lyb-pixi-js 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lyb-pixi.js CHANGED
@@ -7,7 +7,7 @@ Deprecated since v${i}`):(s=s.split(`
7
7
  `).splice(e).join(`
8
8
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
9
9
  Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
10
- Deprecated since v${i}`),console.warn(s))),Hf[t]=!0}function vs(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Jn(i){return i.split("?")[0].split("#")[0]}function kb(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bb(i,t,e){return i.replace(new RegExp(kb(t),"g"),e)}function Db(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let h=0;h<=i.length;++h){if(h<i.length)a=i.charCodeAt(h);else{if(a===47)break;a=47}if(a===47){if(!(r===h-1||n===1))if(r!==h-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const o=e.lastIndexOf("/");if(o!==e.length-1){o===-1?(e="",s=0):(e=e.slice(0,o),s=e.length-1-e.lastIndexOf("/")),r=h,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=h,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,h)}`:e=i.slice(r+1,h),s=h-r-1;r=h,n=0}else a===46&&n!==-1?++n:n=-1}return e}const vt={toPosix(i){return Bb(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){vs(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(vs(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=Jn(this.toPosix(t??z.ADAPTER.getBaseUrl())),r=Jn(this.toPosix(e??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?vt.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(vs(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=Db(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return vs(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){const s=i[e];if(vs(s),s.length>0)if(t===void 0)t=s;else{const r=i[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(vs(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let h=i.length-1;h>=1;--h)if(t=i.charCodeAt(h),t===47){if(!r){s=h;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){vs(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){vs(i),t&&vs(t),i=Jn(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let a=t.length-1,h=-1;for(n=i.length-1;n>=0;--n){const o=i.charCodeAt(n);if(o===47){if(!r){e=n+1;break}}else h===-1&&(r=!1,h=n+1),a>=0&&(o===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=h))}return e===s?s=h:s===-1&&(s=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){vs(i),i=Jn(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const h=i.charCodeAt(a);if(h===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),h===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":i.slice(t,s)},parse(i){vs(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Jn(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let n=-1,a=0,h=-1,o=!0,l=i.length-1,u=0;for(;l>=r;--l){if(e=i.charCodeAt(l),e===47){if(!o){a=l+1;break}continue}h===-1&&(o=!1,h=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&s?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let _h;async function Ob(){return _h??(_h=(async()=>{var n;const i=document.createElement("canvas").getContext("webgl");if(!i)return Re.UNPACK;const t=await new Promise(a=>{const h=document.createElement("video");h.onloadeddata=()=>a(h),h.onerror=()=>a(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!t)return Re.UNPACK;const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);const s=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,s),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t);const r=new Uint8Array(4);return i.readPixels(0,0,1,1,i.RGBA,i.UNSIGNED_BYTE,r),i.deleteFramebuffer(s),i.deleteTexture(e),(n=i.getExtension("WEBGL_lose_context"))==null||n.loseContext(),r[0]<=r[3]?Re.PMA:Re.UNPACK})()),_h}let yh;function Lb(){return typeof yh>"u"&&(yh=function(){var t;const i={stencil:!0,failIfMajorPerformanceCaveat:z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!z.ADAPTER.getWebGLRenderingContext())return!1;const e=z.ADAPTER.createCanvas();let s=e.getContext("webgl",i)||e.getContext("experimental-webgl",i);const r=!!((t=s==null?void 0:s.getContextAttributes())!=null&&t.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch{return!1}}()),yh}var Nb={grad:.9,turn:360,rad:360/(2*Math.PI)},gr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},fe=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},as=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Wf=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},zf=function(i){return{r:as(i.r,0,255),g:as(i.g,0,255),b:as(i.b,0,255),a:as(i.a)}},xh=function(i){return{r:fe(i.r),g:fe(i.g),b:fe(i.b),a:fe(i.a,3)}},Vb=/^#([0-9a-f]{3,8})$/i,na=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},jf=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),h=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(h<0?h+6:h),s:n?a/n*100:0,v:n/255*100,a:r}},qf=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),h=s*(1-(t-n)*e),o=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,h,a,a,o,s][l],g:255*[o,s,s,h,a,a][l],b:255*[a,a,o,s,s,h][l],a:r}},Zf=function(i){return{h:Wf(i.h),s:as(i.s,0,100),l:as(i.l,0,100),a:as(i.a)}},Kf=function(i){return{h:fe(i.h),s:fe(i.s),l:fe(i.l),a:fe(i.a,3)}},Qf=function(i){return qf((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},to=function(i){return{h:(t=jf(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},Ub=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Gb=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$b=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vh={string:[[function(i){var t=Vb.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?fe(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?fe(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Xb.exec(i)||$b.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:zf({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Ub.exec(i)||Gb.exec(i);if(!t)return null;var e,s,r=Zf({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Nb[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Qf(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return gr(t)&&gr(e)&&gr(s)?zf({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!gr(t)||!gr(e)||!gr(s))return null;var a=Zf({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Qf(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!gr(t)||!gr(e)||!gr(s))return null;var a=function(h){return{h:Wf(h.h),s:as(h.s,0,100),v:as(h.v,0,100),a:as(h.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return qf(a)},"hsv"]]},Jf=function(i,t){for(var e=0;e<t.length;e++){var s=t[e][0](i);if(s)return[s,t[e][1]]}return[null,void 0]},Yb=function(i){return typeof i=="string"?Jf(i.trim(),vh.string):typeof i=="object"&&i!==null?Jf(i,vh.object):[null,void 0]},bh=function(i,t){var e=to(i);return{h:e.h,s:as(e.s+100*t,0,100),l:e.l,a:e.a}},wh=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},tp=function(i,t){var e=to(i);return{h:e.h,s:e.s,l:as(e.l+100*t,0,100),a:e.a}},Eh=function(){function i(t){this.parsed=Yb(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return fe(wh(this.rgba),2)},i.prototype.isDark=function(){return wh(this.rgba)<.5},i.prototype.isLight=function(){return wh(this.rgba)>=.5},i.prototype.toHex=function(){return t=xh(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?na(fe(255*n)):"","#"+na(e)+na(s)+na(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return xh(this.rgba)},i.prototype.toRgbString=function(){return t=xh(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return Kf(to(this.rgba))},i.prototype.toHslString=function(){return t=Kf(to(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=jf(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},i.prototype.invert=function(){return Hs({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Hs(bh(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Hs(bh(this.rgba,-t))},i.prototype.grayscale=function(){return Hs(bh(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Hs(tp(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Hs(tp(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Hs({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=to(this.rgba);return typeof t=="number"?Hs({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Hs(t).toHex()},i}(),Hs=function(i){return i instanceof Eh?i:new Eh(i)},ep=[],Hb=function(i){i.forEach(function(t){ep.indexOf(t)<0&&(t(Eh,vh),ep.push(t))})};function Wb(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var h,o,l=s[this.toHex()];if(l)return l;if(a!=null&&a.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new i(e[f]).toRgb();for(var p in e){var m=(h=u,o=n[p],Math.pow(h.r-o.r,2)+Math.pow(h.g-o.g,2)+Math.pow(h.b-o.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(a){var h=a.toLowerCase(),o=h==="transparent"?"#0000":e[h];return o?new i(o).toRgb():null},"name"])}Hb([Wb]);const rn=class wl{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(t){if(t instanceof wl)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t??[];const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=wl.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,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(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const h=wl.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}const a=Hs(t);a.isValid()&&({r:e,g:s,b:r,a:n}=a.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}};rn.shared=new rn,rn.temp=new rn,rn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ct=rn;function sp(i,t=[]){return ot("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),Ct.shared.setValue(i).toRgbArray(t)}function zb(i){return ot("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ct.shared.setValue(i).toHex()}function eo(i){return ot("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ct.shared.setValue(i).toNumber()}function jb(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[W.NORMAL_NPM]=W.NORMAL,i[W.ADD_NPM]=W.ADD,i[W.SCREEN_NPM]=W.SCREEN,t[W.NORMAL]=W.NORMAL_NPM,t[W.ADD]=W.ADD_NPM,t[W.SCREEN]=W.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const rp=jb();function ip(i,t){return rp[t?1:0][i]}function qb(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,r=0;s<e;s+=6,r+=4)t[s+0]=r+0,t[s+1]=r+1,t[s+2]=r+2,t[s+3]=r+0,t[s+4]=r+2,t[s+5]=r+3;return t}function np(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function oa(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function op(i){return!(i&i-1)&&!!i}function ap(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function nn(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;r<n;++r)i[r]=i[r+e];i.length=n}function Dr(i){return i===0?0:i<0?-1:1}let Zb=0;function gi(){return++Zb}const Th=class{constructor(i,t,e,s){this.left=i,this.top=t,this.right=e,this.bottom=s}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Th.EMPTY=new Th(0,0,0,0);let lp=Th;const hp={},Ws=Object.create(null),Or=Object.create(null);class Kb{constructor(t,e,s){this._canvas=z.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||z.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(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function cp(i,t,e){for(let s=0,r=4*e*t;s<t;++s,r+=4)if(i[r+3]!==0)return!1;return!0}function up(i,t,e,s,r){const n=4*t;for(let a=s,h=s*n+4*e;a<=r;++a,h+=n)if(i[h+3]!==0)return!1;return!0}function Qb(i){const{width:t,height:e}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const r=s.getImageData(0,0,t,e).data;let n=0,a=0,h=t-1,o=e-1;for(;a<e&&cp(r,t,a);)++a;if(a===e)return lp.EMPTY;for(;cp(r,t,o);)--o;for(;up(r,t,n,a,o);)++n;for(;up(r,t,h,a,o);)--h;return++h,++o,new lp(n,a,h,o)}function Jb(i){const t=Qb(i),{width:e,height:s}=t;let r=null;if(!t.isEmpty()){const n=i.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(t.left,t.top,e,s)}return{width:e,height:s,data:r}}function t1(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function _r(i,t=1){var s;const e=(s=z.RETINA_PREFIX)==null?void 0:s.exec(i);return e?parseFloat(e[1]):t}var Y=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(Y||{});const Ah=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},dp=(i,t)=>Ah(i).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ah).forEach(t=>{t.type.forEach(e=>{var s,r;return(r=(s=this._removeHandlers)[e])==null?void 0:r.call(s,t)})}),this},add(...i){return i.map(Ah).forEach(t=>{t.type.forEach(e=>{var n,a;const s=this._addHandlers,r=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(r[e]=r[e]||[],(a=r[e])==null||a.push(t))})}),this},handle(i,t,e){var a;const s=this._addHandlers,r=this._removeHandlers;if(s[i]||r[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=t,r[i]=e;const n=this._queue;return n[i]&&((a=n[i])==null||a.forEach(h=>t(h)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>dp(n,e)-dp(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Sh{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}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 e1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
10
+ Deprecated since v${i}`),console.warn(s))),Hf[t]=!0}function vs(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Jn(i){return i.split("?")[0].split("#")[0]}function kb(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bb(i,t,e){return i.replace(new RegExp(kb(t),"g"),e)}function Db(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let h=0;h<=i.length;++h){if(h<i.length)a=i.charCodeAt(h);else{if(a===47)break;a=47}if(a===47){if(!(r===h-1||n===1))if(r!==h-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const o=e.lastIndexOf("/");if(o!==e.length-1){o===-1?(e="",s=0):(e=e.slice(0,o),s=e.length-1-e.lastIndexOf("/")),r=h,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=h,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,h)}`:e=i.slice(r+1,h),s=h-r-1;r=h,n=0}else a===46&&n!==-1?++n:n=-1}return e}const bt={toPosix(i){return Bb(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){vs(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(vs(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=Jn(this.toPosix(t??z.ADAPTER.getBaseUrl())),r=Jn(this.toPosix(e??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?bt.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(vs(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=Db(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return vs(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){const s=i[e];if(vs(s),s.length>0)if(t===void 0)t=s;else{const r=i[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(vs(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let h=i.length-1;h>=1;--h)if(t=i.charCodeAt(h),t===47){if(!r){s=h;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){vs(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){vs(i),t&&vs(t),i=Jn(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let a=t.length-1,h=-1;for(n=i.length-1;n>=0;--n){const o=i.charCodeAt(n);if(o===47){if(!r){e=n+1;break}}else h===-1&&(r=!1,h=n+1),a>=0&&(o===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=h))}return e===s?s=h:s===-1&&(s=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){vs(i),i=Jn(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const h=i.charCodeAt(a);if(h===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),h===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":i.slice(t,s)},parse(i){vs(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Jn(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let n=-1,a=0,h=-1,o=!0,l=i.length-1,u=0;for(;l>=r;--l){if(e=i.charCodeAt(l),e===47){if(!o){a=l+1;break}continue}h===-1&&(o=!1,h=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&s?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let _h;async function Ob(){return _h??(_h=(async()=>{var n;const i=document.createElement("canvas").getContext("webgl");if(!i)return Re.UNPACK;const t=await new Promise(a=>{const h=document.createElement("video");h.onloadeddata=()=>a(h),h.onerror=()=>a(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!t)return Re.UNPACK;const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);const s=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,s),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t);const r=new Uint8Array(4);return i.readPixels(0,0,1,1,i.RGBA,i.UNSIGNED_BYTE,r),i.deleteFramebuffer(s),i.deleteTexture(e),(n=i.getExtension("WEBGL_lose_context"))==null||n.loseContext(),r[0]<=r[3]?Re.PMA:Re.UNPACK})()),_h}let yh;function Lb(){return typeof yh>"u"&&(yh=function(){var t;const i={stencil:!0,failIfMajorPerformanceCaveat:z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!z.ADAPTER.getWebGLRenderingContext())return!1;const e=z.ADAPTER.createCanvas();let s=e.getContext("webgl",i)||e.getContext("experimental-webgl",i);const r=!!((t=s==null?void 0:s.getContextAttributes())!=null&&t.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch{return!1}}()),yh}var Nb={grad:.9,turn:360,rad:360/(2*Math.PI)},gr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},fe=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},as=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Wf=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},zf=function(i){return{r:as(i.r,0,255),g:as(i.g,0,255),b:as(i.b,0,255),a:as(i.a)}},xh=function(i){return{r:fe(i.r),g:fe(i.g),b:fe(i.b),a:fe(i.a,3)}},Vb=/^#([0-9a-f]{3,8})$/i,na=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},jf=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),h=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(h<0?h+6:h),s:n?a/n*100:0,v:n/255*100,a:r}},qf=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),h=s*(1-(t-n)*e),o=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,h,a,a,o,s][l],g:255*[o,s,s,h,a,a][l],b:255*[a,a,o,s,s,h][l],a:r}},Zf=function(i){return{h:Wf(i.h),s:as(i.s,0,100),l:as(i.l,0,100),a:as(i.a)}},Kf=function(i){return{h:fe(i.h),s:fe(i.s),l:fe(i.l),a:fe(i.a,3)}},Qf=function(i){return qf((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},to=function(i){return{h:(t=jf(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},Ub=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Gb=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$b=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vh={string:[[function(i){var t=Vb.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?fe(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?fe(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Xb.exec(i)||$b.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:zf({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Ub.exec(i)||Gb.exec(i);if(!t)return null;var e,s,r=Zf({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Nb[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Qf(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return gr(t)&&gr(e)&&gr(s)?zf({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!gr(t)||!gr(e)||!gr(s))return null;var a=Zf({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Qf(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!gr(t)||!gr(e)||!gr(s))return null;var a=function(h){return{h:Wf(h.h),s:as(h.s,0,100),v:as(h.v,0,100),a:as(h.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return qf(a)},"hsv"]]},Jf=function(i,t){for(var e=0;e<t.length;e++){var s=t[e][0](i);if(s)return[s,t[e][1]]}return[null,void 0]},Yb=function(i){return typeof i=="string"?Jf(i.trim(),vh.string):typeof i=="object"&&i!==null?Jf(i,vh.object):[null,void 0]},bh=function(i,t){var e=to(i);return{h:e.h,s:as(e.s+100*t,0,100),l:e.l,a:e.a}},wh=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},tp=function(i,t){var e=to(i);return{h:e.h,s:e.s,l:as(e.l+100*t,0,100),a:e.a}},Eh=function(){function i(t){this.parsed=Yb(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return fe(wh(this.rgba),2)},i.prototype.isDark=function(){return wh(this.rgba)<.5},i.prototype.isLight=function(){return wh(this.rgba)>=.5},i.prototype.toHex=function(){return t=xh(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?na(fe(255*n)):"","#"+na(e)+na(s)+na(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return xh(this.rgba)},i.prototype.toRgbString=function(){return t=xh(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return Kf(to(this.rgba))},i.prototype.toHslString=function(){return t=Kf(to(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=jf(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},i.prototype.invert=function(){return Hs({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Hs(bh(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Hs(bh(this.rgba,-t))},i.prototype.grayscale=function(){return Hs(bh(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Hs(tp(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Hs(tp(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Hs({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=to(this.rgba);return typeof t=="number"?Hs({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Hs(t).toHex()},i}(),Hs=function(i){return i instanceof Eh?i:new Eh(i)},ep=[],Hb=function(i){i.forEach(function(t){ep.indexOf(t)<0&&(t(Eh,vh),ep.push(t))})};function Wb(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var h,o,l=s[this.toHex()];if(l)return l;if(a!=null&&a.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new i(e[f]).toRgb();for(var p in e){var m=(h=u,o=n[p],Math.pow(h.r-o.r,2)+Math.pow(h.g-o.g,2)+Math.pow(h.b-o.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(a){var h=a.toLowerCase(),o=h==="transparent"?"#0000":e[h];return o?new i(o).toRgb():null},"name"])}Hb([Wb]);const rn=class wl{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(t){if(t instanceof wl)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t??[];const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=wl.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,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(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const h=wl.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}const a=Hs(t);a.isValid()&&({r:e,g:s,b:r,a:n}=a.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}};rn.shared=new rn,rn.temp=new rn,rn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ct=rn;function sp(i,t=[]){return ot("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),Ct.shared.setValue(i).toRgbArray(t)}function zb(i){return ot("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ct.shared.setValue(i).toHex()}function eo(i){return ot("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ct.shared.setValue(i).toNumber()}function jb(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[W.NORMAL_NPM]=W.NORMAL,i[W.ADD_NPM]=W.ADD,i[W.SCREEN_NPM]=W.SCREEN,t[W.NORMAL]=W.NORMAL_NPM,t[W.ADD]=W.ADD_NPM,t[W.SCREEN]=W.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const rp=jb();function ip(i,t){return rp[t?1:0][i]}function qb(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,r=0;s<e;s+=6,r+=4)t[s+0]=r+0,t[s+1]=r+1,t[s+2]=r+2,t[s+3]=r+0,t[s+4]=r+2,t[s+5]=r+3;return t}function np(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function oa(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function op(i){return!(i&i-1)&&!!i}function ap(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function nn(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;r<n;++r)i[r]=i[r+e];i.length=n}function Dr(i){return i===0?0:i<0?-1:1}let Zb=0;function gi(){return++Zb}const Th=class{constructor(i,t,e,s){this.left=i,this.top=t,this.right=e,this.bottom=s}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Th.EMPTY=new Th(0,0,0,0);let lp=Th;const hp={},Ws=Object.create(null),Or=Object.create(null);class Kb{constructor(t,e,s){this._canvas=z.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||z.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(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function cp(i,t,e){for(let s=0,r=4*e*t;s<t;++s,r+=4)if(i[r+3]!==0)return!1;return!0}function up(i,t,e,s,r){const n=4*t;for(let a=s,h=s*n+4*e;a<=r;++a,h+=n)if(i[h+3]!==0)return!1;return!0}function Qb(i){const{width:t,height:e}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const r=s.getImageData(0,0,t,e).data;let n=0,a=0,h=t-1,o=e-1;for(;a<e&&cp(r,t,a);)++a;if(a===e)return lp.EMPTY;for(;cp(r,t,o);)--o;for(;up(r,t,n,a,o);)++n;for(;up(r,t,h,a,o);)--h;return++h,++o,new lp(n,a,h,o)}function Jb(i){const t=Qb(i),{width:e,height:s}=t;let r=null;if(!t.isEmpty()){const n=i.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(t.left,t.top,e,s)}return{width:e,height:s,data:r}}function t1(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function _r(i,t=1){var s;const e=(s=z.RETINA_PREFIX)==null?void 0:s.exec(i);return e?parseFloat(e[1]):t}var Y=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(Y||{});const Ah=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},dp=(i,t)=>Ah(i).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ah).forEach(t=>{t.type.forEach(e=>{var s,r;return(r=(s=this._removeHandlers)[e])==null?void 0:r.call(s,t)})}),this},add(...i){return i.map(Ah).forEach(t=>{t.type.forEach(e=>{var n,a;const s=this._addHandlers,r=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(r[e]=r[e]||[],(a=r[e])==null||a.push(t))})}),this},handle(i,t,e){var a;const s=this._addHandlers,r=this._removeHandlers;if(s[i]||r[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=t,r[i]=e;const n=this._queue;return n[i]&&((a=n[i])==null||a.forEach(h=>t(h)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>dp(n,e)-dp(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Sh{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}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 e1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
11
  `);function s1(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
12
12
  else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function r1(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=e1.replace(/%forloop%/gi,s1(i));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}const Ch=0,Ih=1,Ph=2,Rh=3,Mh=4,Fh=5;class zs{constructor(){this.data=0,this.blendMode=W.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ch)}set blend(t){!!(this.data&1<<Ch)!==t&&(this.data^=1<<Ch)}get offsets(){return!!(this.data&1<<Ih)}set offsets(t){!!(this.data&1<<Ih)!==t&&(this.data^=1<<Ih)}get culling(){return!!(this.data&1<<Ph)}set culling(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph)}get depthTest(){return!!(this.data&1<<Rh)}set depthTest(t){!!(this.data&1<<Rh)!==t&&(this.data^=1<<Rh)}get depthMask(){return!!(this.data&1<<Fh)}set depthMask(t){!!(this.data&1<<Fh)!==t&&(this.data^=1<<Fh)}get clockwiseFrontFace(){return!!(this.data&1<<Mh)}set clockwiseFrontFace(t){!!(this.data&1<<Mh)!==t&&(this.data^=1<<Mh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==W.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new zs;return t.depthTest=!1,t.blend=!0,t}}zs.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const kh=[];function fp(i,t){if(!i)return null;let e="";if(typeof i=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);s&&(e=s[1].toLowerCase())}for(let s=kh.length-1;s>=0;--s){const r=kh[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class bs{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,a,h,o){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,s,r,n,a,h,o);return u===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 e!==-1&&(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 this.items.length===0}get name(){return this._name}}Object.defineProperties(bs.prototype,{dispatch:{value:bs.prototype.emit},run:{value:bs.prototype.emit}});class so{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new bs("setRealSize"),this.onUpdate=new bs("update"),this.onError=new bs("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class aa extends so{constructor(t,e){const{width:s,height:r}=e||{};if(!s||!r)throw new Error("BufferResource width or height invalid");super(s,r),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,s){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,r.texImage2D(e.target,0,s.internalFormat,n,a,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||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 i1={scaleMode:je.NEAREST,alphaMode:Re.NPM},Bh=class On extends Gs{constructor(t=null,e=null){super(),e=Object.assign({},On.defaultOptions,e);const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:a,width:h,height:o,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof so)&&(t=fp(t,p),t.internal=!0),this.resolution=f||z.RESOLUTION,this.width=Math.round((h||0)*this.resolution)/this.resolution,this.height=Math.round((o||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=gi(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=h>0&&o>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=op(this.realWidth)&&op(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(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 Or[this.cacheId],delete Ws[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),On.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,e,s=z.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gi()}`}n=t._pixiId}let a=Or[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new On(t,e),a.cacheId=n,On.addToCache(a,n)),a}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new aa(t,{width:e,height:s,...r==null?void 0:r.resourceOptions});let a,h;return t instanceof Float32Array?(a=G.RGBA,h=tt.FLOAT):t instanceof Int32Array?(a=G.RGBA_INTEGER,h=tt.INT):t instanceof Uint32Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_INT):t instanceof Int16Array?(a=G.RGBA_INTEGER,h=tt.SHORT):t instanceof Uint16Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_SHORT):t instanceof Int8Array?(a=G.RGBA,h=tt.BYTE):(a=G.RGBA,h=tt.UNSIGNED_BYTE),n.internal=!0,new On(n,Object.assign({},i1,{type:h,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Or[e]&&Or[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Or[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Or[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Or[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Or[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Bh.defaultOptions={mipmap:xs.POW2,anisotropicLevel:0,scaleMode:je.LINEAR,wrapMode:Fr.CLAMP,alphaMode:Re.UNPACK,target:Wi.TEXTURE_2D,format:G.RGBA,type:tt.UNSIGNED_BYTE},Bh._globalBatch=0;let et=Bh;class Dh{constructor(){this.texArray=null,this.blend=0,this.type=ys.TRIANGLES,this.start=0,this.size=0,this.data=null}}let n1=0;class Jt{constructor(t,e=!0,s=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=s,this.static=e,this.id=n1++,this.disposeRunner=new bs("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?Vs.ELEMENT_ARRAY_BUFFER:Vs.ARRAY_BUFFER}get index(){return this.type===Vs.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Jt(t)}}class la{constructor(t,e=0,s=!1,r=tt.FLOAT,n,a,h,o=1){this.buffer=t,this.size=e,this.normalized=s,this.type=r,this.stride=n,this.start=a,this.instance=h,this.divisor=o}destroy(){this.buffer=null}static from(t,e,s,r,n){return new la(t,e,s,r,n)}}const o1={Float32Array,Uint32Array,Int32Array,Uint8Array};function a1(i,t){let e=0,s=0;const r={};for(let o=0;o<i.length;o++)s+=t[o],e+=i[o].length;const n=new ArrayBuffer(e*4);let a=null,h=0;for(let o=0;o<i.length;o++){const l=t[o],u=i[o],c=np(u);r[c]||(r[c]=new o1[c](n)),a=r[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+h,p=d%l;a[f+p]=u[d]}h+=l}return new Float32Array(n)}const pp={5126:4,5123:2,5121:1};let l1=0;const h1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Lr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=l1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new bs("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,r=!1,n,a,h,o=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Jt||(e instanceof Array&&(e=new Float32Array(e)),e=new Jt(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,s,r,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new la(u,s,r,n,a,h,o),this.instanced=this.instanced||o,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Jt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Jt(t)),t.type=Vs.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],s=new Jt;let r;for(r in this.attributes){const n=this.attributes[r],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*pp[n.type]/4),n.buffer=0}for(s.data=a1(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[s],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 Lr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Jt(this.buffers[e].data.slice(0));for(const e in this.attributes){const s=this.attributes[e];t.attributes[e]=new la(s.buffer,s.size,s.normalized,s.type,s.stride,s.start,s.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Vs.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Lr,s=[],r=[],n=[];let a;for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)r[o]=r[o]||0,r[o]+=a.buffers[o].data.length,n[o]=0}for(let h=0;h<a.buffers.length;h++)s[h]=new h1[np(a.buffers[h].data)](r[h]),e.buffers[h]=new Jt(s[h]);for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)s[o].set(a.buffers[o].data,n[o]),n[o]+=a.buffers[o].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Vs.ELEMENT_ARRAY_BUFFER;let h=0,o=0,l=0,u=0;for(let c=0;c<a.buffers.length;c++)if(a.buffers[c]!==a.indexBuffer){u=c;break}for(const c in a.attributes){const d=a.attributes[c];(d.buffer|0)===u&&(o+=d.size*pp[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=h;h+=t[c].buffers[u].data.length/o,l+=d.length}}return e}}class mp extends Lr{constructor(t=!1){super(),this._buffer=new Jt(null,t,!1),this._indexBuffer=new Jt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,tt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,tt.FLOAT).addAttribute("aColor",this._buffer,4,!0,tt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,tt.FLOAT).addIndex(this._indexBuffer)}}const ha=Math.PI*2,c1=180/Math.PI,Oh=Math.PI/180;var xe=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(xe||{});class st{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new st(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}}st.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const ca=[new st,new st,new st,new st];let rt=class pd{constructor(t=0,e=0,s=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(r),this.type=xe.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 pd(0,0,0,0)}clone(){return new pd(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?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const T=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=T)return!1;const A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}const s=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=s||a<=n)return!1;const h=ca[0].set(t.left,t.top),o=ca[1].set(t.left,t.bottom),l=ca[2].set(t.right,t.top),u=ca[3].set(t.right,t.bottom);if(l.x<=h.x||o.y<=h.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(h,h),e.apply(o,o),e.apply(l,l),e.apply(u,u),Math.max(h.x,o.x,l.x,u.x)<=s||Math.min(h.x,o.x,l.x,u.x)>=r||Math.max(h.y,o.y,l.y,u.y)<=n||Math.min(h.y,o.y,l.y,u.y)>=a))return!1;const d=c*(o.y-h.y),f=c*(h.x-o.x),p=d*s+f*n,m=d*r+f*n,g=d*s+f*a,_=d*r+f*a;if(Math.max(p,m,g,_)<=d*h.x+f*h.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;const x=c*(h.y-l.y),y=c*(l.x-h.x),v=x*s+y*n,b=x*r+y*n,w=x*s+y*a,E=x*r+y*a;return!(Math.max(v,b,w,E)<=x*h.x+y*h.y||Math.min(v,b,w,E)>=x*u.x+y*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=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=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}};rt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ua{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=xe.CIRC}clone(){return new ua(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=s}getBounds(){return new rt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}ua.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class da{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=xe.ELIP}clone(){return new da(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,r=(e-this.y)/this.height;return s*=s,r*=r,s+r<=1}getBounds(){return new rt(this.x-this.width,this.y-this.height,this.width,this.height)}}da.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Nr{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let r=0,n=e.length;r<n;r++)s.push(e[r].x,e[r].y);e=s}this.points=e,this.type=xe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Nr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let s=!1;const r=this.points.length/2;for(let n=0,a=r-1;n<r;a=n++){const h=this.points[n*2],o=this.points[n*2+1],l=this.points[a*2],u=this.points[a*2+1];o>e!=u>e&&t<(l-h)*((e-o)/(u-o))+h&&(s=!s)}return s}}Nr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};class fa{constructor(t=0,e=0,s=0,r=0,n=20){this.x=t,this.y=e,this.width=s,this.height=r,this.radius=n,this.type=xe.RREC}clone(){return new fa(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let r=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(r*r+n*n<=a||(r=t-(this.x+this.width-s),r*r+n*n<=a)||(n=e-(this.y+this.height-s),r*r+n*n<=a)||(r=t-(this.x+s),r*r+n*n<=a))return!0}return!1}}fa.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Rt{constructor(t=1,e=0,s=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,r,n,a){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new st;const s=t.x,r=t.y;return e.x=this.a*s+this.c*r+this.tx,e.y=this.b*s+this.d*r+this.ty,e}applyInverse(t,e){e=e||new st;const s=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*s*r+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*r+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*s,this.b=r*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=a*e-this.ty*s,this.ty=a*s+this.ty*e,this}append(t){const e=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,r,n,a,h,o,l){return this.a=Math.cos(h+l)*n,this.b=Math.sin(h+l)*n,this.c=-Math.sin(h-o)*a,this.d=Math.cos(h-o)*a,this.tx=t-(s*this.a+r*this.c),this.ty=e-(s*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,r=this.c,n=this.d,a=t.pivot,h=-Math.atan2(-r,n),o=Math.atan2(s,e),l=Math.abs(h+o);return l<1e-5||Math.abs(ha-l)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=h,t.skew.y=o),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(a.x*e+a.y*r),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,a=t*r-e*s;return this.a=r/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,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 Rt;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 Rt}static get TEMP_MATRIX(){return new Rt}}Rt.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 _i=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],yi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Lh=[],gp=[],pa=Math.sign;function u1(){for(let i=0;i<16;i++){const t=[];Lh.push(t);for(let e=0;e<16;e++){const s=pa(_i[i]*_i[e]+xi[i]*yi[e]),r=pa(yi[i]*_i[e]+vi[i]*yi[e]),n=pa(_i[i]*xi[e]+xi[i]*vi[e]),a=pa(yi[i]*xi[e]+vi[i]*vi[e]);for(let h=0;h<16;h++)if(_i[h]===s&&yi[h]===r&&xi[h]===n&&vi[h]===a){t.push(h);break}}}for(let i=0;i<16;i++){const t=new Rt;t.set(_i[i],yi[i],xi[i],vi[i],0,0),gp.push(t)}}u1();const Nt={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:i=>_i[i],uY:i=>yi[i],vX:i=>xi[i],vY:i=>vi[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Lh[i][t],sub:(i,t)=>Lh[i][Nt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Nt.S:Nt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Nt.E:Nt.W:t>0?i>0?Nt.SE:Nt.SW:i>0?Nt.NE:Nt.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=gp[Nt.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class js{constructor(t,e,s=0,r=0){this._x=s,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new js(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))}}js.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Nh=class{constructor(){this.worldTransform=new Rt,this.localTransform=new Rt,this.position=new js(this.onChange,this,0,0),this.scale=new js(this.onChange,this,1,1),this.pivot=new js(this.onChange,this,0,0),this.skew=new js(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 i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){const e=i.worldTransform,s=this.worldTransform;s.a=t.a*e.a+t.b*e.c,s.b=t.a*e.b+t.b*e.d,s.c=t.c*e.a+t.d*e.c,s.d=t.c*e.b+t.d*e.d,s.tx=t.tx*e.a+t.ty*e.c+e.tx,s.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Nh.IDENTITY=new Nh;let ma=Nh;ma.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}) ]`};var d1=`varying vec2 vTextureCoord;
13
13
 
@@ -863,8 +863,8 @@ void main()
863
863
 
864
864
  gl_FragColor = color;
865
865
  }
866
- `;class Lw extends pe{constructor(t=.5,e=Math.random()){super(sm,Ow,{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 dm={AlphaFilter:Ew,BlurFilter:um,BlurFilterPass:Jh,ColorMatrixFilter:hn,DisplacementFilter:Fw,FXAAFilter:Dw,NoiseFilter:Lw};Object.entries(dm).forEach(([i,t])=>{Object.defineProperty(dm,i,{get(){return ot("7.1.0",`filters.${i} has moved to ${i}`),t}})});class Nw{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||(Tt.system.add(this.tickerUpdate,this,Vr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Tt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||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())}}const Ur=new Nw;class lo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=lo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new st,this.page=new st,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,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,s,r,n){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 Pa extends lo{constructor(){super(...arguments),this.client=new st,this.movement=new st,this.offset=new st,this.global=new st,this.screen=new st}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}getLocalPosition(t,e,s){return t.worldTransform.applyInverse(s||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,s,r,n,a,h,o,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Es extends Pa{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class cn extends Pa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}cn.DOM_DELTA_PIXEL=0,cn.DOM_DELTA_LINE=1,cn.DOM_DELTA_PAGE=2;const Vw=2048,Uw=new st,tc=new st;class Gw{constructor(t){this.dispatch=new Gs,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,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((s,r)=>s.priority-r.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,r=e.length;s<r;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ur.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[s](this.rootTarget,this.rootTarget.eventMode,Uw.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=s.length-1;r<n;r++)if(t.currentTarget=s[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=s.length-2;r>=0;r--)if(t.currentTarget=s[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s<Vw&&t!==this.rootTarget;s++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,s,r,n,a=!1){let h=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ur.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,r,n,a||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),h=!0}}}const o=this._isInteractive(e),l=t.isInteractive();return o&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:h?this._hitElements:o&&!n(t,s)&&r(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,r,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ur.pauseUpdate=!1),t.interactiveChildren&&t.children){const o=t.children;for(let l=o.length-1;l>=0;l--){const u=o[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,r,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const a=this._isInteractive(e),h=t.isInteractive();return a&&r(t,s)?h?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,tc),!t.hitArea.contains(tc.x,tc.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((s=r.containsPoint)!=null&&s.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,a;e=e??t.type;const s=`on${e}`;(a=(n=t.currentTarget)[s])==null||a.call(n,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 Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var o,l;if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const s=e.pointerType==="mouse"||e.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((o=r.overTargets)==null?void 0:o.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),s&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),s&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),s&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),s&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}const a=[],h=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),h&&a.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),h&&a.push("globaltouchmove")),s&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),h&&a.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),a.length>0&&this.all(e,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),r=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),r&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(a=s.target)==null?void 0:a.cursor);const n=this.clonePointerEvent(s,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const s=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.dispatchEvent(s,h?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let h=n;for(;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.notifyTarget(s,o?"rightupoutside":"mouseupoutside")}h=h.parent}delete r.pressTargetsByButton[t.button],a=h}if(a){const h=this.clonePointerEvent(s,"click");h.target=a,h.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});const o=r.clicksByButton[t.button];if(o.target===h.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=h.target,o.timeStamp=e,h.detail=o.clickCount,h.pointerType==="mouse"){const l=h.button===2;this.dispatchEvent(h,l?"rightclick":"click")}else h.pointerType==="touch"&&this.dispatchEvent(h,"tap");this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(s){let n=s;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof cn)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;s<t.length&&t[s].parent===e;s++)e=t[s];return e}createPointerEvent(t,e,s){const r=this.allocateEvent(Es);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=s??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}createWheelEvent(t){const e=this.allocateEvent(cn);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 s=this.allocateEvent(Es);return s.nativeEvent=t.nativeEvent,s.originalEvent=t.originalEvent,this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.target=t.target,s.path=t.composedPath().slice(),s.type=e??s.type,s}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Es&&e instanceof Es&&(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.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Pa&&e instanceof Pa&&(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 s=t.currentTarget._events[e];if(s&&t.currentTarget.isInteractive())if("fn"in s)s.once&&t.currentTarget.removeListener(e,s.fn,void 0,!0),s.fn.call(s.context,t);else for(let r=0,n=s.length;r<n&&!t.propagationImmediatelyStopped;r++)s[r].once&&t.currentTarget.removeListener(e,s[r].fn,void 0,!0),s[r].fn.call(s[r].context,t)}}const Xw=1,$w={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},ec=class xd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Gw(null),Ur.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Es(null),this.rootWheelEvent=new cn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...xd.defaultEventFeatures},{set:(e,s,r)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[s]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:s}=this.renderer;this.setTargetElement(e),this.resolution=s,xd._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.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 s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s);break}else e&&typeof t=="string"&&!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 s=0,r=e.length;s<r;s++){const n=e[s],a=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ur.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,r=e.length;s<r;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(n)}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 s=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n<a;n++){const h=this.bootstrapEvent(this.rootPointerEvent,r[n]);h.type+=s,this.rootBoundary.mapEvent(h)}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 s=0,r=e.length;s<r;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(n)}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,Ur.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ur.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;Ur.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,s){const r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-r.left)*(this.domElement.width/r.width)*n,t.y=(s-r.top)*(this.domElement.height/r.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,r=t.changedTouches.length;s<r;s++){const n=t.changedTouches[s];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const s=t;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=Xw),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}else e.push(t);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,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=$w[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}};ec.extension={name:"events",type:[Y.RendererSystem,Y.CanvasRendererSystem]},ec.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let sc=ec;K.add(sc);function fm(i){return i==="dynamic"||i==="static"}const Yw={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??fm(sc.defaultEventMode)},set interactive(i){ot("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??sc.defaultEventMode},set eventMode(i){this._internalInteractive=fm(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;i=s?`${i}capture`:i;const h=typeof t=="function"?t:t.handleEvent,o=this;r&&r.addEventListener("abort",()=>{o.off(i,h,a)}),n?o.once(i,h,a):o.on(i,h,a)},removeEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;i=s?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,r)},dispatchEvent(i){if(!(i instanceof lo))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};Vt.mixin(Yw);const Hw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Vt.mixin(Hw);const Ww=9,Ra=100,zw=0,jw=0,pm=2,mm=1,qw=-1e3,Zw=-1e3,Kw=2;class gm{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,(fr.tablet||fr.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.position="absolute",e.style.top=`${zw}px`,e.style.left=`${jw}px`,e.style.zIndex=pm.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=`${mm}px`,t.style.height=`${mm}px`,t.style.position="absolute",t.style.top=`${qw}px`,t.style.left=`${Zw}px`,t.style.zIndex=Kw.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(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let s=0;s<e.length;s++)this.updateAccessibleObjects(e[s])}update(){const t=performance.now();if(fr.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:s,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:h,resolution:o}=this.renderer,l=r/a*o,u=n/h*o;let c=this.div;c.style.left=`${e}px`,c.style.top=`${s}px`,c.style.width=`${a}px`,c.style.height=`${h}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,nn(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{c=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(c.style.left=`${(m.tx+p.x*m.a)*l}px`,c.style.top=`${(m.ty+p.y*m.d)*u}px`,c.style.width=`${p.width*m.a*l}px`,c.style.height=`${p.height*m.d*u}px`):(p=f.getBounds(),this.capHitArea(p),c.style.left=`${p.x*l}px`,c.style.top=`${p.y*u}px`,c.style.width=`${p.width*l}px`,c.style.height=`${p.height*u}px`,c.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(c.title=f.accessibleTitle),c.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&c.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==c.title||f.tabIndex!==c.tabIndex)&&(c.title=f.accessibleTitle,c.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(c))}}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:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=pm.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&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new lo(r),{target:s});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>r.dispatchEvent(n,a))}_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){t.keyCode===Ww&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||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}}gm.extension={name:"accessibility",type:[Y.RendererPlugin,Y.CanvasRendererPlugin]},K.add(gm);const _m=class vd{constructor(t){this.stage=new Bt,t=Object.assign({forceCanvas:!1},t),this.renderer=lw(t),vd._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const s=vd._plugins.slice(0);s.reverse(),s.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};_m._plugins=[];let Qw=_m;K.handleByList(Y.Application,Qw._plugins);class ym{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(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;this.cancelResize();let e,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,s=n}this.renderer.resize(e,s),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}}ym.extension=Y.Application,K.add(ym);const xm={loader:Y.LoadParser,resolver:Y.ResolveParser,cache:Y.CacheParser,detection:Y.DetectionParser};K.handle(Y.Asset,i=>{const t=i.ref;Object.entries(xm).filter(([e])=>!!t[e]).forEach(([e,s])=>K.add(Object.assign(t[e],{extension:t[e].extension??s})))},i=>{const t=i.ref;Object.keys(xm).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});class Jw{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s<e;s++)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 un(i,t){if(Array.isArray(t)){for(const e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}function Le(i,t){const e=i.split("?")[0],s=vt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const Ts=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(s=>typeof s=="string"||e?t(s):s):i),rc=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function vm(i,t,e,s,r){const n=t[e];for(let a=0;a<n.length;a++){const h=n[a];e<t.length-1?vm(i.replace(s[e],h),t,e+1,s,r):r.push(i.replace(s[e],h))}}function tE(i){const t=/\{(.*?)\}/g,e=i.match(t),s=[];if(e){const r=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");r.push(a)}),vm(i,r,0,e,s)}else s.push(i);return s}const Ma=i=>!Array.isArray(i);class eE{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=Ts(t);let r;for(let h=0;h<this.parsers.length;h++){const o=this.parsers[h];if(o.test(e)){r=o.getCacheableAssets(s,e);break}}r||(r={},s.forEach(h=>{r[h]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:s};if(s.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{this._cache.has(h)&&this._cache.get(h)!==e&&console.warn("[Cache] already has key:",h),this._cache.set(h,r[h])}),e instanceof q){const h=e;s.forEach(o=>{h.baseTexture!==q.EMPTY.baseTexture&&et.addToCache(h.baseTexture,o),q.addToCache(h,o)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}}const Ai=new eE;class sE{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var a,h;let r=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];if(l.load&&((a=l.test)!=null&&a.call(l,t,e,this))){n=l;break}}if(!n)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 n.load(t,e,this),s.parser=n;for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];l.parse&&l.parse&&await((h=l.testParse)==null?void 0:h.call(l,r,e,this))&&(r=await l.parse(r,e,this)||r,s.parser=l)}return r})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const r={},n=Ma(t),a=Ts(t,l=>({alias:[l],src:l})),h=a.length,o=a.map(async l=>{const u=vt.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),r[l.src]=await this.promiseCache[u].promise,e&&e(++s/h)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}.
867
- ${c}`)}});return await Promise.all(o),n?r[a[0].src]:r}async unload(t){const e=Ts(t,s=>({alias:[s],src:s})).map(async s=>{var a,h;const r=vt.toAbsolute(s.src),n=this.promiseCache[r];if(n){const o=await n.promise;delete this.promiseCache[r],(h=(a=n.parser)==null?void 0:a.unload)==null||h.call(a,o,s,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 Ne=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Ne||{});const rE=".json",iE="application/json",nE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadJson",test(i){return un(i,iE)||Le(i,rE)},async load(i){return await(await z.ADAPTER.fetch(i)).json()}};K.add(nE);const oE=".txt",aE="text/plain",lE={name:"loadTxt",extension:{type:Y.LoadParser,priority:Ne.Low},test(i){return un(i,aE)||Le(i,oE)},async load(i){return await(await z.ADAPTER.fetch(i)).text()}};K.add(lE);const hE=["normal","bold","100","200","300","400","500","600","700","800","900"],cE=[".ttf",".otf",".woff",".woff2"],uE=["font/ttf","font/otf","font/woff","font/woff2"],dE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function fE(i){const t=vt.extname(i),e=vt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(dE)){s=!1;break}let r=e.join(" ");return s||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const pE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function mE(i){return pE.test(i)?i:encodeURI(i)}const gE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadWebFont",test(i){return un(i,uE)||Le(i,cE)},async load(i,t){var s,r,n;const e=z.ADAPTER.getFontFaceSet();if(e){const a=[],h=((s=t.data)==null?void 0:s.family)??fE(i),o=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(u=>hE.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<o.length;u++){const c=o[u],d=new FontFace(h,`url(${mE(i)})`,{...l,weight:c});await d.load(),e.add(d),a.push(d)}return a.length===1?a[0]:a}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};K.add(gE);const _E=`(function() {
866
+ `;class Lw extends pe{constructor(t=.5,e=Math.random()){super(sm,Ow,{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 dm={AlphaFilter:Ew,BlurFilter:um,BlurFilterPass:Jh,ColorMatrixFilter:hn,DisplacementFilter:Fw,FXAAFilter:Dw,NoiseFilter:Lw};Object.entries(dm).forEach(([i,t])=>{Object.defineProperty(dm,i,{get(){return ot("7.1.0",`filters.${i} has moved to ${i}`),t}})});class Nw{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||(Tt.system.add(this.tickerUpdate,this,Vr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Tt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||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())}}const Ur=new Nw;class lo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=lo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new st,this.page=new st,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,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,s,r,n){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 Pa extends lo{constructor(){super(...arguments),this.client=new st,this.movement=new st,this.offset=new st,this.global=new st,this.screen=new st}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}getLocalPosition(t,e,s){return t.worldTransform.applyInverse(s||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,s,r,n,a,h,o,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Es extends Pa{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class cn extends Pa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}cn.DOM_DELTA_PIXEL=0,cn.DOM_DELTA_LINE=1,cn.DOM_DELTA_PAGE=2;const Vw=2048,Uw=new st,tc=new st;class Gw{constructor(t){this.dispatch=new Gs,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,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((s,r)=>s.priority-r.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,r=e.length;s<r;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ur.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[s](this.rootTarget,this.rootTarget.eventMode,Uw.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=s.length-1;r<n;r++)if(t.currentTarget=s[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=s.length-2;r>=0;r--)if(t.currentTarget=s[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s<Vw&&t!==this.rootTarget;s++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,s,r,n,a=!1){let h=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ur.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,r,n,a||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),h=!0}}}const o=this._isInteractive(e),l=t.isInteractive();return o&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:h?this._hitElements:o&&!n(t,s)&&r(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,r,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ur.pauseUpdate=!1),t.interactiveChildren&&t.children){const o=t.children;for(let l=o.length-1;l>=0;l--){const u=o[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,r,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const a=this._isInteractive(e),h=t.isInteractive();return a&&r(t,s)?h?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,tc),!t.hitArea.contains(tc.x,tc.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((s=r.containsPoint)!=null&&s.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,a;e=e??t.type;const s=`on${e}`;(a=(n=t.currentTarget)[s])==null||a.call(n,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 Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var o,l;if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const s=e.pointerType==="mouse"||e.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((o=r.overTargets)==null?void 0:o.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),s&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),s&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),s&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),s&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}const a=[],h=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),h&&a.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),h&&a.push("globaltouchmove")),s&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),h&&a.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),a.length>0&&this.all(e,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),r=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),r&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(a=s.target)==null?void 0:a.cursor);const n=this.clonePointerEvent(s,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const s=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.dispatchEvent(s,h?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let h=n;for(;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.notifyTarget(s,o?"rightupoutside":"mouseupoutside")}h=h.parent}delete r.pressTargetsByButton[t.button],a=h}if(a){const h=this.clonePointerEvent(s,"click");h.target=a,h.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});const o=r.clicksByButton[t.button];if(o.target===h.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=h.target,o.timeStamp=e,h.detail=o.clickCount,h.pointerType==="mouse"){const l=h.button===2;this.dispatchEvent(h,l?"rightclick":"click")}else h.pointerType==="touch"&&this.dispatchEvent(h,"tap");this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(s){let n=s;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof cn)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;s<t.length&&t[s].parent===e;s++)e=t[s];return e}createPointerEvent(t,e,s){const r=this.allocateEvent(Es);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=s??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}createWheelEvent(t){const e=this.allocateEvent(cn);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 s=this.allocateEvent(Es);return s.nativeEvent=t.nativeEvent,s.originalEvent=t.originalEvent,this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.target=t.target,s.path=t.composedPath().slice(),s.type=e??s.type,s}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Es&&e instanceof Es&&(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.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Pa&&e instanceof Pa&&(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 s=t.currentTarget._events[e];if(s&&t.currentTarget.isInteractive())if("fn"in s)s.once&&t.currentTarget.removeListener(e,s.fn,void 0,!0),s.fn.call(s.context,t);else for(let r=0,n=s.length;r<n&&!t.propagationImmediatelyStopped;r++)s[r].once&&t.currentTarget.removeListener(e,s[r].fn,void 0,!0),s[r].fn.call(s[r].context,t)}}const Xw=1,$w={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},ec=class xd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Gw(null),Ur.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Es(null),this.rootWheelEvent=new cn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...xd.defaultEventFeatures},{set:(e,s,r)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[s]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:s}=this.renderer;this.setTargetElement(e),this.resolution=s,xd._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.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 s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s);break}else e&&typeof t=="string"&&!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 s=0,r=e.length;s<r;s++){const n=e[s],a=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ur.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,r=e.length;s<r;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(n)}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 s=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n<a;n++){const h=this.bootstrapEvent(this.rootPointerEvent,r[n]);h.type+=s,this.rootBoundary.mapEvent(h)}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 s=0,r=e.length;s<r;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);this.rootBoundary.mapEvent(n)}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,Ur.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ur.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;Ur.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,s){const r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-r.left)*(this.domElement.width/r.width)*n,t.y=(s-r.top)*(this.domElement.height/r.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,r=t.changedTouches.length;s<r;s++){const n=t.changedTouches[s];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const s=t;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=Xw),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}else e.push(t);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,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=$w[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}};ec.extension={name:"events",type:[Y.RendererSystem,Y.CanvasRendererSystem]},ec.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let sc=ec;K.add(sc);function fm(i){return i==="dynamic"||i==="static"}const Yw={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??fm(sc.defaultEventMode)},set interactive(i){ot("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??sc.defaultEventMode},set eventMode(i){this._internalInteractive=fm(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;i=s?`${i}capture`:i;const h=typeof t=="function"?t:t.handleEvent,o=this;r&&r.addEventListener("abort",()=>{o.off(i,h,a)}),n?o.once(i,h,a):o.on(i,h,a)},removeEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;i=s?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,r)},dispatchEvent(i){if(!(i instanceof lo))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};Vt.mixin(Yw);const Hw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Vt.mixin(Hw);const Ww=9,Ra=100,zw=0,jw=0,pm=2,mm=1,qw=-1e3,Zw=-1e3,Kw=2;class gm{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,(fr.tablet||fr.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.position="absolute",e.style.top=`${zw}px`,e.style.left=`${jw}px`,e.style.zIndex=pm.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=`${mm}px`,t.style.height=`${mm}px`,t.style.position="absolute",t.style.top=`${qw}px`,t.style.left=`${Zw}px`,t.style.zIndex=Kw.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(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let s=0;s<e.length;s++)this.updateAccessibleObjects(e[s])}update(){const t=performance.now();if(fr.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:s,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:h,resolution:o}=this.renderer,l=r/a*o,u=n/h*o;let c=this.div;c.style.left=`${e}px`,c.style.top=`${s}px`,c.style.width=`${a}px`,c.style.height=`${h}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,nn(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{c=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(c.style.left=`${(m.tx+p.x*m.a)*l}px`,c.style.top=`${(m.ty+p.y*m.d)*u}px`,c.style.width=`${p.width*m.a*l}px`,c.style.height=`${p.height*m.d*u}px`):(p=f.getBounds(),this.capHitArea(p),c.style.left=`${p.x*l}px`,c.style.top=`${p.y*u}px`,c.style.width=`${p.width*l}px`,c.style.height=`${p.height*u}px`,c.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(c.title=f.accessibleTitle),c.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&c.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==c.title||f.tabIndex!==c.tabIndex)&&(c.title=f.accessibleTitle,c.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(c))}}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:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=pm.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&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new lo(r),{target:s});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>r.dispatchEvent(n,a))}_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){t.keyCode===Ww&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||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}}gm.extension={name:"accessibility",type:[Y.RendererPlugin,Y.CanvasRendererPlugin]},K.add(gm);const _m=class vd{constructor(t){this.stage=new Bt,t=Object.assign({forceCanvas:!1},t),this.renderer=lw(t),vd._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const s=vd._plugins.slice(0);s.reverse(),s.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};_m._plugins=[];let Qw=_m;K.handleByList(Y.Application,Qw._plugins);class ym{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(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;this.cancelResize();let e,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,s=n}this.renderer.resize(e,s),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}}ym.extension=Y.Application,K.add(ym);const xm={loader:Y.LoadParser,resolver:Y.ResolveParser,cache:Y.CacheParser,detection:Y.DetectionParser};K.handle(Y.Asset,i=>{const t=i.ref;Object.entries(xm).filter(([e])=>!!t[e]).forEach(([e,s])=>K.add(Object.assign(t[e],{extension:t[e].extension??s})))},i=>{const t=i.ref;Object.keys(xm).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});class Jw{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s<e;s++)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 un(i,t){if(Array.isArray(t)){for(const e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}function Le(i,t){const e=i.split("?")[0],s=bt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const Ts=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(s=>typeof s=="string"||e?t(s):s):i),rc=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function vm(i,t,e,s,r){const n=t[e];for(let a=0;a<n.length;a++){const h=n[a];e<t.length-1?vm(i.replace(s[e],h),t,e+1,s,r):r.push(i.replace(s[e],h))}}function tE(i){const t=/\{(.*?)\}/g,e=i.match(t),s=[];if(e){const r=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");r.push(a)}),vm(i,r,0,e,s)}else s.push(i);return s}const Ma=i=>!Array.isArray(i);class eE{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=Ts(t);let r;for(let h=0;h<this.parsers.length;h++){const o=this.parsers[h];if(o.test(e)){r=o.getCacheableAssets(s,e);break}}r||(r={},s.forEach(h=>{r[h]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:s};if(s.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{this._cache.has(h)&&this._cache.get(h)!==e&&console.warn("[Cache] already has key:",h),this._cache.set(h,r[h])}),e instanceof q){const h=e;s.forEach(o=>{h.baseTexture!==q.EMPTY.baseTexture&&et.addToCache(h.baseTexture,o),q.addToCache(h,o)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}}const Ai=new eE;class sE{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var a,h;let r=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];if(l.load&&((a=l.test)!=null&&a.call(l,t,e,this))){n=l;break}}if(!n)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 n.load(t,e,this),s.parser=n;for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];l.parse&&l.parse&&await((h=l.testParse)==null?void 0:h.call(l,r,e,this))&&(r=await l.parse(r,e,this)||r,s.parser=l)}return r})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const r={},n=Ma(t),a=Ts(t,l=>({alias:[l],src:l})),h=a.length,o=a.map(async l=>{const u=bt.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),r[l.src]=await this.promiseCache[u].promise,e&&e(++s/h)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}.
867
+ ${c}`)}});return await Promise.all(o),n?r[a[0].src]:r}async unload(t){const e=Ts(t,s=>({alias:[s],src:s})).map(async s=>{var a,h;const r=bt.toAbsolute(s.src),n=this.promiseCache[r];if(n){const o=await n.promise;delete this.promiseCache[r],(h=(a=n.parser)==null?void 0:a.unload)==null||h.call(a,o,s,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 Ne=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Ne||{});const rE=".json",iE="application/json",nE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadJson",test(i){return un(i,iE)||Le(i,rE)},async load(i){return await(await z.ADAPTER.fetch(i)).json()}};K.add(nE);const oE=".txt",aE="text/plain",lE={name:"loadTxt",extension:{type:Y.LoadParser,priority:Ne.Low},test(i){return un(i,aE)||Le(i,oE)},async load(i){return await(await z.ADAPTER.fetch(i)).text()}};K.add(lE);const hE=["normal","bold","100","200","300","400","500","600","700","800","900"],cE=[".ttf",".otf",".woff",".woff2"],uE=["font/ttf","font/otf","font/woff","font/woff2"],dE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function fE(i){const t=bt.extname(i),e=bt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(dE)){s=!1;break}let r=e.join(" ");return s||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const pE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function mE(i){return pE.test(i)?i:encodeURI(i)}const gE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadWebFont",test(i){return un(i,uE)||Le(i,cE)},async load(i,t){var s,r,n;const e=z.ADAPTER.getFontFaceSet();if(e){const a=[],h=((s=t.data)==null?void 0:s.family)??fE(i),o=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(u=>hE.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<o.length;u++){const c=o[u],d=new FontFace(h,`url(${mE(i)})`,{...l,weight:c});await d.load(),e.add(d),a.push(d)}return a.length===1?a[0]:a}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};K.add(gE);const _E=`(function() {
868
868
  "use strict";
869
869
  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
870
870
  async function checkImageBitmap() {
@@ -908,7 +908,7 @@ ${c}`)}});return await Promise.all(o),n?r[a[0].src]:r}async unload(t){const e=Ts
908
908
  };
909
909
  })();
910
910
  `;let fn=null;class bm{constructor(){fn||(fn=URL.createObjectURL(new Blob([yE],{type:"application/javascript"}))),this.worker=new Worker(fn)}}bm.revokeObjectURL=function(){fn&&(URL.revokeObjectURL(fn),fn=null)};let wm=0,nc;class xE{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new ic;e.addEventListener("message",s=>{e.terminate(),ic.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){nc===void 0&&(nc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<nc&&(this._createdWorkers++,t=new bm().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise((r,n)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[wm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:wm++,id:s})}}const Em=new xE;function ho(i,t,e){i.resource.internal=!0;const s=new q(i),r=()=>{delete t.promiseCache[e],Ai.has(e)&&Ai.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),r())}),s.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),s}const vE=[".jpeg",".jpg",".png",".webp",".avif"],bE=["image/jpeg","image/png","image/webp","image/avif"];async function wE(i){const t=await z.ADAPTER.fetch(i);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Fa={name:"loadTextures",extension:{type:Y.LoadParser,priority:Ne.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return un(i,bE)||Le(i,vE)},async load(i,t,e){var h;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let r;s?this.config.preferWorkers&&await Em.isImageBitmapSupported()?r=await Em.loadImageBitmap(i):r=await wE(i):r=await new Promise((o,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=i,u.complete?o(u):(u.onload=()=>o(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=_r(i)),s&&((h=n.resourceOptions)==null?void 0:h.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const a=new et(r,n);return a.resource.src=i,ho(a,e,i)},unload(i){i.destroy(!0)}};K.add(Fa);const EE=".svg",TE="image/svg+xml",AE={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadSVG",test(i){return un(i,TE)||Le(i,EE)},async testParse(i){return Kh.test(i)},async parse(i,t,e){var n;const s=new Kh(i,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await s.load();const r=new et(s,{resolution:_r(i),...t==null?void 0:t.data});return r.resource.src=t.src,ho(r,e,t.src)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload:Fa.unload};K.add(AE);const SE=[".mp4",".m4v",".webm",".ogv"],CE=["video/mp4","video/webm","video/ogg"],IE={name:"loadVideo",extension:{type:Y.LoadParser,priority:Ne.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(i){return un(i,CE)||Le(i,SE)},async load(i,t,e){var a;let s;const r=await(await z.ADAPTER.fetch(i)).blob(),n=URL.createObjectURL(r);try{const h={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(a=t==null?void 0:t.data)==null?void 0:a.resourceOptions,autoLoad:!0},o=new lm(n,h);await o.load();const l=new et(o,{alphaMode:await Ob(),resolution:_r(i),...t==null?void 0:t.data});l.resource.src=i,s=ho(l,e,i),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(h){throw URL.revokeObjectURL(n),h}return s},unload(i){i.destroy(!0)}};K.add(IE);class PE{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,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,name:s,src:r,srcs:n}=t;return Ts(e||s||r||n,a=>typeof a=="string"?a:Array.isArray(a)?a.map(h=>(h==null?void 0:h.src)??(h==null?void 0:h.srcs)??h):a!=null&&a.src||a!=null&&a.srcs?a.src??a.srcs:a,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(r=>{const n=r.src??r.srcs,a=r.alias??r.name;let h;if(typeof a=="string"){const o=this._createBundleAssetId(t,a);s.push(o),h=[a,o]}else{const o=a.map(l=>this._createBundleAssetId(t,l));s.push(...o),h=[...a,...o]}this.add({...r,alias:h,src:n})}):Object.keys(e).forEach(r=>{const n=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:n,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:n,src:e[r]});else{const a=e[r],h=a.src??a.srcs;this.add({...a,alias:n,src:Array.isArray(h)?h:[h]})}s.push(...n)}),this._bundles[t]=s}add(t,e,s,r,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(ot("7.2.0",`Assets.add now uses an object instead of individual parameters.
911
- Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:s,format:r,loadParser:n})):Array.isArray(t)?a.push(...t):a.push(t);let h;h=o=>{this.hasKey(o)&&console.warn(`[Resolver] already has key: ${o} overwriting`)},Ts(a).forEach(o=>{const{src:l,srcs:u}=o;let{data:c,format:d,loadParser:f}=o;const p=Ts(l||u).map(_=>typeof _=="string"?tE(_):Array.isArray(_)?_:[_]),m=this.getAlias(o);Array.isArray(m)?m.forEach(h):h(m);const g=[];p.forEach(_=>{_.forEach(x=>{let y={};if(typeof x!="object"){y.src=x;for(let v=0;v<this._parsers.length;v++){const b=this._parsers[v];if(b.test(x)){y=b.parse(x);break}}}else c=x.data??c,d=x.format??d,f=x.loadParser??f,y={...y,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:m,data:c,format:d,loadParser:f}),g.push(y)})}),m.forEach(_=>{this._assetMap[_]=g})})}resolveBundle(t){const e=Ma(t);t=Ts(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),h={};for(const o in a){const l=a[o];h[this._extractAssetIdFromBundle(r,o)]=l}s[r]=h}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const r in e)s[r]=e[r].src;return s}return e.src}resolve(t){const e=Ma(t);t=Ts(t);const s={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const a=n[0],h=this._getPreferredOrder(n);h==null||h.priority.forEach(o=>{h.params[o].forEach(l=>{const u=n.filter(c=>c[o]?c[o]===l:!1);u.length&&(n=u)})}),this._resolverHash[r]=n[0]??a}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:s,data:r,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=vt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??vt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class RE{constructor(){this._detections=[],this._initialized=!1,this.resolver=new PE,this.loader=new sE,this.cache=Ai,this._backgroundLoader=new Jw(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,a;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}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 h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,s=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:s}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,r,n){this.resolver.add(t,e,s,r,n)}async load(t,e){this._initialized||await this.init();const s=Ma(t),r=Ts(t).map(h=>{if(typeof h!="string"){const o=this.resolver.getAlias(h);return o.some(l=>!this.resolver.hasKey(l))&&this.add(h),Array.isArray(o)?o[0]:o}return this.resolver.hasKey(h)||this.add({alias:h,src:h}),h}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return s?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let h=0,o=0;const l=()=>{e==null||e(++h/o)},u=a.map(c=>{const d=r[c];return o+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[c]=f})});return await Promise.all(u),s?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Ai.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ai.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(s,e);this._backgroundLoader.active=!0;const a={};return s.forEach((h,o)=>{const l=n[h.src],u=[h.src];h.alias&&u.push(...h.alias),a[r[o]]=l,Ai.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=Ts(t).map(r=>typeof r!="string"?r.src:r),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Ts(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Ai.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,r)=>e.indexOf(s)===r),e}get detections(){return this._detections}get preferWorkers(){return Fa.config.preferWorkers}set preferWorkers(t){ot("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(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Gr=new RE;K.handleByList(Y.LoadParser,Gr.loader.parsers).handleByList(Y.ResolveParser,Gr.resolver.parsers).handleByList(Y.CacheParser,Gr.cache.parsers).handleByList(Y.DetectionParser,Gr.detections);const ME={extension:Y.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof q),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};K.add(ME);async function Tm(i){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const FE={extension:{type:Y.DetectionParser,priority:1},test:async()=>Tm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};K.add(FE);const kE={extension:{type:Y.DetectionParser,priority:0},test:async()=>Tm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};K.add(kE);const Am=["png","jpg","jpeg"],BE={extension:{type:Y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Am],remove:async i=>i.filter(t=>!Am.includes(t))};K.add(BE);const DE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function oc(i){return DE?!1:document.createElement("video").canPlayType(i)!==""}const OE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};K.add(OE);const LE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};K.add(LE);const NE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};K.add(NE);const VE={extension:Y.ResolveParser,test:Fa.test,parse:i=>{var t;return{resolution:parseFloat(((t=z.RETINA_PREFIX.exec(i))==null?void 0:t[1])??"1"),format:vt.extname(i).slice(1),src:i}}};K.add(VE);var ve=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i))(ve||{});const ka={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 Zs,pn;function Sm(){pn={bptc:Zs.getExtension("EXT_texture_compression_bptc"),astc:Zs.getExtension("WEBGL_compressed_texture_astc"),etc:Zs.getExtension("WEBGL_compressed_texture_etc"),s3tc:Zs.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Zs.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Zs.getExtension("WEBGL_compressed_texture_pvrtc")||Zs.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Zs.getExtension("WEBGL_compressed_texture_etc1"),atc:Zs.getExtension("WEBGL_compressed_texture_atc")}}const UE={extension:{type:Y.DetectionParser,priority:2},test:async()=>{const i=z.ADAPTER.createCanvas().getContext("webgl");return i?(Zs=i,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{pn||Sm();const t=[];for(const e in pn)pn[e]&&t.push(e);return[...t,...i]},remove:async i=>(pn||Sm(),i.filter(t=>!(t in pn)))};K.add(UE);class GE extends aa{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,r;typeof t=="string"?(s=t,r=new Uint8Array):(s=null,r=t),super(r,e),this.origin=s,this.buffer=r?new Sh(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?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 Sh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Si extends GE{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=Si._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Si._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){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 n=0,a=this.levels;n<a;n++){const{levelID:h,levelWidth:o,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,h,this.format,o,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Si._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(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,s,r,n,a,h){const o=new Array(s);let l=t.byteOffset,u=a,c=h,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*ka[e];for(let m=0;m<s;m++)o[m]={levelID:m,levelWidth:s>1?u:d,levelHeight:s>1?c:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,u=u>>1||1,c=c>>1||1,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*ka[e];return o}}const ac=4,Ba=124,XE=32,Cm=20,$E=542327876,Da={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},YE={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Oa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},HE=1,WE=2,zE=4,jE=64,qE=512,ZE=131072,KE=827611204,QE=861165636,JE=894720068,tT=808540228,eT=4,sT={[KE]:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,[QE]:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,[JE]:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT},rT={70:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:ve.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:ve.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:ve.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:ve.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function iT(i){const t=new Uint32Array(i);if(t[0]!==$E)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,Ba/Uint32Array.BYTES_PER_ELEMENT),s=e[Da.HEIGHT],r=e[Da.WIDTH],n=e[Da.MIPMAP_COUNT],a=new Uint32Array(i,Da.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,XE/Uint32Array.BYTES_PER_ELEMENT),h=a[HE];if(h&zE){const o=a[YE.FOURCC];if(o!==tT){const x=sT[o],y=ac+Ba,v=new Uint8Array(i,y);return[new Si(v,{format:x,width:r,height:s,levels:n})]}const l=ac+Ba,u=new Uint32Array(t.buffer,l,Cm/Uint32Array.BYTES_PER_ELEMENT),c=u[Oa.DXGI_FORMAT],d=u[Oa.RESOURCE_DIMENSION],f=u[Oa.MISC_FLAG],p=u[Oa.ARRAY_SIZE],m=rT[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===eT)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,_=ac+Ba+Cm;if(p===1)g.push(new Uint8Array(i,_));else{const x=ka[m];let y=0,v=r,b=s;for(let E=0;E<n;E++){const T=Math.max(1,v+3&-4),A=Math.max(1,b+3&-4),I=T*A*x;y+=I,v=v>>>1,b=b>>>1}let w=_;for(let E=0;E<p;E++)g.push(new Uint8Array(i,w,y)),w+=y}return g.map(x=>new Si(x,{format:m,width:r,height:s,levels:n}))}throw h&jE?new Error("DDSParser does not support uncompressed texture data."):h&qE?new Error("DDSParser does not supported YUV uncompressed texture data."):h&ZE?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&WE?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Im=[171,75,84,88,32,49,49,187,13,10,26,10],nT=67305985,As={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},lc=64,Pm={[tt.UNSIGNED_BYTE]:1,[tt.UNSIGNED_SHORT]:2,[tt.INT]:4,[tt.UNSIGNED_INT]:4,[tt.FLOAT]:4,[tt.HALF_FLOAT]:8},oT={[G.RGBA]:4,[G.RGB]:3,[G.RG]:2,[G.RED]:1,[G.LUMINANCE]:1,[G.LUMINANCE_ALPHA]:2,[G.ALPHA]:1},aT={[tt.UNSIGNED_SHORT_4_4_4_4]:2,[tt.UNSIGNED_SHORT_5_5_5_1]:2,[tt.UNSIGNED_SHORT_5_6_5]:2};function lT(i,t,e=!1){const s=new DataView(t);if(!hT(i,s))return null;const r=s.getUint32(As.ENDIANNESS,!0)===nT,n=s.getUint32(As.GL_TYPE,r),a=s.getUint32(As.GL_FORMAT,r),h=s.getUint32(As.GL_INTERNAL_FORMAT,r),o=s.getUint32(As.PIXEL_WIDTH,r),l=s.getUint32(As.PIXEL_HEIGHT,r)||1,u=s.getUint32(As.PIXEL_DEPTH,r)||1,c=s.getUint32(As.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(As.NUMBER_OF_FACES,r),f=s.getUint32(As.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(As.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,_=o+3&-4,x=l+3&-4,y=new Array(c);let v=o*l;n===0&&(v=_*x);let b;if(n!==0?Pm[n]?b=Pm[n]*oT[a]:b=aT[n]:b=ka[h],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?uT(s,p,r):null;let E=v*b,T=o,A=l,I=_,M=x,R=lc+p;for(let C=0;C<f;C++){const P=s.getUint32(R,r);let k=R+4;for(let U=0;U<c;U++){let V=y[U];V||(V=y[U]=new Array(f)),V[C]={levelID:C,levelWidth:f>1||n!==0?T:I,levelHeight:f>1||n!==0?A:M,levelBuffer:new Uint8Array(t,k,E)},k+=E}R+=P+4,R=R%4!==0?R+4-R%4:R,T=T>>1||1,A=A>>1||1,I=T+m-1&~(m-1),M=A+g-1&~(g-1),E=I*M*b}return n!==0?{uncompressed:y.map(C=>{let P=C[0].levelBuffer,k=!1;return n===tt.FLOAT?P=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===tt.UNSIGNED_INT?(k=!0,P=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===tt.INT&&(k=!0,P=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new aa(P,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:k?cT(a):a}}),kvData:w}:{compressed:y.map(C=>new Si(null,{format:h,width:o,height:l,levels:f,levelBuffers:C})),kvData:w}}function hT(i,t){for(let e=0;e<Im.length;e++)if(t.getUint8(e)!==Im[e])return console.error(`${i} is not a valid *.ktx file!`),!1;return!0}function cT(i){switch(i){case G.RGBA:return G.RGBA_INTEGER;case G.RGB:return G.RGB_INTEGER;case G.RG:return G.RG_INTEGER;case G.RED:return G.RED_INTEGER;default:return i}}function uT(i,t,e){const s=new Map;let r=0;for(;r<t;){const n=i.getUint32(lc+r,e),a=lc+r+4,h=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let o=0;for(;o<n&&i.getUint8(a+o)!==0;o++);if(o===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(i.buffer,a,o)),u=new DataView(i.buffer,a+o+1,n-o-1);s.set(l,u),r+=4+n+h}return s}const dT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadDDS",test(i){return Le(i,".dds")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),r=iT(s).map(n=>{const a=new et(n,{mipmap:xs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data});return ho(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(dT);const fT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadKTX",test(i){return Le(i,".ktx")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=lT(i,s),h=r??n,o={mipmap:xs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data},l=h.map(u=>{h===n&&Object.assign(o,{type:u.type,format:u.format});const c=u.resource??u,d=new et(c,o);return d.ktxKeyValueData=a,ho(d,e,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(fT);const pT=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],mT={extension:Y.ResolveParser,test:i=>{const t=vt.extname(i).slice(1);return["basis","ktx","dds"].includes(t)},parse:i=>{var s,r;const t=i.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(pT.includes(n))return{resolution:parseFloat(((s=z.RETINA_PREFIX.exec(i))==null?void 0:s[1])??"1"),format:n,src:i}}return{resolution:parseFloat(((r=z.RETINA_PREFIX.exec(i))==null?void 0:r[1])??"1"),format:e,src:i}}};K.add(mT);const La=new rt,gT=4,Rm=class Lo{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,s,r){const n=new Image;return n.src=await this.base64(t,e,s,r),n}async base64(t,e,s,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,h)=>{n.toBlob(o=>{if(!o){h(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((h,o)=>{const l=new FileReader;l.onload=()=>h(l.result),l.onerror=o,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);a&&Lo._flipY(s,r,n),h&&Lo._unpremultiplyAlpha(s);const o=new Kb(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return o.context.putImageData(l,0,0),o.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);return a&&Lo._flipY(s,r,n),h&&Lo._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let r,n=!1,a=!1,h,o=!1;t&&(t instanceof wi?h=t:(h=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),o=!0,e&&(La.width=e.width,La.height=e.height,e=La)));const l=s.gl;if(h){if(r=h.baseTexture.resolution,e=e??h.frame,n=!1,a=h.baseTexture.alphaMode>0&&h.baseTexture.format===G.RGBA,!o){s.renderTexture.bind(h);const f=h.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else r=s.resolution,e||(e=La,e.width=s.width/r,e.height=s.height/r),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),d=new Uint8Array(gT*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),o&&(h==null||h.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const r=e<<2,n=s>>1,a=new Uint8Array(r);for(let h=0;h<n;h++){const o=h*r,l=(s-h-1)*r;a.set(t.subarray(o,o+r)),t.copyWithin(o,l,l+r),t.set(a,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let s=0;s<e;s+=4){const r=t[s+3];if(r!==0){const n=255.001/r;t[s]=t[s]*n+.5,t[s+1]=t[s+1]*n+.5,t[s+2]=t[s+2]*n+.5}}}};Rm.extension={name:"extract",type:Y.RendererSystem};let _T=Rm;K.add(_T);const Na={build(i){const t=i.points;let e,s,r,n,a,h;if(i.type===xe.CIRC){const p=i.shape;e=p.x,s=p.y,a=h=p.radius,r=n=0}else if(i.type===xe.ELIP){const p=i.shape;e=p.x,s=p.y,a=p.width,h=p.height,r=n=0}else{const p=i.shape,m=p.width/2,g=p.height/2;e=p.x+m,s=p.y+g,a=h=Math.max(0,Math.min(p.radius,Math.min(m,g))),r=m-a,n=g-h}if(!(a>=0&&h>=0&&r>=0&&n>=0)){t.length=0;return}const o=Math.ceil(2.3*Math.sqrt(a+h)),l=o*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(o===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=s+n,t[2]=t[4]=e-r,t[5]=t[7]=s-n;return}let u=0,c=o*4+(r?2:0)+2,d=c,f=l;{const p=r+a,m=n,g=e+p,_=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=_,n){const y=s-m;t[d++]=_,t[d++]=y,t[--f]=y,t[--f]=g}}for(let p=1;p<o;p++){const m=Math.PI/2*(p/o),g=r+Math.cos(m)*a,_=n+Math.sin(m)*h,x=e+g,y=e-g,v=s+_,b=s-_;t[u++]=x,t[u++]=v,t[--c]=v,t[--c]=y,t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=x}{const p=r,m=n+h,g=e+p,_=e-p,x=s+m,y=s-m;t[u++]=g,t[u++]=x,t[--f]=y,t[--f]=g,r&&(t[u++]=_,t[u++]=x,t[--f]=y,t[--f]=_)}},triangulate(i,t){const e=i.points,s=t.points,r=t.indices;if(e.length===0)return;let n=s.length/2;const a=n;let h,o;if(i.type!==xe.RREC){const u=i.shape;h=u.x,o=u.y}else{const u=i.shape;h=u.x+u.width/2,o=u.y+u.height/2}const l=i.matrix;s.push(i.matrix?l.a*h+l.c*o+l.tx:h,i.matrix?l.b*h+l.d*o+l.ty:o),n++,s.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)s.push(e[u],e[u+1]),r.push(n++,a,n);r.push(a+1,a,n)}};function Mm(i,t=!1){const e=i.length;if(e<6)return;let s=0;for(let r=0,n=i[e-2],a=i[e-1];r<e;r+=2){const h=i[r],o=i[r+1];s+=(h-n)*(o+a),n=h,a=o}if(!t&&s>0||t&&s<=0){const r=e/2;for(let n=r+r%2;n<e;n+=2){const a=e-n-2,h=e-n-1,o=n,l=n+1;[i[a],i[o]]=[i[o],i[a]],[i[h],i[l]]=[i[l],i[h]]}}}const Fm={build(i){i.points=i.shape.points.slice()},triangulate(i,t){let e=i.points;const s=i.holes,r=t.points,n=t.indices;if(e.length>=6){Mm(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];Mm(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const h=My(e,a,2);if(!h)return;const o=r.length/2;for(let l=0;l<h.length;l+=3)n.push(h[l]+o),n.push(h[l+1]+o),n.push(h[l+2]+o);for(let l=0;l<e.length;l++)r.push(e[l])}}},yT={build(i){const t=i.shape,e=t.x,s=t.y,r=t.width,n=t.height,a=i.points;a.length=0,r>=0&&n>=0&&a.push(e,s,e+r,s,e+r,s+n,e,s+n)},triangulate(i,t){const e=i.points,s=t.points;if(e.length===0)return;const r=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},xT={build(i){Na.build(i)},triangulate(i,t){Na.triangulate(i,t)}};var ls=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(ls||{}),Xr=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(Xr||{});const mn={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,t=20){if(!this.adaptive||!i||isNaN(i))return t;let e=Math.ceil(i/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class km{static curveTo(t,e,s,r,n,a){const h=a[a.length-2],o=a[a.length-1]-e,l=h-t,u=r-e,c=s-t,d=Math.abs(o*c-l*u);if(d<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=o*o+l*l,p=u*u+c*c,m=o*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(p)/d,x=g*m/f,y=_*m/p,v=g*c+_*l,b=g*u+_*o,w=l*(_+x),E=o*(_+x),T=c*(g+y),A=u*(g+y),I=Math.atan2(E-b,w-v),M=Math.atan2(A-b,T-v);return{cx:v+t,cy:b+e,radius:n,startAngle:I,endAngle:M,anticlockwise:l*u>c*o}}static arc(t,e,s,r,n,a,h,o,l){const u=h-a,c=mn._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/ha)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,_=g%1/g;for(let x=0;x<=g;++x){const y=x+_*x,v=d+a+f*y,b=Math.cos(v),w=-Math.sin(v);l.push((p*b+m*w)*n+s,(p*-w+m*b)*n+r)}}}class vT{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class hc{static curveLength(t,e,s,r,n,a,h,o){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,y=0,v=t,b=e;for(let w=1;w<=10;++w)u=w/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,g=m*t+3*p*u*s+3*f*c*n+d*h,_=m*e+3*p*u*r+3*f*c*a+d*o,x=v-g,y=b-_,v=g,b=_,l+=Math.sqrt(x*x+y*y);return l}static curveTo(t,e,s,r,n,a,h){const o=h[h.length-2],l=h[h.length-1];h.length-=2;const u=mn._segmentsCount(hc.curveLength(o,l,t,e,s,r,n,a));let c=0,d=0,f=0,p=0,m=0;h.push(o,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,p=_*_,m=p*_,h.push(f*o+3*d*_*t+3*c*p*s+m*n,f*l+3*d*_*e+3*c*p*r+m*a)}}function Bm(i,t,e,s,r,n,a,h){const o=i-e*r,l=t-s*r,u=i+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=o+d,m=l+f,g=u+d,_=c+f;return h.push(p,m,g,_),2}function Ci(i,t,e,s,r,n,a,h){const o=e-i,l=s-t;let u=Math.atan2(o,l),c=Math.atan2(r-i,n-t);h&&u<c?u+=Math.PI*2:!h&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(o*o+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,h){a.push(i,t,e,s);for(let x=1,y=d;x<g;x++,y+=_)a.push(i,t,i+Math.sin(y)*m,t+Math.cos(y)*m);a.push(i,t,r,n)}else{a.push(e,s,i,t);for(let x=1,y=d;x<g;x++,y+=_)a.push(i+Math.sin(y)*m,t+Math.cos(y)*m,i,t);a.push(r,n,i,t)}return g*2}function bT(i,t){const e=i.shape;let s=i.points||e.points.slice();const r=t.closePointEps;if(s.length===0)return;const n=i.lineStyle,a=new st(s[0],s[1]),h=new st(s[s.length-2],s[s.length-1]),o=e.type!==xe.POLY||e.closeStroke,l=Math.abs(a.x-h.x)<r&&Math.abs(a.y-h.y)<r;if(o){s=s.slice(),l&&(s.pop(),s.pop(),h.set(s[s.length-2],s[s.length-1]));const V=(a.x+h.x)*.5,L=(h.y+a.y)*.5;s.unshift(V,L),s.push(V,L)}const u=t.points,c=s.length/2;let d=s.length;const f=u.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let _=s[0],x=s[1],y=s[2],v=s[3],b=0,w=0,E=-(x-v),T=_-y,A=0,I=0,M=Math.sqrt(E*E+T*T);E/=M,T/=M,E*=p,T*=p;const R=n.alignment,C=(1-R)*2,P=R*2;o||(n.cap===Xr.ROUND?d+=Ci(_-E*(C-P)*.5,x-T*(C-P)*.5,_-E*C,x-T*C,_+E*P,x+T*P,u,!0)+2:n.cap===Xr.SQUARE&&(d+=Bm(_,x,E,T,C,P,!0,u))),u.push(_-E*C,x-T*C,_+E*P,x+T*P);for(let V=1;V<c-1;++V){_=s[(V-1)*2],x=s[(V-1)*2+1],y=s[V*2],v=s[V*2+1],b=s[(V+1)*2],w=s[(V+1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,A=-(v-w),I=y-b,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=p,I*=p;const L=y-_,$=x-v,O=y-b,N=w-v,Z=L*O+$*N,Q=$*O-N*L,H=Q<0;if(Math.abs(Q)<.001*Math.abs(Z)){u.push(y-E*C,v-T*C,y+E*P,v+T*P),Z>=0&&(n.join===ls.ROUND?d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4:d+=2,u.push(y-A*P,v-I*P,y+A*C,v+I*C));continue}const lt=(-E+_)*(-T+v)-(-E+y)*(-T+x),Et=(-A+b)*(-I+v)-(-A+y)*(-I+w),_t=(L*Et-O*lt)/Q,kt=(N*lt-$*Et)/Q,zt=(_t-y)*(_t-y)+(kt-v)*(kt-v),Qt=y+(_t-y)*C,Pt=v+(kt-v)*C,jt=y-(_t-y)*P,Ot=v-(kt-v)*P,ze=Math.min(L*L+$*$,O*O+N*N),is=H?C:P,li=ze+is*is*m,kn=zt<=li;let hi=n.join;if(hi===ls.MITER&&zt/m>g&&(hi=ls.BEVEL),kn)switch(hi){case ls.MITER:{u.push(Qt,Pt,jt,Ot);break}case ls.BEVEL:{H?u.push(Qt,Pt,y+E*P,v+T*P,Qt,Pt,y+A*P,v+I*P):u.push(y-E*C,v-T*C,jt,Ot,y-A*C,v-I*C,jt,Ot),d+=2;break}case ls.ROUND:{H?(u.push(Qt,Pt,y+E*P,v+T*P),d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+4,u.push(Qt,Pt,y+A*P,v+I*P)):(u.push(y-E*C,v-T*C,jt,Ot),d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4,u.push(y-A*C,v-I*C,jt,Ot));break}}else{switch(u.push(y-E*C,v-T*C,y+E*P,v+T*P),hi){case ls.MITER:{H?u.push(jt,Ot,jt,Ot):u.push(Qt,Pt,Qt,Pt),d+=2;break}case ls.ROUND:{H?d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+2:d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+2;break}}u.push(y-A*C,v-I*C,y+A*P,v+I*P),d+=2}}_=s[(c-2)*2],x=s[(c-2)*2+1],y=s[(c-1)*2],v=s[(c-1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,u.push(y-E*C,v-T*C,y+E*P,v+T*P),o||(n.cap===Xr.ROUND?d+=Ci(y-E*(C-P)*.5,v-T*(C-P)*.5,y-E*C,v-T*C,y+E*P,v+T*P,u,!1)+2:n.cap===Xr.SQUARE&&(d+=Bm(y,v,E,T,C,P,!1,u)));const k=t.indices,U=mn.epsilon*mn.epsilon;for(let V=f;V<d+f-2;++V)_=u[V*2],x=u[V*2+1],y=u[(V+1)*2],v=u[(V+1)*2+1],b=u[(V+2)*2],w=u[(V+2)*2+1],!(Math.abs(_*(v-w)+y*(w-x)+b*(x-v))<U)&&k.push(V,V+1,V+2)}function wT(i,t){let e=0;const s=i.shape,r=i.points||s.points,n=s.type!==xe.POLY||s.closeStroke;if(r.length===0)return;const a=t.points,h=t.indices,o=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),e=1;e<o;e++)a.push(r[e*2],r[e*2+1]),h.push(u,u+1),u++;n&&h.push(u,l)}function Dm(i,t){i.lineStyle.native?wT(i,t):bT(i,t)}class cc{static curveLength(t,e,s,r,n,a){const h=t-2*s+n,o=e-2*r+a,l=2*s-2*t,u=2*r-2*e,c=4*(h*h+o*o),d=4*(h*l+o*u),f=l*l+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),g=2*c*m,_=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-_)+(4*f*c-d*d)*Math.log((2*m+x+p)/(x+_)))/(4*g)}static curveTo(t,e,s,r,n){const a=n[n.length-2],h=n[n.length-1],o=mn._segmentsCount(cc.curveLength(a,h,t,e,s,r));let l=0,u=0;for(let c=1;c<=o;++c){const d=c/o;l=a+(t-a)*d,u=h+(e-h)*d,n.push(l+(t+(s-t)*d-l)*d,u+(e+(r-e)*d-u)*d)}}}const uc={[xe.POLY]:Fm,[xe.CIRC]:Na,[xe.ELIP]:Na,[xe.RECT]:yT,[xe.RREC]:xT},Om=[],Va=[];class Ua{constructor(t,e=null,s=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new Ua(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 gn=new st,Lm=class ry extends mp{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 Ia,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(),Va.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Om.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,s=null,r=null){const n=new Ua(t,e,s,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Ua(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=r.lineStyle,r.holes.push(s),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 s=0;s<e.length;++s){const r=e[s];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,gn):gn.copyFrom(t),r.shape.contains(gn.x,gn.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.holes[a].shape.contains(gn.x,gn.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let s=null,r=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],r=s.style);for(let o=this.shapeIndex;o<e.length;o++){this.shapeIndex++;const l=e[o],u=l.fillStyle,c=l.lineStyle;uc[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?u:c;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=Fr.REPEAT,d===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-g;_!==0&&(s&&!this._compareStyles(r,f)&&(s.end(m,g),s=null),s||(s=Om.pop()||new vT,s.begin(f,m,g),this.batches.push(s),r=f),this.addUvs(this.points,t,f.texture,g,_,f.matrix))}}const n=this.indices.length,a=this.points.length/2;if(s&&s.end(n,a),this.batches.length===0){this.batchable=!0;return}const h=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&h===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=h?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 s=this.graphicsData[t],r=s.fillStyle,n=s.lineStyle;if(r&&!r.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,s=t.length;e<s;e++){const r=t[e];for(let n=0;n<r.size;n++){const a=r.start+n;this.indicesUint16[a]=this.indicesUint16[a]-r.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<ry.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++et._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Va.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let r=Va.pop();r||(r=new Dh,r.texArray=new Gh),r.texArray.count=0,r.start=0,r.size=0,r.type=ys.TRIANGLES;let n=0,a=null,h=0,o=!1,l=ys.TRIANGLES,u=0;this.drawCalls.push(r);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],f=8,p=d.style,m=p.texture.baseTexture;o!==!!p.native&&(o=!!p.native,l=o?ys.LINES:ys.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=Va.pop(),r||(r=new Dh,r.texArray=new Gh),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Fr.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,u+=d.size,h=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,h,d.attribSize,d.attribStart)}et._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),h=new Uint32Array(n);let o=0;for(let l=0;l<t.length/2;l++)a[o++]=t[l*2],a[o++]=t[l*2+1],a[o++]=e[l*2],a[o++]=e[l*2+1],h[o++]=s[l],a[o++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?Fm.triangulate(t,this):uc[t.type].triangulate(t,this)}processLine(t){Dm(t,this);for(let e=0;e<t.holes.length;e++)Dm(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];uc[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.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 s=0;s<t.length/2;s++){const r=t[s*2],n=t[s*2+1];t[s*2]=e.a*r+e.c*n+e.tx,t[s*2+1]=e.b*r+e.d*n+e.ty}}addColors(t,e,s,r,n=0){const a=Ct.shared.setValue(e).toLittleEndianNumber(),h=Ct.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+r);for(let o=0;o<r;o++)t[n+o]=h}addTextureIds(t,e,s,r=0){t.length=Math.max(t.length,r+s);for(let n=0;n<s;n++)t[r+n]=e}addUvs(t,e,s,r,n,a=null){let h=0;const o=e.length,l=s.frame;for(;h<n;){let c=t[(r+h)*2],d=t[(r+h)*2+1];if(a){const f=a.a*c+a.c*d+a.tx;d=a.b*c+a.d*d+a.ty,c=f}h++,e.push(c/l.width,d/l.height)}const u=s.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,s,o,n)}adjustUvs(t,e,s,r){const n=e.baseTexture,a=1e-6,h=s+r*2,o=e.frame,l=o.width/n.width,u=o.height/n.height;let c=o.x/o.width,d=o.y/o.height,f=Math.floor(t[s]+a),p=Math.floor(t[s+1]+a);for(let m=s+2;m<h;m+=2)f=Math.min(f,Math.floor(t[m]+a)),p=Math.min(p,Math.floor(t[m+1]+a));c-=f,d-=p;for(let m=s;m<h;m+=2)t[m]=(t[m]+c)*l,t[m+1]=(t[m+1]+d)*u}};Lm.BATCHABLE_SIZE=100;let ET=Lm;class Ga{constructor(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ga;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=q.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class dc extends Ga{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}clone(){const t=new dc;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=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}}const fc={},pc=class Sl extends Bt{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 Ga,this._lineStyle=new dc,this._matrix=null,this._holeMode=!1,this.state=zs.for2d(),this._geometry=t||new ET,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ct(16777215),this.blendMode=W.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Sl(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,s,r=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:s,alignment:r,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:q.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Xr.BUTT,join:ls.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.width>0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Nr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Nr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,r=s[s.length-2],n=s[s.length-1];return(r!==t||n!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),cc.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),hc.curveTo(t,e,s,r,n,a,this.currentPath.points),this}arcTo(t,e,s,r,n){this._initCurve(t,e);const a=this.currentPath.points,h=km.curveTo(t,e,s,r,n,a);if(h){const{cx:o,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=h;this.arc(o,l,u,c,d,f)}return this}arc(t,e,s,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=ha:a&&r<=n&&(r+=ha),n-r===0)return this;const h=t+Math.cos(r)*s,o=e+Math.sin(r)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-h),d=Math.abs(u[u.length-1]-o);c<l&&d<l||u.push(h,o)}else this.moveTo(h,o),u=this.currentPath.points;return km.arc(h,o,t,e,s,r,n,a,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:q.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ct.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:q.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,r){return this.drawShape(new rt(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new fa(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new ua(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new da(t,e,s,r))}drawPolygon(...t){let e,s=!0;const r=t[0];r.points?(s=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Nr(e);return n.closeStroke=s,this.drawShape(n),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 t.length===1&&t[0].shape.type===xe.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let r=0;r<s;r++){const n=t.batches[r],a=n.style.color,h=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),o=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:h,blendMode:e,indices:l,uvs:o,_batchRGB:Ct.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,s=this.batches.length;e<s;e++){const r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,r=this.worldAlpha,n=e.uniforms,a=s.drawCalls;n.translationMatrix=this.transform.worldTransform,Ct.shared.setValue(this._tintColor).premultiply(r).toArray(n.tint),t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,s.drawCalls[h])}_renderDrawCallDirect(t,e){const{texArray:s,type:r,size:n,start:a}=e,h=s.count;for(let o=0;o<h;o++)t.texture.bind(s.elements[o],o);t.geometry.draw(r,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!fc[s]){const{maxTextures:r}=t.plugins[s],n=new Int32Array(r);for(let o=0;o<r;o++)n[o]=o;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:ws.from({uSamplers:n},!0)},h=t.plugins[s]._shader.program;fc[s]=new qs(h,a)}e=fc[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:r,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,s,r,n)}containsPoint(t){return this.worldTransform.applyInverse(t,Sl._TEMP_POINT),this._geometry.containsPoint(Sl._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=Ct.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,s=e.a,r=e.b,n=e.c,a=e.d,h=e.tx,o=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const f=l[d],p=l[d+1];u[c++]=s*f+n*p+h,u[c++]=a*p+r*f+o}}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--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};pc.curves=mn,pc._TEMP_POINT=new st;let Ks=pc;class TT{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 mc=new st,Nm=new Nr,Vm=class iy extends Bt{constructor(t,e,s,r=ys.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||zs.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=z.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}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(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===ys.TRIANGLES&&e.length<iy.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_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,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=s._tintRGB,this._texture=s.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,s=t._updateID;if(s===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,n=r.a,a=r.b,h=r.c,o=r.d,l=r.tx,u=r.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const f=e[d*2],p=e[d*2+1];c[d*2]=n*f+h*p+l,c[d*2+1]=a*f+o*p+u}if(this._roundPixels){const d=z.RESOLUTION;for(let f=0;f<c.length;++f)c[f]=Math.round(c[f]*d)/d}this.vertexDirty=s}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new TT(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,mc);const e=this.geometry.getBuffer("aVertexPosition").data,s=Nm.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let h=0;h+2<n;h+=a){const o=r[h]*2,l=r[h+1]*2,u=r[h+2]*2;if(s[0]=e[o],s[1]=e[o+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[u],s[5]=e[u+1],Nm.contains(mc.x,mc.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}};Vm.BATCHABLE_SIZE=100;let Xa=Vm;class gc extends Lr{constructor(t,e,s){super();const r=new Jt(t),n=new Jt(e,!0),a=new Jt(s,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,tt.FLOAT).addAttribute("aTextureCoord",n,2,!1,tt.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var AT=`varying vec2 vTextureCoord;
911
+ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:s,format:r,loadParser:n})):Array.isArray(t)?a.push(...t):a.push(t);let h;h=o=>{this.hasKey(o)&&console.warn(`[Resolver] already has key: ${o} overwriting`)},Ts(a).forEach(o=>{const{src:l,srcs:u}=o;let{data:c,format:d,loadParser:f}=o;const p=Ts(l||u).map(_=>typeof _=="string"?tE(_):Array.isArray(_)?_:[_]),m=this.getAlias(o);Array.isArray(m)?m.forEach(h):h(m);const g=[];p.forEach(_=>{_.forEach(x=>{let y={};if(typeof x!="object"){y.src=x;for(let v=0;v<this._parsers.length;v++){const b=this._parsers[v];if(b.test(x)){y=b.parse(x);break}}}else c=x.data??c,d=x.format??d,f=x.loadParser??f,y={...y,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:m,data:c,format:d,loadParser:f}),g.push(y)})}),m.forEach(_=>{this._assetMap[_]=g})})}resolveBundle(t){const e=Ma(t);t=Ts(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),h={};for(const o in a){const l=a[o];h[this._extractAssetIdFromBundle(r,o)]=l}s[r]=h}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const r in e)s[r]=e[r].src;return s}return e.src}resolve(t){const e=Ma(t);t=Ts(t);const s={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const a=n[0],h=this._getPreferredOrder(n);h==null||h.priority.forEach(o=>{h.params[o].forEach(l=>{const u=n.filter(c=>c[o]?c[o]===l:!1);u.length&&(n=u)})}),this._resolverHash[r]=n[0]??a}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:s,data:r,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=bt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??bt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class RE{constructor(){this._detections=[],this._initialized=!1,this.resolver=new PE,this.loader=new sE,this.cache=Ai,this._backgroundLoader=new Jw(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,a;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}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 h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,s=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:s}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,r,n){this.resolver.add(t,e,s,r,n)}async load(t,e){this._initialized||await this.init();const s=Ma(t),r=Ts(t).map(h=>{if(typeof h!="string"){const o=this.resolver.getAlias(h);return o.some(l=>!this.resolver.hasKey(l))&&this.add(h),Array.isArray(o)?o[0]:o}return this.resolver.hasKey(h)||this.add({alias:h,src:h}),h}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return s?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let h=0,o=0;const l=()=>{e==null||e(++h/o)},u=a.map(c=>{const d=r[c];return o+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[c]=f})});return await Promise.all(u),s?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Ai.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ai.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(s,e);this._backgroundLoader.active=!0;const a={};return s.forEach((h,o)=>{const l=n[h.src],u=[h.src];h.alias&&u.push(...h.alias),a[r[o]]=l,Ai.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=Ts(t).map(r=>typeof r!="string"?r.src:r),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Ts(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Ai.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,r)=>e.indexOf(s)===r),e}get detections(){return this._detections}get preferWorkers(){return Fa.config.preferWorkers}set preferWorkers(t){ot("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(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Gr=new RE;K.handleByList(Y.LoadParser,Gr.loader.parsers).handleByList(Y.ResolveParser,Gr.resolver.parsers).handleByList(Y.CacheParser,Gr.cache.parsers).handleByList(Y.DetectionParser,Gr.detections);const ME={extension:Y.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof q),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};K.add(ME);async function Tm(i){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const FE={extension:{type:Y.DetectionParser,priority:1},test:async()=>Tm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};K.add(FE);const kE={extension:{type:Y.DetectionParser,priority:0},test:async()=>Tm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};K.add(kE);const Am=["png","jpg","jpeg"],BE={extension:{type:Y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Am],remove:async i=>i.filter(t=>!Am.includes(t))};K.add(BE);const DE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function oc(i){return DE?!1:document.createElement("video").canPlayType(i)!==""}const OE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};K.add(OE);const LE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};K.add(LE);const NE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};K.add(NE);const VE={extension:Y.ResolveParser,test:Fa.test,parse:i=>{var t;return{resolution:parseFloat(((t=z.RETINA_PREFIX.exec(i))==null?void 0:t[1])??"1"),format:bt.extname(i).slice(1),src:i}}};K.add(VE);var ve=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i))(ve||{});const ka={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 Zs,pn;function Sm(){pn={bptc:Zs.getExtension("EXT_texture_compression_bptc"),astc:Zs.getExtension("WEBGL_compressed_texture_astc"),etc:Zs.getExtension("WEBGL_compressed_texture_etc"),s3tc:Zs.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Zs.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Zs.getExtension("WEBGL_compressed_texture_pvrtc")||Zs.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Zs.getExtension("WEBGL_compressed_texture_etc1"),atc:Zs.getExtension("WEBGL_compressed_texture_atc")}}const UE={extension:{type:Y.DetectionParser,priority:2},test:async()=>{const i=z.ADAPTER.createCanvas().getContext("webgl");return i?(Zs=i,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{pn||Sm();const t=[];for(const e in pn)pn[e]&&t.push(e);return[...t,...i]},remove:async i=>(pn||Sm(),i.filter(t=>!(t in pn)))};K.add(UE);class GE extends aa{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,r;typeof t=="string"?(s=t,r=new Uint8Array):(s=null,r=t),super(r,e),this.origin=s,this.buffer=r?new Sh(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?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 Sh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Si extends GE{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=Si._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Si._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){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 n=0,a=this.levels;n<a;n++){const{levelID:h,levelWidth:o,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,h,this.format,o,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Si._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(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,s,r,n,a,h){const o=new Array(s);let l=t.byteOffset,u=a,c=h,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*ka[e];for(let m=0;m<s;m++)o[m]={levelID:m,levelWidth:s>1?u:d,levelHeight:s>1?c:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,u=u>>1||1,c=c>>1||1,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*ka[e];return o}}const ac=4,Ba=124,XE=32,Cm=20,$E=542327876,Da={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},YE={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Oa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},HE=1,WE=2,zE=4,jE=64,qE=512,ZE=131072,KE=827611204,QE=861165636,JE=894720068,tT=808540228,eT=4,sT={[KE]:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,[QE]:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,[JE]:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT},rT={70:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:ve.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:ve.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:ve.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:ve.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function iT(i){const t=new Uint32Array(i);if(t[0]!==$E)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,Ba/Uint32Array.BYTES_PER_ELEMENT),s=e[Da.HEIGHT],r=e[Da.WIDTH],n=e[Da.MIPMAP_COUNT],a=new Uint32Array(i,Da.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,XE/Uint32Array.BYTES_PER_ELEMENT),h=a[HE];if(h&zE){const o=a[YE.FOURCC];if(o!==tT){const x=sT[o],y=ac+Ba,v=new Uint8Array(i,y);return[new Si(v,{format:x,width:r,height:s,levels:n})]}const l=ac+Ba,u=new Uint32Array(t.buffer,l,Cm/Uint32Array.BYTES_PER_ELEMENT),c=u[Oa.DXGI_FORMAT],d=u[Oa.RESOURCE_DIMENSION],f=u[Oa.MISC_FLAG],p=u[Oa.ARRAY_SIZE],m=rT[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===eT)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,_=ac+Ba+Cm;if(p===1)g.push(new Uint8Array(i,_));else{const x=ka[m];let y=0,v=r,b=s;for(let E=0;E<n;E++){const T=Math.max(1,v+3&-4),A=Math.max(1,b+3&-4),I=T*A*x;y+=I,v=v>>>1,b=b>>>1}let w=_;for(let E=0;E<p;E++)g.push(new Uint8Array(i,w,y)),w+=y}return g.map(x=>new Si(x,{format:m,width:r,height:s,levels:n}))}throw h&jE?new Error("DDSParser does not support uncompressed texture data."):h&qE?new Error("DDSParser does not supported YUV uncompressed texture data."):h&ZE?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&WE?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Im=[171,75,84,88,32,49,49,187,13,10,26,10],nT=67305985,As={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},lc=64,Pm={[tt.UNSIGNED_BYTE]:1,[tt.UNSIGNED_SHORT]:2,[tt.INT]:4,[tt.UNSIGNED_INT]:4,[tt.FLOAT]:4,[tt.HALF_FLOAT]:8},oT={[G.RGBA]:4,[G.RGB]:3,[G.RG]:2,[G.RED]:1,[G.LUMINANCE]:1,[G.LUMINANCE_ALPHA]:2,[G.ALPHA]:1},aT={[tt.UNSIGNED_SHORT_4_4_4_4]:2,[tt.UNSIGNED_SHORT_5_5_5_1]:2,[tt.UNSIGNED_SHORT_5_6_5]:2};function lT(i,t,e=!1){const s=new DataView(t);if(!hT(i,s))return null;const r=s.getUint32(As.ENDIANNESS,!0)===nT,n=s.getUint32(As.GL_TYPE,r),a=s.getUint32(As.GL_FORMAT,r),h=s.getUint32(As.GL_INTERNAL_FORMAT,r),o=s.getUint32(As.PIXEL_WIDTH,r),l=s.getUint32(As.PIXEL_HEIGHT,r)||1,u=s.getUint32(As.PIXEL_DEPTH,r)||1,c=s.getUint32(As.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(As.NUMBER_OF_FACES,r),f=s.getUint32(As.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(As.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,_=o+3&-4,x=l+3&-4,y=new Array(c);let v=o*l;n===0&&(v=_*x);let b;if(n!==0?Pm[n]?b=Pm[n]*oT[a]:b=aT[n]:b=ka[h],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?uT(s,p,r):null;let E=v*b,T=o,A=l,I=_,M=x,R=lc+p;for(let C=0;C<f;C++){const P=s.getUint32(R,r);let k=R+4;for(let U=0;U<c;U++){let V=y[U];V||(V=y[U]=new Array(f)),V[C]={levelID:C,levelWidth:f>1||n!==0?T:I,levelHeight:f>1||n!==0?A:M,levelBuffer:new Uint8Array(t,k,E)},k+=E}R+=P+4,R=R%4!==0?R+4-R%4:R,T=T>>1||1,A=A>>1||1,I=T+m-1&~(m-1),M=A+g-1&~(g-1),E=I*M*b}return n!==0?{uncompressed:y.map(C=>{let P=C[0].levelBuffer,k=!1;return n===tt.FLOAT?P=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===tt.UNSIGNED_INT?(k=!0,P=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===tt.INT&&(k=!0,P=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new aa(P,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:k?cT(a):a}}),kvData:w}:{compressed:y.map(C=>new Si(null,{format:h,width:o,height:l,levels:f,levelBuffers:C})),kvData:w}}function hT(i,t){for(let e=0;e<Im.length;e++)if(t.getUint8(e)!==Im[e])return console.error(`${i} is not a valid *.ktx file!`),!1;return!0}function cT(i){switch(i){case G.RGBA:return G.RGBA_INTEGER;case G.RGB:return G.RGB_INTEGER;case G.RG:return G.RG_INTEGER;case G.RED:return G.RED_INTEGER;default:return i}}function uT(i,t,e){const s=new Map;let r=0;for(;r<t;){const n=i.getUint32(lc+r,e),a=lc+r+4,h=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let o=0;for(;o<n&&i.getUint8(a+o)!==0;o++);if(o===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(i.buffer,a,o)),u=new DataView(i.buffer,a+o+1,n-o-1);s.set(l,u),r+=4+n+h}return s}const dT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadDDS",test(i){return Le(i,".dds")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),r=iT(s).map(n=>{const a=new et(n,{mipmap:xs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data});return ho(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(dT);const fT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadKTX",test(i){return Le(i,".ktx")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=lT(i,s),h=r??n,o={mipmap:xs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data},l=h.map(u=>{h===n&&Object.assign(o,{type:u.type,format:u.format});const c=u.resource??u,d=new et(c,o);return d.ktxKeyValueData=a,ho(d,e,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(fT);const pT=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],mT={extension:Y.ResolveParser,test:i=>{const t=bt.extname(i).slice(1);return["basis","ktx","dds"].includes(t)},parse:i=>{var s,r;const t=i.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(pT.includes(n))return{resolution:parseFloat(((s=z.RETINA_PREFIX.exec(i))==null?void 0:s[1])??"1"),format:n,src:i}}return{resolution:parseFloat(((r=z.RETINA_PREFIX.exec(i))==null?void 0:r[1])??"1"),format:e,src:i}}};K.add(mT);const La=new rt,gT=4,Rm=class Lo{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,s,r){const n=new Image;return n.src=await this.base64(t,e,s,r),n}async base64(t,e,s,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,h)=>{n.toBlob(o=>{if(!o){h(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((h,o)=>{const l=new FileReader;l.onload=()=>h(l.result),l.onerror=o,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);a&&Lo._flipY(s,r,n),h&&Lo._unpremultiplyAlpha(s);const o=new Kb(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return o.context.putImageData(l,0,0),o.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);return a&&Lo._flipY(s,r,n),h&&Lo._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let r,n=!1,a=!1,h,o=!1;t&&(t instanceof wi?h=t:(h=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),o=!0,e&&(La.width=e.width,La.height=e.height,e=La)));const l=s.gl;if(h){if(r=h.baseTexture.resolution,e=e??h.frame,n=!1,a=h.baseTexture.alphaMode>0&&h.baseTexture.format===G.RGBA,!o){s.renderTexture.bind(h);const f=h.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else r=s.resolution,e||(e=La,e.width=s.width/r,e.height=s.height/r),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),d=new Uint8Array(gT*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),o&&(h==null||h.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const r=e<<2,n=s>>1,a=new Uint8Array(r);for(let h=0;h<n;h++){const o=h*r,l=(s-h-1)*r;a.set(t.subarray(o,o+r)),t.copyWithin(o,l,l+r),t.set(a,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let s=0;s<e;s+=4){const r=t[s+3];if(r!==0){const n=255.001/r;t[s]=t[s]*n+.5,t[s+1]=t[s+1]*n+.5,t[s+2]=t[s+2]*n+.5}}}};Rm.extension={name:"extract",type:Y.RendererSystem};let _T=Rm;K.add(_T);const Na={build(i){const t=i.points;let e,s,r,n,a,h;if(i.type===xe.CIRC){const p=i.shape;e=p.x,s=p.y,a=h=p.radius,r=n=0}else if(i.type===xe.ELIP){const p=i.shape;e=p.x,s=p.y,a=p.width,h=p.height,r=n=0}else{const p=i.shape,m=p.width/2,g=p.height/2;e=p.x+m,s=p.y+g,a=h=Math.max(0,Math.min(p.radius,Math.min(m,g))),r=m-a,n=g-h}if(!(a>=0&&h>=0&&r>=0&&n>=0)){t.length=0;return}const o=Math.ceil(2.3*Math.sqrt(a+h)),l=o*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(o===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=s+n,t[2]=t[4]=e-r,t[5]=t[7]=s-n;return}let u=0,c=o*4+(r?2:0)+2,d=c,f=l;{const p=r+a,m=n,g=e+p,_=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=_,n){const y=s-m;t[d++]=_,t[d++]=y,t[--f]=y,t[--f]=g}}for(let p=1;p<o;p++){const m=Math.PI/2*(p/o),g=r+Math.cos(m)*a,_=n+Math.sin(m)*h,x=e+g,y=e-g,v=s+_,b=s-_;t[u++]=x,t[u++]=v,t[--c]=v,t[--c]=y,t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=x}{const p=r,m=n+h,g=e+p,_=e-p,x=s+m,y=s-m;t[u++]=g,t[u++]=x,t[--f]=y,t[--f]=g,r&&(t[u++]=_,t[u++]=x,t[--f]=y,t[--f]=_)}},triangulate(i,t){const e=i.points,s=t.points,r=t.indices;if(e.length===0)return;let n=s.length/2;const a=n;let h,o;if(i.type!==xe.RREC){const u=i.shape;h=u.x,o=u.y}else{const u=i.shape;h=u.x+u.width/2,o=u.y+u.height/2}const l=i.matrix;s.push(i.matrix?l.a*h+l.c*o+l.tx:h,i.matrix?l.b*h+l.d*o+l.ty:o),n++,s.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)s.push(e[u],e[u+1]),r.push(n++,a,n);r.push(a+1,a,n)}};function Mm(i,t=!1){const e=i.length;if(e<6)return;let s=0;for(let r=0,n=i[e-2],a=i[e-1];r<e;r+=2){const h=i[r],o=i[r+1];s+=(h-n)*(o+a),n=h,a=o}if(!t&&s>0||t&&s<=0){const r=e/2;for(let n=r+r%2;n<e;n+=2){const a=e-n-2,h=e-n-1,o=n,l=n+1;[i[a],i[o]]=[i[o],i[a]],[i[h],i[l]]=[i[l],i[h]]}}}const Fm={build(i){i.points=i.shape.points.slice()},triangulate(i,t){let e=i.points;const s=i.holes,r=t.points,n=t.indices;if(e.length>=6){Mm(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];Mm(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const h=My(e,a,2);if(!h)return;const o=r.length/2;for(let l=0;l<h.length;l+=3)n.push(h[l]+o),n.push(h[l+1]+o),n.push(h[l+2]+o);for(let l=0;l<e.length;l++)r.push(e[l])}}},yT={build(i){const t=i.shape,e=t.x,s=t.y,r=t.width,n=t.height,a=i.points;a.length=0,r>=0&&n>=0&&a.push(e,s,e+r,s,e+r,s+n,e,s+n)},triangulate(i,t){const e=i.points,s=t.points;if(e.length===0)return;const r=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},xT={build(i){Na.build(i)},triangulate(i,t){Na.triangulate(i,t)}};var ls=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(ls||{}),Xr=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(Xr||{});const mn={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,t=20){if(!this.adaptive||!i||isNaN(i))return t;let e=Math.ceil(i/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class km{static curveTo(t,e,s,r,n,a){const h=a[a.length-2],o=a[a.length-1]-e,l=h-t,u=r-e,c=s-t,d=Math.abs(o*c-l*u);if(d<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=o*o+l*l,p=u*u+c*c,m=o*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(p)/d,x=g*m/f,y=_*m/p,v=g*c+_*l,b=g*u+_*o,w=l*(_+x),E=o*(_+x),T=c*(g+y),A=u*(g+y),I=Math.atan2(E-b,w-v),M=Math.atan2(A-b,T-v);return{cx:v+t,cy:b+e,radius:n,startAngle:I,endAngle:M,anticlockwise:l*u>c*o}}static arc(t,e,s,r,n,a,h,o,l){const u=h-a,c=mn._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/ha)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,_=g%1/g;for(let x=0;x<=g;++x){const y=x+_*x,v=d+a+f*y,b=Math.cos(v),w=-Math.sin(v);l.push((p*b+m*w)*n+s,(p*-w+m*b)*n+r)}}}class vT{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class hc{static curveLength(t,e,s,r,n,a,h,o){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,y=0,v=t,b=e;for(let w=1;w<=10;++w)u=w/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,g=m*t+3*p*u*s+3*f*c*n+d*h,_=m*e+3*p*u*r+3*f*c*a+d*o,x=v-g,y=b-_,v=g,b=_,l+=Math.sqrt(x*x+y*y);return l}static curveTo(t,e,s,r,n,a,h){const o=h[h.length-2],l=h[h.length-1];h.length-=2;const u=mn._segmentsCount(hc.curveLength(o,l,t,e,s,r,n,a));let c=0,d=0,f=0,p=0,m=0;h.push(o,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,p=_*_,m=p*_,h.push(f*o+3*d*_*t+3*c*p*s+m*n,f*l+3*d*_*e+3*c*p*r+m*a)}}function Bm(i,t,e,s,r,n,a,h){const o=i-e*r,l=t-s*r,u=i+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=o+d,m=l+f,g=u+d,_=c+f;return h.push(p,m,g,_),2}function Ci(i,t,e,s,r,n,a,h){const o=e-i,l=s-t;let u=Math.atan2(o,l),c=Math.atan2(r-i,n-t);h&&u<c?u+=Math.PI*2:!h&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(o*o+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,h){a.push(i,t,e,s);for(let x=1,y=d;x<g;x++,y+=_)a.push(i,t,i+Math.sin(y)*m,t+Math.cos(y)*m);a.push(i,t,r,n)}else{a.push(e,s,i,t);for(let x=1,y=d;x<g;x++,y+=_)a.push(i+Math.sin(y)*m,t+Math.cos(y)*m,i,t);a.push(r,n,i,t)}return g*2}function bT(i,t){const e=i.shape;let s=i.points||e.points.slice();const r=t.closePointEps;if(s.length===0)return;const n=i.lineStyle,a=new st(s[0],s[1]),h=new st(s[s.length-2],s[s.length-1]),o=e.type!==xe.POLY||e.closeStroke,l=Math.abs(a.x-h.x)<r&&Math.abs(a.y-h.y)<r;if(o){s=s.slice(),l&&(s.pop(),s.pop(),h.set(s[s.length-2],s[s.length-1]));const V=(a.x+h.x)*.5,L=(h.y+a.y)*.5;s.unshift(V,L),s.push(V,L)}const u=t.points,c=s.length/2;let d=s.length;const f=u.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let _=s[0],x=s[1],y=s[2],v=s[3],b=0,w=0,E=-(x-v),T=_-y,A=0,I=0,M=Math.sqrt(E*E+T*T);E/=M,T/=M,E*=p,T*=p;const R=n.alignment,C=(1-R)*2,P=R*2;o||(n.cap===Xr.ROUND?d+=Ci(_-E*(C-P)*.5,x-T*(C-P)*.5,_-E*C,x-T*C,_+E*P,x+T*P,u,!0)+2:n.cap===Xr.SQUARE&&(d+=Bm(_,x,E,T,C,P,!0,u))),u.push(_-E*C,x-T*C,_+E*P,x+T*P);for(let V=1;V<c-1;++V){_=s[(V-1)*2],x=s[(V-1)*2+1],y=s[V*2],v=s[V*2+1],b=s[(V+1)*2],w=s[(V+1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,A=-(v-w),I=y-b,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=p,I*=p;const L=y-_,$=x-v,O=y-b,N=w-v,Z=L*O+$*N,Q=$*O-N*L,H=Q<0;if(Math.abs(Q)<.001*Math.abs(Z)){u.push(y-E*C,v-T*C,y+E*P,v+T*P),Z>=0&&(n.join===ls.ROUND?d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4:d+=2,u.push(y-A*P,v-I*P,y+A*C,v+I*C));continue}const lt=(-E+_)*(-T+v)-(-E+y)*(-T+x),Et=(-A+b)*(-I+v)-(-A+y)*(-I+w),_t=(L*Et-O*lt)/Q,kt=(N*lt-$*Et)/Q,zt=(_t-y)*(_t-y)+(kt-v)*(kt-v),Qt=y+(_t-y)*C,Pt=v+(kt-v)*C,jt=y-(_t-y)*P,Ot=v-(kt-v)*P,ze=Math.min(L*L+$*$,O*O+N*N),is=H?C:P,li=ze+is*is*m,kn=zt<=li;let hi=n.join;if(hi===ls.MITER&&zt/m>g&&(hi=ls.BEVEL),kn)switch(hi){case ls.MITER:{u.push(Qt,Pt,jt,Ot);break}case ls.BEVEL:{H?u.push(Qt,Pt,y+E*P,v+T*P,Qt,Pt,y+A*P,v+I*P):u.push(y-E*C,v-T*C,jt,Ot,y-A*C,v-I*C,jt,Ot),d+=2;break}case ls.ROUND:{H?(u.push(Qt,Pt,y+E*P,v+T*P),d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+4,u.push(Qt,Pt,y+A*P,v+I*P)):(u.push(y-E*C,v-T*C,jt,Ot),d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4,u.push(y-A*C,v-I*C,jt,Ot));break}}else{switch(u.push(y-E*C,v-T*C,y+E*P,v+T*P),hi){case ls.MITER:{H?u.push(jt,Ot,jt,Ot):u.push(Qt,Pt,Qt,Pt),d+=2;break}case ls.ROUND:{H?d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+2:d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+2;break}}u.push(y-A*C,v-I*C,y+A*P,v+I*P),d+=2}}_=s[(c-2)*2],x=s[(c-2)*2+1],y=s[(c-1)*2],v=s[(c-1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,u.push(y-E*C,v-T*C,y+E*P,v+T*P),o||(n.cap===Xr.ROUND?d+=Ci(y-E*(C-P)*.5,v-T*(C-P)*.5,y-E*C,v-T*C,y+E*P,v+T*P,u,!1)+2:n.cap===Xr.SQUARE&&(d+=Bm(y,v,E,T,C,P,!1,u)));const k=t.indices,U=mn.epsilon*mn.epsilon;for(let V=f;V<d+f-2;++V)_=u[V*2],x=u[V*2+1],y=u[(V+1)*2],v=u[(V+1)*2+1],b=u[(V+2)*2],w=u[(V+2)*2+1],!(Math.abs(_*(v-w)+y*(w-x)+b*(x-v))<U)&&k.push(V,V+1,V+2)}function wT(i,t){let e=0;const s=i.shape,r=i.points||s.points,n=s.type!==xe.POLY||s.closeStroke;if(r.length===0)return;const a=t.points,h=t.indices,o=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),e=1;e<o;e++)a.push(r[e*2],r[e*2+1]),h.push(u,u+1),u++;n&&h.push(u,l)}function Dm(i,t){i.lineStyle.native?wT(i,t):bT(i,t)}class cc{static curveLength(t,e,s,r,n,a){const h=t-2*s+n,o=e-2*r+a,l=2*s-2*t,u=2*r-2*e,c=4*(h*h+o*o),d=4*(h*l+o*u),f=l*l+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),g=2*c*m,_=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-_)+(4*f*c-d*d)*Math.log((2*m+x+p)/(x+_)))/(4*g)}static curveTo(t,e,s,r,n){const a=n[n.length-2],h=n[n.length-1],o=mn._segmentsCount(cc.curveLength(a,h,t,e,s,r));let l=0,u=0;for(let c=1;c<=o;++c){const d=c/o;l=a+(t-a)*d,u=h+(e-h)*d,n.push(l+(t+(s-t)*d-l)*d,u+(e+(r-e)*d-u)*d)}}}const uc={[xe.POLY]:Fm,[xe.CIRC]:Na,[xe.ELIP]:Na,[xe.RECT]:yT,[xe.RREC]:xT},Om=[],Va=[];class Ua{constructor(t,e=null,s=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new Ua(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 gn=new st,Lm=class ry extends mp{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 Ia,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(),Va.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Om.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,s=null,r=null){const n=new Ua(t,e,s,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Ua(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=r.lineStyle,r.holes.push(s),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 s=0;s<e.length;++s){const r=e[s];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,gn):gn.copyFrom(t),r.shape.contains(gn.x,gn.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.holes[a].shape.contains(gn.x,gn.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let s=null,r=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],r=s.style);for(let o=this.shapeIndex;o<e.length;o++){this.shapeIndex++;const l=e[o],u=l.fillStyle,c=l.lineStyle;uc[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?u:c;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=Fr.REPEAT,d===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-g;_!==0&&(s&&!this._compareStyles(r,f)&&(s.end(m,g),s=null),s||(s=Om.pop()||new vT,s.begin(f,m,g),this.batches.push(s),r=f),this.addUvs(this.points,t,f.texture,g,_,f.matrix))}}const n=this.indices.length,a=this.points.length/2;if(s&&s.end(n,a),this.batches.length===0){this.batchable=!0;return}const h=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&h===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=h?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 s=this.graphicsData[t],r=s.fillStyle,n=s.lineStyle;if(r&&!r.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,s=t.length;e<s;e++){const r=t[e];for(let n=0;n<r.size;n++){const a=r.start+n;this.indicesUint16[a]=this.indicesUint16[a]-r.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<ry.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++et._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Va.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let r=Va.pop();r||(r=new Dh,r.texArray=new Gh),r.texArray.count=0,r.start=0,r.size=0,r.type=ys.TRIANGLES;let n=0,a=null,h=0,o=!1,l=ys.TRIANGLES,u=0;this.drawCalls.push(r);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],f=8,p=d.style,m=p.texture.baseTexture;o!==!!p.native&&(o=!!p.native,l=o?ys.LINES:ys.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=Va.pop(),r||(r=new Dh,r.texArray=new Gh),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Fr.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,u+=d.size,h=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,h,d.attribSize,d.attribStart)}et._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),h=new Uint32Array(n);let o=0;for(let l=0;l<t.length/2;l++)a[o++]=t[l*2],a[o++]=t[l*2+1],a[o++]=e[l*2],a[o++]=e[l*2+1],h[o++]=s[l],a[o++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?Fm.triangulate(t,this):uc[t.type].triangulate(t,this)}processLine(t){Dm(t,this);for(let e=0;e<t.holes.length;e++)Dm(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];uc[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.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 s=0;s<t.length/2;s++){const r=t[s*2],n=t[s*2+1];t[s*2]=e.a*r+e.c*n+e.tx,t[s*2+1]=e.b*r+e.d*n+e.ty}}addColors(t,e,s,r,n=0){const a=Ct.shared.setValue(e).toLittleEndianNumber(),h=Ct.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+r);for(let o=0;o<r;o++)t[n+o]=h}addTextureIds(t,e,s,r=0){t.length=Math.max(t.length,r+s);for(let n=0;n<s;n++)t[r+n]=e}addUvs(t,e,s,r,n,a=null){let h=0;const o=e.length,l=s.frame;for(;h<n;){let c=t[(r+h)*2],d=t[(r+h)*2+1];if(a){const f=a.a*c+a.c*d+a.tx;d=a.b*c+a.d*d+a.ty,c=f}h++,e.push(c/l.width,d/l.height)}const u=s.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,s,o,n)}adjustUvs(t,e,s,r){const n=e.baseTexture,a=1e-6,h=s+r*2,o=e.frame,l=o.width/n.width,u=o.height/n.height;let c=o.x/o.width,d=o.y/o.height,f=Math.floor(t[s]+a),p=Math.floor(t[s+1]+a);for(let m=s+2;m<h;m+=2)f=Math.min(f,Math.floor(t[m]+a)),p=Math.min(p,Math.floor(t[m+1]+a));c-=f,d-=p;for(let m=s;m<h;m+=2)t[m]=(t[m]+c)*l,t[m+1]=(t[m+1]+d)*u}};Lm.BATCHABLE_SIZE=100;let ET=Lm;class Ga{constructor(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ga;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=q.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class dc extends Ga{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}clone(){const t=new dc;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=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}}const fc={},pc=class Sl extends Bt{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 Ga,this._lineStyle=new dc,this._matrix=null,this._holeMode=!1,this.state=zs.for2d(),this._geometry=t||new ET,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ct(16777215),this.blendMode=W.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Sl(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,s,r=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:s,alignment:r,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:q.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Xr.BUTT,join:ls.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.width>0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Nr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Nr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,r=s[s.length-2],n=s[s.length-1];return(r!==t||n!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),cc.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),hc.curveTo(t,e,s,r,n,a,this.currentPath.points),this}arcTo(t,e,s,r,n){this._initCurve(t,e);const a=this.currentPath.points,h=km.curveTo(t,e,s,r,n,a);if(h){const{cx:o,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=h;this.arc(o,l,u,c,d,f)}return this}arc(t,e,s,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=ha:a&&r<=n&&(r+=ha),n-r===0)return this;const h=t+Math.cos(r)*s,o=e+Math.sin(r)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-h),d=Math.abs(u[u.length-1]-o);c<l&&d<l||u.push(h,o)}else this.moveTo(h,o),u=this.currentPath.points;return km.arc(h,o,t,e,s,r,n,a,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:q.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ct.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:q.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,r){return this.drawShape(new rt(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new fa(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new ua(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new da(t,e,s,r))}drawPolygon(...t){let e,s=!0;const r=t[0];r.points?(s=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Nr(e);return n.closeStroke=s,this.drawShape(n),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 t.length===1&&t[0].shape.type===xe.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let r=0;r<s;r++){const n=t.batches[r],a=n.style.color,h=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),o=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:h,blendMode:e,indices:l,uvs:o,_batchRGB:Ct.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,s=this.batches.length;e<s;e++){const r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,r=this.worldAlpha,n=e.uniforms,a=s.drawCalls;n.translationMatrix=this.transform.worldTransform,Ct.shared.setValue(this._tintColor).premultiply(r).toArray(n.tint),t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,s.drawCalls[h])}_renderDrawCallDirect(t,e){const{texArray:s,type:r,size:n,start:a}=e,h=s.count;for(let o=0;o<h;o++)t.texture.bind(s.elements[o],o);t.geometry.draw(r,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!fc[s]){const{maxTextures:r}=t.plugins[s],n=new Int32Array(r);for(let o=0;o<r;o++)n[o]=o;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:ws.from({uSamplers:n},!0)},h=t.plugins[s]._shader.program;fc[s]=new qs(h,a)}e=fc[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:r,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,s,r,n)}containsPoint(t){return this.worldTransform.applyInverse(t,Sl._TEMP_POINT),this._geometry.containsPoint(Sl._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=Ct.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,s=e.a,r=e.b,n=e.c,a=e.d,h=e.tx,o=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const f=l[d],p=l[d+1];u[c++]=s*f+n*p+h,u[c++]=a*p+r*f+o}}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--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};pc.curves=mn,pc._TEMP_POINT=new st;let Ks=pc;class TT{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 mc=new st,Nm=new Nr,Vm=class iy extends Bt{constructor(t,e,s,r=ys.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||zs.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=z.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}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(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===ys.TRIANGLES&&e.length<iy.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_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,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=s._tintRGB,this._texture=s.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,s=t._updateID;if(s===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,n=r.a,a=r.b,h=r.c,o=r.d,l=r.tx,u=r.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const f=e[d*2],p=e[d*2+1];c[d*2]=n*f+h*p+l,c[d*2+1]=a*f+o*p+u}if(this._roundPixels){const d=z.RESOLUTION;for(let f=0;f<c.length;++f)c[f]=Math.round(c[f]*d)/d}this.vertexDirty=s}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new TT(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,mc);const e=this.geometry.getBuffer("aVertexPosition").data,s=Nm.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let h=0;h+2<n;h+=a){const o=r[h]*2,l=r[h+1]*2,u=r[h+2]*2;if(s[0]=e[o],s[1]=e[o+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[u],s[5]=e[u+1],Nm.contains(mc.x,mc.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}};Vm.BATCHABLE_SIZE=100;let Xa=Vm;class gc extends Lr{constructor(t,e,s){super();const r=new Jt(t),n=new Jt(e,!0),a=new Jt(s,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,tt.FLOAT).addAttribute("aTextureCoord",n,2,!1,tt.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var AT=`varying vec2 vTextureCoord;
912
912
  uniform vec4 uColor;
913
913
 
914
914
  uniform sampler2D uSampler;
@@ -1080,7 +1080,7 @@ void main(void)
1080
1080
  vec4 texSample = texture2D(uSampler, vTextureCoord);
1081
1081
  gl_FragColor = texSample * uColor;
1082
1082
  }
1083
- `;const ja=new Rt;class jm extends xa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Mp,this.state=zs.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=qs.from(zm,ZT,e),this.shader=t.context.webGLVersion>1?qs.from(jT,zT,e):qs.from(zm,qT,e)}render(t){const e=this.renderer,s=this.quad;let r=s.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 n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;r=s.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,s.invalidate();const h=t._texture,o=h.baseTexture,l=o.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=o.isPowerOfTwo&&h.frame.width===o.width&&h.frame.height===o.height;d&&(o._glTextures[e.CONTEXT_UID]?d=o.wrapMode!==Fr.CLAMP:o.wrapMode===Fr.CLAMP&&(o.wrapMode=Fr.REPEAT));const f=d?this.simpleShader:this.shader,p=h.width,m=h.height,g=t._width,_=t._height;ja.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),ja.invert(),d?ja.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=ja.toArray(!0),f.uniforms.uColor=Ct.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=h,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=ip(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}jm.extension={name:"tilingSprite",type:Y.RendererPlugin},K.add(jm);const qm=class Vo{constructor(t,e,s){this.linkedSheets=[],(t instanceof et||t instanceof q)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:r,data:n,resolutionFilename:a=null,cachePrefix:h=""}=t;this.cachePrefix=h,this._texture=r instanceof q?r:null,this.baseTexture=r instanceof et?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const o=this.baseTexture.resource;this.resolution=this._updateResolution(a||(o?o.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=_r(t,null);return s===null&&(s=typeof e=="number"?e:parseFloat(e??"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Vo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Vo.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const r=this._frameKeys[e],n=this._frames[r],a=n.frame;if(a){let h=null,o=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new rt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?h=new rt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new rt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(o=new rt(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[r]=new q(this.baseTexture,h,u,o,n.rotated?2:0,n.anchor,n.borders),q.addToCache(this.textures[r],this.cachePrefix+r.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const r=t[e][s];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*Vo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Vo.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};qm.BATCH_SIZE=1e3;let Zm=qm;const KT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Km(i,t,e){const s={};if(i.forEach(r=>{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=vt.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,Km([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const QT={extension:Y.Asset,cache:{test:i=>i instanceof Zm,getCacheableAssets:(i,t)=>Km(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&KT.includes(s)},parse:i=>{var e;const t=i.split(".");return{resolution:parseFloat(((e=z.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:Y.LoadParser,priority:Ne.Normal},async testParse(i,t){return vt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var u,c;const{texture:s,imageFilename:r,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=vt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(s&&s.baseTexture)h=s;else{const d=rc(a+(r??i.meta.image),t.src);h=(await e.load([d]))[d]}const o=new Zm({texture:h.baseTexture,data:i,resolutionFilename:t.src,cachePrefix:n});await o.parse();const l=(u=i==null?void 0:i.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(l)){const d=[];for(const p of l){if(typeof p!="string")continue;let m=a+p;(c=t.data)!=null&&c.ignoreMultiPack||(m=rc(m,t.src),d.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);o.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[o].concat(o.linkedSheets.filter(m=>m!==p))})}return o},unload(i){i.destroy(!0)}}};K.add(QT);class qa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Za{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const a=e[n].match(/^[a-z]+/gm)[0],h=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(const l in h){const u=h[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;o[c]=p}s[a].push(o)}const r=new qa;return s.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),s.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class vc{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new qa,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),h=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let l=0;l<s.length;l++)e.info.push({face:s[l].getAttribute("face"),size:parseInt(s[l].getAttribute("size"),10)});for(let l=0;l<r.length;l++)e.common.push({lineHeight:parseInt(r[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<a.length;l++){const u=a[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<h.length;l++)e.kerning.push({first:parseInt(h[l].getAttribute("first"),10),second:parseInt(h[l].getAttribute("second"),10),amount:parseInt(h[l].getAttribute("amount"),10)});for(let l=0;l<o.length;l++)e.distanceField.push({fieldType:o[l].getAttribute("fieldType"),distanceRange:parseInt(o[l].getAttribute("distanceRange"),10)});return e}}class bc{static test(t){return typeof t=="string"&&t.includes("<font>")?vc.test(z.ADAPTER.parseXML(t)):!1}static parse(t){return vc.parse(z.ADAPTER.parseXML(t))}}const wc=[Za,vc,bc];function JT(i){for(let t=0;t<wc.length;t++)if(wc[t].test(i))return wc[t];return null}function tA(i,t,e,s,r,n){const a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let h;const o=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=i.width/s-o-l*2,c=i.height/s-o-l*2,d=a.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(a[0]),f.unshift(0),d.push(a[a.length-1]),f.push(1),e.fillGradientType===Ha.LINEAR_VERTICAL){h=t.createLinearGradient(u/2,l,u/2,c+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<r.length;g++){const _=n.lineHeight*g;for(let x=0;x<d.length;x++){let y=0;typeof f[x]=="number"?y=f[x]:y=x/d.length;const v=_/c+y*m;let b=Math.max(p,v);b=Math.min(b,1),h.addColorStop(b,d[x]),p=b}}}else{h=t.createLinearGradient(l,c/2,u+l,c/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let _;typeof f[g]=="number"?_=f[g]:_=m/p,h.addColorStop(_,d[g]),m++}}return h}function eA(i,t,e,s,r,n,a){const h=e.text,o=e.fontProperties;t.translate(s,r),t.scale(n,n);const l=a.strokeThickness/2,u=-(a.strokeThickness/2);if(t.font=a.toFontString(),t.lineWidth=a.strokeThickness,t.textBaseline=a.textBaseline,t.lineJoin=a.lineJoin,t.miterLimit=a.miterLimit,t.fillStyle=tA(i,t,a,n,[h],e),t.strokeStyle=a.stroke,a.dropShadow){const c=a.dropShadowColor,d=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=Ct.shared.setValue(c).setAlpha(a.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(h,l,u+e.lineHeight-o.descent),a.fill&&t.fillText(h,l,u+e.lineHeight-o.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ka(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function Qm(i){return Array.from?Array.from(i):i.split("")}function sA(i){typeof i=="string"&&(i=[i]);const t=[];for(let e=0,s=i.length;e<s;e++){const r=i[e];if(Array.isArray(r)){if(r.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);const n=r[0].charCodeAt(0),a=r[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let h=n,o=a;h<=o;h++)t.push(String.fromCharCode(h))}else t.push(...Qm(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Yr=class ur{constructor(t,e,s){var u;const[r]=t.info,[n]=t.common,[a]=t.page,[h]=t.distanceField,o=_r(a.file),l={};this._ownsTextures=s,this.font=r.face,this.size=r.size,this.lineHeight=n.lineHeight/o,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:f}=t.page[c];l[d]=e instanceof Array?e[c]:e[f],h!=null&&h.fieldType&&h.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Re.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=xs.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:f}=t.char[c];let{x:p,y:m,width:g,height:_,xoffset:x,yoffset:y,xadvance:v}=t.char[c];p/=o,m/=o,g/=o,_/=o,x/=o,y/=o,v/=o;const b=new rt(p+l[f].frame.x/o,m+l[f].frame.y/o,g,_);this.chars[d]={xOffset:x,yOffset:y,xAdvance:v,kerning:{},texture:new q(l[f].baseTexture,b),page:f}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:f,amount:p}=t.kerning[c];d/=o,f/=o,p/=o,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=h==null?void 0:h.distanceRange,this.distanceFieldType=((u=h==null?void 0:h.fieldType)==null?void 0:u.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(t,e,s){let r;if(t instanceof qa)r=t;else{const a=JT(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof q&&(e=[e]);const n=new ur(r,e,s);return ur.available[n.font]=n,n}static uninstall(t){const e=ur.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ur.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:a,textureWidth:h,textureHeight:o,...l}=Object.assign({},ur.defaultOptions,s),u=sA(r),c=e instanceof vr?e:new vr(e),d=h,f=new qa;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p=0,m=0,g,_,x,y=0;const v=[];for(let w=0;w<u.length;w++){g||(g=z.ADAPTER.createCanvas(),g.width=h,g.height=o,_=g.getContext("2d"),x=new et(g,{resolution:a,...l}),v.push(new q(x)),f.page.push({id:v.length-1,file:""}));const E=u[w],T=$r.measureText(E,c,!1,g),A=T.width,I=Math.ceil(T.height),M=Math.ceil((c.fontStyle==="italic"?2:1)*A);if(m>=o-I*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,g=null,_=null,x=null,m=0,p=0,y=0;continue}if(y=Math.max(I+T.fontProperties.descent,y),M*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,m+=y*a,m=Math.ceil(m),p=0,y=0;continue}eA(g,_,T,p,m,a,c);const R=Ka(T.text);f.char.push({id:R,page:v.length-1,x:p/a,y:m/a,width:M,height:I,xoffset:0,yoffset:0,xadvance:A-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),p+=(M+2*n)*a,p=Math.ceil(p)}if(!(s!=null&&s.skipKerning))for(let w=0,E=u.length;w<E;w++){const T=u[w];for(let A=0;A<E;A++){const I=u[A],M=_.measureText(T).width,R=_.measureText(I).width,C=_.measureText(T+I).width-(M+R);C&&f.kerning.push({first:Ka(T),second:Ka(I),amount:C})}}const b=new ur(f,v,!0);return ur.available[t]!==void 0&&ur.uninstall(t),ur.available[t]=b,b}};Yr.ALPHA=[["a","z"],["A","Z"]," "],Yr.NUMERIC=[["0","9"]],Yr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Yr.ASCII=[[" ","~"]],Yr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Yr.ALPHANUMERIC},Yr.available={};let Hr=Yr;var rA=`// Pixi texture info\r
1083
+ `;const ja=new Rt;class jm extends xa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Mp,this.state=zs.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=qs.from(zm,ZT,e),this.shader=t.context.webGLVersion>1?qs.from(jT,zT,e):qs.from(zm,qT,e)}render(t){const e=this.renderer,s=this.quad;let r=s.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 n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;r=s.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,s.invalidate();const h=t._texture,o=h.baseTexture,l=o.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=o.isPowerOfTwo&&h.frame.width===o.width&&h.frame.height===o.height;d&&(o._glTextures[e.CONTEXT_UID]?d=o.wrapMode!==Fr.CLAMP:o.wrapMode===Fr.CLAMP&&(o.wrapMode=Fr.REPEAT));const f=d?this.simpleShader:this.shader,p=h.width,m=h.height,g=t._width,_=t._height;ja.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),ja.invert(),d?ja.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=ja.toArray(!0),f.uniforms.uColor=Ct.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=h,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=ip(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}jm.extension={name:"tilingSprite",type:Y.RendererPlugin},K.add(jm);const qm=class Vo{constructor(t,e,s){this.linkedSheets=[],(t instanceof et||t instanceof q)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:r,data:n,resolutionFilename:a=null,cachePrefix:h=""}=t;this.cachePrefix=h,this._texture=r instanceof q?r:null,this.baseTexture=r instanceof et?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const o=this.baseTexture.resource;this.resolution=this._updateResolution(a||(o?o.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=_r(t,null);return s===null&&(s=typeof e=="number"?e:parseFloat(e??"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Vo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Vo.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const r=this._frameKeys[e],n=this._frames[r],a=n.frame;if(a){let h=null,o=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new rt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?h=new rt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new rt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(o=new rt(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[r]=new q(this.baseTexture,h,u,o,n.rotated?2:0,n.anchor,n.borders),q.addToCache(this.textures[r],this.cachePrefix+r.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const r=t[e][s];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*Vo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Vo.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};qm.BATCH_SIZE=1e3;let Zm=qm;const KT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Km(i,t,e){const s={};if(i.forEach(r=>{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=bt.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,Km([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const QT={extension:Y.Asset,cache:{test:i=>i instanceof Zm,getCacheableAssets:(i,t)=>Km(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&KT.includes(s)},parse:i=>{var e;const t=i.split(".");return{resolution:parseFloat(((e=z.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:Y.LoadParser,priority:Ne.Normal},async testParse(i,t){return bt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var u,c;const{texture:s,imageFilename:r,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=bt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(s&&s.baseTexture)h=s;else{const d=rc(a+(r??i.meta.image),t.src);h=(await e.load([d]))[d]}const o=new Zm({texture:h.baseTexture,data:i,resolutionFilename:t.src,cachePrefix:n});await o.parse();const l=(u=i==null?void 0:i.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(l)){const d=[];for(const p of l){if(typeof p!="string")continue;let m=a+p;(c=t.data)!=null&&c.ignoreMultiPack||(m=rc(m,t.src),d.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);o.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[o].concat(o.linkedSheets.filter(m=>m!==p))})}return o},unload(i){i.destroy(!0)}}};K.add(QT);class qa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Za{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const a=e[n].match(/^[a-z]+/gm)[0],h=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(const l in h){const u=h[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;o[c]=p}s[a].push(o)}const r=new qa;return s.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),s.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class vc{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new qa,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),h=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let l=0;l<s.length;l++)e.info.push({face:s[l].getAttribute("face"),size:parseInt(s[l].getAttribute("size"),10)});for(let l=0;l<r.length;l++)e.common.push({lineHeight:parseInt(r[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<a.length;l++){const u=a[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<h.length;l++)e.kerning.push({first:parseInt(h[l].getAttribute("first"),10),second:parseInt(h[l].getAttribute("second"),10),amount:parseInt(h[l].getAttribute("amount"),10)});for(let l=0;l<o.length;l++)e.distanceField.push({fieldType:o[l].getAttribute("fieldType"),distanceRange:parseInt(o[l].getAttribute("distanceRange"),10)});return e}}class bc{static test(t){return typeof t=="string"&&t.includes("<font>")?vc.test(z.ADAPTER.parseXML(t)):!1}static parse(t){return vc.parse(z.ADAPTER.parseXML(t))}}const wc=[Za,vc,bc];function JT(i){for(let t=0;t<wc.length;t++)if(wc[t].test(i))return wc[t];return null}function tA(i,t,e,s,r,n){const a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let h;const o=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=i.width/s-o-l*2,c=i.height/s-o-l*2,d=a.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(a[0]),f.unshift(0),d.push(a[a.length-1]),f.push(1),e.fillGradientType===Ha.LINEAR_VERTICAL){h=t.createLinearGradient(u/2,l,u/2,c+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<r.length;g++){const _=n.lineHeight*g;for(let x=0;x<d.length;x++){let y=0;typeof f[x]=="number"?y=f[x]:y=x/d.length;const v=_/c+y*m;let b=Math.max(p,v);b=Math.min(b,1),h.addColorStop(b,d[x]),p=b}}}else{h=t.createLinearGradient(l,c/2,u+l,c/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let _;typeof f[g]=="number"?_=f[g]:_=m/p,h.addColorStop(_,d[g]),m++}}return h}function eA(i,t,e,s,r,n,a){const h=e.text,o=e.fontProperties;t.translate(s,r),t.scale(n,n);const l=a.strokeThickness/2,u=-(a.strokeThickness/2);if(t.font=a.toFontString(),t.lineWidth=a.strokeThickness,t.textBaseline=a.textBaseline,t.lineJoin=a.lineJoin,t.miterLimit=a.miterLimit,t.fillStyle=tA(i,t,a,n,[h],e),t.strokeStyle=a.stroke,a.dropShadow){const c=a.dropShadowColor,d=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=Ct.shared.setValue(c).setAlpha(a.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(h,l,u+e.lineHeight-o.descent),a.fill&&t.fillText(h,l,u+e.lineHeight-o.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ka(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function Qm(i){return Array.from?Array.from(i):i.split("")}function sA(i){typeof i=="string"&&(i=[i]);const t=[];for(let e=0,s=i.length;e<s;e++){const r=i[e];if(Array.isArray(r)){if(r.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);const n=r[0].charCodeAt(0),a=r[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let h=n,o=a;h<=o;h++)t.push(String.fromCharCode(h))}else t.push(...Qm(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Yr=class ur{constructor(t,e,s){var u;const[r]=t.info,[n]=t.common,[a]=t.page,[h]=t.distanceField,o=_r(a.file),l={};this._ownsTextures=s,this.font=r.face,this.size=r.size,this.lineHeight=n.lineHeight/o,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:f}=t.page[c];l[d]=e instanceof Array?e[c]:e[f],h!=null&&h.fieldType&&h.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Re.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=xs.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:f}=t.char[c];let{x:p,y:m,width:g,height:_,xoffset:x,yoffset:y,xadvance:v}=t.char[c];p/=o,m/=o,g/=o,_/=o,x/=o,y/=o,v/=o;const b=new rt(p+l[f].frame.x/o,m+l[f].frame.y/o,g,_);this.chars[d]={xOffset:x,yOffset:y,xAdvance:v,kerning:{},texture:new q(l[f].baseTexture,b),page:f}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:f,amount:p}=t.kerning[c];d/=o,f/=o,p/=o,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=h==null?void 0:h.distanceRange,this.distanceFieldType=((u=h==null?void 0:h.fieldType)==null?void 0:u.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(t,e,s){let r;if(t instanceof qa)r=t;else{const a=JT(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof q&&(e=[e]);const n=new ur(r,e,s);return ur.available[n.font]=n,n}static uninstall(t){const e=ur.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ur.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:a,textureWidth:h,textureHeight:o,...l}=Object.assign({},ur.defaultOptions,s),u=sA(r),c=e instanceof vr?e:new vr(e),d=h,f=new qa;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p=0,m=0,g,_,x,y=0;const v=[];for(let w=0;w<u.length;w++){g||(g=z.ADAPTER.createCanvas(),g.width=h,g.height=o,_=g.getContext("2d"),x=new et(g,{resolution:a,...l}),v.push(new q(x)),f.page.push({id:v.length-1,file:""}));const E=u[w],T=$r.measureText(E,c,!1,g),A=T.width,I=Math.ceil(T.height),M=Math.ceil((c.fontStyle==="italic"?2:1)*A);if(m>=o-I*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,g=null,_=null,x=null,m=0,p=0,y=0;continue}if(y=Math.max(I+T.fontProperties.descent,y),M*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,m+=y*a,m=Math.ceil(m),p=0,y=0;continue}eA(g,_,T,p,m,a,c);const R=Ka(T.text);f.char.push({id:R,page:v.length-1,x:p/a,y:m/a,width:M,height:I,xoffset:0,yoffset:0,xadvance:A-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),p+=(M+2*n)*a,p=Math.ceil(p)}if(!(s!=null&&s.skipKerning))for(let w=0,E=u.length;w<E;w++){const T=u[w];for(let A=0;A<E;A++){const I=u[A],M=_.measureText(T).width,R=_.measureText(I).width,C=_.measureText(T+I).width-(M+R);C&&f.kerning.push({first:Ka(T),second:Ka(I),amount:C})}}const b=new ur(f,v,!0);return ur.available[t]!==void 0&&ur.uninstall(t),ur.available[t]=b,b}};Yr.ALPHA=[["a","z"],["A","Z"]," "],Yr.NUMERIC=[["0","9"]],Yr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Yr.ASCII=[[" ","~"]],Yr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Yr.ALPHANUMERIC},Yr.available={};let Hr=Yr;var rA=`// Pixi texture info\r
1084
1084
  varying vec2 vTextureCoord;\r
1085
1085
  uniform sampler2D uSampler;\r
1086
1086
  \r
@@ -1137,7 +1137,7 @@ void main(void)\r
1137
1137
  `;const Jm=[],tg=[],eg=[],sg=class oy extends Bt{constructor(t,e={}){super();const{align:s,tint:r,maxWidth:n,letterSpacing:a,fontName:h,fontSize:o}=Object.assign({},oy.styleDefaults,e);if(!Hr.available[h])throw new Error(`Missing BitmapFont "${h}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Ct(r),this._font=void 0,this._fontName=h,this._fontSize=o,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new js(()=>{this.dirty=!0},this,0,0),this._roundPixels=z.ROUND_PIXELS,this.dirty=!0,this._resolution=z.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var M;const t=Hr.available[this._fontName],e=this.fontSize,s=e/t.size,r=new st,n=[],a=[],h=[],o=this._text.replace(/(?:\r\n|\r)/g,`
1138
1138
  `)||" ",l=Qm(o),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?Jm:tg;let d=null,f=0,p=0,m=0,g=-1,_=0,x=0,y=0,v=0;for(let R=0;R<l.length;R++){const C=l[R],P=Ka(C);if(/(?:\s)/.test(C)&&(g=R,_=f,v++),C==="\r"||C===`
1139
1139
  `){a.push(f),h.push(-1),p=Math.max(p,f),++m,++x,r.x=0,r.y+=t.lineHeight,d=null,v=0;continue}const k=t.chars[P];if(!k)continue;d&&k.kerning[d]&&(r.x+=k.kerning[d]);const U=eg.pop()||{texture:q.EMPTY,line:0,charCode:0,prevSpaces:0,position:new st};U.texture=k.texture,U.line=m,U.charCode=P,U.position.x=Math.round(r.x+k.xOffset+this._letterSpacing/2),U.position.y=Math.round(r.y+k.yOffset),U.prevSpaces=v,n.push(U),f=U.position.x+Math.max(k.xAdvance-k.xOffset,k.texture.orig.width),r.x+=k.xAdvance+this._letterSpacing,y=Math.max(y,k.yOffset+k.texture.height),d=P,g!==-1&&u>0&&r.x>u&&(++x,nn(n,1+g-x,1+R-g),R=g,g=-1,a.push(_),h.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,_),m++,r.x=0,r.y+=t.lineHeight,d=null,v=0)}const b=l[l.length-1];b!=="\r"&&b!==`
1140
- `&&(/(?:\s)/.test(b)&&(f=_),a.push(f),p=Math.max(p,f),h.push(-1));const w=[];for(let R=0;R<=m;R++){let C=0;this._align==="right"?C=p-a[R]:this._align==="center"?C=(p-a[R])/2:this._align==="justify"&&(C=h[R]<0?0:(p-a[R])/h[R]),w.push(C)}const E=n.length,T={},A=[],I=this._activePagesMeshData;c.push(...I);for(let R=0;R<E;R++){const C=n[R].texture,P=C.baseTexture.uid;if(!T[P]){let k=c.pop();if(!k){const V=new gc;let L,$;t.distanceFieldType==="none"?(L=new $a(q.EMPTY),$=W.NORMAL):(L=new $a(q.EMPTY,{program:yr.from(iA,rA),uniforms:{uFWidth:0}}),$=W.NORMAL_NPM);const O=new Xa(V,L);O.blendMode=$,k={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:O,vertices:null,uvs:null,indices:null}}k.index=0,k.indexCount=0,k.vertexCount=0,k.uvsCount=0,k.total=0;const{_textureCache:U}=this;U[P]=U[P]||new q(C.baseTexture),k.mesh.texture=U[P],k.mesh.tint=this._tintColor.value,A.push(k),T[P]=k}T[P].total++}for(let R=0;R<I.length;R++)A.includes(I[R])||this.removeChild(I[R].mesh);for(let R=0;R<A.length;R++)A[R].mesh.parent!==this&&this.addChild(A[R].mesh);this._activePagesMeshData=A;for(const R in T){const C=T[R],P=C.total;if(!(((M=C.indices)==null?void 0:M.length)>6*P)||C.vertices.length<Xa.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*P),C.uvs=new Float32Array(4*2*P),C.indices=new Uint16Array(6*P);else{const k=C.total,U=C.vertices;for(let V=k*4*2;V<U.length;V++)U[V]=0}C.mesh.size=6*P}for(let R=0;R<E;R++){const C=n[R];let P=C.position.x+w[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(P=Math.round(P));const k=P*s,U=C.position.y*s,V=C.texture,L=T[V.baseTexture.uid],$=V.frame,O=V._uvs,N=L.index++;L.indices[N*6+0]=0+N*4,L.indices[N*6+1]=1+N*4,L.indices[N*6+2]=2+N*4,L.indices[N*6+3]=0+N*4,L.indices[N*6+4]=2+N*4,L.indices[N*6+5]=3+N*4,L.vertices[N*8+0]=k,L.vertices[N*8+1]=U,L.vertices[N*8+2]=k+$.width*s,L.vertices[N*8+3]=U,L.vertices[N*8+4]=k+$.width*s,L.vertices[N*8+5]=U+$.height*s,L.vertices[N*8+6]=k,L.vertices[N*8+7]=U+$.height*s,L.uvs[N*8+0]=O.x0,L.uvs[N*8+1]=O.y0,L.uvs[N*8+2]=O.x1,L.uvs[N*8+3]=O.y1,L.uvs[N*8+4]=O.x2,L.uvs[N*8+5]=O.y2,L.uvs[N*8+6]=O.x3,L.uvs[N*8+7]=O.y3}this._textWidth=p*s,this._textHeight=(r.y+t.lineHeight)*s;for(const R in T){const C=T[R];if(this.anchor.x!==0||this.anchor.y!==0){let V=0;const L=this._textWidth*this.anchor.x,$=this._textHeight*this.anchor.y;for(let O=0;O<C.total;O++)C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$}this._maxLineHeight=y*s;const P=C.mesh.geometry.getBuffer("aVertexPosition"),k=C.mesh.geometry.getBuffer("aTextureCoord"),U=C.mesh.geometry.getIndex();P.data=C.vertices,k.data=C.uvs,U.data=C.indices,P.update(),k.update(),U.update()}for(let R=0;R<n.length;R++)eg.push(n[R]);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:s,size:r}=Hr.available[this._fontName];if(s!=="none"){const{a:n,b:a,c:h,d:o}=this.worldTransform,l=Math.sqrt(n*n+a*a),u=Math.sqrt(h*h+o*o),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/r,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=c*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=Hr.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(!Hr.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Hr.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?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,s=Hr.available[this._fontName].distanceFieldType==="none"?Jm:tg;s.push(...this._activePagesMeshData);for(const r of this._activePagesMeshData)this.removeChild(r.mesh);this._activePagesMeshData=[],s.filter(r=>e[r.mesh.texture.baseTexture.uid]).forEach(r=>{r.mesh.texture=q.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};sg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let nA=sg;const oA=[".xml",".fnt"],aA={extension:{type:Y.LoadParser,priority:Ne.Normal},name:"loadBitmapFont",test(i){return oA.includes(vt.extname(i).toLowerCase())},async testParse(i){return Za.test(i)||bc.test(i)},async parse(i,t,e){const s=Za.test(i)?Za.parse(i):bc.parse(i),{src:r}=t,{page:n}=s,a=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=vt.join(vt.dirname(r),u);c=rc(c,r),a.push(c)}const h=await e.load(a),o=a.map(l=>h[l]);return Hr.install(s,o,!0)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};K.add(aA);const Ec=class Nn extends vr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Nn(Object.keys(Nn.defaultOptions).reduce((e,s)=>({...e,[s]:t[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete Nn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=Nn;if(s[t]){const r=s[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,a)=>{const h=URL.createObjectURL(r),o=new FileReader;o.onload=()=>n([h,o.result]),o.onerror=a,o.readAsDataURL(r)})).then(async([r,n])=>{const a=Object.assign({family:vt.basename(t,vt.extname(t)),weight:"normal",style:"normal",display:"auto",src:r,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const h=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=h,await h.load(),document.fonts.add(h),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(s=>!this._overrides.includes(s));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(s=>this._overrides.includes(s));e.length>0&&(this._overrides=this._overrides.filter(s=>!e.includes(s)),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}
1140
+ `&&(/(?:\s)/.test(b)&&(f=_),a.push(f),p=Math.max(p,f),h.push(-1));const w=[];for(let R=0;R<=m;R++){let C=0;this._align==="right"?C=p-a[R]:this._align==="center"?C=(p-a[R])/2:this._align==="justify"&&(C=h[R]<0?0:(p-a[R])/h[R]),w.push(C)}const E=n.length,T={},A=[],I=this._activePagesMeshData;c.push(...I);for(let R=0;R<E;R++){const C=n[R].texture,P=C.baseTexture.uid;if(!T[P]){let k=c.pop();if(!k){const V=new gc;let L,$;t.distanceFieldType==="none"?(L=new $a(q.EMPTY),$=W.NORMAL):(L=new $a(q.EMPTY,{program:yr.from(iA,rA),uniforms:{uFWidth:0}}),$=W.NORMAL_NPM);const O=new Xa(V,L);O.blendMode=$,k={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:O,vertices:null,uvs:null,indices:null}}k.index=0,k.indexCount=0,k.vertexCount=0,k.uvsCount=0,k.total=0;const{_textureCache:U}=this;U[P]=U[P]||new q(C.baseTexture),k.mesh.texture=U[P],k.mesh.tint=this._tintColor.value,A.push(k),T[P]=k}T[P].total++}for(let R=0;R<I.length;R++)A.includes(I[R])||this.removeChild(I[R].mesh);for(let R=0;R<A.length;R++)A[R].mesh.parent!==this&&this.addChild(A[R].mesh);this._activePagesMeshData=A;for(const R in T){const C=T[R],P=C.total;if(!(((M=C.indices)==null?void 0:M.length)>6*P)||C.vertices.length<Xa.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*P),C.uvs=new Float32Array(4*2*P),C.indices=new Uint16Array(6*P);else{const k=C.total,U=C.vertices;for(let V=k*4*2;V<U.length;V++)U[V]=0}C.mesh.size=6*P}for(let R=0;R<E;R++){const C=n[R];let P=C.position.x+w[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(P=Math.round(P));const k=P*s,U=C.position.y*s,V=C.texture,L=T[V.baseTexture.uid],$=V.frame,O=V._uvs,N=L.index++;L.indices[N*6+0]=0+N*4,L.indices[N*6+1]=1+N*4,L.indices[N*6+2]=2+N*4,L.indices[N*6+3]=0+N*4,L.indices[N*6+4]=2+N*4,L.indices[N*6+5]=3+N*4,L.vertices[N*8+0]=k,L.vertices[N*8+1]=U,L.vertices[N*8+2]=k+$.width*s,L.vertices[N*8+3]=U,L.vertices[N*8+4]=k+$.width*s,L.vertices[N*8+5]=U+$.height*s,L.vertices[N*8+6]=k,L.vertices[N*8+7]=U+$.height*s,L.uvs[N*8+0]=O.x0,L.uvs[N*8+1]=O.y0,L.uvs[N*8+2]=O.x1,L.uvs[N*8+3]=O.y1,L.uvs[N*8+4]=O.x2,L.uvs[N*8+5]=O.y2,L.uvs[N*8+6]=O.x3,L.uvs[N*8+7]=O.y3}this._textWidth=p*s,this._textHeight=(r.y+t.lineHeight)*s;for(const R in T){const C=T[R];if(this.anchor.x!==0||this.anchor.y!==0){let V=0;const L=this._textWidth*this.anchor.x,$=this._textHeight*this.anchor.y;for(let O=0;O<C.total;O++)C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$}this._maxLineHeight=y*s;const P=C.mesh.geometry.getBuffer("aVertexPosition"),k=C.mesh.geometry.getBuffer("aTextureCoord"),U=C.mesh.geometry.getIndex();P.data=C.vertices,k.data=C.uvs,U.data=C.indices,P.update(),k.update(),U.update()}for(let R=0;R<n.length;R++)eg.push(n[R]);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:s,size:r}=Hr.available[this._fontName];if(s!=="none"){const{a:n,b:a,c:h,d:o}=this.worldTransform,l=Math.sqrt(n*n+a*a),u=Math.sqrt(h*h+o*o),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/r,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=c*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=Hr.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(!Hr.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Hr.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?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,s=Hr.available[this._fontName].distanceFieldType==="none"?Jm:tg;s.push(...this._activePagesMeshData);for(const r of this._activePagesMeshData)this.removeChild(r.mesh);this._activePagesMeshData=[],s.filter(r=>e[r.mesh.texture.baseTexture.uid]).forEach(r=>{r.mesh.texture=q.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};sg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let nA=sg;const oA=[".xml",".fnt"],aA={extension:{type:Y.LoadParser,priority:Ne.Normal},name:"loadBitmapFont",test(i){return oA.includes(bt.extname(i).toLowerCase())},async testParse(i){return Za.test(i)||bc.test(i)},async parse(i,t,e){const s=Za.test(i)?Za.parse(i):bc.parse(i),{src:r}=t,{page:n}=s,a=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=bt.join(bt.dirname(r),u);c=rc(c,r),a.push(c)}const h=await e.load(a),o=a.map(l=>h[l]);return Hr.install(s,o,!0)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};K.add(aA);const Ec=class Nn extends vr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Nn(Object.keys(Nn.defaultOptions).reduce((e,s)=>({...e,[s]:t[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete Nn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=Nn;if(s[t]){const r=s[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,a)=>{const h=URL.createObjectURL(r),o=new FileReader;o.onload=()=>n([h,o.result]),o.onerror=a,o.readAsDataURL(r)})).then(async([r,n])=>{const a=Object.assign({family:bt.basename(t,bt.extname(t)),weight:"normal",style:"normal",display:"auto",src:r,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const h=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=h,await h.load(),document.fonts.add(h),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(s=>!this._overrides.includes(s));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(s=>this._overrides.includes(s));e.length>0&&(this._overrides=this._overrides.filter(s=>!e.includes(s)),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}
1141
1141
  @font-face {
1142
1142
  font-family: "${e.family}";
1143
1143
  src: url('${e.dataSrc}');
@@ -1160,15 +1160,15 @@ void main(void)\r
1160
1160
  * Subject to the terms at https://gsap.com/standard-license or for
1161
1161
  * Club GSAP members, the agreement issued with that membership.
1162
1162
  * @author: Jack Doyle, jack@greensock.com
1163
- */var Qg,Kr,Tn,su,Bi,Jg,ru,eS=function(){return typeof window<"u"},Er={},Di=180/Math.PI,An=Math.PI/180,Sn=Math.atan2,t_=1e8,iu=/([A-Z])/g,sS=/(left|right|width|margin|padding|x)/i,rS=/[\s,\(]\S/,sr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},nu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},iS=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},nS=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},oS=function(t,e){var s=e.s+e.c*t;e.set(e.t,e.p,~~(s+(s<0?-.5:.5))+e.u,e)},e_=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},s_=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},aS=function(t,e,s){return t.style[e]=s},lS=function(t,e,s){return t.style.setProperty(e,s)},hS=function(t,e,s){return t._gsap[e]=s},cS=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},uS=function(t,e,s,r,n){var a=t._gsap;a.scaleX=a.scaleY=s,a.renderTransform(n,a)},dS=function(t,e,s,r,n){var a=t._gsap;a[e]=s,a.renderTransform(n,a)},Gt="transform",$e=Gt+"Origin",fS=function i(t,e){var s=this,r=this.target,n=r.style,a=r._gsap;if(t in Er&&n){if(this.tfm=this.tfm||{},t!=="transform")t=sr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(h){return s.tfm[h]=Tr(r,h)}):this.tfm[t]=a.x?a[t]:Tr(r,t),t===$e&&(this.tfm.zOrigin=a.zOrigin);else return sr.transform.split(",").forEach(function(h){return i.call(s,h,e)});if(this.props.indexOf(Gt)>=0)return;a.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push($e,e,"")),t=Gt}(n||e)&&this.props.push(t,e,n[t])},r_=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},pS=function(){var t=this.props,e=this.target,s=e.style,r=e._gsap,n,a;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?s[t[n]]=t[n+2]:s.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(iu,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)r[a]=this.tfm[a];r.svg&&(r.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=ru(),(!n||!n.isStart)&&!s[Gt]&&(r_(s),r.zOrigin&&s[$e]&&(s[$e]+=" "+r.zOrigin+"px",r.zOrigin=0,r.renderTransform()),r.uncache=1)}},i_=function(t,e){var s={target:t,props:[],revert:pS,save:fS};return t._gsap||Xe.core.getCache(t),e&&e.split(",").forEach(function(r){return s.save(r)}),s},n_,ou=function(t,e){var s=Kr.createElementNS?Kr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Kr.createElement(t);return s&&s.style?s:Kr.createElement(t)},rr=function i(t,e,s){var r=getComputedStyle(t);return r[e]||r.getPropertyValue(e.replace(iu,"-$1").toLowerCase())||r.getPropertyValue(e)||!s&&i(t,Cn(e)||e,1)||""},o_="O,Moz,ms,Ms,Webkit".split(","),Cn=function(t,e,s){var r=e||Bi,n=r.style,a=5;if(t in n&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(o_[a]+t in n););return a<0?null:(a===3?"ms":a>=0?o_[a]:"")+t},au=function(){eS()&&window.document&&(Qg=window,Kr=Qg.document,Tn=Kr.documentElement,Bi=ou("div")||{style:{}},ou("div"),Gt=Cn(Gt),$e=Gt+"Origin",Bi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",n_=!!Cn("perspective"),ru=Xe.core.reverting,su=1)},lu=function i(t){var e=ou("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,r=this.nextSibling,n=this.style.cssText,a;if(Tn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=i}catch{}else this._gsapBBox&&(a=this._gsapBBox());return s&&(r?s.insertBefore(this,r):s.appendChild(this)),Tn.removeChild(e),this.style.cssText=n,a},a_=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},l_=function(t){var e;try{e=t.getBBox()}catch{e=lu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===lu||(e=lu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+a_(t,["x","cx","x1"])||0,y:+a_(t,["y","cy","y1"])||0,width:0,height:0}:e},h_=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&l_(t))},Oi=function(t,e){if(e){var s=t.style,r;e in Er&&e!==$e&&(e=Gt),s.removeProperty?(r=e.substr(0,2),(r==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(r==="--"?e:e.replace(iu,"-$1").toLowerCase())):s.removeAttribute(e)}},Qr=function(t,e,s,r,n,a){var h=new Ge(t._pt,e,s,0,1,a?s_:e_);return t._pt=h,h.b=r,h.e=n,t._props.push(s),h},c_={deg:1,rad:1,turn:1},mS={grid:1,flex:1},Jr=function i(t,e,s,r){var n=parseFloat(s)||0,a=(s+"").trim().substr((n+"").length)||"px",h=Bi.style,o=sS.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(o?"Width":"Height"),c=100,d=r==="px",f=r==="%",p,m,g,_;if(r===a||!n||c_[r]||c_[a])return n;if(a!=="px"&&!d&&(n=i(t,e,s,"px")),_=t.getCTM&&h_(t),(f||a==="%")&&(Er[e]||~e.indexOf("adius")))return p=_?t.getBBox()[o?"width":"height"]:t[u],te(f?n/p*c:n/100*p);if(h[o?"width":"height"]=c+(d?a:r),m=~e.indexOf("adius")||r==="em"&&t.appendChild&&!l?t:t.parentNode,_&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Kr||!m.appendChild)&&(m=Kr.body),g=m._gsap,g&&f&&g.width&&o&&g.time===ts.time&&!g.uncache)return te(n/g.width*c);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=c+r,p=t[u],x?t.style[e]=x:Oi(t,e)}else(f||a==="%")&&!mS[rr(m,"display")]&&(h.position=rr(t,"position")),m===t&&(h.position="static"),m.appendChild(Bi),p=Bi[u],m.removeChild(Bi),h.position="absolute";return o&&f&&(g=Ii(m),g.time=ts.time,g.width=m[u]),te(d?p*n/c:p&&n?c/p*n:0)},Tr=function(t,e,s,r){var n;return su||au(),e in sr&&e!=="transform"&&(e=sr[e],~e.indexOf(",")&&(e=e.split(",")[0])),Er[e]&&e!=="transform"?(n=Eo(t,r),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dl(rr(t,$e))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||r||~(n+"").indexOf("calc("))&&(n=ul[e]&&ul[e](t,e,s)||rr(t,e)||pg(t,e)||(e==="opacity"?1:0))),s&&!~(n+"").trim().indexOf(" ")?Jr(t,e,n,s)+s:n},gS=function(t,e,s,r){if(!s||s==="none"){var n=Cn(e,t,1),a=n&&rr(t,n,1);a&&a!==s?(e=n,s=a):e==="borderColor"&&(s=rr(t,"borderTopColor"))}var h=new Ge(this._pt,t.style,e,0,1,jg),o=0,l=0,u,c,d,f,p,m,g,_,x,y,v,b;if(h.b=s,h.e=r,s+="",r+="",r==="auto"&&(m=t.style[e],t.style[e]=r,r=rr(t,e)||r,m?t.style[e]=m:Oi(t,e)),u=[s,r],Ng(u),s=u[0],r=u[1],d=s.match(yn)||[],b=r.match(yn)||[],b.length){for(;c=yn.exec(r);)g=c[0],x=r.substring(o,c.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=xn(f,g)+v),_=parseFloat(g),y=g.substr((_+"").length),o=yn.lastIndex-y.length,y||(y=y||Ze.units[e]||v,o===r.length&&(r+=y,h.e+=y)),v!==y&&(f=Jr(t,e,m,y)||0),h._pt={_next:h._pt,p:x||l===1?x:",",s:f,c:_-f,m:p&&p<4||e==="zIndex"?Math.round:0});h.c=o<r.length?r.substring(o,r.length):""}else h.r=e==="display"&&r==="none"?s_:e_;return ag.test(r)&&(h.e=0),this._pt=h,h},u_={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},_S=function(t){var e=t.split(" "),s=e[0],r=e[1]||"50%";return(s==="top"||s==="bottom"||r==="left"||r==="right")&&(t=s,s=r,r=t),e[0]=u_[s]||s,e[1]=u_[r]||r,e.join(" ")},yS=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,r=s.style,n=e.u,a=s._gsap,h,o,l;if(n==="all"||n===!0)r.cssText="",o=1;else for(n=n.split(","),l=n.length;--l>-1;)h=n[l],Er[h]&&(o=1,h=h==="transformOrigin"?$e:Gt),Oi(s,h);o&&(Oi(s,Gt),a&&(a.svg&&s.removeAttribute("transform"),Eo(s,1),a.uncache=1,r_(r)))}},ul={clearProps:function(t,e,s,r,n){if(n.data!=="isFromStart"){var a=t._pt=new Ge(t._pt,e,s,0,0,yS);return a.u=r,a.pr=-10,a.tween=n,t._props.push(s),1}}},wo=[1,0,0,1,0,0],d_={},f_=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},p_=function(t){var e=rr(t,Gt);return f_(e)?wo:e.substr(7).match(og).map(te)},hu=function(t,e){var s=t._gsap||Ii(t),r=t.style,n=p_(t),a,h,o,l;return s.svg&&t.getAttribute("transform")?(o=t.transform.baseVal.consolidate().matrix,n=[o.a,o.b,o.c,o.d,o.e,o.f],n.join(",")==="1,0,0,1,0,0"?wo:n):(n===wo&&!t.offsetParent&&t!==Tn&&!s.svg&&(o=r.display,r.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,h=t.nextElementSibling,Tn.appendChild(t)),n=p_(t),o?r.display=o:Oi(t,"display"),l&&(h?a.insertBefore(t,h):a?a.appendChild(t):Tn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},cu=function(t,e,s,r,n,a){var h=t._gsap,o=n||hu(t,!0),l=h.xOrigin||0,u=h.yOrigin||0,c=h.xOffset||0,d=h.yOffset||0,f=o[0],p=o[1],m=o[2],g=o[3],_=o[4],x=o[5],y=e.split(" "),v=parseFloat(y[0])||0,b=parseFloat(y[1])||0,w,E,T,A;s?o!==wo&&(E=f*g-p*m)&&(T=v*(g/E)+b*(-m/E)+(m*x-g*_)/E,A=v*(-p/E)+b*(f/E)-(f*x-p*_)/E,v=T,b=A):(w=l_(t),v=w.x+(~y[0].indexOf("%")?v/100*w.width:v),b=w.y+(~(y[1]||y[0]).indexOf("%")?b/100*w.height:b)),r||r!==!1&&h.smooth?(_=v-l,x=b-u,h.xOffset=c+(_*f+x*m)-_,h.yOffset=d+(_*p+x*g)-x):h.xOffset=h.yOffset=0,h.xOrigin=v,h.yOrigin=b,h.smooth=!!r,h.origin=e,h.originIsAbsolute=!!s,t.style[$e]="0px 0px",a&&(Qr(a,h,"xOrigin",l,v),Qr(a,h,"yOrigin",u,b),Qr(a,h,"xOffset",c,h.xOffset),Qr(a,h,"yOffset",d,h.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},Eo=function(t,e){var s=t._gsap||new Xg(t);if("x"in s&&!e&&!s.uncache)return s;var r=t.style,n=s.scaleX<0,a="px",h="deg",o=getComputedStyle(t),l=rr(t,$e)||"0",u,c,d,f,p,m,g,_,x,y,v,b,w,E,T,A,I,M,R,C,P,k,U,V,L,$,O,N,Z,Q,H,lt;return u=c=d=m=g=_=x=y=v=0,f=p=1,s.svg=!!(t.getCTM&&h_(t)),o.translate&&((o.translate!=="none"||o.scale!=="none"||o.rotate!=="none")&&(r[Gt]=(o.translate!=="none"?"translate3d("+(o.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(o.rotate!=="none"?"rotate("+o.rotate+") ":"")+(o.scale!=="none"?"scale("+o.scale.split(" ").join(",")+") ":"")+(o[Gt]!=="none"?o[Gt]:"")),r.scale=r.rotate=r.translate="none"),E=hu(t,s.svg),s.svg&&(s.uncache?(L=t.getBBox(),l=s.xOrigin-L.x+"px "+(s.yOrigin-L.y)+"px",V=""):V=!e&&t.getAttribute("data-svg-origin"),cu(t,V||l,!!V||s.originIsAbsolute,s.smooth!==!1,E)),b=s.xOrigin||0,w=s.yOrigin||0,E!==wo&&(M=E[0],R=E[1],C=E[2],P=E[3],u=k=E[4],c=U=E[5],E.length===6?(f=Math.sqrt(M*M+R*R),p=Math.sqrt(P*P+C*C),m=M||R?Sn(R,M)*Di:0,x=C||P?Sn(C,P)*Di+m:0,x&&(p*=Math.abs(Math.cos(x*An))),s.svg&&(u-=b-(b*M+w*C),c-=w-(b*R+w*P))):(lt=E[6],Q=E[7],O=E[8],N=E[9],Z=E[10],H=E[11],u=E[12],c=E[13],d=E[14],T=Sn(lt,Z),g=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=k*A+O*I,L=U*A+N*I,$=lt*A+Z*I,O=k*-I+O*A,N=U*-I+N*A,Z=lt*-I+Z*A,H=Q*-I+H*A,k=V,U=L,lt=$),T=Sn(-C,Z),_=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=M*A-O*I,L=R*A-N*I,$=C*A-Z*I,H=P*I+H*A,M=V,R=L,C=$),T=Sn(R,M),m=T*Di,T&&(A=Math.cos(T),I=Math.sin(T),V=M*A+R*I,L=k*A+U*I,R=R*A-M*I,U=U*A-k*I,M=V,k=L),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,_=180-_),f=te(Math.sqrt(M*M+R*R+C*C)),p=te(Math.sqrt(U*U+lt*lt)),T=Sn(k,U),x=Math.abs(T)>2e-4?T*Di:0,v=H?1/(H<0?-H:H):0),s.svg&&(V=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!f_(rr(t,Gt)),V&&t.setAttribute("transform",V))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||s.uncache,s.x=u-((s.xPercent=u&&(!e&&s.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*s.xPercent/100:0)+a,s.y=c-((s.yPercent=c&&(!e&&s.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*s.yPercent/100:0)+a,s.z=d+a,s.scaleX=te(f),s.scaleY=te(p),s.rotation=te(m)+h,s.rotationX=te(g)+h,s.rotationY=te(_)+h,s.skewX=x+h,s.skewY=y+h,s.transformPerspective=v+a,(s.zOrigin=parseFloat(l.split(" ")[2])||!e&&s.zOrigin||0)&&(r[$e]=dl(l)),s.xOffset=s.yOffset=0,s.force3D=Ze.force3D,s.renderTransform=s.svg?vS:n_?m_:xS,s.uncache=0,s},dl=function(t){return(t=t.split(" "))[0]+" "+t[1]},uu=function(t,e,s){var r=Ce(e);return te(parseFloat(e)+parseFloat(Jr(t,"x",s+"px",r)))+r},xS=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,m_(t,e)},Li="0deg",To="0px",Ni=") ",m_=function(t,e){var s=e||this,r=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.z,l=s.rotation,u=s.rotationY,c=s.rotationX,d=s.skewX,f=s.skewY,p=s.scaleX,m=s.scaleY,g=s.transformPerspective,_=s.force3D,x=s.target,y=s.zOrigin,v="",b=_==="auto"&&t&&t!==1||_===!0;if(y&&(c!==Li||u!==Li)){var w=parseFloat(u)*An,E=Math.sin(w),T=Math.cos(w),A;w=parseFloat(c)*An,A=Math.cos(w),a=uu(x,a,E*A*-y),h=uu(x,h,-Math.sin(w)*-y),o=uu(x,o,T*A*-y+y)}g!==To&&(v+="perspective("+g+Ni),(r||n)&&(v+="translate("+r+"%, "+n+"%) "),(b||a!==To||h!==To||o!==To)&&(v+=o!==To||b?"translate3d("+a+", "+h+", "+o+") ":"translate("+a+", "+h+Ni),l!==Li&&(v+="rotate("+l+Ni),u!==Li&&(v+="rotateY("+u+Ni),c!==Li&&(v+="rotateX("+c+Ni),(d!==Li||f!==Li)&&(v+="skew("+d+", "+f+Ni),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Ni),x.style[Gt]=v||"translate(0, 0)"},vS=function(t,e){var s=e||this,r=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.rotation,l=s.skewX,u=s.skewY,c=s.scaleX,d=s.scaleY,f=s.target,p=s.xOrigin,m=s.yOrigin,g=s.xOffset,_=s.yOffset,x=s.forceCSS,y=parseFloat(a),v=parseFloat(h),b,w,E,T,A;o=parseFloat(o),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,o+=u),o||l?(o*=An,l*=An,b=Math.cos(o)*c,w=Math.sin(o)*c,E=Math.sin(o-l)*-d,T=Math.cos(o-l)*d,l&&(u*=An,A=Math.tan(l-u),A=Math.sqrt(1+A*A),E*=A,T*=A,u&&(A=Math.tan(u),A=Math.sqrt(1+A*A),b*=A,w*=A)),b=te(b),w=te(w),E=te(E),T=te(T)):(b=c,T=d,w=E=0),(y&&!~(a+"").indexOf("px")||v&&!~(h+"").indexOf("px"))&&(y=Jr(f,"x",a,"px"),v=Jr(f,"y",h,"px")),(p||m||g||_)&&(y=te(y+p-(p*b+m*E)+g),v=te(v+m-(p*w+m*T)+_)),(r||n)&&(A=f.getBBox(),y=te(y+r/100*A.width),v=te(v+n/100*A.height)),A="matrix("+b+","+w+","+E+","+T+","+y+","+v+")",f.setAttribute("transform",A),x&&(f.style[Gt]=A)},bS=function(t,e,s,r,n){var a=360,h=me(n),o=parseFloat(n)*(h&&~n.indexOf("rad")?Di:1),l=o-r,u=r+l+"deg",c,d;return h&&(c=n.split("_")[1],c==="short"&&(l%=a,l!==l%(a/2)&&(l+=l<0?a:-a)),c==="cw"&&l<0?l=(l+a*t_)%a-~~(l/a)*a:c==="ccw"&&l>0&&(l=(l-a*t_)%a-~~(l/a)*a)),t._pt=d=new Ge(t._pt,e,s,r,l,iS),d.e=u,d.u="deg",t._props.push(s),d},g_=function(t,e){for(var s in e)t[s]=e[s];return t},wS=function(t,e,s){var r=g_({},s._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=s.style,h,o,l,u,c,d,f,p;r.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),a[Gt]=e,h=Eo(s,1),Oi(s,Gt),s.setAttribute("transform",l)):(l=getComputedStyle(s)[Gt],a[Gt]=e,h=Eo(s,1),a[Gt]=l);for(o in Er)l=r[o],u=h[o],l!==u&&n.indexOf(o)<0&&(f=Ce(l),p=Ce(u),c=f!==p?Jr(s,o,l,p):parseFloat(l),d=parseFloat(u),t._pt=new Ge(t._pt,h,o,c,d-c,nu),t._pt.u=p||0,t._props.push(o));g_(h,r)};Ue("padding,margin,Width,Radius",function(i,t){var e="Top",s="Right",r="Bottom",n="Left",a=(t<3?[e,s,r,n]:[e+n,e+s,r+s,r+n]).map(function(h){return t<2?i+h:"border"+h+i});ul[t>1?"border"+i:i]=function(h,o,l,u,c){var d,f;if(arguments.length<4)return d=a.map(function(p){return Tr(h,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(u+"").split(" "),f={},a.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),h.init(o,f,c)}});var __={name:"css",register:au,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,r,n){var a=this._props,h=t.style,o=s.vars.startAt,l,u,c,d,f,p,m,g,_,x,y,v,b,w,E,T;su||au(),this.styles=this.styles||i_(t),T=this.styles.props,this.tween=s;for(m in e)if(m!=="autoRound"&&(u=e[m],!(Qe[m]&&$g(m,e,s,r,t,n)))){if(f=typeof u,p=ul[m],f==="function"&&(u=u.call(s,r,t,n),f=typeof u),f==="string"&&~u.indexOf("random(")&&(u=go(u)),p)p(this,t,m,u,s)&&(E=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),u+="",qr.lastIndex=0,qr.test(l)||(g=Ce(l),_=Ce(u)),_?g!==_&&(l=Jr(t,m,l,_)+_):g&&(u+=g),this.add(h,"setProperty",l,u,r,n,0,0,m),a.push(m),T.push(m,0,h[m]);else if(f!=="undefined"){if(o&&m in o?(l=typeof o[m]=="function"?o[m].call(s,r,t,n):o[m],me(l)&&~l.indexOf("random(")&&(l=go(l)),Ce(l+"")||l==="auto"||(l+=Ze.units[m]||Ce(Tr(t,m))||""),(l+"").charAt(1)==="="&&(l=Tr(t,m))):l=Tr(t,m),d=parseFloat(l),x=f==="string"&&u.charAt(1)==="="&&u.substr(0,2),x&&(u=u.substr(2)),c=parseFloat(u),m in sr&&(m==="autoAlpha"&&(d===1&&Tr(t,"visibility")==="hidden"&&c&&(d=0),T.push("visibility",0,h.visibility),Qr(this,h,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),m!=="scale"&&m!=="transform"&&(m=sr[m],~m.indexOf(",")&&(m=m.split(",")[0]))),y=m in Er,y){if(this.styles.save(m),v||(b=t._gsap,b.renderTransform&&!e.parseTransform||Eo(t,e.parseTransform),w=e.smoothOrigin!==!1&&b.smooth,v=this._pt=new Ge(this._pt,h,Gt,0,1,b.renderTransform,b,0,-1),v.dep=1),m==="scale")this._pt=new Ge(this._pt,b,"scaleY",b.scaleY,(x?xn(b.scaleY,x+c):c)-b.scaleY||0,nu),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){T.push($e,0,h[$e]),u=_S(u),b.svg?cu(t,u,0,w,0,this):(_=parseFloat(u.split(" ")[2])||0,_!==b.zOrigin&&Qr(this,b,"zOrigin",b.zOrigin,_),Qr(this,h,m,dl(l),dl(u)));continue}else if(m==="svgOrigin"){cu(t,u,1,w,0,this);continue}else if(m in d_){bS(this,b,m,d,x?xn(d,x+u):u);continue}else if(m==="smoothOrigin"){Qr(this,b,"smooth",b.smooth,u);continue}else if(m==="force3D"){b[m]=u;continue}else if(m==="transform"){wS(this,u,t);continue}}else m in h||(m=Cn(m)||m);if(y||(c||c===0)&&(d||d===0)&&!rS.test(u)&&m in h)g=(l+"").substr((d+"").length),c||(c=0),_=Ce(u)||(m in Ze.units?Ze.units[m]:g),g!==_&&(d=Jr(t,m,l,_)),this._pt=new Ge(this._pt,y?b:h,m,d,(x?xn(d,x+c):c)-d,!y&&(_==="px"||m==="zIndex")&&e.autoRound!==!1?oS:nu),this._pt.u=_||0,g!==_&&_!=="%"&&(this._pt.b=l,this._pt.r=nS);else if(m in h)gS.call(this,t,m,l,x?x+u:u);else if(m in t)this.add(t,m,l||t[m],x?x+u:u,r,n);else if(m!=="parseTransform"){kc(m,u);continue}y||(m in h?T.push(m,0,h[m]):T.push(m,1,l||t[m])),a.push(m)}}E&&qg(this)},render:function(t,e){if(e.tween._time||!ru())for(var s=e._pt;s;)s.r(t,s.d),s=s._next;else e.styles.revert()},get:Tr,aliases:sr,getSetter:function(t,e,s){var r=sr[e];return r&&r.indexOf(",")<0&&(e=r),e in Er&&e!==$e&&(t._gsap.x||Tr(t,"x"))?s&&Jg===s?e==="scale"?cS:hS:(Jg=s||{})&&(e==="scale"?uS:dS):t.style&&!Cc(t.style[e])?aS:~e.indexOf("-")?lS:Kc(t,e)},core:{_removeProperty:Oi,_getMatrix:hu}};Xe.utils.checkPrefix=Cn,Xe.core.getStyleSaver=i_,function(i,t,e,s){var r=Ue(i+","+t+","+e,function(n){Er[n]=1});Ue(t,function(n){Ze.units[n]="deg",d_[n]=1}),sr[r[13]]=i+","+t,Ue(s,function(n){var a=n.split(":");sr[a[1]]=r[a[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ue("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(i){Ze.units[i]="px"}),Xe.registerPlugin(__);var bt=Xe.registerPlugin(__)||Xe;bt.core.Tween;class du extends Ks{constructor(t){super(),this.radius=0,this.enableTint=!0,this.bgColor="#fff",this.borderWidth=0,this.borderColor="black",this.bgAlpha=1;const{x:e=0,y:s=0,width:r=0,height:n=0,bgColor:a="#fff",alpha:h=1,radius:o=0,borderWidth:l=0,borderColor:u="black",enableTint:c=!0}=t;this.x=e,this.y=s,this.bgAlpha=h,this.radius=o,this.enableTint=c,this.bgColor=a,this.borderWidth=l,this.borderColor=u,this.renderBg(r,n)}updateColor(t){bt.to(this,{tint:t,duration:.25})}renderBg(t,e){this.clear(),this.enableTint?(this.beginFill("#fff",this.bgAlpha),this.tint=this.bgColor):(this.beginFill(this.bgColor,this.bgAlpha),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1)),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1),this.radius!==0?typeof this.radius=="number"?this.drawRoundedRect(0,0,t,e,this.radius):(this.moveTo(0+this.radius[0],0),this.lineTo(0+t-this.radius[1],0),this.radius[1]>0?this.arcTo(0+t,0,0+t,0+this.radius[1],this.radius[1]):this.lineTo(0+t,0),this.lineTo(0+t,0+e-this.radius[2]),this.radius[2]>0?this.arcTo(0+t,0+e,0+t-this.radius[2],0+e,this.radius[2]):this.lineTo(0+t,0+e),this.lineTo(0+this.radius[3],0+e),this.radius[3]>0?this.arcTo(0,0+e,0,0+e-this.radius[3],this.radius[3]):this.lineTo(0,0+e),this.lineTo(0,0+this.radius[0]),this.radius[0]>0?this.arcTo(0,0,0+this.radius[0],0,this.radius[0]):this.lineTo(0,0),this.closePath()):this.drawRect(0,0,t,e),this.endFill()}}class Ao extends Bt{constructor(t,e,s,r){if(super(),r){const n=new Ks;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}s?(this._bgColorFill=new du({width:t,height:e,bgColor:s}),this.addChild(this._bgColorFill)):(this._fill=new qe,this._fill.width=t,this._fill.height=e,this.addChild(this._fill))}setSize(t,e){this._fill&&(this._fill.width=t,this._fill.height=e),this._bgColorFill&&this._bgColorFill.renderBg(t,e)}}/*!
1163
+ */var Qg,Kr,Tn,su,Bi,Jg,ru,eS=function(){return typeof window<"u"},Er={},Di=180/Math.PI,An=Math.PI/180,Sn=Math.atan2,t_=1e8,iu=/([A-Z])/g,sS=/(left|right|width|margin|padding|x)/i,rS=/[\s,\(]\S/,sr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},nu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},iS=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},nS=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},oS=function(t,e){var s=e.s+e.c*t;e.set(e.t,e.p,~~(s+(s<0?-.5:.5))+e.u,e)},e_=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},s_=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},aS=function(t,e,s){return t.style[e]=s},lS=function(t,e,s){return t.style.setProperty(e,s)},hS=function(t,e,s){return t._gsap[e]=s},cS=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},uS=function(t,e,s,r,n){var a=t._gsap;a.scaleX=a.scaleY=s,a.renderTransform(n,a)},dS=function(t,e,s,r,n){var a=t._gsap;a[e]=s,a.renderTransform(n,a)},Gt="transform",$e=Gt+"Origin",fS=function i(t,e){var s=this,r=this.target,n=r.style,a=r._gsap;if(t in Er&&n){if(this.tfm=this.tfm||{},t!=="transform")t=sr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(h){return s.tfm[h]=Tr(r,h)}):this.tfm[t]=a.x?a[t]:Tr(r,t),t===$e&&(this.tfm.zOrigin=a.zOrigin);else return sr.transform.split(",").forEach(function(h){return i.call(s,h,e)});if(this.props.indexOf(Gt)>=0)return;a.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push($e,e,"")),t=Gt}(n||e)&&this.props.push(t,e,n[t])},r_=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},pS=function(){var t=this.props,e=this.target,s=e.style,r=e._gsap,n,a;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?s[t[n]]=t[n+2]:s.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(iu,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)r[a]=this.tfm[a];r.svg&&(r.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=ru(),(!n||!n.isStart)&&!s[Gt]&&(r_(s),r.zOrigin&&s[$e]&&(s[$e]+=" "+r.zOrigin+"px",r.zOrigin=0,r.renderTransform()),r.uncache=1)}},i_=function(t,e){var s={target:t,props:[],revert:pS,save:fS};return t._gsap||Xe.core.getCache(t),e&&e.split(",").forEach(function(r){return s.save(r)}),s},n_,ou=function(t,e){var s=Kr.createElementNS?Kr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Kr.createElement(t);return s&&s.style?s:Kr.createElement(t)},rr=function i(t,e,s){var r=getComputedStyle(t);return r[e]||r.getPropertyValue(e.replace(iu,"-$1").toLowerCase())||r.getPropertyValue(e)||!s&&i(t,Cn(e)||e,1)||""},o_="O,Moz,ms,Ms,Webkit".split(","),Cn=function(t,e,s){var r=e||Bi,n=r.style,a=5;if(t in n&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(o_[a]+t in n););return a<0?null:(a===3?"ms":a>=0?o_[a]:"")+t},au=function(){eS()&&window.document&&(Qg=window,Kr=Qg.document,Tn=Kr.documentElement,Bi=ou("div")||{style:{}},ou("div"),Gt=Cn(Gt),$e=Gt+"Origin",Bi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",n_=!!Cn("perspective"),ru=Xe.core.reverting,su=1)},lu=function i(t){var e=ou("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,r=this.nextSibling,n=this.style.cssText,a;if(Tn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=i}catch{}else this._gsapBBox&&(a=this._gsapBBox());return s&&(r?s.insertBefore(this,r):s.appendChild(this)),Tn.removeChild(e),this.style.cssText=n,a},a_=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},l_=function(t){var e;try{e=t.getBBox()}catch{e=lu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===lu||(e=lu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+a_(t,["x","cx","x1"])||0,y:+a_(t,["y","cy","y1"])||0,width:0,height:0}:e},h_=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&l_(t))},Oi=function(t,e){if(e){var s=t.style,r;e in Er&&e!==$e&&(e=Gt),s.removeProperty?(r=e.substr(0,2),(r==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(r==="--"?e:e.replace(iu,"-$1").toLowerCase())):s.removeAttribute(e)}},Qr=function(t,e,s,r,n,a){var h=new Ge(t._pt,e,s,0,1,a?s_:e_);return t._pt=h,h.b=r,h.e=n,t._props.push(s),h},c_={deg:1,rad:1,turn:1},mS={grid:1,flex:1},Jr=function i(t,e,s,r){var n=parseFloat(s)||0,a=(s+"").trim().substr((n+"").length)||"px",h=Bi.style,o=sS.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(o?"Width":"Height"),c=100,d=r==="px",f=r==="%",p,m,g,_;if(r===a||!n||c_[r]||c_[a])return n;if(a!=="px"&&!d&&(n=i(t,e,s,"px")),_=t.getCTM&&h_(t),(f||a==="%")&&(Er[e]||~e.indexOf("adius")))return p=_?t.getBBox()[o?"width":"height"]:t[u],te(f?n/p*c:n/100*p);if(h[o?"width":"height"]=c+(d?a:r),m=~e.indexOf("adius")||r==="em"&&t.appendChild&&!l?t:t.parentNode,_&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Kr||!m.appendChild)&&(m=Kr.body),g=m._gsap,g&&f&&g.width&&o&&g.time===ts.time&&!g.uncache)return te(n/g.width*c);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=c+r,p=t[u],x?t.style[e]=x:Oi(t,e)}else(f||a==="%")&&!mS[rr(m,"display")]&&(h.position=rr(t,"position")),m===t&&(h.position="static"),m.appendChild(Bi),p=Bi[u],m.removeChild(Bi),h.position="absolute";return o&&f&&(g=Ii(m),g.time=ts.time,g.width=m[u]),te(d?p*n/c:p&&n?c/p*n:0)},Tr=function(t,e,s,r){var n;return su||au(),e in sr&&e!=="transform"&&(e=sr[e],~e.indexOf(",")&&(e=e.split(",")[0])),Er[e]&&e!=="transform"?(n=Eo(t,r),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dl(rr(t,$e))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||r||~(n+"").indexOf("calc("))&&(n=ul[e]&&ul[e](t,e,s)||rr(t,e)||pg(t,e)||(e==="opacity"?1:0))),s&&!~(n+"").trim().indexOf(" ")?Jr(t,e,n,s)+s:n},gS=function(t,e,s,r){if(!s||s==="none"){var n=Cn(e,t,1),a=n&&rr(t,n,1);a&&a!==s?(e=n,s=a):e==="borderColor"&&(s=rr(t,"borderTopColor"))}var h=new Ge(this._pt,t.style,e,0,1,jg),o=0,l=0,u,c,d,f,p,m,g,_,x,y,v,b;if(h.b=s,h.e=r,s+="",r+="",r==="auto"&&(m=t.style[e],t.style[e]=r,r=rr(t,e)||r,m?t.style[e]=m:Oi(t,e)),u=[s,r],Ng(u),s=u[0],r=u[1],d=s.match(yn)||[],b=r.match(yn)||[],b.length){for(;c=yn.exec(r);)g=c[0],x=r.substring(o,c.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=xn(f,g)+v),_=parseFloat(g),y=g.substr((_+"").length),o=yn.lastIndex-y.length,y||(y=y||Ze.units[e]||v,o===r.length&&(r+=y,h.e+=y)),v!==y&&(f=Jr(t,e,m,y)||0),h._pt={_next:h._pt,p:x||l===1?x:",",s:f,c:_-f,m:p&&p<4||e==="zIndex"?Math.round:0});h.c=o<r.length?r.substring(o,r.length):""}else h.r=e==="display"&&r==="none"?s_:e_;return ag.test(r)&&(h.e=0),this._pt=h,h},u_={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},_S=function(t){var e=t.split(" "),s=e[0],r=e[1]||"50%";return(s==="top"||s==="bottom"||r==="left"||r==="right")&&(t=s,s=r,r=t),e[0]=u_[s]||s,e[1]=u_[r]||r,e.join(" ")},yS=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,r=s.style,n=e.u,a=s._gsap,h,o,l;if(n==="all"||n===!0)r.cssText="",o=1;else for(n=n.split(","),l=n.length;--l>-1;)h=n[l],Er[h]&&(o=1,h=h==="transformOrigin"?$e:Gt),Oi(s,h);o&&(Oi(s,Gt),a&&(a.svg&&s.removeAttribute("transform"),Eo(s,1),a.uncache=1,r_(r)))}},ul={clearProps:function(t,e,s,r,n){if(n.data!=="isFromStart"){var a=t._pt=new Ge(t._pt,e,s,0,0,yS);return a.u=r,a.pr=-10,a.tween=n,t._props.push(s),1}}},wo=[1,0,0,1,0,0],d_={},f_=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},p_=function(t){var e=rr(t,Gt);return f_(e)?wo:e.substr(7).match(og).map(te)},hu=function(t,e){var s=t._gsap||Ii(t),r=t.style,n=p_(t),a,h,o,l;return s.svg&&t.getAttribute("transform")?(o=t.transform.baseVal.consolidate().matrix,n=[o.a,o.b,o.c,o.d,o.e,o.f],n.join(",")==="1,0,0,1,0,0"?wo:n):(n===wo&&!t.offsetParent&&t!==Tn&&!s.svg&&(o=r.display,r.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,h=t.nextElementSibling,Tn.appendChild(t)),n=p_(t),o?r.display=o:Oi(t,"display"),l&&(h?a.insertBefore(t,h):a?a.appendChild(t):Tn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},cu=function(t,e,s,r,n,a){var h=t._gsap,o=n||hu(t,!0),l=h.xOrigin||0,u=h.yOrigin||0,c=h.xOffset||0,d=h.yOffset||0,f=o[0],p=o[1],m=o[2],g=o[3],_=o[4],x=o[5],y=e.split(" "),v=parseFloat(y[0])||0,b=parseFloat(y[1])||0,w,E,T,A;s?o!==wo&&(E=f*g-p*m)&&(T=v*(g/E)+b*(-m/E)+(m*x-g*_)/E,A=v*(-p/E)+b*(f/E)-(f*x-p*_)/E,v=T,b=A):(w=l_(t),v=w.x+(~y[0].indexOf("%")?v/100*w.width:v),b=w.y+(~(y[1]||y[0]).indexOf("%")?b/100*w.height:b)),r||r!==!1&&h.smooth?(_=v-l,x=b-u,h.xOffset=c+(_*f+x*m)-_,h.yOffset=d+(_*p+x*g)-x):h.xOffset=h.yOffset=0,h.xOrigin=v,h.yOrigin=b,h.smooth=!!r,h.origin=e,h.originIsAbsolute=!!s,t.style[$e]="0px 0px",a&&(Qr(a,h,"xOrigin",l,v),Qr(a,h,"yOrigin",u,b),Qr(a,h,"xOffset",c,h.xOffset),Qr(a,h,"yOffset",d,h.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},Eo=function(t,e){var s=t._gsap||new Xg(t);if("x"in s&&!e&&!s.uncache)return s;var r=t.style,n=s.scaleX<0,a="px",h="deg",o=getComputedStyle(t),l=rr(t,$e)||"0",u,c,d,f,p,m,g,_,x,y,v,b,w,E,T,A,I,M,R,C,P,k,U,V,L,$,O,N,Z,Q,H,lt;return u=c=d=m=g=_=x=y=v=0,f=p=1,s.svg=!!(t.getCTM&&h_(t)),o.translate&&((o.translate!=="none"||o.scale!=="none"||o.rotate!=="none")&&(r[Gt]=(o.translate!=="none"?"translate3d("+(o.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(o.rotate!=="none"?"rotate("+o.rotate+") ":"")+(o.scale!=="none"?"scale("+o.scale.split(" ").join(",")+") ":"")+(o[Gt]!=="none"?o[Gt]:"")),r.scale=r.rotate=r.translate="none"),E=hu(t,s.svg),s.svg&&(s.uncache?(L=t.getBBox(),l=s.xOrigin-L.x+"px "+(s.yOrigin-L.y)+"px",V=""):V=!e&&t.getAttribute("data-svg-origin"),cu(t,V||l,!!V||s.originIsAbsolute,s.smooth!==!1,E)),b=s.xOrigin||0,w=s.yOrigin||0,E!==wo&&(M=E[0],R=E[1],C=E[2],P=E[3],u=k=E[4],c=U=E[5],E.length===6?(f=Math.sqrt(M*M+R*R),p=Math.sqrt(P*P+C*C),m=M||R?Sn(R,M)*Di:0,x=C||P?Sn(C,P)*Di+m:0,x&&(p*=Math.abs(Math.cos(x*An))),s.svg&&(u-=b-(b*M+w*C),c-=w-(b*R+w*P))):(lt=E[6],Q=E[7],O=E[8],N=E[9],Z=E[10],H=E[11],u=E[12],c=E[13],d=E[14],T=Sn(lt,Z),g=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=k*A+O*I,L=U*A+N*I,$=lt*A+Z*I,O=k*-I+O*A,N=U*-I+N*A,Z=lt*-I+Z*A,H=Q*-I+H*A,k=V,U=L,lt=$),T=Sn(-C,Z),_=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=M*A-O*I,L=R*A-N*I,$=C*A-Z*I,H=P*I+H*A,M=V,R=L,C=$),T=Sn(R,M),m=T*Di,T&&(A=Math.cos(T),I=Math.sin(T),V=M*A+R*I,L=k*A+U*I,R=R*A-M*I,U=U*A-k*I,M=V,k=L),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,_=180-_),f=te(Math.sqrt(M*M+R*R+C*C)),p=te(Math.sqrt(U*U+lt*lt)),T=Sn(k,U),x=Math.abs(T)>2e-4?T*Di:0,v=H?1/(H<0?-H:H):0),s.svg&&(V=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!f_(rr(t,Gt)),V&&t.setAttribute("transform",V))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||s.uncache,s.x=u-((s.xPercent=u&&(!e&&s.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*s.xPercent/100:0)+a,s.y=c-((s.yPercent=c&&(!e&&s.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*s.yPercent/100:0)+a,s.z=d+a,s.scaleX=te(f),s.scaleY=te(p),s.rotation=te(m)+h,s.rotationX=te(g)+h,s.rotationY=te(_)+h,s.skewX=x+h,s.skewY=y+h,s.transformPerspective=v+a,(s.zOrigin=parseFloat(l.split(" ")[2])||!e&&s.zOrigin||0)&&(r[$e]=dl(l)),s.xOffset=s.yOffset=0,s.force3D=Ze.force3D,s.renderTransform=s.svg?vS:n_?m_:xS,s.uncache=0,s},dl=function(t){return(t=t.split(" "))[0]+" "+t[1]},uu=function(t,e,s){var r=Ce(e);return te(parseFloat(e)+parseFloat(Jr(t,"x",s+"px",r)))+r},xS=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,m_(t,e)},Li="0deg",To="0px",Ni=") ",m_=function(t,e){var s=e||this,r=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.z,l=s.rotation,u=s.rotationY,c=s.rotationX,d=s.skewX,f=s.skewY,p=s.scaleX,m=s.scaleY,g=s.transformPerspective,_=s.force3D,x=s.target,y=s.zOrigin,v="",b=_==="auto"&&t&&t!==1||_===!0;if(y&&(c!==Li||u!==Li)){var w=parseFloat(u)*An,E=Math.sin(w),T=Math.cos(w),A;w=parseFloat(c)*An,A=Math.cos(w),a=uu(x,a,E*A*-y),h=uu(x,h,-Math.sin(w)*-y),o=uu(x,o,T*A*-y+y)}g!==To&&(v+="perspective("+g+Ni),(r||n)&&(v+="translate("+r+"%, "+n+"%) "),(b||a!==To||h!==To||o!==To)&&(v+=o!==To||b?"translate3d("+a+", "+h+", "+o+") ":"translate("+a+", "+h+Ni),l!==Li&&(v+="rotate("+l+Ni),u!==Li&&(v+="rotateY("+u+Ni),c!==Li&&(v+="rotateX("+c+Ni),(d!==Li||f!==Li)&&(v+="skew("+d+", "+f+Ni),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Ni),x.style[Gt]=v||"translate(0, 0)"},vS=function(t,e){var s=e||this,r=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.rotation,l=s.skewX,u=s.skewY,c=s.scaleX,d=s.scaleY,f=s.target,p=s.xOrigin,m=s.yOrigin,g=s.xOffset,_=s.yOffset,x=s.forceCSS,y=parseFloat(a),v=parseFloat(h),b,w,E,T,A;o=parseFloat(o),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,o+=u),o||l?(o*=An,l*=An,b=Math.cos(o)*c,w=Math.sin(o)*c,E=Math.sin(o-l)*-d,T=Math.cos(o-l)*d,l&&(u*=An,A=Math.tan(l-u),A=Math.sqrt(1+A*A),E*=A,T*=A,u&&(A=Math.tan(u),A=Math.sqrt(1+A*A),b*=A,w*=A)),b=te(b),w=te(w),E=te(E),T=te(T)):(b=c,T=d,w=E=0),(y&&!~(a+"").indexOf("px")||v&&!~(h+"").indexOf("px"))&&(y=Jr(f,"x",a,"px"),v=Jr(f,"y",h,"px")),(p||m||g||_)&&(y=te(y+p-(p*b+m*E)+g),v=te(v+m-(p*w+m*T)+_)),(r||n)&&(A=f.getBBox(),y=te(y+r/100*A.width),v=te(v+n/100*A.height)),A="matrix("+b+","+w+","+E+","+T+","+y+","+v+")",f.setAttribute("transform",A),x&&(f.style[Gt]=A)},bS=function(t,e,s,r,n){var a=360,h=me(n),o=parseFloat(n)*(h&&~n.indexOf("rad")?Di:1),l=o-r,u=r+l+"deg",c,d;return h&&(c=n.split("_")[1],c==="short"&&(l%=a,l!==l%(a/2)&&(l+=l<0?a:-a)),c==="cw"&&l<0?l=(l+a*t_)%a-~~(l/a)*a:c==="ccw"&&l>0&&(l=(l-a*t_)%a-~~(l/a)*a)),t._pt=d=new Ge(t._pt,e,s,r,l,iS),d.e=u,d.u="deg",t._props.push(s),d},g_=function(t,e){for(var s in e)t[s]=e[s];return t},wS=function(t,e,s){var r=g_({},s._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=s.style,h,o,l,u,c,d,f,p;r.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),a[Gt]=e,h=Eo(s,1),Oi(s,Gt),s.setAttribute("transform",l)):(l=getComputedStyle(s)[Gt],a[Gt]=e,h=Eo(s,1),a[Gt]=l);for(o in Er)l=r[o],u=h[o],l!==u&&n.indexOf(o)<0&&(f=Ce(l),p=Ce(u),c=f!==p?Jr(s,o,l,p):parseFloat(l),d=parseFloat(u),t._pt=new Ge(t._pt,h,o,c,d-c,nu),t._pt.u=p||0,t._props.push(o));g_(h,r)};Ue("padding,margin,Width,Radius",function(i,t){var e="Top",s="Right",r="Bottom",n="Left",a=(t<3?[e,s,r,n]:[e+n,e+s,r+s,r+n]).map(function(h){return t<2?i+h:"border"+h+i});ul[t>1?"border"+i:i]=function(h,o,l,u,c){var d,f;if(arguments.length<4)return d=a.map(function(p){return Tr(h,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(u+"").split(" "),f={},a.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),h.init(o,f,c)}});var __={name:"css",register:au,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,r,n){var a=this._props,h=t.style,o=s.vars.startAt,l,u,c,d,f,p,m,g,_,x,y,v,b,w,E,T;su||au(),this.styles=this.styles||i_(t),T=this.styles.props,this.tween=s;for(m in e)if(m!=="autoRound"&&(u=e[m],!(Qe[m]&&$g(m,e,s,r,t,n)))){if(f=typeof u,p=ul[m],f==="function"&&(u=u.call(s,r,t,n),f=typeof u),f==="string"&&~u.indexOf("random(")&&(u=go(u)),p)p(this,t,m,u,s)&&(E=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),u+="",qr.lastIndex=0,qr.test(l)||(g=Ce(l),_=Ce(u)),_?g!==_&&(l=Jr(t,m,l,_)+_):g&&(u+=g),this.add(h,"setProperty",l,u,r,n,0,0,m),a.push(m),T.push(m,0,h[m]);else if(f!=="undefined"){if(o&&m in o?(l=typeof o[m]=="function"?o[m].call(s,r,t,n):o[m],me(l)&&~l.indexOf("random(")&&(l=go(l)),Ce(l+"")||l==="auto"||(l+=Ze.units[m]||Ce(Tr(t,m))||""),(l+"").charAt(1)==="="&&(l=Tr(t,m))):l=Tr(t,m),d=parseFloat(l),x=f==="string"&&u.charAt(1)==="="&&u.substr(0,2),x&&(u=u.substr(2)),c=parseFloat(u),m in sr&&(m==="autoAlpha"&&(d===1&&Tr(t,"visibility")==="hidden"&&c&&(d=0),T.push("visibility",0,h.visibility),Qr(this,h,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),m!=="scale"&&m!=="transform"&&(m=sr[m],~m.indexOf(",")&&(m=m.split(",")[0]))),y=m in Er,y){if(this.styles.save(m),v||(b=t._gsap,b.renderTransform&&!e.parseTransform||Eo(t,e.parseTransform),w=e.smoothOrigin!==!1&&b.smooth,v=this._pt=new Ge(this._pt,h,Gt,0,1,b.renderTransform,b,0,-1),v.dep=1),m==="scale")this._pt=new Ge(this._pt,b,"scaleY",b.scaleY,(x?xn(b.scaleY,x+c):c)-b.scaleY||0,nu),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){T.push($e,0,h[$e]),u=_S(u),b.svg?cu(t,u,0,w,0,this):(_=parseFloat(u.split(" ")[2])||0,_!==b.zOrigin&&Qr(this,b,"zOrigin",b.zOrigin,_),Qr(this,h,m,dl(l),dl(u)));continue}else if(m==="svgOrigin"){cu(t,u,1,w,0,this);continue}else if(m in d_){bS(this,b,m,d,x?xn(d,x+u):u);continue}else if(m==="smoothOrigin"){Qr(this,b,"smooth",b.smooth,u);continue}else if(m==="force3D"){b[m]=u;continue}else if(m==="transform"){wS(this,u,t);continue}}else m in h||(m=Cn(m)||m);if(y||(c||c===0)&&(d||d===0)&&!rS.test(u)&&m in h)g=(l+"").substr((d+"").length),c||(c=0),_=Ce(u)||(m in Ze.units?Ze.units[m]:g),g!==_&&(d=Jr(t,m,l,_)),this._pt=new Ge(this._pt,y?b:h,m,d,(x?xn(d,x+c):c)-d,!y&&(_==="px"||m==="zIndex")&&e.autoRound!==!1?oS:nu),this._pt.u=_||0,g!==_&&_!=="%"&&(this._pt.b=l,this._pt.r=nS);else if(m in h)gS.call(this,t,m,l,x?x+u:u);else if(m in t)this.add(t,m,l||t[m],x?x+u:u,r,n);else if(m!=="parseTransform"){kc(m,u);continue}y||(m in h?T.push(m,0,h[m]):T.push(m,1,l||t[m])),a.push(m)}}E&&qg(this)},render:function(t,e){if(e.tween._time||!ru())for(var s=e._pt;s;)s.r(t,s.d),s=s._next;else e.styles.revert()},get:Tr,aliases:sr,getSetter:function(t,e,s){var r=sr[e];return r&&r.indexOf(",")<0&&(e=r),e in Er&&e!==$e&&(t._gsap.x||Tr(t,"x"))?s&&Jg===s?e==="scale"?cS:hS:(Jg=s||{})&&(e==="scale"?uS:dS):t.style&&!Cc(t.style[e])?aS:~e.indexOf("-")?lS:Kc(t,e)},core:{_removeProperty:Oi,_getMatrix:hu}};Xe.utils.checkPrefix=Cn,Xe.core.getStyleSaver=i_,function(i,t,e,s){var r=Ue(i+","+t+","+e,function(n){Er[n]=1});Ue(t,function(n){Ze.units[n]="deg",d_[n]=1}),sr[r[13]]=i+","+t,Ue(s,function(n){var a=n.split(":");sr[a[1]]=r[a[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ue("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(i){Ze.units[i]="px"}),Xe.registerPlugin(__);var xt=Xe.registerPlugin(__)||Xe;xt.core.Tween;class du extends Ks{constructor(t){super(),this.radius=0,this.enableTint=!0,this.bgColor="#fff",this.borderWidth=0,this.borderColor="black",this.bgAlpha=1;const{x:e=0,y:s=0,width:r=0,height:n=0,bgColor:a="#fff",alpha:h=1,radius:o=0,borderWidth:l=0,borderColor:u="black",enableTint:c=!0}=t;this.x=e,this.y=s,this.bgAlpha=h,this.radius=o,this.enableTint=c,this.bgColor=a,this.borderWidth=l,this.borderColor=u,this.renderBg(r,n)}updateColor(t){xt.to(this,{tint:t,duration:.25})}renderBg(t,e){this.clear(),this.enableTint?(this.beginFill("#fff",this.bgAlpha),this.tint=this.bgColor):(this.beginFill(this.bgColor,this.bgAlpha),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1)),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1),this.radius!==0?typeof this.radius=="number"?this.drawRoundedRect(0,0,t,e,this.radius):(this.moveTo(0+this.radius[0],0),this.lineTo(0+t-this.radius[1],0),this.radius[1]>0?this.arcTo(0+t,0,0+t,0+this.radius[1],this.radius[1]):this.lineTo(0+t,0),this.lineTo(0+t,0+e-this.radius[2]),this.radius[2]>0?this.arcTo(0+t,0+e,0+t-this.radius[2],0+e,this.radius[2]):this.lineTo(0+t,0+e),this.lineTo(0+this.radius[3],0+e),this.radius[3]>0?this.arcTo(0,0+e,0,0+e-this.radius[3],this.radius[3]):this.lineTo(0,0+e),this.lineTo(0,0+this.radius[0]),this.radius[0]>0?this.arcTo(0,0,0+this.radius[0],0,this.radius[0]):this.lineTo(0,0),this.closePath()):this.drawRect(0,0,t,e),this.endFill()}}class Ao extends Bt{constructor(t,e,s,r){if(super(),r){const n=new Ks;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}s?(this._bgColorFill=new du({width:t,height:e,bgColor:s}),this.addChild(this._bgColorFill)):(this._fill=new qe,this._fill.width=t,this._fill.height=e,this.addChild(this._fill))}setSize(t,e){this._fill&&(this._fill.width=t,this._fill.height=e),this._bgColorFill&&this._bgColorFill.renderBg(t,e)}}/*!
1164
1164
  * @pixi/particle-emitter - v5.0.8
1165
1165
  * Compiled Mon, 28 Nov 2022 04:01:38 UTC
1166
1166
  *
1167
1167
  * @pixi/particle-emitter is licensed under the MIT License.
1168
1168
  * http://www.opensource.org/licenses/mit-license
1169
- */class ir{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:v_(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let r;const{value:n,time:a}=s[0],h=r=new ir(typeof n=="string"?pl(n):n,a,t.ease);if(s.length>2||s.length===2&&s[1].value!==n)for(let o=1;o<s.length;++o){const{value:l,time:u}=s[o];r.next=new ir(typeof l=="string"?pl(l):l,u),r=r.next}return h.isStepped=!!t.isStepped,h}const e=new ir(typeof t.start=="string"?pl(t.start):t.start,0);return t.end!==t.start&&(e.next=new ir(typeof t.end=="string"?pl(t.end):t.end,1)),e}}let So=q.from;const nr=Math.PI/180;function Ar(i,t){if(!i)return;const e=Math.sin(i),s=Math.cos(i),r=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=r,t.y=n}function fl(i,t,e){return i<<16|t<<8|e}function y_(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function ES(i){const t=1/y_(i);i.x*=t,i.y*=t}function x_(i,t){i.x*=t,i.y*=t}function pl(i,t){t||(t={}),i.charAt(0)==="#"?i=i.substr(1):i.indexOf("0x")===0&&(i=i.substr(2));let e;return i.length===8&&(e=i.substr(0,2),i=i.substr(2)),t.r=parseInt(i.substr(0,2),16),t.g=parseInt(i.substr(2,2),16),t.b=parseInt(i.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function v_(i){const t=i.length,e=1/t;return function(s){const r=t*s|0,n=(s-r*e)*t,a=i[r]||i[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function TS(i){return i?(i=i.toUpperCase().replace(/ /g,"_"),W[i]||W.NORMAL):W.NORMAL}class fu extends qe{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 Ft;(function(i){i[i.Spawn=0]="Spawn",i[i.Normal=2]="Normal",i[i.Late=5]="Late"})(Ft||(Ft={}));const pu=Tt.shared,Vi=Symbol("Position particle per emitter position");class wt{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 st,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new st,this._prevEmitterPos=new st,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){wt.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){typeof t=="number"&&t>0?this._frequency=t:this._frequency=1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase=typeof t.ease=="function"?t.ease:v_(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance=typeof t.spawnChance=="number"&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=t.emit===void 0?!0:!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map(s=>{const r=wt.knownBehaviors[s.type];return r?new r(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Vi),e.sort((s,r)=>s===Vi?r.order===Ft.Spawn?1:-1:r===Vi?s.order===Ft.Spawn?-1:1:s.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Vi&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Vi&&s.recycleParticle)}getBehavior(t){return wt.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof wt.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new fu(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let s=0;s<this.recycleBehaviors.length;++s)this.recycleBehaviors[s].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,Ar(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?pu.remove(this.update,this):!this._autoUpdate&&t&&pu.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=pu.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,h;a;a=h)if(h=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let o=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?o=this.customEase(o,0,1,1):o=this.customEase(o)),a.agePercent=o;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,s;this._prevPosIsValid&&(e=this._prevEmitterPos.x,s=this._prevEmitterPos.y);const r=this.ownerPos.x+this.spawnPos.x,n=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let a,h;if(this._prevPosIsValid&&this._posChanged){const u=1+this._spawnTimer/t;a=(r-e)*u+e,h=(n-s)*u+s}else a=r,h=n;let o=null,l=null;for(let u=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),c=0;c<u;++c){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let d;if(this.minLifetime===this.maxLifetime?d=this.minLifetime:d=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=d)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new fu(this),f.init(d),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),o?(l.next=f,f.prev=l,l=f):l=o=f,++this.particleCount}if(o){this._activeParticlesLast?(this._activeParticlesLast.next=o,o.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=o,this._activeParticlesLast=l);for(let u=0;u<this.initBehaviors.length;++u){const c=this.initBehaviors[u];if(c===Vi)for(let d=o,f;d;d=f){f=d.next,this.rotation!==0&&(Ar(this.rotation,d.position),d.rotation+=this.rotation),d.position.x+=a,d.position.y+=h,d.age+=-this._spawnTimer;let p=d.age*d.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),d.agePercent=p}else c.initParticles(o)}for(let u=o,c;u;u=c){c=u.next;for(let d=0;d<this.updateBehaviors.length;++d)if(this.updateBehaviors[d].updateParticle(u,-this._spawnTimer)){this.recycle(u);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=r,this._prevEmitterPos.y=n,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const a=this._completeCallback;this._completeCallback=null,a()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let s=null,r=null;for(let n=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),a=0;a<n;++a){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let h;this._poolFirst?(h=this._poolFirst,this._poolFirst=this._poolFirst.next,h.next=null):h=new fu(this);let o;this.minLifetime===this.maxLifetime?o=this.minLifetime:o=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,h.init(o),this.addAtBack?this._parent.addChildAt(h,0):this._parent.addChild(h),s?(r.next=h,h.prev=r,r=h):r=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=s,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Vi)for(let h=s,o;h;h=o)o=h.next,this.rotation!==0&&(Ar(this.rotation,h.position),h.rotation+=this.rotation),h.position.x+=t,h.position.y+=e;else a.initParticles(s)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){this.autoUpdate=!1,this.cleanup();let t;for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}wt.knownBehaviors={};class mu{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}}mu.type="rect",mu.editorConfig=null;class ml{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),Ar(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}ml.type="torus",ml.editorConfig=null;class gu{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(!t||!t.length)this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});else if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const s=t[e];let r=s[0];for(let n=1;n<s.length;++n){const a=s[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let s=1;s<t.length;++s){const r=t[s];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:r}=this.segments[e],n=Math.sqrt((r.x-s.x)*(r.x-s.x)+(r.y-s.y)*(r.y-s.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let s,r;if(this.segments.length===1)s=this.segments[0],r=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],r=h===0?e:e-this.countingLengths[h-1];break}r/=s.l||1;const{p1:n,p2:a}=s;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}gu.type="polygonalChain",gu.editorConfig=null;class _u{constructor(t){var e;this.order=Ft.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=(e=t.maxSpeed)!==null&&e!==void 0?e:0}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,r=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const a=y_(s);a>this.maxSpeed&&x_(s,this.maxSpeed/a)}t.x+=(r+s.x)/2*e,t.y+=(n+s.y)/2*e,this.rotate&&(t.rotation=Math.atan2(s.y,s.x))}}_u.type="moveAcceleration",_u.editorConfig=null;function AS(i){return this.ease&&(i=this.ease(i)),(this.first.next.value-this.first.value)*i+this.first.value}function SS(i){this.ease&&(i=this.ease(i));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*i+t.r,r=(e.g-t.g)*i+t.g,n=(e.b-t.b)*i+t.b;return fl(s,r,n)}function CS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;return i=(i-t.time)/(e.time-t.time),(e.value-t.value)*i+t.value}function IS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;i=(i-t.time)/(e.time-t.time);const s=t.value,r=e.value,n=(r.r-s.r)*i+s.r,a=(r.g-s.g)*i+s.g,h=(r.b-s.b)*i+s.b;return fl(n,a,h)}function PS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;return t.value}function RS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;const e=t.value;return fl(e.r,e.g,e.b)}class Co{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?SS:AS:t.isStepped?this.interpolate=this.isColor?RS:PS:this.interpolate=this.isColor?IS:CS,this.ease=this.first.ease}}class yu{constructor(t){this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.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)}}yu.type="alpha",yu.editorConfig=null;class xu{constructor(t){this.order=Ft.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}xu.type="alphaStatic",xu.editorConfig=null;function b_(i){const t=[];for(let e=0;e<i.length;++e){let s=i[e];if(typeof s=="string")t.push(So(s));else if(s instanceof q)t.push(s);else{let r=s.count||1;for(typeof s.texture=="string"?s=So(s.texture):s=s.texture;r>0;--r)t.push(s)}}return t}class vu{constructor(t){this.order=Ft.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const s=t.anims[e],r=b_(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!s.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[s];e.texture=r.textures[0],e.config.animElapsed=0,r.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=r.textures.length/e.maxLife):(e.config.animDuration=r.duration,e.config.animFramerate=r.framerate),e=e.next}}updateParticle(t,e){const s=t.config,r=s.anim;s.animElapsed+=e,s.animElapsed>=s.animDuration&&(s.anim.loop?s.animElapsed=s.animElapsed%s.animDuration:s.animElapsed=s.animDuration-1e-6);const n=s.animElapsed*s.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||q.EMPTY}}vu.type="animatedRandom",vu.editorConfig=null;class bu{constructor(t){this.order=Ft.Normal;const e=t.anim,s=b_(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:r>0?s.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const s=this.anim;for(;e;)e.texture=s.textures[0],e.config.animElapsed=0,s.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=s.textures.length/e.maxLife):(e.config.animDuration=s.duration,e.config.animFramerate=s.framerate),e=e.next}updateParticle(t,e){const s=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(s.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}bu.type="animatedSingle",bu.editorConfig=null;class wu{constructor(t){this.order=Ft.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=TS(this.value),e=e.next}}wu.type="blendMode",wu.editorConfig=null;class Eu{constructor(t){this.order=Ft.Spawn,this.spacing=t.spacing*nr,this.start=t.start*nr,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,s.rotation=r,this.distance&&(s.position.x=this.distance,Ar(r,s.position)),s=s.next,++e}}}Eu.type="spawnBurst",Eu.editorConfig=null;class Tu{constructor(t){this.order=Ft.Normal,this.list=new Co(!0),this.list.reset(ir.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,r=fl(s.r,s.g,s.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}Tu.type="color",Tu.editorConfig=null;class Au{constructor(t){this.order=Ft.Normal;let e=t.color;e.charAt(0)==="#"?e=e.substr(1):e.indexOf("0x")===0&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}Au.type="colorStatic",Au.editorConfig=null;class Su{constructor(t){this.order=Ft.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}Su.type="textureOrdered",Su.editorConfig=null;const In=new st,w_=["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"],MS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(w_).join("|"),"g");function FS(i){const t=i.match(MS);for(let e=t.length-1;e>=0;--e)w_.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return i=t.join(""),new Function("x",`return ${i};`)}class Cu{constructor(t){var e;if(this.order=Ft.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=FS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new st(e.x,e.y),e.config.movement=0;const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=s*e,In.x=t.config.movement,In.y=this.path(In.x),Ar(t.config.initRotation,In),t.position.x=t.config.initPosition.x+In.x,t.position.y=t.config.initPosition.y+In.y}}Cu.type="movePath",Cu.editorConfig=null;class Iu{constructor(){this.order=Ft.Spawn}initParticles(t){}}Iu.type="spawnPoint",Iu.editorConfig=null;class Pu{constructor(t){this.order=Ft.Normal,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[s],e=e.next}}}Pu.type="textureRandom",Pu.editorConfig=null;class Ru{constructor(t){this.order=Ft.Normal,this.minStart=t.minStart*nr,this.maxStart=t.maxStart*nr,this.minSpeed=t.minSpeed*nr,this.maxSpeed=t.maxSpeed*nr,this.accel=t.accel*nr}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 s=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+s)/2*e}else t.rotation+=t.config.rotSpeed*e}}Ru.type="rotation",Ru.editorConfig=null;class Mu{constructor(t){this.order=Ft.Normal,this.min=t.min*nr,this.max=t.max*nr}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}}Mu.type="rotationStatic",Mu.editorConfig=null;class Fu{constructor(t){this.order=Ft.Late+1,this.rotation=(t.rotation||0)*nr}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Fu.type="noRotation",Fu.editorConfig=null;class ku{constructor(t){var e;this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=s,e.scale.x=e.scale.y=this.list.first.value*s,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}ku.type="scale",ku.editorConfig=null;class Bu{constructor(t){this.order=Ft.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=s,e=e.next}}}Bu.type="scaleStatic",Bu.editorConfig=null;class Ss{constructor(t){this.order=Ft.Spawn;const e=Ss.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){Ss.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Ss.type="spawnShape",Ss.editorConfig=null,Ss.shapes={},Ss.registerShape(gu),Ss.registerShape(mu),Ss.registerShape(ml),Ss.registerShape(ml,"circle");class Du{constructor(t){this.order=Ft.Normal,this.texture=typeof t.texture=="string"?So(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Du.type="textureSingle",Du.editorConfig=null;class Ou{constructor(t){var e;this.order=Ft.Late,this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e.config.velocity?e.config.velocity.set(this.list.first.value*s,0):e.config.velocity=new st(this.list.first.value*s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;ES(r),x_(r,s),t.x+=r.x*e,t.y+=r.y*e}}Ou.type="moveSpeed",Ou.editorConfig=null;class Lu{constructor(t){this.order=Ft.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity;t.x+=s.x*e,t.y+=s.y*e}}Lu.type="moveSpeedStatic",Lu.editorConfig=null,wt.registerBehavior(_u),wt.registerBehavior(yu),wt.registerBehavior(xu),wt.registerBehavior(vu),wt.registerBehavior(bu),wt.registerBehavior(wu),wt.registerBehavior(Eu),wt.registerBehavior(Tu),wt.registerBehavior(Au),wt.registerBehavior(Su),wt.registerBehavior(Cu),wt.registerBehavior(Iu),wt.registerBehavior(Pu),wt.registerBehavior(Ru),wt.registerBehavior(Mu),wt.registerBehavior(Fu),wt.registerBehavior(ku),wt.registerBehavior(Bu),wt.registerBehavior(Ss),wt.registerBehavior(Du),wt.registerBehavior(Ou),wt.registerBehavior(Lu);class Nu extends za{constructor(t){const{text:e,fontSize:s=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:h,fontFamily:o="MicrosoftYaHei",fontWeight:l="normal",wordWrap:u=!1,wordWrapWidth:c=100,lineHeight:d=1.25,align:f="left",indent:p=0,shadow:m}=t,g=new vr({fontSize:s,wordWrap:u,wordWrapWidth:c,fontWeight:l,lineHeight:d*s,breakWords:u,fill:r,align:f,fontFamily:o,stroke:n?a:"transparent",strokeThickness:n?h:0,lineJoin:"round"});m&&(g.dropShadow=!0,g.dropShadowColor=m[0],g.dropShadowAngle=m[1]*(Math.PI/180),g.dropShadowBlur=m[2],g.dropShadowDistance=m[3]),super(e,g),this.position.x=p*s}}class kS extends Bt{constructor(t){super();const{start:e,control:s,end:r,json:n,duration:a,ease:h="power1.out",showControl:o=!1,loop:l=!1}=t;this._particleContainer=new MT,this.addChild(this._particleContainer);const u=new wt(this._particleContainer,n),c=this._createBezierPoints([e,...s,r],100,o),d={pathThrough:0};bt.to(d,{duration:a,pathThrough:c.length-1,repeat:l?-1:0,ease:h,onStart:()=>{u.emit=!0},onUpdate:()=>{const p=Math.floor(d.pathThrough),m=c[p];u.updateOwnerPos(m.x,m.y)},onComplete:()=>{bt.to(this,{alpha:0,duration:.5,onComplete:()=>{u.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new Tt;f.add(()=>{u.update(1/75)}),f.start()}_createBezierPoints(t,e,s){const r=[];s&&t.forEach((n,a)=>{const h=new Nu({text:a+1,fontSize:16});h.position.set(n.x,n.y),this.addChild(h)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const s=t.length;let r=0,n=0;const a=[];for(let h=0;h<s;h++)a[h]=this._binomial(s-1,h);for(let h=0;h<s;h++){const o=t[h],l=a[h],u=Math.pow(e,h),c=Math.pow(1-e,s-1-h);r+=o.x*c*u*l,n+=o.y*c*u*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let r=1;r<=e;r++)s=s*(t-r+1)/r;return s}}var at=(i=>(i[i.Region=0]="Region",i[i.BoundingBox=1]="BoundingBox",i[i.Mesh=2]="Mesh",i[i.LinkedMesh=3]="LinkedMesh",i[i.Path=4]="Path",i[i.Point=5]="Point",i[i.Clipping=6]="Clipping",i))(at||{});class gl{constructor(t,e=new Array,s=0,r=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return e&128&&(e=this.readByte(),s|=(e&127)<<7,e&128&&(e=this.readByte(),s|=(e&127)<<14,e&128&&(e=this.readByte(),s|=(e&127)<<21,e&128&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(r),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(i=>(i[i.setup=0]="setup",i[i.first=1]="first",i[i.replace=2]="replace",i[i.add=3]="add",i))(S||{}),At=(i=>(i[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",i))(At||{}),ne=(i=>(i[i.Fixed=0]="Fixed",i[i.Percent=1]="Percent",i))(ne||{}),Fe=(i=>(i[i.Tangent=0]="Tangent",i[i.Chain=1]="Chain",i[i.ChainScale=2]="ChainScale",i))(Fe||{}),xt=(i=>(i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection",i))(xt||{});function E_(i){switch(i.toLowerCase()){case"nearest":return Ye.Nearest;case"linear":return Ye.Linear;case"mipmap":return Ye.MipMap;case"mipmapnearestnearest":return Ye.MipMapNearestNearest;case"mipmaplinearnearest":return Ye.MipMapLinearNearest;case"mipmapnearestlinear":return Ye.MipMapNearestLinear;case"mipmaplinearlinear":return Ye.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${i}`)}}var Ye=(i=>(i[i.Nearest=9728]="Nearest",i[i.Linear=9729]="Linear",i[i.MipMap=9987]="MipMap",i[i.MipMapNearestNearest=9984]="MipMapNearestNearest",i[i.MipMapLinearNearest=9985]="MipMapLinearNearest",i[i.MipMapNearestLinear=9986]="MipMapNearestLinear",i[i.MipMapLinearLinear=9987]="MipMapLinearLinear",i))(Ye||{}),Ui=(i=>(i[i.MirroredRepeat=33648]="MirroredRepeat",i[i.ClampToEdge=33071]="ClampToEdge",i[i.Repeat=10497]="Repeat",i))(Ui||{});class Vu{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}}class BS{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Uu{constructor(t,e,s){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,s)}addTexture(t,e){const s=this.pages;let r=null;for(let a=0;a<s.length;a++)if(s[a].baseTexture===e.baseTexture){r=s[a];break}if(r===null){r=new T_,r.name="texturePage";const a=e.baseTexture;r.width=a.realWidth,r.height=a.realHeight,r.baseTexture=a,r.minFilter=r.magFilter=Ye.Nearest,r.uWrap=Ui.ClampToEdge,r.vWrap=Ui.ClampToEdge,s.push(r)}const n=new A_;return n.name=t,n.page=r,n.texture=e,n.index=-1,this.regions.push(n),n}addTextureHash(t,e){for(const s in t)t.hasOwnProperty(s)&&this.addTexture(e&&s.indexOf(".")!==-1?s.substr(0,s.lastIndexOf(".")):s,t[s])}addSpineAtlas(t,e,s){return this.load(t,e,s)}load(t,e,s){if(e==null)throw new Error("textureLoader cannot be null.");const r=new DS(t),n=new Array(4);let a=null;const h={};let o=null;h.size=()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},h.format=()=>{},h.filter=()=>{a.minFilter=E_(n[1]),a.magFilter=E_(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(a.uWrap=Ui.Repeat),n[1].indexOf("y")!=-1&&(a.vWrap=Ui.Repeat)},h.pma=()=>{a.pma=n[1]=="true"};const l={};l.xy=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2])},l.size=()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},l.bounds=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2]),o.width=parseInt(n[3]),o.height=parseInt(n[4])},l.offset=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2])},l.orig=()=>{o.originalWidth=parseInt(n[1]),o.originalHeight=parseInt(n[2])},l.offsets=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2]),o.originalWidth=parseInt(n[3]),o.originalHeight=parseInt(n[4])},l.rotate=()=>{const d=n[1];let f=0;d.toLocaleLowerCase()=="true"?f=6:d.toLocaleLowerCase()=="false"?f=0:f=(720-parseFloat(d))%360/45,o.rotate=f},l.index=()=>{o.index=parseInt(n[1])};let u=r.readLine();for(;u!=null&&u.trim().length==0;)u=r.readLine();for(;!(u==null||u.trim().length==0||r.readEntry(n,u)==0);)u=r.readLine();const c=()=>{for(;;){if(u==null)return s&&s(this);if(u.trim().length==0)a=null,u=r.readLine();else if(a===null){for(a=new T_,a.name=u.trim();r.readEntry(n,u=r.readLine())!=0;){const d=h[n[0]];d&&d()}this.pages.push(a),e(a.name,d=>{if(d===null)return this.pages.splice(this.pages.indexOf(a),1),s&&s(null);a.baseTexture=d,a.pma&&(d.alphaMode=Re.PMA),d.valid||d.setSize(a.width,a.height),a.setFilters(),(!a.width||!a.height)&&(a.width=d.realWidth,a.height=d.realHeight,(!a.width||!a.height)&&console.log(`ERROR spine atlas page ${a.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),c()});break}else{o=new BS;const d=new A_;d.name=u,d.page=a;let f=null,p=null;for(;;){const v=r.readEntry(n,u=r.readLine());if(v==0)break;const b=l[n[0]];if(b)b();else{f==null&&(f=[],p=[]),f.push(n[0]);const w=[];for(let E=0;E<v;E++)w.push(parseInt(n[E+1]));p.push(w)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height);const m=a.baseTexture.resolution;o.x/=m,o.y/=m,o.width/=m,o.height/=m,o.originalWidth/=m,o.originalHeight/=m,o.offsetX/=m,o.offsetY/=m;const g=o.rotate%4!==0,_=new rt(o.x,o.y,g?o.height:o.width,g?o.width:o.height),x=new rt(0,0,o.originalWidth,o.originalHeight),y=new rt(o.offsetX,o.originalHeight-o.height-o.offsetY,o.width,o.height);d.texture=new q(d.page.baseTexture,_,x,y,o.rotate),d.index=o.index,d.texture.updateUvs(),this.regions.push(d)}}};c()}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].baseTexture.dispose()}}class DS{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(e==null||(e=e.trim(),e.length==0))return 0;const s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let r=1,n=s+1;;r++){const a=e.indexOf(",",n);if(a==-1)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,a-n).trim(),n=a+1,r==4)return 4}}}class T_{constructor(){this.minFilter=Ye.Nearest,this.magFilter=Ye.Nearest,this.uWrap=Ui.ClampToEdge,this.vWrap=Ui.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==Ye.Linear?t.scaleMode=je.LINEAR:this.minFilter==Ye.Nearest?t.scaleMode=je.NEAREST:(t.mipmap=xs.POW2,e==Ye.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class A_ extends Vu{}class OS{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class LS{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Gi=class{constructor(i=0,t=0,e=0,s=0){this.r=i,this.g=t,this.b=e,this.a=s}set(i,t,e,s){return this.r=i,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(i){return this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this}setFromString(i){return i=i.charAt(0)=="#"?i.substr(1):i,this.r=parseInt(i.substr(0,2),16)/255,this.g=parseInt(i.substr(2,2),16)/255,this.b=parseInt(i.substr(4,2),16)/255,this.a=i.length!=8?1:parseInt(i.substr(6,2),16)/255,this}add(i,t,e,s){return this.r+=i,this.g+=t,this.b+=e,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(i,t){i.r=((t&4278190080)>>>24)/255,i.g=((t&16711680)>>>16)/255,i.b=((t&65280)>>>8)/255,i.a=(t&255)/255}static rgb888ToColor(i,t){i.r=((t&16711680)>>>16)/255,i.g=((t&65280)>>>8)/255,i.b=(t&255)/255}static fromString(i){return new Gi().setFromString(i)}};let X=Gi;X.WHITE=new Gi(1,1,1,1),X.RED=new Gi(1,0,0,1),X.GREEN=new Gi(0,1,0,1),X.BLUE=new Gi(0,0,1,1),X.MAGENTA=new Gi(1,0,1,1);const Sr=class{static clamp(i,t,e){return i<t?t:i>e?e:i}static cosDeg(i){return Math.cos(i*Sr.degRad)}static sinDeg(i){return Math.sin(i*Sr.degRad)}static signum(i){return Math.sign(i)}static toInt(i){return i>0?Math.floor(i):Math.ceil(i)}static cbrt(i){const t=Math.pow(Math.abs(i),.3333333333333333);return i<0?-t:t}static randomTriangular(i,t){return Sr.randomTriangularWith(i,t,(i+t)*.5)}static randomTriangularWith(i,t,e){const s=Math.random(),r=t-i;return s<=(e-i)/r?i+Math.sqrt(s*r*(e-i)):t-Math.sqrt((1-s)*r*(t-e))}static isPowerOfTwo(i){return i&&(i&i-1)===0}};let D=Sr;D.PI=3.1415927,D.PI2=Sr.PI*2,D.radiansToDegrees=180/Sr.PI,D.radDeg=Sr.radiansToDegrees,D.degreesToRadians=Sr.PI/180,D.degRad=Sr.degreesToRadians;class NS{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class VS extends NS{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class S_ extends VS{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Pn=class{static arrayCopy(i,t,e,s,r){for(let n=t,a=s;n<t+r;n++,a++)e[a]=i[n]}static arrayFill(i,t,e,s){for(let r=t;r<e;r++)i[r]=s}static setArraySize(i,t,e=0){const s=i.length;if(s==t)return i;if(i.length=t,s<t)for(let r=s;r<t;r++)i[r]=e;return i}static ensureArrayCapacity(i,t,e=0){return i.length>=t?i:Pn.setArraySize(i,t,e)}static newArray(i,t){const e=new Array(i);for(let s=0;s<i;s++)e[s]=t;return e}static newFloatArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(i){return Pn.SUPPORTS_TYPED_ARRAYS?new Float32Array(i):i}static toSinglePrecision(i){return Pn.SUPPORTS_TYPED_ARRAYS?Math.fround(i):i}static webkit602BugfixHelper(i,t){}static contains(i,t,e=!0){for(let s=0;s<i.length;s++)if(i[s]==t)return!0;return!1}static enumValue(i,t){return i[t[0].toUpperCase()+t.slice(1)]}};let B=Pn;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class US{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class GS{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}}const XS={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},ti=[0,0,0];class $S extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class YS extends RT{constructor(t,e,s,r,n){super(t,e,s,r,n),this.region=null,this.attachment=null}}const C_=class extends Bt{constructor(i){if(super(),!i)throw new Error("The spineData param is required.");if(typeof i=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=i,this.createSkeleton(i),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],r=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===at.Region){const a=r.name,h=this.createSprite(s,r,a);s.currentSprite=h,s.currentSpriteName=a,n.addChild(h)}else if(r.type===at.Mesh){const a=this.createMesh(s,r);s.currentMesh=a,s.currentMeshId=r.id,s.currentMeshName=r.name,n.addChild(a)}else r.type===at.Clipping&&(this.createGraphics(s,r),n.addChild(s.clippingContainer),n.addChild(s.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(i){var t;i!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),i==null||i.registerSpine(this),this._debug=i)}get autoUpdate(){return this._autoUpdate}set autoUpdate(i){i!==this._autoUpdate&&(this._autoUpdate=i,this.updateTransform=i?C_.prototype.autoUpdateTransform:Bt.prototype.updateTransform)}get tint(){return eo(this.tintRgb)}set tint(i){this.tintRgb=sp(i,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:XS.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(i){var l;const t=this.delayLimit;if(i>t&&(i=t),this.state.update(i),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let r=null,n=null;s?(r=s.light,n=s.dark):r=this.tintRgb;for(let u=0,c=e.length;u<c;u++){const d=e[u],f=d.getAttachment(),p=this.slotContainers[u];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(d,f);let g=f.region;const _=f.color;switch(f!=null&&f.type){case at.Region:if(p.transform.setFromMatrix(d.bone.matrix),g=f.region,d.currentMesh&&(d.currentMesh.visible=!1,d.currentMesh=null,d.currentMeshId=void 0,d.currentMeshName=void 0),!g){d.currentSprite&&(d.currentSprite.renderable=!1);break}if(!d.currentSpriteName||d.currentSpriteName!==f.name){const v=f.name;if(d.currentSprite&&(d.currentSprite.visible=!1),d.sprites=d.sprites||{},d.sprites[v]!==void 0)d.sprites[v].visible=!0;else{const b=this.createSprite(d,f,v);p.addChild(b)}d.currentSprite=d.sprites[v],d.currentSpriteName=v}d.currentSprite.renderable=!0,d.hackRegion||this.setSpriteRegion(f,d.currentSprite,g),d.currentSprite.color?m=d.currentSprite.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentSprite.tint=eo(ti)),d.currentSprite.blendMode=d.blendMode;break;case at.Mesh:if(d.currentSprite){d.currentSprite.visible=!1,d.currentSprite=null,d.currentSpriteName=void 0;const v=new ma;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!g){d.currentMesh&&(d.currentMesh.renderable=!1);break}const y=f.id;if(d.currentMeshId===void 0||d.currentMeshId!==y){const v=y;if(d.currentMesh&&(d.currentMesh.visible=!1),d.meshes=d.meshes||{},d.meshes[v]!==void 0)d.meshes[v].visible=!0;else{const b=this.createMesh(d,f);p.addChild(b)}d.currentMesh=d.meshes[v],d.currentMeshName=f.name,d.currentMeshId=v}d.currentMesh.renderable=!0,f.computeWorldVerticesOld(d,d.currentMesh.vertices),d.currentMesh.color?m=d.currentMesh.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentMesh.tint=eo(ti)),d.currentMesh.blendMode=d.blendMode,d.hackRegion||this.setMeshRegion(f,d.currentMesh,g);break;case at.Clipping:d.currentGraphics||(this.createGraphics(d,f),p.addChild(d.clippingContainer),p.addChild(d.currentGraphics)),this.updateGraphics(d,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=d.color.r*_.r,y=d.color.g*_.g,v=d.color.b*_.b;m.setLight(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v)),d.darkColor?(x=d.darkColor.r,y=d.darkColor.g,v=d.darkColor.b):(x=0,y=0,v=0),m.setDark(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v))}p.alpha=d.color.a}const a=this.skeleton.drawOrder;let h=null,o=null;for(let u=0,c=a.length;u<c;u++){const d=e[a[u].data.index],f=this.slotContainers[a[u].data.index];if(o||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),d.currentGraphics&&d.getAttachment())o=d.clippingContainer,h=d.getAttachment(),o.children.length=0,this.children[u]=f,h.endSlot===d.data&&(h.endSlot=null);else if(o){let p=this.tempClipContainers[u];p||(p=this.tempClipContainers[u]=this.newContainer(),p.visible=!1),this.children[u]=p,f.parent=null,o.addChild(f),h.endSlot==d.data&&(o.renderable=!0,o=null,h=null)}else this.children[u]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,t.rotation=i.rotation*D.degRad,t.position.x=i.x,t.position.y=i.y,t.alpha=i.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=i.scaleX*i.width/e.originalWidth,t.scale.y=-i.scaleY*i.height/e.originalHeight))}setMeshRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(i.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const i=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(i)}Bt.prototype.updateTransform.call(this)}createSprite(i,t,e){let s=t.region;i.hackAttachment===t&&(s=i.hackRegion);const r=s?s.texture:null,n=this.newSprite(r);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),i.sprites=i.sprites||{},i.sprites[e]=n,n}createMesh(i,t){let e=t.region;i.hackAttachment===t&&(e=i.hackRegion,i.hackAttachment=null,i.hackRegion=null);const s=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),ys.TRIANGLES);return typeof s._canvasPadding<"u"&&(s._canvasPadding=1.5),s.alpha=t.color.a,s.region=t.region,e&&this.setMeshRegion(t,s,e),i.meshes=i.meshes||{},i.meshes[t.id]=s,s}createGraphics(i,t){const e=this.newGraphics(),s=new Nr([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,i.currentGraphics=e,i.clippingContainer=this.newContainer(),i.clippingContainer.mask=i.currentGraphics,e}updateGraphics(i,t){const e=i.currentGraphics.geometry,s=e.graphicsData[0].shape.points,r=t.worldVerticesLength;s.length=r,t.computeWorldVertices(i,0,r,s,0,2),e.invalidate()}hackTextureBySlotIndex(i,t=null,e=null){const s=this.skeleton.slots[i];if(!s)return!1;const r=s.getAttachment();let n=r.region;return t?(n=new Vu,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=r):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(r,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(r,s.currentMesh,n),!0}hackTextureBySlotName(i,t=null,e=null){const s=this.skeleton.findSlotIndex(i);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(i,t,e,s=null){const r=this.skeleton.findSlotIndex(i),n=this.skeleton.getAttachmentByName(i,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const h=a.getAttachment();if(t===h.name){let o=n.region;return e?(o=new Vu,o.texture=e,o.size=s,a.hackRegion=o,a.hackAttachment=h):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=o?(this.setSpriteRegion(h,a.currentSprite,o),a.currentSprite.region=o):a.currentMesh&&a.currentMesh.region!=o&&this.setMeshRegion(h,a.currentMesh,o),!0}return!1}newContainer(){return new Bt}newSprite(i){return new $S(i)}newGraphics(){return new Ks}newMesh(i,t,e,s,r){return new YS(i,t,e,s,r)}transformHack(){return 1}hackAttachmentGroups(i,t,e){if(!i)return;const s=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const h=this.skeleton.slots[n],o=h.currentSpriteName||h.currentMeshName||"",l=h.currentSprite||h.currentMesh;o.endsWith(i)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,r]}destroy(i){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const r in s.meshes)s.meshes[r].destroy(i);s.meshes=null;for(const r in s.sprites)s.sprites[r].destroy(i);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(i);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(i)}};let Gu=C_;Gu.clippingPolygon=[],Object.defineProperty(Gu.prototype,"visible",{get(){return this._visible},set(i){i!==this._visible&&(this._visible=i,i&&(this.lastTime=0))}});let I_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const P_=class extends I_{constructor(t){super(t),this.id=(P_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.deform;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}copyTo(t){this.bones!=null?(t.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices!=null?(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment}};let Xi=P_;Xi.nextID=0;let HS=class ay extends Xi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new ay(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},WS=class ly extends Xi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new ly(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Xu=class wd extends Xi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.tempColor=new X(0,0,0,0)}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();const t=new wd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new wd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(this.parentMesh!=null?this.parentMesh:this),t}},_l=class hy extends Xi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new hy(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},zS=class cy extends Xi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new cy(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},R_=class{constructor(t,e){if(this.deform=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};const _e=class extends I_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[_e.OX1]=u-f,x[_e.OY1]=d+c,x[_e.OX2]=u-_,x[_e.OY2]=g+c,x[_e.OX3]=p-_,x[_e.OY3]=g+m,x[_e.OX4]=p-f,x[_e.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof R_?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[_e.OX1],p=n[_e.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX4],p=n[_e.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}copy(){const t=new _e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,B.arrayCopy(this.uvs,0,t.uvs,0,8),B.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t}};let it=_e;it.OX1=0,it.OY1=1,it.OX2=2,it.OY2=3,it.OX3=4,it.OY3=5,it.OX4=6,it.OY4=7,it.X1=0,it.Y1=1,it.C1R=2,it.C1G=3,it.C1B=4,it.C1A=5,it.U1=6,it.V1=7,it.X2=8,it.Y2=9,it.C2R=10,it.C2G=11,it.C2B=12,it.C2A=13,it.U2=14,it.V2=15,it.X3=16,it.Y3=17,it.C3R=18,it.C3G=19,it.C3B=20,it.C3A=21,it.U3=22,it.V3=23,it.X4=24,it.Y4=25,it.C4R=26,it.C4G=27,it.C4B=28,it.C4A=29,it.U4=30,it.V4=31,new S_(2);let oe=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(let r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const ee=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=B.newFloatArray((t-1)*ee.BEZIER_SIZE)}getFrameCount(){return this.curves.length/ee.BEZIER_SIZE+1}setLinear(t){this.curves[t*ee.BEZIER_SIZE]=ee.LINEAR}setStepped(t){this.curves[t*ee.BEZIER_SIZE]=ee.STEPPED}getCurveType(t){const e=t*ee.BEZIER_SIZE;if(e==this.curves.length)return ee.LINEAR;const s=this.curves[e];return s==ee.LINEAR?ee.LINEAR:s==ee.STEPPED?ee.STEPPED:ee.BEZIER}setCurve(t,e,s,r,n){const a=(-e*2+r)*.03,h=(-s*2+n)*.03,o=((e-r)*3+1)*.006,l=((s-n)*3+1)*.006;let u=a*2+o,c=h*2+l,d=e*.3+a+o*.16666667,f=s*.3+h+l*.16666667,p=t*ee.BEZIER_SIZE;const m=this.curves;m[p++]=ee.BEZIER;let g=d,_=f;for(let x=p+ee.BEZIER_SIZE-1;p<x;p+=2)m[p]=g,m[p+1]=_,d+=u,f+=c,u+=o,c+=l,g+=d,_+=f}getCurvePercent(t,e){e=D.clamp(e,0,1);const s=this.curves;let r=t*ee.BEZIER_SIZE;const n=s[r];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;r++;let a=0;for(let o=r,l=r+ee.BEZIER_SIZE-1;r<l;r+=2)if(a=s[r],a>=e){let u,c;return r==o?(u=0,c=0):(u=s[r-2],c=s[r-1]),c+(s[r+1]-c)*(e-u)/(a-u)}const h=s[r-1];return h+(1-h)*(e-a)/(1-a)}};let es=ee;es.LINEAR=0,es.STEPPED=1,es.BEZIER=2,es.BEZIER_SIZE=10*2-1;const ei=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+ei.ROTATION]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotation=l.data.rotation;return;case S.first:const m=l.data.rotation-l.rotation;l.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*n}return}if(s>=o[o.length-ei.ENTRIES]){let m=o[o.length+ei.PREV_ROTATION];switch(a){case S.setup:l.rotation=l.data.rotation+m*n;break;case S.first:case S.replace:m+=l.data.rotation-l.rotation,m-=(16384-(16384.499999999996-m/360|0))*360;case S.add:l.rotation+=m*n}return}const u=oe.binarySearch(o,s,ei.ENTRIES),c=o[u+ei.PREV_ROTATION],d=o[u],f=this.getCurvePercent((u>>1)-1,1-(s-d)/(o[u+ei.PREV_TIME]-d));let p=o[u+ei.ROTATION]-c;switch(p=c+(p-(16384-(16384.499999999996-p/360|0))*360)*f,a){case S.setup:l.rotation=l.data.rotation+(p-(16384-(16384.499999999996-p/360|0))*360)*n;break;case S.first:case S.replace:p+=l.data.rotation-l.rotation;case S.add:l.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*n}}};let Ie=ei;Ie.ENTRIES=2,Ie.PREV_TIME=-2,Ie.PREV_ROTATION=-1,Ie.ROTATION=1;const ke=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*ke.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,r){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.x=l.data.x,l.y=l.data.y;return;case S.first:l.x+=(l.data.x-l.x)*n,l.y+=(l.data.y-l.y)*n}return}let u=0,c=0;if(s>=o[o.length-ke.ENTRIES])u=o[o.length+ke.PREV_X],c=o[o.length+ke.PREV_Y];else{const d=oe.binarySearch(o,s,ke.ENTRIES);u=o[d+ke.PREV_X],c=o[d+ke.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ke.ENTRIES-1,1-(s-f)/(o[d+ke.PREV_TIME]-f));u+=(o[d+ke.X]-u)*p,c+=(o[d+ke.Y]-c)*p}switch(a){case S.setup:l.x=l.data.x+u*n,l.y=l.data.y+c*n;break;case S.first:case S.replace:l.x+=(l.data.x+u-l.x)*n,l.y+=(l.data.y+c-l.y)*n;break;case S.add:l.x+=u*n,l.y+=c*n}}};let fs=ke;fs.ENTRIES=3,fs.PREV_TIME=-3,fs.PREV_X=-2,fs.PREV_Y=-1,fs.X=1,fs.Y=2;let M_=class ks extends fs{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-ks.ENTRIES])u=o[o.length+ks.PREV_X]*l.data.scaleX,c=o[o.length+ks.PREV_Y]*l.data.scaleY;else{const d=oe.binarySearch(o,s,ks.ENTRIES);u=o[d+ks.PREV_X],c=o[d+ks.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ks.ENTRIES-1,1-(s-f)/(o[d+ks.PREV_TIME]-f));u=(u+(o[d+ks.X]-u)*p)*l.data.scaleX,c=(c+(o[d+ks.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},F_=class Bs extends fs{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Bs.ENTRIES])u=o[o.length+Bs.PREV_X],c=o[o.length+Bs.PREV_Y];else{const d=oe.binarySearch(o,s,Bs.ENTRIES);u=o[d+Bs.PREV_X],c=o[d+Bs.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Bs.ENTRIES-1,1-(s-f)/(o[d+Bs.PREV_TIME]-f));u=u+(o[d+Bs.X]-u)*p,c=c+(o[d+Bs.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Xt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Xt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,r,n,a){t*=Xt.ENTRIES,this.frames[t]=e,this.frames[t+Xt.R]=s,this.frames[t+Xt.G]=r,this.frames[t+Xt.B]=n,this.frames[t+Xt.A]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color);return;case S.first:const p=o.color,m=o.data.color;p.add((m.r-p.r)*n,(m.g-p.g)*n,(m.b-p.b)*n,(m.a-p.a)*n)}return}let u=0,c=0,d=0,f=0;if(s>=l[l.length-Xt.ENTRIES]){const p=l.length;u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A]}else{const p=oe.binarySearch(l,s,Xt.ENTRIES);u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A];const m=l[p],g=this.getCurvePercent(p/Xt.ENTRIES-1,1-(s-m)/(l[p+Xt.PREV_TIME]-m));u+=(l[p+Xt.R]-u)*g,c+=(l[p+Xt.G]-c)*g,d+=(l[p+Xt.B]-d)*g,f+=(l[p+Xt.A]-f)*g}if(n==1)o.color.set(u,c,d,f);else{const p=o.color;a==S.setup&&p.setFromColor(o.data.color),p.add((u-p.r)*n,(c-p.g)*n,(d-p.b)*n,(f-p.a)*n)}}};let He=Xt;He.ENTRIES=5,He.PREV_TIME=-5,He.PREV_R=-4,He.PREV_G=-3,He.PREV_B=-2,He.PREV_A=-1,He.R=1,He.G=2,He.B=3,He.A=4;const dt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*dt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,r,n,a,h,o,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=r,this.frames[t+dt.B]=n,this.frames[t+dt.A]=a,this.frames[t+dt.R2]=h,this.frames[t+dt.G2]=o,this.frames[t+dt.B2]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case S.first:const _=o.color,x=o.darkColor,y=o.data.color,v=o.data.darkColor;_.add((y.r-_.r)*n,(y.g-_.g)*n,(y.b-_.b)*n,(y.a-_.a)*n),x.add((v.r-x.r)*n,(v.g-x.g)*n,(v.b-x.b)*n,0)}return}let u=0,c=0,d=0,f=0,p=0,m=0,g=0;if(s>=l[l.length-dt.ENTRIES]){const _=l.length;u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2]}else{const _=oe.binarySearch(l,s,dt.ENTRIES);u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2];const x=l[_],y=this.getCurvePercent(_/dt.ENTRIES-1,1-(s-x)/(l[_+dt.PREV_TIME]-x));u+=(l[_+dt.R]-u)*y,c+=(l[_+dt.G]-c)*y,d+=(l[_+dt.B]-d)*y,f+=(l[_+dt.A]-f)*y,p+=(l[_+dt.R2]-p)*y,m+=(l[_+dt.G2]-m)*y,g+=(l[_+dt.B2]-g)*y}if(n==1)o.color.set(u,c,d,f),o.darkColor.set(p,m,g,1);else{const _=o.color,x=o.darkColor;a==S.setup&&(_.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),_.add((u-_.r)*n,(c-_.g)*n,(d-_.b)*n,(f-_.a)*n),x.add((p-x.r)*n,(m-x.g)*n,(g-x.b)*n,0)}}};let ae=dt;ae.ENTRIES=8,ae.PREV_TIME=-8,ae.PREV_R=-7,ae.PREV_G=-6,ae.PREV_B=-5,ae.PREV_A=-4,ae.PREV_R2=-3,ae.PREV_G2=-2,ae.PREV_B2=-1,ae.R=1,ae.G=2,ae.B=3,ae.A=4,ae.R2=5,ae.G2=6,ae.B2=7;let Rn=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}const l=this.frames;if(s<l[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}let u=0;s>=l[l.length-1]?u=l.length-1:u=oe.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}setAttachment(t,e,s){e.setAttachment(s==null?null:t.getAttachment(this.slotIndex,s))}},k_=null,B_=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),k_==null&&(k_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!(l instanceof Xi)||l.deformAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;break;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=oe.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},$u=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=oe.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},Io=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=oe.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const mt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*mt.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(t,e,s,r,n,a,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=r,this.frames[t+mt.BEND_DIRECTION]=n,this.frames[t+mt.COMPRESS]=a?1:0,this.frames[t+mt.STRETCH]=h?1:0}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case S.first:l.mix+=(l.data.mix-l.mix)*n,l.softness+=(l.data.softness-l.softness)*n,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}if(s>=o[o.length-mt.ENTRIES]){a==S.setup?(l.mix=l.data.mix+(o[o.length+mt.PREV_MIX]-l.data.mix)*n,l.softness=l.data.softness+(o[o.length+mt.PREV_SOFTNESS]-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0)):(l.mix+=(o[o.length+mt.PREV_MIX]-l.mix)*n,l.softness+=(o[o.length+mt.PREV_SOFTNESS]-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0));return}const u=oe.binarySearch(o,s,mt.ENTRIES),c=o[u+mt.PREV_MIX],d=o[u+mt.PREV_SOFTNESS],f=o[u],p=this.getCurvePercent(u/mt.ENTRIES-1,1-(s-f)/(o[u+mt.PREV_TIME]-f));a==S.setup?(l.mix=l.data.mix+(c+(o[u+mt.MIX]-c)*p-l.data.mix)*n,l.softness=l.data.softness+(d+(o[u+mt.SOFTNESS]-d)*p-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0)):(l.mix+=(c+(o[u+mt.MIX]-c)*p-l.mix)*n,l.softness+=(d+(o[u+mt.SOFTNESS]-d)*p-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0))}};let Pe=mt;Pe.ENTRIES=6,Pe.PREV_TIME=-6,Pe.PREV_MIX=-5,Pe.PREV_SOFTNESS=-4,Pe.PREV_BEND_DIRECTION=-3,Pe.PREV_COMPRESS=-2,Pe.PREV_STRETCH=-1,Pe.MIX=1,Pe.SOFTNESS=2,Pe.BEND_DIRECTION=3,Pe.COMPRESS=4,Pe.STRETCH=5;const $t=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*$t.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,a){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=r,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=a}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s<o[0]){const p=l.data;switch(a){case S.setup:l.rotateMix=p.rotateMix,l.translateMix=p.translateMix,l.scaleMix=p.scaleMix,l.shearMix=p.shearMix;return;case S.first:l.rotateMix+=(p.rotateMix-l.rotateMix)*n,l.translateMix+=(p.translateMix-l.translateMix)*n,l.scaleMix+=(p.scaleMix-l.scaleMix)*n,l.shearMix+=(p.shearMix-l.shearMix)*n}return}let u=0,c=0,d=0,f=0;if(s>=o[o.length-$t.ENTRIES]){const p=o.length;u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR]}else{const p=oe.binarySearch(o,s,$t.ENTRIES);u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR];const m=o[p],g=this.getCurvePercent(p/$t.ENTRIES-1,1-(s-m)/(o[p+$t.PREV_TIME]-m));u+=(o[p+$t.ROTATE]-u)*g,c+=(o[p+$t.TRANSLATE]-c)*g,d+=(o[p+$t.SCALE]-d)*g,f+=(o[p+$t.SHEAR]-f)*g}if(a==S.setup){const p=l.data;l.rotateMix=p.rotateMix+(u-p.rotateMix)*n,l.translateMix=p.translateMix+(c-p.translateMix)*n,l.scaleMix=p.scaleMix+(d-p.scaleMix)*n,l.shearMix=p.shearMix+(f-p.shearMix)*n}else l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n,l.scaleMix+=(d-l.scaleMix)*n,l.shearMix+=(f-l.shearMix)*n}};let We=$t;We.ENTRIES=5,We.PREV_TIME=-5,We.PREV_ROTATE=-4,We.PREV_TRANSLATE=-3,We.PREV_SCALE=-2,We.PREV_SHEAR=-1,We.ROTATE=1,We.TRANSLATE=2,We.SCALE=3,We.SHEAR=4;const Cs=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Cs.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Cs.ENTRIES,this.frames[t]=e,this.frames[t+Cs.VALUE]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.position=l.data.position;return;case S.first:l.position+=(l.data.position-l.position)*n}return}let u=0;if(s>=o[o.length-Cs.ENTRIES])u=o[o.length+Cs.PREV_VALUE];else{const c=oe.binarySearch(o,s,Cs.ENTRIES);u=o[c+Cs.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/Cs.ENTRIES-1,1-(s-d)/(o[c+Cs.PREV_TIME]-d));u+=(o[c+Cs.VALUE]-u)*f}a==S.setup?l.position=l.data.position+(u-l.data.position)*n:l.position+=(u-l.position)*n}};let Cr=Cs;Cr.ENTRIES=2,Cr.PREV_TIME=-2,Cr.PREV_VALUE=-1,Cr.VALUE=1;let D_=class ci extends Cr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ci.ENTRIES])u=o[o.length+ci.PREV_VALUE];else{const c=oe.binarySearch(o,s,ci.ENTRIES);u=o[c+ci.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ci.ENTRIES-1,1-(s-d)/(o[c+ci.PREV_TIME]-d));u+=(o[c+ci.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Be=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Be.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,r){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotateMix=l.data.rotateMix,l.translateMix=l.data.translateMix;return;case S.first:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*n,l.translateMix+=(l.data.translateMix-l.translateMix)*n}return}let u=0,c=0;if(s>=o[o.length-Be.ENTRIES])u=o[o.length+Be.PREV_ROTATE],c=o[o.length+Be.PREV_TRANSLATE];else{const d=oe.binarySearch(o,s,Be.ENTRIES);u=o[d+Be.PREV_ROTATE],c=o[d+Be.PREV_TRANSLATE];const f=o[d],p=this.getCurvePercent(d/Be.ENTRIES-1,1-(s-f)/(o[d+Be.PREV_TIME]-f));u+=(o[d+Be.ROTATE]-u)*p,c+=(o[d+Be.TRANSLATE]-c)*p}a==S.setup?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*n):(l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n)}};let or=Be;or.ENTRIES=3,or.PREV_TIME=-3,or.PREV_ROTATE=-2,or.PREV_TRANSLATE=-1,or.ROTATE=1,or.TRANSLATE=2;const Yt=class{constructor(i){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new O_(this),this.propertyIDs=new OS,this.animationsChanged=!1,this.trackEntryPool=new US(()=>new Yu),this.data=i}update(i){i*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=i*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let a=r.next;if(a!=null){const h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(h/r.timeScale+i)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=i,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){t[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,i)){let h=r.mixingFrom;for(r.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(i,t){const e=i.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,i.mixTime>0&&i.mixTime>=i.mixDuration?((e.totalAlpha==0||i.mixDuration==0)&&(i.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=i),i.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,i.mixTime+=t,!1)}apply(i){if(i==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let a=0,h=e.length;a<h;a++){const o=e[a];if(o==null||o.delay>0)continue;s=!0;const l=a==0?S.first:o.mixBlend;let u=o.alpha;o.mixingFrom!=null?u*=this.applyMixingFrom(o,i,l):o.trackTime>=o.trackEnd&&o.next==null&&(u=0);const c=o.animationLast,d=o.getAnimationTime(),f=o.animation.timelines.length,p=o.animation.timelines;if(a==0&&u==1||l==S.add)for(let m=0;m<f;m++){const g=p[m];g instanceof Rn?this.applyAttachmentTimeline(g,i,d,l,!0):g.apply(i,c,d,t,u,l,At.mixIn)}else{const m=o.timelineMode,g=o.timelinesRotation.length==0;g&&B.setArraySize(o.timelinesRotation,f<<1,null);const _=o.timelinesRotation;for(let x=0;x<f;x++){const y=p[x],v=m[x]==Yt.SUBSEQUENT?l:S.setup;y instanceof Ie?this.applyRotateTimeline(y,i,d,u,v,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,i,d,l,!0):y.apply(i,c,d,t,u,v,At.mixIn)}}this.queueEvents(o,d),t.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Yt.SETUP,n=i.slots;for(let a=0,h=i.slots.length;a<h;a++){const o=n[a];if(o.attachmentState==r){const l=o.data.attachmentName;o.setAttachment(l==null?null:i.getAttachment(o.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(i,t,e){const s=i.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let r=0;i.mixDuration==0?(r=1,e==S.first&&(e=S.setup)):(r=i.mixTime/i.mixDuration,r>1&&(r=1),e!=S.first&&(e=s.mixBlend));const n=r<s.eventThreshold?this.events:null,a=r<s.attachmentThreshold,h=r<s.drawOrderThreshold,o=s.animationLast,l=s.getAnimationTime(),u=s.animation.timelines.length,c=s.animation.timelines,d=s.alpha*i.interruptAlpha,f=d*(1-r);if(e==S.add)for(let p=0;p<u;p++)c[p].apply(t,o,l,n,f,e,At.mixOut);else{const p=s.timelineMode,m=s.timelineHoldMix,g=s.timelinesRotation.length==0;g&&B.setArraySize(s.timelinesRotation,u<<1,null);const _=s.timelinesRotation;s.totalAlpha=0;for(let x=0;x<u;x++){const y=c[x];let v=At.mixOut,b,w=0;switch(p[x]){case Yt.SUBSEQUENT:if(!h&&y instanceof Io)continue;b=e,w=f;break;case Yt.FIRST:b=S.setup,w=f;break;case Yt.HOLD_SUBSEQUENT:b=e,w=d;break;case Yt.HOLD_FIRST:b=S.setup,w=d;break;default:b=S.setup;const E=m[x];w=d*Math.max(0,1-E.mixTime/E.mixDuration);break}s.totalAlpha+=w,y instanceof Ie?this.applyRotateTimeline(y,t,l,w,b,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,t,l,b,a):(h&&y instanceof Io&&b==S.setup&&(v=At.mixIn),y.apply(t,o,l,n,w,b,v))}}return i.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,r}applyAttachmentTimeline(i,t,e,s,r){const n=t.slots[i.slotIndex];if(!n.bone.active)return;const a=i.frames;if(e<a[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let h;e>=a[a.length-1]?h=a.length-1:h=oe.binarySearch(a,e)-1,this.setAttachment(t,n,i.attachmentNames[h],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Yt.SETUP)}setAttachment(i,t,e,s){t.setAttachment(e==null?null:i.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Yt.CURRENT)}applyRotateTimeline(i,t,e,s,r,n,a,h){if(h&&(n[a]=0),s==1){i.apply(t,0,e,null,1,r,At.mixIn);return}const o=i,l=o.frames,u=t.bones[o.boneIndex];if(!u.active)return;let c=0,d=0;if(e<l[0])switch(r){case S.setup:u.rotation=u.data.rotation;default:return;case S.first:c=u.rotation,d=u.data.rotation}else if(c=r==S.setup?u.data.rotation:u.rotation,e>=l[l.length-Ie.ENTRIES])d=u.data.rotation+l[l.length+Ie.PREV_ROTATION];else{const m=oe.binarySearch(l,e,Ie.ENTRIES),g=l[m+Ie.PREV_ROTATION],_=l[m],x=o.getCurvePercent((m>>1)-1,1-(e-_)/(l[m+Ie.PREV_TIME]-_));d=l[m+Ie.ROTATION]-g,d-=(16384-(16384.499999999996-d/360|0))*360,d=g+d*x+u.data.rotation,d-=(16384-(16384.499999999996-d/360|0))*360}let f=0,p=d-c;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,g=0;h?(m=0,g=p):(m=n[a],g=n[a+1]);const _=p>0;let x=m>=0;D.signum(g)!=D.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*D.signum(m)),x=_),f=p+m-m%360,x!=_&&(f+=360*D.signum(m)),n[a]=f}n[a+1]=p,c+=f*s,u.rotation=c-(16384-(16384.499999999996-c/360|0))*360}queueEvents(i,t){const e=i.animationStart,s=i.animationEnd,r=s-e,n=i.trackLast%r,a=this.events;let h=0;const o=a.length;for(;h<o;h++){const u=a[h];if(u.time<n)break;u.time>s||this.queue.event(i,u)}let l=!1;for(i.loop?l=r==0||n>i.trackTime%r:l=t>=s&&i.animationLast<s,l&&this.queue.complete(i);h<o;h++)a[h].time<e||this.queue.event(i,a[h])}clearTracks(){const i=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=i,this.queue.drain()}clearTrack(i){if(i>=this.tracks.length)return;const t=this.tracks[i];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(s==null)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(i,t,e){const s=this.expandToIndex(i);this.tracks[i]=t,s!=null&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom!=null&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(i,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(i,s,e)}setAnimationWith(i,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,r=this.expandToIndex(i);r!=null&&(r.nextTrackLast==-1?(this.tracks[i]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,s=!1):this.disposeNext(r));const n=this.trackEntry(i,t,e,r);return this.setCurrent(i,n,s),this.queue.drain(),n}addAnimation(i,t,e,s){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(i,r,e,s)}addAnimationWith(i,t,e,s){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(i);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(i,t,e,r);if(r==null)this.setCurrent(i,n,!0),this.queue.drain();else if(r.next=n,s<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?s+=a*(1+(r.trackTime/a|0)):s+=Math.max(a,r.trackTime),s-=this.data.getMix(r.animation,t)):s=r.trackTime}return n.delay=s,n}setEmptyAnimation(i,t){const e=this.setAnimationWith(i,Yt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(i,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(i,Yt.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(i){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,i)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(i){return i<this.tracks.length?this.tracks[i]:(B.ensureArrayCapacity(this.tracks,i+1,null),this.tracks.length=i+1,null)}trackEntry(i,t,e,s){const r=this.trackEntryPool.obtain();return r.trackIndex=i,r.animation=t,r.loop=e,r.holdPrevious=!1,r.eventThreshold=0,r.attachmentThreshold=0,r.drawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.interruptAlpha=1,r.mixTime=0,r.mixDuration=s==null?0:this.data.getMix(s.animation,t),r.mixBlend=S.replace,r}disposeNext(i){let t=i.next;for(;t!=null;)this.queue.dispose(t),t=t.next;i.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let i=0,t=this.tracks.length;i<t;i++){let e=this.tracks[i];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=S.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(i){const t=i.mixingTo,e=i.animation.timelines,s=i.animation.timelines.length,r=B.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;const n=B.setArraySize(i.timelineHoldMix,s),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)r[h]=a.add(e[h].getPropertyId())?Yt.HOLD_FIRST:Yt.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const o=e[h],l=o.getPropertyId();if(!a.add(l))r[h]=Yt.SUBSEQUENT;else if(t==null||o instanceof Rn||o instanceof Io||o instanceof $u||!t.animation.hasTimeline(l))r[h]=Yt.FIRST;else{for(let u=t.mixingTo;u!=null;u=u.mixingTo)if(!u.animation.hasTimeline(l)){if(i.mixDuration>0){r[h]=Yt.HOLD_MIX,n[h]=u;continue t}break}r[h]=Yt.HOLD_FIRST}}}getCurrent(i){return i>=this.tracks.length?null:this.tracks[i]}addListener(i){if(i==null)throw new Error("listener cannot be null.");this.listeners.push(i)}removeListener(i){const t=this.listeners.indexOf(i);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(i,t,e){Yt.deprecatedWarning1||(Yt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(i,t,e)}addAnimationByName(i,t,e,s){Yt.deprecatedWarning2||(Yt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(i,t,e,s)}hasAnimation(i){return this.data.skeletonData.findAnimation(i)!==null}hasAnimationByName(i){return Yt.deprecatedWarning3||(Yt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(i)}};let ps=Yt;ps.emptyAnimation=new oe("<empty>",[],0),ps.SUBSEQUENT=0,ps.FIRST=1,ps.HOLD_SUBSEQUENT=2,ps.HOLD_FIRST=3,ps.HOLD_MIX=4,ps.SETUP=1,ps.CURRENT=2,ps.deprecatedWarning1=!1,ps.deprecatedWarning2=!1,ps.deprecatedWarning3=!1;const Ir=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const i=this.animationEnd-this.animationStart;return i==0?this.animationStart:this.trackTime%i+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(i){this.animationLast=i,this.nextAnimationLast=i}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(i){Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=i}get endTime(){return Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(i){Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=i}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Yu=Ir;Yu.deprecatedWarning1=!1,Yu.deprecatedWarning2=!1;const Hu=class{constructor(i){this.objects=[],this.drainDisabled=!1,this.animState=i}start(i){this.objects.push(ss.start),this.objects.push(i),this.animState.animationsChanged=!0}interrupt(i){this.objects.push(ss.interrupt),this.objects.push(i)}end(i){this.objects.push(ss.end),this.objects.push(i),this.animState.animationsChanged=!0}dispose(i){this.objects.push(ss.dispose),this.objects.push(i)}complete(i){this.objects.push(ss.complete),this.objects.push(i)}event(i,t){this.objects.push(ss.event),this.objects.push(i),this.objects.push(t)}deprecateStuff(){return Hu.deprecatedWarning1||(Hu.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const i=this.objects,t=this.animState.listeners;for(let e=0;e<i.length;e+=2){const s=i[e],r=i[e+1];switch(s){case ss.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case ss.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(r);break;case ss.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case ss.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(r);this.animState.trackEntryPool.free(r);break;case ss.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(r);const n=D.toInt(r.loopsCount());r.onComplete&&this.deprecateStuff()&&r.onComplete(r.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(r.trackIndex,n);break;case ss.event:const a=i[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(r,a);r.onEvent&&this.deprecateStuff()&&r.onEvent(r.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(r.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let O_=Hu;O_.deprecatedWarning1=!1;var ss=(i=>(i[i.start=0]="start",i[i.interrupt=1]="interrupt",i[i.end=2]="end",i[i.dispose=3]="dispose",i[i.complete=4]="complete",i[i.event=5]="event",i))(ss||{});const Wu=class{constructor(i){if(this.animationToMixTime={},this.defaultMix=0,i==null)throw new Error("skeletonData cannot be null.");this.skeletonData=i}setMix(i,t,e){const s=this.skeletonData.findAnimation(i);if(s==null)throw new Error(`Animation not found: ${i}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,r,e)}setMixByName(i,t,e){Wu.deprecatedWarning1||(Wu.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(i,t,e)}setMixWith(i,t,e){if(i==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${i.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(i,t){const e=`${i.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let L_=Wu;L_.deprecatedWarning1=!1;let N_=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new it(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Xu(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new HS(e)}newPathAttachment(t,e){return new _l(e)}newPointAttachment(t,e){return new zS(e)}newClippingAttachment(t,e){return new WS(e)}};class V_{constructor(t,e,s){if(this.matrix=new Rt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,n,a,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=h,this.appliedValid=!0;const o=this.parent,l=this.matrix,u=this.skeleton.scaleX,c=-this.skeleton.scaleY;if(o==null){const g=this.skeleton,_=s+90+h;l.a=D.cosDeg(s+a)*r*u,l.c=D.cosDeg(_)*n*u,l.b=D.sinDeg(s+a)*r*c,l.d=D.sinDeg(_)*n*c,l.tx=t*u+g.x,l.ty=e*c+g.y;return}let d=o.matrix.a,f=o.matrix.c,p=o.matrix.b,m=o.matrix.d;switch(l.tx=d*t+f*e+o.matrix.tx,l.ty=p*t+m*e+o.matrix.ty,this.data.transformMode){case xt.Normal:{const g=s+90+h,_=D.cosDeg(s+a)*r,x=D.cosDeg(g)*n,y=D.sinDeg(s+a)*r,v=D.sinDeg(g)*n;l.a=d*_+f*y,l.c=d*x+f*v,l.b=p*_+m*y,l.d=p*x+m*v;return}case xt.OnlyTranslation:{const g=s+90+h;l.a=D.cosDeg(s+a)*r,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+a)*r,l.d=D.sinDeg(g)*n;break}case xt.NoRotationOrReflection:{let g=d*d+p*p,_=0;g>1e-4?(g=Math.abs(d*m-f*p)/g,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*g,m=d*g,_=Math.atan2(p,d)*D.radDeg):(d=0,p=0,_=90-Math.atan2(m,f)*D.radDeg);const x=s+a-_,y=s+h-_+90,v=D.cosDeg(x)*r,b=D.cosDeg(y)*n,w=D.sinDeg(x)*r,E=D.sinDeg(y)*n;l.a=d*v-f*w,l.c=d*b-f*E,l.b=p*v+m*w,l.d=p*b+m*E;break}case xt.NoScale:case xt.NoScaleOrReflection:{const g=D.cosDeg(s),_=D.sinDeg(s);let x=(d*g+f*_)/u,y=(p*g+m*_)/c,v=Math.sqrt(x*x+y*y);v>1e-5&&(v=1/v),x*=v,y*=v,v=Math.sqrt(x*x+y*y),this.data.transformMode==xt.NoScale&&d*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(y,x),w=Math.cos(b)*v,E=Math.sin(b)*v,T=D.cosDeg(a)*r,A=D.cosDeg(90+h)*n,I=D.sinDeg(a)*r,M=D.sinDeg(90+h)*n;l.a=x*T+w*I,l.c=x*A+w*M,l.b=y*T+E*I,l.d=y*A+E*M;break}}l.a*=u,l.c*=u,l.b*=c,l.d*=c}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*D.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*D.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*D.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*D.radDeg;return}const s=t.matrix,r=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,a=e.ty-s.ty;this.ax=n*s.d*r-a*s.c*r,this.ay=a*s.a*r-n*s.b*r;const h=r*s.d,o=r*s.a,l=r*s.c,u=r*s.b,c=h*e.a-l*e.b,d=h*e.c-l*e.d,f=o*e.b-u*e.a,p=o*e.d-u*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){const m=c*p-d*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*d+f*p,m)*D.radDeg,this.arotation=Math.atan2(f,c)*D.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*D.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=1/(s*a-r*n),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*a*h-l*r*h,t.y=l*s*h-o*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,r=t.y;return t.x=s*e.a+r*e.c+e.tx,t.y=s*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=D.cosDeg(t),o=D.sinDeg(t);e.a=h*s-o*n,e.c=h*r-o*a,e.b=o*s+h*n,e.d=o*r+h*a,this.appliedValid=!1}}let U_=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=xt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},zu=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},G_=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},X_=class{constructor(t){this.name=t}};class jS{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){const t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix);break}}apply1(t,e,s,r,n,a,h){t.appliedValid||t.updateAppliedTransform();const o=t.parent.matrix,l=o.a;let u=o.c;const c=o.b;let d=o.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case xt.OnlyTranslation:p=e-t.worldX,m=s-t.worldY;break;case xt.NoRotationOrReflection:const x=Math.abs(l*d-u*c)/(l*l+c*c),y=l/t.skeleton.scaleX,v=c/t.skeleton.scaleY;u=-v*x*t.skeleton.scaleX,d=y*x*t.skeleton.scaleY,f+=Math.atan2(v,y)*D.radDeg;default:const b=e-o.tx,w=s-o.ty,E=l*d-u*c;p=(b*d-w*u)/E-t.ax,m=(w*l-b*c)/E-t.ay}f+=Math.atan2(m,p)*D.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,_=t.ascaleY;if(r||n){switch(t.data.transformMode){case xt.NoScale:case xt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const x=t.data.length*g,y=Math.sqrt(p*p+m*m);if(r&&y<x||n&&y>x&&x>1e-4){const v=(y/x-1)*h+1;g*=v,a&&(_*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*h,g,_,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,a,h,o){if(o==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,u=t.ay;let c=t.ascaleX,d=c,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,_=0,x=0;c<0?(c=-c,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,_=180):_=0;const y=e.ax;let v=0,b=0,w=0,E=m.a,T=m.c,A=m.b,I=m.d;const M=Math.abs(c-f)<=1e-4;M?(v=e.ay,b=E*y+T*v+m.tx,w=A*y+I*v+m.ty):(v=0,b=E*y+m.tx,w=A*y+m.ty);const R=t.parent.matrix;E=R.a,T=R.c,A=R.b,I=R.d;const C=1/(E*I-T*A);let P=b-R.tx,k=w-R.ty;const U=(P*I-k*T)*C-l,V=(k*E-P*A)*C-u,L=Math.sqrt(U*U+V*V);let $=e.data.length*p,O,N;if(L<1e-4){this.apply1(t,s,r,!1,a,!1,o),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=r-R.ty;let Z=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-u,H=Z*Z+Q*Q;if(h!=0){h*=c*(p+1)/2;const _t=Math.sqrt(H),kt=_t-L-$*c+h;if(kt>0){let zt=Math.min(1,kt/(h*2))-1;zt=(kt-h*(1-zt*zt))/_t,Z-=zt*Z,Q-=zt*Q,H=Z*Z+Q*Q}}t:if(M){$*=c;let _t=(H-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,a&&(d*=(Math.sqrt(H)/(L+$)-1)*o+1)),N=Math.acos(_t)*n,E=L+$*_t,T=$*Math.sin(N),O=Math.atan2(Q*E-Z*T,Z*E+Q*T)}else{E=c*$,T=f*$;const _t=E*E,kt=T*T,zt=Math.atan2(Q,Z);A=kt*L*L+_t*H-_t*kt;const Qt=-2*kt*L,Pt=kt-_t;if(I=Qt*Qt-4*Pt*A,I>=0){let Bn=Math.sqrt(I);Qt<0&&(Bn=-Bn),Bn=-(Qt+Bn)/2;const ey=Bn/Pt,sy=A/Bn,Dn=Math.abs(ey)<Math.abs(sy)?ey:sy;if(Dn*Dn<=H){k=Math.sqrt(H-Dn*Dn)*n,O=zt-Math.atan2(k,Dn),N=Math.atan2(k/f,(Dn-L)/c);break t}}let jt=D.PI,Ot=L-E,ze=Ot*Ot,is=0,li=0,kn=L+E,hi=kn*kn,ty=0;A=-E*L/(_t-kt),A>=-1&&A<=1&&(A=Math.acos(A),P=E*Math.cos(A)+L,k=T*Math.sin(A),I=P*P+k*k,I<ze&&(jt=A,ze=I,Ot=P,is=k),I>hi&&(li=A,hi=I,kn=P,ty=k)),H<=(ze+hi)/2?(O=zt-Math.atan2(is*n,Ot),N=jt*n):(O=zt-Math.atan2(ty*n,kn),N=li*n)}const lt=Math.atan2(v,y)*x;let Et=t.arotation;O=(O-lt)*D.radDeg+g-Et,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(l,u,Et+O*o,d,t.ascaleY,0,0),Et=e.arotation,N=((N+lt)*D.radDeg-e.ashearX)*x+_-Et,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(y,v,Et+N*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}let $_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},Y_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array}};var be=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(be||{});const $i=class{constructor(i,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,i==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=i,this.bones=new Array;for(let e=0,s=i.bones.length;e<s;e++)this.bones.push(t.findBone(i.bones[e].name));this.target=t.findSlot(i.target.name),this.position=i.position,this.spacing=i.spacing,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix}isActive(){return this.active}apply(){this.update()}update(){const i=this.target.getAttachment();if(!(i instanceof _l))return;const t=this.rotateMix,e=this.translateMix,s=e>0,r=t>0;if(!s&&!r)return;const n=this.data,a=n.spacingMode,h=a==be.Length,o=n.rotateMode,l=o==Fe.Tangent,u=o==Fe.ChainScale,c=this.bones.length,d=l?c:c+1,f=this.bones,p=B.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(u||h){u&&(m=B.setArraySize(this.lengths,c));for(let w=0,E=d-1;w<E;){const T=f[w],A=T.data.length;if(A<$i.epsilon)u&&(m[w]=0),p[++w]=0;else{const I=A*T.matrix.a,M=A*T.matrix.b,R=Math.sqrt(I*I+M*M);u&&(m[w]=R),p[++w]=(h?A+g:g)*R/A}}}else for(let w=1;w<d;w++)p[w]=g;const _=this.computeWorldPositions(i,d,l,n.positionMode==ne.Percent,a==be.Percent);let x=_[0],y=_[1],v=n.offsetRotation,b=!1;if(v==0)b=o==Fe.Chain;else{b=!1;const w=this.target.bone.matrix;v*=w.a*w.d-w.b*w.c>0?D.degRad:-D.degRad}for(let w=0,E=3;w<c;w++,E+=3){const T=f[w],A=T.matrix;A.tx+=(x-A.tx)*e,A.ty+=(y-A.ty)*e;const I=_[E],M=_[E+1],R=I-x,C=M-y;if(u){const P=m[w];if(P!=0){const k=(Math.sqrt(R*R+C*C)/P-1)*t+1;A.a*=k,A.b*=k}}if(x=I,y=M,r){const P=A.a,k=A.c,U=A.b,V=A.d;let L=0,$=0,O=0;if(l&&(l?L=_[E-1]:p[w+1]==0?L=_[E+2]:L=Math.atan2(C,R)),L-=Math.atan2(U,P),b){$=Math.cos(L),O=Math.sin(L);const N=T.data.length;x+=(N*($*P-O*U)-R)*t,y+=(N*(O*P+$*U)-C)*t}else L+=v;L>D.PI?L-=D.PI2:L<-D.PI&&(L+=D.PI2),L*=t,$=Math.cos(L),O=Math.sin(L),A.a=$*P-O*U,A.c=$*k-O*V,A.b=O*P+$*U,A.d=O*k+$*V}T.appliedValid=!1}}computeWorldPositions(i,t,e,s,r){const n=this.target;let a=this.position;const h=this.spaces,o=B.setArraySize(this.positions,t*3+2);let l=null;const u=i.closed;let c=i.worldVerticesLength,d=c/6,f=$i.NONE;if(!i.constantSpeed){const L=i.lengths;d-=u?1:2;const $=L[d];if(s&&(a*=$),r)for(let O=0;O<t;O++)h[O]*=$;l=B.setArraySize(this.world,8);for(let O=0,N=0,Z=0;O<t;O++,N+=3){const Q=h[O];a+=Q;let H=a;if(u)H%=$,H<0&&(H+=$),Z=0;else if(H<0){f!=$i.BEFORE&&(f=$i.BEFORE,i.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(H,l,0,o,N);continue}else if(H>$){f!=$i.AFTER&&(f=$i.AFTER,i.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(H-$,l,0,o,N);continue}for(;;Z++){const lt=L[Z];if(!(H>lt)){if(Z==0)H/=lt;else{const Et=L[Z-1];H=(H-Et)/(lt-Et)}break}}Z!=f&&(f=Z,u&&Z==d?(i.computeWorldVertices(n,c-4,4,l,0,2),i.computeWorldVertices(n,0,4,l,4,2)):i.computeWorldVertices(n,Z*6+2,8,l,0,2)),this.addCurvePosition(H,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],o,N,e||O>0&&Q==0)}return o}u?(c+=2,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c-4,l,0,2),i.computeWorldVertices(n,0,2,l,c-4,2),l[c-2]=l[0],l[c-1]=l[1]):(d--,c-=4,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c,l,0,2));const p=B.setArraySize(this.curves,d);let m=0,g=l[0],_=l[1],x=0,y=0,v=0,b=0,w=0,E=0,T=0,A=0,I=0,M=0,R=0,C=0,P=0,k=0;for(let L=0,$=2;L<d;L++,$+=6)x=l[$],y=l[$+1],v=l[$+2],b=l[$+3],w=l[$+4],E=l[$+5],T=(g-x*2+v)*.1875,A=(_-y*2+b)*.1875,I=((x-v)*3-g+w)*.09375,M=((y-b)*3-_+E)*.09375,R=T*2+I,C=A*2+M,P=(x-g)*.75+T+I*.16666667,k=(y-_)*.75+A+M*.16666667,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,R+=I,C+=M,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,m+=Math.sqrt(P*P+k*k),P+=R+I,k+=C+M,m+=Math.sqrt(P*P+k*k),p[L]=m,g=w,_=E;if(s&&(a*=m),r)for(let L=0;L<t;L++)h[L]*=m;const U=this.segments;let V=0;for(let L=0,$=0,O=0,N=0;L<t;L++,$+=3){const Z=h[L];a+=Z;let Q=a;if(u)Q%=m,Q<0&&(Q+=m),O=0;else if(Q<0){this.addBeforePosition(Q,l,0,o,$);continue}else if(Q>m){this.addAfterPosition(Q-m,l,c-4,o,$);continue}for(;;O++){const H=p[O];if(!(Q>H)){if(O==0)Q/=H;else{const lt=p[O-1];Q=(Q-lt)/(H-lt)}break}}if(O!=f){f=O;let H=O*6;for(g=l[H],_=l[H+1],x=l[H+2],y=l[H+3],v=l[H+4],b=l[H+5],w=l[H+6],E=l[H+7],T=(g-x*2+v)*.03,A=(_-y*2+b)*.03,I=((x-v)*3-g+w)*.006,M=((y-b)*3-_+E)*.006,R=T*2+I,C=A*2+M,P=(x-g)*.3+T+I*.16666667,k=(y-_)*.3+A+M*.16666667,V=Math.sqrt(P*P+k*k),U[0]=V,H=1;H<8;H++)P+=R,k+=C,R+=I,C+=M,V+=Math.sqrt(P*P+k*k),U[H]=V;P+=R,k+=C,V+=Math.sqrt(P*P+k*k),U[8]=V,P+=R+I,k+=C+M,V+=Math.sqrt(P*P+k*k),U[9]=V,N=0}for(Q*=V;;N++){const H=U[N];if(!(Q>H)){if(N==0)Q/=H;else{const lt=U[N-1];Q=N+(Q-lt)/(H-lt)}break}}this.addCurvePosition(Q*.1,g,_,x,y,v,b,w,E,o,$,e||L>0&&Z==0)}return o}addBeforePosition(i,t,e,s,r){const n=t[e],a=t[e+1],h=t[e+2]-n,o=t[e+3]-a,l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addAfterPosition(i,t,e,s,r){const n=t[e+2],a=t[e+3],h=n-t[e],o=a-t[e+1],l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addCurvePosition(i,t,e,s,r,n,a,h,o,l,u,c){(i==0||isNaN(i))&&(i=1e-4);const d=i*i,f=d*i,p=1-i,m=p*p,g=m*p,_=p*i,x=_*3,y=p*x,v=x*i,b=t*g+s*y+n*v+h*f,w=e*g+r*y+a*v+o*f;l[u]=b,l[u+1]=w,c&&(l[u+2]=Math.atan2(w-(e*m+r*_*2+a*d),b-(t*m+s*_*2+n*d)))}};let Po=$i;Po.NONE=-1,Po.BEFORE=-2,Po.AFTER=-3,Po.epsilon=1e-5;class qS{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new GS,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)-Math.atan2(w,v)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=(v.x-y.tx)*e,y.ty+=(v.y-y.ty)*e,x=!0}if(s>0){let v=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(h*h+l*l);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*s)/v),y.a*=v,y.b*=v,v=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+u*u),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*s)/v),y.c*=v,y.d*=v,x=!0}if(r>0){const v=y.c,b=y.d,w=Math.atan2(b,v);let E=Math.atan2(u,o)-Math.atan2(l,h)-(w-Math.atan2(y.b,y.a));E>D.PI?E-=D.PI2:E<-D.PI&&(E+=D.PI2),E=w+(E+f)*r;const T=Math.sqrt(v*v+b*b);y.c=Math.cos(E)*T,y.d=Math.sin(E)*T,x=!0}x&&(_.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=v.x*e,y.ty+=v.y*e,x=!0}if(s>0){let v=(Math.sqrt(h*h+l*l)-1+this.data.offsetScaleX)*s+1;y.a*=v,y.b*=v,v=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*s+1,y.c*=v,y.d*=v,x=!0}if(r>0){let v=Math.atan2(u,o)-Math.atan2(l,h);v>D.PI?v-=D.PI2:v<-D.PI&&(v+=D.PI2);const b=y.c,w=y.d;v=Math.atan2(w,b)+(v-D.PI/2+f)*r;const E=Math.sqrt(b*b+w*w);y.c=Math.cos(v)*E,y.d=Math.sin(v)*E,x=!0}x&&(_.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;if(t!=0){let g=n.arotation-u+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,u+=g*t}let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax-c+this.data.offsetX)*e,d+=(n.ay-d+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*s)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*s)/p));const m=l.ashearY;if(r>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*r}l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;t!=0&&(u+=(n.arotation+this.data.offsetRotation)*t);let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax+this.data.offsetX)*e,d+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let m=l.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}}const Ro=class{constructor(i){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,i==null)throw new Error("data cannot be null.");this.data=i,this.bones=new Array;for(let t=0;t<i.bones.length;t++){const e=i.bones[t];let s;if(e.parent==null)s=new V_(e,this,null);else{const r=this.bones[e.parent.index];s=new V_(e,this,r),r.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<i.slots.length;t++){const e=i.slots[t],s=this.bones[e.boneData.index],r=new R_(e,s);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<i.ikConstraints.length;t++){const e=i.ikConstraints[t];this.ikConstraints.push(new jS(e,this))}this.transformConstraints=new Array;for(let t=0;t<i.transformConstraints.length;t++){const e=i.transformConstraints[t];this.transformConstraints.push(new qS(e,this))}this.pathConstraints=new Array;for(let t=0;t<i.pathConstraints.length;t++){const e=i.pathConstraints[t];this.pathConstraints.push(new Po(e,this))}this.color=new X(1,1,1,1),this.updateCache()}updateCache(){const i=this._updateCache;i.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,u=t.length;l<u;l++){const c=t[l];c.sorted=c.data.skinRequired,c.active=!c.sorted}if(this.skin!=null){const l=this.skin.bones;for(let u=0,c=this.skin.bones.length;u<c;u++){let d=this.bones[l[u].index];do d.sorted=!1,d.active=!0,d=d.parent;while(d!=null)}}const e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,n=e.length,a=s.length,h=r.length,o=n+a+h;t:for(let l=0;l<o;l++){for(let u=0;u<n;u++){const c=e[u];if(c.data.order==l){this.sortIkConstraint(c);continue t}}for(let u=0;u<a;u++){const c=s[u];if(c.data.order==l){this.sortTransformConstraint(c);continue t}}for(let u=0;u<h;u++){const c=r[u];if(c.data.order==l){this.sortPathConstraint(c);continue t}}}for(let l=0,u=t.length;l<u;l++)this.sortBone(t[l])}sortIkConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target;this.sortBone(t);const e=i.bones,s=e[0];if(this.sortBone(s),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(i),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(i){if(i.active=i.target.bone.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target,e=t.data.index,s=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,s),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let h=0,o=this.data.skins.length;h<o;h++)this.sortPathConstraintAttachment(this.data.skins[h],e,s);const r=t.getAttachment();r instanceof _l&&this.sortPathConstraintAttachmentWith(r,s);const n=i.bones,a=n.length;for(let h=0;h<a;h++)this.sortBone(n[h]);this._updateCache.push(i);for(let h=0;h<a;h++)this.sortReset(n[h].children);for(let h=0;h<a;h++)n[h].sorted=!0}sortTransformConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;this.sortBone(i.target);const t=i.bones,e=t.length;if(i.data.local)for(let s=0;s<e;s++){const r=t[s];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(i);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(i,t,e){const s=i.attachments[t];if(s)for(const r in s)this.sortPathConstraintAttachmentWith(s[r],e)}sortPathConstraintAttachmentWith(i,t){if(!(i instanceof _l))return;const e=i.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const h=e[r];this.sortBone(s[h])}}}}sortBone(i){if(i.sorted)return;const t=i.parent;t!=null&&this.sortBone(t),i.sorted=!0,this._updateCache.push(i)}sortReset(i){for(let t=0,e=i.length;t<e;t++){const s=i[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const i=this.updateCacheReset;for(let e=0,s=i.length;e<s;e++){const r=i[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}const t=this._updateCache;for(let e=0,s=t.length;e<s;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const i=this.bones;for(let r=0,n=i.length;r<n;r++)i[r].setToSetupPose();const t=this.ikConstraints;for(let r=0,n=t.length;r<n;r++){const a=t[r];a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}const e=this.transformConstraints;for(let r=0,n=e.length;r<n;r++){const a=e[r],h=a.data;a.rotateMix=h.rotateMix,a.translateMix=h.translateMix,a.scaleMix=h.scaleMix,a.shearMix=h.shearMix}const s=this.pathConstraints;for(let r=0,n=s.length;r<n;r++){const a=s[r],h=a.data;a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix}}setSlotsToSetupPose(){const i=this.slots;B.arrayCopy(i,0,this.drawOrder,0,i.length);for(let t=0,e=i.length;t<e;t++)i[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findBoneIndex(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}findSlot(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findSlotIndex(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}setSkinByName(i){const t=this.data.findSkin(i);if(t==null)throw new Error(`Skin not found: ${i}`);this.setSkin(t)}setSkin(i){if(i!=this.skin){if(i!=null)if(this.skin!=null)i.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=i.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=i,this.updateCache()}}getAttachmentByName(i,t){return this.getAttachment(this.data.findSlotIndex(i),t)}getAttachment(i,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(i,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(i,t):null}setAttachment(i,t){if(i==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.data.name==i){let a=null;if(t!=null&&(a=this.getAttachment(s,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${i}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${i}`)}findIkConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findTransformConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findPathConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}getBounds(i,t,e=new Array(2)){if(i==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let o=0,l=s.length;o<l;o++){const u=s[o];if(!u.bone.active)continue;let c=0,d=null;const f=u.getAttachment();if(f instanceof it)c=8,d=B.setArraySize(e,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(f instanceof Xu){const p=f;c=p.worldVerticesLength,d=B.setArraySize(e,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(d!=null)for(let p=0,m=d.length;p<m;p+=2){const g=d[p],_=d[p+1];r=Math.min(r,g),n=Math.min(n,_),a=Math.max(a,g),h=Math.max(h,_)}}i.set(r,n),t.set(a-r,h-n)}update(i){this.time+=i}get flipX(){return this.scaleX==-1}set flipX(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=i?1:-1}get flipY(){return this.scaleY==-1}set flipY(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=i?1:-1}};let H_=Ro;H_.deprecatedWarning1=!1;let W_=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},z_=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},j_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},q_=class{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},ju=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment!=null&&(r.attachment instanceof Xu?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&(s[e]=null)}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new q_(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new q_(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}};const Kt=class{constructor(i){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=i}readSkeletonData(i){const t=this.scale,e=new W_;e.name="";const s=new gl(i);e.hash=s.readString(),e.version=s.readString(),e.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),e.x=s.readFloat(),e.y=s.readFloat(),e.width=s.readFloat(),e.height=s.readFloat();const r=s.readBoolean();r&&(e.fps=s.readFloat(),e.imagesPath=s.readString(),e.audioPath=s.readString());let n=0;n=s.readInt(!0);for(let h=0;h<n;h++)s.strings.push(s.readString());n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=h==0?null:e.bones[s.readInt(!0)],u=new U_(h,o,l);u.rotation=s.readFloat(),u.x=s.readFloat()*t,u.y=s.readFloat()*t,u.scaleX=s.readFloat(),u.scaleY=s.readFloat(),u.shearX=s.readFloat(),u.shearY=s.readFloat(),u.length=s.readFloat()*t,u.transformMode=Kt.TransformModeValues[s.readInt(!0)],u.skinRequired=s.readBoolean(),r&&X.rgba8888ToColor(u.color,s.readInt32()),e.bones.push(u)}n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=e.bones[s.readInt(!0)],u=new z_(h,o,l);X.rgba8888ToColor(u.color,s.readInt32());const c=s.readInt32();c!=-1&&X.rgb888ToColor(u.darkColor=new X,c),u.attachmentName=s.readStringRef(),u.blendMode=Kt.BlendModeValues[s.readInt(!0)],e.slots.push(u)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new $_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.mix=s.readFloat(),l.softness=s.readFloat()*t,l.bendDirection=s.readByte(),l.compress=s.readBoolean(),l.stretch=s.readBoolean(),l.uniform=s.readBoolean(),e.ikConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new j_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.local=s.readBoolean(),l.relative=s.readBoolean(),l.offsetRotation=s.readFloat(),l.offsetX=s.readFloat()*t,l.offsetY=s.readFloat()*t,l.offsetScaleX=s.readFloat(),l.offsetScaleY=s.readFloat(),l.offsetShearY=s.readFloat(),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),l.scaleMix=s.readFloat(),l.shearMix=s.readFloat(),e.transformConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new Y_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.slots[s.readInt(!0)],l.positionMode=Kt.PositionModeValues[s.readInt(!0)],l.spacingMode=Kt.SpacingModeValues[s.readInt(!0)],l.rotateMode=Kt.RotateModeValues[s.readInt(!0)],l.offsetRotation=s.readFloat(),l.position=s.readFloat(),l.positionMode==ne.Fixed&&(l.position*=t),l.spacing=s.readFloat(),(l.spacingMode==be.Length||l.spacingMode==be.Fixed)&&(l.spacing*=t),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),e.pathConstraints.push(l)}const a=this.readSkin(s,e,!0,r);a!=null&&(e.defaultSkin=a,e.skins.push(a));{let h=e.skins.length;for(B.setArraySize(e.skins,n=h+s.readInt(!0));h<n;h++)e.skins[h]=this.readSkin(s,e,!1,r)}n=this.linkedMeshes.length;for(let h=0;h<n;h++){const o=this.linkedMeshes[h],l=o.skin==null?e.defaultSkin:e.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}this.linkedMeshes.length=0,n=s.readInt(!0);for(let h=0;h<n;h++){const o=new X_(s.readStringRef());o.intValue=s.readInt(!1),o.floatValue=s.readFloat(),o.stringValue=s.readString(),o.audioPath=s.readString(),o.audioPath!=null&&(o.volume=s.readFloat(),o.balance=s.readFloat()),e.events.push(o)}n=s.readInt(!0);for(let h=0;h<n;h++)e.animations.push(this.readAnimation(s,s.readString(),e));return e}readSkin(i,t,e,s){let r=null,n=0;if(e){if(n=i.readInt(!0),n==0)return null;r=new ju("default")}else{r=new ju(i.readStringRef()),r.bones.length=i.readInt(!0);for(let a=0,h=r.bones.length;a<h;a++)r.bones[a]=t.bones[i.readInt(!0)];for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.ikConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.transformConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.pathConstraints[i.readInt(!0)]);n=i.readInt(!0)}for(let a=0;a<n;a++){const h=i.readInt(!0);for(let o=0,l=i.readInt(!0);o<l;o++){const u=i.readStringRef(),c=this.readAttachment(i,t,r,h,u,s);c!=null&&r.setAttachment(h,u,c)}}return r}readAttachment(i,t,e,s,r,n){const a=this.scale;let h=i.readStringRef();h==null&&(h=r);const o=i.readByte();switch(Kt.AttachmentTypeValues[o]){case at.Region:{let u=i.readStringRef();const c=i.readFloat(),d=i.readFloat(),f=i.readFloat(),p=i.readFloat(),m=i.readFloat(),g=i.readFloat(),_=i.readFloat(),x=i.readInt32();u==null&&(u=h);const y=this.attachmentLoader.newRegionAttachment(e,h,u);return y==null?null:(y.path=u,y.x=d*a,y.y=f*a,y.scaleX=p,y.scaleY=m,y.rotation=c,y.width=g*a,y.height=_*a,X.rgba8888ToColor(y.color,x),y)}case at.BoundingBox:{const u=i.readInt(!0),c=this.readVertices(i,u),d=n?i.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(e,h);return f==null?null:(f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,n&&X.rgba8888ToColor(f.color,d),f)}case at.Mesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readInt(!0),f=this.readFloatArray(i,d<<1,1),p=this.readShortArray(i),m=this.readVertices(i,d),g=i.readInt(!0);let _=null,x=0,y=0;n&&(_=this.readShortArray(i),x=i.readFloat(),y=i.readFloat()),u==null&&(u=h);const v=this.attachmentLoader.newMeshAttachment(e,h,u);return v==null?null:(v.path=u,X.rgba8888ToColor(v.color,c),v.bones=m.bones,v.vertices=m.vertices,v.worldVerticesLength=d<<1,v.triangles=p,v.regionUVs=new Float32Array(f),v.hullLength=g<<1,n&&(v.edges=_,v.width=x*a,v.height=y*a),v)}case at.LinkedMesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readStringRef(),f=i.readStringRef(),p=i.readBoolean();let m=0,g=0;n&&(m=i.readFloat(),g=i.readFloat()),u==null&&(u=h);const _=this.attachmentLoader.newMeshAttachment(e,h,u);return _==null?null:(_.path=u,X.rgba8888ToColor(_.color,c),n&&(_.width=m*a,_.height=g*a),this.linkedMeshes.push(new ZS(_,d,s,f,p)),_)}case at.Path:{const u=i.readBoolean(),c=i.readBoolean(),d=i.readInt(!0),f=this.readVertices(i,d),p=B.newArray(d/3,0);for(let _=0,x=p.length;_<x;_++)p[_]=i.readFloat()*a;const m=n?i.readInt32():0,g=this.attachmentLoader.newPathAttachment(e,h);return g==null?null:(g.closed=u,g.constantSpeed=c,g.worldVerticesLength=d<<1,g.vertices=f.vertices,g.bones=f.bones,g.lengths=p,n&&X.rgba8888ToColor(g.color,m),g)}case at.Point:{const u=i.readFloat(),c=i.readFloat(),d=i.readFloat(),f=n?i.readInt32():0,p=this.attachmentLoader.newPointAttachment(e,h);return p==null?null:(p.x=c*a,p.y=d*a,p.rotation=u,n&&X.rgba8888ToColor(p.color,f),p)}case at.Clipping:{const u=i.readInt(!0),c=i.readInt(!0),d=this.readVertices(i,c),f=n?i.readInt32():0,p=this.attachmentLoader.newClippingAttachment(e,h);return p==null?null:(p.endSlot=t.slots[u],p.worldVerticesLength=c<<1,p.vertices=d.vertices,p.bones=d.bones,n&&X.rgba8888ToColor(p.color,f),p)}}return null}readVertices(i,t){const e=t<<1,s=new KS,r=this.scale;if(!i.readBoolean())return s.vertices=this.readFloatArray(i,e,r),s;const n=new Array,a=new Array;for(let h=0;h<t;h++){const o=i.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(i.readInt(!0)),n.push(i.readFloat()*r),n.push(i.readFloat()*r),n.push(i.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=a,s}readFloatArray(i,t,e){const s=new Array(t);if(e==1)for(let r=0;r<t;r++)s[r]=i.readFloat();else for(let r=0;r<t;r++)s[r]=i.readFloat()*e;return s}readShortArray(i){const t=i.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=i.readShort();return e}readAnimation(i,t,e){const s=new Array,r=this.scale;let n=0;const a=new X,h=new X;for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.SLOT_ATTACHMENT:{const _=new Rn(g);_.slotIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readStringRef());s.push(_),n=Math.max(n,_.frames[g-1]);break}case Kt.SLOT_COLOR:{const _=new He(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*He.ENTRIES]);break}case Kt.SLOT_TWO_COLOR:{const _=new ae(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),X.rgb888ToColor(h,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a,h.r,h.g,h.b),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*ae.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.BONE_ROTATE:{const _=new Ie(g);_.boneIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readFloat()),x<g-1&&this.readCurve(i,x,_);s.push(_),n=Math.max(n,_.frames[(g-1)*Ie.ENTRIES]);break}case Kt.BONE_TRANSLATE:case Kt.BONE_SCALE:case Kt.BONE_SHEAR:{let _,x=1;m==Kt.BONE_SCALE?_=new M_(g):m==Kt.BONE_SHEAR?_=new F_(g):(_=new fs(g),x=r),_.boneIndex=d;for(let y=0;y<g;y++)_.setFrame(y,i.readFloat(),i.readFloat()*x,i.readFloat()*x),y<g-1&&this.readCurve(i,y,_);s.push(_),n=Math.max(n,_.frames[(g-1)*fs.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new Pe(f);p.ikConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat()*r,i.readByte(),i.readBoolean(),i.readBoolean()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new We(f);p.transformConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=e.pathConstraints[d];for(let p=0,m=i.readInt(!0);p<m;p++){const g=i.readByte(),_=i.readInt(!0);switch(g){case Kt.PATH_POSITION:case Kt.PATH_SPACING:{let x,y=1;g==Kt.PATH_SPACING?(x=new D_(_),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(y=r)):(x=new Cr(_),f.positionMode==ne.Fixed&&(y=r)),x.pathConstraintIndex=d;for(let v=0;v<_;v++)x.setFrame(v,i.readFloat(),i.readFloat()*y),v<_-1&&this.readCurve(i,v,x);s.push(x),n=Math.max(n,x.frames[(_-1)*Cr.ENTRIES]);break}case Kt.PATH_MIX:{const x=new or(_);x.pathConstraintIndex=d;for(let y=0;y<_;y++)x.setFrame(y,i.readFloat(),i.readFloat(),i.readFloat()),y<_-1&&this.readCurve(i,y,x);s.push(x),n=Math.max(n,x.frames[(_-1)*or.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=e.skins[i.readInt(!0)];for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readInt(!0);for(let g=0,_=i.readInt(!0);g<_;g++){const x=d.getAttachment(m,i.readStringRef()),y=x.bones!=null,v=x.vertices,b=y?v.length/3*2:v.length,w=i.readInt(!0),E=new B_(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=i.readFloat();let I,M=i.readInt(!0);if(M==0)I=y?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=i.readInt(!0);if(M+=R,r==1)for(let C=R;C<M;C++)I[C]=i.readFloat();else for(let C=R;C<M;C++)I[C]=i.readFloat()*r;if(!y)for(let C=0,P=I.length;C<P;C++)I[C]+=v[C]}E.setFrame(T,A,I),T<w-1&&this.readCurve(i,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const o=i.readInt(!0);if(o>0){const u=new Io(o),c=e.slots.length;for(let d=0;d<o;d++){const f=i.readFloat(),p=i.readInt(!0),m=B.newArray(c,0);for(let y=c-1;y>=0;y--)m[y]=-1;const g=B.newArray(c-p,0);let _=0,x=0;for(let y=0;y<p;y++){const v=i.readInt(!0);for(;_!=v;)g[x++]=_++;m[_+i.readInt(!0)]=_++}for(;_<c;)g[x++]=_++;for(let y=c-1;y>=0;y--)m[y]==-1&&(m[y]=g[--x]);u.setFrame(d,f,m)}s.push(u),n=Math.max(n,u.frames[o-1])}const l=i.readInt(!0);if(l>0){const u=new $u(l);for(let c=0;c<l;c++){const d=i.readFloat(),f=e.events[i.readInt(!0)],p=new G_(d,f);p.intValue=i.readInt(!1),p.floatValue=i.readFloat(),p.stringValue=i.readBoolean()?i.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=i.readFloat(),p.balance=i.readFloat()),u.setFrame(c,p)}s.push(u),n=Math.max(n,u.frames[l-1])}return new oe(t,s,n)}readCurve(i,t,e){switch(i.readByte()){case Kt.CURVE_STEPPED:e.setStepped(t);break;case Kt.CURVE_BEZIER:this.setCurve(e,t,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat());break}}setCurve(i,t,e,s,r,n){i.setCurve(t,e,s,r,n)}};let le=Kt;le.AttachmentTypeValues=[0,1,2,3,4,5,6],le.TransformModeValues=[xt.Normal,xt.OnlyTranslation,xt.NoRotationOrReflection,xt.NoScale,xt.NoScaleOrReflection],le.PositionModeValues=[ne.Fixed,ne.Percent],le.SpacingModeValues=[be.Length,be.Fixed,be.Percent],le.RotateModeValues=[Fe.Tangent,Fe.Chain,Fe.ChainScale],le.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN],le.BONE_ROTATE=0,le.BONE_TRANSLATE=1,le.BONE_SCALE=2,le.BONE_SHEAR=3,le.SLOT_ATTACHMENT=0,le.SLOT_COLOR=1,le.SLOT_TWO_COLOR=2,le.PATH_POSITION=0,le.PATH_SPACING=1,le.PATH_MIX=2,le.CURVE_LINEAR=0,le.CURVE_STEPPED=1,le.CURVE_BEZIER=2;let ZS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}},KS=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},QS=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new W_,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null){if(s.hash=n.hash,s.version=n.spine,s.version.substr(0,3)!=="3.8"){const a=`Spine 3.8 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(a)}s.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new U_(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Un.transformModeFromString(this.getValue(h,"transform","normal")),u.skinRequired=this.getValue(h,"skin",!1),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new z_(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Un.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new $_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.mix=this.getValue(h,"mix",1),o.softness=this.getValue(h,"softness",0)*e,o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.compress=this.getValue(h,"compress",!1),o.stretch=this.getValue(h,"stretch",!1),o.uniform=this.getValue(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new j_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new Y_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Un.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Un.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Un.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==be.Length||o.spacingMode==be.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new ju(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=s.findBone(h.bones[l]);if(u==null)throw new Error(`Skin bone not found: ${h.bones[a]}`);o.bones.push(u)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=s.findIkConstraint(h.ik[l]);if(u==null)throw new Error(`Skin IK constraint not found: ${h.ik[a]}`);o.constraints.push(u)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=s.findTransformConstraint(h.transform[l]);if(u==null)throw new Error(`Skin transform constraint not found: ${h.transform[a]}`);o.constraints.push(u)}if(h.path)for(let l=0;l<h.path.length;l++){const u=s.findPathConstraint(h.path[l]);if(u==null)throw new Error(`Skin path constraint not found: ${h.path[a]}`);o.constraints.push(u)}for(const l in h.attachments){const u=s.findSlot(l);if(u==null)throw new Error(`Slot not found: ${l}`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f!=null&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new X_(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u),l.width=this.getValue(t,"width",0)*a,l.height=this.getValue(t,"height",0)*a;const c=this.getValue(t,"parent",null);if(c!=null)return this.linkedMeshes.push(new JS(l,this.getValue(t,"skin",null),s,c,this.getValue(t,"deform",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=this.getValue(t,"edges",null),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new Rn(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,this.getValue(g,"time",0),g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new He(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*He.ENTRIES])}else if(c=="twoColor"){const f=new ae(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ae.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Ie(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ie.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1,m=0;c==="scale"?(f=new M_(d.length),m=1):c==="shear"?f=new F_(d.length):(f=new fs(d.length),p=r),f.boneIndex=u;let g=0;for(let _=0;_<d.length;_++){const x=d[_],y=this.getValue(x,"x",m),v=this.getValue(x,"y",m);f.setFrame(g,this.getValue(x,"time",0),y*p,v*p),this.readCurve(x,f,g),g++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*fs.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new Pe(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*r,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*Pe.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new We(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*We.ENTRIES])}if(t.path)for(const o in t.path){const l=t.path[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new D_(f.length),(c.spacingMode==be.Length||c.spacingMode==be.Fixed)&&(m=r)):(p=new Cr(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Cr.ENTRIES])}else if(d==="mix"){const p=new or(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,this.getValue(_,"time",0),this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*or.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new B_(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,this.getValue(E,"time",0),T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new Io(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,this.getValue(d,"time",0),f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new $u(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new G_(B.toSinglePrecision(this.getValue(c,"time",0)),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new oe(e,n,a))}readCurve(t,e,s){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(s);else{const r=t.curve;e.setCurve(s,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return be.Length;if(t=="fixed")return be.Fixed;if(t=="percent")return be.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return xt.Normal;if(t=="onlytranslation")return xt.OnlyTranslation;if(t=="norotationorreflection")return xt.NoRotationOrReflection;if(t=="noscale")return xt.NoScale;if(t=="noscaleorreflection")return xt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},JS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}};class tC extends Gu{createSkeleton(t){this.skeleton=new H_(t),this.skeleton.updateWorldTransform(),this.stateData=new L_(t),this.state=new ps(this.stateData)}}const eC={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(i){return Le(i,".atlas")},async load(i){return await(await z.ADAPTER.fetch(i)).text()},testParse(i,t){const e=Le(t.src,".atlas"),s=typeof i=="string";return Promise.resolve(e&&s)},async parse(i,t,e){const s=t.data;let r=vt.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let n=null,a=null;const h=new Promise((u,c)=>{n=u,a=c});let o;const l=u=>{u||a(`Something went terribly wrong loading a spine .atlas file
1170
- Most likely your texture failed to load.`),n(o)};if(s.image||s.images){const u=Object.assign(s.image?{default:s.image}:{},s.images);o=new Uu(i,(c,d)=>{const f=u[c]||u.default;f&&f.baseTexture?d(f.baseTexture):d(f)},l)}else o=new Uu(i,Z_(e,r,s.imageMetadata),l);return await h},unload(i){i.dispose()}}},Z_=(i,t,e)=>async(s,r)=>{const n=vt.normalize([...t.split(vt.sep),s].join(vt.sep)),a=await i.load({src:n,data:e});r(a.baseTexture)};K.add(eC);function K_(i){return i.hasOwnProperty("bones")}function sC(i){return i instanceof ArrayBuffer}class rC{constructor(){}installLoader(){const t=this,e={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(s){return Le(s,".skel")},async load(s){return await(await z.ADAPTER.fetch(s)).arrayBuffer()},testParse(s,r){var o;const n=Le(r.src,".json")&&K_(s),a=Le(r.src,".skel")&&sC(s),h=((o=r.data)==null?void 0:o.spineAtlas)===!1;return Promise.resolve(n&&!h||a)},async parse(s,r,n){const a=vt.extname(r.src).toLowerCase(),h=vt.basename(r.src,a);let o=vt.dirname(r.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=Le(r.src,".json")&&K_(s);let u=null,c=s;l?u=t.createJsonParser():(u=t.createBinaryParser(),c=new Uint8Array(s));const d=r.data||{},f=(d==null?void 0:d.spineSkeletonScale)??null;f&&(u.scale=f);const p=d.spineAtlas;if(p&&p.pages)return t.parseData(u,p,c);const m=d.atlasRawData;if(m){let x=null,y=null;const v=new Promise((E,T)=>{x=E,y=T}),b=new Uu(m,Z_(n,o,d.imageMetadata),E=>{E||y(`Something went terribly wrong loading a spine .atlas file
1171
- Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u,w,c)}let g=d.spineAtlasFile;g||(g=`${o+h}.atlas`);const _=await n.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(u,_,c)}}};return K.add(e),e}}let Q_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const J_=class extends Q_{constructor(t){super(t),this.id=(J_.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}applyDeform(t){return this==t}};let Yi=J_;Yi.nextID=0;let iC=class extends Yi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},nC=class extends Yi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},oC=class extends Yi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.inheritDeform=!1,this.tempColor=new X(0,0,0,0)}applyDeform(t){return this==t||this.inheritDeform&&this.parentMesh==t}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}},aC=class extends Yi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},lC=class extends Yi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}};class hC{constructor(t,e){if(this.attachmentVertices=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const we=class extends Q_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[we.OX1]=u-f,x[we.OY1]=d+c,x[we.OX2]=u-_,x[we.OY2]=g+c,x[we.OX3]=p-_,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof hC?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}};let nt=we;nt.OX1=0,nt.OY1=1,nt.OX2=2,nt.OY2=3,nt.OX3=4,nt.OY3=5,nt.OX4=6,nt.OY4=7,nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31,new S_(2);let Ee=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=s}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const se=class{constructor(i){if(i<=0)throw new Error(`frameCount must be > 0: ${i}`);this.curves=B.newFloatArray((i-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(i){this.curves[i*se.BEZIER_SIZE]=se.LINEAR}setStepped(i){this.curves[i*se.BEZIER_SIZE]=se.STEPPED}getCurveType(i){const t=i*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(i,t,e,s,r){const n=(-t*2+s)*.03,a=(-e*2+r)*.03,h=((t-s)*3+1)*.006,o=((e-r)*3+1)*.006;let l=n*2+h,u=a*2+o,c=t*.3+n+h*.16666667,d=e*.3+a+o*.16666667,f=i*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=d;for(let _=f+se.BEZIER_SIZE-1;f<_;f+=2)p[f]=m,p[f+1]=g,c+=l,d+=u,l+=h,u+=o,m+=c,g+=d}getCurvePercent(i,t){t=D.clamp(t,0,1);const e=this.curves;let s=i*se.BEZIER_SIZE;const r=e[s];if(r==se.LINEAR)return t;if(r==se.STEPPED)return 0;s++;let n=0;for(let h=s,o=s+se.BEZIER_SIZE-1;s<o;s+=2)if(n=e[s],n>=t){let l,u;return s==h?(l=0,u=0):(l=e[s-2],u=e[s-1]),u+(e[s+1]-u)*(t-l)/(n-l)}const a=e[s-1];return a+(1-a)*(t-n)/(1-n)}};let rs=se;rs.LINEAR=0,rs.STEPPED=1,rs.BEZIER=2,rs.BEZIER_SIZE=10*2-1;const si=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(i,t,e){i<<=1,this.frames[i]=t,this.frames[i+si.ROTATION]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.rotation=o.data.rotation;return;case S.first:const p=o.data.rotation-o.rotation;o.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=h[h.length-si.ENTRIES]){let p=h[h.length+si.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*r;break;case S.first:case S.replace:p+=o.data.rotation-o.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:o.rotation+=p*r}return}const l=Ee.binarySearch(h,e,si.ENTRIES),u=h[l+si.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+si.PREV_TIME]-c));let f=h[l+si.ROTATION]-u;switch(f=u+(f-(16384-(16384.499999999996-f/360|0))*360)*d,n){case S.setup:o.rotation=o.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case S.first:case S.replace:f+=o.data.rotation-o.rotation;case S.add:o.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Mn=si;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(i,t,e,s){i*=De.ENTRIES,this.frames[i]=t,this.frames[i+De.X]=e,this.frames[i+De.Y]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*r,o.y+=(o.data.y-o.y)*r}return}let l=0,u=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],u=h[h.length+De.PREV_Y];else{const c=Ee.binarySearch(h,e,De.ENTRIES);l=h[c+De.PREV_X],u=h[c+De.PREV_Y];const d=h[c],f=this.getCurvePercent(c/De.ENTRIES-1,1-(e-d)/(h[c+De.PREV_TIME]-d));l+=(h[c+De.X]-l)*f,u+=(h[c+De.Y]-u)*f}switch(n){case S.setup:o.x=o.data.x+l*r,o.y=o.data.y+u*r;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*r,o.y+=(o.data.y+u-o.y)*r;break;case S.add:o.x+=l*r,o.y+=u*r}}};let ar=De;ar.ENTRIES=3,ar.PREV_TIME=-3,ar.PREV_X=-2,ar.PREV_Y=-1,ar.X=1,ar.Y=2;let cC=class Ds extends ar{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Ds.ENTRIES])u=o[o.length+Ds.PREV_X]*l.data.scaleX,c=o[o.length+Ds.PREV_Y]*l.data.scaleY;else{const d=Ee.binarySearch(o,s,Ds.ENTRIES);u=o[d+Ds.PREV_X],c=o[d+Ds.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ds.ENTRIES-1,1-(s-f)/(o[d+Ds.PREV_TIME]-f));u=(u+(o[d+Ds.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Ds.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},uC=class Os extends ar{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Os.ENTRIES])u=o[o.length+Os.PREV_X],c=o[o.length+Os.PREV_Y];else{const d=Ee.binarySearch(o,s,Os.ENTRIES);u=o[d+Os.PREV_X],c=o[d+Os.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Os.ENTRIES-1,1-(s-f)/(o[d+Os.PREV_TIME]-f));u=u+(o[d+Os.X]-u)*p,c=c+(o[d+Os.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Ht=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(i,t,e,s,r,n){i*=Ht.ENTRIES,this.frames[i]=t,this.frames[i+Ht.R]=e,this.frames[i+Ht.G]=s,this.frames[i+Ht.B]=r,this.frames[i+Ht.A]=n}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color);return;case S.first:const f=h.color,p=h.data.color;f.add((p.r-f.r)*r,(p.g-f.g)*r,(p.b-f.b)*r,(p.a-f.a)*r)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Ht.ENTRIES]){const f=o.length;l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A]}else{const f=Ee.binarySearch(o,e,Ht.ENTRIES);l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A];const p=o[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(o[f+Ht.PREV_TIME]-p));l+=(o[f+Ht.R]-l)*m,u+=(o[f+Ht.G]-u)*m,c+=(o[f+Ht.B]-c)*m,d+=(o[f+Ht.A]-d)*m}if(r==1)h.color.set(l,u,c,d);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*r,(u-f.g)*r,(c-f.b)*r,(d-f.a)*r)}}};let ms=Ht;ms.ENTRIES=5,ms.PREV_TIME=-5,ms.PREV_R=-4,ms.PREV_G=-3,ms.PREV_B=-2,ms.PREV_A=-1,ms.R=1,ms.G=2,ms.B=3,ms.A=4;const ft=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(i,t,e,s,r,n,a,h,o){i*=ft.ENTRIES,this.frames[i]=t,this.frames[i+ft.R]=e,this.frames[i+ft.G]=s,this.frames[i+ft.B]=r,this.frames[i+ft.A]=n,this.frames[i+ft.R2]=a,this.frames[i+ft.G2]=h,this.frames[i+ft.B2]=o}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color),h.darkColor.setFromColor(h.data.darkColor);return;case S.first:const g=h.color,_=h.darkColor,x=h.data.color,y=h.data.darkColor;g.add((x.r-g.r)*r,(x.g-g.g)*r,(x.b-g.b)*r,(x.a-g.a)*r),_.add((y.r-_.r)*r,(y.g-_.g)*r,(y.b-_.b)*r,0)}return}let l=0,u=0,c=0,d=0,f=0,p=0,m=0;if(e>=o[o.length-ft.ENTRIES]){const g=o.length;l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2]}else{const g=Ee.binarySearch(o,e,ft.ENTRIES);l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2];const _=o[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-_)/(o[g+ft.PREV_TIME]-_));l+=(o[g+ft.R]-l)*x,u+=(o[g+ft.G]-u)*x,c+=(o[g+ft.B]-c)*x,d+=(o[g+ft.A]-d)*x,f+=(o[g+ft.R2]-f)*x,p+=(o[g+ft.G2]-p)*x,m+=(o[g+ft.B2]-m)*x}if(r==1)h.color.set(l,u,c,d),h.darkColor.set(f,p,m,1);else{const g=h.color,_=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),_.setFromColor(h.data.darkColor)),g.add((l-g.r)*r,(u-g.g)*r,(c-g.b)*r,(d-g.a)*r),_.add((f-_.r)*r,(p-_.g)*r,(m-_.b)*r,0)}}};let ye=ft;ye.ENTRIES=8,ye.PREV_TIME=-8,ye.PREV_R=-7,ye.PREV_G=-6,ye.PREV_B=-5,ye.PREV_A=-4,ye.PREV_R2=-3,ye.PREV_G2=-2,ye.PREV_B2=-1,ye.R=1,ye.G=2,ye.B=3,ye.A=4,ye.R2=5,ye.G2=6,ye.B2=7;let dC=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(h==At.mixOut&&a==S.setup){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}const l=this.frames;if(s<l[0]){if(a==S.setup||a==S.first){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let u=0;s>=l[l.length-1]?u=l.length-1:u=Ee.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}},t0=null,fC=class extends rs{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),t0==null&&(t0=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Yi)||!l.applyDeform(this.attachment))return;const u=o.attachmentVertices;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},pC=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=Ee.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},mC=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=Ee.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const St=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(i,t,e,s,r,n){i*=St.ENTRIES,this.frames[i]=t,this.frames[i+St.MIX]=e,this.frames[i+St.BEND_DIRECTION]=s,this.frames[i+St.COMPRESS]=r?1:0,this.frames[i+St.STRETCH]=n?1:0}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.mix=o.data.mix,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*r,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(o.mix=o.data.mix+(h[h.length+St.PREV_MIX]-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0)):(o.mix+=(h[h.length+St.PREV_MIX]-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),u=h[l+St.PREV_MIX],c=h[l],d=this.getCurvePercent(l/St.ENTRIES-1,1-(e-c)/(h[l+St.PREV_TIME]-c));n==S.setup?(o.mix=o.data.mix+(u+(h[l+St.MIX]-u)*d-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0)):(o.mix+=(u+(h[l+St.MIX]-u)*d-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0))}};let gs=St;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_MIX=-4,gs.PREV_BEND_DIRECTION=-3,gs.PREV_COMPRESS=-2,gs.PREV_STRETCH=-1,gs.MIX=1,gs.BEND_DIRECTION=2,gs.COMPRESS=3,gs.STRETCH=4;const Wt=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(i,t,e,s,r,n){i*=Wt.ENTRIES,this.frames[i]=t,this.frames[i+Wt.ROTATE]=e,this.frames[i+Wt.TRANSLATE]=s,this.frames[i+Wt.SCALE]=r,this.frames[i+Wt.SHEAR]=n}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=o.data;switch(n){case S.setup:o.rotateMix=f.rotateMix,o.translateMix=f.translateMix,o.scaleMix=f.scaleMix,o.shearMix=f.shearMix;return;case S.first:o.rotateMix+=(f.rotateMix-o.rotateMix)*r,o.translateMix+=(f.translateMix-o.translateMix)*r,o.scaleMix+=(f.scaleMix-o.scaleMix)*r,o.shearMix+=(f.shearMix-o.shearMix)*r}return}let l=0,u=0,c=0,d=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR];const p=h[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(h[f+Wt.PREV_TIME]-p));l+=(h[f+Wt.ROTATE]-l)*m,u+=(h[f+Wt.TRANSLATE]-u)*m,c+=(h[f+Wt.SCALE]-c)*m,d+=(h[f+Wt.SHEAR]-d)*m}if(n==S.setup){const f=o.data;o.rotateMix=f.rotateMix+(l-f.rotateMix)*r,o.translateMix=f.translateMix+(u-f.translateMix)*r,o.scaleMix=f.scaleMix+(c-f.scaleMix)*r,o.shearMix=f.shearMix+(d-f.shearMix)*r}else o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r,o.scaleMix+=(c-o.scaleMix)*r,o.shearMix+=(d-o.shearMix)*r}};let _s=Wt;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_ROTATE=-4,_s.PREV_TRANSLATE=-3,_s.PREV_SCALE=-2,_s.PREV_SHEAR=-1,_s.ROTATE=1,_s.TRANSLATE=2,_s.SCALE=3,_s.SHEAR=4;const Is=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(i,t,e){i*=Is.ENTRIES,this.frames[i]=t,this.frames[i+Is.VALUE]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*r}return}let l=0;if(e>=h[h.length-Is.ENTRIES])l=h[h.length+Is.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Is.ENTRIES);l=h[u+Is.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Is.ENTRIES-1,1-(e-c)/(h[u+Is.PREV_TIME]-c));l+=(h[u+Is.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*r:o.position+=(l-o.position)*r}};let Hi=Is;Hi.ENTRIES=2,Hi.PREV_TIME=-2,Hi.PREV_VALUE=-1,Hi.VALUE=1;let gC=class ui extends Hi{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ui.ENTRIES])u=o[o.length+ui.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ui.ENTRIES);u=o[c+ui.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ui.ENTRIES-1,1-(s-d)/(o[c+ui.PREV_TIME]-d));u+=(o[c+ui.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Oe=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(i,t,e,s){i*=Oe.ENTRIES,this.frames[i]=t,this.frames[i+Oe.ROTATE]=e,this.frames[i+Oe.TRANSLATE]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.rotateMix=o.data.rotateMix,o.translateMix=o.data.translateMix;return;case S.first:o.rotateMix+=(o.data.rotateMix-o.rotateMix)*r,o.translateMix+=(o.data.translateMix-o.translateMix)*r}return}let l=0,u=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],u=h[h.length+Oe.PREV_TRANSLATE];else{const c=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[c+Oe.PREV_ROTATE],u=h[c+Oe.PREV_TRANSLATE];const d=h[c],f=this.getCurvePercent(c/Oe.ENTRIES-1,1-(e-d)/(h[c+Oe.PREV_TIME]-d));l+=(h[c+Oe.ROTATE]-l)*f,u+=(h[c+Oe.TRANSLATE]-u)*f}n==S.setup?(o.rotateMix=o.data.rotateMix+(l-o.data.rotateMix)*r,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*r):(o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r)}};let ri=Oe;ri.ENTRIES=3,ri.PREV_TIME=-3,ri.PREV_ROTATE=-2,ri.PREV_TRANSLATE=-1,ri.ROTATE=1,ri.TRANSLATE=2,new Ee("<empty>",[],0);let _C=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new oC(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new iC(e)}newPathAttachment(t,e){return new aC(e)}newPointAttachment(t,e){return new lC(e)}newClippingAttachment(t,e){return new nC(e)}},yC=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=xt.Normal,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},xC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},vC=class{constructor(t){this.name=t}},bC=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},wC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var ii=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(ii||{});let EC=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},TC=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},AC=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},SC=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}},CC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new EC,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null&&(s.hash=n.hash,s.version=n.spine,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images),r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new yC(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Gn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new TC(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Gn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new bC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.mix=this.getValue(h,"mix",1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new AC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new wC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Gn.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Gn.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Gn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==ii.Length||o.spacingMode==ii.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(const a in r.skins){const h=r.skins[a],o=new SC(a);for(const l in h){const u=s.findSlotIndex(l);if(u==-1)throw new Error(`Slot not found: ${l}`);const c=h[l];for(const d in c){const f=this.readAttachment(c[d],o,u,d,s);f!=null&&o.addAttachment(u,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new vC(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u);const c=this.getValue(t,"parent",null);if(c!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new IC(l,this.getValue(t,"skin",null),s,c)),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new dC(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,g.time,g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new ms(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ms.ENTRIES])}else if(c=="twoColor"){const f=new ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ye.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Mn(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Mn.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1;c==="scale"?f=new cC(d.length):c==="shear"?f=new uC(d.length):(f=new ar(d.length),p=r),f.boneIndex=u;let m=0;for(let g=0;g<d.length;g++){const _=d[g],x=this.getValue(_,"x",0),y=this.getValue(_,"y",0);f.setFrame(m,_.time,x*p,y*p),this.readCurve(_,f,m),m++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ar.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new gs(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*gs.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new _s(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*_s.ENTRIES])}if(t.paths)for(const o in t.paths){const l=t.paths[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new gC(f.length),(c.spacingMode==ii.Length||c.spacingMode==ii.Fixed)&&(m=r)):(p=new Hi(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,x.time,this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Hi.ENTRIES])}else if(d==="mix"){const p=new ri(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,_.time,this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*ri.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new fC(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new mC(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,d.time,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new pC(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new xC(B.toSinglePrecision(c.time),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,a))}readCurve(t,e,s){if(t.curve){if(t.curve==="stepped")e.setStepped(s);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){const r=t.curve;e.setCurve(s,r[0],r[1],r[2],r[3])}}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return ii.Length;if(t=="fixed")return ii.Fixed;if(t=="percent")return ii.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return xt.Normal;if(t=="onlytranslation")return xt.OnlyTranslation;if(t=="norotationorreflection")return xt.NoRotationOrReflection;if(t=="noscale")return xt.NoScale;if(t=="noscaleorreflection")return xt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},IC=class{constructor(t,e,s,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r}};class e0{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const s0=class extends e0{constructor(i){super(i),this.id=s0.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(i,t){this.computeWorldVertices(i,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(i,t,e,s,r,n){e=r+(e>>1)*n;const a=i.bone.skeleton,h=i.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=i.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=r;b<e;v+=2,b+=n){const w=o[v],E=o[v+1];s[b]=w*g+E*_+p,s[b+1]=w*x+E*y+m}return}let u=0,c=0;for(let f=0;f<t;f+=2){const p=l[u];u+=p+1,c+=p}const d=a.bones;if(h.length==0)for(let f=r,p=c*3;f<e;f+=n){let m=0,g=0,_=l[u++];for(_+=u;u<_;u++,p+=3){const x=d[l[u]].matrix,y=o[p],v=o[p+1],b=o[p+2];m+=(y*x.a+v*x.c+x.tx)*b,g+=(y*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=r,m=c*3,g=c<<1;p<e;p+=n){let _=0,x=0,y=l[u++];for(y+=u;u<y;u++,m+=3,g+=2){const v=d[l[u]].matrix,b=o[m]+f[g],w=o[m+1]+f[g+1],E=o[m+2];_+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=_,s[p+1]=x}}}copyTo(i){this.bones?(i.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,i.bones,0,this.bones.length)):i.bones=null,this.vertices&&(i.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,i.vertices,0,this.vertices.length)),i.worldVerticesLength=this.worldVerticesLength,i.timelineAttachment=this.timelineAttachment}};let ni=s0;ni.nextID=0;class qu extends ni{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new qu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Zu extends ni{constructor(t){super(t),this.type=at.Clipping,this.endSlot=null,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new Zu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Mo extends ni{constructor(t,e){super(t),this.type=at.Mesh,this.region=null,this.triangles=[],this.color=new X(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new X(0,0,0,0),this.path=e}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,n,a)}newLinkedMesh(){const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t}}class Ku extends ni{constructor(t){super(t),this.type=at.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new Ku(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Qu extends ni{constructor(t){super(t),this.type=at.Point,this.x=0,this.y=0,this.rotation=0,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new Qu(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const r0=class extends e0{constructor(i,t){super(i),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const i=this.region,t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=this.x,c=this.y,d=s*o+u,f=s*l,p=r*o+c,m=r*l,g=n*o+u,_=n*l,x=a*o+c,y=a*l,v=this.offset;v[0]=d-m,v[1]=p+f,v[2]=d-y,v[3]=x+f,v[4]=g-y,v[5]=x+_,v[6]=g-m,v[7]=p+_;const b=this.uvs;i.degrees==90?(b[2]=i.u,b[3]=i.v2,b[4]=i.u,b[5]=i.v,b[6]=i.u2,b[7]=i.v,b[0]=i.u2,b[1]=i.v2):(b[0]=i.u,b[1]=i.v2,b[2]=i.u,b[3]=i.v,b[4]=i.u2,b[5]=i.v,b[6]=i.u2,b[7]=i.v2)}computeWorldVertices(i,t,e,s){this.sequence!=null&&this.sequence.apply(i,this);const r=i.bone,n=this.offset,a=r.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[2],p=n[3],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[4],p=n[5],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[6],p=n[7],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o}copy(){const i=new r0(this.name,this.path);return i.region=this.region,i.rendererObject=this.rendererObject,i.x=this.x,i.y=this.y,i.scaleX=this.scaleX,i.scaleY=this.scaleY,i.rotation=this.rotation,i.width=this.width,i.height=this.height,B.arrayCopy(this.uvs,0,i.uvs,0,8),B.arrayCopy(this.offset,0,i.offset,0,8),i.color.setFromColor(this.color),i.sequence=this.sequence!=null?this.sequence.copy():null,i}};let gt=r0;gt.X1=0,gt.Y1=1,gt.C1R=2,gt.C1G=3,gt.C1B=4,gt.C1A=5,gt.U1=6,gt.V1=7,gt.X2=8,gt.Y2=9,gt.C2R=10,gt.C2G=11,gt.C2B=12,gt.C2A=13,gt.U2=14,gt.V2=15,gt.X3=16,gt.Y3=17,gt.C3R=18,gt.C3G=19,gt.C3B=20,gt.C3A=21,gt.U3=22,gt.V3=23,gt.X4=24,gt.Y4=25,gt.C4R=26,gt.C4G=27,gt.C4B=28,gt.C4A=29,gt.U4=30,gt.V4=31;const yl=class{constructor(i){this.id=yl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(i)}copy(){const i=new yl(this.regions.length);return B.arrayCopy(this.regions,0,i.regions,0,this.regions.length),i.start=this.start,i.digits=this.digits,i.setupIndex=this.setupIndex,i}apply(i,t){let e=i.sequenceIndex;e==-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(i,t){let e=i;const s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)e+="0";return e+=s,e}static nextID(){return yl._nextID++}};let Ju=yl;Ju._nextID=0;var Pr=(i=>(i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse",i))(Pr||{});const i0=[0,1,2,3,4,5,6];class td{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new LS,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}}const yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19};class he{constructor(t,e){this.propertyIds=e,this.frames=B.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){const s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){const r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}}class lr extends he{constructor(t,e,s){super(t,s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-r+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=r+v,E=n+b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getBezierValue(t,e,s,r){const n=this.curves;if(n[r]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}const a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){const l=n[r-2],u=n[r-1];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}e+=this.getFrameEntries();const h=n[a-2],o=n[a-1];return o+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-o)}}class hr extends lr{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const r=this.curves[s>>1];switch(r){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}}class ed extends lr{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class n0 extends hr{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.rotation=o.data.rotation;return;case S.first:o.rotation+=(o.data.rotation-o.rotation)*n}return}let u=this.getCurveValue(s);switch(a){case S.setup:o.rotation=o.data.rotation+u*n;break;case S.first:case S.replace:u+=o.data.rotation-o.rotation;case S.add:o.rotation+=u*n}}}class o0 extends ed{constructor(t,e,s){super(t,e,`${yt.x}|${s}`,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.x=o.data.x+u*n,o.y=o.data.y+c*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case S.add:o.x+=u*n,o.y+=c*n}}}class a0 extends hr{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x;return;case S.first:o.x+=(o.data.x-o.x)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.x=o.data.x+u*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n;break;case S.add:o.x+=u*n}}}class l0 extends hr{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.y=o.data.y;return;case S.first:o.y+=(o.data.y-o.y)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.y=o.data.y+u*n;break;case S.first:case S.replace:o.y+=(o.data.y+u-o.y)*n;break;case S.add:o.y+=u*n}}}class h0 extends ed{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX,o.scaleY=o.data.scaleY;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u,c;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(u*=o.data.scaleX,c*=o.data.scaleY,n==1)a==S.add?(o.scaleX+=u-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=u,o.scaleY=c);else{let p=0,m=0;if(h==At.mixOut)switch(a){case S.setup:p=o.data.scaleX,m=o.data.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=o.scaleX,m=o.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(a){case S.setup:p=Math.abs(o.data.scaleX)*D.signum(u),m=Math.abs(o.data.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.first:case S.replace:p=Math.abs(o.scaleX)*D.signum(u),m=Math.abs(o.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}}class c0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n}return}const u=this.getCurveValue(s)*o.data.scaleX;if(n==1)a==S.add?o.scaleX+=u-o.data.scaleX:o.scaleX=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}}}}class u0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleY=o.data.scaleY;return;case S.first:o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}const u=this.getCurveValue(s)*o.data.scaleY;if(n==1)a==S.add?o.scaleY+=u-o.data.scaleY:o.scaleY=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}}}}class d0 extends ed{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX,o.shearY=o.data.shearY;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.shearX=o.data.shearX+u*n,o.shearY=o.data.shearY+c*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case S.add:o.shearX+=u*n,o.shearY+=c*n}}}class f0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearX=o.data.shearX+u*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n;break;case S.add:o.shearX+=u*n}}}class p0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearY=o.data.shearY;return;case S.first:o.shearY+=(o.data.shearY-o.shearY)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearY=o.data.shearY+u*n;break;case S.first:case S.replace:o.shearY+=(o.data.shearY+u-o.shearY)*n;break;case S.add:o.shearY+=u*n}}}class m0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const _=o.data.color;switch(a){case S.setup:u.setFromColor(_);return;case S.first:u.add((_.r-u.r)*n,(_.g-u.g)*n,(_.b-u.b)*n,(_.a-u.a)*n)}return}let c=0,d=0,f=0,p=0;const m=he.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const _=l[m];c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];const x=(s-_)/(l[m+5]-_);c+=(l[m+5+1]-c)*x,d+=(l[m+5+2]-d)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),f=this.getBezierValue(s,m,3,g+18*2-2),p=this.getBezierValue(s,m,4,g+18*3-2)}n==1?u.set(c,d,f,p):(a==S.setup&&u.setFromColor(o.data.color),u.add((c-u.r)*n,(d-u.g)*n,(f-u.b)*n,(p-u.a)*n))}}class g0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const g=o.data.color;switch(a){case S.setup:u.r=g.r,u.g=g.g,u.b=g.b;return;case S.first:u.r+=(g.r-u.r)*n,u.g+=(g.g-u.g)*n,u.b+=(g.b-u.b)*n}return}let c=0,d=0,f=0;const p=he.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];c=l[p+1],d=l[p+2],f=l[p+3];const _=(s-g)/(l[p+4]-g);c+=(l[p+4+1]-c)*_,d+=(l[p+4+2]-d)*_,f+=(l[p+4+3]-f)*_;break;case 1:c=l[p+1],d=l[p+2],f=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)u.r=c,u.g=d,u.b=f;else{if(a==S.setup){const g=o.data.color;u.r=g.r,u.g=g.g,u.b=g.b}u.r+=(c-u.r)*n,u.g+=(d-u.g)*n,u.b+=(f-u.b)*n}}}class _0 extends hr{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.color;if(s<this.frames[0]){const c=o.data.color;switch(a){case S.setup:l.a=c.a;return;case S.first:l.a+=(c.a-l.a)*n}return}const u=this.getCurveValue(s);n==1?l.a=u:(a==S.setup&&(l.a=o.data.color.a),l.a+=(u-l.a)*n)}}class y0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const b=o.data.color,w=o.data.darkColor;switch(a){case S.setup:u.setFromColor(b),c.r=w.r,c.g=w.g,c.b=w.b;return;case S.first:u.add((b.r-u.r)*n,(b.g-u.g)*n,(b.b-u.b)*n,(b.a-u.a)*n),c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0,x=0;const y=he.search(l,s,8),v=this.curves[y>>3];switch(v){case 0:const b=l[y];d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];const w=(s-b)/(l[y+8]-b);d+=(l[y+8+1]-d)*w,f+=(l[y+8+2]-f)*w,p+=(l[y+8+3]-p)*w,m+=(l[y+8+4]-m)*w,g+=(l[y+8+5]-g)*w,_+=(l[y+8+6]-_)*w,x+=(l[y+8+7]-x)*w;break;case 1:d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];break;default:d=this.getBezierValue(s,y,1,v-2),f=this.getBezierValue(s,y,2,v+18-2),p=this.getBezierValue(s,y,3,v+18*2-2),m=this.getBezierValue(s,y,4,v+18*3-2),g=this.getBezierValue(s,y,5,v+18*4-2),_=this.getBezierValue(s,y,6,v+18*5-2),x=this.getBezierValue(s,y,7,v+18*6-2)}if(n==1)u.set(d,f,p,m),c.r=g,c.g=_,c.b=x;else{if(a==S.setup){u.setFromColor(o.data.color);const b=o.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}u.add((d-u.r)*n,(f-u.g)*n,(p-u.b)*n,(m-u.a)*n),c.r+=(g-c.r)*n,c.g+=(_-c.g)*n,c.b+=(x-c.b)*n}}}class x0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const v=o.data.color,b=o.data.darkColor;switch(a){case S.setup:u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b;return;case S.first:u.r+=(v.r-u.r)*n,u.g+=(v.g-u.g)*n,u.b+=(v.b-u.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0;const x=he.search(l,s,7),y=this.curves[x/7];switch(y){case 0:const v=l[x];d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];const b=(s-v)/(l[x+7]-v);d+=(l[x+7+1]-d)*b,f+=(l[x+7+2]-f)*b,p+=(l[x+7+3]-p)*b,m+=(l[x+7+4]-m)*b,g+=(l[x+7+5]-g)*b,_+=(l[x+7+6]-_)*b;break;case 1:d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];break;default:d=this.getBezierValue(s,x,1,y-2),f=this.getBezierValue(s,x,2,y+18-2),p=this.getBezierValue(s,x,3,y+18*2-2),m=this.getBezierValue(s,x,4,y+18*3-2),g=this.getBezierValue(s,x,5,y+18*4-2),_=this.getBezierValue(s,x,6,y+18*5-2)}if(n==1)u.r=d,u.g=f,u.b=p,c.r=m,c.g=g,c.b=_;else{if(a==S.setup){const v=o.data.color,b=o.data.darkColor;u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b}u.r+=(d-u.r)*n,u.g+=(f-u.g)*n,u.b+=(p-u.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(_-c.b)*n}}}class v0 extends he{constructor(t,e){super(t,[`${yt.attachment}|${e}`]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(o.bone.active){if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}if(s<this.frames[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}this.setAttachment(t,o,this.attachmentNames[he.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class b0 extends lr{constructor(t,e,s,r){super(t,e,[`${yt.deform}|${s}|${r.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-r+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=r+v,E=b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let r=s[e];switch(r){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(r-=2,s[r]>t){const o=this.frames[e];return s[r+1]*(t-o)/(s[r]-o)}const n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){const o=s[r-2],l=s[r-1];return l+(t-o)/(s[r]-o)*(s[r+1]-l)}const a=s[n-2],h=s[n-1];return h+(1-h)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof ni)||l.timelineAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;return}u.length=d;const x=l;if(x.bones){n=1-n;for(let y=0;y<d;y++)u[y]*=n}else{const y=x.vertices;for(let v=0;v<d;v++)u[v]+=(y[v]-u[v])*n}}return}if(u.length=d,s>=f[f.length-1]){const x=c[f.length-1];if(n==1)if(a==S.add){const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v];else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,u,0,d);else switch(a){case S.setup:{const v=l;if(v.bones)for(let b=0;b<d;b++)u[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<d;w++){const E=b[w];u[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<d;v++)u[v]+=(x[v]-u[v])*n;break;case S.add:const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v]*n;else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=(x[b]-v[b])*n}}return}const p=he.search1(f,s),m=this.getCurvePercent(s,p),g=c[p],_=c[p+1];if(n==1)if(a==S.add){const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=v+(_[y]-v)*m}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=b+(_[v]-b)*m-y[v]}}}else for(let x=0;x<d;x++){const y=g[x];u[x]=y+(_[x]-y)*m}else switch(a){case S.setup:{const y=l;if(y.bones)for(let v=0;v<d;v++){const b=g[v];u[v]=(b+(_[v]-b)*m)*n}else{const v=y.vertices;for(let b=0;b<d;b++){const w=g[b],E=v[b];u[b]=E+(w+(_[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m-u[y])*n}break;case S.add:const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m)*n}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=(b+(_[v]-b)*m-y[v])*n}}}}}const w0=class extends he{constructor(i){super(i,w0.propertyIds),this.events=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t){this.frames[i]=t.time,this.events[i]=t}apply(i,t,e,s,r,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(i,t,Number.MAX_VALUE,s,r,n,a),t=-1;else if(t>=h[o-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=he.search1(h,t)+1;const u=h[l];for(;l>0&&h[l-1]==u;)l--}for(;l<o&&e>=h[l];l++)s.push(this.events[l])}};let sd=w0;sd.propertyIds=[`${yt.event}`];const E0=class extends he{constructor(i){super(i,E0.propertyIds),this.drawOrders=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t,e){this.frames[i]=t,this.drawOrders[i]=e}apply(i,t,e,s,r,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);else{const l=i.drawOrder,u=i.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let rd=E0;rd.propertyIds=[`${yt.drawOrder}`];class T0 extends lr{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,r,n,a,h){const o=t.ikConstraints[this.ikConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let u=0,c=0;const d=he.search(l,s,6),f=this.curves[d/6];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+6]-p);u+=(l[d+6+1]-u)*m,c+=(l[d+6+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}a==S.setup?(o.mix=o.data.mix+(u-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,h==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0)):(o.mix+=(u-o.mix)*n,o.softness+=(c-o.softness)*n,h==At.mixIn&&(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0))}}class A0 extends lr{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.transformConstraints[this.transformConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){const x=o.data;switch(a){case S.setup:o.mixRotate=x.mixRotate,o.mixX=x.mixX,o.mixY=x.mixY,o.mixScaleX=x.mixScaleX,o.mixScaleY=x.mixScaleY,o.mixShearY=x.mixShearY;return;case S.first:o.mixRotate+=(x.mixRotate-o.mixRotate)*n,o.mixX+=(x.mixX-o.mixX)*n,o.mixY+=(x.mixY-o.mixY)*n,o.mixScaleX+=(x.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(x.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(x.mixShearY-o.mixShearY)*n}return}let u,c,d,f,p,m;const g=he.search(l,s,7),_=this.curves[g/7];switch(_){case 0:const x=l[g];u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const y=(s-x)/(l[g+7]-x);u+=(l[g+7+1]-u)*y,c+=(l[g+7+2]-c)*y,d+=(l[g+7+3]-d)*y,f+=(l[g+7+4]-f)*y,p+=(l[g+7+5]-p)*y,m+=(l[g+7+6]-m)*y;break;case 1:u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:u=this.getBezierValue(s,g,1,_-2),c=this.getBezierValue(s,g,2,_+18-2),d=this.getBezierValue(s,g,3,_+18*2-2),f=this.getBezierValue(s,g,4,_+18*3-2),p=this.getBezierValue(s,g,5,_+18*4-2),m=this.getBezierValue(s,g,6,_+18*5-2)}if(a==S.setup){const x=o.data;o.mixRotate=x.mixRotate+(u-x.mixRotate)*n,o.mixX=x.mixX+(c-x.mixX)*n,o.mixY=x.mixY+(d-x.mixY)*n,o.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,o.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,o.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n,o.mixScaleX+=(f-o.mixScaleX)*n,o.mixScaleY+=(p-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class S0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*n}return}const u=this.getCurveValue(s);a==S.setup?o.position=o.data.position+(u-o.data.position)*n:o.position+=(u-o.position)*n}}class C0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.spacing=o.data.spacing;return;case S.first:o.spacing+=(o.data.spacing-o.spacing)*n}return}const u=this.getCurveValue(s);a==S.setup?o.spacing=o.data.spacing+(u-o.data.spacing)*n:o.spacing+=(u-o.spacing)*n}}class I0 extends lr{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=r,a[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,o.mixY=o.data.mixY;return;case S.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u,c,d;const f=he.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];u=l[f+1],c=l[f+2],d=l[f+3];const g=(s-m)/(l[f+4]-m);u+=(l[f+4+1]-u)*g,c+=(l[f+4+2]-c)*g,d+=(l[f+4+3]-d)*g;break;case 1:u=l[f+1],c=l[f+2],d=l[f+3];break;default:u=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2)}if(a==S.setup){const m=o.data;o.mixRotate=m.mixRotate+(u-m.mixRotate)*n,o.mixX=m.mixX+(c-m.mixX)*n,o.mixY=m.mixY+(d-m.mixY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n}}const oi=class extends he{constructor(i,t,e){super(i,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return oi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(i,t,e,s,r){const n=this.frames;i*=oi.ENTRIES,n[i]=t,n[i+oi.MODE]=e|s<<4,n[i+oi.DELAY]=r}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof ni)||o.timelineAttachment!=l))return;const u=this.frames;if(e<u[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const c=he.search(u,e,oi.ENTRIES),d=u[c],f=u[c+oi.MODE],p=u[c+oi.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=i0[f&15];if(_!=Pr.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pr.once:m=Math.min(g-1,m);break;case Pr.loop:m%=g;break;case Pr.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pr.onceReverse:m=Math.max(g-1-m,0);break;case Pr.loopReverse:m=g-1-m%g;break;case Pr.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=oi;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new td("<empty>",[],0);class P0{constructor(t){this.atlas=t}loadSequence(t,e,s){const r=s.regions;for(let n=0,a=r.length;n<a;n++){const h=s.getPath(e,n),o=this.atlas.findRegion(h);if(o==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);r[n]=o,r[n].renderObject=r[n]}}newRegionAttachment(t,e,s,r){const n=new gt(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);a.renderObject=a,n.region=a}return n}newMeshAttachment(t,e,s,r){const n=new Mo(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);a.renderObject=a,n.region=a}return n}newBoundingBoxAttachment(t,e){return new qu(e)}newPathAttachment(t,e){return new Ku(e)}newPointAttachment(t,e){return new Qu(e)}newClippingAttachment(t,e){return new Zu(e)}}class R0{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=xt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class id{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let M0=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class F0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class k0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class B0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Ps.Fixed,this.rotateMode=Fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Ps=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional",i))(Ps||{});class D0{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}}class O0{constructor(t,e,s){if(this.index=0,this.color=new X(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=W.NORMAL,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class L0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class N0{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class nd{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment&&(r.attachment instanceof Mo?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new N0(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new N0(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u&&n.setAttachment(u);break}}}s++}}}class V0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new D0;s.name="";const r=new gl(t),n=r.readInt32(),a=r.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=r.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const c=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(c)}this.ver40=h==="4.0",s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat();const o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("String in string table must not be null.");r.strings.push(d)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[r.readInt(!0)],p=new R0(c,d,f);p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.transformMode=r.readInt(!0),p.skinRequired=r.readBoolean(),o&&X.rgba8888ToColor(p.color,r.readInt32()),s.bones.push(p)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[r.readInt(!0)],p=new O0(c,d,f);X.rgba8888ToColor(p.color,r.readInt32());const m=r.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=r.readStringRef(),p.blendMode=r.readInt(!0),s.slots.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new k0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.mix=r.readFloat(),p.softness=r.readFloat()*e,p.bendDirection=r.readByte(),p.compress=r.readBoolean(),p.stretch=r.readBoolean(),p.uniform=r.readBoolean(),s.ikConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new L0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.local=r.readBoolean(),p.relative=r.readBoolean(),p.offsetRotation=r.readFloat(),p.offsetX=r.readFloat()*e,p.offsetY=r.readFloat()*e,p.offsetScaleX=r.readFloat(),p.offsetScaleY=r.readFloat(),p.offsetShearY=r.readFloat(),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),p.mixScaleX=r.readFloat(),p.mixScaleY=r.readFloat(),p.mixShearY=r.readFloat(),s.transformConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new B0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.slots[r.readInt(!0)],p.positionMode=r.readInt(!0),p.spacingMode=r.readInt(!0),p.rotateMode=r.readInt(!0),p.offsetRotation=r.readFloat(),p.position=r.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=r.readFloat(),(p.spacingMode==Ps.Length||p.spacingMode==Ps.Fixed)&&(p.spacing*=e),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(r,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+r.readInt(!0));c<l;c++){const d=this.readSkin(r,s,!1,o);if(!d)throw new Error("readSkin() should not have returned null.");s.skins[c]=d}}l=this.linkedMeshes.length;for(let c=0;c<l;c++){const d=this.linkedMeshes[c],f=d.skin?s.findSkin(d.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readStringRef();if(!d)throw new Error;const f=new F0(d);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,d,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),a==0)return null;n=new nd("default")}else{const h=t.readStringRef();if(!h)throw new Error("Skin name must not be null.");n=new nd(h),n.bones.length=t.readInt(!0);for(let o=0,l=n.bones.length;o<l;o++)n.bones[o]=e.bones[t.readInt(!0)];for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let h=0;h<a;h++){const o=t.readInt(!0);for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,n,o,c,r);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,r,n,a){const h=this.scale;let o=t.readStringRef();switch(o||(o=n),t.readByte()){case at.Region:{let l=t.readStringRef();const u=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),_=t.readInt32(),x=this.readSequence(t);l||(l=o);const y=this.attachmentLoader.newRegionAttachment(s,o,l,x);return y?(y.path=l,y.x=c*h,y.y=d*h,y.scaleX=f,y.scaleY=p,y.rotation=u,y.width=m*h,y.height=g*h,X.rgba8888ToColor(y.color,_),y.sequence=x,x==null&&y.updateRegion(),y):null}case at.BoundingBox:{const l=t.readInt(!0),u=this.readVertices(t,l),c=a?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l<<1,d.vertices=u.vertices,d.bones=u.bones,a&&X.rgba8888ToColor(d.color,c),d):null}case at.Mesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readInt(!0),d=this.readFloatArray(t,c<<1,1),f=this.readShortArray(t),p=this.readVertices(t,c),m=t.readInt(!0),g=this.readSequence(t);let _=[],x=0,y=0;a&&(_=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),l||(l=o);const v=this.attachmentLoader.newMeshAttachment(s,o,l,g);return v?(v.path=l,X.rgba8888ToColor(v.color,u),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=c<<1,v.triangles=f,v.regionUVs=new Float32Array(d),v.hullLength=m<<1,v.sequence=g,a&&(v.edges=_,v.width=x*h,v.height=y*h),v):null}case at.LinkedMesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;a&&(m=t.readFloat(),g=t.readFloat()),l||(l=o);const _=this.attachmentLoader.newMeshAttachment(s,o,l,p);return _?(_.path=l,X.rgba8888ToColor(_.color,u),_.sequence=p,a&&(_.width=m*h,_.height=g*h),this.linkedMeshes.push(new PC(_,c,r,d,f)),_):null}case at.Path:{const l=t.readBoolean(),u=t.readBoolean(),c=t.readInt(!0),d=this.readVertices(t,c),f=B.newArray(c/3,0);for(let g=0,_=f.length;g<_;g++)f[g]=t.readFloat()*h;const p=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=u,m.worldVerticesLength=c<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&X.rgba8888ToColor(m.color,p),m):null}case at.Point:{const l=t.readFloat(),u=t.readFloat(),c=t.readFloat(),d=a?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=u*h,f.y=c*h,f.rotation=l,a&&X.rgba8888ToColor(f.color,d),f):null}case at.Clipping:{const l=t.readInt(!0),u=t.readInt(!0),c=this.readVertices(t,u),d=a?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,o);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,a&&X.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Ju(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?U0:t.readByte()}readVertices(t,e){const s=this.scale,r=e<<1,n=new RC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,s),n;const a=new Array,h=new Array;for(let o=0;o<e;o++){const l=t.readInt(!0);h.push(l);for(let u=0;u<l;u++)h.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=B.toFloatArray(a),n.bones=h,n}readFloatArray(t,e,s){const r=new Array(e);if(s==1)for(let n=0;n<e;n++)r[n]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const r=new Array,n=this.scale;for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case GC:{const _=new v0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());r.push(_);break}case XC:{const _=t.readInt(!0),x=new m0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let T=0,A=0;x.setFrame(T,y,v,b,w,E),T!=g;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(T);break;case Ms:ct(t,x,A++,T,0,y,I,v,M,1),ct(t,x,A++,T,1,y,I,b,R,1),ct(t,x,A++,T,2,y,I,w,C,1),ct(t,x,A++,T,3,y,I,E,P,1)}y=I,v=M,b=R,w=C,E=P}r.push(x);break}case $C:{const _=t.readInt(!0),x=new g0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,y,v,b,w),E!=g;E++){const A=t.readFloat(),I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(E);break;case Ms:ct(t,x,T++,E,0,y,A,v,I,1),ct(t,x,T++,E,1,y,A,b,M,1),ct(t,x,T++,E,2,y,A,w,R,1)}y=A,v=I,b=M,w=R}r.push(x);break}case YC:{const _=t.readInt(!0),x=new y0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,R=0;x.setFrame(M,y,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(M);break;case Ms:ct(t,x,R++,M,0,y,C,v,P,1),ct(t,x,R++,M,1,y,C,b,k,1),ct(t,x,R++,M,2,y,C,w,U,1),ct(t,x,R++,M,3,y,C,E,V,1),ct(t,x,R++,M,4,y,C,T,L,1),ct(t,x,R++,M,5,y,C,A,$,1),ct(t,x,R++,M,6,y,C,I,O,1)}y=C,v=P,b=k,w=U,E=V,T=L,A=$,I=O}r.push(x);break}case HC:{const _=t.readInt(!0),x=new x0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,v,b,w,E,T,A),I!=g;I++){const R=t.readFloat(),C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(I);break;case Ms:ct(t,x,M++,I,0,y,R,v,C,1),ct(t,x,M++,I,1,y,R,b,P,1),ct(t,x,M++,I,2,y,R,w,k,1),ct(t,x,M++,I,3,y,R,E,U,1),ct(t,x,M++,I,4,y,R,T,V,1),ct(t,x,M++,I,5,y,R,A,L,1)}y=R,v=C,b=P,w=k,E=U,T=V,A=L}r.push(x);break}case WC:{const _=new _0(m,t.readInt(!0),c);let x=t.readFloat(),y=t.readUnsignedByte()/255;for(let v=0,b=0;_.setFrame(v,x,y),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:_.setStepped(v);break;case Ms:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}r.push(_)}}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case MC:r.push(Rr(t,new n0(m,g,c),1));break;case FC:r.push(od(t,new o0(m,g,c),n));break;case kC:r.push(Rr(t,new a0(m,g,c),n));break;case BC:r.push(Rr(t,new l0(m,g,c),n));break;case DC:r.push(od(t,new h0(m,g,c),1));break;case OC:r.push(Rr(t,new c0(m,g,c),1));break;case LC:r.push(Rr(t,new u0(m,g,c),1));break;case NC:r.push(od(t,new d0(m,g,c),1));break;case VC:r.push(Rr(t,new f0(m,g,c),1));break;case UC:r.push(Rr(t,new p0(m,g,c),1))}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new T0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat()*n;for(let x=0,y=0;p.setFrame(x,m,g,_,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Rs:p.setStepped(x);break;case Ms:ct(t,p,y++,x,0,m,v,g,b,1),ct(t,p,y++,x,1,m,v,_,w,n)}m=v,g=b,_=w}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new A0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,_,x,y,v,b),w!=f;w++){const T=t.readFloat(),A=t.readFloat(),I=t.readFloat(),M=t.readFloat(),R=t.readFloat(),C=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Rs:p.setStepped(w);break;case Ms:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,_,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,y,R,1),ct(t,p,E++,w,4,m,T,v,C,1),ct(t,p,E++,w,5,m,T,b,P,1)}m=T,g=A,_=I,x=M,y=R,v=C,b=P}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case jC:r.push(Rr(t,new S0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case qC:r.push(Rr(t,new C0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Ps.Length||d.spacingMode==Ps.Fixed?n:1));break;case ZC:const m=new I0(t.readInt(!0),t.readInt(!0),c);let g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,_,x,y),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Rs:m.setStepped(v);break;case Ms:ct(t,m,b++,v,0,g,E,_,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,y,I,1)}g=E,_=T,x=A,y=I}r.push(m)}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const _=t.readStringRef();if(!_)throw new Error("attachmentName must not be null.");const x=c.getAttachment(p,_),y=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(y){case U0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new b0(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,U=t.readInt(!0);if(U==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(U+=L,n==1)for(let $=L;$<U;$++)k[$]=t.readFloat();else for(let $=L;$<U;$++)k[$]=t.readFloat()*n;if(!E)for(let $=0,O=k.length;$<O;$++)k[$]+=T[$]}if(M.setFrame(C,R,k),C==b)break;const V=t.readFloat();switch(t.readByte()){case Rs:M.setStepped(C);break;case Ms:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}r.push(M);break}case zC:{const w=new Fo(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,i0[A&15],A>>4,t.readFloat())}r.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new rd(a),u=s.slots.length;for(let c=0;c<a;c++){const d=t.readFloat(),f=t.readInt(!0),p=B.newArray(u,0);for(let x=u-1;x>=0;x--)p[x]=-1;const m=B.newArray(u-f,0);let g=0,_=0;for(let x=0;x<f;x++){const y=t.readInt(!0);for(;g!=y;)m[_++]=g++;p[g+t.readInt(!0)]=g++}for(;g<u;)m[_++]=g++;for(let x=u-1;x>=0;x--)p[x]==-1&&(p[x]=m[--_]);l.setFrame(c,d,p)}r.push(l)}const h=t.readInt(!0);if(h>0){const l=new sd(h);for(let u=0;u<h;u++){const c=t.readFloat(),d=s.events[t.readInt(!0)],f=new M0(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():d.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(u,f)}r.push(l)}let o=0;for(let l=0,u=r.length;l<u;l++)o=Math.max(o,r[l].getDuration());return new td(e,r,o)}}V0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let PC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};class RC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Rr(i,t,e){let s=i.readFloat(),r=i.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,r),n!=h;n++){const o=i.readFloat(),l=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(n);break;case Ms:ct(i,t,a++,n,0,s,o,r,l,e)}s=o,r=l}return t}function od(i,t,e){let s=i.readFloat(),r=i.readFloat()*e,n=i.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,r,n),a!=o;a++){const l=i.readFloat(),u=i.readFloat()*e,c=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(a);break;case Ms:ct(i,t,h++,a,0,s,l,r,u,e),ct(i,t,h++,a,1,s,l,n,c,e)}s=l,r=u,n=c}return t}function ct(i,t,e,s,r,n,a,h,o,l){t.setBezier(e,s,r,n,h,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,a,o)}const MC=0,FC=1,kC=2,BC=3,DC=4,OC=5,LC=6,NC=7,VC=8,UC=9,GC=0,XC=1,$C=2,YC=3,HC=4,WC=5,U0=0,zC=1,jC=0,qC=1,ZC=2,Rs=1,Ms=2;class ad{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new D0,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const a=s.version.substr(0,3);if(a!=="4.0"&&a!=="4.1"){const h=`Spine 4.1 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(h)}s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=F(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new R0(s.bones.length,h.name,o);u.length=F(h,"length",0)*e,u.x=F(h,"x",0)*e,u.y=F(h,"y",0)*e,u.rotation=F(h,"rotation",0),u.scaleX=F(h,"scaleX",1),u.scaleY=F(h,"scaleY",1),u.shearX=F(h,"shearX",0),u.shearY=F(h,"shearY",0),u.transformMode=B.enumValue(xt,F(h,"transform","Normal")),u.skinRequired=F(h,"skin",!1);const c=F(h,"color",null);c&&u.color.setFromString(c),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=s.findBone(h.bone);if(!o)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new O0(s.slots.length,h.name,o),u=F(h,"color",null);u&&l.color.setFromString(u);const c=F(h,"dark",null);c&&(l.darkColor=X.fromString(c)),l.attachmentName=F(h,"attachment",null),l.blendMode=ad.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new k0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(c==null)throw new Error(`IK bone not found: ${u}`);o.bones.push(c)}o.target=s.findBone(h.target),o.mix=F(h,"mix",1),o.softness=F(h,"softness",0)*e,o.bendDirection=F(h,"bendPositive",!0)?1:-1,o.compress=F(h,"compress",!1),o.stretch=F(h,"stretch",!1),o.uniform=F(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new L0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findBone(l);if(!u)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);o.target=u,o.local=F(h,"local",!1),o.relative=F(h,"relative",!1),o.offsetRotation=F(h,"rotation",0),o.offsetX=F(h,"x",0)*e,o.offsetY=F(h,"y",0)*e,o.offsetScaleX=F(h,"scaleX",0),o.offsetScaleY=F(h,"scaleY",0),o.offsetShearY=F(h,"shearY",0),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),o.mixScaleX=F(h,"mixScaleX",1),o.mixScaleY=F(h,"mixScaleY",o.mixScaleX),o.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new B0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findSlot(l);if(!u)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);o.target=u,o.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),o.spacingMode=B.enumValue(Ps,F(h,"spacingMode","Length")),o.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),o.offsetRotation=F(h,"rotation",0),o.position=F(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=F(h,"spacing",0),(o.spacingMode==Ps.Length||o.spacingMode==Ps.Fixed)&&(o.spacing*=e),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new nd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(!c)throw new Error(`Couldn't find bone ${u} for skin ${h.name}.`);o.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=h.ik[l],c=s.findIkConstraint(u);if(!c)throw new Error(`Couldn't find IK constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=h.transform[l],c=s.findTransformConstraint(u);if(!c)throw new Error(`Couldn't find transform constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const u=h.path[l],c=s.findPathConstraint(u);if(!c)throw new Error(`Couldn't find path constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}for(const l in h.attachments){const u=s.findSlot(l);if(!u)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin?s.findSkin(o.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(!u)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.timelineAttachment=o.inheritTimeline?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new F0(a);o.intValue=F(h,"int",0),o.floatValue=F(h,"float",0),o.stringValue=F(h,"string",""),o.audioPath=F(h,"audio",null),o.audioPath&&(o.volume=F(h,"volume",1),o.balance=F(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=F(t,"name",r),F(t,"type","region")){case"region":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,r,h,o);if(!l)return null;l.path=h,l.x=F(t,"x",0)*a,l.y=F(t,"y",0)*a,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*a,l.height=t.height*a,l.sequence=o;const u=F(t,"color",null);return u&&l.color.setFromString(u),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"mesh":case"linkedmesh":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,r,h,o);if(!l)return null;l.path=h;const u=F(t,"color",null);u&&l.color.setFromString(u),l.width=F(t,"width",0)*a,l.height=F(t,"height",0)*a,l.sequence=o;const c=F(t,"parent",null);if(c)return this.linkedMeshes.push(new KC(l,F(t,"skin",null),s,c,F(t,"timelines",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,r);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,h,o<<1);const l=B.newArray(o/3,0);for(let c=0;c<t.lengths.length;c++)l[c]=t.lengths[c]*a;h.lengths=l;const u=F(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,r);if(!h)return null;h.x=F(t,"x",0)*a,h.y=F(t,"y",0)*a,h.rotation=F(t,"rotation",0);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,r);if(!h)return null;const o=F(t,"end",null);if(o!=null){const c=n.findSlot(o);if(c==null)throw new Error(`Clipping end slot not found: ${o}`);h.endSlot=c}const l=t.vertexCount;this.readVertices(t,h,l<<1);const u=F(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return null;const e=new Ju(F(t,"count",0));return e.start=F(t,"start",1),e.digits=F(t,"digits",0),e.setupIndex=F(t,"setup",0),e}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const o=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const u=l.index;for(const c in o){const d=o[c];if(!d)continue;const f=d.length;if(c=="attachment"){const p=new v0(f,u);for(let m=0;m<f;m++){const g=d[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(c=="rgba"){const p=new m0(f,f<<2,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b,_.a);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1),y=pt(E,p,y,x,3,g,b,_.a,w.a,1)),g=b,_=w,m=v}n.push(p)}else if(c=="rgb"){const p=new g0(f,f*3,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1)),g=b,_=w,m=v}n.push(p)}else if(c=="alpha")n.push(cr(d,new _0(f,f,u),0,1));else if(c=="rgba2"){const p=new y0(f,f*7,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,_.a,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,_.a,E.a,1),v=pt(A,p,v,y,4,g,w,x.r,T.r,1),v=pt(A,p,v,y,5,g,w,x.g,T.g,1),v=pt(A,p,v,y,6,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}else if(c=="rgb2"){const p=new x0(f,f*6,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,x.r,T.r,1),v=pt(A,p,v,y,4,g,w,x.g,T.g,1),v=pt(A,p,v,y,5,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const o=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const u=l.index;for(const c in o){const d=o[c],f=d.length;if(f!=0){if(c==="rotate")n.push(cr(d,new n0(f,f,u),0,1));else if(c==="translate"){const p=new o0(f,f<<1,u);n.push(ld(d,p,"x","y",0,r))}else if(c==="translatex"){const p=new a0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="translatey"){const p=new l0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="scale"){const p=new h0(f,f<<1,u);n.push(ld(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new c0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="scaley"){const p=new u0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="shear"){const p=new d0(f,f<<1,u);n.push(ld(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new f0(f,f,u);n.push(cr(d,p,0,1))}else if(c==="sheary"){const p=new p0(f,f,u);n.push(cr(d,p,0,1))}}}}if(t.ik)for(const h in t.ik){const o=t.ik[h];let l=o[0];if(!l)continue;const u=s.findIkConstraint(h);if(!u)throw new Error(`IK Constraint not found: ${h}`);const c=s.ikConstraints.indexOf(u),d=new T0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*r;for(let g=0,_=0;;g++){d.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=o[g+1];if(!x){d.shrink(_);break}const y=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*r,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,r)),f=y,p=v,m=b,l=x}n.push(d)}if(t.transform)for(const h in t.transform){const o=t.transform[h];let l=o[0];if(!l)continue;const u=s.findTransformConstraint(h);if(!u)throw new Error(`Transform constraint not found: ${h}`);const c=s.transformConstraints.indexOf(u),d=new A0(o.length,o.length*6,c);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),_=F(l,"mixScaleX",1),x=F(l,"mixScaleY",_);const y=F(l,"mixShearY",1);for(let v=0,b=0;;v++){d.setFrame(v,f,p,m,g,_,x,y);const w=o[v+1];if(!w){d.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=F(w,"mixScaleX",1),R=F(w,"mixScaleY",M),C=F(w,"mixShearY",1),P=l.curve;P&&(b=pt(P,d,b,v,0,f,E,p,T,1),b=pt(P,d,b,v,1,f,E,m,A,1),b=pt(P,d,b,v,2,f,E,g,I,1),b=pt(P,d,b,v,3,f,E,_,M,1),b=pt(P,d,b,v,4,f,E,x,R,1),b=pt(P,d,b,v,5,f,E,y,C,1)),f=E,p=T,m=A,g=I,_=M,x=R,_=M,l=w}n.push(d)}if(t.path)for(const h in t.path){const o=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const u=s.pathConstraints.indexOf(l);for(const c in o){const d=o[c];let f=d[0];if(!f)continue;const p=d.length;if(c==="position"){const m=new S0(p,p,u);n.push(cr(d,m,0,l.positionMode==ne.Fixed?r:1))}else if(c==="spacing"){const m=new C0(p,p,u);n.push(cr(d,m,0,l.spacingMode==Ps.Length||l.spacingMode==Ps.Fixed?r:1))}else if(c==="mix"){const m=new I0(p,p*3,u);let g=F(f,"time",0),_=F(f,"mixRotate",1),x=F(f,"mixX",1),y=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,_,x,y);const w=d[v+1];if(!w){m.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=f.curve;M&&(b=pt(M,m,b,v,0,g,E,_,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,y,I,1)),g=E,_=T,x=A,y=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const o=t.deform[h],l=t.attachments[h]={};for(const u in o){const c=o[u],d=l[u]={};for(const f in c)d[f]={deform:c[f]}}}}if(t.attachments)for(const h in t.attachments){const o=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const u in o){const c=o[u],d=s.findSlot(u);if(!d)throw new Error(`Slot not found: ${u}`);const f=d.index;for(const p in c){const m=c[p],g=l.getAttachment(f,p);for(const _ in m){const x=m[_];let y=x[0];if(y){if(_=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new b0(x.length,x.length,f,g);let T=F(y,"time",0);for(let A=0,I=0;;A++){let M;const R=F(y,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const U=F(y,"offset",0);if(B.arrayCopy(R,0,M,U,R.length),r!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=r;if(!v)for(let V=0;V<w;V++)M[V]+=b[V]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=y.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,y=C}n.push(E)}else if(_=="sequence"){const v=new Fo(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(y,"delay",b),T=F(y,"time",0),A=Pr[F(y,"mode","hold")],I=F(y,"index",0);v.setFrame(w,T,A,I,E),b=E,y=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new rd(t.drawOrder.length),o=s.slots.length;let l=0;for(let u=0;u<t.drawOrder.length;u++,l++){const c=t.drawOrder[u];let d=null;const f=F(c,"offsets",null);if(f){d=B.newArray(o,-1);const p=B.newArray(o-f.length,0);let m=0,g=0;for(let _=0;_<f.length;_++){const x=f[_],y=s.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);const v=y.index;for(;m!=v;)p[g++]=m++;d[m+x.offset]=m++}for(;m<o;)p[g++]=m++;for(let _=o-1;_>=0;_--)d[_]==-1&&(d[_]=p[--g])}h.setFrame(l,F(c,"time",0),d)}n.push(h)}if(t.events){const h=new sd(t.events.length);let o=0;for(let l=0;l<t.events.length;l++,o++){const u=t.events[l],c=s.findEvent(u.name);if(!c)throw new Error(`Event not found: ${u.name}`);const d=new M0(B.toSinglePrecision(F(u,"time",0)),c);d.intValue=F(u,"int",c.intValue),d.floatValue=F(u,"float",c.floatValue),d.stringValue=F(u,"string",c.stringValue),d.data.audioPath&&(d.volume=F(u,"volume",1),d.balance=F(u,"balance",0)),h.setFrame(o,d)}n.push(h)}let a=0;for(let h=0,o=n.length;h<o;h++)a=Math.max(a,n[h].getDuration());if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new td(e,n,a))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}}class KC{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}}function cr(i,t,e,s){let r=i[0],n=F(r,"time",0),a=F(r,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=i[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;r.curve&&(h=pt(r.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,r=l}}function ld(i,t,e,s,r,n){let a=i[0],h=F(a,"time",0),o=F(a,e,r)*n,l=F(a,s,r)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=i[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,r)*n,m=F(d,s,r)*n,g=a.curve;g&&(u=pt(g,t,u,c,0,h,f,o,p,n),u=pt(g,t,u,c,1,h,f,l,m,n)),h=f,o=p,l=m,a=d}}function pt(i,t,e,s,r,n,a,h,o,l){if(i=="stepped")return t.setStepped(s),e;const u=r<<2,c=i[u],d=i[u+1]*l,f=i[u+2],p=i[u+3]*l;return t.setBezier(e,s,r,n,h,c,d,f,p,a,o),e+1}function F(i,t,e){return i[t]!==void 0?i[t]:e}var ai=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VER37=37]="VER37",i[i.VER38=38]="VER38",i[i.VER40=40]="VER40",i[i.VER41=41]="VER41",i))(ai||{});function hd(i){const t=i.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:e<37?37:0}class QC{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=hd(r);if(n===ai.VER38&&(s=new le(new N_(t))),r=this.readVersionNewFormat(e),n=hd(r),(n===ai.VER40||n===ai.VER41)&&(s=new V0(new P0(t))),!s){const a=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new gl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new gl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class JC{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=hd(s);let n=null;if(r===ai.VER37&&(n=new CC(new _C(t))),r===ai.VER38&&(n=new QS(new N_(t))),(r===ai.VER40||r===ai.VER41)&&(n=new ad(new P0(t))),!n){const a=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(a)}return n.scale=this.scale,n.readSkeletonData(e)}}class tI extends rC{createBinaryParser(){return new QC}createJsonParser(){return new JC}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new tI().installLoader();class eI extends tC{constructor(t,e){const{followPointList:s,visible:r=!1}=e||{};let n;typeof t=="string"?n=Gr.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(a=>{a.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(a.boneName),follow:a.follow,onUpdate:a.onUpdate,angleFollow:a.angleFollow||!1,scaleFollow:a.scaleFollow||!0})})),this._loopFn=this._loop.bind(this),Tt.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{s()}}})}addAnimation(t="animation",e=!1,s=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){Tt.system.remove(this._loopFn),this.destroy()}_loop(){this.update(Tt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:r,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=r),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,s+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{bt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Mr=(i,t,e,s=!1)=>{i.cursor="pointer",i.eventMode="static";const r=n=>{n.button!==2&&e(n)};s?i.once(t,r):i.on(t,r)};class sI extends Bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=r,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Mr(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mr(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,r&&(this._btn.tint=r))})}toggleTexture(t,e){this._texture=t,this._hoverTexture=e,this._btn._texture=e}setDisabled(t){this.disabled=t,this._btn.tint=t?this._disabledColor:this._tintColor||"#fff",this._btn.texture=this._texture}}class rI extends Ao{constructor(t){const{sprite:e,onClick:s}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Mr(this,"pointerenter",()=>{bt.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Mr(this,"pointerleave",()=>{e.alpha=1,bt.to(e,{duration:.25,rotation:0})}),Mr(this,"pointerdown",()=>{e.alpha=.5}),Mr(this,"pointerup",()=>{s()})}}class iI extends Bt{constructor(t){super(),this._maskUI=new du({bgColor:"#000",width:1080,height:1920}),this.addChild(this._maskUI),this._maskUI.alpha=0,this._maskUI.eventMode="static",this._drawerContainer=t,this.addChild(this._drawerContainer),this._drawerContainer.y=this._maskUI.height,bt.to(this._maskUI,{duration:.25,alpha:.5}),bt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){bt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await bt.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class nI extends Bt{constructor(t){super(),this.COLLECT_TIME=5*1e3,this._nowTime=0,this._lastTime=0,this._drawCount=0,this._maxDrawCount=0,this._tempMaxDrawCount=0,this._lastCollectTime=0,this._paramTxts=[];for(let e=0;e<3;e++){const s=new Nu({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=s,s.x=0,s.y=s.height*e,this.addChild(s),s.alpha=.75}this._renderer=t.renderer,this._drawElements=this._renderer.gl.drawElements,this.init()}init(){this._renderer.gl.drawElements=(...t)=>{this._drawElements.call(this._renderer.gl,...t),this._drawCount++},Tt.shared.add(()=>{const t=Tt.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTxtInfo(0,Math.floor(t).toFixed(0)),this._lastTime=this._nowTime),this._nowTime-this._lastCollectTime<this.COLLECT_TIME?this._tempMaxDrawCount<this._drawCount&&(this._tempMaxDrawCount=this._drawCount):(this._maxDrawCount=this._tempMaxDrawCount,this._tempMaxDrawCount=0,this._lastCollectTime=this._nowTime),this._setTxtInfo(1,this._drawCount),this._setTxtInfo(2,this._maxDrawCount),this._drawCount=0},Vr.UTILITY)}_setTxtInfo(t,e){const s=a=>{this._paramTxts[t].style.fill="#fff",a<=30&&(this._paramTxts[t].style.fill="yellow"),a<=20&&(this._paramTxts[t].style.fill="red")},r=a=>{this._paramTxts[t].style.fill="#fff",a>=75&&(this._paramTxts[t].style.fill="yellow"),a>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(s(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class oI extends Bt{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:r,barHeight:n,bgTexture:a,barTexture:h}=t,o=new qe(a);this.addChild(o),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(s-n)/2;const l=new Ks;l.beginFill(16777215),l.drawRect(0,0,0,this._progressBar.height),l.endFill(),this._progressBar.addChild(l),this._progressBar.mask=l,this._maskGraphics=l}setProgress(t){const e=Math.max(0,Math.min(1,t));this._maskGraphics.clear(),this._maskGraphics.beginFill(16777215),this._maskGraphics.drawRect(0,0,this._progressBar.width*e,this._progressBar.height),this._maskGraphics.endFill()}}class aI extends Ao{constructor(t){const{width:e,height:s,scrollContent:r,bottomMargin:n=50}=t;if(super(e,s),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=r,this._content=new Bt,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new qe;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new Ks,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,s),this._maskGraphics.endFill(),this.mask=this._maskGraphics,this.eventMode="static",this.on("pointerdown",this._onDragStart,this),this.on("pointermove",this._onDragMove,this),this.on("pointerup",this._onDragEnd,this),this.on("pointerupoutside",this._onDragEnd,this),this.on("wheel",this._onWheelScroll,this)}setDimensions(t,e){this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,t,e),this._maskGraphics.endFill(),this.setSize(t,e)}scrollToTop(){this._content.y=0}addContent(t){this._scrollContent.addChild(t)}_onDragStart(t){if(this._content.height<=this._maskGraphics.height)return;const e=t.getLocalPosition(this);this._startY=e.y-this._content.y,this._isDragging=!0,this._velocity=0,this._startTime=Date.now(),this._startPosition=this._content.y,bt.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const s=t.getLocalPosition(this).y-this._startY;this._content.y=s}}_onDragEnd(){this._isDragging=!1;const e=Date.now()-this._startTime;e<250?(this._velocity=(this._content.y-this._startPosition)/e,this._applyInertia()):this._velocity=0,this._limitScrollRange()}_onWheelScroll(t){if(this._content.height<=this._maskGraphics.height)return;let e=this._content.y-t.deltaY*(this._scrollSpeed/100);e>0?e=0:Math.abs(e)>=this._content.height-this._maskGraphics.height&&(e=-(this._content.height-this._maskGraphics.height)),bt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){bt.to(this._content,{y:this._content.y+this._velocity*250,duration:.5,ease:"power1.out",onUpdate:this._limitScrollRange.bind(this)})}_limitScrollRange(){if(this._content.y>0)bt.to(this._content,{duration:.75,y:0,ease:"elastic.out"});else if(Math.abs(this._content.y)>=this._content.height-this._maskGraphics.height)if(this._content.height>this._maskGraphics.height){const t=-(this._content.height-this._maskGraphics.height);bt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else bt.to(this._content,{duration:.25,y:0})}}class lI extends Ao{constructor(t){const{width:e,height:s,content:r,slideCallback:n,scrollCallback:a,pageNum:h,pageHeight:o}=t;super(e,s),this._currentIndex=0,this._scrollHeight=0,this._slideHeight=0,this._startY=0,this._offsetY=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1;const l=new Ks;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=o,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=h-1,this.addChild(this._slideArea),this._slideArea.x=e/2,this._slideArea.y=this._scrollHeight/2,this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}updatePosition(t,e){this._slideArea.y=t,this._currentIndex=e}slideTo(t,e=!0){var s;t<0?(bt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(bt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,bt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:e?.25:.01,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}})),(s=this._slideCallback)==null||s.call(this,this._currentIndex)}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,bt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var s;if(!this._isDragging)return;const e=t.pageY-this._startY;this._slideArea.y=this._offsetY+e,(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startY-t.pageY,r=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||r>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}}const G0=i=>{const t=new Ks;return t.beginFill(16777215),t.drawRect(0,0,i.width,i.height),t.endFill(),i.addChild(t),i.mask=t,t};class hI extends Ao{constructor(t,e,s,r){super(t,e),this._currentIndex=0,this._slideWidth=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,G0(this),this._slideWidth=t,this._slideArea=s,this.slideCallback=r,this._pageNum=Math.floor(s.width/this._slideWidth)-1,this.addChild(s),this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}prev(){this._slideTo(this._currentIndex-1)}next(){this._slideTo(this._currentIndex+1)}_slideTo(t){t<0?(bt.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(bt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,bt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,bt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){if(!this._isDragging)return;const e=t.pageX-this._startX;this._slideArea.x=this._offsetX+e}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,r=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||r>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class cI{constructor(t,e){this._currentIndex=0,this._numsLength=0,this._isDown=!1,this._onChange=e,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}class uI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new cI(s,a=>{this._onAmountIndex(a),this.minMaxUpdateIndex(a)}),this.minMaxUpdateIndex(e),this._baseNumSteper.updateIndex(e)}min(){this.minMaxUpdateIndex(0),this._onAmountIndex(0)}max(){const t=this._betAmountListLength-1;this.minMaxUpdateIndex(t),this._onAmountIndex(t)}sub(){this._baseNumSteper.down("sub")}add(){this._baseNumSteper.down("add")}minMaxUpdateIndex(t){t===0?this._onDisabled("min"):t===this._betAmountListLength-1?this._onDisabled("max"):this._onDisabled(),this._baseNumSteper.updateIndex(t)}}const X0=(i,t,e)=>{const s=t/i.width*i.scale.x,r=e?e/i.height*i.scale.y:s,n=Math.min(s,r);i.scale.set(n>1?1:n)};class dI extends Bt{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:r=100,fontColor:n="#B4B4B8",fontSize:a=24,lineWidth:h=3,lineColor:o="#B4B4B8"}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=r,this._fontColor=n,this._fontSize=a,this._lineWidth=h,this._lineColor=o,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new Ks;s.lineStyle(this._lineWidth,this._lineColor),s.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)s.moveTo(0,r*this._cellHeight),s.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)s.moveTo(r*this._cellWidth,0),s.lineTo(r*this._cellWidth,e);this.addChild(s)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const s=this._data[t][e];this._createNumberText(s,e,t)}}_createNumberText(t,e,s){const r=new za(t.toString(),{_fontSize:this._fontSize,fill:this._fontColor}),n=e*this._cellWidth+this._cellWidth/2,a=s*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),X0(r,this._cellWidth*.9)}}var cd={};/*!
1169
+ */class ir{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:v_(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let r;const{value:n,time:a}=s[0],h=r=new ir(typeof n=="string"?pl(n):n,a,t.ease);if(s.length>2||s.length===2&&s[1].value!==n)for(let o=1;o<s.length;++o){const{value:l,time:u}=s[o];r.next=new ir(typeof l=="string"?pl(l):l,u),r=r.next}return h.isStepped=!!t.isStepped,h}const e=new ir(typeof t.start=="string"?pl(t.start):t.start,0);return t.end!==t.start&&(e.next=new ir(typeof t.end=="string"?pl(t.end):t.end,1)),e}}let So=q.from;const nr=Math.PI/180;function Ar(i,t){if(!i)return;const e=Math.sin(i),s=Math.cos(i),r=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=r,t.y=n}function fl(i,t,e){return i<<16|t<<8|e}function y_(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function ES(i){const t=1/y_(i);i.x*=t,i.y*=t}function x_(i,t){i.x*=t,i.y*=t}function pl(i,t){t||(t={}),i.charAt(0)==="#"?i=i.substr(1):i.indexOf("0x")===0&&(i=i.substr(2));let e;return i.length===8&&(e=i.substr(0,2),i=i.substr(2)),t.r=parseInt(i.substr(0,2),16),t.g=parseInt(i.substr(2,2),16),t.b=parseInt(i.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function v_(i){const t=i.length,e=1/t;return function(s){const r=t*s|0,n=(s-r*e)*t,a=i[r]||i[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function TS(i){return i?(i=i.toUpperCase().replace(/ /g,"_"),W[i]||W.NORMAL):W.NORMAL}class fu extends qe{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 Ft;(function(i){i[i.Spawn=0]="Spawn",i[i.Normal=2]="Normal",i[i.Late=5]="Late"})(Ft||(Ft={}));const pu=Tt.shared,Vi=Symbol("Position particle per emitter position");class wt{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 st,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new st,this._prevEmitterPos=new st,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){wt.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){typeof t=="number"&&t>0?this._frequency=t:this._frequency=1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase=typeof t.ease=="function"?t.ease:v_(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance=typeof t.spawnChance=="number"&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=t.emit===void 0?!0:!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map(s=>{const r=wt.knownBehaviors[s.type];return r?new r(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Vi),e.sort((s,r)=>s===Vi?r.order===Ft.Spawn?1:-1:r===Vi?s.order===Ft.Spawn?-1:1:s.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Vi&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Vi&&s.recycleParticle)}getBehavior(t){return wt.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof wt.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new fu(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let s=0;s<this.recycleBehaviors.length;++s)this.recycleBehaviors[s].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,Ar(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?pu.remove(this.update,this):!this._autoUpdate&&t&&pu.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=pu.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,h;a;a=h)if(h=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let o=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?o=this.customEase(o,0,1,1):o=this.customEase(o)),a.agePercent=o;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,s;this._prevPosIsValid&&(e=this._prevEmitterPos.x,s=this._prevEmitterPos.y);const r=this.ownerPos.x+this.spawnPos.x,n=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let a,h;if(this._prevPosIsValid&&this._posChanged){const u=1+this._spawnTimer/t;a=(r-e)*u+e,h=(n-s)*u+s}else a=r,h=n;let o=null,l=null;for(let u=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),c=0;c<u;++c){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let d;if(this.minLifetime===this.maxLifetime?d=this.minLifetime:d=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=d)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new fu(this),f.init(d),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),o?(l.next=f,f.prev=l,l=f):l=o=f,++this.particleCount}if(o){this._activeParticlesLast?(this._activeParticlesLast.next=o,o.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=o,this._activeParticlesLast=l);for(let u=0;u<this.initBehaviors.length;++u){const c=this.initBehaviors[u];if(c===Vi)for(let d=o,f;d;d=f){f=d.next,this.rotation!==0&&(Ar(this.rotation,d.position),d.rotation+=this.rotation),d.position.x+=a,d.position.y+=h,d.age+=-this._spawnTimer;let p=d.age*d.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),d.agePercent=p}else c.initParticles(o)}for(let u=o,c;u;u=c){c=u.next;for(let d=0;d<this.updateBehaviors.length;++d)if(this.updateBehaviors[d].updateParticle(u,-this._spawnTimer)){this.recycle(u);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=r,this._prevEmitterPos.y=n,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const a=this._completeCallback;this._completeCallback=null,a()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let s=null,r=null;for(let n=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),a=0;a<n;++a){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let h;this._poolFirst?(h=this._poolFirst,this._poolFirst=this._poolFirst.next,h.next=null):h=new fu(this);let o;this.minLifetime===this.maxLifetime?o=this.minLifetime:o=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,h.init(o),this.addAtBack?this._parent.addChildAt(h,0):this._parent.addChild(h),s?(r.next=h,h.prev=r,r=h):r=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=s,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Vi)for(let h=s,o;h;h=o)o=h.next,this.rotation!==0&&(Ar(this.rotation,h.position),h.rotation+=this.rotation),h.position.x+=t,h.position.y+=e;else a.initParticles(s)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){this.autoUpdate=!1,this.cleanup();let t;for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}wt.knownBehaviors={};class mu{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}}mu.type="rect",mu.editorConfig=null;class ml{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),Ar(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}ml.type="torus",ml.editorConfig=null;class gu{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(!t||!t.length)this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});else if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const s=t[e];let r=s[0];for(let n=1;n<s.length;++n){const a=s[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let s=1;s<t.length;++s){const r=t[s];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:r}=this.segments[e],n=Math.sqrt((r.x-s.x)*(r.x-s.x)+(r.y-s.y)*(r.y-s.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let s,r;if(this.segments.length===1)s=this.segments[0],r=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],r=h===0?e:e-this.countingLengths[h-1];break}r/=s.l||1;const{p1:n,p2:a}=s;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}gu.type="polygonalChain",gu.editorConfig=null;class _u{constructor(t){var e;this.order=Ft.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=(e=t.maxSpeed)!==null&&e!==void 0?e:0}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,r=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const a=y_(s);a>this.maxSpeed&&x_(s,this.maxSpeed/a)}t.x+=(r+s.x)/2*e,t.y+=(n+s.y)/2*e,this.rotate&&(t.rotation=Math.atan2(s.y,s.x))}}_u.type="moveAcceleration",_u.editorConfig=null;function AS(i){return this.ease&&(i=this.ease(i)),(this.first.next.value-this.first.value)*i+this.first.value}function SS(i){this.ease&&(i=this.ease(i));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*i+t.r,r=(e.g-t.g)*i+t.g,n=(e.b-t.b)*i+t.b;return fl(s,r,n)}function CS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;return i=(i-t.time)/(e.time-t.time),(e.value-t.value)*i+t.value}function IS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;i=(i-t.time)/(e.time-t.time);const s=t.value,r=e.value,n=(r.r-s.r)*i+s.r,a=(r.g-s.g)*i+s.g,h=(r.b-s.b)*i+s.b;return fl(n,a,h)}function PS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;return t.value}function RS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;const e=t.value;return fl(e.r,e.g,e.b)}class Co{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?SS:AS:t.isStepped?this.interpolate=this.isColor?RS:PS:this.interpolate=this.isColor?IS:CS,this.ease=this.first.ease}}class yu{constructor(t){this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.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)}}yu.type="alpha",yu.editorConfig=null;class xu{constructor(t){this.order=Ft.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}xu.type="alphaStatic",xu.editorConfig=null;function b_(i){const t=[];for(let e=0;e<i.length;++e){let s=i[e];if(typeof s=="string")t.push(So(s));else if(s instanceof q)t.push(s);else{let r=s.count||1;for(typeof s.texture=="string"?s=So(s.texture):s=s.texture;r>0;--r)t.push(s)}}return t}class vu{constructor(t){this.order=Ft.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const s=t.anims[e],r=b_(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!s.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[s];e.texture=r.textures[0],e.config.animElapsed=0,r.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=r.textures.length/e.maxLife):(e.config.animDuration=r.duration,e.config.animFramerate=r.framerate),e=e.next}}updateParticle(t,e){const s=t.config,r=s.anim;s.animElapsed+=e,s.animElapsed>=s.animDuration&&(s.anim.loop?s.animElapsed=s.animElapsed%s.animDuration:s.animElapsed=s.animDuration-1e-6);const n=s.animElapsed*s.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||q.EMPTY}}vu.type="animatedRandom",vu.editorConfig=null;class bu{constructor(t){this.order=Ft.Normal;const e=t.anim,s=b_(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:r>0?s.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const s=this.anim;for(;e;)e.texture=s.textures[0],e.config.animElapsed=0,s.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=s.textures.length/e.maxLife):(e.config.animDuration=s.duration,e.config.animFramerate=s.framerate),e=e.next}updateParticle(t,e){const s=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(s.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}bu.type="animatedSingle",bu.editorConfig=null;class wu{constructor(t){this.order=Ft.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=TS(this.value),e=e.next}}wu.type="blendMode",wu.editorConfig=null;class Eu{constructor(t){this.order=Ft.Spawn,this.spacing=t.spacing*nr,this.start=t.start*nr,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,s.rotation=r,this.distance&&(s.position.x=this.distance,Ar(r,s.position)),s=s.next,++e}}}Eu.type="spawnBurst",Eu.editorConfig=null;class Tu{constructor(t){this.order=Ft.Normal,this.list=new Co(!0),this.list.reset(ir.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,r=fl(s.r,s.g,s.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}Tu.type="color",Tu.editorConfig=null;class Au{constructor(t){this.order=Ft.Normal;let e=t.color;e.charAt(0)==="#"?e=e.substr(1):e.indexOf("0x")===0&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}Au.type="colorStatic",Au.editorConfig=null;class Su{constructor(t){this.order=Ft.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}Su.type="textureOrdered",Su.editorConfig=null;const In=new st,w_=["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"],MS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(w_).join("|"),"g");function FS(i){const t=i.match(MS);for(let e=t.length-1;e>=0;--e)w_.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return i=t.join(""),new Function("x",`return ${i};`)}class Cu{constructor(t){var e;if(this.order=Ft.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=FS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new st(e.x,e.y),e.config.movement=0;const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=s*e,In.x=t.config.movement,In.y=this.path(In.x),Ar(t.config.initRotation,In),t.position.x=t.config.initPosition.x+In.x,t.position.y=t.config.initPosition.y+In.y}}Cu.type="movePath",Cu.editorConfig=null;class Iu{constructor(){this.order=Ft.Spawn}initParticles(t){}}Iu.type="spawnPoint",Iu.editorConfig=null;class Pu{constructor(t){this.order=Ft.Normal,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[s],e=e.next}}}Pu.type="textureRandom",Pu.editorConfig=null;class Ru{constructor(t){this.order=Ft.Normal,this.minStart=t.minStart*nr,this.maxStart=t.maxStart*nr,this.minSpeed=t.minSpeed*nr,this.maxSpeed=t.maxSpeed*nr,this.accel=t.accel*nr}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 s=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+s)/2*e}else t.rotation+=t.config.rotSpeed*e}}Ru.type="rotation",Ru.editorConfig=null;class Mu{constructor(t){this.order=Ft.Normal,this.min=t.min*nr,this.max=t.max*nr}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}}Mu.type="rotationStatic",Mu.editorConfig=null;class Fu{constructor(t){this.order=Ft.Late+1,this.rotation=(t.rotation||0)*nr}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Fu.type="noRotation",Fu.editorConfig=null;class ku{constructor(t){var e;this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=s,e.scale.x=e.scale.y=this.list.first.value*s,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}ku.type="scale",ku.editorConfig=null;class Bu{constructor(t){this.order=Ft.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=s,e=e.next}}}Bu.type="scaleStatic",Bu.editorConfig=null;class Ss{constructor(t){this.order=Ft.Spawn;const e=Ss.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){Ss.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Ss.type="spawnShape",Ss.editorConfig=null,Ss.shapes={},Ss.registerShape(gu),Ss.registerShape(mu),Ss.registerShape(ml),Ss.registerShape(ml,"circle");class Du{constructor(t){this.order=Ft.Normal,this.texture=typeof t.texture=="string"?So(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Du.type="textureSingle",Du.editorConfig=null;class Ou{constructor(t){var e;this.order=Ft.Late,this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e.config.velocity?e.config.velocity.set(this.list.first.value*s,0):e.config.velocity=new st(this.list.first.value*s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;ES(r),x_(r,s),t.x+=r.x*e,t.y+=r.y*e}}Ou.type="moveSpeed",Ou.editorConfig=null;class Lu{constructor(t){this.order=Ft.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity;t.x+=s.x*e,t.y+=s.y*e}}Lu.type="moveSpeedStatic",Lu.editorConfig=null,wt.registerBehavior(_u),wt.registerBehavior(yu),wt.registerBehavior(xu),wt.registerBehavior(vu),wt.registerBehavior(bu),wt.registerBehavior(wu),wt.registerBehavior(Eu),wt.registerBehavior(Tu),wt.registerBehavior(Au),wt.registerBehavior(Su),wt.registerBehavior(Cu),wt.registerBehavior(Iu),wt.registerBehavior(Pu),wt.registerBehavior(Ru),wt.registerBehavior(Mu),wt.registerBehavior(Fu),wt.registerBehavior(ku),wt.registerBehavior(Bu),wt.registerBehavior(Ss),wt.registerBehavior(Du),wt.registerBehavior(Ou),wt.registerBehavior(Lu);class Nu extends za{constructor(t){const{text:e,fontSize:s=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:h,fontFamily:o="MicrosoftYaHei",fontWeight:l="normal",wordWrap:u=!1,wordWrapWidth:c=100,lineHeight:d=1.25,align:f="left",indent:p=0,shadow:m}=t,g=new vr({fontSize:s,wordWrap:u,wordWrapWidth:c,fontWeight:l,lineHeight:d*s,breakWords:u,fill:r,align:f,fontFamily:o,stroke:n?a:"transparent",strokeThickness:n?h:0,lineJoin:"round"});m&&(g.dropShadow=!0,g.dropShadowColor=m[0],g.dropShadowAngle=m[1]*(Math.PI/180),g.dropShadowBlur=m[2],g.dropShadowDistance=m[3]),super(e,g),this.position.x=p*s}}class kS extends Bt{constructor(t){super();const{start:e,control:s,end:r,json:n,duration:a,ease:h="power1.out",showControl:o=!1,loop:l=!1}=t;this._particleContainer=new MT,this.addChild(this._particleContainer);const u=new wt(this._particleContainer,n),c=this._createBezierPoints([e,...s,r],100,o),d={pathThrough:0};xt.to(d,{duration:a,pathThrough:c.length-1,repeat:l?-1:0,ease:h,onStart:()=>{u.emit=!0},onUpdate:()=>{const p=Math.floor(d.pathThrough),m=c[p];u.updateOwnerPos(m.x,m.y)},onComplete:()=>{xt.to(this,{alpha:0,duration:.5,onComplete:()=>{u.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new Tt;f.add(()=>{u.update(1/75)}),f.start()}_createBezierPoints(t,e,s){const r=[];s&&t.forEach((n,a)=>{const h=new Nu({text:a+1,fontSize:16});h.position.set(n.x,n.y),this.addChild(h)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const s=t.length;let r=0,n=0;const a=[];for(let h=0;h<s;h++)a[h]=this._binomial(s-1,h);for(let h=0;h<s;h++){const o=t[h],l=a[h],u=Math.pow(e,h),c=Math.pow(1-e,s-1-h);r+=o.x*c*u*l,n+=o.y*c*u*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let r=1;r<=e;r++)s=s*(t-r+1)/r;return s}}var at=(i=>(i[i.Region=0]="Region",i[i.BoundingBox=1]="BoundingBox",i[i.Mesh=2]="Mesh",i[i.LinkedMesh=3]="LinkedMesh",i[i.Path=4]="Path",i[i.Point=5]="Point",i[i.Clipping=6]="Clipping",i))(at||{});class gl{constructor(t,e=new Array,s=0,r=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return e&128&&(e=this.readByte(),s|=(e&127)<<7,e&128&&(e=this.readByte(),s|=(e&127)<<14,e&128&&(e=this.readByte(),s|=(e&127)<<21,e&128&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(r),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(i=>(i[i.setup=0]="setup",i[i.first=1]="first",i[i.replace=2]="replace",i[i.add=3]="add",i))(S||{}),At=(i=>(i[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",i))(At||{}),ne=(i=>(i[i.Fixed=0]="Fixed",i[i.Percent=1]="Percent",i))(ne||{}),Fe=(i=>(i[i.Tangent=0]="Tangent",i[i.Chain=1]="Chain",i[i.ChainScale=2]="ChainScale",i))(Fe||{}),vt=(i=>(i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection",i))(vt||{});function E_(i){switch(i.toLowerCase()){case"nearest":return Ye.Nearest;case"linear":return Ye.Linear;case"mipmap":return Ye.MipMap;case"mipmapnearestnearest":return Ye.MipMapNearestNearest;case"mipmaplinearnearest":return Ye.MipMapLinearNearest;case"mipmapnearestlinear":return Ye.MipMapNearestLinear;case"mipmaplinearlinear":return Ye.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${i}`)}}var Ye=(i=>(i[i.Nearest=9728]="Nearest",i[i.Linear=9729]="Linear",i[i.MipMap=9987]="MipMap",i[i.MipMapNearestNearest=9984]="MipMapNearestNearest",i[i.MipMapLinearNearest=9985]="MipMapLinearNearest",i[i.MipMapNearestLinear=9986]="MipMapNearestLinear",i[i.MipMapLinearLinear=9987]="MipMapLinearLinear",i))(Ye||{}),Ui=(i=>(i[i.MirroredRepeat=33648]="MirroredRepeat",i[i.ClampToEdge=33071]="ClampToEdge",i[i.Repeat=10497]="Repeat",i))(Ui||{});class Vu{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}}class BS{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Uu{constructor(t,e,s){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,s)}addTexture(t,e){const s=this.pages;let r=null;for(let a=0;a<s.length;a++)if(s[a].baseTexture===e.baseTexture){r=s[a];break}if(r===null){r=new T_,r.name="texturePage";const a=e.baseTexture;r.width=a.realWidth,r.height=a.realHeight,r.baseTexture=a,r.minFilter=r.magFilter=Ye.Nearest,r.uWrap=Ui.ClampToEdge,r.vWrap=Ui.ClampToEdge,s.push(r)}const n=new A_;return n.name=t,n.page=r,n.texture=e,n.index=-1,this.regions.push(n),n}addTextureHash(t,e){for(const s in t)t.hasOwnProperty(s)&&this.addTexture(e&&s.indexOf(".")!==-1?s.substr(0,s.lastIndexOf(".")):s,t[s])}addSpineAtlas(t,e,s){return this.load(t,e,s)}load(t,e,s){if(e==null)throw new Error("textureLoader cannot be null.");const r=new DS(t),n=new Array(4);let a=null;const h={};let o=null;h.size=()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},h.format=()=>{},h.filter=()=>{a.minFilter=E_(n[1]),a.magFilter=E_(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(a.uWrap=Ui.Repeat),n[1].indexOf("y")!=-1&&(a.vWrap=Ui.Repeat)},h.pma=()=>{a.pma=n[1]=="true"};const l={};l.xy=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2])},l.size=()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},l.bounds=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2]),o.width=parseInt(n[3]),o.height=parseInt(n[4])},l.offset=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2])},l.orig=()=>{o.originalWidth=parseInt(n[1]),o.originalHeight=parseInt(n[2])},l.offsets=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2]),o.originalWidth=parseInt(n[3]),o.originalHeight=parseInt(n[4])},l.rotate=()=>{const d=n[1];let f=0;d.toLocaleLowerCase()=="true"?f=6:d.toLocaleLowerCase()=="false"?f=0:f=(720-parseFloat(d))%360/45,o.rotate=f},l.index=()=>{o.index=parseInt(n[1])};let u=r.readLine();for(;u!=null&&u.trim().length==0;)u=r.readLine();for(;!(u==null||u.trim().length==0||r.readEntry(n,u)==0);)u=r.readLine();const c=()=>{for(;;){if(u==null)return s&&s(this);if(u.trim().length==0)a=null,u=r.readLine();else if(a===null){for(a=new T_,a.name=u.trim();r.readEntry(n,u=r.readLine())!=0;){const d=h[n[0]];d&&d()}this.pages.push(a),e(a.name,d=>{if(d===null)return this.pages.splice(this.pages.indexOf(a),1),s&&s(null);a.baseTexture=d,a.pma&&(d.alphaMode=Re.PMA),d.valid||d.setSize(a.width,a.height),a.setFilters(),(!a.width||!a.height)&&(a.width=d.realWidth,a.height=d.realHeight,(!a.width||!a.height)&&console.log(`ERROR spine atlas page ${a.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),c()});break}else{o=new BS;const d=new A_;d.name=u,d.page=a;let f=null,p=null;for(;;){const v=r.readEntry(n,u=r.readLine());if(v==0)break;const b=l[n[0]];if(b)b();else{f==null&&(f=[],p=[]),f.push(n[0]);const w=[];for(let E=0;E<v;E++)w.push(parseInt(n[E+1]));p.push(w)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height);const m=a.baseTexture.resolution;o.x/=m,o.y/=m,o.width/=m,o.height/=m,o.originalWidth/=m,o.originalHeight/=m,o.offsetX/=m,o.offsetY/=m;const g=o.rotate%4!==0,_=new rt(o.x,o.y,g?o.height:o.width,g?o.width:o.height),x=new rt(0,0,o.originalWidth,o.originalHeight),y=new rt(o.offsetX,o.originalHeight-o.height-o.offsetY,o.width,o.height);d.texture=new q(d.page.baseTexture,_,x,y,o.rotate),d.index=o.index,d.texture.updateUvs(),this.regions.push(d)}}};c()}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].baseTexture.dispose()}}class DS{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(e==null||(e=e.trim(),e.length==0))return 0;const s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let r=1,n=s+1;;r++){const a=e.indexOf(",",n);if(a==-1)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,a-n).trim(),n=a+1,r==4)return 4}}}class T_{constructor(){this.minFilter=Ye.Nearest,this.magFilter=Ye.Nearest,this.uWrap=Ui.ClampToEdge,this.vWrap=Ui.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==Ye.Linear?t.scaleMode=je.LINEAR:this.minFilter==Ye.Nearest?t.scaleMode=je.NEAREST:(t.mipmap=xs.POW2,e==Ye.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class A_ extends Vu{}class OS{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class LS{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Gi=class{constructor(i=0,t=0,e=0,s=0){this.r=i,this.g=t,this.b=e,this.a=s}set(i,t,e,s){return this.r=i,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(i){return this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this}setFromString(i){return i=i.charAt(0)=="#"?i.substr(1):i,this.r=parseInt(i.substr(0,2),16)/255,this.g=parseInt(i.substr(2,2),16)/255,this.b=parseInt(i.substr(4,2),16)/255,this.a=i.length!=8?1:parseInt(i.substr(6,2),16)/255,this}add(i,t,e,s){return this.r+=i,this.g+=t,this.b+=e,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(i,t){i.r=((t&4278190080)>>>24)/255,i.g=((t&16711680)>>>16)/255,i.b=((t&65280)>>>8)/255,i.a=(t&255)/255}static rgb888ToColor(i,t){i.r=((t&16711680)>>>16)/255,i.g=((t&65280)>>>8)/255,i.b=(t&255)/255}static fromString(i){return new Gi().setFromString(i)}};let X=Gi;X.WHITE=new Gi(1,1,1,1),X.RED=new Gi(1,0,0,1),X.GREEN=new Gi(0,1,0,1),X.BLUE=new Gi(0,0,1,1),X.MAGENTA=new Gi(1,0,1,1);const Sr=class{static clamp(i,t,e){return i<t?t:i>e?e:i}static cosDeg(i){return Math.cos(i*Sr.degRad)}static sinDeg(i){return Math.sin(i*Sr.degRad)}static signum(i){return Math.sign(i)}static toInt(i){return i>0?Math.floor(i):Math.ceil(i)}static cbrt(i){const t=Math.pow(Math.abs(i),.3333333333333333);return i<0?-t:t}static randomTriangular(i,t){return Sr.randomTriangularWith(i,t,(i+t)*.5)}static randomTriangularWith(i,t,e){const s=Math.random(),r=t-i;return s<=(e-i)/r?i+Math.sqrt(s*r*(e-i)):t-Math.sqrt((1-s)*r*(t-e))}static isPowerOfTwo(i){return i&&(i&i-1)===0}};let D=Sr;D.PI=3.1415927,D.PI2=Sr.PI*2,D.radiansToDegrees=180/Sr.PI,D.radDeg=Sr.radiansToDegrees,D.degreesToRadians=Sr.PI/180,D.degRad=Sr.degreesToRadians;class NS{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class VS extends NS{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class S_ extends VS{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Pn=class{static arrayCopy(i,t,e,s,r){for(let n=t,a=s;n<t+r;n++,a++)e[a]=i[n]}static arrayFill(i,t,e,s){for(let r=t;r<e;r++)i[r]=s}static setArraySize(i,t,e=0){const s=i.length;if(s==t)return i;if(i.length=t,s<t)for(let r=s;r<t;r++)i[r]=e;return i}static ensureArrayCapacity(i,t,e=0){return i.length>=t?i:Pn.setArraySize(i,t,e)}static newArray(i,t){const e=new Array(i);for(let s=0;s<i;s++)e[s]=t;return e}static newFloatArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(i){return Pn.SUPPORTS_TYPED_ARRAYS?new Float32Array(i):i}static toSinglePrecision(i){return Pn.SUPPORTS_TYPED_ARRAYS?Math.fround(i):i}static webkit602BugfixHelper(i,t){}static contains(i,t,e=!0){for(let s=0;s<i.length;s++)if(i[s]==t)return!0;return!1}static enumValue(i,t){return i[t[0].toUpperCase()+t.slice(1)]}};let B=Pn;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class US{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class GS{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}}const XS={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},ti=[0,0,0];class $S extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class YS extends RT{constructor(t,e,s,r,n){super(t,e,s,r,n),this.region=null,this.attachment=null}}const C_=class extends Bt{constructor(i){if(super(),!i)throw new Error("The spineData param is required.");if(typeof i=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=i,this.createSkeleton(i),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],r=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===at.Region){const a=r.name,h=this.createSprite(s,r,a);s.currentSprite=h,s.currentSpriteName=a,n.addChild(h)}else if(r.type===at.Mesh){const a=this.createMesh(s,r);s.currentMesh=a,s.currentMeshId=r.id,s.currentMeshName=r.name,n.addChild(a)}else r.type===at.Clipping&&(this.createGraphics(s,r),n.addChild(s.clippingContainer),n.addChild(s.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(i){var t;i!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),i==null||i.registerSpine(this),this._debug=i)}get autoUpdate(){return this._autoUpdate}set autoUpdate(i){i!==this._autoUpdate&&(this._autoUpdate=i,this.updateTransform=i?C_.prototype.autoUpdateTransform:Bt.prototype.updateTransform)}get tint(){return eo(this.tintRgb)}set tint(i){this.tintRgb=sp(i,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:XS.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(i){var l;const t=this.delayLimit;if(i>t&&(i=t),this.state.update(i),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let r=null,n=null;s?(r=s.light,n=s.dark):r=this.tintRgb;for(let u=0,c=e.length;u<c;u++){const d=e[u],f=d.getAttachment(),p=this.slotContainers[u];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(d,f);let g=f.region;const _=f.color;switch(f!=null&&f.type){case at.Region:if(p.transform.setFromMatrix(d.bone.matrix),g=f.region,d.currentMesh&&(d.currentMesh.visible=!1,d.currentMesh=null,d.currentMeshId=void 0,d.currentMeshName=void 0),!g){d.currentSprite&&(d.currentSprite.renderable=!1);break}if(!d.currentSpriteName||d.currentSpriteName!==f.name){const v=f.name;if(d.currentSprite&&(d.currentSprite.visible=!1),d.sprites=d.sprites||{},d.sprites[v]!==void 0)d.sprites[v].visible=!0;else{const b=this.createSprite(d,f,v);p.addChild(b)}d.currentSprite=d.sprites[v],d.currentSpriteName=v}d.currentSprite.renderable=!0,d.hackRegion||this.setSpriteRegion(f,d.currentSprite,g),d.currentSprite.color?m=d.currentSprite.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentSprite.tint=eo(ti)),d.currentSprite.blendMode=d.blendMode;break;case at.Mesh:if(d.currentSprite){d.currentSprite.visible=!1,d.currentSprite=null,d.currentSpriteName=void 0;const v=new ma;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!g){d.currentMesh&&(d.currentMesh.renderable=!1);break}const y=f.id;if(d.currentMeshId===void 0||d.currentMeshId!==y){const v=y;if(d.currentMesh&&(d.currentMesh.visible=!1),d.meshes=d.meshes||{},d.meshes[v]!==void 0)d.meshes[v].visible=!0;else{const b=this.createMesh(d,f);p.addChild(b)}d.currentMesh=d.meshes[v],d.currentMeshName=f.name,d.currentMeshId=v}d.currentMesh.renderable=!0,f.computeWorldVerticesOld(d,d.currentMesh.vertices),d.currentMesh.color?m=d.currentMesh.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentMesh.tint=eo(ti)),d.currentMesh.blendMode=d.blendMode,d.hackRegion||this.setMeshRegion(f,d.currentMesh,g);break;case at.Clipping:d.currentGraphics||(this.createGraphics(d,f),p.addChild(d.clippingContainer),p.addChild(d.currentGraphics)),this.updateGraphics(d,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=d.color.r*_.r,y=d.color.g*_.g,v=d.color.b*_.b;m.setLight(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v)),d.darkColor?(x=d.darkColor.r,y=d.darkColor.g,v=d.darkColor.b):(x=0,y=0,v=0),m.setDark(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v))}p.alpha=d.color.a}const a=this.skeleton.drawOrder;let h=null,o=null;for(let u=0,c=a.length;u<c;u++){const d=e[a[u].data.index],f=this.slotContainers[a[u].data.index];if(o||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),d.currentGraphics&&d.getAttachment())o=d.clippingContainer,h=d.getAttachment(),o.children.length=0,this.children[u]=f,h.endSlot===d.data&&(h.endSlot=null);else if(o){let p=this.tempClipContainers[u];p||(p=this.tempClipContainers[u]=this.newContainer(),p.visible=!1),this.children[u]=p,f.parent=null,o.addChild(f),h.endSlot==d.data&&(o.renderable=!0,o=null,h=null)}else this.children[u]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,t.rotation=i.rotation*D.degRad,t.position.x=i.x,t.position.y=i.y,t.alpha=i.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=i.scaleX*i.width/e.originalWidth,t.scale.y=-i.scaleY*i.height/e.originalHeight))}setMeshRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(i.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const i=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(i)}Bt.prototype.updateTransform.call(this)}createSprite(i,t,e){let s=t.region;i.hackAttachment===t&&(s=i.hackRegion);const r=s?s.texture:null,n=this.newSprite(r);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),i.sprites=i.sprites||{},i.sprites[e]=n,n}createMesh(i,t){let e=t.region;i.hackAttachment===t&&(e=i.hackRegion,i.hackAttachment=null,i.hackRegion=null);const s=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),ys.TRIANGLES);return typeof s._canvasPadding<"u"&&(s._canvasPadding=1.5),s.alpha=t.color.a,s.region=t.region,e&&this.setMeshRegion(t,s,e),i.meshes=i.meshes||{},i.meshes[t.id]=s,s}createGraphics(i,t){const e=this.newGraphics(),s=new Nr([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,i.currentGraphics=e,i.clippingContainer=this.newContainer(),i.clippingContainer.mask=i.currentGraphics,e}updateGraphics(i,t){const e=i.currentGraphics.geometry,s=e.graphicsData[0].shape.points,r=t.worldVerticesLength;s.length=r,t.computeWorldVertices(i,0,r,s,0,2),e.invalidate()}hackTextureBySlotIndex(i,t=null,e=null){const s=this.skeleton.slots[i];if(!s)return!1;const r=s.getAttachment();let n=r.region;return t?(n=new Vu,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=r):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(r,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(r,s.currentMesh,n),!0}hackTextureBySlotName(i,t=null,e=null){const s=this.skeleton.findSlotIndex(i);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(i,t,e,s=null){const r=this.skeleton.findSlotIndex(i),n=this.skeleton.getAttachmentByName(i,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const h=a.getAttachment();if(t===h.name){let o=n.region;return e?(o=new Vu,o.texture=e,o.size=s,a.hackRegion=o,a.hackAttachment=h):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=o?(this.setSpriteRegion(h,a.currentSprite,o),a.currentSprite.region=o):a.currentMesh&&a.currentMesh.region!=o&&this.setMeshRegion(h,a.currentMesh,o),!0}return!1}newContainer(){return new Bt}newSprite(i){return new $S(i)}newGraphics(){return new Ks}newMesh(i,t,e,s,r){return new YS(i,t,e,s,r)}transformHack(){return 1}hackAttachmentGroups(i,t,e){if(!i)return;const s=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const h=this.skeleton.slots[n],o=h.currentSpriteName||h.currentMeshName||"",l=h.currentSprite||h.currentMesh;o.endsWith(i)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,r]}destroy(i){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const r in s.meshes)s.meshes[r].destroy(i);s.meshes=null;for(const r in s.sprites)s.sprites[r].destroy(i);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(i);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(i)}};let Gu=C_;Gu.clippingPolygon=[],Object.defineProperty(Gu.prototype,"visible",{get(){return this._visible},set(i){i!==this._visible&&(this._visible=i,i&&(this.lastTime=0))}});let I_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const P_=class extends I_{constructor(t){super(t),this.id=(P_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.deform;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}copyTo(t){this.bones!=null?(t.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices!=null?(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment}};let Xi=P_;Xi.nextID=0;let HS=class ay extends Xi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new ay(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},WS=class ly extends Xi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new ly(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Xu=class wd extends Xi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.tempColor=new X(0,0,0,0)}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();const t=new wd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new wd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(this.parentMesh!=null?this.parentMesh:this),t}},_l=class hy extends Xi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new hy(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},zS=class cy extends Xi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new cy(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},R_=class{constructor(t,e){if(this.deform=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};const _e=class extends I_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[_e.OX1]=u-f,x[_e.OY1]=d+c,x[_e.OX2]=u-_,x[_e.OY2]=g+c,x[_e.OX3]=p-_,x[_e.OY3]=g+m,x[_e.OX4]=p-f,x[_e.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof R_?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[_e.OX1],p=n[_e.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX4],p=n[_e.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}copy(){const t=new _e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,B.arrayCopy(this.uvs,0,t.uvs,0,8),B.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t}};let it=_e;it.OX1=0,it.OY1=1,it.OX2=2,it.OY2=3,it.OX3=4,it.OY3=5,it.OX4=6,it.OY4=7,it.X1=0,it.Y1=1,it.C1R=2,it.C1G=3,it.C1B=4,it.C1A=5,it.U1=6,it.V1=7,it.X2=8,it.Y2=9,it.C2R=10,it.C2G=11,it.C2B=12,it.C2A=13,it.U2=14,it.V2=15,it.X3=16,it.Y3=17,it.C3R=18,it.C3G=19,it.C3B=20,it.C3A=21,it.U3=22,it.V3=23,it.X4=24,it.Y4=25,it.C4R=26,it.C4G=27,it.C4B=28,it.C4A=29,it.U4=30,it.V4=31,new S_(2);let oe=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(let r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const ee=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=B.newFloatArray((t-1)*ee.BEZIER_SIZE)}getFrameCount(){return this.curves.length/ee.BEZIER_SIZE+1}setLinear(t){this.curves[t*ee.BEZIER_SIZE]=ee.LINEAR}setStepped(t){this.curves[t*ee.BEZIER_SIZE]=ee.STEPPED}getCurveType(t){const e=t*ee.BEZIER_SIZE;if(e==this.curves.length)return ee.LINEAR;const s=this.curves[e];return s==ee.LINEAR?ee.LINEAR:s==ee.STEPPED?ee.STEPPED:ee.BEZIER}setCurve(t,e,s,r,n){const a=(-e*2+r)*.03,h=(-s*2+n)*.03,o=((e-r)*3+1)*.006,l=((s-n)*3+1)*.006;let u=a*2+o,c=h*2+l,d=e*.3+a+o*.16666667,f=s*.3+h+l*.16666667,p=t*ee.BEZIER_SIZE;const m=this.curves;m[p++]=ee.BEZIER;let g=d,_=f;for(let x=p+ee.BEZIER_SIZE-1;p<x;p+=2)m[p]=g,m[p+1]=_,d+=u,f+=c,u+=o,c+=l,g+=d,_+=f}getCurvePercent(t,e){e=D.clamp(e,0,1);const s=this.curves;let r=t*ee.BEZIER_SIZE;const n=s[r];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;r++;let a=0;for(let o=r,l=r+ee.BEZIER_SIZE-1;r<l;r+=2)if(a=s[r],a>=e){let u,c;return r==o?(u=0,c=0):(u=s[r-2],c=s[r-1]),c+(s[r+1]-c)*(e-u)/(a-u)}const h=s[r-1];return h+(1-h)*(e-a)/(1-a)}};let es=ee;es.LINEAR=0,es.STEPPED=1,es.BEZIER=2,es.BEZIER_SIZE=10*2-1;const ei=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+ei.ROTATION]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotation=l.data.rotation;return;case S.first:const m=l.data.rotation-l.rotation;l.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*n}return}if(s>=o[o.length-ei.ENTRIES]){let m=o[o.length+ei.PREV_ROTATION];switch(a){case S.setup:l.rotation=l.data.rotation+m*n;break;case S.first:case S.replace:m+=l.data.rotation-l.rotation,m-=(16384-(16384.499999999996-m/360|0))*360;case S.add:l.rotation+=m*n}return}const u=oe.binarySearch(o,s,ei.ENTRIES),c=o[u+ei.PREV_ROTATION],d=o[u],f=this.getCurvePercent((u>>1)-1,1-(s-d)/(o[u+ei.PREV_TIME]-d));let p=o[u+ei.ROTATION]-c;switch(p=c+(p-(16384-(16384.499999999996-p/360|0))*360)*f,a){case S.setup:l.rotation=l.data.rotation+(p-(16384-(16384.499999999996-p/360|0))*360)*n;break;case S.first:case S.replace:p+=l.data.rotation-l.rotation;case S.add:l.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*n}}};let Ie=ei;Ie.ENTRIES=2,Ie.PREV_TIME=-2,Ie.PREV_ROTATION=-1,Ie.ROTATION=1;const ke=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*ke.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,r){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.x=l.data.x,l.y=l.data.y;return;case S.first:l.x+=(l.data.x-l.x)*n,l.y+=(l.data.y-l.y)*n}return}let u=0,c=0;if(s>=o[o.length-ke.ENTRIES])u=o[o.length+ke.PREV_X],c=o[o.length+ke.PREV_Y];else{const d=oe.binarySearch(o,s,ke.ENTRIES);u=o[d+ke.PREV_X],c=o[d+ke.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ke.ENTRIES-1,1-(s-f)/(o[d+ke.PREV_TIME]-f));u+=(o[d+ke.X]-u)*p,c+=(o[d+ke.Y]-c)*p}switch(a){case S.setup:l.x=l.data.x+u*n,l.y=l.data.y+c*n;break;case S.first:case S.replace:l.x+=(l.data.x+u-l.x)*n,l.y+=(l.data.y+c-l.y)*n;break;case S.add:l.x+=u*n,l.y+=c*n}}};let fs=ke;fs.ENTRIES=3,fs.PREV_TIME=-3,fs.PREV_X=-2,fs.PREV_Y=-1,fs.X=1,fs.Y=2;let M_=class ks extends fs{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-ks.ENTRIES])u=o[o.length+ks.PREV_X]*l.data.scaleX,c=o[o.length+ks.PREV_Y]*l.data.scaleY;else{const d=oe.binarySearch(o,s,ks.ENTRIES);u=o[d+ks.PREV_X],c=o[d+ks.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ks.ENTRIES-1,1-(s-f)/(o[d+ks.PREV_TIME]-f));u=(u+(o[d+ks.X]-u)*p)*l.data.scaleX,c=(c+(o[d+ks.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},F_=class Bs extends fs{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Bs.ENTRIES])u=o[o.length+Bs.PREV_X],c=o[o.length+Bs.PREV_Y];else{const d=oe.binarySearch(o,s,Bs.ENTRIES);u=o[d+Bs.PREV_X],c=o[d+Bs.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Bs.ENTRIES-1,1-(s-f)/(o[d+Bs.PREV_TIME]-f));u=u+(o[d+Bs.X]-u)*p,c=c+(o[d+Bs.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Xt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Xt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,r,n,a){t*=Xt.ENTRIES,this.frames[t]=e,this.frames[t+Xt.R]=s,this.frames[t+Xt.G]=r,this.frames[t+Xt.B]=n,this.frames[t+Xt.A]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color);return;case S.first:const p=o.color,m=o.data.color;p.add((m.r-p.r)*n,(m.g-p.g)*n,(m.b-p.b)*n,(m.a-p.a)*n)}return}let u=0,c=0,d=0,f=0;if(s>=l[l.length-Xt.ENTRIES]){const p=l.length;u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A]}else{const p=oe.binarySearch(l,s,Xt.ENTRIES);u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A];const m=l[p],g=this.getCurvePercent(p/Xt.ENTRIES-1,1-(s-m)/(l[p+Xt.PREV_TIME]-m));u+=(l[p+Xt.R]-u)*g,c+=(l[p+Xt.G]-c)*g,d+=(l[p+Xt.B]-d)*g,f+=(l[p+Xt.A]-f)*g}if(n==1)o.color.set(u,c,d,f);else{const p=o.color;a==S.setup&&p.setFromColor(o.data.color),p.add((u-p.r)*n,(c-p.g)*n,(d-p.b)*n,(f-p.a)*n)}}};let He=Xt;He.ENTRIES=5,He.PREV_TIME=-5,He.PREV_R=-4,He.PREV_G=-3,He.PREV_B=-2,He.PREV_A=-1,He.R=1,He.G=2,He.B=3,He.A=4;const dt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*dt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,r,n,a,h,o,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=r,this.frames[t+dt.B]=n,this.frames[t+dt.A]=a,this.frames[t+dt.R2]=h,this.frames[t+dt.G2]=o,this.frames[t+dt.B2]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case S.first:const _=o.color,x=o.darkColor,y=o.data.color,v=o.data.darkColor;_.add((y.r-_.r)*n,(y.g-_.g)*n,(y.b-_.b)*n,(y.a-_.a)*n),x.add((v.r-x.r)*n,(v.g-x.g)*n,(v.b-x.b)*n,0)}return}let u=0,c=0,d=0,f=0,p=0,m=0,g=0;if(s>=l[l.length-dt.ENTRIES]){const _=l.length;u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2]}else{const _=oe.binarySearch(l,s,dt.ENTRIES);u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2];const x=l[_],y=this.getCurvePercent(_/dt.ENTRIES-1,1-(s-x)/(l[_+dt.PREV_TIME]-x));u+=(l[_+dt.R]-u)*y,c+=(l[_+dt.G]-c)*y,d+=(l[_+dt.B]-d)*y,f+=(l[_+dt.A]-f)*y,p+=(l[_+dt.R2]-p)*y,m+=(l[_+dt.G2]-m)*y,g+=(l[_+dt.B2]-g)*y}if(n==1)o.color.set(u,c,d,f),o.darkColor.set(p,m,g,1);else{const _=o.color,x=o.darkColor;a==S.setup&&(_.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),_.add((u-_.r)*n,(c-_.g)*n,(d-_.b)*n,(f-_.a)*n),x.add((p-x.r)*n,(m-x.g)*n,(g-x.b)*n,0)}}};let ae=dt;ae.ENTRIES=8,ae.PREV_TIME=-8,ae.PREV_R=-7,ae.PREV_G=-6,ae.PREV_B=-5,ae.PREV_A=-4,ae.PREV_R2=-3,ae.PREV_G2=-2,ae.PREV_B2=-1,ae.R=1,ae.G=2,ae.B=3,ae.A=4,ae.R2=5,ae.G2=6,ae.B2=7;let Rn=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}const l=this.frames;if(s<l[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}let u=0;s>=l[l.length-1]?u=l.length-1:u=oe.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}setAttachment(t,e,s){e.setAttachment(s==null?null:t.getAttachment(this.slotIndex,s))}},k_=null,B_=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),k_==null&&(k_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!(l instanceof Xi)||l.deformAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;break;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=oe.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},$u=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=oe.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},Io=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=oe.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const mt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*mt.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(t,e,s,r,n,a,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=r,this.frames[t+mt.BEND_DIRECTION]=n,this.frames[t+mt.COMPRESS]=a?1:0,this.frames[t+mt.STRETCH]=h?1:0}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case S.first:l.mix+=(l.data.mix-l.mix)*n,l.softness+=(l.data.softness-l.softness)*n,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}if(s>=o[o.length-mt.ENTRIES]){a==S.setup?(l.mix=l.data.mix+(o[o.length+mt.PREV_MIX]-l.data.mix)*n,l.softness=l.data.softness+(o[o.length+mt.PREV_SOFTNESS]-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0)):(l.mix+=(o[o.length+mt.PREV_MIX]-l.mix)*n,l.softness+=(o[o.length+mt.PREV_SOFTNESS]-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0));return}const u=oe.binarySearch(o,s,mt.ENTRIES),c=o[u+mt.PREV_MIX],d=o[u+mt.PREV_SOFTNESS],f=o[u],p=this.getCurvePercent(u/mt.ENTRIES-1,1-(s-f)/(o[u+mt.PREV_TIME]-f));a==S.setup?(l.mix=l.data.mix+(c+(o[u+mt.MIX]-c)*p-l.data.mix)*n,l.softness=l.data.softness+(d+(o[u+mt.SOFTNESS]-d)*p-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0)):(l.mix+=(c+(o[u+mt.MIX]-c)*p-l.mix)*n,l.softness+=(d+(o[u+mt.SOFTNESS]-d)*p-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0))}};let Pe=mt;Pe.ENTRIES=6,Pe.PREV_TIME=-6,Pe.PREV_MIX=-5,Pe.PREV_SOFTNESS=-4,Pe.PREV_BEND_DIRECTION=-3,Pe.PREV_COMPRESS=-2,Pe.PREV_STRETCH=-1,Pe.MIX=1,Pe.SOFTNESS=2,Pe.BEND_DIRECTION=3,Pe.COMPRESS=4,Pe.STRETCH=5;const $t=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*$t.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,a){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=r,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=a}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s<o[0]){const p=l.data;switch(a){case S.setup:l.rotateMix=p.rotateMix,l.translateMix=p.translateMix,l.scaleMix=p.scaleMix,l.shearMix=p.shearMix;return;case S.first:l.rotateMix+=(p.rotateMix-l.rotateMix)*n,l.translateMix+=(p.translateMix-l.translateMix)*n,l.scaleMix+=(p.scaleMix-l.scaleMix)*n,l.shearMix+=(p.shearMix-l.shearMix)*n}return}let u=0,c=0,d=0,f=0;if(s>=o[o.length-$t.ENTRIES]){const p=o.length;u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR]}else{const p=oe.binarySearch(o,s,$t.ENTRIES);u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR];const m=o[p],g=this.getCurvePercent(p/$t.ENTRIES-1,1-(s-m)/(o[p+$t.PREV_TIME]-m));u+=(o[p+$t.ROTATE]-u)*g,c+=(o[p+$t.TRANSLATE]-c)*g,d+=(o[p+$t.SCALE]-d)*g,f+=(o[p+$t.SHEAR]-f)*g}if(a==S.setup){const p=l.data;l.rotateMix=p.rotateMix+(u-p.rotateMix)*n,l.translateMix=p.translateMix+(c-p.translateMix)*n,l.scaleMix=p.scaleMix+(d-p.scaleMix)*n,l.shearMix=p.shearMix+(f-p.shearMix)*n}else l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n,l.scaleMix+=(d-l.scaleMix)*n,l.shearMix+=(f-l.shearMix)*n}};let We=$t;We.ENTRIES=5,We.PREV_TIME=-5,We.PREV_ROTATE=-4,We.PREV_TRANSLATE=-3,We.PREV_SCALE=-2,We.PREV_SHEAR=-1,We.ROTATE=1,We.TRANSLATE=2,We.SCALE=3,We.SHEAR=4;const Cs=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Cs.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Cs.ENTRIES,this.frames[t]=e,this.frames[t+Cs.VALUE]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.position=l.data.position;return;case S.first:l.position+=(l.data.position-l.position)*n}return}let u=0;if(s>=o[o.length-Cs.ENTRIES])u=o[o.length+Cs.PREV_VALUE];else{const c=oe.binarySearch(o,s,Cs.ENTRIES);u=o[c+Cs.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/Cs.ENTRIES-1,1-(s-d)/(o[c+Cs.PREV_TIME]-d));u+=(o[c+Cs.VALUE]-u)*f}a==S.setup?l.position=l.data.position+(u-l.data.position)*n:l.position+=(u-l.position)*n}};let Cr=Cs;Cr.ENTRIES=2,Cr.PREV_TIME=-2,Cr.PREV_VALUE=-1,Cr.VALUE=1;let D_=class ci extends Cr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ci.ENTRIES])u=o[o.length+ci.PREV_VALUE];else{const c=oe.binarySearch(o,s,ci.ENTRIES);u=o[c+ci.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ci.ENTRIES-1,1-(s-d)/(o[c+ci.PREV_TIME]-d));u+=(o[c+ci.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Be=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Be.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,r){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotateMix=l.data.rotateMix,l.translateMix=l.data.translateMix;return;case S.first:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*n,l.translateMix+=(l.data.translateMix-l.translateMix)*n}return}let u=0,c=0;if(s>=o[o.length-Be.ENTRIES])u=o[o.length+Be.PREV_ROTATE],c=o[o.length+Be.PREV_TRANSLATE];else{const d=oe.binarySearch(o,s,Be.ENTRIES);u=o[d+Be.PREV_ROTATE],c=o[d+Be.PREV_TRANSLATE];const f=o[d],p=this.getCurvePercent(d/Be.ENTRIES-1,1-(s-f)/(o[d+Be.PREV_TIME]-f));u+=(o[d+Be.ROTATE]-u)*p,c+=(o[d+Be.TRANSLATE]-c)*p}a==S.setup?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*n):(l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n)}};let or=Be;or.ENTRIES=3,or.PREV_TIME=-3,or.PREV_ROTATE=-2,or.PREV_TRANSLATE=-1,or.ROTATE=1,or.TRANSLATE=2;const Yt=class{constructor(i){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new O_(this),this.propertyIDs=new OS,this.animationsChanged=!1,this.trackEntryPool=new US(()=>new Yu),this.data=i}update(i){i*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=i*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let a=r.next;if(a!=null){const h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(h/r.timeScale+i)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=i,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){t[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,i)){let h=r.mixingFrom;for(r.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(i,t){const e=i.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,i.mixTime>0&&i.mixTime>=i.mixDuration?((e.totalAlpha==0||i.mixDuration==0)&&(i.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=i),i.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,i.mixTime+=t,!1)}apply(i){if(i==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let a=0,h=e.length;a<h;a++){const o=e[a];if(o==null||o.delay>0)continue;s=!0;const l=a==0?S.first:o.mixBlend;let u=o.alpha;o.mixingFrom!=null?u*=this.applyMixingFrom(o,i,l):o.trackTime>=o.trackEnd&&o.next==null&&(u=0);const c=o.animationLast,d=o.getAnimationTime(),f=o.animation.timelines.length,p=o.animation.timelines;if(a==0&&u==1||l==S.add)for(let m=0;m<f;m++){const g=p[m];g instanceof Rn?this.applyAttachmentTimeline(g,i,d,l,!0):g.apply(i,c,d,t,u,l,At.mixIn)}else{const m=o.timelineMode,g=o.timelinesRotation.length==0;g&&B.setArraySize(o.timelinesRotation,f<<1,null);const _=o.timelinesRotation;for(let x=0;x<f;x++){const y=p[x],v=m[x]==Yt.SUBSEQUENT?l:S.setup;y instanceof Ie?this.applyRotateTimeline(y,i,d,u,v,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,i,d,l,!0):y.apply(i,c,d,t,u,v,At.mixIn)}}this.queueEvents(o,d),t.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Yt.SETUP,n=i.slots;for(let a=0,h=i.slots.length;a<h;a++){const o=n[a];if(o.attachmentState==r){const l=o.data.attachmentName;o.setAttachment(l==null?null:i.getAttachment(o.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(i,t,e){const s=i.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let r=0;i.mixDuration==0?(r=1,e==S.first&&(e=S.setup)):(r=i.mixTime/i.mixDuration,r>1&&(r=1),e!=S.first&&(e=s.mixBlend));const n=r<s.eventThreshold?this.events:null,a=r<s.attachmentThreshold,h=r<s.drawOrderThreshold,o=s.animationLast,l=s.getAnimationTime(),u=s.animation.timelines.length,c=s.animation.timelines,d=s.alpha*i.interruptAlpha,f=d*(1-r);if(e==S.add)for(let p=0;p<u;p++)c[p].apply(t,o,l,n,f,e,At.mixOut);else{const p=s.timelineMode,m=s.timelineHoldMix,g=s.timelinesRotation.length==0;g&&B.setArraySize(s.timelinesRotation,u<<1,null);const _=s.timelinesRotation;s.totalAlpha=0;for(let x=0;x<u;x++){const y=c[x];let v=At.mixOut,b,w=0;switch(p[x]){case Yt.SUBSEQUENT:if(!h&&y instanceof Io)continue;b=e,w=f;break;case Yt.FIRST:b=S.setup,w=f;break;case Yt.HOLD_SUBSEQUENT:b=e,w=d;break;case Yt.HOLD_FIRST:b=S.setup,w=d;break;default:b=S.setup;const E=m[x];w=d*Math.max(0,1-E.mixTime/E.mixDuration);break}s.totalAlpha+=w,y instanceof Ie?this.applyRotateTimeline(y,t,l,w,b,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,t,l,b,a):(h&&y instanceof Io&&b==S.setup&&(v=At.mixIn),y.apply(t,o,l,n,w,b,v))}}return i.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,r}applyAttachmentTimeline(i,t,e,s,r){const n=t.slots[i.slotIndex];if(!n.bone.active)return;const a=i.frames;if(e<a[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let h;e>=a[a.length-1]?h=a.length-1:h=oe.binarySearch(a,e)-1,this.setAttachment(t,n,i.attachmentNames[h],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Yt.SETUP)}setAttachment(i,t,e,s){t.setAttachment(e==null?null:i.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Yt.CURRENT)}applyRotateTimeline(i,t,e,s,r,n,a,h){if(h&&(n[a]=0),s==1){i.apply(t,0,e,null,1,r,At.mixIn);return}const o=i,l=o.frames,u=t.bones[o.boneIndex];if(!u.active)return;let c=0,d=0;if(e<l[0])switch(r){case S.setup:u.rotation=u.data.rotation;default:return;case S.first:c=u.rotation,d=u.data.rotation}else if(c=r==S.setup?u.data.rotation:u.rotation,e>=l[l.length-Ie.ENTRIES])d=u.data.rotation+l[l.length+Ie.PREV_ROTATION];else{const m=oe.binarySearch(l,e,Ie.ENTRIES),g=l[m+Ie.PREV_ROTATION],_=l[m],x=o.getCurvePercent((m>>1)-1,1-(e-_)/(l[m+Ie.PREV_TIME]-_));d=l[m+Ie.ROTATION]-g,d-=(16384-(16384.499999999996-d/360|0))*360,d=g+d*x+u.data.rotation,d-=(16384-(16384.499999999996-d/360|0))*360}let f=0,p=d-c;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,g=0;h?(m=0,g=p):(m=n[a],g=n[a+1]);const _=p>0;let x=m>=0;D.signum(g)!=D.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*D.signum(m)),x=_),f=p+m-m%360,x!=_&&(f+=360*D.signum(m)),n[a]=f}n[a+1]=p,c+=f*s,u.rotation=c-(16384-(16384.499999999996-c/360|0))*360}queueEvents(i,t){const e=i.animationStart,s=i.animationEnd,r=s-e,n=i.trackLast%r,a=this.events;let h=0;const o=a.length;for(;h<o;h++){const u=a[h];if(u.time<n)break;u.time>s||this.queue.event(i,u)}let l=!1;for(i.loop?l=r==0||n>i.trackTime%r:l=t>=s&&i.animationLast<s,l&&this.queue.complete(i);h<o;h++)a[h].time<e||this.queue.event(i,a[h])}clearTracks(){const i=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=i,this.queue.drain()}clearTrack(i){if(i>=this.tracks.length)return;const t=this.tracks[i];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(s==null)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(i,t,e){const s=this.expandToIndex(i);this.tracks[i]=t,s!=null&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom!=null&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(i,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(i,s,e)}setAnimationWith(i,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,r=this.expandToIndex(i);r!=null&&(r.nextTrackLast==-1?(this.tracks[i]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,s=!1):this.disposeNext(r));const n=this.trackEntry(i,t,e,r);return this.setCurrent(i,n,s),this.queue.drain(),n}addAnimation(i,t,e,s){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(i,r,e,s)}addAnimationWith(i,t,e,s){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(i);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(i,t,e,r);if(r==null)this.setCurrent(i,n,!0),this.queue.drain();else if(r.next=n,s<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?s+=a*(1+(r.trackTime/a|0)):s+=Math.max(a,r.trackTime),s-=this.data.getMix(r.animation,t)):s=r.trackTime}return n.delay=s,n}setEmptyAnimation(i,t){const e=this.setAnimationWith(i,Yt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(i,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(i,Yt.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(i){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,i)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(i){return i<this.tracks.length?this.tracks[i]:(B.ensureArrayCapacity(this.tracks,i+1,null),this.tracks.length=i+1,null)}trackEntry(i,t,e,s){const r=this.trackEntryPool.obtain();return r.trackIndex=i,r.animation=t,r.loop=e,r.holdPrevious=!1,r.eventThreshold=0,r.attachmentThreshold=0,r.drawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.interruptAlpha=1,r.mixTime=0,r.mixDuration=s==null?0:this.data.getMix(s.animation,t),r.mixBlend=S.replace,r}disposeNext(i){let t=i.next;for(;t!=null;)this.queue.dispose(t),t=t.next;i.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let i=0,t=this.tracks.length;i<t;i++){let e=this.tracks[i];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=S.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(i){const t=i.mixingTo,e=i.animation.timelines,s=i.animation.timelines.length,r=B.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;const n=B.setArraySize(i.timelineHoldMix,s),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)r[h]=a.add(e[h].getPropertyId())?Yt.HOLD_FIRST:Yt.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const o=e[h],l=o.getPropertyId();if(!a.add(l))r[h]=Yt.SUBSEQUENT;else if(t==null||o instanceof Rn||o instanceof Io||o instanceof $u||!t.animation.hasTimeline(l))r[h]=Yt.FIRST;else{for(let u=t.mixingTo;u!=null;u=u.mixingTo)if(!u.animation.hasTimeline(l)){if(i.mixDuration>0){r[h]=Yt.HOLD_MIX,n[h]=u;continue t}break}r[h]=Yt.HOLD_FIRST}}}getCurrent(i){return i>=this.tracks.length?null:this.tracks[i]}addListener(i){if(i==null)throw new Error("listener cannot be null.");this.listeners.push(i)}removeListener(i){const t=this.listeners.indexOf(i);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(i,t,e){Yt.deprecatedWarning1||(Yt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(i,t,e)}addAnimationByName(i,t,e,s){Yt.deprecatedWarning2||(Yt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(i,t,e,s)}hasAnimation(i){return this.data.skeletonData.findAnimation(i)!==null}hasAnimationByName(i){return Yt.deprecatedWarning3||(Yt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(i)}};let ps=Yt;ps.emptyAnimation=new oe("<empty>",[],0),ps.SUBSEQUENT=0,ps.FIRST=1,ps.HOLD_SUBSEQUENT=2,ps.HOLD_FIRST=3,ps.HOLD_MIX=4,ps.SETUP=1,ps.CURRENT=2,ps.deprecatedWarning1=!1,ps.deprecatedWarning2=!1,ps.deprecatedWarning3=!1;const Ir=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const i=this.animationEnd-this.animationStart;return i==0?this.animationStart:this.trackTime%i+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(i){this.animationLast=i,this.nextAnimationLast=i}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(i){Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=i}get endTime(){return Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(i){Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=i}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Yu=Ir;Yu.deprecatedWarning1=!1,Yu.deprecatedWarning2=!1;const Hu=class{constructor(i){this.objects=[],this.drainDisabled=!1,this.animState=i}start(i){this.objects.push(ss.start),this.objects.push(i),this.animState.animationsChanged=!0}interrupt(i){this.objects.push(ss.interrupt),this.objects.push(i)}end(i){this.objects.push(ss.end),this.objects.push(i),this.animState.animationsChanged=!0}dispose(i){this.objects.push(ss.dispose),this.objects.push(i)}complete(i){this.objects.push(ss.complete),this.objects.push(i)}event(i,t){this.objects.push(ss.event),this.objects.push(i),this.objects.push(t)}deprecateStuff(){return Hu.deprecatedWarning1||(Hu.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const i=this.objects,t=this.animState.listeners;for(let e=0;e<i.length;e+=2){const s=i[e],r=i[e+1];switch(s){case ss.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case ss.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(r);break;case ss.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case ss.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(r);this.animState.trackEntryPool.free(r);break;case ss.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(r);const n=D.toInt(r.loopsCount());r.onComplete&&this.deprecateStuff()&&r.onComplete(r.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(r.trackIndex,n);break;case ss.event:const a=i[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(r,a);r.onEvent&&this.deprecateStuff()&&r.onEvent(r.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(r.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let O_=Hu;O_.deprecatedWarning1=!1;var ss=(i=>(i[i.start=0]="start",i[i.interrupt=1]="interrupt",i[i.end=2]="end",i[i.dispose=3]="dispose",i[i.complete=4]="complete",i[i.event=5]="event",i))(ss||{});const Wu=class{constructor(i){if(this.animationToMixTime={},this.defaultMix=0,i==null)throw new Error("skeletonData cannot be null.");this.skeletonData=i}setMix(i,t,e){const s=this.skeletonData.findAnimation(i);if(s==null)throw new Error(`Animation not found: ${i}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,r,e)}setMixByName(i,t,e){Wu.deprecatedWarning1||(Wu.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(i,t,e)}setMixWith(i,t,e){if(i==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${i.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(i,t){const e=`${i.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let L_=Wu;L_.deprecatedWarning1=!1;let N_=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new it(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Xu(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new HS(e)}newPathAttachment(t,e){return new _l(e)}newPointAttachment(t,e){return new zS(e)}newClippingAttachment(t,e){return new WS(e)}};class V_{constructor(t,e,s){if(this.matrix=new Rt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,n,a,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=h,this.appliedValid=!0;const o=this.parent,l=this.matrix,u=this.skeleton.scaleX,c=-this.skeleton.scaleY;if(o==null){const g=this.skeleton,_=s+90+h;l.a=D.cosDeg(s+a)*r*u,l.c=D.cosDeg(_)*n*u,l.b=D.sinDeg(s+a)*r*c,l.d=D.sinDeg(_)*n*c,l.tx=t*u+g.x,l.ty=e*c+g.y;return}let d=o.matrix.a,f=o.matrix.c,p=o.matrix.b,m=o.matrix.d;switch(l.tx=d*t+f*e+o.matrix.tx,l.ty=p*t+m*e+o.matrix.ty,this.data.transformMode){case vt.Normal:{const g=s+90+h,_=D.cosDeg(s+a)*r,x=D.cosDeg(g)*n,y=D.sinDeg(s+a)*r,v=D.sinDeg(g)*n;l.a=d*_+f*y,l.c=d*x+f*v,l.b=p*_+m*y,l.d=p*x+m*v;return}case vt.OnlyTranslation:{const g=s+90+h;l.a=D.cosDeg(s+a)*r,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+a)*r,l.d=D.sinDeg(g)*n;break}case vt.NoRotationOrReflection:{let g=d*d+p*p,_=0;g>1e-4?(g=Math.abs(d*m-f*p)/g,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*g,m=d*g,_=Math.atan2(p,d)*D.radDeg):(d=0,p=0,_=90-Math.atan2(m,f)*D.radDeg);const x=s+a-_,y=s+h-_+90,v=D.cosDeg(x)*r,b=D.cosDeg(y)*n,w=D.sinDeg(x)*r,E=D.sinDeg(y)*n;l.a=d*v-f*w,l.c=d*b-f*E,l.b=p*v+m*w,l.d=p*b+m*E;break}case vt.NoScale:case vt.NoScaleOrReflection:{const g=D.cosDeg(s),_=D.sinDeg(s);let x=(d*g+f*_)/u,y=(p*g+m*_)/c,v=Math.sqrt(x*x+y*y);v>1e-5&&(v=1/v),x*=v,y*=v,v=Math.sqrt(x*x+y*y),this.data.transformMode==vt.NoScale&&d*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(y,x),w=Math.cos(b)*v,E=Math.sin(b)*v,T=D.cosDeg(a)*r,A=D.cosDeg(90+h)*n,I=D.sinDeg(a)*r,M=D.sinDeg(90+h)*n;l.a=x*T+w*I,l.c=x*A+w*M,l.b=y*T+E*I,l.d=y*A+E*M;break}}l.a*=u,l.c*=u,l.b*=c,l.d*=c}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*D.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*D.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*D.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*D.radDeg;return}const s=t.matrix,r=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,a=e.ty-s.ty;this.ax=n*s.d*r-a*s.c*r,this.ay=a*s.a*r-n*s.b*r;const h=r*s.d,o=r*s.a,l=r*s.c,u=r*s.b,c=h*e.a-l*e.b,d=h*e.c-l*e.d,f=o*e.b-u*e.a,p=o*e.d-u*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){const m=c*p-d*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*d+f*p,m)*D.radDeg,this.arotation=Math.atan2(f,c)*D.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*D.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=1/(s*a-r*n),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*a*h-l*r*h,t.y=l*s*h-o*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,r=t.y;return t.x=s*e.a+r*e.c+e.tx,t.y=s*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=D.cosDeg(t),o=D.sinDeg(t);e.a=h*s-o*n,e.c=h*r-o*a,e.b=o*s+h*n,e.d=o*r+h*a,this.appliedValid=!1}}let U_=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},zu=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},G_=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},X_=class{constructor(t){this.name=t}};class jS{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){const t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix);break}}apply1(t,e,s,r,n,a,h){t.appliedValid||t.updateAppliedTransform();const o=t.parent.matrix,l=o.a;let u=o.c;const c=o.b;let d=o.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case vt.OnlyTranslation:p=e-t.worldX,m=s-t.worldY;break;case vt.NoRotationOrReflection:const x=Math.abs(l*d-u*c)/(l*l+c*c),y=l/t.skeleton.scaleX,v=c/t.skeleton.scaleY;u=-v*x*t.skeleton.scaleX,d=y*x*t.skeleton.scaleY,f+=Math.atan2(v,y)*D.radDeg;default:const b=e-o.tx,w=s-o.ty,E=l*d-u*c;p=(b*d-w*u)/E-t.ax,m=(w*l-b*c)/E-t.ay}f+=Math.atan2(m,p)*D.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,_=t.ascaleY;if(r||n){switch(t.data.transformMode){case vt.NoScale:case vt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const x=t.data.length*g,y=Math.sqrt(p*p+m*m);if(r&&y<x||n&&y>x&&x>1e-4){const v=(y/x-1)*h+1;g*=v,a&&(_*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*h,g,_,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,a,h,o){if(o==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,u=t.ay;let c=t.ascaleX,d=c,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,_=0,x=0;c<0?(c=-c,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,_=180):_=0;const y=e.ax;let v=0,b=0,w=0,E=m.a,T=m.c,A=m.b,I=m.d;const M=Math.abs(c-f)<=1e-4;M?(v=e.ay,b=E*y+T*v+m.tx,w=A*y+I*v+m.ty):(v=0,b=E*y+m.tx,w=A*y+m.ty);const R=t.parent.matrix;E=R.a,T=R.c,A=R.b,I=R.d;const C=1/(E*I-T*A);let P=b-R.tx,k=w-R.ty;const U=(P*I-k*T)*C-l,V=(k*E-P*A)*C-u,L=Math.sqrt(U*U+V*V);let $=e.data.length*p,O,N;if(L<1e-4){this.apply1(t,s,r,!1,a,!1,o),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=r-R.ty;let Z=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-u,H=Z*Z+Q*Q;if(h!=0){h*=c*(p+1)/2;const _t=Math.sqrt(H),kt=_t-L-$*c+h;if(kt>0){let zt=Math.min(1,kt/(h*2))-1;zt=(kt-h*(1-zt*zt))/_t,Z-=zt*Z,Q-=zt*Q,H=Z*Z+Q*Q}}t:if(M){$*=c;let _t=(H-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,a&&(d*=(Math.sqrt(H)/(L+$)-1)*o+1)),N=Math.acos(_t)*n,E=L+$*_t,T=$*Math.sin(N),O=Math.atan2(Q*E-Z*T,Z*E+Q*T)}else{E=c*$,T=f*$;const _t=E*E,kt=T*T,zt=Math.atan2(Q,Z);A=kt*L*L+_t*H-_t*kt;const Qt=-2*kt*L,Pt=kt-_t;if(I=Qt*Qt-4*Pt*A,I>=0){let Bn=Math.sqrt(I);Qt<0&&(Bn=-Bn),Bn=-(Qt+Bn)/2;const ey=Bn/Pt,sy=A/Bn,Dn=Math.abs(ey)<Math.abs(sy)?ey:sy;if(Dn*Dn<=H){k=Math.sqrt(H-Dn*Dn)*n,O=zt-Math.atan2(k,Dn),N=Math.atan2(k/f,(Dn-L)/c);break t}}let jt=D.PI,Ot=L-E,ze=Ot*Ot,is=0,li=0,kn=L+E,hi=kn*kn,ty=0;A=-E*L/(_t-kt),A>=-1&&A<=1&&(A=Math.acos(A),P=E*Math.cos(A)+L,k=T*Math.sin(A),I=P*P+k*k,I<ze&&(jt=A,ze=I,Ot=P,is=k),I>hi&&(li=A,hi=I,kn=P,ty=k)),H<=(ze+hi)/2?(O=zt-Math.atan2(is*n,Ot),N=jt*n):(O=zt-Math.atan2(ty*n,kn),N=li*n)}const lt=Math.atan2(v,y)*x;let Et=t.arotation;O=(O-lt)*D.radDeg+g-Et,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(l,u,Et+O*o,d,t.ascaleY,0,0),Et=e.arotation,N=((N+lt)*D.radDeg-e.ashearX)*x+_-Et,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(y,v,Et+N*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}let $_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},Y_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array}};var be=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(be||{});const $i=class{constructor(i,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,i==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=i,this.bones=new Array;for(let e=0,s=i.bones.length;e<s;e++)this.bones.push(t.findBone(i.bones[e].name));this.target=t.findSlot(i.target.name),this.position=i.position,this.spacing=i.spacing,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix}isActive(){return this.active}apply(){this.update()}update(){const i=this.target.getAttachment();if(!(i instanceof _l))return;const t=this.rotateMix,e=this.translateMix,s=e>0,r=t>0;if(!s&&!r)return;const n=this.data,a=n.spacingMode,h=a==be.Length,o=n.rotateMode,l=o==Fe.Tangent,u=o==Fe.ChainScale,c=this.bones.length,d=l?c:c+1,f=this.bones,p=B.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(u||h){u&&(m=B.setArraySize(this.lengths,c));for(let w=0,E=d-1;w<E;){const T=f[w],A=T.data.length;if(A<$i.epsilon)u&&(m[w]=0),p[++w]=0;else{const I=A*T.matrix.a,M=A*T.matrix.b,R=Math.sqrt(I*I+M*M);u&&(m[w]=R),p[++w]=(h?A+g:g)*R/A}}}else for(let w=1;w<d;w++)p[w]=g;const _=this.computeWorldPositions(i,d,l,n.positionMode==ne.Percent,a==be.Percent);let x=_[0],y=_[1],v=n.offsetRotation,b=!1;if(v==0)b=o==Fe.Chain;else{b=!1;const w=this.target.bone.matrix;v*=w.a*w.d-w.b*w.c>0?D.degRad:-D.degRad}for(let w=0,E=3;w<c;w++,E+=3){const T=f[w],A=T.matrix;A.tx+=(x-A.tx)*e,A.ty+=(y-A.ty)*e;const I=_[E],M=_[E+1],R=I-x,C=M-y;if(u){const P=m[w];if(P!=0){const k=(Math.sqrt(R*R+C*C)/P-1)*t+1;A.a*=k,A.b*=k}}if(x=I,y=M,r){const P=A.a,k=A.c,U=A.b,V=A.d;let L=0,$=0,O=0;if(l&&(l?L=_[E-1]:p[w+1]==0?L=_[E+2]:L=Math.atan2(C,R)),L-=Math.atan2(U,P),b){$=Math.cos(L),O=Math.sin(L);const N=T.data.length;x+=(N*($*P-O*U)-R)*t,y+=(N*(O*P+$*U)-C)*t}else L+=v;L>D.PI?L-=D.PI2:L<-D.PI&&(L+=D.PI2),L*=t,$=Math.cos(L),O=Math.sin(L),A.a=$*P-O*U,A.c=$*k-O*V,A.b=O*P+$*U,A.d=O*k+$*V}T.appliedValid=!1}}computeWorldPositions(i,t,e,s,r){const n=this.target;let a=this.position;const h=this.spaces,o=B.setArraySize(this.positions,t*3+2);let l=null;const u=i.closed;let c=i.worldVerticesLength,d=c/6,f=$i.NONE;if(!i.constantSpeed){const L=i.lengths;d-=u?1:2;const $=L[d];if(s&&(a*=$),r)for(let O=0;O<t;O++)h[O]*=$;l=B.setArraySize(this.world,8);for(let O=0,N=0,Z=0;O<t;O++,N+=3){const Q=h[O];a+=Q;let H=a;if(u)H%=$,H<0&&(H+=$),Z=0;else if(H<0){f!=$i.BEFORE&&(f=$i.BEFORE,i.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(H,l,0,o,N);continue}else if(H>$){f!=$i.AFTER&&(f=$i.AFTER,i.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(H-$,l,0,o,N);continue}for(;;Z++){const lt=L[Z];if(!(H>lt)){if(Z==0)H/=lt;else{const Et=L[Z-1];H=(H-Et)/(lt-Et)}break}}Z!=f&&(f=Z,u&&Z==d?(i.computeWorldVertices(n,c-4,4,l,0,2),i.computeWorldVertices(n,0,4,l,4,2)):i.computeWorldVertices(n,Z*6+2,8,l,0,2)),this.addCurvePosition(H,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],o,N,e||O>0&&Q==0)}return o}u?(c+=2,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c-4,l,0,2),i.computeWorldVertices(n,0,2,l,c-4,2),l[c-2]=l[0],l[c-1]=l[1]):(d--,c-=4,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c,l,0,2));const p=B.setArraySize(this.curves,d);let m=0,g=l[0],_=l[1],x=0,y=0,v=0,b=0,w=0,E=0,T=0,A=0,I=0,M=0,R=0,C=0,P=0,k=0;for(let L=0,$=2;L<d;L++,$+=6)x=l[$],y=l[$+1],v=l[$+2],b=l[$+3],w=l[$+4],E=l[$+5],T=(g-x*2+v)*.1875,A=(_-y*2+b)*.1875,I=((x-v)*3-g+w)*.09375,M=((y-b)*3-_+E)*.09375,R=T*2+I,C=A*2+M,P=(x-g)*.75+T+I*.16666667,k=(y-_)*.75+A+M*.16666667,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,R+=I,C+=M,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,m+=Math.sqrt(P*P+k*k),P+=R+I,k+=C+M,m+=Math.sqrt(P*P+k*k),p[L]=m,g=w,_=E;if(s&&(a*=m),r)for(let L=0;L<t;L++)h[L]*=m;const U=this.segments;let V=0;for(let L=0,$=0,O=0,N=0;L<t;L++,$+=3){const Z=h[L];a+=Z;let Q=a;if(u)Q%=m,Q<0&&(Q+=m),O=0;else if(Q<0){this.addBeforePosition(Q,l,0,o,$);continue}else if(Q>m){this.addAfterPosition(Q-m,l,c-4,o,$);continue}for(;;O++){const H=p[O];if(!(Q>H)){if(O==0)Q/=H;else{const lt=p[O-1];Q=(Q-lt)/(H-lt)}break}}if(O!=f){f=O;let H=O*6;for(g=l[H],_=l[H+1],x=l[H+2],y=l[H+3],v=l[H+4],b=l[H+5],w=l[H+6],E=l[H+7],T=(g-x*2+v)*.03,A=(_-y*2+b)*.03,I=((x-v)*3-g+w)*.006,M=((y-b)*3-_+E)*.006,R=T*2+I,C=A*2+M,P=(x-g)*.3+T+I*.16666667,k=(y-_)*.3+A+M*.16666667,V=Math.sqrt(P*P+k*k),U[0]=V,H=1;H<8;H++)P+=R,k+=C,R+=I,C+=M,V+=Math.sqrt(P*P+k*k),U[H]=V;P+=R,k+=C,V+=Math.sqrt(P*P+k*k),U[8]=V,P+=R+I,k+=C+M,V+=Math.sqrt(P*P+k*k),U[9]=V,N=0}for(Q*=V;;N++){const H=U[N];if(!(Q>H)){if(N==0)Q/=H;else{const lt=U[N-1];Q=N+(Q-lt)/(H-lt)}break}}this.addCurvePosition(Q*.1,g,_,x,y,v,b,w,E,o,$,e||L>0&&Z==0)}return o}addBeforePosition(i,t,e,s,r){const n=t[e],a=t[e+1],h=t[e+2]-n,o=t[e+3]-a,l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addAfterPosition(i,t,e,s,r){const n=t[e+2],a=t[e+3],h=n-t[e],o=a-t[e+1],l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addCurvePosition(i,t,e,s,r,n,a,h,o,l,u,c){(i==0||isNaN(i))&&(i=1e-4);const d=i*i,f=d*i,p=1-i,m=p*p,g=m*p,_=p*i,x=_*3,y=p*x,v=x*i,b=t*g+s*y+n*v+h*f,w=e*g+r*y+a*v+o*f;l[u]=b,l[u+1]=w,c&&(l[u+2]=Math.atan2(w-(e*m+r*_*2+a*d),b-(t*m+s*_*2+n*d)))}};let Po=$i;Po.NONE=-1,Po.BEFORE=-2,Po.AFTER=-3,Po.epsilon=1e-5;class qS{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new GS,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)-Math.atan2(w,v)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=(v.x-y.tx)*e,y.ty+=(v.y-y.ty)*e,x=!0}if(s>0){let v=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(h*h+l*l);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*s)/v),y.a*=v,y.b*=v,v=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+u*u),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*s)/v),y.c*=v,y.d*=v,x=!0}if(r>0){const v=y.c,b=y.d,w=Math.atan2(b,v);let E=Math.atan2(u,o)-Math.atan2(l,h)-(w-Math.atan2(y.b,y.a));E>D.PI?E-=D.PI2:E<-D.PI&&(E+=D.PI2),E=w+(E+f)*r;const T=Math.sqrt(v*v+b*b);y.c=Math.cos(E)*T,y.d=Math.sin(E)*T,x=!0}x&&(_.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=v.x*e,y.ty+=v.y*e,x=!0}if(s>0){let v=(Math.sqrt(h*h+l*l)-1+this.data.offsetScaleX)*s+1;y.a*=v,y.b*=v,v=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*s+1,y.c*=v,y.d*=v,x=!0}if(r>0){let v=Math.atan2(u,o)-Math.atan2(l,h);v>D.PI?v-=D.PI2:v<-D.PI&&(v+=D.PI2);const b=y.c,w=y.d;v=Math.atan2(w,b)+(v-D.PI/2+f)*r;const E=Math.sqrt(b*b+w*w);y.c=Math.cos(v)*E,y.d=Math.sin(v)*E,x=!0}x&&(_.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;if(t!=0){let g=n.arotation-u+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,u+=g*t}let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax-c+this.data.offsetX)*e,d+=(n.ay-d+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*s)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*s)/p));const m=l.ashearY;if(r>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*r}l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;t!=0&&(u+=(n.arotation+this.data.offsetRotation)*t);let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax+this.data.offsetX)*e,d+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let m=l.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}}const Ro=class{constructor(i){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,i==null)throw new Error("data cannot be null.");this.data=i,this.bones=new Array;for(let t=0;t<i.bones.length;t++){const e=i.bones[t];let s;if(e.parent==null)s=new V_(e,this,null);else{const r=this.bones[e.parent.index];s=new V_(e,this,r),r.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<i.slots.length;t++){const e=i.slots[t],s=this.bones[e.boneData.index],r=new R_(e,s);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<i.ikConstraints.length;t++){const e=i.ikConstraints[t];this.ikConstraints.push(new jS(e,this))}this.transformConstraints=new Array;for(let t=0;t<i.transformConstraints.length;t++){const e=i.transformConstraints[t];this.transformConstraints.push(new qS(e,this))}this.pathConstraints=new Array;for(let t=0;t<i.pathConstraints.length;t++){const e=i.pathConstraints[t];this.pathConstraints.push(new Po(e,this))}this.color=new X(1,1,1,1),this.updateCache()}updateCache(){const i=this._updateCache;i.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,u=t.length;l<u;l++){const c=t[l];c.sorted=c.data.skinRequired,c.active=!c.sorted}if(this.skin!=null){const l=this.skin.bones;for(let u=0,c=this.skin.bones.length;u<c;u++){let d=this.bones[l[u].index];do d.sorted=!1,d.active=!0,d=d.parent;while(d!=null)}}const e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,n=e.length,a=s.length,h=r.length,o=n+a+h;t:for(let l=0;l<o;l++){for(let u=0;u<n;u++){const c=e[u];if(c.data.order==l){this.sortIkConstraint(c);continue t}}for(let u=0;u<a;u++){const c=s[u];if(c.data.order==l){this.sortTransformConstraint(c);continue t}}for(let u=0;u<h;u++){const c=r[u];if(c.data.order==l){this.sortPathConstraint(c);continue t}}}for(let l=0,u=t.length;l<u;l++)this.sortBone(t[l])}sortIkConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target;this.sortBone(t);const e=i.bones,s=e[0];if(this.sortBone(s),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(i),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(i){if(i.active=i.target.bone.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target,e=t.data.index,s=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,s),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let h=0,o=this.data.skins.length;h<o;h++)this.sortPathConstraintAttachment(this.data.skins[h],e,s);const r=t.getAttachment();r instanceof _l&&this.sortPathConstraintAttachmentWith(r,s);const n=i.bones,a=n.length;for(let h=0;h<a;h++)this.sortBone(n[h]);this._updateCache.push(i);for(let h=0;h<a;h++)this.sortReset(n[h].children);for(let h=0;h<a;h++)n[h].sorted=!0}sortTransformConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;this.sortBone(i.target);const t=i.bones,e=t.length;if(i.data.local)for(let s=0;s<e;s++){const r=t[s];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(i);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(i,t,e){const s=i.attachments[t];if(s)for(const r in s)this.sortPathConstraintAttachmentWith(s[r],e)}sortPathConstraintAttachmentWith(i,t){if(!(i instanceof _l))return;const e=i.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const h=e[r];this.sortBone(s[h])}}}}sortBone(i){if(i.sorted)return;const t=i.parent;t!=null&&this.sortBone(t),i.sorted=!0,this._updateCache.push(i)}sortReset(i){for(let t=0,e=i.length;t<e;t++){const s=i[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const i=this.updateCacheReset;for(let e=0,s=i.length;e<s;e++){const r=i[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}const t=this._updateCache;for(let e=0,s=t.length;e<s;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const i=this.bones;for(let r=0,n=i.length;r<n;r++)i[r].setToSetupPose();const t=this.ikConstraints;for(let r=0,n=t.length;r<n;r++){const a=t[r];a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}const e=this.transformConstraints;for(let r=0,n=e.length;r<n;r++){const a=e[r],h=a.data;a.rotateMix=h.rotateMix,a.translateMix=h.translateMix,a.scaleMix=h.scaleMix,a.shearMix=h.shearMix}const s=this.pathConstraints;for(let r=0,n=s.length;r<n;r++){const a=s[r],h=a.data;a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix}}setSlotsToSetupPose(){const i=this.slots;B.arrayCopy(i,0,this.drawOrder,0,i.length);for(let t=0,e=i.length;t<e;t++)i[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findBoneIndex(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}findSlot(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findSlotIndex(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}setSkinByName(i){const t=this.data.findSkin(i);if(t==null)throw new Error(`Skin not found: ${i}`);this.setSkin(t)}setSkin(i){if(i!=this.skin){if(i!=null)if(this.skin!=null)i.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=i.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=i,this.updateCache()}}getAttachmentByName(i,t){return this.getAttachment(this.data.findSlotIndex(i),t)}getAttachment(i,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(i,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(i,t):null}setAttachment(i,t){if(i==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.data.name==i){let a=null;if(t!=null&&(a=this.getAttachment(s,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${i}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${i}`)}findIkConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findTransformConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findPathConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}getBounds(i,t,e=new Array(2)){if(i==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let o=0,l=s.length;o<l;o++){const u=s[o];if(!u.bone.active)continue;let c=0,d=null;const f=u.getAttachment();if(f instanceof it)c=8,d=B.setArraySize(e,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(f instanceof Xu){const p=f;c=p.worldVerticesLength,d=B.setArraySize(e,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(d!=null)for(let p=0,m=d.length;p<m;p+=2){const g=d[p],_=d[p+1];r=Math.min(r,g),n=Math.min(n,_),a=Math.max(a,g),h=Math.max(h,_)}}i.set(r,n),t.set(a-r,h-n)}update(i){this.time+=i}get flipX(){return this.scaleX==-1}set flipX(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=i?1:-1}get flipY(){return this.scaleY==-1}set flipY(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=i?1:-1}};let H_=Ro;H_.deprecatedWarning1=!1;let W_=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},z_=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},j_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},q_=class{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},ju=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment!=null&&(r.attachment instanceof Xu?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&(s[e]=null)}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new q_(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new q_(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}};const Kt=class{constructor(i){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=i}readSkeletonData(i){const t=this.scale,e=new W_;e.name="";const s=new gl(i);e.hash=s.readString(),e.version=s.readString(),e.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),e.x=s.readFloat(),e.y=s.readFloat(),e.width=s.readFloat(),e.height=s.readFloat();const r=s.readBoolean();r&&(e.fps=s.readFloat(),e.imagesPath=s.readString(),e.audioPath=s.readString());let n=0;n=s.readInt(!0);for(let h=0;h<n;h++)s.strings.push(s.readString());n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=h==0?null:e.bones[s.readInt(!0)],u=new U_(h,o,l);u.rotation=s.readFloat(),u.x=s.readFloat()*t,u.y=s.readFloat()*t,u.scaleX=s.readFloat(),u.scaleY=s.readFloat(),u.shearX=s.readFloat(),u.shearY=s.readFloat(),u.length=s.readFloat()*t,u.transformMode=Kt.TransformModeValues[s.readInt(!0)],u.skinRequired=s.readBoolean(),r&&X.rgba8888ToColor(u.color,s.readInt32()),e.bones.push(u)}n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=e.bones[s.readInt(!0)],u=new z_(h,o,l);X.rgba8888ToColor(u.color,s.readInt32());const c=s.readInt32();c!=-1&&X.rgb888ToColor(u.darkColor=new X,c),u.attachmentName=s.readStringRef(),u.blendMode=Kt.BlendModeValues[s.readInt(!0)],e.slots.push(u)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new $_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.mix=s.readFloat(),l.softness=s.readFloat()*t,l.bendDirection=s.readByte(),l.compress=s.readBoolean(),l.stretch=s.readBoolean(),l.uniform=s.readBoolean(),e.ikConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new j_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.local=s.readBoolean(),l.relative=s.readBoolean(),l.offsetRotation=s.readFloat(),l.offsetX=s.readFloat()*t,l.offsetY=s.readFloat()*t,l.offsetScaleX=s.readFloat(),l.offsetScaleY=s.readFloat(),l.offsetShearY=s.readFloat(),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),l.scaleMix=s.readFloat(),l.shearMix=s.readFloat(),e.transformConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new Y_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.slots[s.readInt(!0)],l.positionMode=Kt.PositionModeValues[s.readInt(!0)],l.spacingMode=Kt.SpacingModeValues[s.readInt(!0)],l.rotateMode=Kt.RotateModeValues[s.readInt(!0)],l.offsetRotation=s.readFloat(),l.position=s.readFloat(),l.positionMode==ne.Fixed&&(l.position*=t),l.spacing=s.readFloat(),(l.spacingMode==be.Length||l.spacingMode==be.Fixed)&&(l.spacing*=t),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),e.pathConstraints.push(l)}const a=this.readSkin(s,e,!0,r);a!=null&&(e.defaultSkin=a,e.skins.push(a));{let h=e.skins.length;for(B.setArraySize(e.skins,n=h+s.readInt(!0));h<n;h++)e.skins[h]=this.readSkin(s,e,!1,r)}n=this.linkedMeshes.length;for(let h=0;h<n;h++){const o=this.linkedMeshes[h],l=o.skin==null?e.defaultSkin:e.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}this.linkedMeshes.length=0,n=s.readInt(!0);for(let h=0;h<n;h++){const o=new X_(s.readStringRef());o.intValue=s.readInt(!1),o.floatValue=s.readFloat(),o.stringValue=s.readString(),o.audioPath=s.readString(),o.audioPath!=null&&(o.volume=s.readFloat(),o.balance=s.readFloat()),e.events.push(o)}n=s.readInt(!0);for(let h=0;h<n;h++)e.animations.push(this.readAnimation(s,s.readString(),e));return e}readSkin(i,t,e,s){let r=null,n=0;if(e){if(n=i.readInt(!0),n==0)return null;r=new ju("default")}else{r=new ju(i.readStringRef()),r.bones.length=i.readInt(!0);for(let a=0,h=r.bones.length;a<h;a++)r.bones[a]=t.bones[i.readInt(!0)];for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.ikConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.transformConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.pathConstraints[i.readInt(!0)]);n=i.readInt(!0)}for(let a=0;a<n;a++){const h=i.readInt(!0);for(let o=0,l=i.readInt(!0);o<l;o++){const u=i.readStringRef(),c=this.readAttachment(i,t,r,h,u,s);c!=null&&r.setAttachment(h,u,c)}}return r}readAttachment(i,t,e,s,r,n){const a=this.scale;let h=i.readStringRef();h==null&&(h=r);const o=i.readByte();switch(Kt.AttachmentTypeValues[o]){case at.Region:{let u=i.readStringRef();const c=i.readFloat(),d=i.readFloat(),f=i.readFloat(),p=i.readFloat(),m=i.readFloat(),g=i.readFloat(),_=i.readFloat(),x=i.readInt32();u==null&&(u=h);const y=this.attachmentLoader.newRegionAttachment(e,h,u);return y==null?null:(y.path=u,y.x=d*a,y.y=f*a,y.scaleX=p,y.scaleY=m,y.rotation=c,y.width=g*a,y.height=_*a,X.rgba8888ToColor(y.color,x),y)}case at.BoundingBox:{const u=i.readInt(!0),c=this.readVertices(i,u),d=n?i.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(e,h);return f==null?null:(f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,n&&X.rgba8888ToColor(f.color,d),f)}case at.Mesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readInt(!0),f=this.readFloatArray(i,d<<1,1),p=this.readShortArray(i),m=this.readVertices(i,d),g=i.readInt(!0);let _=null,x=0,y=0;n&&(_=this.readShortArray(i),x=i.readFloat(),y=i.readFloat()),u==null&&(u=h);const v=this.attachmentLoader.newMeshAttachment(e,h,u);return v==null?null:(v.path=u,X.rgba8888ToColor(v.color,c),v.bones=m.bones,v.vertices=m.vertices,v.worldVerticesLength=d<<1,v.triangles=p,v.regionUVs=new Float32Array(f),v.hullLength=g<<1,n&&(v.edges=_,v.width=x*a,v.height=y*a),v)}case at.LinkedMesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readStringRef(),f=i.readStringRef(),p=i.readBoolean();let m=0,g=0;n&&(m=i.readFloat(),g=i.readFloat()),u==null&&(u=h);const _=this.attachmentLoader.newMeshAttachment(e,h,u);return _==null?null:(_.path=u,X.rgba8888ToColor(_.color,c),n&&(_.width=m*a,_.height=g*a),this.linkedMeshes.push(new ZS(_,d,s,f,p)),_)}case at.Path:{const u=i.readBoolean(),c=i.readBoolean(),d=i.readInt(!0),f=this.readVertices(i,d),p=B.newArray(d/3,0);for(let _=0,x=p.length;_<x;_++)p[_]=i.readFloat()*a;const m=n?i.readInt32():0,g=this.attachmentLoader.newPathAttachment(e,h);return g==null?null:(g.closed=u,g.constantSpeed=c,g.worldVerticesLength=d<<1,g.vertices=f.vertices,g.bones=f.bones,g.lengths=p,n&&X.rgba8888ToColor(g.color,m),g)}case at.Point:{const u=i.readFloat(),c=i.readFloat(),d=i.readFloat(),f=n?i.readInt32():0,p=this.attachmentLoader.newPointAttachment(e,h);return p==null?null:(p.x=c*a,p.y=d*a,p.rotation=u,n&&X.rgba8888ToColor(p.color,f),p)}case at.Clipping:{const u=i.readInt(!0),c=i.readInt(!0),d=this.readVertices(i,c),f=n?i.readInt32():0,p=this.attachmentLoader.newClippingAttachment(e,h);return p==null?null:(p.endSlot=t.slots[u],p.worldVerticesLength=c<<1,p.vertices=d.vertices,p.bones=d.bones,n&&X.rgba8888ToColor(p.color,f),p)}}return null}readVertices(i,t){const e=t<<1,s=new KS,r=this.scale;if(!i.readBoolean())return s.vertices=this.readFloatArray(i,e,r),s;const n=new Array,a=new Array;for(let h=0;h<t;h++){const o=i.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(i.readInt(!0)),n.push(i.readFloat()*r),n.push(i.readFloat()*r),n.push(i.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=a,s}readFloatArray(i,t,e){const s=new Array(t);if(e==1)for(let r=0;r<t;r++)s[r]=i.readFloat();else for(let r=0;r<t;r++)s[r]=i.readFloat()*e;return s}readShortArray(i){const t=i.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=i.readShort();return e}readAnimation(i,t,e){const s=new Array,r=this.scale;let n=0;const a=new X,h=new X;for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.SLOT_ATTACHMENT:{const _=new Rn(g);_.slotIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readStringRef());s.push(_),n=Math.max(n,_.frames[g-1]);break}case Kt.SLOT_COLOR:{const _=new He(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*He.ENTRIES]);break}case Kt.SLOT_TWO_COLOR:{const _=new ae(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),X.rgb888ToColor(h,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a,h.r,h.g,h.b),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*ae.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.BONE_ROTATE:{const _=new Ie(g);_.boneIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readFloat()),x<g-1&&this.readCurve(i,x,_);s.push(_),n=Math.max(n,_.frames[(g-1)*Ie.ENTRIES]);break}case Kt.BONE_TRANSLATE:case Kt.BONE_SCALE:case Kt.BONE_SHEAR:{let _,x=1;m==Kt.BONE_SCALE?_=new M_(g):m==Kt.BONE_SHEAR?_=new F_(g):(_=new fs(g),x=r),_.boneIndex=d;for(let y=0;y<g;y++)_.setFrame(y,i.readFloat(),i.readFloat()*x,i.readFloat()*x),y<g-1&&this.readCurve(i,y,_);s.push(_),n=Math.max(n,_.frames[(g-1)*fs.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new Pe(f);p.ikConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat()*r,i.readByte(),i.readBoolean(),i.readBoolean()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new We(f);p.transformConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=e.pathConstraints[d];for(let p=0,m=i.readInt(!0);p<m;p++){const g=i.readByte(),_=i.readInt(!0);switch(g){case Kt.PATH_POSITION:case Kt.PATH_SPACING:{let x,y=1;g==Kt.PATH_SPACING?(x=new D_(_),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(y=r)):(x=new Cr(_),f.positionMode==ne.Fixed&&(y=r)),x.pathConstraintIndex=d;for(let v=0;v<_;v++)x.setFrame(v,i.readFloat(),i.readFloat()*y),v<_-1&&this.readCurve(i,v,x);s.push(x),n=Math.max(n,x.frames[(_-1)*Cr.ENTRIES]);break}case Kt.PATH_MIX:{const x=new or(_);x.pathConstraintIndex=d;for(let y=0;y<_;y++)x.setFrame(y,i.readFloat(),i.readFloat(),i.readFloat()),y<_-1&&this.readCurve(i,y,x);s.push(x),n=Math.max(n,x.frames[(_-1)*or.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=e.skins[i.readInt(!0)];for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readInt(!0);for(let g=0,_=i.readInt(!0);g<_;g++){const x=d.getAttachment(m,i.readStringRef()),y=x.bones!=null,v=x.vertices,b=y?v.length/3*2:v.length,w=i.readInt(!0),E=new B_(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=i.readFloat();let I,M=i.readInt(!0);if(M==0)I=y?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=i.readInt(!0);if(M+=R,r==1)for(let C=R;C<M;C++)I[C]=i.readFloat();else for(let C=R;C<M;C++)I[C]=i.readFloat()*r;if(!y)for(let C=0,P=I.length;C<P;C++)I[C]+=v[C]}E.setFrame(T,A,I),T<w-1&&this.readCurve(i,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const o=i.readInt(!0);if(o>0){const u=new Io(o),c=e.slots.length;for(let d=0;d<o;d++){const f=i.readFloat(),p=i.readInt(!0),m=B.newArray(c,0);for(let y=c-1;y>=0;y--)m[y]=-1;const g=B.newArray(c-p,0);let _=0,x=0;for(let y=0;y<p;y++){const v=i.readInt(!0);for(;_!=v;)g[x++]=_++;m[_+i.readInt(!0)]=_++}for(;_<c;)g[x++]=_++;for(let y=c-1;y>=0;y--)m[y]==-1&&(m[y]=g[--x]);u.setFrame(d,f,m)}s.push(u),n=Math.max(n,u.frames[o-1])}const l=i.readInt(!0);if(l>0){const u=new $u(l);for(let c=0;c<l;c++){const d=i.readFloat(),f=e.events[i.readInt(!0)],p=new G_(d,f);p.intValue=i.readInt(!1),p.floatValue=i.readFloat(),p.stringValue=i.readBoolean()?i.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=i.readFloat(),p.balance=i.readFloat()),u.setFrame(c,p)}s.push(u),n=Math.max(n,u.frames[l-1])}return new oe(t,s,n)}readCurve(i,t,e){switch(i.readByte()){case Kt.CURVE_STEPPED:e.setStepped(t);break;case Kt.CURVE_BEZIER:this.setCurve(e,t,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat());break}}setCurve(i,t,e,s,r,n){i.setCurve(t,e,s,r,n)}};let le=Kt;le.AttachmentTypeValues=[0,1,2,3,4,5,6],le.TransformModeValues=[vt.Normal,vt.OnlyTranslation,vt.NoRotationOrReflection,vt.NoScale,vt.NoScaleOrReflection],le.PositionModeValues=[ne.Fixed,ne.Percent],le.SpacingModeValues=[be.Length,be.Fixed,be.Percent],le.RotateModeValues=[Fe.Tangent,Fe.Chain,Fe.ChainScale],le.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN],le.BONE_ROTATE=0,le.BONE_TRANSLATE=1,le.BONE_SCALE=2,le.BONE_SHEAR=3,le.SLOT_ATTACHMENT=0,le.SLOT_COLOR=1,le.SLOT_TWO_COLOR=2,le.PATH_POSITION=0,le.PATH_SPACING=1,le.PATH_MIX=2,le.CURVE_LINEAR=0,le.CURVE_STEPPED=1,le.CURVE_BEZIER=2;let ZS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}},KS=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},QS=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new W_,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null){if(s.hash=n.hash,s.version=n.spine,s.version.substr(0,3)!=="3.8"){const a=`Spine 3.8 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(a)}s.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new U_(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Un.transformModeFromString(this.getValue(h,"transform","normal")),u.skinRequired=this.getValue(h,"skin",!1),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new z_(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Un.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new $_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.mix=this.getValue(h,"mix",1),o.softness=this.getValue(h,"softness",0)*e,o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.compress=this.getValue(h,"compress",!1),o.stretch=this.getValue(h,"stretch",!1),o.uniform=this.getValue(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new j_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new Y_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Un.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Un.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Un.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==be.Length||o.spacingMode==be.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new ju(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=s.findBone(h.bones[l]);if(u==null)throw new Error(`Skin bone not found: ${h.bones[a]}`);o.bones.push(u)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=s.findIkConstraint(h.ik[l]);if(u==null)throw new Error(`Skin IK constraint not found: ${h.ik[a]}`);o.constraints.push(u)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=s.findTransformConstraint(h.transform[l]);if(u==null)throw new Error(`Skin transform constraint not found: ${h.transform[a]}`);o.constraints.push(u)}if(h.path)for(let l=0;l<h.path.length;l++){const u=s.findPathConstraint(h.path[l]);if(u==null)throw new Error(`Skin path constraint not found: ${h.path[a]}`);o.constraints.push(u)}for(const l in h.attachments){const u=s.findSlot(l);if(u==null)throw new Error(`Slot not found: ${l}`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f!=null&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new X_(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u),l.width=this.getValue(t,"width",0)*a,l.height=this.getValue(t,"height",0)*a;const c=this.getValue(t,"parent",null);if(c!=null)return this.linkedMeshes.push(new JS(l,this.getValue(t,"skin",null),s,c,this.getValue(t,"deform",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=this.getValue(t,"edges",null),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new Rn(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,this.getValue(g,"time",0),g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new He(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*He.ENTRIES])}else if(c=="twoColor"){const f=new ae(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ae.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Ie(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ie.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1,m=0;c==="scale"?(f=new M_(d.length),m=1):c==="shear"?f=new F_(d.length):(f=new fs(d.length),p=r),f.boneIndex=u;let g=0;for(let _=0;_<d.length;_++){const x=d[_],y=this.getValue(x,"x",m),v=this.getValue(x,"y",m);f.setFrame(g,this.getValue(x,"time",0),y*p,v*p),this.readCurve(x,f,g),g++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*fs.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new Pe(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*r,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*Pe.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new We(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*We.ENTRIES])}if(t.path)for(const o in t.path){const l=t.path[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new D_(f.length),(c.spacingMode==be.Length||c.spacingMode==be.Fixed)&&(m=r)):(p=new Cr(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Cr.ENTRIES])}else if(d==="mix"){const p=new or(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,this.getValue(_,"time",0),this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*or.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new B_(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,this.getValue(E,"time",0),T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new Io(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,this.getValue(d,"time",0),f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new $u(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new G_(B.toSinglePrecision(this.getValue(c,"time",0)),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new oe(e,n,a))}readCurve(t,e,s){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(s);else{const r=t.curve;e.setCurve(s,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return be.Length;if(t=="fixed")return be.Fixed;if(t=="percent")return be.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},JS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}};class tC extends Gu{createSkeleton(t){this.skeleton=new H_(t),this.skeleton.updateWorldTransform(),this.stateData=new L_(t),this.state=new ps(this.stateData)}}const eC={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(i){return Le(i,".atlas")},async load(i){return await(await z.ADAPTER.fetch(i)).text()},testParse(i,t){const e=Le(t.src,".atlas"),s=typeof i=="string";return Promise.resolve(e&&s)},async parse(i,t,e){const s=t.data;let r=bt.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let n=null,a=null;const h=new Promise((u,c)=>{n=u,a=c});let o;const l=u=>{u||a(`Something went terribly wrong loading a spine .atlas file
1170
+ Most likely your texture failed to load.`),n(o)};if(s.image||s.images){const u=Object.assign(s.image?{default:s.image}:{},s.images);o=new Uu(i,(c,d)=>{const f=u[c]||u.default;f&&f.baseTexture?d(f.baseTexture):d(f)},l)}else o=new Uu(i,Z_(e,r,s.imageMetadata),l);return await h},unload(i){i.dispose()}}},Z_=(i,t,e)=>async(s,r)=>{const n=bt.normalize([...t.split(bt.sep),s].join(bt.sep)),a=await i.load({src:n,data:e});r(a.baseTexture)};K.add(eC);function K_(i){return i.hasOwnProperty("bones")}function sC(i){return i instanceof ArrayBuffer}class rC{constructor(){}installLoader(){const t=this,e={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(s){return Le(s,".skel")},async load(s){return await(await z.ADAPTER.fetch(s)).arrayBuffer()},testParse(s,r){var o;const n=Le(r.src,".json")&&K_(s),a=Le(r.src,".skel")&&sC(s),h=((o=r.data)==null?void 0:o.spineAtlas)===!1;return Promise.resolve(n&&!h||a)},async parse(s,r,n){const a=bt.extname(r.src).toLowerCase(),h=bt.basename(r.src,a);let o=bt.dirname(r.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=Le(r.src,".json")&&K_(s);let u=null,c=s;l?u=t.createJsonParser():(u=t.createBinaryParser(),c=new Uint8Array(s));const d=r.data||{},f=(d==null?void 0:d.spineSkeletonScale)??null;f&&(u.scale=f);const p=d.spineAtlas;if(p&&p.pages)return t.parseData(u,p,c);const m=d.atlasRawData;if(m){let x=null,y=null;const v=new Promise((E,T)=>{x=E,y=T}),b=new Uu(m,Z_(n,o,d.imageMetadata),E=>{E||y(`Something went terribly wrong loading a spine .atlas file
1171
+ Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u,w,c)}let g=d.spineAtlasFile;g||(g=`${o+h}.atlas`);const _=await n.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(u,_,c)}}};return K.add(e),e}}let Q_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const J_=class extends Q_{constructor(t){super(t),this.id=(J_.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}applyDeform(t){return this==t}};let Yi=J_;Yi.nextID=0;let iC=class extends Yi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},nC=class extends Yi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},oC=class extends Yi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.inheritDeform=!1,this.tempColor=new X(0,0,0,0)}applyDeform(t){return this==t||this.inheritDeform&&this.parentMesh==t}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}},aC=class extends Yi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},lC=class extends Yi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}};class hC{constructor(t,e){if(this.attachmentVertices=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const we=class extends Q_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[we.OX1]=u-f,x[we.OY1]=d+c,x[we.OX2]=u-_,x[we.OY2]=g+c,x[we.OX3]=p-_,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof hC?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}};let nt=we;nt.OX1=0,nt.OY1=1,nt.OX2=2,nt.OY2=3,nt.OX3=4,nt.OY3=5,nt.OX4=6,nt.OY4=7,nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31,new S_(2);let Ee=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=s}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const se=class{constructor(i){if(i<=0)throw new Error(`frameCount must be > 0: ${i}`);this.curves=B.newFloatArray((i-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(i){this.curves[i*se.BEZIER_SIZE]=se.LINEAR}setStepped(i){this.curves[i*se.BEZIER_SIZE]=se.STEPPED}getCurveType(i){const t=i*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(i,t,e,s,r){const n=(-t*2+s)*.03,a=(-e*2+r)*.03,h=((t-s)*3+1)*.006,o=((e-r)*3+1)*.006;let l=n*2+h,u=a*2+o,c=t*.3+n+h*.16666667,d=e*.3+a+o*.16666667,f=i*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=d;for(let _=f+se.BEZIER_SIZE-1;f<_;f+=2)p[f]=m,p[f+1]=g,c+=l,d+=u,l+=h,u+=o,m+=c,g+=d}getCurvePercent(i,t){t=D.clamp(t,0,1);const e=this.curves;let s=i*se.BEZIER_SIZE;const r=e[s];if(r==se.LINEAR)return t;if(r==se.STEPPED)return 0;s++;let n=0;for(let h=s,o=s+se.BEZIER_SIZE-1;s<o;s+=2)if(n=e[s],n>=t){let l,u;return s==h?(l=0,u=0):(l=e[s-2],u=e[s-1]),u+(e[s+1]-u)*(t-l)/(n-l)}const a=e[s-1];return a+(1-a)*(t-n)/(1-n)}};let rs=se;rs.LINEAR=0,rs.STEPPED=1,rs.BEZIER=2,rs.BEZIER_SIZE=10*2-1;const si=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(i,t,e){i<<=1,this.frames[i]=t,this.frames[i+si.ROTATION]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.rotation=o.data.rotation;return;case S.first:const p=o.data.rotation-o.rotation;o.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=h[h.length-si.ENTRIES]){let p=h[h.length+si.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*r;break;case S.first:case S.replace:p+=o.data.rotation-o.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:o.rotation+=p*r}return}const l=Ee.binarySearch(h,e,si.ENTRIES),u=h[l+si.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+si.PREV_TIME]-c));let f=h[l+si.ROTATION]-u;switch(f=u+(f-(16384-(16384.499999999996-f/360|0))*360)*d,n){case S.setup:o.rotation=o.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case S.first:case S.replace:f+=o.data.rotation-o.rotation;case S.add:o.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Mn=si;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(i,t,e,s){i*=De.ENTRIES,this.frames[i]=t,this.frames[i+De.X]=e,this.frames[i+De.Y]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*r,o.y+=(o.data.y-o.y)*r}return}let l=0,u=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],u=h[h.length+De.PREV_Y];else{const c=Ee.binarySearch(h,e,De.ENTRIES);l=h[c+De.PREV_X],u=h[c+De.PREV_Y];const d=h[c],f=this.getCurvePercent(c/De.ENTRIES-1,1-(e-d)/(h[c+De.PREV_TIME]-d));l+=(h[c+De.X]-l)*f,u+=(h[c+De.Y]-u)*f}switch(n){case S.setup:o.x=o.data.x+l*r,o.y=o.data.y+u*r;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*r,o.y+=(o.data.y+u-o.y)*r;break;case S.add:o.x+=l*r,o.y+=u*r}}};let ar=De;ar.ENTRIES=3,ar.PREV_TIME=-3,ar.PREV_X=-2,ar.PREV_Y=-1,ar.X=1,ar.Y=2;let cC=class Ds extends ar{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Ds.ENTRIES])u=o[o.length+Ds.PREV_X]*l.data.scaleX,c=o[o.length+Ds.PREV_Y]*l.data.scaleY;else{const d=Ee.binarySearch(o,s,Ds.ENTRIES);u=o[d+Ds.PREV_X],c=o[d+Ds.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ds.ENTRIES-1,1-(s-f)/(o[d+Ds.PREV_TIME]-f));u=(u+(o[d+Ds.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Ds.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},uC=class Os extends ar{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Os.ENTRIES])u=o[o.length+Os.PREV_X],c=o[o.length+Os.PREV_Y];else{const d=Ee.binarySearch(o,s,Os.ENTRIES);u=o[d+Os.PREV_X],c=o[d+Os.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Os.ENTRIES-1,1-(s-f)/(o[d+Os.PREV_TIME]-f));u=u+(o[d+Os.X]-u)*p,c=c+(o[d+Os.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Ht=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(i,t,e,s,r,n){i*=Ht.ENTRIES,this.frames[i]=t,this.frames[i+Ht.R]=e,this.frames[i+Ht.G]=s,this.frames[i+Ht.B]=r,this.frames[i+Ht.A]=n}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color);return;case S.first:const f=h.color,p=h.data.color;f.add((p.r-f.r)*r,(p.g-f.g)*r,(p.b-f.b)*r,(p.a-f.a)*r)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Ht.ENTRIES]){const f=o.length;l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A]}else{const f=Ee.binarySearch(o,e,Ht.ENTRIES);l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A];const p=o[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(o[f+Ht.PREV_TIME]-p));l+=(o[f+Ht.R]-l)*m,u+=(o[f+Ht.G]-u)*m,c+=(o[f+Ht.B]-c)*m,d+=(o[f+Ht.A]-d)*m}if(r==1)h.color.set(l,u,c,d);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*r,(u-f.g)*r,(c-f.b)*r,(d-f.a)*r)}}};let ms=Ht;ms.ENTRIES=5,ms.PREV_TIME=-5,ms.PREV_R=-4,ms.PREV_G=-3,ms.PREV_B=-2,ms.PREV_A=-1,ms.R=1,ms.G=2,ms.B=3,ms.A=4;const ft=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(i,t,e,s,r,n,a,h,o){i*=ft.ENTRIES,this.frames[i]=t,this.frames[i+ft.R]=e,this.frames[i+ft.G]=s,this.frames[i+ft.B]=r,this.frames[i+ft.A]=n,this.frames[i+ft.R2]=a,this.frames[i+ft.G2]=h,this.frames[i+ft.B2]=o}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color),h.darkColor.setFromColor(h.data.darkColor);return;case S.first:const g=h.color,_=h.darkColor,x=h.data.color,y=h.data.darkColor;g.add((x.r-g.r)*r,(x.g-g.g)*r,(x.b-g.b)*r,(x.a-g.a)*r),_.add((y.r-_.r)*r,(y.g-_.g)*r,(y.b-_.b)*r,0)}return}let l=0,u=0,c=0,d=0,f=0,p=0,m=0;if(e>=o[o.length-ft.ENTRIES]){const g=o.length;l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2]}else{const g=Ee.binarySearch(o,e,ft.ENTRIES);l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2];const _=o[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-_)/(o[g+ft.PREV_TIME]-_));l+=(o[g+ft.R]-l)*x,u+=(o[g+ft.G]-u)*x,c+=(o[g+ft.B]-c)*x,d+=(o[g+ft.A]-d)*x,f+=(o[g+ft.R2]-f)*x,p+=(o[g+ft.G2]-p)*x,m+=(o[g+ft.B2]-m)*x}if(r==1)h.color.set(l,u,c,d),h.darkColor.set(f,p,m,1);else{const g=h.color,_=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),_.setFromColor(h.data.darkColor)),g.add((l-g.r)*r,(u-g.g)*r,(c-g.b)*r,(d-g.a)*r),_.add((f-_.r)*r,(p-_.g)*r,(m-_.b)*r,0)}}};let ye=ft;ye.ENTRIES=8,ye.PREV_TIME=-8,ye.PREV_R=-7,ye.PREV_G=-6,ye.PREV_B=-5,ye.PREV_A=-4,ye.PREV_R2=-3,ye.PREV_G2=-2,ye.PREV_B2=-1,ye.R=1,ye.G=2,ye.B=3,ye.A=4,ye.R2=5,ye.G2=6,ye.B2=7;let dC=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(h==At.mixOut&&a==S.setup){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}const l=this.frames;if(s<l[0]){if(a==S.setup||a==S.first){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let u=0;s>=l[l.length-1]?u=l.length-1:u=Ee.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}},t0=null,fC=class extends rs{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),t0==null&&(t0=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Yi)||!l.applyDeform(this.attachment))return;const u=o.attachmentVertices;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},pC=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=Ee.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},mC=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=Ee.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const St=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(i,t,e,s,r,n){i*=St.ENTRIES,this.frames[i]=t,this.frames[i+St.MIX]=e,this.frames[i+St.BEND_DIRECTION]=s,this.frames[i+St.COMPRESS]=r?1:0,this.frames[i+St.STRETCH]=n?1:0}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.mix=o.data.mix,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*r,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(o.mix=o.data.mix+(h[h.length+St.PREV_MIX]-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0)):(o.mix+=(h[h.length+St.PREV_MIX]-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),u=h[l+St.PREV_MIX],c=h[l],d=this.getCurvePercent(l/St.ENTRIES-1,1-(e-c)/(h[l+St.PREV_TIME]-c));n==S.setup?(o.mix=o.data.mix+(u+(h[l+St.MIX]-u)*d-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0)):(o.mix+=(u+(h[l+St.MIX]-u)*d-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0))}};let gs=St;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_MIX=-4,gs.PREV_BEND_DIRECTION=-3,gs.PREV_COMPRESS=-2,gs.PREV_STRETCH=-1,gs.MIX=1,gs.BEND_DIRECTION=2,gs.COMPRESS=3,gs.STRETCH=4;const Wt=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(i,t,e,s,r,n){i*=Wt.ENTRIES,this.frames[i]=t,this.frames[i+Wt.ROTATE]=e,this.frames[i+Wt.TRANSLATE]=s,this.frames[i+Wt.SCALE]=r,this.frames[i+Wt.SHEAR]=n}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=o.data;switch(n){case S.setup:o.rotateMix=f.rotateMix,o.translateMix=f.translateMix,o.scaleMix=f.scaleMix,o.shearMix=f.shearMix;return;case S.first:o.rotateMix+=(f.rotateMix-o.rotateMix)*r,o.translateMix+=(f.translateMix-o.translateMix)*r,o.scaleMix+=(f.scaleMix-o.scaleMix)*r,o.shearMix+=(f.shearMix-o.shearMix)*r}return}let l=0,u=0,c=0,d=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR];const p=h[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(h[f+Wt.PREV_TIME]-p));l+=(h[f+Wt.ROTATE]-l)*m,u+=(h[f+Wt.TRANSLATE]-u)*m,c+=(h[f+Wt.SCALE]-c)*m,d+=(h[f+Wt.SHEAR]-d)*m}if(n==S.setup){const f=o.data;o.rotateMix=f.rotateMix+(l-f.rotateMix)*r,o.translateMix=f.translateMix+(u-f.translateMix)*r,o.scaleMix=f.scaleMix+(c-f.scaleMix)*r,o.shearMix=f.shearMix+(d-f.shearMix)*r}else o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r,o.scaleMix+=(c-o.scaleMix)*r,o.shearMix+=(d-o.shearMix)*r}};let _s=Wt;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_ROTATE=-4,_s.PREV_TRANSLATE=-3,_s.PREV_SCALE=-2,_s.PREV_SHEAR=-1,_s.ROTATE=1,_s.TRANSLATE=2,_s.SCALE=3,_s.SHEAR=4;const Is=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(i,t,e){i*=Is.ENTRIES,this.frames[i]=t,this.frames[i+Is.VALUE]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*r}return}let l=0;if(e>=h[h.length-Is.ENTRIES])l=h[h.length+Is.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Is.ENTRIES);l=h[u+Is.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Is.ENTRIES-1,1-(e-c)/(h[u+Is.PREV_TIME]-c));l+=(h[u+Is.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*r:o.position+=(l-o.position)*r}};let Hi=Is;Hi.ENTRIES=2,Hi.PREV_TIME=-2,Hi.PREV_VALUE=-1,Hi.VALUE=1;let gC=class ui extends Hi{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ui.ENTRIES])u=o[o.length+ui.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ui.ENTRIES);u=o[c+ui.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ui.ENTRIES-1,1-(s-d)/(o[c+ui.PREV_TIME]-d));u+=(o[c+ui.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Oe=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(i,t,e,s){i*=Oe.ENTRIES,this.frames[i]=t,this.frames[i+Oe.ROTATE]=e,this.frames[i+Oe.TRANSLATE]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.rotateMix=o.data.rotateMix,o.translateMix=o.data.translateMix;return;case S.first:o.rotateMix+=(o.data.rotateMix-o.rotateMix)*r,o.translateMix+=(o.data.translateMix-o.translateMix)*r}return}let l=0,u=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],u=h[h.length+Oe.PREV_TRANSLATE];else{const c=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[c+Oe.PREV_ROTATE],u=h[c+Oe.PREV_TRANSLATE];const d=h[c],f=this.getCurvePercent(c/Oe.ENTRIES-1,1-(e-d)/(h[c+Oe.PREV_TIME]-d));l+=(h[c+Oe.ROTATE]-l)*f,u+=(h[c+Oe.TRANSLATE]-u)*f}n==S.setup?(o.rotateMix=o.data.rotateMix+(l-o.data.rotateMix)*r,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*r):(o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r)}};let ri=Oe;ri.ENTRIES=3,ri.PREV_TIME=-3,ri.PREV_ROTATE=-2,ri.PREV_TRANSLATE=-1,ri.ROTATE=1,ri.TRANSLATE=2,new Ee("<empty>",[],0);let _C=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new oC(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new iC(e)}newPathAttachment(t,e){return new aC(e)}newPointAttachment(t,e){return new lC(e)}newClippingAttachment(t,e){return new nC(e)}},yC=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},xC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},vC=class{constructor(t){this.name=t}},bC=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},wC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var ii=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(ii||{});let EC=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},TC=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},AC=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},SC=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}},CC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new EC,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null&&(s.hash=n.hash,s.version=n.spine,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images),r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new yC(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Gn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new TC(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Gn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new bC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.mix=this.getValue(h,"mix",1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new AC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new wC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Gn.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Gn.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Gn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==ii.Length||o.spacingMode==ii.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(const a in r.skins){const h=r.skins[a],o=new SC(a);for(const l in h){const u=s.findSlotIndex(l);if(u==-1)throw new Error(`Slot not found: ${l}`);const c=h[l];for(const d in c){const f=this.readAttachment(c[d],o,u,d,s);f!=null&&o.addAttachment(u,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new vC(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u);const c=this.getValue(t,"parent",null);if(c!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new IC(l,this.getValue(t,"skin",null),s,c)),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new dC(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,g.time,g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new ms(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ms.ENTRIES])}else if(c=="twoColor"){const f=new ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ye.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Mn(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Mn.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1;c==="scale"?f=new cC(d.length):c==="shear"?f=new uC(d.length):(f=new ar(d.length),p=r),f.boneIndex=u;let m=0;for(let g=0;g<d.length;g++){const _=d[g],x=this.getValue(_,"x",0),y=this.getValue(_,"y",0);f.setFrame(m,_.time,x*p,y*p),this.readCurve(_,f,m),m++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ar.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new gs(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*gs.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new _s(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*_s.ENTRIES])}if(t.paths)for(const o in t.paths){const l=t.paths[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new gC(f.length),(c.spacingMode==ii.Length||c.spacingMode==ii.Fixed)&&(m=r)):(p=new Hi(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,x.time,this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Hi.ENTRIES])}else if(d==="mix"){const p=new ri(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,_.time,this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*ri.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new fC(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new mC(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,d.time,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new pC(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new xC(B.toSinglePrecision(c.time),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,a))}readCurve(t,e,s){if(t.curve){if(t.curve==="stepped")e.setStepped(s);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){const r=t.curve;e.setCurve(s,r[0],r[1],r[2],r[3])}}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return ii.Length;if(t=="fixed")return ii.Fixed;if(t=="percent")return ii.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},IC=class{constructor(t,e,s,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r}};class e0{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const s0=class extends e0{constructor(i){super(i),this.id=s0.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(i,t){this.computeWorldVertices(i,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(i,t,e,s,r,n){e=r+(e>>1)*n;const a=i.bone.skeleton,h=i.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=i.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=r;b<e;v+=2,b+=n){const w=o[v],E=o[v+1];s[b]=w*g+E*_+p,s[b+1]=w*x+E*y+m}return}let u=0,c=0;for(let f=0;f<t;f+=2){const p=l[u];u+=p+1,c+=p}const d=a.bones;if(h.length==0)for(let f=r,p=c*3;f<e;f+=n){let m=0,g=0,_=l[u++];for(_+=u;u<_;u++,p+=3){const x=d[l[u]].matrix,y=o[p],v=o[p+1],b=o[p+2];m+=(y*x.a+v*x.c+x.tx)*b,g+=(y*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=r,m=c*3,g=c<<1;p<e;p+=n){let _=0,x=0,y=l[u++];for(y+=u;u<y;u++,m+=3,g+=2){const v=d[l[u]].matrix,b=o[m]+f[g],w=o[m+1]+f[g+1],E=o[m+2];_+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=_,s[p+1]=x}}}copyTo(i){this.bones?(i.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,i.bones,0,this.bones.length)):i.bones=null,this.vertices&&(i.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,i.vertices,0,this.vertices.length)),i.worldVerticesLength=this.worldVerticesLength,i.timelineAttachment=this.timelineAttachment}};let ni=s0;ni.nextID=0;class qu extends ni{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new qu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Zu extends ni{constructor(t){super(t),this.type=at.Clipping,this.endSlot=null,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new Zu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Mo extends ni{constructor(t,e){super(t),this.type=at.Mesh,this.region=null,this.triangles=[],this.color=new X(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new X(0,0,0,0),this.path=e}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,n,a)}newLinkedMesh(){const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t}}class Ku extends ni{constructor(t){super(t),this.type=at.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new Ku(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Qu extends ni{constructor(t){super(t),this.type=at.Point,this.x=0,this.y=0,this.rotation=0,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new Qu(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const r0=class extends e0{constructor(i,t){super(i),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const i=this.region,t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=this.x,c=this.y,d=s*o+u,f=s*l,p=r*o+c,m=r*l,g=n*o+u,_=n*l,x=a*o+c,y=a*l,v=this.offset;v[0]=d-m,v[1]=p+f,v[2]=d-y,v[3]=x+f,v[4]=g-y,v[5]=x+_,v[6]=g-m,v[7]=p+_;const b=this.uvs;i.degrees==90?(b[2]=i.u,b[3]=i.v2,b[4]=i.u,b[5]=i.v,b[6]=i.u2,b[7]=i.v,b[0]=i.u2,b[1]=i.v2):(b[0]=i.u,b[1]=i.v2,b[2]=i.u,b[3]=i.v,b[4]=i.u2,b[5]=i.v,b[6]=i.u2,b[7]=i.v2)}computeWorldVertices(i,t,e,s){this.sequence!=null&&this.sequence.apply(i,this);const r=i.bone,n=this.offset,a=r.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[2],p=n[3],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[4],p=n[5],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[6],p=n[7],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o}copy(){const i=new r0(this.name,this.path);return i.region=this.region,i.rendererObject=this.rendererObject,i.x=this.x,i.y=this.y,i.scaleX=this.scaleX,i.scaleY=this.scaleY,i.rotation=this.rotation,i.width=this.width,i.height=this.height,B.arrayCopy(this.uvs,0,i.uvs,0,8),B.arrayCopy(this.offset,0,i.offset,0,8),i.color.setFromColor(this.color),i.sequence=this.sequence!=null?this.sequence.copy():null,i}};let gt=r0;gt.X1=0,gt.Y1=1,gt.C1R=2,gt.C1G=3,gt.C1B=4,gt.C1A=5,gt.U1=6,gt.V1=7,gt.X2=8,gt.Y2=9,gt.C2R=10,gt.C2G=11,gt.C2B=12,gt.C2A=13,gt.U2=14,gt.V2=15,gt.X3=16,gt.Y3=17,gt.C3R=18,gt.C3G=19,gt.C3B=20,gt.C3A=21,gt.U3=22,gt.V3=23,gt.X4=24,gt.Y4=25,gt.C4R=26,gt.C4G=27,gt.C4B=28,gt.C4A=29,gt.U4=30,gt.V4=31;const yl=class{constructor(i){this.id=yl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(i)}copy(){const i=new yl(this.regions.length);return B.arrayCopy(this.regions,0,i.regions,0,this.regions.length),i.start=this.start,i.digits=this.digits,i.setupIndex=this.setupIndex,i}apply(i,t){let e=i.sequenceIndex;e==-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(i,t){let e=i;const s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)e+="0";return e+=s,e}static nextID(){return yl._nextID++}};let Ju=yl;Ju._nextID=0;var Pr=(i=>(i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse",i))(Pr||{});const i0=[0,1,2,3,4,5,6];class td{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new LS,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}}const yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19};class he{constructor(t,e){this.propertyIds=e,this.frames=B.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){const s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){const r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}}class lr extends he{constructor(t,e,s){super(t,s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-r+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=r+v,E=n+b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getBezierValue(t,e,s,r){const n=this.curves;if(n[r]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}const a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){const l=n[r-2],u=n[r-1];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}e+=this.getFrameEntries();const h=n[a-2],o=n[a-1];return o+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-o)}}class hr extends lr{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const r=this.curves[s>>1];switch(r){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}}class ed extends lr{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class n0 extends hr{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.rotation=o.data.rotation;return;case S.first:o.rotation+=(o.data.rotation-o.rotation)*n}return}let u=this.getCurveValue(s);switch(a){case S.setup:o.rotation=o.data.rotation+u*n;break;case S.first:case S.replace:u+=o.data.rotation-o.rotation;case S.add:o.rotation+=u*n}}}class o0 extends ed{constructor(t,e,s){super(t,e,`${yt.x}|${s}`,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.x=o.data.x+u*n,o.y=o.data.y+c*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case S.add:o.x+=u*n,o.y+=c*n}}}class a0 extends hr{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x;return;case S.first:o.x+=(o.data.x-o.x)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.x=o.data.x+u*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n;break;case S.add:o.x+=u*n}}}class l0 extends hr{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.y=o.data.y;return;case S.first:o.y+=(o.data.y-o.y)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.y=o.data.y+u*n;break;case S.first:case S.replace:o.y+=(o.data.y+u-o.y)*n;break;case S.add:o.y+=u*n}}}class h0 extends ed{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX,o.scaleY=o.data.scaleY;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u,c;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(u*=o.data.scaleX,c*=o.data.scaleY,n==1)a==S.add?(o.scaleX+=u-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=u,o.scaleY=c);else{let p=0,m=0;if(h==At.mixOut)switch(a){case S.setup:p=o.data.scaleX,m=o.data.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=o.scaleX,m=o.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(a){case S.setup:p=Math.abs(o.data.scaleX)*D.signum(u),m=Math.abs(o.data.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.first:case S.replace:p=Math.abs(o.scaleX)*D.signum(u),m=Math.abs(o.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}}class c0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n}return}const u=this.getCurveValue(s)*o.data.scaleX;if(n==1)a==S.add?o.scaleX+=u-o.data.scaleX:o.scaleX=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}}}}class u0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleY=o.data.scaleY;return;case S.first:o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}const u=this.getCurveValue(s)*o.data.scaleY;if(n==1)a==S.add?o.scaleY+=u-o.data.scaleY:o.scaleY=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}}}}class d0 extends ed{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX,o.shearY=o.data.shearY;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.shearX=o.data.shearX+u*n,o.shearY=o.data.shearY+c*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case S.add:o.shearX+=u*n,o.shearY+=c*n}}}class f0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearX=o.data.shearX+u*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n;break;case S.add:o.shearX+=u*n}}}class p0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearY=o.data.shearY;return;case S.first:o.shearY+=(o.data.shearY-o.shearY)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearY=o.data.shearY+u*n;break;case S.first:case S.replace:o.shearY+=(o.data.shearY+u-o.shearY)*n;break;case S.add:o.shearY+=u*n}}}class m0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const _=o.data.color;switch(a){case S.setup:u.setFromColor(_);return;case S.first:u.add((_.r-u.r)*n,(_.g-u.g)*n,(_.b-u.b)*n,(_.a-u.a)*n)}return}let c=0,d=0,f=0,p=0;const m=he.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const _=l[m];c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];const x=(s-_)/(l[m+5]-_);c+=(l[m+5+1]-c)*x,d+=(l[m+5+2]-d)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),f=this.getBezierValue(s,m,3,g+18*2-2),p=this.getBezierValue(s,m,4,g+18*3-2)}n==1?u.set(c,d,f,p):(a==S.setup&&u.setFromColor(o.data.color),u.add((c-u.r)*n,(d-u.g)*n,(f-u.b)*n,(p-u.a)*n))}}class g0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const g=o.data.color;switch(a){case S.setup:u.r=g.r,u.g=g.g,u.b=g.b;return;case S.first:u.r+=(g.r-u.r)*n,u.g+=(g.g-u.g)*n,u.b+=(g.b-u.b)*n}return}let c=0,d=0,f=0;const p=he.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];c=l[p+1],d=l[p+2],f=l[p+3];const _=(s-g)/(l[p+4]-g);c+=(l[p+4+1]-c)*_,d+=(l[p+4+2]-d)*_,f+=(l[p+4+3]-f)*_;break;case 1:c=l[p+1],d=l[p+2],f=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)u.r=c,u.g=d,u.b=f;else{if(a==S.setup){const g=o.data.color;u.r=g.r,u.g=g.g,u.b=g.b}u.r+=(c-u.r)*n,u.g+=(d-u.g)*n,u.b+=(f-u.b)*n}}}class _0 extends hr{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.color;if(s<this.frames[0]){const c=o.data.color;switch(a){case S.setup:l.a=c.a;return;case S.first:l.a+=(c.a-l.a)*n}return}const u=this.getCurveValue(s);n==1?l.a=u:(a==S.setup&&(l.a=o.data.color.a),l.a+=(u-l.a)*n)}}class y0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const b=o.data.color,w=o.data.darkColor;switch(a){case S.setup:u.setFromColor(b),c.r=w.r,c.g=w.g,c.b=w.b;return;case S.first:u.add((b.r-u.r)*n,(b.g-u.g)*n,(b.b-u.b)*n,(b.a-u.a)*n),c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0,x=0;const y=he.search(l,s,8),v=this.curves[y>>3];switch(v){case 0:const b=l[y];d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];const w=(s-b)/(l[y+8]-b);d+=(l[y+8+1]-d)*w,f+=(l[y+8+2]-f)*w,p+=(l[y+8+3]-p)*w,m+=(l[y+8+4]-m)*w,g+=(l[y+8+5]-g)*w,_+=(l[y+8+6]-_)*w,x+=(l[y+8+7]-x)*w;break;case 1:d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];break;default:d=this.getBezierValue(s,y,1,v-2),f=this.getBezierValue(s,y,2,v+18-2),p=this.getBezierValue(s,y,3,v+18*2-2),m=this.getBezierValue(s,y,4,v+18*3-2),g=this.getBezierValue(s,y,5,v+18*4-2),_=this.getBezierValue(s,y,6,v+18*5-2),x=this.getBezierValue(s,y,7,v+18*6-2)}if(n==1)u.set(d,f,p,m),c.r=g,c.g=_,c.b=x;else{if(a==S.setup){u.setFromColor(o.data.color);const b=o.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}u.add((d-u.r)*n,(f-u.g)*n,(p-u.b)*n,(m-u.a)*n),c.r+=(g-c.r)*n,c.g+=(_-c.g)*n,c.b+=(x-c.b)*n}}}class x0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const v=o.data.color,b=o.data.darkColor;switch(a){case S.setup:u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b;return;case S.first:u.r+=(v.r-u.r)*n,u.g+=(v.g-u.g)*n,u.b+=(v.b-u.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0;const x=he.search(l,s,7),y=this.curves[x/7];switch(y){case 0:const v=l[x];d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];const b=(s-v)/(l[x+7]-v);d+=(l[x+7+1]-d)*b,f+=(l[x+7+2]-f)*b,p+=(l[x+7+3]-p)*b,m+=(l[x+7+4]-m)*b,g+=(l[x+7+5]-g)*b,_+=(l[x+7+6]-_)*b;break;case 1:d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];break;default:d=this.getBezierValue(s,x,1,y-2),f=this.getBezierValue(s,x,2,y+18-2),p=this.getBezierValue(s,x,3,y+18*2-2),m=this.getBezierValue(s,x,4,y+18*3-2),g=this.getBezierValue(s,x,5,y+18*4-2),_=this.getBezierValue(s,x,6,y+18*5-2)}if(n==1)u.r=d,u.g=f,u.b=p,c.r=m,c.g=g,c.b=_;else{if(a==S.setup){const v=o.data.color,b=o.data.darkColor;u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b}u.r+=(d-u.r)*n,u.g+=(f-u.g)*n,u.b+=(p-u.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(_-c.b)*n}}}class v0 extends he{constructor(t,e){super(t,[`${yt.attachment}|${e}`]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(o.bone.active){if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}if(s<this.frames[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}this.setAttachment(t,o,this.attachmentNames[he.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class b0 extends lr{constructor(t,e,s,r){super(t,e,[`${yt.deform}|${s}|${r.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-r+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=r+v,E=b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let r=s[e];switch(r){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(r-=2,s[r]>t){const o=this.frames[e];return s[r+1]*(t-o)/(s[r]-o)}const n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){const o=s[r-2],l=s[r-1];return l+(t-o)/(s[r]-o)*(s[r+1]-l)}const a=s[n-2],h=s[n-1];return h+(1-h)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof ni)||l.timelineAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;return}u.length=d;const x=l;if(x.bones){n=1-n;for(let y=0;y<d;y++)u[y]*=n}else{const y=x.vertices;for(let v=0;v<d;v++)u[v]+=(y[v]-u[v])*n}}return}if(u.length=d,s>=f[f.length-1]){const x=c[f.length-1];if(n==1)if(a==S.add){const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v];else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,u,0,d);else switch(a){case S.setup:{const v=l;if(v.bones)for(let b=0;b<d;b++)u[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<d;w++){const E=b[w];u[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<d;v++)u[v]+=(x[v]-u[v])*n;break;case S.add:const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v]*n;else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=(x[b]-v[b])*n}}return}const p=he.search1(f,s),m=this.getCurvePercent(s,p),g=c[p],_=c[p+1];if(n==1)if(a==S.add){const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=v+(_[y]-v)*m}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=b+(_[v]-b)*m-y[v]}}}else for(let x=0;x<d;x++){const y=g[x];u[x]=y+(_[x]-y)*m}else switch(a){case S.setup:{const y=l;if(y.bones)for(let v=0;v<d;v++){const b=g[v];u[v]=(b+(_[v]-b)*m)*n}else{const v=y.vertices;for(let b=0;b<d;b++){const w=g[b],E=v[b];u[b]=E+(w+(_[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m-u[y])*n}break;case S.add:const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m)*n}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=(b+(_[v]-b)*m-y[v])*n}}}}}const w0=class extends he{constructor(i){super(i,w0.propertyIds),this.events=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t){this.frames[i]=t.time,this.events[i]=t}apply(i,t,e,s,r,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(i,t,Number.MAX_VALUE,s,r,n,a),t=-1;else if(t>=h[o-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=he.search1(h,t)+1;const u=h[l];for(;l>0&&h[l-1]==u;)l--}for(;l<o&&e>=h[l];l++)s.push(this.events[l])}};let sd=w0;sd.propertyIds=[`${yt.event}`];const E0=class extends he{constructor(i){super(i,E0.propertyIds),this.drawOrders=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t,e){this.frames[i]=t,this.drawOrders[i]=e}apply(i,t,e,s,r,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);else{const l=i.drawOrder,u=i.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let rd=E0;rd.propertyIds=[`${yt.drawOrder}`];class T0 extends lr{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,r,n,a,h){const o=t.ikConstraints[this.ikConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let u=0,c=0;const d=he.search(l,s,6),f=this.curves[d/6];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+6]-p);u+=(l[d+6+1]-u)*m,c+=(l[d+6+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}a==S.setup?(o.mix=o.data.mix+(u-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,h==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0)):(o.mix+=(u-o.mix)*n,o.softness+=(c-o.softness)*n,h==At.mixIn&&(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0))}}class A0 extends lr{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.transformConstraints[this.transformConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){const x=o.data;switch(a){case S.setup:o.mixRotate=x.mixRotate,o.mixX=x.mixX,o.mixY=x.mixY,o.mixScaleX=x.mixScaleX,o.mixScaleY=x.mixScaleY,o.mixShearY=x.mixShearY;return;case S.first:o.mixRotate+=(x.mixRotate-o.mixRotate)*n,o.mixX+=(x.mixX-o.mixX)*n,o.mixY+=(x.mixY-o.mixY)*n,o.mixScaleX+=(x.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(x.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(x.mixShearY-o.mixShearY)*n}return}let u,c,d,f,p,m;const g=he.search(l,s,7),_=this.curves[g/7];switch(_){case 0:const x=l[g];u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const y=(s-x)/(l[g+7]-x);u+=(l[g+7+1]-u)*y,c+=(l[g+7+2]-c)*y,d+=(l[g+7+3]-d)*y,f+=(l[g+7+4]-f)*y,p+=(l[g+7+5]-p)*y,m+=(l[g+7+6]-m)*y;break;case 1:u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:u=this.getBezierValue(s,g,1,_-2),c=this.getBezierValue(s,g,2,_+18-2),d=this.getBezierValue(s,g,3,_+18*2-2),f=this.getBezierValue(s,g,4,_+18*3-2),p=this.getBezierValue(s,g,5,_+18*4-2),m=this.getBezierValue(s,g,6,_+18*5-2)}if(a==S.setup){const x=o.data;o.mixRotate=x.mixRotate+(u-x.mixRotate)*n,o.mixX=x.mixX+(c-x.mixX)*n,o.mixY=x.mixY+(d-x.mixY)*n,o.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,o.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,o.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n,o.mixScaleX+=(f-o.mixScaleX)*n,o.mixScaleY+=(p-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class S0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*n}return}const u=this.getCurveValue(s);a==S.setup?o.position=o.data.position+(u-o.data.position)*n:o.position+=(u-o.position)*n}}class C0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.spacing=o.data.spacing;return;case S.first:o.spacing+=(o.data.spacing-o.spacing)*n}return}const u=this.getCurveValue(s);a==S.setup?o.spacing=o.data.spacing+(u-o.data.spacing)*n:o.spacing+=(u-o.spacing)*n}}class I0 extends lr{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=r,a[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,o.mixY=o.data.mixY;return;case S.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u,c,d;const f=he.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];u=l[f+1],c=l[f+2],d=l[f+3];const g=(s-m)/(l[f+4]-m);u+=(l[f+4+1]-u)*g,c+=(l[f+4+2]-c)*g,d+=(l[f+4+3]-d)*g;break;case 1:u=l[f+1],c=l[f+2],d=l[f+3];break;default:u=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2)}if(a==S.setup){const m=o.data;o.mixRotate=m.mixRotate+(u-m.mixRotate)*n,o.mixX=m.mixX+(c-m.mixX)*n,o.mixY=m.mixY+(d-m.mixY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n}}const oi=class extends he{constructor(i,t,e){super(i,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return oi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(i,t,e,s,r){const n=this.frames;i*=oi.ENTRIES,n[i]=t,n[i+oi.MODE]=e|s<<4,n[i+oi.DELAY]=r}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof ni)||o.timelineAttachment!=l))return;const u=this.frames;if(e<u[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const c=he.search(u,e,oi.ENTRIES),d=u[c],f=u[c+oi.MODE],p=u[c+oi.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=i0[f&15];if(_!=Pr.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pr.once:m=Math.min(g-1,m);break;case Pr.loop:m%=g;break;case Pr.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pr.onceReverse:m=Math.max(g-1-m,0);break;case Pr.loopReverse:m=g-1-m%g;break;case Pr.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=oi;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new td("<empty>",[],0);class P0{constructor(t){this.atlas=t}loadSequence(t,e,s){const r=s.regions;for(let n=0,a=r.length;n<a;n++){const h=s.getPath(e,n),o=this.atlas.findRegion(h);if(o==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);r[n]=o,r[n].renderObject=r[n]}}newRegionAttachment(t,e,s,r){const n=new gt(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);a.renderObject=a,n.region=a}return n}newMeshAttachment(t,e,s,r){const n=new Mo(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);a.renderObject=a,n.region=a}return n}newBoundingBoxAttachment(t,e){return new qu(e)}newPathAttachment(t,e){return new Ku(e)}newPointAttachment(t,e){return new Qu(e)}newClippingAttachment(t,e){return new Zu(e)}}class R0{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class id{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let M0=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class F0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class k0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class B0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Ps.Fixed,this.rotateMode=Fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Ps=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional",i))(Ps||{});class D0{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}}class O0{constructor(t,e,s){if(this.index=0,this.color=new X(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=W.NORMAL,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class L0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class N0{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class nd{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment&&(r.attachment instanceof Mo?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new N0(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new N0(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u&&n.setAttachment(u);break}}}s++}}}class V0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new D0;s.name="";const r=new gl(t),n=r.readInt32(),a=r.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=r.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const c=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(c)}this.ver40=h==="4.0",s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat();const o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("String in string table must not be null.");r.strings.push(d)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[r.readInt(!0)],p=new R0(c,d,f);p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.transformMode=r.readInt(!0),p.skinRequired=r.readBoolean(),o&&X.rgba8888ToColor(p.color,r.readInt32()),s.bones.push(p)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[r.readInt(!0)],p=new O0(c,d,f);X.rgba8888ToColor(p.color,r.readInt32());const m=r.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=r.readStringRef(),p.blendMode=r.readInt(!0),s.slots.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new k0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.mix=r.readFloat(),p.softness=r.readFloat()*e,p.bendDirection=r.readByte(),p.compress=r.readBoolean(),p.stretch=r.readBoolean(),p.uniform=r.readBoolean(),s.ikConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new L0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.local=r.readBoolean(),p.relative=r.readBoolean(),p.offsetRotation=r.readFloat(),p.offsetX=r.readFloat()*e,p.offsetY=r.readFloat()*e,p.offsetScaleX=r.readFloat(),p.offsetScaleY=r.readFloat(),p.offsetShearY=r.readFloat(),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),p.mixScaleX=r.readFloat(),p.mixScaleY=r.readFloat(),p.mixShearY=r.readFloat(),s.transformConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new B0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.slots[r.readInt(!0)],p.positionMode=r.readInt(!0),p.spacingMode=r.readInt(!0),p.rotateMode=r.readInt(!0),p.offsetRotation=r.readFloat(),p.position=r.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=r.readFloat(),(p.spacingMode==Ps.Length||p.spacingMode==Ps.Fixed)&&(p.spacing*=e),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(r,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+r.readInt(!0));c<l;c++){const d=this.readSkin(r,s,!1,o);if(!d)throw new Error("readSkin() should not have returned null.");s.skins[c]=d}}l=this.linkedMeshes.length;for(let c=0;c<l;c++){const d=this.linkedMeshes[c],f=d.skin?s.findSkin(d.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readStringRef();if(!d)throw new Error;const f=new F0(d);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,d,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),a==0)return null;n=new nd("default")}else{const h=t.readStringRef();if(!h)throw new Error("Skin name must not be null.");n=new nd(h),n.bones.length=t.readInt(!0);for(let o=0,l=n.bones.length;o<l;o++)n.bones[o]=e.bones[t.readInt(!0)];for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let h=0;h<a;h++){const o=t.readInt(!0);for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,n,o,c,r);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,r,n,a){const h=this.scale;let o=t.readStringRef();switch(o||(o=n),t.readByte()){case at.Region:{let l=t.readStringRef();const u=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),_=t.readInt32(),x=this.readSequence(t);l||(l=o);const y=this.attachmentLoader.newRegionAttachment(s,o,l,x);return y?(y.path=l,y.x=c*h,y.y=d*h,y.scaleX=f,y.scaleY=p,y.rotation=u,y.width=m*h,y.height=g*h,X.rgba8888ToColor(y.color,_),y.sequence=x,x==null&&y.updateRegion(),y):null}case at.BoundingBox:{const l=t.readInt(!0),u=this.readVertices(t,l),c=a?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l<<1,d.vertices=u.vertices,d.bones=u.bones,a&&X.rgba8888ToColor(d.color,c),d):null}case at.Mesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readInt(!0),d=this.readFloatArray(t,c<<1,1),f=this.readShortArray(t),p=this.readVertices(t,c),m=t.readInt(!0),g=this.readSequence(t);let _=[],x=0,y=0;a&&(_=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),l||(l=o);const v=this.attachmentLoader.newMeshAttachment(s,o,l,g);return v?(v.path=l,X.rgba8888ToColor(v.color,u),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=c<<1,v.triangles=f,v.regionUVs=new Float32Array(d),v.hullLength=m<<1,v.sequence=g,a&&(v.edges=_,v.width=x*h,v.height=y*h),v):null}case at.LinkedMesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;a&&(m=t.readFloat(),g=t.readFloat()),l||(l=o);const _=this.attachmentLoader.newMeshAttachment(s,o,l,p);return _?(_.path=l,X.rgba8888ToColor(_.color,u),_.sequence=p,a&&(_.width=m*h,_.height=g*h),this.linkedMeshes.push(new PC(_,c,r,d,f)),_):null}case at.Path:{const l=t.readBoolean(),u=t.readBoolean(),c=t.readInt(!0),d=this.readVertices(t,c),f=B.newArray(c/3,0);for(let g=0,_=f.length;g<_;g++)f[g]=t.readFloat()*h;const p=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=u,m.worldVerticesLength=c<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&X.rgba8888ToColor(m.color,p),m):null}case at.Point:{const l=t.readFloat(),u=t.readFloat(),c=t.readFloat(),d=a?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=u*h,f.y=c*h,f.rotation=l,a&&X.rgba8888ToColor(f.color,d),f):null}case at.Clipping:{const l=t.readInt(!0),u=t.readInt(!0),c=this.readVertices(t,u),d=a?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,o);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,a&&X.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Ju(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?U0:t.readByte()}readVertices(t,e){const s=this.scale,r=e<<1,n=new RC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,s),n;const a=new Array,h=new Array;for(let o=0;o<e;o++){const l=t.readInt(!0);h.push(l);for(let u=0;u<l;u++)h.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=B.toFloatArray(a),n.bones=h,n}readFloatArray(t,e,s){const r=new Array(e);if(s==1)for(let n=0;n<e;n++)r[n]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const r=new Array,n=this.scale;for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case GC:{const _=new v0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());r.push(_);break}case XC:{const _=t.readInt(!0),x=new m0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let T=0,A=0;x.setFrame(T,y,v,b,w,E),T!=g;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(T);break;case Ms:ct(t,x,A++,T,0,y,I,v,M,1),ct(t,x,A++,T,1,y,I,b,R,1),ct(t,x,A++,T,2,y,I,w,C,1),ct(t,x,A++,T,3,y,I,E,P,1)}y=I,v=M,b=R,w=C,E=P}r.push(x);break}case $C:{const _=t.readInt(!0),x=new g0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,y,v,b,w),E!=g;E++){const A=t.readFloat(),I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(E);break;case Ms:ct(t,x,T++,E,0,y,A,v,I,1),ct(t,x,T++,E,1,y,A,b,M,1),ct(t,x,T++,E,2,y,A,w,R,1)}y=A,v=I,b=M,w=R}r.push(x);break}case YC:{const _=t.readInt(!0),x=new y0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,R=0;x.setFrame(M,y,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(M);break;case Ms:ct(t,x,R++,M,0,y,C,v,P,1),ct(t,x,R++,M,1,y,C,b,k,1),ct(t,x,R++,M,2,y,C,w,U,1),ct(t,x,R++,M,3,y,C,E,V,1),ct(t,x,R++,M,4,y,C,T,L,1),ct(t,x,R++,M,5,y,C,A,$,1),ct(t,x,R++,M,6,y,C,I,O,1)}y=C,v=P,b=k,w=U,E=V,T=L,A=$,I=O}r.push(x);break}case HC:{const _=t.readInt(!0),x=new x0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,v,b,w,E,T,A),I!=g;I++){const R=t.readFloat(),C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(I);break;case Ms:ct(t,x,M++,I,0,y,R,v,C,1),ct(t,x,M++,I,1,y,R,b,P,1),ct(t,x,M++,I,2,y,R,w,k,1),ct(t,x,M++,I,3,y,R,E,U,1),ct(t,x,M++,I,4,y,R,T,V,1),ct(t,x,M++,I,5,y,R,A,L,1)}y=R,v=C,b=P,w=k,E=U,T=V,A=L}r.push(x);break}case WC:{const _=new _0(m,t.readInt(!0),c);let x=t.readFloat(),y=t.readUnsignedByte()/255;for(let v=0,b=0;_.setFrame(v,x,y),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:_.setStepped(v);break;case Ms:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}r.push(_)}}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case MC:r.push(Rr(t,new n0(m,g,c),1));break;case FC:r.push(od(t,new o0(m,g,c),n));break;case kC:r.push(Rr(t,new a0(m,g,c),n));break;case BC:r.push(Rr(t,new l0(m,g,c),n));break;case DC:r.push(od(t,new h0(m,g,c),1));break;case OC:r.push(Rr(t,new c0(m,g,c),1));break;case LC:r.push(Rr(t,new u0(m,g,c),1));break;case NC:r.push(od(t,new d0(m,g,c),1));break;case VC:r.push(Rr(t,new f0(m,g,c),1));break;case UC:r.push(Rr(t,new p0(m,g,c),1))}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new T0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat()*n;for(let x=0,y=0;p.setFrame(x,m,g,_,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Rs:p.setStepped(x);break;case Ms:ct(t,p,y++,x,0,m,v,g,b,1),ct(t,p,y++,x,1,m,v,_,w,n)}m=v,g=b,_=w}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new A0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,_,x,y,v,b),w!=f;w++){const T=t.readFloat(),A=t.readFloat(),I=t.readFloat(),M=t.readFloat(),R=t.readFloat(),C=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Rs:p.setStepped(w);break;case Ms:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,_,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,y,R,1),ct(t,p,E++,w,4,m,T,v,C,1),ct(t,p,E++,w,5,m,T,b,P,1)}m=T,g=A,_=I,x=M,y=R,v=C,b=P}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case jC:r.push(Rr(t,new S0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case qC:r.push(Rr(t,new C0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Ps.Length||d.spacingMode==Ps.Fixed?n:1));break;case ZC:const m=new I0(t.readInt(!0),t.readInt(!0),c);let g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,_,x,y),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Rs:m.setStepped(v);break;case Ms:ct(t,m,b++,v,0,g,E,_,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,y,I,1)}g=E,_=T,x=A,y=I}r.push(m)}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const _=t.readStringRef();if(!_)throw new Error("attachmentName must not be null.");const x=c.getAttachment(p,_),y=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(y){case U0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new b0(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,U=t.readInt(!0);if(U==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(U+=L,n==1)for(let $=L;$<U;$++)k[$]=t.readFloat();else for(let $=L;$<U;$++)k[$]=t.readFloat()*n;if(!E)for(let $=0,O=k.length;$<O;$++)k[$]+=T[$]}if(M.setFrame(C,R,k),C==b)break;const V=t.readFloat();switch(t.readByte()){case Rs:M.setStepped(C);break;case Ms:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}r.push(M);break}case zC:{const w=new Fo(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,i0[A&15],A>>4,t.readFloat())}r.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new rd(a),u=s.slots.length;for(let c=0;c<a;c++){const d=t.readFloat(),f=t.readInt(!0),p=B.newArray(u,0);for(let x=u-1;x>=0;x--)p[x]=-1;const m=B.newArray(u-f,0);let g=0,_=0;for(let x=0;x<f;x++){const y=t.readInt(!0);for(;g!=y;)m[_++]=g++;p[g+t.readInt(!0)]=g++}for(;g<u;)m[_++]=g++;for(let x=u-1;x>=0;x--)p[x]==-1&&(p[x]=m[--_]);l.setFrame(c,d,p)}r.push(l)}const h=t.readInt(!0);if(h>0){const l=new sd(h);for(let u=0;u<h;u++){const c=t.readFloat(),d=s.events[t.readInt(!0)],f=new M0(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():d.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(u,f)}r.push(l)}let o=0;for(let l=0,u=r.length;l<u;l++)o=Math.max(o,r[l].getDuration());return new td(e,r,o)}}V0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let PC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};class RC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Rr(i,t,e){let s=i.readFloat(),r=i.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,r),n!=h;n++){const o=i.readFloat(),l=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(n);break;case Ms:ct(i,t,a++,n,0,s,o,r,l,e)}s=o,r=l}return t}function od(i,t,e){let s=i.readFloat(),r=i.readFloat()*e,n=i.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,r,n),a!=o;a++){const l=i.readFloat(),u=i.readFloat()*e,c=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(a);break;case Ms:ct(i,t,h++,a,0,s,l,r,u,e),ct(i,t,h++,a,1,s,l,n,c,e)}s=l,r=u,n=c}return t}function ct(i,t,e,s,r,n,a,h,o,l){t.setBezier(e,s,r,n,h,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,a,o)}const MC=0,FC=1,kC=2,BC=3,DC=4,OC=5,LC=6,NC=7,VC=8,UC=9,GC=0,XC=1,$C=2,YC=3,HC=4,WC=5,U0=0,zC=1,jC=0,qC=1,ZC=2,Rs=1,Ms=2;class ad{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new D0,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const a=s.version.substr(0,3);if(a!=="4.0"&&a!=="4.1"){const h=`Spine 4.1 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(h)}s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=F(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new R0(s.bones.length,h.name,o);u.length=F(h,"length",0)*e,u.x=F(h,"x",0)*e,u.y=F(h,"y",0)*e,u.rotation=F(h,"rotation",0),u.scaleX=F(h,"scaleX",1),u.scaleY=F(h,"scaleY",1),u.shearX=F(h,"shearX",0),u.shearY=F(h,"shearY",0),u.transformMode=B.enumValue(vt,F(h,"transform","Normal")),u.skinRequired=F(h,"skin",!1);const c=F(h,"color",null);c&&u.color.setFromString(c),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=s.findBone(h.bone);if(!o)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new O0(s.slots.length,h.name,o),u=F(h,"color",null);u&&l.color.setFromString(u);const c=F(h,"dark",null);c&&(l.darkColor=X.fromString(c)),l.attachmentName=F(h,"attachment",null),l.blendMode=ad.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new k0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(c==null)throw new Error(`IK bone not found: ${u}`);o.bones.push(c)}o.target=s.findBone(h.target),o.mix=F(h,"mix",1),o.softness=F(h,"softness",0)*e,o.bendDirection=F(h,"bendPositive",!0)?1:-1,o.compress=F(h,"compress",!1),o.stretch=F(h,"stretch",!1),o.uniform=F(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new L0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findBone(l);if(!u)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);o.target=u,o.local=F(h,"local",!1),o.relative=F(h,"relative",!1),o.offsetRotation=F(h,"rotation",0),o.offsetX=F(h,"x",0)*e,o.offsetY=F(h,"y",0)*e,o.offsetScaleX=F(h,"scaleX",0),o.offsetScaleY=F(h,"scaleY",0),o.offsetShearY=F(h,"shearY",0),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),o.mixScaleX=F(h,"mixScaleX",1),o.mixScaleY=F(h,"mixScaleY",o.mixScaleX),o.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new B0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findSlot(l);if(!u)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);o.target=u,o.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),o.spacingMode=B.enumValue(Ps,F(h,"spacingMode","Length")),o.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),o.offsetRotation=F(h,"rotation",0),o.position=F(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=F(h,"spacing",0),(o.spacingMode==Ps.Length||o.spacingMode==Ps.Fixed)&&(o.spacing*=e),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new nd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(!c)throw new Error(`Couldn't find bone ${u} for skin ${h.name}.`);o.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=h.ik[l],c=s.findIkConstraint(u);if(!c)throw new Error(`Couldn't find IK constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=h.transform[l],c=s.findTransformConstraint(u);if(!c)throw new Error(`Couldn't find transform constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const u=h.path[l],c=s.findPathConstraint(u);if(!c)throw new Error(`Couldn't find path constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}for(const l in h.attachments){const u=s.findSlot(l);if(!u)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin?s.findSkin(o.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(!u)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.timelineAttachment=o.inheritTimeline?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new F0(a);o.intValue=F(h,"int",0),o.floatValue=F(h,"float",0),o.stringValue=F(h,"string",""),o.audioPath=F(h,"audio",null),o.audioPath&&(o.volume=F(h,"volume",1),o.balance=F(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=F(t,"name",r),F(t,"type","region")){case"region":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,r,h,o);if(!l)return null;l.path=h,l.x=F(t,"x",0)*a,l.y=F(t,"y",0)*a,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*a,l.height=t.height*a,l.sequence=o;const u=F(t,"color",null);return u&&l.color.setFromString(u),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"mesh":case"linkedmesh":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,r,h,o);if(!l)return null;l.path=h;const u=F(t,"color",null);u&&l.color.setFromString(u),l.width=F(t,"width",0)*a,l.height=F(t,"height",0)*a,l.sequence=o;const c=F(t,"parent",null);if(c)return this.linkedMeshes.push(new KC(l,F(t,"skin",null),s,c,F(t,"timelines",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,r);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,h,o<<1);const l=B.newArray(o/3,0);for(let c=0;c<t.lengths.length;c++)l[c]=t.lengths[c]*a;h.lengths=l;const u=F(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,r);if(!h)return null;h.x=F(t,"x",0)*a,h.y=F(t,"y",0)*a,h.rotation=F(t,"rotation",0);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,r);if(!h)return null;const o=F(t,"end",null);if(o!=null){const c=n.findSlot(o);if(c==null)throw new Error(`Clipping end slot not found: ${o}`);h.endSlot=c}const l=t.vertexCount;this.readVertices(t,h,l<<1);const u=F(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return null;const e=new Ju(F(t,"count",0));return e.start=F(t,"start",1),e.digits=F(t,"digits",0),e.setupIndex=F(t,"setup",0),e}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const o=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const u=l.index;for(const c in o){const d=o[c];if(!d)continue;const f=d.length;if(c=="attachment"){const p=new v0(f,u);for(let m=0;m<f;m++){const g=d[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(c=="rgba"){const p=new m0(f,f<<2,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b,_.a);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1),y=pt(E,p,y,x,3,g,b,_.a,w.a,1)),g=b,_=w,m=v}n.push(p)}else if(c=="rgb"){const p=new g0(f,f*3,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1)),g=b,_=w,m=v}n.push(p)}else if(c=="alpha")n.push(cr(d,new _0(f,f,u),0,1));else if(c=="rgba2"){const p=new y0(f,f*7,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,_.a,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,_.a,E.a,1),v=pt(A,p,v,y,4,g,w,x.r,T.r,1),v=pt(A,p,v,y,5,g,w,x.g,T.g,1),v=pt(A,p,v,y,6,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}else if(c=="rgb2"){const p=new x0(f,f*6,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,x.r,T.r,1),v=pt(A,p,v,y,4,g,w,x.g,T.g,1),v=pt(A,p,v,y,5,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const o=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const u=l.index;for(const c in o){const d=o[c],f=d.length;if(f!=0){if(c==="rotate")n.push(cr(d,new n0(f,f,u),0,1));else if(c==="translate"){const p=new o0(f,f<<1,u);n.push(ld(d,p,"x","y",0,r))}else if(c==="translatex"){const p=new a0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="translatey"){const p=new l0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="scale"){const p=new h0(f,f<<1,u);n.push(ld(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new c0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="scaley"){const p=new u0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="shear"){const p=new d0(f,f<<1,u);n.push(ld(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new f0(f,f,u);n.push(cr(d,p,0,1))}else if(c==="sheary"){const p=new p0(f,f,u);n.push(cr(d,p,0,1))}}}}if(t.ik)for(const h in t.ik){const o=t.ik[h];let l=o[0];if(!l)continue;const u=s.findIkConstraint(h);if(!u)throw new Error(`IK Constraint not found: ${h}`);const c=s.ikConstraints.indexOf(u),d=new T0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*r;for(let g=0,_=0;;g++){d.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=o[g+1];if(!x){d.shrink(_);break}const y=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*r,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,r)),f=y,p=v,m=b,l=x}n.push(d)}if(t.transform)for(const h in t.transform){const o=t.transform[h];let l=o[0];if(!l)continue;const u=s.findTransformConstraint(h);if(!u)throw new Error(`Transform constraint not found: ${h}`);const c=s.transformConstraints.indexOf(u),d=new A0(o.length,o.length*6,c);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),_=F(l,"mixScaleX",1),x=F(l,"mixScaleY",_);const y=F(l,"mixShearY",1);for(let v=0,b=0;;v++){d.setFrame(v,f,p,m,g,_,x,y);const w=o[v+1];if(!w){d.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=F(w,"mixScaleX",1),R=F(w,"mixScaleY",M),C=F(w,"mixShearY",1),P=l.curve;P&&(b=pt(P,d,b,v,0,f,E,p,T,1),b=pt(P,d,b,v,1,f,E,m,A,1),b=pt(P,d,b,v,2,f,E,g,I,1),b=pt(P,d,b,v,3,f,E,_,M,1),b=pt(P,d,b,v,4,f,E,x,R,1),b=pt(P,d,b,v,5,f,E,y,C,1)),f=E,p=T,m=A,g=I,_=M,x=R,_=M,l=w}n.push(d)}if(t.path)for(const h in t.path){const o=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const u=s.pathConstraints.indexOf(l);for(const c in o){const d=o[c];let f=d[0];if(!f)continue;const p=d.length;if(c==="position"){const m=new S0(p,p,u);n.push(cr(d,m,0,l.positionMode==ne.Fixed?r:1))}else if(c==="spacing"){const m=new C0(p,p,u);n.push(cr(d,m,0,l.spacingMode==Ps.Length||l.spacingMode==Ps.Fixed?r:1))}else if(c==="mix"){const m=new I0(p,p*3,u);let g=F(f,"time",0),_=F(f,"mixRotate",1),x=F(f,"mixX",1),y=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,_,x,y);const w=d[v+1];if(!w){m.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=f.curve;M&&(b=pt(M,m,b,v,0,g,E,_,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,y,I,1)),g=E,_=T,x=A,y=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const o=t.deform[h],l=t.attachments[h]={};for(const u in o){const c=o[u],d=l[u]={};for(const f in c)d[f]={deform:c[f]}}}}if(t.attachments)for(const h in t.attachments){const o=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const u in o){const c=o[u],d=s.findSlot(u);if(!d)throw new Error(`Slot not found: ${u}`);const f=d.index;for(const p in c){const m=c[p],g=l.getAttachment(f,p);for(const _ in m){const x=m[_];let y=x[0];if(y){if(_=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new b0(x.length,x.length,f,g);let T=F(y,"time",0);for(let A=0,I=0;;A++){let M;const R=F(y,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const U=F(y,"offset",0);if(B.arrayCopy(R,0,M,U,R.length),r!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=r;if(!v)for(let V=0;V<w;V++)M[V]+=b[V]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=y.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,y=C}n.push(E)}else if(_=="sequence"){const v=new Fo(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(y,"delay",b),T=F(y,"time",0),A=Pr[F(y,"mode","hold")],I=F(y,"index",0);v.setFrame(w,T,A,I,E),b=E,y=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new rd(t.drawOrder.length),o=s.slots.length;let l=0;for(let u=0;u<t.drawOrder.length;u++,l++){const c=t.drawOrder[u];let d=null;const f=F(c,"offsets",null);if(f){d=B.newArray(o,-1);const p=B.newArray(o-f.length,0);let m=0,g=0;for(let _=0;_<f.length;_++){const x=f[_],y=s.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);const v=y.index;for(;m!=v;)p[g++]=m++;d[m+x.offset]=m++}for(;m<o;)p[g++]=m++;for(let _=o-1;_>=0;_--)d[_]==-1&&(d[_]=p[--g])}h.setFrame(l,F(c,"time",0),d)}n.push(h)}if(t.events){const h=new sd(t.events.length);let o=0;for(let l=0;l<t.events.length;l++,o++){const u=t.events[l],c=s.findEvent(u.name);if(!c)throw new Error(`Event not found: ${u.name}`);const d=new M0(B.toSinglePrecision(F(u,"time",0)),c);d.intValue=F(u,"int",c.intValue),d.floatValue=F(u,"float",c.floatValue),d.stringValue=F(u,"string",c.stringValue),d.data.audioPath&&(d.volume=F(u,"volume",1),d.balance=F(u,"balance",0)),h.setFrame(o,d)}n.push(h)}let a=0;for(let h=0,o=n.length;h<o;h++)a=Math.max(a,n[h].getDuration());if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new td(e,n,a))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}}class KC{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}}function cr(i,t,e,s){let r=i[0],n=F(r,"time",0),a=F(r,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=i[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;r.curve&&(h=pt(r.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,r=l}}function ld(i,t,e,s,r,n){let a=i[0],h=F(a,"time",0),o=F(a,e,r)*n,l=F(a,s,r)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=i[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,r)*n,m=F(d,s,r)*n,g=a.curve;g&&(u=pt(g,t,u,c,0,h,f,o,p,n),u=pt(g,t,u,c,1,h,f,l,m,n)),h=f,o=p,l=m,a=d}}function pt(i,t,e,s,r,n,a,h,o,l){if(i=="stepped")return t.setStepped(s),e;const u=r<<2,c=i[u],d=i[u+1]*l,f=i[u+2],p=i[u+3]*l;return t.setBezier(e,s,r,n,h,c,d,f,p,a,o),e+1}function F(i,t,e){return i[t]!==void 0?i[t]:e}var ai=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VER37=37]="VER37",i[i.VER38=38]="VER38",i[i.VER40=40]="VER40",i[i.VER41=41]="VER41",i))(ai||{});function hd(i){const t=i.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:e<37?37:0}class QC{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=hd(r);if(n===ai.VER38&&(s=new le(new N_(t))),r=this.readVersionNewFormat(e),n=hd(r),(n===ai.VER40||n===ai.VER41)&&(s=new V0(new P0(t))),!s){const a=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new gl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new gl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class JC{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=hd(s);let n=null;if(r===ai.VER37&&(n=new CC(new _C(t))),r===ai.VER38&&(n=new QS(new N_(t))),(r===ai.VER40||r===ai.VER41)&&(n=new ad(new P0(t))),!n){const a=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(a)}return n.scale=this.scale,n.readSkeletonData(e)}}class tI extends rC{createBinaryParser(){return new QC}createJsonParser(){return new JC}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new tI().installLoader();class eI extends tC{constructor(t,e){const{followPointList:s,visible:r=!1}=e||{};let n;typeof t=="string"?n=Gr.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(a=>{a.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(a.boneName),follow:a.follow,onUpdate:a.onUpdate,angleFollow:a.angleFollow||!1,scaleFollow:a.scaleFollow||!0})})),this._loopFn=this._loop.bind(this),Tt.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{s()}}})}addAnimation(t="animation",e=!1,s=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){Tt.system.remove(this._loopFn),this.destroy()}_loop(){this.update(Tt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:r,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=r),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,s+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{xt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Mr=(i,t,e,s=!1)=>{i.cursor="pointer",i.eventMode="static";const r=n=>{n.button!==2&&e(n)};s?i.once(t,r):i.on(t,r)};class sI extends Bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=r,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Mr(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mr(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,r&&(this._btn.tint=r))})}toggleTexture(t,e){this._texture=t,this._hoverTexture=e,this._btn._texture=e}setDisabled(t){this.disabled=t,this._btn.tint=t?this._disabledColor:this._tintColor||"#fff",this._btn.texture=this._texture}}class rI extends Ao{constructor(t){const{sprite:e,onClick:s}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Mr(this,"pointerenter",()=>{xt.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Mr(this,"pointerleave",()=>{e.alpha=1,xt.to(e,{duration:.25,rotation:0})}),Mr(this,"pointerdown",()=>{e.alpha=.5}),Mr(this,"pointerup",()=>{s()})}}class iI extends Bt{constructor(t){super(),this._maskUI=new du({bgColor:"#000",width:1080,height:1920}),this.addChild(this._maskUI),this._maskUI.alpha=0,this._maskUI.eventMode="static",this._drawerContainer=t,this.addChild(this._drawerContainer),this._drawerContainer.y=this._maskUI.height,xt.to(this._maskUI,{duration:.25,alpha:.5}),xt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){xt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await xt.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class nI extends Bt{constructor(t){super(),this.COLLECT_TIME=5*1e3,this._nowTime=0,this._lastTime=0,this._drawCount=0,this._maxDrawCount=0,this._tempMaxDrawCount=0,this._lastCollectTime=0,this._paramTxts=[];for(let e=0;e<3;e++){const s=new Nu({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=s,s.x=0,s.y=s.height*e,this.addChild(s),s.alpha=.75}this._renderer=t.renderer,this._drawElements=this._renderer.gl.drawElements,this.init()}init(){this._renderer.gl.drawElements=(...t)=>{this._drawElements.call(this._renderer.gl,...t),this._drawCount++},Tt.shared.add(()=>{const t=Tt.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTxtInfo(0,Math.floor(t).toFixed(0)),this._lastTime=this._nowTime),this._nowTime-this._lastCollectTime<this.COLLECT_TIME?this._tempMaxDrawCount<this._drawCount&&(this._tempMaxDrawCount=this._drawCount):(this._maxDrawCount=this._tempMaxDrawCount,this._tempMaxDrawCount=0,this._lastCollectTime=this._nowTime),this._setTxtInfo(1,this._drawCount),this._setTxtInfo(2,this._maxDrawCount),this._drawCount=0},Vr.UTILITY)}_setTxtInfo(t,e){const s=a=>{this._paramTxts[t].style.fill="#fff",a<=30&&(this._paramTxts[t].style.fill="yellow"),a<=20&&(this._paramTxts[t].style.fill="red")},r=a=>{this._paramTxts[t].style.fill="#fff",a>=75&&(this._paramTxts[t].style.fill="yellow"),a>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(s(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class oI extends Bt{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:r,barHeight:n,bgTexture:a,barTexture:h}=t,o=new qe(a);this.addChild(o),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(s-n)/2;const l=new Ks;l.beginFill(16777215),l.drawRect(0,0,0,this._progressBar.height),l.endFill(),this._progressBar.addChild(l),this._progressBar.mask=l,this._maskGraphics=l}setProgress(t){const e=Math.max(0,Math.min(1,t));this._maskGraphics.clear(),this._maskGraphics.beginFill(16777215),this._maskGraphics.drawRect(0,0,this._progressBar.width*e,this._progressBar.height),this._maskGraphics.endFill()}}class aI extends Ao{constructor(t){const{width:e,height:s,scrollContent:r,bottomMargin:n=50}=t;if(super(e,s),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=r,this._content=new Bt,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new qe;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new Ks,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,s),this._maskGraphics.endFill(),this.mask=this._maskGraphics,this.eventMode="static",this.on("pointerdown",this._onDragStart,this),this.on("pointermove",this._onDragMove,this),this.on("pointerup",this._onDragEnd,this),this.on("pointerupoutside",this._onDragEnd,this),this.on("wheel",this._onWheelScroll,this)}setDimensions(t,e){this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,t,e),this._maskGraphics.endFill(),this.setSize(t,e)}scrollToTop(){xt.killTweensOf(this._content),this._content.y=0}addContent(t){this._scrollContent.addChild(t)}_onDragStart(t){if(this._content.height<=this._maskGraphics.height)return;const e=t.getLocalPosition(this);this._startY=e.y-this._content.y,this._isDragging=!0,this._velocity=0,this._startTime=Date.now(),this._startPosition=this._content.y,xt.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const s=t.getLocalPosition(this).y-this._startY;this._content.y=s}}_onDragEnd(){this._isDragging=!1;const e=Date.now()-this._startTime;e<250?(this._velocity=(this._content.y-this._startPosition)/e,this._applyInertia()):this._velocity=0,this._limitScrollRange()}_onWheelScroll(t){if(this._content.height<=this._maskGraphics.height)return;let e=this._content.y-t.deltaY*(this._scrollSpeed/100);e>0?e=0:Math.abs(e)>=this._content.height-this._maskGraphics.height&&(e=-(this._content.height-this._maskGraphics.height)),xt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){xt.to(this._content,{y:this._content.y+this._velocity*250,duration:.5,ease:"power1.out",onUpdate:this._limitScrollRange.bind(this)})}_limitScrollRange(){if(this._content.y>0)xt.to(this._content,{duration:.75,y:0,ease:"elastic.out"});else if(Math.abs(this._content.y)>=this._content.height-this._maskGraphics.height)if(this._content.height>this._maskGraphics.height){const t=-(this._content.height-this._maskGraphics.height);xt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else xt.to(this._content,{duration:.25,y:0})}}class lI extends Ao{constructor(t){const{width:e,height:s,content:r,slideCallback:n,scrollCallback:a,pageNum:h,pageHeight:o}=t;super(e,s),this._currentIndex=0,this._scrollHeight=0,this._slideHeight=0,this._startY=0,this._offsetY=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1;const l=new Ks;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=o,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=h-1,this.addChild(this._slideArea),this._slideArea.x=e/2,this._slideArea.y=this._scrollHeight/2,this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}updatePosition(t,e){this._slideArea.y=t,this._currentIndex=e}slideTo(t,e=!0){var s;t<0?(xt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:e?.25:.01,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}})),(s=this._slideCallback)==null||s.call(this,this._currentIndex)}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var s;if(!this._isDragging)return;const e=t.pageY-this._startY;this._slideArea.y=this._offsetY+e,(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startY-t.pageY,r=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||r>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}}const G0=i=>{const t=new Ks;return t.beginFill(16777215),t.drawRect(0,0,i.width,i.height),t.endFill(),i.addChild(t),i.mask=t,t};class hI extends Ao{constructor(t,e,s,r){super(t,e),this._currentIndex=0,this._slideWidth=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,G0(this),this._slideWidth=t,this._slideArea=s,this.slideCallback=r,this._pageNum=Math.floor(s.width/this._slideWidth)-1,this.addChild(s),this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}prev(){this._slideTo(this._currentIndex-1)}next(){this._slideTo(this._currentIndex+1)}_slideTo(t){t<0?(xt.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){if(!this._isDragging)return;const e=t.pageX-this._startX;this._slideArea.x=this._offsetX+e}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,r=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||r>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class cI{constructor(t,e){this._currentIndex=0,this._numsLength=0,this._isDown=!1,this._onChange=e,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}class uI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new cI(s,a=>{this._onAmountIndex(a),this.minMaxUpdateIndex(a)}),this.minMaxUpdateIndex(e),this._baseNumSteper.updateIndex(e)}min(){this.minMaxUpdateIndex(0),this._onAmountIndex(0)}max(){const t=this._betAmountListLength-1;this.minMaxUpdateIndex(t),this._onAmountIndex(t)}sub(){this._baseNumSteper.down("sub")}add(){this._baseNumSteper.down("add")}minMaxUpdateIndex(t){t===0?this._onDisabled("min"):t===this._betAmountListLength-1?this._onDisabled("max"):this._onDisabled(),this._baseNumSteper.updateIndex(t)}}const X0=(i,t,e)=>{const s=t/i.width*i.scale.x,r=e?e/i.height*i.scale.y:s,n=Math.min(s,r);i.scale.set(n>1?1:n)};class dI extends Bt{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:r=100,fontColor:n="#B4B4B8",fontSize:a=24,lineWidth:h=3,lineColor:o="#B4B4B8"}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=r,this._fontColor=n,this._fontSize=a,this._lineWidth=h,this._lineColor=o,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new Ks;s.lineStyle(this._lineWidth,this._lineColor),s.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)s.moveTo(0,r*this._cellHeight),s.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)s.moveTo(r*this._cellWidth,0),s.lineTo(r*this._cellWidth,e);this.addChild(s)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const s=this._data[t][e];this._createNumberText(s,e,t)}}_createNumberText(t,e,s){const r=new za(t.toString(),{_fontSize:this._fontSize,fill:this._fontColor}),n=e*this._cellWidth+this._cellWidth/2,a=s*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),X0(r,this._cellWidth*.9)}}var cd={};/*!
1172
1172
  * howler.js v2.2.4
1173
1173
  * howlerjs.com
1174
1174
  *
@@ -1186,7 +1186,7 @@ Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u
1186
1186
  * goldfirestudios.com
1187
1187
  *
1188
1188
  * MIT License
1189
- */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var s=this;if(!s.ctx||!s.ctx.listener)return s;for(var r=s._howls.length-1;r>=0;r--)s._howls[r].stereo(e);return s},HowlerGlobal.prototype.pos=function(e,s,r){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(s=typeof s!="number"?n._pos[1]:s,r=typeof r!="number"?n._pos[2]:r,typeof e=="number")n._pos=[e,s,r],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]);else return n._pos;return n},HowlerGlobal.prototype.orientation=function(e,s,r,n,a,h){var o=this;if(!o.ctx||!o.ctx.listener)return o;var l=o._orientation;if(s=typeof s!="number"?l[1]:s,r=typeof r!="number"?l[2]:r,n=typeof n!="number"?l[3]:n,a=typeof a!="number"?l[4]:a,h=typeof h!="number"?l[5]:h,typeof e=="number")o._orientation=[e,s,r,n,a,h],typeof o.ctx.listener.forwardX<"u"?(o.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),o.ctx.listener.forwardY.setTargetAtTime(s,Howler.ctx.currentTime,.1),o.ctx.listener.forwardZ.setTargetAtTime(r,Howler.ctx.currentTime,.1),o.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),o.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),o.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):o.ctx.listener.setOrientation(e,s,r,n,a,h);else return l;return o},Howl.prototype.init=function(e){return function(s){var r=this;return r._orientation=s.orientation||[1,0,0],r._stereo=s.stereo||null,r._pos=s.pos||null,r._pannerAttr={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:360,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:360,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:0,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:"inverse",maxDistance:typeof s.maxDistance<"u"?s.maxDistance:1e4,panningModel:typeof s.panningModel<"u"?s.panningModel:"HRTF",refDistance:typeof s.refDistance<"u"?s.refDistance:1,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:1},r._onstereo=s.onstereo?[{fn:s.onstereo}]:[],r._onpos=s.onpos?[{fn:s.onpos}]:[],r._onorientation=s.onorientation?[{fn:s.onorientation}]:[],e.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,s){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(e,s)}}),r;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u")if(typeof e=="number")r._stereo=e,r._pos=[e,0,0];else return r._stereo;for(var a=r._getSoundIds(s),h=0;h<a.length;h++){var o=r._soundById(a[h]);if(o)if(typeof e=="number")o._stereo=e,o._pos=[e,0,0],o._node&&(o._pannerAttr.panningModel="equalpower",(!o._panner||!o._panner.pan)&&t(o,n),n==="spatial"?typeof o._panner.positionX<"u"?(o._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),o._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),o._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):o._panner.setPosition(e,0,0):o._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),r._emit("stereo",o._id);else return o._stereo}return r},Howl.prototype.pos=function(e,s,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"pos",action:function(){a.pos(e,s,r,n)}}),a;if(s=typeof s!="number"?0:s,r=typeof r!="number"?-.5:r,typeof n>"u")if(typeof e=="number")a._pos=[e,s,r];else return a._pos;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._pos=[e,s,r],l._node&&((!l._panner||l._panner.pan)&&t(l,"spatial"),typeof l._panner.positionX<"u"?(l._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):l._panner.setPosition(e,s,r)),a._emit("pos",l._id);else return l._pos}return a},Howl.prototype.orientation=function(e,s,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"orientation",action:function(){a.orientation(e,s,r,n)}}),a;if(s=typeof s!="number"?a._orientation[1]:s,r=typeof r!="number"?a._orientation[2]:r,typeof n>"u")if(typeof e=="number")a._orientation=[e,s,r];else return a._orientation;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._orientation=[e,s,r],l._node&&(l._panner||(l._pos||(l._pos=a._pos||[0,0,-.5]),t(l,"spatial")),typeof l._panner.orientationX<"u"?(l._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.orientationY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):l._panner.setOrientation(e,s,r)),a._emit("orientation",l._id);else return l._orientation}return a},Howl.prototype.pannerAttr=function(){var e=this,s=arguments,r,n,a;if(!e._webAudio)return e;if(s.length===0)return e._pannerAttr;if(s.length===1)if(typeof s[0]=="object")r=s[0],typeof n>"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),e._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:e._panningModel});else return a=e._soundById(parseInt(s[0],10)),a?a._pannerAttr:e._pannerAttr;else s.length===2&&(r=s[0],n=parseInt(s[1],10));for(var h=e._getSoundIds(n),o=0;o<h.length;o++)if(a=e._soundById(h[o]),a){var l=a._pannerAttr;l={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:l.coneOuterAngle,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:l.coneOuterGain,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:l.distanceModel,maxDistance:typeof r.maxDistance<"u"?r.maxDistance:l.maxDistance,refDistance:typeof r.refDistance<"u"?r.refDistance:l.refDistance,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:l.rolloffFactor,panningModel:typeof r.panningModel<"u"?r.panningModel:l.panningModel};var u=a._panner;u||(a._pos||(a._pos=e._pos||[0,0,-.5]),t(a,"spatial"),u=a._panner),u.coneInnerAngle=l.coneInnerAngle,u.coneOuterAngle=l.coneOuterAngle,u.coneOuterGain=l.coneOuterGain,u.distanceModel=l.distanceModel,u.maxDistance=l.maxDistance,u.refDistance=l.refDistance,u.rolloffFactor=l.rolloffFactor,u.panningModel=l.panningModel}return e},Sound.prototype.init=function(e){return function(){var s=this,r=s._parent;s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,e.call(this),s._stereo?r.stereo(s._stereo):s._pos&&r.pos(s._pos[0],s._pos[1],s._pos[2],s._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var s=this,r=s._parent;return s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,s._stereo?r.stereo(s._stereo):s._pos?r.pos(s._pos[0],s._pos[1],s._pos[2],s._id):s._panner&&(s._panner.disconnect(0),s._panner=void 0,r._refreshBuffer(s)),e.call(this)}}(Sound.prototype.reset);var t=function(e,s){s=s||"spatial",s==="spatial"?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,typeof e._panner.positionX<"u"?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),typeof e._panner.orientationX<"u"?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}})()})(cd);let $0;function fI(i){return $0=i,i}function ko(){return $0}let pI=0;const ud=class extends Gs{constructor(i){super(),this.id=pI++,this.init(i)}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(i){this._playing=!1,this._duration=i.source.duration;const t=this._source=i.source.cloneNode(!1);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters")}refresh(){const i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=i.volume*(i.muted?0:1),s=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*s,this._source.playbackRate=this._speed*i.speed*t.speed}refreshPaused(){const i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(i){const{start:t,end:e,speed:s,loop:r,volume:n,muted:a}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=n,this._loop=!!r,this._muted=a,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-ud.PADDING),this._end=Math.min(this._end+ud.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),Tt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){Tt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){Tt.shared.remove(this._onUpdate,this),this.removeAllListeners();const i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let Y0=ud;Y0.PADDING=.1;class mI extends Gs{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new Y0(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,s=this.parent;if(e.readyState===4){s.isLoaded=!0;const o=s.autoPlayStart();t&&setTimeout(()=>{t(null,s,o)},0);return}if(!s.url){t(new Error("sound.url or sound.source must be set"));return}e.src=s.url;const r=()=>{h(),s.isLoaded=!0;const o=s.autoPlayStart();t&&t(null,s,o)},n=()=>{h(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{h();const o=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(o)):console.error(o)},h=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class gI{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const xl=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],_I=["audio/mpeg","audio/ogg"],vl={};function yI(i){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...i||{}},e=document.createElement("audio"),s={},r=/^no$/;xl.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),h=t[n]?e.canPlayType(t[n]).replace(r,""):"";s[n]=!!a||!!h}),Object.assign(vl,s)}yI();class dd{static setParamValue(t,e){if(t.setValueAtTime){const s=ko().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}let xI=0;class vI extends Gs{constructor(t){super(),this.id=xI++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(s=>s).forEach(s=>s.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const s=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);dd.setParamValue(this._gain.gain,n*r*s),dd.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(s=>{e.connect(s.destination),e=s}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,s=this._paused||e.paused||t.paused;s!==this._pausedReal&&(this._pausedReal=s,s?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",s))}play(t){const{start:e,end:s,speed:r,loop:n,volume:a,muted:h,filters:o}=t;s&&console.assert(s>e,"End time is before start time"),this._paused=!1;const{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=r,this._volume=a,this._loop=!!n,this._muted=h,this._filters=o,this.refresh();const c=this._source.buffer.duration;this._duration=c,this._end=s,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=s,this._source.loopStart=e,this._source.start(0,e)):s?this._source.start(0,e,s-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){Tt.shared.remove(this._updateListener,this),t&&Tt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),s=e-this._lastUpdate;if(s>0||t){const r=this._source.playbackRate.value;this._elapsed+=s*r,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const h=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%h)/n}else a=this._elapsed%n/n;this._progress=a,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class H0{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(s=>{e===null?this._input.connect(s.destination):e.connect(s.destination),e=s}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const W0=class extends H0{constructor(i){const t=i.audioContext,e=t.createBufferSource(),s=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(s),s.connect(i.destination),super(r,s),this.context=i,this.bufferSource=e,this.gain=s,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(W0.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,dd.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let z0=W0;z0.BUFFER_SIZE=0;class bI{init(t){this.parent=t,this._nodes=new z0(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new vI(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,s=await z.ADAPTER.fetch(e);this._decode(await s.arrayBuffer(),t)}_decode(t,e){const s=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?s(null,t):this.parent.context.decode(t,s)}}const Fn=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=ko().useLegacy?new mI:new bI;return new Fn(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(i){const[t]=i.map(e=>({url:e,ext:vt.extname(e).slice(1)})).filter(({ext:e})=>vl[e]).sort((e,s)=>xl.indexOf(e.ext)-xl.indexOf(s.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return ko().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get filters(){return this.media.filters}set filters(i){this.media.filters=i}addSprites(i,t){if(typeof i=="object"){const s={};for(const r in i)s[r]=this.addSprites(r,i[r]);return s}console.assert(!this._sprites[i],`Alias ${i} is already taken`);const e=new gI(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(i){if(i){const t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((a,h,o)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,h,o),r(o))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const s=this._createInstance();return this._instances.push(s),this.isPlaying=!0,s.once("end",()=>{e.complete&&e.complete(this),this._onComplete(s)}),s.once("stop",()=>{this._onComplete(s)}),s.play(e),s}refresh(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh()}refreshPaused(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}_preload(i){this.media.load(i)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0}_onComplete(i){if(this._instances){const t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(i)}_createInstance(){if(Fn._pool.length>0){const i=Fn._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Fn._pool.indexOf(i)<0&&Fn._pool.push(i)}};let bl=Fn;bl._pool=[];class wI extends Gs{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}class Bo extends H0{constructor(){const t=window,e=new Bo.AudioContext,s=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(s),s.connect(e.destination),super(r,s),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Bo.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=s,this.analyser=r,this.events=new Gs,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const s=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},s);r&&r.catch(s)}}class EI{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Bo),this._htmlAudioContext=new wI,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Bo.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const h=this._getOptions(t[a],e);n[a]=this.add(a,h)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof bl)return this._sounds[t]=e,e;const s=this._getOptions(e),r=bl.from(s);return this._sounds[t]=r,r}_getOptions(t,e){let s;return typeof t=="string"?s={url:t}:Array.isArray(t)?s={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?s={source:t}:s=t,s={...s,...e||{}},s}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const s=!!this._sounds[t];return e&&console.assert(s,`No sound matching alias '${t}'.`),s}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const s=this.find(t);return e!==void 0&&(s.volume=e),s.volume}speed(t,e){const s=this.find(t);return e!==void 0&&(s.speed=e),s.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const j0=i=>{var e;const t=i.src;return((e=i==null?void 0:i.alias)==null?void 0:e[0])??vt.basename(t,vt.extname(t))},TI={extension:Y.Asset,detection:{test:async()=>!0,add:async i=>[...i,...xl.filter(t=>vl[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{extension:{type:[Y.LoadParser],priority:Ne.High},test(i){const t=vt.extname(i).slice(1);return!!vl[t]||_I.some(e=>i.startsWith(`data:${e}`))},async load(i,t){const e=await new Promise((s,r)=>bl.from({...t.data,url:i,preload:!0,loaded(n,a){var h,o;n?r(n):s(a),(o=(h=t.data)==null?void 0:h.loaded)==null||o.call(h,n,a)}}));return ko().add(j0(t),e),e},async unload(i,t){ko().remove(j0(t))}}};K.add(TI),fI(new EI);class AI{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,s;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(s=this._musicPlayer)==null||s.pause(),this._playingList.forEach(r=>{t?r.audio.play():r.audio.pause()})},document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(s=>{const r=new Date().getTime(),n=Gr.get(t).url,a=new cd.Howl({src:n,mute:this._isBackground||!this.effectEnabled});if(a.play(),a.on("end",()=>{this._playingList=this._playingList.filter(h=>h.id!==r),s()}),e){const o=a.duration()-e;a.seek(o)}this._playingList.push({id:r,audio:a,url:n})})}async playMusic(t){const e=Gr.get(t).url;this._musicPlayer&&(bt.killTweensOf(this._musicPlayer),await bt.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),this._musicPlayer.stop()),this._musicPlayer=new cd.Howl({src:e,loop:!0,volume:0,html5:!0,mute:this._isBackground||!this.effectEnabled}),this._musicPlayer.play(),this._isMusicPaused=!1,bt.killTweensOf(this._musicPlayer),bt.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t;this._isMusicPaused=!1,(t=this._musicPlayer)==null||t.play()}stopEffect(t){const e=Gr.get(t).url;this._playingList.forEach(s=>{s.url===e&&s.audio.pause()}),this._playingList=this._playingList.filter(s=>s.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){var e;(e=this._musicPlayer)==null||e.mute(t||!this.musicEnabled)}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.mute(t||!this.effectEnabled)})}}const SI=i=>{const{texture:t,dotWidth:e,width:s,height:r}=i;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new PT(t,n[0],n[1],n[2],n[3]);return a.width=s,a.height=r,a},CI=(i,t,e)=>{let s=!1;return i.cursor="pointer",i.eventMode="static",i.on(t,r=>{s||r.button!==2&&e(r)}),()=>{s=!0}},II=(i,t,e=0)=>parseFloat((Math.random()*(t-i)+i).toFixed(e)),PI=(i,t)=>{let e=0;const s=new Tt,r=n=>{e+=n*s.deltaMS;let a=0;Array.isArray(t)?a=II(t[0],t[1],2):a=t,e>=a&&(i(),e=0)};return s.add(r),s.start(),()=>{s.remove(r),s.stop()}},RI=(i,t,e)=>{const s=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=i.getBounds().contains(r.clientX,r.clientY);!n&&!a&&i.visible&&(e(),window.removeEventListener("pointerdown",s))};return window.addEventListener("pointerdown",s),()=>{window.removeEventListener("pointerdown",s)}},MI=(i=1,t)=>new Promise(e=>{let s=0;const r=new Tt,n=()=>{s+=r.deltaMS,s>=i&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),FI=(i,t)=>{let e;if(i==="brightness")e=new hn,e.brightness(t,!1);else if(i==="blur")e=new um;else if(i==="desaturate")e=new hn,e.desaturate();else if(i==="contrast")e=new hn,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var kI=`attribute vec2 aVertexPosition;
1189
+ */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var s=this;if(!s.ctx||!s.ctx.listener)return s;for(var r=s._howls.length-1;r>=0;r--)s._howls[r].stereo(e);return s},HowlerGlobal.prototype.pos=function(e,s,r){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(s=typeof s!="number"?n._pos[1]:s,r=typeof r!="number"?n._pos[2]:r,typeof e=="number")n._pos=[e,s,r],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]);else return n._pos;return n},HowlerGlobal.prototype.orientation=function(e,s,r,n,a,h){var o=this;if(!o.ctx||!o.ctx.listener)return o;var l=o._orientation;if(s=typeof s!="number"?l[1]:s,r=typeof r!="number"?l[2]:r,n=typeof n!="number"?l[3]:n,a=typeof a!="number"?l[4]:a,h=typeof h!="number"?l[5]:h,typeof e=="number")o._orientation=[e,s,r,n,a,h],typeof o.ctx.listener.forwardX<"u"?(o.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),o.ctx.listener.forwardY.setTargetAtTime(s,Howler.ctx.currentTime,.1),o.ctx.listener.forwardZ.setTargetAtTime(r,Howler.ctx.currentTime,.1),o.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),o.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),o.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):o.ctx.listener.setOrientation(e,s,r,n,a,h);else return l;return o},Howl.prototype.init=function(e){return function(s){var r=this;return r._orientation=s.orientation||[1,0,0],r._stereo=s.stereo||null,r._pos=s.pos||null,r._pannerAttr={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:360,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:360,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:0,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:"inverse",maxDistance:typeof s.maxDistance<"u"?s.maxDistance:1e4,panningModel:typeof s.panningModel<"u"?s.panningModel:"HRTF",refDistance:typeof s.refDistance<"u"?s.refDistance:1,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:1},r._onstereo=s.onstereo?[{fn:s.onstereo}]:[],r._onpos=s.onpos?[{fn:s.onpos}]:[],r._onorientation=s.onorientation?[{fn:s.onorientation}]:[],e.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,s){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(e,s)}}),r;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u")if(typeof e=="number")r._stereo=e,r._pos=[e,0,0];else return r._stereo;for(var a=r._getSoundIds(s),h=0;h<a.length;h++){var o=r._soundById(a[h]);if(o)if(typeof e=="number")o._stereo=e,o._pos=[e,0,0],o._node&&(o._pannerAttr.panningModel="equalpower",(!o._panner||!o._panner.pan)&&t(o,n),n==="spatial"?typeof o._panner.positionX<"u"?(o._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),o._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),o._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):o._panner.setPosition(e,0,0):o._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),r._emit("stereo",o._id);else return o._stereo}return r},Howl.prototype.pos=function(e,s,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"pos",action:function(){a.pos(e,s,r,n)}}),a;if(s=typeof s!="number"?0:s,r=typeof r!="number"?-.5:r,typeof n>"u")if(typeof e=="number")a._pos=[e,s,r];else return a._pos;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._pos=[e,s,r],l._node&&((!l._panner||l._panner.pan)&&t(l,"spatial"),typeof l._panner.positionX<"u"?(l._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):l._panner.setPosition(e,s,r)),a._emit("pos",l._id);else return l._pos}return a},Howl.prototype.orientation=function(e,s,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"orientation",action:function(){a.orientation(e,s,r,n)}}),a;if(s=typeof s!="number"?a._orientation[1]:s,r=typeof r!="number"?a._orientation[2]:r,typeof n>"u")if(typeof e=="number")a._orientation=[e,s,r];else return a._orientation;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._orientation=[e,s,r],l._node&&(l._panner||(l._pos||(l._pos=a._pos||[0,0,-.5]),t(l,"spatial")),typeof l._panner.orientationX<"u"?(l._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.orientationY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):l._panner.setOrientation(e,s,r)),a._emit("orientation",l._id);else return l._orientation}return a},Howl.prototype.pannerAttr=function(){var e=this,s=arguments,r,n,a;if(!e._webAudio)return e;if(s.length===0)return e._pannerAttr;if(s.length===1)if(typeof s[0]=="object")r=s[0],typeof n>"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),e._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:e._panningModel});else return a=e._soundById(parseInt(s[0],10)),a?a._pannerAttr:e._pannerAttr;else s.length===2&&(r=s[0],n=parseInt(s[1],10));for(var h=e._getSoundIds(n),o=0;o<h.length;o++)if(a=e._soundById(h[o]),a){var l=a._pannerAttr;l={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:l.coneOuterAngle,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:l.coneOuterGain,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:l.distanceModel,maxDistance:typeof r.maxDistance<"u"?r.maxDistance:l.maxDistance,refDistance:typeof r.refDistance<"u"?r.refDistance:l.refDistance,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:l.rolloffFactor,panningModel:typeof r.panningModel<"u"?r.panningModel:l.panningModel};var u=a._panner;u||(a._pos||(a._pos=e._pos||[0,0,-.5]),t(a,"spatial"),u=a._panner),u.coneInnerAngle=l.coneInnerAngle,u.coneOuterAngle=l.coneOuterAngle,u.coneOuterGain=l.coneOuterGain,u.distanceModel=l.distanceModel,u.maxDistance=l.maxDistance,u.refDistance=l.refDistance,u.rolloffFactor=l.rolloffFactor,u.panningModel=l.panningModel}return e},Sound.prototype.init=function(e){return function(){var s=this,r=s._parent;s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,e.call(this),s._stereo?r.stereo(s._stereo):s._pos&&r.pos(s._pos[0],s._pos[1],s._pos[2],s._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var s=this,r=s._parent;return s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,s._stereo?r.stereo(s._stereo):s._pos?r.pos(s._pos[0],s._pos[1],s._pos[2],s._id):s._panner&&(s._panner.disconnect(0),s._panner=void 0,r._refreshBuffer(s)),e.call(this)}}(Sound.prototype.reset);var t=function(e,s){s=s||"spatial",s==="spatial"?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,typeof e._panner.positionX<"u"?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),typeof e._panner.orientationX<"u"?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}})()})(cd);let $0;function fI(i){return $0=i,i}function ko(){return $0}let pI=0;const ud=class extends Gs{constructor(i){super(),this.id=pI++,this.init(i)}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(i){this._playing=!1,this._duration=i.source.duration;const t=this._source=i.source.cloneNode(!1);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters")}refresh(){const i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=i.volume*(i.muted?0:1),s=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*s,this._source.playbackRate=this._speed*i.speed*t.speed}refreshPaused(){const i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(i){const{start:t,end:e,speed:s,loop:r,volume:n,muted:a}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=n,this._loop=!!r,this._muted=a,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-ud.PADDING),this._end=Math.min(this._end+ud.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),Tt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){Tt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){Tt.shared.remove(this._onUpdate,this),this.removeAllListeners();const i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let Y0=ud;Y0.PADDING=.1;class mI extends Gs{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new Y0(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,s=this.parent;if(e.readyState===4){s.isLoaded=!0;const o=s.autoPlayStart();t&&setTimeout(()=>{t(null,s,o)},0);return}if(!s.url){t(new Error("sound.url or sound.source must be set"));return}e.src=s.url;const r=()=>{h(),s.isLoaded=!0;const o=s.autoPlayStart();t&&t(null,s,o)},n=()=>{h(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{h();const o=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(o)):console.error(o)},h=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class gI{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const xl=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],_I=["audio/mpeg","audio/ogg"],vl={};function yI(i){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...i||{}},e=document.createElement("audio"),s={},r=/^no$/;xl.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),h=t[n]?e.canPlayType(t[n]).replace(r,""):"";s[n]=!!a||!!h}),Object.assign(vl,s)}yI();class dd{static setParamValue(t,e){if(t.setValueAtTime){const s=ko().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}let xI=0;class vI extends Gs{constructor(t){super(),this.id=xI++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(s=>s).forEach(s=>s.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const s=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);dd.setParamValue(this._gain.gain,n*r*s),dd.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(s=>{e.connect(s.destination),e=s}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,s=this._paused||e.paused||t.paused;s!==this._pausedReal&&(this._pausedReal=s,s?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",s))}play(t){const{start:e,end:s,speed:r,loop:n,volume:a,muted:h,filters:o}=t;s&&console.assert(s>e,"End time is before start time"),this._paused=!1;const{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=r,this._volume=a,this._loop=!!n,this._muted=h,this._filters=o,this.refresh();const c=this._source.buffer.duration;this._duration=c,this._end=s,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=s,this._source.loopStart=e,this._source.start(0,e)):s?this._source.start(0,e,s-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){Tt.shared.remove(this._updateListener,this),t&&Tt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),s=e-this._lastUpdate;if(s>0||t){const r=this._source.playbackRate.value;this._elapsed+=s*r,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const h=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%h)/n}else a=this._elapsed%n/n;this._progress=a,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class H0{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(s=>{e===null?this._input.connect(s.destination):e.connect(s.destination),e=s}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const W0=class extends H0{constructor(i){const t=i.audioContext,e=t.createBufferSource(),s=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(s),s.connect(i.destination),super(r,s),this.context=i,this.bufferSource=e,this.gain=s,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(W0.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,dd.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let z0=W0;z0.BUFFER_SIZE=0;class bI{init(t){this.parent=t,this._nodes=new z0(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new vI(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,s=await z.ADAPTER.fetch(e);this._decode(await s.arrayBuffer(),t)}_decode(t,e){const s=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?s(null,t):this.parent.context.decode(t,s)}}const Fn=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=ko().useLegacy?new mI:new bI;return new Fn(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(i){const[t]=i.map(e=>({url:e,ext:bt.extname(e).slice(1)})).filter(({ext:e})=>vl[e]).sort((e,s)=>xl.indexOf(e.ext)-xl.indexOf(s.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return ko().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get filters(){return this.media.filters}set filters(i){this.media.filters=i}addSprites(i,t){if(typeof i=="object"){const s={};for(const r in i)s[r]=this.addSprites(r,i[r]);return s}console.assert(!this._sprites[i],`Alias ${i} is already taken`);const e=new gI(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(i){if(i){const t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((a,h,o)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,h,o),r(o))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const s=this._createInstance();return this._instances.push(s),this.isPlaying=!0,s.once("end",()=>{e.complete&&e.complete(this),this._onComplete(s)}),s.once("stop",()=>{this._onComplete(s)}),s.play(e),s}refresh(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh()}refreshPaused(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}_preload(i){this.media.load(i)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0}_onComplete(i){if(this._instances){const t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(i)}_createInstance(){if(Fn._pool.length>0){const i=Fn._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Fn._pool.indexOf(i)<0&&Fn._pool.push(i)}};let bl=Fn;bl._pool=[];class wI extends Gs{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}class Bo extends H0{constructor(){const t=window,e=new Bo.AudioContext,s=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(s),s.connect(e.destination),super(r,s),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Bo.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=s,this.analyser=r,this.events=new Gs,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const s=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},s);r&&r.catch(s)}}class EI{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Bo),this._htmlAudioContext=new wI,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Bo.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const h=this._getOptions(t[a],e);n[a]=this.add(a,h)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof bl)return this._sounds[t]=e,e;const s=this._getOptions(e),r=bl.from(s);return this._sounds[t]=r,r}_getOptions(t,e){let s;return typeof t=="string"?s={url:t}:Array.isArray(t)?s={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?s={source:t}:s=t,s={...s,...e||{}},s}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const s=!!this._sounds[t];return e&&console.assert(s,`No sound matching alias '${t}'.`),s}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const s=this.find(t);return e!==void 0&&(s.volume=e),s.volume}speed(t,e){const s=this.find(t);return e!==void 0&&(s.speed=e),s.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const j0=i=>{var e;const t=i.src;return((e=i==null?void 0:i.alias)==null?void 0:e[0])??bt.basename(t,bt.extname(t))},TI={extension:Y.Asset,detection:{test:async()=>!0,add:async i=>[...i,...xl.filter(t=>vl[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{extension:{type:[Y.LoadParser],priority:Ne.High},test(i){const t=bt.extname(i).slice(1);return!!vl[t]||_I.some(e=>i.startsWith(`data:${e}`))},async load(i,t){const e=await new Promise((s,r)=>bl.from({...t.data,url:i,preload:!0,loaded(n,a){var h,o;n?r(n):s(a),(o=(h=t.data)==null?void 0:h.loaded)==null||o.call(h,n,a)}}));return ko().add(j0(t),e),e},async unload(i,t){ko().remove(j0(t))}}};K.add(TI),fI(new EI);class AI{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,s;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(s=this._musicPlayer)==null||s.pause(),this._playingList.forEach(r=>{t?r.audio.play():r.audio.pause()})},document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(s=>{const r=new Date().getTime(),n=Gr.get(t).url,a=new cd.Howl({src:n,mute:this._isBackground||!this.effectEnabled});if(a.play(),a.on("end",()=>{this._playingList=this._playingList.filter(h=>h.id!==r),s()}),e){const o=a.duration()-e;a.seek(o)}this._playingList.push({id:r,audio:a,url:n})})}async playMusic(t){const e=Gr.get(t).url;this._musicPlayer&&(xt.killTweensOf(this._musicPlayer),await xt.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),this._musicPlayer.stop()),this._musicPlayer=new cd.Howl({src:e,loop:!0,volume:0,mute:this._isBackground||!this.musicEnabled}),this._musicPlayer.play(),this._isMusicPaused=!1,xt.killTweensOf(this._musicPlayer),xt.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t;this._isMusicPaused=!1,(t=this._musicPlayer)==null||t.play()}stopEffect(t){const e=Gr.get(t).url;this._playingList.forEach(s=>{s.url===e&&s.audio.pause()}),this._playingList=this._playingList.filter(s=>s.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){var e;(e=this._musicPlayer)==null||e.mute(t||!this.musicEnabled)}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.mute(t||!this.effectEnabled)})}}const SI=i=>{const{texture:t,dotWidth:e,width:s,height:r}=i;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new PT(t,n[0],n[1],n[2],n[3]);return a.width=s,a.height=r,a},CI=(i,t,e)=>{let s=!1;return i.cursor="pointer",i.eventMode="static",i.on(t,r=>{s||r.button!==2&&e(r)}),()=>{s=!0}},II=(i,t,e=0)=>parseFloat((Math.random()*(t-i)+i).toFixed(e)),PI=(i,t)=>{let e=0;const s=new Tt,r=n=>{e+=n*s.deltaMS;let a=0;Array.isArray(t)?a=II(t[0],t[1],2):a=t,e>=a&&(i(),e=0)};return s.add(r),s.start(),()=>{s.remove(r),s.stop()}},RI=(i,t,e)=>{const s=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=i.getBounds().contains(r.clientX,r.clientY);!n&&!a&&i.visible&&(e(),window.removeEventListener("pointerdown",s))};return window.addEventListener("pointerdown",s),()=>{window.removeEventListener("pointerdown",s)}},MI=(i=1,t)=>new Promise(e=>{let s=0;const r=new Tt,n=()=>{s+=r.deltaMS,s>=i&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),FI=(i,t)=>{let e;if(i==="brightness")e=new hn,e.brightness(t,!1);else if(i==="blur")e=new um;else if(i==="desaturate")e=new hn,e.desaturate();else if(i==="contrast")e=new hn,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var kI=`attribute vec2 aVertexPosition;
1190
1190
  attribute vec2 aTextureCoord;
1191
1191
 
1192
1192
  uniform mat3 projectionMatrix;