UNPKG

wl-live2d

Version:

Live2D for web, 这是一个运行在浏览器环境的 Live2D 看板组件

377 lines 943 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["wl-live2d"]={})}(this,function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}var i,r,n,s,o,a,h,u,l,c,f,d,p,_,g,v,y,b,x,T,A;!function(i){var r,n=function(){function t(){}return t.getVersion=function(){return c.ccall("csmGetVersion","number",[],[])},t.getLatestMocVersion=function(){return c.ccall("csmGetLatestMocVersion","number",[],[])},t.getMocVersion=function(t,e){return c.ccall("csmGetMocVersion","number",["number","number"],[t,e])},t.getSizeofModel=function(t){return c.ccall("csmGetSizeofModel","number",["number"],[t])},t.reviveMocInPlace=function(t,e){return c.ccall("csmReviveMocInPlace","number",["number","number"],[t,e])},t.initializeModelInPlace=function(t,e,i){return c.ccall("csmInitializeModelInPlace","number",["number","number","number"],[t,e,i])},t.hasMocConsistency=function(t,e){return c.ccall("csmHasMocConsistency","number",["number","number"],[t,e])},t.getParameterCount=function(t){return c.ccall("csmGetParameterCount","number",["number"],[t])},t.getParameterIds=function(t){return c.ccall("csmGetParameterIds","number",["number"],[t])},t.getParameterMinimumValues=function(t){return c.ccall("csmGetParameterMinimumValues","number",["number"],[t])},t.getParameterTypes=function(t){return c.ccall("csmGetParameterTypes","number",["number"],[t])},t.getParameterMaximumValues=function(t){return c.ccall("csmGetParameterMaximumValues","number",["number"],[t])},t.getParameterDefaultValues=function(t){return c.ccall("csmGetParameterDefaultValues","number",["number"],[t])},t.getParameterValues=function(t){return c.ccall("csmGetParameterValues","number",["number"],[t])},t.getParameterKeyCounts=function(t){return c.ccall("csmGetParameterKeyCounts","number",["number"],[t])},t.getParameterKeyValues=function(t){return c.ccall("csmGetParameterKeyValues","number",["number"],[t])},t.getPartCount=function(t){return c.ccall("csmGetPartCount","number",["number"],[t])},t.getPartIds=function(t){return c.ccall("csmGetPartIds","number",["number"],[t])},t.getPartOpacities=function(t){return c.ccall("csmGetPartOpacities","number",["number"],[t])},t.getPartParentPartIndices=function(t){return c.ccall("csmGetPartParentPartIndices","number",["number"],[t])},t.getDrawableCount=function(t){return c.ccall("csmGetDrawableCount","number",["number"],[t])},t.getDrawableIds=function(t){return c.ccall("csmGetDrawableIds","number",["number"],[t])},t.getDrawableConstantFlags=function(t){return c.ccall("csmGetDrawableConstantFlags","number",["number"],[t])},t.getDrawableDynamicFlags=function(t){return c.ccall("csmGetDrawableDynamicFlags","number",["number"],[t])},t.getDrawableTextureIndices=function(t){return c.ccall("csmGetDrawableTextureIndices","number",["number"],[t])},t.getDrawableDrawOrders=function(t){return c.ccall("csmGetDrawableDrawOrders","number",["number"],[t])},t.getDrawableRenderOrders=function(t){return c.ccall("csmGetDrawableRenderOrders","number",["number"],[t])},t.getDrawableOpacities=function(t){return c.ccall("csmGetDrawableOpacities","number",["number"],[t])},t.getDrawableMaskCounts=function(t){return c.ccall("csmGetDrawableMaskCounts","number",["number"],[t])},t.getDrawableMasks=function(t){return c.ccall("csmGetDrawableMasks","number",["number"],[t])},t.getDrawableVertexCounts=function(t){return c.ccall("csmGetDrawableVertexCounts","number",["number"],[t])},t.getDrawableVertexPositions=function(t){return c.ccall("csmGetDrawableVertexPositions","number",["number"],[t])},t.getDrawableVertexUvs=function(t){return c.ccall("csmGetDrawableVertexUvs","number",["number"],[t])},t.getDrawableIndexCounts=function(t){return c.ccall("csmGetDrawableIndexCounts","number",["number"],[t])},t.getDrawableIndices=function(t){return c.ccall("csmGetDrawableIndices","number",["number"],[t])},t.getDrawableMultiplyColors=function(t){return c.ccall("csmGetDrawableMultiplyColors","number",["number"],[t])},t.getDrawableScreenColors=function(t){return c.ccall("csmGetDrawableScreenColors","number",["number"],[t])},t.getDrawableParentPartIndices=function(t){return c.ccall("csmGetDrawableParentPartIndices","number",["number"],[t])},t.mallocMoc=function(t){return c.ccall("csmMallocMoc","number",["number"],[t])},t.mallocModelAndInitialize=function(t){return c.ccall("csmMallocModelAndInitialize","number",["number"],[t])},t.malloc=function(t){return c.ccall("csmMalloc","number",["number"],[t])},t.setLogFunction=function(t){c.ccall("csmSetLogFunction",null,["number"],[t])},t.updateModel=function(t){c.ccall("csmUpdateModel",null,["number"],[t])},t.readCanvasInfo=function(t,e,i,r){c.ccall("csmReadCanvasInfo",null,["number","number","number","number"],[t,e,i,r])},t.resetDrawableDynamicFlags=function(t){c.ccall("csmResetDrawableDynamicFlags",null,["number"],[t])},t.free=function(t){c.ccall("csmFree",null,["number"],[t])},t.initializeAmountOfMemory=function(t){c.ccall("csmInitializeAmountOfMemory",null,["number"],[t])},t}(),s=(i.AlignofMoc=64,i.AlignofModel=16,i.MocVersion_Unknown=0,i.MocVersion_30=1,i.MocVersion_33=2,i.MocVersion_40=3,i.MocVersion_42=4,i.MocVersion_50=5,i.ParameterType_Normal=0,i.ParameterType_BlendShape=1,function(){function t(){}return t.csmGetVersion=function(){return n.getVersion()},t.csmGetLatestMocVersion=function(){return n.getLatestMocVersion()},t.csmGetMocVersion=function(t,e){return n.getMocVersion(t._ptr,e.byteLength)},t}()),o=(s=(i.Version=s,function(){function t(){}return t.csmSetLogFunction=function(e){t.logFunction=e,e=c.addFunction(t.wrapLogFunction,"vi"),n.setLogFunction(e)},t.csmGetLogFunction=function(){return t.logFunction},t.wrapLogFunction=function(e){e=c.UTF8ToString(e),t.logFunction(e)},t}()),s=(i.Logging=s,function(){function t(t){var e=n.mallocMoc(t.byteLength);e&&(new Uint8Array(c.HEAPU8.buffer,e,t.byteLength).set(new Uint8Array(t)),this._ptr=n.reviveMocInPlace(e,t.byteLength),this._ptr||n.free(e))}return t.prototype.hasMocConsistency=function(t){var e=n.mallocMoc(t.byteLength);if(e)return new Uint8Array(c.HEAPU8.buffer,e,t.byteLength).set(new Uint8Array(t)),t=n.hasMocConsistency(e,t.byteLength),n.free(e),t},t.fromArrayBuffer=function(e){return e&&(e=new t(e))._ptr?e:null},t.prototype._release=function(){n.free(this._ptr),this._ptr=0},t}()),s=(i.Moc=s,function(){function t(t){this._ptr=n.mallocModelAndInitialize(t._ptr),this._ptr&&(this.parameters=new a(this._ptr),this.parts=new h(this._ptr),this.drawables=new u(this._ptr),this.canvasinfo=new o(this._ptr))}return t.fromMoc=function(e){return(e=new t(e))._ptr?e:null},t.prototype.update=function(){n.updateModel(this._ptr)},t.prototype.release=function(){n.free(this._ptr),this._ptr=0},t}()),i.Model=s,function(t){var e,i,r,s,o,a,h;t&&(r=(e=new Float32Array(2)).length*e.BYTES_PER_ELEMENT,i=n.malloc(r),(i=new Uint8Array(c.HEAPU8.buffer,i,r)).set(new Uint8Array(e.buffer)),o=(r=new Float32Array(2)).length*r.BYTES_PER_ELEMENT,s=n.malloc(o),(s=new Uint8Array(c.HEAPU8.buffer,s,o)).set(new Uint8Array(r.buffer)),a=(o=new Float32Array(1)).length*o.BYTES_PER_ELEMENT,h=n.malloc(a),(h=new Uint8Array(c.HEAPU8.buffer,h,a)).set(new Uint8Array(o.buffer)),n.readCanvasInfo(t,i.byteOffset,s.byteOffset,h.byteOffset),e=new Float32Array(i.buffer,i.byteOffset,i.length),r=new Float32Array(s.buffer,s.byteOffset,s.length),o=new Float32Array(h.buffer,h.byteOffset,h.length),this.CanvasWidth=e[0],this.CanvasHeight=e[1],this.CanvasOriginX=r[0],this.CanvasOriginY=r[1],this.PixelsPerUnit=o[0],n.free(i.byteOffset),n.free(s.byteOffset),n.free(h.byteOffset))}),a=(i.CanvasInfo=o,function(t){this.count=n.getParameterCount(t),e=n.getParameterCount(t),this.ids=new Array(e);for(var e,i,r=new Uint32Array(c.HEAPU32.buffer,n.getParameterIds(t),e),s=0;s<r.length;s++)this.ids[s]=c.UTF8ToString(r[s]);e=n.getParameterCount(t),this.minimumValues=new Float32Array(c.HEAPF32.buffer,n.getParameterMinimumValues(t),e),e=n.getParameterCount(t),this.types=new Int32Array(c.HEAP32.buffer,n.getParameterTypes(t),e),e=n.getParameterCount(t),this.maximumValues=new Float32Array(c.HEAPF32.buffer,n.getParameterMaximumValues(t),e),e=n.getParameterCount(t),this.defaultValues=new Float32Array(c.HEAPF32.buffer,n.getParameterDefaultValues(t),e),e=n.getParameterCount(t),this.values=new Float32Array(c.HEAPF32.buffer,n.getParameterValues(t),e),e=n.getParameterCount(t),this.keyCounts=new Int32Array(c.HEAP32.buffer,n.getParameterKeyCounts(t),e),e=n.getParameterCount(t),i=new Int32Array(c.HEAP32.buffer,n.getParameterKeyCounts(t),e),this.keyValues=new Array(e);var o=new Uint32Array(c.HEAPU32.buffer,n.getParameterKeyValues(t),e);for(s=0;s<o.length;s++)this.keyValues[s]=new Float32Array(c.HEAPF32.buffer,o[s],i[s])}),h=(i.Parameters=a,function(t){this.count=n.getPartCount(t),e=n.getPartCount(t),this.ids=new Array(e);for(var e,i=new Uint32Array(c.HEAPU32.buffer,n.getPartIds(t),e),r=0;r<i.length;r++)this.ids[r]=c.UTF8ToString(i[r]);e=n.getPartCount(t),this.opacities=new Float32Array(c.HEAPF32.buffer,n.getPartOpacities(t),e),e=n.getPartCount(t),this.parentIndices=new Int32Array(c.HEAP32.buffer,n.getPartParentPartIndices(t),e)}),u=(i.Parts=h,function(){function t(t){this._modelPtr=t;for(var e,i=null,r=(this.count=n.getDrawableCount(t),e=n.getDrawableCount(t),this.ids=new Array(e),new Uint32Array(c.HEAPU32.buffer,n.getDrawableIds(t),e)),s=0;s<r.length;s++)this.ids[s]=c.UTF8ToString(r[s]);e=n.getDrawableCount(t),this.constantFlags=new Uint8Array(c.HEAPU8.buffer,n.getDrawableConstantFlags(t),e),e=n.getDrawableCount(t),this.dynamicFlags=new Uint8Array(c.HEAPU8.buffer,n.getDrawableDynamicFlags(t),e),e=n.getDrawableCount(t),this.textureIndices=new Int32Array(c.HEAP32.buffer,n.getDrawableTextureIndices(t),e),e=n.getDrawableCount(t),this.drawOrders=new Int32Array(c.HEAP32.buffer,n.getDrawableDrawOrders(t),e),e=n.getDrawableCount(t),this.renderOrders=new Int32Array(c.HEAP32.buffer,n.getDrawableRenderOrders(t),e),e=n.getDrawableCount(t),this.opacities=new Float32Array(c.HEAPF32.buffer,n.getDrawableOpacities(t),e),e=n.getDrawableCount(t),this.maskCounts=new Int32Array(c.HEAP32.buffer,n.getDrawableMaskCounts(t),e),e=n.getDrawableCount(t),this.vertexCounts=new Int32Array(c.HEAP32.buffer,n.getDrawableVertexCounts(t),e),e=n.getDrawableCount(t),this.indexCounts=new Int32Array(c.HEAP32.buffer,n.getDrawableIndexCounts(t),e),e=n.getDrawableCount(t),this.multiplyColors=new Float32Array(c.HEAPF32.buffer,n.getDrawableMultiplyColors(t),4*e),e=n.getDrawableCount(t),this.screenColors=new Float32Array(c.HEAPF32.buffer,n.getDrawableScreenColors(t),4*e),e=n.getDrawableCount(t),this.parentPartIndices=new Int32Array(c.HEAP32.buffer,n.getDrawableParentPartIndices(t),e),e=n.getDrawableCount(t),i=new Int32Array(c.HEAP32.buffer,n.getDrawableMaskCounts(t),e),this.masks=new Array(e);var o=new Uint32Array(c.HEAPU32.buffer,n.getDrawableMasks(t),e);for(s=0;s<o.length;s++)this.masks[s]=new Int32Array(c.HEAP32.buffer,o[s],i[s]);e=n.getDrawableCount(t),i=new Int32Array(c.HEAP32.buffer,n.getDrawableVertexCounts(t),e),this.vertexPositions=new Array(e);var a=new Uint32Array(c.HEAPU32.buffer,n.getDrawableVertexPositions(t),e);for(s=0;s<a.length;s++)this.vertexPositions[s]=new Float32Array(c.HEAPF32.buffer,a[s],2*i[s]);e=n.getDrawableCount(t),i=new Int32Array(c.HEAP32.buffer,n.getDrawableVertexCounts(t),e),this.vertexUvs=new Array(e);var h=new Uint32Array(c.HEAPU32.buffer,n.getDrawableVertexUvs(t),e);for(s=0;s<h.length;s++)this.vertexUvs[s]=new Float32Array(c.HEAPF32.buffer,h[s],2*i[s]);e=n.getDrawableCount(t),i=new Int32Array(c.HEAP32.buffer,n.getDrawableIndexCounts(t),e),this.indices=new Array(e);var u=new Uint32Array(c.HEAPU32.buffer,n.getDrawableIndices(t),e);for(s=0;s<u.length;s++)this.indices[s]=new Uint16Array(c.HEAPU16.buffer,u[s],i[s])}return t.prototype.resetDynamicFlags=function(){n.resetDrawableDynamicFlags(this._modelPtr)},t}()),l=(s=(i.Drawables=u,function(){function t(){}return t.hasBlendAdditiveBit=function(t){return!(1&~t)},t.hasBlendMultiplicativeBit=function(t){return!(2&~t)},t.hasIsDoubleSidedBit=function(t){return!(4&~t)},t.hasIsInvertedMaskBit=function(t){return!(8&~t)},t.hasIsVisibleBit=function(t){return!(1&~t)},t.hasVisibilityDidChangeBit=function(t){return!(2&~t)},t.hasOpacityDidChangeBit=function(t){return!(4&~t)},t.hasDrawOrderDidChangeBit=function(t){return!(8&~t)},t.hasRenderOrderDidChangeBit=function(t){return!(16&~t)},t.hasVertexPositionsDidChangeBit=function(t){return!(32&~t)},t.hasBlendColorDidChangeBit=function(t){return!(64&~t)},t}()),s=(i.Utils=s,function(){function t(){}return t.initializeAmountOfMemory=function(t){16777216<t&&n.initializeAmountOfMemory(t)},t}()),i.Memory=s,r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t){t=t||{};var i,n,s={};for(n in i=i||(void 0!==t?t:{}))i.hasOwnProperty(n)&&(s[n]=i[n]);var o,a,h,u,l="object"==("undefined"==typeof window?"undefined":e(window)),c="function"==typeof importScripts,f="object"==("undefined"==typeof process?"undefined":e(process))&&"object"==e(process.versions)&&"string"==typeof process.versions.node&&!l&&!c,d=!l&&!f&&!c,p="",_=(f?(p=__dirname+"/",h=function(t,e){var i=Z(t);return i||(o=o||require("fs"),t=(a=a||require("path")).normalize(t),i=o.readFileSync(t)),e?i:i.toString()},u=function(t){return A((t=(t=h(t,!0)).buffer?t:new Uint8Array(t)).buffer),t},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(t){throw t}),process.on("unhandledRejection",X),i.inspect=function(){return"[Emscripten Module object]"}):d?("undefined"!=typeof read&&(h=function(t){var e=Z(t);return e?W(e):read(t)}),u=function(t){var i;if(!(i=Z(t))){if("function"==typeof readbuffer)return new Uint8Array(readbuffer(t));A("object"==e(i=read(t,"binary")))}return i},"undefined"!=typeof print&&((console="undefined"==typeof console?{}:console).log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(l||c)&&(c?p=self.location.href:document.currentScript&&(p=document.currentScript.src),p=0!==(p=r||p).indexOf("blob:")?p.substr(0,p.lastIndexOf("/")+1):"",h=function(t){try{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText}catch(e){if(t=Z(t))return W(t);throw e}},c)&&(u=function(t){try{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}catch(e){if(t=Z(t))return t;throw e}}),i.print||console.log.bind(console)),m=i.printErr||console.warn.bind(console);for(n in s)s.hasOwnProperty(n)&&(i[n]=s[n]);function g(){return{exports:function(t,e,i){var r=new ArrayBuffer(8),n=new Int32Array(r),s=new Float32Array(r),o=new Float64Array(r);function a(t,e){n[t]=e}function h(){return o[0]}function u(t){o[0]=t}function l(t){s[0]=t}function c(){return s[0]}r=e.buffer;var f,d,p,_,m,g,v,y,b,x,T,A,E,w,S,P,M,I,C,R,O,$,D,L,F=new Uint8Array(r);return(r=function(t,e){var i,r;if("undefined"==typeof Buffer)for(i=atob(e),r=0;r<i.length;r++)F[t+r]=i.charCodeAt(r);else for(i=Buffer.from(e,"base64"),r=0;r<i.length;r++)F[t+r]=i[r]})(1024,"QW4gZXJyb3Igb2NjdXJyZWQgaW4gdGhlIGludGVycG9sYXRpb24gZm9yIGJsZW5kIHNoYXBlcy4gQ29tYmluYXRpb25Db3VudCBpcyAlZC4ACgBbQ1NNXSBbRV1XYXJwRGVmb3JtZXI6OlRyYW5zZm9ybVRhcmdldCgpIGVycm9yLiBbJWRdIHAwMT0oJS40ZiAsICUuNGYpCgBbQ1NNXSBbRV1Jbml0aWFsaXplRGVmb3JtZXJzKCk6IFVua25vd24gRGVmb3JtZXIgVHlwZS4KAFtDU01dIFtFXWNzbUhhc01vY0NvbnNpc3RlbmN5OiBUaGlzIG1vYzMgc2l6ZSBpcyBpbnZhbGlkLgoAW0NTTV0gW0VdJXM6ICVzCgBbQ1NNXSBbV11Sb3RhdGlvbkRlZm9ybWVyOiBOb3QgZm91bmQgdHJhbnNmb3JtZWQgRGlyZWN0aW9uLgoAW0NTTV0gW0VdVXBkYXRlRGVmb3JtZXJIaWVyYXJjaHkoKTogVW5rbm93biBEZWZvcm1lciBUeXBlLgoAJXMKACAgAE1PQzMAImFkZHJlc3MiIGlzIG51bGwuACUwMlggAFtDU01dIFtFXWNzbUhhc01vY0NvbnNpc3RlbmN5OiBGaWxlVHlwZSBpcyBpbnZhbGlkLgoAImFkZHJlc3MiIGFsaWdubWVudCBpcyBpbnZhbGlkLgBbQ1NNXSBbRV1jc21IYXNNb2NDb25zaXN0ZW5jeTogVGhpcyBtb2MzIHZlciBpcyBpbnZhbGlkIFt2ZXI6JWRdLgoAInNpemUiIGlzIGludmFsaWQuAFtDU01dIFtFXWNzbUhhc01vY0NvbnNpc3RlbmN5OiBUaGUgQ29yZSB1bnN1cHBvcnQgbGF0ZXIgdGhhbiBtb2MzIHZlcjpbJWRdLiBUaGlzIG1vYzMgdmVyIGlzIFslZF0uCgAibW9kZWwiIGlzIGludmFsaWQuAFtDU01dIFtFXWNzbUhhc01vY0NvbnNpc3RlbmN5OiBIZWFkZXIgc2VjdGlvbiBpcyBpbnZhbGlkLgoAIm91dFNpemVJblBpeGVscyIgaXMgbnVsbC4AW0NTTV0gW0VdY3NtSGFzTW9jQ29uc2lzdGVuY3k6IERhdGEgc2VjdGlvbiBpcyBpbnZhbGlkLgoAIm91dE9yaWdpbkluUGl4ZWxzIiBpcyBudWxsLgBbQ1NNXSBbRV1jc21SZXZpdmVNb2NJblBsYWNlIGlzIGZhaWxlZC4gQ29ycnVwdGVkICBtb2MzIGZpbGUuCgAib3V0UGl4ZWxzUGVyVW5pdCIgaXMgbnVsbC4AW0NTTV0gW0VdY3NtUmV2aXZlTW9jSW5QbGFjZSBpcyBmYWlsZWQuIFRoZSBDb3JlIHVuc3VwcG9ydCBsYXRlciB0aGFuIG1vYzMgdmVyOlslZF0uIFRoaXMgbW9jMyB2ZXIgaXMgWyVkXS4KACJtb2MiIGlzIGludmFsaWQuAFtDU01dIFtFXWNzbUdldE1vY1ZlcnNpb24gaXMgZmFpbGVkLiBDb3JydXB0ZWQgbW9jMyBmaWxlLgoAInNpemUiIGlzIGludmFsaWQATGl2ZTJEIEN1YmlzbSBTREsgQ29yZSBWZXJzaW9uICVkLiVkLiVkAGNzbUdldE1vY1ZlcnNpb24AY3NtSGFzTW9jQ29uc2lzdGVuY3kAY3NtUmV2aXZlTW9jSW5QbGFjZQBjc21SZWFkQ2FudmFzSW5mbwBjc21HZXRTaXplb2ZNb2RlbABjc21Jbml0aWFsaXplTW9kZWxJblBsYWNlAGNzbVVwZGF0ZU1vZGVsAGNzbUdldFBhcmFtZXRlckNvdW50AGNzbUdldFBhcmFtZXRlcklkcwBjc21HZXRQYXJhbWV0ZXJUeXBlcwBjc21HZXRQYXJhbWV0ZXJNaW5pbXVtVmFsdWVzAGNzbUdldFBhcmFtZXRlck1heGltdW1WYWx1ZXMAY3NtR2V0UGFyYW1ldGVyRGVmYXVsdFZhbHVlcwBjc21HZXRQYXJhbWV0ZXJWYWx1ZXMAY3NtR2V0UGFydENvdW50AGNzbUdldFBhcnRJZHMAY3NtR2V0UGFydE9wYWNpdGllcwBjc21HZXRQYXJ0UGFyZW50UGFydEluZGljZXMAY3NtR2V0RHJhd2FibGVDb3VudABjc21HZXREcmF3YWJsZUlkcwBjc21HZXREcmF3YWJsZUNvbnN0YW50RmxhZ3MAY3NtR2V0RHJhd2FibGVEeW5hbWljRmxhZ3MAY3NtR2V0RHJhd2FibGVUZXh0dXJlSW5kaWNlcwBjc21HZXREcmF3YWJsZURyYXdPcmRlcnMAY3NtR2V0RHJhd2FibGVSZW5kZXJPcmRlcnMAY3NtR2V0RHJhd2FibGVPcGFjaXRpZXMAY3NtR2V0RHJhd2FibGVNYXNrQ291bnRzAGNzbUdldERyYXdhYmxlTWFza3MAY3NtR2V0RHJhd2FibGVWZXJ0ZXhDb3VudHMAY3NtR2V0RHJhd2FibGVWZXJ0ZXhQb3NpdGlvbnMAY3NtR2V0RHJhd2FibGVWZXJ0ZXhVdnMAY3NtR2V0RHJhd2FibGVJbmRleENvdW50cwBjc21HZXREcmF3YWJsZUluZGljZXMAY3NtR2V0RHJhd2FibGVNdWx0aXBseUNvbG9ycwBjc21HZXREcmF3YWJsZVNjcmVlbkNvbG9ycwBjc21HZXREcmF3YWJsZVBhcmVudFBhcnRJbmRpY2VzAGNzbVJlc2V0RHJhd2FibGVEeW5hbWljRmxhZ3MAY3NtR2V0UGFyYW1ldGVyS2V5Q291bnRzAGNzbUdldFBhcmFtZXRlcktleVZhbHVlcw=="),r(3228,"Cg=="),r(3267,"//////8="),r(3336,"LSsgICAwWDB4AChudWxsKQ=="),r(3360,"EQAKABEREQAAAAAFAAAAAAAACQAAAAAL"),r(3392,"EQAPChEREQMKBwABEwkLCwAACQYLAAALAAYRAAAAERER"),r(3441,"Cw=="),r(3450,"EQAKChEREQAKAAACAAkLAAAACQALAAAL"),r(3499,"DA=="),r(3511,"DAAAAAAMAAAAAAkMAAAAAAAMAAAM"),r(3557,"Dg=="),r(3569,"DQAAAAQNAAAAAAkOAAAAAAAOAAAO"),r(3615,"EA=="),r(3627,"DwAAAAAPAAAAAAkQAAAAAAAQAAAQAAASAAAAEhIS"),r(3682,"EgAAABISEgAAAAAAAAk="),r(3731,"Cw=="),r(3743,"CgAAAAAKAAAAAAkLAAAAAAALAAAL"),r(3789,"DA=="),r(3801,"DAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGLTBYKzBYIDBYLTB4KzB4IDB4AGluZgBJTkYAbmFuAE5BTgAuAAAAAKgaAAAAAAAAAwAAAAQAAAAEAAAABgAAAIP5ogBETm4A/CkVANFXJwDdNPUAYtvAADyZlQBBkEMAY1H+ALveqwC3YcUAOm4kANJNQgBJBuAACeouAByS0QDrHf4AKbEcAOg+pwD1NYIARLsuAJzphAC0JnAAQX5fANaROQBTgzkAnPQ5AItfhAAo+b0A+B87AN7/lwAPmAUAES/vAApaiwBtH20Az342AAnLJwBGT7cAnmY/AC3qXwC6J3UA5evHAD178QD3OQcAklKKAPtr6gAfsV8ACF2NADADVgB7/EYA8KtrACC8zwA29JoA46kdAF5hkQAIG+YAhZllAKAUXwCNQGgAgNj/ACdzTQAGBjEAylYVAMmocwB74mAAa4zAABnERwDNZ8MACejcAFmDKgCLdsQAphyWAESv3QAZV9EApT4FAAUH/wAzfj8AwjLoAJhP3gC7fTIAJj3DAB5r7wCf+F4ANR86AH/yygDxhx0AfJAhAGokfADVbvoAMC13ABU7QwC1FMYAwxmdAK3EwgAsTUEADABdAIZ9RgDjcS0Am8aaADNiAAC00nwAtKeXADdV1QDXPvYAoxAYAE12/ABknSoAcNerAGN8+AB6sFcAFxXnAMBJVgA71tkAp4Q4ACQjywDWincAWlQjAAAfuQDxChsAGc7fAJ8x/wBmHmoAmVdhAKz7RwB+f9gAImW3ADLoiQDmv2AA78TNAGw2CQBdP9QAFt7XAFg73gDem5IA0iIoACiG6ADiWE0AxsoyAAjjFgDgfcsAF8BQAPMdpwAY4FsALhM0AIMSYgCDSAEA9Y5bAK2wfwAe6fIASEpDABBn0wCq3dgArl9CAGphzgAKKKQA05m0AAam8gBcd38Ao8KDAGE8iACKc3gAr4xaAG/XvQAtpmMA9L/LAI2B7wAmwWcAVcpFAMrZNgAoqNIAwmGNABLJdwAEJhQAEkabAMRZxADIxUQATbKRAAAX8wDUQ60AKUnlAP3VEAAAvvwAHpTMAHDO7gATPvUA7PGAALPnwwDH+CgAkwWUAMFxPgAuCbMAC0XzAIgSnACrIHsALrWfAEeSwgB7Mi8ADFVtAHKnkABr5x8AMcuWAHkWSgBBeeIA9N+JAOiUlwDi5oQAmTGXAIjtawBfXzYAu/0OAEiatABnpGwAcXJCAI1dMgCfFbgAvOUJAI0xJQD3dDkAMAUcAA0MAQBLCGgALO5YAEeqkAB05wIAvdYkAPd9pgBuSHIAnxbvAI6UpgC0kfYA0VNRAM8K8gAgmDMA9Ut+ALJjaADdPl8AQF0DAIWJfwBVUikAN2TAAG3YEAAySDIAW0x1AE5x1ABFVG4ACwnBACr1aQAUZtUAJwedAF0EUAC0O9sA6nbFAIf5FwBJa30AHSe6AJZpKQDGzKwArRRUAJDiagCI2YkALHJQAASkvgB3B5QA8zBwAAD8JwDqcagAZsJJAGTgPQCX3YMAoz+XAEOU/QANhowAMUHeAJI5nQDdcIwAF7fnAAjfOwAVNysAXICgAFqAkwAQEZIAD+jYAGyArwDb/0sAOJAPAFkYdgBipRUAYcu7AMeJuQAQQL0A0vIEAEl1JwDrtvYA2yK7AAoUqgCJJi8AZIN2AAk7MwAOlBoAUTqqAB2jwgCv7a4AXCYSAG3CTQAtepwAwFaXAAM/gwAJ8PYAK0CMAG0xmQA5tAcADCAVANjDWwD1ksQAxq1LAE7KpQCnN80A5qk2AKuSlADdQmgAGWPeAHaM7wBoi1IA/Ns3AK6hqwDfFTEAAK6hAAz72gBkTWYA7QW3ACllMABXVr8AR/86AGr5uQB1vvMAKJPfAKuAMABmjPYABMsVAPoiBgDZ5B0APbOkAFcbjwA2zQkATkLpABO+pAAzI7UA8KoaAE9lqADSwaUACz8PAFt4zQAj+XYAe4sEAIkXcgDGplMAb27iAO/rAACbSlgAxNq3AKpmugB2z88A0QIdALHxLQCMmcEAw613AIZI2gD3XaAAxoD0AKzwLwDd7JoAP1y8ANDebQCQxx8AKtu2AKMlOgAAr5oArVOTALZXBAApLbQAS4B+ANoHpwB2qg4Ae1mhABYSKgDcty0A+uX9AInb/gCJvv0A5HZsAAap/AA+gHAAhW4VAP2H/wAoPgcAYWczACoYhgBNveoAs+evAI9tbgCVZzkAMb9bAITXSAAw3xYAxy1DACVhNQDJcM4AMMu4AL9s/QCkAKIABWzkAFrdoAAhb0cAYhLSALlchABwYUkAa1bgAJlSAQBQVTcAHtW3ADPxxAATbl8AXTDkAIUuqQAdssMAoTI2AAi3pADqsdQAFvchAI9p5AAn/3cADAOAAI1ALQBPzaAAIKWZALOi0wAvXQoAtPlCABHaywB9vtAAm9vBAKsXvQDKooEACGpcAC5VFwAnAFUAfxTwAOEHhgAUC2QAlkGNAIe+3gDa/SoAayW2AHuJNAAF8/4Aub+eAGhqTwBKKqgAT8RaAC34vADXWpgA9MeVAA1NjQAgOqYApFdfABQ/sQCAOJUAzCABAHHdhgDJ3rYAv2D1AE1lEQABB2sAjLCsALLA0ABRVUgAHvsOAJVywwCjBjsAwEA1AAbcewDgRcwATin6ANbKyADo80EAfGTeAJtk2ADZvjEApJfDAHdY1ABp48UA8NoTALo6PABGGEYAVXVfANK99QBuksYArC5dAA5E7QAcPkIAYcSHACn96QDn1vMAInzKAG+RNQAI4MUA/9eNAG5q4gCw/cYAkwjBAHxddABrrbIAzW6dAD5yewDGEWoA98+pAClz3wC1yboAtwBRAOKyDQB0uiQA5X1gAHTYigANFSwAgRgMAH5mlAABKRYAn3p2AP39vgBWRe8A2X42AOzZEwCLurkAxJf8ADGoJwDxbsMAlMU2ANioVgC0qLUAz8wOABKJLQBvVzQALFaJAJnO4wDWILkAa16qAD4qnAARX8wA/QtKAOH0+wCOO20A4oYsAOnUhAD8tKkA7+7RAC41yQAvOWEAOCFEABvZyACB/AoA+0pqAC8c2ABTtIQATpmMAFQizAAqVdwAwMbWAAsZlgAacLgAaZVkACZaYAA/Uu4AfxEPAPS1EQD8y/UANLwtADS87gDoXcwA3V5gAGeOmwCSM+8AyRe4AGFYmwDhV7wAUYPGANg+EADdcUgALRzdAK8YoQAhLEYAWfPXANl6mACeVMAAT4b6AFYG/ADlea4AiSI2ADitIgBnk9wAVeiqAIImOADK55sAUQ2kAJkzsQCp1w4AaQVIAGWy8AB/iKcAiEyXAPnRNgAhkrMAe4JKAJjPIQBAn9wA3EdVAOF0OgBn60IA/p3fAF7UXwB7Z6QAuqx6AFX2ogAriCMAQbpVAFluCAAhKoYAOUeDAInj5gDlntQASftAAP9W6QAcD8oAxVmKAJT6KwDTwcUAD8XPANtargBHxYYAhUNiACGGOwAseZQAEGGHACpMewCALBoAQ78SAIgmkAB4PIkAqMTkAOXbewDEOsIAJvTqAPdnigANkr8AZaMrAD2TsQC9fAsApFHcACfdYwBp4d0AmpQZAKgplQBozigACe20AESfIABOmMoAcIJjAH58IwAPuTIAp/WOABRW5wAh8QgAtZ0qAG9+TQClGVEAtfmrAILf1gCW3WEAFjYCAMQ6nwCDoqEAcu1tADmNegCCuKkAazJcAEYnWwAANO0A0gB3APz0VQABWU0A4HGA"),r(6675,"QPsh+T8AAAAALUR0PgAAAICYRvg8AAAAYFHMeDsAAACAgxvwOQAAAEAgJXo4AAAAgCKC4zYAAAAAHfNpNThj7T7aD0k/Xph7P9oPyT9pN6wxaCEiM7QPFDNoIaIz2w9JP9sPSb/kyxZA5MsWwAAAAAAAAACA2w9JQNsPScAAAIA/AADAPwAAAADcz9E1AAAAAADAFT8="),r(6824,"BQ=="),r(6836,"DQ=="),r(6860,"DgAAAA8AAABYHAAAAAQ="),r(6884,"AQ=="),r(6899,"Cv////8="),r(7156,"gCA="),f={Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0,Math:Math},d=e.buffer,p=(r=t).memory,_=i,m=new f.Int8Array(d),g=new f.Int16Array(d),v=new f.Int32Array(d),y=new f.Uint8Array(d),b=new f.Uint16Array(d),x=new f.Uint32Array(d),T=new f.Float32Array(d),A=new f.Float64Array(d),E=f.Math.imul,w=f.Math.fround,S=f.Math.abs,P=f.Math.clz32,M=f.Math.min,f.Math.max,I=f.Math.floor,f.Math.ceil,f.Math.sqrt,r.abort,f.NaN,C=f.Infinity,R=r.a,O=r.b,$=r.c,D=5251744,L=0,_[1]=function(t,e,i,r,n){t|=0,e|=0,i|=0,r|=0,n|=0;var s,o,a,h,u,l,c,f,d,p,_,m,g,y,b,x,P,M,I,C,R,O,$,L,F=0,k=w(0),N=w(0),U=0,G=w(0),X=w(0),V=w(0),H=w(0),j=w(0),Y=w(0),z=w(0),W=w(0),q=w(0),Z=w(0),Q=w(0),J=w(0),K=w(0),tt=w(0),et=w(0),it=w(0),rt=w(0),nt=w(0),st=w(0),ot=(w(0),w(0),w(0),w(0),w(0),w(0),w(0),w(0),w(0),0);if(D=L=D-32|0,1<=(0|n))for(s=v[16+(v[t+308>>2]+(e<<5)|0)>>2],F=v[t+60>>2]+E(s,24)|0,e=(o=v[F+8>>2])+-1|0,m=(u=v[F+4>>2])+-1|0,g=d=(s=v[v[t+152>>2]+(s<<2)>>2])+(o<<3)|0,y=p=s+((f=E(u,a=o+1|0))<<3)|0,b=_=s+(o+f<<3)|0,$=v[F+12>>2],l=w(0|u),c=w(0|o),t=0;V=T[4+(F=(h=t<<3)+i|0)>>2],N=w(V*l),H=T[F>>2],k=w(H*c),F=V>=w(1),N=!(V<w(0)^1)||F|H>=w(1)|H<w(0)?(ot||(q=T[4+b>>2],x=T[s+4>>2],j=w(q-x),P=T[4+g>>2],M=T[4+y>>2],Y=w(P-M),Z=w(w(j-Y)*w(.5)),I=T[_>>2],C=T[s>>2],z=w(I-C),R=T[d>>2],O=T[p>>2],W=w(R-O),Q=w(w(z-W)*w(.5)),Y=w(w(Y+j)*w(.5)),W=w(w(W+z)*w(.5)),ot=1,j=w(w(w(w(w(x+P)+M)+q)*w(.25))-w(j*w(.5))),z=w(w(w(w(w(C+R)+O)+I)*w(.25))-w(z*w(.5)))),V<w(3)^1|H>w(-2)^1|H<w(3)^1|V>w(-2)^1?(T[r+h>>2]=w(V*Q)+w(w(H*W)+z),k=w(V*Z),w(w(H*Y)+j)):(H<=w(0)?V<=w(0)?(X=w(w(V+w(2))*w(.5)),G=w(w(H+w(2))*w(.5)),k=w(Z+Z),nt=w(j-k),N=w(Q+Q),st=w(z-N),it=w(j-w(Y+Y)),J=w(it-k),rt=w(z-w(W+W)),K=w(rt-N),tt=T[s+4>>2],et=T[s>>2]):F?(k=w(Z*w(3)),N=w(j-w(Y+Y)),it=w(k+N),J=w(Q*w(3)),K=w(z-w(W+W)),rt=w(J+K),X=w(w(V+w(-1))*w(.5)),G=w(w(H+w(2))*w(.5)),tt=w(k+j),et=w(J+z),J=w(Z+N),K=w(Q+K),nt=T[4+y>>2],st=T[p>>2]):(k=w(j-w(Y+Y)),F=m,U=w(S(N))<w(2147483648)?~~N:-2147483648,X=w(0|(F=(0|U)==(0|u)?F:U)),G=w(X/l),J=w(w(G*Z)+k),q=w(G*Q),G=w(z-w(W+W)),K=w(q+G),V=w(w(0|(U=F+1|0))/l),it=w(w(V*Z)+k),rt=w(w(V*Q)+G),G=w(w(H+w(2))*w(.5)),X=w(N-X),F=s+(E(F,a)<<3)|0,nt=T[F+4>>2],st=T[F>>2],F=s+(E(U,a)<<3)|0,tt=T[F+4>>2],et=T[F>>2]):H>=w(1)?V<=w(0)?(X=w(w(V+w(2))*w(.5)),G=w(w(H+w(-1))*w(.5)),k=w(Z+Z),J=w(w(Y+j)-k),N=w(Q+Q),K=w(w(W+z)-N),tt=w(w(Y*w(3))+j),nt=w(tt-k),et=w(w(W*w(3))+z),st=w(et-N),it=T[4+g>>2],rt=T[d>>2]):F?(k=w(Z*w(3)),it=w(k+w(Y+j)),N=w(Q*w(3)),rt=w(N+w(W+z)),q=k,k=w(w(Y*w(3))+j),tt=w(q+k),q=N,N=w(w(W*w(3))+z),et=w(q+N),X=w(w(V+w(-1))*w(.5)),G=w(w(H+w(-1))*w(.5)),nt=w(Z+k),st=w(Q+N),J=T[4+b>>2],K=T[_>>2]):(k=w(w(Y*w(3))+j),F=m,U=w(S(N))<w(2147483648)?~~N:-2147483648,X=w(0|(F=(0|U)==(0|u)?F:U)),G=w(X/l),nt=w(w(G*Z)+k),q=w(G*Q),G=w(w(W*w(3))+z),st=w(q+G),V=w(w(0|(U=F+1|0))/l),tt=w(w(V*Z)+k),et=w(w(V*Q)+G),G=w(w(H+w(-1))*w(.5)),X=w(N-X),F=s+(E(F,a)+o<<3)|0,J=T[F+4>>2],K=T[F>>2],F=s+(E(U,a)+o<<3)|0,it=T[F+4>>2],rt=T[F>>2]):V<=w(0)?(X=w(w(V+w(2))*w(.5)),F=e,U=w(S(N=k))<w(2147483648)?~~k:-2147483648,k=w(0|(F=(0|U)==(0|o)?F:U)),G=w(N-k),k=w(k/c),N=w(Z+Z),J=w(w(w(k*Y)+j)-N),q=w(w(k*W)+z),k=w(Q+Q),K=w(q-k),V=w(w(0|(U=F+1|0))/c),nt=w(w(w(V*Y)+j)-N),st=w(w(w(V*W)+z)-k),it=T[4+(F=s+(F<<3)|0)>>2],rt=T[F>>2],tt=T[4+(F=s+(U<<3)|0)>>2],et=T[F>>2]):F?(q=N=w(Z*w(3)),F=e,U=w(S(k))<w(2147483648)?~~k:-2147483648,G=w(0|(F=(0|U)==(0|o)?F:U)),X=w(G/c),it=w(q+w(w(X*Y)+j)),H=w(Q*w(3)),rt=w(H+w(w(X*W)+z)),q=N,N=w(w(0|(U=F+1|0))/c),tt=w(q+w(w(N*Y)+j)),et=w(H+w(w(N*W)+z)),X=w(w(V+w(-1))*w(.5)),G=w(k-G),J=T[4+(F=s+(F+f<<3)|0)>>2],K=T[F>>2],nt=T[4+(F=s+(U+f<<3)|0)>>2],st=T[F>>2]):(A[16+L>>3]=V,v[L>>2]=t,A[8+L>>3]=H,B(4,1107,L)),w(G+X)<=w(1)?(T[r+h>>2]=w(K+w(w(st-K)*G))+w(w(rt-K)*X),k=w(J+w(w(nt-J)*G)),w(w(it-J)*X)):(k=w(w(1)-G),N=w(w(1)-X),T[r+h>>2]=w(et+w(w(rt-et)*k))+w(w(st-et)*N),k=w(tt+w(w(it-tt)*k)),w(w(nt-tt)*N)))):(F=w(S(q=N))<w(2147483648)?~~N:-2147483648,X=w(q-w(0|F)),U=w(S(N=k))<w(2147483648)?~~k:-2147483648,G=w(N-w(0|U)),F=U+E(F,a)|0,$?(k=w(w(1)-X),N=w(w(1)-G),U=s+(F<<3)|0,F=s+(F+a<<3)|0,T[r+h>>2]=w(w(w(k*w(N*T[U>>2]))+w(k*w(G*T[U+8>>2])))+w(X*w(N*T[F>>2])))+w(X*w(G*T[F+8>>2])),k=w(w(w(k*w(N*T[U+4>>2]))+w(k*w(G*T[U+12>>2])))+w(X*w(N*T[F+4>>2]))),w(X*w(G*T[F+12>>2]))):w(G+X)<=w(1)?(k=w(w(w(1)-G)-X),U=s+(F<<3)|0,F=s+(F+a<<3)|0,T[r+h>>2]=w(w(k*T[U>>2])+w(G*T[U+8>>2]))+w(X*T[F>>2]),k=w(w(k*T[U+4>>2])+w(G*T[U+12>>2])),w(X*T[F+4>>2])):(k=w(w(G+w(-1))+X),U=s+(F+a<<3)|0,N=w(w(1)-G),V=w(w(1)-X),F=s+(F<<3)|0,T[r+h>>2]=w(w(k*T[U+8>>2])+w(N*T[U>>2]))+w(V*T[F+8>>2]),k=w(w(k*T[U+12>>2])+w(N*T[U+4>>2])),w(V*T[F+12>>2]))),T[4+(r+h|0)>>2]=k+N,(0|n)!=(0|(t=t+1|0)););D=32+L|0},_[2]=function(t,e){t|=0,e|=0;var i=0,r=0,n=0,s=0,o=0,a=w(0),h=0,u=0,l=(w(0),0),c=0;s=v[t+320>>2],i=v[t+316>>2],o=v[t+308>>2];-1==(0|(r=v[8+(n=o+(e<<5)|0)>>2]))?(v[(c=i)+(i=e<<2)>>2]=v[v[t+148>>2]+(v[n+16>>2]<<2)>>2],v[i+s>>2]=1065353216):(h=v[n+16>>2],u=v[v[t+152>>2]+(h<<2)>>2],_[v[24+(o+(r<<5)|0)>>2]](t,r,u,u,v[16+(v[t+60>>2]+E(h,24)|0)>>2]),a=T[v[t+148>>2]+(v[n+16>>2]<<2)>>2],n=v[n+8>>2]<<2,T[(r=e<<2)+i>>2]=a*T[n+i>>2],v[r+s>>2]=v[n+s>>2]),4<=y[v[t>>2]+4|0]&&(s=e<<2,i=v[t+308>>2]+(e<<5)|0,r=v[i+16>>2]<<2,n=v[t+328>>2],e=v[t+324>>2],-1==(0|(o=v[i+8>>2]))?(o=v[t+156>>2],v[(i=s<<2)+e>>2]=v[o+(r<<=2)>>2],v[(h=4|i)+e>>2]=v[(u=4|r)+o>>2],v[(l=8|i)+e>>2]=v[o+(c=8|r)>>2],v[e+((s|=3)<<2)>>2]=1065353216,t=v[t+160>>2],v[i+n>>2]=v[t+r>>2],v[n+h>>2]=v[t+u>>2],v[n+l>>2]=v[t+c>>2]):(r=(u=r<<2)+v[t+156>>2]|0,T[(i=(h=s<<2)+e|0)>>2]=T[r>>2]*T[(o=(l=o<<4)+e|0)>>2],T[i+4>>2]=T[r+4>>2]*T[o+4>>2],T[i+8>>2]=T[r+8>>2]*T[o+8>>2],v[e+((s|=3)<<2)>>2]=1065353216,t=u+v[t+160>>2]|0,c=T[t>>2],a=T[(i=n+l|0)>>2],T[(e=n+h|0)>>2]=w(c+a)-w(c*a),c=T[t+4>>2],a=T[i+4>>2],T[e+4>>2]=w(c+a)-w(c*a),c=T[t+8>>2],a=T[i+8>>2],T[e+8>>2]=w(c+a)-w(c*a)),v[n+(s<<2)>>2]=1065353216)},_[3]=function(t,e,i,r,s){t|=0,e|=0,i|=0,r|=0,s|=0;var o,a,h,u,c,f=0,d=(f=(w(0),w(0),w(0),w(0),w(0),w(0),w(0),w(0),(e=v[16+(v[t+308>>2]+(e<<5)|0)>>2])<<2),function(t){var e,i,r,s,o=w(0);D=r=D-16|0,l(t);t:if((e=2147483647&(s=n[0]))>>>0<=1061752794)o=w(1),e>>>0<964689920||(o=V(+t));else if(e>>>0<=1081824209)i=+t,o=1075235812<=e>>>0?w(-V(((0|s)<0?3.141592653589793:-3.141592653589793)+i)):X((0|s)<=-1?1.5707963267948966+i:1.5707963267948966-i);else if(e>>>0<=1088565717)o=1085271520<=e>>>0?V(+t+((0|s)<0?6.283185307179586:-6.283185307179586)):X((0|s)<=-1?-4.71238898038469-+t:+t-4.71238898038469);else if(o=w(t-t),!(2139095040<=e>>>0))if((e=3&gt(t,8+r|0))>>>0<=2){switch(e-1|0){default:o=V(A[8+r>>3]);break t;case 0:o=X(-A[8+r>>3]);break t;case 1:}o=w(-V(A[8+r>>3]))}else o=X(A[8+r>>3]);return D=16+r|0,o}(m=w(w(w(T[4+(v[t+168>>2]+E(e,12)|0)>>2]+T[f+v[t+284>>2]>>2])*w(3.1415927410125732))/w(180)))),p=T[f+v[t+272>>2]>>2],_=v[f+v[t+292>>2]>>2],m=function(t){var e,i,r,s=0;D=i=D-16|0,l(t);t:if((e=2147483647&(r=n[0]))>>>0<=1061752794)e>>>0<964689920||(t=X(+t));else if(e>>>0<=1081824209)s=+t,t=e>>>0<=1075235811?(0|r)<=-1?w(-V(s+1.5707963267948966)):V(s+-1.5707963267948966):X(-(((0|r)<0?3.141592653589793:-3.141592653589793)+s));else if(e>>>0<=1088565717)s=+t,t=e>>>0<=1085271519?(0|r)<=-1?V(s+4.71238898038469):w(-V(s+-4.71238898038469)):X(((0|r)<0?6.283185307179586:-6.283185307179586)+s);else if(2139095040<=e>>>0)t=w(t-t);else if((e=3&gt(t,8+i|0))>>>0<=2){switch(e-1|0){default:t=X(A[8+i>>3]);break t;case 0:t=V(A[8+i>>3]);break t;case 1:}t=X(-A[8+i>>3])}else t=w(-V(A[8+i>>3]));return D=16+i|0,t}(m);if((e=0)<(0|s))for(d=w(p*d),a=w(_?-1:1),u=w(d*a),o=v[f+v[t+288>>2]>>2]?w(-1):w(1),c=w(w(p*m)*o),d=w(d*o),p=w(w(p*w(-m))*a),m=T[f+v[t+280>>2]>>2],a=T[f+v[t+276>>2]>>2];f=(t=e<<3)+r|0,o=T[(t=t+i|0)>>2],h=T[t+4>>2],T[f+4>>2]=m+w(w(c*o)+w(u*h)),T[f>>2]=a+w(w(d*o)+w(p*h)),(0|s)!=(0|(e=e+1|0)););},_[4]=function(t,e){t|=0,e|=0;var i,r,n,s,o,a,h=0,u=0,l=0,c=w(0),f=0,d=0,p=w(0),m=0,g=0,b=0;if(w(0),w(0),w(0),w(0),D=a=D+-64|0,m=v[t+320>>2],g=v[t+316>>2],u=v[t+308>>2],-1==(0|(f=v[8+(l=u+(e<<5)|0)>>2])))h=v[l+16>>2]<<2,v[(u=e<<2)+g>>2]=v[h+v[t+268>>2]>>2],v[u+m>>2]=v[h+v[t+272>>2]>>2];else{h=v[l+16>>2]<<2,b=v[h+v[t+276>>2]>>2],v[24+a>>2]=b,h=v[h+v[t+280>>2]>>2],v[28+a>>2]=h,v[16+a>>2]=0,r=1==v[12+(d=u+(f<<5)|0)>>2]?w(-10):w(-.10000000149011612),T[20+a>>2]=r,v[60+a>>2]=h,v[56+a>>2]=b,_[v[d+24>>2]](t,f,56+a|0,48+a|0,1),c=w(1),u=9;t:{for(;;){if(h=u,p=w(c*w(0)),T[32+a>>2]=p+T[56+a>>2],i=w(r*c),T[36+a>>2]=i+T[60+a>>2],_[v[d+24>>2]](t,f,32+a|0,40+a|0,1),n=w(T[44+a>>2]-T[52+a>>2]),T[44+a>>2]=n,s=w(T[40+a>>2]-T[48+a>>2]),T[40+a>>2]=s,n!=w(0)||s!=w(0)){u=v[44+a>>2],v[8+a>>2]=v[40+a>>2],v[12+a>>2]=u;break t}if(T[32+a>>2]=T[56+a>>2]-p,T[36+a>>2]=T[60+a>>2]-i,_[v[d+24>>2]](t,f,32+a|0,40+a|0,1),p=w(T[40+a>>2]-T[48+a>>2]),T[40+a>>2]=p,i=w(T[44+a>>2]-T[52+a>>2]),(T[44+a>>2]=i)!=w(0)||p!=w(0)){T[12+a>>2]=-i,T[8+a>>2]=-p;break t}if(u=h+-1|0,c=w(c*w(.10000000149011612)),!h)break}B(3,1311,0)}c=function(t,e){var i=w(0);if((i=w(_t(T[4+t>>2],T[t>>2])-_t(T[4+e>>2],T[e>>2])))<w(-3.1415927410125732))for(;(i=w(i+w(6.2831854820251465)))<w(-3.1415927410125732););if(i>w(3.1415927410125732))for(;(i=w(i+w(-6.2831854820251465)))>w(3.1415927410125732););return i}(16+a|0,8+a|0),_[v[d+24>>2]](t,v[l+8>>2],24+a|0,24+a|0,1),u=v[l+16>>2]<<2,v[u+v[t+276>>2]>>2]=v[24+a>>2],v[u+v[t+280>>2]>>2]=v[28+a>>2],h=u+v[t+284>>2]|0,T[h>>2]=T[h>>2]+w(w(c*w(-180))/w(3.1415927410125732)),l=v[l+8>>2]<<2,T[(h=e<<2)+g>>2]=T[u+v[t+268>>2]>>2]*T[l+g>>2],u=u+v[t+272>>2]|0,c=w(T[u>>2]*T[l+m>>2]),T[h+m>>2]=c,T[u>>2]=c}4<=y[v[t>>2]+4|0]&&(h=e<<2,l=v[t+308>>2]+(e<<5)|0,f=v[l+16>>2]<<2,u=v[t+328>>2],e=v[t+324>>2],-1==(0|(d=v[l+8>>2]))?(d=v[t+296>>2],v[(l=h<<2)+e>>2]=v[d+(f<<=2)>>2],v[(m=4|l)+e>>2]=v[(g=4|f)+d>>2],v[(b=8|l)+e>>2]=v[d+(o=8|f)>>2],v[e+((h|=3)<<2)>>2]=1065353216,t=v[t+300>>2],v[u+l>>2]=v[t+f>>2],v[u+m>>2]=v[t+g>>2],v[u+b>>2]=v[t+o>>2]):(f=(g=f<<2)+v[t+296>>2]|0,T[(l=(m=h<<2)+e|0)>>2]=T[f>>2]*T[(d=(b=d<<4)+e|0)>>2],T[l+4>>2]=T[f+4>>2]*T[d+4>>2],T[l+8>>2]=T[f+8>>2]*T[d+8>>2],v[e+((h|=3)<<2)>>2]=1065353216,t=g+v[t+300>>2]|0,c=T[t>>2],p=T[(l=u+b|0)>>2],T[(e=u+m|0)>>2]=w(c+p)-w(c*p),c=T[t+4>>2],p=T[l+4>>2],T[e+4>>2]=w(c+p)-w(c*p),c=T[t+8>>2],p=T[l+8>>2],T[e+8>>2]=w(c+p)-w(c*p)),v[u+(h<<2)>>2]=1065353216),D=64+a|0},_[5]=function(t,e){return t|=0,e|=0,w(0),w(0),0|((t=T[t>>2])<(e=T[e>>2])?-1:e<t)},_[6]=function(t,e,i,r){t|=0,e|=0,i|=0,r|=0;var n=0,s=0,o=w(0),a=0,h=0,u=0,l=0,c=0;if(1<=(0|(a=v[t+8>>2])))for(u=v[t+12>>2],h=v[t+20>>2];T[(s=n<<2)+u>>2]=T[e+s>>2]*T[s+h>>2],(0|(n=n+1|0))<(0|a););if(!((0|(a=v[t>>2]))<1))if(u=v[t+4>>2],r)for(s=e=0;;){if(v[r>>2]){if((0|(n=v[(h=e<<2)+v[t+16>>2]>>2]))<1)o=w(0);else for(l=n+s|0,c=v[t+12>>2],o=w(0),n=s;o=w(o+T[c+(n<<2)>>2]),(0|(n=n+1|0))<(0|l););T[i+h>>2]=o}if(r=r+4|0,s=v[u+(e<<2)>>2]+s|0,!((0|(e=e+1|0))<(0|a)))break}else for(h=v[t+16>>2],e=r=0;;){if((0|(n=v[(s=r<<2)+h>>2]))<=0)o=w(0);else for(l=e+n|0,c=v[t+12>>2],o=w(0),n=e;o=w(o+T[c+(n<<2)>>2]),(0|(n=n+1|0))<(0|l););if(T[i+s>>2]=o,e=v[s+u>>2]+e|0,!((0|(r=r+1|0))<(0|a)))break}},_[7]=function(t,e,i,r){t|=0,e|=0,i|=0,r|=0;var n=0,s=w(0),o=0,a=0,h=0,u=0,l=0;if(1<=(0|(u=v[t+8>>2])))for(a=v[t+12>>2],h=v[t+20>>2];T[(o=n<<2)+a>>2]=T[e+o>>2]*T[o+h>>2],(0|(n=n+1|0))<(0|u););if(!((0|(n=v[t>>2]))<1))if(u=v[t+4>>2],r)for(o=e=0;;){if(v[r>>2]){if((0|(n=v[(a=e<<2)+v[t+16>>2]>>2]))<1)s=w(0);else for(h=n+o|0,l=v[t+12>>2],s=w(0),n=o;s=w(s+T[l+(n<<2)>>2]),(0|(n=n+1|0))<(0|h););n=i+a|0,s=w(s+w(.0010000000474974513)),a=w(S(s))<w(2147483648)?~~s:-2147483648,v[n>>2]=a,n=v[t>>2]}if(r=r+4|0,o=v[u+(e<<2)>>2]+o|0,!((0|(e=e+1|0))<(0|n)))break}else for(a=v[t+16>>2],e=r=0;;){if((0|(n=v[(o=r<<2)+a>>2]))<=0)s=w(0);else for(h=e+n|0,l=v[t+12>>2],s=w(0),n=e;s=w(s+T[l+(n<<2)>>2]),(0|(n=n+1|0))<(0|h););if(n=i+o|0,s=w(s+w(.0010000000474974513)),h=w(S(s))<w(2147483648)?~~s:-2147483648,v[n>>2]=h,e=v[o+u>>2]+e|0,!((0|(r=r+1|0))<v[t>>2]))break}},_[8]=function(t,e,i,r,n,s){t|=0,e|=0,i|=0,r|=0,n|=0,s|=0;var o,a,h=0,u=0,l=0,c=0,f=0,d=0,p=0,_=0,m=0,g=0,y=w(0),b=0,x=v[t>>2];if(!((0|x)<1))if(o=n<<2,a=v[t+4>>2],s)for(;;){if(v[s>>2]&&(l=v[(h=c<<2)+v[t+16>>2]>>2],p=v[i+h>>2],u=v[r+h>>2],(h=(0|(_=E(u,n)))<1)||H(p,0,E(u,o)),!(h|(0|l)<1)))for(m=l+d|0,g=v[t+20>>2],h=d;;){for(y=T[(u=h<<2)+g>>2],b=v[e+u>>2],f=0;T[(u=(l=f<<2)+p|0)>>2]=T[u>>2]+w(y*T[l+b>>2]),(0|_)!=(0|(f=f+1|0)););if(!((0|(h=h+1|0))<(0|m)))break}if(s=s+4|0,d=v[(c<<2)+a>>2]+d|0,!((0|(c=c+1|0))<(0|x)))break}else for(s=0;;){if(l=v[(c=s<<2)+v[t+16>>2]>>2],p=v[i+c>>2],u=v[r+c>>2],(h=(0|(_=E(u,n)))<1)||H(p,0,E(u,o)),!(h|(0|l)<=0))for(m=l+d|0,g=v[t+20>>2],h=d;;){for(y=T[(u=h<<2)+g>>2],b=v[e+u>>2],f=0;T[(u=(l=f<<2)+p|0)>>2]=T[u>>2]+w(y*T[l+b>>2]),(0|_)!=(0|(f=f+1|0)););if(!((0|(h=h+1|0))<(0|m)))break}if(d=v[c+a>>2]+d|0,!((0|(s=s+1|0))<(0|x)))break}},_[9]=function(t){var e,i,r,n=0,s=0,o=0,a=0;if(!(v[648+(t|=0)>>2]||(0|(n=v[t+332>>2]))<1))for(i=(s=v[t+336>>2])+E(n,20)|0,n=v[t+424>>2],a=v[t+444>>2];;){if(v[n>>2]&&!((0|(o=v[s+16>>2]))<(t=1)))for(o<<=1,r=v[a>>2];T[(e=(t<<2)+r|0)>>2]=-T[e>>2],(0|(t=t+2|0))<(0|o););if(a=a+4|0,n=n+4|0,!((s=s+20|0)>>>0<i>>>0))break}},_[10]=function(t,e,i){var r;return G(r=v[20+(t|=0)>>2],e|=0,e=(i|=0)>>>0<(e=v[t+16>>2]-r|0)>>>0?i:e),v[t+20>>2]=e+v[t+20>>2],0|i},_[11]=function(t,e,i,r,s,o){t|=0,e=+e,i|=0,r|=0,s|=0,o|=0;var l,c,f,d,p=0,_=0,g=0,b=0,x=0,T=0,A=0,w=0,P=0,M=0,I=0,C=0,R=0,O=0,$=0;if(v[44+(D=f=D-560|0)>>2]=0,u(+e),p=0|n[1],c=4294967295<n[0]>>>0?0:1,d=(0|p)<-1||(0|p)<=-1&&c?(u(e=-e),p=0|n[1],n[0],O=1,3840):2048&s?(O=1,3843):(O=1&s)?3846:3841,2146435072&~p)if(e=function t(e,i){var r,s,o=0;if(u(+e),o=0|n[1],r=0|n[0],2047!=(0|(o=(s=o)>>>20&2047))){if(!o)return o=i,i=0==e?0:(e=t(0x10000000000000000*e,i),v[i>>2]+-64|0),v[o>>2]=i,e;v[i>>2]=o+-1022,a(0,0|r),a(1,-2146435073&s|1071644672),e=+h()}return e}(e,44+f|0),0!=(e+=e)&&(v[44+f>>2]=v[44+f>>2]+-1),l=16+f|0,97==(0|(c=32|o))){if(I=(M=32&o)?9+d|0:d,!(11<r>>>0)&&(p=12-r|0)){for(C=8;C*=16,p=p+-1|0;);e=45==y[0|I]?-(C+(-e-C)):e+C-C}for((0|l)==(0|(p=W((g=(p=v[44+f>>2])>>31)^p+g,0,l)))&&(m[15+f|0]=48,p=15+f|0),x=2|O,g=v[44+f>>2],m[0|(P=p+-2|0)]=o+15,m[p+-1|0]=(0|g)<0?45:43,p=8&s,_=16+f|0;o=_,w=M,g=S(e)<2147483648?~~e:-2147483648,m[0|_]=w|y[g+3824|0],1!=((_=o+1|0)-(16+f|0)|0)|(0==(e=16*(e-(0|g)))?!(p|0<(0|r)):0)||(m[o+1|0]=46,_=o+2|0),0!=e;);U(t,32,i,T=(o=!r|(0|r)<=((_-f|0)-18|0)?((l-(16+f|0)|0)-P|0)+_|0:2+((r+l|0)-P|0)|0)+x|0,s),N(t,I,x),U(t,48,i,T,65536^s),N(t,16+f|0,r=_-(16+f|0)|0),U(t,48,o-((p=r)+(r=l-P|0)|0)|0,0,0),N(t,P,r)}else{for(p=(0|r)<0,0==e?b=v[44+f>>2]:(b=v[44+f>>2]+-28|0,v[44+f>>2]=b,e*=268435456),A=p?6:r,g=M=(0|b)<0?48+f|0:336+f|0;g=(r=g)+4|0,0!=(e=1e9*(e-((v[r>>2]=p=e<4294967296&0<=e?~~e>>>0:0)>>>0))););if((0|b)<1)p=g,_=M;else for(_=M;;){if(P=(0|b)<29?b:29,!((p=g+-4|0)>>>0<_>>>0)){for(r=P,w=0;$=w,w=v[(I=p)>>2],x=31&r,x=32<=(63&r)>>>(T=0)?(b=w<<x,0):(b=(1<<x)-1&w>>>32-x,w<<x),T=b+T|0,T=(w=$+x|0)>>>0<x>>>0?T+1|0:T,$=I,I=It(w=Ct(x=w,T,1e9),L,1e9),v[$>>2]=x-I,_>>>0<=(p=p+-4|0)>>>0;);(r=w)&&(v[(_=_+-4|0)>>2]=r)}for(;_>>>0<(p=g)>>>0&&!v[(g=p+-4|0)>>2];);if(b=v[44+f>>2]-P|0,g=p,!(0<(0|(v[44+f>>2]=b))))break}if((0|b)<=-1)for(R=1+((A+25|0)/9|0)|0,P=102==(0|c);;){if(w=(0|b)<-9?9:0-b|0,p>>>0<=_>>>0)_=v[_>>2]?_:_+4|0;else{for(I=1e9>>>w,x=~(-1<<w),b=0,g=_;r=v[g>>2],v[g>>2]=(r>>>w)+b,b=E(I,r&x),(g=g+4|0)>>>0<p>>>0;);_=v[_>>2]?_:_+4|0,b&&(v[p>>2]=b,p=p+4|0)}if(b=w+v[44+f>>2]|0,p=(0|R)<p-(r=P?M:_)>>2?r+(R<<2)|0:p,!((0|(v[44+f>>2]=b))<0))break}if(!(p>>>(g=0)<=_>>>0||(g=E(M-_>>2,9),(r=v[_>>2])>>>0<(b=10))))for(;g=g+1|0,(b=E(b,10))>>>0<=r>>>0;);if((0|(r=(A-(102==(0|c)?0:g)|0)-(103==(0|c)&!!(0|A))|0))<(E(p-M>>2,9)+-9|0)){if(T=(M+((r=(0|(x=r+9216|0))/9|0)<<2)|0)-4092|0,b=10,(0|(r=1+(x-E(r,9)|0)|0))<=8)for(;b=E(b,10),9!=(0|(r=r+1|0)););if(R=T+4|0,((P=(I=v[T>>2])-E(b,x=(I>>>0)/(b>>>0)|0)|0)||(0|R)!=(0|p))&&(C=P>>>0<(r=b>>>1)>>>0?.5:(0|p)==(0|R)&&(0|r)==(0|P)?1:1.5,e=1&x?9007199254740994:9007199254740992,!O|45!=y[0|d]||(C=-C,e=-e),v[T>>2]=r=I-P|0,e+C!=e)){if(1e9<=(v[T>>2]=r=r+b|0)>>>0)for(;(T=T+-4|(v[T>>2]=0))>>>0<_>>>0&&(v[(_=_+-4|0)>>2]=0),r=v[T>>2]+1|0,999999999<(v[T>>2]=r)>>>0;);if(g=E(M-_>>2,9),!((r=v[_>>2])>>>0<(b=10)))for(;g=g+1|0,(b=E(b,10))>>>0<=r>>>0;);}p=(r=T+4|0)>>>0<p>>>0?r:p}t:{for(;;){if((P=p)>>>(I=0)<=_>>>0)break t;if(v[(p=P+-4|0)>>2])break}I=1}if(103!=(0|c))x=8&s;else if(A=((r=(0|g)<(0|(p=A||1))&-5<(0|g))?-1^g:-1)+p|0,o=(r?-1:-2)+o|0,!(x=8&s)){if(p=9,I&&(x=v[P+-4>>2])&&!((x>>>(p=0))%(r=10)))for(;p=p+1|0,!((x>>>0)%((r=E(r,10))>>>0)););r=E(P-M>>2,9)+-9|0,A=102==(32|o)?((x=0)|A)<(0|(r=0<(0|(r=r-p|0))?r:0))?A:r:((x=0)|A)<(0|(r=0<(0|(r=(r+g|0)-p|0))?r:0))?A:r}if(T=!!(0|(b=A|x)),r=t,$=i,p=0<(0|g)?g:0,102!=(0|(w=32|o))){if((l-(p=W((p=g>>31)+g^p,0,l))|0)<=1)for(;m[0|(p=p+-1|0)]=48,(l-p|0)<2;);m[0|(R=p+-2|0)]=o,m[p+-1|0]=(0|g)<0?45:43,p=l-R|0}if(U(r,32,$,T=1+(p+(T+(A+O|0)|0)|0)|0,s),N(t,d,O),U(t,48,i,T,65536^s),102==(0|w)){for(r=16+f|8,g=16+f|9,_=o=M>>>0<_>>>0?M:_;;){if(p=W(v[_>>2],0,g),(0|o)!=(0|_)){if(!(p>>>0<=16+f>>>0))for(;m[0|(p=p+-1|0)]=48,16+f>>>0<p>>>0;);}else(0|p)==(0|g)&&(m[24+f|0]=48,p=r);if(N(t,p,g-p|0),!((_=_+4|0)>>>0<=M>>>0))break}b&&N(t,3875,1);t:if(!((0|A)<1|P>>>0<=_>>>0))for(;;){if(16+f>>>0<(p=W(v[_>>2],0,g))>>>0)for(;m[0|(p=p+-1|0)]=48,16+f>>>0<p>>>0;);if(N(t,p,(0|A)<9?A:9),A=A+-9|0,P>>>0<=(_=_+4|0)>>>0)break t;if(!(0<(0|A)))break}U(t,48,A+9|0,9,0)}else{t:if(!((0|A)<0))for(o=I?P:_+4|0,r=16+f|8,M=16+f|9,g=_;;){if((0|M)==(0|(p=W(v[g>>2],0,M)))&&(m[24+f|0]=48,p=r),(0|_)!=(0|g)){if(!(p>>>0<=16+f>>>0))for(;m[0|(p=p+-1|0)]=48,16+f>>>0<p>>>0;);}else N(t,p,1),p=p+1|0,(0|A)<1&&!x||N(t,3875,1);if(N(t,w=p,(0|(p=M-p|0))<(0|A)?p:A),A=A-p|0,o>>>0<=(g=g+4|0)>>>0)break t;if(!(-1<(0|A)))break}U(t,48,A+18|0,18,0),N(t,R,l-R|0)}}else U(t,32,i,T=O+3|0,-65537&s),N(t,d,O),r=o>>>5&1,N(t,e!=e?r?3867:3871:r?3859:3863,3);return U(t,32,i,T,8192^s),D=560+f|0,0|((0|T)<(0|i)?i:T)},_[12]=function(t,e){t|=0;var i=e|=0;e=v[e>>2]+15&-16,v[i>>2]=e+16,i=t,t=function(t,e,i,r){var n,s,o,u=0,l=0,c=0;return D=s=D-32|0,u=(o=u=2147483647&r)-1006698496|0,l=u=(n=l=c=i)>>>0<0?u+1|0:u,u=o-1140785152|0,(0|(u=c>>>0<0?u+1|0:u))==(0|l)&n>>>0<c>>>0|l>>>0<u>>>0?(u=r<<4|i>>>28,i=i<<4|e>>>28,134217728==(0|(c=e&=268435455))&1<=t>>>0|134217728<e>>>0?(u=u+1073741824|0,(t=i+1|0)>>>0<1&&(u=u+1|0),l=t):(u=u-(((l=i)>>>0<0)+-1073741824|0)|0,t|134217728^c||((t=l+(1&l)|0)>>>0<l>>>0&&(u=u+1|0),l=t))):(!c&2147418112==(0|o)?!(t|e):2147418112==(0|o)&c>>>0<0|o>>>0<2147418112)?(u=2146435072,1140785151==((l=0)|o)&4294967295<c>>>0|1140785151<o>>>0||(c=o>>>16)>>>(u=0)<15249||(function(t,e,i,r,n,s){var o,a,h=0,u=0;64&s?(e=31&(i=s-64|0),e=32<=(63&i)>>>0?(i=0,n>>>e):(i=n>>>e,((1<<e)-1&n)<<32-e|r>>>e),n=r=0):s&&(u=n,h=31&(a=64-s|0),a=32<=(63&a)>>>0?(u=r<<h,0):(u=(1<<h)-1&r>>>32-h|u<<h,r<<h),o=e,e=31&(h=s),e=32<=(63&h)>>>0?(h=0,i>>>e):(h=i>>>e,((1<<e)-1&i)<<32-e|o>>>e),e|=a,i=h|u,h=r,r=31&s,r=32<=(63&s)>>>0?(u=0,n>>>r):(u=n>>>r,((1<<r)-1&n)<<32-r|h>>>r),n=u),v[t>>2]=e,v[4+t>>2]=i,v[8+t>>2]=r,v[12+t>>2]=n}(s,t,e,i,u=65535&r|65536,15361-c|0),function(t,e,i,r,n,s){var o,a,h=0;64&s?(r=e,e=31&(n=s+-64|0),32<=(63&n)>>>0?(n=r<<e,r=0):(n=(1<<e)-1&r>>>32-e|i<<e,r<<=e),i=e=0):s&&(a=r,r=31&(o=s),a=32<=(63&s)>>>0?(h=a<<r,0):(h=(1<<r)-1&a>>>32-r|n<<r,a<<r),r=i,n=31&(s=64-s|0),32<=(63&s)>>>0?(s=0,r>>>=n):(s=r>>>n,r=((1<<n)-1&r)<<32-n|e>>>n),r|=a,n=s|h,s=e,e=31&o,e=32<=(63&o)>>>0?(h=s<<e,0):(h=(1<<e)-1&s>>>32-e|i<<e,s<<e),i=h),v[t>>2]=e,v[4+t>>2]=i,v[8+t>>2]=r,v[12+t>>2]=n}(16+s|0,t,e,i,u,c+-15233|0),i=v[4+s>>2],t=v[8+s>>2],u=v[12+s>>2]<<4|t>>>28,l=t<<4|i>>>28,134217728==(0|(i=t=268435455&i))&1<=(e=v[s>>2]|0!=(v[16+s>>2]|v[24+s>>2])|0!=(v[20+s>>2]|v[28+s>>2]))>>>0|134217728<t>>>0?((t=l+1|0)>>>0<1&&(u=u+1|0),l=t):e|134217728^i||((t=l+(1&l)|0)>>>0<l>>>0&&(u=u+1|0),l=t))):(l=i<<4|e>>>28,u=524287&(u=r<<4|i>>>28)|2146959360),D=32+s|0,a(0,0|l),a(1,-2147483648&r|u),+h()}(v[e>>2],v[e+4>>2],v[e+8>>2],v[e+12>>2]),A[i>>3]=t},_[13]=function(t){return 0},_[14]=function(t,e,i){e|=0,i|=0;var r,n,s=0,o=0,a=0,h=0;for(D=n=D-32|0,s=v[28+(t|=0)>>2],v[16+n>>2]=s,a=v[t+20>>2],v[28+n>>2]=i,v[24+n>>2]=e,a=(v[20+n>>2]=e=a-s|0)+i|0,h=2,e=16+n|0;;){t:{if((o=(s=0)|$(v[t+60>>2],0|e,0|h,12+n|0))&&(v[2086]=o,s=-1),(0|(s=s?v[12+n>>2]=-1:v[12+n>>2]))==(0|a))e=v[t+44>>2],v[t+28>>2]=e,v[t+20>>2]=e,v[t+16>>2]=e+v[t+48>>2],t=i;else{if(-1<(0|s))break t;v[t+28>>2]=0,v[t+16>>2]=0,v[t+20>>2]=0,v[t>>2]=32|v[t>>2],2!=((t=0)|h)&&(t=i-v[e+4>>2]|0)}return D=32+n|0,0|t}o=v[e+4>>2],v[(e=(r=o>>>0<s>>>0)?e+8|0:e)>>2]=(o=s-(r?o:0)|0)+v[e>>2],v[e+4>>2]=v[e+4>>2]-o,a=a-s|0,h=h-r|0}},_[15]=function(t,e,i,r){return L=0},{d:function(){},e:function(){return 83886080},f:function(){return 5},g:function(t,e){return e|=0,D=e=D-16|0,t=(t|=0)?ot(t)?(B(4,2150,0),0):y[t+4|0]:(v[e+4>>2]=1444,v[e>>2]=2267,B(4,1294,e),0),D=e+16|0,0|t},h:function(t,e){var i;return e|=0,D=i=D-48|0,t=(t|=0)?(t+63&-64)!=(0|t)?(v[36+i>>2]=1522,v[32+i>>2]=2284,B(4,1294,32+i|0),0):(e+63&-64)==(0|e)&&e?function(t,e){var i,r=0,n=0,s=0,o=0,a=0,h=0,u=0,l=0,c=0,f=0,d=0,p=0,_=0,g=0,T=0,A=0,w=0,S=0,P=0,M=0,I=0;D=a=(i=n=D)-704&-64;t:if(e>>>0<=1343)B(4,1235,0);else if(ot(t))B(4,1469,0);else if(n=y[0|(M=t+4|0)]){if(!(6<=n>>>0)){(A=1==(0|!y[t+5|0]))||(j(M,1),k(t- -64|0,4,160)),H(a- -64|0,0,640),et(t,a- -64|0),n=t+e|0,e=v[a+64>>2];e:{i:{r:{if(5<=(T=y[t+4|0])>>>0){if(e>>>0<t>>>0|n>>>0<e>>>0)break i;if((o=e+256|0)>>>0<t>>>0)break i;if(o>>>0<=n>>>0)break r;break i}if(e>>>0<t>>>0|n>>>0<e>>>0)break i;if((o=e+128|0)>>>0<t>>>0|n>>>0<o>>>0)break i}if(!((s=v[a+68>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<o>>>0||(s=s- -64|0)>>>0<t>>>0|n>>>0<s>>>0||(0|(f=v[e>>2]))<0||(o=v[a+72>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=(r=o)+(o=f<<2)|0)>>>0<t>>>0|n>>>0<s>>>0||(u=v[a+76>>2])>>>0<t>>>0|n>>>0<u>>>0|u>>>0<s>>>0||(r=(f<<6)+u|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+80>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+84>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+88>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+92>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+96>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+100>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0||(0|(r=v[e+4>>2]))<0||(o=v[a+104>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(h=(s=o)+(o=r<<2)|0)>>>0<t>>>0|n>>>0<h>>>0||(s=v[a+108>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<h>>>0||(r=s+(r<<6)|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+112>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+116>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+120>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+124>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+128>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+132>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+136>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0||(0|(r=v[e+8>>2]))<0||(o=v[a+140>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=(d=r<<2)+o|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+144>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+d|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+148>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+d|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+156>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+d|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+160>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+d|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+164>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+d|0)>>>0<t>>>0|n>>>0<s>>>0||(0|(r=v[e+12>>2]))<0||(o=v[a+172>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=(p=r<<2)+o|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+176>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+p|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+180>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+p|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+188>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(r=o+p|0)>>>0<t>>>0|n>>>0<r>>>0||(0|(s=v[e+16>>2]))<0||(o=v[a+192>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0||(h=(r=o)+(o=s<<2)|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+196>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+200>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+204>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+208>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+(s<<6)|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+212>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+216>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+220>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+228>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+232>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+236>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+240>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+244>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+o|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+248>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(r=r+s|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+252>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+256>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+260>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+264>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+268>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(s=v[a+272>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(0|(h=v[e+20>>2]))<0||(s=v[a+276>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0||(_=(r=s)+(s=h<<2)|0)>>>0<t>>>0|n>>>0<_>>>0||(r=v[a+280>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<_>>>0||(h=r+(h<<6)|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+284>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+s|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+288>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+s|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+292>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+s|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+296>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+s|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+300>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+s|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+308>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+s|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+312>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+s|0)>>>0<t>>>0|n>>>0<h>>>0||(0|(_=v[e+24>>2]))<0||(r=v[a+336>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+(_<<2)|0)>>>0<t>>>0|n>>>0<h>>>0||(0|(_=v[e+28>>2]))<0||(r=v[a+340>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=(S=_<<2)+r|0)>>>0<t>>>0|n>>>0<h>>>0||(r=v[a+344>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(h=r+S|0)>>>0<t>>>0|n>>>0<h>>>0||(0|(_=v[e+32>>2]))<0||(r=v[a+356>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<h>>>0||(_=(h=_<<2)+r|0)>>>0<t>>>0|n>>>0<_>>>0||(r=v[a+360>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<_>>>0||(_=r+h|0)>>>0<t>>>0|n>>>0<_>>>0||(r=v[a+364>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<_>>>0||(_=r+h|0)>>>0<t>>>0|n>>>0<_>>>0||(r=v[a+368>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<_>>>0||(_=r+h|0)>>>0<t>>>0|n>>>0<_>>>0||(r=v[a+372>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<_>>>0||(_=r+h|0)>>>0<t>>>0|n>>>0<_>>>0||(r=v[a+376>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<_>>>0||(_=r+h|0)>>>0<t>>>0|n>>>0<_>>>0||(r=v[a+380>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<_>>>0||(_=r+h|0)>>>0<t>>>0|n>>>0<_>>>0||(0|(l=v[e+36>>2]))<0||(r=v[a+392>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<_>>>0||(l=(_=l<<2)+r|0)>>>0<t>>>0|n>>>0<l>>>0||(r=v[a+396>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+_|0)>>>0<t>>>0|n>>>0<l>>>0||(r=v[a+400>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+_|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+40>>2]))<0||(r=v[a+412>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+(c<<2)|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+44>>2]))<0||(r=v[a+424>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+(c<<2)|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+48>>2]))<0||(r=v[a+428>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=(c<<=2)+r|0)>>>0<t>>>0|n>>>0<l>>>0||(r=v[a+432>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+c|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+52>>2]))<0||(r=v[a+416>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=(c<<=2)+r|0)>>>0<t>>>0|n>>>0<l>>>0||(r=v[a+420>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+c|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+56>>2]))<0||(r=v[a+552>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+(c<<2)|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+60>>2]))<0||(r=v[a+556>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+(c<<2)|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+64>>2]))<0||(r=v[a+560>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+(c<<1)|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+68>>2]))<0||(r=v[a+564>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+(c<<2)|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+72>>2]))<0||(r=v[a+568>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(c=(l=r)+(r=c<<2)|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+572>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+576>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+580>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+584>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(l=r+l|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+76>>2]))<0||(r=v[a+588>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(c=(l=c<<2)+r|0)>>>0<t>>>0|n>>>0<c>>>0||(r=v[a+592>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(r=v[a+596>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<c>>>0||(l=r+l|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+80>>2]))<0||(r=v[a+600>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(g=(l=r)+(r=c<<2)|0)>>>0<t>>>0|n>>>0<g>>>0||(l=v[a+604>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<g>>>0||(c=l+(c<<6)|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+608>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+612>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+616>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+620>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+624>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+628>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(c=r+l|0)>>>0<t>>>0|n>>>0<c>>>0||(l=v[a+632>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<c>>>0||(l=r+l|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+84>>2]))<0||(r=v[a+636>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+(c<<2)|0)>>>0<t>>>0|n>>>0<l>>>0||(r=v[a+640>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(l=r+(c<<1)|0)>>>0<t>>>0|n>>>0<l>>>0||(0|(c=v[e+88>>2]))<0||(r=v[a+644>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0||(r=r+(c<<2)|0)>>>0<t>>>0|n>>>0<r>>>0)){if(!(T>>>0<2)){if((l=v[a+168>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<r>>>0)break i;if((r=l+d|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if(!(T>>>0<4)){if((l=v[a+324>>2])>>>0<t>>>0|n>>>0<l>>>0|l>>>0<r>>>0)break i;if((l=s+l|0)>>>0<t>>>0|n>>>0<l>>>0)break i;if((r=v[a+328>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0)break i;if((l=r+s|0)>>>0<t>>>0|n>>>0<l>>>0)break i;if((r=v[a+332>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0)break i;if((l=r+s|0)>>>0<t>>>0|n>>>0<l>>>0)break i;if((r=v[a+152>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<l>>>0)break i;if((d=r+d|0)>>>0<t>>>0|n>>>0<d>>>0)break i;if((r=v[a+184>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<d>>>0)break i;if((d=r+p|0)>>>0<t>>>0|n>>>0<d>>>0)break i;if((r=v[a+224>>2])>>>0<t>>>0|n>>>0<r>>>0|r>>>0<d>>>0)break i;if((r=r+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((0|(d=v[e+92>>2]))<0)break i;if((o=v[a+648>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((d=(r=d<<2)+o|0)>>>0<t>>>0|n>>>0<d>>>0)break i;if((o=v[a+652>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<d>>>0)break i;if((d=r+o|0)>>>0<t>>>0|n>>>0<d>>>0)break i;if((o=v[a+656>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<d>>>0)break i;if((r=r+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((0|(d=v[e+96>>2]))<0)break i;if((o=v[a+660>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((d=(r=d<<2)+o|0)>>>0<t>>>0|n>>>0<d>>>0)break i;if((o=v[a+664>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<d>>>0)break i;if((d=r+o|0)>>>0<t>>>0|n>>>0<d>>>0)break i;if((o=v[a+668>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<d>>>0)break i;if((r=r+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+304>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+316>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+320>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0)break i;if((0|(r=v[e+100>>2]))<0)break i;if((o=v[a+436>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0)break i;if((r=(s=r<<2)+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+440>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+444>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0)break i;if((0|(r=v[e+104>>2]))<0)break i;if((o=v[a+448>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0)break i;if((r=(s=o)+(o=r<<2)|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((s=v[a+452>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((s=v[a+456>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((s=v[a+460>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((s=v[a+464>>2])>>>0<t>>>0|n>>>0<s>>>0|s>>>0<r>>>0)break i;if((s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0)break i;if((0|(r=v[e+108>>2]))<0)break i;if((o=v[a+480>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0)break i;if((r=(s=r<<2)+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+484>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+488>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0)break i;if((0|(r=v[e+112>>2]))<0)break i;if((o=v[a+504>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0)break i;if((r=(s=r<<2)+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+508>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+512>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0)break i;if((0|(r=v[e+116>>2]))<0)break i;if((o=v[a+528>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0)break i;if((s=o+(r<<2)|0)>>>0<t>>>0|n>>>0<s>>>0)break i;if((0|(r=v[e+120>>2]))<0)break i;if((o=v[a+532>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0)break i;if((r=(s=r<<2)+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+536>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i;if((o=v[a+540>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0)break i;if((s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0)break i;if((0|(r=v[e+124>>2]))<0)break i;if((o=v[a+544>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0)break i;if((s=(r<<=2)+o|0)>>>0<t>>>0|n>>>0<s>>>0)break i;if((o=v[a+548>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0)break i;if((r=r+o|0)>>>0<t>>>0|n>>>0<r>>>0)break i}}if(T>>>0<5)break e;if(!((o=v[a+348>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0||(s=o+S|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+352>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+S|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+384>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+h|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+388>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+h|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+404>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+_|0)>>>0<t>>>0|n>>>0<s>>>0||(o=v[a+408>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(s=o+_|0)>>>0<t>>>0|n>>>0<s>>>0||(0|(r=v[e+128>>2]))<0||(o=v[a+468>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(r=(s=r<<2)+o|0)>>>0<t>>>0|n>>>0<r>>>0||(o=v[a+472>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(o=v[a+476>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0||(s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0||(0|(r=v[e+132>>2]))<0||(o=v[a+492>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(r=(s=r<<2)+o|0)>>>0<t>>>0|n>>>0<r>>>0||(o=v[a+496>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(o=v[a+500>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0||(s=s+o|0)>>>0<t>>>0|n>>>0<s>>>0||(0|(r=v[e+136>>2]))<0||(o=v[a+516>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<s>>>0||(r=(s=r<<2)+o|0)>>>0<t>>>0|n>>>0<r>>>0||(o=v[a+520>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0||(r=s+o|0)>>>0<t>>>0|n>>>0<r>>>0||(o=v[a+524>>2])>>>0<t>>>0|n>>>0<o>>>0|o>>>0<r>>>0||(o=s+o|0)>>>0<t>>>0)&&o>>>0<=n>>>0)break e}}B(4,1760,0),j(M,1),k(t- -64|0,4,160);break t}A||(ft(t),m[t+5|0]=0,e=v[a+64>>2],f=v[e>>2],u=v[a+76>>2],T=y[t+4|0]);e:{if((t=0)<(0|f)){for(;;){if(63<Z((t<<6)+u|0)>>>0)break e;if((0|f)==(0|(t=t+1|0)))break}if(r=e+48|0,(n=0)<(0|(t=v[e>>2]))){for(o=v[e+48>>2],s=v[a+80>>2];;){if((0|(u=v[s+(n<<2)>>2]))<0|(0|o)<=(0|u))break e;if((0|t)==(0|(n=n+1|0)))break}for(_=e+24|0,o=v[e+24>>2],h=v[a+88>>2],f=v[a+84>>2],n=0;;){if(s=v[(u=n<<2)+h>>2]){if((0|s)<0|(0|o)<(0|s))break e;if((0|(u=v[u+f>>2]))<0|(0|o)<=(0|u))break e;if((s=s+u|0)>>>31|(0|o)<(0|s))break e}if((0|t)==(0|(n=n+1|0)))break}for(n=0,o=v[a+92>>2];;){if(1<x[o+(n<<2)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(n=0,o=v[a+96>>2];;){if(1<x[o+(n<<2)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(n=0,o=v[a+100>>2];;){if((0|(s=v[o+(n<<2)>>2]))<-1|(0|t)<=(0|s))break e;if((0|t)==(0|(n=n+1|0)))break}}else _=e+24|0}else _=e+24|0,r=e+48|0;if((t=0)<(0|(n=v[e+4>>2]))){for(o=v[a+108>>2];;){if(63<Z(o+(t<<6)|0)>>>0)break e;if((0|n)==(0|(t=t+1|0)))break}if(h=(o=v[e+48>>2])+-1|0,!(((n=0)|(t=v[e+4>>2]))<=0)){for(s=v[a+112>>2];;){if((0|(u=v[s+(n<<2)>>2]))<0|(0|o)<=(0|u))break e;if((0|t)==(0|(n=n+1|0)))break}for(n=0,o=v[a+116>>2];;){if(1<x[o+(n<<2)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(n=0,o=v[a+120>>2];;){if(1<x[o+(n<<2)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(o=v[e>>2],n=0,s=v[a+124>>2];;){if((0|(u=v[s+(n<<2)>>2]))<-1|(0|o)<=(0|u))break e;if((0|t)==(0|(n=n+1|0)))break}for(n=0,o=v[a+128>>2];;){if((0|(s=v[o+(n<<2)>>2]))<-1|(0|t)<=(0|s))break e;if((0|t)==(0|(n=n+1|0)))break}for(n=0,o=v[a+132>>2];;){if(1<x[o+(n<<2)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(s=e+8|0,u=e+12|0,f=v[a+136>>2],n=0;;){if(1<(p=v[(d=n<<2)+o>>2])>>>0)break e;if((0|(d=v[f+d>>2]))<0|(0|d)>=v[(p-1|0?s:u)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}}}else h=v[r>>2]+-1|0;if((t=0)<(0|(n=v[e+8>>2]))){for(o=v[a+140>>2];;){if((0|(s=v[o+(t<<2)>>2]))<0|(0|h)<(0|s))break e;if((0|n)==(0|(t=t+1|0)))break}for(S=e+28|0,o=v[e+28>>2],f=v[a+148>>2],d=v[a+144>>2],t=0;;){if(s=v[(u=t<<2)+f>>2]){if((0|s)<0|(0|o)<(0|s))break e;if((0|(u=v[u+d>>2]))<0|(0|o)<=(0|u))break e;if((s=s+u|0)>>>31|(0|o)<(0|s))break e}if((0|n)==(0|(t=t+1|0)))break}for(t=0,s=v[a+156>>2],u=v[a+164>>2],f=v[a+160>>2];;){if((0|(d=v[(o=t<<2)+f>>2]))<1)break e;if((0|(p=v[o+u>>2]))<1)break e;if((0|(o=v[s+o>>2]))<1|(0|o)!=(0|E(p+1|0,d+1|0)))break e;if((0|n)==(0|(t=t+1|0)))break}}else S=e+28|0;if((t=0)<(0|(s=v[e+12>>2]))){for(n=v[a+172>>2];;){if((0|(o=v[n+(t<<2)>>2]))<0|(0|h)<(0|o))break e;if((0|s)==(0|(t=t+1|0)))break}for(l=e+32|0,n=v[e+32>>2],h=v[a+180>>2],f=v[a+176>>2],t=0;;){if(o=v[(u=t<<2)+h>>2]){if((0|o)<0|(0|n)<(0|o))break e;if((0|(u=v[u+f>>2]))<0|(0|n)<=(0|u))break e;if((o=o+u|0)>>>31|(0|n)<(0|o))break e}if((0|s)==(0|(t=t+1|0)))break}}else l=e+32|0;o=e+16|0;i:{r:{if(!(((t=0)|(n=v[e+16>>2]))<=0)){for(s=v[a+208>>2];;){if(63<Z(s+(t<<6)|0)>>>0)break e;if((0|n)==(0|(t=t+1|0)))break}if(!(((n=0)|(t=v[o>>2]))<=0)){for(s=v[r>>2],u=v[a+212>>2];;){if((0|(h=v[u+(n<<2)>>2]))<0|(0|s)<=(0|h))break e;if((0|t)==(0|(n=n+1|0)))break}for(M=e+36|0,s=v[e+36>>2],f=v[a+220>>2],d=v[a+216>>2],n=0;;){if(u=v[(h=n<<2)+f>>2]){if((0|u)<0|(0|s)<(0|u))break e;if((0|(h=v[h+d>>2]))<0|(0|s)<=(0|h))break e;if((u=u+h|0)>>>31|(0|s)<(0|u))break e}if((0|t)==(0|(n=n+1|0)))break}for(n=0,s=v[a+228>>2];;){if(1<x[s+(n<<2)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(n=0,s=v[a+232>>2];;){if(1<x[s+(n<<2)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(s=v[e>>2],n=0,u=v[a+236>>2];;){if((0|(h=v[u+(n<<2)>>2]))<-1|(0|s)<=(0|h))break e;if((0|t)==(0|(n=n+1|0)))break}for(s=v[e+4>>2],n=0,u=v[a+240>>2];;){if((0|(h=v[u+(n<<2)>>2]))<-1|(0|s)<=(0|h))break e;if((0|t)==(0|(n=n+1|0)))break}for(s=v[a+244>>2],n=0;;){if(v[s+(n<<2)>>2]<0)break e;if((0|t)==(0|(n=n+1|0)))break}break r}}u=e+68|0,M=e+36|0;break i}for(s=v[a+252>>2],n=0;;){if(v[s+(n<<2)>>2]<0)break e;if((0|t)==(0|(n=n+1|0)))break}for(u=v[e+60>>2],n=0,h=v[a+256>>2];;){if((f=v[(f=n<<2)+h>>2]+(v[s+f>>2]<<1)|0)>>>31|(0|u)<(0|f))break e;if((0|t)==(0|(n=n+1|0)))break}for(s=v[e+64>>2],f=v[a+264>>2],d=v[a+260>>2],n=0;;){if(u=v[(h=n<<2)+f>>2]){if((0|u)<0|(0|s)<(0|u))break e;if((0|(h=v[h+d>>2]))<0|(0|s)<=(0|h))break e;if((u=u+h|0)>>>31|(0|s)<(0|u))break e}if((0|t)==(0|(n=n+1|0)))break}for(u=e+68|0,s=v[e+68>>2],d=v[a+272>>2],p=v[a+268>>2],n=0;;){if(h=v[(f=n<<2)+d>>2]){if((0|h)<0|(0|s)<(0|h))break e;if((0|(f=v[f+p>>2]))<0|(0|s)<=(0|f))break e;if((h=h+f|0)>>>31|(0|s)<(0|h))break e}if((0|t)==(0|(n=n+1|0)))break}}i:{r:{if(!(((t=0)|(n=v[e+20>>2]))<=0)){for(s=v[a+280>>2];;){if(63<Z(s+(t<<6)|0)>>>0)break e;if((0|n)==(0|(t=t+1|0)))break}if(!(((t=0)|(n=v[e+20>>2]))<=0)){for(s=v[a+296>>2];;){if(1<x[s+(t<<2)>>2])break e;if((0|n)==(0|(t=t+1|0)))break}for(s=v[a+300>>2],t=0;;){if(v[s+(t<<2)>>2]<0)break e;if((0|n)==(0|(t=t+1|0)))break}break r}}t=v[e+52>>2];break i}for(t=v[e+52>>2],d=v[a+312>>2],p=v[a+308>>2],h=0;;){if(s=v[(f=h<<2)+d>>2]){if((0|s)<0|(0|t)<(0|s))break e;if((0|(f=v[f+p>>2]))<0|(0|t)<=(0|f))break e;if((s=s+f|0)>>>31|(0|t)<(0|s))break e}if((0|n)==(0|(h=h+1|0)))break}}if(s=v[e+40>>2],(n=0)<(0|(h=v[e+8>>2])))for(f=v[a+344>>2],d=v[a+156>>2];;){if((p=v[(p=n<<2)+f>>2]+(v[d+p>>2]<<1)|0)>>>31|(0|s)<(0|p))break e;if((0|h)==(0|(n=n+1|0)))break}if((n=0)<(0|(h=v[l>>2]))){for(f=v[a+376>>2];;){if(1<x[f+(n<<2)>>2])break e;if((0|h)==(0|(n=n+1|0)))break}for(n=0,f=v[a+380>>2];;){if(1<x[f+(n<<2)>>2])break e;if((0|h)==(0|(n=n+1|0)))break}}if((n=0)<(0|(h=v[o>>2])))for(f=v[a+400>>2],d=v[a+252>>2];;){if((p=v[(p=n<<2)+f>>2]+(v[d+p>>2]<<1)|0)>>>31|(0|s)<(0|p))break e;if((0|h)==(0|(n=n+1|0)))break}if((n=0)<(0|(s=v[e+44>>2])))for(f=v[a+424>>2];;){if((0|(d=v[f+(n<<2)>>2]))<0|(0|t)<=(0|d))break e;if((0|s)==(0|(n=n+1|0)))break}if(1<=(0|(d=v[r>>2])))for(n=0,p=v[a+432>>2],c=v[a+428>>2];;){if(r=v[(f=n<<2)+p>>2]){if((0|r)<0|(0|s)<(0|r))break e;if((0|(f=v[c+f>>2]))<0|(0|s)<=(0|f))break e;if((r=r+f|0)>>>31|(0|s)<(0|r))break e}if((0|d)==(0|(n=n+1|0)))break}if(1<=(0|t))for(s=v[e+56>>2],n=0,d=v[a+420>>2],p=v[a+416>>2];;){if(r=v[(f=n<<2)+d>>2]){if((0|r)<0|(0|s)<(0|r))break e;if((0|(f=v[f+p>>2]))<0|(0|s)<=(0|f))break e;if((r=r+f|0)>>>31|(0|s)<(0|r))break e}if((0|(n=n+1|0))==(0|t))break}if((t=0)<(0|(n=v[u>>2])))for(s=v[a+564>>2];;){if((0|(u=v[s+(t<<2)>>2]))<-1|(0|h)<=(0|u))break e;if((0|n)==(0|(t=t+1|0)))break}if(t=v[e+76>>2],1<=(0|(u=v[e+72>>2])))for(n=0,h=v[a+572>>2],f=v[a+568>>2];;){if(s=v[(r=n<<2)+h>>2]){if((0|s)<0|(0|t)<(0|s))break e;if((0|(r=v[r+f>>2]))<0|(0|t)<=(0|r))break e;if((s=r+s|0)>>>31|(0|t)<(0|s))break e}if((0|u)==(0|(n=n+1|0)))break}if((n=0)<(0|t)){for(s=v[a+588>>2];;){if(1<x[s+(n<<2)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(r=v[a+592>>2],n=0;;){if(1<(f=v[(h=n<<2)+s>>2])>>>0)break e;if((0|(h=v[r+h>>2]))<0|(0|h)>=v[(f-1|0?o:e)>>2])break e;if((0|t)==(0|(n=n+1|0)))break}for(n=0,s=v[a+596>>2];;){if((0|(r=v[s+(n<<2)>>2]))<-1|(0|u)<=(0|r))break e;if((0|t)==(0|(n=n+1|0)))break}}i:{if(!(((t=0)|(h=v[e+80>>2]))<=0)){for(n=v[a+604>>2];;){if(63<Z(n+(t<<6)|0)>>>0)break e;if((0|h)==(0|(t=t+1|0)))break}if(!(((t=0)|(h=v[e+80>>2]))<=0)){for(n=v[e+48>>2],s=v[a+608>>2];;){if((0|(u=v[s+(t<<2)>>2]))<0|(0|n)<=(0|u))break e;if((0|h)==(0|(t=t+1|0)))break}for(d=v[e+88>>2],u=v[a+616>>2],r=v[a+612>>2],t=0;;){if(n=v[(s=t<<2)+u>>2]){if((0|n)<0|(0|d)<(0|n))break e;if((0|(s=v[r+s>>2]))<0|(0|d)<=(0|s))break e;if((n=n+s|0)>>>31|(0|d)<(0|n))break e}if((0|h)==(0|(t=t+1|0)))break}for(o=v[o>>2],u=v[a+620>>2],t=0;;){if((0|(n=v[u+(t<<2)>>2]))<0|(0|o)<=(0|n))break e;if((0|h)==(0|(t=t+1|0)))break}for(r=v[a+624>>2],t=0;;){if((0|(n=v[r+(t<<2)>>2]))<0|(0|o)<=(0|n))break e;if((0|h)==(0|(t=t+1|0)))break}for(n=v[e+84>>2],f=v[a+632>>2],p=v[a+628>>2],t=0;;){if(s=v[(c=t<<2)+f>>2]){if((0|s)<0|(0|n)<(0|s))break e;if((0|(c=v[c+p>>2]))<0|(0|n)<=(0|c))break e;if((s=s+c|0)>>>31|(0|n)<(0|s))break e}if((0|h)==(0|(t=t+1|0)))break}for(g=v[a+640>>2],n=v[a+252>>2],s=0;;){if(0<(0|(A=v[(t=s<<2)+f>>2])))for(c=g+(v[t+p>>2]<<1)|0,I=v[n+(v[t+r>>2]<<2)>>2],w=v[n+(v[t+u>>2]<<2)>>2],t=0;;){if((0|I)<=b[c+(2|(P=t<<1))>>1]|(0|w)<=b[c+P>>1])break e;if(!((0|(t=t+2|0))<(0|A)))break}if((0|h)==(0|(s=s+1|0)))break}break i}}o=v[e+16>>2],d=v[e+88>>2]}if(!((255&T)>>>0<2)){if((t=0)<(0|(f=v[e+8>>2])))for(n=v[a+168>>2];;){if(1<x[n+(t<<2)>>2])break e;if((0|f)==(0|(t=t+1|0)))break}if(!((255&T)>>>0<4)){if(u=v[e+56>>2],1<=(0|(p=v[e+20>>2])))for(r=v[a+332>>2],c=v[a+328>>2],t=0;;){if(n=v[(s=t<<2)+r>>2]){if((0|n)<0|(0|u)<(0|n))break e;if((0|(s=v[s+c>>2]))<0|(0|u)<=(0|s))break e;if((n=n+s|0)>>>31|(0|u)<(0|n))break e}if((0|p)==(0|(t=t+1|0)))break}if((0|(t=v[e+92>>2]))!=v[e+96>>2])break e;if(1<=(0|f))for(c=v[a+152>>2],n=0,g=v[a+148>>2];;){if(s=v[(r=n<<2)+g>>2]){if((0|s)<0|(0|t)<(0|s))break e;if((0|(r=v[r+c>>2]))<0|(0|t)<=(0|r))break e;if((s=r+s|0)>>>31|(0|t)<(0|s))break e}if((0|f)==(0|(n=n+1|0)))break}if(1<=(0|(I=v[e+12>>2])))for(c=v[a+184>>2],n=0,g=v[a+180>>2];;){if(s=v[(r=n<<2)+g>>2]){if((0|s)<0|(0|t)<(0|s))break e;if((0|(r=v[r+c>>2]))<0|(0|t)<=(0|r))break e;if((s=r+s|0)>>>31|(0|t)<(0|s))break e}if((0|I)==(0|(n=n+1|0)))break}if(1<=(0|o))for(c=v[a+224>>2],n=0,g=v[a+220>>2];;){if(s=v[(r=n<<2)+g>>2]){if((0|s)<0|(0|t)<(0|s))break e;if((0|(r=v[r+c>>2]))<0|(0|t)<=(0|r))break e;if((s=r+s|0)>>>31|(0|t)<(0|s))break e}if((0|o)==(0|(n=n+1|0)))break}if((n=0)<(0|p)){for(s=v[a+304>>2];;){if(1<x[s+(n<<2)>>2])break e;if((0|p)==(0|(n=n+1|0)))break}for(s=v[e+100>>2],g=v[a+320>>2],A=v[a+316>>2],n=0;;){if(r=v[(c=n<<2)+g>>2]){if((0|r)<0|(0|s)<(0|r))break e;if((0|(c=v[c+A>>2]))<0|(0|s)<=(0|c))break e;if((r=r+c|0)>>>31|(0|s)<(0|r))break e}if((0|p)==(0|(n=n+1|0)))break}}else s=v[e+100>>2];if(1<=(0|s)){for(c=v[a+440>>2],n=0,A=v[a+436>>2];;){if(r=v[(g=n<<2)+c>>2]){if((0|r)<0|(0|u)<(0|r))break e;if((0|(g=v[g+A>>2]))<0|(0|u)<=(0|g))break e;if((r=r+g|0)>>>31|(0|u)<(0|r))break e}if((0|s)==(0|(n=n+1|0)))break}for(u=v[a+444>>2],n=0;;){if((0|(g=v[(r=n<<2)+u>>2]))<0|(0|g)>=v[r+c>>2])break e;if((0|s)==(0|(n=n+1|0)))break}}if((u=0)<(0|(n=v[e+104>>2]))){for(r=v[a+448>>2];;){if((0|(c=v[r+(u<<2)>>2]))<0|(0|s)<=(0|c))break e;if((0|n)==(0|(u=u+1|0)))break}for(r=v[e+116>>2],g=v[a+464>>2],A=v[a+460>>2],s=0;;){if(u=v[(c=s<<2)+g>>2]){if((0|u)<0|(0|r)<(0|u))break e;if((0|(c=v[c+A>>2]))<0|(0|r)<=(0|c))break e;if((u=u+c|0)>>>31|(0|r)<(0|u))break e}if((0|n)==(0|(s=s+1|0)))break}}else r=v[e+116>>2];if((s=0)<(0|(c=v[e+108>>2]))){for(u=v[a+480>>2];;){if((0|(g=v[u+(s<<2)>>2]))<0|(0|f)<=(0|g))break e;if((0|c)==(0|(s=s+1|0)))break}for(g=v[a+488>>2],w=v[a+484>>2],s=0;;){if(u=v[(f=s<<2)+g>>2]){if((0|u)<0|(0|n)<(0|u))break e;if((0|(f=v[f+w>>2]))<0|(0|n)<=(0|f))break e;if((u=u+f|0)>>>31|(0|n)<(0|u))break e}if((0|c)==(0|(s=s+1|0)))break}for(g=v[S>>2],s=v[a+456>>2],f=v[a+452>>2],u=0;;){if(P=v[w+(u<<2)>>2]<<2,A=v[P+s>>2]){if((0|A)<0|(0|g)<(0|A))break e;if((0|(P=v[f+P>>2]))<0|(0|g)<=(0|P))break e;if((0|(A=A+P|0))<0|(0|g)<(0|A))break e}if((0|c)==(0|(u=u+1|0)))break}}else s=v[a+456>>2],f=v[a+452>>2];if((u=0)<(0|(c=v[e+112>>2]))){for(g=v[a+504>>2];;){if((0|(A=v[g+(u<<2)>>2]))<0|(0|o)<=(0|A))break e;if((0|c)==(0|(u=u+1|0)))break}for(w=v[a+512>>2],A=v[a+508>>2],o=0;;){if(u=v[(g=o<<2)+w>>2]){if((0|u)<0|(0|n)<(0|u))break e;if((0|(g=v[g+A>>2]))<0|(0|n)<=(0|g))break e;if((u=u+g|0)>>>31|(0|n)<(0|u))break e}if((0|c)==(0|(o=o+1|0)))break}for(u=v[M>>2],o=0;;){if(w=v[A+(o<<2)>>2]<<2,g=v[w+s>>2]){if((0|g)<0|(0|u)<(0|g))break e;if((0|(w=v[f+w>>2]))<0|(0|u)<=(0|w))break e;if((0|(g=g+w|0))<0|(0|u)<(0|g))break e}if((0|c)==(0|(o=o+1|0)))break}}if(u=v[e+120>>2],(o=0)<(0|r))for(c=v[a+528>>2];;){if((0|(g=v[c+(o<<2)>>2]))<0|(0|u)<=(0|g))break e;if((0|(o=o+1|0))==(0|r))break}if((o=0)<(0|u)){for(r=v[a+532>>2];;){if((0|(c=v[r+(o<<2)>>2]))<-1|(0|p)<=(0|c))break e;if((0|u)==(0|(o=o+1|0)))break}for(r=v[e+124>>2],g=v[a+540>>2],A=v[a+536>>2],o=0;;){if(p=v[(c=o<<2)+g>>2]){if((0|p)<0|(0|r)<(0|p))break e;if((0|(c=v[c+A>>2]))<0|(0|r)<=(0|c))break e;if((p=c+p|0)>>>31|(0|r)<(0|p))break e}if((0|u)==(0|(o=o+1|0)))break}}if(!((255&T)>>>0<5)){if((o=0)<(0|(T=v[S>>2]))){for(u=v[a+348>>2];;){if((0|(r=v[u+(o<<2)>>2]))<0|(0|t)<(0|r))break e;if((0|T)==(0|(o=o+1|0)))break}for(u=v[a+352>>2],o=0;;){if((0|(r=v[u+(o<<2)>>2]))<0|(0|t)<(0|r))break e;if((0|T)==(0|(o=o+1|0)))break}}if((T=0)<(0|(o=v[l>>2]))){for(u=v[a+384>>2];;){if((0|(r=v[u+(T<<2)>>2]))<0|(0|t)<(0|r))break e;if((0|o)==(0|(T=T+1|0)))break}for(u=v[a+388>>2],T=0;;){if((0|(r=v[u+(T<<2)>>2]))<0|(0|t)<(0|r))break e;if((0|o)==(0|(T=T+1|0)))break}}if((T=0)<(0|(u=v[M>>2]))){for(r=v[a+404>>2];;){if((0|(p=v[r+(T<<2)>>2]))<0|(0|t)<(0|p))break e;if((0|u)==(0|(T=T+1|0)))break}for(r=v[a+408>>2],T=0;;){if((0|(p=v[r+(T<<2)>>2]))<0|(0|t)<(0|p))break e;if((0|u)==(0|(T=T+1|0)))break}}if((t=0)<(0|(T=v[e+128>>2]))){for(u=v[e>>2],r=v[a+468>>2];;){if((0|(p=v[r+(t<<2)>>2]))<0|(0|u)<=(0|p))break e;if((0|T)==(0|(t=t+1|0)))break}for(S=v[a+476>>2],p=v[a+472>>2],t=0;;){if(u=v[(r=t<<2)+S>>2]){if((0|u)<0|(0|n)<(0|u))break e;if((0|(r=v[r+p>>2]))<0|(0|n)<=(0|r))break e;if((u=r+u|0)>>>31|(0|n)<(0|u))break e}if((0|T)==(0|(t=t+1|0)))break}for(u=v[_>>2],t=0;;){if(_=v[p+(t<<2)>>2]<<2,r=v[_+s>>2]){if((0|r)<0|(0|u)<(0|r))break e;if((0|(_=v[f+_>>2]))<0|(0|u)<=(0|_))break e;if((0|(r=r+_|0))<0|(0|u)<(0|r))break e}if((0|T)==(0|(t=t+1|0)))break}}if((t=0)<(0|(T=v[e+132>>2]))){for(u=v[a+492>>2];;){if((0|(r=v[u+(t<<2)>>2]))<0|(0|I)<=(0|r))break e;if((0|T)==(0|(t=t+1|0)))break}for(_=v[a+500>>2],r=v[a+496>>2],t=0;;){if(u=v[(p=t<<2)+_>>2]){if((0|u)<0|(0|n)<(0|u))break e;if((0|(p=v[r+p>>2]))<0|(0|n)<=(0|p))break e;if((u=u+p|0)>>>31|(0|n)<(0|u))break e}if((0|T)==(0|(t=t+1|0)))break}for(t=0;;){if(p=v[r+(t<<2)>>2]<<2,u=v[p+s>>2]){if((0|u)<0|(0|o)<(0|u))break e;if((0|(p=v[f+p>>2]))<0|(0|o)<=(0|p))break e;if((0|(u=u+p|0))<0|(0|o)<(0|u))break e}if((0|T)==(0|(t=t+1|0)))break}}if(!(((t=0)|(e=v[e+136>>2]))<=0)){for(o=v[a+516>>2];;){if((0|(T=v[o+(t<<2)>>2]))<0|(0|h)<=(0|T))break e;if((0|e)==(0|(t=t+1|0)))break}for(u=v[a+524>>2],o=v[a+520>>2],t=0;;){if(a=v[(T=t<<2)+u>>2]){if((0|a)<0|(0|n)<(0|a))break e;if((0|(T=v[o+T>>2]))<0|(0|n)<=(0|T))break e;if((a=a+T|0)>>>31|(0|n)<(0|a))break e}if((0|e)==(0|(t=t+1|0)))break}for(t=0;;){if(a=v[o+(t<<2)>>2]<<2,n=v[a+s>>2]){if((0|n)<0|(0|d)<(0|n))break e;if((0|(a=v[a+f>>2]))<0|(0|d)<=(0|a))break e;if((0|(n=n+a|0))<0|(0|d)<(0|n))break e}if((0|e)==(0|(t=t+1|0)))break}}}}}return D=i,1}return B(4,1846,0),D=i,0}v[a+52>>2]=n,v[a+48>>2]=5,B(4,1640,a+48|0)}else v[a+32>>2]=n,B(4,1554,a+32|0);return D=i,0}(t,e):(v[20+i>>2]=1621,v[16+i>>2]=2284,B(4,1294,16+i|0),0):(v[4+i>>2]=1444,v[i>>2]=2284,B(4,1294,i),0),D=48+i|0,0|t},i:function(t){v[1805]=t|=0},j:function(t,e){var i;return e|=0,D=i=D-48|0,t=(t|=0)?(t+63&-64)!=(0|t)?(v[36+i>>2]=1522,v[32+i>>2]=2305,B(4,1294,32+i|0),0):(e+63&-64)==(0|e)&&e?function(t){var e,i,r,n,s=0,o=0,a=0,h=0,u=0,l=0,c=0,f=0;v[24+(D=e=D-32|0)>>2]=0,v[16+e>>2]=5,v[20+e>>2]=0,At(16+(D=n=D-272|0)|0,2227,v[12+n>>2]=16+e|0),function(t){var e;v[(D=e=D-16|0)>>2]=t,function(t,e){var i;v[12+(D=i=D-16|0)>>2]=e,Tt(t,1432,e,0,0),D=16+i|0}(v[970],e),D=16+e|0}(16+n|0),D=272+n|0;t:{if(ot(t))B(4,1932,0);else{if(!(6<=(a=y[t+4|0])>>>0)){if(1!=(0|!y[t+5|0])?(j(t+4|0,1),k(t- -64|0,4,160),et(t,t+704|(m[t+5|0]=0)),ft(t)):et(t,t+704|0),y[7224]||(v[1807]=6,m[7224]=1,v[1808]=7,v[1809]=8,v[1810]=9),o=v[t+704>>2],1<=(0|(a=v[o+16>>2]))){for(f=(h=v[t+912>>2])+(a<<2)|0,u=v[t+908>>2];;){c=v[t+1204>>2]+(v[u>>2]<<2)|0;e:if(!(((o=0)|(s=(a=v[h>>2])+-1|0))<1))i:for(;;){for(;;){if(v[(l=c+(o<<2)|0)>>2]<=-1){if(function(t,e,i){var r=0,n=0;r:if((0|t)!=(0|e)){if(!(t>>>0<e+i>>>0&&e>>>0<(n=t+i|0)>>>0))return G(t,e,i);if(r=3&(t^e),t>>>0<e>>>0){if(!r){if(3&t)for(;;){if(!i)break r;if(m[0|t]=y[0|e],e=e+1|0,i=i+-1|0,!(3&(t=t+1|0)))break}if(!(i>>>0<=3)){for(r=i;v[t>>2]=v[e>>2],e=e+4|0,t=t+4|0,3<(r=r+-4|0)>>>0;);i&=3}}if(i)for(;m[0|t]=y[0|e],t=t+1|0,e=e+1|0,i=i+-1|0;);}else{if(!r){if(3&n)for(;;){if(!i)break r;if(m[0|(r=(i=i+-1|0)+t|0)]=y[e+i|0],!(3&r))break}if(!(i>>>0<=3))for(;v[(i=i+-4|0)+t>>2]=v[e+i>>2],3<i>>>0;);}if(i)for(;m[(i=i+-1|0)+t|0]=y[e+i|0],i;);}}}(l,l+4|0,(-1^o)+a<<2),(0|o)<(0|(s=(a=s)+-1|0)))continue i;break e}if(!((0|(o=o+1|0))<(0|s)))break}break}if(o=h,0<(0|a)&&(a=v[c+(s<<2)>>2]<0?s:a),v[o>>2]=a,u=u+4|0,!((h=h+4|0)>>>0<f>>>0))break}o=v[t+704>>2]}if(1<=v[o>>2])for(s=0;v[v[t+712>>2]+(s<<2)>>2]=v[t+716>>2]+(s<<6),o=v[t+704>>2],(0|(s=s+1|0))<v[o>>2];);if(1<=v[o+4>>2])for(s=0;v[v[t+744>>2]+(s<<2)>>2]=v[t+748>>2]+(s<<6),o=v[t+704>>2],(0|(s=s+1|0))<v[o+4>>2];);if(1<=v[o+16>>2])for(s=0;v[(a=s<<2)+v[t+832>>2]>>2]=v[t+848>>2]+(s<<6),v[a+v[t+836>>2]>>2]=v[t+1196>>2]+(v[a+v[t+896>>2]>>2]<<2),v[a+v[t+840>>2]>>2]=v[t+1200>>2]+(v[a+v[t+900>>2]>>2]<<1),v[a+v[t+844>>2]>>2]=v[t+1204>>2]+(v[a+v[t+908>>2]>>2]<<2),o=v[t+704>>2],(0|(s=s+1|0))<v[o+16>>2];);if(1<=v[o+20>>2])for(s=0;v[v[t+916>>2]+(s<<2)>>2]=v[t+920>>2]+(s<<6),o=v[t+704>>2],(0|(s=s+1|0))<v[o+20>>2];);if(1<=v[o+80>>2])for(s=0;v[v[t+1240>>2]+(s<<2)>>2]=v[t+1244>>2]+(s<<6),o=v[t+704>>2],(0|(s=s+1|0))<v[o+80>>2];);if(1&m[v[t+708>>2]+20|0])break t;if((0|(h=v[o+16>>2]))<1)break t;for(s=v[t+904>>2],c=v[t+900>>2],l=v[t+1200>>2],u=0;;){if(0<(0|(f=v[(a=u<<2)+s>>2]+-1|0)))for(i=l+(v[a+c>>2]<<1)|0,o=0;r=b[(a=i+(o<<1)|0)>>1],g[a>>1]=b[a+4>>1],g[a+4>>1]=r,(0|(o=o+3|0))<(0|f););if((0|h)==(0|(u=u+1|0)))break}for(a=v[t+892>>2],u=v[t+896>>2],c=v[t+1196>>2],s=0;;){if(1<=(0|(l=v[(o=s<<2)+a>>2])))for(l=(o=c+(v[o+u>>2]<<2)|0)+(l<<3)|0,o=o+4|0;T[o>>2]=w(1)-T[o>>2],(o=o+8|0)>>>0<l>>>0;);if((0|h)==(0|(s=s+1|0)))break}break t}v[4+e>>2]=a,v[e>>2]=5,B(4,2023,e)}t=0}return D=32+e|0,t}(t):(v[20+i>>2]=1621,v[16+i>>2]=2305,B(4,1294,16+i|0),0):(v[4+i>>2]=1444,v[i>>2]=2305,B(4,1294,i),0),D=48+i|0,0|t},k:function(t,e,i,r){var n;e|=0,i|=0,r|=0,D=n=D+-64|0,(t|=0)?e?i?r?(t=v[v[t>>2]+708>>2],v[e>>2]=v[t+12>>2],v[e+4>>2]=v[t+16>>2],v[i>>2]=v[t+4>>2],v[i+4>>2]=v[t+8>>2],v[r>>2]=v[t>>2]):(v[52+n>>2]=1995,v[48+n>>2]=2325,B(4,1294,48+n|0)):(v[36+n>>2]=1903,v[32+n>>2]=2325,B(4,1294,32+n|0)):(v[20+n>>2]=1819,v[16+n>>2]=2325,B(4,1294,16+n|0)):(v[4+n>>2]=1740,v[n>>2]=2325,B(4,1294,n)),D=64+n|0},l:ct,m:lt,n:function(t){var e;D=e=D-16|0,(t|=0)?ht(t):(v[4+e>>2]=1740,v[e>>2]=2387,B(4,1294,e)),D=16+e|0},o:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+540>>2]:(v[4+e>>2]=1740,v[e>>2]=2402,B(4,1294,e),-1),D=16+e|0,0|t},p:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+916>>2]:(v[4+e>>2]=1740,v[e>>2]=2423,B(4,1294,e),0),D=16+e|0,0|t},q:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+548>>2]:(v[4+e>>2]=1740,v[e>>2]=2442,B(4,1294,e),0),D=16+e|0,0|t},r:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+928>>2]:(v[4+e>>2]=1740,v[e>>2]=2463,B(4,1294,e),0),D=16+e|0,0|t},s:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+924>>2]:(v[4+e>>2]=1740,v[e>>2]=2492,B(4,1294,e),0),D=16+e|0,0|t},t:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+932>>2]:(v[4+e>>2]=1740,v[e>>2]=2521,B(4,1294,e),0),D=16+e|0,0|t},u:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+552>>2]:(v[4+e>>2]=1740,v[e>>2]=2550,B(4,1294,e),0),D=16+e|0,0|t},v:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+4>>2]:(v[4+e>>2]=1740,v[e>>2]=2572,B(4,1294,e),-1),D=16+e|0,0|t},w:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+712>>2]:(v[4+e>>2]=1740,v[e>>2]=2588,B(4,1294,e),0),D=16+e|0,0|t},x:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+52>>2]:(v[4+e>>2]=1740,v[e>>2]=2602,B(4,1294,e),0),D=16+e|0,0|t},y:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+740>>2]:(v[4+e>>2]=1740,v[e>>2]=2622,B(4,1294,e),0),D=16+e|0,0|t},z:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+332>>2]:(v[4+e>>2]=1740,v[e>>2]=2650,B(4,1294,e),-1),D=16+e|0,0|t},A:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+832>>2]:(v[4+e>>2]=1740,v[e>>2]=2670,B(4,1294,e),0),D=16+e|0,0|t},B:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+888>>2]:(v[4+e>>2]=1740,v[e>>2]=2688,B(4,1294,e),0),D=16+e|0,0|t},C:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+432>>2]:(v[4+e>>2]=1740,v[e>>2]=2716,B(4,1294,e),0),D=16+e|0,0|t},D:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+884>>2]:(v[4+e>>2]=1740,v[e>>2]=2743,B(4,1294,e),0),D=16+e|0,0|t},E:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+440>>2]:(v[4+e>>2]=1740,v[e>>2]=2772,B(4,1294,e),0),D=16+e|0,0|t},F:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+436>>2]:(v[4+e>>2]=1740,v[e>>2]=2797,B(4,1294,e),0),D=16+e|0,0|t},G:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+448>>2]:(v[4+e>>2]=1740,v[e>>2]=2824,B(4,1294,e),0),D=16+e|0,0|t},H:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+912>>2]:(v[4+e>>2]=1740,v[e>>2]=2848,B(4,1294,e),0),D=16+e|0,0|t},I:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+844>>2]:(v[4+e>>2]=1740,v[e>>2]=2873,B(4,1294,e),0),D=16+e|0,0|t},J:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+892>>2]:(v[4+e>>2]=1740,v[e>>2]=2893,B(4,1294,e),0),D=16+e|0,0|t},K:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+444>>2]:(v[4+e>>2]=1740,v[e>>2]=2920,B(4,1294,e),0),D=16+e|0,0|t},L:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+836>>2]:(v[4+e>>2]=1740,v[e>>2]=2950,B(4,1294,e),0),D=16+e|0,0|t},M:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+904>>2]:(v[4+e>>2]=1740,v[e>>2]=2974,B(4,1294,e),0),D=16+e|0,0|t},N:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+840>>2]:(v[4+e>>2]=1740,v[e>>2]=3e3,B(4,1294,e),0),D=16+e|0,0|t},O:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+452>>2]:(v[4+e>>2]=1740,v[e>>2]=3022,B(4,1294,e),0),D=16+e|0,0|t},P:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+456>>2]:(v[4+e>>2]=1740,v[e>>2]=3051,B(4,1294,e),0),D=16+e|0,0|t},Q:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[v[t>>2]+876>>2]:(v[4+e>>2]=1740,v[e>>2]=3078,B(4,1294,e),0),D=16+e|0,0|t},R:function(t){var e;D=e=D-16|0,(t|=0)?v[t+428>>2]=1:(v[4+e>>2]=1740,v[e>>2]=3110,B(4,1294,e)),D=16+e|0},S:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+640>>2]:(v[4+e>>2]=1740,v[e>>2]=3139,B(4,1294,e),0),D=16+e|0,0|t},T:function(t){var e;return D=e=D-16|0,t=(t|=0)?v[t+636>>2]:(v[4+e>>2]=1740,v[e>>2]=3164,B(4,1294,e),0),D=16+e|0,0|t},U:function(t){var e;return it(12+(D=e=D-16|0)|0,64,t|=0),D=16+e|0,v[12+e>>2]},V:function(t){var e,i,r=0;return D=i=D-16|0,!(t|=0)||it(12+i|0,16,e=ct(t))||(r=lt(t,v[12+i>>2],e))||(rt(v[12+i>>2]),r=0),D=16+i|0,0|r},W:function(t){return 0|nt(t|=0)},X:function(t){rt(t|=0)},Y:function(t){var e;it(12+(D=e=D-16|0)|0,64,t|=0),rt(v[12+e>>2]),D=16+e|0},Z:function(){return 0|D},_:function(t){return 0|(D=D-(0|t)&-16)},$:function(t){D=0|t},aa:function(t){return 0|(t=0|(t|=0),(i=0|Ot())<(t=i+(t|=0)|0)&&t<65536&&(t=new ArrayBuffer(E(t,65536)),(e=new f.Int8Array(t)).set(m),m=e,m=new f.Int8Array(t),g=new f.Int16Array(t),v=new f.Int32Array(t),y=new f.Uint8Array(t),b=new f.Uint16Array(t),x=new f.Uint32Array(t),T=new f.Float32Array(t),A=new f.Float64Array(t),d=t,p.buffer=t),i);var e,i},ba:function(t,e){_[t|=0](e|=0)}};function k(t,e,i){var r,n,s=0;if(i)for(;;){if(i=i+-1|0,t>>>0<(s=(r=t+e|0)-1|0)>>>0)for(;n=y[0|t],m[0|t]=y[0|s],m[0|s]=n,(t=t+1|0)>>>0<(s=s+-1|0)>>>0;);if(t=r,!i)break}}function B(t,e,i){var r;D=r=D-272|0,x[1804]>t>>>0||(t=v[1805])&&(At(16+r|0,e,v[12+r>>2]=i),_[t](16+r|0)),D=272+r|0}function N(t,e,i){32&y[0|t]||function(t,e,i){var r=0,n=0,s=0;t:{if(!(r=v[i+16>>2])){if(function(t){var e;return e=y[t+74|0],m[t+74|0]=e+-1|e,8&(e=v[t>>2])?(v[t>>2]=32|e,1):(v[t+4>>2]=0,v[t+8>>2]=0,e=v[t+44>>2],v[t+28>>2]=e,v[t+20>>2]=e,v[t+16>>2]=e+v[t+48>>2],0)}(i))break t;r=v[i+16>>2]}if(r-(s=v[i+20>>2])>>>0<e>>>0)return _[v[i+36>>2]](i,t,e);e:if(!(m[i+75|0]<0)){for(r=e;;){if(!(n=r))break e;if(10==y[(r=n+-1|0)+t|0])break}if(_[v[i+36>>2]](i,t,n)>>>0<n>>>0)break t;e=e-n|0,t=t+n|0,s=v[i+20>>2]}G(s,t,e),v[i+20>>2]=v[i+20>>2]+e}}(e,i,t)}function U(t,e,i,r,n){var s,o,a;if(D=a=D-256|0,!(73728&n|(0|i)<=(0|r))){if(H(a,e,(s=(n=i-r|0)>>>0<256)?n:256),e=t,o=a,!s){for(i=i-r|0;N(t,a,256),255<(n=n+-256|0)>>>0;);n=255&i}N(e,o,n)}D=256+a|0}function G(t,e,i){var r,n=0;if(8192<=i>>>0)R(0|t,0|e,0|i);else{if(r=t+i|0,3&(t^e))if(r>>>0<4)i=t;else if((n=r-4|0)>>>0<t>>>0)i=t;else for(i=t;m[0|i]=y[0|e],m[i+1|0]=y[e+1|0],m[i+2|0]=y[e+2|0],m[i+3|0]=y[e+3|0],e=e+4|0,(i=i+4|0)>>>0<=n>>>0;);else{t:if((0|i)<1)i=t;else if(3&t)for(i=t;;){if(m[0|i]=y[0|e],e=e+1|0,r>>>0<=(i=i+1|0)>>>0)break t;if(!(3&i))break}else i=t;if(!((t=-4&r)>>>0<64||(n=t+-64|0)>>>0<i>>>0))for(;v[i>>2]=v[e>>2],v[i+4>>2]=v[e+4>>2],v[i+8>>2]=v[e+8>>2],v[i+12>>2]=v[e+12>>2],v[i+16>>2]=v[e+16>>2],v[i+20>>2]=v[e+20>>2],v[i+24>>2]=v[e+24>>2],v[i+28>>2]=v[e+28>>2],v[i+32>>2]=v[e+32>>2],v[i+36>>2]=v[e+36>>2],v[i+40>>2]=v[e+40>>2],v[i+44>>2]=v[e+44>>2],v[i+48>>2]=v[e+48>>2],v[i+52>>2]=v[e+52>>2],v[i+56>>2]=v[e+56>>2],v[i+60>>2]=v[e+60>>2],e=e- -64|0,(i=i- -64|0)>>>0<=n>>>0;);if(!(t>>>0<=i>>>0))for(;v[i>>2]=v[e>>2],e=e+4|0,(i=i+4|0)>>>0<t>>>0;);}if(i>>>0<r>>>0)for(;m[0|i]=y[0|e],e=e+1|0,(0|r)!=(0|(i=i+1|0)););}}function X(t){var e,i;return w((e=t*t)*e*(i=e*t)*(2718311493989822e-21*e-.00019839334836096632)+(i*(.008333329385889463*e-.16666666641626524)+t))}function V(t){var e;return w(-.499999997251031*(t*=t)+1+.04166662332373906*(e=t*t)+t*e*(2439044879627741e-20*t-.001388676377460993))}function H(t,e,i){var r,n,s,o;if(i&&(m[(r=t+i|0)-1|0]=e,m[0|t]=e,!(i>>>0<3||(m[r-2|0]=e,m[t+1|0]=e,m[r-3|0]=e,m[t+2|0]=e,i>>>0<7)||(m[r-4|0]=e,m[t+3|0]=e,i>>>0<9)||(n=(r=0-t&3)+t|0,e=E(255&e,16843009),v[n>>2]=e,v[(r=(i=i-r&-4)+n|0)-4>>2]=e,i>>>0<9)||(v[8+n>>2]=e,v[4+n>>2]=e,v[r-8>>2]=e,v[r-12>>2]=e,i>>>0<25)||(v[24+n>>2]=e,v[20+n>>2]=e,v[16+n>>2]=e,v[12+n>>2]=e,v[r-16>>2]=e,v[r-20>>2]=e,v[r-24>>2]=e,v[r-28>>2]=e,(i=i-(o=4&n|24)|0)>>>0<32))))for(s=r=e,e=n+o|0;v[e+24>>2]=s,v[e+28>>2]=r,v[e+16>>2]=s,v[e+20>>2]=r,v[e+8>>2]=s,v[e+12>>2]=r,v[e>>2]=s,v[e+4>>2]=r,e=e+32|0,31<(i=i+-32|0)>>>0;);return t}function j(t,e){var i;if(t>>>0<(e=(t+e|0)-1|0)>>>0)for(;i=y[0|t],m[0|t]=y[0|e],m[0|e]=i,(t=t+1|0)>>>0<(e=e+-1|0)>>>0;);}function Y(t){var e,i=Ot();return(t=(e=v[2216])+t|0)>>>0<=i<<16>>>0||O(0|t)?(v[2216]=t,e):(v[2086]=48,-1)}function z(t,e,i,r,n,s,o){var a,h,u,l,c,f,d,p,_,m,g=0,y=w(0),b=w(0),x=w(0);if(w(0),w(0),w(0),w(0),D=m=D-16|0,1<=(0|t))for(f=E(t,12)+e|0;;){if(1<=(0|(h=v[e+4>>2])))for(d=(t=v[e+8>>2])+E(h,48)|0,h=(a=v[e>>2]<<4)+o|0,u=(8|a)+o|0,a=(4|a)+o|0;(g=v[t+8>>2])&&((p=g+-1|0)>>>0<=1?(_=(v[t+4>>2]<<2)+i|0,g=v[_+(v[t+12>>2]<<2)>>2]<<2,y=T[g+s>>2],c=T[n+g>>2],b=T[r+g>>2],p-1?(x=b,b=T[t+20>>2],T[h>>2]=T[h>>2]+w(T[t+44>>2]*w(x*b)),T[a>>2]=T[a>>2]+w(w(c*b)*T[t+44>>2]),T[u>>2]=T[u>>2]+w(w(y*b)*T[t+44>>2])):(g=v[(v[t+16>>2]<<2)+_>>2]<<2,p=T[g+s>>2],_=T[n+g>>2],x=b,b=T[t+20>>2],l=T[t+24>>2],T[h>>2]=T[h>>2]+w(T[t+44>>2]*w(w(x*b)+w(T[r+g>>2]*l))),T[a>>2]=T[a>>2]+w(w(w(c*b)+w(_*l))*T[t+44>>2]),T[u>>2]=T[u>>2]+w(w(w(y*b)+w(p*l))*T[t+44>>2]))):(v[m>>2]=g,B(4,1024,m))),(t=t+48|0)>>>0<d>>>0;);if(t=(v[e>>2]<<4)+o|0,y=T[t>>2],T[t>>2]=y<w(0)?w(0):w(M(y,w(1))),y=T[t+4>>2],T[t+4>>2]=y<w(0)?w(0):w(M(y,w(1))),y=T[t+8>>2],T[t+8>>2]=y<w(0)?w(0):w(M(y,w(1))),!((e=e+12|0)>>>0<f>>>0))break}D=16+m|0}function W(t,e,i){var r,n,s=0;if(1==(0|e)&t>>>0<0|e>>>0<1)s=t;else for(;r=It(s=Ct(t,e,10),n=L,10),m[0|(i=i+-1|0)]=t-r|48,r=9==(0|e)&4294967295<t>>>0|9<e>>>0,t=s,e=n,r;);if(s)for(;m[0|(i=i+-1|0)]=s-E(t=(s>>>0)/10|0,10)|48,e=9<s>>>0,s=t,e;);return i}function q(t){return t+-48>>>0<10}function Z(t){var e;return(e=Et(t,64))?e-t|0:64}function Q(t,e){var i=0;return 1024<=(0|e)?(t*=898846567431158e293,e=(0|(i=e+-1023|0))<1024?i:(t*=898846567431158e293,((0|e)<3069?e:3069)+-2046|0)):-1023<(0|e)||(t*=22250738585072014e-324,e=-1023<(0|(i=e+1022|0))?i:(t*=22250738585072014e-324,(-3066<(0|e)?e:-3066)+2044|0)),a(0,0),a(1,e+1023<<20),t*+h()}function J(t,e){var i=0,r=t,n=e>>>0<=31?(i=v[t+4>>2],v[t>>2]):(i=v[t>>2],v[t+4>>2]=i,e=e+-32|(v[t>>2]=0),0);v[r>>2]=n<<e,v[t+4>>2]=i<<e|n>>>32-e}function K(t,e,i,r,n){var s,o=0,a=0,h=0;D=s=D-240|0,o=v[e>>2],v[232+s>>2]=o,e=v[e+4>>2],v[s>>2]=t,a=1;t:{e:{i:{if(((v[236+s>>2]=e)||1!=(0|o))&&(o=t-v[(i<<2)+n>>2]|0,!((0|_[5](o,t))<1))){for(h=!r;;){r:{if(e=o,!(!h|(0|i)<2)){if(r=v[((i<<2)+n|0)-8>>2],-1<(0|_[5](o=t+-4|0,e)))break r;if(-1<(0|_[5](o-r|0,e)))break r}if(v[(a<<2)+s>>2]=e,a=a+1|0,tt(232+s|0,t=Pt(232+s|0)),i=t+i|0,!v[236+s>>2]&&1==v[232+s>>2])break e;if(h=1,o=(t=e)-v[(i<<2)+n>>2]|(r=0),0<(0|_[5](o,v[s>>2])))continue;break i}break}e=t;break e}e=t}if(r)break t}St(s,a),at(e,i,n)}D=240+s|0}function tt(t,e){var i=0,r=t,n=e>>>0<=31?(i=v[t>>2],v[t+4>>2]):(i=v[t+4>>2],v[t+4>>2]=0,v[t>>2]=i,e=e+-32|0,0);v[r+4>>2]=n>>>e,v[t>>2]=n<<32-e|i>>>e}function et(t,e){var i=y[t+4|0];v[e>>2]=v[t+64>>2]+t,v[e+4>>2]=v[t+68>>2]+t,v[e+8>>2]=v[t+72>>2]+t,v[e+12>>2]=v[t+76>>2]+t,v[e+16>>2]=v[t+80>>2]+t,v[e+20>>2]=v[t+84>>2]+t,v[e+24>>2]=v[t+88>>2]+t,v[e+28>>2]=v[t+92>>2]+t,v[e+32>>2]=v[t+96>>2]+t,v[e+36>>2]=v[t+100>>2]+t,v[e+40>>2]=v[t+104>>2]+t,v[e+44>>2]=v[t+108>>2]+t,v[e+48>>2]=v[t+112>>2]+t,v[e+52>>2]=v[t+116>>2]+t,v[e+56>>2]=v[t+120>>2]+t,v[e+60>>2]=v[t+124>>2]+t,v[e- -64>>2]=v[t+128>>2]+t,v[e+68>>2]=v[t+132>>2]+t,v[e+72>>2]=v[t+136>>2]+t,v[e+76>>2]=v[t+140>>2]+t,v[e+80>>2]=v[t+144>>2]+t,v[e+84>>2]=v[t+148>>2]+t,v[e+92>>2]=v[t+152>>2]+t,v[e+96>>2]=v[t+156>>2]+t,v[e+100>>2]=v[t+160>>2]+t,v[e+108>>2]=v[t+164>>2]+t,v[e+112>>2]=v[t+168>>2]+t,v[e+116>>2]=v[t+172>>2]+t,v[e+124>>2]=v[t+176>>2]+t,v[e+128>>2]=v[t+180>>2]+t,v[e+132>>2]=v[t+184>>2]+t,v[e+136>>2]=v[t+188>>2]+t,v[e+140>>2]=v[t+192>>2]+t,v[e+144>>2]=v[t+196>>2]+t,v[e+148>>2]=v[t+200>>2]+t,v[e+152>>2]=v[t+204>>2]+t,v[e+156>>2]=v[t+208>>2]+t,v[e+164>>2]=v[t+212>>2]+t,v[e+168>>2]=v[t+216>>2]+t,v[e+172>>2]=v[t+220>>2]+t,v[e+176>>2]=v[t+224>>2]+t,v[e+180>>2]=v[t+228>>2]+t,v[e+184>>2]=v[t+232>>2]+t,v[e+188>>2]=v[t+236>>2]+t,v[e+192>>2]=v[t+240>>2]+t,v[e+196>>2]=v[t+244>>2]+t,v[e+200>>2]=v[t+248>>2]+t,v[e+204>>2]=v[t+252>>2]+t,v[e+208>>2]=v[t+256>>2]+t,v[e+212>>2]=v[t+260>>2]+t,v[e+216>>2]=v[t+264>>2]+t,v[e+220>>2]=v[t+268>>2]+t,v[e+224>>2]=v[t+272>>2]+t,v[e+228>>2]=v[t+276>>2]+t,v[e+232>>2]=v[t+280>>2]+t,v[e+236>>2]=v[t+284>>2]+t,v[e+244>>2]=v[t+288>>2]+t,v[e+248>>2]=v[t+292>>2]+t,v[e+272>>2]=v[t+296>>2]+t,v[e+276>>2]=v[t+300>>2]+t,v[e+280>>2]=v[t+304>>2]+t,v[e+292>>2]=v[t+308>>2]+t,v[e+296>>2]=v[t+312>>2]+t,v[e+300>>2]=v[t+316>>2]+t,v[e+304>>2]=v[t+320>>2]+t,v[e+308>>2]=v[t+324>>2]+t,v[e+312>>2]=v[t+328>>2]+t,v[e+316>>2]=v[t+332>>2]+t,v[e+328>>2]=v[t+336>>2]+t,v[e+332>>2]=v[t+340>>2]+t,v[e+336>>2]=v[t+344>>2]+t,v[e+348>>2]=v[t+348>>2]+t,v[e+360>>2]=v[t+352>>2]+t,v[e+364>>2]=v[t+356>>2]+t,v[e+368>>2]=v[t+360>>2]+t,v[e+352>>2]=v[t+364>>2]+t,v[e+356>>2]=v[t+368>>2]+t,v[e+488>>2]=v[t+372>>2]+t,v[e+492>>2]=v[t+376>>2]+t,v[e+496>>2]=v[t+380>>2]+t,v[e+500>>2]=v[t+384>>2]+t,v[e+504>>2]=v[t+388>>2]+t,v[e+508>>2]=v[t+392>>2]+t,v[e+512>>2]=v[t+396>>2]+t,v[e+516>>2]=v[t+400>>2]+t,v[e+520>>2]=v[t+404>>2]+t,v[e+524>>2]=v[t+408>>2]+t,v[e+528>>2]=v[t+412>>2]+t,v[e+532>>2]=v[t+416>>2]+t,v[e+536>>2]=v[t+420>>2]+t,v[e+540>>2]=v[t+424>>2]+t,v[e+544>>2]=v[t+428>>2]+t,v[e+548>>2]=v[t+432>>2]+t,v[e+552>>2]=v[t+436>>2]+t,v[e+556>>2]=v[t+440>>2]+t,v[e+560>>2]=v[t+444>>2]+t,v[e+564>>2]=v[t+448>>2]+t,v[e+568>>2]=v[t+452>>2]+t,v[e+572>>2]=v[t+456>>2]+t,v[e+576>>2]=v[t+460>>2]+t,v[e+580>>2]=v[t+464>>2]+t,i>>>0<2||(v[e+104>>2]=v[t+468>>2]+t,i>>>0<4)||(v[e+260>>2]=v[t+472>>2]+t,v[e+264>>2]=v[t+476>>2]+t,v[e+268>>2]=v[t+480>>2]+t,v[e+88>>2]=v[t+484>>2]+t,v[e+120>>2]=v[t+488>>2]+t,v[e+160>>2]=v[t+492>>2]+t,v[e+584>>2]=v[t+496>>2]+t,v[e+588>>2]=v[t+500>>2]+t,v[e+592>>2]=v[t+504>>2]+t,v[e+596>>2]=v[t+508>>2]+t,v[e+600>>2]=v[t+512>>2]+t,v[e+604>>2]=v[t+516>>2]+t,v[e+240>>2]=v[t+520>>2]+t,v[e+252>>2]=v[t+524>>2]+t,v[e+256>>2]=v[t+528>>2]+t,v[e+372>>2]=v[t+532>>2]+t,v[e+376>>2]=v[t+536>>2]+t,v[e+380>>2]=v[t+540>>2]+t,v[e+384>>2]=v[t+544>>2]+t,v[e+388>>2]=v[t+548>>2]+t,v[e+392>>2]=v[t+552>>2]+t,v[e+396>>2]=v[t+556>>2]+t,v[e+400>>2]=v[t+560>>2]+t,v[e+416>>2]=v[t+564>>2]+t,v[e+420>>2]=v[t+568>>2]+t,v[e+424>>2]=v[t+572>>2]+t,v[e+440>>2]=v[t+576>>2]+t,v[e+444>>2]=v[t+580>>2]+t,v[e+448>>2]=v[t+584>>2]+t,v[e+464>>2]=v[t+588>>2]+t,v[e+468>>2]=v[t+592>>2]+t,v[e+472>>2]=v[t+596>>2]+t,v[e+476>>2]=v[t+600>>2]+t,v[e+480>>2]=v[t+604>>2]+t,v[e+484>>2]=v[t+608>>2]+t,4!=(0|i)&&(v[e+284>>2]=v[t+612>>2]+t,v[e+288>>2]=v[t+616>>2]+t,v[e+320>>2]=v[t+620>>2]+t,v[e+324>>2]=v[t+624>>2]+t,v[e+340>>2]=v[t+628>>2]+t,v[e+344>>2]=v[t+632>>2]+t,v[e+404>>2]=v[t+636>>2]+t,v[e+408>>2]=v[t+640>>2]+t,v[e+412>>2]=v[t+644>>2]+t,v[e+428>>2]=v[t+648>>2]+t,v[e+432>>2]=v[t+652>>2]+t,v[e+436>>2]=v[t+656>>2]+t,v[e+452>>2]=v[t+660>>2]+t,v[e+456>>2]=v[t+664>>2]+t,v[e+460>>2]=v[t+668>>2]+t))}function it(t,e,i){var r=0;t:{if(8==(0|e))e=nt(i);else{if(r=28,3&e|1!=(0|function(t){for(var e=0,i=0;i=e,t;)t&=t-1,e=e+1|0;return i}(e>>>2)))break t;if(r=48,-64-e>>>0<i>>>0)break t;e=function(t,e){var i,r,n=0,s=0,o=0;if((s=t>>>0>(n=16)?t:16)+-1&s)for(;n=(t=n)<<1,t>>>0<s>>>0;);else t=s;return-64-t>>>0<=e>>>0?(v[2086]=48,0):(n=nt(12+((s=e>>>0<11?16:e+11&-8)+t|0)|0))?(e=n+-8|0,n&t+-1?(o=(-8&(r=v[(i=n+-4|0)>>2]))-(n=(t=15<(n=((t+n|0)-1&0-t)-8|0)-e>>>0?n:t+n|0)-e|0)|0,3&r?(v[t+4>>2]=o|1&v[t+4>>2]|2,v[4+(o=t+o|0)>>2]=1|v[4+o>>2],v[i>>2]=n|1&v[i>>2]|2,v[t+4>>2]=1|v[t+4>>2],dt(e,n)):(e=v[e>>2],v[t+4>>2]=o,v[t>>2]=e+n)):t=e,3&(e=v[t+4>>2])&&((n=-8&e)>>>0<=s+16>>>0||(v[t+4>>2]=s|1&e|2,v[4+(e=t+s|0)>>2]=3|(s=n-s|0),v[4+(n=t+n|0)>>2]=1|v[n+4>>2],dt(e,s))),t+8|0):0}(16<e>>>0?e:16,i)}if(!e)return 1;v[t>>2]=e,r=0}return r}function rt(t){var e,i=0,r=0,n=0,s=0,o=0,a=0,h=0;t:if(t){e=(n=t+-8|0)+(t=-8&(r=v[t+-4>>2]))|0;e:if(!(1&r)){if(!(3&r))break t;if((n=n-(r=v[n>>2])|0)>>>0<x[2091])break t;if(t=t+r|0,v[2092]!=(0|n))if(r>>>0<=255)s=v[n+8>>2],r>>>=3,(0|(i=v[n+12>>2]))==(0|s)?(h=v[2087]&Rt(r),v[2087]=h):(v[s+12>>2]=i,v[i+8>>2]=s);else{if(a=v[n+24>>2],(0|n)!=(0|(r=v[n+12>>2])))i=v[n+8>>2],v[i+12>>2]=r,v[r+8>>2]=i;else if(i=(i=v[(s=n+20|0)>>2])||v[(s=n+16|0)>>2]){for(;o=s,(i=v[(s=(r=i)+20|0)>>2])||(s=r+16|0,i=v[r+16>>2]););v[o>>2]=0}else r=0;if(a){s=v[n+28>>2];i:{if(v[(i=8652+(s<<2)|0)>>2]==(0|n)){if(v[i>>2]=r)break i;h=v[2088]&Rt(s),v[2088]=h;break e}if(!(v[a+(v[a+16>>2]==(0|n)?16:20)>>2]=r))break e}v[r+24>>2]=a,(i=v[n+16>>2])&&(v[r+16>>2]=i,v[i+24>>2]=r),(i=v[n+20>>2])&&(v[r+20>>2]=i,v[i+24>>2]=r)}}else if(!(3&~(r=v[4+e>>2])))return v[2089]=t,v[4+e>>2]=-2&r,v[n+4>>2]=1|t,v[t+n>>2]=t}if(!(e>>>0<=n>>>0)&&1&(r=v[4+e>>2])){e:{if(!(2&r)){if(v[2093]==(0|e)){if(v[2093]=n,t=v[2090]+t|0,v[2090]=t,v[n+4>>2]=1|t,v[2092]!=(0|n))break t;return v[2089]=0,v[2092]=0}if(v[2092]==(0|e))return v[2092]=n,t=v[2089]+t|0,v[2089]=t,v[n+4>>2]=1|t,v[t+n>>2]=t;t=(-8&r)+t|0;i:if(r>>>0<=255)r>>>=3,(0|(i=v[8+e>>2]))==(0|(s=v[12+e>>2]))?(h=v[2087]&Rt(r),v[2087]=h):(v[i+12>>2]=s,v[s+8>>2]=i);else{if(a=v[24+e>>2],(0|e)!=(0|(r=v[12+e>>2])))i=v[8+e>>2],v[i+12>>2]=r,v[r+8>>2]=i;else if(i=(i=v[(s=20+e|0)>>2])||v[(s=16+e|0)>>2]){for(;o=s,(i=v[(s=(r=i)+20|0)>>2])||(s=r+16|0,i=v[r+16>>2]););v[o>>2]=0}else r=0;if(a){s=v[28+e>>2];r:{if(v[(i=8652+(s<<2)|0)>>2]==(0|e)){if(v[i>>2]=r)break r;h=v[2088]&Rt(s),v[2088]=h;break i}if(!(v[a+(v[a+16>>2]==(0|e)?16:20)>>2]=r))break i}v[r+24>>2]=a,(i=v[16+e>>2])&&(v[r+16>>2]=i,v[i+24>>2]=r),(i=v[20+e>>2])&&(v[r+20>>2]=i,v[i+24>>2]=r)}}if(v[n+4>>2]=1|t,v[t+n>>2]=t,v[2092]!=(0|n))break e;return v[2089]=t}v[4+e>>2]=-2&r,v[n+4>>2]=1|t,v[t+n>>2]=t}if(t>>>0<=255)return r=8388+((t>>>=3)<<3)|0,t=(i=v[2087])&(t=1<<t)?v[r+8>>2]:(v[2087]=t|i,r),v[r+8>>2]=n,v[t+12>>2]=n,v[n+12>>2]=r,v[n+8>>2]=t;v[n+16>>2]=0,i=v[n+20>>2]=0,(s=t>>>8)&&(i=31,16777215<t>>>0||(i=s,i=28+((i=((i=(i<<=s=s+1048320>>>16&8)<<(a=i+520192>>>16&4))<<(o=i+245760>>>16&2)>>>15)-(o|s|a)|0)<<1|t>>>i+21&1)|0)),o=8652+((v[(r=n)+28>>2]=i)<<2)|0;e:if((s=v[2088])&(r=1<<i)){s=t<<(31==(0|i)?0:25-(i>>>1)|0),r=v[o>>2];i:{for(;;){if((-8&v[(i=r)+4>>2])==(0|t))break i;if(r=s>>>29,s<<=1,!(r=v[16+(o=i+(4&r)|0)>>2]))break}v[o+16>>2]=n,v[n+12>>2]=n,v[n+24>>2]=i,v[n+8>>2]=n;break e}t=v[i+8>>2],v[t+12>>2]=n,v[i+8>>2]=n,v[n+24>>2]=0,v[n+12>>2]=i,v[n+8>>2]=t}else v[2088]=r|s,v[o>>2]=n,v[n+12>>2]=n,v[n+24>>2]=o,v[n+8>>2]=n;if(t=v[2095]+-1|0,!(v[2095]=t)){for(n=8804;n=(t=v[n>>2])+8|0,t;);v[2095]=-1}}}}function nt(t){var e,i=0,r=0,n=0,s=0,o=0,a=0,h=0,u=0,l=0,c=0,f=0;D=e=D-16|0;t:{e:{i:{r:{n:{s:{o:{a:{h:{u:{l:{if(t>>>0<=244){if(3&(i=(o=v[2087])>>>(t=(a=t>>>0<11?16:t+11&-8)>>>3))){t=(i=v[8396+(s=(r=t+(1&~i)|0)<<3)>>2])+8|0,(0|(n=v[i+8>>2]))==(0|(s=s+8388|0))?(f=Rt(r)&o,v[2087]=f):(v[n+12>>2]=s,v[s+8>>2]=n),v[i+4>>2]=3|(r<<=3),v[4+(i=i+r|0)>>2]=1|v[i+4>>2];break t}if(a>>>0<=(u=v[2089])>>>0)break l;if(i){r=i=(t=(0-(t=(0-(r=2<<t)|r)&i<<t)&t)-1|0)>>>12&16,i=v[8396+(n=(r=((r=(r|=i=(t>>>=i)>>>5&8)|(i=(t>>>=i)>>>2&4)|(i=(t>>>=i)>>>1&2))|(i=(t>>>=i)>>>1&1))+(t>>>i)|0)<<3)>>2],(0|(t=v[i+8>>2]))==(0|(n=n+8388|0))?(o=Rt(r)&o,v[2087]=o):(v[t+12>>2]=n,v[n+8>>2]=t),t=i+8|0,v[i+4>>2]=3|a,v[4+(h=i+a|0)>>2]=1|(s=(r<<=3)-a|0),v[i+r>>2]=s,u&&(i=8388+((r=u>>>3)<<3)|0,n=v[2092],r=(r=1<<r)&o?v[i+8>>2]:(v[2087]=r|o,i),v[i+8>>2]=n,v[r+12>>2]=n,v[n+12>>2]=i,v[n+8>>2]=r),v[2092]=h,v[2089]=s;break t}if(!(c=v[2088]))break l;for(r=i=(t=(c&0-c)-1|0)>>>12&16,i=v[8652+(((r=(r|=i=(t>>>=i)>>>5&8)|(i=(t>>>=i)>>>2&4)|(i=(t>>>=i)>>>1&2))|(i=(t>>>=i)>>>1&1))+(t>>>i)<<2)>>2],n=(-8&v[i+4>>2])-a|0,r=i;t=(t=v[r+16>>2])||v[r+20>>2];)n=(r=(s=(-8&v[t+4>>2])-a|0)>>>0<n>>>0)?s:n,i=r?t:i,r=t;if(l=v[i+24>>2],(0|(s=v[i+12>>2]))!=(0|i)){t=v[i+8>>2],v[t+12>>2]=s,v[s+8>>2]=t;break e}if(!(t=v[(r=i+20|0)>>2])){if(!(t=v[i+16>>2]))break u;r=i+16|0}for(;h=r,(t=v[(r=(s=t)+20|0)>>2])||(r=s+16|0,t=v[s+16>>2]););v[h>>2]=0;break e}if(a=-1,!(4294967231<t>>>0)&&(a=-8&(i=t+11|0),u=v[2088])){r=0-a|0,o=0,(i>>>=8)&&(o=31,16777215<a>>>0||(o=28+((t=((o=(i<<=n=i+1048320>>>16&8)<<(t=i+520192>>>16&4))<<(i=o+245760>>>16&2)>>>15)-(i|t|n)|0)<<1|a>>>t+21&1)|0));c:{f:{if(n=v[8652+(o<<2)>>2])for(i=a<<(31==(0|o)?0:25-(o>>>1)|0),t=0;;){if(!(r>>>0<=(h=(-8&v[n+4>>2])-a|0)>>>0||(s=n,r=h))){r=0,t=n;break f}if(h=v[n+20>>2],n=v[16+((i>>>29&4)+n|0)>>2],t=h&&(0|h)!=(0|n)?h:t,i<<=!!(0|n),!n)break}else t=0;if(!(t|s)){if(!(t=(0-(t=2<<o)|t)&u))break l;n=i=(t=(t&0-t)-1|0)>>>12&16,t=v[8652+(((n=(n|=i=(t>>>=i)>>>5&8)|(i=(t>>>=i)>>>2&4)|(i=(t>>>=i)>>>1&2))|(i=(t>>>=i)>>>1&1))+(t>>>i)<<2)>>2]}if(!t)break c}for(;r=(i=(n=(-8&v[t+4>>2])-a|0)>>>0<r>>>0)?n:r,s=i?t:s,t=(i=v[t+16>>2])||v[t+20>>2];);}if(!(!s|r>>>0>=v[2089]-a>>>0)){if(h=v[s+24>>2],(0|s)!=(0|(i=v[s+12>>2]))){t=v[s+8>>2],v[t+12>>2]=i,v[i+8>>2]=t;break i}if(!(t=v[(n=s+20|0)>>2])){if(!(t=v[s+16>>2]))break h;n=s+16|0}for(;o=n,(t=v[(n=(i=t)+20|0)>>2])||(n=i+16|0,t=v[i+16>>2]););v[o>>2]=0;break i}}}if(a>>>0<=(i=v[2089])>>>0){t=v[2092],16<=(r=i-a|0)>>>0?(v[2089]=r,v[2092]=n=t+a|0,v[n+4>>2]=1|r,v[t+i>>2]=r,v[t+4>>2]=3|a):(v[2092]=0,v[2089]=0,v[t+4>>2]=3|i,v[4+(i=t+i|0)>>2]=1|v[i+4>>2]),t=t+8|0;break t}if(a>>>0<(n=v[2090])>>>0){v[2090]=i=n-a|0,t=v[2093],v[2093]=r=t+a|0,v[r+4>>2]=1|i,v[t+4>>2]=3|a,t=t+8|0;break t}if((r=(o=(r=s=a+47|(t=0))+(i=v[2205]?v[2207]:(v[2208]=-1,v[2209]=-1,v[2206]=4096,v[2207]=4096,v[2205]=12+e&-16^1431655768,v[2210]=0,v[2198]=0,4096))|0)&(h=0-i|0))>>>0<=a>>>0)break t;if((i=v[2197])&&(l=(u=v[2195])+r|0)>>>0<=u>>>0|i>>>0<l>>>0)break t;if(4&y[8792])break s;l:{c:{if(i=v[2093])for(t=8796;;){if((u=v[t>>2])+v[t+4>>2]>>>0>i>>>0&&u>>>0<=i>>>0)break c;if(!(t=v[t+8>>2]))break}if(-1==(0|(i=Y(0))))break o;if(o=r,(o=(n=(t=v[2206])+-1|0)&i?(r-i|0)+(i+n&0-t)|0:o)>>>0<=a>>>0|2147483646<o>>>0)break o;if((t=v[2197])&&(h=(n=v[2195])+o|0)>>>0<=n>>>0|t>>>0<h>>>0)break o;if((0|i)!=(0|(t=Y(o))))break l;break n}if(2147483646<(o=h&o-n)>>>0)break o;if((0|(i=Y(o)))==(v[t>>2]+v[t+4>>2]|0))break a;t=i}if(!(a+48>>>0<=o>>>0|2147483646<o>>>0|-1==(0|(i=t)))){if(2147483646<(t=(t=v[2207])+(s-o|0)&0-t)>>>0)break n;if(-1!=(0|Y(t))){o=t+o|0;break n}Y(0-o|0);break o}if(-1!=(0|i))break n;break o}s=0;break e}i=0;break i}if(-1!=(0|i))break n}v[2198]=4|v[2198]}if(2147483646<r>>>0)break r;if(i=Y(r),(t=Y(0))>>>0<=i>>>0|-1==(0|i)|-1==(0|t))break r;if((o=t-i|0)>>>0<=a+40>>>0)break r}t=v[2195]+o|0,(v[2195]=t)>>>0>x[2196]&&(v[2196]=t);n:{s:{o:{if(r=v[2093]){for(t=8796;;){if(((n=v[t>>2])+(s=v[t+4>>2])|0)==(0|i))break o;if(!(t=v[t+8>>2]))break}break s}for((t=v[2091])>>>0<=i>>>0&&t||(v[2091]=i),t=0,v[2200]=o,v[2199]=i,v[2095]=-1,v[2096]=v[2205],v[2202]=0;v[8396+(r=t<<3)>>2]=n=r+8388|0,v[r+8400>>2]=n,32!=(0|(t=t+1|0)););v[2090]=n=(t=o+-40|0)-(r=i+8&7?-8-i&7:0)|0,v[2093]=r=i+r|0,v[r+4>>2]=1|n,v[4+(t+i|0)>>2]=40,v[2094]=v[2209];break n}if(!(8&y[t+12|0]|i>>>0<=r>>>0|r>>>0<n>>>0)){v[t+4>>2]=s+o,v[2093]=i=(t=r+8&7?-8-r&7:0)+r|0,n=v[2090]+o|0,v[2090]=t=n-t|0,v[i+4>>2]=1|t,v[4+(r+n|0)>>2]=40,v[2094]=v[2209];break n}}i>>>0<(s=v[2091])>>>0&&(v[2091]=i,s=0),n=i+o|0,t=8796;s:{o:{a:{h:{u:{l:{for(;(0|n)!=v[t>>2];)if(!(t=v[t+8>>2]))break l;if(!(8&y[t+12|0]))break u}for(t=8796;;){if((n=v[t>>2])>>>0<=r>>>0&&r>>>0<(s=n+v[t+4>>2]|0)>>>0)break h;t=v[t+8>>2]}}if(v[t>>2]=i,v[t+4>>2]=v[t+4>>2]+o,v[4+(l=(i+8&7?-8-i&7:0)+i|0)>>2]=3|a,t=((i=n+(n+8&7?-8-n&7:0)|0)-l|0)-a|0,h=a+l|0,(0|i)==(0|r)){v[2093]=h,t=v[2090]+t|0,v[2090]=t,v[h+4>>2]=1|t;break o}if(v[2092]==(0|i)){v[2092]=h,t=v[2089]+t|0,v[2089]=t,v[h+4>>2]=1|t,v[t+h>>2]=t;break o}if(1==(3&(r=v[i+4>>2]))){c=-8&r;u:if(r>>>0<=255)s=r>>>3,r=v[i+8>>2],(0|(n=v[i+12>>2]))==(0|r)?(f=v[2087]&Rt(s),v[2087]=f):(v[r+12>>2]=n,v[n+8>>2]=r);else{if(u=v[i+24>>2],(0|(o=v[i+12>>2]))!=(0|i))r=v[i+8>>2],v[r+12>>2]=o,v[o+8>>2]=r;else if(a=(a=v[(n=i+20|0)>>2])||v[(n=i+16|0)>>2]){for(;r=n,(a=v[(n=(o=a)+20|0)>>2])||(n=o+16|0,a=v[o+16>>2]););v[r>>2]=0}else o=0;if(u){r=v[i+28>>2];l:{if(v[(n=8652+(r<<2)|0)>>2]==(0|i)){if(v[n>>2]=o)break l;f=v[2088]&Rt(r),v[2088]=f;break u}if(!(v[u+(v[u+16>>2]==(0|i)?16:20)>>2]=o))break u}v[o+24>>2]=u,(r=v[i+16>>2])&&(v[o+16>>2]=r,v[r+24>>2]=o),(r=v[i+20>>2])&&(v[o+20>>2]=r,v[r+24>>2]=o)}}i=i+c|0,t=t+c|0}if(v[i+4>>2]=-2&v[i+4>>2],v[h+4>>2]=1|t,(v[t+h>>2]=t)>>>0<=255){t=8388+((i=t>>>3)<<3)|0,i=(r=v[2087])&(i=1<<i)?v[t+8>>2]:(v[2087]=i|r,t),v[t+8>>2]=h,v[i+12>>2]=h,v[h+12>>2]=t,v[h+8>>2]=i;break o}if(i=0,(n=t>>>8)&&(i=31,16777215<t>>>0||(i=28+((i=((a=(n<<=s=n+1048320>>>16&8)<<(i=n+520192>>>16&4))<<(n=a+245760>>>16&2)>>>15)-(n|i|s)|0)<<1|t>>>i+21&1)|0)),v[(r=h)+28>>2]=i,v[h+16>>2]=0,r=8652+(i<<2)|(v[h+20>>2]=0),(n=v[2088])&(s=1<<i)){for(n=t<<(31==(0|i)?0:25-(i>>>1)|0),i=v[r>>2];;){if((-8&v[(r=i)+4>>2])==(0|t))break a;if(i=n>>>29,n<<=1,!(i=v[16+(s=(4&i)+r|0)>>2]))break}v[s+16>>2]=h}else v[2088]=n|s,v[r>>2]=h;v[h+24>>2]=r,v[h+12>>2]=h,v[h+8>>2]=h;break o}for(v[2090]=h=(t=o+-40|0)-(n=i+8&7?-8-i&7:0)|0,v[2093]=n=i+n|0,v[n+4>>2]=1|h,v[4+(t+i|0)>>2]=40,v[2094]=v[2209],v[(n=(t=(s+(s+-39&7?39-s&7:0)|0)-47|0)>>>0<r+16>>>0?r:t)+4>>2]=27,t=v[2202],v[n+16>>2]=v[2201],v[n+20>>2]=t,t=v[2200],v[n+8>>2]=v[2199],v[n+12>>2]=t,v[2201]=n+8,v[2200]=o,v[2199]=i,t=n+24|(v[2202]=0);v[t+4>>2]=7,i=t+8|0,t=t+4|0,i>>>0<s>>>0;);if((0|r)==(0|n))break n;if(v[n+4>>2]=-2&v[n+4>>2],v[r+4>>2]=1|(s=n-r|0),(v[n>>2]=s)>>>0<=255){t=8388+((i=s>>>3)<<3)|0,i=(n=v[2087])&(i=1<<i)?v[t+8>>2]:(v[2087]=i|n,t),v[t+8>>2]=r,v[i+12>>2]=r,v[r+12>>2]=t,v[r+8>>2]=i;break n}if(v[r+16>>2]=0,t=v[r+20>>2]=0,(n=s>>>8)&&(t=31,16777215<s>>>0||(t=28+((t=((h=(n<<=o=n+1048320>>>16&8)<<(t=n+520192>>>16&4))<<(n=h+245760>>>16&2)>>>15)-(n|t|o)|0)<<1|s>>>t+21&1)|0)),i=8652+((v[(i=r)+28>>2]=t)<<2)|0,(n=v[2088])&(o=1<<t)){for(t=s<<(31==(0|t)?0:25-(t>>>1)|0),i=v[i>>2];;){if((0|s)==(-8&v[(n=i)+4>>2]))break s;if(i=t>>>29,t<<=1,!(i=v[16+(o=n+(4&i)|0)>>2]))break}v[o+16>>2]=r,v[r+24>>2]=n}else v[2088]=n|o,v[i>>2]=r,v[r+24>>2]=i;v[r+12>>2]=r,v[r+8>>2]=r;break n}t=v[r+8>>2],v[t+12>>2]=h,v[r+8>>2]=h,v[h+24>>2]=0,v[h+12>>2]=r,v[h+8>>2]=t}t=l+8|0;break t}t=v[n+8>>2],v[t+12>>2]=r,v[n+8>>2]=r,v[r+24>>2]=0,v[r+12>>2]=n,v[r+8>>2]=t}if(!((t=v[2090])>>>0<=a>>>0)){v[2090]=i=t-a|0,t=v[2093],v[2093]=r=t+a|0,v[r+4>>2]=1|i,v[t+4>>2]=3|a,t=t+8|0;break t}}v[2086]=48,t=0;break t}i:if(h){t=v[s+28>>2];r:{if(v[(n=8652+(t<<2)|0)>>2]==(0|s)){if(v[n>>2]=i)break r;u=Rt(t)&u,v[2088]=u;break i}if(!(v[h+(v[h+16>>2]==(0|s)?16:20)>>2]=i))break i}v[i+24>>2]=h,(t=v[s+16>>2])&&(v[i+16>>2]=t,v[t+24>>2]=i),(t=v[s+20>>2])&&(v[i+20>>2]=t,v[t+24>>2]=i)}i:if(r>>>0<=15)v[s+4>>2]=3|(t=r+a|0),v[4+(t=t+s|0)>>2]=1|v[t+4>>2];else if(v[s+4>>2]=3|a,v[4+(n=s+a|0)>>2]=1|r,(v[r+n>>2]=r)>>>0<=255)t=8388+((i=r>>>3)<<3)|0,i=(r=v[2087])&(i=1<<i)?v[t+8>>2]:(v[2087]=i|r,t),v[t+8>>2]=n,v[i+12>>2]=n,v[n+12>>2]=t,v[n+8>>2]=i;else{t=0,(a=r>>>8)&&(t=31,16777215<r>>>0||(t=28+((t=((h=(a<<=o=a+1048320>>>16&8)<<(t=a+520192>>>16&4))<<(a=h+245760>>>16&2)>>>15)-(a|t|o)|0)<<1|r>>>t+21&1)|0)),v[(i=n)+28>>2]=t,v[n+16>>2]=0,i=8652+(t<<2)|(v[n+20>>2]=0);r:{if((a=1<<t)&u){for(t=r<<(31==(0|t)?0:25-(t>>>1)|0),a=v[i>>2];;){if((-8&v[(i=a)+4>>2])==(0|r))break r;if(a=t>>>29,t<<=1,!(a=v[16+(o=(4&a)+i|0)>>2]))break}v[o+16>>2]=n}else v[2088]=a|u,v[i>>2]=n;v[n+24>>2]=i,v[n+12>>2]=n,v[n+8>>2]=n;break i}t=v[i+8>>2],v[t+12>>2]=n,v[i+8>>2]=n,v[n+24>>2]=0,v[n+12>>2]=i,v[n+8>>2]=t}t=s+8|0;break t}e:if(l){t=v[i+28>>2];i:{if(v[(r=8652+(t<<2)|0)>>2]==(0|i)){if(v[r>>2]=s)break i;f=Rt(t)&c,v[2088]=f;break e}if(!(v[l+(v[l+16>>2]==(0|i)?16:20)>>2]=s))break e}v[s+24>>2]=l,(t=v[i+16>>2])&&(v[s+16>>2]=t,v[t+24>>2]=s),(t=v[i+20>>2])&&(v[s+20>>2]=t,v[t+24>>2]=s)}n>>>0<=15?(v[i+4>>2]=3|(t=n+a|0),v[4+(t=t+i|0)>>2]=1|v[t+4>>2]):(v[i+4>>2]=3|a,v[4+(a=i+a|0)>>2]=1|n,v[n+a>>2]=n,u&&(t=8388+((r=u>>>3)<<3)|0,s=v[2092],r=(r=1<<r)&o?v[t+8>>2]:(v[2087]=r|o,t),v[t+8>>2]=s,v[r+12>>2]=s,v[s+12>>2]=t,v[s+8>>2]=r),v[2092]=a,v[2089]=n),t=i+8|0}return D=16+e|0,t}function st(t,e,i,r,n,s,o){var a,h,u,l=0,c=0,f=0,d=0,p=0,b=0,x=0,T=0,w=0,S=0,P=0,M=0;v[76+(D=u=D-80|0)>>2]=e,h=55+u|0,a=56+u|0,e=0;t:{e:{i:for(;;){(0|w)<0||(w=(2147483647-w|0)<(0|e)?(v[2086]=61,-1):e+w|0);r:{n:{s:{o:{a:{h:{u:{l:{c:{f:{d:{p:{_:{if(d=v[76+u>>2],f=y[0|(e=d)]){for(;;){m:{g:{v:if(l=255&f){if(37!=(0|l))break g;for(f=e;;){if(37!=y[e+1|0])break v;if(v[76+u>>2]=l=e+2|0,f=f+1|0,c=y[e+2|0],e=l,37!=(0|c))break}}else f=e;if(e=f-d|0,t&&N(t,d,e),e)continue i;S=-1,p=!q(m[v[76+(l=u)>>2]+(f=1)|0]),e=v[76+u>>2],p|36!=y[e+2|0]||(S=m[e+1|0]+-48|0,P=1,f=3),v[l+76>>2]=e=f+e|0;v:if(31<(c=(x=m[(f=0)|e])+-32|0)>>>0)l=e;else if(l=e,75913&(c=1<<c))for(;;){if(v[76+u>>2]=l=e+1|0,f|=c,31<(c=(x=m[e+1|0])+-32|0)>>>0)break v;if(e=l,!(75913&(c=1<<c)))break}if(42==(0|x)){if(p=u,q(m[l+1|0])&&(e=v[76+u>>2],36==y[e+2|0]))v[((m[e+1|0]<<2)+n|0)-192>>2]=10,T=v[((m[e+1|0]<<3)+r|0)-384>>2],P=1,e=e+3|0;else{if(P)break e;T=P=0,t&&(e=v[i>>2],v[i>>2]=e+4,T=v[e>>2]),e=v[76+u>>2]+1|0}v[p+76>>2]=e,-1<(0|T)||(T=0-T|0,f|=8192)}else{if((0|(T=xt(76+u|0)))<0)break e;e=v[76+u>>2]}if(c=-1,46==y[0|e])if(42==y[e+1|0])if(q(m[e+2|0])&&(e=v[76+u>>2],36==y[e+3|0]))v[((m[e+2|0]<<2)+n|0)-192>>2]=10,c=v[((m[e+2|0]<<3)+r|0)-384>>2],v[76+u>>2]=e=e+4|0;else{if(P)break e;c=t?(e=v[i>>2],v[i>>2]=e+4,v[e>>2]):0,e=v[76+u>>2]+2|0,v[76+u>>2]=e}else v[76+u>>2]=e+1,c=xt(76+u|0),e=v[76+u>>2];for(l=0;;){if(M=l,b=-1,57<m[0|e]+-65>>>0)break t;if(v[76+u>>2]=x=e+1|0,l=m[0|e],e=x,!((l=y[3295+(l+E(M,58)|0)|0])+-1>>>0<8))break}if(!l)break t;v:{y:{b:{if(19==(0|l)){if((0|S)<=-1)break b;break t}if((0|S)<0)break y;v[(S<<2)+n>>2]=l,l=v[4+(e=(S<<3)+r|0)>>2],v[64+u>>2]=v[e>>2],v[68+u>>2]=l}if(e=0,t)break v;continue i}if(!t)break r;bt(64+u|0,l,i,o),x=v[76+u>>2]}if(p=-65537&f,f=8192&f?p:f,S=3336,l=a,e=m[x+-1|(b=0)],(x=(e=M&&3==(15&e)?-33&e:e)+-88|0)>>>0<=32)break m;v:{y:{b:{x:{if(6<(p=e+-65|0)>>>0){if(83!=(0|e))break n;if(!c)break x;l=v[64+u>>2];break y}switch(p-1|0){case 1:break b;case 0:case 2:break n;default:break _}}U(t,32,T,e=0,f);break v}v[12+u>>2]=0,v[8+u>>2]=v[64+u>>2],v[64+u>>2]=8+u,c=-1,l=8+u|0}e=0;y:{for(;;){if(!(d=v[l>>2]))break y;if((p=(0|(d=vt(4+u|0,d)))<0)|c-e>>>0<d>>>0)break;if(l=l+4|0,!((e=e+d|0)>>>0<c>>>0))break y}if(b=-1,p)break t}if(U(t,32,T,e,f),e)for(c=0,l=v[64+u>>2];;){if(!(d=v[l>>2]))break v;if((0|e)<(0|(c=(d=vt(4+u|0,d))+c|0)))break v;if(N(t,4+u|0,d),l=l+4|0,!(c>>>0<e>>>0))break}else e=0}U(t,32,T,e,8192^f),e=(0|e)<(0|T)?T:e;continue i}v[76+u>>2]=l=e+1|0,f=y[e+1|0],e=l;continue}break}switch(x-1|0){case 28:break a;case 21:break h;case 23:break l;case 22:break c;case 11:case 16:break f;case 10:break d;case 26:break p;case 8:case 12:case 13:case 14:break _;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 9:case 15:case 17:case 18:case 19:case 20:case 24:case 25:case 27:case 29:case 30:break n;default:break u}}if(b=w,t)break t;if(!P)break r;for(e=1;;){if(t=v[(e<<2)+n>>2]){if(bt((e<<3)+r|0,t,i,o),10!=(0|(e=e+(b=1)|0)))continue;break t}break}if(b=1,9<e>>>0)break t;if(b=-1,v[(e<<2)+n>>2])break t;for(;!v[((e=e+1|0)<<2)+n>>2]&&10!=(0|e););b=e>>>0<10?-1:1;break t}e=0|_[s](t,A[64+u>>3],T,c,f,e);continue}l=(e=Et(d=(e=v[64+u>>2])||3346,c))||c+d|0,f=p,c=e?e-d|0:c;break n}m[55+u|0]=v[64+u>>2],c=1,d=h,f=p;break n}if(e=p=v[68+u>>2],d=v[64+u>>2],(0|e)<-1||(0|e)<=-1&&!(4294967295<d>>>0)){e=0-(e+(0<d>>>0)|0)|0,v[64+u>>2]=d=0-d|0,v[68+u>>2]=e,b=1,S=3336;break o}if(2048&f){b=1,S=3337;break o}S=(b=1&f)?3338:3336;break o}if(d=function(t,e,i){if(t|e)for(;m[0|(i=i+-1|0)]=7&t|48,(t=(7&e)<<29|t>>>3)|(e>>>=3););return i}(v[64+u>>2],v[68+u>>2],a),!(8&f))break s;c=(0|(e=a-d|0))<(0|c)?c:e+1|0;break s}c=8<c>>>0?c:8,f|=8,e=120}if(d=function(t,e,i,r){if(t|e)for(;m[0|(i=i+-1|0)]=y[3824+(15&t)|0]|r,(t=(15&e)<<28|t>>>4)|(e>>>=4););return i}(v[64+u>>2],v[68+u>>2],a,32&e),!(8&f)|!(v[64+u>>2]|v[68+u>>2]))break s;S=3336+(e>>>4)|0,b=2;break s}if(7<(l=255&M)>>>(e=0))continue;switch(l-1|0){default:case 0:case 5:v[v[64+u>>2]>>2]=w;continue;case 1:l=v[64+u>>2],v[l>>2]=w,v[l+4>>2]=w>>31;continue;case 2:g[v[64+u>>2]>>1]=w;continue;case 3:m[v[64+u>>2]]=w;continue;case 4:continue;case 6:}l=v[64+u>>2],v[l>>2]=w,v[l+4>>2]=w>>31;continue}d=v[64+u>>2],e=v[68+u>>2],S=3336}d=W(d,e,a)}f=-1<(0|c)?-65537&f:f,c=!!((p=e=v[68+u>>2])|(x=v[64+u>>2]))|c?(0|(e=!(p|x)+(a-d|0)|0))<(0|c)?c:e:(d=a,0)}U(t,32,e=(0|T)<(0|(l=(c=(0|c)<(0|(p=l-d|0))?p:c)+b|0))?l:T,l,f),N(t,S,b),U(t,48,e,l,65536^f),U(t,48,c,p,0),N(t,d,p),U(t,32,e,l,8192^f);continue}break}b=0;break t}b=-1}return D=80+u|0,b}function ot(t){var e,i=0,r=0,n=0,s=0;n=4,r=1439;t:if(i=y[0|t]){for(;!((0|(e=y[0|r]))!=(0|i)||!(n=n+-1|0)|!e);)if(r=r+1|0,i=y[t+1|0],t=t+1|0,!i)break t;s=i}return(255&s)-y[0|r]|0}function at(t,e,i){var r,n,s=0,o=0,a=0;v[(D=n=D-240|0)>>2]=t,o=1;t:if(!((0|e)<2))for(s=t;;){if(s=(r=s+-4|0)-v[((a=e+-2|0)<<2)+i>>2]|0,0<=(0|_[5](t,s))&&-1<(0|_[5](t,r)))break t;if(t=(o<<2)+n|0,0<=(0|_[5](s,r))?(v[t>>2]=s,a=e+-1|0):s=v[t>>2]=r,o=o+1|0,(0|a)<2)break t;t=v[n>>2],e=a}St(n,o),D=240+n|0}function ht(t){var e,i,r=0;if(w(0),function(t){var e,i;v[t+428>>2]&&(i=v[t+332>>2],G(v[t+460>>2],v[t+436>>2],e=i<<2),G(v[t+464>>2],v[t+440>>2],e),G(v[t+468>>2],v[t+448>>2],e),y[v[t>>2]+4|0]<4||(G(v[t+472>>2],v[t+452>>2],e=i<<4),G(v[t+476>>2],v[t+456>>2],e)))}(t),function(t){var e,i,r,n=0,s=w(0),o=w(0),a=0,h=w(0);if(w(0),w(0),1<=(0|(a=v[t>>2])))for(r=(n=v[t+4>>2])+E(a,52)|0,t=v[t+12>>2];s=T[t>>2],T[n+44>>2]!=(s=(e=v[n+16>>2])?(o=s,s=T[n+4>>2],h=T[n+12>>2],o=w(w(o-s)/h),i=w(I(o)),a=w(S(i))<w(2147483648)?~~i:-2147483648,w(s+w(h*w(o-w(0|a))))):(h=T[n+4>>2],o=T[n+8>>2],s<h?h:o<s?o:s))?(T[n+44>>2]=s,v[n+48>>2]=1):v[n+48>>2]=0,e||(T[t>>2]=s),t=t+4|0,(n=n+52|0)>>>0<r>>>0;);}(t+540|0),function(t){var e,i,r,n,s,o,a=0,h=0,u=w(0),l=0,c=w(0),f=(w(0),w(0),0),d=w(0),p=0,_=0,m=0;if(w(0),1<=(0|(l=v[t+540>>2])))for(s=(f=v[t+544>>2])+E(l,52)|0,o=v[t+644>>2];;){t:if(!(v[f>>2]||(0|(l=v[f+32>>2]))<1))if(r=(t=v[f+28>>2])+E(l,28)|0,n=T[f+24>>2],i=T[f+20>>2],e=T[f+44>>2],o)for(;;){d=w(_=0);e:{i:{r:{if((0|(h=v[t>>2]))<1)a=l=0;else if(p=v[t+4>>2],c=T[p>>2],u=w(c-i),1==(0|h))l=e<w(i+c)^1|u<e^1,a=0;else{if(e<u){l=1,a=0;break i}if(l=0,e<w(i+c))a=0;else{if(a=1,u=T[p+4>>2],!(e<w(i+u)))for(;;){if((0|h)==(0|(a=a+1|0)))break r;if(c=u,u=T[p+(a<<2)>>2],e<w(i+u))break}w(u-i)<e||(a=a+-1|0,(u=w(u-c))<n)||(d=w(w(e-c)/u))}}if(l)break i;if(p=h=1,v[t+16>>2])break e;break i}a=h+-1|0,l=1}p=(h=(c=T[t+12>>2])!=d)&(d==w(0)|c==w(0))|v[t+8>>2]!=(0|a),_=l}if(v[t+20>>2]=p,v[t+24>>2]=h,T[t+12>>2]=d,v[t+16>>2]=_,v[t+8>>2]=a,!((t=t+28|0)>>>0<r>>>0))break}else{if(!v[f+48>>2])for(;;)if(v[t+20>>2]=0,!((t=t+28|(v[t+24>>2]=0))>>>0<r>>>0))break t;for(;;){d=w(_=0);e:{i:{r:{n:if(!(((h=0)|(a=v[(p=t)>>2]))<1)){if(l=v[t+4>>2],c=T[l>>2],u=w(c-i),1!=(0|a)){if(!(e<u)){if(h=0,e<w(i+c))break n;h=1;s:if(u=T[l+4>>2],!(e<w(i+u))){for(a=a+-1|0;c=u,(0|a)!=(0|h);)if(u=T[l+((h=h+1|0)<<2)>>2],e<w(i+u))break s;l=1;break i}if(l=0,w(u-i)<e){a=h;break r}if(a=h+-1|0,(u=w(u-c))<n)break r;d=w(w(e-c)/u);break r}l=1,a=0;break i}h=e<w(i+c)^1|u<e^1}l=h,a=0}if(!l&&(m=h=1,v[t+16>>2]))break e}_=l,m=(h=(c=T[t+12>>2])!=d)&(d==w(0)|c==w(0))|v[t+8>>2]!=(0|a)}if(v[p+20>>2]=m,v[t+24>>2]=h,T[t+12>>2]=d,v[t+16>>2]=_,v[t+8>>2]=a,!((t=t+28|0)>>>0<r>>>0))break}}if(!((f=f+52|0)>>>0<s>>>0))break}}(t),function(t){var e,i,r,n,s,o=0,a=w(0),h=0,u=0,l=w(0),c=0,f=w(0);if(w(0),!(y[v[t>>2]+4|0]<4||(0|(o=v[t+540>>2]))<1))for(n=(c=v[t+544>>2])+E(o,52)|0,s=v[t+644>>2];;){t:if(1==v[c>>2]&&!((0|(o=v[c+40>>2]))<1))if(i=(t=v[c+36>>2])+E(o,28)|0,e=T[c+44>>2],s)for(;;){f=w(o=0);e:if(!((0|(u=v[t>>2]))<2||(h=v[t+4>>2],e<=(a=T[h>>2])))){o=1;i:if(!(e<(l=T[h+4>>2]))){for(;a=l,(0|u)!=(0|(o=o+1|0));)if(e<(l=T[h+(o<<2)>>2]))break i;o=u+-1|0;break e}f=w(w(e-a)/w(l-a)),o=o+-1|0}if(a=T[t+16>>2],T[t+16>>2]=f,u=v[t+12>>2],v[t+12>>2]=o,v[t+24>>2]=h=a!=f,v[t+20>>2]=h&(f==w(0)|a==w(0))|(0|o)!=(0|u),!((t=t+28|0)>>>0<i>>>0))break}else{if(!v[c+48>>2])for(;;)if(v[t+20>>2]=0,!((t=t+28|(v[t+24>>2]=0))>>>0<i>>>0))break t;for(;;){f=w(u=0);e:if(!((0|(r=v[t>>2]))<2||(h=v[t+4>>2],e<=(a=T[h>>2])))){if(o=1,!(e<(l=T[h+4>>2])))for(u=r+-1|0;;){if(a=l,(0|o)==(0|u))break e;if(e<(l=T[h+((o=o+1|0)<<2)>>2]))break}f=w(w(e-a)/w(l-a)),u=o+-1|0}if(a=T[t+16>>2],T[t+16>>2]=f,o=v[t+12>>2],v[t+12>>2]=u,v[t+24>>2]=h=a!=f,v[t+20>>2]=h&(f==w(0)|a==w(0))|(0|o)!=(0|u),!((t=t+28|0)>>>0<i>>>0))break}}if(!((c=c+52|0)>>>0<n>>>0))break}}(t),function(t){var e,i,r,n,s,o,a,h=0,u=0,l=0,c=0,f=0,d=0,p=0,_=w(0),m=0,g=0,y=0,b=0,x=0;if(1<=(0|(u=v[t+564>>2])))for(o=(f=v[t+568>>2])+E(u,36)|0,n=v[t+644>>2];;){t:{if(!(d=((l=c=u=0)|(i=v[f+4>>2]))<1))for(m=v[f>>2],t=b=0;;){if(h=v[m+(t<<2)>>2],v[h+16>>2]){h=1,x=0;break t}if(l=l||v[h+24>>2],u=u||v[h+20>>2],c=(T[h+12>>2]!=w(0))+c|0,(0|i)==(0|(t=t+1|0)))break}if(h=0,(b=n?1:l)|(x=n?1:u)&&(v[f+12>>2]=m=1<<c,31!=(0|c))){for(u=v[f+20>>2],s=v[f>>2],l=(t=v[f+16>>2])+(p=m<<2)|0,l=H(t,0,4+((-1^t)+((t=t+4|0)>>>0<l>>>0?l:t)|0)&-4),p=u+p|0,t=u;v[t>>2]=1065353216,(t=t+4|0)>>>0<p>>>0;);if(!d){if(d=0,p=h=1,c)for(;;){if(c=v[(d<<2)+s>>2],g=v[c+8>>2],y=E(g,h),(_=T[c+12>>2])!=w(t=0)){for(v[l>>2]=y+v[l>>2],T[u>>2]=w(w(1)-_)*T[u>>2],g=E(g+(t=1)|0,h);_=T[c+12>>2],a=v[(r=(e=t<<2)+l|0)>>2],v[r>>2]=a+((r=t&p)?g:y),T[(e=u+e|0)>>2]=(r?_:w(w(1)-_))*T[e>>2],(0|m)!=(0|(t=t+1|0)););p<<=1}else for(;v[(g=l+(t<<2)|0)>>2]=y+v[g>>2],(0|m)!=(0|(t=t+1|0)););if(h=E(v[c>>2],h),(0|i)==(0|(d=d+1|0)))break}else for(;;){if(c=v[(d<<2)+s>>2],p=E(v[c+8>>2],h),(_=T[c+12>>2])!=w(t=0))v[l>>2]=p+v[l>>2],T[u>>2]=w(w(1)-_)*T[u>>2];else for(;v[(y=l+(t<<2)|0)>>2]=p+v[y>>2],(0|m)!=(0|(t=t+1|0)););if(h=E(v[c>>2],h),(0|i)==(0|(d=d+1|0)))break}h=0}}}if(v[f+32>>2]=h,v[f+24>>2]=x,v[f+28>>2]=b,!((f=f+36|0)>>>0<o>>>0))break}}(t),function(t){var e,i,r,n,s=w(0),o=0,a=0,h=0,u=0,l=0,c=w(0),f=w(0),d=w(0),p=0,_=0,m=0;if(!(y[v[t>>2]+4|0]<4||(0|(o=v[t+588>>2]))<1))for(n=(h=v[t+592>>2])+E(o,48)|0,e=v[t+644>>2];;){if(t=v[h>>2],(_=e?1:v[t+20>>2])|(m=e?1:v[t+24>>2])){t:{e:{l=h,u=v[t+8>>2],o=v[t+12>>2],s=T[t+16>>2],t=(0|u)!=(0|o);i:{if(s!=w(0)){if(t=o+1|0,(0|o)==(0|u)){v[h+8>>2]=_=1,s=w(w(1)-s),m=1;break i}t=(0|t)==(0|u)?1:2}if(v[l+8>>2]=t,!m)break e;t=o}T[h+24>>2]=s,T[h+20>>2]=w(1)-s;break t}m=0,t=o}_?(v[h+12>>2]=t,v[h+16>>2]=t+1):_=0}else _=m=0;t:if((0|(i=v[h+36>>2]))<1)d=w(1);else{if(r=v[h+40>>2],t=0,d=w(1),!e)for(;;){e:{i:{if(o=v[(t<<2)+r>>2],a=v[o>>2]){if(!v[a+48>>2]){s=T[o+16>>2];break e}if((0|(u=v[o+12>>2]))<1){s=w(1),T[o+16>>2]=1;break e}if(p=v[o+8>>2],1!=(0|u)&&(c=T[a+44>>2],l=v[o+4>>2],!(c<=(f=T[l>>2]))))break i;s=T[p>>2],T[o+16>>2]=s;break e}v[o+16>>2]=1065353216,s=w(1);break e}a=1;i:if(!(c<(s=T[l+4>>2]))){for(;f=s,(0|u)!=(0|(a=a+1|0));)if(c<(s=T[l+(a<<2)>>2]))break i;s=T[(p+(u<<2)|0)-4>>2],T[o+16>>2]=s;break e}l=o,s=w(w(c-f)/w(s-f)),s=w(w(s*T[(o=p+(a<<2)|0)>>2])+w(T[o+-4>>2]*w(w(1)-s))),T[l+16>>2]=s}if(d=d<s?d:s,(0|i)==(0|(t=t+1|0)))break t}for(;;){o=v[(t<<2)+r>>2],a=v[o>>2],s=w(1);e:if(a&&(p=v[o+12>>2],s=w(1),!((0|p)<1))&&(u=v[o+8>>2],s=T[u>>2],1!=(0|p))){i:{if(c=T[a+44>>2],l=v[o+4>>2],c<=(f=T[l>>2])){s=T[u>>2];break e}if(a=1,!(c<(s=T[l+4>>2]))){for(;f=s,(0|p)!=(0|(a=a+1|0));)if(c<(s=T[l+(a<<2)>>2]))break i;s=T[(u+(p<<2)|0)-4>>2];break e}}s=w(w(c-f)/w(s-f)),s=w(w(s*T[(a=u+(a<<2)|0)>>2])+w(T[a+-4>>2]*w(w(1)-s)))}if(d=d<(T[o+16>>2]=s)?d:s,(0|i)==(0|(t=t+1|0)))break}}if(v[h+32>>2]=m,v[h+28>>2]=_,T[h+44>>2]=d,!((h=h+48|0)>>>0<n>>>0))break}}(t),1<=(0|(e=v[t+4>>2])))for(e=(r=v[t+52>>2])+(e<<2)|0;i=T[r>>2],T[r>>2]=i<w(0)?w(0):w(M(i,w(1))),(r=r+4|0)>>>0<e>>>0;);!function(t){var e,i,r,n=0,s=0;if(1<=(0|(s=v[t+4>>2])))for(r=(n=v[t+8>>2])+E(s,12)|0,t=e=v[t+40>>2];s=0,v[n+8>>2]&&(i=v[n+4>>2],!v[(i<<2)+e>>2]&&-1!=(0|i)||(s=!v[v[n>>2]+32>>2])),v[t>>2]=s,t=t+4|0,(n=n+12|0)>>>0<r>>>0;);}(t),function(t){var e,i,r,n,s,o,a,h=0,u=0,l=0,c=0,f=0;if(1<=(0|(i=v[t+4>>2])))for(n=v[t+8>>2],r=v[t>>2],s=v[r+724>>2];;){if(e=v[E(c,12)+n>>2],(v[e+28>>2]||v[e+24>>2])&&(v[(h=c<<2)+v[t+28>>2]>>2]=v[e+12>>2],v[e+24>>2])&&!((0|(l=v[e+12>>2]))<1))for(l=(u=v[e+16>>2])+(l<<2)|0,o=v[h+s>>2],h=v[t+36>>2]+(f<<2)|0,a=v[r+976>>2];v[h>>2]=v[(v[u>>2]+o<<2)+a>>2],h=h+4|0,(u=u+4|0)>>>0<l>>>0;);if(v[e+28>>2]&&!((0|(h=v[e+12>>2]))<1))for(l=(u=v[e+20>>2])+(h<<2)|0,h=v[t+32>>2]+(f<<2)|0;v[h>>2]=v[u>>2],h=h+4|0,(u=u+4|0)>>>0<l>>>0;);if(f=v[e+8>>2]+f|0,(0|i)==(0|(c=c+1|0)))break}}(t),_[v[1808]](t+12|0,v[t+36>>2],v[t+44>>2],v[t+40>>2]),function(t){var e,i,r,n,s,o,a=0,h=0,u=0;if(1<=(0|(u=v[t+304>>2])))for(r=(a=v[t+308>>2])+(u<<5)|0,n=v[t+264>>2],s=v[t+144>>2],o=v[t+40>>2],u=i=v[t+312>>2];e=u,h=0,t=h=!v[a+28>>2]||-1!=(0|(t=v[a+4>>2]))&&(h=0,!v[(t<<2)+o>>2])||-1!=(0|(t=v[a+8>>2]))&&(h=0,!v[(t<<2)+i>>2])?h:!v[v[a>>2]+32>>2],v[e>>2]=t,(e=v[a+12>>2])>>>0<=1?e-1?v[(v[a+16>>2]<<2)+s>>2]=t:v[(v[a+16>>2]<<2)+n>>2]=t:B(4,1372,0),u=u+4|0,(a=a+32|0)>>>0<r>>>0;);}(t),function(t){var e,i,r,n,s,o,a,h,u,l=0,c=0,f=0,d=0,p=0,_=0,m=0,g=0,b=0,x=0,T=0,A=0,w=0,S=0;p=v[t>>2];if(1<=(0|(g=v[t+56>>2]))){for(b=v[t+60>>2],x=v[p+1052>>2],T=v[p+784>>2];;){if(l=v[b+E(_,24)>>2],(v[l+28>>2]||v[l+24>>2])&&(v[(c=_<<2)+v[t+80>>2]>>2]=v[l+12>>2],v[l+24>>2])&&!((0|(d=v[l+12>>2]))<1))for(A=(f=v[l+16>>2])+(d<<2)|0,w=v[c+T>>2],c=(d=m<<2)+v[t+92>>2]|0,d=d+v[t+88>>2]|0;S=w+v[f>>2]<<2,v[c>>2]=x+(v[S+v[p+984>>2]>>2]<<2),v[d>>2]=v[S+v[p+980>>2]>>2],d=d+4|0,c=c+4|0,(f=f+4|0)>>>0<A>>>0;);if(v[l+28>>2]&&!((0|(c=v[l+12>>2]))<1))for(d=(f=v[l+20>>2])+(c<<2)|0,c=v[t+84>>2]+(m<<2)|0;v[c>>2]=v[f>>2],c=c+4|0,(f=f+4|0)>>>0<d>>>0;);if(m=v[l+8>>2]+m|0,(0|g)==(0|(_=_+1|0)))break}p=v[t>>2]}if(!(y[p+4|0]<4||(0|(w=v[t+56>>2]))<1))for(S=v[p+792>>2],e=v[t+60>>2],f=m=0;;){if(_=v[E(f,24)+e>>2],v[_+24>>2]&&!((0|(l=v[_+12>>2]))<1))for(i=(c=v[_+16>>2])+(l<<2)|0,r=v[S+(f<<2)>>2],d=(l=m<<2)+v[t+96>>2]|0,g=l+v[t+100>>2]|0,b=l+v[t+104>>2]|0,x=l+v[t+108>>2]|0,T=l+v[t+112>>2]|0,A=l+v[t+116>>2]|0,n=v[p+1308>>2],s=v[p+1304>>2],o=v[p+1300>>2],a=v[p+1296>>2],h=v[p+1292>>2],u=v[p+1288>>2];l=v[c>>2]+r<<2,v[d>>2]=v[l+u>>2],v[g>>2]=v[l+h>>2],v[b>>2]=v[l+a>>2],v[x>>2]=v[l+o>>2],v[T>>2]=v[l+s>>2],v[A>>2]=v[l+n>>2],A=A+4|0,T=T+4|0,x=x+4|0,b=b+4|0,g=g+4|0,d=d+4|0,(c=c+4|0)>>>0<i>>>0;);if(m=v[_+8>>2]+m|0,(0|w)==(0|(f=f+1|0)))break}}(t),function(t){var e=0,i=0,r=0,n=0,s=0,o=0,a=0,h=0,u=0,l=0,c=0,f=0,d=0,p=0,_=0,m=0,g=0,b=0,x=0,T=0,A=0,w=v[t+168>>2],S=v[t>>2];if(1<=(0|(d=v[t+164>>2])))for(_=v[S+816>>2];;){if(r=v[E(a,12)+w>>2],(v[r+28>>2]||v[r+24>>2])&&(v[(h=a<<2)+v[t+188>>2]>>2]=v[r+12>>2],v[r+24>>2])){if(i=v[r+16>>2],p=v[h+_>>2],1<=(0|(e=v[r+12>>2])))for(m=i+(e<<2)|0,n=(e=o<<2)+v[t+200>>2]|0,u=e+v[t+204>>2]|0,l=e+v[t+208>>2]|0,c=e+v[t+212>>2]|0,f=e+v[t+196>>2]|0,g=v[S+996>>2],b=v[S+1012>>2],x=v[S+1008>>2],T=v[S+1004>>2],A=v[S+1e3>>2],e=i;s=p+v[e>>2]<<2,v[n>>2]=v[s+A>>2],v[u>>2]=v[s+T>>2],v[l>>2]=v[s+x>>2],v[c>>2]=v[s+b>>2],v[f>>2]=v[s+g>>2],f=f+4|0,c=c+4|0,l=l+4|0,u=u+4|0,n=n+4|0,(e=e+4|0)>>>0<m>>>0;);e=p+v[i>>2]<<2,v[h+v[t+288>>2]>>2]=v[e+v[S+1016>>2]>>2],v[h+v[t+292>>2]>>2]=v[e+v[S+1020>>2]>>2]}if(v[r+28>>2]&&!((0|(i=v[r+12>>2]))<1))for(i=(e=v[r+20>>2])+(i<<2)|0,n=v[t+192>>2]+(o<<2)|0;v[n>>2]=v[e>>2],n=n+4|0,(e=e+4|0)>>>0<i>>>0;);if(o=v[r+8>>2]+o|0,(0|d)==(0|(a=a+1|0)))break}if(!(y[S+4|0]<4||(0|(h=v[t+164>>2]))<1))for(p=v[S+824>>2],o=r=0;;){if(s=v[E(o,12)+w>>2],v[s+24>>2]&&!((0|(e=v[s+12>>2]))<1))for(d=(n=v[s+16>>2])+(e<<2)|0,_=v[p+(o<<2)>>2],u=(i=r<<2)+v[t+216>>2]|0,l=i+v[t+220>>2]|0,c=i+v[t+224>>2]|0,f=i+v[t+228>>2]|0,e=i+v[t+232>>2]|0,a=i+v[t+236>>2]|0,m=v[S+1308>>2],g=v[S+1304>>2],b=v[S+1300>>2],x=v[S+1296>>2],T=v[S+1292>>2],A=v[S+1288>>2];i=_+v[n>>2]<<2,v[u>>2]=v[i+A>>2],v[l>>2]=v[i+T>>2],v[c>>2]=v[i+x>>2],v[f>>2]=v[i+b>>2],v[e>>2]=v[i+g>>2],v[a>>2]=v[i+m>>2],a=a+4|0,e=e+4|0,f=f+4|0,c=c+4|0,l=l+4|0,u=u+4|0,(n=n+4|0)>>>0<d>>>0;);if(r=v[s+8>>2]+r|0,(0|h)==(0|(o=o+1|0)))break}}(t),function(t){var e,i=0,r=0,n=0,s=0,o=0,a=0,h=0,u=0;i=t- -64|0;if(_[v[1807]](i,v[t+88>>2],v[t+148>>2],v[t+144>>2]),_[v[1809]](i,v[t+92>>2],v[t+152>>2],v[v[t>>2]+796>>2],2,v[t+144>>2]),!(y[v[t>>2]+4|0]<4||(_[v[1807]](i,v[t+96>>2],v[t+120>>2],v[t+144>>2]),_[v[1807]](i,v[t+100>>2],v[t+124>>2],v[t+144>>2]),_[v[1807]](i,v[t+104>>2],v[t+128>>2],v[t+144>>2]),_[v[1807]](i,v[t+108>>2],v[t+132>>2],v[t+144>>2]),_[v[1807]](i,v[t+112>>2],v[t+136>>2],v[t+144>>2]),_[v[1807]](i,v[t+116>>2],v[t+140>>2],v[t+144>>2]),(0|(a=v[t+56>>2]))<1))){for(h=v[t+128>>2],u=v[t+124>>2],e=v[t+120>>2],r=v[t+156>>2],i=0;v[(n=s<<2)+r>>2]=v[(o=i<<2)+e>>2],v[r+(4|n)>>2]=v[o+u>>2],v[r+(8|n)>>2]=v[o+h>>2],s=s+4|0,(0|a)!=(0|(i=i+1|0)););for(r=v[t+160>>2],o=v[t+140>>2],h=v[t+136>>2],u=v[t+132>>2],i=t=0;v[(s=t<<2)+r>>2]=v[(n=i<<2)+u>>2],v[r+(4|s)>>2]=v[n+h>>2],v[r+(8|s)>>2]=v[n+o>>2],t=t+4|0,(0|a)!=(0|(i=i+1|0)););}}(t),function(t){var e,i=0,r=0,n=0,s=0,o=0,a=0,h=0,u=0;i=t+172|0;if(_[v[1807]](i,v[t+196>>2],v[t+268>>2],v[t+264>>2]),_[v[1807]](i,v[t+200>>2],v[t+284>>2],v[t+264>>2]),_[v[1807]](i,v[t+204>>2],v[t+276>>2],v[t+264>>2]),_[v[1807]](i,v[t+208>>2],v[t+280>>2],v[t+264>>2]),_[v[1807]](i,v[t+212>>2],v[t+272>>2],v[t+264>>2]),!(y[v[t>>2]+4|0]<4||(_[v[1807]](i,v[t+216>>2],v[t+240>>2],v[t+264>>2]),_[v[1807]](i,v[t+220>>2],v[t+244>>2],v[t+264>>2]),_[v[1807]](i,v[t+224>>2],v[t+248>>2],v[t+264>>2]),_[v[1807]](i,v[t+228>>2],v[t+252>>2],v[t+264>>2]),_[v[1807]](i,v[t+232>>2],v[t+256>>2],v[t+264>>2]),_[v[1807]](i,v[t+236>>2],v[t+260>>2],v[t+264>>2]),(0|(a=v[t+164>>2]))<1))){for(h=v[t+248>>2],u=v[t+244>>2],e=v[t+240>>2],r=v[t+296>>2],i=0;v[(n=s<<2)+r>>2]=v[(o=i<<2)+e>>2],v[r+(4|n)>>2]=v[o+u>>2],v[r+(8|n)>>2]=v[o+h>>2],s=s+4|0,(0|a)!=(0|(i=i+1|0)););for(r=v[t+300>>2],o=v[t+260>>2],h=v[t+256>>2],u=v[t+252>>2],i=t=0;v[(s=t<<2)+r>>2]=v[(n=i<<2)+u>>2],v[r+(4|s)>>2]=v[n+h>>2],v[r+(8|s)>>2]=v[n+o>>2],t=t+4|0,(0|a)!=(0|(i=i+1|0)););}}(t),function(t){var e,i,r,n=0,s=0,o=0;if(1<=(0|(s=v[t+332>>2])))for(e=(n=v[t+336>>2])+E(s,20)|0,i=v[t+312>>2],r=v[t+40>>2],t=v[t+424>>2];s=0,v[n+12>>2]&&(o=v[n+4>>2],v[(o<<2)+r>>2]||-1==(0|o))&&(o=v[n+8>>2],v[(o<<2)+i>>2]||-1==(0|o))&&(s=!v[v[n>>2]+32>>2]),v[t>>2]=s,t=t+4|0,(n=n+20|0)>>>0<e>>>0;);}(t),function(t){var e,i,r,n,s,o,a,h,u=0,l=0,c=0,f=0,d=0,p=0,_=0,m=0,g=0,b=0,x=0,T=0,A=0,w=0,S=0;f=v[t>>2];if(1<=(0|(b=v[t+332>>2]))){for(x=v[t+336>>2],T=v[f+1052>>2],A=v[f+856>>2];;){if(u=v[x+E(_,20)>>2],(v[u+28>>2]||v[u+24>>2])&&(v[(l=_<<2)+v[t+356>>2]>>2]=v[u+12>>2],v[u+24>>2])&&!((0|(d=v[u+12>>2]))<1))for(w=(c=v[u+16>>2])+(d<<2)|0,S=v[l+A>>2],l=(p=m<<2)+v[t+372>>2]|0,d=p+v[t+364>>2]|0,p=p+v[t+368>>2]|0;g=S+v[c>>2]<<2,v[l>>2]=T+(v[g+v[f+1040>>2]>>2]<<2),v[d>>2]=v[g+v[f+1032>>2]>>2],v[p>>2]=v[g+v[f+1036>>2]>>2],p=p+4|0,d=d+4|0,l=l+4|0,(c=c+4|0)>>>0<w>>>0;);if(v[u+28>>2]&&!((0|(l=v[u+12>>2]))<1))for(d=(c=v[u+20>>2])+(l<<2)|0,l=v[t+360>>2]+(m<<2)|0;v[l>>2]=v[c>>2],l=l+4|0,(c=c+4|0)>>>0<d>>>0;);if(m=v[u+8>>2]+m|0,(0|b)==(0|(_=_+1|0)))break}f=v[t>>2]}if(!(y[f+4|0]<4||(0|(A=v[t+332>>2]))<1))for(w=v[f+864>>2],S=v[t+336>>2],c=m=0;;){if(_=v[S+E(c,20)>>2],v[_+24>>2]&&!((0|(u=v[_+12>>2]))<1))for(e=(l=v[_+16>>2])+(u<<2)|0,i=v[w+(c<<2)>>2],d=(u=m<<2)+v[t+376>>2]|0,p=u+v[t+380>>2]|0,g=u+v[t+384>>2]|0,b=u+v[t+388>>2]|0,x=u+v[t+392>>2]|0,T=u+v[t+396>>2]|0,r=v[f+1308>>2],n=v[f+1304>>2],s=v[f+1300>>2],o=v[f+1296>>2],a=v[f+1292>>2],h=v[f+1288>>2];u=v[l>>2]+i<<2,v[d>>2]=v[u+h>>2],v[p>>2]=v[u+a>>2],v[g>>2]=v[u+o>>2],v[b>>2]=v[u+s>>2],v[x>>2]=v[u+n>>2],v[T>>2]=v[u+r>>2],T=T+4|0,x=x+4|0,b=b+4|0,g=g+4|0,p=p+4|0,d=d+4|0,(l=l+4|0)>>>0<e>>>0;);if(m=v[_+8>>2]+m|0,(0|A)==(0|(c=c+1|0)))break}}(t),function(t){var e,i=0,r=0,n=0,s=0,o=0,a=0,h=0,u=0;i=t+340|0;if(_[v[1807]](i,v[t+364>>2],v[t+448>>2],v[t+424>>2]),_[v[1808]](i,v[t+368>>2],v[t+440>>2],v[t+424>>2]),_[v[1809]](i,v[t+372>>2],v[t+444>>2],v[v[t>>2]+892>>2],2,v[t+424>>2]),!(y[v[t>>2]+4|0]<4||(_[v[1807]](i,v[t+376>>2],v[t+400>>2],v[t+424>>2]),_[v[1807]](i,v[t+380>>2],v[t+404>>2],v[t+424>>2]),_[v[1807]](i,v[t+384>>2],v[t+408>>2],v[t+424>>2]),_[v[1807]](i,v[t+388>>2],v[t+412>>2],v[t+424>>2]),_[v[1807]](i,v[t+392>>2],v[t+416>>2],v[t+424>>2]),_[v[1807]](i,v[t+396>>2],v[t+420>>2],v[t+424>>2]),(0|(a=v[t+332>>2]))<1))){for(h=v[t+408>>2],u=v[t+404>>2],e=v[t+400>>2],r=v[t+452>>2],i=0;v[(n=s<<2)+r>>2]=v[(o=i<<2)+e>>2],v[r+(4|n)>>2]=v[o+u>>2],v[r+(8|n)>>2]=v[o+h>>2],s=s+4|0,(0|a)!=(0|(i=i+1|0)););for(r=v[t+456>>2],o=v[t+420>>2],h=v[t+416>>2],u=v[t+412>>2],i=t=0;v[(s=t<<2)+r>>2]=v[(n=i<<2)+u>>2],v[r+(4|s)>>2]=v[n+h>>2],v[r+(8|s)>>2]=v[n+o>>2],t=t+4|0,(0|a)!=(0|(i=i+1|0)););}}(t),function(t){var e,i,r,n,s,o,a,h=0,u=0,l=0,c=0,f=0;if(1<=(0|(i=v[t+500>>2])))for(n=v[t+504>>2],r=v[t>>2],s=v[r+1252>>2];;){if(e=v[E(c,24)+n>>2],(v[e+28>>2]||v[e+24>>2])&&(v[(h=c<<2)+v[t+524>>2]>>2]=v[e+12>>2],v[e+24>>2])&&!((0|(l=v[e+12>>2]))<1))for(l=(u=v[e+16>>2])+(l<<2)|0,o=v[h+s>>2],h=v[t+532>>2]+(f<<2)|0,a=v[r+1284>>2];v[h>>2]=v[(v[u>>2]+o<<2)+a>>2],h=h+4|0,(u=u+4|0)>>>0<l>>>0;);if(v[e+28>>2]&&!((0|(h=v[e+12>>2]))<1))for(l=(u=v[e+20>>2])+(h<<2)|0,h=v[t+528>>2]+(f<<2)|0;v[h>>2]=v[u>>2],h=h+4|0,(u=u+4|0)>>>0<l>>>0;);if(f=v[e+8>>2]+f|0,(0|i)==(0|(c=c+1|0)))break}}(t),_[v[1807]](t+508|0,v[t+532>>2],v[t+536>>2],0),function(t){var e,i,r,n,s,o,a=w(0),h=0,u=0,l=0,c=0;if(w(0),D=e=D-16|0,l=v[t>>2],!(y[l+4|0]<5||(0|(c=v[t+596>>2]))<1))for(n=(u=v[t+600>>2])+E(c,12)|0,s=v[t+44>>2],c=v[l+976>>2];;){if(l=(v[u>>2]<<2)+s|0,a=w(v[l>>2]),1<=(0|(h=v[u+4>>2])))for(o=(t=v[u+8>>2])+E(h,48)|0;(h=v[t+8>>2])&&((i=h+-1|0)>>>0<=1?(h=v[t+4>>2],r=T[c+(h+v[t+12>>2]<<2)>>2],a=w(i-1?a+w(T[t+44>>2]*w(r*T[t+20>>2])):a+w(T[t+44>>2]*w(w(r*T[t+20>>2])+w(T[c+(h+v[t+16>>2]<<2)>>2]*T[t+24>>2]))))):(v[e>>2]=h,B(4,1024,e))),(t=t+48|0)>>>0<o>>>0;);if(a=(a=w(a+w(.0010000000474974513)))<w(0)?w(0):w(M(a,w(1e3))),t=w(S(a))<w(2147483648)?~~a:-2147483648,v[l>>2]=t,!((u=u+12|0)>>>0<n>>>0))break}D=16+e|0}(t),function(t){var e,i,r,s,o,h,u,f,d,p=0,_=0,m=0,g=0,b=0,x=w(0);if(D=e=D-16|0,p=v[t>>2],!(y[p+4|0]<4||(ut(t,v[t+604>>2],v[t+608>>2],v[p+984>>2],v[t+152>>2],v[p+796>>2]),_=v[t>>2],y[_+4|0]<5))){if(m=v[t+608>>2],o=v[_+992>>2],h=v[_+988>>2],1<=(0|(p=v[t+604>>2]))){for(u=E(p,12)+m|0,f=v[t+148>>2],i=v[_+980>>2];;){if(r=(v[m>>2]<<2)+f|0,b=v[r>>2],1<=(0|(g=v[m+4>>2])))for(d=(p=v[m+8>>2])+E(g,48)|0;(g=v[p+8>>2])&&((s=g+-1|0)>>>0<=1?(g=v[p+4>>2],x=T[(g+v[p+12>>2]<<2)+i>>2],l(w(s-1?w(T[p+44>>2]*w(x*T[p+20>>2]))+(a(0,b),c()):w(T[p+44>>2]*w(w(x*T[p+20>>2])+w(T[(g+v[p+16>>2]<<2)+i>>2]*T[p+24>>2])))+(a(0,b),c()))),b=n[0]):(v[e>>2]=g,B(4,1024,e))),(p=p+48|0)>>>0<d>>>0;);if(a(0,b),x=c(),T[r>>2]=x<w(0)?w(0):w(M(x,w(1))),!((m=m+12|0)>>>0<u>>>0))break}m=v[t+608>>2],p=v[t+604>>2]}z(p,m,h,v[_+1288>>2],v[_+1292>>2],v[_+1296>>2],v[t+156>>2]),z(v[t+604>>2],v[t+608>>2],o,v[_+1300>>2],v[_+1304>>2],v[_+1308>>2],v[t+160>>2])}D=16+e|0}(t),function(t){var e,i=0,r=0,s=0,o=0,h=0,u=w(0),f=0,d=0,p=0,_=0,m=0,g=0,b=0,x=0;if(D=e=D-80|0,h=v[t>>2],!(y[h+4|0]<5)){if(g=v[h+1028>>2],b=v[h+1024>>2],s=r=v[t+616>>2],!((0|(i=v[t+612>>2]))<1)){for(d=E(i,12)+r|0,p=v[t+276>>2],f=v[h+1004>>2];;){if(_=p+(v[r>>2]<<2)|0,s=v[_>>2],1<=(0|(o=v[r+4>>2])))for(x=(i=v[r+8>>2])+E(o,48)|0;(o=v[i+8>>2])&&((m=o+-1|0)>>>0<=1?(o=v[i+4>>2],u=T[f+(o+v[i+12>>2]<<2)>>2],l(w(m-1?w(T[i+44>>2]*w(u*T[i+20>>2]))+(a(0,s),c()):w(T[i+44>>2]*w(w(u*T[i+20>>2])+w(T[f+(o+v[i+16>>2]<<2)>>2]*T[i+24>>2])))+(a(0,s),c()))),s=n[0]):(v[64+e>>2]=o,B(4,1024,64+e|0))),(i=i+48|0)>>>0<x>>>0;);if(v[_>>2]=s,!((r=r+12|0)>>>0<d>>>0))break}if(s=r=v[t+616>>2],!((0|(i=v[t+612>>2]))<1)){for(d=E(i,12)+r|0,p=v[t+280>>2],f=v[v[t>>2]+1008>>2];;){if(_=p+(v[r>>2]<<2)|0,s=v[_>>2],1<=(0|(o=v[r+4>>2])))for(x=(i=v[r+8>>2])+E(o,48)|0;(o=v[i+8>>2])&&((m=o+-1|0)>>>0<=1?(o=v[i+4>>2],u=T[f+(o+v[i+12>>2]<<2)>>2],l(w(m-1?w(T[i+44>>2]*w(u*T[i+20>>2]))+(a(0,s),c()):w(T[i+44>>2]*w(w(u*T[i+20>>2])+w(T[f+(o+v[i+16>>2]<<2)>>2]*T[i+24>>2])))+(a(0,s),c()))),s=n[0]):(v[48+e>>2]=o,B(4,1024,48+e|0))),(i=i+48|0)>>>0<x>>>0;);if(v[_>>2]=s,!((r=r+12|0)>>>0<d>>>0))break}if(s=r=v[t+616>>2],!((0|(i=v[t+612>>2]))<1)){for(d=E(i,12)+r|0,p=v[t+268>>2],f=v[v[t>>2]+996>>2];;){if(_=p+(v[r>>2]<<2)|0,s=v[_>>2],1<=(0|(o=v[r+4>>2])))for(x=(i=v[r+8>>2])+E(o,48)|0;(o=v[i+8>>2])&&((m=o+-1|0)>>>0<=1?(o=v[i+4>>2],u=T[f+(o+v[i+12>>2]<<2)>>2],l(w(m-1?w(T[i+44>>2]*w(u*T[i+20>>2]))+(a(0,s),c()):w(T[i+44>>2]*w(w(u*T[i+20>>2])+w(T[f+(o+v[i+16>>2]<<2)>>2]*T[i+24>>2])))+(a(0,s),c()))),s=n[0]):(v[32+e>>2]=o,B(4,1024,32+e|0))),(i=i+48|0)>>>0<x>>>0;);if(a(0,s),u=c(),T[_>>2]=u<w(0)?w(0):w(M(u,w(1))),!((r=r+12|0)>>>0<d>>>0))break}i=v[t+612>>2],s=v[t+616>>2]}}}if(z(i,s,b,v[h+1288>>2],v[h+1292>>2],v[h+1296>>2],v[t+296>>2]),z(v[t+612>>2],v[t+616>>2],g,v[h+1300>>2],v[h+1304>>2],v[h+1308>>2],v[t+300>>2]),!((0|(i=v[t+612>>2]))<1)){for(o=(r=v[t+616>>2])+E(i,12)|0,g=v[t+284>>2],h=v[v[t>>2]+1e3>>2];;){if(b=g+(v[r>>2]<<2)|0,s=v[b>>2],1<=(0|(f=v[r+4>>2])))for(d=(i=v[r+8>>2])+E(f,48)|0;(f=v[i+8>>2])&&((p=f+-1|0)>>>0<=1?(f=v[i+4>>2],u=T[h+(f+v[i+12>>2]<<2)>>2],l(w(p-1?w(T[i+44>>2]*w(u*T[i+20>>2]))+(a(0,s),c()):w(T[i+44>>2]*w(w(u*T[i+20>>2])+w(T[h+(f+v[i+16>>2]<<2)>>2]*T[i+24>>2])))+(a(0,s),c()))),s=n[0]):(v[16+e>>2]=f,B(4,1024,16+e|0))),(i=i+48|0)>>>0<d>>>0;);if(a(0,s),u=c(),T[b>>2]=u<w(-3600)?w(-3600):w(M(u,w(3600))),!((r=r+12|0)>>>0<o>>>0))break}if(!((0|(i=v[t+612>>2]))<1))for(f=(r=v[t+616>>2])+E(i,12)|0,o=v[t+272>>2],t=v[v[t>>2]+1012>>2];;){if(g=o+(v[r>>2]<<2)|0,s=v[g>>2],1<=(0|(h=v[r+4>>2])))for(b=(i=v[r+8>>2])+E(h,48)|0;(h=v[i+8>>2])&&((d=h+-1|0)>>>0<=1?(h=v[i+4>>2],u=T[t+(h+v[i+12>>2]<<2)>>2],l(w(d-1?w(T[i+44>>2]*w(u*T[i+20>>2]))+(a(0,s),c()):w(T[i+44>>2]*w(w(u*T[i+20>>2])+w(T[t+(h+v[i+16>>2]<<2)>>2]*T[i+24>>2])))+(a(0,s),c()))),s=n[0]):(v[e>>2]=h,B(4,1024,e))),(i=i+48|0)>>>0<b>>>0;);if(a(0,s),u=c(),T[g>>2]=u<w(9999999747378752e-20)?w(9999999747378752e-20):w(M(u,w(100))),!((r=r+12|0)>>>0<f>>>0))break}}}D=80+e|0}(t),function(t){var e,i,r,s,o,h=0,u=0,f=0,d=0,p=w(0),_=0,m=0,g=0,b=0,x=0,A=0;if(w(0),D=e=D-32|0,f=v[t>>2],!(y[f+4|0]<4||(ut(t,v[t+620>>2],v[t+624>>2],v[f+1040>>2],v[t+444>>2],v[f+892>>2]),_=v[t>>2],y[_+4|0]<5))){if(s=v[_+1048>>2],o=v[_+1044>>2],f=d=v[t+624>>2],!((0|(h=v[t+620>>2]))<1)){for(x=E(h,12)+d|0,A=v[t+440>>2],m=v[_+1036>>2];;){if(f=A+(v[d>>2]<<2)|0,p=w(v[f>>2]),1<=(0|(u=v[d+4>>2])))for(g=(h=v[d+8>>2])+E(u,48)|0;(u=v[h+8>>2])&&((b=u+-1|0)>>>0<=1?(u=v[h+4>>2],i=T[m+(u+v[h+12>>2]<<2)>>2],p=w(b-1?p+w(T[h+44>>2]*w(i*T[h+20>>2])):p+w(T[h+44>>2]*w(w(i*T[h+20>>2])+w(T[m+(u+v[h+16>>2]<<2)>>2]*T[h+24>>2]))))):(v[16+e>>2]=u,B(4,1024,16+e|0))),(h=h+48|0)>>>0<g>>>0;);if(p=(p=w(p+w(.0010000000474974513)))<w(0)?w(0):w(M(p,w(1e3))),h=w(S(p))<w(2147483648)?~~p:-2147483648,v[f>>2]=h,!((d=d+12|0)>>>0<x>>>0))break}if(f=d=v[t+624>>2],!((0|(h=v[t+620>>2]))<1)){for(x=E(h,12)+d|0,A=v[t+448>>2],m=v[v[t>>2]+1032>>2];;){if(g=A+(v[d>>2]<<2)|0,f=v[g>>2],1<=(0|(u=v[d+4>>2])))for(b=(h=v[d+8>>2])+E(u,48)|0;(u=v[h+8>>2])&&((r=u+-1|0)>>>0<=1?(u=v[h+4>>2],p=T[m+(u+v[h+12>>2]<<2)>>2],l(w(r-1?w(T[h+44>>2]*w(p*T[h+20>>2]))+(a(0,f),c()):w(T[h+44>>2]*w(w(p*T[h+20>>2])+w(T[m+(u+v[h+16>>2]<<2)>>2]*T[h+24>>2])))+(a(0,f),c()))),f=n[0]):(v[e>>2]=u,B(4,1024,e))),(h=h+48|0)>>>0<b>>>0;);if(a(0,f),p=c(),T[g>>2]=p<w(0)?w(0):w(M(p,w(1))),!((d=d+12|0)>>>0<x>>>0))break}h=v[t+620>>2],f=v[t+624>>2]}}z(h,f,o,v[_+1288>>2],v[_+1292>>2],v[_+1296>>2],v[t+452>>2]),z(v[t+620>>2],v[t+624>>2],s,v[_+1300>>2],v[_+1304>>2],v[_+1308>>2],v[t+456>>2])}D=32+e|0}(t),function(t){var e,i,r,s,o,h,u=0,f=0,d=0,p=0,_=w(0);if(D=e=D-16|0,f=v[t>>2],!(y[f+4|0]<5||(0|(p=v[t+628>>2]))<1))for(s=(d=v[t+632>>2])+E(p,12)|0,o=v[t+536>>2],p=v[f+1284>>2];;){if(i=(v[d>>2]<<2)+o|0,f=v[i>>2],1<=(0|(u=v[d+4>>2])))for(h=(t=v[d+8>>2])+E(u,48)|0;(u=v[t+8>>2])&&((r=u+-1|0)>>>0<=1?(u=v[t+4>>2],_=T[p+(u+v[t+12>>2]<<2)>>2],l(w(r-1?w(T[t+44>>2]*w(_*T[t+20>>2]))+(a(0,f),c()):w(T[t+44>>2]*w(w(_*T[t+20>>2])+w(T[p+(u+v[t+16>>2]<<2)>>2]*T[t+24>>2])))+(a(0,f),c()))),f=n[0]):(v[e>>2]=u,B(4,1024,e))),(t=t+48|0)>>>0<h>>>0;);if(a(0,f),_=c(),T[i>>2]=_<w(0)?w(0):w(M(_,w(1))),!((d=d+12|0)>>>0<s>>>0))break}D=16+e|0}(t),function(t){var e,i,r=0,n=0,s=0,o=w(0),a=0;if(1<=(0|(r=v[t+4>>2])))for(i=(n=v[t+8>>2])+E(r,12)|0,r=v[t+40>>2],s=v[t+52>>2],t=e=v[t+48>>2];v[r>>2]&&(o=T[s>>2],T[t>>2]=o,-1!=(0|(a=v[n+4>>2])))&&(T[t>>2]=o*T[(a<<2)+e>>2]),t=t+4|0,s=s+4|0,r=r+4|0,(n=n+12|0)>>>0<i>>>0;);}(t),function(t){var e,i=0,r=0,n=0;if(1<=(0|(e=v[t+304>>2])))for(i=v[t+308>>2],r=v[t+312>>2];v[r>>2]&&_[v[i+20>>2]](t,n),r=r+4|0,i=i+32|0,(0|e)!=(0|(n=n+1|0)););}(t),function(t){var e,i,r,n,s,o=0,a=0,h=(w(0),w(0),0),u=0,l=0,c=(w(0),0),f=0,d=0;if(1<=(0|(o=v[t+332>>2])))for(f=(a=v[t+336>>2])+E(o,20)|0,d=v[t+308>>2],c=v[t+316>>2],s=v[t+48>>2],o=v[t+448>>2],h=v[t+444>>2],l=v[t+424>>2];v[l>>2]&&(-1!=(0|(u=v[a+4>>2]))&&(T[o>>2]=T[(u<<2)+s>>2]*T[o>>2]),-1!=(0|(u=v[a+8>>2])))&&(T[o>>2]=T[c+(u<<2)>>2]*T[o>>2],n=v[h>>2],_[v[24+(d+(u<<5)|0)>>2]](t,u,n,n,v[a+16>>2])),h=h+4|0,o=o+4|0,l=l+4|0,(a=a+20|0)>>>0<f>>>0;);if(!(y[v[t>>2]+4|0]<4||(0|(o=v[t+332>>2]))<1))for(u=(h=v[t+336>>2])+E(o,20)|0,f=v[t+328>>2],d=v[t+324>>2],a=v[t+452>>2],o=v[t+456>>2],l=v[t+424>>2];v[l>>2]&&-1!=(0|(t=v[h+8>>2]))&&(t=(c=t<<4)+d|0,e=w(T[a>>2]*T[t>>2]),T[a>>2]=e,i=w(T[a+4>>2]*T[t+4>>2]),T[a+4>>2]=i,r=T[t+8>>2],v[a+12>>2]=1065353216,T[a+4>>2]=i<w(0)?w(0):w(M(i,w(1))),T[a>>2]=e<w(0)?w(0):w(M(e,w(1))),e=w(r*T[a+8>>2]),T[a+8>>2]=e<w(0)?w(0):w(M(e,w(1))),e=T[o>>2],i=T[(t=f+c|0)>>2],e=w(w(e+i)-w(e*i)),T[o>>2]=e,i=T[o+4>>2],r=T[t+4>>2],i=w(w(i+r)-w(i*r)),T[o+4>>2]=i,r=T[t+8>>2],v[o+12>>2]=1065353216,T[o+4>>2]=i<w(0)?w(0):w(M(i,w(1))),T[o>>2]=e<w(0)?w(0):w(M(e,w(1))),e=T[o+8>>2],e=w(w(r+e)-w(e*r)),T[o+8>>2]=e<w(0)?w(0):w(M(e,w(1)))),o=o+16|0,a=a+16|0,l=l+4|0,(h=h+20|0)>>>0<u>>>0;);}(t),function(t){var e,i,r,n,s,o,a,h,u,l,c,f,d,p,_,m,g,y,x,A,S=0;if(w(0),w(0),w(0),w(0),w(0),w(0),w(0),1<=(0|(h=v[t+500>>2])))for(x=v[t+536>>2],u=v[t+444>>2],A=v[t+504>>2];;){if(t=E(S,24)+A|0,0<(0|(l=v[t+12>>2])))for(r=T[(S<<2)+x>>2],c=v[t+20>>2],f=v[t+16>>2],d=v[(v[t+4>>2]<<2)+u>>2],p=v[(v[t+8>>2]<<2)+u>>2],t=0;_=T[((e=1|t)<<2)+f>>2],i=b[(t<<1)+c>>1]<<3&262136,n=T[(m=(4|i)+d|0)>>2],e=b[(e<<1)+c>>1]<<3&262136,s=T[(g=(4|e)+p|0)>>2],o=T[(i=i+d|0)>>2],y=T[(t<<2)+f>>2],a=T[(e=e+p|0)>>2],T[i>>2]=o+w(r*w(y*w(a-o))),T[m>>2]=n+w(r*w(y*w(s-n))),T[e>>2]=a+w(r*w(_*w(o-a))),T[g>>2]=s+w(r*w(_*w(n-s))),(0|(t=t+2|0))<(0|l););if(!((0|(S=S+1|0))<(0|h)))break}}(t),_[v[1810]](t),function(t){var e,i,r,n,s=0,o=0,a=0,h=0,u=0,l=0,c=0,f=0,d=0,p=0,_=0;if(!((0|(e=v[t+480>>2]))<1)){for(h=(i=v[t+484>>2])+E(e,28)|0,c=v[t+424>>2],f=v[t+40>>2],u=v[t+44>>2],_=v[t+440>>2],s=i;;){if(1<=(0|(l=v[s+4>>2])))for(p=s+20|0,d=v[s+12>>2],o=0;r=v[4+(a=d+(o<<4)|0)>>2]<<2,a=1==v[(n=a)>>2],v[n+12>>2]=v[(v[(a?f:c)+r>>2]?(a?u:_)+r:p)>>2],(0|(o=o+1|0))<(0|l););if(!((s=s+28|0)>>>0<h>>>0))break}if(!((0|e)<1))for(_=v[t+436>>2],f=0;;){if(h=E(f,28)+i|0,!(v[(c=h)+24>>2]<1)){for(a=v[t+488>>2],o=0;v[a+(o<<2)>>2]=-1,(0|(o=o+1|0))<(0|(s=v[c+24>>2])););if(!((0|s)<1))for(s=v[t+496>>2],o=0;v[s+(o<<2)>>2]=-1,(0|(o=o+1|0))<v[c+24>>2];);}if(!(v[h+4>>2]<1)){for(u=v[t+492>>2],o=0;v[u+(o<<2)>>2]=-1,(0|(o=o+1|0))<(0|(s=v[h+4>>2])););if(!((0|s)<1))for(l=v[h+12>>2],p=v[t+496>>2],o=0;d=v[12+(l+(o<<4)|0)>>2]-v[h+20>>2]<<2,s=-1==(0|(s=v[(a=d+p|0)>>2]))?d+v[t+488>>2]|0:u+(s<<2)|0,v[s>>2]=o,(0|(o=(v[a>>2]=o)+1|0))<v[h+4>>2];);}if(1<=(0|(s=v[c+24>>2])))for(u=v[h+8>>2],p=v[t+488>>2],l=0;;){if(-1!=(0|(o=v[p+(l<<2)>>2]))){for(d=v[t+492>>2],a=v[h+12>>2];u=(s=1==v[(s=a+(o<<4)|0)>>2]?(s=E(v[s+8>>2],28)+i|0,v[s+8>>2]=u,v[s>>2]):(v[_+(v[s+4>>2]<<2)>>2]=u,1))+u|0,(0|o)<(0|(s=v[d+(o<<2)>>2]))&&-1!=(0|(o=s)););s=v[c+24>>2]}if(!((0|(l=l+1|0))<(0|s)))break}if((0|e)==(0|(f=f+1|0)))break}}}(t),function(t){var e=0,i=0,r=0,n=0,s=0,o=w(0),a=0,h=0,u=v[t+332>>2];if(v[t+644>>2]){if(!(((v[t+428>>2]=0)|u)<1))for(;e=126,a=v[t+432>>2]+r|0,!v[(i=r<<2)+v[t+424>>2]>>2]|T[i+v[t+448>>2]>>2]==w(0)||(e=127),m[0|a]=e,(0|u)!=(0|(r=r+1|0)););}else if(v[t+428>>2]){if(e=y[v[t>>2]+4|0],!(((v[t+428>>2]=0)|u)<1))if(4<=e>>>0)for(;o=T[(e=r<<2)+v[t+448>>2]>>2],n=v[e+v[t+424>>2]>>2],i=o!=w(0)&!!(0|n),a=v[t+432>>2]+r|0,i=(0|i)==(1&m[0|a])?i:2|i,i=o!=T[e+v[t+468>>2]>>2]?4|i:i,i=v[e+v[t+440>>2]>>2]==v[e+v[t+464>>2]>>2]?i:8|i,e=v[e+v[t+436>>2]>>2]==v[e+v[t+460>>2]>>2]?i:16|i,e=n?32|e:e,n=(i=h<<2)+v[t+452>>2]|0,s=i+v[t+472>>2]|0,(T[n>>2]!=T[s>>2]|T[n+4>>2]!=T[s+4>>2]|T[n+8>>2]!=T[s+8>>2]|T[n+12>>2]!=T[s+12>>2]||(n=i+v[t+456>>2]|0,i=i+v[t+476>>2]|0,T[n>>2]!=T[i>>2]|T[n+4>>2]!=T[i+4>>2]|T[n+8>>2]!=T[i+8>>2])||T[n+12>>2]!=T[i+12>>2])&&(e|=64),m[0|a]=e,h=h+4|0,(0|u)!=(0|(r=r+1|0)););else for(;o=T[(e=r<<2)+v[t+448>>2]>>2],n=v[e+v[t+424>>2]>>2],i=o!=w(0)&!!(0|n),s=v[t+432>>2]+r|0,i=(0|i)==(1&m[0|s])?i:2|i,i=o!=T[e+v[t+468>>2]>>2]?4|i:i,i=v[e+v[t+440>>2]>>2]==v[e+v[t+464>>2]>>2]?i:8|i,e=v[e+v[t+436>>2]>>2]==v[e+v[t+460>>2]>>2]?i:16|i,m[0|s]=n?32|e:e,(0|u)!=(0|(r=r+1|0)););}else if(!((0|u)<1))for(;!v[(e=r<<2)+v[t+424>>2]>>2]|T[e+v[t+448>>2]>>2]==w(0)?(e=v[t+432>>2]+r|0,m[0|e]=254&y[0|e]):(e=v[t+432>>2]+r|0,m[0|e]=1|y[0|e]),(0|u)!=(0|(r=r+1|0)););}(t),v[t+644>>2]=0}function ut(t,e,i,r,n,s){var o,a,h,u,l,c,f,d=0,p=0,_=0,m=0;if(D=c=D-32|0,1<=(0|e))for(l=E(e,12)+i|0;;){if(!((0|(d=v[i+4>>2]))<1))if(o=(e=v[i+8>>2])+E(d,48)|0,d=v[i>>2]<<2,1<=(0|(f=v[d+s>>2])))for(f<<=1,a=v[v[t>>2]+1052>>2],h=v[n+d>>2];;){t:if(d=v[e+8>>2]){e:{if((p=d+-1|0)>>>0<=1){if(d=(v[e+4>>2]<<2)+r|0,m=(v[d+(v[e+12>>2]<<2)>>2]<<2)+a|0,p-1)break e;for(_=(v[d+(v[e+16>>2]<<2)>>2]<<2)+a|0,d=0;T[(u=(p=d<<2)+h|0)>>2]=T[u>>2]+w(T[e+44>>2]*w(w(T[p+m>>2]*T[e+20>>2])+w(T[p+_>>2]*T[e+24>>2]))),(0|f)!=(0|(d=d+1|0)););break t}v[c>>2]=d,B(4,1024,c);break t}for(d=0;T[(_=(p=d<<2)+h|0)>>2]=T[_>>2]+w(T[e+44>>2]*w(T[p+m>>2]*T[e+20>>2])),(0|f)!=(0|(d=d+1|0)););}if(!((e=e+48|0)>>>0<o>>>0))break}else for(;3<=(d=v[e+8>>2])>>>0&&(v[16+c>>2]=d,B(4,1024,16+c|0)),(e=e+48|0)>>>0<o>>>0;);if(!((i=i+12|0)>>>0<l>>>0))break}D=32+c|0}function lt(t,e,i){var r;e|=0,i|=0,D=r=D+-64|0;t:{if(t|=0)if(e)if((e+15&-16)!=(0|e))v[52+r>>2]=1522,v[48+r>>2]=2361,B(4,1294,48+r|0);else{if(e=function(t,e,i){var r,n=0,s=0,o=0,a=0,h=0,u=0,l=0,c=0,f=0,d=0,p=0,_=0,g=0,b=w(0),A=0,S=0,P=0,M=0,I=0;if(H(16+(D=r=D-576|0)|0,0,560),yt(t,16+r|0,12+r|0),(a=v[12+r>>2])>>>0<=i>>>0){if(n=(s=H(e,0,a))+v[16+r>>2]|0,v[n+8>>2]=s+v[20+r>>2],v[n+40>>2]=s+v[24+r>>2],v[n+44>>2]=s+v[28+r>>2],v[n+48>>2]=s+v[32+r>>2],v[n+52>>2]=s+v[36+r>>2],v[n+16>>2]=s+v[40+r>>2],v[n+24>>2]=s+v[44+r>>2],v[n+28>>2]=s+v[48+r>>2],v[n+32>>2]=s+v[52+r>>2],v[n+36>>2]=s+v[56+r>>2],e=v[t+704>>2],v[n+308>>2]=s+v[60+r>>2],v[n+312>>2]=s+v[64+r>>2],v[n+316>>2]=s+v[68+r>>2],v[n+320>>2]=s+v[72+r>>2],v[n+324>>2]=s+v[76+r>>2],v[n+328>>2]=s+v[80+r>>2],v[n+60>>2]=s+v[84+r>>2],v[n+144>>2]=s+v[88+r>>2],v[n+148>>2]=s+v[92+r>>2],i=s+v[96+r>>2]|0,v[n+152>>2]=i,!((0|(a=v[e+8>>2]))<1)&&(e=s+v[100+r>>2]|0,v[i>>2]=e,1!=(0|a)))for(i=1;e=(15+(v[v[t+796>>2]+(o<<2)>>2]<<3)&-16)+e|0,v[v[n+152>>2]+(i<<2)>>2]=e,(0|a)!=(0|(i=(o=i)+1|0)););if(v[n+156>>2]=s+v[104+r>>2],v[n+160>>2]=s+v[108+r>>2],v[n+68>>2]=s+v[112+r>>2],v[n+76>>2]=s+v[116+r>>2],v[n+80>>2]=s+v[120+r>>2],v[n+84>>2]=s+v[124+r>>2],v[n+88>>2]=s+v[128+r>>2],v[n+92>>2]=s+v[132+r>>2],v[n+96>>2]=s+v[136+r>>2],v[n+100>>2]=s+v[140+r>>2],v[n+104>>2]=s+v[144+r>>2],v[n+108>>2]=s+v[148+r>>2],v[n+112>>2]=s+v[152+r>>2],v[n+116>>2]=s+v[156+r>>2],v[n+120>>2]=s+v[160+r>>2],v[n+124>>2]=s+v[164+r>>2],v[n+128>>2]=s+v[168+r>>2],v[n+132>>2]=s+v[172+r>>2],v[n+136>>2]=s+v[176+r>>2],v[n+140>>2]=s+v[180+r>>2],v[n+168>>2]=s+v[184+r>>2],v[n+264>>2]=s+v[188+r>>2],v[n+268>>2]=s+v[192+r>>2],v[n+272>>2]=s+v[196+r>>2],v[n+276>>2]=s+v[200+r>>2],v[n+280>>2]=s+v[204+r>>2],v[n+284>>2]=s+v[208+r>>2],v[n+288>>2]=s+v[212+r>>2],v[n+292>>2]=s+v[216+r>>2],v[n+296>>2]=s+v[220+r>>2],v[n+300>>2]=s+v[224+r>>2],v[n+176>>2]=s+v[228+r>>2],v[n+184>>2]=s+v[232+r>>2],v[n+188>>2]=s+v[236+r>>2],v[n+192>>2]=s+v[240+r>>2],v[n+196>>2]=s+v[244+r>>2],v[n+200>>2]=s+v[248+r>>2],v[n+204>>2]=s+v[252+r>>2],v[n+208>>2]=s+v[256+r>>2],v[n+212>>2]=s+v[260+r>>2],v[n+216>>2]=s+v[264+r>>2],v[n+220>>2]=s+v[268+r>>2],v[n+224>>2]=s+v[272+r>>2],v[n+228>>2]=s+v[276+r>>2],v[n+232>>2]=s+v[280+r>>2],v[n+236>>2]=s+v[284+r>>2],v[n+240>>2]=s+v[288+r>>2],v[n+244>>2]=s+v[292+r>>2],v[n+248>>2]=s+v[296+r>>2],v[n+252>>2]=s+v[300+r>>2],v[n+256>>2]=s+v[304+r>>2],v[n+260>>2]=s+v[308+r>>2],e=v[t+704>>2],v[n+336>>2]=s+v[312+r>>2],v[n+424>>2]=s+v[316+r>>2],v[n+432>>2]=s+v[320+r>>2],v[n+436>>2]=s+v[324+r>>2],v[n+440>>2]=s+v[328+r>>2],i=s+v[332+r>>2]|0,v[n+444>>2]=i,!((0|(a=v[e+16>>2]))<1)&&(o=s+v[336+r>>2]|0,v[i>>2]=o,(i=1)!=(0|a)))for(e=0;o=(15+(v[v[t+892>>2]+(e<<2)>>2]<<3)&-16)+o|0,v[v[n+444>>2]+(i<<2)>>2]=o,(0|a)!=(0|(i=(e=i)+1|0)););if(v[n+448>>2]=s+v[340+r>>2],v[n+452>>2]=s+v[344+r>>2],v[n+456>>2]=s+v[348+r>>2],v[n+460>>2]=s+v[352+r>>2],v[n+464>>2]=s+v[356+r>>2],v[n+468>>2]=s+v[360+r>>2],v[n+472>>2]=s+v[364+r>>2],v[n+476>>2]=s+v[368+r>>2],v[n+344>>2]=s+v[372+r>>2],v[n+352>>2]=s+v[376+r>>2],v[n+356>>2]=s+v[380+r>>2],v[n+360>>2]=s+v[384+r>>2],v[n+364>>2]=s+v[388+r>>2],v[n+368>>2]=s+v[392+r>>2],v[n+372>>2]=s+v[396+r>>2],v[n+376>>2]=s+v[400+r>>2],v[n+380>>2]=s+v[404+r>>2],v[n+384>>2]=s+v[408+r>>2],v[n+388>>2]=s+v[412+r>>2],v[n+392>>2]=s+v[416+r>>2],v[n+396>>2]=s+v[420+r>>2],v[n+400>>2]=s+v[424+r>>2],v[n+404>>2]=s+v[428+r>>2],v[n+408>>2]=s+v[432+r>>2],v[n+412>>2]=s+v[436+r>>2],v[n+416>>2]=s+v[440+r>>2],v[n+420>>2]=s+v[444+r>>2],e=v[448+r>>2],i=v[452+r>>2],v[n+552>>2]=s+v[456+r>>2],v[n+548>>2]=i+s,v[n+544>>2]=e+s,v[n+560>>2]=s+v[460+r>>2],e=v[t+704>>2],l=s+v[464+r>>2]|0,v[n+568>>2]=l,1<=(0|(u=v[e+48>>2])))for(o=s+v[468+r>>2]|0,e=s+v[472+r>>2]|0,h=s+v[476+r>>2]|0,c=v[t+1072>>2],i=0;a=l+E(i,36)|0,v[a+20>>2]=h,v[a+16>>2]=e,v[a>>2]=o,o=((a=v[c+(i<<2)>>2])<<2)+o|0,h=(a=1<<a<<2)+h|0,e=e+a|0,(0|u)!=(0|(i=i+1|0)););if(e=v[t+704>>2],a=s+v[516+r>>2]|0,v[n+484>>2]=a,1<=(0|(e=v[e+72>>2])))for(o=s+v[520+r>>2]|0,h=v[t+1212>>2],i=0;v[12+(a+E(i,28)|0)>>2]=o,o=(v[h+(i<<2)>>2]<<4)+o|0,(0|e)!=(0|(i=i+1|0)););v[n+488>>2]=s+v[524+r>>2],v[n+492>>2]=s+v[528+r>>2],v[n+496>>2]=s+v[532+r>>2],v[n+504>>2]=s+v[536+r>>2],v[n+536>>2]=s+v[540+r>>2],v[n+512>>2]=s+v[544+r>>2],v[n+520>>2]=s+v[548+r>>2],v[n+524>>2]=s+v[552+r>>2],v[n+528>>2]=s+v[556+r>>2],v[n+532>>2]=s+v[560+r>>2];e:{if(4<=(u=y[t+4|0])>>>0){if(v[n+576>>2]=s+v[480+r>>2],v[n+584>>2]=s+v[484+r>>2],e=v[t+704>>2],i=v[492+r>>2],a=s+v[488+r>>2]|0,v[n+592>>2]=a,1<=(0|(e=v[e+104>>2])))for(o=i+s|0,h=v[t+1104>>2],i=0;v[40+(a+E(i,48)|0)>>2]=o,o=(v[h+(i<<2)>>2]<<2)+o|0,(0|e)!=(0|(i=i+1|0)););v[n+608>>2]=s+v[500+r>>2],v[n+624>>2]=s+v[508+r>>2]}else{if(e=v[572+r>>2],i=v[568+r>>2],v[n+636>>2]=s+v[564+r>>2],v[n+640>>2]=i+s,v[v[t+704>>2]+20>>2]<1)break e;for(a=e+s|0,l=0;;){i:{if((0|(o=v[(e=l<<2)+v[t+952>>2]>>2]))<=0)e=e+v[n+636>>2]|0;else{for(h=o+(i=v[e+v[t+948>>2]>>2])|0,c=v[t+1060>>2],o=0;o=v[c+(i<<2)>>2]+o|0,(0|(i=i+1|0))<(0|h););if(e=e+v[n+636>>2]|0,i=a,o)break i}i=o=0}if(v[e>>2]=i,a=(o<<2)+a|0,!((0|(l=l+1|0))<v[v[t+704>>2]+20>>2]))break}}u>>>0<5||(v[n+600>>2]=s+v[496+r>>2],v[n+616>>2]=s+v[504+r>>2],v[n+632>>2]=s+v[512+r>>2])}v[n+644>>2]=1,v[n>>2]=t,v[n+648>>2]=1&m[v[t+708>>2]+20|0],s=v[t+704>>2],l=v[s+20>>2];e:if(!((0|(v[n+540>>2]=l))<1)){if(e=l+-1|0,c=v[t+952>>2],f=v[t+940>>2],d=v[t+932>>2],p=v[t+936>>2],_=v[t+924>>2],g=v[t+928>>2],A=v[n+552>>2],P=v[n+544>>2],u>>>0<4)for(;;)if(i=P+E(e,52)|0,o=(a=e<<2)+g|(v[i>>2]=0),v[i+4>>2]=v[o>>2],v[i+8>>2]=v[(h=a+_|0)>>2],T[i+12>>2]=T[h>>2]-T[o>>2],v[i+16>>2]=v[a+p>>2],v[i+44>>2]=v[(o=a+d|0)>>2],b=pt(w(v[a+f>>2])),T[i+20>>2]=b,T[i+24>>2]=b*w(1.5),S=v[a+c>>2],h=0,h=(v[i+32>>2]=S)?v[n+560>>2]+E(v[a+v[t+948>>2]>>2],28)|0:h,v[i+48>>2]=1,v[i+28>>2]=h,v[a+A>>2]=v[o>>2],i=0<(0|e),e=e+-1|0,!i)break e;for(S=v[t+960>>2],I=v[t+944>>2];i=P+E(e,52)|0,v[i>>2]=v[(o=e<<2)+I>>2],v[i+4>>2]=v[(a=o+g|0)>>2],v[i+8>>2]=v[(h=o+_|0)>>2],T[i+12>>2]=T[h>>2]-T[a>>2],v[i+16>>2]=v[o+p>>2],v[i+44>>2]=v[(M=o+d|0)>>2],b=pt(w(v[o+f>>2])),T[i+20>>2]=b,T[i+24>>2]=b*w(1.5),h=v[o+c>>2],v[i+32>>2]=h,v[i+28>>2]=h?v[n+560>>2]+E(v[o+v[t+948>>2]>>2],28)|0:0,a=v[o+S>>2],a=(v[i+40>>2]=a)?v[n+584>>2]+E(v[o+v[t+956>>2]>>2],28)|0:0,v[i+48>>2]=1,v[i+36>>2]=a,v[o+A>>2]=v[M>>2],i=0<(0|e),e=e+-1|0,i;);}if(4<=u>>>0?(v[n+548>>2]=v[t+944>>2],a=t):(H(v[n+548>>2],0,l<<2),a=v[n>>2],s=v[a+704>>2]),o=v[s+52>>2],1<=(0|(v[n+556>>2]=o)))for(i=v[a+1056>>2],h=v[a+1192>>2],l=v[a+1060>>2],u=v[n+560>>2];e=u+E(o=o+-1|0,28)|0,v[e>>2]=v[(c=o<<2)+l>>2],c=v[i+c>>2],v[e+24>>2]=1,v[e+16>>2]=0,v[e+20>>2]=1,v[e+8>>2]=0,v[e+12>>2]=0,v[e+4>>2]=h+(c<<2),0<(0|o););if(o=v[s+48>>2],1<=(0|(v[n+564>>2]=o))){for(;;){if(e=v[n+568>>2]+E(o=o+-1|0,36)|0,h=v[(s=o<<2)+v[a+1072>>2]>>2],1<=(0|(v[e+4>>2]=h)))for(i=0;v[v[e>>2]+(i<<2)>>2]=v[n+560>>2]+E(v[v[a+1064>>2]+(v[s+v[a+1068>>2]>>2]+i<<2)>>2],28),(0|h)!=(0|(i=i+1|0)););if(v[e+24>>2]=1,v[e+28>>2]=1,v[e+8>>2]=1<<h,!(0<(0|o)))break}a=v[n>>2],s=v[a+704>>2]}if(e=v[s>>2],(0|(v[n+4>>2]=e))<1)i=0;else{for(c=v[a+732>>2],f=v[a+736>>2],d=v[a+740>>2],h=v[a+720>>2],p=v[n+52>>2],l=v[n+568>>2],_=v[n+8>>2],o=e;u=_+E(o=o+-1|0,12)|0,v[u>>2]=l+E(v[(i=o<<2)+h>>2],36),v[u+4>>2]=v[i+d>>2],v[u+8>>2]=v[i+f>>2],T[i+p>>2]=v[i+c>>2]?w(1):w(0),0<(0|o););for(u=v[n+16>>2],i=0;o=v[8+(l+E(v[(c=(e=e+-1|0)<<2)+h>>2],36)|0)>>2],i=i+(v[u+c>>2]=o)|0,0<(0|e););e=v[n+4>>2]}if(v[n+12>>2]=e,v[n+20>>2]=i,e=v[s+4>>2],1<=(0|(v[n+304>>2]=e))){for(;i=v[n+308>>2]+((e=e+-1|0)<<5)|0,v[i>>2]=v[n+568>>2]+E(v[(o=e<<2)+v[a+752>>2]>>2],36),v[i+4>>2]=v[o+v[a+764>>2]>>2],v[i+8>>2]=v[o+v[a+768>>2]>>2],h=v[o+v[a+772>>2]>>2],v[i+12>>2]=h,s=v[o+v[a+776>>2]>>2],v[i+16>>2]=s,v[i+28>>2]=v[o+v[a+760>>2]>>2],h>>>0<=1?h-1?(v[20+(v[n+60>>2]+E(s,24)|0)>>2]=e,v[i+24>>2]=1,v[i+20>>2]=2):(v[8+(v[n+168>>2]+E(s,12)|0)>>2]=e,v[i+24>>2]=3,v[i+20>>2]=4):B(4,1179,0),0<(0|e););a=v[n>>2],s=v[a+704>>2]}o=v[s+8>>2];e:if(!((0|(v[n+56>>2]=o))<1)){if(i=o+-1|0,l=v[a+796>>2],u=v[a+804>>2],c=v[a+800>>2],f=v[a+780>>2],d=v[n+568>>2],p=v[n+60>>2],y[a+4|0]<2)for(;;)if(e=p+E(i,24)|0,v[e>>2]=d+E(v[(h=i<<2)+f>>2],36),v[e+4>>2]=v[h+c>>2],v[e+8>>2]=v[h+u>>2],h=v[h+l>>2],v[e+12>>2]=0,v[e+16>>2]=h,e=0<(0|i),i=i+-1|0,!e)break e;for(_=v[a+808>>2];e=p+E(i,24)|0,v[e>>2]=d+E(v[(h=i<<2)+f>>2],36),v[e+4>>2]=v[h+c>>2],v[e+8>>2]=v[h+u>>2],v[e+16>>2]=v[h+l>>2],v[e+12>>2]=v[h+_>>2],e=0<(0|i),i=i+-1|0,e;);}if(i=v[s+12>>2],1<=(0|(v[n+164>>2]=i)))for(h=v[a+828>>2],l=v[a+812>>2],u=v[n+568>>2],c=v[n+168>>2],e=i;f=c+E(e=e+-1|0,12)|0,v[f>>2]=u+E(v[(d=e<<2)+l>>2],36),v[f+4>>2]=v[h+d>>2],0<(0|e););if(((e=0)|o)<1)h=0;else{for(l=v[n+68>>2],u=v[n+60>>2],h=0;i=v[v[u+E(o=o+-1|0,24)>>2]+8>>2],h=(v[l+(o<<2)>>2]=i)+h|0,0<(0|o););i=v[n+164>>2],o=v[n+56>>2]}if(v[n+64>>2]=o,v[n+72>>2]=h,o=n,1<=(0|i)){for(l=v[n+176>>2],u=v[n+168>>2];h=v[v[u+E(i=i+-1|0,12)>>2]+8>>2],e=e+(v[l+(i<<2)>>2]=h)|0,0<(0|i););i=v[n+164>>2]}if(v[o+172>>2]=i,v[n+180>>2]=e,h=v[s+16>>2],1<=(0|(v[n+332>>2]=h))){for(c=v[a+872>>2],f=v[a+892>>2],d=v[a+880>>2],p=v[a+876>>2],l=v[a+852>>2],u=v[n+568>>2],_=v[n+336>>2],e=h;i=_+E(e=e+-1|0,20)|0,v[i>>2]=u+E(v[(o=e<<2)+l>>2],36),v[i+4>>2]=v[o+p>>2],v[i+8>>2]=v[o+d>>2],v[i+16>>2]=v[o+f>>2],v[i+12>>2]=v[o+c>>2],0<(0|e););for(o=v[n+344>>2],i=0;e=v[8+(u+E(v[(c=(h=h+-1|0)<<2)+l>>2],36)|0)>>2],i=(v[o+c>>2]=e)+i|0,0<(0|h););if(v[n+348>>2]=i,h=v[n+332>>2],!((0|(v[n+340>>2]=h))<1))for(i=h<<2,o=v[n+456>>2],l=v[n+452>>2];v[(u=(e=i+-4|0)<<2)+l>>2]=1065353216,v[(c=(i<<=2)-4|0)+l>>2]=1065353216,v[(f=(i=i+-12|0)+l|0)>>2]=1065353216,v[f+4>>2]=1065353216,v[o+u>>2]=0,v[o+c>>2]=1065353216,v[(i=i+o|0)>>2]=0,v[i+4>>2]=0,i=e,0<(0|(h=h+-1|0)););}else v[n+340>>2]=h,v[n+348>>2]=0;if(h=v[s+72>>2],1<=(0|(v[n+480>>2]=h)))for(c=v[a+1208>>2],f=v[a+1224>>2],d=v[a+1220>>2],p=v[a+1216>>2],_=v[a+1212>>2],g=v[n+484>>2],o=0;;){if(e=g+E(o,28)|0,l=v[(i=o<<2)+_>>2],v[e+4>>2]=l,v[e>>2]=v[i+p>>2],u=v[i+d>>2],v[e+16>>2]=u,A=v[i+f>>2],v[e+20>>2]=A,v[e+8>>2]=0,v[e+24>>2]=1+(u-A|0),1<=(0|l))for(A=v[i+c>>2],P=v[e+12>>2],S=v[a+1236>>2],I=v[a+1228>>2],M=v[a+1232>>2],i=0;v[4+(e=P+(i<<4)|0)>>2]=v[(u=i+A<<2)+M>>2],v[e>>2]=v[u+I>>2],u=v[u+S>>2],v[e+12>>2]=0,v[e+8>>2]=u,(0|l)!=(0|(i=i+1|0)););if((0|h)==(0|(o=o+1|0)))break}if(i=v[s+80>>2],(0|(v[n+500>>2]=i))<1)o=0;else{for(u=v[a+1280>>2],c=v[a+1268>>2],f=v[a+1276>>2],d=v[a+1272>>2],p=v[a+1264>>2],_=v[a+1260>>2],h=v[a+1248>>2],l=v[n+568>>2],g=v[n+504>>2];e=g+E(i=i+-1|0,24)|0,v[e>>2]=l+E(v[(o=i<<2)+h>>2],36),v[e+4>>2]=v[o+_>>2],v[e+8>>2]=v[o+p>>2],v[e+12>>2]=v[o+d>>2],o=v[o+c>>2],v[e+20>>2]=u+(o<<1),v[e+16>>2]=f+(o<<2),0<(0|i););if((0|(i=v[n+500>>2]))<1)o=0;else{for(u=v[n+512>>2],o=0;e=v[8+(l+E(v[(c=(i=i+-1|0)<<2)+h>>2],36)|0)>>2],o=(v[u+c>>2]=e)+o|0,0<(0|i););i=v[n+500>>2]}}v[n+508>>2]=i,v[n+516>>2]=o;e:if(4<=y[t+4|0]){if(!((h=y[a+4|0])>>>0<4)){if(i=v[s+120>>2],1<=(0|(v[n+572>>2]=i))){for(u=v[a+1172>>2],c=v[n+576>>2];h=(0|(s=v[(e=(i=i+-1|0)<<2)+u>>2]))<0?s=l=o=0:(o=(h=v[e+v[a+1176>>2]>>2]<<2)+v[a+1188>>2]|0,l=v[e+v[a+1180>>2]>>2],s=v[n+544>>2]+E(s,52)|0,h+v[a+1184>>2]|0),e=c+E(i,20)|0,v[e+12>>2]=l,v[e+8>>2]=o,v[e+4>>2]=h,v[e>>2]=s,0<(0|i););if(a=v[n>>2],(h=y[a+4|0])>>>0<4)break e}if(s=v[a+704>>2],o=v[s+100>>2],1<=(0|(v[n+580>>2]=o)))for(l=v[a+1084>>2],u=v[a+1076>>2],c=v[a+1192>>2],f=v[a+1080>>2],d=v[n+584>>2];e=d+E(o=o+-1|0,28)|0,v[e>>2]=v[(i=o<<2)+f>>2],v[e+4>>2]=c+(v[i+u>>2]<<2),i=v[i+l>>2],v[e+20>>2]=1,v[e+24>>2]=1,v[e+12>>2]=0,v[e+16>>2]=0,v[e+8>>2]=i,0<(0|o););if(o=v[s+104>>2],1<=(0|(v[n+588>>2]=o))){for(;;){if(e=v[n+592>>2]+E(o=o+-1|0,48)|0,v[e>>2]=v[n+584>>2]+E(v[(h=o<<2)+v[a+1088>>2]>>2],28),i=v[h+v[a+1092>>2]>>2],v[e+28>>2]=1,v[e+32>>2]=1,v[e+8>>2]=0,v[e+4>>2]=i,s=v[h+v[a+1104>>2]>>2],1<=(0|(v[e+36>>2]=s)))for(i=0;v[v[e+40>>2]+(i<<2)>>2]=v[n+576>>2]+E(v[v[a+1168>>2]+(v[h+v[a+1100>>2]>>2]+i<<2)>>2],20),(0|s)!=(0|(i=i+1|0)););if(!(1<=(0|o)))break}a=v[n>>2],h=y[a+4|0]}if(!(h>>>0<4)){if(h=v[t+704>>2],i=v[h+108>>2],1<=(0|(v[n+604>>2]=i)))for(s=v[t+1124>>2],l=v[t+1128>>2],u=v[t+1120>>2],c=v[n+592>>2],f=v[n+608>>2];e=f+E(i=i+-1|0,12)|0,v[e>>2]=v[(o=i<<2)+u>>2],v[e+4>>2]=v[o+l>>2],v[e+8>>2]=c+E(v[s+o>>2],48),0<(0|i););if(i=v[h+112>>2],1<=(0|(v[n+620>>2]=i)))for(h=v[t+1148>>2],s=v[t+1152>>2],l=v[t+1144>>2],u=v[n+592>>2],c=v[n+624>>2];e=c+E(i=i+-1|0,12)|0,v[e>>2]=v[(o=i<<2)+l>>2],v[e+4>>2]=v[s+o>>2],v[e+8>>2]=u+E(v[o+h>>2],48),0<(0|i););if(o=v[a+1192>>2],e=v[v[a+704>>2]+20>>2],v[n+640>>2]=v[a+972>>2],h=v[a+964>>2],v[n+636>>2]=h,!((0|e)<(i=1))&&(v[h>>2]=o+(v[v[a+968>>2]>>2]<<2),1!=(0|e)))for(;v[(h=i<<2)+v[n+636>>2]>>2]=o+(v[h+v[a+968>>2]>>2]<<2),(0|e)!=(0|(i=i+1|0)););}}}else if(!(v[s+20>>2]<1))for(s=0;;){if(o=v[(l=s<<2)+v[n+636>>2]>>2],1<=((e=0)|(i=v[l+v[a+952>>2]>>2])))for(f=i+(u=v[l+v[a+948>>2]>>2])|0,d=v[a+1060>>2],p=v[a+1056>>2];;){if(1<=(0|(c=v[(i=u<<2)+d>>2])))for(_=c+(h=v[i+p>>2])|0,g=v[a+1192>>2];;){c=o+(e<<2)|0,b=T[g+(h<<2)>>2],i=o;i:{if(0<(0|e))for(;;){if(T[i>>2]==b)break i;if(!((i=i+4|0)>>>0<c>>>0))break}T[c>>2]=b,e=e+1|0}if(!((0|(h=h+1|0))<(0|_)))break}if(!((0|(u=u+1|0))<(0|f)))break}if(function(t,e){var i,r,n=0,s=0,o=0;v[8+(D=i=D-208|0)>>2]=1,v[12+i>>2]=0;i:if(r=e<<2){for(v[16+i>>2]=4,o=e=v[20+i>>2]=4,n=2;e=(o+4|0)+(s=e)|0,v[(16+i|0)+(n<<2)>>2]=e,n=n+1|0,o=s,e>>>0<r>>>0;);if((s=(t+r|0)-4|0)>>>0<=t>>>0)e=n=1;else for(e=n=1;e=3&~n?(x[(16+i|0)+((o=e+-1|0)<<2)>>2]>=s-t>>>0?K(t,8+i|0,e,0,16+i|0):at(t,e,16+i|0),1==(0|e)?(J(8+i|0,1),0):(J(8+i|0,o),1)):(at(t,e,16+i|0),tt(8+i|0,2),e+2|0),n=1|v[8+i>>2],v[8+i>>2]=n,(t=t+4|0)>>>0<s>>>0;);for(K(t,8+i|0,e,0,16+i|0);;){r:{n:{s:{if(!(1!=(0|e)|1!=(0|n))){if(v[12+i>>2])break s;break i}if(1<(0|e))break n}tt(8+i|0,s=Pt(8+i|0)),n=v[8+i>>2],e=e+s|0;break r}J(8+i|0,2),v[8+i>>2]=7^v[8+i>>2],tt(8+i|0,1),K((o=t+-4|0)-v[(16+i|0)+((s=e+-2|0)<<2)>>2]|0,8+i|0,e+-1|0,1,16+i|0),J(8+i|0,1),n=1|v[8+i>>2],v[8+i>>2]=n,K(o,8+i|0,s,1,16+i|0),e=s}t=t+-4|0}}D=208+i|0}(o,e),v[l+v[n+640>>2]>>2]=e,!((0|(s=s+1|0))<v[v[a+704>>2]+20>>2]))break}if(!(y[t+4|0]<5|y[v[n>>2]+4|0]<4)){if(e=v[t+704>>2],i=v[e+128>>2],1<=(0|(v[n+596>>2]=i)))for(h=v[t+1112>>2],s=v[t+1116>>2],l=v[t+1108>>2],u=v[n+592>>2],c=v[n+600>>2];a=c+E(i=i+-1|0,12)|0,v[a>>2]=v[(o=i<<2)+l>>2],v[a+4>>2]=v[s+o>>2],v[a+8>>2]=u+E(v[o+h>>2],48),0<(0|i););if(i=v[e+132>>2],1<=(0|(v[n+612>>2]=i)))for(h=v[t+1136>>2],s=v[t+1140>>2],l=v[t+1132>>2],u=v[n+592>>2],c=v[n+616>>2];a=c+E(i=i+-1|0,12)|0,v[a>>2]=v[(o=i<<2)+l>>2],v[a+4>>2]=v[s+o>>2],v[a+8>>2]=u+E(v[o+h>>2],48),0<(0|i););if(i=v[e+136>>2],!((0|(v[n+628>>2]=i))<1))for(a=v[t+1160>>2],o=v[t+1164>>2],h=v[t+1156>>2],s=v[n+592>>2],l=v[n+632>>2];t=l+E(i=i+-1|0,12)|0,v[t>>2]=v[(e=i<<2)+h>>2],v[t+4>>2]=v[e+o>>2],v[t+8>>2]=s+E(v[e+a>>2],48),0<(0|i););}ht(n)}return D=576+r|0,n}(t,e,i))break t;v[36+r>>2]=2209,v[32+r>>2]=2361,B(4,1294,32+r|0)}else v[20+r>>2]=1444,v[16+r>>2]=2361,B(4,1294,16+r|0);else v[4+r>>2]=2132,v[r>>2]=2361,B(4,1294,r);e=0}return D=64+r|0,0|e}function ct(t){var e;return D=e=D-16|0,t=(t|=0)?function(t){var e;return H(16+(D=e=D-576|0)|0,0,560),yt(t,16+e|0,12+e|0),D=576+e|0,v[12+e>>2]}(t):(v[4+e>>2]=2132,v[e>>2]=2343,B(4,1294,e),0),D=16+e|0,0|t}function ft(t){var e=y[t+4|0];k(v[t+704>>2],4,64),j(v[t+708>>2],4),j(v[t+708>>2]+4|0,4),j(v[t+708>>2]+8|0,4),j(v[t+708>>2]+12|0,4),j(v[t+708>>2]+16|0,4),j(v[t+708>>2]+20|0,1),k(v[t+720>>2],4,v[v[t+704>>2]>>2]),k(v[t+724>>2],4,v[v[t+704>>2]>>2]),k(v[t+728>>2],4,v[v[t+704>>2]>>2]),k(v[t+732>>2],4,v[v[t+704>>2]>>2]),k(v[t+736>>2],4,v[v[t+704>>2]>>2]),k(v[t+740>>2],4,v[v[t+704>>2]>>2]),k(v[t+752>>2],4,v[v[t+704>>2]+4>>2]),k(v[t+756>>2],4,v[v[t+704>>2]+4>>2]),k(v[t+760>>2],4,v[v[t+704>>2]+4>>2]),k(v[t+764>>2],4,v[v[t+704>>2]+4>>2]),k(v[t+768>>2],4,v[v[t+704>>2]+4>>2]),k(v[t+772>>2],4,v[v[t+704>>2]+4>>2]),k(v[t+776>>2],4,v[v[t+704>>2]+4>>2]),k(v[t+780>>2],4,v[v[t+704>>2]+8>>2]),k(v[t+784>>2],4,v[v[t+704>>2]+8>>2]),k(v[t+788>>2],4,v[v[t+704>>2]+8>>2]),k(v[t+796>>2],4,v[v[t+704>>2]+8>>2]),k(v[t+800>>2],4,v[v[t+704>>2]+8>>2]),k(v[t+804>>2],4,v[v[t+704>>2]+8>>2]),k(v[t+812>>2],4,v[v[t+704>>2]+12>>2]),k(v[t+816>>2],4,v[v[t+704>>2]+12>>2]),k(v[t+820>>2],4,v[v[t+704>>2]+12>>2]),k(v[t+828>>2],4,v[v[t+704>>2]+12>>2]),k(v[t+852>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+856>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+860>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+868>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+872>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+876>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+880>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+884>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+888>>2],1,v[v[t+704>>2]+16>>2]),k(v[t+892>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+896>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+900>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+904>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+908>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+912>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+924>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+928>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+932>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+936>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+940>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+948>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+952>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+976>>2],4,v[v[t+704>>2]+24>>2]),k(v[t+980>>2],4,v[v[t+704>>2]+28>>2]),k(v[t+984>>2],4,v[v[t+704>>2]+28>>2]),k(v[t+996>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1e3>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1004>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1008>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1012>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1016>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1020>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1032>>2],4,v[v[t+704>>2]+36>>2]),k(v[t+1036>>2],4,v[v[t+704>>2]+36>>2]),k(v[t+1040>>2],4,v[v[t+704>>2]+36>>2]),k(v[t+1052>>2],4,v[v[t+704>>2]+40>>2]),k(v[t+1064>>2],4,v[v[t+704>>2]+44>>2]),k(v[t+1068>>2],4,v[v[t+704>>2]+48>>2]),k(v[t+1072>>2],4,v[v[t+704>>2]+48>>2]),k(v[t+1056>>2],4,v[v[t+704>>2]+52>>2]),k(v[t+1060>>2],4,v[v[t+704>>2]+52>>2]),k(v[t+1192>>2],4,v[v[t+704>>2]+56>>2]),k(v[t+1196>>2],4,v[v[t+704>>2]+60>>2]),k(v[t+1200>>2],2,v[v[t+704>>2]+64>>2]),k(v[t+1204>>2],4,v[v[t+704>>2]+68>>2]),k(v[t+1208>>2],4,v[v[t+704>>2]+72>>2]),k(v[t+1212>>2],4,v[v[t+704>>2]+72>>2]),k(v[t+1216>>2],4,v[v[t+704>>2]+72>>2]),k(v[t+1220>>2],4,v[v[t+704>>2]+72>>2]),k(v[t+1224>>2],4,v[v[t+704>>2]+72>>2]),k(v[t+1228>>2],4,v[v[t+704>>2]+76>>2]),k(v[t+1232>>2],4,v[v[t+704>>2]+76>>2]),k(v[t+1236>>2],4,v[v[t+704>>2]+76>>2]),k(v[t+1248>>2],4,v[v[t+704>>2]+80>>2]),k(v[t+1252>>2],4,v[v[t+704>>2]+80>>2]),k(v[t+1256>>2],4,v[v[t+704>>2]+80>>2]),k(v[t+1260>>2],4,v[v[t+704>>2]+80>>2]),k(v[t+1264>>2],4,v[v[t+704>>2]+80>>2]),k(v[t+1268>>2],4,v[v[t+704>>2]+80>>2]),k(v[t+1272>>2],4,v[v[t+704>>2]+80>>2]),k(v[t+1276>>2],4,v[v[t+704>>2]+84>>2]),k(v[t+1280>>2],2,v[v[t+704>>2]+84>>2]),k(v[t+1284>>2],4,v[v[t+704>>2]+88>>2]),e>>>0<2||(k(v[t+808>>2],4,v[v[t+704>>2]+8>>2]),e>>>0<4)||(k(v[t+968>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+972>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+792>>2],4,v[v[t+704>>2]+8>>2]),k(v[t+824>>2],4,v[v[t+704>>2]+12>>2]),k(v[t+864>>2],4,v[v[t+704>>2]+16>>2]),k(v[t+1288>>2],4,v[v[t+704>>2]+92>>2]),k(v[t+1292>>2],4,v[v[t+704>>2]+92>>2]),k(v[t+1296>>2],4,v[v[t+704>>2]+92>>2]),k(v[t+1300>>2],4,v[v[t+704>>2]+96>>2]),k(v[t+1304>>2],4,v[v[t+704>>2]+96>>2]),k(v[t+1308>>2],4,v[v[t+704>>2]+96>>2]),k(v[t+944>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+956>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+960>>2],4,v[v[t+704>>2]+20>>2]),k(v[t+1076>>2],4,v[v[t+704>>2]+100>>2]),k(v[t+1080>>2],4,v[v[t+704>>2]+100>>2]),k(v[t+1084>>2],4,v[v[t+704>>2]+100>>2]),k(v[t+1088>>2],4,v[v[t+704>>2]+104>>2]),k(v[t+1092>>2],4,v[v[t+704>>2]+104>>2]),k(v[t+1096>>2],4,v[v[t+704>>2]+104>>2]),k(v[t+1100>>2],4,v[v[t+704>>2]+104>>2]),k(v[t+1104>>2],4,v[v[t+704>>2]+104>>2]),k(v[t+1120>>2],4,v[v[t+704>>2]+108>>2]),k(v[t+1124>>2],4,v[v[t+704>>2]+108>>2]),k(v[t+1128>>2],4,v[v[t+704>>2]+108>>2]),k(v[t+1144>>2],4,v[v[t+704>>2]+112>>2]),k(v[t+1148>>2],4,v[v[t+704>>2]+112>>2]),k(v[t+1152>>2],4,v[v[t+704>>2]+112>>2]),k(v[t+1168>>2],4,v[v[t+704>>2]+116>>2]),k(v[t+1172>>2],4,v[v[t+704>>2]+120>>2]),k(v[t+1176>>2],4,v[v[t+704>>2]+120>>2]),k(v[t+1180>>2],4,v[v[t+704>>2]+120>>2]),k(v[t+1184>>2],4,v[v[t+704>>2]+124>>2]),k(v[t+1188>>2],4,v[v[t+704>>2]+124>>2]),4!=(0|e)&&(k(v[t+988>>2],4,v[v[t+704>>2]+28>>2]),k(v[t+992>>2],4,v[v[t+704>>2]+28>>2]),k(v[t+1024>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1028>>2],4,v[v[t+704>>2]+32>>2]),k(v[t+1044>>2],4,v[v[t+704>>2]+36>>2]),k(v[t+1048>>2],4,v[v[t+704>>2]+36>>2]),k(v[t+1108>>2],4,v[v[t+704>>2]+128>>2]),k(v[t+1112>>2],4,v[v[t+704>>2]+128>>2]),k(v[t+1116>>2],4,v[v[t+704>>2]+128>>2]),k(v[t+1132>>2],4,v[v[t+704>>2]+132>>2]),k(v[t+1136>>2],4,v[v[t+704>>2]+132>>2]),k(v[t+1140>>2],4,v[v[t+704>>2]+132>>2]),k(v[t+1156>>2],4,v[v[t+704>>2]+136>>2]),k(v[t+1160>>2],4,v[v[t+704>>2]+136>>2]),k(v[t+1164>>2],4,v[v[t+704>>2]+136>>2])))}function dt(t,e){var i=0,r=0,n=0,s=0,o=0,a=0,h=t+e|0;t:{e:if(!(1&(i=v[t+4>>2]))){if(!(3&i))break t;if(e=(i=v[t>>2])+e|0,(0|(t=t-i|0))!=v[2092])if(i>>>0<=255)n=i>>>3,i=v[t+8>>2],(0|(r=v[t+12>>2]))==(0|i)?(a=v[2087]&Rt(n),v[2087]=a):(v[i+12>>2]=r,v[r+8>>2]=i);else{if(o=v[t+24>>2],(0|(i=v[t+12>>2]))!=(0|t))r=v[t+8>>2],v[r+12>>2]=i,v[i+8>>2]=r;else if(n=(n=v[(r=t+20|0)>>2])||v[(r=t+16|0)>>2]){for(;s=r,(n=v[(r=(i=n)+20|0)>>2])||(r=i+16|0,n=v[i+16>>2]););v[s>>2]=0}else i=0;if(o){r=v[t+28>>2];i:{if(v[(n=8652+(r<<2)|0)>>2]==(0|t)){if(v[n>>2]=i)break i;a=v[2088]&Rt(r),v[2088]=a;break e}if(!(v[o+(v[o+16>>2]==(0|t)?16:20)>>2]=i))break e}v[i+24>>2]=o,(r=v[t+16>>2])&&(v[i+16>>2]=r,v[r+24>>2]=i),(r=v[t+20>>2])&&(v[i+20>>2]=r,v[r+24>>2]=i)}}else if(!(3&~(i=v[4+h>>2])))return v[2089]=e,v[4+h>>2]=-2&i,v[t+4>>2]=1|e,v[h>>2]=e}e:{if(!(2&(i=v[4+h>>2]))){if(v[2093]==(0|h)){if(v[2093]=t,e=v[2090]+e|0,v[2090]=e,v[t+4>>2]=1|e,v[2092]!=(0|t))break t;return v[2089]=0,v[2092]=0}if(v[2092]==(0|h))return v[2092]=t,e=v[2089]+e|0,v[2089]=e,v[t+4>>2]=1|e,v[t+e>>2]=e;e=(-8&i)+e|0;i:if(i>>>0<=255)n=i>>>3,i=v[8+h>>2],(0|(r=v[12+h>>2]))==(0|i)?(a=v[2087]&Rt(n),v[2087]=a):(v[i+12>>2]=r,v[r+8>>2]=i);else{if(o=v[24+h>>2],(0|h)!=(0|(i=v[12+h>>2])))r=v[8+h>>2],v[r+12>>2]=i,v[i+8>>2]=r;else if(n=(n=v[(r=20+h|0)>>2])||v[(r=16+h|0)>>2]){for(;s=r,(n=v[(r=(i=n)+20|0)>>2])||(r=i+16|0,n=v[i+16>>2]););v[s>>2]=0}else i=0;if(o){r=v[28+h>>2];r:{if(v[(n=8652+(r<<2)|0)>>2]==(0|h)){if(v[n>>2]=i)break r;a=v[2088]&Rt(r),v[2088]=a;break i}if(!(v[o+(v[o+16>>2]==(0|h)?16:20)>>2]=i))break i}v[i+24>>2]=o,(r=v[16+h>>2])&&(v[i+16>>2]=r,v[r+24>>2]=i),(r=v[20+h>>2])&&(v[i+20>>2]=r,v[r+24>>2]=i)}}if(v[t+4>>2]=1|e,v[t+e>>2]=e,v[2092]!=(0|t))break e;return v[2089]=e}v[4+h>>2]=-2&i,v[t+4>>2]=1|e,v[t+e>>2]=e}if(e>>>0<=255)return e=8388+((i=e>>>3)<<3)|0,i=(r=v[2087])&(i=1<<i)?v[e+8>>2]:(v[2087]=i|r,e),v[e+8>>2]=t,v[i+12>>2]=t,v[t+12>>2]=e,v[t+8>>2]=i;v[t+16>>2]=0,i=v[t+20>>2]=0,(n=e>>>8)&&(i=31,16777215<e>>>0||(i=28+((i=((h=(n<<=s=n+1048320>>>16&8)<<(i=n+520192>>>16&4))<<(n=245760+h>>>16&2)>>>15)-(n|i|s)|0)<<1|e>>>i+21&1)|0)),n=8652+((v[(r=t)+28>>2]=i)<<2)|0;e:{if((r=v[2088])&(s=1<<i)){for(r=e<<(31==(0|i)?0:25-(i>>>1)|0),i=v[n>>2];;){if((-8&v[(n=i)+4>>2])==(0|e))break e;if(i=r>>>29,r<<=1,!(i=v[16+(s=n+(4&i)|0)>>2]))break}v[s+16>>2]=t}else v[2088]=r|s,v[n>>2]=t;return v[t+24>>2]=n,v[t+12>>2]=t,v[t+8>>2]=t}e=v[n+8>>2],v[e+12>>2]=t,v[n+8>>2]=t,v[t+24>>2]=0,v[t+12>>2]=n,v[t+8>>2]=e}}function pt(t){var e,i,r,s,o,h,u,f,d=w(0),p=(w(0),0),_=0,m=(w(0),w(0),w(0),w(0),0);w(0),w(0);t:{e:{if(l(t),_=2147483647&(p=n[0])){if(!(_>>>0<2139095041))return w(w(.10000000149011612)+t);if(1065353216==(0|_))return w(-1<(0|p)?.10000000149011612:10);if(2139095040==(0|_))return w(-1<(0|p)?0:-t);if(1073741824==(0|p))return w(.010000000707805157);if(1056964608==(0|p))return w(.3162277638912201);if(1291845633<=_>>>0)return w((0|p)<0?C:0);if(e=T[1701],f=w(w(1.600000023841858)-e),i=w(w(1)/w(e+w(1.600000023841858))),a(0,-4096&(l(u=w(f*i)),n[0])),d=c(),r=w(d*d),o=T[1705],e=w(i*w(w(f-w((s=d)*w(3.099609375)))-w(d*w(w(1.600000023841858)-w(w(3.099609375)-e))))),i=w(w(u+d)*e),d=w(u*u),f=w(i+w(w(d*d)*w(w(d*w(w(d*w(w(d*w(w(d*w(w(d*w(.20697501301765442))+w(.23066075146198273)))+w(.2727281153202057)))+w(.3333333432674408)))+w(.4285714328289032)))+w(.6000000238418579)))),a(0,-4096&(l(w(w(r+w(3))+f)),n[0])),d=c(),i=w(s*d),u=w(w(e*d)+w(u*w(f-w(w(d+w(-3))-r)))),a(0,-4096&(l(w(i+u)),n[0])),d=c(),e=w(d*w(.9619140625)),r=w(T[1703]+w(w(w(u-w(d-i))*w(.9617967009544373))+w(d*w(-.00011736857413779944)))),a(0,-4096&(l(w(w(o+w(e+r))+w(-4))),n[0])),u=c(),a(0,-4096&p),f=c(),d=w(u*f),t=w(w(w(r-w(w(w(u-w(-4))-o)-e))*t)+w(w(t-f)*u)),l(u=w(d+t)),1124073473<=(0|(p=n[0])))break e;i:{if((_=1124073472)==(0|p)){if(w(t+w(4.299566569443414e-8))>w(u-d))break e}else{if(_=2147483647&p,!(t<=w(u-d)^1|-1021968384!=(0|p))|1125515265<=_>>>0)break t;if(_>>>0<1056964609)break i}m=(8388607&(_=(8388608>>>(_>>>23)-126)+p|0)|8388608)>>>150-(h=_>>>23&255),m=(0|p)<0?0-m|0:m,d=w(d-(a(0,_&-8388608>>h-127),c())),l(w(t+d)),p=n[0]}a(0,-32768&p),u=c(),e=w(u*w(.693145751953125)),u=w(w(u*w(14286065379565116e-22))+w(w(t-w(u-d))*w(.6931471824645996))),t=w(e+u),d=w(t*t),d=w(t-w(d*w(w(d*w(w(d*w(w(d*w(w(d*w(4.138136944220605e-8))+w(-16533901998627698e-22)))+w(661375597701408e-19)))+w(-.0027777778450399637)))+w(.1666666716337204)))),s=w(w(t*d)/w(d+w(-2))),d=w(u-w(t-e)),t=(0|(p=0|(l(t=w(w(t-w(s-w(d+w(t*d))))+w(1))),n[0]+(m<<23))))<=8388607?function(t,e){var i=0;return 128<=(0|e)?(t=w(t*w(17014118346046923e22)),e=(0|(i=e+-127|0))<128?i:(t=w(t*w(17014118346046923e22)),((0|e)<381?e:381)+-254|0)):-127<(0|e)||(t=w(t*w(11754943508222875e-54)),e=-127<(0|(i=e+126|0))?i:(t=w(t*w(11754943508222875e-54)),(-378<(0|e)?e:-378)+252|0)),w(t*(a(0,1065353216+(e<<23)|0),c()))}(t,m):(a(0,p),c()),t=w(w(1)*t)}else t=w(1);return t}return w(C)}return w(0)}function _t(t,e){var i,r,s,o=0,a=0,h=w(0);if(l(e),!((s=2147483647&(r=n[0]))>>>0<=2139095040&&(l(t),(o=2147483647&(a=n[0]))>>>0<2139095041)))return w(t+e);if(1065353216==(0|r))return mt(t);r=(i=r>>>30&2)|a>>>31;t:{e:{i:{r:{if(!o){switch(r-2|0){case 0:break r;case 1:break;default:break i}return w(-3.1415927410125732)}if(2139095040!=(0|s)){if(!s|!(o>>>0<=218103808+s>>>0&&2139095040!=(0|o)))break t;if(t=h=o+218103808>>>0<s>>>0&&(h=w(0),i)?h:mt(w(S(w(t/e)))),r>>>0<=2){switch(r-1|0){case 0:return w(-t);case 1:break;default:break i}return w(w(3.1415927410125732)-w(t+w(8.742277657347586e-8)))}return w(w(t+w(8.742277657347586e-8))+w(-3.1415927410125732))}if(2139095040==(0|o))break e;return T[6784+(r<<2)>>2]}t=w(3.1415927410125732)}return t}return T[6768+(r<<2)>>2]}return w((0|a)<0?-1.5707963705062866:1.5707963705062866)}function mt(t){w(0);var e,i,r,s,o,a=0;w(0),w(0),l(t);t:{if(1283457024<=(s=2147483647&(o=n[0]))>>>0){if(2139095040<s>>>0)break t;return w((0|o)<0?-1.570796251296997:1.570796251296997)}e:{if(s>>>0<=1054867455){if(a=-1,964689920<=s>>>0)break e;break t}t=w(S(t)),a=s>>>0<=1066926079?s>>>0<=1060110335?(t=w(w(w(t+t)+w(-1))/w(t+w(2))),0):(t=w(w(t+w(-1))/w(t+w(1))),1):s>>>0<=1075576831?(t=w(w(t+w(-1.5))/w(w(t*w(1.5))+w(1))),2):(t=w(w(-1)/t),3)}if(s=a,i=w(t*t),e=w(i*i),r=w(e*w(w(e*w(-.106480173766613))+w(-.19999158382415771))),e=w(i*w(w(e*w(w(e*w(.06168760731816292))+w(.14253635704517365)))+w(.333333283662796))),(0|s)<=-1)return w(t-w(t*w(r+e)));t=w(T[6736+(s<<=2)>>2]-w(w(w(t*w(r+e))-T[6752+s>>2])-t)),t=(0|o)<0?w(-t):t}return t}function gt(t,e){var i,r,s,o=0,h=0;return D=r=D-16|0,l(t),(o=2147483647&(s=n[0]))>>>0<=1305022426?(A[e>>3]=(i=+t)+-1.5707963109016418*(h=.6366197723675814*i+6755399441055744-6755399441055744)+-1.5893254773528196e-8*h,o=S(h)<2147483648?~~h:-2147483648):2139095040<=o>>>0?(A[e>>3]=w(t-t),o=0):(i=o,A[8+r>>3]=(a(0,i-((o=(o>>>23)-150|0)<<23)|0),c()),o=function(t,e,i){var r,n,s,o,a,h,u=0,l=0,c=0,f=0,d=0,p=0,_=0,m=0,g=0,y=0,b=0;if(D=r=D-560|0,_=(l=i)+E(s=0<(0|(i=(i+-3|0)/24|0))?i:0,-24)|0,0<=(0|(n=v[972])))for(l=n+1|0,i=s;A[(320+r|0)+(c<<3)>>3]=(0|i)<0?0:+v[3904+(i<<2)>>2],i=i+1|0,(0|l)!=(0|(c=c+1|0)););for(d=_+-24|0,l=0;;){for(u=i=0;u+=A[(i<<3)+t>>3]*A[(320+r|0)+(l-i<<3)>>3],1!=(0|(i=i+1|0)););if(A[(l<<3)+r>>3]=u,i=(0|l)<(0|n),l=l+1|0,!i)break}h=23-d|0,o=24-d|0,l=n;t:{for(;;){if(u=A[(l<<3)+r>>3],!(g=((i=0)|(c=l))<1))for(;p=(480+r|0)+(i<<2)|0,m=u,f=S(u*=5.960464477539063e-8)<2147483648?~~u:-2147483648,f=S(m+=-16777216*(u=0|f))<2147483648?~~m:-2147483648,v[p>>2]=f,u=A[((c=c+-1|0)<<3)+r>>3]+u,(0|l)!=(0|(i=i+1|0)););u=Q(u,d),u=(u+=-8*I(.125*u))-(0|(p=S(u)<2147483648?~~u:-2147483648));e:{i:{r:{if(b=(0|d)<1){if(d)break r;f=v[476+((l<<2)+r|0)>>2]>>23}else f=v[476+(c=(l<<2)+r|0)>>2],y=c,c=f-((i=f>>o)<<o)|0,p=i+p|0,f=(v[y+476>>2]=c)>>h;if((0|f)<1)break e;break i}if(f=2,!(.5<=u)){f=0;break e}}if(c=i=0,!g)for(;;){g=v[(a=(480+r|0)+(i<<2)|0)>>2],y=16777215;i:{r:{if(!c){if(!g)break r;y=16777216,c=1}v[a>>2]=y-g;break i}c=0}if((0|l)==(0|(i=i+1|0)))break}b||1<(i=d+-1|0)>>>0||(v[476+(i=(l<<2)+r|0)>>2]=i-1?8388607&v[i+476>>2]:4194303&v[i+476>>2]),p=p+1|0,2==(0|f)&&(u=1-u,f=2,c)&&(u-=Q(1,d))}if(0!=u)break;if(!(((c=0)|(i=l))<=(0|n))){for(;c=v[(480+r|0)+((i=i+-1|0)<<2)>>2]|c,(0|n)<(0|i););if(c){for(_=d;_=_+-24|0,!v[(480+r|0)+((l=l+-1|0)<<2)>>2];);break t}}for(i=1;i=(c=i)+1|0,!v[(480+r|0)+(n-c<<2)>>2];);for(c=l+c|0;;){for(l=p=l+1|0,A[(320+r|0)+(p<<3)>>3]=v[3904+(s+l<<2)>>2],u=i=0;u+=A[(i<<3)+t>>3]*A[(320+r|0)+(p-i<<3)>>3],1!=(0|(i=i+1|0)););if(A[(l<<3)+r>>3]=u,!((0|l)<(0|c)))break}l=c}16777216<=(u=Q(u,0-d|0))?(t=(480+r|0)+(l<<2)|0,m=u,i=S(u*=5.960464477539063e-8)<2147483648?~~u:-2147483648,c=S(u=m+-16777216*(0|i))<2147483648?~~u:-2147483648,v[t>>2]=c,l=l+1|0):(i=S(u)<2147483648?~~u:-2147483648,_=d),v[(480+r|0)+(l<<2)>>2]=i}if(u=Q(1,_),!((0|l)<=-1)){for(i=l;A[(i<<3)+r>>3]=u*+v[(480+r|0)+(i<<2)>>2],u*=5.960464477539063e-8,t=0<(0|i),i=i+-1|0,t;);if(!((0|l)<=-1))for(i=l;;){for(d=l-(t=i)|0,i=u=0;u+=A[6672+(i<<3)>>3]*A[(t+i<<3)+r>>3],!((0|n)<=(0|i))&&(_=i>>>0<d>>>0,i=i+1|0,_););if(A[(160+r|0)+(d<<3)>>3]=u,i=t+-1|0,!(0<(0|t)))break}}if(0<=(l|(u=0)))for(;u+=A[(160+r|0)+(l<<3)>>3],t=0<(0|l),l=l+-1|0,t;);return A[e>>3]=f?-u:u,D=560+r|0,7&p}(8+r|0,r,o),h=A[r>>3],(0|s)<=-1?(A[e>>3]=-h,o=0-o|0):A[e>>3]=h),D=16+r|0,o}function vt(t,e){return t?function(t,e){t:{if(t){if(e>>>0<=127)break t;if(v[v[1789]>>2]){if(e>>>0<=2047)return m[t+1|0]=63&e|128,m[0|t]=e>>>6|192,2;if(!(57344!=(-8192&e)&&55296<=e>>>0))return m[t+2|0]=63&e|128,m[0|t]=e>>>12|224,m[t+1|0]=e>>>6&63|128,3;if(e+-65536>>>0<=1048575)return m[t+3|0]=63&e|128,m[0|t]=e>>>18|240,m[t+2|0]=e>>>6&63|128,m[t+1|0]=e>>>12&63|128,4}else if(57216==(-128&e))break t;v[2086]=25,t=-1}else t=1;return t}return m[0|t]=e,1}(t,e):0}function yt(t,e,i){var r,n,s=0,o=0,a=0,h=0,u=0,l=0,c=0,f=0,d=0,p=y[t+4|0];if(v[e>>2]=652,o=v[t+704>>2],1<=(0|(h=v[o>>2]))){for(u=v[t+720>>2],c=v[t+1072>>2];a=(1<<v[c+(v[u+(s<<2)>>2]<<2)>>2])+a|0,(0|h)!=(0|(s=s+1|0)););s=a<<2}if(v[e+4>>2]=E(h,12),v[e+8>>2]=v[o>>2]<<2,v[e+12>>2]=v[o>>2]<<2,v[e+16>>2]=v[o>>2]<<2,v[e+20>>2]=v[o>>2]<<2,a=v[o>>2],v[e+28>>2]=s,v[e+24>>2]=a<<2,a=v[o>>2],v[e+40>>2]=s,v[e+36>>2]=s,v[e+32>>2]=a<<2,v[e+44>>2]=v[o+4>>2]<<5,v[e+48>>2]=v[o+4>>2]<<2,v[e+52>>2]=v[o+4>>2]<<2,v[e+56>>2]=v[o+4>>2]<<2,v[e+60>>2]=v[o+4>>2]<<4,v[e+64>>2]=v[o+4>>2]<<4,1<=((s=0)|(h=v[o+8>>2]))){for(u=v[t+780>>2],c=v[t+1072>>2],d=v[t+796>>2],a=0;l=(15+(v[(f=s<<2)+d>>2]<<3)&-16)+l|0,a=(1<<v[c+(v[u+f>>2]<<2)>>2])+a|0,(0|h)!=(0|(s=s+1|0)););s=a<<2}if(v[e+68>>2]=E(h,24),v[e+72>>2]=v[o+8>>2]<<2,v[e+76>>2]=v[o+8>>2]<<2,a=v[o+8>>2],v[e+84>>2]=l,v[e+80>>2]=a<<2,v[e+88>>2]=v[o+8>>2]<<4,v[e+92>>2]=v[o+8>>2]<<4,a=v[o+8>>2],v[e+100>>2]=s,v[e+96>>2]=a<<2,a=v[o+8>>2],v[e+140>>2]=s,v[e+136>>2]=s,v[e+132>>2]=s,v[e+128>>2]=s,v[e+124>>2]=s,v[e+120>>2]=s,v[e+116>>2]=s,v[e+112>>2]=s,v[e+108>>2]=s,v[e+104>>2]=a<<2,v[e+144>>2]=v[o+8>>2]<<2,v[e+148>>2]=v[o+8>>2]<<2,v[e+152>>2]=v[o+8>>2]<<2,v[e+156>>2]=v[o+8>>2]<<2,v[e+160>>2]=v[o+8>>2]<<2,v[e+164>>2]=v[o+8>>2]<<2,1<=((s=l=0)|(h=v[o+12>>2]))){for(u=v[t+812>>2],c=v[t+1072>>2],a=0;a=(1<<v[c+(v[u+(s<<2)>>2]<<2)>>2])+a|0,(0|h)!=(0|(s=s+1|0)););s=a<<2}if(v[e+168>>2]=E(h,12),v[e+172>>2]=v[o+12>>2]<<2,v[e+176>>2]=v[o+12>>2]<<2,v[e+180>>2]=v[o+12>>2]<<2,v[e+184>>2]=v[o+12>>2]<<2,v[e+188>>2]=v[o+12>>2]<<2,v[e+192>>2]=v[o+12>>2]<<2,v[e+196>>2]=v[o+12>>2]<<2,v[e+200>>2]=v[o+12>>2]<<2,v[e+204>>2]=v[o+12>>2]<<4,v[e+208>>2]=v[o+12>>2]<<4,a=v[o+12>>2],v[e+216>>2]=s,v[e+212>>2]=a<<2,a=v[o+12>>2],v[e+268>>2]=s,v[e+264>>2]=s,v[e+260>>2]=s,v[e+256>>2]=s,v[e+252>>2]=s,v[e+248>>2]=s,v[e+244>>2]=s,v[e+240>>2]=s,v[e+236>>2]=s,v[e+232>>2]=s,v[e+228>>2]=s,v[e+224>>2]=s,v[e+220>>2]=a<<2,v[e+272>>2]=v[o+12>>2]<<2,v[e+276>>2]=v[o+12>>2]<<2,v[e+280>>2]=v[o+12>>2]<<2,v[e+284>>2]=v[o+12>>2]<<2,v[e+288>>2]=v[o+12>>2]<<2,v[e+292>>2]=v[o+12>>2]<<2,1<=((s=0)|(a=v[o+16>>2]))){for(u=v[t+852>>2],c=v[t+1072>>2],d=v[t+892>>2],h=0;l=(15+(v[(f=s<<2)+d>>2]<<3)&-16)+l|0,h=(1<<v[c+(v[u+f>>2]<<2)>>2])+h|0,(0|a)!=(0|(s=s+1|0)););s=h<<2}if(v[e+296>>2]=E(a,20),v[e+300>>2]=v[o+16>>2]<<2,v[e+304>>2]=v[o+16>>2],v[e+308>>2]=v[o+16>>2]<<2,v[e+312>>2]=v[o+16>>2]<<2,a=v[o+16>>2],v[e+320>>2]=l,v[e+316>>2]=a<<2,v[e+324>>2]=v[o+16>>2]<<2,v[e+328>>2]=v[o+16>>2]<<4,v[e+332>>2]=v[o+16>>2]<<4,v[e+336>>2]=v[o+16>>2]<<2,v[e+340>>2]=v[o+16>>2]<<2,v[e+344>>2]=v[o+16>>2]<<2,v[e+348>>2]=v[o+16>>2]<<4,v[e+352>>2]=v[o+16>>2]<<4,a=v[o+16>>2],v[e+360>>2]=s,v[e+356>>2]=a<<2,a=v[o+16>>2],v[e+404>>2]=s,v[e+400>>2]=s,v[e+396>>2]=s,v[e+392>>2]=s,v[e+388>>2]=s,v[e+384>>2]=s,v[e+380>>2]=s,v[e+376>>2]=s,v[e+372>>2]=s,v[e+368>>2]=s,v[e+364>>2]=a<<2,v[e+408>>2]=v[o+16>>2]<<2,v[e+412>>2]=v[o+16>>2]<<2,v[e+416>>2]=v[o+16>>2]<<2,v[e+420>>2]=v[o+16>>2]<<2,v[e+424>>2]=v[o+16>>2]<<2,v[e+428>>2]=v[o+16>>2]<<2,u=v[t+704>>2],v[e+432>>2]=E(v[u+20>>2],52),v[e+436>>2]=p>>>(s=h=0)<=3?v[u+20>>2]<<2:0,v[e+440>>2]=v[u+20>>2]<<2,v[e+444>>2]=E(v[u+52>>2],28),1<=(0|(o=v[u+48>>2]))){for(a=v[t+1072>>2],l=0;l=(c=v[a+(s<<2)>>2])+l|0,h=(1<<c)+h|0,(0|o)!=(0|(s=s+1|0)););s=h<<2,h=l<<2}if(v[e+460>>2]=s,v[e+456>>2]=s,v[e+452>>2]=h,v[e+448>>2]=E(o,36),v[e+500>>2]=E(v[u+72>>2],28),1<=((l=s=a=0)|(c=v[u+72>>2]))){for(d=v[t+1224>>2],f=v[t+1220>>2],n=v[t+1212>>2],h=0;h=(0|(r=v[(o=l<<2)+f>>2]-v[o+d>>2]|0))<(0|h)?h:1+r|0,s=(0|s)<(0|(o=v[o+n>>2]))?o:s,(0|c)!=(0|(l=l+1|0)););l=s<<2,s=h<<2}if(o=v[u+76>>2],v[e+516>>2]=s,v[e+512>>2]=l,v[e+508>>2]=s,v[e+504>>2]=o<<4,1<=(0|(o=v[u+80>>2]))){for(a=v[t+1248>>2],l=v[t+1072>>2],h=s=0;h=(1<<v[l+(v[a+(s<<2)>>2]<<2)>>2])+h|0,(0|o)!=(0|(s=s+1|0)););a=h<<2}if(v[e+520>>2]=E(o,24),v[e+524>>2]=v[u+80>>2]<<2,o=v[u+80>>2],v[e+532>>2]=a,v[e+528>>2]=o<<2,o=v[u+80>>2],v[e+544>>2]=a,v[e+540>>2]=a,v[e+536>>2]=o<<2,o=e,4<=p>>>0){if(v[e+464>>2]=E(v[u+120>>2],20),v[e+468>>2]=E(v[u+100>>2],28),a=e,1<=((s=l=0)|(c=v[u+104>>2]))){for(t=v[t+1104>>2],h=0;h=v[t+(s<<2)>>2]+h|0,(0|c)!=(0|(s=s+1|0)););t=h<<2}else t=0;v[a+476>>2]=t,v[e+472>>2]=E(c,48),v[e+484>>2]=E(v[u+108>>2],12),t=v[u+112>>2],v[e+552>>2]=0,v[e+492>>2]=E(t,12),t=0}else{if((0|(l=v[u+20>>2]))<1)h=0;else for(c=v[t+1060>>2],d=v[t+952>>2],t=v[t+948>>2],a=h=0;;){if(1<=(0|(f=v[(s=a<<2)+d>>2])))for(f=(s=c+(v[t+s>>2]<<2)|0)+(f<<2)|0;h=v[s>>2]+h|0,(s=s+4|0)>>>0<f>>>0;);if((0|l)==(0|(a=a+1|0)))break}v[e+552>>2]=l<<2,l=v[u+20>>2]<<2,t=h<<2}for(v[o+556>>2]=t,v[e+548>>2]=l,4<p>>>0&&(v[e+480>>2]=E(v[u+128>>2],12),v[e+488>>2]=E(v[u+132>>2],12),v[e+496>>2]=E(v[u+136>>2],12)),s=h=0;s=((o=v[(t=(h<<2)+e|0)>>2])+15&-16)+(v[t>>2]=s)|0,140!=(0|(h=h+1|0)););v[i>>2]=s}function bt(t,e,i,r){t:{if(!(20<e>>>0||9<(e=e+-9|0)>>>0)){switch(e-1|0){default:return e=v[i>>2],v[i>>2]=e+4,v[t>>2]=v[e>>2];case 0:return e=v[i>>2],v[i>>2]=e+4,e=v[e>>2],v[t>>2]=e,v[t+4>>2]=e>>31;case 1:return e=v[i>>2],v[i>>2]=e+4,v[t>>2]=v[e>>2],v[t+4>>2]=0;case 3:return e=v[i>>2],v[i>>2]=e+4,e=g[e>>1],v[t>>2]=e,v[t+4>>2]=e>>31;case 4:return e=v[i>>2],v[i>>2]=e+4,v[t>>2]=b[e>>1],v[t+4>>2]=0;case 5:return e=v[i>>2],v[i>>2]=e+4,e=m[0|e],v[t>>2]=e,v[t+4>>2]=e>>31;case 6:return e=v[i>>2],v[i>>2]=e+4,v[t>>2]=y[0|e],v[t+4>>2]=0;case 2:case 7:break t;case 8:}_[r](t,i)}return}e=v[i>>2]+7&-8,v[i>>2]=e+8,i=v[e+4>>2],v[t>>2]=v[e>>2],v[t+4>>2]=i}function xt(t){var e,i,r=0;if(q(m[v[t>>2]]))for(;e=v[t>>2],i=m[0|e],v[t>>2]=e+1,r=(E(r,10)+i|0)-48|0,q(m[e+1|0]););return r}function Tt(t,e,i,r,n){var s,o;v[204+(D=o=D-208|0)>>2]=i,H(160+o|(i=0),0,40),v[200+o>>2]=v[204+o>>2],(0|st(0,e,200+o|0,80+o|0,160+o|0,r,n))<0||(i=0<=v[t+76>>2]?1:i,i=v[t>>2],m[t+74|0]<=0&&(v[t>>2]=-33&i),s=32&i,v[t+48>>2]?st(t,e,200+o|0,80+o|0,160+o|0,r,n):(v[t+48>>2]=80,v[t+16>>2]=80+o,v[t+28>>2]=o,v[t+20>>2]=o,i=v[t+44>>2],st(t,e,200+(v[t+44>>2]=o)|0,80+o|0,160+o|0,r,n),i&&(_[v[t+36>>2]](t,0,0),v[t+48>>2]=0,v[t+44>>2]=i,v[t+28>>2]=0,v[t+16>>2]=0,v[t+20>>2]=0)),v[t>>2]=v[t>>2]|s),D=208+o|0}function At(t,e,i){var r,n;G(8+(D=n=D-160|0)|0,3192,144),v[52+n>>2]=t,v[28+n>>2]=t,v[56+n>>2]=r=(r=-2-t|0)>>>0<256?r:256,v[36+n>>2]=t=t+r|0,v[24+n>>2]=t,Tt(8+n|0,e,i,11,12),r&&(t=v[28+n>>2],m[t-((0|t)==v[24+n>>2])|0]=0),D=160+n|0}function Et(t,e){var i,r,n=0;n=!!(0|e);t:{e:{i:{r:if(!(!e|!(3&t)))for(;;){if(!y[0|t])break i;if(t=t+1|0,n=!!(0|(e=e+-1|0)),!e)break r;if(!(3&t))break}if(!n)break e}if(!y[0|t])break t;i:{if(4<=e>>>0){for(n=(n=e+-4|0)-(i=-4&n)|0,i=4+(t+i|0)|0;;){if((-1^(r=v[t>>2]))&r+-16843009&-2139062144)break i;if(t=t+4|0,!(3<(e=e+-4|0)>>>0))break}e=n,t=i}if(!e)break e}for(;;){if(!y[0|t])break t;if(t=t+1|0,!(e=e+-1|0))break}}return 0}return t}function wt(t){var e,i=0;if(!t)return 32;if(!(1&t))for(;i=i+1|0,e=2&t,t>>>=1,!e;);return i}function St(t,e){var i,r,n,s,o=0,a=0;a=4;D=s=D-256|0;t:if(!((0|e)<2))for(o=v[(n=(e<<2)+t|0)>>2]=s;;){for(G(o,v[t>>2],i=a>>>0<256?a:256),o=0;G(v[(r=(o<<2)+t|0)>>2],v[((o=o+1|0)<<2)+t>>2],i),v[r>>2]=v[r>>2]+i,(0|e)!=(0|o););if(!(a=a-i|0))break t;o=v[n>>2]}D=256+s|0}function Pt(t){return wt(v[t>>2]+-1|0)||((t=wt(v[t+4>>2]))?t+32|0:0)}function Mt(t,e){e|=0,n[0]=t|=0,n[1]=e}function It(t,e,i){return function(t,e,i){var r,n,s,o,a=E(n=i>>>16,s=t>>>16);return t=(65535&(s=((r=E(o=65535&i,t&=65535))>>>16)+E(s,o)|0))+E(t,n)|0,L=((a+E(e,i)|0)+(s>>>16)|0)+(t>>>16)|0,65535&r|t<<16}(t,e,i)}function Ct(t,e,i){return function(t,e,i){var r,n,s=0,o=0,a=0,h=0,u=0,l=0,c=0;t:{e:{i:{r:{n:{if(!(o=e))return Mt((e=t)-E(t=(t>>>0)/(i>>>0)|0,i)|0,0),L=0,t;if(s=i){if(!((h=s+-1|0)&s))break n;u=0-(h=(P(s)+33|0)-P(o)|0)|0;break i}if(!t)return Mt(0,o-E(t=(o>>>0)/0|0,0)|0),L=0,t;if((s=32-P(o)|0)>>>0<31)break r;break e}if(Mt(t&h,0),1==(0|s))break t;return i=31&(s=s?31-P(s+-1^s)|0:32),t=32<=(63&s)>>>0?(o=0,e>>>i):(o=e>>>i,((1<<i)-1&e)<<32-i|t>>>i),L=o,t}h=s+1|0,u=63-s|0}if(s=e,a=31&(o=63&h),a=32<=o>>>0?(o=0,s>>>a):(o=s>>>a,((1<<a)-1&s)<<32-a|t>>>a),s=31&(u&=63),32<=u>>>0?(e=t<<s,t=0):(e=(1<<s)-1&t>>>32-s|e<<s,t<<=s),h)for((u=i+(s=-1)|0)>>>0<4294967295&&(s=0);a=(n=l=a<<1|e>>>31)-(r=i&(l=s-((o=o<<1|a>>>31)+(u>>>0<l>>>0)|0)>>31))|0,o=o-(n>>>0<r>>>0)|0,e=e<<1|t>>>31,t=c|t<<1,c=l&=1,h=h+-1|0;);return Mt(a,o),L=e<<1|t>>>31,l|t<<1}Mt(t,e),e=t=0}return L=e,t}(t,e,i)}function Rt(t){var e;return(-1>>>(e=31&t)&-2)<<e|(-1<<(t=0-t&31)&-2)>>>t}function Ot(){return d.byteLength/65536|0}}(J,b,x)}}s=null,i.wasmBinary&&(y=i.wasmBinary);var v={},y=[];"object"!=e(v)&&m("no native wasm support detected");var b,x=new function(){var t=Array(16);return t.grow=function(){17<=t.length&&X("Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."),t.push(null)},t.set=function(e,i){t[e]=i},t.get=function(e){return t[e]},t},T=!1;function A(t,e){t||X("Assertion failed: "+e)}var E,w,S,P,M="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function I(t,e,i){var r=e+i;for(i=e;t[i]&&!(r<=i);)++i;if(16<i-e&&t.subarray&&M)return M.decode(t.subarray(e,i));for(r="";e<i;){var n,s,o=t[e++];128&o?(n=63&t[e++],192==(224&o)?r+=String.fromCharCode((31&o)<<6|n):(s=63&t[e++],(o=224==(240&o)?(15&o)<<12|n<<6|s:(7&o)<<18|n<<12|s<<6|63&t[e++])<65536?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode(55296|o>>10,56320|1023&o)))):r+=String.fromCharCode(o)}return r}function C(t,e){return t?I(S,t,e):""}function R(t){return 0<t%65536&&(t+=65536-t%65536),t}function O(t){E=t,i.HEAP8=w=new Int8Array(t),i.HEAP16=new Int16Array(t),i.HEAP32=P=new Int32Array(t),i.HEAPU8=S=new Uint8Array(t),i.HEAPU16=new Uint16Array(t),i.HEAPU32=new Uint32Array(t),i.HEAPF32=new Float32Array(t),i.HEAPF64=new Float64Array(t)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var $=i.TOTAL_MEMORY||16777216;function D(t){for(;0<t.length;){var e,r=t.shift();"function"==typeof r?r():"number"==typeof(e=r.ea)?void 0===r.da?i.dynCall_v(e):i.dynCall_vi(e,r.da):e(void 0===r.da?null:r.da)}}(b=i.wasmMemory||new function(){return{buffer:new ArrayBuffer($/65536*65536),grow:function(t){return rt(t)}}})&&(E=b.buffer),E.byteLength,O(E),P[2216]=5251936;var L,F=[],k=[],B=[],N=[],U=(Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(t,e){var i=65535&t,r=65535&e;return i*r+((t>>>16)*r+i*(e>>>16)<<16)|0}),Math.fround||(L=new Float32Array(1),Math.fround=function(t){return L[0]=t,L[0]}),Math.clz32||(Math.clz32=function(t){var e=32,i=t>>16;return i&&(e-=16,t=i),(i=t>>8)&&(e-=8,t=i),(i=t>>4)&&(e-=4,t=i),(i=t>>2)&&(e-=2,t=i),t>>1?e-2:e-t}),Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),0),G=null;function X(t){throw i.onAbort&&i.onAbort(t),_(t),m(t),T=!0,"abort("+t+"). Build with -s ASSERTIONS=1 for more info."}i.preloadedImages={},i.preloadedAudios={};var V="data:application/octet-stream;base64,";function H(t){return String.prototype.startsWith?t.startsWith(V):0===t.indexOf(V)}var j="_em_module.wasm";function Y(){try{if(y)return new Uint8Array(y);var t=Z(j);if(t)return t;if(u)return u(j);throw"both async and sync fetching of the wasm failed"}catch(t){X(t)}}H(j)||(d=j,j=i.locateFile?i.locateFile(d,p):p+d),k.push({ea:function(){K()}});var z=[null,[],[]];function W(t){for(var e=[],i=0;i<t.length;i++){var r=t[i];255<r&&(r&=255),e.push(String.fromCharCode(r))}return e.join("")}var q="function"==typeof atob?atob:function(t){var e="",i=0;t=t.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(t.charAt(i++)),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(t.charAt(i++)),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(t.charAt(i++)),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(t.charAt(i++)),a=(r=r<<2|n>>4,n=(15&n)<<4|s>>2,(3&s)<<6|o)}while(e+=String.fromCharCode(r),64!==s&&(e+=String.fromCharCode(n)),64!==o&&(e+=String.fromCharCode(a)),i<t.length);return e};function Z(t){if(H(t)){if(t=t.slice(V.length),"boolean"==typeof f&&f){try{var e=Buffer.from(t,"base64")}catch(i){e=new Buffer(t,"base64")}var i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}else try{var r=q(t),n=new Uint8Array(r.length);for(e=0;e<r.length;++e)n[e]=r.charCodeAt(e);i=n}catch(t){throw Error("Converting base64 string to bytes failed.")}return i}}var Q,J={a:function(t,e,i){S.set(S.subarray(e,e+i),t)},b:function(t){if(2147418112<t)return!1;for(var e=Math.max(w.length,16777216);e<t;)e=e<=536870912?R(2*e):Math.min(R((3*e+2147483648)/4),2147418112);t:{try{b.grow(e-E.byteLength+65535>>16),O(b.buffer);var i=1;break t}catch(t){}i=void 0}return!!i},c:function(t,e,i,r){try{for(var n=0,s=0;s<i;s++){for(var o=P[e+8*s>>2],a=P[e+(8*s+4)>>2],h=0;h<a;h++){var u=S[o+h],l=z[t];0===u||10===u?((1===t?_:m)(I(l,0)),l.length=0):l.push(u)}n+=a}return P[r>>2]=n,0}catch(t){return"undefined"!=typeof FS&&t instanceof FS.fa||X(t),t.ga}},memory:b,table:x},K=(p=function(){function t(t){i.asm=t.exports,U--,i.monitorRunDependencies&&i.monitorRunDependencies(U),0==U&&G&&(t=G,G=null,t())}function e(e){t(e.instance)}function r(t){(y||!l&&!c||"function"!=typeof fetch?new Promise(function(t){t(Y())}):fetch(j,{credentials:"same-origin"}).then(function(t){if(t.ok)return t.arrayBuffer();throw"failed to load wasm binary file at '"+j+"'"}).catch(Y)).then(function(){return{then:function(t){t({instance:new g})}}}).then(t,function(t){m("failed to asynchronously prepare wasm: "+t),X(t)})}var n={env:J,wasi_unstable:J};if(U++,i.monitorRunDependencies&&i.monitorRunDependencies(U),i.instantiateWasm)try{return i.instantiateWasm(n,t)}catch(t){return m("Module.instantiateWasm callback failed with error: "+t),!1}return y||"function"!=typeof v.instantiateStreaming||H(j)||"function"!=typeof fetch?r(e):fetch(j,{credentials:"same-origin"}).then(function(t){return v.instantiateStreaming(t,n).then(e,function(t){m("wasm streaming compile failed: "+t),m("falling back to ArrayBuffer instantiation"),r(e)})}),{}}(),i.asm=p,i.___wasm_call_ctors=function(){return i.asm.d.apply(null,arguments)}),tt=(i._csmGetVersion=function(){return i.asm.e.apply(null,arguments)},i._csmGetLatestMocVersion=function(){return i.asm.f.apply(null,arguments)},i._csmGetMocVersion=function(){return i.asm.g.apply(null,arguments)},i._csmHasMocConsistency=function(){return i.asm.h.apply(null,arguments)},i._csmSetLogFunction=function(){return i.asm.i.apply(null,arguments)},i._csmReviveMocInPlace=function(){return i.asm.j.apply(null,arguments)},i._csmReadCanvasInfo=function(){return i.asm.k.apply(null,arguments)},i._csmGetSizeofModel=function(){return i.asm.l.apply(null,arguments)},i._csmInitializeModelInPlace=function(){return i.asm.m.apply(null,arguments)},i._csmUpdateModel=function(){return i.asm.n.apply(null,arguments)},i._csmGetParameterCount=function(){return i.asm.o.apply(null,arguments)},i._csmGetParameterIds=function(){return i.asm.p.apply(null,arguments)},i._csmGetParameterTypes=function(){return i.asm.q.apply(null,arguments)},i._csmGetParameterMinimumValues=function(){return i.asm.r.apply(null,arguments)},i._csmGetParameterMaximumValues=function(){return i.asm.s.apply(null,arguments)},i._csmGetParameterDefaultValues=function(){return i.asm.t.apply(null,arguments)},i._csmGetParameterValues=function(){return i.asm.u.apply(null,arguments)},i._csmGetPartCount=function(){return i.asm.v.apply(null,arguments)},i._csmGetPartIds=function(){return i.asm.w.apply(null,arguments)},i._csmGetPartOpacities=function(){return i.asm.x.apply(null,arguments)},i._csmGetPartParentPartIndices=function(){return i.asm.y.apply(null,arguments)},i._csmGetDrawableCount=function(){return i.asm.z.apply(null,arguments)},i._csmGetDrawableIds=function(){return i.asm.A.apply(null,arguments)},i._csmGetDrawableConstantFlags=function(){return i.asm.B.apply(null,arguments)},i._csmGetDrawableDynamicFlags=function(){return i.asm.C.apply(null,arguments)},i._csmGetDrawableTextureIndices=function(){return i.asm.D.apply(null,arguments)},i._csmGetDrawableDrawOrders=function(){return i.asm.E.apply(null,arguments)},i._csmGetDrawableRenderOrders=function(){return i.asm.F.apply(null,arguments)},i._csmGetDrawableOpacities=function(){return i.asm.G.apply(null,arguments)},i._csmGetDrawableMaskCounts=function(){return i.asm.H.apply(null,arguments)},i._csmGetDrawableMasks=function(){return i.asm.I.apply(null,arguments)},i._csmGetDrawableVertexCounts=function(){return i.asm.J.apply(null,arguments)},i._csmGetDrawableVertexPositions=function(){return i.asm.K.apply(null,arguments)},i._csmGetDrawableVertexUvs=function(){return i.asm.L.apply(null,arguments)},i._csmGetDrawableIndexCounts=function(){return i.asm.M.apply(null,arguments)},i._csmGetDrawableIndices=function(){return i.asm.N.apply(null,arguments)},i._csmGetDrawableMultiplyColors=function(){return i.asm.O.apply(null,arguments)},i._csmGetDrawableScreenColors=function(){return i.asm.P.apply(null,arguments)},i._csmGetDrawableParentPartIndices=function(){return i.asm.Q.apply(null,arguments)},i._csmResetDrawableDynamicFlags=function(){return i.asm.R.apply(null,arguments)},i._csmGetParameterKeyCounts=function(){return i.asm.S.apply(null,arguments)},i._csmGetParameterKeyValues=function(){return i.asm.T.apply(null,arguments)},i._csmMallocMoc=function(){return i.asm.U.apply(null,arguments)},i._csmMallocModelAndInitialize=function(){return i.asm.V.apply(null,arguments)},i._csmMalloc=function(){return i.asm.W.apply(null,arguments)},i._csmFree=function(){return i.asm.X.apply(null,arguments)},i._csmInitializeAmountOfMemory=function(){return i.asm.Y.apply(null,arguments)},i.stackSave=function(){return i.asm.Z.apply(null,arguments)}),et=i.stackAlloc=function(){return i.asm._.apply(null,arguments)},it=i.stackRestore=function(){return i.asm.$.apply(null,arguments)},rt=i.__growWasmMemory=function(){return i.asm.aa.apply(null,arguments)};function nt(){function t(){if(!Q&&(Q=!0,!T)){if(D(k),D(B),i.onRuntimeInitialized&&i.onRuntimeInitialized(),i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;){var t=i.postRun.shift();N.unshift(t)}D(N)}}if(!(0<U)){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)!function(){var t=i.preRun.shift();F.unshift(t)}();D(F),0<U||(i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),t()},1)):t())}}if(i.dynCall_vi=function(){return i.asm.ba.apply(null,arguments)},i.asm=p,i.ccall=function(t,e,r,n){var s={string:function(t){var e=0;if(null!=t&&0!==t){var i=1+(t.length<<2),r=e=et(i),n=S;if(0<i){i=r+i-1;for(var s=0;s<t.length;++s){var o=t.charCodeAt(s);if((o=55296<=o&&o<=57343?65536+((1023&o)<<10)|1023&t.charCodeAt(++s):o)<=127){if(i<=r)break;n[r++]=o}else{if(o<=2047){if(i<=r+1)break;n[r++]=192|o>>6}else{if(o<=65535){if(i<=r+2)break;n[r++]=224|o>>12}else{if(i<=r+3)break;n[r++]=240|o>>18,n[r++]=128|o>>12&63}n[r++]=128|o>>6&63}n[r++]=128|63&o}}n[r]=0}}return e},array:function(t){var e=et(t.length);return w.set(t,e),e}},o=function(t){var e=i["_"+t];return A(e,"Cannot call unknown function "+t+", make sure it is exported"),e}(t),a=[];if(t=0,n)for(var h=0;h<n.length;h++){var u=s[r[h]];u?(0===t&&(t=tt()),a[h]=u(n[h])):a[h]=n[h]}return r=function(t){return"string"===e?C(t):"boolean"===e?!!t:t}(r=o.apply(null,a)),0!==t&&it(t),r},i.UTF8ToString=C,i.addFunction=function(t,e){var i=x.length;try{x.grow(1)}catch(t){if(!t instanceof RangeError)throw t;throw"Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."}try{x.set(i,t)}catch(r){if(!r instanceof TypeError)throw r;A(void 0!==e,"Missing signature argument to addFunction"),x.set(i,t)}return i},i.then=function(t){var e;return Q?t(i):(e=i.onRuntimeInitialized,i.onRuntimeInitialized=function(){e&&e(),t(i)}),i},G=function t(){Q||nt(),Q||(G=t)},i.run=nt,i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);0<i.preInit.length;)i.preInit.pop()();return nt(),t}),c=("object"==(void 0===t?"undefined":e(t))&&"object"==("undefined"==typeof module?"undefined":e(module))?module.exports=l:"function"==typeof define&&define.amd?define([],function(){return l}):"object"==(void 0===t?"undefined":e(t))&&(t._em_module=l),l())}(i=i||{}),window.Live2DCubismCore=i,function(){var t=!0;function e(){t||(this._$MT=null,this._$5S=null,this._$NP=0,e._$42++,this._$5S=new G(this))}function i(e){if(!t){this.clipContextList=new Array,this.glcontext=e.gl,this.dp_webgl=e,this.curFrameNo=0,this.firstError_clipInNotUpdate=!0,this.colorBuffer=0,this.isInitGLFBFunc=!1,this.tmpBoundsOnModel=new T,ot.glContext.length>ot.frameBuffers.length&&(this.curFrameNo=this.getMaskRenderTexture()),this.tmpModelToViewMatrix=new $,this.tmpMatrix2=new $,this.tmpMatrixForMask=new $,this.tmpMatrixForDraw=new $,this.CHANNEL_COLORS=new Array;var i=new P;(i=new P).r=0,i.g=0,i.b=0,i.a=1,this.CHANNEL_COLORS.push(i),(i=new P).r=1,i.g=0,i.b=0,i.a=0,this.CHANNEL_COLORS.push(i),(i=new P).r=0,i.g=1,i.b=0,i.a=0,this.CHANNEL_COLORS.push(i),(i=new P).r=0,i.g=0,i.b=1,i.a=0,this.CHANNEL_COLORS.push(i);for(var r=0;r<this.CHANNEL_COLORS.length;r++)this.dp_webgl.setChannelFlagAsColor(r,this.CHANNEL_COLORS[r])}}function r(t,e,i){this.clipIDList=new Array,this.clipIDList=i,this.clippingMaskDrawIndexList=new Array;for(var r=0;r<i.length;r++)this.clippingMaskDrawIndexList.push(e.getDrawDataIndex(i[r]));this.clippedDrawContextList=new Array,this.isUsing=!0,this.layoutChannelNo=0,this.layoutBounds=new T,this.allClippedDrawRect=new T,this.matrixForMask=new Float32Array(16),this.matrixForDraw=new Float32Array(16),this.owner=t}function n(t,e){this._$gP=t,this.drawDataIndex=e}function s(){t||(this.color=null)}function o(){t||(this._$dP=null,this._$eo=null,this._$V0=null,this._$dP=1e3,this._$eo=1e3,this._$V0=1,this._$a0())}function a(){}function h(){this._$r=null,this._$0S=null}function u(){t||(this.x=null,this.y=null,this.width=null,this.height=null)}function l(e){t||et.prototype.constructor.call(this,e)}function c(e){t||et.prototype.constructor.call(this,e)}function f(){t||(this._$vo=null,this._$F2=null,this._$ao=400,this._$1S=400,f._$42++)}function d(){t||(this.p1=new p,this.p2=new p,this._$Fo=0,this._$Db=0,this._$L2=0,this._$M2=0,this._$ks=0,this._$9b=0,this._$iP=0,this._$iT=0,this._$lL=new Array,this._$qP=new Array,this.setup(.3,.5,.1))}function p(){this._$p=1,this.x=0,this.y=0,this.vx=0,this.vy=0,this.ax=0,this.ay=0,this.fx=0,this.fy=0,this._$s0=0,this._$70=0,this._$7L=0,this._$HL=0}function _(t,e,i){this._$wL=null,this.scale=null,this._$V0=null,this._$wL=t,this.scale=e,this._$V0=i}function g(t,e,i,r){_.prototype.constructor.call(this,e,i,r),this._$tL=null,this._$tL=t}function v(t,e,i){this._$wL=null,this.scale=null,this._$V0=null,this._$wL=t,this.scale=e,this._$V0=i}function y(t,e,i,r){v.prototype.constructor.call(this,e,i,r),this._$YP=null,this._$YP=t}function b(){t||(this._$fL=0,this._$gL=0,this._$B0=1,this._$z0=1,this._$qT=0,this.reflectX=!1,this.reflectY=!1)}e._$0s=1,e._$4s=2,e._$42=0,e._$62=function(t,i){try{if(i instanceof ArrayBuffer&&(i=new DataView(i)),!(i instanceof DataView))throw new ht("_$SS#loadModel(b) / b _$x be DataView or ArrayBuffer");var r,n=new bt(i),s=n._$ST(),o=n._$ST(),h=n._$ST();if(109!=s||111!=o||99!=h)throw new ht("_$gi _$C _$li , _$Q0 _$P0.");if(r=n._$ST(),n._$gr(r),r>U._$T7)throw t._$NP|=e._$4s,new ht("_$gi _$C _$li , _$n0 _$_ version _$li ( SDK : "+U._$T7+" < _$f0 : "+r+" )@_$SS#loadModel()\n");var u=n._$nP();if(r>=U._$s7){var l=n._$9T(),c=n._$9T();if(-30584!=l||-30584!=c)throw t._$NP|=e._$0s,new ht("_$gi _$C _$li , _$0 _$6 _$Ui.")}t._$KS(u);var f=t.getModelContext();f.setDrawParam(t.getDrawParam()),f.init()}catch(t){a._$Rb(t)}},e.prototype._$KS=function(t){this._$MT=t},e.prototype.getModelImpl=function(){return null==this._$MT&&(this._$MT=new f,this._$MT._$zP()),this._$MT},e.prototype.getCanvasWidth=function(){return null==this._$MT?0:this._$MT.getCanvasWidth()},e.prototype.getCanvasHeight=function(){return null==this._$MT?0:this._$MT.getCanvasHeight()},e.prototype.getParamFloat=function(t){return"number"!=typeof t&&(t=this._$5S.getParamIndex(c.getID(t))),this._$5S.getParamFloat(t)},e.prototype.setParamFloat=function(t,e,i){"number"!=typeof t&&(t=this._$5S.getParamIndex(c.getID(t))),arguments.length<3&&(i=1),this._$5S.setParamFloat(t,this._$5S.getParamFloat(t)*(1-i)+e*i)},e.prototype.addToParamFloat=function(t,e,i){"number"!=typeof t&&(t=this._$5S.getParamIndex(c.getID(t))),arguments.length<3&&(i=1),this._$5S.setParamFloat(t,this._$5S.getParamFloat(t)+e*i)},e.prototype.multParamFloat=function(t,e,i){"number"!=typeof t&&(t=this._$5S.getParamIndex(c.getID(t))),arguments.length<3&&(i=1),this._$5S.setParamFloat(t,this._$5S.getParamFloat(t)*(1+(e-1)*i))},e.prototype.getParamIndex=function(t){return this._$5S.getParamIndex(c.getID(t))},e.prototype.loadParam=function(){this._$5S.loadParam()},e.prototype.saveParam=function(){this._$5S.saveParam()},e.prototype.init=function(){this._$5S.init()},e.prototype.update=function(){this._$5S.update()},e.prototype._$Rs=function(){return a._$li("_$60 _$PT _$Rs()"),-1},e.prototype._$Ds=function(t){a._$li("_$60 _$PT _$SS#_$Ds() \n")},e.prototype._$K2=function(){},e.prototype.draw=function(){},e.prototype.getModelContext=function(){return this._$5S},e.prototype._$s2=function(){return this._$NP},e.prototype._$P7=function(t,e,i,r){var n=-1,s=0,o=this,a=.5;if(0!=i)if(1==t.length){p=t[0];var h=0!=o.getParamFloat(p),u=(_=e[0],o.getPartsOpacity(_)),l=i/r;h?(u+=l)>1&&(u=1):(u-=l)<0&&(u=0),o.setPartsOpacity(_,u)}else{for(d=0;d<t.length;d++){p=t[d];if(m=0!=o.getParamFloat(p)){if(n>=0)break;n=d;_=e[d];s=o.getPartsOpacity(_),(s+=i/r)>1&&(s=1)}}n<0&&(console.log("No _$wi _$q0/ _$U default[%s]",t[0]),n=0,s=1,o.loadParam(),o.setParamFloat(t[n],s),o.saveParam());for(d=0;d<t.length;d++){_=e[d];if(n==d)o.setPartsOpacity(_,s);else{var c,f=o.getPartsOpacity(_);(1-(c=s<a?-.5*s/a+1:(1-s)*a/.5))*(1-s)>.15&&(c=1-.15/(1-s)),f>c&&(f=c),o.setPartsOpacity(_,f)}}}else for(var d=0;d<t.length;d++){var p=t[d],_=e[d],m=0!=o.getParamFloat(p);o.setPartsOpacity(_,m?1:0)}},e.prototype.setPartsOpacity=function(t,e){"number"!=typeof t&&(t=this._$5S.getPartsDataIndex(l.getID(t))),this._$5S.setPartsOpacity(t,e)},e.prototype.getPartsDataIndex=function(t){return t instanceof l||(t=l.getID(t)),this._$5S.getPartsDataIndex(t)},e.prototype.getPartsOpacity=function(t){return"number"!=typeof t&&(t=this._$5S.getPartsDataIndex(l.getID(t))),t<0?0:this._$5S.getPartsOpacity(t)},e.prototype.getDrawParam=function(){},e.prototype.getDrawDataIndex=function(t){return this._$5S.getDrawDataIndex(D.getID(t))},e.prototype.getDrawData=function(t){return this._$5S.getDrawData(t)},e.prototype.getTransformedPoints=function(t){var e=this._$5S._$C2(t);return e instanceof lt?e.getTransformedPoints():null},e.prototype.getIndexArray=function(t){if(t<0||t>=this._$5S._$aS.length)return null;var e=this._$5S._$aS[t];return null!=e&&e.getType()==Y._$wb&&e instanceof ut?e.getIndexArray():null},i.CHANNEL_COUNT=4,i.RENDER_TEXTURE_USE_MIPMAP=!1,i.NOT_USED_FRAME=-100,i.prototype._$L7=function(){if(this.tmpModelToViewMatrix&&(this.tmpModelToViewMatrix=null),this.tmpMatrix2&&(this.tmpMatrix2=null),this.tmpMatrixForMask&&(this.tmpMatrixForMask=null),this.tmpMatrixForDraw&&(this.tmpMatrixForDraw=null),this.tmpBoundsOnModel&&(this.tmpBoundsOnModel=null),this.CHANNEL_COLORS){for(var t=this.CHANNEL_COLORS.length-1;t>=0;--t)this.CHANNEL_COLORS.splice(t,1);this.CHANNEL_COLORS=[]}this.releaseShader()},i.prototype.releaseShader=function(){for(var t=ot.frameBuffers.length,e=0;e<t;e++)this.gl.deleteFramebuffer(ot.frameBuffers[e].framebuffer);ot.frameBuffers=[],ot.glContext=[]},i.prototype.init=function(t,e,i){for(var n=0;n<e.length;n++){var s=e[n].getClipIDList();if(null!=s){var o=this.findSameClip(s);null==o&&(o=new r(this,t,s),this.clipContextList.push(o));var a=e[n].getDrawDataID(),h=t.getDrawDataIndex(a);o.addClippedDrawData(a,h),i[n].clipBufPre_clipContext=o}}},i.prototype.getMaskRenderTexture=function(){var t;return t=this.dp_webgl.createFramebuffer(),ot.frameBuffers[this.dp_webgl.glno]=t,this.dp_webgl.glno},i.prototype.setupClip=function(t,e){for(var i=0,r=0;r<this.clipContextList.length;r++){var n=this.clipContextList[r];this.calcClippedDrawTotalBounds(t,n),n.isUsing&&i++}if(i>0){var s=e.gl.getParameter(e.gl.FRAMEBUFFER_BINDING),o=new Array(4);o[0]=0,o[1]=0,o[2]=e.gl.canvas.width,o[3]=e.gl.canvas.height,e.gl.viewport(0,0,ot.clippingMaskBufferSize,ot.clippingMaskBufferSize),this.setupLayoutBounds(i),e.gl.bindFramebuffer(e.gl.FRAMEBUFFER,ot.frameBuffers[this.curFrameNo].framebuffer),e.gl.clearColor(0,0,0,0),e.gl.clear(e.gl.COLOR_BUFFER_BIT);for(r=0;r<this.clipContextList.length;r++){var a=(n=this.clipContextList[r]).allClippedDrawRect;n.layoutChannelNo;var h=n.layoutBounds;this.tmpBoundsOnModel._$jL(a),this.tmpBoundsOnModel.expand(.05*a.width,.05*a.height);var u=h.width/this.tmpBoundsOnModel.width,l=h.height/this.tmpBoundsOnModel.height;this.tmpMatrix2.identity(),this.tmpMatrix2.translate(-1,-1,0),this.tmpMatrix2.scale(2,2,1),this.tmpMatrix2.translate(h.x,h.y,0),this.tmpMatrix2.scale(u,l,1),this.tmpMatrix2.translate(-this.tmpBoundsOnModel.x,-this.tmpBoundsOnModel.y,0),this.tmpMatrixForMask.setMatrix(this.tmpMatrix2.m),this.tmpMatrix2.identity(),this.tmpMatrix2.translate(h.x,h.y,0),this.tmpMatrix2.scale(u,l,1),this.tmpMatrix2.translate(-this.tmpBoundsOnModel.x,-this.tmpBoundsOnModel.y,0),this.tmpMatrixForDraw.setMatrix(this.tmpMatrix2.m);for(var c=this.tmpMatrixForMask.getArray(),f=0;f<16;f++)n.matrixForMask[f]=c[f];var d=this.tmpMatrixForDraw.getArray();for(f=0;f<16;f++)n.matrixForDraw[f]=d[f];for(var p=n.clippingMaskDrawIndexList.length,_=0;_<p;_++){var m=n.clippingMaskDrawIndexList[_],g=t.getDrawData(m),v=t._$C2(m);e.setClipBufPre_clipContextForMask(n),g.draw(e,t,v)}}e.gl.bindFramebuffer(e.gl.FRAMEBUFFER,s),e.setClipBufPre_clipContextForMask(null),e.gl.viewport(o[0],o[1],o[2],o[3])}},i.prototype.getColorBuffer=function(){return this.colorBuffer},i.prototype.findSameClip=function(t){for(var e=0;e<this.clipContextList.length;e++){var i=this.clipContextList[e],r=i.clipIDList.length;if(r==t.length){for(var n=0,s=0;s<r;s++)for(var o=i.clipIDList[s],a=0;a<r;a++)if(t[a]==o){n++;break}if(n==r)return i}}return null},i.prototype.calcClippedDrawTotalBounds=function(t,e){for(var i=t._$Ri.getModelImpl().getCanvasWidth(),r=t._$Ri.getModelImpl().getCanvasHeight(),n=i>r?i:r,s=n,o=n,a=0,h=0,u=e.clippedDrawContextList.length,l=0;l<u;l++){var c=e.clippedDrawContextList[l].drawDataIndex,f=t._$C2(c);if(f._$yo()){for(var d=f.getTransformedPoints(),p=d.length,_=[],m=[],g=0,v=N._$i2;v<p;v+=N._$No)_[g]=d[v],m[g]=d[v+1],g++;var y=Math.min.apply(null,_),b=Math.min.apply(null,m),x=Math.max.apply(null,_),T=Math.max.apply(null,m);y<s&&(s=y),b<o&&(o=b),x>a&&(a=x),T>h&&(h=T)}}if(s==n)e.allClippedDrawRect.x=0,e.allClippedDrawRect.y=0,e.allClippedDrawRect.width=0,e.allClippedDrawRect.height=0,e.isUsing=!1;else{var A=a-s,E=h-o;e.allClippedDrawRect.x=s,e.allClippedDrawRect.y=o,e.allClippedDrawRect.width=A,e.allClippedDrawRect.height=E,e.isUsing=!0}},i.prototype.setupLayoutBounds=function(t){var e=t/i.CHANNEL_COUNT,r=t%i.CHANNEL_COUNT;e=~~e,r=~~r;for(var n=0,s=0;s<i.CHANNEL_COUNT;s++){var o=e+(s<r?1:0);if(0==o);else if(1==o)(c=this.clipContextList[n++]).layoutChannelNo=s,c.layoutBounds.x=0,c.layoutBounds.y=0,c.layoutBounds.width=1,c.layoutBounds.height=1;else if(2==o)for(var h=0;h<o;h++){var u=0;l=~~(l=h%2),(c=this.clipContextList[n++]).layoutChannelNo=s,c.layoutBounds.x=.5*l,c.layoutBounds.y=0,c.layoutBounds.width=.5,c.layoutBounds.height=1}else if(o<=4)for(h=0;h<o;h++){l=~~(l=h%2),u=~~(u=h/2),(c=this.clipContextList[n++]).layoutChannelNo=s,c.layoutBounds.x=.5*l,c.layoutBounds.y=.5*u,c.layoutBounds.width=.5,c.layoutBounds.height=.5}else if(o<=9)for(h=0;h<o;h++){var l,c;l=~~(l=h%3),u=~~(u=h/3),(c=this.clipContextList[n++]).layoutChannelNo=s,c.layoutBounds.x=l/3,c.layoutBounds.y=u/3,c.layoutBounds.width=1/3,c.layoutBounds.height=1/3}else a._$li("_$6 _$0P mask count : %d",o)}},r.prototype.addClippedDrawData=function(t,e){var i=new n(t,e);this.clippedDrawContextList.push(i)},o._$JT=function(t,e,i){var r=t/e,n=i/e,s=1/3,o=2/3,a=1-(1-n)*(1-n),h=1-(1-n)*(1-n),u=(1-n)*s*a+(n*o+(1-n)*s)*(1-a),l=(n+(1-n)*o)*h+(n*s+(1-n)*o)*(1-h);if(r<=0)return 0;if(r>=1)return 1;var c=r*r;return(1-3*l+3*u-0)*(r*c)+(3*l-6*u+0)*c+(3*u-0)*r+0},o.prototype._$a0=function(){},o.prototype.setFadeIn=function(t){this._$dP=t},o.prototype.setFadeOut=function(t){this._$eo=t},o.prototype._$pT=function(t){this._$V0=t},o.prototype.getFadeOut=function(){return this._$eo},o.prototype._$4T=function(){return this._$eo},o.prototype._$mT=function(){return this._$V0},o.prototype.getDurationMSec=function(){return-1},o.prototype.getLoopDurationMSec=function(){return-1},o.prototype.updateParam=function(t,e){if(e._$AT&&!e._$9L){var i=I.getUserTimeMSec();if(e._$z2<0){e._$z2=i,e._$bs=i;var r=this.getDurationMSec();e._$Do<0&&(e._$Do=r<=0?-1:e._$z2+r)}var n=this._$V0;0<=(n=n*(0==this._$dP?1:at._$r2((i-e._$bs)/this._$dP))*(0==this._$eo||e._$Do<0?1:at._$r2((e._$Do-i)/this._$eo)))&&n<=1||console.log("### assert!! ### "),this.updateParamExe(t,i,n,e),e._$Do>0&&e._$Do<i&&(e._$9L=!0)}},o.prototype.updateParamExe=function(t,e,i,r){},a._$8s=0,a._$fT=new Object,a.start=function(t){var e=a._$fT[t];null==e&&((e=new h)._$r=t,a._$fT[t]=e),e._$0S=I.getSystemTimeMSec()},a.dump=function(t){var e=a._$fT[t];if(null!=e){var i=I.getSystemTimeMSec()-e._$0S;return console.log(t+" : "+i+"ms"),i}return-1},a.end=function(t){var e=a._$fT[t];return null!=e?I.getSystemTimeMSec()-e._$0S:-1},a._$li=function(t,e){console.log("_$li : "+t+"\n",e)},a._$Ji=function(t,e){console.log(t,e)},a._$dL=function(t,e){console.log(t,e),console.log("\n")},a._$KL=function(t,e){for(var i=0;i<e;i++)i%16==0&&i>0?console.log("\n"):i%8==0&&i>0&&console.log("  "),console.log("%02X ",255&t[i]);console.log("\n")},a._$nr=function(t,e,i){console.log("%s\n",t);for(var r=e.length,n=0;n<r;++n)console.log("%5d",e[n]),console.log("%s\n",i),console.log(",");console.log("\n")},a._$Rb=function(t){console.log("dump exception : "+t),console.log("stack :: "+t.stack)},u.prototype._$8P=function(){return.5*(this.x+this.x+this.width)},u.prototype._$6P=function(){return.5*(this.y+this.y+this.height)},u.prototype._$EL=function(){return this.x+this.width},u.prototype._$5T=function(){return this.y+this.height},u.prototype._$jL=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r},u.prototype._$jL=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},l.prototype=new et,l._$tP=new Object,l._$27=function(){l._$tP.clear()},l.getID=function(t){var e=l._$tP[t];return null==e&&(e=new l(t),l._$tP[t]=e),e},l.prototype._$3s=function(){return new l},c.prototype=new et,c._$tP=new Object,c._$27=function(){c._$tP.clear()},c.getID=function(t){var e=c._$tP[t];return null==e&&(e=new c(t),c._$tP[t]=e),e},c.prototype._$3s=function(){return new c},f._$42=0,f.prototype._$zP=function(){null==this._$vo&&(this._$vo=new it),null==this._$F2&&(this._$F2=new Array)},f.prototype.getCanvasWidth=function(){return this._$ao},f.prototype.getCanvasHeight=function(){return this._$1S},f.prototype._$F0=function(t){this._$vo=t._$nP(),this._$F2=t._$nP(),this._$ao=t._$6L(),this._$1S=t._$6L()},f.prototype._$6S=function(t){this._$F2.push(t)},f.prototype._$Xr=function(){return this._$F2},f.prototype._$E2=function(){return this._$vo},d.prototype.setup=function(t,e,i){this._$ks=this._$Yb(),this.p2._$xT(),3==arguments.length&&(this._$Fo=t,this._$L2=e,this.p1._$p=i,this.p2._$p=i,this.p2.y=t,this.setup())},d.prototype.getPhysicsPoint1=function(){return this.p1},d.prototype.getPhysicsPoint2=function(){return this.p2},d.prototype._$qr=function(){return this._$Db},d.prototype._$pr=function(t){this._$Db=t},d.prototype._$5r=function(){return this._$M2},d.prototype._$Cs=function(){return this._$9b},d.prototype._$Yb=function(){return-180*Math.atan2(this.p1.x-this.p2.x,-(this.p1.y-this.p2.y))/Math.PI},d.prototype.addSrcParam=function(t,e,i,r){var n=new g(t,e,i,r);this._$lL.push(n)},d.prototype.addTargetParam=function(t,e,i,r){var n=new y(t,e,i,r);this._$qP.push(n)},d.prototype.update=function(t,e){if(0==this._$iP)return this._$iP=this._$iT=e,void(this._$Fo=Math.sqrt((this.p1.x-this.p2.x)*(this.p1.x-this.p2.x)+(this.p1.y-this.p2.y)*(this.p1.y-this.p2.y)));var i=(e-this._$iT)/1e3;if(0!=i){for(var r=this._$lL.length-1;r>=0;--r){this._$lL[r]._$oP(t,this)}this._$oo(t,i),this._$M2=this._$Yb(),this._$9b=(this._$M2-this._$ks)/i,this._$ks=this._$M2}for(r=this._$qP.length-1;r>=0;--r){this._$qP[r]._$YS(t,this)}this._$iT=e},d.prototype._$oo=function(t,e){e<.033&&(e=.033);var i=1/e;this.p1.vx=(this.p1.x-this.p1._$s0)*i,this.p1.vy=(this.p1.y-this.p1._$70)*i,this.p1.ax=(this.p1.vx-this.p1._$7L)*i,this.p1.ay=(this.p1.vy-this.p1._$HL)*i,this.p1.fx=this.p1.ax*this.p1._$p,this.p1.fy=this.p1.ay*this.p1._$p,this.p1._$xT();var r,n,s=-Math.atan2(this.p1.y-this.p2.y,this.p1.x-this.p2.x),o=Math.cos(s),a=Math.sin(s),h=9.8*this.p2._$p,u=this._$Db*Tt._$bS,l=h*Math.cos(s-u);r=l*a,n=l*o;var c=-this.p1.fx*a*a,f=-this.p1.fy*a*o,d=-this.p2.vx*this._$L2,p=-this.p2.vy*this._$L2;this.p2.fx=r+c+d,this.p2.fy=n+f+p,this.p2.ax=this.p2.fx/this.p2._$p,this.p2.ay=this.p2.fy/this.p2._$p,this.p2.vx+=this.p2.ax*e,this.p2.vy+=this.p2.ay*e,this.p2.x+=this.p2.vx*e,this.p2.y+=this.p2.vy*e;var _=Math.sqrt((this.p1.x-this.p2.x)*(this.p1.x-this.p2.x)+(this.p1.y-this.p2.y)*(this.p1.y-this.p2.y));this.p2.x=this.p1.x+this._$Fo*(this.p2.x-this.p1.x)/_,this.p2.y=this.p1.y+this._$Fo*(this.p2.y-this.p1.y)/_,this.p2.vx=(this.p2.x-this.p2._$s0)*i,this.p2.vy=(this.p2.y-this.p2._$70)*i,this.p2._$xT()},p.prototype._$xT=function(){this._$s0=this.x,this._$70=this.y,this._$7L=this.vx,this._$HL=this.vy},_.prototype._$oP=function(t,e){},g.prototype=new _,g.prototype._$oP=function(t,e){var i=this.scale*t.getParamFloat(this._$wL),r=e.getPhysicsPoint1();switch(this._$tL){default:case d.Src.SRC_TO_X:r.x=r.x+(i-r.x)*this._$V0;break;case d.Src.SRC_TO_Y:r.y=r.y+(i-r.y)*this._$V0;break;case d.Src.SRC_TO_G_ANGLE:var n=e._$qr();n+=(i-n)*this._$V0,e._$pr(n)}},v.prototype._$YS=function(t,e){},y.prototype=new v,y.prototype._$YS=function(t,e){switch(this._$YP){default:case d.Target.TARGET_FROM_ANGLE:t.setParamFloat(this._$wL,this.scale*e._$5r(),this._$V0);break;case d.Target.TARGET_FROM_ANGLE_V:t.setParamFloat(this._$wL,this.scale*e._$Cs(),this._$V0)}},d.Src=function(){},d.Src.SRC_TO_X="SRC_TO_X",d.Src.SRC_TO_Y="SRC_TO_Y",d.Src.SRC_TO_G_ANGLE="SRC_TO_G_ANGLE",d.Target=function(){},d.Target.TARGET_FROM_ANGLE="TARGET_FROM_ANGLE",d.Target.TARGET_FROM_ANGLE_V="TARGET_FROM_ANGLE_V",b.prototype.init=function(t){this._$fL=t._$fL,this._$gL=t._$gL,this._$B0=t._$B0,this._$z0=t._$z0,this._$qT=t._$qT,this.reflectX=t.reflectX,this.reflectY=t.reflectY},b.prototype._$F0=function(t){this._$fL=t._$_T(),this._$gL=t._$_T(),this._$B0=t._$_T(),this._$z0=t._$_T(),this._$qT=t._$_T(),t.getFormatVersion()>=U.LIVE2D_FORMAT_VERSION_V2_10_SDK2&&(this.reflectX=t._$po(),this.reflectY=t._$po())},b.prototype._$e=function(){};var x=function(){};function T(){t||(this.x=null,this.y=null,this.width=null,this.height=null)}function A(){}function E(){t||(this.x=null,this.y=null)}function w(){t||(this._$gP=null,this._$dr=null,this._$GS=null,this._$qb=null,this._$Lb=null,this._$mS=null,this.clipID=null,this.clipIDList=new Array)}function S(){t||(this._$Eb=S._$ps,this._$lT=1,this._$C0=1,this._$tT=1,this._$WL=1,this.culling=!1,this.matrix4x4=new Float32Array(16),this.premultipliedAlpha=!1,this.anisotropy=0,this.clippingProcess=S.CLIPPING_PROCESS_NONE,this.clipBufPre_clipContextMask=null,this.clipBufPre_clipContextDraw=null,this.CHANNEL_COLORS=new Array)}function P(){t||(this.a=1,this.r=1,this.g=1,this.b=1,this.scale=1,this._$ho=1,this.blendMode=ot.L2D_COLOR_BLEND_MODE_MULT)}function M(){t||(this._$kP=null,this._$dr=null,this._$Ai=!0,this._$mS=null)}function I(){}function C(){t||(this._$VP=0,this._$wL=null,this._$GP=null,this._$8o=C._$ds,this._$2r=-1,this._$O2=0,this._$ri=0)}function R(){}function O(){t||(this._$Ob=null)}function $(){this.m=new Float32Array(16),this.identity()}function D(e){t||et.prototype.constructor.call(this,e)}function L(){t||(this._$7=1,this._$f=0,this._$H=0,this._$g=1,this._$k=0,this._$w=0,this._$hi=STATE_IDENTITY,this._$Z=_$pS)}function F(){t||(o.prototype.constructor.call(this),this.motions=new Array,this._$7r=null,this._$7r=F._$Co++,this._$D0=30,this._$yT=0,this._$E=!0,this.loopFadeIn=!0,this._$AS=-1,_$a0())}function k(){this._$P=new Float32Array(100),this.size=0}function B(){this._$4P=null,this._$I0=null,this._$RP=null}function N(){}function U(){}function G(e){t||(this._$QT=!0,this._$co=-1,this._$qo=0,this._$pb=new Array(G._$is),this._$_2=new Float32Array(G._$is),this._$vr=new Float32Array(G._$is),this._$Rr=new Float32Array(G._$is),this._$Or=new Float32Array(G._$is),this._$fs=new Float32Array(G._$is),this._$Js=new Array(G._$is),this._$3S=new Array,this._$aS=new Array,this._$Bo=null,this._$F2=new Array,this._$db=new Array,this._$8b=new Array,this._$Hr=new Array,this._$Ws=null,this._$Vs=null,this._$Er=null,this._$Es=new Int16Array(N._$Qb),this._$ZP=new Float32Array(2*N._$1r),this._$Ri=e,this._$b0=G._$HP++,this.clipManager=null,this.dp_webgl=null)}function X(){}function V(){t||(S.prototype.constructor.call(this),this._$sb=new Int32Array(V._$As),this._$U2=new Array,this.transform=null,this.gl=null,null==V._$NT&&(V._$NT=V._$9r(256),V._$vS=V._$9r(256),V._$no=V._$vb(256)))}function H(){t||(M.prototype.constructor.call(this),this._$GS=null,this._$Y0=null)}function j(t){st.prototype.constructor.call(this,t),this._$8r=M._$ur,this._$Yr=null,this._$Wr=null}function Y(){t||(w.prototype.constructor.call(this),this._$gP=null,this._$dr=null,this._$GS=null,this._$qb=null,this._$Lb=null,this._$mS=null)}function z(){t||(this._$NL=null,this._$3S=null,this._$aS=null,z._$42++)}function W(){t||(e.prototype.constructor.call(this),this._$zo=new V)}function q(){t||(o.prototype.constructor.call(this),this.motions=new Array,this._$o2=null,this._$7r=q._$Co++,this._$D0=30,this._$yT=0,this._$E=!1,this.loopFadeIn=!0,this._$rr=-1,this._$eP=0)}function Z(t,e){return String.fromCharCode(t.getUint8(e))}function k(){this._$P=new Float32Array(100),this.size=0}function B(){this._$4P=null,this._$I0=null,this._$RP=null}function Q(){t||(M.prototype.constructor.call(this),this._$o=0,this._$A=0,this._$GS=null,this._$Eo=null)}function J(t){st.prototype.constructor.call(this,t),this._$8r=M._$ur,this._$Cr=null,this._$hr=null}function K(){t||(this.visible=!0,this._$g0=!1,this._$NL=null,this._$3S=null,this._$aS=null,K._$42++)}function tt(t){this._$VS=null,this._$e0=null,this._$e0=t}function et(e){t||(this.id=e)}function it(){t||(this._$4S=null)}function rt(t,e){this.canvas=t,this.context=e,this.viewport=new Array(0,0,t.width,t.height),this._$6r=1,this._$xP=0,this._$3r=1,this._$uP=0,this._$Qo=-1,this.cacheImages={}}function nt(){t||(this._$TT=null,this._$LT=null,this._$FS=null,this._$wL=null)}function st(e){t||(this._$e0=null,this._$IP=null,this._$JS=!1,this._$AT=!0,this._$e0=e,this.totalScale=1,this._$7s=1,this.totalOpacity=1)}function ot(){}function at(){}function ht(e){t||(this._$ib=e)}function ut(){t||(Y.prototype.constructor.call(this),this._$LP=-1,this._$d0=0,this._$Yo=0,this._$JP=null,this._$5P=null,this._$BP=null,this._$Eo=null,this._$Qi=null,this._$6s=ut._$ms,this.culling=!0,this.gl_cacheImage=null,this.instanceNo=ut._$42++)}function lt(t){At.prototype.constructor.call(this,t),this._$8r=Y._$ur,this._$Cr=null,this._$hr=null}function ct(){t||(this.x=null,this.y=null)}function ft(i){t||(e.prototype.constructor.call(this),this.drawParamWebGL=new gt(i),this.drawParamWebGL.setGL(ot.getGL(i)))}function dt(){t||(this.motions=null,this._$eb=!1,this.motions=new Array)}function pt(){this._$w0=null,this._$AT=!0,this._$9L=!1,this._$z2=-1,this._$bs=-1,this._$Do=-1,this._$sr=null,this._$sr=pt._$Gs++}function _t(){this.m=new Array(1,0,0,0,1,0,0,0,1)}function mt(e){t||et.prototype.constructor.call(this,e)}function gt(e){t||(S.prototype.constructor.call(this),this.textures=new Array,this.transform=null,this.gl=null,this.glno=e,this.firstDraw=!0,this.anisotropyExt=null,this.maxAnisotropy=0,this._$As=32,this._$Gr=!1,this._$NT=null,this._$vS=null,this._$no=null,this.vertShader=null,this.fragShader=null,this.vertShaderOff=null,this.fragShaderOff=null)}function vt(t,e,i){return null==e&&(e=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW),e}function yt(t,e,i){return null==e&&(e=t.createBuffer()),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),t.bufferData(t.ELEMENT_ARRAY_BUFFER,i,t.DYNAMIC_DRAW),e}function bt(e){t||(this._$P=new Int8Array(8),this._$R0=new DataView(this._$P.buffer),this._$3i=new Int8Array(1e3),this._$hL=0,this._$v0=0,this._$S2=0,this._$Ko=new Array,this._$T=e,this._$F=0)}x._$ni=function(t,e,i,r,n,s,o,a,h){var u=o*s-a*n;if(0==u)return null;var l,c=((t-i)*s-(e-r)*n)/u;return l=0!=n?(t-i-c*o)/n:(e-r-c*a)/s,isNaN(l)&&(l=(t-i-c*o)/n,isNaN(l)&&(l=(e-r-c*a)/s),isNaN(l)&&(console.log("a is NaN @UtVector#_$ni() "),console.log("v1x : "+n),console.log("v1x != 0 ? "+(0!=n)))),null==h?new Array(l,c):(h[0]=l,h[1]=c,h)},T.prototype._$8P=function(){return this.x+.5*this.width},T.prototype._$6P=function(){return this.y+.5*this.height},T.prototype._$EL=function(){return this.x+this.width},T.prototype._$5T=function(){return this.y+this.height},T.prototype._$jL=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r},T.prototype._$jL=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},T.prototype.contains=function(t,e){return this.x<=this.x&&this.y<=this.y&&this.x<=this.x+this.width&&this.y<=this.y+this.height},T.prototype.expand=function(t,e){this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e},A._$Z2=function(t,e,i,r){var n=e._$Q2(t,i),s=t._$vs(),o=t._$Tr();if(e._$zr(s,o,n),n<=0)return r[s[0]];if(1==n)return(a=r[s[0]])+((h=r[s[1]])-a)*(y=o[0])|0;if(2==n){var a=r[s[0]],h=r[s[1]],u=r[s[2]],l=r[s[3]];return(T=a+(h-a)*(y=o[0])|0)+((u+(l-u)*y|0)-T)*(b=o[1])|0}if(3==n){var c=r[s[0]],f=r[s[1]],d=r[s[2]],p=r[s[3]],_=r[s[4]],m=r[s[5]],g=r[s[6]],v=r[s[7]];return(T=(a=c+(f-c)*(y=o[0])|0)+((h=d+(p-d)*y|0)-a)*(b=o[1])|0)+(((u=_+(m-_)*y|0)+((l=g+(v-g)*y|0)-u)*b|0)-T)*(x=o[2])|0}if(4==n){var y,b,x,T,A=r[s[0]],E=r[s[1]],w=r[s[2]],S=r[s[3]],P=r[s[4]],M=r[s[5]],I=r[s[6]],C=r[s[7]],R=r[s[8]],O=r[s[9]],$=r[s[10]],D=r[s[11]],L=r[s[12]],F=r[s[13]],k=r[s[14]],B=r[s[15]];return(T=(a=(c=A+(E-A)*(y=o[0])|0)+((f=w+(S-w)*y|0)-c)*(b=o[1])|0)+((h=(d=P+(M-P)*y|0)+((p=I+(C-I)*y|0)-d)*b|0)-a)*(x=o[2])|0)+(((u=(_=R+(O-R)*y|0)+((m=$+(D-$)*y|0)-_)*b|0)+((l=(g=L+(F-L)*y|0)+((v=k+(B-k)*y|0)-g)*b|0)-u)*x|0)-T)*o[3]|0}for(var N=1<<n,U=new Float32Array(N),G=0;G<N;G++){for(var X=G,V=1,H=0;H<n;H++)V*=X%2==0?1-o[H]:o[H],X/=2;U[G]=V}for(var j=new Float32Array(N),Y=0;Y<N;Y++)j[Y]=r[s[Y]];var z=0;for(Y=0;Y<N;Y++)z+=U[Y]*j[Y];return z+.5|0},A._$br=function(t,e,i,r){var n=e._$Q2(t,i),s=t._$vs(),o=t._$Tr();if(e._$zr(s,o,n),n<=0)return r[s[0]];if(1==n)return(a=r[s[0]])+((h=r[s[1]])-a)*(c=o[0]);if(2==n){var a=r[s[0]],h=r[s[1]],u=r[s[2]],l=r[s[3]],c=o[0];return(1-(b=o[1]))*(a+(h-a)*c)+b*(u+(l-u)*c)}if(3==n){var f=r[s[0]],d=r[s[1]],p=r[s[2]],_=r[s[3]],m=r[s[4]],g=r[s[5]],v=r[s[6]],y=r[s[7]],b=(c=o[0],o[1]);return(1-(k=o[2]))*((1-b)*(f+(d-f)*c)+b*(p+(_-p)*c))+k*((1-b)*(m+(g-m)*c)+b*(v+(y-v)*c))}if(4==n){var x=r[s[0]],T=r[s[1]],A=r[s[2]],E=r[s[3]],w=r[s[4]],S=r[s[5]],P=r[s[6]],M=r[s[7]],I=r[s[8]],C=r[s[9]],R=r[s[10]],O=r[s[11]],$=r[s[12]],D=r[s[13]],L=r[s[14]],F=r[s[15]],k=(c=o[0],b=o[1],o[2]),B=o[3];return(1-B)*((1-k)*((1-b)*(x+(T-x)*c)+b*(A+(E-A)*c))+k*((1-b)*(w+(S-w)*c)+b*(P+(M-P)*c)))+B*((1-k)*((1-b)*(I+(C-I)*c)+b*(R+(O-R)*c))+k*((1-b)*($+(D-$)*c)+b*(L+(F-L)*c)))}for(var N=1<<n,U=new Float32Array(N),G=0;G<N;G++){for(var X=G,V=1,H=0;H<n;H++)V*=X%2==0?1-o[H]:o[H],X/=2;U[G]=V}for(var j=new Float32Array(N),Y=0;Y<N;Y++)j[Y]=r[s[Y]];var z=0;for(Y=0;Y<N;Y++)z+=U[Y]*j[Y];return z},A._$Vr=function(t,e,i,r,n,s,o,a){var h=e._$Q2(t,i),u=t._$vs(),l=t._$Tr();e._$zr(u,l,h);var c=2*r,f=o;if(h<=0){var d=n[u[0]];if(2==a&&0==o)I._$jT(d,0,s,0,c);else for(var p=0;p<c;)s[f]=d[p++],s[f+1]=d[p++],f+=a}else if(1==h){d=n[u[0]];var _=n[u[1]],m=1-(y=l[0]);for(p=0;p<c;)s[f]=d[p]*m+_[p]*y,++p,s[f+1]=d[p]*m+_[p]*y,++p,f+=a}else if(2==h){d=n[u[0]],_=n[u[1]];var g=n[u[2]],v=n[u[3]],y=l[0],b=(X=1-($=l[1]))*(m=1-y),x=X*y,T=$*m,A=$*y;for(p=0;p<c;)s[f]=b*d[p]+x*_[p]+T*g[p]+A*v[p],++p,s[f+1]=b*d[p]+x*_[p]+T*g[p]+A*v[p],++p,f+=a}else if(3==h){var E=n[u[0]],w=n[u[1]],S=n[u[2]],P=n[u[3]],M=n[u[4]],C=n[u[5]],R=n[u[6]],O=n[u[7]],$=(y=l[0],l[1]),D=(V=1-(ot=l[2]))*(X=1-$)*(m=1-y),L=V*X*y,F=V*$*m,k=V*$*y,B=ot*X*m,N=ot*X*y,U=ot*$*m,G=ot*$*y;for(p=0;p<c;)s[f]=D*E[p]+L*w[p]+F*S[p]+k*P[p]+B*M[p]+N*C[p]+U*R[p]+G*O[p],++p,s[f+1]=D*E[p]+L*w[p]+F*S[p]+k*P[p]+B*M[p]+N*C[p]+U*R[p]+G*O[p],++p,f+=a}else if(4==h){var X,V,H=n[u[0]],j=n[u[1]],Y=n[u[2]],z=n[u[3]],W=n[u[4]],q=n[u[5]],Z=n[u[6]],Q=n[u[7]],J=n[u[8]],K=n[u[9]],tt=n[u[10]],et=n[u[11]],it=n[u[12]],rt=n[u[13]],nt=n[u[14]],st=n[u[15]],ot=(y=l[0],$=l[1],l[2]),at=l[3],ht=1-at,ut=ht*(V=1-ot)*(X=1-$)*(m=1-y),lt=ht*V*X*y,ct=ht*V*$*m,ft=ht*V*$*y,dt=ht*ot*X*m,pt=ht*ot*X*y,_t=ht*ot*$*m,mt=ht*ot*$*y,gt=at*V*X*m,vt=at*V*X*y,yt=at*V*$*m,bt=at*V*$*y,xt=at*ot*X*m,Tt=at*ot*X*y,At=at*ot*$*m,Et=at*ot*$*y;for(p=0;p<c;)s[f]=ut*H[p]+lt*j[p]+ct*Y[p]+ft*z[p]+dt*W[p]+pt*q[p]+_t*Z[p]+mt*Q[p]+gt*J[p]+vt*K[p]+yt*tt[p]+bt*et[p]+xt*it[p]+Tt*rt[p]+At*nt[p]+Et*st[p],++p,s[f+1]=ut*H[p]+lt*j[p]+ct*Y[p]+ft*z[p]+dt*W[p]+pt*q[p]+_t*Z[p]+mt*Q[p]+gt*J[p]+vt*K[p]+yt*tt[p]+bt*et[p]+xt*it[p]+Tt*rt[p]+At*nt[p]+Et*st[p],++p,f+=a}else{for(var wt=1<<h,St=new Float32Array(wt),Pt=0;Pt<wt;Pt++){for(var Mt=Pt,It=1,Ct=0;Ct<h;Ct++)It*=Mt%2==0?1-l[Ct]:l[Ct],Mt/=2;St[Pt]=It}for(var Rt=new Float32Array(wt),Ot=0;Ot<wt;Ot++)Rt[Ot]=n[u[Ot]];for(p=0;p<c;){var $t=0,Dt=0,Lt=p+1;for(Ot=0;Ot<wt;Ot++)$t+=St[Ot]*Rt[Ot][p],Dt+=St[Ot]*Rt[Ot][Lt];p+=2,s[f]=$t,s[f+1]=Dt,f+=a}}},E.prototype._$HT=function(t,e){this.x=t,this.y=e},E.prototype._$HT=function(t){this.x=t.x,this.y=t.y},w._$ur=-2,w._$ES=500,w._$wb=2,w._$8S=3,w._$52=w._$ES,w._$R2=w._$ES,w._$or=function(){return w._$52},w._$Pr=function(){return w._$R2},w.prototype.convertClipIDForV2_11=function(t){var e=[];return null==t||0==t.length?null:/,/.test(t)?e=t.id.split(","):(e.push(t.id),e)},w.prototype._$F0=function(t){this._$gP=t._$nP(),this._$dr=t._$nP(),this._$GS=t._$nP(),this._$qb=t._$6L(),this._$Lb=t._$cS(),this._$mS=t._$Tb(),t.getFormatVersion()>=U._$T7?(this.clipID=t._$nP(),this.clipIDList=this.convertClipIDForV2_11(this.clipID)):this.clipIDList=[],this._$MS(this._$Lb)},w.prototype.getClipIDList=function(){return this.clipIDList},w.prototype.init=function(t){},w.prototype._$Nr=function(t,e){if(e._$IS[0]=!1,e._$Us=A._$Z2(t,this._$GS,e._$IS,this._$Lb),ot._$Zs);else if(e._$IS[0])return;e._$7s=A._$br(t,this._$GS,e._$IS,this._$mS)},w.prototype._$2b=function(t,e){},w.prototype.getDrawDataID=function(){return this._$gP},w.prototype._$j2=function(t){this._$gP=t},w.prototype.getOpacity=function(t,e){return e._$7s},w.prototype._$zS=function(t,e){return e._$Us},w.prototype._$MS=function(t){for(var e=t.length-1;e>=0;--e){var i=t[e];i<w._$52?w._$52=i:i>w._$R2&&(w._$R2=i)}},w.prototype.getTargetBaseDataID=function(){return this._$dr},w.prototype._$gs=function(t){this._$dr=t},w.prototype._$32=function(){return null!=this._$dr&&this._$dr!=mt._$2o()},w.prototype.preDraw=function(t,e,i){},w.prototype.draw=function(t,e,i){},w.prototype.getType=function(){},w.prototype._$B2=function(t,e,i){},S._$ps=32,S.CLIPPING_PROCESS_NONE=0,S.CLIPPING_PROCESS_OVERWRITE_ALPHA=1,S.CLIPPING_PROCESS_MULTIPLY_ALPHA=2,S.CLIPPING_PROCESS_DRAW=3,S.CLIPPING_PROCESS_CLEAR_ALPHA=4,S.prototype.setChannelFlagAsColor=function(t,e){this.CHANNEL_COLORS[t]=e},S.prototype.getChannelFlagAsColor=function(t){return this.CHANNEL_COLORS[t]},S.prototype._$ZT=function(){},S.prototype._$Uo=function(t,e,i,r,n,s,o){},S.prototype._$Rs=function(){return-1},S.prototype._$Ds=function(t){},S.prototype.setBaseColor=function(t,e,i,r){t<0?t=0:t>1&&(t=1),e<0?e=0:e>1&&(e=1),i<0?i=0:i>1&&(i=1),r<0?r=0:r>1&&(r=1),this._$lT=t,this._$C0=e,this._$tT=i,this._$WL=r},S.prototype._$WP=function(t){this.culling=t},S.prototype.setMatrix=function(t){for(var e=0;e<16;e++)this.matrix4x4[e]=t[e]},S.prototype._$IT=function(){return this.matrix4x4},S.prototype.setPremultipliedAlpha=function(t){this.premultipliedAlpha=t},S.prototype.isPremultipliedAlpha=function(){return this.premultipliedAlpha},S.prototype.setAnisotropy=function(t){this.anisotropy=t},S.prototype.getAnisotropy=function(){return this.anisotropy},S.prototype.getClippingProcess=function(){return this.clippingProcess},S.prototype.setClippingProcess=function(t){this.clippingProcess=t},S.prototype.setClipBufPre_clipContextForMask=function(t){this.clipBufPre_clipContextMask=t},S.prototype.getClipBufPre_clipContextMask=function(){return this.clipBufPre_clipContextMask},S.prototype.setClipBufPre_clipContextForDraw=function(t){this.clipBufPre_clipContextDraw=t},S.prototype.getClipBufPre_clipContextDraw=function(){return this.clipBufPre_clipContextDraw},M._$ur=-2,M._$c2=1,M._$_b=2,M.prototype._$F0=function(t){this._$kP=t._$nP(),this._$dr=t._$nP()},M.prototype.readV2_opacity=function(t){t.getFormatVersion()>=U.LIVE2D_FORMAT_VERSION_V2_10_SDK2&&(this._$mS=t._$Tb())},M.prototype.init=function(t){},M.prototype._$Nr=function(t,e){},M.prototype.interpolateOpacity=function(t,e,i,r){null==this._$mS?i.setInterpolatedOpacity(1):i.setInterpolatedOpacity(A._$br(t,e,r,this._$mS))},M.prototype._$2b=function(t,e){},M.prototype._$nb=function(t,e,i,r,n,s,o){},M.prototype.getType=function(){},M.prototype._$gs=function(t){this._$dr=t},M.prototype._$a2=function(t){this._$kP=t},M.prototype.getTargetBaseDataID=function(){return this._$dr},M.prototype.getBaseDataID=function(){return this._$kP},M.prototype._$32=function(){return null!=this._$dr&&this._$dr!=mt._$2o()},I._$W2=0,I._$CS=I._$W2,I._$Mo=function(){return!0},I._$XP=function(t){try{for(var e=getTimeMSec();getTimeMSec()-e<t;);}catch(t){t._$Rb()}},I.getUserTimeMSec=function(){return I._$CS==I._$W2?I.getSystemTimeMSec():I._$CS},I.setUserTimeMSec=function(t){I._$CS=t},I.updateUserTimeMSec=function(){return I._$CS=I.getSystemTimeMSec()},I.getTimeMSec=function(){return(new Date).getTime()},I.getSystemTimeMSec=function(){return(new Date).getTime()},I._$Q=function(t){},I._$jT=function(t,e,i,r,n){for(var s=0;s<n;s++)i[r+s]=t[e+s]},C._$ds=-2,C.prototype._$F0=function(t){this._$wL=t._$nP(),this._$VP=t._$6L(),this._$GP=t._$nP()},C.prototype.getParamIndex=function(t){return this._$2r!=t&&(this._$8o=C._$ds),this._$8o},C.prototype._$Pb=function(t,e){this._$8o=t,this._$2r=e},C.prototype.getParamID=function(){return this._$wL},C.prototype._$yP=function(t){this._$wL=t},C.prototype._$N2=function(){return this._$VP},C.prototype._$d2=function(){return this._$GP},C.prototype._$t2=function(t,e){this._$VP=t,this._$GP=e},C.prototype._$Lr=function(){return this._$O2},C.prototype._$wr=function(t){this._$O2=t},C.prototype._$SL=function(){return this._$ri},C.prototype._$AL=function(t){this._$ri=t},R.startsWith=function(t,e,i){var r=e+i.length;if(r>=t.length)return!1;for(var n=e;n<r;n++)if(R.getChar(t,n)!=i.charAt(n-e))return!1;return!0},R.getChar=function(t,e){return String.fromCharCode(t.getUint8(e))},R.createString=function(t,e,i){for(var r=new ArrayBuffer(2*i),n=new Uint16Array(r),s=0;s<i;s++)n[s]=t.getUint8(e+s);return String.fromCharCode.apply(null,n)},R._$LS=function(t,e,i,r){t instanceof ArrayBuffer&&(t=new DataView(t));var n=i,s=!1,o=!1,a=0,h=R.getChar(t,n);"-"==h&&(s=!0,n++);for(var u=!1;n<e;n++){switch(h=R.getChar(t,n)){case"0":a*=10;break;case"1":a=10*a+1;break;case"2":a=10*a+2;break;case"3":a=10*a+3;break;case"4":a=10*a+4;break;case"5":a=10*a+5;break;case"6":a=10*a+6;break;case"7":a=10*a+7;break;case"8":a=10*a+8;break;case"9":a=10*a+9;break;case".":o=!0,n++,u=!0;break;default:u=!0}if(u)break}if(o)for(var l=.1,c=!1;n<e;n++){switch(h=R.getChar(t,n)){case"0":break;case"1":a+=1*l;break;case"2":a+=2*l;break;case"3":a+=3*l;break;case"4":a+=4*l;break;case"5":a+=5*l;break;case"6":a+=6*l;break;case"7":a+=7*l;break;case"8":a+=8*l;break;case"9":a+=9*l;break;default:c=!0}if(l*=.1,c)break}return s&&(a=-a),r[0]=n,a},O.prototype._$zP=function(){this._$Ob=new Array},O.prototype._$F0=function(t){this._$Ob=t._$nP()},O.prototype._$Ur=function(t){if(t._$WS())return!0;for(var e=t._$v2(),i=this._$Ob.length-1;i>=0;--i){var r=this._$Ob[i].getParamIndex(e);if(r==C._$ds&&(r=t.getParamIndex(this._$Ob[i].getParamID())),t._$Xb(r))return!0}return!1},O.prototype._$Q2=function(t,e){for(var i,r,n=this._$Ob.length,s=t._$v2(),o=0,a=0;a<n;a++){var h=this._$Ob[a];if((i=h.getParamIndex(s))==C._$ds&&(i=t.getParamIndex(h.getParamID()),h._$Pb(i,s)),i<0)throw new Exception("err 23242 : "+h.getParamID());var u=i<0?0:t.getParamFloat(i);r=h._$N2();var l,c,f=h._$d2(),d=-1,p=0;if(r<1);else if(1==r)(l=f[0])-N._$J<u&&u<l+N._$J?(d=0,p=0):(d=0,e[0]=!0);else if(u<(l=f[0])-N._$J)d=0,e[0]=!0;else if(u<l+N._$J)d=0;else{for(var _=!1,m=1;m<r;++m){if(u<(c=f[m])+N._$J){c-N._$J<u?d=m:(d=m-1,p=(u-l)/(c-l),o++),_=!0;break}l=c}_||(d=r-1,p=0,e[0]=!0)}h._$wr(d),h._$AL(p)}return o},O.prototype._$zr=function(t,e,i){var r=1<<i;r+1>N._$Qb&&console.log("err 23245\n");for(var n=this._$Ob.length,s=1,o=1,a=0,h=0;h<r;++h)t[h]=0;for(var u=0;u<n;++u){var l=this._$Ob[u];if(0==l._$SL()){if((c=l._$Lr()*s)<0&&ot._$3T)throw new Exception("err 23246");for(h=0;h<r;++h)t[h]+=c}else{var c=s*l._$Lr(),f=s*(l._$Lr()+1);for(h=0;h<r;++h)t[h]+=(h/o|0)%2==0?c:f;e[a++]=l._$SL(),o*=2}s*=l._$N2()}t[r]=65535,e[a]=-1},O.prototype._$h2=function(t,e,i){for(var r=new Float32Array(e),n=0;n<e;++n)r[n]=i[n];var s=new C;s._$yP(t),s._$t2(e,r),this._$Ob.push(s)},O.prototype._$J2=function(t){for(var e=t,i=this._$Ob.length,r=0;r<i;++r){var n=this._$Ob[r],s=n._$N2(),o=e%n._$N2(),a=n._$d2()[o];console.log("%s[%d]=%7.2f / ",n.getParamID(),o,a),e/=s}console.log("\n")},O.prototype.getParamCount=function(){return this._$Ob.length},O.prototype._$zs=function(){return this._$Ob},$.prototype.identity=function(){for(var t=0;t<16;t++)this.m[t]=t%5==0?1:0},$.prototype.getArray=function(){return this.m},$.prototype.getCopyMatrix=function(){return new Float32Array(this.m)},$.prototype.setMatrix=function(t){if(null!=t&&16==t.length)for(var e=0;e<16;e++)this.m[e]=t[e]},$.prototype.mult=function(t,e,i){return null==e?null:(this==e?this.mult_safe(this.m,t.m,e.m,i):this.mult_fast(this.m,t.m,e.m,i),e)},$.prototype.mult_safe=function(t,e,i,r){if(t==i){var n=new Array(16);this.mult_fast(t,e,n,r);for(var s=15;s>=0;--s)i[s]=n[s]}else this.mult_fast(t,e,i,r)},$.prototype.mult_fast=function(t,e,i,r){r?(i[0]=t[0]*e[0]+t[4]*e[1]+t[8]*e[2],i[4]=t[0]*e[4]+t[4]*e[5]+t[8]*e[6],i[8]=t[0]*e[8]+t[4]*e[9]+t[8]*e[10],i[12]=t[0]*e[12]+t[4]*e[13]+t[8]*e[14]+t[12],i[1]=t[1]*e[0]+t[5]*e[1]+t[9]*e[2],i[5]=t[1]*e[4]+t[5]*e[5]+t[9]*e[6],i[9]=t[1]*e[8]+t[5]*e[9]+t[9]*e[10],i[13]=t[1]*e[12]+t[5]*e[13]+t[9]*e[14]+t[13],i[2]=t[2]*e[0]+t[6]*e[1]+t[10]*e[2],i[6]=t[2]*e[4]+t[6]*e[5]+t[10]*e[6],i[10]=t[2]*e[8]+t[6]*e[9]+t[10]*e[10],i[14]=t[2]*e[12]+t[6]*e[13]+t[10]*e[14]+t[14],i[3]=i[7]=i[11]=0,i[15]=1):(i[0]=t[0]*e[0]+t[4]*e[1]+t[8]*e[2]+t[12]*e[3],i[4]=t[0]*e[4]+t[4]*e[5]+t[8]*e[6]+t[12]*e[7],i[8]=t[0]*e[8]+t[4]*e[9]+t[8]*e[10]+t[12]*e[11],i[12]=t[0]*e[12]+t[4]*e[13]+t[8]*e[14]+t[12]*e[15],i[1]=t[1]*e[0]+t[5]*e[1]+t[9]*e[2]+t[13]*e[3],i[5]=t[1]*e[4]+t[5]*e[5]+t[9]*e[6]+t[13]*e[7],i[9]=t[1]*e[8]+t[5]*e[9]+t[9]*e[10]+t[13]*e[11],i[13]=t[1]*e[12]+t[5]*e[13]+t[9]*e[14]+t[13]*e[15],i[2]=t[2]*e[0]+t[6]*e[1]+t[10]*e[2]+t[14]*e[3],i[6]=t[2]*e[4]+t[6]*e[5]+t[10]*e[6]+t[14]*e[7],i[10]=t[2]*e[8]+t[6]*e[9]+t[10]*e[10]+t[14]*e[11],i[14]=t[2]*e[12]+t[6]*e[13]+t[10]*e[14]+t[14]*e[15],i[3]=t[3]*e[0]+t[7]*e[1]+t[11]*e[2]+t[15]*e[3],i[7]=t[3]*e[4]+t[7]*e[5]+t[11]*e[6]+t[15]*e[7],i[11]=t[3]*e[8]+t[7]*e[9]+t[11]*e[10]+t[15]*e[11],i[15]=t[3]*e[12]+t[7]*e[13]+t[11]*e[14]+t[15]*e[15])},$.prototype.translate=function(t,e,i){this.m[12]=this.m[0]*t+this.m[4]*e+this.m[8]*i+this.m[12],this.m[13]=this.m[1]*t+this.m[5]*e+this.m[9]*i+this.m[13],this.m[14]=this.m[2]*t+this.m[6]*e+this.m[10]*i+this.m[14],this.m[15]=this.m[3]*t+this.m[7]*e+this.m[11]*i+this.m[15]},$.prototype.scale=function(t,e,i){this.m[0]*=t,this.m[4]*=e,this.m[8]*=i,this.m[1]*=t,this.m[5]*=e,this.m[9]*=i,this.m[2]*=t,this.m[6]*=e,this.m[10]*=i,this.m[3]*=t,this.m[7]*=e,this.m[11]*=i},$.prototype.rotateX=function(t){var e=Tt.fcos(t),i=Tt._$9(t),r=this.m[4];this.m[4]=r*e+this.m[8]*i,this.m[8]=r*-i+this.m[8]*e,r=this.m[5],this.m[5]=r*e+this.m[9]*i,this.m[9]=r*-i+this.m[9]*e,r=this.m[6],this.m[6]=r*e+this.m[10]*i,this.m[10]=r*-i+this.m[10]*e,r=this.m[7],this.m[7]=r*e+this.m[11]*i,this.m[11]=r*-i+this.m[11]*e},$.prototype.rotateY=function(t){var e=Tt.fcos(t),i=Tt._$9(t),r=this.m[0];this.m[0]=r*e+this.m[8]*-i,this.m[8]=r*i+this.m[8]*e,r=this.m[1],this.m[1]=r*e+this.m[9]*-i,this.m[9]=r*i+this.m[9]*e,r=m[2],this.m[2]=r*e+this.m[10]*-i,this.m[10]=r*i+this.m[10]*e,r=m[3],this.m[3]=r*e+this.m[11]*-i,this.m[11]=r*i+this.m[11]*e},$.prototype.rotateZ=function(t){var e=Tt.fcos(t),i=Tt._$9(t),r=this.m[0];this.m[0]=r*e+this.m[4]*i,this.m[4]=r*-i+this.m[4]*e,r=this.m[1],this.m[1]=r*e+this.m[5]*i,this.m[5]=r*-i+this.m[5]*e,r=this.m[2],this.m[2]=r*e+this.m[6]*i,this.m[6]=r*-i+this.m[6]*e,r=this.m[3],this.m[3]=r*e+this.m[7]*i,this.m[7]=r*-i+this.m[7]*e},D.prototype=new et,D._$tP=new Object,D._$27=function(){D._$tP.clear()},D.getID=function(t){var e=D._$tP[t];return null==e&&(e=new D(t),D._$tP[t]=e),e},D.prototype._$3s=function(){return new D},L._$kS=-1,L._$pS=0,L._$hb=1,L.STATE_IDENTITY=0,L._$gb=1,L._$fo=2,L._$go=4,L.prototype.transform=function(t,e,i){var r,n,s,o,a,h,u=0,l=0;switch(this._$hi){default:return;case L._$go|L._$fo|L._$gb:for(r=this._$7,n=this._$H,s=this._$k,o=this._$f,a=this._$g,h=this._$w;--i>=0;){var c=t[u++],f=t[u++];e[l++]=r*c+n*f+s,e[l++]=o*c+a*f+h}return;case L._$go|L._$fo:for(r=this._$7,n=this._$H,o=this._$f,a=this._$g;--i>=0;){c=t[u++],f=t[u++];e[l++]=r*c+n*f,e[l++]=o*c+a*f}return;case L._$go|L._$gb:for(n=this._$H,s=this._$k,o=this._$f,h=this._$w;--i>=0;){c=t[u++];e[l++]=n*t[u++]+s,e[l++]=o*c+h}return;case L._$go:for(n=this._$H,o=this._$f;--i>=0;){c=t[u++];e[l++]=n*t[u++],e[l++]=o*c}return;case L._$fo|L._$gb:for(r=this._$7,s=this._$k,a=this._$g,h=this._$w;--i>=0;)e[l++]=r*t[u++]+s,e[l++]=a*t[u++]+h;return;case L._$fo:for(r=this._$7,a=this._$g;--i>=0;)e[l++]=r*t[u++],e[l++]=a*t[u++];return;case L._$gb:for(s=this._$k,h=this._$w;--i>=0;)e[l++]=t[u++]+s,e[l++]=t[u++]+h;return;case L.STATE_IDENTITY:return void(t==e&&u==l||I._$jT(t,u,e,l,2*i))}},L.prototype.update=function(){0==this._$H&&0==this._$f?1==this._$7&&1==this._$g?0==this._$k&&0==this._$w?(this._$hi=L.STATE_IDENTITY,this._$Z=L._$pS):(this._$hi=L._$gb,this._$Z=L._$hb):0==this._$k&&0==this._$w?(this._$hi=L._$fo,this._$Z=L._$kS):(this._$hi=L._$fo|L._$gb,this._$Z=L._$kS):0==this._$7&&0==this._$g?0==this._$k&&0==this._$w?(this._$hi=L._$go,this._$Z=L._$kS):(this._$hi=L._$go|L._$gb,this._$Z=L._$kS):0==this._$k&&0==this._$w?(this._$hi=L._$go|L._$fo,this._$Z=L._$kS):(this._$hi=L._$go|L._$fo|L._$gb,this._$Z=L._$kS)},L.prototype._$RT=function(t){this._$IT(t);var e=t[0],i=t[2],r=t[1],n=t[3],s=Math.sqrt(e*e+r*r),o=e*n-i*r;0==s?ot._$so&&console.log("affine._$RT() / rt==0"):(t[0]=s,t[1]=o/s,t[2]=(r*n+e*i)/o,t[3]=Math.atan2(r,e))},L.prototype._$ho=function(t,e,i,r){var n=new Float32Array(6),s=new Float32Array(6);t._$RT(n),e._$RT(s);var o=new Float32Array(6);o[0]=n[0]+(s[0]-n[0])*i,o[1]=n[1]+(s[1]-n[1])*i,o[2]=n[2]+(s[2]-n[2])*i,o[3]=n[3]+(s[3]-n[3])*i,o[4]=n[4]+(s[4]-n[4])*i,o[5]=n[5]+(s[5]-n[5])*i,r._$CT(o)},L.prototype._$CT=function(t){var e=Math.cos(t[3]),i=Math.sin(t[3]);this._$7=t[0]*e,this._$f=t[0]*i,this._$H=t[1]*(t[2]*e-i),this._$g=t[1]*(t[2]*i+e),this._$k=t[4],this._$w=t[5],this.update()},L.prototype._$IT=function(t){t[0]=this._$7,t[1]=this._$f,t[2]=this._$H,t[3]=this._$g,t[4]=this._$k,t[5]=this._$w},F.prototype=new o,F._$cs="VISIBLE:",F._$ar="LAYOUT:",F._$Co=0,F._$D2=[],F._$1T=1,F.loadMotion=function(t){var e=new F,i=[0],r=t.length;e._$yT=0;for(var n=0;n<r;++n){var s=255&t[n];if("\n"!=s&&"\r"!=s)if("#"!=s)if("$"!=s){if("a"<=s&&s<="z"||"A"<=s&&s<="Z"||"_"==s){for(u=n,l=-1;n<r&&("\r"!=(s=255&t[n])&&"\n"!=s);++n)if("="==s){l=n;break}if(l>=0){var o=new B;R.startsWith(t,u,F._$cs)?(o._$RP=B._$hs,o._$4P=new String(t,u,l-u)):R.startsWith(t,u,F._$ar)?(o._$4P=new String(t,u+7,l-u-7),R.startsWith(t,u+7,"ANCHOR_X")?o._$RP=B._$xs:R.startsWith(t,u+7,"ANCHOR_Y")?o._$RP=B._$us:R.startsWith(t,u+7,"SCALE_X")?o._$RP=B._$qs:R.startsWith(t,u+7,"SCALE_Y")?o._$RP=B._$Ys:R.startsWith(t,u+7,"X")?o._$RP=B._$ws:R.startsWith(t,u+7,"Y")&&(o._$RP=B._$Ns)):(o._$RP=B._$Fr,o._$4P=new String(t,u,l-u)),e.motions.push(o);var a=0;for(F._$D2.clear(),n=l+1;n<r&&("\r"!=(s=255&t[n])&&"\n"!=s);++n)if(","!=s&&" "!=s&&"\t"!=s){f=R._$LS(t,r,n,i);if(i[0]>0){F._$D2.push(f),a++;var h=i[0];if(h<n){console.log("_$n0 _$hi . @Live2DMotion loadMotion()\n");break}n=h}}o._$I0=F._$D2._$BL(),a>e._$yT&&(e._$yT=a)}}}else{for(var u=n,l=-1;n<r&&("\r"!=(s=255&t[n])&&"\n"!=s);++n)if("="==s){l=n;break}var c=!1;if(l>=0)for(l==u+4&&"f"==t[u+1]&&"p"==t[u+2]&&"s"==t[u+3]&&(c=!0),n=l+1;n<r&&("\r"!=(s=255&t[n])&&"\n"!=s);++n)if(","!=s&&" "!=s&&"\t"!=s){var f=R._$LS(t,r,n,i);i[0]>0&&c&&5<f&&f<121&&(e._$D0=f),n=i[0]}for(;n<r&&("\n"!=t[n]&&"\r"!=t[n]);++n);}else for(;n<r&&("\n"!=t[n]&&"\r"!=t[n]);++n);}return e._$AS=1e3*e._$yT/e._$D0|0,e},F.prototype.getDurationMSec=function(){return this._$AS},F.prototype.dump=function(){for(var t=0;t<this.motions.length;t++){var e=this.motions[t];console.log("_$wL[%s] [%d]. ",e._$4P,e._$I0.length);for(var i=0;i<e._$I0.length&&i<10;i++)console.log("%5.2f ,",e._$I0[i]);console.log("\n")}},F.prototype.updateParamExe=function(t,e,i,r){for(var n=(e-r._$z2)*this._$D0/1e3,s=0|n,o=n-s,a=0;a<this.motions.length;a++){var h=this.motions[a],u=h._$I0.length,l=h._$4P;if(h._$RP==B._$hs){var c=h._$I0[s>=u?u-1:s];t.setParamFloat(l,c)}else if(B._$ws<=h._$RP&&h._$RP<=B._$Ys);else{var f=t.getParamFloat(l),d=h._$I0[s>=u?u-1:s],p=f+(d+(h._$I0[s+1>=u?u-1:s+1]-d)*o-f)*i;t.setParamFloat(l,p)}}s>=this._$yT&&(this._$E?(r._$z2=e,this.loopFadeIn&&(r._$bs=e)):r._$9L=!0)},F.prototype._$r0=function(){return this._$E},F.prototype._$aL=function(t){this._$E=t},F.prototype.isLoopFadeIn=function(){return this.loopFadeIn},F.prototype.setLoopFadeIn=function(t){this.loopFadeIn=t},k.prototype.clear=function(){this.size=0},k.prototype.add=function(t){if(this._$P.length<=this.size){var e=new Float32Array(2*this.size);I._$jT(this._$P,0,e,0,this.size),this._$P=e}this._$P[this.size++]=t},k.prototype._$BL=function(){var t=new Float32Array(this.size);return I._$jT(this._$P,0,t,0,this.size),t},B._$Fr=0,B._$hs=1,B._$ws=100,B._$Ns=101,B._$xs=102,B._$us=103,B._$qs=104,B._$Ys=105,N._$Ms=1,N._$Qs=2,N._$i2=0,N._$No=2,N._$do=N._$Ms,N._$Ls=!0,N._$1r=5,N._$Qb=65,N._$J=1e-4,N._$FT=.001,N._$Ss=3,U._$o7=6,U._$S7=7,U._$s7=8,U._$77=9,U.LIVE2D_FORMAT_VERSION_V2_10_SDK2=10,U.LIVE2D_FORMAT_VERSION_V2_11_SDK2_1=11,U._$T7=U.LIVE2D_FORMAT_VERSION_V2_11_SDK2_1,U._$Is=-2004318072,U._$h0=0,U._$4L=23,U._$7P=33,U._$uT=function(t){console.log("_$bo :: _$6 _$mo _$E0 : %d\n",t)},U._$9o=function(t){if(t<40)return U._$uT(t),null;if(t<50)return U._$uT(t),null;if(t<60)return U._$uT(t),null;if(t<100)switch(t){case 65:return new Q;case 66:return new O;case 67:return new C;case 68:return new H;case 69:return new b;case 70:return new ut;default:return U._$uT(t),null}else if(t<150)switch(t){case 131:return new nt;case 133:return new K;case 136:return new f;case 137:return new it;case 142:return new z}return U._$uT(t),null},G._$HP=0,G._$_0=!0,G._$V2=-1,G._$W0=-1,G._$jr=!1,G._$ZS=!0,G._$tr=-1e6,G._$lr=1e6,G._$is=32,G._$e=!1,G.prototype.getDrawDataIndex=function(t){for(var e=this._$aS.length-1;e>=0;--e)if(null!=this._$aS[e]&&this._$aS[e].getDrawDataID()==t)return e;return-1},G.prototype.getDrawData=function(t){if(t instanceof D){if(null==this._$Bo){this._$Bo=new Object;for(var e=this._$aS.length,i=0;i<e;i++){var r=this._$aS[i],n=r.getDrawDataID();null!=n&&(this._$Bo[n]=r)}}return this._$Bo[id]}return t<this._$aS.length?this._$aS[t]:null},G.prototype.release=function(){this._$3S.clear(),this._$aS.clear(),this._$F2.clear(),null!=this._$Bo&&this._$Bo.clear(),this._$db.clear(),this._$8b.clear(),this._$Hr.clear()},G.prototype.init=function(){this._$co++,this._$F2.length>0&&this.release();for(var t=this._$Ri.getModelImpl(),e=t._$Xr(),r=e.length,n=new Array,s=new Array,o=0;o<r;++o){var a=e[o];this._$F2.push(a),this._$Hr.push(a.init(this));for(var h=a.getBaseData(),u=h.length,l=0;l<u;++l)n.push(h[l]);for(l=0;l<u;++l){var c=h[l].init(this);c._$l2(o),s.push(c)}var f=a.getDrawData(),d=f.length;for(l=0;l<d;++l){var p=f[l],_=p.init(this);_._$IP=o,this._$aS.push(p),this._$8b.push(_)}}for(var m=n.length,g=mt._$2o();;){var v=!1;for(o=0;o<m;++o){var y=n[o];if(null!=y){var b=y.getTargetBaseDataID();(null==b||b==g||this.getBaseDataIndex(b)>=0)&&(this._$3S.push(y),this._$db.push(s[o]),n[o]=null,v=!0)}}if(!v)break}var x=t._$E2();if(null!=x){var T=x._$1s();if(null!=T){var A=T.length;for(o=0;o<A;++o){var E=T[o];null!=E&&this._$02(E.getParamID(),E.getDefaultValue(),E.getMinValue(),E.getMaxValue())}}}this.clipManager=new i(this.dp_webgl),this.clipManager.init(this,this._$aS,this._$8b),this._$QT=!0},G.prototype.update=function(){G._$e&&a.start("_$zL");for(var t=this._$_2.length,e=0;e<t;e++)this._$_2[e]!=this._$vr[e]&&(this._$Js[e]=G._$ZS,this._$vr[e]=this._$_2[e]);var i=this._$3S.length,r=this._$aS.length,n=Y._$or(),s=Y._$Pr()-n+1;(null==this._$Ws||this._$Ws.length<s)&&(this._$Ws=new Int16Array(s),this._$Vs=new Int16Array(s));for(e=0;e<s;e++)this._$Ws[e]=G._$V2,this._$Vs[e]=G._$V2;(null==this._$Er||this._$Er.length<r)&&(this._$Er=new Int16Array(r));for(e=0;e<r;e++)this._$Er[e]=G._$W0;G._$e&&a.dump("_$zL"),G._$e&&a.start("_$UL");for(var o=null,h=0;h<i;++h){var u=this._$3S[h],l=this._$db[h];try{u._$Nr(this,l),u._$2b(this,l)}catch(t){null==o&&(o=t)}}null!=o&&G._$_0&&a._$Rb(o),G._$e&&a.dump("_$UL"),G._$e&&a.start("_$DL");for(var c=null,f=0;f<r;++f){var d=this._$aS[f],p=this._$8b[f];try{if(d._$Nr(this,p),p._$u2())continue;d._$2b(this,p);var _,m=Math.floor(d._$zS(this,p)-n);try{_=this._$Vs[m]}catch(t){console.log("_$li :: %s / %s \t\t\t\t@@_$fS\n",t.toString(),d.getDrawDataID().toString()),m=Math.floor(d._$zS(this,p)-n);continue}_==G._$V2?this._$Ws[m]=f:this._$Er[_]=f,this._$Vs[m]=f}catch(t){null==c&&(c=t,ot._$sT(ot._$H7))}}null!=c&&G._$_0&&a._$Rb(c),G._$e&&a.dump("_$DL"),G._$e&&a.start("_$eL");for(e=this._$Js.length-1;e>=0;e--)this._$Js[e]=G._$jr;return this._$QT=!1,G._$e&&a.dump("_$eL"),!1},G.prototype.preDraw=function(t){null!=this.clipManager&&(t._$ZT(),this.clipManager.setupClip(this,t))},G.prototype.draw=function(t){if(null!=this._$Ws){var e=this._$Ws.length;t._$ZT();for(var i=0;i<e;++i){var r=this._$Ws[i];if(r!=G._$V2)for(;;){var n=this._$aS[r],s=this._$8b[r];if(s._$yo()){var o=s._$IP,h=this._$Hr[o];s._$VS=h.getPartsOpacity(),n.draw(t,this,s)}var u=this._$Er[r];if(u<=r||u==G._$W0)break;r=u}}}else a._$li("call _$Ri.update() before _$Ri.draw() ")},G.prototype.getParamIndex=function(t){for(var e=this._$pb.length-1;e>=0;--e)if(this._$pb[e]==t)return e;return this._$02(t,0,G._$tr,G._$lr)},G.prototype._$BS=function(t){return this.getBaseDataIndex(t)},G.prototype.getBaseDataIndex=function(t){for(var e=this._$3S.length-1;e>=0;--e)if(null!=this._$3S[e]&&this._$3S[e].getBaseDataID()==t)return e;return-1},G.prototype._$UT=function(t,e){var i=new Float32Array(e);return I._$jT(t,0,i,0,t.length),i},G.prototype._$02=function(t,e,i,r){if(this._$qo>=this._$pb.length){var n=this._$pb.length,s=new Array(2*n);I._$jT(this._$pb,0,s,0,n),this._$pb=s,this._$_2=this._$UT(this._$_2,2*n),this._$vr=this._$UT(this._$vr,2*n),this._$Rr=this._$UT(this._$Rr,2*n),this._$Or=this._$UT(this._$Or,2*n);var o=new Array;I._$jT(this._$Js,0,o,0,n),this._$Js=o}return this._$pb[this._$qo]=t,this._$_2[this._$qo]=e,this._$vr[this._$qo]=e,this._$Rr[this._$qo]=i,this._$Or[this._$qo]=r,this._$Js[this._$qo]=G._$ZS,this._$qo++},G.prototype._$Zo=function(t,e){this._$3S[t]=e},G.prototype.setParamFloat=function(t,e){e<this._$Rr[t]&&(e=this._$Rr[t]),e>this._$Or[t]&&(e=this._$Or[t]),this._$_2[t]=e},G.prototype.loadParam=function(){var t=this._$_2.length;t>this._$fs.length&&(t=this._$fs.length),I._$jT(this._$fs,0,this._$_2,0,t)},G.prototype.saveParam=function(){var t=this._$_2.length;t>this._$fs.length&&(this._$fs=new Float32Array(t)),I._$jT(this._$_2,0,this._$fs,0,t)},G.prototype._$v2=function(){return this._$co},G.prototype._$WS=function(){return this._$QT},G.prototype._$Xb=function(t){return this._$Js[t]==G._$ZS},G.prototype._$vs=function(){return this._$Es},G.prototype._$Tr=function(){return this._$ZP},G.prototype.getBaseData=function(t){return this._$3S[t]},G.prototype.getParamFloat=function(t){return this._$_2[t]},G.prototype.getParamMax=function(t){return this._$Or[t]},G.prototype.getParamMin=function(t){return this._$Rr[t]},G.prototype.setPartsOpacity=function(t,e){this._$Hr[t].setPartsOpacity(e)},G.prototype.getPartsOpacity=function(t){return this._$Hr[t].getPartsOpacity()},G.prototype.getPartsDataIndex=function(t){for(var e=this._$F2.length-1;e>=0;--e)if(null!=this._$F2[e]&&this._$F2[e]._$p2()==t)return e;return-1},G.prototype._$q2=function(t){return this._$db[t]},G.prototype._$C2=function(t){return this._$8b[t]},G.prototype._$Bb=function(t){return this._$Hr[t]},G.prototype._$5s=function(t,e){for(var i=this._$Ws.length,r=t,n=0;n<i;++n){var s=this._$Ws[n];if(s!=G._$V2)for(;;){var o=this._$8b[s];o._$yo()&&(o._$GT()._$B2(this,o,r),r+=e);var a=this._$Er[s];if(a<=s||a==G._$W0)break;s=a}}},G.prototype.setDrawParam=function(t){this.dp_webgl=t},G.prototype.getDrawParam=function(){return this.dp_webgl},X._$0T=function(t){return X._$0T(new _$5(t))},X._$0T=function(t){if(!t.exists())throw new _$ls(t._$3b());for(var e,i=t.length(),r=new Int8Array(i),n=new _$Xs(new _$kb(t),8192),s=0;(e=n.read(r,s,i-s))>0;)s+=e;return r},X._$C=function(t){var e=null,i=null;try{e=t instanceof Array?t:new _$Xs(t,8192),i=new _$js;for(var r,n=new Int8Array(1e3);(r=e.read(n))>0;)i.write(n,0,r);return i._$TS()}finally{null!=t&&t.close(),null!=i&&(i.flush(),i.close())}},V.prototype=new S,V._$As=32,V._$Gr=!1,V._$NT=null,V._$vS=null,V._$no=null,V._$9r=function(t){return new Float32Array(t)},V._$vb=function(t){return new Int16Array(t)},V._$cr=function(t,e){return null==t||t._$yL()<e.length?((t=V._$9r(2*e.length)).put(e),t._$oT(0)):(t.clear(),t.put(e),t._$oT(0)),t},V._$mb=function(t,e){return null==t||t._$yL()<e.length?((t=V._$vb(2*e.length)).put(e),t._$oT(0)):(t.clear(),t.put(e),t._$oT(0)),t},V._$Hs=function(){return V._$Gr},V._$as=function(t){V._$Gr=t},V.prototype.setGL=function(t){this.gl=t},V.prototype.setTransform=function(t){this.transform=t},V.prototype._$ZT=function(){},V.prototype._$Uo=function(t,e,i,r,n,s,o,a){if(!(s<.01)){var h=this._$U2[t],u=s>.9?ot.EXPAND_W:0;this.gl.drawElements(h,i,r,n,s,u,this.transform,a)}},V.prototype._$Rs=function(){throw new Error("_$Rs")},V.prototype._$Ds=function(t){throw new Error("_$Ds")},V.prototype._$K2=function(){for(var t=0;t<this._$sb.length;t++){0!=this._$sb[t]&&(this.gl._$Sr(1,this._$sb,t),this._$sb[t]=0)}},V.prototype.setTexture=function(t,e){this._$sb.length<t+1&&this._$nS(t),this._$sb[t]=e},V.prototype.setTexture=function(t,e){this._$sb.length<t+1&&this._$nS(t),this._$U2[t]=e},V.prototype._$nS=function(t){var e=Math.max(2*this._$sb.length,t+1+10),i=new Int32Array(e);I._$jT(this._$sb,0,i,0,this._$sb.length),this._$sb=i;var r=new Array;I._$jT(this._$U2,0,r,0,this._$U2.length),this._$U2=r},H.prototype=new M,H._$Xo=new Float32Array(2),H._$io=new Float32Array(2),H._$0o=new Float32Array(2),H._$Lo=new Float32Array(2),H._$To=new Float32Array(2),H._$Po=new Float32Array(2),H._$gT=new Array,H.prototype._$zP=function(){this._$GS=new O,this._$GS._$zP(),this._$Y0=new Array},H.prototype.getType=function(){return M._$c2},H.prototype._$F0=function(t){M.prototype._$F0.call(this,t),this._$GS=t._$nP(),this._$Y0=t._$nP(),M.prototype.readV2_opacity.call(this,t)},H.prototype.init=function(t){var e=new j(this);return e._$Yr=new b,this._$32()&&(e._$Wr=new b),e},H.prototype._$Nr=function(t,e){this!=e._$GT()&&console.log("### assert!! ### ");var i=e;if(this._$GS._$Ur(t)){var r=H._$gT;r[0]=!1;var n=this._$GS._$Q2(t,r);e._$Ib(r[0]),this.interpolateOpacity(t,this._$GS,e,r);var s=t._$vs(),o=t._$Tr();if(this._$GS._$zr(s,o,n),n<=0){var a=this._$Y0[s[0]];i._$Yr.init(a)}else if(1==n){a=this._$Y0[s[0]];var h=this._$Y0[s[1]],u=o[0];i._$Yr._$fL=a._$fL+(h._$fL-a._$fL)*u,i._$Yr._$gL=a._$gL+(h._$gL-a._$gL)*u,i._$Yr._$B0=a._$B0+(h._$B0-a._$B0)*u,i._$Yr._$z0=a._$z0+(h._$z0-a._$z0)*u,i._$Yr._$qT=a._$qT+(h._$qT-a._$qT)*u}else if(2==n){a=this._$Y0[s[0]],h=this._$Y0[s[1]];var l=this._$Y0[s[2]],c=this._$Y0[s[3]],f=(u=o[0],o[1]),d=a._$fL+(h._$fL-a._$fL)*u,p=l._$fL+(c._$fL-l._$fL)*u;i._$Yr._$fL=d+(p-d)*f,d=a._$gL+(h._$gL-a._$gL)*u,p=l._$gL+(c._$gL-l._$gL)*u,i._$Yr._$gL=d+(p-d)*f,d=a._$B0+(h._$B0-a._$B0)*u,p=l._$B0+(c._$B0-l._$B0)*u,i._$Yr._$B0=d+(p-d)*f,d=a._$z0+(h._$z0-a._$z0)*u,p=l._$z0+(c._$z0-l._$z0)*u,i._$Yr._$z0=d+(p-d)*f,d=a._$qT+(h._$qT-a._$qT)*u,p=l._$qT+(c._$qT-l._$qT)*u,i._$Yr._$qT=d+(p-d)*f}else if(3==n){var _=this._$Y0[s[0]],m=this._$Y0[s[1]],g=this._$Y0[s[2]],v=this._$Y0[s[3]],y=this._$Y0[s[4]],b=this._$Y0[s[5]],x=this._$Y0[s[6]],T=this._$Y0[s[7]],A=(u=o[0],f=o[1],o[2]),E=(d=_._$fL+(m._$fL-_._$fL)*u,p=g._$fL+(v._$fL-g._$fL)*u,y._$fL+(b._$fL-y._$fL)*u),w=x._$fL+(T._$fL-x._$fL)*u;i._$Yr._$fL=(1-A)*(d+(p-d)*f)+A*(E+(w-E)*f),d=_._$gL+(m._$gL-_._$gL)*u,p=g._$gL+(v._$gL-g._$gL)*u,E=y._$gL+(b._$gL-y._$gL)*u,w=x._$gL+(T._$gL-x._$gL)*u,i._$Yr._$gL=(1-A)*(d+(p-d)*f)+A*(E+(w-E)*f),d=_._$B0+(m._$B0-_._$B0)*u,p=g._$B0+(v._$B0-g._$B0)*u,E=y._$B0+(b._$B0-y._$B0)*u,w=x._$B0+(T._$B0-x._$B0)*u,i._$Yr._$B0=(1-A)*(d+(p-d)*f)+A*(E+(w-E)*f),d=_._$z0+(m._$z0-_._$z0)*u,p=g._$z0+(v._$z0-g._$z0)*u,E=y._$z0+(b._$z0-y._$z0)*u,w=x._$z0+(T._$z0-x._$z0)*u,i._$Yr._$z0=(1-A)*(d+(p-d)*f)+A*(E+(w-E)*f),d=_._$qT+(m._$qT-_._$qT)*u,p=g._$qT+(v._$qT-g._$qT)*u,E=y._$qT+(b._$qT-y._$qT)*u,w=x._$qT+(T._$qT-x._$qT)*u,i._$Yr._$qT=(1-A)*(d+(p-d)*f)+A*(E+(w-E)*f)}else if(4==n){var S=this._$Y0[s[0]],P=this._$Y0[s[1]],M=this._$Y0[s[2]],I=this._$Y0[s[3]],C=this._$Y0[s[4]],R=this._$Y0[s[5]],O=this._$Y0[s[6]],$=this._$Y0[s[7]],D=this._$Y0[s[8]],L=this._$Y0[s[9]],F=this._$Y0[s[10]],k=this._$Y0[s[11]],B=this._$Y0[s[12]],N=this._$Y0[s[13]],U=this._$Y0[s[14]],G=this._$Y0[s[15]],X=(u=o[0],f=o[1],A=o[2],o[3]),V=(d=S._$fL+(P._$fL-S._$fL)*u,p=M._$fL+(I._$fL-M._$fL)*u,E=C._$fL+(R._$fL-C._$fL)*u,w=O._$fL+($._$fL-O._$fL)*u,D._$fL+(L._$fL-D._$fL)*u),j=F._$fL+(k._$fL-F._$fL)*u,Y=B._$fL+(N._$fL-B._$fL)*u,z=U._$fL+(G._$fL-U._$fL)*u;i._$Yr._$fL=(1-X)*((1-A)*(d+(p-d)*f)+A*(E+(w-E)*f))+X*((1-A)*(V+(j-V)*f)+A*(Y+(z-Y)*f)),d=S._$gL+(P._$gL-S._$gL)*u,p=M._$gL+(I._$gL-M._$gL)*u,E=C._$gL+(R._$gL-C._$gL)*u,w=O._$gL+($._$gL-O._$gL)*u,V=D._$gL+(L._$gL-D._$gL)*u,j=F._$gL+(k._$gL-F._$gL)*u,Y=B._$gL+(N._$gL-B._$gL)*u,z=U._$gL+(G._$gL-U._$gL)*u,i._$Yr._$gL=(1-X)*((1-A)*(d+(p-d)*f)+A*(E+(w-E)*f))+X*((1-A)*(V+(j-V)*f)+A*(Y+(z-Y)*f)),d=S._$B0+(P._$B0-S._$B0)*u,p=M._$B0+(I._$B0-M._$B0)*u,E=C._$B0+(R._$B0-C._$B0)*u,w=O._$B0+($._$B0-O._$B0)*u,V=D._$B0+(L._$B0-D._$B0)*u,j=F._$B0+(k._$B0-F._$B0)*u,Y=B._$B0+(N._$B0-B._$B0)*u,z=U._$B0+(G._$B0-U._$B0)*u,i._$Yr._$B0=(1-X)*((1-A)*(d+(p-d)*f)+A*(E+(w-E)*f))+X*((1-A)*(V+(j-V)*f)+A*(Y+(z-Y)*f)),d=S._$z0+(P._$z0-S._$z0)*u,p=M._$z0+(I._$z0-M._$z0)*u,E=C._$z0+(R._$z0-C._$z0)*u,w=O._$z0+($._$z0-O._$z0)*u,V=D._$z0+(L._$z0-D._$z0)*u,j=F._$z0+(k._$z0-F._$z0)*u,Y=B._$z0+(N._$z0-B._$z0)*u,z=U._$z0+(G._$z0-U._$z0)*u,i._$Yr._$z0=(1-X)*((1-A)*(d+(p-d)*f)+A*(E+(w-E)*f))+X*((1-A)*(V+(j-V)*f)+A*(Y+(z-Y)*f)),d=S._$qT+(P._$qT-S._$qT)*u,p=M._$qT+(I._$qT-M._$qT)*u,E=C._$qT+(R._$qT-C._$qT)*u,w=O._$qT+($._$qT-O._$qT)*u,V=D._$qT+(L._$qT-D._$qT)*u,j=F._$qT+(k._$qT-F._$qT)*u,Y=B._$qT+(N._$qT-B._$qT)*u,z=U._$qT+(G._$qT-U._$qT)*u,i._$Yr._$qT=(1-X)*((1-A)*(d+(p-d)*f)+A*(E+(w-E)*f))+X*((1-A)*(V+(j-V)*f)+A*(Y+(z-Y)*f))}else{for(var W=0|Math.pow(2,n),q=new Float32Array(W),Z=0;Z<W;Z++){for(var Q=Z,J=1,K=0;K<n;K++)J*=Q%2==0?1-o[K]:o[K],Q/=2;q[Z]=J}for(var tt=new Array,et=0;et<W;et++)tt[et]=this._$Y0[s[et]];var it=0,rt=0,nt=0,st=0,ot=0;for(et=0;et<W;et++)it+=q[et]*tt[et]._$fL,rt+=q[et]*tt[et]._$gL,nt+=q[et]*tt[et]._$B0,st+=q[et]*tt[et]._$z0,ot+=q[et]*tt[et]._$qT;i._$Yr._$fL=it,i._$Yr._$gL=rt,i._$Yr._$B0=nt,i._$Yr._$z0=st,i._$Yr._$qT=ot}a=this._$Y0[s[0]];i._$Yr.reflectX=a.reflectX,i._$Yr.reflectY=a.reflectY}},H.prototype._$2b=function(t,e){this!=e._$GT()&&console.log("### assert!! ### ");var i=e;if(i._$hS(!0),this._$32()){var r=this.getTargetBaseDataID();if(i._$8r==M._$ur&&(i._$8r=t.getBaseDataIndex(r)),i._$8r<0)ot._$so&&a._$li("_$L _$0P _$G :: %s",r),i._$hS(!1);else{var n=t.getBaseData(i._$8r);if(null!=n){var s=t._$q2(i._$8r),o=H._$Xo;o[0]=i._$Yr._$fL,o[1]=i._$Yr._$gL;var h=H._$io;h[0]=0,h[1]=-.1,s._$GT().getType()==M._$c2?h[1]=-10:h[1]=-.1;var u=H._$0o;this._$Jr(t,n,s,o,h,u);var l=Tt._$92(h,u);n._$nb(t,s,o,o,1,0,2),i._$Wr._$fL=o[0],i._$Wr._$gL=o[1],i._$Wr._$B0=i._$Yr._$B0,i._$Wr._$z0=i._$Yr._$z0,i._$Wr._$qT=i._$Yr._$qT-l*Tt._$NS;var c=s.getTotalScale();i.setTotalScale_notForClient(c*i._$Wr._$B0);var f=s.getTotalOpacity();i.setTotalOpacity(f*i.getInterpolatedOpacity()),i._$Wr.reflectX=i._$Yr.reflectX,i._$Wr.reflectY=i._$Yr.reflectY,i._$hS(s._$yo())}else i._$hS(!1)}}else i.setTotalScale_notForClient(i._$Yr._$B0),i.setTotalOpacity(i.getInterpolatedOpacity())},H.prototype._$nb=function(t,e,i,r,n,s,o){this!=e._$GT()&&console.log("### assert!! ### ");for(var a,h,u=e,l=null!=u._$Wr?u._$Wr:u._$Yr,c=Math.sin(Tt._$bS*l._$qT),f=Math.cos(Tt._$bS*l._$qT),d=u.getTotalScale(),p=l.reflectX?-1:1,_=l.reflectY?-1:1,m=f*d*p,g=-c*d*_,v=c*d*p,y=f*d*_,b=l._$fL,x=l._$gL,T=n*o,A=s;A<T;A+=o)a=i[A],h=i[A+1],r[A]=m*a+g*h+b,r[A+1]=v*a+y*h+x},H.prototype._$Jr=function(t,e,i,r,n,s){e!=i._$GT()&&console.log("### assert!! ### ");var o=H._$Lo;H._$Lo[0]=r[0],H._$Lo[1]=r[1],e._$nb(t,i,o,o,1,0,2);for(var a=H._$To,h=H._$Po,u=1,l=0;l<10;l++){if(h[0]=r[0]+u*n[0],h[1]=r[1]+u*n[1],e._$nb(t,i,h,a,1,0,2),a[0]-=o[0],a[1]-=o[1],0!=a[0]||0!=a[1])return s[0]=a[0],void(s[1]=a[1]);if(h[0]=r[0]-u*n[0],h[1]=r[1]-u*n[1],e._$nb(t,i,h,a,1,0,2),a[0]-=o[0],a[1]-=o[1],0!=a[0]||0!=a[1])return a[0]=-a[0],a[0]=-a[0],s[0]=a[0],void(s[1]=a[1]);u*=.1}ot._$so&&console.log("_$L0 to transform _$SP\n")},j.prototype=new st,Y.prototype=new w,Y._$ur=-2,Y._$ES=500,Y._$wb=2,Y._$8S=3,Y._$os=4,Y._$52=Y._$ES,Y._$R2=Y._$ES,Y._$Sb=function(t){for(var e=t.length-1;e>=0;--e){var i=t[e];i<Y._$52?Y._$52=i:i>Y._$R2&&(Y._$R2=i)}},Y._$or=function(){return Y._$52},Y._$Pr=function(){return Y._$R2},Y.prototype._$F0=function(t){this._$gP=t._$nP(),this._$dr=t._$nP(),this._$GS=t._$nP(),this._$qb=t._$6L(),this._$Lb=t._$cS(),this._$mS=t._$Tb(),t.getFormatVersion()>=U._$T7?(this.clipID=t._$nP(),this.clipIDList=this.convertClipIDForV2_11(this.clipID)):this.clipIDList=null,Y._$Sb(this._$Lb)},Y.prototype.getClipIDList=function(){return this.clipIDList},Y.prototype._$Nr=function(t,e){if(e._$IS[0]=!1,e._$Us=A._$Z2(t,this._$GS,e._$IS,this._$Lb),ot._$Zs);else if(e._$IS[0])return;e._$7s=A._$br(t,this._$GS,e._$IS,this._$mS)},Y.prototype._$2b=function(t){},Y.prototype.getDrawDataID=function(){return this._$gP},Y.prototype._$j2=function(t){this._$gP=t},Y.prototype.getOpacity=function(t,e){return e._$7s},Y.prototype._$zS=function(t,e){return e._$Us},Y.prototype.getTargetBaseDataID=function(){return this._$dr},Y.prototype._$gs=function(t){this._$dr=t},Y.prototype._$32=function(){return null!=this._$dr&&this._$dr!=mt._$2o()},Y.prototype.getType=function(){},z._$42=0,z.prototype._$1b=function(){return this._$3S},z.prototype.getDrawDataList=function(){return this._$aS},z.prototype._$F0=function(t){this._$NL=t._$nP(),this._$aS=t._$nP(),this._$3S=t._$nP()},z.prototype._$kr=function(t){t._$Zo(this._$3S),t._$xo(this._$aS),this._$3S=null,this._$aS=null},W.prototype=new e,W.loadModel=function(t){var i=new W;return e._$62(i,t),i},W.loadModel=function(t){var i=new W;return e._$62(i,t),i},W._$to=function(){return new W},W._$er=function(t){var e=new _$5("../_$_r/_$t0/_$Ri/_$_P._$d");if(0==e.exists())throw new _$ls("_$t0 _$_ _$6 _$Ui :: "+e._$PL());for(var i=["../_$_r/_$t0/_$Ri/_$_P.512/_$CP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$vP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$EP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$pP._$1"],r=W.loadModel(e._$3b()),n=0;n<i.length;n++){var s=new _$5(i[n]);if(0==s.exists())throw new _$ls("_$t0 _$_ _$6 _$Ui :: "+s._$PL());r.setTexture(n,_$nL._$_o(t,s._$3b()))}return r},W.prototype.setGL=function(t){this._$zo.setGL(t)},W.prototype.setTransform=function(t){this._$zo.setTransform(t)},W.prototype.draw=function(){this._$5S.draw(this._$zo)},W.prototype._$K2=function(){this._$zo._$K2()},W.prototype.setTexture=function(t,e){null==this._$zo&&a._$li("_$Yi for QT _$ki / _$XS() is _$6 _$ui!!"),this._$zo.setTexture(t,e)},W.prototype.setTexture=function(t,e){null==this._$zo&&a._$li("_$Yi for QT _$ki / _$XS() is _$6 _$ui!!"),this._$zo.setTexture(t,e)},W.prototype._$Rs=function(){return this._$zo._$Rs()},W.prototype._$Ds=function(t){this._$zo._$Ds(t)},W.prototype.getDrawParam=function(){return this._$zo},q.prototype=new o,q._$cs="VISIBLE:",q._$ar="LAYOUT:",q.MTN_PREFIX_FADEIN="FADEIN:",q.MTN_PREFIX_FADEOUT="FADEOUT:",q._$Co=0,q._$1T=1,q.loadMotion=function(t){var e=X._$C(t);return q.loadMotion(e)},q.loadMotion=function(t){t instanceof ArrayBuffer&&(t=new DataView(t));var e=new q,i=[0],r=t.byteLength;e._$yT=0;for(var n=0;n<r;++n){var s=Z(t,n),o=s.charCodeAt(0);if("\n"!=s&&"\r"!=s)if("#"!=s)if("$"!=s){if(97<=o&&o<=122||65<=o&&o<=90||"_"==s){for(c=n,f=-1;n<r&&("\r"!=(s=Z(t,n))&&"\n"!=s);++n)if("="==s){f=n;break}if(f>=0){var a=new B;R.startsWith(t,c,q._$cs)?(a._$RP=B._$hs,a._$4P=R.createString(t,c,f-c)):R.startsWith(t,c,q._$ar)?(a._$4P=R.createString(t,c+7,f-c-7),R.startsWith(t,c+7,"ANCHOR_X")?a._$RP=B._$xs:R.startsWith(t,c+7,"ANCHOR_Y")?a._$RP=B._$us:R.startsWith(t,c+7,"SCALE_X")?a._$RP=B._$qs:R.startsWith(t,c+7,"SCALE_Y")?a._$RP=B._$Ys:R.startsWith(t,c+7,"X")?a._$RP=B._$ws:R.startsWith(t,c+7,"Y")&&(a._$RP=B._$Ns)):(a._$RP=B._$Fr,a._$4P=R.createString(t,c,f-c)),e.motions.push(a);var h=0,u=[];for(n=f+1;n<r&&("\r"!=(s=Z(t,n))&&"\n"!=s);++n)if(","!=s&&" "!=s&&"\t"!=s){p=R._$LS(t,r,n,i);if(i[0]>0){u.push(p),h++;var l=i[0];if(l<n){console.log("_$n0 _$hi . @Live2DMotion loadMotion()\n");break}n=l-1}}a._$I0=new Float32Array(u),h>e._$yT&&(e._$yT=h)}}}else{for(var c=n,f=-1;n<r&&("\r"!=(s=Z(t,n))&&"\n"!=s);++n)if("="==s){f=n;break}var d=!1;if(f>=0)for(f==c+4&&"f"==Z(t,c+1)&&"p"==Z(t,c+2)&&"s"==Z(t,c+3)&&(d=!0),n=f+1;n<r&&("\r"!=(s=Z(t,n))&&"\n"!=s);++n)if(","!=s&&" "!=s&&"\t"!=s){var p=R._$LS(t,r,n,i);i[0]>0&&d&&5<p&&p<121&&(e._$D0=p),n=i[0]}for(;n<r&&("\n"!=Z(t,n)&&"\r"!=Z(t,n));++n);}else for(;n<r&&("\n"!=Z(t,n)&&"\r"!=Z(t,n));++n);}return e._$rr=1e3*e._$yT/e._$D0|0,e},q.prototype.getDurationMSec=function(){return this._$E?-1:this._$rr},q.prototype.getLoopDurationMSec=function(){return this._$rr},q.prototype.dump=function(){for(var t=0;t<this.motions.length;t++){var e=this.motions[t];console.log("_$wL[%s] [%d]. ",e._$4P,e._$I0.length);for(var i=0;i<e._$I0.length&&i<10;i++)console.log("%5.2f ,",e._$I0[i]);console.log("\n")}},q.prototype.updateParamExe=function(t,e,i,r){for(var n=(e-r._$z2)*this._$D0/1e3,s=0|n,o=n-s,a=0;a<this.motions.length;a++){var h=this.motions[a],u=h._$I0.length,l=h._$4P;if(h._$RP==B._$hs){var c=h._$I0[s>=u?u-1:s];t.setParamFloat(l,c)}else if(B._$ws<=h._$RP&&h._$RP<=B._$Ys);else{var f=t.getParamIndex(l),d=t.getModelContext(),p=.4*(d.getParamMax(f)-d.getParamMin(f)),_=d.getParamFloat(f),m=h._$I0[s>=u?u-1:s],g=h._$I0[s+1>=u?u-1:s+1],v=_+((m<g&&g-m>p||m>g&&m-g>p?m:m+(g-m)*o)-_)*i;t.setParamFloat(l,v)}}s>=this._$yT&&(this._$E?(r._$z2=e,this.loopFadeIn&&(r._$bs=e)):r._$9L=!0),this._$eP=i},q.prototype._$r0=function(){return this._$E},q.prototype._$aL=function(t){this._$E=t},q.prototype._$S0=function(){return this._$D0},q.prototype._$U0=function(t){this._$D0=t},q.prototype.isLoopFadeIn=function(){return this.loopFadeIn},q.prototype.setLoopFadeIn=function(t){this.loopFadeIn=t},k.prototype.clear=function(){this.size=0},k.prototype.add=function(t){if(this._$P.length<=this.size){var e=new Float32Array(2*this.size);I._$jT(this._$P,0,e,0,this.size),this._$P=e}this._$P[this.size++]=t},k.prototype._$BL=function(){var t=new Float32Array(this.size);return I._$jT(this._$P,0,t,0,this.size),t},B._$Fr=0,B._$hs=1,B._$ws=100,B._$Ns=101,B._$xs=102,B._$us=103,B._$qs=104,B._$Ys=105,Q.prototype=new M,Q._$gT=new Array,Q.prototype._$zP=function(){this._$GS=new O,this._$GS._$zP()},Q.prototype._$F0=function(t){M.prototype._$F0.call(this,t),this._$A=t._$6L(),this._$o=t._$6L(),this._$GS=t._$nP(),this._$Eo=t._$nP(),M.prototype.readV2_opacity.call(this,t)},Q.prototype.init=function(t){var e=new J(this),i=(this._$o+1)*(this._$A+1);return null!=e._$Cr&&(e._$Cr=null),e._$Cr=new Float32Array(2*i),null!=e._$hr&&(e._$hr=null),this._$32()?e._$hr=new Float32Array(2*i):e._$hr=null,e},Q.prototype._$Nr=function(t,e){var i=e;if(this._$GS._$Ur(t)){var r=this._$VT(),n=Q._$gT;n[0]=!1,A._$Vr(t,this._$GS,n,r,this._$Eo,i._$Cr,0,2),e._$Ib(n[0]),this.interpolateOpacity(t,this._$GS,e,n)}},Q.prototype._$2b=function(t,e){var i=e;if(i._$hS(!0),this._$32()){var r=this.getTargetBaseDataID();if(i._$8r==M._$ur&&(i._$8r=t.getBaseDataIndex(r)),i._$8r<0)ot._$so&&a._$li("_$L _$0P _$G :: %s",r),i._$hS(!1);else{var n=t.getBaseData(i._$8r),s=t._$q2(i._$8r);if(null!=n&&s._$yo()){var o=s.getTotalScale();i.setTotalScale_notForClient(o);var h=s.getTotalOpacity();i.setTotalOpacity(h*i.getInterpolatedOpacity()),n._$nb(t,s,i._$Cr,i._$hr,this._$VT(),0,2),i._$hS(!0)}else i._$hS(!1)}}else i.setTotalOpacity(i.getInterpolatedOpacity())},Q.prototype._$nb=function(t,e,i,r,n,s,o){var a=e,h=null!=a._$hr?a._$hr:a._$Cr;Q.transformPoints_sdk2(i,r,n,s,o,h,this._$o,this._$A)},Q.transformPoints_sdk2=function(t,e,i,r,n,s,o,a){for(var h,u,l,c=i*n,f=0,d=0,p=0,_=0,m=0,g=0,v=!1,y=r;y<c;y+=n){var b,x,T,A;if(T=t[y],x=(A=t[y+1])*a,(b=T*o)<0||x<0||o<=b||a<=x){var E=o+1;if(!v){v=!0,f=.25*(s[2*(0+0*E)]+s[2*(o+0*E)]+s[2*(0+a*E)]+s[2*(o+a*E)]),d=.25*(s[2*(0+0*E)+1]+s[2*(o+0*E)+1]+s[2*(0+a*E)+1]+s[2*(o+a*E)+1]);var w=s[2*(o+a*E)]-s[2*(0+0*E)],S=s[2*(o+a*E)+1]-s[2*(0+0*E)+1],P=s[2*(o+0*E)]-s[2*(0+a*E)],M=s[2*(o+0*E)+1]-s[2*(0+a*E)+1];f-=.5*((p=.5*(w+P))+(m=.5*(w-P))),d-=.5*((_=.5*(S+M))+(g=.5*(S-M)))}if(-2<T&&T<3&&-2<A&&A<3)if(T<=0)if(A<=0){var I=s[2*(0+0*E)],C=s[2*(0+0*E)+1],R=f-2*p,O=d-2*_,$=f-2*m,D=d-2*g,L=f-2*p-2*m,F=d-2*_-2*g;(k=.5*(T- -2))+(B=.5*(A- -2))<=1?(e[y]=L+($-L)*k+(R-L)*B,e[y+1]=F+(D-F)*k+(O-F)*B):(e[y]=I+(R-I)*(1-k)+($-I)*(1-B),e[y+1]=C+(O-C)*(1-k)+(D-C)*(1-B))}else if(A>=1){$=s[2*(0+a*E)],D=s[2*(0+a*E)+1],L=f-2*p+1*m,F=d-2*_+1*g,I=f+3*m,C=d+3*g,R=f-2*p+3*m,O=d-2*_+3*g;(k=.5*(T- -2))+(B=.5*(A-1))<=1?(e[y]=L+($-L)*k+(R-L)*B,e[y+1]=F+(D-F)*k+(O-F)*B):(e[y]=I+(R-I)*(1-k)+($-I)*(1-B),e[y+1]=C+(O-C)*(1-k)+(D-C)*(1-B))}else{(G=0|x)==a&&(G=a-1);var k=.5*(T- -2),B=x-G,N=G/a,U=(G+1)/a;$=s[2*(0+G*E)],D=s[2*(0+G*E)+1],I=s[2*(0+(G+1)*E)],C=s[2*(0+(G+1)*E)+1],L=f-2*p+N*m,F=d-2*_+N*g,R=f-2*p+U*m,O=d-2*_+U*g;k+B<=1?(e[y]=L+($-L)*k+(R-L)*B,e[y+1]=F+(D-F)*k+(O-F)*B):(e[y]=I+(R-I)*(1-k)+($-I)*(1-B),e[y+1]=C+(O-C)*(1-k)+(D-C)*(1-B))}else if(1<=T)if(A<=0){R=s[2*(o+0*E)],O=s[2*(o+0*E)+1],I=f+3*p,C=d+3*_,L=f+1*p-2*m,F=d+1*_-2*g,$=f+3*p-2*m,D=d+3*_-2*g;(k=.5*(T-1))+(B=.5*(A- -2))<=1?(e[y]=L+($-L)*k+(R-L)*B,e[y+1]=F+(D-F)*k+(O-F)*B):(e[y]=I+(R-I)*(1-k)+($-I)*(1-B),e[y+1]=C+(O-C)*(1-k)+(D-C)*(1-B))}else if(A>=1){L=s[2*(o+a*E)],F=s[2*(o+a*E)+1],$=f+3*p+1*m,D=d+3*_+1*g,R=f+1*p+3*m,O=d+1*_+3*g,I=f+3*p+3*m,C=d+3*_+3*g;(k=.5*(T-1))+(B=.5*(A-1))<=1?(e[y]=L+($-L)*k+(R-L)*B,e[y+1]=F+(D-F)*k+(O-F)*B):(e[y]=I+(R-I)*(1-k)+($-I)*(1-B),e[y+1]=C+(O-C)*(1-k)+(D-C)*(1-B))}else{var G;(G=0|x)==a&&(G=a-1);k=.5*(T-1),B=x-G,N=G/a,U=(G+1)/a,L=s[2*(o+G*E)],F=s[2*(o+G*E)+1],R=s[2*(o+(G+1)*E)],O=s[2*(o+(G+1)*E)+1],$=f+3*p+N*m,D=d+3*_+N*g,I=f+3*p+U*m,C=d+3*_+U*g;k+B<=1?(e[y]=L+($-L)*k+(R-L)*B,e[y+1]=F+(D-F)*k+(O-F)*B):(e[y]=I+(R-I)*(1-k)+($-I)*(1-B),e[y+1]=C+(O-C)*(1-k)+(D-C)*(1-B))}else if(A<=0){(H=0|b)==o&&(H=o-1);k=b-H,B=.5*(A- -2);var X=H/o,V=(H+1)/o;R=s[2*(H+0*E)],O=s[2*(H+0*E)+1],I=s[2*(H+1+0*E)],C=s[2*(H+1+0*E)+1],L=f+X*p-2*m,F=d+X*_-2*g,$=f+V*p-2*m,D=d+V*_-2*g;k+B<=1?(e[y]=L+($-L)*k+(R-L)*B,e[y+1]=F+(D-F)*k+(O-F)*B):(e[y]=I+(R-I)*(1-k)+($-I)*(1-B),e[y+1]=C+(O-C)*(1-k)+(D-C)*(1-B))}else if(A>=1){var H;(H=0|b)==o&&(H=o-1);k=b-H,B=.5*(A-1),X=H/o,V=(H+1)/o,L=s[2*(H+a*E)],F=s[2*(H+a*E)+1],$=s[2*(H+1+a*E)],D=s[2*(H+1+a*E)+1],R=f+X*p+3*m,O=d+X*_+3*g,I=f+V*p+3*m,C=d+V*_+3*g;k+B<=1?(e[y]=L+($-L)*k+(R-L)*B,e[y+1]=F+(D-F)*k+(O-F)*B):(e[y]=I+(R-I)*(1-k)+($-I)*(1-B),e[y+1]=C+(O-C)*(1-k)+(D-C)*(1-B))}else System.err.printf("_$li calc : %.4f , %.4f\t\t\t\t\t@@BDBoxGrid\n",T,A);else e[y]=f+T*p+A*m,e[y+1]=d+T*_+A*g}else h=2*((0|b)+(0|x)*(o+1)),(u=b-(0|b))+(l=x-(0|x))<1?(e[y]=s[h]*(1-u-l)+s[h+2]*u+s[h+2*(o+1)]*l,e[y+1]=s[h+1]*(1-u-l)+s[h+3]*u+s[h+2*(o+1)+1]*l):(e[y]=s[h+2*(o+1)+2]*(u-1+l)+s[h+2*(o+1)]*(1-u)+s[h+2]*(1-l),e[y+1]=s[h+2*(o+1)+3]*(u-1+l)+s[h+2*(o+1)+1]*(1-u)+s[h+3]*(1-l))}},Q.prototype.transformPoints_sdk1=function(t,e,i,r,n,s,o){for(var a,h,u,l,c,f,d,p=e,_=this._$o,m=this._$A,g=n*o,v=null!=p._$hr?p._$hr:p._$Cr,y=s;y<g;y+=o)ot._$ts?((a=i[y])<0?a=0:a>1&&(a=1),(h=i[y+1])<0?h=0:h>1&&(h=1),(u=0|(a*=_))>_-1&&(u=_-1),(l=0|(h*=m))>m-1&&(l=m-1),f=a-u,d=h-l,c=2*(u+l*(_+1))):(f=(a=i[y]*_)-(0|a),d=(h=i[y+1]*m)-(0|h),c=2*((0|a)+(0|h)*(_+1))),f+d<1?(r[y]=v[c]*(1-f-d)+v[c+2]*f+v[c+2*(_+1)]*d,r[y+1]=v[c+1]*(1-f-d)+v[c+3]*f+v[c+2*(_+1)+1]*d):(r[y]=v[c+2*(_+1)+2]*(f-1+d)+v[c+2*(_+1)]*(1-f)+v[c+2]*(1-d),r[y+1]=v[c+2*(_+1)+3]*(f-1+d)+v[c+2*(_+1)+1]*(1-f)+v[c+3]*(1-d))},Q.prototype._$VT=function(){return(this._$o+1)*(this._$A+1)},Q.prototype.getType=function(){return M._$_b},J.prototype=new st,K._$42=0,K.prototype._$zP=function(){this._$3S=new Array,this._$aS=new Array},K.prototype._$F0=function(t){this._$g0=t._$8L(),this.visible=t._$8L(),this._$NL=t._$nP(),this._$3S=t._$nP(),this._$aS=t._$nP()},K.prototype.init=function(t){var e=new tt(this);return e.setPartsOpacity(this.isVisible()?1:0),e},K.prototype._$6o=function(t){if(null==this._$3S)throw new Error("_$3S _$6 _$Wo@_$6o");this._$3S.push(t)},K.prototype._$3o=function(t){if(null==this._$aS)throw new Error("_$aS _$6 _$Wo@_$3o");this._$aS.push(t)},K.prototype._$Zo=function(t){this._$3S=t},K.prototype._$xo=function(t){this._$aS=t},K.prototype.isVisible=function(){return this.visible},K.prototype._$uL=function(){return this._$g0},K.prototype._$KP=function(t){this.visible=t},K.prototype._$ET=function(t){this._$g0=t},K.prototype.getBaseData=function(){return this._$3S},K.prototype.getDrawData=function(){return this._$aS},K.prototype._$p2=function(){return this._$NL},K.prototype._$ob=function(t){this._$NL=t},K.prototype.getPartsID=function(){return this._$NL},K.prototype._$MP=function(t){this._$NL=t},tt.prototype=new function(){},tt.prototype.getPartsOpacity=function(){return this._$VS},tt.prototype.setPartsOpacity=function(t){this._$VS=t},et._$L7=function(){c._$27(),mt._$27(),D._$27(),l._$27()},et.prototype.toString=function(){return this.id},it.prototype._$1s=function(){return this._$4S},it.prototype._$zP=function(){this._$4S=new Array},it.prototype._$F0=function(t){this._$4S=t._$nP()},it.prototype._$Ks=function(t){this._$4S.push(t)},rt.tr=new _t,rt._$50=new _t,rt._$Ti=new Array(0,0),rt._$Pi=new Array(0,0),rt._$B=new Array(0,0),rt.prototype._$lP=function(t,e,i,r){this.viewport=new Array(t,e,i,r)},rt.prototype._$bL=function(){this.context.save();var t=this.viewport;null!=t&&(this.context.beginPath(),this.context._$Li(t[0],t[1],t[2],t[3]),this.context.clip())},rt.prototype._$ei=function(){this.context.restore()},rt.prototype.drawElements=function(t,e,i,r,n,s,o,h){try{n!=this._$Qo&&(this._$Qo=n,this.context.globalAlpha=n);for(var u=e.length,l=t.width,c=t.height,f=this.context,d=this._$xP,p=this._$uP,_=this._$6r,m=this._$3r,g=rt.tr,v=rt._$Ti,y=rt._$Pi,b=rt._$B,T=0;T<u;T+=3){f.save();var A=e[T],E=e[T+1],w=e[T+2],S=d+_*i[2*A],P=p+m*i[2*A+1],M=d+_*i[2*E],I=p+m*i[2*E+1],C=d+_*i[2*w],R=p+m*i[2*w+1];o&&(o._$PS(S,P,b),S=b[0],P=b[1],o._$PS(M,I,b),M=b[0],I=b[1],o._$PS(C,R,b),C=b[0],R=b[1]);var O=l*r[2*A],$=c-c*r[2*A+1],D=l*r[2*E],L=c-c*r[2*E+1],F=l*r[2*w],k=c-c*r[2*w+1],B=Math.atan2(L-$,D-O),N=Math.atan2(I-P,M-S),U=M-S,G=I-P,X=Math.sqrt(U*U+G*G),V=D-O,H=L-$,j=X/Math.sqrt(V*V+H*H);x._$ni(F,k,O,$,D-O,L-$,-(L-$),D-O,v),x._$ni(C,R,S,P,M-S,I-P,-(I-P),M-S,y);var Y=(y[0]-v[0])/v[1],z=Math.min(O,D,F),W=Math.max(O,D,F),q=Math.min($,L,k),Z=Math.max($,L,k),Q=Math.floor(z),J=Math.floor(q),K=Math.ceil(W),tt=Math.ceil(Z);g.identity(),g.translate(S,P),g.rotate(N),g.scale(1,y[1]/v[1]),g.shear(Y,0),g.scale(j,j),g.rotate(-B),g.translate(-O,-$),g.setContext(f);if(s||(s=1.2),ot.IGNORE_EXPAND&&(s=0),ot.USE_CACHED_POLYGON_IMAGE){var et=h._$e0;if(et.gl_cacheImage=et.gl_cacheImage||{},!et.gl_cacheImage[T]){var it=rt.createCanvas(K-Q,tt-J);ot.DEBUG_DATA.LDGL_CANVAS_MB=ot.DEBUG_DATA.LDGL_CANVAS_MB||0,ot.DEBUG_DATA.LDGL_CANVAS_MB+=(K-Q)*(tt-J)*4;var nt=it.getContext("2d");nt.translate(-Q,-J),rt.clip(nt,g,s,X,O,$,D,L,F,k,S,P,M,I,C,R),nt.drawImage(t,0,0),et.gl_cacheImage[T]={cacheCanvas:it,cacheContext:nt}}f.drawImage(et.gl_cacheImage[T].cacheCanvas,Q,J)}else ot.IGNORE_CLIP||rt.clip(f,g,s,X,O,$,D,L,F,k,S,P,M,I,C,R),ot.USE_ADJUST_TRANSLATION&&(z=0,W=l,q=0,Z=c),f.drawImage(t,z,q,W-z,Z-q,z,q,W-z,Z-q);f.restore()}}catch(t){a._$Rb(t)}},rt.clip=function(t,e,i,r,n,s,o,a,h,u,l,c,f,d,p,_){i>.02?rt.expandClip(t,e,i,r,l,c,f,d,p,_):rt.clipWithTransform(t,null,n,s,o,a,h,u)},rt.expandClip=function(t,e,i,r,n,s,o,a,h,u){var l=o-n,c=a-s,f=h-n,d=u-s,p=l*d-c*f>0?i:-i,_=-c,m=l,g=h-o,v=u-a,y=-v,b=g,x=Math.sqrt(g*g+v*v),T=-d,A=f,E=Math.sqrt(f*f+d*d),w=n-p*_/r,S=s-p*m/r,P=o-p*_/r,M=a-p*m/r,I=o-p*y/x,C=a-p*b/x,R=h-p*y/x,O=u-p*b/x,$=n+p*T/E,D=s+p*A/E,L=h+p*T/E,F=u+p*A/E,k=rt._$50;return null!=e._$P2(k)&&(rt.clipWithTransform(t,k,w,S,P,M,I,C,R,O,L,F,$,D),!0)},rt.clipWithTransform=function(t,e,i,r,n,s,o,h){if(arguments.length<7)a._$li("err : @LDGL.clip()");else if(arguments[1]instanceof _t){var u=rt._$B,l=e,c=arguments;if(t.beginPath(),l){l._$PS(c[2],c[3],u),t.moveTo(u[0],u[1]);for(var f=4;f<c.length;f+=2)l._$PS(c[f],c[f+1],u),t.lineTo(u[0],u[1])}else{t.moveTo(c[2],c[3]);for(f=4;f<c.length;f+=2)t.lineTo(c[f],c[f+1])}t.clip()}else a._$li("err : a[0] is _$6 LDTransform @LDGL.clip()")},rt.createCanvas=function(t,e){var i=document.createElement("canvas");return i.setAttribute("width",t),i.setAttribute("height",e),i||a._$li("err : "+i),i},rt.dumpValues=function(){for(var t="",e=0;e<arguments.length;e++)t+="["+e+"]= "+arguments[e].toFixed(3)+" , ";console.log(t)},nt.prototype._$F0=function(t){this._$TT=t._$_T(),this._$LT=t._$_T(),this._$FS=t._$_T(),this._$wL=t._$nP()},nt.prototype.getMinValue=function(){return this._$TT},nt.prototype.getMaxValue=function(){return this._$LT},nt.prototype.getDefaultValue=function(){return this._$FS},nt.prototype.getParamID=function(){return this._$wL},st.prototype._$yo=function(){return this._$AT&&!this._$JS},st.prototype._$hS=function(t){this._$AT=t},st.prototype._$GT=function(){return this._$e0},st.prototype._$l2=function(t){this._$IP=t},st.prototype.getPartsIndex=function(){return this._$IP},st.prototype._$x2=function(){return this._$JS},st.prototype._$Ib=function(t){this._$JS=t},st.prototype.getTotalScale=function(){return this.totalScale},st.prototype.setTotalScale_notForClient=function(t){this.totalScale=t},st.prototype.getInterpolatedOpacity=function(){return this._$7s},st.prototype.setInterpolatedOpacity=function(t){this._$7s=t},st.prototype.getTotalOpacity=function(t){return this.totalOpacity},st.prototype.setTotalOpacity=function(t){this.totalOpacity=t},ot._$2s="2.1.00_1",ot._$Kr=201001e3,ot._$sP=!0,ot._$so=!0,ot._$cb=!1,ot._$3T=!0,ot._$Ts=!0,ot._$fb=!0,ot._$ts=!0,ot.L2D_DEFORMER_EXTEND=!0,ot._$Wb=!1,ot._$yr=!1,ot._$Zs=!1,ot.L2D_NO_ERROR=0,ot._$i7=1e3,ot._$9s=1001,ot._$es=1100,ot._$r7=2e3,ot._$07=2001,ot._$b7=2002,ot._$H7=4e3,ot.L2D_COLOR_BLEND_MODE_MULT=0,ot.L2D_COLOR_BLEND_MODE_ADD=1,ot.L2D_COLOR_BLEND_MODE_INTERPOLATE=2,ot._$6b=!0,ot._$cT=0,ot.clippingMaskBufferSize=256,ot.glContext=new Array,ot.frameBuffers=new Array,ot.fTexture=new Array,ot.IGNORE_CLIP=!1,ot.IGNORE_EXPAND=!1,ot.EXPAND_W=2,ot.USE_ADJUST_TRANSLATION=!0,ot.USE_CANVAS_TRANSFORM=!0,ot.USE_CACHED_POLYGON_IMAGE=!1,ot.DEBUG_DATA={},ot.PROFILE_IOS_SPEED={PROFILE_NAME:"iOS Speed",USE_ADJUST_TRANSLATION:!0,USE_CACHED_POLYGON_IMAGE:!0,EXPAND_W:4},ot.PROFILE_IOS_QUALITY={PROFILE_NAME:"iOS HiQ",USE_ADJUST_TRANSLATION:!0,USE_CACHED_POLYGON_IMAGE:!1,EXPAND_W:2},ot.PROFILE_IOS_DEFAULT=ot.PROFILE_IOS_QUALITY,ot.PROFILE_ANDROID={PROFILE_NAME:"Android",USE_ADJUST_TRANSLATION:!1,USE_CACHED_POLYGON_IMAGE:!1,EXPAND_W:2},ot.PROFILE_DESKTOP={PROFILE_NAME:"Desktop",USE_ADJUST_TRANSLATION:!1,USE_CACHED_POLYGON_IMAGE:!1,EXPAND_W:2},ot.initProfile=function(){Et.isIOS()?ot.setupProfile(ot.PROFILE_IOS_DEFAULT):Et.isAndroid()?ot.setupProfile(ot.PROFILE_ANDROID):ot.setupProfile(ot.PROFILE_DESKTOP)},ot.setupProfile=function(t,e){if("number"==typeof t)switch(t){case 9901:t=ot.PROFILE_IOS_SPEED;break;case 9902:t=ot.PROFILE_IOS_QUALITY;break;case 9903:t=ot.PROFILE_IOS_DEFAULT;break;case 9904:t=ot.PROFILE_ANDROID;break;case 9905:t=ot.PROFILE_DESKTOP;break;default:alert("profile _$6 _$Ui : "+t)}for(var i in arguments.length<2&&(e=!0),e&&console.log("profile : "+t.PROFILE_NAME),t)ot[i]=t[i],e&&console.log("  ["+i+"] = "+t[i])},ot.init=function(){ot._$6b&&(console.log("Live2D %s",ot._$2s),ot._$6b=!1,ot.initProfile())},ot.getVersionStr=function(){return ot._$2s},ot.getVersionNo=function(){return ot._$Kr},ot._$sT=function(t){ot._$cT=t},ot.getError=function(){var t=ot._$cT;return ot._$cT=0,t},ot.dispose=function(){ot.glContext=[],ot.frameBuffers=[],ot.fTexture=[]},ot.setGL=function(t,e){var i=e||0;ot.glContext[i]=t},ot.getGL=function(t){return ot.glContext[t]},ot.setClippingMaskBufferSize=function(t){ot.clippingMaskBufferSize=t},ot.getClippingMaskBufferSize=function(){return ot.clippingMaskBufferSize},ot.deleteBuffer=function(t){ot.getGL(t).deleteFramebuffer(ot.frameBuffers[t].framebuffer),delete ot.frameBuffers[t],delete ot.glContext[t]},at._$r2=function(t){return t<0?0:t>1?1:.5-.5*Math.cos(t*Tt.PI_F)},ht._$fr=-1,ht.prototype.toString=function(){return this._$ib},ut.prototype=new Y,ut._$42=0,ut._$Os=30,ut._$ms=0,ut._$ns=1,ut._$_s=2,ut._$gT=new Array,ut.prototype._$_S=function(t){this._$LP=t},ut.prototype.getTextureNo=function(){return this._$LP},ut.prototype._$ZL=function(){return this._$Qi},ut.prototype._$H2=function(){return this._$JP},ut.prototype.getNumPoints=function(){return this._$d0},ut.prototype.getType=function(){return Y._$wb},ut.prototype._$B2=function(t,e,i){var r=e,n=null!=r._$hr?r._$hr:r._$Cr;switch(N._$do){default:case N._$Ms:throw new Error("_$L _$ro ");case N._$Qs:for(var s=this._$d0-1;s>=0;--s){n[s*N._$No+4]=i}}},ut.prototype._$zP=function(){this._$GS=new O,this._$GS._$zP()},ut.prototype._$F0=function(t){Y.prototype._$F0.call(this,t),this._$LP=t._$6L(),this._$d0=t._$6L(),this._$Yo=t._$6L();var e=t._$nP();this._$BP=new Int16Array(3*this._$Yo);for(var i=3*this._$Yo-1;i>=0;--i)this._$BP[i]=e[i];if(this._$Eo=t._$nP(),this._$Qi=t._$nP(),t.getFormatVersion()>=U._$s7){if(this._$JP=t._$6L(),0!=this._$JP){if(1&this._$JP){var r=t._$6L();null==this._$5P&&(this._$5P=new Object),this._$5P._$Hb=parseInt(r)}0!=(this._$JP&ut._$Os)?this._$6s=(this._$JP&ut._$Os)>>1:this._$6s=ut._$ms,32&this._$JP&&(this.culling=!1)}}else this._$JP=0},ut.prototype.init=function(t){var e=new lt(this),i=this._$d0*N._$No,r=this._$32();switch(null!=e._$Cr&&(e._$Cr=null),e._$Cr=new Float32Array(i),null!=e._$hr&&(e._$hr=null),e._$hr=r?new Float32Array(i):null,N._$do){default:case N._$Ms:if(N._$Ls)for(var n=this._$d0-1;n>=0;--n){var s=n<<1;this._$Qi[s+1]=1-this._$Qi[s+1]}break;case N._$Qs:for(n=this._$d0-1;n>=0;--n){s=n<<1;var o=n*N._$No,a=this._$Qi[s],h=this._$Qi[s+1];e._$Cr[o]=a,e._$Cr[o+1]=h,e._$Cr[o+4]=0,r&&(e._$hr[o]=a,e._$hr[o+1]=h,e._$hr[o+4]=0)}}return e},ut.prototype._$Nr=function(t,e){var i=e;if(this!=i._$GT()&&console.log("### assert!! ### "),this._$GS._$Ur(t)&&(Y.prototype._$Nr.call(this,t,i),!i._$IS[0])){var r=ut._$gT;r[0]=!1,A._$Vr(t,this._$GS,r,this._$d0,this._$Eo,i._$Cr,N._$i2,N._$No)}},ut.prototype._$2b=function(t,e){try{this!=e._$GT()&&console.log("### assert!! ### ");var i=!1;e._$IS[0]&&(i=!0);var r=e;if(!i&&(Y.prototype._$2b.call(this,t),this._$32())){var n=this.getTargetBaseDataID();if(r._$8r==Y._$ur&&(r._$8r=t.getBaseDataIndex(n)),r._$8r<0)ot._$so&&a._$li("_$L _$0P _$G :: %s",n);else{var s=t.getBaseData(r._$8r),o=t._$q2(r._$8r);null==s||o._$x2()?r._$AT=!1:(s._$nb(t,o,r._$Cr,r._$hr,this._$d0,N._$i2,N._$No),r._$AT=!0),r.baseOpacity=o.getTotalOpacity()}}}catch(t){throw t}},ut.prototype.draw=function(t,e,i){if(this!=i._$GT()&&console.log("### assert!! ### "),!i._$IS[0]){var r=i,n=this._$LP;n<0&&(n=1);var s=this.getOpacity(e,r)*i._$VS*i.baseOpacity,o=null!=r._$hr?r._$hr:r._$Cr;t.setClipBufPre_clipContextForDraw(i.clipBufPre_clipContext),t._$WP(this.culling),t._$Uo(n,3*this._$Yo,this._$BP,o,this._$Qi,s,this._$6s,r)}},ut.prototype.dump=function(){console.log("  _$yi( %d ) , _$d0( %d ) , _$Yo( %d ) \n",this._$LP,this._$d0,this._$Yo),console.log("  _$Oi _$di = { ");for(var t=0;t<this._$BP.length;t++)console.log("%5d ,",this._$BP[t]);console.log("\n  _$5i _$30");for(t=0;t<this._$Eo.length;t++){console.log("\n    _$30[%d] = ",t);for(var e=this._$Eo[t],i=0;i<e.length;i++)console.log("%6.2f, ",e[i])}console.log("\n")},ut.prototype._$72=function(t){return null==this._$5P?null:this._$5P[t]},ut.prototype.getIndexArray=function(){return this._$BP},lt.prototype=new At,lt.prototype.getTransformedPoints=function(){return null!=this._$hr?this._$hr:this._$Cr},ct.prototype._$HT=function(t){this.x=t.x,this.y=t.y},ct.prototype._$HT=function(t,e){this.x=t,this.y=e},ft.prototype=new e,ft.loadModel=function(t){var i=new ft;return e._$62(i,t),i},ft.loadModel=function(t,i){var r=new ft(i||0);return e._$62(r,t),r},ft._$to=function(){return new ft},ft._$er=function(t){var e=new _$5("../_$_r/_$t0/_$Ri/_$_P._$d");if(0==e.exists())throw new _$ls("_$t0 _$_ _$6 _$Ui :: "+e._$PL());for(var i=["../_$_r/_$t0/_$Ri/_$_P.512/_$CP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$vP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$EP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$pP._$1"],r=ft.loadModel(e._$3b()),n=0;n<i.length;n++){var s=new _$5(i[n]);if(0==s.exists())throw new _$ls("_$t0 _$_ _$6 _$Ui :: "+s._$PL());r.setTexture(n,_$nL._$_o(t,s._$3b()))}return r},ft.prototype.setGL=function(t){ot.setGL(t)},ft.prototype.setTransform=function(t){this.drawParamWebGL.setTransform(t)},ft.prototype.update=function(){this._$5S.update(),this._$5S.preDraw(this.drawParamWebGL)},ft.prototype.draw=function(){this._$5S.draw(this.drawParamWebGL)},ft.prototype._$K2=function(){this.drawParamWebGL._$K2()},ft.prototype.setTexture=function(t,e){null==this.drawParamWebGL&&a._$li("_$Yi for QT _$ki / _$XS() is _$6 _$ui!!"),this.drawParamWebGL.setTexture(t,e)},ft.prototype.setTexture=function(t,e){null==this.drawParamWebGL&&a._$li("_$Yi for QT _$ki / _$XS() is _$6 _$ui!!"),this.drawParamWebGL.setTexture(t,e)},ft.prototype._$Rs=function(){return this.drawParamWebGL._$Rs()},ft.prototype._$Ds=function(t){this.drawParamWebGL._$Ds(t)},ft.prototype.getDrawParam=function(){return this.drawParamWebGL},ft.prototype.setMatrix=function(t){this.drawParamWebGL.setMatrix(t)},ft.prototype.setPremultipliedAlpha=function(t){this.drawParamWebGL.setPremultipliedAlpha(t)},ft.prototype.isPremultipliedAlpha=function(){return this.drawParamWebGL.isPremultipliedAlpha()},ft.prototype.setAnisotropy=function(t){this.drawParamWebGL.setAnisotropy(t)},ft.prototype.getAnisotropy=function(){return this.drawParamWebGL.getAnisotropy()},dt.prototype._$tb=function(){return this.motions},dt.prototype.startMotion=function(t,e){for(var i=null,r=this.motions.length,n=0;n<r;++n)null!=(i=this.motions[n])&&(i._$qS(i._$w0.getFadeOut()),this._$eb&&a._$Ji("MotionQueueManager[size:%2d]->startMotion() / start _$K _$3 (m%d)\n",r,i._$sr));if(null==t)return-1;(i=new pt)._$w0=t,this.motions.push(i);var s=i._$sr;return this._$eb&&a._$Ji("MotionQueueManager[size:%2d]->startMotion() / new _$w0 (m%d)\n",r,s),s},dt.prototype.updateParam=function(t){try{for(var e=!1,i=0;i<this.motions.length;i++){var r=this.motions[i];if(null!=r){var n=r._$w0;null!=n?(n.updateParam(t,r),e=!0,r.isFinished()&&(this._$eb&&a._$Ji("MotionQueueManager[size:%2d]->updateParam() / _$T0 _$w0 (m%d)\n",this.motions.length-1,r._$sr),this.motions.splice(i,1),i--)):(this.motions=this.motions.splice(i,1),i--)}else this.motions.splice(i,1),i--}return e}catch(t){return a._$li(t),!0}},dt.prototype.isFinished=function(t){if(arguments.length>=1){for(var e=0;e<this.motions.length;e++){if(null!=(i=this.motions[e])&&(i._$sr==t&&!i.isFinished()))return!1}return!0}for(e=0;e<this.motions.length;e++){var i;if(null!=(i=this.motions[e]))if(null!=i._$w0){if(!i.isFinished())return!1}else this.motions.splice(e,1),e--;else this.motions.splice(e,1),e--}return!0},dt.prototype.stopAllMotions=function(){for(var t=0;t<this.motions.length;t++){var e=this.motions[t];if(null!=e){e._$w0;this.motions.splice(t,1),t--}else this.motions.splice(t,1),t--}},dt.prototype._$Zr=function(t){this._$eb=t},dt.prototype._$e=function(){console.log("-- _$R --\n");for(var t=0;t<this.motions.length;t++){var e=this.motions[t]._$w0;console.log("MotionQueueEnt[%d] :: %s\n",this.motions.length,e.toString())}},pt._$Gs=0,pt.prototype.isFinished=function(){return this._$9L},pt.prototype._$qS=function(t){var e=I.getUserTimeMSec()+t;(this._$Do<0||e<this._$Do)&&(this._$Do=e)},pt.prototype._$Bs=function(){return this._$sr},_t.prototype.setContext=function(t){var e=this.m;t.transform(e[0],e[1],e[3],e[4],e[6],e[7])},_t.prototype.toString=function(){for(var t="LDTransform { ",e=0;e<9;e++)t+=this.m[e].toFixed(2)+" ,";return t+=" }"},_t.prototype.identity=function(){var t=this.m;t[0]=t[4]=t[8]=1,t[1]=t[2]=t[3]=t[5]=t[6]=t[7]=0},_t.prototype._$PS=function(t,e,i){null==i&&(i=new Array(0,0));var r=this.m;return i[0]=r[0]*t+r[3]*e+r[6],i[1]=r[1]*t+r[4]*e+r[7],i},_t.prototype._$P2=function(t){t||(t=new _t);var e=this.m,i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],h=e[6],u=e[7],l=e[8],c=i*o*l+r*a*h+n*s*u-i*a*u-n*o*h-r*s*l;if(0==c)return null;var f=1/c;return t.m[0]=f*(o*l-u*a),t.m[1]=f*(u*n-r*l),t.m[2]=f*(r*a-o*n),t.m[3]=f*(h*a-s*l),t.m[4]=f*(i*l-h*n),t.m[5]=f*(s*n-i*a),t.m[6]=f*(s*u-h*o),t.m[7]=f*(h*r-i*u),t.m[8]=f*(i*o-s*r),t},_t.prototype.transform=function(t,e,i){null==i&&(i=new Array(0,0));var r=this.m;return i[0]=r[0]*t+r[3]*e+r[6],i[1]=r[1]*t+r[4]*e+r[7],i},_t.prototype.translate=function(t,e){var i=this.m;i[6]=i[0]*t+i[3]*e+i[6],i[7]=i[1]*t+i[4]*e+i[7],i[8]=i[2]*t+i[5]*e+i[8]},_t.prototype.scale=function(t,e){var i=this.m;i[0]*=t,i[1]*=t,i[2]*=t,i[3]*=e,i[4]*=e,i[5]*=e},_t.prototype.shear=function(t,e){var i=this.m,r=i[0]+i[3]*e,n=i[1]+i[4]*e,s=i[2]+i[5]*e;i[3]=i[0]*t+i[3],i[4]=i[1]*t+i[4],i[5]=i[2]*t+i[5],i[0]=r,i[1]=n,i[2]=s},_t.prototype.rotate=function(t){var e=this.m,i=Math.cos(t),r=Math.sin(t),n=e[0]*i+e[3]*r,s=e[1]*i+e[4]*r,o=e[2]*i+e[5]*r;e[3]=-e[0]*r+e[3]*i,e[4]=-e[1]*r+e[4]*i,e[5]=-e[2]*r+e[5]*i,e[0]=n,e[1]=s,e[2]=o},_t.prototype.concatenate=function(t){var e=this.m,i=t.m,r=e[0]*i[0]+e[3]*i[1]+e[6]*i[2],n=e[1]*i[0]+e[4]*i[1]+e[7]*i[2],s=e[2]*i[0]+e[5]*i[1]+e[8]*i[2],o=e[0]*i[3]+e[3]*i[4]+e[6]*i[5],a=e[1]*i[3]+e[4]*i[4]+e[7]*i[5],h=e[2]*i[3]+e[5]*i[4]+e[8]*i[5],u=e[0]*i[6]+e[3]*i[7]+e[6]*i[8],l=e[1]*i[6]+e[4]*i[7]+e[7]*i[8],c=e[2]*i[6]+e[5]*i[7]+e[8]*i[8];m[0]=r,m[1]=n,m[2]=s,m[3]=o,m[4]=a,m[5]=h,m[6]=u,m[7]=l,m[8]=c},mt.prototype=new et,mt._$eT=null,mt._$tP=new Object,mt._$2o=function(){return null==mt._$eT&&(mt._$eT=mt.getID("DST_BASE")),mt._$eT},mt._$27=function(){mt._$tP.clear(),mt._$eT=null},mt.getID=function(t){var e=mt._$tP[t];return null==e&&(e=new mt(t),mt._$tP[t]=e),e},mt.prototype._$3s=function(){return new mt},gt.prototype=new S,gt._$9r=function(t){return new Float32Array(t)},gt._$vb=function(t){return new Int16Array(t)},gt._$cr=function(t,e){return null==t||t._$yL()<e.length?((t=gt._$9r(2*e.length)).put(e),t._$oT(0)):(t.clear(),t.put(e),t._$oT(0)),t},gt._$mb=function(t,e){return null==t||t._$yL()<e.length?((t=gt._$vb(2*e.length)).put(e),t._$oT(0)):(t.clear(),t.put(e),t._$oT(0)),t},gt._$Hs=function(){return this._$Gr},gt._$as=function(t){this._$Gr=t},gt.prototype.getGL=function(){return this.gl},gt.prototype.setGL=function(t){this.gl=t},gt.prototype.setTransform=function(t){this.transform=t},gt.prototype._$ZT=function(){var t=this.gl;this.firstDraw&&(this.initShader(),this.firstDraw=!1,this.anisotropyExt=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic"),this.anisotropyExt&&(this.maxAnisotropy=t.getParameter(this.anisotropyExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.DEPTH_TEST),t.frontFace(t.CW),t.enable(t.BLEND),t.colorMask(1,1,1,1),t.bindBuffer(t.ARRAY_BUFFER,null),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)},gt.prototype._$Uo=function(t,e,i,r,n,s,o,a){if(!(s<.01&&null==this.clipBufPre_clipContextMask)){s>.9&&ot.EXPAND_W;var h=this.gl;if(null==this.gl)throw new Error("gl is null");var u,l,c,f,d=1*this._$C0*s,p=1*this._$tT*s,_=1*this._$WL*s,m=this._$lT*s;if(null!=this.clipBufPre_clipContextMask){h.frontFace(h.CCW),h.useProgram(this.shaderProgram),this._$vS=vt(h,this._$vS,r),this._$no=yt(h,this._$no,i),h.enableVertexAttribArray(this.a_position_Loc),h.vertexAttribPointer(this.a_position_Loc,2,h.FLOAT,!1,0,0),this._$NT=vt(h,this._$NT,n),h.activeTexture(h.TEXTURE1),h.bindTexture(h.TEXTURE_2D,this.textures[t]),h.uniform1i(this.s_texture0_Loc,1),h.enableVertexAttribArray(this.a_texCoord_Loc),h.vertexAttribPointer(this.a_texCoord_Loc,2,h.FLOAT,!1,0,0),h.uniformMatrix4fv(this.u_matrix_Loc,!1,this.getClipBufPre_clipContextMask().matrixForMask);var g=this.getClipBufPre_clipContextMask().layoutChannelNo,v=this.getChannelFlagAsColor(g);h.uniform4f(this.u_channelFlag,v.r,v.g,v.b,v.a);var y=this.getClipBufPre_clipContextMask().layoutBounds;h.uniform4f(this.u_baseColor_Loc,2*y.x-1,2*y.y-1,2*y._$EL()-1,2*y._$5T()-1),h.uniform1i(this.u_maskFlag_Loc,!0)}else if(null!=this.getClipBufPre_clipContextDraw()){h.useProgram(this.shaderProgramOff),this._$vS=vt(h,this._$vS,r),this._$no=yt(h,this._$no,i),h.enableVertexAttribArray(this.a_position_Loc_Off),h.vertexAttribPointer(this.a_position_Loc_Off,2,h.FLOAT,!1,0,0),this._$NT=vt(h,this._$NT,n),h.activeTexture(h.TEXTURE1),h.bindTexture(h.TEXTURE_2D,this.textures[t]),h.uniform1i(this.s_texture0_Loc_Off,1),h.enableVertexAttribArray(this.a_texCoord_Loc_Off),h.vertexAttribPointer(this.a_texCoord_Loc_Off,2,h.FLOAT,!1,0,0),h.uniformMatrix4fv(this.u_clipMatrix_Loc_Off,!1,this.getClipBufPre_clipContextDraw().matrixForDraw),h.uniformMatrix4fv(this.u_matrix_Loc_Off,!1,this.matrix4x4),h.activeTexture(h.TEXTURE2),h.bindTexture(h.TEXTURE_2D,ot.fTexture[this.glno]),h.uniform1i(this.s_texture1_Loc_Off,2);g=this.getClipBufPre_clipContextDraw().layoutChannelNo,v=this.getChannelFlagAsColor(g);h.uniform4f(this.u_channelFlag_Loc_Off,v.r,v.g,v.b,v.a),h.uniform4f(this.u_baseColor_Loc_Off,d,p,_,m)}else h.useProgram(this.shaderProgram),this._$vS=vt(h,this._$vS,r),this._$no=yt(h,this._$no,i),h.enableVertexAttribArray(this.a_position_Loc),h.vertexAttribPointer(this.a_position_Loc,2,h.FLOAT,!1,0,0),this._$NT=vt(h,this._$NT,n),h.activeTexture(h.TEXTURE1),h.bindTexture(h.TEXTURE_2D,this.textures[t]),h.uniform1i(this.s_texture0_Loc,1),h.enableVertexAttribArray(this.a_texCoord_Loc),h.vertexAttribPointer(this.a_texCoord_Loc,2,h.FLOAT,!1,0,0),h.uniformMatrix4fv(this.u_matrix_Loc,!1,this.matrix4x4),h.uniform4f(this.u_baseColor_Loc,d,p,_,m),h.uniform1i(this.u_maskFlag_Loc,!1);if(this.culling?this.gl.enable(h.CULL_FACE):this.gl.disable(h.CULL_FACE),this.gl.enable(h.BLEND),null!=this.clipBufPre_clipContextMask)u=h.ONE,l=h.ONE_MINUS_SRC_ALPHA,c=h.ONE,f=h.ONE_MINUS_SRC_ALPHA;else switch(o){case ut._$ms:u=h.ONE,l=h.ONE_MINUS_SRC_ALPHA,c=h.ONE,f=h.ONE_MINUS_SRC_ALPHA;break;case ut._$ns:u=h.ONE,l=h.ONE,c=h.ZERO,f=h.ONE;break;case ut._$_s:u=h.DST_COLOR,l=h.ONE_MINUS_SRC_ALPHA,c=h.ZERO,f=h.ONE}h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(u,l,c,f),this.anisotropyExt&&h.texParameteri(h.TEXTURE_2D,this.anisotropyExt.TEXTURE_MAX_ANISOTROPY_EXT,this.maxAnisotropy);var b=i.length;h.drawElements(h.TRIANGLES,b,h.UNSIGNED_SHORT,0),h.bindTexture(h.TEXTURE_2D,null)}},gt.prototype._$Rs=function(){throw new Error("_$Rs")},gt.prototype._$Ds=function(t){throw new Error("_$Ds")},gt.prototype._$K2=function(){for(var t=0;t<this.textures.length;t++){0!=this.textures[t]&&(this.gl._$K2(1,this.textures,t),this.textures[t]=null)}},gt.prototype.setTexture=function(t,e){this.textures[t]=e},gt.prototype.initShader=function(){var t=this.gl;this.loadShaders2(),this.a_position_Loc=t.getAttribLocation(this.shaderProgram,"a_position"),this.a_texCoord_Loc=t.getAttribLocation(this.shaderProgram,"a_texCoord"),this.u_matrix_Loc=t.getUniformLocation(this.shaderProgram,"u_mvpMatrix"),this.s_texture0_Loc=t.getUniformLocation(this.shaderProgram,"s_texture0"),this.u_channelFlag=t.getUniformLocation(this.shaderProgram,"u_channelFlag"),this.u_baseColor_Loc=t.getUniformLocation(this.shaderProgram,"u_baseColor"),this.u_maskFlag_Loc=t.getUniformLocation(this.shaderProgram,"u_maskFlag"),this.a_position_Loc_Off=t.getAttribLocation(this.shaderProgramOff,"a_position"),this.a_texCoord_Loc_Off=t.getAttribLocation(this.shaderProgramOff,"a_texCoord"),this.u_matrix_Loc_Off=t.getUniformLocation(this.shaderProgramOff,"u_mvpMatrix"),this.u_clipMatrix_Loc_Off=t.getUniformLocation(this.shaderProgramOff,"u_ClipMatrix"),this.s_texture0_Loc_Off=t.getUniformLocation(this.shaderProgramOff,"s_texture0"),this.s_texture1_Loc_Off=t.getUniformLocation(this.shaderProgramOff,"s_texture1"),this.u_channelFlag_Loc_Off=t.getUniformLocation(this.shaderProgramOff,"u_channelFlag"),this.u_baseColor_Loc_Off=t.getUniformLocation(this.shaderProgramOff,"u_baseColor")},gt.prototype.disposeShader=function(){var t=this.gl;this.shaderProgram&&(t.deleteProgram(this.shaderProgram),this.shaderProgram=null),this.shaderProgramOff&&(t.deleteProgram(this.shaderProgramOff),this.shaderProgramOff=null)},gt.prototype.compileShader=function(t,e){var i=this.gl,r=e,n=i.createShader(t);if(null==n)return a._$Ji("_$L0 to create shader"),null;if(i.shaderSource(n,r),i.compileShader(n),!i.getShaderParameter(n,i.COMPILE_STATUS)){var s=i.getShaderInfoLog(n);return a._$Ji("_$L0 to compile shader : "+s),i.deleteShader(n),null}return n},gt.prototype.loadShaders2=function(){var t=this.gl;if(this.shaderProgram=t.createProgram(),!this.shaderProgram)return!1;if(this.shaderProgramOff=t.createProgram(),!this.shaderProgramOff)return!1;if(this.vertShader=this.compileShader(t.VERTEX_SHADER,"attribute vec4     a_position;attribute vec2     a_texCoord;varying vec2       v_texCoord;varying vec4       v_ClipPos;uniform mat4       u_mvpMatrix;void main(){    gl_Position = u_mvpMatrix * a_position;    v_ClipPos = u_mvpMatrix * a_position;    v_texCoord = a_texCoord;}"),!this.vertShader)return a._$Ji("Vertex shader compile _$li!"),!1;if(this.vertShaderOff=this.compileShader(t.VERTEX_SHADER,"attribute vec4     a_position;attribute vec2     a_texCoord;varying vec2       v_texCoord;varying vec4       v_ClipPos;uniform mat4       u_mvpMatrix;uniform mat4       u_ClipMatrix;void main(){    gl_Position = u_mvpMatrix * a_position;    v_ClipPos = u_ClipMatrix * a_position;    v_texCoord = a_texCoord ;}"),!this.vertShaderOff)return a._$Ji("OffVertex shader compile _$li!"),!1;if(this.fragShader=this.compileShader(t.FRAGMENT_SHADER,"precision mediump float;varying vec2       v_texCoord;varying vec4       v_ClipPos;uniform sampler2D  s_texture0;uniform vec4       u_channelFlag;uniform vec4       u_baseColor;uniform bool       u_maskFlag;void main(){    vec4 smpColor;     if(u_maskFlag){        float isInside =             step(u_baseColor.x, v_ClipPos.x/v_ClipPos.w)          * step(u_baseColor.y, v_ClipPos.y/v_ClipPos.w)          * step(v_ClipPos.x/v_ClipPos.w, u_baseColor.z)          * step(v_ClipPos.y/v_ClipPos.w, u_baseColor.w);        smpColor = u_channelFlag * texture2D(s_texture0 , v_texCoord).a * isInside;    }else{        smpColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;    }    gl_FragColor = smpColor;}"),!this.fragShader)return a._$Ji("Fragment shader compile _$li!"),!1;if(this.fragShaderOff=this.compileShader(t.FRAGMENT_SHADER,"precision mediump float ;varying vec2       v_texCoord;varying vec4       v_ClipPos;uniform sampler2D  s_texture0;uniform sampler2D  s_texture1;uniform vec4       u_channelFlag;uniform vec4       u_baseColor ;void main(){    vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;    vec4 clipMask = texture2D(s_texture1, v_ClipPos.xy / v_ClipPos.w) * u_channelFlag;    float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;    col_formask = col_formask * maskVal;    gl_FragColor = col_formask;}"),!this.fragShaderOff)return a._$Ji("OffFragment shader compile _$li!"),!1;if(t.attachShader(this.shaderProgram,this.vertShader),t.attachShader(this.shaderProgram,this.fragShader),t.attachShader(this.shaderProgramOff,this.vertShaderOff),t.attachShader(this.shaderProgramOff,this.fragShaderOff),t.linkProgram(this.shaderProgram),t.linkProgram(this.shaderProgramOff),!t.getProgramParameter(this.shaderProgram,t.LINK_STATUS)){var e=t.getProgramInfoLog(this.shaderProgram);return a._$Ji("_$L0 to link program: "+e),this.vertShader&&(t.deleteShader(this.vertShader),this.vertShader=0),this.fragShader&&(t.deleteShader(this.fragShader),this.fragShader=0),this.shaderProgram&&(t.deleteProgram(this.shaderProgram),this.shaderProgram=0),this.vertShaderOff&&(t.deleteShader(this.vertShaderOff),this.vertShaderOff=0),this.fragShaderOff&&(t.deleteShader(this.fragShaderOff),this.fragShaderOff=0),this.shaderProgramOff&&(t.deleteProgram(this.shaderProgramOff),this.shaderProgramOff=0),!1}return!0},gt.prototype.createFramebuffer=function(){var t=this.gl,e=ot.clippingMaskBufferSize,i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i);var r=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,e,e),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,r);var n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,e,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0),t.bindTexture(t.TEXTURE_2D,null),t.bindRenderbuffer(t.RENDERBUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),ot.fTexture[this.glno]=n,{framebuffer:i,renderbuffer:r,texture:ot.fTexture[this.glno]}},bt.prototype._$fP=function(){var t,e,i,r=this._$ST();if(128&r){if(128&(t=this._$ST())){if(128&(e=this._$ST())){if(128&(i=this._$ST()))throw new ht("_$L _$0P  _");return(127&r)<<21|(127&t)<<14|(127&e)<<7|255&i}return(127&r)<<14|(127&t)<<7|255&e}return(127&r)<<7|127&t}return 255&r},bt.prototype.getFormatVersion=function(){return this._$S2},bt.prototype._$gr=function(t){this._$S2=t},bt.prototype._$3L=function(){return this._$fP()},bt.prototype._$mP=function(){return this._$zT(),this._$F+=8,this._$T.getFloat64(this._$F-8)},bt.prototype._$_T=function(){return this._$zT(),this._$F+=4,this._$T.getFloat32(this._$F-4)},bt.prototype._$6L=function(){return this._$zT(),this._$F+=4,this._$T.getInt32(this._$F-4)},bt.prototype._$ST=function(){return this._$zT(),this._$T.getInt8(this._$F++)},bt.prototype._$9T=function(){return this._$zT(),this._$F+=2,this._$T.getInt16(this._$F-2)},bt.prototype._$2T=function(){throw this._$zT(),this._$F+=8,new ht("_$L _$q read long")},bt.prototype._$po=function(){return this._$zT(),0!=this._$T.getInt8(this._$F++)};var xt=!0;function Tt(){}function At(e){t||(this._$e0=null,this._$IP=null,this._$Us=null,this._$7s=null,this._$IS=[!1],this._$VS=null,this._$AT=!0,this.baseOpacity=1,this.clipBufPre_clipContext=null,this._$e0=e)}function Et(){}bt.prototype._$bT=function(){this._$zT();var t=this._$3L(),e=null;if(xt)try{var i=new ArrayBuffer(2*t);e=new Uint16Array(i);for(var r=0;r<t;++r)e[r]=this._$T.getUint8(this._$F++);return String.fromCharCode.apply(null,e)}catch(t){xt=!1}try{var n=new Array;if(null==e)for(r=0;r<t;++r)n[r]=this._$T.getUint8(this._$F++);else for(r=0;r<t;++r)n[r]=e[r];return String.fromCharCode.apply(null,n)}catch(t){console.log("read utf8 / _$rT _$L0 !! : "+t)}},bt.prototype._$cS=function(){this._$zT();for(var t=this._$3L(),e=new Int32Array(t),i=0;i<t;i++)e[i]=this._$T.getInt32(this._$F),this._$F+=4;return e},bt.prototype._$Tb=function(){this._$zT();for(var t=this._$3L(),e=new Float32Array(t),i=0;i<t;i++)e[i]=this._$T.getFloat32(this._$F),this._$F+=4;return e},bt.prototype._$5b=function(){this._$zT();for(var t=this._$3L(),e=new Float64Array(t),i=0;i<t;i++)e[i]=this._$T.getFloat64(this._$F),this._$F+=8;return e},bt.prototype._$nP=function(){return this._$Jb(-1)},bt.prototype._$Jb=function(t){if(this._$zT(),t<0&&(t=this._$3L()),t==U._$7P){var e=this._$6L();if(0<=e&&e<this._$Ko.length)return this._$Ko[e];throw new ht("_$sL _$4i @_$m0")}var i=this._$4b(t);return this._$Ko.push(i),i},bt.prototype._$4b=function(t){if(0==t)return null;if(50==t){var e=this._$bT();return n=D.getID(e)}if(51==t){e=this._$bT();return n=mt.getID(e)}if(134==t){e=this._$bT();return n=l.getID(e)}if(60==t){e=this._$bT();return n=c.getID(e)}if(t>=48){var i=U._$9o(t);return null!=i?(i._$F0(this),i):null}switch(t){case 1:return this._$bT();case 10:return this._$6L(),new s;case 11:return new T(this._$mP(),this._$mP(),this._$mP(),this._$mP());case 12:return new T(this._$_T(),this._$_T(),this._$_T(),this._$_T());case 13:return new E(this._$mP(),this._$mP());case 14:return new E(this._$_T(),this._$_T());case 15:for(var r=this._$3L(),n=new Array(r),o=0;o<r;o++)n[o]=this._$nP();return n;case 17:return n=new L(this._$mP(),this._$mP(),this._$mP(),this._$mP(),this._$mP(),this._$mP());case 21:return new u(this._$6L(),this._$6L(),this._$6L(),this._$6L());case 22:return new ct(this._$6L(),this._$6L());case 23:throw new Error("_$L _$ro ");case 16:case 25:return this._$cS();case 26:return this._$5b();case 27:return this._$Tb();case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 18:case 19:case 20:case 24:case 28:throw new ht("_$6 _$q : _$nP() of 2-9 ,18,19,20,24,28 : "+t);default:throw new ht("_$6 _$q : _$nP() NO _$i : "+t)}},bt.prototype._$8L=function(){return 0==this._$hL?this._$v0=this._$ST():8==this._$hL&&(this._$v0=this._$ST(),this._$hL=0),1==(this._$v0>>7-this._$hL++&1)},bt.prototype._$zT=function(){0!=this._$hL&&(this._$hL=0)},Tt._$2S=Math.PI/180,Tt._$bS=Math.PI/180,Tt._$wS=180/Math.PI,Tt._$NS=180/Math.PI,Tt.PI_F=Math.PI,Tt._$kT=[0,.012368,.024734,.037097,.049454,.061803,.074143,.086471,.098786,.111087,.12337,.135634,.147877,.160098,.172295,.184465,.196606,.208718,.220798,.232844,.244854,.256827,.268761,.280654,.292503,.304308,.316066,.327776,.339436,.351044,.362598,.374097,.385538,.396921,.408243,.419502,.430697,.441826,.452888,.463881,.474802,.485651,.496425,.507124,.517745,.528287,.538748,.549126,.559421,.56963,.579752,.589785,.599728,.609579,.619337,.629,.638567,.648036,.657406,.666676,.675843,.684908,.693867,.70272,.711466,.720103,.72863,.737045,.745348,.753536,.76161,.769566,.777405,.785125,.792725,.800204,.807561,.814793,.821901,.828884,.835739,.842467,.849066,.855535,.861873,.868079,.874153,.880093,.885898,.891567,.897101,.902497,.907754,.912873,.917853,.922692,.92739,.931946,.936359,.940629,.944755,.948737,.952574,.956265,.959809,.963207,.966457,.96956,.972514,.97532,.977976,.980482,.982839,.985045,.987101,.989006,.990759,.992361,.993811,.995109,.996254,.997248,.998088,.998776,.999312,.999694,.999924,1],Tt._$92=function(t,e){var i=Math.atan2(t[1],t[0]),r=Math.atan2(e[1],e[0]);return Tt._$tS(i,r)},Tt._$tS=function(t,e){for(var i=t-e;i<-Math.PI;)i+=2*Math.PI;for(;i>Math.PI;)i-=2*Math.PI;return i},Tt._$9=function(t){return Math.sin(t)},Tt.fcos=function(t){return Math.cos(t)},At.prototype._$u2=function(){return this._$IS[0]},At.prototype._$yo=function(){return this._$AT&&!this._$IS[0]},At.prototype._$GT=function(){return this._$e0},Et._$W2=0,Et.SYSTEM_INFO=null,Et.USER_AGENT=navigator.userAgent,Et.isIPhone=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO._isIPhone},Et.isIOS=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO._isIPhone||Et.SYSTEM_INFO._isIPad},Et.isAndroid=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO._isAndroid},Et.getOSVersion=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO.version},Et.getOS=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO._isIPhone||Et.SYSTEM_INFO._isIPad?"iOS":Et.SYSTEM_INFO._isAndroid?"Android":"_$Q0 OS"},Et.setup=function(){var t,e=Et.USER_AGENT;function i(t,e){for(var i=t.substring(e).split(/[ _,;\.]/),r=0,n=0;n<=2&&!isNaN(i[n]);n++){var s=parseInt(i[n]);if(s<0||s>999){a._$li("err : "+s+" @UtHtml5.setup()"),r=0;break}r+=s*Math.pow(1e3,2-n)}return r}var r=Et.SYSTEM_INFO={userAgent:e};if((t=e.indexOf("iPhone OS "))>=0)r.os="iPhone",r._isIPhone=!0,r.version=i(e,t+10);else if((t=e.indexOf("iPad"))>=0){if((t=e.indexOf("CPU OS"))<0)return void a._$li(" err : "+e+" @UtHtml5.setup()");r.os="iPad",r._isIPad=!0,r.version=i(e,t+7)}else(t=e.indexOf("Android"))>=0?(r.os="Android",r._isAndroid=!0,r.version=i(e,t+8)):(r.os="-",r.version=-1)},window.UtSystem=I,window.UtDebug=a,window.LDTransform=_t,window.LDGL=rt,window.Live2D=ot,window.Live2DModelWebGL=ft,window.Live2DModelJS=W,window.Live2DMotion=q,window.MotionQueueManager=dt,window.PhysicsHair=d,window.AMotion=o,window.PartsDataID=l,window.DrawDataID=D,window.BaseDataID=mt,window.ParamID=c,ot.init();t=!1}(),function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(r||(r={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(n||(n={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(s||(s={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"}(o||(o={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(a||(a={})),function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(h||(h={})),function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(u||(u={})),function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT"}(l||(l={})),function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"}(c||(c={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}(f||(f={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(d||(d={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"}(p||(p={})),function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(_||(_={})),function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"}(g||(g={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(v||(v={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(y||(y={})),function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR"}(b||(b={})),function(t){t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA"}(x||(x={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(T||(T={})),function(t){t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(A||(A={}));
/*!
   * @pixi/settings - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/settings is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
var E={createCanvas:function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var t;return null!==(t=document.baseURI)&&void 0!==t?t:window.location.href},fetch:function(t,e){return fetch(t,e)}},w=/iPhone/i,S=/iPod/i,P=/iPad/i,M=/\biOS-universal(?:.+)Mac\b/i,I=/\bAndroid(?:.+)Mobile\b/i,C=/Android/i,R=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,O=/Silk/i,$=/Windows Phone/i,D=/\bWindows(?:.+)ARM\b/i,L=/BlackBerry/i,F=/BB10/i,k=/Opera Mini/i,B=/\b(CriOS|Chrome)(?:.+)Mobile/i,N=/Mobile(?:.+)Firefox\b/i,U=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};var G=function(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var i=e.userAgent,r=i.split("[FBAN");void 0!==r[1]&&(i=r[0]),void 0!==(r=i.split("Twitter"))[1]&&(i=r[0]);var n=function(t){return function(e){return e.test(t)}}(i),s={apple:{phone:n(w)&&!n($),ipod:n(S),tablet:!n(w)&&(n(P)||U(e))&&!n($),universal:n(M),device:(n(w)||n(S)||n(P)||n(M)||U(e))&&!n($)},amazon:{phone:n(R),tablet:!n(R)&&n(O),device:n(R)||n(O)},android:{phone:!n($)&&n(R)||!n($)&&n(I),tablet:!n($)&&!n(R)&&!n(I)&&(n(O)||n(C)),device:!n($)&&(n(R)||n(O)||n(I)||n(C))||n(/\bokhttp\b/i)},windows:{phone:n($),tablet:n(D),device:n($)||n(D)},other:{blackberry:n(L),blackberry10:n(F),opera:n(k),firefox:n(N),chrome:n(B),device:n(L)||n(F)||n(k)||n(N)||n(B)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}(globalThis.navigator);var X={ADAPTER:E,MIPMAP_TEXTURES:p.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:T.NONE,SPRITE_MAX_TEXTURES:function(t){var e=!0;if(G.tablet||G.phone){var i;if(G.apple.device)if(i=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(i[1],10)<11&&(e=!1);if(G.android.device)if(i=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(i[1],10)<7&&(e=!1)}return e?t:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:v.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:d.CLAMP,SCALE_MODE:f.LINEAR,PRECISION_VERTEX:y.HIGH,PRECISION_FRAGMENT:G.apple.device?y.HIGH:y.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!G.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};function V(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var H={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function r(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function s(t,e,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new n(r,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,r,n=[];if(0===this._eventsCount)return n;for(r in t=this._events)e.call(t,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,s=r.length,o=new Array(s);n<s;n++)o[n]=r[n].fn;return o},a.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,n,s,o){var a=i?i+t:t;if(!this._events[a])return!1;var h,u,l=this._events[a],c=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,n),!0;case 5:return l.fn.call(l.context,e,r,n,s),!0;case 6:return l.fn.call(l.context,e,r,n,s,o),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h)}else{var f,d=l.length;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,r);break;case 4:l[u].fn.call(l[u].context,e,r,n);break;default:if(!h)for(f=1,h=new Array(c-1);f<c;f++)h[f-1]=arguments[f];l[u].fn.apply(l[u].context,h)}}return!0},a.prototype.on=function(t,e,i){return s(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return s(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,r,n){var s=i?i+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||n&&!a.once||r&&a.context!==r||o(this,s);else{for(var h=0,u=[],l=a.length;h<l;h++)(a[h].fn!==e||n&&!a[h].once||r&&a[h].context!==r)&&u.push(a[h]);u.length?this._events[s]=1===u.length?u[0]:u:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&o(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a}(H);var j=V(H.exports),Y={exports:{}};function z(t,e,i){i=i||2;var r,n,s,o,a,h,u,l=e&&e.length,c=l?e[0]*i:t.length,f=W(t,0,c,i,!0),d=[];if(!f||f.next===f.prev)return d;if(l&&(f=function(t,e,i,r){var n,s,o,a=[];for(n=0,s=e.length;n<s;n++)(o=W(t,e[n]*r,n<s-1?e[n+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),a.push(st(o));for(a.sort(et),n=0;n<a.length;n++)i=it(a[n],i);return i}(t,e,f,i)),t.length>80*i){r=s=t[0],n=o=t[1];for(var p=i;p<c;p+=i)(a=t[p])<r&&(r=a),(h=t[p+1])<n&&(n=h),a>s&&(s=a),h>o&&(o=h);u=0!==(u=Math.max(s-r,o-n))?32767/u:0}return Z(f,d,i,r,n,u,0),d}function W(t,e,i,r,n){var s,o;if(n===vt(t,e,i,r)>0)for(s=e;s<i;s+=r)o=_t(s,t[s],t[s+1],o);else for(s=i-r;s>=e;s-=r)o=_t(s,t[s],t[s+1],o);return o&&ut(o,o.next)&&(mt(o),o=o.next),o}function q(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!ut(r,r.next)&&0!==ht(r.prev,r,r.next))r=r.next;else{if(mt(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Z(t,e,i,r,n,s,o){if(t){!o&&s&&function(t,e,i,r){var n=t;do{0===n.z&&(n.z=nt(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,s,o,a,h,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,r=i,a=0,e=0;e<u&&(a++,r=r.nextZ);e++);for(h=u;a>0||h>0&&r;)0!==a&&(0===h||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,h--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=r}s.nextZ=null,u*=2}while(o>1)}(n)}(t,r,n,s);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?J(t,r,n,s):Q(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(h.i/i|0),mt(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?Z(t=K(q(t),e,i),e,i,r,n,s,2):2===o&&tt(t,e,i,r,n,s):Z(q(t),e,i,r,n,s,1);break}}}function Q(t){var e=t.prev,i=t,r=t.next;if(ht(e,i,r)>=0)return!1;for(var n=e.x,s=i.x,o=r.x,a=e.y,h=i.y,u=r.y,l=n<s?n<o?n:o:s<o?s:o,c=a<h?a<u?a:u:h<u?h:u,f=n>s?n>o?n:o:s>o?s:o,d=a>h?a>u?a:u:h>u?h:u,p=r.next;p!==e;){if(p.x>=l&&p.x<=f&&p.y>=c&&p.y<=d&&ot(n,a,s,h,o,u,p.x,p.y)&&ht(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function J(t,e,i,r){var n=t.prev,s=t,o=t.next;if(ht(n,s,o)>=0)return!1;for(var a=n.x,h=s.x,u=o.x,l=n.y,c=s.y,f=o.y,d=a<h?a<u?a:u:h<u?h:u,p=l<c?l<f?l:f:c<f?c:f,_=a>h?a>u?a:u:h>u?h:u,m=l>c?l>f?l:f:c>f?c:f,g=nt(d,p,e,i,r),v=nt(_,m,e,i,r),y=t.prevZ,b=t.nextZ;y&&y.z>=g&&b&&b.z<=v;){if(y.x>=d&&y.x<=_&&y.y>=p&&y.y<=m&&y!==n&&y!==o&&ot(a,l,h,c,u,f,y.x,y.y)&&ht(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,b.x>=d&&b.x<=_&&b.y>=p&&b.y<=m&&b!==n&&b!==o&&ot(a,l,h,c,u,f,b.x,b.y)&&ht(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;y&&y.z>=g;){if(y.x>=d&&y.x<=_&&y.y>=p&&y.y<=m&&y!==n&&y!==o&&ot(a,l,h,c,u,f,y.x,y.y)&&ht(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=d&&b.x<=_&&b.y>=p&&b.y<=m&&b!==n&&b!==o&&ot(a,l,h,c,u,f,b.x,b.y)&&ht(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function K(t,e,i){var r=t;do{var n=r.prev,s=r.next.next;!ut(n,s)&&lt(n,r,r.next,s)&&dt(n,s)&&dt(s,n)&&(e.push(n.i/i|0),e.push(r.i/i|0),e.push(s.i/i|0),mt(r),mt(r.next),r=t=s),r=r.next}while(r!==t);return q(r)}function tt(t,e,i,r,n,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&at(o,a)){var h=pt(o,a);return o=q(o,o.next),h=q(h,h.next),Z(o,e,i,r,n,s,0),void Z(h,e,i,r,n,s,0)}a=a.next}o=o.next}while(o!==t)}function et(t,e){return t.x-e.x}function it(t,e){var i=function(t,e){var i,r=e,n=t.x,s=t.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o&&(o=a,i=r.x<r.next.x?r:r.next,a===n))return i}r=r.next}while(r!==e);if(!i)return null;var h,u=i,l=i.x,c=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=l&&n!==r.x&&ot(s<c?n:o,s,l,c,s<c?o:n,s,r.x,r.y)&&(h=Math.abs(s-r.y)/(n-r.x),dt(r,t)&&(h<f||h===f&&(r.x>i.x||r.x===i.x&&rt(i,r)))&&(i=r,f=h)),r=r.next}while(r!==u);return i}(t,e);if(!i)return e;var r=pt(i,t);return q(r,r.next),q(i,i.next)}function rt(t,e){return ht(t.prev,t,e.prev)<0&&ht(e.next,t,t.next)<0}function nt(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function st(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ot(t,e,i,r,n,s,o,a){return(n-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(n-o)*(r-a)}function at(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&lt(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(dt(t,e)&&dt(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(ht(t.prev,t,e.prev)||ht(t,e.prev,e))||ut(t,e)&&ht(t.prev,t,t.next)>0&&ht(e.prev,e,e.next)>0)}function ht(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ut(t,e){return t.x===e.x&&t.y===e.y}function lt(t,e,i,r){var n=ft(ht(t,e,i)),s=ft(ht(t,e,r)),o=ft(ht(i,r,t)),a=ft(ht(i,r,e));return n!==s&&o!==a||(!(0!==n||!ct(t,i,e))||(!(0!==s||!ct(t,r,e))||(!(0!==o||!ct(i,t,r))||!(0!==a||!ct(i,e,r)))))}function ct(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function ft(t){return t>0?1:t<0?-1:0}function dt(t,e){return ht(t.prev,t,t.next)<0?ht(t,e,t.next)>=0&&ht(t,t.prev,e)>=0:ht(t,e,t.prev)<0||ht(t,t.next,e)<0}function pt(t,e){var i=new gt(t.i,t.x,t.y),r=new gt(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function _t(t,e,i,r){var n=new gt(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function mt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function gt(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function vt(t,e,i,r){for(var n=0,s=e,o=i-r;s<i;s+=r)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}Y.exports=z,Y.exports.default=z,z.deviation=function(t,e,i,r){var n=e&&e.length,s=n?e[0]*i:t.length,o=Math.abs(vt(t,0,s,i));if(n)for(var a=0,h=e.length;a<h;a++){var u=e[a]*i,l=a<h-1?e[a+1]*i:t.length;o-=Math.abs(vt(t,u,l,i))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*i,d=r[a+1]*i,p=r[a+2]*i;c+=Math.abs((t[f]-t[p])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[p+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},z.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,n=0;n<t.length;n++){for(var s=0;s<t[n].length;s++)for(var o=0;o<e;o++)i.vertices.push(t[n][s][o]);n>0&&(r+=t[n-1].length,i.holes.push(r))}return i};var yt=V(Y.exports),bt=2147483647,xt=/[^\x20-\x7E]/,Tt=/[\x2E\u3002\uFF0E\uFF61]/g,At={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Et=Math.floor,wt=String.fromCharCode;function St(t){throw new RangeError(At[t])}function Pt(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function Mt(t,e,i){var r=0;for(t=i?Et(t/700):t>>1,t+=Et(t/e);t>455;r+=36)t=Et(t/35);return Et(r+36*t/(t+38))}function It(t){return function(t,e){var i=t.split("@"),r="";i.length>1&&(r=i[0]+"@",t=i[1]);var n=function(t,e){for(var i=t.length,r=[];i--;)r[i]=e(t[i]);return r}((t=t.replace(Tt,".")).split("."),e).join(".");return r+n}(t,function(t){return xt.test(t)?"xn--"+function(t){var e,i,r,n,s,o,a,h,u,l,c,f,d,p,_,m=[];for(t=function(t){for(var e,i,r=[],n=0,s=t.length;n<s;)(e=t.charCodeAt(n++))>=55296&&e<=56319&&n<s?56320==(64512&(i=t.charCodeAt(n++)))?r.push(((1023&e)<<10)+(1023&i)+65536):(r.push(e),n--):r.push(e);return r}(t),f=t.length,e=128,i=0,s=72,o=0;o<f;++o)(c=t[o])<128&&m.push(wt(c));for(r=n=m.length,n&&m.push("-");r<f;){for(a=bt,o=0;o<f;++o)(c=t[o])>=e&&c<a&&(a=c);for(a-e>Et((bt-i)/(d=r+1))&&St("overflow"),i+=(a-e)*d,e=a,o=0;o<f;++o)if((c=t[o])<e&&++i>bt&&St("overflow"),c==e){for(h=i,u=36;!(h<(l=u<=s?1:u>=s+26?26:u-s));u+=36)_=h-l,p=36-l,m.push(wt(Pt(l+_%p,0))),h=Et(_/p);m.push(wt(Pt(h,0))),s=Mt(i,d,r==n),i=0,++r}++i,++e}return m.join("")}(t):t})}function Ct(t){return null===t}function Rt(t){return"string"==typeof t}function Ot(t){return"object"==typeof t&&null!==t}function $t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Dt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function Lt(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}}function Ft(t,e){if(t.map)return t.map(e);for(var i=[],r=0;r<t.length;r++)i.push(e(t[r],r));return i}var kt=Object.keys||function(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.push(i);return e};function Bt(t,e,i,r){e=e||"&",i=i||"=";var n={};if("string"!=typeof t||0===t.length)return n;var s=/\+/g;t=t.split(e);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var a=t.length;o>0&&a>o&&(a=o);for(var h=0;h<a;++h){var u,l,c,f,d=t[h].replace(s,"%20"),p=d.indexOf(i);p>=0?(u=d.substr(0,p),l=d.substr(p+1)):(u=d,l=""),c=decodeURIComponent(u),f=decodeURIComponent(l),$t(n,c)?Dt(n[c])?n[c].push(f):n[c]=[n[c],f]:n[c]=f}return n}function Nt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Ut=/^([a-z0-9.+-]+:)/i,Gt=/:[0-9]*$/,Xt=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Vt=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Ht=["'"].concat(Vt),jt=["%","/","?",";","#"].concat(Ht),Yt=["/","?","#"],zt=/^[+a-z0-9A-Z_-]{0,63}$/,Wt=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,qt={javascript:!0,"javascript:":!0},Zt={javascript:!0,"javascript:":!0},Qt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Jt(t,e,i){if(t&&Ot(t)&&t instanceof Nt)return t;var r=new Nt;return r.parse(t,e,i),r}function Kt(t,e,i,r){if(!Rt(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),s=-1!==n&&n<e.indexOf("#")?"?":"#",o=e.split(s);o[0]=o[0].replace(/\\/g,"/");var a=e=o.join(s);if(a=a.trim(),!r&&1===e.split("#").length){var h=Xt.exec(a);if(h)return t.path=a,t.href=a,t.pathname=h[1],h[2]?(t.search=h[2],t.query=i?Bt(t.search.substr(1)):t.search.substr(1)):i&&(t.search="",t.query={}),t}var u,l,c,f,d=Ut.exec(a);if(d){var p=(d=d[0]).toLowerCase();t.protocol=p,a=a.substr(d.length)}if(r||d||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var _="//"===a.substr(0,2);!_||d&&Zt[d]||(a=a.substr(2),t.slashes=!0)}if(!Zt[d]&&(_||d&&!Qt[d])){var m,g,v=-1;for(u=0;u<Yt.length;u++)-1!==(l=a.indexOf(Yt[u]))&&(-1===v||l<v)&&(v=l);for(-1!==(g=-1===v?a.lastIndexOf("@"):a.lastIndexOf("@",v))&&(m=a.slice(0,g),a=a.slice(g+1),t.auth=decodeURIComponent(m)),v=-1,u=0;u<jt.length;u++)-1!==(l=a.indexOf(jt[u]))&&(-1===v||l<v)&&(v=l);-1===v&&(v=a.length),t.host=a.slice(0,v),a=a.slice(v),ee(t),t.hostname=t.hostname||"";var y="["===t.hostname[0]&&"]"===t.hostname[t.hostname.length-1];if(!y){var b=t.hostname.split(/\./);for(u=0,c=b.length;u<c;u++){var x=b[u];if(x&&!x.match(zt)){for(var T="",A=0,E=x.length;A<E;A++)x.charCodeAt(A)>127?T+="x":T+=x[A];if(!T.match(zt)){var w=b.slice(0,u),S=b.slice(u+1),P=x.match(Wt);P&&(w.push(P[1]),S.unshift(P[2])),S.length&&(a="/"+S.join(".")+a),t.hostname=w.join(".");break}}}}t.hostname.length>255?t.hostname="":t.hostname=t.hostname.toLowerCase(),y||(t.hostname=It(t.hostname)),f=t.port?":"+t.port:"";var M=t.hostname||"";t.host=M+f,t.href+=t.host,y&&(t.hostname=t.hostname.substr(1,t.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!qt[p])for(u=0,c=Ht.length;u<c;u++){var I=Ht[u];if(-1!==a.indexOf(I)){var C=encodeURIComponent(I);C===I&&(C=escape(I)),a=a.split(I).join(C)}}var R=a.indexOf("#");-1!==R&&(t.hash=a.substr(R),a=a.slice(0,R));var O=a.indexOf("?");if(-1!==O?(t.search=a.substr(O),t.query=a.substr(O+1),i&&(t.query=Bt(t.query)),a=a.slice(0,O)):i&&(t.search="",t.query={}),a&&(t.pathname=a),Qt[p]&&t.hostname&&!t.pathname&&(t.pathname="/"),t.pathname||t.search){f=t.pathname||"";var $=t.search||"";t.path=f+$}return t.href=te(t),t}function te(t){var e=t.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var i,r,n,s,o=t.protocol||"",a=t.pathname||"",h=t.hash||"",u=!1,l="";t.host?u=e+t.host:t.hostname&&(u=e+(-1===t.hostname.indexOf(":")?t.hostname:"["+this.hostname+"]"),t.port&&(u+=":"+t.port)),t.query&&Ot(t.query)&&Object.keys(t.query).length&&(i=t.query,r=r||"&",n=n||"=",null===i&&(i=void 0),l="object"==typeof i?Ft(kt(i),function(t){var e=encodeURIComponent(Lt(t))+n;return Dt(i[t])?Ft(i[t],function(t){return e+encodeURIComponent(Lt(t))}).join(r):e+encodeURIComponent(Lt(i[t]))}).join(r):s?encodeURIComponent(Lt(s))+n+encodeURIComponent(Lt(i)):"");var c=t.search||l&&"?"+l||"";return o&&":"!==o.substr(-1)&&(o+=":"),t.slashes||(!o||Qt[o])&&!1!==u?(u="//"+(u||""),a&&"/"!==a.charAt(0)&&(a="/"+a)):u||(u=""),h&&"#"!==h.charAt(0)&&(h="#"+h),c&&"?"!==c.charAt(0)&&(c="?"+c),o+u+(a=a.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(c=c.replace("#","%23"))+h}function ee(t){var e=t.host,i=Gt.exec(e);i&&(":"!==(i=i[0])&&(t.port=i.substr(1)),e=e.substr(0,e.length-i.length)),e&&(t.hostname=e)}
/*!
   * @pixi/utils - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/utils is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */Nt.prototype.parse=function(t,e,i){return Kt(this,t,e,i)},Nt.prototype.format=function(){return te(this)},Nt.prototype.resolve=function(t){return this.resolveObject(Jt(t,!1,!0)).format()},Nt.prototype.resolveObject=function(t){if(Rt(t)){var e=new Nt;e.parse(t,!1,!0),t=e}for(var i,r=new Nt,n=Object.keys(this),s=0;s<n.length;s++){var o=n[s];r[o]=this[o]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),h=0;h<a.length;h++){var u=a[h];"protocol"!==u&&(r[u]=t[u])}return Qt[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!Qt[t.protocol]){for(var l=Object.keys(t),c=0;c<l.length;c++){var f=l[c];r[f]=t[f]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||Zt[t.protocol])r.pathname=t.pathname;else{for(i=(t.pathname||"").split("/");i.length&&!(t.host=i.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==i[0]&&i.unshift(""),i.length<2&&i.unshift(""),r.pathname=i.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var d=r.pathname||"",p=r.search||"";r.path=d+p}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var _,m=r.pathname&&"/"===r.pathname.charAt(0),g=t.host||t.pathname&&"/"===t.pathname.charAt(0),v=g||m||r.host&&t.pathname,y=v,b=r.pathname&&r.pathname.split("/")||[],x=r.protocol&&!Qt[r.protocol];if(i=t.pathname&&t.pathname.split("/")||[],x&&(r.hostname="",r.port=null,r.host&&(""===b[0]?b[0]=r.host:b.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===i[0]?i[0]=t.host:i.unshift(t.host)),t.host=null),v=v&&(""===i[0]||""===b[0])),g)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,b=i;else if(i.length)b||(b=[]),b.pop(),b=b.concat(i),r.search=t.search,r.query=t.query;else if(null!=t.search)return x&&(r.hostname=r.host=b.shift(),(_=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=_.shift(),r.host=r.hostname=_.shift())),r.search=t.search,r.query=t.query,Ct(r.pathname)&&Ct(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!b.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=b.slice(-1)[0],A=(r.host||t.host||b.length>1)&&("."===T||".."===T)||""===T,E=0,w=b.length;w>=0;w--)"."===(T=b[w])?b.splice(w,1):".."===T?(b.splice(w,1),E++):E&&(b.splice(w,1),E--);if(!v&&!y)for(;E--;E)b.unshift("..");!v||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),A&&"/"!==b.join("/").substr(-1)&&b.push("");var S=""===b[0]||b[0]&&"/"===b[0].charAt(0);return x&&(r.hostname=r.host=S?"":b.length?b.shift():"",(_=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=_.shift(),r.host=r.hostname=_.shift())),(v=v||r.host&&b.length)&&!S&&b.unshift(""),b.length?r.pathname=b.join("/"):(r.pathname=null,r.path=null),Ct(r.pathname)&&Ct(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},Nt.prototype.parseHost=function(){return ee(this)};var ie={parse:Jt,format:function(t){return Rt(t)&&(t=Kt({},t)),te(t)},resolve:function(t,e){return Jt(t,!1,!0).resolve(e)}};X.RETINA_PREFIX=/@([0-9\.]+)x/,X.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var re,ne=!1,se="6.5.10";var oe={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function ae(t,e){return void 0===e&&(e=[]),e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function he(t){var e=t.toString(16);return"#"+(e="000000".substring(0,6-e.length)+e)}function ue(t){return"string"==typeof t&&"#"===(t=oe[t.toLowerCase()]||t)[0]&&(t=t.slice(1)),parseInt(t,16)}var le=function(){for(var t=[],e=[],i=0;i<32;i++)t[i]=i,e[i]=i;t[o.NORMAL_NPM]=o.NORMAL,t[o.ADD_NPM]=o.ADD,t[o.SCREEN_NPM]=o.SCREEN,e[o.NORMAL]=o.NORMAL_NPM,e[o.ADD]=o.ADD_NPM,e[o.SCREEN]=o.SCREEN_NPM;var r=[];return r.push(e),r.push(t),r}();function ce(t,e){return le[e?1:0][t]}function fe(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var i=t>>16&255,r=t>>8&255,n=255&t;return(255*e<<24)+((i=i*e+.5|0)<<16)+((r=r*e+.5|0)<<8)+(n=n*e+.5|0)}function de(t,e,i,r){return(i=i||new Float32Array(4))[0]=(t>>16&255)/255,i[1]=(t>>8&255)/255,i[2]=(255&t)/255,(r||void 0===r)&&(i[0]*=e,i[1]*=e,i[2]*=e),i[3]=e,i}function pe(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}function _e(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function me(t){return!(t&t-1||!t)}function ge(t){var e=(t>65535?1:0)<<4,i=((t>>>=e)>255?1:0)<<3;return e|=i,e|=i=((t>>>=i)>15?1:0)<<2,(e|=i=((t>>>=i)>3?1:0)<<1)|(t>>>=i)>>1}function ve(t,e,i){var r,n=t.length;if(!(e>=n||0===i)){var s=n-(i=e+i>n?n-e:i);for(r=e;r<s;++r)t[r]=t[r+i];t.length=s}}function ye(t){return 0===t?0:t<0?-1:1}var be=0;function xe(){return++be}var Te={};function Ae(t,e,i){if(void 0===i&&(i=3),!Te[e]){var r=(new Error).stack;void 0===r?console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t):(r=r.split("\n").splice(i).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+"\nDeprecated since v"+t),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+"\nDeprecated since v"+t),console.warn(r))),Te[e]=!0}}var Ee,we={},Se=Object.create(null),Pe=Object.create(null),Me=function(){function t(t,e,i){this.canvas=X.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=i||X.RESOLUTION,this.resize(t,e)}return t.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},t.prototype.resize=function(t,e){this.canvas.width=Math.round(t*this.resolution),this.canvas.height=Math.round(e*this.resolution)},t.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(t.prototype,"width",{get:function(){return this.canvas.width},set:function(t){this.canvas.width=Math.round(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=Math.round(t)},enumerable:!1,configurable:!0}),t}();function Ie(t,e){if(void 0===e&&(e=globalThis.location),0===t.indexOf("data:"))return"";e=e||globalThis.location,Ee||(Ee=document.createElement("a")),Ee.href=t;var i=ie.parse(Ee.href),r=!i.port&&""===e.port||i.port===e.port;return i.hostname===e.hostname&&r&&i.protocol===e.protocol?"":"anonymous"}function Ce(t,e){var i=X.RETINA_PREFIX.exec(t);return i?parseFloat(i[1]):void 0!==e?e:1}
/*!
   * @pixi/math - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/math is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */var Re,Oe=2*Math.PI,$e=180/Math.PI,De=Math.PI/180;!function(t){t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC"}(Re||(Re={}));var Le=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},t.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},t}(),Fe=[new Le,new Le,new Le,new Le],ke=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=Re.RECT}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t,"EMPTY",{get:function(){return new t(0,0,0,0)},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},t.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},t.prototype.contains=function(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)},t.prototype.intersects=function(t,e){if(!e){var i=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=i)return!1;var r=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>r}var n=this.left,s=this.right,o=this.top,a=this.bottom;if(s<=n||a<=o)return!1;var h=Fe[0].set(t.left,t.top),u=Fe[1].set(t.left,t.bottom),l=Fe[2].set(t.right,t.top),c=Fe[3].set(t.right,t.bottom);if(l.x<=h.x||u.y<=h.y)return!1;var f=Math.sign(e.a*e.d-e.b*e.c);if(0===f)return!1;if(e.apply(h,h),e.apply(u,u),e.apply(l,l),e.apply(c,c),Math.max(h.x,u.x,l.x,c.x)<=n||Math.min(h.x,u.x,l.x,c.x)>=s||Math.max(h.y,u.y,l.y,c.y)<=o||Math.min(h.y,u.y,l.y,c.y)>=a)return!1;var d=f*(u.y-h.y),p=f*(h.x-u.x),_=d*n+p*o,m=d*s+p*o,g=d*n+p*a,v=d*s+p*a;if(Math.max(_,m,g,v)<=d*h.x+p*h.y||Math.min(_,m,g,v)>=d*c.x+p*c.y)return!1;var y=f*(h.y-l.y),b=f*(l.x-h.x),x=y*n+b*o,T=y*s+b*o,A=y*n+b*a,E=y*s+b*a;return!(Math.max(x,T,A,E)<=y*h.x+b*h.y||Math.min(x,T,A,E)>=y*c.x+b*c.y)},t.prototype.pad=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this},t.prototype.fit=function(t){var e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this},t.prototype.ceil=function(t,e){void 0===t&&(t=1),void 0===e&&(e=.001);var i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this},t.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this},t.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},t}(),Be=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.radius=i,this.type=Re.CIRC}return t.prototype.clone=function(){return new t(this.x,this.y,this.radius)},t.prototype.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return(r*=r)+(n*=n)<=i},t.prototype.getBounds=function(){return new ke(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},t.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},t}(),Ne=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.width=i,this.height=r,this.type=Re.ELIP}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=(t-this.x)/this.width,r=(e-this.y)/this.height;return(i*=i)+(r*=r)<=1},t.prototype.getBounds=function(){return new ke(this.x-this.width,this.y-this.height,this.width,this.height)},t.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},t}(),Ue=function(){function t(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];var r=Array.isArray(e[0])?e[0]:e;if("number"!=typeof r[0]){for(var n=[],s=0,o=r.length;s<o;s++)n.push(r[s].x,r[s].y);r=n}this.points=r,this.type=Re.POLY,this.closeStroke=!0}return t.prototype.clone=function(){var e=new t(this.points.slice());return e.closeStroke=this.closeStroke,e},t.prototype.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,s=r-1;n<r;s=n++){var o=this.points[2*n],a=this.points[2*n+1],h=this.points[2*s],u=this.points[2*s+1];a>e!=u>e&&t<(e-a)/(u-a)*(h-o)+o&&(i=!i)}return i},t.prototype.toString=function(){return"[@pixi/math:PolygoncloseStroke="+this.closeStroke+"points="+this.points.reduce(function(t,e){return t+", "+e},"")+"]"},t}(),Ge=function(){function t(t,e,i,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=20),this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n,this.type=Re.RREC}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height,this.radius)},t.prototype.contains=function(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){var i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;var r=t-(this.x+i),n=e-(this.y+i),s=i*i;if(r*r+n*n<=s)return!0;if((r=t-(this.x+this.width-i))*r+n*n<=s)return!0;if(r*r+(n=e-(this.y+this.height-i))*n<=s)return!0;if((r=t-(this.x+i))*r+n*n<=s)return!0}return!1},t.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+"width="+this.width+" height="+this.height+" radius="+this.radius+"]"},t}(),Xe=function(){function t(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0),this._x=i,this._y=r,this.cb=t,this.scope=e}return t.prototype.clone=function(e,i){return void 0===e&&(e=this.cb),void 0===i&&(i=this.scope),new t(e,i,this._x,this._y)},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._x===t&&this._y===e||(this._x=t,this._y=e,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},t.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),Ve=function(){function t(t,e,i,r,n,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),void 0===n&&(n=0),void 0===s&&(s=0),this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=s}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,e,i,r,n,s){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=s,this},t.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},t.prototype.apply=function(t,e){e=e||new Le;var i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e},t.prototype.applyInverse=function(t,e){e=e||new Le;var i=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*i*r+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,e},t.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},t.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,s=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=s*e-this.ty*i,this.ty=s*i+this.ty*e,this},t.prototype.append=function(t){var e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},t.prototype.setTransform=function(t,e,i,r,n,s,o,a,h){return this.a=Math.cos(o+h)*n,this.b=Math.sin(o+h)*n,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this},t.prototype.prepend=function(t){var e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*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},t.prototype.decompose=function(t){var e=this.a,i=this.b,r=this.c,n=this.d,s=t.pivot,o=-Math.atan2(-r,n),a=Math.atan2(i,e),h=Math.abs(o+a);return h<1e-5||Math.abs(Oe-h)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=a),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(s.x*e+s.y*r),t.position.y=this.ty+(s.x*i+s.y*n),t},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,s=t*r-e*i;return this.a=r/s,this.b=-e/s,this.c=-i/s,this.d=t/s,this.tx=(i*this.ty-r*n)/s,this.ty=-(t*this.ty-e*n)/s,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},t.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),He=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],je=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ye=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ze=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],We=[],qe=[],Ze=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];We.push(e);for(var i=0;i<16;i++)for(var r=Ze(He[t]*He[i]+Ye[t]*je[i]),n=Ze(je[t]*He[i]+ze[t]*je[i]),s=Ze(He[t]*Ye[i]+Ye[t]*ze[i]),o=Ze(je[t]*Ye[i]+ze[t]*ze[i]),a=0;a<16;a++)if(He[a]===r&&je[a]===n&&Ye[a]===s&&ze[a]===o){e.push(a);break}}for(t=0;t<16;t++){var h=new Ve;h.set(He[t],je[t],Ye[t],ze[t],0,0),qe.push(h)}}();var Qe,Je={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return He[t]},uY:function(t){return je[t]},vX:function(t){return Ye[t]},vY:function(t){return ze[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return We[t][e]},sub:function(t,e){return We[t][Je.inv(e)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,e){return 2*Math.abs(t)<=Math.abs(e)?e>=0?Je.S:Je.N:2*Math.abs(e)<=Math.abs(t)?t>0?Je.E:Je.W:e>0?t>0?Je.SE:Je.SW:t>0?Je.NE:Je.NW},matrixAppendRotationInv:function(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=qe[Je.inv(e)];n.tx=i,n.ty=r,t.append(n)}},Ke=function(){function t(){this.worldTransform=new Ve,this.localTransform=new Ve,this.position=new Xe(this.onChange,this,0,0),this.scale=new Xe(this.onChange,this,1,1),this.pivot=new Xe(this.onChange,this,0,0),this.skew=new Xe(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.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+") ]"},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var i=t.worldTransform,r=this.worldTransform;r.a=e.a*i.a+e.b*i.c,r.b=e.a*i.b+e.b*i.d,r.c=e.c*i.a+e.d*i.c,r.d=e.c*i.b+e.d*i.d,r.tx=e.tx*i.a+e.ty*i.c+i.tx,r.ty=e.tx*i.b+e.ty*i.d+i.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}(),ti=function(){return ti=Object.assign||function(t){for(var e,i=arguments,r=1,n=arguments.length;r<n;r++)for(var s in e=i[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},ti.apply(this,arguments)};!function(t){t.Application="application",t.RendererPlugin="renderer-webgl-plugin",t.CanvasRendererPlugin="renderer-canvas-plugin",t.Loader="loader",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser"}(Qe||(Qe={}));var ei,ii=function(t){if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");var e="object"!=typeof t.extension?{type:t.extension}:t.extension;t=ti(ti({},e),{ref:t})}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t=ti({},t)).type&&(t.type=[t.type]),t},ri={_addHandlers:null,_removeHandlers:null,_queue:{},remove:function(){for(var t=arguments,e=this,i=[],r=0;r<arguments.length;r++)i[r]=t[r];return i.map(ii).forEach(function(t){t.type.forEach(function(i){var r,n;return null===(n=(r=e._removeHandlers)[i])||void 0===n?void 0:n.call(r,t)})}),this},add:function(){for(var t=arguments,e=this,i=[],r=0;r<arguments.length;r++)i[r]=t[r];return i.map(ii).forEach(function(t){t.type.forEach(function(i){var r=e._addHandlers,n=e._queue;r[i]?r[i](t):(n[i]=n[i]||[],n[i].push(t))})}),this},handle:function(t,e,i){var r=this._addHandlers=this._addHandlers||{},n=this._removeHandlers=this._removeHandlers||{};if(r[t]||n[t])throw new Error("Extension type "+t+" already has a handler");r[t]=e,n[t]=i;var s=this._queue;return s[t]&&(s[t].forEach(function(t){return e(t)}),delete s[t]),this},handleByMap:function(t,e){return this.handle(t,function(t){e[t.name]=t.ref},function(t){delete e[t.name]})},handleByList:function(t,e){return this.handle(t,function(i){var r,n;e.includes(i.ref)||(e.push(i.ref),t===Qe.Loader&&(null===(n=(r=i.ref).add)||void 0===n||n.call(r)))},function(t){var i=e.indexOf(t.ref);-1!==i&&e.splice(i,1)})}},ni=function(){function t(t){this.items=[],this._name=t,this._aliasCount=0}return t.prototype.emit=function(t,e,i,r,n,s,o,a){if(arguments.length>8)throw new Error("max arguments reached");var h=this.name,u=this.items;this._aliasCount++;for(var l=0,c=u.length;l<c;l++)u[l][h](t,e,i,r,n,s,o,a);return u===this.items&&this._aliasCount--,this},t.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(ni.prototype,{dispatch:{value:ni.prototype.emit},run:{value:ni.prototype.emit}}),
/*!
   * @pixi/ticker - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/ticker is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
X.TARGET_FPMS=.06,function(t){t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY"}(ei||(ei={}));var si=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=0),void 0===r&&(r=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=r}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),oi=function(){function t(){var t=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new si(null,null,1/0),this.deltaMS=1/X.TARGET_FPMS,this.elapsedMS=1/X.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return t.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},t.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},t.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},t.prototype.add=function(t,e,i){return void 0===i&&(i=ei.NORMAL),this._addListener(new si(t,e,i))},t.prototype.addOnce=function(t,e,i){return void 0===i&&(i=ei.NORMAL),this._addListener(new si(t,e,i,!0))},t.prototype._addListener=function(t){var e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this},t.prototype.remove=function(t,e){for(var i=this._head.next;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(t.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},t.prototype.update=function(t){var e;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((e=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var i=t-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=t-i%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*X.TARGET_FPMS;for(var r=this._head,n=r.next;n;)n=n.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t},Object.defineProperty(t.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(t){var e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,X.TARGET_FPMS);this._maxElapsedMS=1/i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(t){if(0===t)this._minElapsedMS=0;else{var e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"shared",{get:function(){if(!t._shared){var e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared},enumerable:!1,configurable:!0}),Object.defineProperty(t,"system",{get:function(){if(!t._system){var e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system},enumerable:!1,configurable:!0}),t}(),ai=function(){function t(){}return t.init=function(t){var e=this;t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set:function(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,ei.LOW)},get:function(){return this._ticker}}),this.stop=function(){e._ticker.stop()},this.start=function(){e._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?oi.shared:new oi,t.autoStart&&this.start()},t.destroy=function(){if(this._ticker){var t=this._ticker;this.ticker=null,t.destroy()}},t.extension=Qe.Application,t}();
/*!
   * @pixi/core - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/core is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
X.PREFER_ENV=G.any?r.WEBGL:r.WEBGL2,X.STRICT_TEXTURE_CACHE=!1;var hi=[];function ui(t,e){if(!t)return null;var i="";if("string"==typeof t){var r=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);r&&(i=r[1].toLowerCase())}for(var n=hi.length-1;n>=0;--n){var s=hi[n];if(s.test&&s.test(t,i))return new s(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */var li=function(t,e){return li=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},li(t,e)};function ci(t,e){function i(){this.constructor=t}li(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var fi=function(){return fi=Object.assign||function(t){for(var e,i=arguments,r=1,n=arguments.length;r<n;r++)for(var s in e=i[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},fi.apply(this,arguments)};var di=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ni("setRealSize"),this.onUpdate=new ni("update"),this.onError=new ni("onError")}return t.prototype.bind=function(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},t.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},t.prototype.resize=function(t,e){t===this._width&&e===this._height||(this._width=t,this._height=e,this.onResize.emit(t,e))},Object.defineProperty(t.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),t.prototype.update=function(){this.destroyed||this.onUpdate.emit()},t.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),t.prototype.style=function(t,e,i){return!1},t.prototype.dispose=function(){},t.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},t.test=function(t,e){return!1},t}(),pi=function(t){function e(e,i){var r=this,n=i||{},s=n.width,o=n.height;if(!s||!o)throw new Error("BufferResource width or height invalid");return(r=t.call(this,s,o)||this).data=e,r}return ci(e,t),e.prototype.upload=function(t,e,i){var r=t.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===_.UNPACK);var n=e.realWidth,s=e.realHeight;return i.width===n&&i.height===s?r.texSubImage2D(e.target,0,0,0,n,s,e.format,i.type,this.data):(i.width=n,i.height=s,r.texImage2D(e.target,0,i.internalFormat,n,s,0,e.format,i.type,this.data)),!0},e.prototype.dispose=function(){this.data=null},e.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},e}(di),_i={scaleMode:f.NEAREST,format:h.RGBA,alphaMode:_.NPM},mi=function(t){function e(e,i){void 0===e&&(e=null),void 0===i&&(i=null);var r=t.call(this)||this,n=(i=i||{}).alphaMode,s=i.mipmap,o=i.anisotropicLevel,a=i.scaleMode,c=i.width,f=i.height,d=i.wrapMode,p=i.format,m=i.type,g=i.target,v=i.resolution,y=i.resourceOptions;return!e||e instanceof di||((e=ui(e,y)).internal=!0),r.resolution=v||X.RESOLUTION,r.width=Math.round((c||0)*r.resolution)/r.resolution,r.height=Math.round((f||0)*r.resolution)/r.resolution,r._mipmap=void 0!==s?s:X.MIPMAP_TEXTURES,r.anisotropicLevel=void 0!==o?o:X.ANISOTROPIC_LEVEL,r._wrapMode=d||X.WRAP_MODE,r._scaleMode=void 0!==a?a:X.SCALE_MODE,r.format=p||h.RGBA,r.type=m||l.UNSIGNED_BYTE,r.target=g||u.TEXTURE_2D,r.alphaMode=void 0!==n?n:_.UNPACK,r.uid=xe(),r.touched=0,r.isPowerOfTwo=!1,r._refreshPOT(),r._glTextures={},r.dirtyId=0,r.dirtyStyleId=0,r.cacheId=null,r.valid=c>0&&f>0,r.textureCacheIds=[],r.destroyed=!1,r.resource=null,r._batchEnabled=0,r._batchLocation=0,r.parentTextureArray=null,r.setResource(e),r}return ci(e,t),Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(t,e){var i;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this},e.prototype.setSize=function(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)},e.prototype.setRealSize=function(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=me(this.realWidth)&&me(this.realHeight)},e.prototype.setResolution=function(t){var e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this},e.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},e.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},e.prototype.onError=function(t){this.emit("error",this,t)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Pe[this.cacheId],delete Se[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(t,i,r){void 0===r&&(r=X.STRICT_TEXTURE_CACHE);var n="string"==typeof t,s=null;if(n)s=t;else{if(!t._pixiId){var o=i&&i.pixiIdPrefix||"pixiid";t._pixiId=o+"_"+xe()}s=t._pixiId}var a=Pe[s];if(n&&r&&!a)throw new Error('The cacheId "'+s+'" does not exist in BaseTextureCache.');return a||((a=new e(t,i)).cacheId=s,e.addToCache(a,s)),a},e.fromBuffer=function(t,i,r,n){t=t||new Float32Array(i*r*4);var s=new pi(t,{width:i,height:r}),o=t instanceof Float32Array?l.FLOAT:l.UNSIGNED_BYTE;return new e(s,Object.assign({},_i,n||{width:i,height:r,type:o}))},e.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),Pe[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),Pe[e]=t)},e.removeFromCache=function(t){if("string"==typeof t){var e=Pe[t];if(e){var i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Pe[t],e}}else if(t&&t.textureCacheIds){for(var r=0;r<t.textureCacheIds.length;++r)delete Pe[t.textureCacheIds[r]];return t.textureCacheIds.length=0,t}return null},e._globalBatch=0,e}(j),gi=function(t){function e(e,i){var r=this,n=i||{},s=n.width,o=n.height;(r=t.call(this,s,o)||this).items=[],r.itemDirtyIds=[];for(var a=0;a<e;a++){var h=new mi;r.items.push(h),r.itemDirtyIds.push(-2)}return r.length=e,r._load=null,r.baseTexture=null,r}return ci(e,t),e.prototype.initFromArray=function(t,e){for(var i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof di?this.addResourceAt(t[i],i):this.addResourceAt(ui(t[i],e),i))},e.prototype.dispose=function(){for(var t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},e.prototype.addResourceAt=function(t,e){if(!this.items[e])throw new Error("Index "+e+" is out of bounds");return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this},e.prototype.bind=function(e){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");t.prototype.bind.call(this,e);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=e,this.items[i].on("update",e.update,e)},e.prototype.unbind=function(e){t.prototype.unbind.call(this,e);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",e.update,e)},e.prototype.load=function(){var t=this;if(this._load)return this._load;var e=this.items.map(function(t){return t.resource}).filter(function(t){return t}).map(function(t){return t.load()});return this._load=Promise.all(e).then(function(){var e=t.items[0],i=e.realWidth,r=e.realHeight;return t.resize(i,r),Promise.resolve(t)}),this._load},e}(di),vi=function(t){function e(e,i){var r,n,s=this,o=i||{},a=o.width,h=o.height;return Array.isArray(e)?(r=e,n=e.length):n=e,s=t.call(this,n,{width:a,height:h})||this,r&&s.initFromArray(r,i),s}return ci(e,t),e.prototype.addBaseTextureAt=function(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this},e.prototype.bind=function(e){t.prototype.bind.call(this,e),e.target=u.TEXTURE_2D_ARRAY},e.prototype.upload=function(t,e,i){var r=this,n=r.length,s=r.itemDirtyIds,o=r.items,a=t.gl;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,n,0,e.format,i.type,null);for(var h=0;h<n;h++){var u=o[h];s[h]<u.dirtyId&&(s[h]=u.dirtyId,u.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,u.resource.width,u.resource.height,1,e.format,i.type,u.resource.source))}return!0},e}(gi),yi=function(t){function e(e){var i=this,r=e,n=r.naturalWidth||r.videoWidth||r.width,s=r.naturalHeight||r.videoHeight||r.height;return(i=t.call(this,n,s)||this).source=e,i.noSubImage=!1,i}return ci(e,t),e.crossOrigin=function(t,e,i){void 0===i&&0!==e.indexOf("data:")?t.crossOrigin=Ie(e):!1!==i&&(t.crossOrigin="string"==typeof i?i:"anonymous")},e.prototype.upload=function(t,e,i,r){var n=t.gl,s=e.realWidth,o=e.realHeight;if((r=r||this.source)instanceof HTMLImageElement){if(!r.complete||0===r.naturalWidth)return!1}else if(r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===_.UNPACK),this.noSubImage||e.target!==n.TEXTURE_2D||i.width!==s||i.height!==o?(i.width=s,i.height=o,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,r)):n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,r),!0},e.prototype.update=function(){if(!this.destroyed){var e=this.source,i=e.naturalWidth||e.videoWidth||e.width,r=e.naturalHeight||e.videoHeight||e.height;this.resize(i,r),t.prototype.update.call(this)}},e.prototype.dispose=function(){this.source=null},e}(di),bi=function(t){function e(e){return t.call(this,e)||this}return ci(e,t),e.test=function(t){var e=globalThis.OffscreenCanvas;return!!(e&&t instanceof e)||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement},e}(yi),xi=function(t){function e(i,r){var n=this,s=r||{},o=s.width,a=s.height,h=s.autoLoad,l=s.linkBaseTexture;if(i&&i.length!==e.SIDES)throw new Error("Invalid length. Got "+i.length+", expected 6");n=t.call(this,6,{width:o,height:a})||this;for(var c=0;c<e.SIDES;c++)n.items[c].target=u.TEXTURE_CUBE_MAP_POSITIVE_X+c;return n.linkBaseTexture=!1!==l,i&&n.initFromArray(i,r),!1!==h&&n.load(),n}return ci(e,t),e.prototype.bind=function(e){t.prototype.bind.call(this,e),e.target=u.TEXTURE_CUBE_MAP},e.prototype.addBaseTextureAt=function(t,e,i){if(!this.items[e])throw new Error("Index "+e+" is out of bounds");if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=u.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this},e.prototype.upload=function(t,i,r){for(var n=this.itemDirtyIds,s=0;s<e.SIDES;s++){var o=this.items[s];(n[s]<o.dirtyId||r.dirtyId<i.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,r),n[s]=o.dirtyId):n[s]<-1&&(t.gl.texImage2D(o.target,0,r.internalFormat,i.realWidth,i.realHeight,0,i.format,r.type,null),n[s]=-1))}return!0},e.test=function(t){return Array.isArray(t)&&t.length===e.SIDES},e.SIDES=6,e}(gi),Ti=function(t){function e(e,i){var r=this;if(i=i||{},!(e instanceof HTMLImageElement)){var n=new Image;yi.crossOrigin(n,e,i.crossorigin),n.src=e,e=n}return r=t.call(this,e)||this,!e.complete&&r._width&&r._height&&(r._width=0,r._height=0),r.url=e.src,r._process=null,r.preserveBitmap=!1,r.createBitmap=(void 0!==i.createBitmap?i.createBitmap:X.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,r.alphaMode="number"==typeof i.alphaMode?i.alphaMode:null,r.bitmap=null,r._load=null,!1!==i.autoLoad&&r.load(),r}return ci(e,t),e.prototype.load=function(t){var e=this;return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise(function(t,i){var r=e.source;e.url=r.src;var n=function(){e.destroyed||(r.onload=null,r.onerror=null,e.resize(r.width,r.height),e._load=null,e.createBitmap?t(e.process()):t(e))};r.complete&&r.src?n():(r.onload=n,r.onerror=function(t){i(t),e.onError.emit(t)})})),this._load},e.prototype.process=function(){var t=this,e=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);var i=globalThis.createImageBitmap,r=!e.crossOrigin||"anonymous"===e.crossOrigin;return this._process=fetch(e.src,{mode:r?"cors":"no-cors"}).then(function(t){return t.blob()}).then(function(r){return i(r,0,0,e.width,e.height,{premultiplyAlpha:null===t.alphaMode||t.alphaMode===_.UNPACK?"premultiply":"none"})}).then(function(e){return t.destroyed?Promise.reject():(t.bitmap=e,t.update(),t._process=null,Promise.resolve(t))}),this._process},e.prototype.upload=function(e,i,r){if("number"==typeof this.alphaMode&&(i.alphaMode=this.alphaMode),!this.createBitmap)return t.prototype.upload.call(this,e,i,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(t.prototype.upload.call(this,e,i,r,this.bitmap),!this.preserveBitmap){var n=!0,s=i._glTextures;for(var o in s){var a=s[o];if(a!==r&&a.dirtyId!==i.dirtyId){n=!1;break}}n&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},e.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,t.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},e.test=function(t){return"string"==typeof t||t instanceof HTMLImageElement},e}(yi),Ai=function(t){function e(e,i){var r=this;return i=i||{},(r=t.call(this,X.ADAPTER.createCanvas())||this)._width=0,r._height=0,r.svg=e,r.scale=i.scale||1,r._overrideWidth=i.width,r._overrideHeight=i.height,r._resolve=null,r._crossorigin=i.crossorigin,r._load=null,!1!==i.autoLoad&&r.load(),r}return ci(e,t),e.prototype.load=function(){var t=this;return this._load||(this._load=new Promise(function(i){if(t._resolve=function(){t.resize(t.source.width,t.source.height),i(t)},e.SVG_XML.test(t.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");t.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t.svg)))}t._loadSvg()})),this._load},e.prototype._loadSvg=function(){var t=this,e=new Image;yi.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=function(i){t._resolve&&(e.onerror=null,t.onError.emit(i))},e.onload=function(){if(t._resolve){var i=e.width,r=e.height;if(!i||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var n=i*t.scale,s=r*t.scale;(t._overrideWidth||t._overrideHeight)&&(n=t._overrideWidth||t._overrideHeight/r*i,s=t._overrideHeight||t._overrideWidth/i*r),n=Math.round(n),s=Math.round(s);var o=t.source;o.width=n,o.height=s,o._pixiId="canvas_"+xe(),o.getContext("2d").drawImage(e,0,0,i,r,0,0,n,s),t._resolve(),t._resolve=null}}},e.getSize=function(t){var i=e.SVG_SIZE.exec(t),r={};return i&&(r[i[1]]=Math.round(parseFloat(i[3])),r[i[5]]=Math.round(parseFloat(i[7]))),r},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},e.test=function(t,i){return"svg"===i||"string"==typeof t&&t.startsWith("data:image/svg+xml")||"string"==typeof t&&e.SVG_XML.test(t)},e.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,e.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(yi),Ei=function(t){function e(i,r){var n=this;if(r=r||{},!(i instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),"string"==typeof i&&(i=[i]);var o=i[0].src||i[0];yi.crossOrigin(s,o,r.crossorigin);for(var a=0;a<i.length;++a){var h=document.createElement("source"),u=i[a],l=u.src,c=u.mime,f=(l=l||i[a]).split("?").shift().toLowerCase(),d=f.slice(f.lastIndexOf(".")+1);c=c||e.MIME_TYPES[d]||"video/"+d,h.src=l,h.type=c,s.appendChild(h)}i=s}return(n=t.call(this,i)||this).noSubImage=!0,n._autoUpdate=!0,n._isConnectedToTicker=!1,n._updateFPS=r.updateFPS||0,n._msToNextUpdate=0,n.autoPlay=!1!==r.autoPlay,n._load=null,n._resolve=null,n._onCanPlay=n._onCanPlay.bind(n),n._onError=n._onError.bind(n),!1!==r.autoLoad&&n.load(),n}return ci(e,t),e.prototype.update=function(e){if(!this.destroyed){var i=oi.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-i),(!this._updateFPS||this._msToNextUpdate<=0)&&(t.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},e.prototype.load=function(){var t=this;if(this._load)return this._load;var e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart.bind(this)),e.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise(function(i){t.valid?i(t):(t._resolve=i,e.load())}),this._load},e.prototype._onError=function(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t)},e.prototype._isSourcePlaying=function(){var t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()},e.prototype._isSourceReady=function(){return this.source.readyState>2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(oi.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(oi.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(oi.shared.remove(this.update,this),this._isConnectedToTicker=!1);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(oi.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(oi.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,i){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(i)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(yi),wi=function(t){function e(e){return t.call(this,e)||this}return ci(e,t),e.test=function(t){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap},e}(yi);hi.push(Ti,wi,bi,Ei,Ai,pi,xi,vi);var Si=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ci(e,t),e.prototype.upload=function(t,e,i){var r=t.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===_.UNPACK);var n=e.realWidth,s=e.realHeight;return i.width===n&&i.height===s?r.texSubImage2D(e.target,0,0,0,n,s,e.format,i.type,this.data):(i.width=n,i.height=s,r.texImage2D(e.target,0,i.internalFormat,n,s,0,e.format,i.type,this.data)),!0},e}(pi),Pi=function(){function t(t,e){this.width=Math.round(t||100),this.height=Math.round(e||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new ni("disposeFramebuffer"),this.multisample=T.NONE}return Object.defineProperty(t.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),t.prototype.addColorTexture=function(t,e){return void 0===t&&(t=0),this.colorTextures[t]=e||new mi(null,{scaleMode:f.NEAREST,resolution:1,mipmap:p.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},t.prototype.addDepthTexture=function(t){return this.depthTexture=t||new mi(new Si(null,{width:this.width,height:this.height}),{scaleMode:f.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:p.OFF,format:h.DEPTH_COMPONENT,type:l.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},t.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},t.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},t.prototype.resize=function(t,e){if(t=Math.round(t),e=Math.round(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var r=this.colorTextures[i],n=r.resolution;r.setSize(t/n,e/n)}if(this.depthTexture){n=this.depthTexture.resolution;this.depthTexture.setSize(t/n,e/n)}}},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},t}(),Mi=function(t){function e(e){void 0===e&&(e={});var i=this;"number"==typeof e&&(e={width:arguments[0],height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]});return e.width=e.width||100,e.height=e.height||100,e.multisample=void 0!==e.multisample?e.multisample:T.NONE,(i=t.call(this,null,e)||this).mipmap=p.OFF,i.valid=!0,i.clearColor=[0,0,0,0],i.framebuffer=new Pi(i.realWidth,i.realHeight).addColorTexture(0,i),i.framebuffer.multisample=e.multisample,i.maskStack=[],i.filterStack=[{}],i}return ci(e,t),e.prototype.resize=function(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},e.prototype.dispose=function(){this.framebuffer.dispose(),t.prototype.dispose.call(this)},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},e}(mi),Ii=function(){function t(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}return t.prototype.set=function(t,e,i){var r=e.width,n=e.height;if(i){var s=t.width/2/r,o=t.height/2/n,a=t.x/r+s,h=t.y/n+o;i=Je.add(i,Je.NW),this.x0=a+s*Je.uX(i),this.y0=h+o*Je.uY(i),i=Je.add(i,2),this.x1=a+s*Je.uX(i),this.y1=h+o*Je.uY(i),i=Je.add(i,2),this.x2=a+s*Je.uX(i),this.y2=h+o*Je.uY(i),i=Je.add(i,2),this.x3=a+s*Je.uX(i),this.y3=h+o*Je.uY(i)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3},t.prototype.toString=function(){return"[@pixi/core:TextureUvs x0="+this.x0+" y0="+this.y0+" x1="+this.x1+" y1="+this.y1+" x2="+this.x2+" y2="+this.y2+" x3="+this.x3+" y3="+this.y3+"]"},t}(),Ci=new Ii;function Ri(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}var Oi=function(t){function e(i,r,n,s,o,a){var h=t.call(this)||this;if(h.noFrame=!1,r||(h.noFrame=!0,r=new ke(0,0,1,1)),i instanceof e&&(i=i.baseTexture),h.baseTexture=i,h._frame=r,h.trim=s,h.valid=!1,h._uvs=Ci,h.uvMatrix=null,h.orig=n||r,h._rotate=Number(o||0),!0===o)h._rotate=2;else if(h._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return h.defaultAnchor=a?new Le(a.x,a.y):new Le(0,0),h._updateID=0,h.textureCacheIds=[],i.valid?h.noFrame?i.valid&&h.onBaseTextureUpdated(i):h.frame=r:i.once("loaded",h.onBaseTextureUpdated,h),h.noFrame&&i.on("update",h.onBaseTextureUpdated,h),h}return ci(e,t),e.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},e.prototype.onBaseTextureUpdated=function(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},e.prototype.destroy=function(t){if(this.baseTexture){if(t){var i=this.baseTexture.resource;i&&i.url&&Se[i.url]&&e.removeFromCache(i.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,e.removeFromCache(this),this.textureCacheIds=null},e.prototype.clone=function(){var t=this._frame.clone(),i=this._frame===this.orig?t:this.orig.clone(),r=new e(this.baseTexture,!this.noFrame&&t,i,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(r._frame=t),r},e.prototype.updateUvs=function(){this._uvs===Ci&&(this._uvs=new Ii),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},e.from=function(t,i,r){void 0===i&&(i={}),void 0===r&&(r=X.STRICT_TEXTURE_CACHE);var n="string"==typeof t,s=null;if(n)s=t;else if(t instanceof mi){if(!t.cacheId){var o=i&&i.pixiIdPrefix||"pixiid";t.cacheId=o+"-"+xe(),mi.addToCache(t,t.cacheId)}s=t.cacheId}else{if(!t._pixiId){o=i&&i.pixiIdPrefix||"pixiid";t._pixiId=o+"_"+xe()}s=t._pixiId}var a=Se[s];if(n&&r&&!a)throw new Error('The cacheId "'+s+'" does not exist in TextureCache.');return a||t instanceof mi?!a&&t instanceof mi&&(a=new e(t),e.addToCache(a,s)):(i.resolution||(i.resolution=Ce(t)),(a=new e(new mi(t,i))).baseTexture.cacheId=s,mi.addToCache(a.baseTexture,s),e.addToCache(a,s)),a},e.fromURL=function(t,i){var r=Object.assign({autoLoad:!1},null==i?void 0:i.resourceOptions),n=e.from(t,Object.assign({resourceOptions:r},i),!1),s=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):s.load().then(function(){return Promise.resolve(n)})},e.fromBuffer=function(t,i,r,n){return new e(mi.fromBuffer(t,i,r,n))},e.fromLoader=function(t,i,r,n){var s=new mi(t,Object.assign({scaleMode:X.SCALE_MODE,resolution:Ce(i)},n)),o=s.resource;o instanceof Ti&&(o.url=i);var a=new e(s);return r||(r=i),mi.addToCache(a.baseTexture,r),e.addToCache(a,r),r!==i&&(mi.addToCache(a.baseTexture,i),e.addToCache(a,i)),a.baseTexture.valid?Promise.resolve(a):new Promise(function(t){a.baseTexture.once("loaded",function(){return t(a)})})},e.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),Se[e]&&console.warn("Texture added to the cache with an id ["+e+"] that already had an entry"),Se[e]=t)},e.removeFromCache=function(t){if("string"==typeof t){var e=Se[t];if(e){var i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Se[t],e}}else if(t&&t.textureCacheIds){for(var r=0;r<t.textureCacheIds.length;++r)Se[t.textureCacheIds[r]]===t&&delete Se[t.textureCacheIds[r]];return t.textureCacheIds.length=0,t}return null},Object.defineProperty(e.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},set:function(t){this._frame=t,this.noFrame=!1;var e=t.x,i=t.y,r=t.width,n=t.height,s=e+r>this.baseTexture.width,o=i+n>this.baseTexture.height;if(s||o){var a=s&&o?"and":"or",h="X: "+e+" + "+r+" = "+(e+r)+" > "+this.baseTexture.width,u="Y: "+i+" + "+n+" = "+(i+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+a+" "+u)}this.valid=r&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new mi),Ri(e._EMPTY),Ri(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=X.ADAPTER.createCanvas(16,16),i=t.getContext("2d");t.width=16,t.height=16,i.fillStyle="white",i.fillRect(0,0,16,16),e._WHITE=new e(mi.from(t)),Ri(e._WHITE),Ri(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(j),$i=function(t){function e(e,i){var r=t.call(this,e,i)||this;return r.valid=!0,r.filterFrame=null,r.filterPoolKey=null,r.updateUvs(),r}return ci(e,t),Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e,i){void 0===i&&(i=!0);var r=this.baseTexture.resolution,n=Math.round(t*r)/r,s=Math.round(e*r)/r;this.valid=n>0&&s>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=s,i&&this.baseTexture.resize(n,s),this.updateUvs()},e.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},e.create=function(t){for(var i=arguments,r=[],n=1;n<arguments.length;n++)r[n-1]=i[n];return"number"==typeof t&&(Ae("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),t={width:t,height:r[0],scaleMode:r[1],resolution:r[2]}),new e(new Mi(t))},e}(Oi),Di=function(){function t(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return t.prototype.createTexture=function(t,e,i){void 0===i&&(i=T.NONE);var r=new Mi(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new $i(r)},t.prototype.getOptimalTexture=function(t,e,i,r){var n;void 0===i&&(i=1),void 0===r&&(r=T.NONE),t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?n=r>1?-r:-1:(n=((65535&(t=_e(t)))<<16|65535&(e=_e(e)))>>>0,r>1&&(n+=4294967296*r)),this.texturePool[n]||(this.texturePool[n]=[]);var s=this.texturePool[n].pop();return s||(s=this.createTexture(t,e,r)),s.filterPoolKey=n,s.setResolution(i),s},t.prototype.getFilterTexture=function(t,e,i){var r=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||T.NONE);return r.filterFrame=t.filterFrame,r},t.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},t.prototype.returnFilterTexture=function(t){this.returnTexture(t)},t.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var i=this.texturePool[e];if(i)for(var r=0;r<i.length;r++)i[r].destroy(!0)}this.texturePool={}},t.prototype.setScreenSize=function(t){if(t.width!==this._pixelsWidth||t.height!==this._pixelsHeight){for(var e in this.enableFullScreen=t.width>0&&t.height>0,this.texturePool)if(Number(e)<0){var i=this.texturePool[e];if(i)for(var r=0;r<i.length;r++)i[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}},t.SCREEN_KEY=-1,t}(),Li=function(){function t(t,e,i,r,n,s,o){void 0===e&&(e=0),void 0===i&&(i=!1),void 0===r&&(r=l.FLOAT),this.buffer=t,this.size=e,this.normalized=i,this.type=r,this.stride=n,this.start=s,this.instance=o}return t.prototype.destroy=function(){this.buffer=null},t.from=function(e,i,r,n,s){return new t(e,i,r,n,s)},t}(),Fi=0,ki=function(){function t(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1),this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=Fi++,this.disposeRunner=new ni("disposeBuffer")}return t.prototype.update=function(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(t.prototype,"index",{get:function(){return this.type===A.ELEMENT_ARRAY_BUFFER},set:function(t){this.type=t?A.ELEMENT_ARRAY_BUFFER:A.ARRAY_BUFFER},enumerable:!1,configurable:!0}),t.from=function(e){return e instanceof Array&&(e=new Float32Array(e)),new t(e)},t}(),Bi={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};var Ni={5126:4,5123:2,5121:1},Ui=0,Gi={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},Xi=function(){function t(t,e){void 0===t&&(t=[]),void 0===e&&(e={}),this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Ui++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ni("disposeGeometry"),this.refCount=0}return t.prototype.addAttribute=function(t,e,i,r,n,s,o,a){if(void 0===i&&(i=0),void 0===r&&(r=!1),void 0===a&&(a=!1),!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof ki||(e instanceof Array&&(e=new Float32Array(e)),e=new ki(e));var h=t.split("|");if(h.length>1){for(var u=0;u<h.length;u++)this.addAttribute(h[u],e,i,r,n);return this}var l=this.buffers.indexOf(e);return-1===l&&(this.buffers.push(e),l=this.buffers.length-1),this.attributes[t]=new Li(l,i,r,n,s,o,a),this.instanced=this.instanced||a,this},t.prototype.getAttribute=function(t){return this.attributes[t]},t.prototype.getBuffer=function(t){return this.buffers[this.getAttribute(t).buffer]},t.prototype.addIndex=function(t){return t instanceof ki||(t instanceof Array&&(t=new Uint16Array(t)),t=new ki(t)),t.type=A.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,-1===this.buffers.indexOf(t)&&this.buffers.push(t),this},t.prototype.getIndex=function(){return this.indexBuffer},t.prototype.interleave=function(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;var t,e=[],i=[],r=new ki;for(t in this.attributes){var n=this.attributes[t],s=this.buffers[n.buffer];e.push(s.data),i.push(n.size*Ni[n.type]/4),n.buffer=0}for(r.data=function(t,e){for(var i=0,r=0,n={},s=0;s<t.length;s++)r+=e[s],i+=t[s].length;var o=new ArrayBuffer(4*i),a=null,h=0;for(s=0;s<t.length;s++){var u=e[s],l=t[s],c=pe(l);n[c]||(n[c]=new Bi[c](o)),a=n[c];for(var f=0;f<l.length;f++)a[(f/u|0)*r+h+f%u]=l[f];h+=u}return new Float32Array(o)}(e,i),t=0;t<this.buffers.length;t++)this.buffers[t]!==this.indexBuffer&&this.buffers[t].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},t.prototype.getSize=function(){for(var t in this.attributes){var e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0},t.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},t.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},t.prototype.clone=function(){for(var e=new t,i=0;i<this.buffers.length;i++)e.buffers[i]=new ki(this.buffers[i].data.slice(0));for(var i in this.attributes){var r=this.attributes[i];e.attributes[i]=new Li(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=A.ELEMENT_ARRAY_BUFFER),e},t.merge=function(e){for(var i,r=new t,n=[],s=[],o=[],a=0;a<e.length;a++){i=e[a];for(var h=0;h<i.buffers.length;h++)s[h]=s[h]||0,s[h]+=i.buffers[h].data.length,o[h]=0}for(a=0;a<i.buffers.length;a++)n[a]=new(Gi[pe(i.buffers[a].data)])(s[a]),r.buffers[a]=new ki(n[a]);for(a=0;a<e.length;a++){i=e[a];for(h=0;h<i.buffers.length;h++)n[h].set(i.buffers[h].data,o[h]),o[h]+=i.buffers[h].data.length}if(r.attributes=i.attributes,i.indexBuffer){r.indexBuffer=r.buffers[i.buffers.indexOf(i.indexBuffer)],r.indexBuffer.type=A.ELEMENT_ARRAY_BUFFER;var u=0,l=0,c=0,f=0;for(a=0;a<i.buffers.length;a++)if(i.buffers[a]!==i.indexBuffer){f=a;break}for(var a in i.attributes){var d=i.attributes[a];(0|d.buffer)===f&&(l+=d.size*Ni[d.type]/4)}for(a=0;a<e.length;a++){var p=e[a].indexBuffer.data;for(h=0;h<p.length;h++)r.indexBuffer.data[h+c]+=u;u+=e[a].buffers[f].data.length/l,c+=p.length}}return r},t}(),Vi=function(t){function e(){var e=t.call(this)||this;return e.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),e}return ci(e,t),e}(Xi),Hi=function(t){function e(){var e=t.call(this)||this;return e.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),e.uvs=new Float32Array([0,0,1,0,1,1,0,1]),e.vertexBuffer=new ki(e.vertices),e.uvBuffer=new ki(e.uvs),e.addAttribute("aVertexPosition",e.vertexBuffer).addAttribute("aTextureCoord",e.uvBuffer).addIndex([0,1,2,0,2,3]),e}return ci(e,t),e.prototype.map=function(t,e){var i=0,r=0;return this.uvs[0]=i,this.uvs[1]=r,this.uvs[2]=i+e.width/t.width,this.uvs[3]=r,this.uvs[4]=i+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=i,this.uvs[7]=r+e.height/t.height,i=e.x,r=e.y,this.vertices[0]=i,this.vertices[1]=r,this.vertices[2]=i+e.width,this.vertices[3]=r,this.vertices[4]=i+e.width,this.vertices[5]=r+e.height,this.vertices[6]=i,this.vertices[7]=r+e.height,this.invalidate(),this},e.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},e}(Xi),ji=0,Yi=function(){function t(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=ji++,this.static=!!e,this.ubo=!!i,t instanceof ki?(this.buffer=t,this.buffer.type=A.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new ki(new Float32Array(1)),this.buffer.type=A.UNIFORM_BUFFER,this.autoManage=!0))}return t.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},t.prototype.add=function(e,i,r){if(this.ubo)throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[e]=new t(i,r)},t.from=function(e,i,r){return new t(e,i,r)},t.uboFrom=function(e,i){return new t(e,null==i||i,!0)},t}(),zi=function(){function t(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=T.NONE,this.sourceFrame=new ke,this.destinationFrame=new ke,this.bindingSourceFrame=new ke,this.bindingDestinationFrame=new ke,this.filters=[],this.transform=null}return t.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},t}(),Wi=[new Le,new Le,new Le,new Le],qi=new Ve,Zi=function(){function t(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Di,this.texturePool.setScreenSize(t.view),this.statePool=[],this.quad=new Vi,this.quadUv=new Hi,this.tempRect=new ke,this.activeState={},this.globalUniforms=new Yi({outputFrame:new ke,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}return t.prototype.push=function(t,e){for(var i,r,n=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new zi,a=this.renderer.renderTexture,h=e[0].resolution,u=e[0].multisample,l=e[0].padding,c=e[0].autoFit,f=null===(i=e[0].legacy)||void 0===i||i,d=1;d<e.length;d++){var p=e[d];h=Math.min(h,p.resolution),u=Math.min(u,p.multisample),l=this.useMaxPadding?Math.max(l,p.padding):l+p.padding,c=c&&p.autoFit,f=f||null===(r=p.legacy)||void 0===r||r}1===s.length&&(this.defaultFilterStack[0].renderTexture=a.current),s.push(o),o.resolution=h,o.multisample=u,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(l);var _=this.tempRect.copyFrom(a.sourceFrame);n.projection.transform&&this.transformAABB(qi.copyFrom(n.projection.transform).invert(),_),c?(o.sourceFrame.fit(_),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(_)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,h,u),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;var m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(a.sourceFrame),o.bindingDestinationFrame.copyFrom(a.destinationFrame),o.transform=n.projection.transform,n.projection.transform=null,a.bind(o.renderTexture,o.sourceFrame,m),n.framebuffer.clear(0,0,0,0)},t.prototype.pop=function(){var t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;var r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;var n=r.inputSize,s=r.inputPixel,o=r.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],s[0]=Math.round(n[0]*e.resolution),s[1]=Math.round(n[1]*e.resolution),s[2]=1/s[0],s[3]=1/s[1],o[0]=.5*s[2],o[1]=.5*s[3],o[2]=e.sourceFrame.width*n[2]-.5*s[2],o[3]=e.sourceFrame.height*n[3]-.5*s[3],e.legacy){var a=r.filterArea;a[0]=e.destinationFrame.width,a[1]=e.destinationFrame.height,a[2]=e.sourceFrame.x,a[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();var h=t[t.length-1];if(this.renderer.framebuffer.blit(),1===i.length)i[0].apply(this,e.renderTexture,h.renderTexture,g.BLEND,e),this.returnFilterTexture(e.renderTexture);else{var u=e.renderTexture,l=this.getOptimalFilterTexture(u.width,u.height,e.resolution);l.filterFrame=u.filterFrame;var c=0;for(c=0;c<i.length-1;++c){1===c&&e.multisample>1&&((l=this.getOptimalFilterTexture(u.width,u.height,e.resolution)).filterFrame=u.filterFrame),i[c].apply(this,u,l,g.CLEAR,e);var f=u;u=l,l=f}i[c].apply(this,u,h.renderTexture,g.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(u),this.returnFilterTexture(l)}e.clear(),this.statePool.push(e)},t.prototype.bindAndClear=function(t,e){void 0===e&&(e=g.CLEAR);var i=this.renderer,r=i.renderTexture,n=i.state;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t&&t.filterFrame){var s=this.tempRect;s.x=0,s.y=0,s.width=t.filterFrame.width,s.height=t.filterFrame.height,r.bind(t,t.filterFrame,s)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var o=1&n.stateId||this.forceClear;(e===g.CLEAR||e===g.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)},t.prototype.applyFilter=function(t,e,i,r){var n=this.renderer;n.state.set(t.state),this.bindAndClear(i,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(a.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(a.TRIANGLE_STRIP))},t.prototype.calculateSpriteMatrix=function(t,e){var i=this.activeState,r=i.sourceFrame,n=i.destinationFrame,s=e._texture.orig,o=t.set(n.width,0,0,n.height,r.x,r.y),a=e.worldTransform.copyTo(Ve.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/s.width,1/s.height),o.translate(e.anchor.x,e.anchor.y),o},t.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},t.prototype.getOptimalFilterTexture=function(t,e,i,r){return void 0===i&&(i=1),void 0===r&&(r=T.NONE),this.texturePool.getOptimalTexture(t,e,i,r)},t.prototype.getFilterTexture=function(t,e,i){if("number"==typeof t){var r=t;t=e,e=r}t=t||this.activeState.renderTexture;var n=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||T.NONE);return n.filterFrame=t.filterFrame,n},t.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},t.prototype.emptyPool=function(){this.texturePool.clear(!0)},t.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},t.prototype.transformAABB=function(t,e){var i=Wi[0],r=Wi[1],n=Wi[2],s=Wi[3];i.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),s.set(e.right,e.bottom),t.apply(i,i),t.apply(r,r),t.apply(n,n),t.apply(s,s);var o=Math.min(i.x,r.x,n.x,s.x),a=Math.min(i.y,r.y,n.y,s.y),h=Math.max(i.x,r.x,n.x,s.x),u=Math.max(i.y,r.y,n.y,s.y);e.x=o,e.y=a,e.width=h-o,e.height=u-a},t.prototype.roundFrame=function(t,e,i,r,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){var s=n.a,o=n.b,a=n.c,h=n.d;if((Math.abs(o)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(s)>1e-4||Math.abs(h)>1e-4))return}(n=n?qi.copyFrom(n):qi.identity()).translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}},t}(),Qi=function(){function t(t){this.renderer=t}return t.prototype.flush=function(){},t.prototype.destroy=function(){this.renderer=null},t.prototype.start=function(){},t.prototype.stop=function(){this.flush()},t.prototype.render=function(t){},t}(),Ji=function(){function t(t){this.renderer=t,this.emptyRenderer=new Qi(t),this.currentRenderer=this.emptyRenderer}return t.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},t.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.copyBoundTextures=function(t,e){for(var i=this.renderer.texture.boundTextures,r=e-1;r>=0;--r)t[r]=i[r]||null,t[r]&&(t[r]._batchLocation=r)},t.prototype.boundArray=function(t,e,i,r){for(var n=t.elements,s=t.ids,o=t.count,a=0,h=0;h<o;h++){var u=n[h],l=u._batchLocation;if(l>=0&&l<r&&e[l]===u)s[h]=l;else for(;a<r;){var c=e[a];if(!c||c._batchEnabled!==i||c._batchLocation!==a){s[h]=a,u._batchLocation=a,e[a]=u;break}a++}}},t.prototype.destroy=function(){this.renderer=null},t}(),Ki=0,tr=function(){function t(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),t.view.addEventListener("webglcontextlost",this.handleContextLost,!1),t.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}return Object.defineProperty(t.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),t.prototype.contextChange=function(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=Ki++},t.prototype.initFromContext=function(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=Ki++,this.renderer.runners.contextChange.emit(t)},t.prototype.initFromOptions=function(t){var e=this.createContext(this.renderer.view,t);this.initFromContext(e)},t.prototype.createContext=function(t,e){var i;if(X.PREFER_ENV>=r.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},t.prototype.getExtensions=function(){var t=this.gl,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},t.prototype.handleContextLost=function(t){var e=this;t.preventDefault(),setTimeout(function(){e.gl.isContextLost()&&e.extensions.loseContext&&e.extensions.loseContext.restoreContext()},0)},t.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},t.prototype.destroy=function(){var t=this.renderer.view;this.renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},t.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},t.prototype.validateContext=function(t){var e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var r=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},t}(),er=function(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=T.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},ir=new ke,rr=function(){function t(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Pi(10,10),this.msaaSamples=null}return t.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new ke,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){var e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;X.PREFER_ENV===r.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=function(t){return e.drawBuffersWEBGL(t)}:(this.hasMRT=!1,t.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)},t.prototype.bind=function(t,e,i){void 0===i&&(i=0);var r=this.gl;if(t){var n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var s=0;s<t.colorTextures.length;s++){var o=t.colorTextures[s];this.renderer.texture.unbind(o.parentTextureArray||o)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){var a=e.width>>i,h=e.height>>i,u=a/e.width;this.setViewport(e.x*u,e.y*u,a,h)}else{a=t.width>>i,h=t.height>>i;this.setViewport(0,0,a,h)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},t.prototype.setViewport=function(t,e,i,r){var n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),n.width===i&&n.height===r&&n.x===t&&n.y===e||(n.x=t,n.y=e,n.width=i,n.height=r,this.gl.viewport(t,e,i,r))},Object.defineProperty(t.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),t.prototype.clear=function(t,e,i,r,n){void 0===n&&(n=s.COLOR|s.DEPTH);var o=this.gl;o.clearColor(t,e,i,r),o.clear(n)},t.prototype.initFramebuffer=function(t){var e=this.gl,i=new er(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i},t.prototype.resizeFramebuffer=function(t){var e=this.gl,i=t.glFramebuffers[this.CONTEXT_UID];i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,e.RGBA8,t.width,t.height)),i.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,i.stencil),i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var r=t.colorTextures,n=r.length;e.drawBuffers||(n=Math.min(n,1));for(var s=0;s<n;s++){var o=r[s],a=o.parentTextureArray||o;this.renderer.texture.bind(a,0)}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)},t.prototype.updateFramebuffer=function(t,e){var i=this.gl,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures,s=n.length;i.drawBuffers||(s=Math.min(s,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?(r.msaaBuffer=r.msaaBuffer||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,r.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,i.RGBA8,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r.msaaBuffer)):r.msaaBuffer&&(i.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));for(var o=[],a=0;a<s;a++){var h=n[a],u=h.parentTextureArray||h;this.renderer.texture.bind(u,0),0===a&&r.msaaBuffer||(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,h.target,u._glTextures[this.CONTEXT_UID].texture,e),o.push(i.COLOR_ATTACHMENT0+a))}if((o.length>1&&i.drawBuffers(o),t.depthTexture)&&this.writeDepthTexture){var l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture?r.stencil&&(i.deleteRenderbuffer(r.stencil),r.stencil=null):(r.stencil=r.stencil||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,r.stencil),r.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,i.DEPTH24_STENCIL8,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,r.stencil))},t.prototype.canMultisampleFramebuffer=function(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture},t.prototype.detectSamples=function(t){var e=this.msaaSamples,i=T.NONE;if(t<=1||null===e)return i;for(var r=0;r<e.length;r++)if(e[r]<=t){i=e[r];break}return 1===i&&(i=T.NONE),i},t.prototype.blit=function(t,e,i){var r=this,n=r.current,s=r.renderer,o=r.gl,a=r.CONTEXT_UID;if(2===s.context.webGLVersion&&n){var h=n.glFramebuffers[a];if(h){if(!t){if(!h.msaaBuffer)return;var u=n.colorTextures[0];if(!u)return;h.blitFramebuffer||(h.blitFramebuffer=new Pi(n.width,n.height),h.blitFramebuffer.addColorTexture(0,u)),(t=h.blitFramebuffer).colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),t.width===n.width&&t.height===n.height||(t.width=n.width,t.height=n.height,t.dirtyId++,t.dirtySize++)}e||((e=ir).width=n.width,e.height=n.height),i||(i=e);var l=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR)}}},t.prototype.disposeFramebuffer=function(t,e){var i=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(i){delete t.glFramebuffers[this.CONTEXT_UID];var n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&r.deleteRenderbuffer(i.msaaBuffer),i.stencil&&r.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&i.blitFramebuffer.dispose()}},t.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)},t.prototype.forceStencil=function(){var t=this.current;if(t){var e=t.glFramebuffers[this.CONTEXT_UID];if(e&&!e.stencil){t.stencil=!0;var i=t.width,r=t.height,n=this.gl,s=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,s),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,n.DEPTH24_STENCIL8,i,r):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,i,r),e.stencil=s,n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,s)}}},t.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new ke},t.prototype.destroy=function(){this.renderer=null},t}(),nr={5126:4,5123:2,5121:1},sr=function(){function t(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return t.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==e.webGLVersion){var i=this.renderer.context.extensions.vertexArrayObject;X.PREFER_ENV===r.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=function(){return i.createVertexArrayOES()},t.bindVertexArray=function(t){return i.bindVertexArrayOES(t)},t.deleteVertexArray=function(t){return i.deleteVertexArrayOES(t)}):(this.hasVao=!1,t.createVertexArray=function(){return null},t.bindVertexArray=function(){return null},t.deleteVertexArray=function(){return null})}if(2!==e.webGLVersion){var n=t.getExtension("ANGLE_instanced_arrays");n?(t.vertexAttribDivisor=function(t,e){return n.vertexAttribDivisorANGLE(t,e)},t.drawElementsInstanced=function(t,e,i,r,s){return n.drawElementsInstancedANGLE(t,e,i,r,s)},t.drawArraysInstanced=function(t,e,i,r){return n.drawArraysInstancedANGLE(t,e,i,r)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex},t.prototype.bind=function(t,e){e=e||this.renderer.shader.shader;var i=this.gl,r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);var s=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==s&&(this._activeVao=s,this.hasVao?i.bindVertexArray(s):this.activateVao(t,e.program)),this.updateBuffers()},t.prototype.reset=function(){this.unbind()},t.prototype.updateBuffers=function(){for(var t=this._activeGeometry,e=this.renderer.buffer,i=0;i<t.buffers.length;i++){var r=t.buffers[i];e.update(r)}},t.prototype.checkCompatibility=function(t,e){var i=t.attributes,r=e.attributeData;for(var n in r)if(!i[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},t.prototype.getSignature=function(t,e){var i=t.attributes,r=e.attributeData,n=["g",t.id];for(var s in i)r[s]&&n.push(s,r[s].location);return n.join("-")},t.prototype.initGeometryVao=function(t,e,i){void 0===i&&(i=!0);var r=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,o=e.program;o.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);var a=this.getSignature(t,o),h=t.glVertexArrayObjects[this.CONTEXT_UID],u=h[a];if(u)return h[o.id]=u,u;var l=t.buffers,c=t.attributes,f={},d={};for(var p in l)f[p]=0,d[p]=0;for(var p in c)!c[p].size&&o.attributeData[p]?c[p].size=o.attributeData[p].size:c[p].size||console.warn("PIXI Geometry attribute '"+p+"' size cannot be determined (likely the bound shader does not have the attribute)"),f[c[p].buffer]+=c[p].size*nr[c[p].type];for(var p in c){var _=c[p],m=_.size;void 0===_.stride&&(f[_.buffer]===m*nr[_.type]?_.stride=0:_.stride=f[_.buffer]),void 0===_.start&&(_.start=d[_.buffer],d[_.buffer]+=m*nr[_.type])}u=r.createVertexArray(),r.bindVertexArray(u);for(var g=0;g<l.length;g++){var v=l[g];s.bind(v),i&&v._glBuffers[n].refCount++}return this.activateVao(t,o),this._activeVao=u,h[o.id]=u,h[a]=u,u},t.prototype.disposeGeometry=function(t,e){var i;if(this.managedGeometries[t.id]){delete this.managedGeometries[t.id];var r=t.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,s=t.buffers,o=null===(i=this.renderer)||void 0===i?void 0:i.buffer;if(t.disposeRunner.remove(this),r){if(o)for(var a=0;a<s.length;a++){var h=s[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,0!==h.refCount||e||o.dispose(s[a],e))}if(!e)for(var u in r)if("g"===u[0]){var l=r[u];this._activeVao===l&&this.unbind(),n.deleteVertexArray(l)}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}},t.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedGeometries),i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)},t.prototype.activateVao=function(t,e){var i=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,s=t.buffers,o=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);var a=null;for(var h in o){var u=o[h],l=s[u.buffer],c=l._glBuffers[r];if(e.attributeData[h]){a!==c&&(n.bind(l),a=c);var f=e.attributeData[h].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,u.size,u.type||i.FLOAT,u.normalized,u.stride,u.start),u.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");i.vertexAttribDivisor(f,1)}}}},t.prototype.draw=function(t,e,i,r){var n=this.gl,s=this._activeGeometry;if(s.indexBuffer){var o=s.indexBuffer.data.BYTES_PER_ELEMENT,a=2===o?n.UNSIGNED_SHORT:n.UNSIGNED_INT;2===o||4===o&&this.canUseUInt32ElementIndex?s.instanced?n.drawElementsInstanced(t,e||s.indexBuffer.data.length,a,(i||0)*o,r||1):n.drawElements(t,e||s.indexBuffer.data.length,a,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else s.instanced?n.drawArraysInstanced(t,i,e||s.getSize(),r||1):n.drawArrays(t,i,e||s.getSize());return this},t.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},t.prototype.destroy=function(){this.renderer=null},t}(),or=function(){function t(t){void 0===t&&(t=null),this.type=b.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=X.FILTER_MULTISAMPLE,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}return Object.defineProperty(t.prototype,"filter",{get:function(){return this._filters?this._filters[0]:null},set:function(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=b.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},t.prototype.copyCountersOrReset=function(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},t}();function ar(t,e,i){var r=t.createShader(e);return t.shaderSource(r,i),t.compileShader(r),r}function hr(t,e){var i=t.getShaderSource(e).split("\n").map(function(t,e){return e+": "+t}),r=t.getShaderInfoLog(e),n=r.split("\n"),s={},o=n.map(function(t){return parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))}).filter(function(t){return!(!t||s[t])&&(s[t]=!0,!0)}),a=[""];o.forEach(function(t){i[t-1]="%c"+i[t-1]+"%c",a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});var h=i.join("\n");a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,a),console.groupEnd()}function ur(t){for(var e=new Array(t),i=0;i<e.length;i++)e[i]=!1;return e}function lr(t,e){switch(t){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return ur(2*e);case"bvec3":return ur(3*e);case"bvec4":return ur(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var cr,fr={},dr=fr;function pr(){if(!cr){cr=y.MEDIUM;var t=function(){if(dr===fr||dr&&dr.isContextLost()){var t=X.ADAPTER.createCanvas(),e=void 0;X.PREFER_ENV>=r.WEBGL2&&(e=t.getContext("webgl2",{})),e||((e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),dr=e}return dr}();if(t&&t.getShaderPrecisionFormat){var e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);cr=e.precision?y.HIGH:y.MEDIUM}}return cr}function _r(t,e,i){if("precision"!==t.substring(0,9)){var r=e;return e===y.HIGH&&i!==y.HIGH&&(r=y.MEDIUM),"precision "+r+" float;\n"+t}return i!==y.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}var mr={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function gr(t){return mr[t]}var vr=null,yr={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function br(t,e){if(!vr){var i=Object.keys(yr);vr={};for(var r=0;r<i.length;++r){var n=i[r];vr[t[n]]=yr[n]}}return vr[e]}var xr=[{test:function(t){return"float"===t.type&&1===t.size&&!t.isArray},code:function(t){return'\n            if(uv["'+t+'"] !== ud["'+t+'"].value)\n            {\n                ud["'+t+'"].value = uv["'+t+'"]\n                gl.uniform1f(ud["'+t+'"].location, uv["'+t+'"])\n            }\n            '}},{test:function(t,e){return!("sampler2D"!==t.type&&"samplerCube"!==t.type&&"sampler2DArray"!==t.type||1!==t.size||t.isArray||null!=e&&void 0===e.castToBaseTexture)},code:function(t){return't = syncData.textureCount++;\n\n            renderer.texture.bind(uv["'+t+'"], t);\n\n            if(ud["'+t+'"].value !== t)\n            {\n                ud["'+t+'"].value = t;\n                gl.uniform1i(ud["'+t+'"].location, t);\n; // eslint-disable-line max-len\n            }'}},{test:function(t,e){return"mat3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.a},code:function(t){return'\n            gl.uniformMatrix3fv(ud["'+t+'"].location, false, uv["'+t+'"].toArray(true));\n            '},codeUbo:function(t){return"\n                var "+t+"_matrix = uv."+t+".toArray(true);\n\n                data[offset] = "+t+"_matrix[0];\n                data[offset+1] = "+t+"_matrix[1];\n                data[offset+2] = "+t+"_matrix[2];\n        \n                data[offset + 4] = "+t+"_matrix[3];\n                data[offset + 5] = "+t+"_matrix[4];\n                data[offset + 6] = "+t+"_matrix[5];\n        \n                data[offset + 8] = "+t+"_matrix[6];\n                data[offset + 9] = "+t+"_matrix[7];\n                data[offset + 10] = "+t+"_matrix[8];\n            "}},{test:function(t,e){return"vec2"===t.type&&1===t.size&&!t.isArray&&void 0!==e.x},code:function(t){return'\n                cv = ud["'+t+'"].value;\n                v = uv["'+t+'"];\n\n                if(cv[0] !== v.x || cv[1] !== v.y)\n                {\n                    cv[0] = v.x;\n                    cv[1] = v.y;\n                    gl.uniform2f(ud["'+t+'"].location, v.x, v.y);\n                }'},codeUbo:function(t){return"\n                v = uv."+t+";\n\n                data[offset] = v.x;\n                data[offset+1] = v.y;\n            "}},{test:function(t){return"vec2"===t.type&&1===t.size&&!t.isArray},code:function(t){return'\n                cv = ud["'+t+'"].value;\n                v = uv["'+t+'"];\n\n                if(cv[0] !== v[0] || cv[1] !== v[1])\n                {\n                    cv[0] = v[0];\n                    cv[1] = v[1];\n                    gl.uniform2f(ud["'+t+'"].location, v[0], v[1]);\n                }\n            '}},{test:function(t,e){return"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.width},code:function(t){return'\n                cv = ud["'+t+'"].value;\n                v = uv["'+t+'"];\n\n                if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n                {\n                    cv[0] = v.x;\n                    cv[1] = v.y;\n                    cv[2] = v.width;\n                    cv[3] = v.height;\n                    gl.uniform4f(ud["'+t+'"].location, v.x, v.y, v.width, v.height)\n                }'},codeUbo:function(t){return"\n                    v = uv."+t+";\n\n                    data[offset] = v.x;\n                    data[offset+1] = v.y;\n                    data[offset+2] = v.width;\n                    data[offset+3] = v.height;\n                "}},{test:function(t){return"vec4"===t.type&&1===t.size&&!t.isArray},code:function(t){return'\n                cv = ud["'+t+'"].value;\n                v = uv["'+t+'"];\n\n                if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n                {\n                    cv[0] = v[0];\n                    cv[1] = v[1];\n                    cv[2] = v[2];\n                    cv[3] = v[3];\n\n                    gl.uniform4f(ud["'+t+'"].location, v[0], v[1], v[2], v[3])\n                }'}}],Tr={float:"\n    if (cv !== v)\n    {\n        cu.value = v;\n        gl.uniform1f(location, v);\n    }",vec2:"\n    if (cv[0] !== v[0] || cv[1] !== v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n\n        gl.uniform2f(location, v[0], v[1])\n    }",vec3:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3f(location, v[0], v[1], v[2])\n    }",vec4:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n        cv[3] = v[3];\n\n        gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n    }",int:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1i(location, v);\n    }",ivec2:"\n    if (cv[0] !== v[0] || cv[1] !== v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n\n        gl.uniform2i(location, v[0], v[1]);\n    }",ivec3:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3i(location, v[0], v[1], v[2]);\n    }",ivec4:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n        cv[3] = v[3];\n\n        gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n    }",uint:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1ui(location, v);\n    }",uvec2:"\n    if (cv[0] !== v[0] || cv[1] !== v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n\n        gl.uniform2ui(location, v[0], v[1]);\n    }",uvec3:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3ui(location, v[0], v[1], v[2]);\n    }",uvec4:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n        cv[3] = v[3];\n\n        gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n    }",bool:"\n    if (cv !== v)\n    {\n        cu.value = v;\n        gl.uniform1i(location, v);\n    }",bvec2:"\n    if (cv[0] != v[0] || cv[1] != v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n\n        gl.uniform2i(location, v[0], v[1]);\n    }",bvec3:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3i(location, v[0], v[1], v[2]);\n    }",bvec4:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n        cv[3] = v[3];\n\n        gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n    }",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1i(location, v);\n    }",samplerCube:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1i(location, v);\n    }",sampler2DArray:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1i(location, v);\n    }"},Ar={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};var Er,wr=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Sr(t){for(var e="",i=0;i<t;++i)i>0&&(e+="\nelse "),i<t-1&&(e+="if(test == "+i+".0){}");return e}var Pr=0,Mr={},Ir=function(){function t(e,i,r){void 0===r&&(r="pixi-shader"),this.id=Pr++,this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=i||t.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),"#version"!==this.vertexSrc.substring(0,8)&&(r=r.replace(/\s+/g,"-"),Mr[r]?(Mr[r]++,r+="-"+Mr[r]):Mr[r]=1,this.vertexSrc="#define SHADER_NAME "+r+"\n"+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+r+"\n"+this.fragmentSrc,this.vertexSrc=_r(this.vertexSrc,X.PRECISION_VERTEX,y.HIGH),this.fragmentSrc=_r(this.fragmentSrc,X.PRECISION_FRAGMENT,pr())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(t,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n   vTextureCoord = aTextureCoord;\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n   gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"},enumerable:!1,configurable:!0}),t.from=function(e,i,r){var n=e+i,s=we[n];return s||(we[n]=s=new t(e,i,r)),s},t}(),Cr=function(){function t(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof Yi?e:new Yi(e):new Yi({}),this.disposeRunner=new ni("disposeShader")}return t.prototype.checkUniformExists=function(t,e){if(e.uniforms[t])return!0;for(var i in e.uniforms){var r=e.uniforms[i];if(r.group&&this.checkUniformExists(t,r))return!0}return!1},t.prototype.destroy=function(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()},Object.defineProperty(t.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),t.from=function(e,i,r){return new t(Ir.from(e,i),r)},t}(),Rr=function(){function t(){this.data=0,this.blendMode=o.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(t.prototype,"blend",{get:function(){return!!(1&this.data)},set:function(t){!!(1&this.data)!==t&&(this.data^=1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsets",{get:function(){return!!(2&this.data)},set:function(t){!!(2&this.data)!==t&&(this.data^=2)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"culling",{get:function(){return!!(4&this.data)},set:function(t){!!(4&this.data)!==t&&(this.data^=4)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthTest",{get:function(){return!!(8&this.data)},set:function(t){!!(8&this.data)!==t&&(this.data^=8)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthMask",{get:function(){return!!(32&this.data)},set:function(t){!!(32&this.data)!==t&&(this.data^=32)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwiseFrontFace",{get:function(){return!!(16&this.data)},set:function(t){!!(16&this.data)!==t&&(this.data^=16)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this.blend=t!==o.NONE,this._blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(t){this.offsets=!!t,this._polygonOffset=t},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[@pixi/core:State blendMode="+this.blendMode+" clockwiseFrontFace="+this.clockwiseFrontFace+" culling="+this.culling+" depthMask="+this.depthMask+" polygonOffset="+this.polygonOffset+"]"},t.for2d=function(){var e=new t;return e.depthTest=!1,e.blend=!0,e},t}(),Or=function(t){function e(i,r,n){var s=this,o=Ir.from(i||e.defaultVertexSrc,r||e.defaultFragmentSrc);return(s=t.call(this,o,n)||this).padding=0,s.resolution=X.FILTER_RESOLUTION,s.multisample=X.FILTER_MULTISAMPLE,s.enabled=!0,s.autoFit=!0,s.state=new Rr,s}return ci(e,t),e.prototype.apply=function(t,e,i,r,n){t.applyFilter(this,e,i,r)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n    gl_Position = filterVertexPosition();\n    vTextureCoord = filterTextureCoord();\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n   gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"},enumerable:!1,configurable:!0}),e}(Cr),$r=new Ve,Dr=function(){function t(t,e){this._texture=t,this.mapCoord=new Ve,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?.5:e,this.isSimple=!1}return Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture=t,this._textureID=-1},enumerable:!1,configurable:!0}),t.prototype.multiplyUvs=function(t,e){void 0===e&&(e=t);for(var i=this.mapCoord,r=0;r<t.length;r+=2){var n=t[r],s=t[r+1];e[r]=n*i.a+s*i.c+i.tx,e[r+1]=n*i.b+s*i.d+i.ty}return e},t.prototype.update=function(t){var e=this._texture;if(!e||!e.valid)return!1;if(!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;var i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);var r=e.orig,n=e.trim;n&&($r.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append($r));var s=e.baseTexture,o=this.uClampFrame,a=this.clampMargin/s.resolution,h=this.clampOffset;return o[0]=(e._frame.x+a+h)/s.width,o[1]=(e._frame.y+a+h)/s.height,o[2]=(e._frame.x+e._frame.width-a+h)/s.width,o[3]=(e._frame.y+e._frame.height-a+h)/s.height,this.uClampOffset[0]=h/s.realWidth,this.uClampOffset[1]=h/s.realHeight,this.isSimple=e._frame.width===s.width&&e._frame.height===s.height&&0===e.rotate,!0},t}(),Lr=function(t){function e(e,i,r){var n=this,s=null;return"string"!=typeof e&&void 0===i&&void 0===r&&(s=e,e=void 0,i=void 0,r=void 0),(n=t.call(this,e||"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0)  ).xy;\n}\n",i||"varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n    float clip = step(3.5,\n        step(maskClamp.x, vMaskCoord.x) +\n        step(maskClamp.y, vMaskCoord.y) +\n        step(vMaskCoord.x, maskClamp.z) +\n        step(vMaskCoord.y, maskClamp.w));\n\n    vec4 original = texture2D(uSampler, vTextureCoord);\n    vec4 masky = texture2D(mask, vMaskCoord);\n    float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n    original *= (alphaMul * masky.r * alpha * clip);\n\n    gl_FragColor = original;\n}\n",r)||this).maskSprite=s,n.maskMatrix=new Ve,n}return ci(e,t),Object.defineProperty(e.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),e.prototype.apply=function(t,e,i,r){var n=this._maskSprite,s=n._texture;s.valid&&(s.uvMatrix||(s.uvMatrix=new Dr(s,0)),s.uvMatrix.update(),this.uniforms.npmAlpha=s.baseTexture.alphaMode?0:1,this.uniforms.mask=s,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(s.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=s.uvMatrix.uClampFrame,t.applyFilter(this,e,i,r))},e}(Or),Fr=function(){function t(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return t.prototype.setMaskStack=function(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)},t.prototype.push=function(t,e){var i=e;if(!i.isMaskData){var r=this.maskDataPool.pop()||new or;r.pooled=!0,r.maskObject=e,i=r}var n=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(n),i._colorMask=n?n._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==b.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case b.SCISSOR:this.renderer.scissor.push(i);break;case b.STENCIL:this.renderer.stencil.push(i);break;case b.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case b.COLOR:this.pushColorMask(i)}i.type===b.SPRITE&&this.maskStack.push(i)},t.prototype.pop=function(t){var e=this.maskStack.pop();if(e&&e._target===t){if(e.enabled)switch(e.type){case b.SCISSOR:this.renderer.scissor.pop(e);break;case b.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case b.SPRITE:this.popSpriteMask(e);break;case b.COLOR:this.popColorMask(e)}if(e.reset(),e.pooled&&this.maskDataPool.push(e),0!==this.maskStack.length){var i=this.maskStack[this.maskStack.length-1];i.type===b.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}},t.prototype.detect=function(t){var e=t.maskObject;e?e.isSprite?t.type=b.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=b.SCISSOR:t.type=b.STENCIL:t.type=b.COLOR},t.prototype.pushSpriteMask=function(t){var e,i,r=t.maskObject,n=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex])||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Lr]);var o,a,h=this.renderer,u=h.renderTexture;if(u.current){var l=u.current;o=t.resolution||l.resolution,a=null!==(e=t.multisample)&&void 0!==e?e:l.multisample}else o=t.resolution||h.resolution,a=null!==(i=t.multisample)&&void 0!==i?i:h.multisample;s[0].resolution=o,s[0].multisample=a,s[0].maskSprite=r;var c=n.filterArea;n.filterArea=r.getBounds(!0),h.filter.push(n,s),n.filterArea=c,t._filters||this.alphaMaskIndex++},t.prototype.popSpriteMask=function(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},t.prototype.pushColorMask=function(t){var e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask(!!(1&i),!!(2&i),!!(4&i),!!(8&i))},t.prototype.popColorMask=function(t){var e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask(!!(1&i),!!(2&i),!!(4&i),!!(8&i))},t.prototype.destroy=function(){this.renderer=null},t}(),kr=function(){function t(t){this.renderer=t,this.maskStack=[],this.glConst=0}return t.prototype.getStackLength=function(){return this.maskStack.length},t.prototype.setMaskStack=function(t){var e=this.renderer.gl,i=this.getStackLength();this.maskStack=t;var r=this.getStackLength();r!==i&&(0===r?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))},t.prototype._useCurrent=function(){},t.prototype.destroy=function(){this.renderer=null,this.maskStack=null},t}(),Br=new Ve,Nr=[],Ur=function(t){function e(e){var i=t.call(this,e)||this;return i.glConst=X.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,i}return ci(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.calcScissorRect=function(t){var e;if(!t._scissorRectLocal){var i=t._scissorRect,r=t.maskObject,n=this.renderer,s=n.renderTexture,o=r.getBounds(!0,null!==(e=Nr.pop())&&void 0!==e?e:new ke);this.roundFrameToPixels(o,s.current?s.current.resolution:n.resolution,s.sourceFrame,s.destinationFrame,n.projection.transform),i&&o.fit(i),t._scissorRectLocal=o}},e.isMatrixRotated=function(t){if(!t)return!1;var e=t.a,i=t.b,r=t.c,n=t.d;return(Math.abs(i)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)},e.prototype.testScissor=function(t){var i=t.maskObject;if(!i.isFastRect||!i.isFastRect())return!1;if(e.isMatrixRotated(i.worldTransform))return!1;if(e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);var r=t._scissorRectLocal;return r.width>0&&r.height>0},e.prototype.roundFrameToPixels=function(t,i,r,n,s){e.isMatrixRotated(s)||((s=s?Br.copyFrom(s):Br.identity()).translate(-r.x,-r.y).scale(n.width/r.width,n.height/r.height).translate(n.x,n.y),this.renderer.filter.transformAABB(s,t),t.fit(n),t.x=Math.round(t.x*i),t.y=Math.round(t.y*i),t.width=Math.round(t.width*i),t.height=Math.round(t.height*i))},e.prototype.push=function(t){t._scissorRectLocal||this.calcScissorRect(t);var e=this.renderer.gl;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;t&&Nr.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t,e=this.maskStack[this.maskStack.length-1]._scissorRect;t=this.renderer.renderTexture.current?e.y:this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)},e}(kr),Gr=function(t){function e(e){var i=t.call(this,e)||this;return i.glConst=X.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,i}return ci(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var e=t.maskObject,i=this.renderer.gl,r=t._stencilCounter;0===r&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;var n=t._colorMask;0!==n&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,r,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==n&&(t._colorMask=n,i.colorMask(!!(1&n),!!(2&n),!!(4&n),!!(8&n))),this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{var i=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,r=i?i._colorMask:15;0!==r&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==r&&(i._colorMask=r,e.colorMask(!!(1&r),!!(2&r),!!(4&r),!!(8&r))),this._useCurrent()}},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(kr),Xr=function(){function t(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ve,this.transform=null}return t.prototype.update=function(t,e,i,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,r),this.transform&&this.projectionMatrix.append(this.transform);var n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)},t.prototype.calculateProjection=function(t,e,i,r){var n=this.projectionMatrix,s=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=s*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-s-e.y*n.d},t.prototype.setTransform=function(t){},t.prototype.destroy=function(){this.renderer=null},t}(),Vr=new ke,Hr=new ke,jr=function(){function t(t){this.renderer=t,this.clearColor=t._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new ke,this.destinationFrame=new ke,this.viewportFrame=new ke}return t.prototype.bind=function(t,e,i){void 0===t&&(t=null);var r,n,s,o=this.renderer;this.current=t,t?(s=(r=t.baseTexture).resolution,e||(Vr.width=t.frame.width,Vr.height=t.frame.height,e=Vr),i||(Hr.x=t.frame.x,Hr.y=t.frame.y,Hr.width=e.width,Hr.height=e.height,i=Hr),n=r.framebuffer):(s=o.resolution,e||(Vr.width=o.screen.width,Vr.height=o.screen.height,e=Vr),i||((i=Vr).width=e.width,i.height=e.height));var a=this.viewportFrame;a.x=i.x*s,a.y=i.y*s,a.width=i.width*s,a.height=i.height*s,t||(a.y=o.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(i,e,s,!n),t?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)},t.prototype.clear=function(t,e){t=this.current?t||this.current.baseTexture.clearColor:t||this.clearColor;var i=this.destinationFrame,r=this.current?this.current.baseTexture:this.renderer.screen,n=i.width!==r.width||i.height!==r.height;if(n){var s=this.viewportFrame,o=s.x,a=s.y,h=s.width,u=s.height;o=Math.round(o),a=Math.round(a),h=Math.round(h),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(o,a,h,u)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),n&&this.renderer.scissor.pop()},t.prototype.resize=function(){this.bind(null)},t.prototype.reset=function(){this.bind(null)},t.prototype.destroy=function(){this.renderer=null},t}();function Yr(t,e,i,r,n){i.buffer.update(n)}var zr={float:"\n        data[offset] = v;\n    ",vec2:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n    ",vec3:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n\n    ",vec4:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n        data[offset+3] = v[3];\n    ",mat2:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n\n        data[offset+4] = v[2];\n        data[offset+5] = v[3];\n    ",mat3:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n\n        data[offset + 4] = v[3];\n        data[offset + 5] = v[4];\n        data[offset + 6] = v[5];\n\n        data[offset + 8] = v[6];\n        data[offset + 9] = v[7];\n        data[offset + 10] = v[8];\n    ",mat4:"\n        for(var i = 0; i < 16; i++)\n        {\n            data[offset + i] = v[i];\n        }\n    "},Wr={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function qr(t,e){if(!t.autoManage)return{size:0,syncFunc:Yr};for(var i=function(t,e){var i=[];for(var r in t)e[r]&&i.push(e[r]);return i.sort(function(t,e){return t.index-e.index}),i}(t.uniforms,e),r=function(t){for(var e=t.map(function(t){return{data:t,offset:0,dataLen:0,dirty:0}}),i=0,r=0,n=0,s=0;s<e.length;s++){var o=e[s];if(i=Wr[o.data.type],o.data.size>1&&(i=Math.max(i,16)*o.data.size),o.dataLen=i,r%i!==0&&r<16){var a=r%i%16;r+=a,n+=a}r+i>16?(n=16*Math.ceil(n/16),o.offset=n,n+=i,r=i):(o.offset=n,r+=i,n+=i)}return{uboElements:e,size:n=16*Math.ceil(n/16)}}(i),n=r.uboElements,s=r.size,o=["\n    var v = null;\n    var v2 = null;\n    var cv = null;\n    var t = 0;\n    var gl = renderer.gl\n    var index = 0;\n    var data = buffer.data;\n    "],a=0;a<n.length;a++){for(var h=n[a],u=t.uniforms[h.data.name],l=h.data.name,c=!1,f=0;f<xr.length;f++){var d=xr[f];if(d.codeUbo&&d.test(h.data,u)){o.push("offset = "+h.offset/4+";",xr[f].codeUbo(h.data.name,u)),c=!0;break}}if(!c)if(h.data.size>1){var p=gr(h.data.type),_=Math.max(Wr[h.data.type]/16,1),m=p/_,g=(4-m%4)%4;o.push("\n                cv = ud."+l+".value;\n                v = uv."+l+";\n                offset = "+h.offset/4+";\n\n                t = 0;\n\n                for(var i=0; i < "+h.data.size*_+"; i++)\n                {\n                    for(var j = 0; j < "+m+"; j++)\n                    {\n                        data[offset++] = v[t++];\n                    }\n                    offset += "+g+";\n                }\n\n                ")}else{var v=zr[h.data.type];o.push("\n                cv = ud."+l+".value;\n                v = uv."+l+";\n                offset = "+h.offset/4+";\n                "+v+";\n                ")}}return o.push("\n       renderer.buffer.update(buffer);\n    "),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join("\n"))}}var Zr=function(){function t(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return t.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},t}();function Qr(t,e){var i=ar(t,t.VERTEX_SHADER,e.vertexSrc),r=ar(t,t.FRAGMENT_SHADER,e.fragmentSrc),n=t.createProgram();if(t.attachShader(n,i),t.attachShader(n,r),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||function(t,e,i,r){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(i,t.COMPILE_STATUS)||hr(t,i),t.getShaderParameter(r,t.COMPILE_STATUS)||hr(t,r),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,n,i,r),e.attributeData=function(t,e){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var s=e.getActiveAttrib(t,n);if(0!==s.name.indexOf("gl_")){var o=br(e,s.type),a={type:o,name:s.name,size:gr(o),location:e.getAttribLocation(t,s.name)};i[s.name]=a}}return i}(n,t),e.uniformData=function(t,e){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;n<r;n++){var s=e.getActiveUniform(t,n),o=s.name.replace(/\[.*?\]$/,""),a=!!s.name.match(/\[.*?\]$/),h=br(e,s.type);i[o]={name:o,index:n,type:h,size:s.size,isArray:a,value:lr(h,s.size)}}return i}(n,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){var s=Object.keys(e.attributeData);s.sort(function(t,e){return t>e?1:-1});for(var o=0;o<s.length;o++)e.attributeData[s[o]].location=o,t.bindAttribLocation(n,o,s[o]);t.linkProgram(n)}t.deleteShader(i),t.deleteShader(r);var a={};for(var o in e.uniformData){var h=e.uniformData[o];a[o]={location:t.getUniformLocation(n,o),value:lr(h.type,h.size)}}return new Zr(n,a)}var Jr=0,Kr={textureCount:0,uboCount:0},tn=function(){function t(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Jr++}return t.prototype.systemCheck=function(){if(!function(){if("boolean"==typeof Er)return Er;try{var t=new Function("param1","param2","param3","return param1[param2] === param3;");Er=!0===t({a:"b"},"a","b")}catch(t){Er=!1}return Er}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},t.prototype.contextChange=function(t){this.gl=t,this.reset()},t.prototype.bind=function(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;var i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),e||(Kr.textureCount=0,Kr.uboCount=0,this.syncUniformGroup(t.uniformGroup,Kr)),r},t.prototype.setUniforms=function(t){var e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)},t.prototype.syncUniformGroup=function(t,e){var i=this.getGlProgram();t.static&&t.dirtyId===i.uniformDirtyGroups[t.id]||(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))},t.prototype.syncUniforms=function(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)},t.prototype.createSyncGroups=function(t){var e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function(t,e){var i,r=["\n        var v = null;\n        var cv = null;\n        var cu = null;\n        var t = 0;\n        var gl = renderer.gl;\n    "];for(var n in t.uniforms){var s=e[n];if(s){for(var o=t.uniforms[n],a=!1,h=0;h<xr.length;h++)if(xr[h].test(s,o)){r.push(xr[h].code(n,o)),a=!0;break}if(!a){var u=(1!==s.size||s.isArray?Ar:Tr)[s.type].replace("location",'ud["'+n+'"].location');r.push('\n            cu = ud["'+n+'"];\n            cv = cu.value;\n            v = uv["'+n+'"];\n            '+u+";")}}else(null===(i=t.uniforms[n])||void 0===i?void 0:i.group)&&(t.uniforms[n].ubo?r.push("\n                        renderer.shader.syncUniformBufferGroup(uv."+n+", '"+n+"');\n                    "):r.push("\n                        renderer.shader.syncUniformGroup(uv."+n+", syncData);\n                    "))}return new Function("ud","uv","renderer","syncData",r.join("\n"))}(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]},t.prototype.syncUniformBufferGroup=function(t,e){var i=this.getGlProgram();if(!t.static||0!==t.dirtyId||!i.uniformGroups[t.id]){t.dirtyId=0;var r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,Kr,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])},t.prototype.createSyncBufferGroup=function(t,e,i){var r=this.renderer.gl;this.renderer.buffer.bind(t.buffer);var n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;var s=this.getSignature(t,this.shader.program.uniformData,"ubo"),o=this._uboCache[s];if(o||(o=this._uboCache[s]=qr(t,this.shader.program.uniformData)),t.autoManage){var a=new Float32Array(o.size/4);t.buffer.update(a)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]},t.prototype.getSignature=function(t,e,i){var r=t.uniforms,n=[i+"-"];for(var s in r)n.push(s),e[s]&&n.push(e[s].type);return n.join("-")},t.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},t.prototype.generateProgram=function(t){var e=this.gl,i=t.program,r=Qr(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r},t.prototype.reset=function(){this.program=null,this.shader=null},t.prototype.disposeShader=function(t){this.shader===t&&(this.shader=null)},t.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},t}();var en=function(){function t(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=o.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new Rr,this.defaultState.blend=!0}return t.prototype.contextChange=function(t){this.gl=t,this.blendModes=function(t,e){return void 0===e&&(e=[]),e[o.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.ADD]=[t.ONE,t.ONE],e[o.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.NONE]=[0,0],e[o.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[o.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[o.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[o.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[o.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[o.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[o.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[o.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[o.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[o.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.set(this.defaultState),this.reset()},t.prototype.set=function(t){if(t=t||this.defaultState,this.stateId!==t.data){for(var e=this.stateId^t.data,i=0;e;)1&e&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(i=0;i<this.checks.length;i++)this.checks[i](this,t)},t.prototype.forceState=function(t){t=t||this.defaultState;for(var e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data},t.prototype.setBlend=function(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)},t.prototype.setOffset=function(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},t.prototype.setDepthTest=function(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)},t.prototype.setDepthMask=function(t){this.gl.depthMask(t)},t.prototype.setCullFace=function(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)},t.prototype.setFrontFace=function(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])},t.prototype.setBlendMode=function(t){if(t!==this.blendMode){this.blendMode=t;var e=this.blendModes[t],i=this.gl;2===e.length?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}},t.prototype.setPolygonOffset=function(t,e){this.gl.polygonOffset(t,e)},t.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},t.prototype.updateCheck=function(t,e){var i=this.checks.indexOf(t);e&&-1===i?this.checks.push(t):e||-1===i||this.checks.splice(i,1)},t.checkBlendMode=function(t,e){t.setBlendMode(e.blendMode)},t.checkPolygonOffset=function(t,e){t.setPolygonOffset(1,e.polygonOffset)},t.prototype.destroy=function(){this.gl=null},t}(),rn=function(){function t(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=X.GC_MAX_IDLE,this.checkCountMax=X.GC_MAX_CHECK_COUNT,this.mode=X.GC_MODE}return t.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==v.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},t.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,i=!1,r=0;r<e.length;r++){var n=e[r];!n.framebuffer&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,i=!0)}if(i){var s=0;for(r=0;r<e.length;r++)null!==e[r]&&(e[s++]=e[r]);e.length=s}},t.prototype.unload=function(t){var e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(var r=t.children.length-1;r>=0;r--)this.unload(t.children[r])},t.prototype.destroy=function(){this.renderer=null},t}();var nn=function(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=l.UNSIGNED_BYTE,this.internalFormat=h.RGBA,this.samplerType=0},sn=function(){function t(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new mi,this.hasIntegerTextures=!1}return t.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(t){var e,i,r,n,s,o,a,u,c,f,d,p,_,m,g,v,y,b,x,T,A,E,w;return"WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?((e={})[l.UNSIGNED_BYTE]=((i={})[h.RGBA]=t.RGBA8,i[h.RGB]=t.RGB8,i[h.RG]=t.RG8,i[h.RED]=t.R8,i[h.RGBA_INTEGER]=t.RGBA8UI,i[h.RGB_INTEGER]=t.RGB8UI,i[h.RG_INTEGER]=t.RG8UI,i[h.RED_INTEGER]=t.R8UI,i[h.ALPHA]=t.ALPHA,i[h.LUMINANCE]=t.LUMINANCE,i[h.LUMINANCE_ALPHA]=t.LUMINANCE_ALPHA,i),e[l.BYTE]=((r={})[h.RGBA]=t.RGBA8_SNORM,r[h.RGB]=t.RGB8_SNORM,r[h.RG]=t.RG8_SNORM,r[h.RED]=t.R8_SNORM,r[h.RGBA_INTEGER]=t.RGBA8I,r[h.RGB_INTEGER]=t.RGB8I,r[h.RG_INTEGER]=t.RG8I,r[h.RED_INTEGER]=t.R8I,r),e[l.UNSIGNED_SHORT]=((n={})[h.RGBA_INTEGER]=t.RGBA16UI,n[h.RGB_INTEGER]=t.RGB16UI,n[h.RG_INTEGER]=t.RG16UI,n[h.RED_INTEGER]=t.R16UI,n[h.DEPTH_COMPONENT]=t.DEPTH_COMPONENT16,n),e[l.SHORT]=((s={})[h.RGBA_INTEGER]=t.RGBA16I,s[h.RGB_INTEGER]=t.RGB16I,s[h.RG_INTEGER]=t.RG16I,s[h.RED_INTEGER]=t.R16I,s),e[l.UNSIGNED_INT]=((o={})[h.RGBA_INTEGER]=t.RGBA32UI,o[h.RGB_INTEGER]=t.RGB32UI,o[h.RG_INTEGER]=t.RG32UI,o[h.RED_INTEGER]=t.R32UI,o[h.DEPTH_COMPONENT]=t.DEPTH_COMPONENT24,o),e[l.INT]=((a={})[h.RGBA_INTEGER]=t.RGBA32I,a[h.RGB_INTEGER]=t.RGB32I,a[h.RG_INTEGER]=t.RG32I,a[h.RED_INTEGER]=t.R32I,a),e[l.FLOAT]=((u={})[h.RGBA]=t.RGBA32F,u[h.RGB]=t.RGB32F,u[h.RG]=t.RG32F,u[h.RED]=t.R32F,u[h.DEPTH_COMPONENT]=t.DEPTH_COMPONENT32F,u),e[l.HALF_FLOAT]=((c={})[h.RGBA]=t.RGBA16F,c[h.RGB]=t.RGB16F,c[h.RG]=t.RG16F,c[h.RED]=t.R16F,c),e[l.UNSIGNED_SHORT_5_6_5]=((f={})[h.RGB]=t.RGB565,f),e[l.UNSIGNED_SHORT_4_4_4_4]=((d={})[h.RGBA]=t.RGBA4,d),e[l.UNSIGNED_SHORT_5_5_5_1]=((p={})[h.RGBA]=t.RGB5_A1,p),e[l.UNSIGNED_INT_2_10_10_10_REV]=((_={})[h.RGBA]=t.RGB10_A2,_[h.RGBA_INTEGER]=t.RGB10_A2UI,_),e[l.UNSIGNED_INT_10F_11F_11F_REV]=((m={})[h.RGB]=t.R11F_G11F_B10F,m),e[l.UNSIGNED_INT_5_9_9_9_REV]=((g={})[h.RGB]=t.RGB9_E5,g),e[l.UNSIGNED_INT_24_8]=((v={})[h.DEPTH_STENCIL]=t.DEPTH24_STENCIL8,v),e[l.FLOAT_32_UNSIGNED_INT_24_8_REV]=((y={})[h.DEPTH_STENCIL]=t.DEPTH32F_STENCIL8,y),w=e):((b={})[l.UNSIGNED_BYTE]=((x={})[h.RGBA]=t.RGBA,x[h.RGB]=t.RGB,x[h.ALPHA]=t.ALPHA,x[h.LUMINANCE]=t.LUMINANCE,x[h.LUMINANCE_ALPHA]=t.LUMINANCE_ALPHA,x),b[l.UNSIGNED_SHORT_5_6_5]=((T={})[h.RGB]=t.RGB,T),b[l.UNSIGNED_SHORT_4_4_4_4]=((A={})[h.RGBA]=t.RGBA,A),b[l.UNSIGNED_SHORT_5_5_5_1]=((E={})[h.RGBA]=t.RGBA,E),w=b),w}(t);var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var i=0;i<e;i++)this.boundTextures[i]=null;this.emptyTextures={};var r=new nn(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new nn(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(i=0;i<this.boundTextures.length;i++)this.bind(null,i)},t.prototype.bind=function(t,e){void 0===e&&(e=0);var i=this.gl;if((t=null==t?void 0:t.castToBaseTexture())&&t.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;var r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null},t.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture},t.prototype.unbind=function(t){var e=this.gl,i=this.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)},t.prototype.ensureSamplerType=function(t){var e=this,i=e.boundTextures,r=e.hasIntegerTextures,n=e.CONTEXT_UID;if(r)for(var s=t-1;s>=0;--s){var o=i[s];if(o)o._glTextures[n].samplerType!==c.FLOAT&&this.renderer.texture.unbind(o)}},t.prototype.initTexture=function(t){var e=new nn(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e},t.prototype.initTextureType=function(t,e){var i,r;e.internalFormat=null!==(r=null===(i=this.internalFormats[t.type])||void 0===i?void 0:i[t.format])&&void 0!==r?r:t.format,2===this.webGLVersion&&t.type===l.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type},t.prototype.updateTexture=function(t){var e=t._glTextures[this.CONTEXT_UID];if(e){var i=this.renderer;if(this.initTextureType(t,e),t.resource&&t.resource.upload(i,t,e))e.samplerType!==c.FLOAT&&(this.hasIntegerTextures=!0);else{var r=t.realWidth,n=t.realHeight,s=i.gl;(e.width!==r||e.height!==n||e.dirtyId<0)&&(e.width=r,e.height=n,s.texImage2D(t.target,0,e.internalFormat,r,n,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}},t.prototype.destroyTexture=function(t,e){var i=this.gl;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){var r=this.managedTextures.indexOf(t);-1!==r&&ve(this.managedTextures,r,1)}},t.prototype.updateTextureStyle=function(t){var e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==p.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=d.CLAMP,t.resource&&t.resource.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)},t.prototype.setStyle=function(t,e){var i=this.gl;if(e.mipmap&&t.mipmap!==p.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===f.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===f.LINEAR){var n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===f.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===f.LINEAR?i.LINEAR:i.NEAREST)},t.prototype.destroy=function(){this.renderer=null},t}(),on=new Ve,an=function(t){function e(e,i){void 0===e&&(e=n.UNKNOWN);var r=t.call(this)||this;return i=Object.assign({},X.RENDER_OPTIONS,i),r.options=i,r.type=e,r.screen=new ke(0,0,i.width,i.height),r.view=i.view||X.ADAPTER.createCanvas(),r.resolution=i.resolution||X.RESOLUTION,r.useContextAlpha=i.useContextAlpha,r.autoDensity=!!i.autoDensity,r.preserveDrawingBuffer=i.preserveDrawingBuffer,r.clearBeforeRender=i.clearBeforeRender,r._backgroundColor=0,r._backgroundColorRgba=[0,0,0,1],r._backgroundColorString="#000000",r.backgroundColor=i.backgroundColor||r._backgroundColor,r.backgroundAlpha=i.backgroundAlpha,void 0!==i.transparent&&(Ae("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),r.useContextAlpha=i.transparent,r.backgroundAlpha=i.transparent?0:1),r._lastObjectRendered=null,r.plugins={},r}return ci(e,t),e.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(e*this.resolution);var i=this.view.width/this.resolution,r=this.view.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.view.style.width=i+"px",this.view.style.height=r+"px"),this.emit("resize",i,r)},e.prototype.generateTexture=function(t,e,i,r){void 0===e&&(e={}),"number"==typeof e&&(Ae("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),e={scaleMode:e,resolution:i,region:r});var n=e.region,s=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i}(e,["region"]);0===(r=n||t.getLocalBounds(null,!0)).width&&(r.width=1),0===r.height&&(r.height=1);var o=$i.create(fi({width:r.width,height:r.height},s));return on.tx=-r.x,on.ty=-r.y,this.render(t,{renderTexture:o,clear:!1,transform:on,skipUpdateTransform:!!t.parent}),o},e.prototype.destroy=function(t){for(var e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var i=this;i.plugins=null,i.type=n.UNKNOWN,i.view=null,i.screen=null,i._tempDisplayObjectParent=null,i.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=he(t),ae(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(t){this._backgroundColorRgba[3]=t},enumerable:!1,configurable:!0}),e}(j),hn=function(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0},un=function(){function t(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}return t.prototype.destroy=function(){this.renderer=null},t.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},t.prototype.bind=function(t){var e=this.gl,i=this.CONTEXT_UID,r=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)},t.prototype.bindBufferBase=function(t,e){var i=this.gl,r=this.CONTEXT_UID;if(this.boundBufferBases[e]!==t){var n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}},t.prototype.bindBufferRange=function(t,e,i){var r=this.gl,n=this.CONTEXT_UID;i=i||0;var s=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,s.buffer,256*i,256)},t.prototype.update=function(t){var e=this.gl,i=this.CONTEXT_UID,r=t._glBuffers[i];if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{var n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}},t.prototype.dispose=function(t,e){if(this.managedBuffers[t.id]){delete this.managedBuffers[t.id];var i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(e||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}},t.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedBuffers),i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)},t.prototype.createGLBuffer=function(t){var e=this.CONTEXT_UID,i=this.gl;return t._glBuffers[e]=new hn(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]},t}(),ln=function(t){function e(i){var r=t.call(this,n.WEBGL,i)||this;return i=r.options,r.gl=null,r.CONTEXT_UID=0,r.runners={destroy:new ni("destroy"),contextChange:new ni("contextChange"),reset:new ni("reset"),update:new ni("update"),postrender:new ni("postrender"),prerender:new ni("prerender"),resize:new ni("resize")},r.runners.contextChange.add(r),r.globalUniforms=new Yi({projectionMatrix:new Ve},!0),r.addSystem(Fr,"mask").addSystem(tr,"context").addSystem(en,"state").addSystem(tn,"shader").addSystem(sn,"texture").addSystem(un,"buffer").addSystem(sr,"geometry").addSystem(rr,"framebuffer").addSystem(Ur,"scissor").addSystem(Gr,"stencil").addSystem(Xr,"projection").addSystem(rn,"textureGC").addSystem(Zi,"filter").addSystem(jr,"renderTexture").addSystem(Ji,"batch"),r.initPlugins(e.__plugins),r.multisample=void 0,i.context?r.context.initFromContext(i.context):r.context.initFromOptions({alpha:!!r.useContextAlpha,antialias:i.antialias,premultipliedAlpha:r.useContextAlpha&&"notMultiplied"!==r.useContextAlpha,stencil:!0,preserveDrawingBuffer:i.preserveDrawingBuffer,powerPreference:r.options.powerPreference}),r.renderingToScreen=!0,function(t){var e;if(!ne){if(X.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var i=["\n %c %c %c PixiJS "+se+" - ✰ "+t+" ✰  %c  %c  http://www.pixijs.com/  %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,i)}else globalThis.console&&globalThis.console.log("PixiJS "+se+" - "+t+" - http://www.pixijs.com/");ne=!0}}(2===r.context.webGLVersion?"WebGL 2":"WebGL 1"),r.resize(r.options.width,r.options.height),r}return ci(e,t),e.create=function(t){if(void 0===re&&(re=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:X.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!X.ADAPTER.getWebGLRenderingContext())return!1;var e=X.ADAPTER.createCanvas(),i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),r=!(!i||!i.getContextAttributes().stencil);if(i){var n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch(t){return!1}}()),re)return new e(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},e.prototype.contextChange=function(){var t,e=this.gl;if(1===this.context.webGLVersion){var i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=T.HIGH?this.multisample=T.HIGH:t>=T.MEDIUM?this.multisample=T.MEDIUM:t>=T.LOW?this.multisample=T.LOW:this.multisample=T.NONE},e.prototype.addSystem=function(t,e){var i=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var r in this[e]=i,this.runners)this.runners[r].add(i);return this},e.prototype.render=function(t,e){var i,r,n,s;if(e&&(e instanceof $i?(Ae("6.0.0","Renderer#render arguments changed, use options instead."),i=e,r=arguments[2],n=arguments[3],s=arguments[4]):(i=e.renderTexture,r=e.clear,n=e.transform,s=e.skipUpdateTransform)),this.renderingToScreen=!i,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,!this.context.isLost){if(i||(this._lastObjectRendered=t),!s){var o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}this.renderTexture.bind(i),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),i&&i.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(e,i,r,n){void 0===i&&(i={});var s=t.prototype.generateTexture.call(this,e,i,r,n);return this.framebuffer.blit(),s},e.prototype.resize=function(e,i){t.prototype.resize.call(this,e,i),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(e){for(var i in this.runners.destroy.emit(),this.runners)this.runners[i].destroy();t.prototype.destroy.call(this,e),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return Ae("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(t,e){Ae("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),ri.add({name:t,type:Qe.RendererPlugin,ref:e})},e.__plugins={},e}(an);ri.handleByMap(Qe.RendererPlugin,ln.__plugins);var cn="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n    gl_Position = filterVertexPosition();\n    vTextureCoord = filterTextureCoord();\n}\n",fn=function(){this.texArray=null,this.blend=0,this.type=a.TRIANGLES,this.start=0,this.size=0,this.data=null},dn=function(){function t(){this.elements=[],this.ids=[],this.count=0}return t.prototype.clear=function(){for(var t=0;t<this.count;t++)this.elements[t]=null;this.count=0},t}(),pn=function(){function t(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}return Object.defineProperty(t.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),t.prototype.view=function(t){return this[t+"View"]},t.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},t.sizeOf=function(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(t+" isn't a valid view type")}},t}(),_n=function(t){function e(e){var i=t.call(this,e)||this;return i.shaderGenerator=null,i.geometryClass=null,i.vertexSize=null,i.state=Rr.for2d(),i.size=4*X.SPRITE_BATCH_SIZE,i._vertexCount=0,i._indexCount=0,i._bufferedElements=[],i._bufferedTextures=[],i._bufferSize=0,i._shader=null,i._packedGeometries=[],i._packedGeometryPoolSize=2,i._flushId=0,i._aBuffers={},i._iBuffers={},i.MAX_TEXTURES=1,i.renderer.on("prerender",i.onPrerender,i),e.runners.contextChange.add(i),i._dcIndex=0,i._aIndex=0,i._iIndex=0,i._attributeBuffer=null,i._indexBuffer=null,i._tempBoundTextures=[],i}return ci(e,t),e.prototype.contextChange=function(){var t=this.renderer.gl;X.PREFER_ENV===r.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),X.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=function(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var i=e.createShader(e.FRAGMENT_SHADER);;){var r=wr.replace(/%forloop%/gi,Sr(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))break;t=t/2|0}return t}(this.MAX_TEXTURES,t)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()},e.prototype.initFlushBuffers=function(){for(var t=e._drawCallPool,i=e._textureArrayPool,r=this.size/4,n=Math.floor(r/this.MAX_TEXTURES)+1;t.length<r;)t.push(new fn);for(;i.length<n;)i.push(new dn);for(var s=0;s<this.MAX_TEXTURES;s++)this._tempBoundTextures[s]=null},e.prototype.onPrerender=function(){this._flushId=0},e.prototype.render=function(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},e.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,i=this.MAX_TEXTURES,r=e._textureArrayPool,n=this.renderer.batch,s=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++mi._globalBatch,h=0,u=r[0],l=0;n.copyBoundTextures(s,i);for(var c=0;c<this._bufferSize;++c){var f=t[c];t[c]=null,f._batchEnabled!==a&&(u.count>=i&&(n.boundArray(u,s,a,i),this.buildDrawCalls(u,l,c),l=c,u=r[++h],++a),f._batchEnabled=a,f.touched=o,u.elements[u.count++]=f)}u.count>0&&(n.boundArray(u,s,a,i),this.buildDrawCalls(u,l,this._bufferSize),++h,++a);for(c=0;c<s.length;c++)s[c]=null;mi._globalBatch=a},e.prototype.buildDrawCalls=function(t,i,r){var n=this,s=n._bufferedElements,o=n._attributeBuffer,a=n._indexBuffer,h=n.vertexSize,u=e._drawCallPool,l=this._dcIndex,c=this._aIndex,f=this._iIndex,d=u[l];d.start=this._iIndex,d.texArray=t;for(var p=i;p<r;++p){var _=s[p],m=_._texture.baseTexture,g=le[m.alphaMode?1:0][_.blendMode];s[p]=null,i<p&&d.blend!==g&&(d.size=f-d.start,i=p,(d=u[++l]).texArray=t,d.start=f),this.packInterleavedGeometry(_,o,a,c,f),c+=_.vertexData.length/2*h,f+=_.indices.length,d.blend=g}i<r&&(d.size=f-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=f},e.prototype.bindAndClearTexArray=function(t){for(var e=this.renderer.texture,i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0},e.prototype.updateGeometry=function(){var t=this,e=t._packedGeometries,i=t._attributeBuffer,r=t._indexBuffer;X.CAN_UPLOAD_SAME_BUFFER?(e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},e.prototype.drawBatches=function(){for(var t=this._dcIndex,i=this.renderer,r=i.gl,n=i.state,s=e._drawCallPool,o=null,a=0;a<t;a++){var h=s[a],u=h.texArray,l=h.type,c=h.size,f=h.start,d=h.blend;o!==u&&(o=u,this.bindAndClearTexArray(u)),this.state.blendMode=d,n.set(this.state),r.drawElements(l,c,r.UNSIGNED_SHORT,2*f)}},e.prototype.flush=function(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},e.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),X.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},e.prototype.stop=function(){this.flush()},e.prototype.destroy=function(){for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),t.prototype.destroy.call(this)},e.prototype.getAttributeBuffer=function(t){var e=_e(Math.ceil(t/8)),i=ge(e),r=8*e;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);var n=this._aBuffers[r];return n||(this._aBuffers[r]=n=new pn(r*this.vertexSize*4)),n},e.prototype.getIndexBuffer=function(t){var e=_e(Math.ceil(t/12)),i=ge(e),r=12*e;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);var n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(r)),n},e.prototype.packInterleavedGeometry=function(t,e,i,r,n){for(var s=e.uint32View,o=e.float32View,a=r/this.vertexSize,h=t.uvs,u=t.indices,l=t.vertexData,c=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),d=f<1&&t._texture.baseTexture.alphaMode?fe(t._tintRGB,f):t._tintRGB+(255*f<<24),p=0;p<l.length;p+=2)o[r++]=l[p],o[r++]=l[p+1],o[r++]=h[p],o[r++]=h[p+1],s[r++]=d,o[r++]=c;for(p=0;p<u.length;p++)i[n++]=a+u[p]},e._drawCallPool=[],e._textureArrayPool=[],e}(Qi),mn=function(){function t(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},e.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(e.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return t.prototype.generateShader=function(t){if(!this.programCache[t]){for(var e=new Int32Array(t),i=0;i<t;i++)e[i]=i;this.defaultGroupCache[t]=Yi.from({uSamplers:e},!0);var r=this.fragTemplate;r=(r=r.replace(/%count%/gi,""+t)).replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new Ir(this.vertexSrc,r)}var n={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ve,default:this.defaultGroupCache[t]};return new Cr(this.programCache[t],n)},t.prototype.generateSampleSrc=function(t){var e="";e+="\n",e+="\n";for(var i=0;i<t;i++)i>0&&(e+="\nelse "),i<t-1&&(e+="if(vTextureId < "+i+".5)"),e+="\n{",e+="\n\tcolor = texture2D(uSamplers["+i+"], vTextureCoord);",e+="\n}";return e+="\n",e+="\n"},t}(),gn=function(t){function e(e){void 0===e&&(e=!1);var i=t.call(this)||this;return i._buffer=new ki(null,e,!1),i._indexBuffer=new ki(null,e,!0),i.addAttribute("aVertexPosition",i._buffer,2,!1,l.FLOAT).addAttribute("aTextureCoord",i._buffer,2,!1,l.FLOAT).addAttribute("aColor",i._buffer,4,!0,l.UNSIGNED_BYTE).addAttribute("aTextureId",i._buffer,1,!0,l.FLOAT).addIndex(i._indexBuffer),i}return ci(e,t),e}(Xi),vn="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vTextureId = aTextureId;\n    vColor = aColor * tint;\n}\n",yn="varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n    vec4 color;\n    %forloop%\n    gl_FragColor = color * vColor;\n}\n",bn=function(){function t(){}return t.create=function(t){var e=Object.assign({vertex:vn,fragment:yn,geometryClass:gn,vertexSize:6},t),i=e.vertex,r=e.fragment,n=e.vertexSize,s=e.geometryClass;return function(t){function e(e){var o=t.call(this,e)||this;return o.shaderGenerator=new mn(i,r),o.geometryClass=s,o.vertexSize=n,o}return ci(e,t),e}(_n)},Object.defineProperty(t,"defaultVertexSrc",{get:function(){return vn},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentTemplate",{get:function(){return yn},enumerable:!1,configurable:!0}),t}(),xn=bn.create();Object.assign(xn,{extension:{name:"batch",type:Qe.RendererPlugin}}),
/*!
   * @pixi/display - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/display is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
X.SORTABLE_CHILDREN=!1;var Tn=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?ke.EMPTY:((t=t||new ke(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addPointMatrix=function(t,e){var i=t.a,r=t.b,n=t.c,s=t.d,o=t.tx,a=t.ty,h=i*e.x+n*e.y+o,u=r*e.x+s*e.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)},t.prototype.addQuad=function(t){var e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,s=t[0],o=t[1];e=s<e?s:e,i=o<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[2])<e?s:e,i=(o=t[3])<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[4])<e?s:e,i=(o=t[5])<i?o:i,r=s>r?s:r,n=o>n?o:n,e=(s=t[6])<e?s:e,i=(o=t[7])<i?o:i,r=s>r?s:r,n=o>n?o:n,this.minX=e,this.minY=i,this.maxX=r,this.maxY=n},t.prototype.addFrame=function(t,e,i,r,n){this.addFrameMatrix(t.worldTransform,e,i,r,n)},t.prototype.addFrameMatrix=function(t,e,i,r,n){var s=t.a,o=t.b,a=t.c,h=t.d,u=t.tx,l=t.ty,c=this.minX,f=this.minY,d=this.maxX,p=this.maxY,_=s*e+a*i+u,m=o*e+h*i+l;c=_<c?_:c,f=m<f?m:f,d=_>d?_:d,p=m>p?m:p,c=(_=s*r+a*i+u)<c?_:c,f=(m=o*r+h*i+l)<f?m:f,d=_>d?_:d,p=m>p?m:p,c=(_=s*e+a*n+u)<c?_:c,f=(m=o*e+h*n+l)<f?m:f,d=_>d?_:d,p=m>p?m:p,c=(_=s*r+a*n+u)<c?_:c,f=(m=o*r+h*n+l)<f?m:f,d=_>d?_:d,p=m>p?m:p,this.minX=c,this.minY=f,this.maxX=d,this.maxY=p},t.prototype.addVertexData=function(t,e,i){for(var r=this.minX,n=this.minY,s=this.maxX,o=this.maxY,a=e;a<i;a+=2){var h=t[a],u=t[a+1];r=h<r?h:r,n=u<n?u:n,s=h>s?h:s,o=u>o?u:o}this.minX=r,this.minY=n,this.maxX=s,this.maxY=o},t.prototype.addVertices=function(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)},t.prototype.addVerticesMatrix=function(t,e,i,r,n,s){void 0===n&&(n=0),void 0===s&&(s=n);for(var o=t.a,a=t.b,h=t.c,u=t.d,l=t.tx,c=t.ty,f=this.minX,d=this.minY,p=this.maxX,_=this.maxY,m=i;m<r;m+=2){var g=e[m],v=e[m+1],y=o*g+h*v+l,b=u*v+a*g+c;f=Math.min(f,y-n),p=Math.max(p,y+n),d=Math.min(d,b-s),_=Math.max(_,b+s)}this.minX=f,this.minY=d,this.maxX=p,this.maxY=_},t.prototype.addBounds=function(t){var e=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n},t.prototype.addBoundsMask=function(t,e){var i=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,s=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&r<=s){var o=this.minX,a=this.minY,h=this.maxX,u=this.maxY;this.minX=i<o?i:o,this.minY=r<a?r:a,this.maxX=n>h?n:h,this.maxY=s>u?s:u}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var i=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,s=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&r<=s){var o=this.minX,a=this.minY,h=this.maxX,u=this.maxY;this.minX=i<o?i:o,this.minY=r<a?r:a,this.maxX=n>h?n:h,this.maxY=s>u?s:u}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,i,r,n,s){t-=n,e-=s,i+=n,r+=s,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r},t}(),An=function(t,e){return An=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},An(t,e)};
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */function En(t,e){function i(){this.constructor=t}An(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var wn=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new Ke,e.alpha=1,e.visible=!0,e.renderable=!0,e.cullable=!1,e.cullArea=null,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new Tn,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._maskRefCount=0,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return En(e,t),e.mixin=function(t){for(var i=Object.keys(t),r=0;r<i.length;++r){var n=i[r];Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t,n))}},Object.defineProperty(e.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),e.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},e.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},e.prototype.getBounds=function(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new ke),e=this._boundsRect),this._bounds.getRectangle(e)},e.prototype.getLocalBounds=function(t){t||(this._localBoundsRect||(this._localBoundsRect=new ke),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Tn);var e=this.transform,i=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;var s=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,s},e.prototype.toGlobal=function(t,e,i){return void 0===i&&(i=!1),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)},e.prototype.toLocal=function(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)},e.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},e.prototype.setTransform=function(t,e,i,r,n,s,o,a,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=1),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=s,this.skew.y=o,this.pivot.x=a,this.pivot.y=h,this},e.prototype.destroy=function(t){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()},Object.defineProperty(e.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new Sn),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),e.prototype.enableTempParent=function(){var t=this.parent;return this.parent=this._tempDisplayObjectParent,t},e.prototype.disableTempParent=function(t){this.parent=t},Object.defineProperty(e.prototype,"x",{get:function(){return this.position.x},set:function(t){this.transform.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.position.y},set:function(t){this.transform.position.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(t){this.transform.pivot.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.rotation=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.transform.rotation*$e},set:function(t){this.transform.rotation=t*De},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._mask},set:function(t){if(this._mask!==t){var e;if(this._mask)(e=this._mask.isMaskData?this._mask.maskObject:this._mask)&&(e._maskRefCount--,0===e._maskRefCount&&(e.renderable=!0,e.isMask=!1));if(this._mask=t,this._mask)(e=this._mask.isMaskData?this._mask.maskObject:this._mask)&&(0===e._maskRefCount&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}},enumerable:!1,configurable:!0}),e}(j),Sn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.sortDirty=null,e}return En(e,t),e}(wn);function Pn(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}wn.prototype.displayObjectUpdateTransform=wn.prototype.updateTransform;var Mn=function(t){function e(){var e=t.call(this)||this;return e.children=[],e.sortableChildren=X.SORTABLE_CHILDREN,e.sortDirty=!1,e}return En(e,t),e.prototype.onChildrenChange=function(t){},e.prototype.addChild=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];if(e.length>1)for(var r=0;r<e.length;r++)this.addChild(e[r]);else{var n=e[0];n.parent&&n.parent.removeChild(n),n.parent=this,this.sortDirty=!0,n.transform._parentID=-1,this.children.push(n),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",n,this,this.children.length-1),n.emit("added",this)}return e[0]},e.prototype.addChildAt=function(t,e){if(e<0||e>this.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},e.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t,this.onChildrenChange(i<r?i:r)}},e.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},e.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(t);ve(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];if(e.length>1)for(var r=0;r<e.length;r++)this.removeChild(e[r]);else{var n=e[0],s=this.children.indexOf(n);if(-1===s)return null;n.parent=null,n.transform._parentID=-1,ve(this.children,s,1),this._boundsID++,this.onChildrenChange(s),n.emit("removed",this),this.emit("childRemoved",n,this,s)}return e[0]},e.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,ve(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e},e.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i,r=t,n=e-r;if(n>0&&n<=e){i=this.children.splice(r,n);for(var s=0;s<i.length;++s)i[s].parent=null,i[s].transform&&(i[s].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(s=0;s<i.length;++s)i[s].emit("removed",this),this.emit("childRemoved",i[s],this,s);return i}if(0===n&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},e.prototype.sortChildren=function(){for(var t=!1,e=0,i=this.children.length;e<i;++e){var r=this.children[e];r._lastSortedIndex=e,t||0===r.zIndex||(t=!0)}t&&this.children.length>1&&this.children.sort(Pn),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t<e;++t){var i=this.children[t];i.visible&&i.updateTransform()}},e.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var e=this.children[t];if(e.visible&&e.renderable)if(e.calculateBounds(),e._mask){var i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID},e.prototype.getLocalBounds=function(e,i){void 0===i&&(i=!1);var r=t.prototype.getLocalBounds.call(this,e);if(!i)for(var n=0,s=this.children.length;n<s;++n){var o=this.children[n];o.visible&&o.updateTransform()}return r},e.prototype._calculateBounds=function(){},e.prototype._renderWithCulling=function(t){var i=t.renderTexture.sourceFrame;if(i.width>0&&i.height>0){var r,n;if(this.cullArea?(r=this.cullArea,n=this.worldTransform):this._render!==e.prototype._render&&(r=this.getBounds(!0)),r&&i.intersects(r,n))this._render(t);else if(this.cullArea)return;for(var s=0,o=this.children.length;s<o;++s){var a=this.children[s],h=a.cullable;a.cullable=h||!this.cullArea,a.render(t),a.cullable=h}}},e.prototype.render=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(var e=0,i=this.children.length;e<i;++e)this.children[e].render(t)}},e.prototype.renderAdvanced=function(t){var e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var r=0;r<e.length;r++)e[r].enabled&&this._enabledFilters.push(e[r])}var n=e&&this._enabledFilters&&this._enabledFilters.length||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==b.NONE));if(n&&t.batch.flush(),e&&this._enabledFilters&&this._enabledFilters.length&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);r=0;for(var s=this.children.length;r<s;++r)this.children[r].render(t)}n&&t.batch.flush(),i&&t.mask.pop(this),e&&this._enabledFilters&&this._enabledFilters.length&&t.filter.pop()},e.prototype._render=function(t){},e.prototype.destroy=function(e){t.prototype.destroy.call(this),this.sortDirty=!1;var i="boolean"==typeof e?e:e&&e.children,r=this.removeChildren(0,this.children.length);if(i)for(var n=0;n<r.length;++n)r[n].destroy(e)},Object.defineProperty(e.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(t){var e=this.getLocalBounds().width;this.scale.x=0!==e?t/e:1,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(t){var e=this.getLocalBounds().height;this.scale.y=0!==e?t/e:1,this._height=t},enumerable:!1,configurable:!0}),e}(wn);Mn.prototype.containerUpdateTransform=Mn.prototype.updateTransform;var In=Math.pow,Cn=(t,e,i)=>new Promise((r,n)=>{var s=t=>{try{a(i.next(t))}catch(t){n(t)}},o=t=>{try{a(i.throw(t))}catch(t){n(t)}},a=t=>t.done?r(t.value):Promise.resolve(t.value).then(s,o);a((i=i.apply(t,e)).next())});var Rn,On,$n,Dn;(On=Rn||(Rn={})).supportMoreMaskDivisions=!0,On.setOpacityFromMotion=!1,(Dn=$n||($n={})).LOG_LEVEL_VERBOSE=0,Dn.LOG_LEVEL_WARNING=1,Dn.LOG_LEVEL_ERROR=2,Dn.LOG_LEVEL_NONE=999,Dn.logLevel=Dn.LOG_LEVEL_WARNING,Dn.sound=!0,Dn.motionSync=!0,Dn.motionFadingDuration=500,Dn.idleMotionFadingDuration=2e3,Dn.expressionFadingDuration=500,Dn.preserveExpressionOnMotion=!0,Dn.cubism4=Rn;const Ln={log(t,...e){$n.logLevel<=$n.LOG_LEVEL_VERBOSE&&console.log(`[${t}]`,...e)},warn(t,...e){$n.logLevel<=$n.LOG_LEVEL_WARNING&&console.warn(`[${t}]`,...e)},error(t,...e){$n.logLevel<=$n.LOG_LEVEL_ERROR&&console.error(`[${t}]`,...e)}};function Fn(t,e,i){return t<e?e:t>i?i:t}function kn(t,e,i,r,n){const s=e[r];null!==s&&typeof s===t&&(i[n]=s)}function Bn(t,e,i,r,n){const s=e[r];Array.isArray(s)&&(i[n]=s.filter(e=>null!==e&&typeof e===t))}function Nn(t,e){e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(i=>{"constructor"!==i&&Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))})})}class Un extends j{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return Cn(this,null,function*(){if(!this.definitions[t])return void Ln.warn(this.tag,`Undefined expression at [${t}]`);if(null===this.expressions[t])return void Ln.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e})}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return Cn(this,null,function*(){if(this.definitions.length){const t=[];for(let e=0;e<this.definitions.length;e++)null!==this.expressions[e]&&this.expressions[e]!==this.currentExpression&&e!==this.reserveExpressionIndex&&t.push(e);if(t.length){const e=Math.floor(Math.random()*t.length);return this.setExpression(e)}}return!1})}resetExpression(){this._setExpression(this.defaultExpression)}restoreExpression(){this._setExpression(this.currentExpression)}setExpression(t){return Cn(this,null,function*(){if("number"!=typeof t&&(t=this.getExpressionIndex(t)),!(t>-1&&t<this.definitions.length))return!1;if(t===this.expressions.indexOf(this.currentExpression))return!1;this.reserveExpressionIndex=t;const e=yield this.loadExpression(t);return!(!e||this.reserveExpressionIndex!==t)&&(this.reserveExpressionIndex=-1,this.currentExpression=e,this._setExpression(e),!0)})}update(t,e){return!this.isFinished()&&this.updateParameters(t,e)}destroy(){this.destroyed=!0,this.emit("destroy");this.definitions=void 0,this.expressions=void 0}}const Gn=40/7.5,Xn=1/150;class Vn{constructor(){this.targetX=0,this.targetY=0,this.x=0,this.y=0,this.vx=0,this.vy=0}focus(t,e,i=!1){this.targetX=Fn(t,-1,1),this.targetY=Fn(e,-1,1),i&&(this.x=this.targetX,this.y=this.targetY)}update(t){const e=this.targetX-this.x,i=this.targetY-this.y;if(Math.abs(e)<.01&&Math.abs(i)<.01)return;const r=Math.sqrt(In(e,2)+In(i,2)),n=Gn/(1e3/t);let s=n*(e/r)-this.vx,o=n*(i/r)-this.vy;const a=Math.sqrt(In(s,2)+In(o,2)),h=n*Xn*t;a>h&&(s*=h/a,o*=h/a),this.vx+=s,this.vy+=o;const u=Math.sqrt(In(this.vx,2)+In(this.vy,2)),l=.5*(Math.sqrt(In(h,2)+8*h*r)-h);u>l&&(this.vx*=l/u,this.vy*=l/u),this.x+=this.vx,this.y+=this.vy}}class Hn{constructor(t){this.json=t;let e=t.url;if("string"!=typeof e)throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=function(t){let e=t.lastIndexOf("/");return-1!=e&&(t=t.slice(0,e)),e=t.lastIndexOf("/"),-1!==e&&(t=t.slice(e+1)),t}(this.url)}resolveURL(t){return ie.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),void 0!==this.pose&&(this.pose=t(this.pose,"pose")),void 0!==this.physics&&(this.physics=t(this.physics,"physics"));for(let e=0;e<this.textures.length;e++)this.textures[e]=t(this.textures[e],`textures[${e}]`)}getDefinedFiles(){const t=[];return this.replaceFiles(e=>(t.push(e),e)),t}validateFiles(t){const e=(e,i)=>{const r=this.resolveURL(e);if(!t.includes(r)){if(i)throw new Error(`File "${e}" is defined in settings, but doesn't exist in given files`);return!1}return!0};[this.moc,...this.textures].forEach(t=>e(t,!0));return this.getDefinedFiles().filter(t=>e(t,!1))}}var jn=(t=>(t[t.NONE=0]="NONE",t[t.IDLE=1]="IDLE",t[t.NORMAL=2]="NORMAL",t[t.FORCE=3]="FORCE",t))(jn||{});class Yn{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,i){if(i<=0)return Ln.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return Ln.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return Ln.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(1===i){if(0!==this.currentPriority)return Ln.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(void 0!==this.reservedIdleGroup)return Ln.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(i<3){if(i<=this.currentPriority)return Ln.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(i<=this.reservePriority)return Ln.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,i)}return!0}start(t,e,i,r){if(1===r){if(this.setReservedIdle(void 0,void 0),0!==this.currentPriority)return Ln.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,i)),!1}else{if(e!==this.reservedGroup||i!==this.reservedIndex)return Ln.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,i)),!1;this.setReserved(void 0,void 0,0)}return!!t&&(this.setCurrent(e,i,r),!0)}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,i){this.currentPriority=i,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,i){this.reservePriority=i,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return void 0===this.currentGroup&&void 0===this.reservedIdleGroup}shouldOverrideExpression(){return!$n.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){return`\n<Requested> group = "${t}", index = ${e}\n`+["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"].map(t=>"["+t+"] "+this[t]).join("\n")}return""}}class zn{static get volume(){return this._volume}static set volume(t){this._volume=(t>1?1:t<0?0:t)||0,this.audios.forEach(t=>t.volume=this._volume)}static add(t,e,i){const r=new Audio(t);return r.volume=this._volume,r.preload="auto",r.addEventListener("ended",()=>{this.dispose(r),null==e||e()}),r.addEventListener("error",e=>{this.dispose(r),Ln.warn("SoundManager",`Error occurred on "${t}"`,e.error),null==i||i(e.error)}),this.audios.push(r),r}static play(t){return new Promise((e,i)=>{var r;null==(r=t.play())||r.catch(e=>{t.dispatchEvent(new ErrorEvent("error",{error:e})),i(e)}),t.readyState===t.HAVE_ENOUGH_DATA?e():t.addEventListener("canplaythrough",e)})}static dispose(t){t.pause(),t.removeAttribute("src"),function(t,e){const i=t.indexOf(e);-1!==i&&t.splice(i,1)}(this.audios,t)}static destroy(){for(let t=this.audios.length-1;t>=0;t--)this.dispose(this.audios[t])}}zn.audios=[],zn._volume=.5;var Wn=(t=>(t.ALL="ALL",t.IDLE="IDLE",t.NONE="NONE",t))(Wn||{});class qn extends j{constructor(t,e){super(),this.motionGroups={},this.state=new Yn,this.playing=!1,this.destroyed=!1,this.settings=t,this.tag=`MotionManager(${t.name})`,this.state.tag=this.tag}init(t){(null==t?void 0:t.idleMotionGroup)&&(this.groups.idle=t.idleMotionGroup),this.setupMotions(t),this.stopAllMotions()}setupMotions(t){for(const t of Object.keys(this.definitions))this.motionGroups[t]=[];let e;switch(null==t?void 0:t.motionPreload){case"NONE":return;case"ALL":e=Object.keys(this.definitions);break;default:e=[this.groups.idle]}for(const t of e)if(this.definitions[t])for(let e=0;e<this.definitions[t].length;e++)this.loadMotion(t,e).then()}loadMotion(t,e){return Cn(this,null,function*(){var i;if(!(null==(i=this.definitions[t])?void 0:i[e]))return void Ln.warn(this.tag,`Undefined motion at "${t}"[${e}]`);if(null===this.motionGroups[t][e])return void Ln.warn(this.tag,`Cannot start motion at "${t}"[${e}] because it's already failed in loading.`);if(this.motionGroups[t][e])return this.motionGroups[t][e];const r=yield this._loadMotion(t,e);return this.destroyed?void 0:(this.motionGroups[t][e]=null!=r?r:null,r)})}_loadMotion(t,e){throw new Error("Not implemented.")}startMotion(t,e){return Cn(this,arguments,function*(t,e,i=jn.NORMAL){var r;if(!this.state.reserve(t,e,i))return!1;const n=null==(r=this.definitions[t])?void 0:r[e];if(!n)return!1;let s;if(this.currentAudio&&zn.dispose(this.currentAudio),$n.sound){const t=this.getSoundFile(n);if(t)try{s=zn.add(this.settings.resolveURL(t),()=>this.currentAudio=void 0,()=>this.currentAudio=void 0),this.currentAudio=s}catch(e){Ln.warn(this.tag,"Failed to create audio",t,e)}}const o=yield this.loadMotion(t,e);if(s){const t=zn.play(s).catch(t=>Ln.warn(this.tag,"Failed to play audio",s.src,t));$n.motionSync&&(yield t)}return this.state.start(o,t,e,i)?(Ln.log(this.tag,"Start motion:",this.getMotionName(n)),this.emit("motionStart",t,e,s),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(o),!0):(s&&(zn.dispose(s),this.currentAudio=void 0),!1)})}startRandomMotion(t,e){return Cn(this,null,function*(){const i=this.definitions[t];if(null==i?void 0:i.length){const r=[];for(let e=0;e<i.length;e++)null===this.motionGroups[t][e]||this.state.isActive(t,e)||r.push(e);if(r.length){const i=Math.floor(Math.random()*r.length);return this.startMotion(t,r[i],e)}}return!1})}stopAllMotions(){this._stopAllMotions(),this.state.reset(),this.currentAudio&&(zn.dispose(this.currentAudio),this.currentAudio=void 0)}update(t,e){var i;return this.isFinished()&&(this.playing&&(this.playing=!1,this.emit("motionFinish")),this.state.shouldOverrideExpression()&&(null==(i=this.expressionManager)||i.restoreExpression()),this.state.complete(),this.state.shouldRequestIdleMotion()&&this.startRandomMotion(this.groups.idle,jn.IDLE)),this.updateParameters(t,e)}destroy(){var t;this.destroyed=!0,this.emit("destroy"),this.stopAllMotions(),null==(t=this.expressionManager)||t.destroy();this.definitions=void 0,this.motionGroups=void 0}}const Zn={x:0,y:0,width:0,height:0};class Qn extends j{constructor(){super(...arguments),this.focusController=new Vn,this.originalWidth=0,this.originalHeight=0,this.width=0,this.height=0,this.localTransform=new Ve,this.drawingMatrix=new Ve,this.hitAreas={},this.textureFlipY=!1,this.viewport=[0,0,0,0],this.destroyed=!1}init(){this.setupLayout(),this.setupHitAreas()}setupLayout(){const t=this,e=this.getSize();t.originalWidth=e[0],t.originalHeight=e[1];const i=Object.assign({width:2,height:2},this.getLayout());this.localTransform.scale(i.width/2,i.height/2),t.width=this.originalWidth*this.localTransform.a,t.height=this.originalHeight*this.localTransform.d;const r=void 0!==i.x&&i.x-i.width/2||void 0!==i.centerX&&i.centerX||void 0!==i.left&&i.left-i.width/2||void 0!==i.right&&i.right+i.width/2||0,n=void 0!==i.y&&i.y-i.height/2||void 0!==i.centerY&&i.centerY||void 0!==i.top&&i.top-i.height/2||void 0!==i.bottom&&i.bottom+i.height/2||0;this.localTransform.translate(this.width*r,-this.height*n)}setupHitAreas(){const t=this.getHitAreaDefs().filter(t=>t.index>=0);for(const e of t)this.hitAreas[e.name]=e}hitTest(t,e){return Object.keys(this.hitAreas).filter(i=>this.isHit(i,t,e))}isHit(t,e,i){if(!this.hitAreas[t])return!1;const r=this.hitAreas[t].index,n=this.getDrawableBounds(r,Zn);return n.x<=e&&e<=n.x+n.width&&n.y<=i&&i<=n.y+n.height}getDrawableBounds(t,e){const i=this.getDrawableVertices(t);let r=i[0],n=i[0],s=i[1],o=i[1];for(let t=0;t<i.length;t+=2){const e=i[t],a=i[t+1];r=Math.min(e,r),n=Math.max(e,n),s=Math.min(a,s),o=Math.max(a,o)}return null!=e||(e={}),e.x=r,e.y=s,e.width=n-r,e.height=o-s,e}updateTransform(t){this.drawingMatrix.copyFrom(t).append(this.localTransform)}update(t,e){this.focusController.update(t)}destroy(){this.destroyed=!0,this.emit("destroy"),this.motionManager.destroy(),this.motionManager=void 0}}class Jn extends Error{constructor(t,e,i,r=!1){super(t),this.url=e,this.status=i,this.aborted=r}}const Kn=class{static createXHR(t,e,i,r,n){const s=new XMLHttpRequest;if(Kn.allXhrSet.add(s),t){let e=Kn.xhrMap.get(t);e?e.add(s):(e=new Set([s]),Kn.xhrMap.set(t,e)),t.listeners("destroy").includes(Kn.cancelXHRs)||t.once("destroy",Kn.cancelXHRs)}return s.open("GET",e),s.responseType=i,s.onload=()=>{200!==s.status&&0!==s.status||!s.response?s.onerror():r(s.response)},s.onerror=()=>{Ln.warn("XHRLoader",`Failed to load resource as ${s.responseType} (Status ${s.status}): ${e}`),n(new Jn("Network error.",e,s.status))},s.onabort=()=>n(new Jn("Aborted.",e,s.status,!0)),s.onloadend=()=>{var e;Kn.allXhrSet.delete(s),t&&(null==(e=Kn.xhrMap.get(t))||e.delete(s))},s}static cancelXHRs(){var t;null==(t=Kn.xhrMap.get(this))||t.forEach(t=>{t.abort(),Kn.allXhrSet.delete(t)}),Kn.xhrMap.delete(this)}static release(){Kn.allXhrSet.forEach(t=>t.abort()),Kn.allXhrSet.clear(),Kn.xhrMap=new WeakMap}};let ts=Kn;function es(t,e){let i=-1;return function r(n,s){if(s)return Promise.reject(s);if(n<=i)return Promise.reject(new Error("next() called multiple times"));i=n;const o=t[n];if(!o)return Promise.resolve();try{return Promise.resolve(o(e,r.bind(null,n+1)))}catch(t){return Promise.reject(t)}}(0)}ts.xhrMap=new WeakMap,ts.allXhrSet=new Set,ts.loader=(t,e)=>new Promise((e,i)=>{Kn.createXHR(t.target,t.settings?t.settings.resolveURL(t.url):t.url,t.type,i=>{t.result=i,e()},i).send()});class is{static load(t){return es(this.middlewares,t).then(()=>t.result)}}is.middlewares=[ts.loader];const rs="Live2DFactory",ns=(t,e)=>Cn(void 0,null,function*(){if("string"==typeof t.source){const e=yield is.load({url:t.source,type:"json",target:t.live2dModel});e.url=t.source,t.source=e,t.live2dModel.emit("settingsJSONLoaded",e)}return e()}),ss=(t,e)=>Cn(void 0,null,function*(){if(t.source instanceof Hn)return t.settings=t.source,e();if("object"==typeof t.source){const i=cs.findRuntime(t.source);if(i){const r=i.createModelSettings(t.source);return t.settings=r,t.live2dModel.emit("settingsLoaded",r),e()}}throw new TypeError("Unknown settings format.")}),os=(t,e)=>{if(t.settings){const i=cs.findRuntime(t.settings);if(i)return i.ready().then(e)}return e()},as=(t,e)=>Cn(void 0,null,function*(){yield e();const i=t.internalModel;if(i){const e=t.settings,r=cs.findRuntime(e);if(r){const n=[];e.pose&&n.push(is.load({settings:e,url:e.pose,type:"json",target:i}).then(e=>{i.pose=r.createPose(i.coreModel,e),t.live2dModel.emit("poseLoaded",i.pose)}).catch(e=>{t.live2dModel.emit("poseLoadError",e),Ln.warn(rs,"Failed to load pose.",e)})),e.physics&&n.push(is.load({settings:e,url:e.physics,type:"json",target:i}).then(e=>{i.physics=r.createPhysics(i.coreModel,e),t.live2dModel.emit("physicsLoaded",i.physics)}).catch(e=>{t.live2dModel.emit("physicsLoadError",e),Ln.warn(rs,"Failed to load physics.",e)})),n.length&&(yield Promise.all(n))}}}),hs=(t,e)=>Cn(void 0,null,function*(){if(!t.settings)throw new TypeError("Missing settings.");{const i=t.live2dModel,r=t.settings.textures.map(e=>function(t,e={}){const i={resourceOptions:{crossorigin:e.crossOrigin}};if(Oi.fromURL)return Oi.fromURL(t,i).catch(t=>{if(t instanceof Error)throw t;const e=new Error("Texture loading error");throw e.event=t,e});i.resourceOptions.autoLoad=!1;const r=Oi.from(t,i);if(r.baseTexture.valid)return Promise.resolve(r);const n=r.baseTexture.resource;return null!=n._live2d_load||(n._live2d_load=new Promise((t,e)=>{const i=t=>{n.source.removeEventListener("error",i);const r=new Error("Texture loading error");r.event=t,e(r)};n.source.addEventListener("error",i),n.load().then(()=>t(r)).catch(i)})),n._live2d_load}(t.settings.resolveURL(e),{crossOrigin:t.options.crossOrigin}));if(yield e(),!t.internalModel)throw new TypeError("Missing internal model.");i.internalModel=t.internalModel,i.emit("modelLoaded",t.internalModel),i.textures=yield Promise.all(r),i.emit("textureLoaded",i.textures)}}),us=(t,e)=>Cn(void 0,null,function*(){const i=t.settings;if(i instanceof Hn){const r=cs.findRuntime(i);if(!r)throw new TypeError("Unknown model settings.");const n=yield is.load({settings:i,url:i.moc,type:"arraybuffer",target:t.live2dModel});if(!r.isValidMoc(n))throw new Error("Invalid moc data");const s=r.createCoreModel(n);return t.internalModel=r.createInternalModel(s,i,t.options),e()}throw new TypeError("Missing settings.")}),ls=class{static registerRuntime(t){ls.runtimes.push(t),ls.runtimes.sort((t,e)=>e.version-t.version)}static findRuntime(t){for(const e of ls.runtimes)if(e.test(t))return e}static setupLive2DModel(t,e,i){return Cn(this,null,function*(){const r=new Promise(e=>t.once("textureLoaded",e)),n=new Promise(e=>t.once("modelLoaded",e)),s=Promise.all([r,n]).then(()=>t.emit("ready"));yield es(ls.live2DModelMiddlewares,{live2dModel:t,source:e,options:i||{}}),yield s,t.emit("load")})}static loadMotion(t,e,i){var r;const n=r=>t.emit("motionLoadError",e,i,r);try{const s=null==(r=t.definitions[e])?void 0:r[i];if(!s)return Promise.resolve(void 0);t.listeners("destroy").includes(ls.releaseTasks)||t.once("destroy",ls.releaseTasks);let o=ls.motionTasksMap.get(t);o||(o={},ls.motionTasksMap.set(t,o));let a=o[e];a||(a=[],o[e]=a);const h=t.getMotionFile(s);return null!=a[i]||(a[i]=is.load({url:h,settings:t.settings,type:t.motionDataType,target:t}).then(r=>{var n;const o=null==(n=ls.motionTasksMap.get(t))?void 0:n[e];o&&delete o[i];const a=t.createMotion(r,e,s);return t.emit("motionLoaded",e,i,a),a}).catch(e=>{Ln.warn(t.tag,`Failed to load motion: ${h}\n`,e),n(e)})),a[i]}catch(r){Ln.warn(t.tag,`Failed to load motion at "${e}"[${i}]\n`,r),n(r)}return Promise.resolve(void 0)}static loadExpression(t,e){const i=i=>t.emit("expressionLoadError",e,i);try{const r=t.definitions[e];if(!r)return Promise.resolve(void 0);t.listeners("destroy").includes(ls.releaseTasks)||t.once("destroy",ls.releaseTasks);let n=ls.expressionTasksMap.get(t);n||(n=[],ls.expressionTasksMap.set(t,n));const s=t.getExpressionFile(r);return null!=n[e]||(n[e]=is.load({url:s,settings:t.settings,type:"json",target:t}).then(i=>{const n=ls.expressionTasksMap.get(t);n&&delete n[e];const s=t.createExpression(i,r);return t.emit("expressionLoaded",e,s),s}).catch(e=>{Ln.warn(t.tag,`Failed to load expression: ${s}\n`,e),i(e)})),n[e]}catch(r){Ln.warn(t.tag,`Failed to load expression at [${e}]\n`,r),i(r)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof qn?ls.motionTasksMap.delete(this):ls.expressionTasksMap.delete(this)}};let cs=ls;cs.runtimes=[],cs.urlToJSON=ns,cs.jsonToSettings=ss,cs.waitUntilReady=os,cs.setupOptionals=as,cs.setupEssentials=hs,cs.createInternalModel=us,cs.live2DModelMiddlewares=[ns,ss,os,as,hs,us],cs.motionTasksMap=new WeakMap,cs.expressionTasksMap=new WeakMap,qn.prototype._loadMotion=function(t,e){return cs.loadMotion(this,t,e)},Un.prototype._loadExpression=function(t){return cs.loadExpression(this,t)};function fs(t){this.tap(t.data.global.x,t.data.global.y)}function ds(t){this.focus(t.data.global.x,t.data.global.y)}class ps extends Ke{}const _s=new Le,ms=new Ve;let gs;class vs extends Mn{constructor(t){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new ps,this.anchor=new Xe(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",()=>this.init(t))}static from(t,e){const i=new this(e);return cs.setupLive2DModel(i,t,e).then(()=>i)}static fromSync(t,e){const i=new this(e);return cs.setupLive2DModel(i,t,e).then(null==e?void 0:e.onLoad).catch(null==e?void 0:e.onError),i}static registerTicker(t){gs=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){var e;gs||(gs=null==(e=window.PIXI)?void 0:e.Ticker),t?this._destroyed||(gs?(gs.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):Ln.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(null==gs||gs.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(t){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const e=Object.assign({autoUpdate:!0,autoInteract:!0},t);e.autoInteract&&(this.interactive=!0),this.autoInteract=e.autoInteract,this.autoUpdate=e.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(t,e,i){return void 0===e?this.internalModel.motionManager.startRandomMotion(t,i):this.internalModel.motionManager.startMotion(t,e,i)}expression(t){return this.internalModel.motionManager.expressionManager?void 0===t?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(t):Promise.resolve(!1)}focus(t,e,i=!1){_s.x=t,_s.y=e,this.toModelPosition(_s,_s,!0);let r=_s.x/this.internalModel.originalWidth*2-1,n=_s.y/this.internalModel.originalHeight*2-1,s=Math.atan2(n,r);this.internalModel.focusController.focus(Math.cos(s),-Math.sin(s),i)}tap(t,e){const i=this.hitTest(t,e);i.length&&(Ln.log(this.tag,"Hit",i),this.emit("hit",i))}hitTest(t,e){return _s.x=t,_s.y=e,this.toModelPosition(_s,_s),this.internalModel.hitTest(_s.x,_s.y)}toModelPosition(t,e=t.clone(),i){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(t,e),this.internalModel.localTransform.applyInverse(e,e),e}containsPoint(t){return this.getBounds(!0).contains(t.x,t.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(gs.shared.deltaMS)}update(t){this.deltaTime+=t,this.elapsedTime+=t}_render(t){this.registerInteraction(t.plugins.interaction),t.batch.reset(),t.geometry.reset(),t.shader.reset(),t.state.reset();let e=!1;this.glContextID!==t.CONTEXT_UID&&(this.glContextID=t.CONTEXT_UID,this.internalModel.updateWebGLContext(t.gl,this.glContextID),e=!0);for(let i=0;i<this.textures.length;i++){const r=this.textures[i];r.valid&&(!e&&r.baseTexture._glTextures[this.glContextID]||(t.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL,this.internalModel.textureFlipY),t.texture.bind(r.baseTexture,0)),this.internalModel.bindTexture(i,r.baseTexture._glTextures[this.glContextID].texture),r.baseTexture.touched=t.textureGC.count)}const i=t.framebuffer.viewport;this.internalModel.viewport=[i.x,i.y,i.width,i.height],this.deltaTime&&(this.internalModel.update(this.deltaTime,this.elapsedTime),this.deltaTime=0);const r=ms.copyFrom(t.globalUniforms.uniforms.projectionMatrix).append(this.worldTransform);this.internalModel.updateTransform(r),this.internalModel.draw(t.gl),t.state.reset(),t.texture.reset()}destroy(t){this.emit("destroy"),this.autoUpdate=!1,this.unregisterInteraction(),(null==t?void 0:t.texture)&&this.textures.forEach(e=>e.destroy(t.baseTexture)),this.internalModel.destroy(),super.destroy(t)}}Nn(vs,[class{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(t){t!==this._autoInteract&&(t?this.on("pointertap",fs,this):this.off("pointertap",fs,this),this._autoInteract=t)}registerInteraction(t){t!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&t&&(this.interactionManager=t,t.on("pointermove",ds,this)))}unregisterInteraction(){var t;this.interactionManager&&(null==(t=this.interactionManager)||t.off("pointermove",ds,this),this.interactionManager=void 0)}}]);const ys=class{static resolveURL(t,e){var i;const r=null==(i=ys.filesMap[t])?void 0:i[e];if(void 0===r)throw new Error("Cannot find this file from uploaded files: "+e);return r}static upload(t,e){return Cn(this,null,function*(){const i={};for(const r of e.getDefinedFiles()){const n=decodeURI(ie.resolve(e.url,r)),s=t.find(t=>t.webkitRelativePath===n);s&&(i[r]=URL.createObjectURL(s))}ys.filesMap[e._objectURL]=i})}static createSettings(t){return Cn(this,null,function*(){const e=t.find(t=>t.name.endsWith("model.json")||t.name.endsWith("model3.json"));if(!e)throw new TypeError("Settings file not found");const i=yield ys.readText(e),r=JSON.parse(i);r.url=e.webkitRelativePath;const n=cs.findRuntime(r);if(!n)throw new Error("Unknown settings JSON");const s=n.createModelSettings(r);return s._objectURL=URL.createObjectURL(e),s})}static readText(t){return Cn(this,null,function*(){return new Promise((e,i)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=i,r.readAsText(t,"utf8")})})}};let bs=ys;bs.filesMap={},bs.factory=(t,e)=>Cn(void 0,null,function*(){if(Array.isArray(t.source)&&t.source[0]instanceof File){const e=t.source;let i=e.settings;if(i){if(!i._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings')}else i=yield ys.createSettings(e);i.validateFiles(e.map(t=>encodeURI(t.webkitRelativePath))),yield ys.upload(e,i),i.resolveURL=function(t){return ys.resolveURL(this._objectURL,t)},t.source=i,t.live2dModel.once("modelLoaded",t=>{t.once("destroy",function(){const t=this.settings._objectURL;if(URL.revokeObjectURL(t),ys.filesMap[t])for(const e of Object.values(ys.filesMap[t]))URL.revokeObjectURL(e);delete ys.filesMap[t]})})}return e()}),cs.live2DModelMiddlewares.unshift(bs.factory);const xs=class{static unzip(t,e){return Cn(this,null,function*(){const i=yield xs.getFilePaths(t),r=[];for(const t of e.getDefinedFiles()){const n=decodeURI(ie.resolve(e.url,t));i.includes(n)&&r.push(n)}const n=yield xs.getFiles(t,r);for(let t=0;t<n.length;t++){const e=r[t],i=n[t];Object.defineProperty(i,"webkitRelativePath",{value:e})}return n})}static createSettings(t){return Cn(this,null,function*(){const e=(yield xs.getFilePaths(t)).find(t=>t.endsWith("model.json")||t.endsWith("model3.json"));if(!e)throw new Error("Settings file not found");const i=yield xs.readText(t,e);if(!i)throw new Error("Empty settings file: "+e);const r=JSON.parse(i);r.url=e;const n=cs.findRuntime(r);if(!n)throw new Error("Unknown settings JSON");return n.createModelSettings(r)})}static zipReader(t,e){return Cn(this,null,function*(){throw new Error("Not implemented")})}static getFilePaths(t){return Cn(this,null,function*(){throw new Error("Not implemented")})}static getFiles(t,e){return Cn(this,null,function*(){throw new Error("Not implemented")})}static readText(t,e){return Cn(this,null,function*(){throw new Error("Not implemented")})}static releaseReader(t){}};let Ts=xs;if(Ts.ZIP_PROTOCOL="zip://",Ts.uid=0,Ts.factory=(t,e)=>Cn(void 0,null,function*(){const i=t.source;let r,n,s;if("string"==typeof i&&(i.endsWith(".zip")||i.startsWith(xs.ZIP_PROTOCOL))?(r=i.startsWith(xs.ZIP_PROTOCOL)?i.slice(xs.ZIP_PROTOCOL.length):i,n=yield is.load({url:r,type:"blob",target:t.live2dModel})):Array.isArray(i)&&1===i.length&&i[0]instanceof File&&i[0].name.endsWith(".zip")&&(n=i[0],r=URL.createObjectURL(n),s=i.settings),n){if(!n.size)throw new Error("Empty zip file");const e=yield xs.zipReader(n,r);s||(s=yield xs.createSettings(e)),s._objectURL=xs.ZIP_PROTOCOL+xs.uid+"/"+s.url;const i=yield xs.unzip(e,s);i.settings=s,t.source=i,r.startsWith("blob:")&&t.live2dModel.once("modelLoaded",t=>{t.once("destroy",function(){URL.revokeObjectURL(r)})}),xs.releaseReader(e)}return e()}),cs.live2DModelMiddlewares.unshift(Ts.factory),!window.Live2D)throw new Error("Could not find Cubism 2 runtime. This plugin requires live2d.min.js to be loaded.");const As=Live2DMotion.prototype.updateParam;Live2DMotion.prototype.updateParam=function(t,e){As.call(this,t,e),e.isFinished()&&this.onFinishHandler&&(this.onFinishHandler(this),delete this.onFinishHandler)};class Es extends AMotion{constructor(t){super(),this.params=[],this.setFadeIn(t.fade_in>0?t.fade_in:$n.expressionFadingDuration),this.setFadeOut(t.fade_out>0?t.fade_out:$n.expressionFadingDuration),Array.isArray(t.params)&&t.params.forEach(t=>{const e=t.calc||"add";if("add"===e){const e=t.def||0;t.val-=e}else if("mult"===e){const e=t.def||1;t.val/=e}this.params.push({calc:e,val:t.val,id:t.id})})}updateParamExe(t,e,i,r){this.params.forEach(e=>{t.setParamFloat(e.id,e.val*i)})}}class ws extends Un{constructor(t,e){var i;super(t,e),this.queueManager=new MotionQueueManager,this.definitions=null!=(i=this.settings.expressions)?i:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex(e=>e.name===t)}getExpressionFile(t){return t.file}createExpression(t,e){return new Es(t)}_setExpression(t){return this.queueManager.startMotion(t)}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.updateParam(t)}}class Ss extends qn{constructor(t,e){super(t,e),this.groups={idle:"idle"},this.motionDataType="arraybuffer",this.queueManager=new MotionQueueManager,this.definitions=this.settings.motions,this.init(e)}init(t){super.init(t),this.settings.expressions&&(this.expressionManager=new ws(this.settings,t))}isFinished(){return this.queueManager.isFinished()}createMotion(t,e,i){const r=Live2DMotion.loadMotion(t),n=e===this.groups.idle?$n.idleMotionFadingDuration:$n.motionFadingDuration;return r.setFadeIn(i.fade_in>0?i.fade_in:n),r.setFadeOut(i.fade_out>0?i.fade_out:n),r}getMotionFile(t){return t.file}getMotionName(t){return t.file}getSoundFile(t){return t.sound}_startMotion(t,e){return t.onFinishHandler=e,this.queueManager.stopAllMotions(),this.queueManager.startMotion(t)}_stopAllMotions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.updateParam(t)}destroy(){super.destroy(),this.queueManager=void 0}}class Ps{constructor(t){this.coreModel=t,this.blinkInterval=4e3,this.closingDuration=100,this.closedDuration=50,this.openingDuration=150,this.eyeState=0,this.eyeParamValue=1,this.closedTimer=0,this.nextBlinkTimeLeft=this.blinkInterval,this.leftParam=t.getParamIndex("PARAM_EYE_L_OPEN"),this.rightParam=t.getParamIndex("PARAM_EYE_R_OPEN")}setEyeParams(t){this.eyeParamValue=Fn(t,0,1),this.coreModel.setParamFloat(this.leftParam,this.eyeParamValue),this.coreModel.setParamFloat(this.rightParam,this.eyeParamValue)}update(t){switch(this.eyeState){case 0:this.nextBlinkTimeLeft-=t,this.nextBlinkTimeLeft<0&&(this.eyeState=1,this.nextBlinkTimeLeft=this.blinkInterval+this.closingDuration+this.closedDuration+this.openingDuration+(e=0,i=2e3,Math.random()*(i-e)+e));break;case 1:this.setEyeParams(this.eyeParamValue+t/this.closingDuration),this.eyeParamValue<=0&&(this.eyeState=2,this.closedTimer=0);break;case 2:this.closedTimer+=t,this.closedTimer>=this.closedDuration&&(this.eyeState=3);break;case 3:this.setEyeParams(this.eyeParamValue+t/this.openingDuration),this.eyeParamValue>=1&&(this.eyeState=0)}var e,i}}const Ms=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class Is extends Qn{constructor(t,e,i){super(),this.textureFlipY=!0,this.drawDataCount=0,this.disableCulling=!1,this.coreModel=t,this.settings=e,this.motionManager=new Ss(e,i),this.eyeBlink=new Ps(t),this.eyeballXParamIndex=t.getParamIndex("PARAM_EYE_BALL_X"),this.eyeballYParamIndex=t.getParamIndex("PARAM_EYE_BALL_Y"),this.angleXParamIndex=t.getParamIndex("PARAM_ANGLE_X"),this.angleYParamIndex=t.getParamIndex("PARAM_ANGLE_Y"),this.angleZParamIndex=t.getParamIndex("PARAM_ANGLE_Z"),this.bodyAngleXParamIndex=t.getParamIndex("PARAM_BODY_ANGLE_X"),this.breathParamIndex=t.getParamIndex("PARAM_BREATH"),this.init()}init(){super.init(),this.settings.initParams&&this.settings.initParams.forEach(({id:t,value:e})=>this.coreModel.setParamFloat(t,e)),this.settings.initOpacities&&this.settings.initOpacities.forEach(({id:t,value:e})=>this.coreModel.setPartsOpacity(t,e)),this.coreModel.saveParam();const t=this.coreModel.getModelContext()._$aS;(null==t?void 0:t.length)&&(this.drawDataCount=t.length);let e=this.coreModel.drawParamWebGL.culling;Object.defineProperty(this.coreModel.drawParamWebGL,"culling",{set:t=>e=t,get:()=>!this.disableCulling&&e});const i=this.coreModel.getModelContext().clipManager,r=i.setupClip;i.setupClip=(t,e)=>{r.call(i,t,e),e.gl.viewport(...this.viewport)}}getSize(){return[this.coreModel.getCanvasWidth(),this.coreModel.getCanvasHeight()]}getLayout(){const t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){let i=e;"center_x"===e?i="centerX":"center_y"===e&&(i="centerY"),t[i]=this.settings.layout[e]}return t}updateWebGLContext(t,e){const i=this.coreModel.drawParamWebGL;i.firstDraw=!0,i.setGL(t),i.glno=e;for(const t in i)i.hasOwnProperty(t)&&i[t]instanceof WebGLBuffer&&(i[t]=null);const r=this.coreModel.getModelContext().clipManager;r.curFrameNo=e;const n=t.getParameter(t.FRAMEBUFFER_BINDING);r.getMaskRenderTexture(),t.bindFramebuffer(t.FRAMEBUFFER,n)}bindTexture(t,e){this.coreModel.setTexture(t,e)}getHitAreaDefs(){var t;return(null==(t=this.settings.hitAreas)?void 0:t.map(t=>({id:t.id,name:t.name,index:this.coreModel.getDrawDataIndex(t.id)})))||[]}getDrawableIDs(){const t=this.coreModel.getModelContext(),e=[];for(let i=0;i<this.drawDataCount;i++){const r=t.getDrawData(i);r&&e.push(r.getDrawDataID().id)}return e}getDrawableIndex(t){return this.coreModel.getDrawDataIndex(t)}getDrawableVertices(t){if("string"==typeof t&&-1===(t=this.coreModel.getDrawDataIndex(t)))throw new TypeError("Unable to find drawable ID: "+t);return this.coreModel.getTransformedPoints(t).slice()}update(t,e){var i,r,n,s;super.update(t,e);const o=this.coreModel;this.emit("beforeMotionUpdate");const a=this.motionManager.update(this.coreModel,e);this.emit("afterMotionUpdate"),o.saveParam(),null==(i=this.motionManager.expressionManager)||i.update(o,e),a||null==(r=this.eyeBlink)||r.update(t),this.updateFocus(),this.updateNaturalMovements(t,e),null==(n=this.physics)||n.update(e),null==(s=this.pose)||s.update(t),this.emit("beforeModelUpdate"),o.update(),o.loadParam()}updateFocus(){this.coreModel.addToParamFloat(this.eyeballXParamIndex,this.focusController.x),this.coreModel.addToParamFloat(this.eyeballYParamIndex,this.focusController.y),this.coreModel.addToParamFloat(this.angleXParamIndex,30*this.focusController.x),this.coreModel.addToParamFloat(this.angleYParamIndex,30*this.focusController.y),this.coreModel.addToParamFloat(this.angleZParamIndex,this.focusController.x*this.focusController.y*-30),this.coreModel.addToParamFloat(this.bodyAngleXParamIndex,10*this.focusController.x)}updateNaturalMovements(t,e){const i=e/1e3*2*Math.PI;this.coreModel.addToParamFloat(this.angleXParamIndex,15*Math.sin(i/6.5345)*.5),this.coreModel.addToParamFloat(this.angleYParamIndex,8*Math.sin(i/3.5345)*.5),this.coreModel.addToParamFloat(this.angleZParamIndex,10*Math.sin(i/5.5345)*.5),this.coreModel.addToParamFloat(this.bodyAngleXParamIndex,4*Math.sin(i/15.5345)*.5),this.coreModel.setParamFloat(this.breathParamIndex,.5+.5*Math.sin(i/3.2345))}draw(t){const e=this.disableCulling;t.getParameter(t.FRAMEBUFFER_BINDING)&&(this.disableCulling=!0);const i=this.drawingMatrix;Ms[0]=i.a,Ms[1]=i.b,Ms[4]=i.c,Ms[5]=i.d,Ms[12]=i.tx,Ms[13]=i.ty,this.coreModel.setMatrix(Ms),this.coreModel.draw(),this.disableCulling=e}destroy(){super.destroy(),this.coreModel=void 0}}class Cs extends Hn{constructor(t){if(super(t),this.motions={},!Cs.isValidJSON(t))throw new TypeError("Invalid JSON.");this.moc=t.model,Bn("string",t,this,"textures","textures"),this.copy(t)}static isValidJSON(t){var e;return!!t&&"string"==typeof t.model&&(null==(e=t.textures)?void 0:e.length)>0&&t.textures.every(t=>"string"==typeof t)}copy(t){kn("string",t,this,"name","name"),kn("string",t,this,"pose","pose"),kn("string",t,this,"physics","physics"),kn("object",t,this,"layout","layout"),kn("object",t,this,"motions","motions"),Bn("object",t,this,"hit_areas","hitAreas"),Bn("object",t,this,"expressions","expressions"),Bn("object",t,this,"init_params","initParams"),Bn("object",t,this,"init_opacities","initOpacities")}replaceFiles(t){super.replaceFiles(t);for(const[e,i]of Object.entries(this.motions))for(let r=0;r<i.length;r++)i[r].file=t(i[r].file,`motions.${e}[${r}].file`),void 0!==i[r].sound&&(i[r].sound=t(i[r].sound,`motions.${e}[${r}].sound`));if(this.expressions)for(let e=0;e<this.expressions.length;e++)this.expressions[e].file=t(this.expressions[e].file,`expressions[${e}].file`)}}const Rs={x:PhysicsHair.Src.SRC_TO_X,y:PhysicsHair.Src.SRC_TO_Y,angle:PhysicsHair.Src.SRC_TO_G_ANGLE},Os={x:PhysicsHair.Src.SRC_TO_X,y:PhysicsHair.Src.SRC_TO_Y,angle:PhysicsHair.Src.SRC_TO_G_ANGLE};class $s{constructor(t,e){this.coreModel=t,this.physicsHairs=[],e.physics_hair&&(this.physicsHairs=e.physics_hair.map(t=>{const e=new PhysicsHair;return e.setup(t.setup.length,t.setup.regist,t.setup.mass),t.src.forEach(({id:t,ptype:i,scale:r,weight:n})=>{const s=Rs[i];s&&e.addSrcParam(s,t,r,n)}),t.targets.forEach(({id:t,ptype:i,scale:r,weight:n})=>{const s=Os[i];s&&e.addTargetParam(s,t,r,n)}),e}))}update(t){this.physicsHairs.forEach(e=>e.update(this.coreModel,t))}}class Ds{constructor(t){this.id=t,this.paramIndex=-1,this.partsIndex=-1,this.link=[]}initIndex(t){this.paramIndex=t.getParamIndex("VISIBLE:"+this.id),this.partsIndex=t.getPartsDataIndex(PartsDataID.getID(this.id)),t.setParamFloat(this.paramIndex,1)}}class Ls{constructor(t,e){this.coreModel=t,this.opacityAnimDuration=500,this.partsGroups=[],e.parts_visible&&(this.partsGroups=e.parts_visible.map(({group:t})=>t.map(({id:t,link:e})=>{const i=new Ds(t);return e&&(i.link=e.map(t=>new Ds(t))),i})),this.init())}init(){this.partsGroups.forEach(t=>{t.forEach(t=>{if(t.initIndex(this.coreModel),t.paramIndex>=0){const e=0!==this.coreModel.getParamFloat(t.paramIndex);this.coreModel.setPartsOpacity(t.partsIndex,e?1:0),this.coreModel.setParamFloat(t.paramIndex,e?1:0),t.link.length>0&&t.link.forEach(t=>t.initIndex(this.coreModel))}})})}normalizePartsOpacityGroup(t,e){const i=this.coreModel,r=.5;let n=1,s=t.findIndex(({paramIndex:t,partsIndex:e})=>e>=0&&0!==i.getParamFloat(t));if(s>=0){const r=i.getPartsOpacity(t[s].partsIndex);n=Fn(r+e/this.opacityAnimDuration,0,1)}else s=0,n=1;t.forEach(({partsIndex:t},e)=>{if(t>=0)if(s==e)i.setPartsOpacity(t,n);else{let e,s=i.getPartsOpacity(t);e=n<r?-.5*n/r+1:(1-n)*r/.5,(1-e)*(1-n)>.15&&(e=1-.15/(1-n)),s>e&&(s=e),i.setPartsOpacity(t,s)}})}copyOpacity(t){const e=this.coreModel;t.forEach(({partsIndex:t,link:i})=>{if(t>=0&&i){const r=e.getPartsOpacity(t);i.forEach(({partsIndex:t})=>{t>=0&&e.setPartsOpacity(t,r)})}})}update(t){this.partsGroups.forEach(e=>{this.normalizePartsOpacityGroup(e,t),this.copyOpacity(e)})}}if(cs.registerRuntime({version:2,test:t=>t instanceof Cs||Cs.isValidJSON(t),ready:()=>Promise.resolve(),isValidMoc(t){if(t.byteLength<3)return!1;const e=new Int8Array(t,0,3);return"moc"===String.fromCharCode(...e)},createModelSettings:t=>new Cs(t),createCoreModel(t){const e=Live2DModelWebGL.loadModel(t),i=Live2D.getError();if(i)throw i;return e},createInternalModel:(t,e,i)=>new Is(t,e,i),createPose:(t,e)=>new Ls(t,e),createPhysics:(t,e)=>new $s(t,e)}),!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class Fs{constructor(t,e){this.x=t||0,this.y=e||0}add(t){const e=new Fs(0,0);return e.x=this.x+t.x,e.y=this.y+t.y,e}substract(t){const e=new Fs(0,0);return e.x=this.x-t.x,e.y=this.y-t.y,e}multiply(t){const e=new Fs(0,0);return e.x=this.x*t.x,e.y=this.y*t.y,e}multiplyByScaler(t){return this.multiply(new Fs(t,t))}division(t){const e=new Fs(0,0);return e.x=this.x/t.x,e.y=this.y/t.y,e}divisionByScalar(t){return this.division(new Fs(t,t))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(t){return Math.sqrt((this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y))}dot(t){return this.x*t.x+this.y*t.y}normalize(){const t=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/t,this.y=this.y/t}isEqual(t){return this.x==t.x&&this.y==t.y}isNotEqual(t){return!this.isEqual(t)}}const ks=class{static range(t,e,i){return t<e?t=e:t>i&&(t=i),t}static sin(t){return Math.sin(t)}static cos(t){return Math.cos(t)}static abs(t){return Math.abs(t)}static sqrt(t){return Math.sqrt(t)}static cbrt(t){if(0===t)return t;let e=t;const i=e<0;let r;return i&&(e=-e),e===1/0?r=1/0:(r=Math.exp(Math.log(e)/3),r=(e/(r*r)+2*r)/3),i?-r:r}static getEasingSine(t){return t<0?0:t>1?1:.5-.5*this.cos(t*Math.PI)}static max(t,e){return t>e?t:e}static min(t,e){return t>e?e:t}static degreesToRadian(t){return t/180*Math.PI}static radianToDegrees(t){return 180*t/Math.PI}static directionToRadian(t,e){let i=Math.atan2(e.y,e.x)-Math.atan2(t.y,t.x);for(;i<-Math.PI;)i+=2*Math.PI;for(;i>Math.PI;)i-=2*Math.PI;return i}static directionToDegrees(t,e){const i=this.directionToRadian(t,e);let r=this.radianToDegrees(i);return e.x-t.x>0&&(r=-r),r}static radianToDirection(t){const e=new Fs;return e.x=this.sin(t),e.y=this.cos(t),e}static quadraticEquation(t,e,i){return this.abs(t)<ks.Epsilon?this.abs(e)<ks.Epsilon?-i:-i/e:-(e+this.sqrt(e*e-4*t*i))/(2*t)}static cardanoAlgorithmForBezier(t,e,i,r){if(this.sqrt(t)<ks.Epsilon)return this.range(this.quadraticEquation(e,i,r),0,1);const n=e/t,s=i/t,o=(3*s-n*n)/3,a=o/3,h=(2*n*n*n-9*n*s+27*(r/t))/27,u=h/2,l=u*u+a*a*a,c=.5,f=.51;if(l<0){const t=-o/3,e=t*t*t,i=this.sqrt(e),r=-h/(2*i),s=this.range(r,-1,1),a=Math.acos(s),u=2*this.cbrt(i),l=u*this.cos(a/3)-n/3;if(this.abs(l-c)<f)return this.range(l,0,1);const d=u*this.cos((a+2*Math.PI)/3)-n/3;if(this.abs(d-c)<f)return this.range(d,0,1);const p=u*this.cos((a+4*Math.PI)/3)-n/3;return this.range(p,0,1)}if(0==l){let t;t=u<0?this.cbrt(-u):-this.cbrt(u);const e=2*t-n/3;if(this.abs(e-c)<f)return this.range(e,0,1);const i=-t-n/3;return this.range(i,0,1)}const d=this.sqrt(l),p=this.cbrt(d-u)-this.cbrt(d+u)-n/3;return this.range(p,0,1)}constructor(){}};let Bs=ks;Bs.Epsilon=1e-5;class Ns{constructor(){this._tr=new Float32Array(16),this.loadIdentity()}static multiply(t,e,i){const r=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);for(let i=0;i<4;++i)for(let n=0;n<4;++n)for(let s=0;s<4;++s)r[n+4*i]+=t[s+4*i]*e[n+4*s];for(let t=0;t<16;++t)i[t]=r[t]}loadIdentity(){const t=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);this.setMatrix(t)}setMatrix(t){for(let e=0;e<16;++e)this._tr[e]=t[e]}getArray(){return this._tr}getScaleX(){return this._tr[0]}getScaleY(){return this._tr[5]}getTranslateX(){return this._tr[12]}getTranslateY(){return this._tr[13]}transformX(t){return this._tr[0]*t+this._tr[12]}transformY(t){return this._tr[5]*t+this._tr[13]}invertTransformX(t){return(t-this._tr[12])/this._tr[0]}invertTransformY(t){return(t-this._tr[13])/this._tr[5]}translateRelative(t,e){const i=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,t,e,0,1]);Ns.multiply(i,this._tr,this._tr)}translate(t,e){this._tr[12]=t,this._tr[13]=e}translateX(t){this._tr[12]=t}translateY(t){this._tr[13]=t}scaleRelative(t,e){const i=new Float32Array([t,0,0,0,0,e,0,0,0,0,1,0,0,0,0,1]);Ns.multiply(i,this._tr,this._tr)}scale(t,e){this._tr[0]=t,this._tr[5]=e}multiplyByMatrix(t){Ns.multiply(t.getArray(),this._tr,this._tr)}clone(){const t=new Ns;for(let e=0;e<this._tr.length;e++)t._tr[e]=this._tr[e];return t}}class Us{initialize(t){this._model=t}drawModel(){null!=this.getModel()&&this.doDrawModel()}setMvpMatrix(t){this._mvpMatrix4x4.setMatrix(t.getArray())}getMvpMatrix(){return this._mvpMatrix4x4}setModelColor(t,e,i,r){t<0?t=0:t>1&&(t=1),e<0?e=0:e>1&&(e=1),i<0?i=0:i>1&&(i=1),r<0?r=0:r>1&&(r=1),this._modelColor.R=t,this._modelColor.G=e,this._modelColor.B=i,this._modelColor.A=r}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(t){this._isPremultipliedAlpha=t}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(t){this._isCulling=t}isCulling(){return this._isCulling}setAnisotropy(t){this._anisortopy=t}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new Xs,this._mvpMatrix4x4=new Ns,this._mvpMatrix4x4.loadIdentity()}}var Gs=(t=>(t[t.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",t[t.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",t[t.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",t))(Gs||{});class Xs{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let Vs,Hs=!1,js=!1;const Ys=0,zs=2;class Ws{static startUp(t){if(Hs)return Qs("CubismFramework.startUp() is already done."),Hs;if(Live2DCubismCore._isStarted)return Hs=!0,!0;if(Live2DCubismCore._isStarted=!0,Vs=t,Vs&&Live2DCubismCore.Logging.csmSetLogFunction(Vs.logFunction),Hs=!0,Hs){const t=Live2DCubismCore.Version.csmGetVersion(),e=(16711680&t)>>16,i=65535&t,r=t;Qs("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+((4278190080&t)>>24)).slice(-2),("00"+e).slice(-2),("0000"+i).slice(-4),r)}return Qs("CubismFramework.startUp() is complete."),Hs}static cleanUp(){Hs=!1,js=!1,Vs=void 0}static initialize(){Hs?js?Js("CubismFramework.initialize() skipped, already initialized."):(js=!0,Qs("CubismFramework.initialize() is complete.")):Js("CubismFramework is not started.")}static dispose(){Hs?js?(Us.staticRelease(),js=!1,Qs("CubismFramework.dispose() is complete.")):Js("CubismFramework.dispose() skipped, not initialized."):Js("CubismFramework is not started.")}static isStarted(){return Hs}static isInitialized(){return js}static coreLogFunction(t){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(t)}static getLoggingLevel(){return null!=Vs?Vs.loggingLevel:qs.LogLevel_Off}constructor(){}}var qs=(t=>(t[t.LogLevel_Verbose=0]="LogLevel_Verbose",t[t.LogLevel_Debug=1]="LogLevel_Debug",t[t.LogLevel_Info=2]="LogLevel_Info",t[t.LogLevel_Warning=3]="LogLevel_Warning",t[t.LogLevel_Error=4]="LogLevel_Error",t[t.LogLevel_Off=5]="LogLevel_Off",t))(qs||{});function Zs(t,...e){to.print(qs.LogLevel_Debug,"[CSM][D]"+t+"\n",e)}function Qs(t,...e){to.print(qs.LogLevel_Info,"[CSM][I]"+t+"\n",e)}function Js(t,...e){to.print(qs.LogLevel_Warning,"[CSM][W]"+t+"\n",e)}function Ks(t,...e){to.print(qs.LogLevel_Error,"[CSM][E]"+t+"\n",e)}class to{static print(t,e,i){if(t<Ws.getLoggingLevel())return;const r=Ws.coreLogFunction;if(!r)return;r(e.replace(/{(\d+)}/g,(t,e)=>i[e]))}static dumpBytes(t,e,i){for(let r=0;r<i;r++)r%16==0&&r>0?this.print(t,"\n"):r%8==0&&r>0&&this.print(t,"  "),this.print(t,"{0} ",[255&e[r]]);this.print(t,"\n")}constructor(){}}class eo{constructor(){this._fadeInSeconds=-1,this._fadeOutSeconds=-1,this._weight=1,this._offsetSeconds=0,this._firedEventValues=[]}release(){this._weight=0}updateParameters(t,e,i){if(!e.isAvailable()||e.isFinished())return;if(!e.isStarted()){e.setIsStarted(!0),e.setStartTime(i-this._offsetSeconds),e.setFadeInStartTime(i);const t=this.getDuration();e.getEndTime()<0&&e.setEndTime(t<=0?-1:e.getStartTime()+t)}let r=this._weight;r=r*(0==this._fadeInSeconds?1:Bs.getEasingSine((i-e.getFadeInStartTime())/this._fadeInSeconds))*(0==this._fadeOutSeconds||e.getEndTime()<0?1:Bs.getEasingSine((e.getEndTime()-i)/this._fadeOutSeconds)),e.setState(i,r),this.doUpdateParameters(t,i,r,e),e.getEndTime()>0&&e.getEndTime()<i&&e.setIsFinished(!0)}setFadeInTime(t){this._fadeInSeconds=t}setFadeOutTime(t){this._fadeOutSeconds=t}getFadeOutTime(){return this._fadeOutSeconds}getFadeInTime(){return this._fadeInSeconds}setWeight(t){this._weight=t}getWeight(){return this._weight}getDuration(){return-1}getLoopDuration(){return-1}setOffsetTime(t){this._offsetSeconds=t}getFiredEvent(t,e){return this._firedEventValues}setFinishedMotionHandler(t){this._onFinishedMotion=t}getFinishedMotionHandler(){return this._onFinishedMotion}}class io extends eo{constructor(){super(),this._parameters=[]}static create(t){const e=new io,i=t.FadeInTime,r=t.FadeOutTime;e.setFadeInTime(void 0!==i?i:1),e.setFadeOutTime(void 0!==r?r:1);const n=t.Parameters||[];for(let t=0;t<n.length;++t){const i=n[t],r=i.Id,s=i.Value;let o;switch(i.Blend){case"Multiply":o=ro.ExpressionBlendType_Multiply;break;case"Overwrite":o=ro.ExpressionBlendType_Overwrite;break;default:o=ro.ExpressionBlendType_Add}const a={parameterId:r,blendType:o,value:s};e._parameters.push(a)}return e}doUpdateParameters(t,e,i,r){for(let e=0;e<this._parameters.length;++e){const r=this._parameters[e];switch(r.blendType){case ro.ExpressionBlendType_Add:t.addParameterValueById(r.parameterId,r.value,i);break;case ro.ExpressionBlendType_Multiply:t.multiplyParameterValueById(r.parameterId,r.value,i);break;case ro.ExpressionBlendType_Overwrite:t.setParameterValueById(r.parameterId,r.value,i)}}}}var ro=(t=>(t[t.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",t[t.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",t[t.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",t))(ro||{});class no{constructor(){this._autoDelete=!1,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this,this._fadeOutSeconds=0,this._isTriggeredFadeOut=!1}release(){this._autoDelete&&this._motion&&this._motion.release()}setFadeOut(t){this._fadeOutSeconds=t,this._isTriggeredFadeOut=!0}startFadeOut(t,e){const i=e+t;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||i<this._endTimeSeconds)&&(this._endTimeSeconds=i)}isFinished(){return this._finished}isStarted(){return this._started}getStartTime(){return this._startTimeSeconds}getFadeInStartTime(){return this._fadeInStartTimeSeconds}getEndTime(){return this._endTimeSeconds}setStartTime(t){this._startTimeSeconds=t}setFadeInStartTime(t){this._fadeInStartTimeSeconds=t}setEndTime(t){this._endTimeSeconds=t}setIsFinished(t){this._finished=t}setIsStarted(t){this._started=t}isAvailable(){return this._available}setIsAvailable(t){this._available=t}setState(t,e){this._stateTimeSeconds=t,this._stateWeight=e}getStateTime(){return this._stateTimeSeconds}getStateWeight(){return this._stateWeight}getLastCheckEventSeconds(){return this._lastEventCheckSeconds}setLastCheckEventSeconds(t){this._lastEventCheckSeconds=t}isTriggeredFadeOut(){return this._isTriggeredFadeOut}getFadeOutSeconds(){return this._fadeOutSeconds}}class so{constructor(){this._userTimeSeconds=0,this._eventCustomData=null,this._motions=[]}release(){for(let t=0;t<this._motions.length;++t)this._motions[t]&&this._motions[t].release();this._motions=void 0}startMotion(t,e,i){if(null==t)return oo;let r;for(let t=0;t<this._motions.length;++t)r=this._motions[t],null!=r&&r.setFadeOut(r._motion.getFadeOutTime());return r=new no,r._autoDelete=e,r._motion=t,this._motions.push(r),r._motionQueueEntryHandle}isFinished(){let t=0;for(;t<this._motions.length;){const e=this._motions[t];if(null==e){this._motions.splice(t,1);continue}if(null!=e._motion){if(!e.isFinished())return!1;t++}else e.release(),this._motions.splice(t,1)}return!0}isFinishedByHandle(t){for(let e=0;e<this._motions.length;e++){const i=this._motions[e];if(null!=i&&(i._motionQueueEntryHandle==t&&!i.isFinished()))return!1}return!0}stopAllMotions(){for(let t=0;t<this._motions.length;t++){const e=this._motions[t];null!=e&&e.release()}this._motions=[]}getCubismMotionQueueEntry(t){return this._motions.find(e=>null!=e&&e._motionQueueEntryHandle==t)}setEventCallback(t,e=null){this._eventCallBack=t,this._eventCustomData=e}doUpdateMotion(t,e){let i=!1,r=0;for(;r<this._motions.length;){const n=this._motions[r];if(null==n){this._motions.splice(r,1);continue}const s=n._motion;if(null==s){n.release(),this._motions.splice(r,1);continue}s.updateParameters(t,n,e),i=!0;const o=s.getFiredEvent(n.getLastCheckEventSeconds()-n.getStartTime(),e-n.getStartTime());for(let t=0;t<o.length;++t)this._eventCallBack(this,o[t],this._eventCustomData);n.setLastCheckEventSeconds(e),n.isFinished()?(n.release(),this._motions.splice(r,1)):(n.isTriggeredFadeOut()&&n.startFadeOut(n.getFadeOutSeconds(),e),r++)}return i}}const oo=-1;class ao extends Un{constructor(t,e){var i;super(t,e),this.queueManager=new so,this.definitions=null!=(i=t.expressions)?i:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex(e=>e.Name===t)}getExpressionFile(t){return t.File}createExpression(t,e){return io.create(t)}_setExpression(t){return this.queueManager.startMotion(t,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}}class ho{constructor(t){this.groups=t.Groups,this.hitAreas=t.HitAreas,this.layout=t.Layout,this.moc=t.FileReferences.Moc,this.expressions=t.FileReferences.Expressions,this.motions=t.FileReferences.Motions,this.textures=t.FileReferences.Textures,this.physics=t.FileReferences.Physics,this.pose=t.FileReferences.Pose}getEyeBlinkParameters(){var t,e;return null==(e=null==(t=this.groups)?void 0:t.find(t=>"EyeBlink"===t.Name))?void 0:e.Ids}getLipSyncParameters(){var t,e;return null==(e=null==(t=this.groups)?void 0:t.find(t=>"LipSync"===t.Name))?void 0:e.Ids}}class uo extends Hn{constructor(t){if(super(t),!uo.isValidJSON(t))throw new TypeError("Invalid JSON.");Object.assign(this,new ho(t))}static isValidJSON(t){var e;return!!(null==t?void 0:t.FileReferences)&&"string"==typeof t.FileReferences.Moc&&(null==(e=t.FileReferences.Textures)?void 0:e.length)>0&&t.FileReferences.Textures.every(t=>"string"==typeof t)}replaceFiles(t){if(super.replaceFiles(t),this.motions)for(const[e,i]of Object.entries(this.motions))for(let r=0;r<i.length;r++)i[r].File=t(i[r].File,`motions.${e}[${r}].File`),void 0!==i[r].Sound&&(i[r].Sound=t(i[r].Sound,`motions.${e}[${r}].Sound`));if(this.expressions)for(let e=0;e<this.expressions.length;e++)this.expressions[e].File=t(this.expressions[e].File,`expressions[${e}].File`)}}Nn(uo,[ho]);var lo=(t=>(t[t.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",t[t.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",t[t.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",t))(lo||{}),co=(t=>(t[t.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",t[t.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",t[t.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",t[t.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped",t))(co||{});class fo{constructor(t=0,e=0){this.time=t,this.value=e}}class po{constructor(){this.basePointIndex=0,this.segmentType=0}}class _o{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class mo{constructor(){this.fireTime=0,this.value=""}}class go{constructor(){this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=[],this.segments=[],this.points=[],this.events=[]}}class vo{constructor(t){this._json=t}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(t){return yo.EvaluationOptionFlag_AreBeziersRistricted==t&&!!this._json.Meta.AreBeziersRestricted}getMotionCurveCount(){return this._json.Meta.CurveCount}getMotionFps(){return this._json.Meta.Fps}getMotionTotalSegmentCount(){return this._json.Meta.TotalSegmentCount}getMotionTotalPointCount(){return this._json.Meta.TotalPointCount}getMotionFadeInTime(){return this._json.Meta.FadeInTime}getMotionFadeOutTime(){return this._json.Meta.FadeOutTime}getMotionCurveTarget(t){return this._json.Curves[t].Target}getMotionCurveId(t){return this._json.Curves[t].Id}getMotionCurveFadeInTime(t){return this._json.Curves[t].FadeInTime}getMotionCurveFadeOutTime(t){return this._json.Curves[t].FadeOutTime}getMotionCurveSegmentCount(t){return this._json.Curves[t].Segments.length}getMotionCurveSegment(t,e){return this._json.Curves[t].Segments[e]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(t){return this._json.UserData[t].Time}getEventValue(t){return this._json.UserData[t].Value}}var yo=(t=>(t[t.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",t))(yo||{});function bo(t,e,i){const r=new fo;return r.time=t.time+(e.time-t.time)*i,r.value=t.value+(e.value-t.value)*i,r}function xo(t,e){let i=(e-t[0].time)/(t[1].time-t[0].time);return i<0&&(i=0),t[0].value+(t[1].value-t[0].value)*i}function To(t,e){let i=(e-t[0].time)/(t[3].time-t[0].time);i<0&&(i=0);const r=bo(t[0],t[1],i),n=bo(t[1],t[2],i),s=bo(t[2],t[3],i),o=bo(r,n,i),a=bo(n,s,i);return bo(o,a,i).value}function Ao(t,e){const i=e,r=t[0].time,n=t[3].time,s=t[1].time,o=t[2].time,a=n-3*o+3*s-r,h=3*o-6*s+3*r,u=3*s-3*r,l=r-i,c=Bs.cardanoAlgorithmForBezier(a,h,u,l),f=bo(t[0],t[1],c),d=bo(t[1],t[2],c),p=bo(t[2],t[3],c),_=bo(f,d,c),m=bo(d,p,c);return bo(_,m,c).value}function Eo(t,e){return t[0].value}function wo(t,e){return t[1].value}function So(t,e,i){const r=t.curves[e];let n=-1;const s=r.baseSegmentIndex+r.segmentCount;let o=0;for(let e=r.baseSegmentIndex;e<s;++e)if(o=t.segments[e].basePointIndex+(t.segments[e].segmentType==co.CubismMotionSegmentType_Bezier?3:1),t.points[o].time>i){n=e;break}if(-1==n)return t.points[o].value;const a=t.segments[n];return a.evaluate(t.points.slice(a.basePointIndex),i)}class Po extends eo{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(t,e){const i=new Po;return i.parse(t),i._sourceFrameRate=i._motionData.fps,i._loopDurationSeconds=i._motionData.duration,i._onFinishedMotion=e,i}doUpdateParameters(t,e,i,r){null==this._modelCurveIdEyeBlink&&(this._modelCurveIdEyeBlink="EyeBlink"),null==this._modelCurveIdLipSync&&(this._modelCurveIdLipSync="LipSync");let n=e-r.getStartTime();n<0&&(n=0);let s=Number.MAX_VALUE,o=Number.MAX_VALUE;const a=64;let h=0,u=0;this._eyeBlinkParameterIds.length>a&&Zs("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>a&&Zs("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const l=this._fadeInSeconds<=0?1:Bs.getEasingSine((e-r.getFadeInStartTime())/this._fadeInSeconds),c=this._fadeOutSeconds<=0||r.getEndTime()<0?1:Bs.getEasingSine((r.getEndTime()-e)/this._fadeOutSeconds);let f,d,p,_=n;if(this._isLoop)for(;_>this._motionData.duration;)_-=this._motionData.duration;const m=this._motionData.curves;for(d=0;d<this._motionData.curveCount&&m[d].type==lo.CubismMotionCurveTarget_Model;++d)f=So(this._motionData,d,_),m[d].id==this._modelCurveIdEyeBlink?o=f:m[d].id==this._modelCurveIdLipSync&&(s=f);for(;d<this._motionData.curveCount&&m[d].type==lo.CubismMotionCurveTarget_Parameter;++d){if(p=t.getParameterIndex(m[d].id),-1==p)continue;const n=t.getParameterValueByIndex(p);if(f=So(this._motionData,d,_),o!=Number.MAX_VALUE)for(let t=0;t<this._eyeBlinkParameterIds.length&&t<a;++t)if(this._eyeBlinkParameterIds[t]==m[d].id){f*=o,u|=1<<t;break}if(s!=Number.MAX_VALUE)for(let t=0;t<this._lipSyncParameterIds.length&&t<a;++t)if(this._lipSyncParameterIds[t]==m[d].id){f+=s,h|=1<<t;break}let g;if(m[d].fadeInTime<0&&m[d].fadeOutTime<0)g=n+(f-n)*i;else{let t,i;t=m[d].fadeInTime<0?l:0==m[d].fadeInTime?1:Bs.getEasingSine((e-r.getFadeInStartTime())/m[d].fadeInTime),i=m[d].fadeOutTime<0?c:0==m[d].fadeOutTime||r.getEndTime()<0?1:Bs.getEasingSine((r.getEndTime()-e)/m[d].fadeOutTime);g=n+(f-n)*(this._weight*t*i)}t.setParameterValueByIndex(p,g,1)}if(o!=Number.MAX_VALUE)for(let e=0;e<this._eyeBlinkParameterIds.length&&e<a;++e){const r=t.getParameterValueById(this._eyeBlinkParameterIds[e]);if(u>>e&1)continue;const n=r+(o-r)*i;t.setParameterValueById(this._eyeBlinkParameterIds[e],n)}if(s!=Number.MAX_VALUE)for(let e=0;e<this._lipSyncParameterIds.length&&e<a;++e){const r=t.getParameterValueById(this._lipSyncParameterIds[e]);if(h>>e&1)continue;const n=r+(s-r)*i;t.setParameterValueById(this._lipSyncParameterIds[e],n)}for(;d<this._motionData.curveCount&&m[d].type==lo.CubismMotionCurveTarget_PartOpacity;++d)if(f=So(this._motionData,d,_),Rn.setOpacityFromMotion)t.setPartOpacityById(m[d].id,f);else{if(p=t.getParameterIndex(m[d].id),-1==p)continue;t.setParameterValueByIndex(p,f)}n>=this._motionData.duration&&(this._isLoop?(r.setStartTime(e),this._isLoopFadeIn&&r.setFadeInStartTime(e)):(this._onFinishedMotion&&this._onFinishedMotion(this),r.setIsFinished(!0))),this._lastWeight=i}setIsLoop(t){this._isLoop=t}isLoop(){return this._isLoop}setIsLoopFadeIn(t){this._isLoopFadeIn=t}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(t,e){const i=this._motionData.curves;for(let r=0;r<this._motionData.curveCount;++r)if(t==i[r].id)return void(i[r].fadeInTime=e)}setParameterFadeOutTime(t,e){const i=this._motionData.curves;for(let r=0;r<this._motionData.curveCount;++r)if(t==i[r].id)return void(i[r].fadeOutTime=e)}getParameterFadeInTime(t){const e=this._motionData.curves;for(let i=0;i<this._motionData.curveCount;++i)if(t==e[i].id)return e[i].fadeInTime;return-1}getParameterFadeOutTime(t){const e=this._motionData.curves;for(let i=0;i<this._motionData.curveCount;++i)if(t==e[i].id)return e[i].fadeOutTime;return-1}setEffectIds(t,e){this._eyeBlinkParameterIds=t,this._lipSyncParameterIds=e}release(){this._motionData=void 0}parse(t){this._motionData=new go;let e=new vo(t);this._motionData.duration=e.getMotionDuration(),this._motionData.loop=e.isMotionLoop(),this._motionData.curveCount=e.getMotionCurveCount(),this._motionData.fps=e.getMotionFps(),this._motionData.eventCount=e.getEventCount();const i=e.getEvaluationOptionFlag(yo.EvaluationOptionFlag_AreBeziersRistricted),r=e.getMotionFadeInTime(),n=e.getMotionFadeOutTime();this._fadeInSeconds=void 0!==r?r<0?1:r:1,this._fadeOutSeconds=void 0!==n?n<0?1:n:1,this._motionData.curves=Array.from({length:this._motionData.curveCount}).map(()=>new _o),this._motionData.segments=Array.from({length:e.getMotionTotalSegmentCount()}).map(()=>new po),this._motionData.events=Array.from({length:this._motionData.eventCount}).map(()=>new mo),this._motionData.points=[];let s=0,o=0;for(let t=0;t<this._motionData.curveCount;++t){const r=this._motionData.curves[t];switch(e.getMotionCurveTarget(t)){case"Model":r.type=lo.CubismMotionCurveTarget_Model;break;case"Parameter":r.type=lo.CubismMotionCurveTarget_Parameter;break;case"PartOpacity":r.type=lo.CubismMotionCurveTarget_PartOpacity;break;default:Js('Warning : Unable to get segment type from Curve! The number of "CurveCount" may be incorrect!')}r.id=e.getMotionCurveId(t),r.baseSegmentIndex=o;const n=e.getMotionCurveFadeInTime(t),a=e.getMotionCurveFadeOutTime(t);r.fadeInTime=void 0!==n?n:-1,r.fadeOutTime=void 0!==a?a:-1;for(let n=0;n<e.getMotionCurveSegmentCount(t);){0==n?(this._motionData.segments[o].basePointIndex=s,this._motionData.points[s]=new fo(e.getMotionCurveSegment(t,n),e.getMotionCurveSegment(t,n+1)),s+=1,n+=2):this._motionData.segments[o].basePointIndex=s-1;switch(e.getMotionCurveSegment(t,n)){case co.CubismMotionSegmentType_Linear:this._motionData.segments[o].segmentType=co.CubismMotionSegmentType_Linear,this._motionData.segments[o].evaluate=xo,this._motionData.points[s]=new fo(e.getMotionCurveSegment(t,n+1),e.getMotionCurveSegment(t,n+2)),s+=1,n+=3;break;case co.CubismMotionSegmentType_Bezier:this._motionData.segments[o].segmentType=co.CubismMotionSegmentType_Bezier,this._motionData.segments[o].evaluate=i?To:Ao,this._motionData.points[s]=new fo(e.getMotionCurveSegment(t,n+1),e.getMotionCurveSegment(t,n+2)),this._motionData.points[s+1]=new fo(e.getMotionCurveSegment(t,n+3),e.getMotionCurveSegment(t,n+4)),this._motionData.points[s+2]=new fo(e.getMotionCurveSegment(t,n+5),e.getMotionCurveSegment(t,n+6)),s+=3,n+=7;break;case co.CubismMotionSegmentType_Stepped:this._motionData.segments[o].segmentType=co.CubismMotionSegmentType_Stepped,this._motionData.segments[o].evaluate=Eo,this._motionData.points[s]=new fo(e.getMotionCurveSegment(t,n+1),e.getMotionCurveSegment(t,n+2)),s+=1,n+=3;break;case co.CubismMotionSegmentType_InverseStepped:this._motionData.segments[o].segmentType=co.CubismMotionSegmentType_InverseStepped,this._motionData.segments[o].evaluate=wo,this._motionData.points[s]=new fo(e.getMotionCurveSegment(t,n+1),e.getMotionCurveSegment(t,n+2)),s+=1,n+=3}++r.segmentCount,++o}this._motionData.curves.push(r)}for(let t=0;t<e.getEventCount();++t)this._motionData.events[t].fireTime=e.getEventTime(t),this._motionData.events[t].value=e.getEventValue(t);e.release()}getFiredEvent(t,e){this._firedEventValues.length=0;for(let i=0;i<this._motionData.eventCount;++i)this._motionData.events[i].fireTime>t&&this._motionData.events[i].fireTime<=e&&this._firedEventValues.push(this._motionData.events[i].value);return this._firedEventValues}}class Mo extends qn{constructor(t,e){var i;super(t,e),this.groups={idle:"Idle"},this.motionDataType="json",this.queueManager=new so,this.definitions=null!=(i=t.motions)?i:{},this.eyeBlinkIds=t.getEyeBlinkParameters()||[],this.lipSyncIds=t.getLipSyncParameters()||[],this.init(e)}init(t){super.init(t),this.settings.expressions&&(this.expressionManager=new ao(this.settings,t)),this.queueManager.setEventCallback((t,e,i)=>{this.emit("motion:"+e)})}isFinished(){return this.queueManager.isFinished()}_startMotion(t,e){return t.setFinishedMotionHandler(e),this.queueManager.stopAllMotions(),this.queueManager.startMotion(t,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(t,e,i){const r=Po.create(t),n=new vo(t),s=(e===this.groups.idle?$n.idleMotionFadingDuration:$n.motionFadingDuration)/1e3;return void 0===n.getMotionFadeInTime()&&r.setFadeInTime(i.FadeInTime>0?i.FadeInTime:s),void 0===n.getMotionFadeOutTime()&&r.setFadeOutTime(i.FadeOutTime>0?i.FadeOutTime:s),r.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),r}getMotionFile(t){return t.File}getMotionName(t){return t.File}getSoundFile(t){return t.Sound}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}class Io{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new Io}setParameters(t){this._breathParameters=t}getParameters(){return this._breathParameters}updateParameters(t,e){this._currentTime+=e;const i=2*this._currentTime*3.14159;for(let e=0;e<this._breathParameters.length;++e){const r=this._breathParameters[e];t.addParameterValueById(r.parameterId,r.offset+r.peak*Math.sin(i/r.cycle),r.weight)}}}class Co{constructor(t,e,i,r,n){this.parameterId=null==t?void 0:t,this.offset=null==e?0:e,this.peak=null==i?0:i,this.cycle=null==r?0:r,this.weight=null==n?0:n}}const Ro=class{static create(t){return new Ro(t)}setBlinkingInterval(t){this._blinkingIntervalSeconds=t}setBlinkingSetting(t,e,i){this._closingSeconds=t,this._closedSeconds=e,this._openingSeconds=i}setParameterIds(t){this._parameterIds=t}getParameterIds(){return this._parameterIds}updateParameters(t,e){let i;this._userTimeSeconds+=e;let r=0;switch(this._blinkingState){case $o.EyeState_Closing:r=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closingSeconds,r>=1&&(r=1,this._blinkingState=$o.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),i=1-r;break;case $o.EyeState_Closed:r=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,r>=1&&(this._blinkingState=$o.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),i=0;break;case $o.EyeState_Opening:r=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,r>=1&&(r=1,this._blinkingState=$o.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),i=r;break;case $o.EyeState_Interval:this._nextBlinkingTime<this._userTimeSeconds&&(this._blinkingState=$o.EyeState_Closing,this._stateStartTimeSeconds=this._userTimeSeconds),i=1;break;case $o.EyeState_First:default:this._blinkingState=$o.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming(),i=1}Ro.CloseIfZero||(i=-i);for(let e=0;e<this._parameterIds.length;++e)t.setParameterValueById(this._parameterIds[e],i)}constructor(t){var e,i;this._blinkingState=$o.EyeState_First,this._nextBlinkingTime=0,this._stateStartTimeSeconds=0,this._blinkingIntervalSeconds=4,this._closingSeconds=.1,this._closedSeconds=.05,this._openingSeconds=.15,this._userTimeSeconds=0,this._parameterIds=[],null!=t&&(this._parameterIds=null!=(i=null==(e=t.getEyeBlinkParameters())?void 0:e.slice())?i:this._parameterIds)}determinNextBlinkingTiming(){const t=Math.random();return this._userTimeSeconds+t*(2*this._blinkingIntervalSeconds-1)}};let Oo=Ro;Oo.CloseIfZero=!0;var $o=(t=>(t[t.EyeState_First=0]="EyeState_First",t[t.EyeState_Interval=1]="EyeState_Interval",t[t.EyeState_Closing=2]="EyeState_Closing",t[t.EyeState_Closed=3]="EyeState_Closed",t[t.EyeState_Opening=4]="EyeState_Opening",t))($o||{});class Do{constructor(t=0,e=0,i=0,r=0){this.x=t,this.y=e,this.width=i,this.height=r}getCenterX(){return this.x+.5*this.width}getCenterY(){return this.y+.5*this.height}getRight(){return this.x+this.width}getBottom(){return this.y+this.height}setRect(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}expand(t,e){this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e}}let Lo,Fo,ko;class Bo{getChannelFlagAsColor(t){return this._channelColors[t]}getMaskRenderTexture(){let t=0;if(this._maskTexture&&0!=this._maskTexture.texture&&(this._maskTexture.frameNo=this._currentFrameNo,t=this._maskTexture.texture),0==t){const e=this._clippingMaskBufferSize;this._colorBuffer=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this._colorBuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.bindTexture(this.gl.TEXTURE_2D,null),t=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,ko),this._maskTexture=new No(this._currentFrameNo,t)}return t}setGL(t){this.gl=t}calcClippedDrawTotalBounds(t,e){let i=Number.MAX_VALUE,r=Number.MAX_VALUE,n=Number.MIN_VALUE,s=Number.MIN_VALUE;const o=e._clippedDrawableIndexList.length;for(let a=0;a<o;a++){const o=e._clippedDrawableIndexList[a],h=t.getDrawableVertexCount(o),u=t.getDrawableVertices(o);let l=Number.MAX_VALUE,c=Number.MAX_VALUE,f=Number.MIN_VALUE,d=Number.MIN_VALUE;const p=h*zs;for(let t=Ys;t<p;t+=zs){const e=u[t],i=u[t+1];e<l&&(l=e),e>f&&(f=e),i<c&&(c=i),i>d&&(d=i)}if(l!=Number.MAX_VALUE)if(l<i&&(i=l),c<r&&(r=c),f>n&&(n=f),d>s&&(s=d),i==Number.MAX_VALUE)e._allClippedDrawRect.x=0,e._allClippedDrawRect.y=0,e._allClippedDrawRect.width=0,e._allClippedDrawRect.height=0,e._isUsing=!1;else{e._isUsing=!0;const t=n-i,o=s-r;e._allClippedDrawRect.x=i,e._allClippedDrawRect.y=r,e._allClippedDrawRect.width=t,e._allClippedDrawRect.height=o}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new Do,this._tmpMatrix=new Ns,this._tmpMatrixForMask=new Ns,this._tmpMatrixForDraw=new Ns;let t=new Xs;t.R=1,t.G=0,t.B=0,t.A=0,this._channelColors.push(t),t=new Xs,t.R=0,t.G=1,t.B=0,t.A=0,this._channelColors.push(t),t=new Xs,t.R=0,t.G=0,t.B=1,t.A=0,this._channelColors.push(t),t=new Xs,t.R=0,t.G=0,t.B=0,t.A=1,this._channelColors.push(t)}release(){var t,e,i;const r=this;for(let e=0;e<this._clippingContextListForMask.length;e++)this._clippingContextListForMask[e]&&(null==(t=this._clippingContextListForMask[e])||t.release());r._clippingContextListForMask=void 0,r._clippingContextListForDraw=void 0,this._maskTexture&&(null==(e=this.gl)||e.deleteFramebuffer(this._maskTexture.texture),r._maskTexture=void 0),r._channelColors=void 0,null==(i=this.gl)||i.deleteTexture(this._colorBuffer),this._colorBuffer=null}initialize(t,e,i,r){for(let t=0;t<e;t++){if(r[t]<=0){this._clippingContextListForDraw.push(null);continue}let e=this.findSameClip(i[t],r[t]);null==e&&(e=new Uo(this,i[t],r[t]),this._clippingContextListForMask.push(e)),e.addClippedDrawable(t),this._clippingContextListForDraw.push(e)}}setupClippingContext(t,e){this._currentFrameNo++;let i=0;for(let e=0;e<this._clippingContextListForMask.length;e++){const r=this._clippingContextListForMask[e];this.calcClippedDrawTotalBounds(t,r),r._isUsing&&i++}if(i>0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),e.getMvpMatrix(),e.preDraw(),this.setupLayoutBounds(i),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._maskRenderTexture),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let i=0;i<this._clippingContextListForMask.length;i++){const r=this._clippingContextListForMask[i],n=r._allClippedDrawRect,s=r._layoutBounds,o=.05;this._tmpBoundsOnModel.setRect(n),this._tmpBoundsOnModel.expand(n.width*o,n.height*o);const a=s.width/this._tmpBoundsOnModel.width,h=s.height/this._tmpBoundsOnModel.height;this._tmpMatrix.loadIdentity(),this._tmpMatrix.translateRelative(-1,-1),this._tmpMatrix.scaleRelative(2,2),this._tmpMatrix.translateRelative(s.x,s.y),this._tmpMatrix.scaleRelative(a,h),this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x,-this._tmpBoundsOnModel.y),this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray()),this._tmpMatrix.loadIdentity(),this._tmpMatrix.translateRelative(s.x,s.y),this._tmpMatrix.scaleRelative(a,h),this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x,-this._tmpBoundsOnModel.y),this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray()),r._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()),r._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray());const u=r._clippingIdCount;for(let i=0;i<u;i++){const n=r._clippingIdList[i];t.getDrawableDynamicFlagVertexPositionsDidChange(n)&&(e.setIsCulling(0!=t.getDrawableCulling(n)),e.setClippingContextBufferForMask(r),e.drawMesh(t.getDrawableTextureIndices(n),t.getDrawableVertexIndexCount(n),t.getDrawableVertexCount(n),t.getDrawableVertexIndices(n),t.getDrawableVertices(n),t.getDrawableVertexUvs(n),t.getDrawableOpacity(n),Gs.CubismBlendMode_Normal,!1))}}this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,ko),e.setClippingContextBufferForMask(null),this.gl.viewport(Fo[0],Fo[1],Fo[2],Fo[3])}}findSameClip(t,e){for(let i=0;i<this._clippingContextListForMask.length;i++){const r=this._clippingContextListForMask[i],n=r._clippingIdCount;if(n!=e)continue;let s=0;for(let e=0;e<n;e++){const i=r._clippingIdList[e];for(let e=0;e<n;e++)if(t[e]==i){s++;break}}if(s==n)return r}return null}setupLayoutBounds(t){let e=t/4,i=t%4;e=~~e,i=~~i;let r=0;for(let t=0;t<4;t++){const n=e+(t<i?1:0);if(0==n);else if(1==n){const e=this._clippingContextListForMask[r++];e._layoutChannelNo=t,e._layoutBounds.x=0,e._layoutBounds.y=0,e._layoutBounds.width=1,e._layoutBounds.height=1}else if(2==n)for(let e=0;e<n;e++){let i=e%2;i=~~i;const n=this._clippingContextListForMask[r++];n._layoutChannelNo=t,n._layoutBounds.x=.5*i,n._layoutBounds.y=0,n._layoutBounds.width=.5,n._layoutBounds.height=1}else if(n<=4)for(let e=0;e<n;e++){let i=e%2,n=e/2;i=~~i,n=~~n;const s=this._clippingContextListForMask[r++];s._layoutChannelNo=t,s._layoutBounds.x=.5*i,s._layoutBounds.y=.5*n,s._layoutBounds.width=.5,s._layoutBounds.height=.5}else if(n<=9)for(let e=0;e<n;e++){let i=e%3,n=e/3;i=~~i,n=~~n;const s=this._clippingContextListForMask[r++];s._layoutChannelNo=t,s._layoutBounds.x=i/3,s._layoutBounds.y=n/3,s._layoutBounds.width=1/3,s._layoutBounds.height=1/3}else if(Rn.supportMoreMaskDivisions&&n<=16)for(let e=0;e<n;e++){let i=e%4,n=e/4;i=~~i,n=~~n;const s=this._clippingContextListForMask[r++];s._layoutChannelNo=t,s._layoutBounds.x=i/4,s._layoutBounds.y=n/4,s._layoutBounds.width=1/4,s._layoutBounds.height=1/4}else Ks("not supported mask count : {0}",n)}}getColorBuffer(){return this._colorBuffer}getClippingContextListForDraw(){return this._clippingContextListForDraw}setClippingMaskBufferSize(t){this._clippingMaskBufferSize=t}getClippingMaskBufferSize(){return this._clippingMaskBufferSize}}class No{constructor(t,e){this.frameNo=t,this.texture=e}}class Uo{constructor(t,e,i){this._isUsing=!1,this._owner=t,this._clippingIdList=e,this._clippingIdCount=i,this._allClippedDrawRect=new Do,this._layoutBounds=new Do,this._clippedDrawableIndexList=[],this._matrixForMask=new Ns,this._matrixForDraw=new Ns}release(){const t=this;t._layoutBounds=void 0,t._allClippedDrawRect=void 0,t._clippedDrawableIndexList=void 0}addClippedDrawable(t){this._clippedDrawableIndexList.push(t)}getClippingManager(){return this._owner}setGl(t){this._owner.setGL(t)}}class Go{static getInstance(){return null==Lo?(Lo=new Go,Lo):Lo}static deleteInstance(){Lo&&(Lo.release(),Lo=void 0)}constructor(){this._shaderSets=[]}release(){this.releaseShaderProgram()}setupShaderProgram(t,e,i,r,n,s,o,a,h,u,l,c,f){let d,p,_,m;l||Ks("NoPremultipliedAlpha is not allowed"),0==this._shaderSets.length&&this.generateShaders();const g=t.getClippingContextBufferForMask();if(null!=g){const t=this._shaderSets[Xo.ShaderNames_SetupMask];this.gl.useProgram(t.shaderProgram),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.uniform1i(t.samplerTexture0Location,0),null==o.vertex&&(o.vertex=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o.vertex),this.gl.bufferData(this.gl.ARRAY_BUFFER,r,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(t.attributePositionLocation),this.gl.vertexAttribPointer(t.attributePositionLocation,2,this.gl.FLOAT,!1,0,0),null==o.uv&&(o.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o.uv),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(t.attributeTexCoordLocation),this.gl.vertexAttribPointer(t.attributeTexCoordLocation,2,this.gl.FLOAT,!1,0,0);const i=g._layoutChannelNo,n=g.getClippingManager().getChannelFlagAsColor(i);this.gl.uniform4f(t.uniformChannelFlagLocation,n.R,n.G,n.B,n.A),this.gl.uniformMatrix4fv(t.uniformClipMatrixLocation,!1,g._matrixForMask.getArray());const a=g._layoutBounds;this.gl.uniform4f(t.uniformBaseColorLocation,2*a.x-1,2*a.y-1,2*a.getRight()-1,2*a.getBottom()-1),d=this.gl.ZERO,p=this.gl.ONE_MINUS_SRC_COLOR,_=this.gl.ZERO,m=this.gl.ONE_MINUS_SRC_ALPHA}else{const i=t.getClippingContextBufferForDraw(),n=null!=i?f?2:1:0;let a;switch(h){case Gs.CubismBlendMode_Normal:default:a=this._shaderSets[Xo.ShaderNames_NormalPremultipliedAlpha+n],d=this.gl.ONE,p=this.gl.ONE_MINUS_SRC_ALPHA,_=this.gl.ONE,m=this.gl.ONE_MINUS_SRC_ALPHA;break;case Gs.CubismBlendMode_Additive:a=this._shaderSets[Xo.ShaderNames_AddPremultipliedAlpha+n],d=this.gl.ONE,p=this.gl.ONE,_=this.gl.ZERO,m=this.gl.ONE;break;case Gs.CubismBlendMode_Multiplicative:a=this._shaderSets[Xo.ShaderNames_MultPremultipliedAlpha+n],d=this.gl.DST_COLOR,p=this.gl.ONE_MINUS_SRC_ALPHA,_=this.gl.ZERO,m=this.gl.ONE}if(this.gl.useProgram(a.shaderProgram),null==o.vertex&&(o.vertex=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o.vertex),this.gl.bufferData(this.gl.ARRAY_BUFFER,r,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(a.attributePositionLocation),this.gl.vertexAttribPointer(a.attributePositionLocation,2,this.gl.FLOAT,!1,0,0),null==o.uv&&(o.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o.uv),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(a.attributeTexCoordLocation),this.gl.vertexAttribPointer(a.attributeTexCoordLocation,2,this.gl.FLOAT,!1,0,0),null!=i){this.gl.activeTexture(this.gl.TEXTURE1);const t=i.getClippingManager().getColorBuffer();this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.uniform1i(a.samplerTexture1Location,1),this.gl.uniformMatrix4fv(a.uniformClipMatrixLocation,!1,i._matrixForDraw.getArray());const e=i._layoutChannelNo,r=i.getClippingManager().getChannelFlagAsColor(e);this.gl.uniform4f(a.uniformChannelFlagLocation,r.R,r.G,r.B,r.A)}this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.uniform1i(a.samplerTexture0Location,0),this.gl.uniformMatrix4fv(a.uniformMatrixLocation,!1,c.getArray()),this.gl.uniform4f(a.uniformBaseColorLocation,u.R,u.G,u.B,u.A)}null==o.index&&(o.index=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,o.index),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,n,this.gl.DYNAMIC_DRAW),this.gl.blendFuncSeparate(d,p,_,m)}releaseShaderProgram(){for(let t=0;t<this._shaderSets.length;t++)this.gl.deleteProgram(this._shaderSets[t].shaderProgram),this._shaderSets[t].shaderProgram=0;this._shaderSets=[]}generateShaders(){for(let t=0;t<10;t++)this._shaderSets.push({});this._shaderSets[0].shaderProgram=this.loadShaderProgram(Vo,Ho),this._shaderSets[1].shaderProgram=this.loadShaderProgram(jo,zo),this._shaderSets[2].shaderProgram=this.loadShaderProgram(Yo,Wo),this._shaderSets[3].shaderProgram=this.loadShaderProgram(Yo,qo),this._shaderSets[4].shaderProgram=this._shaderSets[1].shaderProgram,this._shaderSets[5].shaderProgram=this._shaderSets[2].shaderProgram,this._shaderSets[6].shaderProgram=this._shaderSets[3].shaderProgram,this._shaderSets[7].shaderProgram=this._shaderSets[1].shaderProgram,this._shaderSets[8].shaderProgram=this._shaderSets[2].shaderProgram,this._shaderSets[9].shaderProgram=this._shaderSets[3].shaderProgram,this._shaderSets[0].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[0].shaderProgram,"a_position"),this._shaderSets[0].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[0].shaderProgram,"a_texCoord"),this._shaderSets[0].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"s_texture0"),this._shaderSets[0].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_clipMatrix"),this._shaderSets[0].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_channelFlag"),this._shaderSets[0].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_baseColor"),this._shaderSets[1].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[1].shaderProgram,"a_position"),this._shaderSets[1].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[1].shaderProgram,"a_texCoord"),this._shaderSets[1].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"s_texture0"),this._shaderSets[1].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"u_matrix"),this._shaderSets[1].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"u_baseColor"),this._shaderSets[2].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[2].shaderProgram,"a_position"),this._shaderSets[2].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[2].shaderProgram,"a_texCoord"),this._shaderSets[2].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"s_texture0"),this._shaderSets[2].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"s_texture1"),this._shaderSets[2].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_matrix"),this._shaderSets[2].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_clipMatrix"),this._shaderSets[2].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_channelFlag"),this._shaderSets[2].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_baseColor"),this._shaderSets[3].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[3].shaderProgram,"a_position"),this._shaderSets[3].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[3].shaderProgram,"a_texCoord"),this._shaderSets[3].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"s_texture0"),this._shaderSets[3].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"s_texture1"),this._shaderSets[3].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_matrix"),this._shaderSets[3].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_clipMatrix"),this._shaderSets[3].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_channelFlag"),this._shaderSets[3].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_baseColor"),this._shaderSets[4].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[4].shaderProgram,"a_position"),this._shaderSets[4].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[4].shaderProgram,"a_texCoord"),this._shaderSets[4].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"s_texture0"),this._shaderSets[4].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"u_matrix"),this._shaderSets[4].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"u_baseColor"),this._shaderSets[5].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[5].shaderProgram,"a_position"),this._shaderSets[5].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[5].shaderProgram,"a_texCoord"),this._shaderSets[5].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"s_texture0"),this._shaderSets[5].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"s_texture1"),this._shaderSets[5].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_matrix"),this._shaderSets[5].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_clipMatrix"),this._shaderSets[5].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_channelFlag"),this._shaderSets[5].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_baseColor"),this._shaderSets[6].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[6].shaderProgram,"a_position"),this._shaderSets[6].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[6].shaderProgram,"a_texCoord"),this._shaderSets[6].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"s_texture0"),this._shaderSets[6].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"s_texture1"),this._shaderSets[6].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_matrix"),this._shaderSets[6].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_clipMatrix"),this._shaderSets[6].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_channelFlag"),this._shaderSets[6].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_baseColor"),this._shaderSets[7].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[7].shaderProgram,"a_position"),this._shaderSets[7].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[7].shaderProgram,"a_texCoord"),this._shaderSets[7].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"s_texture0"),this._shaderSets[7].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"u_matrix"),this._shaderSets[7].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"u_baseColor"),this._shaderSets[8].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[8].shaderProgram,"a_position"),this._shaderSets[8].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[8].shaderProgram,"a_texCoord"),this._shaderSets[8].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"s_texture0"),this._shaderSets[8].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"s_texture1"),this._shaderSets[8].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_matrix"),this._shaderSets[8].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_clipMatrix"),this._shaderSets[8].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_channelFlag"),this._shaderSets[8].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_baseColor"),this._shaderSets[9].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[9].shaderProgram,"a_position"),this._shaderSets[9].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[9].shaderProgram,"a_texCoord"),this._shaderSets[9].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"s_texture0"),this._shaderSets[9].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"s_texture1"),this._shaderSets[9].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_matrix"),this._shaderSets[9].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_clipMatrix"),this._shaderSets[9].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_channelFlag"),this._shaderSets[9].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_baseColor")}loadShaderProgram(t,e){let i=this.gl.createProgram(),r=this.compileShaderSource(this.gl.VERTEX_SHADER,t);if(!r)return Ks("Vertex shader compile error!"),0;let n=this.compileShaderSource(this.gl.FRAGMENT_SHADER,e);if(!n)return Ks("Vertex shader compile error!"),0;this.gl.attachShader(i,r),this.gl.attachShader(i,n),this.gl.linkProgram(i);return this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?(this.gl.deleteShader(r),this.gl.deleteShader(n),i):(Ks("Failed to link program: {0}",i),this.gl.deleteShader(r),this.gl.deleteShader(n),i&&this.gl.deleteProgram(i),0)}compileShaderSource(t,e){const i=e,r=this.gl.createShader(t);if(this.gl.shaderSource(r,i),this.gl.compileShader(r),!r){Ks("Shader compile log: {0} ",this.gl.getShaderInfoLog(r))}return this.gl.getShaderParameter(r,this.gl.COMPILE_STATUS)?r:(this.gl.deleteShader(r),null)}setGl(t){this.gl=t}}var Xo=(t=>(t[t.ShaderNames_SetupMask=0]="ShaderNames_SetupMask",t[t.ShaderNames_NormalPremultipliedAlpha=1]="ShaderNames_NormalPremultipliedAlpha",t[t.ShaderNames_NormalMaskedPremultipliedAlpha=2]="ShaderNames_NormalMaskedPremultipliedAlpha",t[t.ShaderNames_NomralMaskedInvertedPremultipliedAlpha=3]="ShaderNames_NomralMaskedInvertedPremultipliedAlpha",t[t.ShaderNames_AddPremultipliedAlpha=4]="ShaderNames_AddPremultipliedAlpha",t[t.ShaderNames_AddMaskedPremultipliedAlpha=5]="ShaderNames_AddMaskedPremultipliedAlpha",t[t.ShaderNames_AddMaskedPremultipliedAlphaInverted=6]="ShaderNames_AddMaskedPremultipliedAlphaInverted",t[t.ShaderNames_MultPremultipliedAlpha=7]="ShaderNames_MultPremultipliedAlpha",t[t.ShaderNames_MultMaskedPremultipliedAlpha=8]="ShaderNames_MultMaskedPremultipliedAlpha",t[t.ShaderNames_MultMaskedPremultipliedAlphaInverted=9]="ShaderNames_MultMaskedPremultipliedAlphaInverted",t))(Xo||{});const Vo="attribute vec4     a_position;attribute vec2     a_texCoord;varying vec2       v_texCoord;varying vec4       v_myPos;uniform mat4       u_clipMatrix;void main(){   gl_Position = u_clipMatrix * a_position;   v_myPos = u_clipMatrix * a_position;   v_texCoord = a_texCoord;   v_texCoord.y = 1.0 - v_texCoord.y;}",Ho="precision mediump float;varying vec2       v_texCoord;varying vec4       v_myPos;uniform vec4       u_baseColor;uniform vec4       u_channelFlag;uniform sampler2D  s_texture0;void main(){   float isInside =        step(u_baseColor.x, v_myPos.x/v_myPos.w)       * step(u_baseColor.y, v_myPos.y/v_myPos.w)       * step(v_myPos.x/v_myPos.w, u_baseColor.z)       * step(v_myPos.y/v_myPos.w, u_baseColor.w);   gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",jo="attribute vec4     a_position;attribute vec2     a_texCoord;varying vec2       v_texCoord;uniform mat4       u_matrix;void main(){   gl_Position = u_matrix * a_position;   v_texCoord = a_texCoord;   v_texCoord.y = 1.0 - v_texCoord.y;}",Yo="attribute vec4     a_position;attribute vec2     a_texCoord;varying vec2       v_texCoord;varying vec4       v_clipPos;uniform mat4       u_matrix;uniform mat4       u_clipMatrix;void main(){   gl_Position = u_matrix * a_position;   v_clipPos = u_clipMatrix * a_position;   v_texCoord = a_texCoord;   v_texCoord.y = 1.0 - v_texCoord.y;}",zo="precision mediump float;varying vec2       v_texCoord;uniform vec4       u_baseColor;uniform sampler2D  s_texture0;void main(){   gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}",Wo="precision mediump float;varying vec2       v_texCoord;varying vec4       v_clipPos;uniform vec4       u_baseColor;uniform vec4       u_channelFlag;uniform sampler2D  s_texture0;uniform sampler2D  s_texture1;void main(){   vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor;   vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;   float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;   col_formask = col_formask * maskVal;   gl_FragColor = col_formask;}",qo="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}";class Zo extends Us{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new Bo,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(t){t.isUsingMasking()&&(this._clippingManager=new Bo,this._clippingManager.initialize(t,t.getDrawableCount(),t.getDrawableMasks(),t.getDrawableMaskCounts()));for(let e=t.getDrawableCount()-1;e>=0;e--)this._sortedDrawableIndexList[e]=0;super.initialize(t)}bindTexture(t,e){this._textures[t]=e}getBindedTextures(){return this._textures}setClippingMaskBufferSize(t){this._clippingManager.release(),this._clippingManager=new Bo,this._clippingManager.setClippingMaskBufferSize(t),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var t,e,i;const r=this;this._clippingManager.release(),r._clippingManager=void 0,null==(t=this.gl)||t.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,null==(e=this.gl)||e.deleteBuffer(this._bufferData.uv),this._bufferData.uv=null,null==(i=this.gl)||i.deleteBuffer(this._bufferData.index),this._bufferData.index=null,r._bufferData=void 0,r._textures=void 0}doDrawModel(){this.preDraw(),null!=this._clippingManager&&this._clippingManager.setupClippingContext(this.getModel(),this);const t=this.getModel().getDrawableCount(),e=this.getModel().getDrawableRenderOrders();for(let i=0;i<t;++i){const t=e[i];this._sortedDrawableIndexList[t]=i}for(let e=0;e<t;++e){const t=this._sortedDrawableIndexList[e];this.getModel().getDrawableDynamicFlagIsVisible(t)&&(this.setClippingContextBufferForDraw(null!=this._clippingManager?this._clippingManager.getClippingContextListForDraw()[t]:null),this.setIsCulling(this.getModel().getDrawableCulling(t)),this.drawMesh(this.getModel().getDrawableTextureIndices(t),this.getModel().getDrawableVertexIndexCount(t),this.getModel().getDrawableVertexCount(t),this.getModel().getDrawableVertexIndices(t),this.getModel().getDrawableVertices(t),this.getModel().getDrawableVertexUvs(t),this.getModel().getDrawableOpacity(t),this.getModel().getDrawableBlendMode(t),this.getModel().getDrawableInvertedMaskBit(t)))}}drawMesh(t,e,i,r,n,s,o,a,h){this.isCulling()?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this.gl.frontFace(this.gl.CCW);const u=this.getModelColor();null==this.getClippingContextBufferForMask()&&(u.A*=o,this.isPremultipliedAlpha()&&(u.R*=u.A,u.G*=u.A,u.B*=u.A));let l=null;null!=this._textures[t]&&(l=this._textures[t]),Go.getInstance().setupShaderProgram(this,l,i,n,r,s,this._bufferData,o,a,u,this.isPremultipliedAlpha(),this.getMvpMatrix(),h),this.gl.drawElements(this.gl.TRIANGLES,e,this.gl.UNSIGNED_SHORT,0),this.gl.useProgram(null),this.setClippingContextBufferForDraw(null),this.setClippingContextBufferForMask(null)}static doStaticRelease(){Go.deleteInstance()}setRenderState(t,e){ko=t,Fo=e}preDraw(){this.firstDraw&&(this.firstDraw=!1,this._anisortopy=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")),this.gl.disable(this.gl.SCISSOR_TEST),this.gl.disable(this.gl.STENCIL_TEST),this.gl.disable(this.gl.DEPTH_TEST),this.gl.frontFace(this.gl.CW),this.gl.enable(this.gl.BLEND),this.gl.colorMask(!0,!0,!0,!0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null)}setClippingContextBufferForMask(t){this._clippingContextBufferForMask=t}getClippingContextBufferForMask(){return this._clippingContextBufferForMask}setClippingContextBufferForDraw(t){this._clippingContextBufferForDraw=t}getClippingContextBufferForDraw(){return this._clippingContextBufferForDraw}startUp(t){this.gl=t,this._clippingManager.setGL(t),Go.getInstance().setGl(t)}}Us.staticRelease=()=>{Zo.doStaticRelease()};const Qo=new Ns;class Jo extends Qn{constructor(t,e,i){super(),this.lipSync=!0,this.breath=Io.create(),this.renderer=new Zo,this.idParamAngleX="ParamAngleX",this.idParamAngleY="ParamAngleY",this.idParamAngleZ="ParamAngleZ",this.idParamEyeBallX="ParamEyeBallX",this.idParamEyeBallY="ParamEyeBallY",this.idParamBodyAngleX="ParamBodyAngleX",this.idParamBreath="ParamBreath",this.pixelsPerUnit=1,this.centeringTransform=new Ve,this.coreModel=t,this.settings=e,this.motionManager=new Mo(e,i),this.init()}init(){var t;super.init(),(null==(t=this.settings.getEyeBlinkParameters())?void 0:t.length)>0&&(this.eyeBlink=Oo.create(this.settings)),this.breath.setParameters([new Co(this.idParamAngleX,0,15,6.5345,.5),new Co(this.idParamAngleY,0,8,3.5345,.5),new Co(this.idParamAngleZ,0,10,5.5345,.5),new Co(this.idParamBodyAngleX,0,4,15.5345,.5),new Co(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){t[e.charAt(0).toLowerCase()+e.slice(1)]=this.settings.layout[e]}return t}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(t,e){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(t),this.renderer._clippingManager._currentFrameNo=e,this.renderer._clippingManager._maskTexture=void 0,Go.getInstance()._shaderSets=[]}bindTexture(t,e){this.renderer.bindTexture(t,e)}getHitAreaDefs(){var t,e;return null!=(e=null==(t=this.settings.hitAreas)?void 0:t.map(t=>({id:t.Id,name:t.Name,index:this.coreModel.getDrawableIndex(t.Id)})))?e:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(t){return this.coreModel.getDrawableIndex(t)}getDrawableVertices(t){if("string"==typeof t&&-1===(t=this.coreModel.getDrawableIndex(t)))throw new TypeError("Unable to find drawable ID: "+t);const e=this.coreModel.getDrawableVertices(t).slice();for(let t=0;t<e.length;t+=2)e[t]=e[t]*this.pixelsPerUnit+this.originalWidth/2,e[t+1]=-e[t+1]*this.pixelsPerUnit+this.originalHeight/2;return e}updateTransform(t){this.drawingMatrix.copyFrom(this.centeringTransform).prepend(this.localTransform).prepend(t)}update(t,e){var i,r,n,s;super.update(t,e),t/=1e3,e/=1e3;const o=this.coreModel;this.emit("beforeMotionUpdate");const a=this.motionManager.update(this.coreModel,e);this.emit("afterMotionUpdate"),o.saveParameters(),null==(i=this.motionManager.expressionManager)||i.update(o,e),a||null==(r=this.eyeBlink)||r.updateParameters(o,t),this.updateFocus(),this.updateNaturalMovements(1e3*t,1e3*e),null==(n=this.physics)||n.evaluate(o,t),null==(s=this.pose)||s.updateParameters(o,t),this.emit("beforeModelUpdate"),o.update(),o.loadParameters()}updateFocus(){this.coreModel.addParameterValueById(this.idParamEyeBallX,this.focusController.x),this.coreModel.addParameterValueById(this.idParamEyeBallY,this.focusController.y),this.coreModel.addParameterValueById(this.idParamAngleX,30*this.focusController.x),this.coreModel.addParameterValueById(this.idParamAngleY,30*this.focusController.y),this.coreModel.addParameterValueById(this.idParamAngleZ,this.focusController.x*this.focusController.y*-30),this.coreModel.addParameterValueById(this.idParamBodyAngleX,10*this.focusController.x)}updateNaturalMovements(t,e){var i;null==(i=this.breath)||i.updateParameters(this.coreModel,t/1e3)}draw(t){const e=this.drawingMatrix,i=Qo.getArray();i[0]=e.a,i[1]=e.b,i[4]=-e.c,i[5]=-e.d,i[12]=e.tx,i[13]=e.ty,this.renderer.setMvpMatrix(Qo),this.renderer.setRenderState(t.getParameter(t.FRAMEBUFFER_BINDING),this.viewport),this.renderer.drawModel()}destroy(){super.destroy(),this.renderer.release(),this.coreModel.release(),this.renderer=void 0,this.coreModel=void 0}}let Ko,ta=20;class ea{static create(t){const e=new ea;"number"==typeof t.FadeInTime&&(e._fadeTimeSeconds=t.FadeInTime,e._fadeTimeSeconds<=0&&(e._fadeTimeSeconds=.5));const i=t.Groups,r=i.length;for(let t=0;t<r;++t){const r=i[t],n=r.length;let s=0;for(let t=0;t<n;++t){const i=r[t],n=new ia;n.partId=i.Id;const o=i.Link;if(o){const t=o.length;for(let e=0;e<t;++e){const t=new ia;t.partId=o[e],n.link.push(t)}}e._partGroups.push(n),++s}e._partGroupCounts.push(s)}return e}updateParameters(t,e){t!=this._lastModel&&this.reset(t),this._lastModel=t,e<0&&(e=0);let i=0;for(let r=0;r<this._partGroupCounts.length;r++){const n=this._partGroupCounts[r];this.doFade(t,e,i,n),i+=n}this.copyPartOpacities(t)}reset(t){let e=0;for(let i=0;i<this._partGroupCounts.length;++i){const r=this._partGroupCounts[i];for(let i=e;i<e+r;++i){this._partGroups[i].initialize(t);const r=this._partGroups[i].partIndex,n=this._partGroups[i].parameterIndex;if(!(r<0)){t.setPartOpacityByIndex(r,i==e?1:0),t.setParameterValueByIndex(n,i==e?1:0);for(let e=0;e<this._partGroups[i].link.length;++e)this._partGroups[i].link[e].initialize(t)}}e+=r}}copyPartOpacities(t){for(let e=0;e<this._partGroups.length;++e){const i=this._partGroups[e];if(0==i.link.length)continue;const r=this._partGroups[e].partIndex,n=t.getPartOpacityByIndex(r);for(let e=0;e<i.link.length;++e){const r=i.link[e].partIndex;r<0||t.setPartOpacityByIndex(r,n)}}}doFade(t,e,i,r){let n=-1,s=1;const o=.5;for(let o=i;o<i+r;++o){const i=this._partGroups[o].partIndex,r=this._partGroups[o].parameterIndex;if(t.getParameterValueByIndex(r)>.001){if(n>=0)break;n=o,s=t.getPartOpacityByIndex(i),s+=e/this._fadeTimeSeconds,s>1&&(s=1)}}n<0&&(n=0,s=1);for(let e=i;e<i+r;++e){const i=this._partGroups[e].partIndex;if(n==e)t.setPartOpacityByIndex(i,s);else{let e,r=t.getPartOpacityByIndex(i);e=s<o?-.5*s/o+1:(1-s)*o/.5;(1-e)*(1-s)>.15&&(e=1-.15/(1-s)),r>e&&(r=e),t.setPartOpacityByIndex(i,r)}}}constructor(){this._fadeTimeSeconds=.5,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class ia{constructor(t){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],null!=t&&this.assignment(t)}assignment(t){return this.partId=t.partId,this.link=t.link.map(t=>t.clone()),this}initialize(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)}clone(){const t=new ia;return t.partId=this.partId,t.parameterIndex=this.parameterIndex,t.partIndex=this.partIndex,t.link=this.link.map(t=>t.clone()),t}}class ra{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getCanvasWidth(){return null==this._model?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return null==this._model?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const t=this._model.parameters.count,e=this._savedParameters.length;for(let i=0;i<t;++i)i<e?this._savedParameters[i]=this._parameterValues[i]:this._savedParameters.push(this._parameterValues[i])}getModel(){return this._model}getPartIndex(t){let e;const i=this._model.parts.count;for(e=0;e<i;++e)if(t==this._partIds[e])return e;return t in this._notExistPartId?this._notExistPartId[t]:(e=i+this._notExistPartId.length,this._notExistPartId[t]=e,this._notExistPartOpacities[e]=0,e)}getPartCount(){return this._model.parts.count}setPartOpacityByIndex(t,e){t in this._notExistPartOpacities?this._notExistPartOpacities[t]=e:(0<=t&&this.getPartCount(),this._partOpacities[t]=e)}setPartOpacityById(t,e){const i=this.getPartIndex(t);i<0||this.setPartOpacityByIndex(i,e)}getPartOpacityByIndex(t){return t in this._notExistPartOpacities?this._notExistPartOpacities[t]:(0<=t&&this.getPartCount(),this._partOpacities[t])}getPartOpacityById(t){const e=this.getPartIndex(t);return e<0?0:this.getPartOpacityByIndex(e)}getParameterIndex(t){let e;const i=this._model.parameters.count;for(e=0;e<i;++e)if(t==this._parameterIds[e])return e;return t in this._notExistParameterId?this._notExistParameterId[t]:(e=this._model.parameters.count+Object.keys(this._notExistParameterId).length,this._notExistParameterId[t]=e,this._notExistParameterValues[e]=0,e)}getParameterCount(){return this._model.parameters.count}getParameterMaximumValue(t){return this._model.parameters.maximumValues[t]}getParameterMinimumValue(t){return this._model.parameters.minimumValues[t]}getParameterDefaultValue(t){return this._model.parameters.defaultValues[t]}getParameterValueByIndex(t){return t in this._notExistParameterValues?this._notExistParameterValues[t]:(0<=t&&this.getParameterCount(),this._parameterValues[t])}getParameterValueById(t){const e=this.getParameterIndex(t);return this.getParameterValueByIndex(e)}setParameterValueByIndex(t,e,i=1){t in this._notExistParameterValues?this._notExistParameterValues[t]=1==i?e:this._notExistParameterValues[t]*(1-i)+e*i:(0<=t&&this.getParameterCount(),this._model.parameters.maximumValues[t]<e&&(e=this._model.parameters.maximumValues[t]),this._model.parameters.minimumValues[t]>e&&(e=this._model.parameters.minimumValues[t]),this._parameterValues[t]=1==i?e:this._parameterValues[t]=this._parameterValues[t]*(1-i)+e*i)}setParameterValueById(t,e,i=1){const r=this.getParameterIndex(t);this.setParameterValueByIndex(r,e,i)}addParameterValueByIndex(t,e,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+e*i)}addParameterValueById(t,e,i=1){const r=this.getParameterIndex(t);this.addParameterValueByIndex(r,e,i)}multiplyParameterValueById(t,e,i=1){const r=this.getParameterIndex(t);this.multiplyParameterValueByIndex(r,e,i)}multiplyParameterValueByIndex(t,e,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(e-1)*i))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(t){const e=this._model.drawables.count;for(let i=0;i<e;++i)if(this._drawableIds[i]==t)return i;return-1}getDrawableCount(){return this._model.drawables.count}getDrawableId(t){return this._model.drawables.ids[t]}getDrawableRenderOrders(){return this._model.drawables.renderOrders}getDrawableTextureIndices(t){return this._model.drawables.textureIndices[t]}getDrawableDynamicFlagVertexPositionsDidChange(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(e[t])}getDrawableVertexIndexCount(t){return this._model.drawables.indexCounts[t]}getDrawableVertexCount(t){return this._model.drawables.vertexCounts[t]}getDrawableVertices(t){return this.getDrawableVertexPositions(t)}getDrawableVertexIndices(t){return this._model.drawables.indices[t]}getDrawableVertexPositions(t){return this._model.drawables.vertexPositions[t]}getDrawableVertexUvs(t){return this._model.drawables.vertexUvs[t]}getDrawableOpacity(t){return this._model.drawables.opacities[t]}getDrawableCulling(t){const e=this._model.drawables.constantFlags;return!Live2DCubismCore.Utils.hasIsDoubleSidedBit(e[t])}getDrawableBlendMode(t){const e=this._model.drawables.constantFlags;return Live2DCubismCore.Utils.hasBlendAdditiveBit(e[t])?Gs.CubismBlendMode_Additive:Live2DCubismCore.Utils.hasBlendMultiplicativeBit(e[t])?Gs.CubismBlendMode_Multiplicative:Gs.CubismBlendMode_Normal}getDrawableInvertedMaskBit(t){const e=this._model.drawables.constantFlags;return Live2DCubismCore.Utils.hasIsInvertedMaskBit(e[t])}getDrawableMasks(){return this._model.drawables.masks}getDrawableMaskCounts(){return this._model.drawables.maskCounts}isUsingMasking(){for(let t=0;t<this._model.drawables.count;++t)if(!(this._model.drawables.maskCounts[t]<=0))return!0;return!1}getDrawableDynamicFlagIsVisible(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasIsVisibleBit(e[t])}getDrawableDynamicFlagVisibilityDidChange(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(e[t])}getDrawableDynamicFlagOpacityDidChange(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasOpacityDidChangeBit(e[t])}getDrawableDynamicFlagRenderOrderDidChange(t){const e=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(e[t])}loadParameters(){let t=this._model.parameters.count;const e=this._savedParameters.length;t>e&&(t=e);for(let e=0;e<t;++e)this._parameterValues[e]=this._savedParameters[e]}initialize(){this._parameterValues=this._model.parameters.values,this._partOpacities=this._model.parts.opacities,this._parameterMaximumValues=this._model.parameters.maximumValues,this._parameterMinimumValues=this._model.parameters.minimumValues;{const t=this._model.parameters.ids,e=this._model.parameters.count;for(let i=0;i<e;++i)this._parameterIds.push(t[i])}{const t=this._model.parts.ids,e=this._model.parts.count;for(let i=0;i<e;++i)this._partIds.push(t[i])}{const t=this._model.drawables.ids,e=this._model.drawables.count;for(let i=0;i<e;++i)this._drawableIds.push(t[i])}}constructor(t){this._model=t,this._savedParameters=[],this._parameterIds=[],this._drawableIds=[],this._partIds=[],this._notExistPartId={},this._notExistParameterId={},this._notExistParameterValues={},this._notExistPartOpacities={},this.initialize()}release(){this._model.release(),this._model=void 0}}class na{static create(t){const e=Live2DCubismCore.Moc.fromArrayBuffer(t);if(e)return new na(e);throw new Error("Unknown error")}createModel(){let t;const e=Live2DCubismCore.Model.fromMoc(this._moc);if(e)return t=new ra(e),++this._modelCount,t;throw new Error("Unknown error")}deleteModel(t){null!=t&&--this._modelCount}constructor(t){this._moc=t,this._modelCount=0}release(){this._moc._release(),this._moc=void 0}}var sa=(t=>(t[t.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",t))(sa||{}),oa=(t=>(t[t.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",t[t.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",t[t.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",t))(oa||{});class aa{constructor(){this.initialPosition=new Fs(0,0),this.position=new Fs(0,0),this.lastPosition=new Fs(0,0),this.lastGravity=new Fs(0,0),this.force=new Fs(0,0),this.velocity=new Fs(0,0)}}class ha{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class ua{constructor(){this.source={}}}class la{constructor(){this.destination={},this.translationScale=new Fs(0,0)}}class ca{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new Fs(0,0),this.wind=new Fs(0,0)}}class fa{constructor(t){this._json=t}release(){this._json=void 0}getGravity(){const t=new Fs(0,0);return t.x=this._json.Meta.EffectiveForces.Gravity.X,t.y=this._json.Meta.EffectiveForces.Gravity.Y,t}getWind(){const t=new Fs(0,0);return t.x=this._json.Meta.EffectiveForces.Wind.X,t.y=this._json.Meta.EffectiveForces.Wind.Y,t}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Default}getNormalizationAngleMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Default}getInputCount(t){return this._json.PhysicsSettings[t].Input.length}getInputWeight(t,e){return this._json.PhysicsSettings[t].Input[e].Weight}getInputReflect(t,e){return this._json.PhysicsSettings[t].Input[e].Reflect}getInputType(t,e){return this._json.PhysicsSettings[t].Input[e].Type}getInputSourceId(t,e){return this._json.PhysicsSettings[t].Input[e].Source.Id}getOutputCount(t){return this._json.PhysicsSettings[t].Output.length}getOutputVertexIndex(t,e){return this._json.PhysicsSettings[t].Output[e].VertexIndex}getOutputAngleScale(t,e){return this._json.PhysicsSettings[t].Output[e].Scale}getOutputWeight(t,e){return this._json.PhysicsSettings[t].Output[e].Weight}getOutputDestinationId(t,e){return this._json.PhysicsSettings[t].Output[e].Destination.Id}getOutputType(t,e){return this._json.PhysicsSettings[t].Output[e].Type}getOutputReflect(t,e){return this._json.PhysicsSettings[t].Output[e].Reflect}getParticleCount(t){return this._json.PhysicsSettings[t].Vertices.length}getParticleMobility(t,e){return this._json.PhysicsSettings[t].Vertices[e].Mobility}getParticleDelay(t,e){return this._json.PhysicsSettings[t].Vertices[e].Delay}getParticleAcceleration(t,e){return this._json.PhysicsSettings[t].Vertices[e].Acceleration}getParticleRadius(t,e){return this._json.PhysicsSettings[t].Vertices[e].Radius}getParticlePosition(t,e){const i=new Fs(0,0);return i.x=this._json.PhysicsSettings[t].Vertices[e].Position.X,i.y=this._json.PhysicsSettings[t].Vertices[e].Position.Y,i}}const da="Angle";class pa{static create(t){const e=new pa;return e.parse(t),e._physicsRig.gravity.y=0,e}evaluate(t,e){let i,r,n,s;const o=new Fs;let a,h,u,l,c,f,d,p;c=t.getModel().parameters.values,f=t.getModel().parameters.maximumValues,d=t.getModel().parameters.minimumValues,p=t.getModel().parameters.defaultValues;for(let _=0;_<this._physicsRig.subRigCount;++_){i={angle:0},o.x=0,o.y=0,a=this._physicsRig.settings[_],h=this._physicsRig.inputs.slice(a.baseInputIndex),u=this._physicsRig.outputs.slice(a.baseOutputIndex),l=this._physicsRig.particles.slice(a.baseParticleIndex);for(let e=0;e<a.inputCount;++e)r=h[e].weight/100,-1==h[e].sourceParameterIndex&&(h[e].sourceParameterIndex=t.getParameterIndex(h[e].source.id)),h[e].getNormalizedParameterValue(o,i,c[h[e].sourceParameterIndex],d[h[e].sourceParameterIndex],f[h[e].sourceParameterIndex],p[h[e].sourceParameterIndex],a.normalizationPosition,a.normalizationAngle,h[e].reflect,r);n=Bs.degreesToRadian(-i.angle),o.x=o.x*Bs.cos(n)-o.y*Bs.sin(n),o.y=o.x*Bs.sin(n)+o.y*Bs.cos(n),Sa(l,a.particleCount,o,i.angle,this._options.wind,.001*a.normalizationPosition.maximum,e,5);for(let e=0;e<a.outputCount;++e){const i=u[e].vertexIndex;if(i<1||i>=a.particleCount)break;-1==u[e].destinationParameterIndex&&(u[e].destinationParameterIndex=t.getParameterIndex(u[e].destination.id));const r=new Fs;r.x=l[i].position.x-l[i-1].position.x,r.y=l[i].position.y-l[i-1].position.y,s=u[e].getValue(r,l,i,u[e].reflect,this._options.gravity);const n=u[e].destinationParameterIndex,o=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(c.subarray(n))):c.slice(n);Pa(o,d[n],f[n],s,u[e]);for(let t=n,e=0;t<c.length;t++,e++)c[t]=o[e]}}}setOptions(t){this._options=t}getOption(){return this._options}constructor(){this._options=new _a,this._options.gravity.y=-1,this._options.gravity.x=0,this._options.wind.x=0,this._options.wind.y=0}release(){this._physicsRig=void 0}parse(t){this._physicsRig=new ca;let e=new fa(t);this._physicsRig.gravity=e.getGravity(),this._physicsRig.wind=e.getWind(),this._physicsRig.subRigCount=e.getSubRigCount();let i=0,r=0,n=0;for(let t=0;t<this._physicsRig.subRigCount;++t){const s=new ha;s.normalizationPosition.minimum=e.getNormalizationPositionMinimumValue(t),s.normalizationPosition.maximum=e.getNormalizationPositionMaximumValue(t),s.normalizationPosition.defalut=e.getNormalizationPositionDefaultValue(t),s.normalizationAngle.minimum=e.getNormalizationAngleMinimumValue(t),s.normalizationAngle.maximum=e.getNormalizationAngleMaximumValue(t),s.normalizationAngle.defalut=e.getNormalizationAngleDefaultValue(t),s.inputCount=e.getInputCount(t),s.baseInputIndex=i,i+=s.inputCount;for(let i=0;i<s.inputCount;++i){const r=new ua;switch(r.sourceParameterIndex=-1,r.weight=e.getInputWeight(t,i),r.reflect=e.getInputReflect(t,i),e.getInputType(t,i)){case"X":r.type=oa.CubismPhysicsSource_X,r.getNormalizedParameterValue=ma;break;case"Y":r.type=oa.CubismPhysicsSource_Y,r.getNormalizedParameterValue=ga;break;case da:r.type=oa.CubismPhysicsSource_Angle,r.getNormalizedParameterValue=va}r.source.targetType=sa.CubismPhysicsTargetType_Parameter,r.source.id=e.getInputSourceId(t,i),this._physicsRig.inputs.push(r)}s.outputCount=e.getOutputCount(t),s.baseOutputIndex=r,r+=s.outputCount;for(let i=0;i<s.outputCount;++i){const r=new la;switch(r.destinationParameterIndex=-1,r.vertexIndex=e.getOutputVertexIndex(t,i),r.angleScale=e.getOutputAngleScale(t,i),r.weight=e.getOutputWeight(t,i),r.destination.targetType=sa.CubismPhysicsTargetType_Parameter,r.destination.id=e.getOutputDestinationId(t,i),e.getOutputType(t,i)){case"X":r.type=oa.CubismPhysicsSource_X,r.getValue=ya,r.getScale=Aa;break;case"Y":r.type=oa.CubismPhysicsSource_Y,r.getValue=ba,r.getScale=Ea;break;case da:r.type=oa.CubismPhysicsSource_Angle,r.getValue=xa,r.getScale=wa}r.reflect=e.getOutputReflect(t,i),this._physicsRig.outputs.push(r)}s.particleCount=e.getParticleCount(t),s.baseParticleIndex=n,n+=s.particleCount;for(let i=0;i<s.particleCount;++i){const r=new aa;r.mobility=e.getParticleMobility(t,i),r.delay=e.getParticleDelay(t,i),r.acceleration=e.getParticleAcceleration(t,i),r.radius=e.getParticleRadius(t,i),r.position=e.getParticlePosition(t,i),this._physicsRig.particles.push(r)}this._physicsRig.settings.push(s)}this.initialize(),e.release()}initialize(){let t,e,i;for(let r=0;r<this._physicsRig.subRigCount;++r){e=this._physicsRig.settings[r],t=this._physicsRig.particles.slice(e.baseParticleIndex),t[0].initialPosition=new Fs(0,0),t[0].lastPosition=new Fs(t[0].initialPosition.x,t[0].initialPosition.y),t[0].lastGravity=new Fs(0,-1),t[0].lastGravity.y*=-1,t[0].velocity=new Fs(0,0),t[0].force=new Fs(0,0);for(let r=1;r<e.particleCount;++r)i=new Fs(0,0),i.y=t[r].radius,t[r].initialPosition=new Fs(t[r-1].initialPosition.x+i.x,t[r-1].initialPosition.y+i.y),t[r].position=new Fs(t[r].initialPosition.x,t[r].initialPosition.y),t[r].lastPosition=new Fs(t[r].initialPosition.x,t[r].initialPosition.y),t[r].lastGravity=new Fs(0,-1),t[r].lastGravity.y*=-1,t[r].velocity=new Fs(0,0),t[r].force=new Fs(0,0)}}}class _a{constructor(){this.gravity=new Fs(0,0),this.wind=new Fs(0,0)}}function ma(t,e,i,r,n,s,o,a,h,u){t.x+=Ma(i,r,n,s,o.minimum,o.maximum,o.defalut,h)*u}function ga(t,e,i,r,n,s,o,a,h,u){t.y+=Ma(i,r,n,s,o.minimum,o.maximum,o.defalut,h)*u}function va(t,e,i,r,n,s,o,a,h,u){e.angle+=Ma(i,r,n,s,a.minimum,a.maximum,a.defalut,h)*u}function ya(t,e,i,r,n){let s=t.x;return r&&(s*=-1),s}function ba(t,e,i,r,n){let s=t.y;return r&&(s*=-1),s}function xa(t,e,i,r,n){let s;return n=i>=2?e[i-1].position.substract(e[i-2].position):n.multiplyByScaler(-1),s=Bs.directionToRadian(n,t),r&&(s*=-1),s}function Ta(t,e){return Math.min(t,e)+function(t,e){return Math.abs(Math.max(t,e)-Math.min(t,e))}(t,e)/2}function Aa(t,e){return t.x}function Ea(t,e){return t.y}function wa(t,e){return e}function Sa(t,e,i,r,n,s,o,a){let h,u,l,c,f=new Fs(0,0),d=new Fs(0,0),p=new Fs(0,0),_=new Fs(0,0);t[0].position=new Fs(i.x,i.y),h=Bs.degreesToRadian(r),c=Bs.radianToDirection(h),c.normalize();for(let i=1;i<e;++i)t[i].force=c.multiplyByScaler(t[i].acceleration).add(n),t[i].lastPosition=new Fs(t[i].position.x,t[i].position.y),u=t[i].delay*o*30,f=t[i].position.substract(t[i-1].position),l=Bs.directionToRadian(t[i].lastGravity,c)/a,f.x=Bs.cos(l)*f.x-f.y*Bs.sin(l),f.y=Bs.sin(l)*f.x+f.y*Bs.cos(l),t[i].position=t[i-1].position.add(f),d=t[i].velocity.multiplyByScaler(u),p=t[i].force.multiplyByScaler(u).multiplyByScaler(u),t[i].position=t[i].position.add(d).add(p),_=t[i].position.substract(t[i-1].position),_.normalize(),t[i].position=t[i-1].position.add(_.multiplyByScaler(t[i].radius)),Bs.abs(t[i].position.x)<s&&(t[i].position.x=0),0!=u&&(t[i].velocity=t[i].position.substract(t[i].lastPosition),t[i].velocity=t[i].velocity.divisionByScalar(u),t[i].velocity=t[i].velocity.multiplyByScaler(t[i].mobility)),t[i].force=new Fs(0,0),t[i].lastGravity=new Fs(c.x,c.y)}function Pa(t,e,i,r,n){let s,o,a;s=n.getScale(n.translationScale,n.angleScale),o=r*s,o<e?(o<n.valueBelowMinimum&&(n.valueBelowMinimum=o),o=e):o>i&&(o>n.valueExceededMaximum&&(n.valueExceededMaximum=o),o=i),a=n.weight/100,a>=1||(o=t[0]*(1-a)+o*a),t[0]=o}function Ma(t,e,i,r,n,s,o,a){let h=0;const u=Bs.max(i,e);u<t&&(t=u);const l=Bs.min(i,e);l>t&&(t=l);const c=Bs.min(n,s),f=Bs.max(n,s),d=o,p=Ta(l,u),_=t-p;switch(Math.sign(_)){case 1:{const t=u-p;0!=t&&(h=_*((f-d)/t),h+=d);break}case-1:{const t=l-p;0!=t&&(h=_*((c-d)/t),h+=d);break}case 0:h=d}return a?h:-1*h}function Ia(){var t;null==(t=this.__moc)||t.release()}function Ca(t,e){this.name="AggregateError",this.errors=t,this.message=e||""}cs.registerRuntime({version:4,ready:function(){return Ws.isStarted()?Promise.resolve():(null!=Ko||(Ko=new Promise((t,e)=>{!function i(){try{r=Object.assign({logFunction:console.log,loggingLevel:qs.LogLevel_Verbose},r),Ws.startUp(r),Ws.initialize(),t()}catch(t){if(ta--,ta<0){const i=new Error("Failed to start up Cubism 4 framework.");return i.cause=t,void e(i)}Ln.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(i,10)}var r}()})),Ko)},test:t=>t instanceof uo||uo.isValidJSON(t),isValidMoc(t){if(t.byteLength<4)return!1;const e=new Int8Array(t,0,4);return"MOC3"===String.fromCharCode(...e)},createModelSettings:t=>new uo(t),createCoreModel(t){const e=na.create(t);try{const t=e.createModel();return t.__moc=e,t}catch(t){try{e.release()}catch(t){}throw t}},createInternalModel(t,e,i){const r=new Jo(t,e,i),n=t;return n.__moc&&(r.__moc=n.__moc,delete n.__moc,r.once("destroy",Ia)),r},createPhysics:(t,e)=>pa.create(e),createPose:(t,e)=>ea.create(e)}),Ca.prototype=Error.prototype;var Ra=setTimeout;function Oa(t){return Boolean(t&&void 0!==t.length)}function $a(){}function Da(t){if(!(this instanceof Da))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],Ua(t,this)}function La(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,Da._immediateFn(function(){var i=1===t._state?e.onFulfilled:e.onRejected;if(null!==i){var r;try{r=i(t._value)}catch(t){return void ka(e.promise,t)}Fa(e.promise,r)}else(1===t._state?Fa:ka)(e.promise,t._value)})):t._deferreds.push(e)}function Fa(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var i=e.then;if(e instanceof Da)return t._state=3,t._value=e,void Ba(t);if("function"==typeof i)return void Ua((r=i,n=e,function(){r.apply(n,arguments)}),t)}t._state=1,t._value=e,Ba(t)}catch(e){ka(t,e)}var r,n}function ka(t,e){t._state=2,t._value=e,Ba(t)}function Ba(t){2===t._state&&0===t._deferreds.length&&Da._immediateFn(function(){t._handled||Da._unhandledRejectionFn(t._value)});for(var e=0,i=t._deferreds.length;e<i;e++)La(t,t._deferreds[e]);t._deferreds=null}function Na(t,e,i){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=i}function Ua(t,e){var i=!1;try{t(function(t){i||(i=!0,Fa(e,t))},function(t){i||(i=!0,ka(e,t))})}catch(t){if(i)return;i=!0,ka(e,t)}}Da.prototype.catch=function(t){return this.then(null,t)},Da.prototype.then=function(t,e){var i=new this.constructor($a);return La(this,new Na(t,e,i)),i},Da.prototype.finally=function(t){var e=this.constructor;return this.then(function(i){return e.resolve(t()).then(function(){return i})},function(i){return e.resolve(t()).then(function(){return e.reject(i)})})},Da.all=function(t){return new Da(function(e,i){if(!Oa(t))return i(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var n=r.length;function s(t,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var a=o.then;if("function"==typeof a)return void a.call(o,function(e){s(t,e)},i)}r[t]=o,0===--n&&e(r)}catch(t){i(t)}}for(var o=0;o<r.length;o++)s(o,r[o])})},Da.any=function(t){var e=this;return new e(function(i,r){if(!t||void 0===t.length)return r(new TypeError("Promise.any accepts an array"));var n=Array.prototype.slice.call(t);if(0===n.length)return r();for(var s=[],o=0;o<n.length;o++)try{e.resolve(n[o]).then(i).catch(function(t){s.push(t),s.length===n.length&&r(new Ca(s,"All promises were rejected"))})}catch(t){r(t)}})},Da.allSettled=function(t){return new this(function(e,i){if(!t||void 0===t.length)return i(new TypeError(typeof t+" "+t+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var n=r.length;function s(t,i){if(i&&("object"==typeof i||"function"==typeof i)){var o=i.then;if("function"==typeof o)return void o.call(i,function(e){s(t,e)},function(i){r[t]={status:"rejected",reason:i},0===--n&&e(r)})}r[t]={status:"fulfilled",value:i},0===--n&&e(r)}for(var o=0;o<r.length;o++)s(o,r[o])})},Da.resolve=function(t){return t&&"object"==typeof t&&t.constructor===Da?t:new Da(function(e){e(t)})},Da.reject=function(t){return new Da(function(e,i){i(t)})},Da.race=function(t){return new Da(function(e,i){if(!Oa(t))return i(new TypeError("Promise.race accepts an array"));for(var r=0,n=t.length;r<n;r++)Da.resolve(t[r]).then(e,i)})},Da._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){Ra(t,0)},Da._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};
/*
  object-assign
  (c) Sindre Sorhus
  @license MIT
  */
var Ga=Object.getOwnPropertySymbols,Xa=Object.prototype.hasOwnProperty,Va=Object.prototype.propertyIsEnumerable;var Ha=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var i,r,n=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),s=1;s<arguments.length;s++){for(var o in i=Object(arguments[s]))Xa.call(i,o)&&(n[o]=i[o]);if(Ga){r=Ga(i);for(var a=0;a<r.length;a++)Va.call(i,r[a])&&(n[r[a]]=i[r[a]])}}return n},ja=V(Ha);
/*!
   * @pixi/polyfill - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/polyfill is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
"undefined"==typeof globalThis&&("undefined"!=typeof self?self.globalThis=self:"undefined"!=typeof global&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=Da),Object.assign||(Object.assign=ja);if(Date.now&&Date.prototype.getTime||(Date.now=function(){return(new Date).getTime()}),!globalThis.performance||!globalThis.performance.now){var Ya=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-Ya}}for(var za=Date.now(),Wa=["ms","moz","webkit","o"],qa=0;qa<Wa.length&&!globalThis.requestAnimationFrame;++qa){var Za=Wa[qa];globalThis.requestAnimationFrame=globalThis[Za+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[Za+"CancelAnimationFrame"]||globalThis[Za+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(t){if("function"!=typeof t)throw new TypeError(t+"is not a function");var e=Date.now(),i=16+za-e;return i<0&&(i=0),za=e,globalThis.self.setTimeout(function(){za=Date.now(),t(performance.now())},i)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(t){return clearTimeout(t)}),Math.sign||(Math.sign=function(t){return 0===(t=Number(t))||isNaN(t)?t:t>0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array)
/*!
   * @pixi/accessibility - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/accessibility is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */;wn.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});var Qa=100,Ja=function(){function t(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,(G.tablet||G.phone)&&this.createTouchHook();var e=document.createElement("div");e.style.width=Qa+"px",e.style.height=Qa+"px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex=2..toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),t.prototype.createTouchHook=function(){var t=this,e=document.createElement("button");e.style.width="1px",e.style.height="1px",e.style.position="absolute",e.style.top="-1000px",e.style.left="-1000px",e.style.zIndex=2..toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",function(){t._isMobileAccessibility=!0,t.activate(),t.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e},t.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},t.prototype.activate=function(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),null===(t=this.renderer.view.parentNode)||void 0===t||t.appendChild(this.div))},t.prototype.deactivate=function(){var t;this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),null===(t=this.div.parentNode)||void 0===t||t.removeChild(this.div))},t.prototype.updateAccessibleObjects=function(t){if(t.visible&&t.accessibleChildren){t.accessible&&t.interactive&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);var e=t.children;if(e)for(var i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}},t.prototype.update=function(){var t=performance.now();if(!(G.android.device&&t<this.androidUpdateCount)&&(this.androidUpdateCount=t+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var e=this.renderer.view.getBoundingClientRect(),i=e.left,r=e.top,n=e.width,s=e.height,o=this.renderer,a=o.width,h=o.height,u=o.resolution,l=n/a*u,c=s/h*u,f=this.div;f.style.left=i+"px",f.style.top=r+"px",f.style.width=a+"px",f.style.height=h+"px";for(var d=0;d<this.children.length;d++){var p=this.children[d];if(p.renderId!==this.renderId)p._accessibleActive=!1,ve(this.children,d,1),this.div.removeChild(p._accessibleDiv),this.pool.push(p._accessibleDiv),p._accessibleDiv=null,d--;else{f=p._accessibleDiv;var _=p.hitArea,m=p.worldTransform;p.hitArea?(f.style.left=(m.tx+_.x*m.a)*l+"px",f.style.top=(m.ty+_.y*m.d)*c+"px",f.style.width=_.width*m.a*l+"px",f.style.height=_.height*m.d*c+"px"):(_=p.getBounds(),this.capHitArea(_),f.style.left=_.x*l+"px",f.style.top=_.y*c+"px",f.style.width=_.width*l+"px",f.style.height=_.height*c+"px",f.title!==p.accessibleTitle&&null!==p.accessibleTitle&&(f.title=p.accessibleTitle),f.getAttribute("aria-label")!==p.accessibleHint&&null!==p.accessibleHint&&f.setAttribute("aria-label",p.accessibleHint)),p.accessibleTitle===f.title&&p.tabIndex===f.tabIndex||(f.title=p.accessibleTitle,f.tabIndex=p.tabIndex,this.debug&&this.updateDebugHTML(f))}}this.renderId++}},t.prototype.updateDebugHTML=function(t){t.innerHTML="type: "+t.type+"</br> title : "+t.title+"</br> tabIndex: "+t.tabIndex},t.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);var e=this.renderer,i=e.width,r=e.height;t.x+t.width>i&&(t.width=i-t.x),t.y+t.height>r&&(t.height=r-t.y)},t.prototype.addChild=function(t){var e=this.pool.pop();e||((e=document.createElement("button")).style.width=Qa+"px",e.style.height=Qa+"px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="displayObject "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},t.prototype._onClick=function(t){var e=this.renderer.plugins.interaction,i=t.target.displayObject,r=e.eventData;e.dispatchEvent(i,"click",r),e.dispatchEvent(i,"pointertap",r),e.dispatchEvent(i,"tap",r)},t.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction,i=t.target.displayObject,r=e.eventData;e.dispatchEvent(i,"mouseover",r)},t.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction,i=t.target.displayObject,r=e.eventData;e.dispatchEvent(i,"mouseout",r)},t.prototype._onKeyDown=function(t){9===t.keyCode&&this.activate()},t.prototype._onMouseMove=function(t){0===t.movementX&&0===t.movementY||this.deactivate()},t.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},t.extension={name:"accessibility",type:[Qe.RendererPlugin,Qe.CanvasRendererPlugin]},t}(),Ka=function(){function t(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new Le,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(t.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),t.prototype.getLocalPosition=function(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)},t.prototype.copyEvent=function(t){"isPrimary"in t&&t.isPrimary&&(this.isPrimary=!0),this.button="button"in t&&t.button;var e="buttons"in t&&t.buttons;this.buttons=Number.isInteger(e)?e:"which"in t&&t.which,this.width="width"in t&&t.width,this.height="height"in t&&t.height,this.tiltX="tiltX"in t&&t.tiltX,this.tiltY="tiltY"in t&&t.tiltY,this.pointerType="pointerType"in t&&t.pointerType,this.pressure="pressure"in t&&t.pressure,this.rotationAngle="rotationAngle"in t&&t.rotationAngle,this.twist="twist"in t&&t.twist||0,this.tangentialPressure="tangentialPressure"in t&&t.tangentialPressure||0},t.prototype.reset=function(){this.isPrimary=!1},t}(),th=function(t,e){return th=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},th(t,e)};var eh=function(){function t(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return t.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},t.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},t}(),ih=function(){function t(e){this._pointerId=e,this._flags=t.FLAGS.NONE}return t.prototype._doSet=function(t,e){this._flags=e?this._flags|t:this._flags&~t},Object.defineProperty(t.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"none",{get:function(){return this._flags===t.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return 0!==(this._flags&t.FLAGS.OVER)},set:function(e){this._doSet(t.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightDown",{get:function(){return 0!==(this._flags&t.FLAGS.RIGHT_DOWN)},set:function(e){this._doSet(t.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftDown",{get:function(){return 0!==(this._flags&t.FLAGS.LEFT_DOWN)},set:function(e){this._doSet(t.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),t.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),t}(),rh=function(){function t(){this._tempPoint=new Le}return t.prototype.recursiveFindHit=function(t,e,i,r,n){var s;if(!e||!e.visible)return!1;var o=t.data.global,a=!1,h=n=e.interactive||n,u=!0;if(e.hitArea)r&&(e.worldTransform.applyInverse(o,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?a=!0:(r=!1,u=!1)),h=!1;else if(e._mask&&r){var l=e._mask.isMaskData?e._mask.maskObject:e._mask;l&&!(null===(s=l.containsPoint)||void 0===s?void 0:s.call(l,o))&&(r=!1)}if(u&&e.interactiveChildren&&e.children)for(var c=e.children,f=c.length-1;f>=0;f--){var d=c[f],p=this.recursiveFindHit(t,d,i,r,h);if(p){if(!d.parent)continue;h=!1,p&&(t.target&&(r=!1),a=!0)}}return n&&(r&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(a=!0),e.interactive&&(a&&!t.target&&(t.target=e),i&&i(t,e,!!a))),a},t.prototype.findHit=function(t,e,i,r){this.recursiveFindHit(t,e,i,r,!1)},t}(),nh={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};wn.mixin(nh);var sh={target:null,data:{global:null}},oh=function(t){function e(e,i){var r=t.call(this)||this;return i=i||{},r.renderer=e,r.autoPreventDefault=void 0===i.autoPreventDefault||i.autoPreventDefault,r.interactionFrequency=i.interactionFrequency||10,r.mouse=new Ka,r.mouse.identifier=1,r.mouse.global.set(-999999),r.activeInteractionData={},r.activeInteractionData[1]=r.mouse,r.interactionDataPool=[],r.eventData=new eh,r.interactionDOMElement=null,r.moveWhenInside=!1,r.eventsAdded=!1,r.tickerAdded=!1,r.mouseOverRenderer=!("PointerEvent"in globalThis),r.supportsTouchEvents="ontouchstart"in globalThis,r.supportsPointerEvents=!!globalThis.PointerEvent,r.onPointerUp=r.onPointerUp.bind(r),r.processPointerUp=r.processPointerUp.bind(r),r.onPointerCancel=r.onPointerCancel.bind(r),r.processPointerCancel=r.processPointerCancel.bind(r),r.onPointerDown=r.onPointerDown.bind(r),r.processPointerDown=r.processPointerDown.bind(r),r.onPointerMove=r.onPointerMove.bind(r),r.processPointerMove=r.processPointerMove.bind(r),r.onPointerOut=r.onPointerOut.bind(r),r.processPointerOverOut=r.processPointerOverOut.bind(r),r.onPointerOver=r.onPointerOver.bind(r),r.cursorStyles={default:"inherit",pointer:"pointer"},r.currentCursorMode=null,r.cursor=null,r.resolution=1,r.delayedEvents=[],r.search=new rh,r._tempDisplayObject=new Sn,r._eventListenerOptions={capture:!0,passive:!1},r._useSystemTicker=void 0===i.useSystemTicker||i.useSystemTicker,r.setTargetElement(r.renderer.view,r.renderer.resolution),r}return function(t,e){function i(){this.constructor=t}th(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),Object.defineProperty(e.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),e.prototype.hitTest=function(t,e){return sh.target=null,sh.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(sh,e,null,!0),sh.target},e.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},e.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(oi.system.add(this.tickerUpdate,this,ei.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(oi.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},e.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},e.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},e.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())},e.prototype.update=function(){if(this.interactionDOMElement)if(this._didMove)this._didMove=!1;else{for(var t in this.cursor=null,this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(t)){var e=this.activeInteractionData[t];if(e.originalEvent&&"touch"!==e.pointerType){var i=this.configureInteractionEventForDOMEvent(this.eventData,e.originalEvent,e);this.processInteractive(i,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},e.prototype.setCursorMode=function(t){t=t||"default";var e=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(e=!1),this.currentCursorMode!==t){this.currentCursorMode=t;var i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.interactionDOMElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.interactionDOMElement.style,i)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.interactionDOMElement.style.cursor=t)}},e.prototype.dispatchEvent=function(t,e,i){i.stopPropagationHint&&t!==i.stopsPropagatingAt||(i.currentTarget=t,i.type=e,t.emit(e,i),t[e]&&t[e](i))},e.prototype.delayDispatchEvent=function(t,e,i){this.delayedEvents.push({displayObject:t,eventString:e,eventData:i})},e.prototype.mapPositionToPoint=function(t,e,i){var r;r=this.interactionDOMElement.parentElement?this.interactionDOMElement.getBoundingClientRect():{x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var n=1/this.resolution;t.x=(e-r.left)*(this.interactionDOMElement.width/r.width)*n,t.y=(i-r.top)*(this.interactionDOMElement.height/r.height)*n},e.prototype.processInteractive=function(t,e,i,r){var n=this.search.findHit(t,e,i,r),s=this.delayedEvents;if(!s.length)return n;t.stopPropagationHint=!1;var o=s.length;this.delayedEvents=[];for(var a=0;a<o;a++){var h=s[a],u=h.displayObject,l=h.eventString,c=h.eventData;c.stopsPropagatingAt===u&&(c.stopPropagationHint=!0),this.dispatchEvent(u,l,c)}return n},e.prototype.onPointerDown=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var i=e.length,r=0;r<i;r++){var n=e[r],s=this.getInteractionDataForPointerId(n),o=this.configureInteractionEventForDOMEvent(this.eventData,n,s);if(o.data.originalEvent=t,this.processInteractive(o,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",o),"touch"===n.pointerType)this.emit("touchstart",o);else if("mouse"===n.pointerType||"pen"===n.pointerType){var a=2===n.button;this.emit(a?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(t,e,i){var r=t.data,n=t.data.identifier;if(i)if(e.trackedPointers[n]||(e.trackedPointers[n]=new ih(n)),this.dispatchEvent(e,"pointerdown",t),"touch"===r.pointerType)this.dispatchEvent(e,"touchstart",t);else if("mouse"===r.pointerType||"pen"===r.pointerType){var s=2===r.button;s?e.trackedPointers[n].rightDown=!0:e.trackedPointers[n].leftDown=!0,this.dispatchEvent(e,s?"rightdown":"mousedown",t)}},e.prototype.onPointerComplete=function(t,e,i){var r=this.normalizeToPointerData(t),n=r.length,s=t.target;t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0]);for(var o=s!==this.interactionDOMElement?"outside":"",a=0;a<n;a++){var h=r[a],u=this.getInteractionDataForPointerId(h),l=this.configureInteractionEventForDOMEvent(this.eventData,h,u);if(l.data.originalEvent=t,this.processInteractive(l,this.lastObjectRendered,i,e||!o),this.emit(e?"pointercancel":"pointerup"+o,l),"mouse"===h.pointerType||"pen"===h.pointerType){var c=2===h.button;this.emit(c?"rightup"+o:"mouseup"+o,l)}else"touch"===h.pointerType&&(this.emit(e?"touchcancel":"touchend"+o,l),this.releaseInteractionDataForPointerId(h.pointerId))}},e.prototype.onPointerCancel=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!0,this.processPointerCancel)},e.prototype.processPointerCancel=function(t,e){var i=t.data,r=t.data.identifier;void 0!==e.trackedPointers[r]&&(delete e.trackedPointers[r],this.dispatchEvent(e,"pointercancel",t),"touch"===i.pointerType&&this.dispatchEvent(e,"touchcancel",t))},e.prototype.onPointerUp=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!1,this.processPointerUp)},e.prototype.processPointerUp=function(t,e,i){var r=t.data,n=t.data.identifier,s=e.trackedPointers[n],o="touch"===r.pointerType,a="mouse"===r.pointerType||"pen"===r.pointerType,h=!1;if(a){var u=2===r.button,l=ih.FLAGS,c=u?l.RIGHT_DOWN:l.LEFT_DOWN,f=void 0!==s&&s.flags&c;i?(this.dispatchEvent(e,u?"rightup":"mouseup",t),f&&(this.dispatchEvent(e,u?"rightclick":"click",t),h=!0)):f&&this.dispatchEvent(e,u?"rightupoutside":"mouseupoutside",t),s&&(u?s.rightDown=!1:s.leftDown=!1)}i?(this.dispatchEvent(e,"pointerup",t),o&&this.dispatchEvent(e,"touchend",t),s&&(a&&!h||this.dispatchEvent(e,"pointertap",t),o&&(this.dispatchEvent(e,"tap",t),s.over=!1))):s&&(this.dispatchEvent(e,"pointerupoutside",t),o&&this.dispatchEvent(e,"touchendoutside",t)),s&&s.none&&delete e.trackedPointers[n]},e.prototype.onPointerMove=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);"mouse"!==e[0].pointerType&&"pen"!==e[0].pointerType||(this._didMove=!0,this.cursor=null);for(var i=e.length,r=0;r<i;r++){var n=e[r],s=this.getInteractionDataForPointerId(n),o=this.configureInteractionEventForDOMEvent(this.eventData,n,s);o.data.originalEvent=t,this.processInteractive(o,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",o),"touch"===n.pointerType&&this.emit("touchmove",o),"mouse"!==n.pointerType&&"pen"!==n.pointerType||this.emit("mousemove",o)}"mouse"===e[0].pointerType&&this.setCursorMode(this.cursor)}},e.prototype.processPointerMove=function(t,e,i){var r=t.data,n="touch"===r.pointerType,s="mouse"===r.pointerType||"pen"===r.pointerType;s&&this.processPointerOverOut(t,e,i),this.moveWhenInside&&!i||(this.dispatchEvent(e,"pointermove",t),n&&this.dispatchEvent(e,"touchmove",t),s&&this.dispatchEvent(e,"mousemove",t))},e.prototype.onPointerOut=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t)[0];"mouse"===e.pointerType&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var i=this.getInteractionDataForPointerId(e),r=this.configureInteractionEventForDOMEvent(this.eventData,e,i);r.data.originalEvent=e,this.processInteractive(r,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",r),"mouse"===e.pointerType||"pen"===e.pointerType?this.emit("mouseout",r):this.releaseInteractionDataForPointerId(i.identifier)}},e.prototype.processPointerOverOut=function(t,e,i){var r=t.data,n=t.data.identifier,s="mouse"===r.pointerType||"pen"===r.pointerType,o=e.trackedPointers[n];i&&!o&&(o=e.trackedPointers[n]=new ih(n)),void 0!==o&&(i&&this.mouseOverRenderer?(o.over||(o.over=!0,this.delayDispatchEvent(e,"pointerover",t),s&&this.delayDispatchEvent(e,"mouseover",t)),s&&null===this.cursor&&(this.cursor=e.cursor)):o.over&&(o.over=!1,this.dispatchEvent(e,"pointerout",this.eventData),s&&this.dispatchEvent(e,"mouseout",t),o.none&&delete e.trackedPointers[n]))},e.prototype.onPointerOver=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t)[0],i=this.getInteractionDataForPointerId(e),r=this.configureInteractionEventForDOMEvent(this.eventData,e,i);r.data.originalEvent=e,"mouse"===e.pointerType&&(this.mouseOverRenderer=!0),this.emit("pointerover",r),"mouse"!==e.pointerType&&"pen"!==e.pointerType||this.emit("mouseover",r)}},e.prototype.getInteractionDataForPointerId=function(t){var e,i=t.pointerId;return 1===i||"mouse"===t.pointerType?e=this.mouse:this.activeInteractionData[i]?e=this.activeInteractionData[i]:((e=this.interactionDataPool.pop()||new Ka).identifier=i,this.activeInteractionData[i]=e),e.copyEvent(t),e},e.prototype.releaseInteractionDataForPointerId=function(t){var e=this.activeInteractionData[t];e&&(delete this.activeInteractionData[t],e.reset(),this.interactionDataPool.push(e))},e.prototype.configureInteractionEventForDOMEvent=function(t,e,i){return t.data=i,this.mapPositionToPoint(i.global,e.clientX,e.clientY),"touch"===e.pointerType&&(e.globalX=i.global.x,e.globalY=i.global.y),i.originalEvent=e,t.reset(),t},e.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var i=0,r=t.changedTouches.length;i<r;i++){var n=t.changedTouches[i];void 0===n.button&&(n.button=t.touches.length?1:0),void 0===n.buttons&&(n.buttons=t.touches.length?1:0),void 0===n.isPrimary&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===n.width&&(n.width=n.radiusX||1),void 0===n.height&&(n.height=n.radiusY||1),void 0===n.tiltX&&(n.tiltX=0),void 0===n.tiltY&&(n.tiltY=0),void 0===n.pointerType&&(n.pointerType="touch"),void 0===n.pointerId&&(n.pointerId=n.identifier||0),void 0===n.pressure&&(n.pressure=n.force||.5),void 0===n.twist&&(n.twist=0),void 0===n.tangentialPressure&&(n.tangentialPressure=0),void 0===n.layerX&&(n.layerX=n.offsetX=n.clientX),void 0===n.layerY&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,e.push(n)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{var s=t;void 0===s.isPrimary&&(s.isPrimary=!0),void 0===s.width&&(s.width=1),void 0===s.height&&(s.height=1),void 0===s.tiltX&&(s.tiltX=0),void 0===s.tiltY&&(s.tiltY=0),void 0===s.pointerType&&(s.pointerType="mouse"),void 0===s.pointerId&&(s.pointerId=1),void 0===s.pressure&&(s.pressure=.5),void 0===s.twist&&(s.twist=0),void 0===s.tangentialPressure&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}return e},e.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},e.extension={name:"interaction",type:[Qe.RendererPlugin,Qe.CanvasRendererPlugin]},e}(j),ah=new ke,hh=function(){function t(t){this.renderer=t}return t.prototype.image=function(t,e,i){var r=new Image;return r.src=this.base64(t,e,i),r},t.prototype.base64=function(t,e,i){return this.canvas(t).toDataURL(e,i)},t.prototype.canvas=function(e,i){var r=this._rawPixels(e,i),n=r.pixels,s=r.width,o=r.height,a=r.flipY,h=new Me(s,o,1),u=h.context.getImageData(0,0,s,o);if(t.arrayPostDivide(n,u.data),h.context.putImageData(u,0,0),a){var l=new Me(h.width,h.height,1);l.context.scale(1,-1),l.context.drawImage(h.canvas,0,-o),h.destroy(),h=l}return h.canvas},t.prototype.pixels=function(e,i){var r=this._rawPixels(e,i).pixels;return t.arrayPostDivide(r,r),r},t.prototype._rawPixels=function(t,e){var i,r,n=this.renderer,s=!1,o=!1;if(t)if(t instanceof $i)r=t;else{var a=n.context.webGLVersion>=2?n.multisample:T.NONE;if(r=this.renderer.generateTexture(t,{multisample:a}),a!==T.NONE){var h=$i.create({width:r.width,height:r.height});n.framebuffer.bind(r.framebuffer),n.framebuffer.blit(h.framebuffer),n.framebuffer.bind(null),r.destroy(!0),r=h}o=!0}r?(i=r.baseTexture.resolution,e=null!=e?e:r.frame,s=!1,n.renderTexture.bind(r)):(i=n.resolution,e||((e=ah).width=n.width,e.height=n.height),s=!0,n.renderTexture.bind(null));var u=Math.round(e.width*i),l=Math.round(e.height*i),c=new Uint8Array(4*u*l),f=n.gl;return f.readPixels(Math.round(e.x*i),Math.round(e.y*i),u,l,f.RGBA,f.UNSIGNED_BYTE,c),o&&r.destroy(!0),{pixels:c,width:u,height:l,flipY:s}},t.prototype.destroy=function(){this.renderer=null},t.arrayPostDivide=function(t,e){for(var i=0;i<t.length;i+=4){var r=e[i+3]=t[i+3];0!==r?(e[i]=Math.round(Math.min(255*t[i]/r,255)),e[i+1]=Math.round(Math.min(255*t[i+1]/r,255)),e[i+2]=Math.round(Math.min(255*t[i+2]/r,255))):(e[i]=t[i],e[i+1]=t[i+1],e[i+2]=t[i+2])}},t.extension={name:"extract",type:Qe.RendererPlugin},t}(),uh=function(){function t(t,e,i){void 0===e&&(e=!1),this._fn=t,this._once=e,this._thisArg=i,this._next=this._prev=this._owner=null}return t.prototype.detach=function(){return null!==this._owner&&(this._owner.detach(this),!0)},t}();function lh(t,e){return t._head?(t._tail._next=e,e._prev=t._tail,t._tail=e):(t._head=e,t._tail=e),e._owner=t,e}var ch,fh=function(){function t(){this._head=this._tail=void 0}return t.prototype.handlers=function(t){void 0===t&&(t=!1);var e=this._head;if(t)return!!e;for(var i=[];e;)i.push(e),e=e._next;return i},t.prototype.has=function(t){if(!(t instanceof uh))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return t._owner===this},t.prototype.dispatch=function(){for(var t=arguments,e=[],i=0;i<arguments.length;i++)e[i]=t[i];var r=this._head;if(!r)return!1;for(;r;)r._once&&this.detach(r),r._fn.apply(r._thisArg,e),r=r._next;return!0},t.prototype.add=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("MiniSignal#add(): First arg must be a Function.");return lh(this,new uh(t,!1,e))},t.prototype.once=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("MiniSignal#once(): First arg must be a Function.");return lh(this,new uh(t,!0,e))},t.prototype.detach=function(t){if(!(t instanceof uh))throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");return t._owner!==this||(t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t===this._head?(this._head=t._next,null===t._next&&(this._tail=null)):t===this._tail&&(this._tail=t._prev,this._tail._next=null),t._owner=null),this},t.prototype.detachAll=function(){var t=this._head;if(!t)return this;for(this._head=this._tail=null;t;)t._owner=null,t=t._next;return this},t}();function dh(t,e){e=e||{};for(var i={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},r=i.parser[e.strictMode?"strict":"loose"].exec(t),n={},s=14;s--;)n[i.key[s]]=r[s]||"";return n[i.q.name]={},n[i.key[12]].replace(i.q.parser,function(t,e,r){e&&(n[i.q.name][e]=r)}),n}var ph=null;function _h(){}function mh(t,e,i){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t[e]=i)}function gh(t){return t.toString().replace("object ","")}var vh=function(){function t(e,i,r){if(this._dequeue=_h,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=null,this._boundOnError=null,this._boundOnProgress=null,this._boundOnTimeout=null,this._boundXhrOnError=null,this._boundXhrOnTimeout=null,this._boundXhrOnAbort=null,this._boundXhrOnLoad=null,"string"!=typeof e||"string"!=typeof i)throw new Error("Both name and url are required for constructing a resource.");r=r||{},this._flags=0,this._setFlag(t.STATUS_FLAGS.DATA_URL,0===i.indexOf("data:")),this.name=e,this.url=i,this.extension=this._getExtension(),this.data=null,this.crossOrigin=!0===r.crossOrigin?"anonymous":r.crossOrigin,this.timeout=r.timeout||0,this.loadType=r.loadType||this._determineLoadType(),this.xhrType=r.xhrType,this.metadata=r.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=t.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=_h,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new fh,this.onProgress=new fh,this.onComplete=new fh,this.onAfterMiddleware=new fh}return t.setExtensionLoadType=function(e,i){mh(t._loadTypeMap,e,i)},t.setExtensionXhrType=function(e,i){mh(t._xhrTypeMap,e,i)},Object.defineProperty(t.prototype,"isDataUrl",{get:function(){return this._hasFlag(t.STATUS_FLAGS.DATA_URL)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isComplete",{get:function(){return this._hasFlag(t.STATUS_FLAGS.COMPLETE)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return this._hasFlag(t.STATUS_FLAGS.LOADING)},enumerable:!1,configurable:!0}),t.prototype.complete=function(){this._clearEvents(),this._finish()},t.prototype.abort=function(e){if(!this.error){if(this.error=new Error(e),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=t.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},t.prototype.load=function(e){var i=this;if(!this.isLoading)if(this.isComplete)e&&setTimeout(function(){return e(i)},1);else switch(e&&this.onComplete.once(e),this._setFlag(t.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),!1!==this.crossOrigin&&"string"==typeof this.crossOrigin||(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case t.LOAD_TYPE.IMAGE:this.type=t.TYPE.IMAGE,this._loadElement("image");break;case t.LOAD_TYPE.AUDIO:this.type=t.TYPE.AUDIO,this._loadSourceElement("audio");break;case t.LOAD_TYPE.VIDEO:this.type=t.TYPE.VIDEO,this._loadSourceElement("video");break;case t.LOAD_TYPE.XHR:default:void 0===ch&&(ch=!(!globalThis.XDomainRequest||"withCredentials"in new XMLHttpRequest)),ch&&this.crossOrigin?this._loadXdr():this._loadXhr()}},t.prototype._hasFlag=function(t){return 0!==(this._flags&t)},t.prototype._setFlag=function(t,e){this._flags=e?this._flags|t:this._flags&~t},t.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},t.prototype._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(t.STATUS_FLAGS.COMPLETE,!0),this._setFlag(t.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},t.prototype._loadElement=function(t){this.metadata.loadElement?this.data=this.metadata.loadElement:"image"===t&&void 0!==globalThis.Image?this.data=new Image:this.data=document.createElement(t),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},t.prototype._loadSourceElement=function(t){if(this.metadata.loadElement?this.data=this.metadata.loadElement:"audio"===t&&void 0!==globalThis.Audio?this.data=new Audio:this.data=document.createElement(t),null!==this.data){if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var e=this.metadata.mimeType,i=0;i<this.url.length;++i)this.data.appendChild(this._createSource(t,this.url[i],Array.isArray(e)?e[i]:e));else{e=this.metadata.mimeType;this.data.appendChild(this._createSource(t,this.url,Array.isArray(e)?e[0]:e))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))}else this.abort("Unsupported element: "+t)},t.prototype._loadXhr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var e=this.xhr=new XMLHttpRequest;"use-credentials"===this.crossOrigin&&(e.withCredentials=!0),e.open("GET",this.url,!0),e.timeout=this.timeout,this.xhrType===t.XHR_RESPONSE_TYPE.JSON||this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT?e.responseType=t.XHR_RESPONSE_TYPE.TEXT:e.responseType=this.xhrType,e.addEventListener("error",this._boundXhrOnError,!1),e.addEventListener("timeout",this._boundXhrOnTimeout,!1),e.addEventListener("abort",this._boundXhrOnAbort,!1),e.addEventListener("progress",this._boundOnProgress,!1),e.addEventListener("load",this._boundXhrOnLoad,!1),e.send()},t.prototype._loadXdr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var t=this.xhr=new globalThis.XDomainRequest;t.timeout=this.timeout||5e3,t.onerror=this._boundXhrOnError,t.ontimeout=this._boundXhrOnTimeout,t.onprogress=this._boundOnProgress,t.onload=this._boundXhrOnLoad,t.open("GET",this.url,!0),setTimeout(function(){return t.send()},1)},t.prototype._createSource=function(t,e,i){i||(i=t+"/"+this._getExtension(e));var r=document.createElement("source");return r.src=e,r.type=i,r},t.prototype._onError=function(t){this.abort("Failed to load element using: "+t.target.nodeName)},t.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(this,t.loaded/t.total)},t.prototype._onTimeout=function(){this.abort("Load timed out.")},t.prototype._xhrOnError=function(){var t=this.xhr;this.abort(gh(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},t.prototype._xhrOnTimeout=function(){var t=this.xhr;this.abort(gh(t)+" Request timed out.")},t.prototype._xhrOnAbort=function(){var t=this.xhr;this.abort(gh(t)+" Request was aborted by the user.")},t.prototype._xhrOnLoad=function(){var e=this.xhr,i="",r=void 0===e.status?200:e.status;if(""!==e.responseType&&"text"!==e.responseType&&void 0!==e.responseType||(i=e.responseText),0===r&&(i.length>0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?r=200:1223===r&&(r=204),2===(r/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=i,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(i),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var n=new DOMParser;this.data=n.parseFromString(i,"text/xml")}else{var s=document.createElement("div");s.innerHTML=i,this.data=s}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||i;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},t.prototype._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";e=e||globalThis.location,ph||(ph=document.createElement("a")),ph.href=t;var i=dh(ph.href,{strictMode:!0}),r=!i.port&&""===e.port||i.port===e.port,n=i.protocol?i.protocol+":":"";return i.host===e.hostname&&r&&n===e.protocol?"":"anonymous"},t.prototype._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},t.prototype._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},t.prototype._getExtension=function(t){void 0===t&&(t=this.url);var e="";if(this.isDataUrl){var i=t.indexOf("/");e=t.substring(i+1,t.indexOf(";",i))}else{var r=t.indexOf("?"),n=t.indexOf("#"),s=Math.min(r>-1?r:t.length,n>-1?n:t.length);e=(t=t.substring(0,s)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},t.prototype._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},t}();function yh(){}function bh(t){return function(){for(var e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];if(null===t)throw new Error("Callback was already called.");var n=t;t=null,n.apply(this,i)}}!function(t){var e,i,r,n;(e=t.STATUS_FLAGS||(t.STATUS_FLAGS={}))[e.NONE=0]="NONE",e[e.DATA_URL=1]="DATA_URL",e[e.COMPLETE=2]="COMPLETE",e[e.LOADING=4]="LOADING",(i=t.TYPE||(t.TYPE={}))[i.UNKNOWN=0]="UNKNOWN",i[i.JSON=1]="JSON",i[i.XML=2]="XML",i[i.IMAGE=3]="IMAGE",i[i.AUDIO=4]="AUDIO",i[i.VIDEO=5]="VIDEO",i[i.TEXT=6]="TEXT",(r=t.LOAD_TYPE||(t.LOAD_TYPE={}))[r.XHR=1]="XHR",r[r.IMAGE=2]="IMAGE",r[r.AUDIO=3]="AUDIO",r[r.VIDEO=4]="VIDEO",(n=t.XHR_RESPONSE_TYPE||(t.XHR_RESPONSE_TYPE={})).DEFAULT="text",n.BUFFER="arraybuffer",n.BLOB="blob",n.DOCUMENT="document",n.JSON="json",n.TEXT="text",t._loadTypeMap={gif:t.LOAD_TYPE.IMAGE,png:t.LOAD_TYPE.IMAGE,bmp:t.LOAD_TYPE.IMAGE,jpg:t.LOAD_TYPE.IMAGE,jpeg:t.LOAD_TYPE.IMAGE,tif:t.LOAD_TYPE.IMAGE,tiff:t.LOAD_TYPE.IMAGE,webp:t.LOAD_TYPE.IMAGE,tga:t.LOAD_TYPE.IMAGE,avif:t.LOAD_TYPE.IMAGE,svg:t.LOAD_TYPE.IMAGE,"svg+xml":t.LOAD_TYPE.IMAGE,mp3:t.LOAD_TYPE.AUDIO,ogg:t.LOAD_TYPE.AUDIO,wav:t.LOAD_TYPE.AUDIO,mp4:t.LOAD_TYPE.VIDEO,webm:t.LOAD_TYPE.VIDEO},t._xhrTypeMap={xhtml:t.XHR_RESPONSE_TYPE.DOCUMENT,html:t.XHR_RESPONSE_TYPE.DOCUMENT,htm:t.XHR_RESPONSE_TYPE.DOCUMENT,xml:t.XHR_RESPONSE_TYPE.DOCUMENT,tmx:t.XHR_RESPONSE_TYPE.DOCUMENT,svg:t.XHR_RESPONSE_TYPE.DOCUMENT,tsx:t.XHR_RESPONSE_TYPE.DOCUMENT,gif:t.XHR_RESPONSE_TYPE.BLOB,png:t.XHR_RESPONSE_TYPE.BLOB,bmp:t.XHR_RESPONSE_TYPE.BLOB,jpg:t.XHR_RESPONSE_TYPE.BLOB,jpeg:t.XHR_RESPONSE_TYPE.BLOB,tif:t.XHR_RESPONSE_TYPE.BLOB,tiff:t.XHR_RESPONSE_TYPE.BLOB,webp:t.XHR_RESPONSE_TYPE.BLOB,tga:t.XHR_RESPONSE_TYPE.BLOB,avif:t.XHR_RESPONSE_TYPE.BLOB,json:t.XHR_RESPONSE_TYPE.JSON,text:t.XHR_RESPONSE_TYPE.TEXT,txt:t.XHR_RESPONSE_TYPE.TEXT,ttf:t.XHR_RESPONSE_TYPE.BUFFER,otf:t.XHR_RESPONSE_TYPE.BUFFER},t.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="}(vh||(vh={}));var xh=function(t,e){this.data=t,this.callback=e},Th=function(){function t(t,e){var i=this;if(void 0===e&&(e=1),this.workers=0,this.saturated=yh,this.unsaturated=yh,this.empty=yh,this.drain=yh,this.error=yh,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(t,e,r){if(r&&"function"!=typeof r)throw new Error("task callback must be a function");if(i.started=!0,null==t&&i.idle())setTimeout(function(){return i.drain()},1);else{var n=new xh(t,"function"==typeof r?r:yh);e?i._tasks.unshift(n):i._tasks.push(n),setTimeout(i.process,1)}},this.process=function(){for(;!i.paused&&i.workers<i.concurrency&&i._tasks.length;){var t=i._tasks.shift();0===i._tasks.length&&i.empty(),i.workers+=1,i.workers===i.concurrency&&i.saturated(),i._worker(t.data,bh(i._next(t)))}},this._worker=t,0===e)throw new Error("Concurrency must not be zero");this.concurrency=e,this.buffer=e/4}return t.prototype._next=function(t){var e=this;return function(){for(var i=arguments,r=[],n=0;n<arguments.length;n++)r[n]=i[n];e.workers-=1,t.callback.apply(t,r),null!=r[0]&&e.error(r[0],t.data),e.workers<=e.concurrency-e.buffer&&e.unsaturated(),e.idle()&&e.drain(),e.process()}},t.prototype.push=function(t,e){this._insert(t,!1,e)},t.prototype.kill=function(){this.workers=0,this.drain=yh,this.started=!1,this._tasks=[]},t.prototype.unshift=function(t,e){this._insert(t,!0,e)},t.prototype.length=function(){return this._tasks.length},t.prototype.running=function(){return this.workers},t.prototype.idle=function(){return this._tasks.length+this.workers===0},t.prototype.pause=function(){!0!==this.paused&&(this.paused=!0)},t.prototype.resume=function(){if(!1!==this.paused){this.paused=!1;for(var t=1;t<=this.concurrency;t++)this.process()}},t.eachSeries=function(t,e,i,r){var n=0,s=t.length;!function o(a){a||n===s?i&&i(a):r?setTimeout(function(){e(t[n++],o)},1):e(t[n++],o)}()},t.queue=function(e,i){return new t(e,i)},t}(),Ah=/(#[\w-]+)?$/,Eh=function(){function t(e,i){var r=this;void 0===e&&(e=""),void 0===i&&(i=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(t,e){return r._loadResource(t,e)},this.resources={},this.baseUrl=e,this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(t,e){return r._loadResource(t,e)},this._queue=Th.queue(this._boundLoadResource,i),this._queue.pause(),this.resources={},this.onProgress=new fh,this.onError=new fh,this.onLoad=new fh,this.onStart=new fh,this.onComplete=new fh;for(var n=0;n<t._plugins.length;++n){var s=t._plugins[n],o=s.pre,a=s.use;o&&this.pre(o),a&&this.use(a)}this._protected=!1}return t.prototype._add=function(t,e,i,r){if(this.loading&&(!i||!i.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[t])throw new Error('Resource named "'+t+'" already exists.');if(e=this._prepareUrl(e),this.resources[t]=new vh(t,e,i),"function"==typeof r&&this.resources[t].onAfterMiddleware.once(r),this.loading){for(var n=i.parentResource,s=[],o=0;o<n.children.length;++o)n.children[o].isComplete||s.push(n.children[o]);var a=n.progressChunk*(s.length+1)/(s.length+2);n.children.push(this.resources[t]),n.progressChunk=a;for(o=0;o<s.length;++o)s[o].progressChunk=a;this.resources[t].progressChunk=a}return this._queue.push(this.resources[t]),this},t.prototype.pre=function(t){return this._beforeMiddleware.push(t),this},t.prototype.use=function(t){return this._afterMiddleware.push(t),this},t.prototype.reset=function(){for(var t in this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause(),this.resources){var e=this.resources[t];e._onLoadBinding&&e._onLoadBinding.detach(),e.isLoading&&e.abort("loader reset")}return this.resources={},this},t.prototype.load=function(t){if(Ae("6.5.0","@pixi/loaders is being replaced with @pixi/assets in the next major release."),"function"==typeof t&&this.onComplete.once(t),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var e=100/this._queue._tasks.length,i=0;i<this._queue._tasks.length;++i)this._queue._tasks[i].data.progressChunk=e;this._onStart(),this._queue.resume()}return this},Object.defineProperty(t.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(t){this._queue.concurrency=t},enumerable:!1,configurable:!0}),t.prototype._prepareUrl=function(t){var e,i=dh(t,{strictMode:!0});if(e=i.protocol||!i.path||0===t.indexOf("//")?t:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&"/"!==t.charAt(0)?this.baseUrl+"/"+t:this.baseUrl+t,this.defaultQueryString){var r=Ah.exec(e)[0];-1!==(e=e.slice(0,e.length-r.length)).indexOf("?")?e+="&"+this.defaultQueryString:e+="?"+this.defaultQueryString,e+=r}return e},t.prototype._loadResource=function(t,e){var i=this;t._dequeue=e,Th.eachSeries(this._beforeMiddleware,function(e,r){e.call(i,t,function(){r(t.isComplete?{}:null)})},function(){t.isComplete?i._onLoad(t):(t._onLoadBinding=t.onComplete.once(i._onLoad,i),t.load())},!0)},t.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},t.prototype._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},t.prototype._onLoad=function(t){var e=this;t._onLoadBinding=null,this._resourcesParsing.push(t),t._dequeue(),Th.eachSeries(this._afterMiddleware,function(i,r){i.call(e,t,r)},function(){t.onAfterMiddleware.dispatch(t),e.progress=Math.min(100,e.progress+t.progressChunk),e.onProgress.dispatch(e,t),t.error?e.onError.dispatch(t.error,e,t):e.onLoad.dispatch(e,t),e._resourcesParsing.splice(e._resourcesParsing.indexOf(t),1),e._queue.idle()&&0===e._resourcesParsing.length&&e._onComplete()},!0)},t.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(t,"shared",{get:function(){var e=t._shared;return e||((e=new t)._protected=!0,t._shared=e),e},enumerable:!1,configurable:!0}),t.registerPlugin=function(e){return Ae("6.5.0","Loader.registerPlugin() is deprecated, use extensions.add() instead."),ri.add({type:Qe.Loader,ref:e}),t},t._plugins=[],t}();ri.handleByList(Qe.Loader,Eh._plugins),Eh.prototype.add=function(t,e,i,r){if(Array.isArray(t)){for(var n=0;n<t.length;++n)this.add(t[n]);return this}if("object"==typeof t&&(i=t,r=e||i.callback||i.onComplete,e=i.url,t=i.name||i.key||i.url),"string"!=typeof e&&(r=i,i=e,e=t),"string"!=typeof e)throw new Error("No url passed to add resource to loader.");return"function"==typeof i&&(r=i,i=null),this._add(t,e,i,r)};var wh=function(){function t(){}return t.init=function(t){t=Object.assign({sharedLoader:!1},t),this.loader=t.sharedLoader?Eh.shared:new Eh},t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.extension=Qe.Application,t}(),Sh=function(){function t(){}return t.add=function(){vh.setExtensionLoadType("svg",vh.LOAD_TYPE.XHR),vh.setExtensionXhrType("svg",vh.XHR_RESPONSE_TYPE.TEXT)},t.use=function(t,e){if(!t.data||t.type!==vh.TYPE.IMAGE&&"svg"!==t.extension)e();else{var i=t.data,r=t.url,n=t.name,s=t.metadata;Oi.fromLoader(i,r,n,s).then(function(i){t.texture=i,e()}).catch(e)}},t.extension=Qe.Loader,t}();function Ph(t,e){if(t.data){if(t.xhr&&t.xhrType===vh.XHR_RESPONSE_TYPE.BLOB)if(self.Blob&&"string"!=typeof t.data){if(0===t.data.type.indexOf("image")){var i=globalThis.URL||globalThis.webkitURL,r=i.createObjectURL(t.data);return t.blob=t.data,t.data=new Image,t.data.src=r,t.type=vh.TYPE.IMAGE,void(t.data.onload=function(){i.revokeObjectURL(r),t.data.onload=null,e()})}}else{var n=t.xhr.getResponseHeader("content-type");if(n&&0===n.indexOf("image"))return t.data=new Image,t.data.src="data:"+n+";base64,"+function(t){for(var e="",i=0;i<t.length;){for(var r=[0,0,0],n=[0,0,0,0],s=0;s<r.length;++s)i<t.length?r[s]=255&t.charCodeAt(i++):r[s]=0;switch(n[0]=r[0]>>2,n[1]=(3&r[0])<<4|r[1]>>4,n[2]=(15&r[1])<<2|r[2]>>6,n[3]=63&r[2],i-(t.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(s=0;s<n.length;++s)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n[s])}return e}(t.xhr.responseText),t.type=vh.TYPE.IMAGE,void(t.data.onload=function(){t.data.onload=null,e()})}e()}else e()}var Mh,Ih,Ch=function(){function t(){}return t.extension=Qe.Loader,t.use=Ph,t}();ri.add(Sh,Ch),function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR"}(Ih||(Ih={}));var Rh=((Mh={})[Ih.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,Mh[Ih.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,Mh[Ih.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,Mh[Ih.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,Mh[Ih.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,Mh[Ih.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,Mh[Ih.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,Mh[Ih.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,Mh[Ih.COMPRESSED_R11_EAC]=.5,Mh[Ih.COMPRESSED_SIGNED_R11_EAC]=.5,Mh[Ih.COMPRESSED_RG11_EAC]=1,Mh[Ih.COMPRESSED_SIGNED_RG11_EAC]=1,Mh[Ih.COMPRESSED_RGB8_ETC2]=.5,Mh[Ih.COMPRESSED_RGBA8_ETC2_EAC]=1,Mh[Ih.COMPRESSED_SRGB8_ETC2]=.5,Mh[Ih.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=1,Mh[Ih.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,Mh[Ih.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,Mh[Ih.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,Mh[Ih.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,Mh[Ih.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,Mh[Ih.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,Mh[Ih.COMPRESSED_RGB_ETC1_WEBGL]=.5,Mh[Ih.COMPRESSED_RGB_ATC_WEBGL]=.5,Mh[Ih.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,Mh[Ih.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,Mh[Ih.COMPRESSED_RGBA_ASTC_4x4_KHR]=1,Mh),Oh=function(t,e){return Oh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Oh(t,e)};
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */function $h(t,e){function i(){this.constructor=t}Oh(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function Dh(t,e,i,r){return new(i||(i=Promise))(function(e,n){function s(t){try{a(r.next(t))}catch(t){n(t)}}function o(t){try{a(r.throw(t))}catch(t){n(t)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i(function(t){t(r)})).then(s,o)}a((r=r.apply(t,[])).next())})}function Lh(t,e){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}var Fh,kh,Bh=function(t){function e(e,i){void 0===i&&(i={width:1,height:1,autoLoad:!0});var r,n,s=this;return"string"==typeof e?(r=e,n=new Uint8Array):(r=null,n=e),(s=t.call(this,n,i)||this).origin=r,s.buffer=n?new pn(n):null,s.origin&&!1!==i.autoLoad&&s.load(),n&&n.length&&(s.loaded=!0,s.onBlobLoaded(s.buffer.rawBinaryData)),s}return $h(e,t),e.prototype.onBlobLoaded=function(t){},e.prototype.load=function(){return Dh(this,0,Promise,function(){var t;return Lh(this,function(e){switch(e.label){case 0:return[4,fetch(this.origin)];case 1:return[4,e.sent().blob()];case 2:return[4,e.sent().arrayBuffer()];case 3:return t=e.sent(),this.data=new Uint32Array(t),this.buffer=new pn(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),[2,this]}})})},e}(pi),Nh=function(t){function e(i,r){var n=t.call(this,i,r)||this;return n.format=r.format,n.levels=r.levels||1,n._width=r.width,n._height=r.height,n._extension=e._formatToExtension(n.format),(r.levelBuffers||n.buffer)&&(n._levelBuffers=r.levelBuffers||e._createLevelBuffers(i instanceof Uint8Array?i:n.buffer.uint8View,n.format,n.levels,4,4,n.width,n.height)),n}return $h(e,t),e.prototype.upload=function(t,e,i){var 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;for(var n=0,s=this.levels;n<s;n++){var o=this._levelBuffers[n],a=o.levelID,h=o.levelWidth,u=o.levelHeight,l=o.levelBuffer;r.compressedTexImage2D(r.TEXTURE_2D,a,this.format,h,u,0,l)}return!0},e.prototype.onBlobLoaded=function(){this._levelBuffers=e._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},e._formatToExtension=function(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},e._createLevelBuffers=function(t,e,i,r,n,s,o){for(var a=new Array(i),h=t.byteOffset,u=s,l=o,c=u+r-1&~(r-1),f=l+n-1&~(n-1),d=c*f*Rh[e],p=0;p<i;p++)a[p]={levelID:p,levelWidth:i>1?u:c,levelHeight:i>1?l:f,levelBuffer:new Uint8Array(t.buffer,h,d)},h+=d,d=(c=(u=u>>1||1)+r-1&~(r-1))*(f=(l=l>>1||1)+n-1&~(n-1))*Rh[e];return a},e}(Bh),Uh=function(){function t(){}return t.use=function(e,i){var r=e.data;if(e.type===vh.TYPE.JSON&&r&&r.cacheID&&r.textures){for(var n=r.textures,s=void 0,o=void 0,a=0,h=n.length;a<h;a++){var u=n[a],l=u.src,c=u.format;if(c||(o=l),t.textureFormats[c]){s=l;break}}if(!(s=s||o))return void i(new Error("Cannot load compressed-textures in "+e.url+", make sure you provide a fallback"));if(s===e.url)return void i(new Error("URL of compressed texture cannot be the same as the manifest's URL"));var f={crossOrigin:e.crossOrigin,metadata:e.metadata.imageMetadata,parentResource:e},d=ie.resolve(e.url.replace(this.baseUrl,""),s),p=r.cacheID;this.add(p,d,f,function(t){if(t.error)i(t.error);else{var r=t.texture,n=void 0===r?null:r,s=t.textures,o=void 0===s?{}:s;Object.assign(e,{texture:n,textures:o}),i()}})}else i()},Object.defineProperty(t,"textureExtensions",{get:function(){if(!t._textureExtensions){var e=X.ADAPTER.createCanvas().getContext("webgl");if(!e)return console.warn("WebGL not available for compressed textures. Silently failing."),{};var i={s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};t._textureExtensions=i}return t._textureExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(t,"textureFormats",{get:function(){if(!t._textureFormats){var e=t.textureExtensions;for(var i in t._textureFormats={},e){var r=e[i];r&&Object.assign(t._textureFormats,Object.getPrototypeOf(r))}}return t._textureFormats},enumerable:!1,configurable:!0}),t.extension=Qe.Loader,t}();function Gh(t,e,i){var r={textures:{},texture:null};return e?(e.map(function(t){return new Oi(new mi(t,Object.assign({mipmap:p.OFF,alphaMode:_.NO_PREMULTIPLIED_ALPHA},i)))}).forEach(function(e,i){var n=e.baseTexture,s=t+"-"+(i+1);mi.addToCache(n,s),Oi.addToCache(e,s),0===i&&(mi.addToCache(n,t),Oi.addToCache(e,t),r.texture=e),r.textures[s]=e}),r):r}var Xh,Vh,Hh=124,jh=3,Yh=4,zh=7,Wh=19,qh=2,Zh=0,Qh=1,Jh=2,Kh=3;!function(t){t[t.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",t[t.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",t[t.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",t[t.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",t[t.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",t[t.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",t[t.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",t[t.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",t[t.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",t[t.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",t[t.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",t[t.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",t[t.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",t[t.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",t[t.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",t[t.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",t[t.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",t[t.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",t[t.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",t[t.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",t[t.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",t[t.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",t[t.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",t[t.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",t[t.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",t[t.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",t[t.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",t[t.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",t[t.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",t[t.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",t[t.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",t[t.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",t[t.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",t[t.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",t[t.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",t[t.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",t[t.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",t[t.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",t[t.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",t[t.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",t[t.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",t[t.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",t[t.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",t[t.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",t[t.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",t[t.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",t[t.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",t[t.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",t[t.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",t[t.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",t[t.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",t[t.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",t[t.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",t[t.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",t[t.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",t[t.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",t[t.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",t[t.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",t[t.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",t[t.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",t[t.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",t[t.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",t[t.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",t[t.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",t[t.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",t[t.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",t[t.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",t[t.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",t[t.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",t[t.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",t[t.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",t[t.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",t[t.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",t[t.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",t[t.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",t[t.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",t[t.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",t[t.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",t[t.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",t[t.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",t[t.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",t[t.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",t[t.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",t[t.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",t[t.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",t[t.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",t[t.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",t[t.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",t[t.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",t[t.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",t[t.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",t[t.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",t[t.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",t[t.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",t[t.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",t[t.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",t[t.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",t[t.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",t[t.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",t[t.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",t[t.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",t[t.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",t[t.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",t[t.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",t[t.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",t[t.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",t[t.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",t[t.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",t[t.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",t[t.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",t[t.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",t[t.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",t[t.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",t[t.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",t[t.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",t[t.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",t[t.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",t[t.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",t[t.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",t[t.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",t[t.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",t[t.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"}(Xh||(Xh={})),function(t){t[t.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",t[t.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",t[t.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"}(Vh||(Vh={}));var tu,eu,iu,ru=((Fh={})[827611204]=Ih.COMPRESSED_RGBA_S3TC_DXT1_EXT,Fh[861165636]=Ih.COMPRESSED_RGBA_S3TC_DXT3_EXT,Fh[894720068]=Ih.COMPRESSED_RGBA_S3TC_DXT5_EXT,Fh),nu=((kh={})[Xh.DXGI_FORMAT_BC1_TYPELESS]=Ih.COMPRESSED_RGBA_S3TC_DXT1_EXT,kh[Xh.DXGI_FORMAT_BC1_UNORM]=Ih.COMPRESSED_RGBA_S3TC_DXT1_EXT,kh[Xh.DXGI_FORMAT_BC2_TYPELESS]=Ih.COMPRESSED_RGBA_S3TC_DXT3_EXT,kh[Xh.DXGI_FORMAT_BC2_UNORM]=Ih.COMPRESSED_RGBA_S3TC_DXT3_EXT,kh[Xh.DXGI_FORMAT_BC3_TYPELESS]=Ih.COMPRESSED_RGBA_S3TC_DXT5_EXT,kh[Xh.DXGI_FORMAT_BC3_UNORM]=Ih.COMPRESSED_RGBA_S3TC_DXT5_EXT,kh[Xh.DXGI_FORMAT_BC1_UNORM_SRGB]=Ih.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,kh[Xh.DXGI_FORMAT_BC2_UNORM_SRGB]=Ih.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,kh[Xh.DXGI_FORMAT_BC3_UNORM_SRGB]=Ih.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,kh);var su=[171,75,84,88,32,49,49,187,13,10,26,10],ou=12,au=16,hu=24,uu=28,lu=36,cu=40,fu=44,du=48,pu=52,_u=56,mu=60,gu=((tu={})[l.UNSIGNED_BYTE]=1,tu[l.UNSIGNED_SHORT]=2,tu[l.INT]=4,tu[l.UNSIGNED_INT]=4,tu[l.FLOAT]=4,tu[l.HALF_FLOAT]=8,tu),vu=((eu={})[h.RGBA]=4,eu[h.RGB]=3,eu[h.RG]=2,eu[h.RED]=1,eu[h.LUMINANCE]=1,eu[h.LUMINANCE_ALPHA]=2,eu[h.ALPHA]=1,eu),yu=((iu={})[l.UNSIGNED_SHORT_4_4_4_4]=2,iu[l.UNSIGNED_SHORT_5_5_5_1]=2,iu[l.UNSIGNED_SHORT_5_6_5]=2,iu);function bu(t,e,i){void 0===i&&(i=!1);var r=new DataView(e);if(!function(t,e){for(var i=0;i<su.length;i++)if(e.getUint8(i)!==su[i])return console.error(t+" is not a valid *.ktx file!"),!1;return!0}(t,r))return null;var n=67305985===r.getUint32(ou,!0),s=r.getUint32(au,n),o=r.getUint32(hu,n),a=r.getUint32(uu,n),h=r.getUint32(lu,n),u=r.getUint32(cu,n)||1,c=r.getUint32(fu,n)||1,f=r.getUint32(du,n)||1,d=r.getUint32(pu,n),p=r.getUint32(_u,n),_=r.getUint32(mu,n);if(0===u||1!==c)throw new Error("Only 2D textures are supported");if(1!==d)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==f)throw new Error("WebGL does not support array textures");var m,g=h+3&-4,v=u+3&-4,y=new Array(f),b=h*u;if(0===s&&(b=g*v),void 0===(m=0!==s?gu[s]?gu[s]*vu[o]:yu[s]:Rh[a]))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var x=i?function(t,e,i){var r=new Map,n=0;for(;n<e;){var s=t.getUint32(64+n,i),o=64+n+4,a=3-(s+3)%4;if(0===s||s>e-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(var h=0;h<s&&0!==t.getUint8(o+h);h++);if(-1===h){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}var u=(new TextDecoder).decode(new Uint8Array(t.buffer,o,h)),l=new DataView(t.buffer,o+h+1,s-h-1);r.set(u,l),n+=4+s+a}return r}(r,_,n):null,T=b*m,A=h,E=u,w=g,S=v,P=64+_,M=0;M<p;M++){for(var I=r.getUint32(P,n),C=P+4,R=0;R<f;R++){var O=y[R];O||(O=y[R]=new Array(p)),O[M]={levelID:M,levelWidth:p>1||0!==s?A:w,levelHeight:p>1||0!==s?E:S,levelBuffer:new Uint8Array(e,C,T)},C+=T}P=(P+=I+4)%4!=0?P+4-P%4:P,T=(w=(A=A>>1||1)+4-1&-4)*(S=(E=E>>1||1)+4-1&-4)*m}return 0!==s?{uncompressed:y.map(function(t){var e=t[0].levelBuffer,i=!1;return s===l.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):s===l.UNSIGNED_INT?(i=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):s===l.INT&&(i=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new pi(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:s,format:i?xu(o):o}}),kvData:x}:{compressed:y.map(function(t){return new Nh(null,{format:a,width:h,height:u,levels:p,levelBuffers:t})}),kvData:x}}function xu(t){switch(t){case h.RGBA:return h.RGBA_INTEGER;case h.RGB:return h.RGB_INTEGER;case h.RG:return h.RG_INTEGER;case h.RED:return h.RED_INTEGER;default:return t}}vh.setExtensionXhrType("dds",vh.XHR_RESPONSE_TYPE.BUFFER);var Tu=function(){function t(){}return t.use=function(t,e){if("dds"===t.extension&&t.data)try{Object.assign(t,Gh(t.name||t.url,function(t){var e=new Uint32Array(t);if(542327876!==e[0])throw new Error("Invalid DDS file magic word");var i=new Uint32Array(t,0,Hh/Uint32Array.BYTES_PER_ELEMENT),r=i[jh],n=i[Yh],s=i[zh],o=new Uint32Array(t,Wh*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),a=o[1];if(4&a){var h=o[qh];if(808540228!==h){var u=ru[h],l=new Uint8Array(t,128);return[new Nh(l,{format:u,width:n,height:r,levels:s})]}var c=new Uint32Array(e.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),f=c[Zh],d=c[Qh],p=c[Jh],_=c[Kh],m=nu[f];if(void 0===m)throw new Error("DDSParser cannot parse texture data with DXGI format "+f);if(4===p)throw new Error("DDSParser does not support cubemap textures");if(d===Vh.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");var g=new Array;if(1===_)g.push(new Uint8Array(t,148));else{for(var v=Rh[m],y=0,b=n,x=r,T=0;T<s;T++)y+=Math.max(1,b+3&-4)*Math.max(1,x+3&-4)*v,b>>>=1,x>>>=1;var A=148;for(T=0;T<_;T++)g.push(new Uint8Array(t,A,y)),A+=y}return g.map(function(t){return new Nh(t,{format:m,width:n,height:r,levels:s})})}if(64&a)throw new Error("DDSParser does not support uncompressed texture data.");if(512&a)throw new Error("DDSParser does not supported YUV uncompressed texture data.");if(131072&a)throw new Error("DDSParser does not support single-channel (lumninance) texture data!");if(2&a)throw new Error("DDSParser does not support single-channel (alpha) texture data!");throw new Error("DDSParser failed to load a texture file due to an unknown reason!")}(t.data),t.metadata))}catch(t){return void e(t)}e()},t.extension=Qe.Loader,t}();vh.setExtensionXhrType("ktx",vh.XHR_RESPONSE_TYPE.BUFFER);var Au=function(){function t(){}return t.use=function(t,e){if("ktx"===t.extension&&t.data)try{var i=t.name||t.url,r=bu(i,t.data,this.loadKeyValueData),n=r.compressed,s=r.uncompressed,o=r.kvData;if(n){var a=Gh(i,n,t.metadata);if(o&&a.textures)for(var h in a.textures)a.textures[h].baseTexture.ktxKeyValueData=o;Object.assign(t,a)}else if(s){var u={};s.forEach(function(t,e){var r=new Oi(new mi(t.resource,{mipmap:p.OFF,alphaMode:_.NO_PREMULTIPLIED_ALPHA,type:t.type,format:t.format})),n=i+"-"+(e+1);o&&(r.baseTexture.ktxKeyValueData=o),mi.addToCache(r.baseTexture,n),Oi.addToCache(r,n),0===e&&(u[i]=r,mi.addToCache(r.baseTexture,i),Oi.addToCache(r,i)),u[n]=r}),Object.assign(t,{textures:u})}}catch(t){return void e(t)}e()},t.extension=Qe.Loader,t.loadKeyValueData=!1,t}(),Eu=function(t,e){return Eu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Eu(t,e)};
/*!
   * @pixi/particle-container - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/particle-container is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */function wu(t,e){function i(){this.constructor=t}Eu(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}!function(t){function e(e,i,r,n){void 0===e&&(e=1500),void 0===r&&(r=16384),void 0===n&&(n=!1);var s=t.call(this)||this;return r>16384&&(r=16384),s._properties=[!1,!0,!1,!1,!1],s._maxSize=e,s._batchSize=r,s._buffers=null,s._bufferUpdateIDs=[],s._updateID=0,s.interactiveChildren=!1,s.blendMode=o.NORMAL,s.autoResize=n,s.roundPixels=!0,s.baseTexture=null,s.setProperties(i),s._tint=0,s.tintRgb=new Float32Array(4),s.tint=16777215,s}wu(e,t),e.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},e.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,ae(t,this.tintRgb)},enumerable:!1,configurable:!0}),e.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return e.onChildrenChange(0)})),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},e.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID},e.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},e.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}(Mn);var Su,Pu,Mu=function(){function t(t,e,i){this.geometry=new Xi,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(var r=0;r<t.length;++r){var n=t[r];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||l.FLOAT,offset:n.offset},e[r]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return t.prototype.initBuffers=function(){var t=this.geometry,e=0;this.indexBuffer=new ki(function(t,e){void 0===e&&(e=null);var i=6*t;if((e=e||new Uint16Array(i)).length!==i)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+i);for(var r=0,n=0;r<i;r+=6,n+=4)e[r+0]=n+0,e[r+1]=n+1,e[r+2]=n+2,e[r+3]=n+0,e[r+4]=n+2,e[r+5]=n+3;return e}(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(var i=0;i<this.dynamicProperties.length;++i){(o=this.dynamicProperties[i]).offset=e,e+=o.size,this.dynamicStride+=o.size}var r=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(r),this.dynamicDataUint32=new Uint32Array(r),this.dynamicBuffer=new ki(this.dynamicData,!1,!1);var n=0;this.staticStride=0;for(i=0;i<this.staticProperties.length;++i){(o=this.staticProperties[i]).offset=n,n+=o.size,this.staticStride+=o.size}var s=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(s),this.staticDataUint32=new Uint32Array(s),this.staticBuffer=new ki(this.staticData,!0,!1);for(i=0;i<this.dynamicProperties.length;++i){var o=this.dynamicProperties[i];t.addAttribute(o.attributeName,this.dynamicBuffer,0,o.type===l.UNSIGNED_BYTE,o.type,4*this.dynamicStride,4*o.offset)}for(i=0;i<this.staticProperties.length;++i){o=this.staticProperties[i];t.addAttribute(o.attributeName,this.staticBuffer,0,o.type===l.UNSIGNED_BYTE,o.type,4*this.staticStride,4*o.offset)}},t.prototype.uploadDynamic=function(t,e,i){for(var r=0;r<this.dynamicProperties.length;r++){var n=this.dynamicProperties[r];n.uploadFunction(t,e,i,n.type===l.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++},t.prototype.uploadStatic=function(t,e,i){for(var r=0;r<this.staticProperties.length;r++){var n=this.staticProperties[r];n.uploadFunction(t,e,i,n.type===l.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++},t.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},t}(),Iu=function(t){function e(e){var i=t.call(this,e)||this;return i.shader=null,i.properties=null,i.tempMatrix=new Ve,i.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:i.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:i.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:i.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:i.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:l.UNSIGNED_BYTE,uploadFunction:i.uploadTint,offset:0}],i.shader=Cr.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n    float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n    float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n    vec2 v = vec2(x, y);\n    v = v + aPositionCoord;\n\n    gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n    vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n    gl_FragColor = color;\n}",{}),i.state=Rr.for2d(),i}return wu(e,t),e.prototype.render=function(t){var e=t.children,i=t._maxSize,r=t._batchSize,n=this.renderer,s=e.length;if(0!==s){s>i&&!t.autoResize&&(s=i);var o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));var a=e[0]._texture.baseTexture,h=a.alphaMode>0;this.state.blendMode=ce(t.blendMode,h),n.state.set(this.state);var u,l,c,f,d=n.gl,p=t.worldTransform.copyTo(this.tempMatrix);p.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=p.toArray(!0),this.shader.uniforms.uColor=(u=t.tintRgb,l=t.worldAlpha,c=this.shader.uniforms.uColor,f=h,c=c||new Float32Array(4),f||void 0===f?(c[0]=u[0]*l,c[1]=u[1]*l,c[2]=u[2]*l):(c[0]=u[0],c[1]=u[1],c[2]=u[2]),c[3]=l,c),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);for(var _=!1,m=0,g=0;m<s;m+=r,g+=1){var v=s-m;v>r&&(v=r),g>=o.length&&o.push(this._generateOneMoreBuffer(t));var y=o[g];y.uploadDynamic(e,m,v);var b=t._bufferUpdateIDs[g]||0;(_=_||y._updateID<b)&&(y._updateID=t._updateID,y.uploadStatic(e,m,v)),n.geometry.bind(y.geometry),d.drawElements(d.TRIANGLES,6*v,d.UNSIGNED_SHORT,0)}}},e.prototype.generateBuffers=function(t){for(var e=[],i=t._maxSize,r=t._batchSize,n=t._properties,s=0;s<i;s+=r)e.push(new Mu(this.properties,n,r));return e},e.prototype._generateOneMoreBuffer=function(t){var e=t._batchSize,i=t._properties;return new Mu(this.properties,i,e)},e.prototype.uploadVertices=function(t,e,i,r,n,s){for(var o=0,a=0,h=0,u=0,l=0;l<i;++l){var c=t[e+l],f=c._texture,d=c.scale.x,p=c.scale.y,_=f.trim,m=f.orig;_?(o=(a=_.x-c.anchor.x*m.width)+_.width,h=(u=_.y-c.anchor.y*m.height)+_.height):(o=m.width*(1-c.anchor.x),a=m.width*-c.anchor.x,h=m.height*(1-c.anchor.y),u=m.height*-c.anchor.y),r[s]=a*d,r[s+1]=u*p,r[s+n]=o*d,r[s+n+1]=u*p,r[s+2*n]=o*d,r[s+2*n+1]=h*p,r[s+3*n]=a*d,r[s+3*n+1]=h*p,s+=4*n}},e.prototype.uploadPosition=function(t,e,i,r,n,s){for(var o=0;o<i;o++){var a=t[e+o].position;r[s]=a.x,r[s+1]=a.y,r[s+n]=a.x,r[s+n+1]=a.y,r[s+2*n]=a.x,r[s+2*n+1]=a.y,r[s+3*n]=a.x,r[s+3*n+1]=a.y,s+=4*n}},e.prototype.uploadRotation=function(t,e,i,r,n,s){for(var o=0;o<i;o++){var a=t[e+o].rotation;r[s]=a,r[s+n]=a,r[s+2*n]=a,r[s+3*n]=a,s+=4*n}},e.prototype.uploadUvs=function(t,e,i,r,n,s){for(var o=0;o<i;++o){var a=t[e+o]._texture._uvs;a?(r[s]=a.x0,r[s+1]=a.y0,r[s+n]=a.x1,r[s+n+1]=a.y1,r[s+2*n]=a.x2,r[s+2*n+1]=a.y2,r[s+3*n]=a.x3,r[s+3*n+1]=a.y3,s+=4*n):(r[s]=0,r[s+1]=0,r[s+n]=0,r[s+n+1]=0,r[s+2*n]=0,r[s+2*n+1]=0,r[s+3*n]=0,r[s+3*n+1]=0,s+=4*n)}},e.prototype.uploadTint=function(t,e,i,r,n,s){for(var o=0;o<i;++o){var a=t[e+o],h=a._texture.baseTexture.alphaMode>0,u=a.alpha,l=u<1&&h?fe(a._tintRGB,u):a._tintRGB+(255*u<<24);r[s]=l,r[s+n]=l,r[s+2*n]=l,r[s+3*n]=l,s+=4*n}},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},e.extension={name:"particle",type:Qe.RendererPlugin},e}(Qi);!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(Su||(Su={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(Pu||(Pu={}));var Cu={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},Ru=function(){function t(){this.color=16777215,this.alpha=1,this.texture=Oi.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=Oi.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),Ou=function(t,e){return Ou=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Ou(t,e)};function $u(t,e){function i(){this.constructor=t}Ou(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function Du(t,e){var i,r;void 0===e&&(e=!1);var n=t.length;if(!(n<6)){for(var s=0,o=0,a=t[n-2],h=t[n-1];o<n;o+=2){var u=t[o],l=t[o+1];s+=(u-a)*(l+h),a=u,h=l}if(!e&&s>0||e&&s<=0){var c=n/2;for(o=c+c%2;o<n;o+=2){var f=n-o-2,d=n-o-1,p=o,_=o+1;i=[t[p],t[f]],t[f]=i[0],t[p]=i[1],r=[t[_],t[d]],t[d]=r[0],t[_]=r[1]}}}}var Lu={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,s=e.indices;if(i.length>=6){Du(i,!1);for(var o=[],a=0;a<r.length;a++){var h=r[a];Du(h.points,!0),o.push(i.length/2),i=i.concat(h.points)}var u=yt(i,o,2);if(!u)return;var l=n.length/2;for(a=0;a<u.length;a+=3)s.push(u[a]+l),s.push(u[a+1]+l),s.push(u[a+2]+l);for(a=0;a<i.length;a++)n.push(i[a])}}},Fu={build:function(t){var e,i,r,n,s,o,a=t.points;if(t.type===Re.CIRC){var h=t.shape;e=h.x,i=h.y,s=o=h.radius,r=n=0}else if(t.type===Re.ELIP){var u=t.shape;e=u.x,i=u.y,s=u.width,o=u.height,r=n=0}else{var l=t.shape,c=l.width/2,f=l.height/2;e=l.x+c,i=l.y+f,r=c-(s=o=Math.max(0,Math.min(l.radius,Math.min(c,f)))),n=f-o}if(s>=0&&o>=0&&r>=0&&n>=0){var d=Math.ceil(2.3*Math.sqrt(s+o)),p=8*d+(r?4:0)+(n?4:0);if(a.length=p,0!==p){if(0===d)return a.length=8,a[0]=a[6]=e+r,a[1]=a[3]=i+n,a[2]=a[4]=e-r,void(a[5]=a[7]=i-n);var _=0,m=4*d+(r?2:0)+2,g=m,v=p,y=e+(w=r+s),b=e-w,x=i+(S=n);if(a[_++]=y,a[_++]=x,a[--m]=x,a[--m]=b,n){var T=i-S;a[g++]=b,a[g++]=T,a[--v]=T,a[--v]=y}for(var A=1;A<d;A++){var E=Math.PI/2*(A/d);y=e+(w=r+Math.cos(E)*s),b=e-w,x=i+(S=n+Math.sin(E)*o),T=i-S;a[_++]=y,a[_++]=x,a[--m]=x,a[--m]=b,a[g++]=b,a[g++]=T,a[--v]=T,a[--v]=y}var w,S;y=e+(w=r),b=e-w,x=i+(S=n+o),T=i-S;a[_++]=y,a[_++]=x,a[--v]=T,a[--v]=y,r&&(a[_++]=b,a[_++]=x,a[--v]=T,a[--v]=b)}}else a.length=0},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices;if(0!==i.length){var s,o,a=r.length/2,h=a;if(t.type!==Re.RREC){var u=t.shape;s=u.x,o=u.y}else{var l=t.shape;s=l.x+l.width/2,o=l.y+l.height/2}var c=t.matrix;r.push(t.matrix?c.a*s+c.c*o+c.tx:s,t.matrix?c.b*s+c.d*o+c.ty:o),a++,r.push(i[0],i[1]);for(var f=2;f<i.length;f+=2)r.push(i[f],i[f+1]),n.push(a++,h,a);n.push(h+1,h,a)}}};function ku(t,e,i){return t+(e-t)*i}function Bu(t,e,i,r,n,s,o){void 0===o&&(o=[]);for(var a=o,h=0,u=0,l=0,c=0,f=0,d=0,p=0,_=0;p<=20;++p)h=ku(t,i,_=p/20),u=ku(e,r,_),l=ku(i,n,_),c=ku(r,s,_),f=ku(h,l,_),d=ku(u,c,_),0===p&&a[a.length-2]===f&&a[a.length-1]===d||a.push(f,d);return a}var Nu={build:function(t){if(rl.nextRoundedRectBehavior)Fu.build(t);else{var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,o=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,o)/2));i.length=0,a?(Bu(r,n+a,r,n,r+a,n,i),Bu(r+s-a,n,r+s,n,r+s,n+a,i),Bu(r+s,n+o-a,r+s,n+o,r+s-a,n+o,i),Bu(r+a,n+o,r,n+o,r,n+o-a,i)):i.push(r,n,r+s,n,r+s,n+o,r,n+o)}},triangulate:function(t,e){if(rl.nextRoundedRectBehavior)Fu.triangulate(t,e);else{for(var i=t.points,r=e.points,n=e.indices,s=r.length/2,o=yt(i,null,2),a=0,h=o.length;a<h;a+=3)n.push(o[a]+s),n.push(o[a+1]+s),n.push(o[a+2]+s);for(a=0,h=i.length;a<h;a++)r.push(i[a],i[++a])}}};function Uu(t,e,i,r,n,s,o,a){var h,u;o?(h=r,u=-i):(h=-r,u=i);var l=t-i*n+h,c=e-r*n+u,f=t+i*s+h,d=e+r*s+u;return a.push(l,c),a.push(f,d),2}function Gu(t,e,i,r,n,s,o,a){var h=i-t,u=r-e,l=Math.atan2(h,u),c=Math.atan2(n-t,s-e);a&&l<c?l+=2*Math.PI:!a&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.abs(d),_=Math.sqrt(h*h+u*u),m=1+(15*p*Math.sqrt(_)/Math.PI|0),g=d/m;if(f+=g,a){o.push(t,e),o.push(i,r);for(var v=1,y=f;v<m;v++,y+=g)o.push(t,e),o.push(t+Math.sin(y)*_,e+Math.cos(y)*_);o.push(t,e),o.push(n,s)}else{o.push(i,r),o.push(t,e);for(v=1,y=f;v<m;v++,y+=g)o.push(t+Math.sin(y)*_,e+Math.cos(y)*_),o.push(t,e);o.push(n,s),o.push(t,e)}return 2*m}function Xu(t,e){t.lineStyle.native?function(t,e){var i=0,r=t.shape,n=t.points||r.points,s=r.type!==Re.POLY||r.closeStroke;if(0!==n.length){var o=e.points,a=e.indices,h=n.length/2,u=o.length/2,l=u;for(o.push(n[0],n[1]),i=1;i<h;i++)o.push(n[2*i],n[2*i+1]),a.push(l,l+1),l++;s&&a.push(l,u)}}(t,e):function(t,e){var i=t.shape,r=t.points||i.points.slice(),n=e.closePointEps;if(0!==r.length){var s=t.lineStyle,o=new Le(r[0],r[1]),a=new Le(r[r.length-2],r[r.length-1]),h=i.type!==Re.POLY||i.closeStroke,u=Math.abs(o.x-a.x)<n&&Math.abs(o.y-a.y)<n;if(h){r=r.slice(),u&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));var l=.5*(o.x+a.x),c=.5*(a.y+o.y);r.unshift(l,c),r.push(l,c)}var f=e.points,d=r.length/2,p=r.length,_=f.length/2,m=s.width/2,g=m*m,v=s.miterLimit*s.miterLimit,y=r[0],b=r[1],x=r[2],T=r[3],A=0,E=0,w=-(b-T),S=y-x,P=0,M=0,I=Math.sqrt(w*w+S*S);w/=I,S/=I,w*=m,S*=m;var C=s.alignment,R=2*(1-C),O=2*C;h||(s.cap===Pu.ROUND?p+=Gu(y-w*(R-O)*.5,b-S*(R-O)*.5,y-w*R,b-S*R,y+w*O,b+S*O,f,!0)+2:s.cap===Pu.SQUARE&&(p+=Uu(y,b,w,S,R,O,!0,f))),f.push(y-w*R,b-S*R),f.push(y+w*O,b+S*O);for(var $=1;$<d-1;++$){y=r[2*($-1)],b=r[2*($-1)+1],x=r[2*$],T=r[2*$+1],A=r[2*($+1)],E=r[2*($+1)+1],w=-(b-T),S=y-x,w/=I=Math.sqrt(w*w+S*S),S/=I,w*=m,S*=m,P=-(T-E),M=x-A,P/=I=Math.sqrt(P*P+M*M),M/=I,P*=m,M*=m;var D=x-y,L=b-T,F=x-A,k=E-T,B=D*F+L*k,N=L*F-k*D,U=N<0;if(Math.abs(N)<.001*Math.abs(B))f.push(x-w*R,T-S*R),f.push(x+w*O,T+S*O),B>=0&&(s.join===Su.ROUND?p+=Gu(x,T,x-w*R,T-S*R,x-P*R,T-M*R,f,!1)+4:p+=2,f.push(x-P*O,T-M*O),f.push(x+P*R,T+M*R));else{var G=(-w+y)*(-S+T)-(-w+x)*(-S+b),X=(-P+A)*(-M+T)-(-P+x)*(-M+E),V=(D*X-F*G)/N,H=(k*G-L*X)/N,j=(V-x)*(V-x)+(H-T)*(H-T),Y=x+(V-x)*R,z=T+(H-T)*R,W=x-(V-x)*O,q=T-(H-T)*O,Z=U?R:O;j<=Math.min(D*D+L*L,F*F+k*k)+Z*Z*g?s.join===Su.BEVEL||j/g>v?(U?(f.push(Y,z),f.push(x+w*O,T+S*O),f.push(Y,z),f.push(x+P*O,T+M*O)):(f.push(x-w*R,T-S*R),f.push(W,q),f.push(x-P*R,T-M*R),f.push(W,q)),p+=2):s.join===Su.ROUND?U?(f.push(Y,z),f.push(x+w*O,T+S*O),p+=Gu(x,T,x+w*O,T+S*O,x+P*O,T+M*O,f,!0)+4,f.push(Y,z),f.push(x+P*O,T+M*O)):(f.push(x-w*R,T-S*R),f.push(W,q),p+=Gu(x,T,x-w*R,T-S*R,x-P*R,T-M*R,f,!1)+4,f.push(x-P*R,T-M*R),f.push(W,q)):(f.push(Y,z),f.push(W,q)):(f.push(x-w*R,T-S*R),f.push(x+w*O,T+S*O),s.join===Su.ROUND?p+=U?Gu(x,T,x+w*O,T+S*O,x+P*O,T+M*O,f,!0)+2:Gu(x,T,x-w*R,T-S*R,x-P*R,T-M*R,f,!1)+2:s.join===Su.MITER&&j/g<=v&&(U?(f.push(W,q),f.push(W,q)):(f.push(Y,z),f.push(Y,z)),p+=2),f.push(x-P*R,T-M*R),f.push(x+P*O,T+M*O),p+=2)}}y=r[2*(d-2)],b=r[2*(d-2)+1],x=r[2*(d-1)],w=-(b-(T=r[2*(d-1)+1])),S=y-x,w/=I=Math.sqrt(w*w+S*S),S/=I,w*=m,S*=m,f.push(x-w*R,T-S*R),f.push(x+w*O,T+S*O),h||(s.cap===Pu.ROUND?p+=Gu(x-w*(R-O)*.5,T-S*(R-O)*.5,x-w*R,T-S*R,x+w*O,T+S*O,f,!1)+2:s.cap===Pu.SQUARE&&(p+=Uu(x,T,w,S,R,O,!1,f)));var Q=e.indices,J=Cu.epsilon*Cu.epsilon;for($=_;$<p+_-2;++$)y=f[2*$],b=f[2*$+1],x=f[2*($+1)],T=f[2*($+1)+1],A=f[2*($+2)],E=f[2*($+2)+1],Math.abs(y*(T-E)+x*(E-b)+A*(b-T))<J||Q.push($,$+1,$+2)}}(t,e)}var Vu,Hu=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var o=s[s.length-2],a=s[s.length-1]-e,h=o-t,u=r-e,l=i-t,c=Math.abs(a*l-h*u);if(c<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var f=a*a+h*h,d=u*u+l*l,p=a*u+h*l,_=n*Math.sqrt(f)/c,m=n*Math.sqrt(d)/c,g=_*p/f,v=m*p/d,y=_*l+m*h,b=_*u+m*a,x=h*(m+g),T=a*(m+g),A=l*(_+v),E=u*(_+v);return{cx:y+t,cy:b+e,radius:n,startAngle:Math.atan2(T-b,x-y),endAngle:Math.atan2(E-b,A-y),anticlockwise:h*u>l*a}},t.arc=function(t,e,i,r,n,s,o,a,h){for(var u=o-s,l=Cu._segmentsCount(Math.abs(u)*n,40*Math.ceil(Math.abs(u)/Oe)),c=u/(2*l),f=2*c,d=Math.cos(c),p=Math.sin(c),_=l-1,m=_%1/_,g=0;g<=_;++g){var v=c+s+f*(g+m*g),y=Math.cos(v),b=-Math.sin(v);h.push((d*y+p*b)*n+i,(d*-b+p*y)*n+r)}},t}(),ju=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s,o,a){for(var h=0,u=0,l=0,c=0,f=0,d=0,p=0,_=0,m=0,g=0,v=0,y=t,b=e,x=1;x<=10;++x)g=y-(_=(p=(d=(f=1-(u=x/10))*f)*f)*t+3*d*u*i+3*f*(l=u*u)*n+(c=l*u)*o),v=b-(m=p*e+3*d*u*r+3*f*l*s+c*a),y=_,b=m,h+=Math.sqrt(g*g+v*v);return h},t.curveTo=function(e,i,r,n,s,o,a){var h=a[a.length-2],u=a[a.length-1];a.length-=2;var l=Cu._segmentsCount(t.curveLength(h,u,e,i,r,n,s,o)),c=0,f=0,d=0,p=0,_=0;a.push(h,u);for(var m=1,g=0;m<=l;++m)d=(f=(c=1-(g=m/l))*c)*c,_=(p=g*g)*g,a.push(d*h+3*f*g*e+3*c*p*r+_*s,d*u+3*f*g*i+3*c*p*n+_*o)},t}(),Yu=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s){var o=t-2*i+n,a=e-2*r+s,h=2*i-2*t,u=2*r-2*e,l=4*(o*o+a*a),c=4*(o*h+a*u),f=h*h+u*u,d=2*Math.sqrt(l+c+f),p=Math.sqrt(l),_=2*l*p,m=2*Math.sqrt(f),g=c/p;return(_*d+p*c*(d-m)+(4*f*l-c*c)*Math.log((2*p+g+d)/(g+m)))/(4*_)},t.curveTo=function(e,i,r,n,s){for(var o=s[s.length-2],a=s[s.length-1],h=Cu._segmentsCount(t.curveLength(o,a,e,i,r,n)),u=0,l=0,c=1;c<=h;++c){var f=c/h;u=o+(e-o)*f,l=a+(i-a)*f,s.push(u+(e+(r-e)*f-u)*f,l+(i+(n-i)*f-l)*f)}},t}(),zu=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),Wu=((Vu={})[Re.POLY]=Lu,Vu[Re.CIRC]=Fu,Vu[Re.ELIP]=Fu,Vu[Re.RECT]={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,o=t.points;o.length=0,o.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},Vu[Re.RREC]=Nu,Vu),qu=[],Zu=[],Qu=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),Ju=new Le,Ku=function(t){function e(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new Tn,e.boundsDirty=-1,e}return $u(e,t),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Zu.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),qu.push(e)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new Qu(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},e.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new Qu(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,Ju):Ju.copyFrom(t),r.shape.contains(Ju.x,Ju.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(Ju.x,Ju.y)){n=!0;break}}if(!n)return!0}}return!1},e.prototype.updateBatches=function(){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,e=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(var n=this.shapeIndex;n<e.length;n++){this.shapeIndex++;var s=e[n],o=s.fillStyle,a=s.lineStyle;Wu[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix),(o.visible||a.visible)&&this.processHoles(s.holes);for(var h=0;h<2;h++){var u=0===h?o:a;if(u.visible){var l=u.texture.baseTexture,c=this.indices.length,f=this.points.length/2;l.wrapMode=d.REPEAT,0===h?this.processFill(s):this.processLine(s);var p=this.points.length/2-f;0!==p&&(i&&!this._compareStyles(r,u)&&(i.end(c,f),i=null),i||((i=qu.pop()||new zu).begin(u,c,f),this.batches.push(i),r=u),this.addUvs(this.points,t,u.texture,f,p,u.matrix))}}}var _=this.indices.length,m=this.points.length/2;if(i&&i.end(_,m),0!==this.batches.length){var g=m>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&g===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=g?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},e.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*e.BATCHABLE_SIZE},e.prototype.buildDrawCalls=function(){for(var t=++mi._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),Zu.push(this.drawCalls[e]);this.drawCalls.length=0;var i=this.colors,r=this.textureIds,n=Zu.pop();n||((n=new fn).texArray=new dn),n.texArray.count=0,n.start=0,n.size=0,n.type=a.TRIANGLES;var s=0,o=null,h=0,u=!1,l=a.TRIANGLES,c=0;this.drawCalls.push(n);for(e=0;e<this.batches.length;e++){var f=this.batches[e],p=f.style,_=p.texture.baseTexture;u!==!!p.native&&(l=(u=!!p.native)?a.LINES:a.TRIANGLES,o=null,s=8,t++),o!==_&&(o=_,_._batchEnabled!==t&&(8===s&&(t++,s=0,n.size>0&&((n=Zu.pop())||((n=new fn).texArray=new dn),this.drawCalls.push(n)),n.start=c,n.size=0,n.texArray.count=0,n.type=l),_.touched=1,_._batchEnabled=t,_._batchLocation=s,_.wrapMode=d.REPEAT,n.texArray.elements[n.texArray.count++]=_,s++)),n.size+=f.size,c+=f.size,h=_._batchLocation,this.addColors(i,p.color,p.alpha,f.attribSize,f.attribStart),this.addTextureIds(r,h,f.attribSize,f.attribStart)}mi._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),o=new Uint32Array(n),a=0,h=0;h<t.length/2;h++)s[a++]=t[2*h],s[a++]=t[2*h+1],s[a++]=e[2*h],s[a++]=e[2*h+1],o[a++]=i[h],s[a++]=r[h];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){t.holes.length?Lu.triangulate(t,this):Wu[t.type].triangulate(t,this)},e.prototype.processLine=function(t){Xu(t,this);for(var e=0;e<t.holes.length;e++)Xu(t.holes[e],this)},e.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];Wu[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},e.prototype.addColors=function(t,e,i,r,n){void 0===n&&(n=0);var s=fe((e>>16)+(65280&e)+((255&e)<<16),i);t.length=Math.max(t.length,n+r);for(var o=0;o<r;o++)t[n+o]=s},e.prototype.addTextureIds=function(t,e,i,r){void 0===r&&(r=0),t.length=Math.max(t.length,r+i);for(var n=0;n<i;n++)t[r+n]=e},e.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var o=0,a=e.length,h=i.frame;o<n;){var u=t[2*(r+o)],l=t[2*(r+o)+1];if(s){var c=s.a*u+s.c*l+s.tx;l=s.b*u+s.d*l+s.ty,u=c}o++,e.push(u/h.width,l/h.height)}var f=i.baseTexture;(h.width<f.width||h.height<f.height)&&this.adjustUvs(e,i,a,n)},e.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=1e-6,o=i+2*r,a=e.frame,h=a.width/n.width,u=a.height/n.height,l=a.x/a.width,c=a.y/a.height,f=Math.floor(t[i]+s),d=Math.floor(t[i+1]+s),p=i+2;p<o;p+=2)f=Math.min(f,Math.floor(t[p]+s)),d=Math.min(d,Math.floor(t[p+1]+s));l-=f,c-=d;for(p=i;p<o;p+=2)t[p]=(t[p]+l)*h,t[p+1]=(t[p+1]+c)*u},e.BATCHABLE_SIZE=100,e}(gn),tl=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=Pu.BUTT,e.join=Su.MITER,e.miterLimit=10,e}return $u(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(Ru),el=new Float32Array(3),il={},rl=function(t){function e(e){void 0===e&&(e=null);var i=t.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new Ru,i._lineStyle=new tl,i._matrix=null,i._holeMode=!1,i.state=Rr.for2d(),i._geometry=e||new Ku,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=o.NORMAL,i}return $u(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t,e,i,r,n){return void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=.5),void 0===n&&(n=!1),"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:Oi.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:Pu.BUTT,join:Su.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var e=t.width>0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},t)):this._lineStyle.reset(),this},e.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Ue,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ue,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},e.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},e.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},e.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),Yu.curveTo(t,e,i,r,n),this},e.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),ju.curveTo(t,e,i,r,n,s,this.currentPath.points),this},e.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,o=Hu.curveTo(t,e,i,r,n,s);if(o){var a=o.cx,h=o.cy,u=o.radius,l=o.startAngle,c=o.endAngle,f=o.anticlockwise;this.arc(a,h,u,l,c,f)}return this},e.prototype.arc=function(t,e,i,r,n,s){if(void 0===s&&(s=!1),r===n)return this;if(!s&&n<=r?n+=Oe:s&&r<=n&&(r+=Oe),0===n-r)return this;var o=t+Math.cos(r)*i,a=e+Math.sin(r)*i,h=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var l=Math.abs(u[u.length-2]-o),c=Math.abs(u[u.length-1]-a);l<h&&c<h||u.push(o,a)}else this.moveTo(o,a),u=this.currentPath.points;return Hu.arc(o,a,t,e,i,r,n,s,u),this},e.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill({texture:Oi.WHITE,color:t,alpha:e})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:Oi.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var e=t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,e,i,r){return this.drawShape(new ke(t,e,i,r))},e.prototype.drawRoundedRect=function(t,e,i,r,n){return this.drawShape(new Ge(t,e,i,r,n))},e.prototype.drawCircle=function(t,e,i){return this.drawShape(new Be(t,e,i))},e.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new Ne(t,e,i,r))},e.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var n=!0,s=i[0];s.points?(n=s.closeStroke,t=s.points):t=Array.isArray(i[0])?i[0]:i;var o=new Ue(t);return o.closeStroke=n,this.drawShape(o),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==Re.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],s=n.style.color,o=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),a=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),h={vertexData:o,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:a,_batchRGB:ae(s),_tintRGB:s,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=h}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},e.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,o=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},e.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,o=i.count,a=0;a<o;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},e.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!il[i]){for(var r=t.plugins[i].MAX_TEXTURES,n=new Int32Array(r),s=0;s<r;s++)n[s]=s;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ve,default:Yi.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;il[i]=new Cr(a,o)}e=il[i]}return e},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=ae(this.tint,el),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},e.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,o=e.tx,a=e.ty,h=this._geometry.points,u=this.vertexData,l=0,c=0;c<h.length;c+=2){var f=h[c],d=h[c+1];u[l++]=i*f+n*d+o,u[l++]=s*d+r*f+a}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},e.prototype.setMatrix=function(t){return this._matrix=t,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(e){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,e)},e.nextRoundedRectBehavior=!1,e._TEMP_POINT=new Le,e}(Mn),nl=function(t,e){return nl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},nl(t,e)};var sl,ol=new Le,al=new Uint16Array([0,1,2,0,2,3]),hl=function(t){function e(e){var i=t.call(this)||this;return i._anchor=new Xe(i._onAnchorUpdate,i,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),i._texture=null,i._width=0,i._height=0,i._tint=null,i._tintRGB=null,i.tint=16777215,i.blendMode=o.NORMAL,i._cachedTint=16777215,i.uvs=null,i.texture=e||Oi.EMPTY,i.vertexData=new Float32Array(8),i.vertexTrimmedData=null,i._transformID=-1,i._textureID=-1,i._transformTrimmedID=-1,i._textureTrimmedID=-1,i.indices=al,i.pluginName="batch",i.isSprite=!0,i._roundPixels=X.ROUND_PIXELS,i}return function(t,e){function i(){this.constructor=t}nl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=ye(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=ye(this.scale.y)*this._height/this._texture.orig.height)},e.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},e.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,o=e.tx,a=e.ty,h=this.vertexData,u=t.trim,l=t.orig,c=this._anchor,f=0,d=0,p=0,_=0;if(u?(f=(d=u.x-c._x*l.width)+u.width,p=(_=u.y-c._y*l.height)+u.height):(f=(d=-c._x*l.width)+l.width,p=(_=-c._y*l.height)+l.height),h[0]=i*d+n*_+o,h[1]=s*_+r*d+a,h[2]=i*f+n*_+o,h[3]=s*_+r*f+a,h[4]=i*f+n*p+o,h[5]=s*p+r*f+a,h[6]=i*d+n*p+o,h[7]=s*p+r*d+a,this._roundPixels)for(var m=X.RESOLUTION,g=0;g<h.length;++g)h[g]=Math.round((h[g]*m|0)/m)}},e.prototype.calculateTrimmedVertices=function(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,n=this.transform.worldTransform,s=n.a,o=n.b,a=n.c,h=n.d,u=n.tx,l=n.ty,c=-r._x*i.width,f=c+i.width,d=-r._y*i.height,p=d+i.height;e[0]=s*c+a*d+u,e[1]=h*d+o*c+l,e[2]=s*f+a*d+u,e[3]=h*d+o*f+l,e[4]=s*f+a*p+u,e[5]=h*p+o*f+l,e[6]=s*c+a*p+u,e[7]=h*p+o*c+l},e.prototype._render=function(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)},e.prototype._calculateBounds=function(){var t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},e.prototype.getLocalBounds=function(e){return 0===this.children.length?(this._localBounds||(this._localBounds=new Tn),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new ke),e=this._localBoundsRect),this._localBounds.getRectangle(e)):t.prototype.getLocalBounds.call(this,e)},e.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,ol);var e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x,n=0;return ol.x>=r&&ol.x<r+e&&(n=-i*this.anchor.y,ol.y>=n&&ol.y<n+i)},e.prototype.destroy=function(e){if(t.prototype.destroy.call(this,e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof e?e:e&&e.texture){var i="boolean"==typeof e?e:e&&e.baseTexture;this._texture.destroy(!!i)}this._texture=null},e.from=function(t,i){return new e(t instanceof Oi?t:Oi.from(t,i))},Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){var e=ye(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){var e=ye(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(t){this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||Oi.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),e}(Mn),ul=function(t,e){return ul=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},ul(t,e)};!function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(sl||(sl={}));var ll={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:sl.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},cl=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],fl=function(){function t(t){this.styleID=0,this.reset(),_l(this,t,t)}return t.prototype.clone=function(){var e={};return _l(e,this,ll),new t(e)},t.prototype.reset=function(){_l(this,ll,ll)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=pl(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=pl(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=pl(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&cl.indexOf(r)<0&&(r='"'+r+'"'),e[i]=r}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function dl(t){return"number"==typeof t?he(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function pl(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=dl(t[e]);return t}return dl(t)}function _l(t,e,i){for(var r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}var ml={willReadFrequently:!0},gl=function(){function t(t,e,i,r,n,s,o,a,h){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=s,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,r,n){void 0===n&&(n=t._canvas),r=null==r?i.wordWrap:r;var s=i.toFontString(),o=t.measureFont(s);0===o.fontSize&&(o.fontSize=i.fontSize,o.ascent=i.fontSize);var a=n.getContext("2d",ml);a.font=s;for(var h=(r?t.wordWrap(e,i,n):e).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),l=0,c=0;c<h.length;c++){var f=a.measureText(h[c]).width+(h[c].length-1)*i.letterSpacing;u[c]=f,l=Math.max(l,f)}var d=l+i.strokeThickness;i.dropShadow&&(d+=i.dropShadowDistance);var p=i.lineHeight||o.fontSize+i.strokeThickness,_=Math.max(p,o.fontSize+i.strokeThickness)+(h.length-1)*(p+i.leading);return i.dropShadow&&(_+=i.dropShadowDistance),new t(e,i,d,_,h,u,p+i.leading,l,o)},t.wordWrap=function(e,i,r){void 0===r&&(r=t._canvas);for(var n=r.getContext("2d",ml),s=0,o="",a="",h=Object.create(null),u=i.letterSpacing,l=i.whiteSpace,c=t.collapseSpaces(l),f=t.collapseNewlines(l),d=!c,p=i.wordWrapWidth+u,_=t.tokenize(e),m=0;m<_.length;m++){var g=_[m];if(t.isNewline(g)){if(!f){a+=t.addLine(o),d=!c,o="",s=0;continue}g=" "}if(c){var v=t.isBreakingSpace(g),y=t.isBreakingSpace(o[o.length-1]);if(v&&y)continue}var b=t.getFromCache(g,u,h,n);if(b>p)if(""!==o&&(a+=t.addLine(o),o="",s=0),t.canBreakWords(g,i.breakWords))for(var x=t.wordWrapSplit(g),T=0;T<x.length;T++){for(var A=x[T],E=1;x[T+E];){var w=x[T+E],S=A[A.length-1];if(t.canBreakChars(S,w,g,T,i.breakWords))break;A+=w,E++}T+=A.length-1;var P=t.getFromCache(A,u,h,n);P+s>p&&(a+=t.addLine(o),d=!1,o="",s=0),o+=A,s+=P}else{o.length>0&&(a+=t.addLine(o),o="",s=0);var M=m===_.length-1;a+=t.addLine(g,!M),d=!1,o="",s=0}else b+s>p&&(d=!1,a+=t.addLine(o),o="",s=0),(o.length>0||!t.isBreakingSpace(g)||d)&&(o+=g,s+=b)}return a+=t.addLine(o,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,r){var n=i[t];if("number"!=typeof n){var s=t.length*e;n=r.measureText(t).width+s,i[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],r="";if("string"!=typeof e)return i;for(var n=0;n<e.length;n++){var s=e[n],o=e[n+1];t.isBreakingSpace(s,o)||t.isNewline(s)?(""!==r&&(i.push(r),r=""),i.push(s)):r+=s}return""!==r&&i.push(r),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,r,n){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},r=t._canvas,n=t._context;n.font=e;var s=t.METRICS_STRING+t.BASELINE_SYMBOL,o=Math.ceil(n.measureText(s).width),a=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,r.width=o,r.height=h,n.fillStyle="#f00",n.fillRect(0,0,o,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(s,0,a);var u=n.getImageData(0,0,o,h).data,l=u.length,c=4*o,f=0,d=0,p=!1;for(f=0;f<a;++f){for(var _=0;_<c;_+=4)if(255!==u[d+_]){p=!0;break}if(p)break;d+=c}for(i.ascent=a-f,d=l-c,p=!1,f=h;f>a;--f){for(_=0;_<c;_+=4)if(255!==u[d+_]){p=!0;break}if(p)break;d-=c}return i.descent=f-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},Object.defineProperty(t,"_canvas",{get:function(){if(!t.__canvas){var e=void 0;try{var i=new OffscreenCanvas(0,0),r=i.getContext("2d",ml);if(r&&r.measureText)return t.__canvas=i,i;e=X.ADAPTER.createCanvas()}catch(t){e=X.ADAPTER.createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas},enumerable:!1,configurable:!0}),Object.defineProperty(t,"_context",{get:function(){return t.__context||(t.__context=t._canvas.getContext("2d",ml)),t.__context},enumerable:!1,configurable:!0}),t}();gl._fonts={},gl.METRICS_STRING="|ÉqÅ",gl.BASELINE_SYMBOL="M",gl.BASELINE_MULTIPLIER=1.4,gl.HEIGHT_MULTIPLIER=2,gl._newlines=[10,13],gl._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var vl={texture:!0,children:!1,baseTexture:!0},yl=function(t){function e(e,i,r){var n=this,s=!1;r||(r=X.ADAPTER.createCanvas(),s=!0),r.width=3,r.height=3;var o=Oi.from(r);return o.orig=new ke,o.trim=new ke,(n=t.call(this,o)||this)._ownCanvas=s,n.canvas=r,n.context=r.getContext("2d",{willReadFrequently:!0}),n._resolution=X.RESOLUTION,n._autoResolution=!0,n._text=null,n._style=null,n._styleListener=null,n._font="",n.text=e,n.style=i,n.localStyleID=-1,n}return function(t,e){function i(){this.constructor=t}ul(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype.updateText=function(t){var i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),this.dirty||!t){this._font=this._style.toFontString();var r,n,s=this.context,o=gl.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=o.width,h=o.height,u=o.lines,l=o.lineHeight,c=o.lineWidths,f=o.maxLineWidth,d=o.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+2*i.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,h)+2*i.padding)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=i.strokeThickness,s.textBaseline=i.textBaseline,s.lineJoin=i.lineJoin,s.miterLimit=i.miterLimit;for(var p=i.dropShadow?2:1,_=0;_<p;++_){var m=i.dropShadow&&0===_,g=m?Math.ceil(Math.max(1,h)+2*i.padding):0,v=g*this._resolution;if(m){s.fillStyle="black",s.strokeStyle="black";var y=i.dropShadowColor,b=ae("number"==typeof y?y:ue(y)),x=i.dropShadowBlur*this._resolution,T=i.dropShadowDistance*this._resolution;s.shadowColor="rgba("+255*b[0]+","+255*b[1]+","+255*b[2]+","+i.dropShadowAlpha+")",s.shadowBlur=x,s.shadowOffsetX=Math.cos(i.dropShadowAngle)*T,s.shadowOffsetY=Math.sin(i.dropShadowAngle)*T+v}else s.fillStyle=this._generateFillStyle(i,u,o),s.strokeStyle=i.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;var A=(l-d.fontSize)/2;(!e.nextLineHeightBehavior||l-d.fontSize<0)&&(A=0);for(var E=0;E<u.length;E++)r=i.strokeThickness/2,n=i.strokeThickness/2+E*l+d.ascent+A,"right"===i.align?r+=f-c[E]:"center"===i.align&&(r+=(f-c[E])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(u[E],r+i.padding,n+i.padding-g,!0),i.fill&&this.drawLetterSpacing(u[E],r+i.padding,n+i.padding-g)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(t,i,r,n){void 0===n&&(n=!1);var s=this._style.letterSpacing,o=e.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(0===s||o)return o&&(this.context.letterSpacing=s,this.context.textLetterSpacing=s),void(n?this.context.strokeText(t,i,r):this.context.fillText(t,i,r));for(var a=i,h=Array.from?Array.from(t):t.split(""),u=this.context.measureText(t).width,l=0,c=0;c<h.length;++c){var f=h[c];n?this.context.strokeText(f,a,r):this.context.fillText(f,a,r);for(var d="",p=c+1;p<h.length;++p)d+=h[p];a+=u-(l=this.context.measureText(d).width)+s,u=l}},e.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=function(t){var e,i,r,n=t.width,s=t.height,o=t.getContext("2d",{willReadFrequently:!0}),a=o.getImageData(0,0,n,s).data,h=a.length,u={top:null,left:null,right:null,bottom:null},l=null;for(e=0;e<h;e+=4)0!==a[e+3]&&(i=e/4%n,r=~~(e/4/n),null===u.top&&(u.top=r),(null===u.left||i<u.left)&&(u.left=i),(null===u.right||u.right<i)&&(u.right=i+1),(null===u.bottom||u.bottom<r)&&(u.bottom=r));return null!==u.top&&(n=u.right-u.left,s=u.bottom-u.top+1,l=o.getImageData(u.left,u.top,n,s)),{height:s,width:n,data:l}}(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,r=this._style,n=r.trim?0:r.padding,s=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-n,i.trim.y=-n,i.orig.width=i._frame.width-2*n,i.orig.height=i._frame.height-2*n,this._onTextureUpdate(),s.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this.dirty=!1},e.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),t.prototype._render.call(this,e)},e.prototype.updateTransform=function(){this.updateText(!0),t.prototype.updateTransform.call(this)},e.prototype.getBounds=function(e,i){return this.updateText(!0),-1===this._textureID&&(e=!1),t.prototype.getBounds.call(this,e,i)},e.prototype.getLocalBounds=function(e){return this.updateText(!0),t.prototype.getLocalBounds.call(this,e)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)},e.prototype._generateFillStyle=function(t,e,i){var r,n=t.fill;if(!Array.isArray(n))return n;if(1===n.length)return n[0];var s=t.dropShadow?t.dropShadowDistance:0,o=t.padding||0,a=this.canvas.width/this._resolution-s-2*o,h=this.canvas.height/this._resolution-s-2*o,u=n.slice(),l=t.fillGradientStops.slice();if(!l.length)for(var c=u.length+1,f=1;f<c;++f)l.push(f/c);if(u.unshift(n[0]),l.unshift(0),u.push(n[n.length-1]),l.push(1),t.fillGradientType===sl.LINEAR_VERTICAL){r=this.context.createLinearGradient(a/2,o,a/2,h+o);var d=i.fontProperties.fontSize+t.strokeThickness;for(f=0;f<e.length;f++){var p=i.lineHeight*(f-1)+d,_=i.lineHeight*f,m=_;f>0&&p>_&&(m=(_+p)/2);var g=_+d,v=i.lineHeight*(f+1),y=g;f+1<e.length&&v<g&&(y=(g+v)/2);for(var b=(y-m)/h,x=0;x<u.length;x++){var T=0;T="number"==typeof l[x]?l[x]:x/u.length;var A=Math.min(1,Math.max(0,m/h+T*b));A=Number(A.toFixed(5)),r.addColorStop(A,u[x])}}}else{r=this.context.createLinearGradient(o,h/2,a+o,h/2);var E=u.length+1,w=1;for(f=0;f<u.length;f++){var S=void 0;S="number"==typeof l[f]?l[f]:w/E,r.addColorStop(S,u[f]),w++}}return r},e.prototype.destroy=function(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},vl,e),t.prototype.destroy.call(this,e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=ye(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=ye(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof fl?t:new fl(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.nextLineHeightBehavior=!1,e.experimentalLetterSpacing=!1,e}(hl);
/*!
   * @pixi/prepare - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/prepare is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
X.UPLOADS_PER_FRAME=4;
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
var bl=function(t,e){return bl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},bl(t,e)};var xl=function(){function t(t){this.maxItemsPerFrame=t,this.itemsLeft=0}return t.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},t.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},t}();function Tl(t,e){var i=!1;if(t&&t._textures&&t._textures.length)for(var r=0;r<t._textures.length;r++)if(t._textures[r]instanceof Oi){var n=t._textures[r].baseTexture;-1===e.indexOf(n)&&(e.push(n),i=!0)}return i}function Al(t,e){if(t.baseTexture instanceof mi){var i=t.baseTexture;return-1===e.indexOf(i)&&e.push(i),!0}return!1}function El(t,e){if(t._texture&&t._texture instanceof Oi){var i=t._texture.baseTexture;return-1===e.indexOf(i)&&e.push(i),!0}return!1}function wl(t,e){return e instanceof yl&&(e.updateText(!0),!0)}function Sl(t,e){if(e instanceof fl){var i=e.toFontString();return gl.measureFont(i),!0}return!1}function Pl(t,e){if(t instanceof yl){-1===e.indexOf(t.style)&&e.push(t.style),-1===e.indexOf(t)&&e.push(t);var i=t._texture.baseTexture;return-1===e.indexOf(i)&&e.push(i),!0}return!1}function Ml(t,e){return t instanceof fl&&(-1===e.indexOf(t)&&e.push(t),!0)}var Il=function(){function t(t){var e=this;this.limiter=new xl(X.UPLOADS_PER_FRAME),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){e.queue&&e.prepareItems()},this.registerFindHook(Pl),this.registerFindHook(Ml),this.registerFindHook(Tl),this.registerFindHook(Al),this.registerFindHook(El),this.registerUploadHook(wl),this.registerUploadHook(Sl)}return t.prototype.upload=function(t,e){var i=this;return"function"==typeof t&&(e=t,t=null),e&&Ae("6.5.0","BasePrepare.upload callback is deprecated, use the return Promise instead."),new Promise(function(r){t&&i.add(t);var n=function(){null==e||e(),r()};i.queue.length?(i.completes.push(n),i.ticking||(i.ticking=!0,oi.system.addOnce(i.tick,i,ei.UTILITY))):n()})},t.prototype.tick=function(){setTimeout(this.delayedTick,0)},t.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var t=this.queue[0],e=!1;if(t&&!t._destroyed)for(var i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}e||this.queue.shift()}if(this.queue.length)oi.system.addOnce(this.tick,this,ei.UTILITY);else{this.ticking=!1;var n=this.completes.slice(0);this.completes.length=0;for(i=0,r=n.length;i<r;i++)n[i]()}},t.prototype.registerFindHook=function(t){return t&&this.addHooks.push(t),this},t.prototype.registerUploadHook=function(t){return t&&this.uploadHooks.push(t),this},t.prototype.add=function(t){for(var e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Mn)for(e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this},t.prototype.destroy=function(){this.ticking&&oi.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},t}();function Cl(t,e){return e instanceof mi&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function Rl(t,e){if(!(e instanceof rl))return!1;var i=e.geometry;e.finishPoly(),i.updateBatches();for(var r=i.batches,n=0;n<r.length;n++){var s=r[n].style.texture;s&&Cl(t,s.baseTexture)}return i.batchable||t.geometry.bind(i,e._resolveDirectShader(t)),!0}function Ol(t,e){return t instanceof rl&&(e.push(t),!0)}var $l=function(t){function e(e){var i=t.call(this,e)||this;return i.uploadHookHelper=i.renderer,i.registerFindHook(Ol),i.registerUploadHook(Cl),i.registerUploadHook(Rl),i}return function(t,e){function i(){this.constructor=t}bl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.extension={name:"prepare",type:Qe.RendererPlugin},e}(Il),Dl=function(){function t(t,e,i){void 0===i&&(i=null),this.linkedSheets=[],this._texture=t instanceof Oi?t:null,this.baseTexture=t instanceof mi?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;var r=this.baseTexture.resource;this.resolution=this._updateResolution(i||(r?r.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return t.prototype._updateResolution=function(t){void 0===t&&(t=null);var e=this.data.meta.scale,i=Ce(t,null);return null===i&&(i=void 0!==e?parseFloat(e):1),1!==i&&this.baseTexture.setResolution(i),i},t.prototype.parse=function(e){var i=this;return e&&Ae("6.5.0","Spritesheet.parse callback is deprecated, use the return Promise instead."),new Promise(function(r){i._callback=function(t){null==e||e(t),r(t)},i._batchIndex=0,i._frameKeys.length<=t.BATCH_SIZE?(i._processFrames(0),i._processAnimations(),i._parseComplete()):i._nextBatch()})},t.prototype._processFrames=function(e){for(var i=e,r=t.BATCH_SIZE;i-e<r&&i<this._frameKeys.length;){var n=this._frameKeys[i],s=this._frames[n],o=s.frame;if(o){var a=null,h=null,u=!1!==s.trimmed&&s.sourceSize?s.sourceSize:s.frame,l=new ke(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);a=s.rotated?new ke(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):new ke(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),!1!==s.trimmed&&s.spriteSourceSize&&(h=new ke(Math.floor(s.spriteSourceSize.x)/this.resolution,Math.floor(s.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[n]=new Oi(this.baseTexture,a,l,h,s.rotated?2:0,s.anchor),Oi.addToCache(this.textures[n],n)}i++}},t.prototype._processAnimations=function(){var t=this.data.animations||{};for(var e in t){this.animations[e]=[];for(var i=0;i<t[e].length;i++){var r=t[e][i];this.animations[e].push(this.textures[r])}}},t.prototype._parseComplete=function(){var t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)},t.prototype._nextBatch=function(){var e=this;this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout(function(){e._batchIndex*t.BATCH_SIZE<e._frameKeys.length?e._nextBatch():(e._processAnimations(),e._parseComplete())},0)},t.prototype.destroy=function(t){var e;for(var i in void 0===t&&(t=!1),this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(null===(e=this._texture)||void 0===e||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]},t.BATCH_SIZE=1e3,t}(),Ll=function(){function t(){}return t.use=function(e,i){var r,n,s=this,o=e.name+"_image";if(e.data&&e.type===vh.TYPE.JSON&&e.data.frames&&!s.resources[o]){var a=null===(n=null===(r=e.data)||void 0===r?void 0:r.meta)||void 0===n?void 0:n.related_multi_packs;if(Array.isArray(a))for(var h=function(t){if("string"!=typeof t)return"continue";var i=t.replace(".json",""),r=ie.resolve(e.url.replace(s.baseUrl,""),t);if(s.resources[i]||Object.values(s.resources).some(function(t){return ie.format(ie.parse(t.url))===r}))return"continue";var n={crossOrigin:e.crossOrigin,loadType:vh.LOAD_TYPE.XHR,xhrType:vh.XHR_RESPONSE_TYPE.JSON,parentResource:e,metadata:e.metadata};s.add(i,r,n)},u=0,l=a;u<l.length;u++){h(l[u])}var c={crossOrigin:e.crossOrigin,metadata:e.metadata.imageMetadata,parentResource:e},f=t.getResourcePath(e,s.baseUrl);s.add(o,f,c,function(t){if(t.error)i(t.error);else{var r=new Dl(t.texture,e.data,e.url);r.parse().then(function(){e.spritesheet=r,e.textures=r.textures,i()})}})}else i()},t.getResourcePath=function(t,e){return t.isDataUrl?t.data.meta.image:ie.resolve(t.url.replace(e,""),t.data.meta.image)},t.extension=Qe.Loader,t}(),Fl=function(t,e){return Fl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Fl(t,e)};
/*!
   * @pixi/spritesheet - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/spritesheet is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */function kl(t,e){function i(){this.constructor=t}Fl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var Bl=new Le;!function(t){function e(e,i,r){void 0===i&&(i=100),void 0===r&&(r=100);var n=t.call(this,e)||this;return n.tileTransform=new Ke,n._width=i,n._height=r,n.uvMatrix=n.texture.uvMatrix||new Dr(e),n.pluginName="tilingSprite",n.uvRespectAnchor=!1,n}kl(e,t),Object.defineProperty(e.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(t){this.tileTransform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(t){this.tileTransform.position.copyFrom(t)},enumerable:!1,configurable:!0}),e.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},e.prototype._render=function(t){var e=this._texture;e&&e.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))},e.prototype._calculateBounds=function(){var t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,i=this._width*(1-this._anchor._x),r=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,i,r)},e.prototype.getLocalBounds=function(e){return 0===this.children.length?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new ke),e=this._localBoundsRect),this._bounds.getRectangle(e)):t.prototype.getLocalBounds.call(this,e)},e.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,Bl);var e=this._width,i=this._height,r=-e*this.anchor._x;if(Bl.x>=r&&Bl.x<r+e){var n=-i*this.anchor._y;if(Bl.y>=n&&Bl.y<n+i)return!0}return!1},e.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this.tileTransform=null,this.uvMatrix=null},e.from=function(t,i){return new e(t instanceof Oi?t:Oi.from(t,i),i.width,i.height)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0})}(hl);var Nl="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",Ul=new Ve,Gl=function(t){function e(e){var i=t.call(this,e)||this;return e.runners.contextChange.add(i),i.quad=new Hi,i.state=Rr.for2d(),i}return kl(e,t),e.prototype.contextChange=function(){var t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Cr.from(Nl,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n    vec4 texSample = texture2D(uSampler, vTextureCoord);\n    gl_FragColor = texSample * uColor;\n}\n",e),this.shader=t.context.webGLVersion>1?Cr.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n    vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n    coord = (uMapCoord * vec3(coord, 1.0)).xy;\n    vec2 unclamped = coord;\n    coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n    vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n    fragmentColor = texSample * uColor;\n}\n",e):Cr.from(Nl,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n    #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n    vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n    coord = (uMapCoord * vec3(coord, 1.0)).xy;\n    vec2 unclamped = coord;\n    coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n    #ifdef GL_EXT_shader_texture_lod\n        vec4 texSample = unclamped == coord\n            ? texture2D(uSampler, coord) \n            : texture2DLodEXT(uSampler, coord, 0);\n    #else\n        vec4 texSample = texture2D(uSampler, coord);\n    #endif\n\n    gl_FragColor = texSample * uColor;\n}\n",e)},e.prototype.render=function(t){var e=this.renderer,i=this.quad,r=i.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);var n=t.uvRespectAnchor?t.anchor.x:0,s=t.uvRespectAnchor?t.anchor.y:0;(r=i.uvs)[0]=r[6]=-n,r[1]=r[3]=-s,r[2]=r[4]=1-n,r[5]=r[7]=1-s,i.invalidate();var o=t._texture,a=o.baseTexture,h=a.alphaMode>0,u=t.tileTransform.localTransform,l=t.uvMatrix,c=a.isPowerOfTwo&&o.frame.width===a.width&&o.frame.height===a.height;c&&(a._glTextures[e.CONTEXT_UID]?c=a.wrapMode!==d.CLAMP:a.wrapMode===d.CLAMP&&(a.wrapMode=d.REPEAT));var f=c?this.simpleShader:this.shader,p=o.width,_=o.height,m=t._width,g=t._height;Ul.set(u.a*p/m,u.b*p/g,u.c*_/m,u.d*_/g,u.tx/m,u.ty/g),Ul.invert(),c?Ul.prepend(l.mapCoord):(f.uniforms.uMapCoord=l.mapCoord.toArray(!0),f.uniforms.uClampFrame=l.uClampFrame,f.uniforms.uClampOffset=l.uClampOffset),f.uniforms.uTransform=Ul.toArray(!0),f.uniforms.uColor=de(t.tint,t.worldAlpha,f.uniforms.uColor,h),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(i),this.state.blendMode=ce(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},e.extension={name:"tilingSprite",type:Qe.RendererPlugin},e}(Qi),Xl=function(t,e){return Xl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Xl(t,e)};function Vl(t,e){function i(){this.constructor=t}Xl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var Hl=function(){function t(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return t.prototype.update=function(t){if(t||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var 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++}},t}(),jl=new Le,Yl=new Ue,zl=function(t){function e(e,i,r,n){void 0===n&&(n=a.TRIANGLES);var s=t.call(this)||this;return s.geometry=e,s.shader=i,s.state=r||Rr.for2d(),s.drawMode=n,s.start=0,s.size=0,s.uvs=null,s.indices=null,s.vertexData=new Float32Array(1),s.vertexDirty=-1,s._transformID=-1,s._roundPixels=X.ROUND_PIXELS,s.batchUvs=null,s}return Vl(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},set:function(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){var i=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===a.TRIANGLES&&i.length<2*e.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)},e.prototype._renderDefault=function(t){var 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)},e.prototype._renderToBatch=function(t){var e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;var r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)},e.prototype.calculateVertices=function(){var t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var r=this.transform.worldTransform,n=r.a,s=r.b,o=r.c,a=r.d,h=r.tx,u=r.ty,l=this.vertexData,c=0;c<l.length/2;c++){var f=e[2*c],d=e[2*c+1];l[2*c]=n*f+o*d+h,l[2*c+1]=s*f+a*d+u}if(this._roundPixels){var p=X.RESOLUTION;for(c=0;c<l.length;++c)l[c]=Math.round((l[c]*p|0)/p)}this.vertexDirty=i}},e.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Hl(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},e.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,jl);for(var e=this.geometry.getBuffer("aVertexPosition").data,i=Yl.points,r=this.geometry.getIndex().data,n=r.length,s=4===this.drawMode?3:1,o=0;o+2<n;o+=s){var a=2*r[o],h=2*r[o+1],u=2*r[o+2];if(i[0]=e[a],i[1]=e[a+1],i[2]=e[h],i[3]=e[h+1],i[4]=e[u],i[5]=e[u+1],Yl.contains(jl.x,jl.y))return!0}return!1},e.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},e.BATCHABLE_SIZE=100,e}(Mn),Wl=function(t){function e(e,i){var r=this,n={uSampler:e,alpha:1,uTextureMatrix:Ve.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(i=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},i)).uniforms&&Object.assign(n,i.uniforms),(r=t.call(this,i.program||Ir.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n    gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),n)||this)._colorDirty=!1,r.uvMatrix=new Dr(e),r.batchable=void 0===i.program,r.pluginName=i.pluginName,r.tint=i.tint,r.alpha=i.alpha,r}return Vl(e,t),Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;de(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(Cr),ql=function(t){function e(e,i,r){var n=t.call(this)||this,s=new ki(e),o=new ki(i,!0),a=new ki(r,!0,!0);return n.addAttribute("aVertexPosition",s,2,!1,l.FLOAT).addAttribute("aTextureCoord",o,2,!1,l.FLOAT).addIndex(a),n._updateId=-1,n}return Vl(e,t),Object.defineProperty(e.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),e}(Xi),Zl=function(t,e){return Zl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Zl(t,e)};var Ql=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},Jl=function(){function t(){}return t.test=function(t){return"string"==typeof t&&0===t.indexOf("info face=")},t.parse=function(t){var e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var r in e){var n=e[r].match(/^[a-z]+/gm)[0],s=e[r].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var a in s){var h=s[a].split("="),u=h[0],l=h[1].replace(/"/gm,""),c=parseFloat(l),f=isNaN(c)?l:c;o[u]=f}i[n].push(o)}var d=new Ql;return i.info.forEach(function(t){return d.info.push({face:t.face,size:parseInt(t.size,10)})}),i.common.forEach(function(t){return d.common.push({lineHeight:parseInt(t.lineHeight,10)})}),i.page.forEach(function(t){return d.page.push({id:parseInt(t.id,10),file:t.file})}),i.char.forEach(function(t){return d.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)})}),i.kerning.forEach(function(t){return d.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)})}),i.distanceField.forEach(function(t){return d.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType})}),d},t}(),Kl=function(){function t(){}return t.test=function(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")},t.parse=function(t){for(var e=new Ql,i=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),s=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),a=t.getElementsByTagName("distanceField"),h=0;h<i.length;h++)e.info.push({face:i[h].getAttribute("face"),size:parseInt(i[h].getAttribute("size"),10)});for(h=0;h<r.length;h++)e.common.push({lineHeight:parseInt(r[h].getAttribute("lineHeight"),10)});for(h=0;h<n.length;h++)e.page.push({id:parseInt(n[h].getAttribute("id"),10)||0,file:n[h].getAttribute("file")});for(h=0;h<s.length;h++){var u=s[h];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(h=0;h<o.length;h++)e.kerning.push({first:parseInt(o[h].getAttribute("first"),10),second:parseInt(o[h].getAttribute("second"),10),amount:parseInt(o[h].getAttribute("amount"),10)});for(h=0;h<a.length;h++)e.distanceField.push({fieldType:a[h].getAttribute("fieldType"),distanceRange:parseInt(a[h].getAttribute("distanceRange"),10)});return e},t}(),tc=function(){function t(){}return t.test=function(t){if("string"==typeof t&&t.indexOf("<font>")>-1){var e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return Kl.test(e)}return!1},t.parse=function(t){var e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return Kl.parse(e)},t}(),ec=[Jl,Kl,tc];function ic(t){for(var e=0;e<ec.length;e++)if(ec[e].test(t))return ec[e];return null}function rc(t,e,i,r,n,s,o){var a=i.text,h=i.fontProperties;e.translate(r,n),e.scale(s,s);var u=o.strokeThickness/2,l=-o.strokeThickness/2;if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=function(t,e,i,r,n,s){var o,a=i.fill;if(!Array.isArray(a))return a;if(1===a.length)return a[0];var h=i.dropShadow?i.dropShadowDistance:0,u=i.padding||0,l=t.width/r-h-2*u,c=t.height/r-h-2*u,f=a.slice(),d=i.fillGradientStops.slice();if(!d.length)for(var p=f.length+1,_=1;_<p;++_)d.push(_/p);if(f.unshift(a[0]),d.unshift(0),f.push(a[a.length-1]),d.push(1),i.fillGradientType===sl.LINEAR_VERTICAL){o=e.createLinearGradient(l/2,u,l/2,c+u);var m=0,g=(s.fontProperties.fontSize+i.strokeThickness)/c;for(_=0;_<n.length;_++)for(var v=s.lineHeight*_,y=0;y<f.length;y++){var b=v/c+("number"==typeof d[y]?d[y]:y/f.length)*g,x=Math.max(m,b);x=Math.min(x,1),o.addColorStop(x,f[y]),m=x}}else{o=e.createLinearGradient(u,c/2,l+u,c/2);var T=f.length+1,A=1;for(_=0;_<f.length;_++){var E=void 0;E="number"==typeof d[_]?d[_]:A/T,o.addColorStop(E,f[_]),A++}}return o}(t,e,o,s,[a],i),e.strokeStyle=o.stroke,o.dropShadow){var c=o.dropShadowColor,f=ae("number"==typeof c?c:ue(c)),d=o.dropShadowBlur*s,p=o.dropShadowDistance*s;e.shadowColor="rgba("+255*f[0]+","+255*f[1]+","+255*f[2]+","+o.dropShadowAlpha+")",e.shadowBlur=d,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*p,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*p}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(a,u,l+i.lineHeight-h.descent),o.fill&&e.fillText(a,u,l+i.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function nc(t){return Array.from?Array.from(t):t.split("")}function sc(t){return t.codePointAt?t.codePointAt(0):t.charCodeAt(0)}var oc=function(){function t(t,e,i){var r,n,s=t.info[0],o=t.common[0],a=t.page[0],h=t.distanceField[0],u=Ce(a.file),l={};this._ownsTextures=i,this.font=s.face,this.size=s.size,this.lineHeight=o.lineHeight/u,this.chars={},this.pageTextures=l;for(var c=0;c<t.page.length;c++){var f=t.page[c],d=f.id,m=f.file;l[d]=e instanceof Array?e[c]:e[m],(null==h?void 0:h.fieldType)&&"none"!==h.fieldType&&(l[d].baseTexture.alphaMode=_.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=p.OFF)}for(c=0;c<t.char.length;c++){var g=t.char[c],v=(d=g.id,g.page),y=t.char[c],b=y.x,x=y.y,T=y.width,A=y.height,E=y.xoffset,w=y.yoffset,S=y.xadvance;x/=u,T/=u,A/=u,E/=u,w/=u,S/=u;var P=new ke((b/=u)+l[v].frame.x/u,x+l[v].frame.y/u,T,A);this.chars[d]={xOffset:E,yOffset:w,xAdvance:S,kerning:{},texture:new Oi(l[v].baseTexture,P),page:v}}for(c=0;c<t.kerning.length;c++){var M=t.kerning[c],I=M.first,C=M.second,R=M.amount;I/=u,C/=u,R/=u,this.chars[C]&&(this.chars[C].kerning[I]=R)}this.distanceFieldRange=null==h?void 0:h.distanceRange,this.distanceFieldType=null!==(n=null===(r=null==h?void 0:h.fieldType)||void 0===r?void 0:r.toLowerCase())&&void 0!==n?n:"none"}return t.prototype.destroy=function(){for(var t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(var t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null},t.install=function(e,i,r){var n;if(e instanceof Ql)n=e;else{var s=ic(e);if(!s)throw new Error("Unrecognized data format for font.");n=s.parse(e)}i instanceof Oi&&(i=[i]);var o=new t(n,i,r);return t.available[o.font]=o,o},t.uninstall=function(e){var i=t.available[e];if(!i)throw new Error("No font found named '"+e+"'");i.destroy(),delete t.available[e]},t.from=function(e,i,r){if(!e)throw new Error("[BitmapFont] Property `name` is required.");var n=Object.assign({},t.defaultOptions,r),s=n.chars,o=n.padding,a=n.resolution,h=n.textureWidth,u=n.textureHeight,l=function(t){"string"==typeof t&&(t=[t]);for(var e=[],i=0,r=t.length;i<r;i++){var n=t[i];if(Array.isArray(n)){if(2!==n.length)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+n.length+".");var s=n[0].charCodeAt(0),o=n[1].charCodeAt(0);if(o<s)throw new Error("[BitmapFont]: Invalid character range.");for(var a=s,h=o;a<=h;a++)e.push(String.fromCharCode(a))}else e.push.apply(e,nc(n))}if(0===e.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}(s),c=i instanceof fl?i:new fl(i),f=h,d=new Ql;d.info[0]={face:c.fontFamily,size:c.fontSize},d.common[0]={lineHeight:c.fontSize};for(var p,_,m,g=0,v=0,y=0,b=[],x=0;x<l.length;x++){p||((p=X.ADAPTER.createCanvas()).width=h,p.height=u,_=p.getContext("2d"),m=new mi(p,{resolution:a}),b.push(new Oi(m)),d.page.push({id:b.length-1,file:""}));var T=l[x],A=gl.measureText(T,c,!1,p),E=A.width,w=Math.ceil(A.height),S=Math.ceil(("italic"===c.fontStyle?2:1)*E);if(v>=u-w*a){if(0===v)throw new Error("[BitmapFont] textureHeight "+u+"px is too small (fontFamily: '"+c.fontFamily+"', fontSize: "+c.fontSize+"px, char: '"+T+"')");--x,p=null,_=null,m=null,v=0,g=0,y=0}else if(y=Math.max(w+A.fontProperties.descent,y),S*a+g>=f){if(0===g)throw new Error("[BitmapFont] textureWidth "+h+"px is too small (fontFamily: '"+c.fontFamily+"', fontSize: "+c.fontSize+"px, char: '"+T+"')");--x,v+=y*a,v=Math.ceil(v),g=0,y=0}else{rc(p,_,A,g,v,a,c);var P=sc(A.text);d.char.push({id:P,page:b.length-1,x:g/a,y:v/a,width:S,height:w,xoffset:0,yoffset:0,xadvance:Math.ceil(E-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0))}),g+=(S+2*o)*a,g=Math.ceil(g)}}if(!(null==r?void 0:r.skipKerning)){x=0;for(var M=l.length;x<M;x++)for(var I=l[x],C=0;C<M;C++){var R=l[C],O=_.measureText(I).width,$=_.measureText(R).width,D=_.measureText(I+R).width-(O+$);D&&d.kerning.push({first:sc(I),second:sc(R),amount:D})}}var L=new t(d,b,!0);return void 0!==t.available[e]&&t.uninstall(e),t.available[e]=L,L},t.ALPHA=[["a","z"],["A","Z"]," "],t.NUMERIC=[["0","9"]],t.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],t.ASCII=[[" ","~"]],t.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:t.ALPHANUMERIC},t.available={},t}(),ac=[],hc=[],uc=[];!function(t){function e(i,r){void 0===r&&(r={});var n=t.call(this)||this;n._tint=16777215;var s=Object.assign({},e.styleDefaults,r),o=s.align,a=s.tint,h=s.maxWidth,u=s.letterSpacing,l=s.fontName,c=s.fontSize;if(!oc.available[l])throw new Error('Missing BitmapFont "'+l+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=o,n._tint=a,n._font=void 0,n._fontName=l,n._fontSize=c,n.text=i,n._maxWidth=h,n._maxLineHeight=0,n._letterSpacing=u,n._anchor=new Xe(function(){n.dirty=!0},n,0,0),n._roundPixels=X.ROUND_PIXELS,n.dirty=!0,n._resolution=X.RESOLUTION,n._autoResolution=!0,n._textureCache={},n}(function(t,e){function i(){this.constructor=t}Zl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(e,t),e.prototype.updateText=function(){for(var t,e=oc.available[this._fontName],i=this.fontSize,r=i/e.size,n=new Le,s=[],a=[],h=[],u=nc(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),l=this._maxWidth*e.size/i,c="none"===e.distanceFieldType?ac:hc,f=null,d=0,p=0,_=0,m=-1,g=0,v=0,y=0,b=0,x=0;x<u.length;x++){var T=sc(X=u[x]);if(/(?:\s)/.test(X)&&(m=x,g=d,b++),"\r"!==X&&"\n"!==X){var A=e.chars[T];if(A){f&&A.kerning[f]&&(n.x+=A.kerning[f]);var E=uc.pop()||{texture:Oi.EMPTY,line:0,charCode:0,prevSpaces:0,position:new Le};E.texture=A.texture,E.line=_,E.charCode=T,E.position.x=n.x+A.xOffset+this._letterSpacing/2,E.position.y=n.y+A.yOffset,E.prevSpaces=b,s.push(E),d=E.position.x+Math.max(A.xAdvance-A.xOffset,A.texture.orig.width),n.x+=A.xAdvance+this._letterSpacing,y=Math.max(y,A.yOffset+A.texture.height),f=T,-1!==m&&l>0&&n.x>l&&(ve(s,1+m-++v,1+x-m),x=m,m=-1,a.push(g),h.push(s.length>0?s[s.length-1].prevSpaces:0),p=Math.max(p,g),_++,n.x=0,n.y+=e.lineHeight,f=null,b=0)}}else a.push(d),h.push(-1),p=Math.max(p,d),++_,++v,n.x=0,n.y+=e.lineHeight,f=null,b=0}var w=u[u.length-1];"\r"!==w&&"\n"!==w&&(/(?:\s)/.test(w)&&(d=g),a.push(d),p=Math.max(p,d),h.push(-1));var S=[];for(x=0;x<=_;x++){var P=0;"right"===this._align?P=p-a[x]:"center"===this._align?P=(p-a[x])/2:"justify"===this._align&&(P=h[x]<0?0:(p-a[x])/h[x]),S.push(P)}var M=s.length,I={},C=[],R=this._activePagesMeshData;c.push.apply(c,R);for(x=0;x<M;x++){var O=(H=s[x].texture).baseTexture.uid;if(!I[O]){if(!(Q=c.pop())){var $=new ql,D=void 0,L=void 0;"none"===e.distanceFieldType?(D=new Wl(Oi.EMPTY),L=o.NORMAL):(D=new Wl(Oi.EMPTY,{program:Ir.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n    vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n  // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n  vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n  // MSDF\r\n  float median = texColor.r + texColor.g + texColor.b -\r\n                  min(texColor.r, min(texColor.g, texColor.b)) -\r\n                  max(texColor.r, max(texColor.g, texColor.b));\r\n  // SDF\r\n  median = min(median, texColor.a);\r\n\r\n  float screenPxDistance = uFWidth * (median - 0.5);\r\n  float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n  if (median < 0.01) {\r\n    alpha = 0.0;\r\n  } else if (median > 0.99) {\r\n    alpha = 1.0;\r\n  }\r\n\r\n  // NPM Textures, NPM outputs\r\n  gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),L=o.NORMAL_NPM);var F=new zl($,D);F.blendMode=L,Q={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:F,vertices:null,uvs:null,indices:null}}Q.index=0,Q.indexCount=0,Q.vertexCount=0,Q.uvsCount=0,Q.total=0;var k=this._textureCache;k[O]=k[O]||new Oi(H.baseTexture),Q.mesh.texture=k[O],Q.mesh.tint=this._tint,C.push(Q),I[O]=Q}I[O].total++}for(x=0;x<R.length;x++)-1===C.indexOf(R[x])&&this.removeChild(R[x].mesh);for(x=0;x<C.length;x++)C[x].mesh.parent!==this&&this.addChild(C[x].mesh);for(var x in this._activePagesMeshData=C,I){var B=(Q=I[x]).total;if(!((null===(t=Q.indices)||void 0===t?void 0:t.length)>6*B)||Q.vertices.length<2*zl.BATCHABLE_SIZE)Q.vertices=new Float32Array(8*B),Q.uvs=new Float32Array(8*B),Q.indices=new Uint16Array(6*B);else for(var N=Q.total,U=Q.vertices,G=4*N*2;G<U.length;G++)U[G]=0;Q.mesh.size=6*B}for(x=0;x<M;x++){var X,V=(X=s[x]).position.x+S[X.line]*("justify"===this._align?X.prevSpaces:1);this._roundPixels&&(V=Math.round(V));var H,j=V*r,Y=X.position.y*r,z=I[(H=X.texture).baseTexture.uid],W=H.frame,q=H._uvs,Z=z.index++;z.indices[6*Z+0]=0+4*Z,z.indices[6*Z+1]=1+4*Z,z.indices[6*Z+2]=2+4*Z,z.indices[6*Z+3]=0+4*Z,z.indices[6*Z+4]=2+4*Z,z.indices[6*Z+5]=3+4*Z,z.vertices[8*Z+0]=j,z.vertices[8*Z+1]=Y,z.vertices[8*Z+2]=j+W.width*r,z.vertices[8*Z+3]=Y,z.vertices[8*Z+4]=j+W.width*r,z.vertices[8*Z+5]=Y+W.height*r,z.vertices[8*Z+6]=j,z.vertices[8*Z+7]=Y+W.height*r,z.uvs[8*Z+0]=q.x0,z.uvs[8*Z+1]=q.y0,z.uvs[8*Z+2]=q.x1,z.uvs[8*Z+3]=q.y1,z.uvs[8*Z+4]=q.x2,z.uvs[8*Z+5]=q.y2,z.uvs[8*Z+6]=q.x3,z.uvs[8*Z+7]=q.y3}for(var x in this._textWidth=p*r,this._textHeight=(n.y+e.lineHeight)*r,I){var Q=I[x];if(0!==this.anchor.x||0!==this.anchor.y)for(var J=0,K=this._textWidth*this.anchor.x,tt=this._textHeight*this.anchor.y,et=0;et<Q.total;et++)Q.vertices[J++]-=K,Q.vertices[J++]-=tt,Q.vertices[J++]-=K,Q.vertices[J++]-=tt,Q.vertices[J++]-=K,Q.vertices[J++]-=tt,Q.vertices[J++]-=K,Q.vertices[J++]-=tt;this._maxLineHeight=y*r;var it=Q.mesh.geometry.getBuffer("aVertexPosition"),rt=Q.mesh.geometry.getBuffer("aTextureCoord"),nt=Q.mesh.geometry.getIndex();it.data=Q.vertices,rt.data=Q.uvs,nt.data=Q.indices,it.update(),rt.update(),nt.update()}for(x=0;x<s.length;x++)uc.push(s[x]);this._font=e,this.dirty=!1},e.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},e.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);var i=oc.available[this._fontName],r=i.distanceFieldRange,n=i.distanceFieldType,s=i.size;if("none"!==n)for(var o=this.worldTransform,a=o.a,h=o.b,u=o.c,l=o.d,c=Math.sqrt(a*a+h*h),f=Math.sqrt(u*u+l*l),d=(Math.abs(c)+Math.abs(f))/2,p=this.fontSize/s,_=0,m=this._activePagesMeshData;_<m.length;_++){m[_].mesh.shader.uniforms.uFWidth=d*r*p*this._resolution}t.prototype._render.call(this,e)},e.prototype.getLocalBounds=function(){return this.validate(),t.prototype.getLocalBounds.call(this)},e.prototype.validate=function(){var t=oc.available[this._fontName];if(!t)throw new Error('Missing BitmapFont "'+this._fontName+'"');this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()},Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){if(this._tint!==t){this._tint=t;for(var e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontName",{get:function(){return this._fontName},set:function(t){if(!oc.available[t])throw new Error('Missing BitmapFont "'+t+'"');this._fontName!==t&&(this._fontName=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){var t;return null!==(t=this._fontSize)&&void 0!==t?t:oc.available[this._fontName].size},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.prototype.destroy=function(e){var i=this._textureCache,r="none"===oc.available[this._fontName].distanceFieldType?ac:hc;r.push.apply(r,this._activePagesMeshData);for(var n=0,s=this._activePagesMeshData;n<s.length;n++){var o=s[n];this.removeChild(o.mesh)}for(var a in this._activePagesMeshData=[],r.filter(function(t){return i[t.mesh.texture.baseTexture.uid]}).forEach(function(t){t.mesh.texture=Oi.EMPTY}),i){i[a].destroy(),delete i[a]}this._font=null,this._textureCache=null,t.prototype.destroy.call(this,e)},e.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0}}(Mn);var lc=function(){function t(){}return t.add=function(){vh.setExtensionXhrType("fnt",vh.XHR_RESPONSE_TYPE.TEXT)},t.use=function(e,i){var r=ic(e.data);if(r)for(var n=t.getBaseUrl(this,e),s=r.parse(e.data),o={},a=function(t){o[t.metadata.pageFile]=t.texture,Object.keys(o).length===s.page.length&&(e.bitmapFont=oc.install(s,o,!0),i())},h=0;h<s.page.length;++h){var u=s.page[h].file,l=n+u,c=!1;for(var f in this.resources){var d=this.resources[f];if(d.url===l){d.metadata.pageFile=u,d.texture?a(d):d.onAfterMiddleware.add(a),c=!0;break}}if(!c){var p={crossOrigin:e.crossOrigin,loadType:vh.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},e.metadata.imageMetadata),parentResource:e};this.add(l,p,a)}}else i()},t.getBaseUrl=function(e,i){var r=i.isDataUrl?"":t.dirname(i.url);return i.isDataUrl&&("."===r&&(r=""),e.baseUrl&&r&&"/"===e.baseUrl.charAt(e.baseUrl.length-1)&&(r+="/")),(r=r.replace(e.baseUrl,""))&&"/"!==r.charAt(r.length-1)&&(r+="/"),r},t.dirname=function(t){var e=t.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return e===t?".":""===e?"/":e},t.extension=Qe.Loader,t}(),cc=function(t,e){return cc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},cc(t,e)};
/*!
   * @pixi/filter-alpha - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/filter-alpha is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */!function(t){function e(e){void 0===e&&(e=1);var i=t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n   gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",{uAlpha:1})||this;return i.alpha=e,i}(function(t,e){function i(){this.constructor=t}cc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(e,t),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0})}(Or);
/*!
   * @pixi/filter-blur - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/filter-blur is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
var fc=function(t,e){return fc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},fc(t,e)};function dc(t,e){function i(){this.constructor=t}fc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var pc={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},_c=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{","    gl_FragColor = vec4(0.0);","    %blur%","}"].join("\n");var mc=function(t){function e(e,i,r,n,s){void 0===i&&(i=8),void 0===r&&(r=4),void 0===n&&(n=X.FILTER_RESOLUTION),void 0===s&&(s=5);var o=this,a=function(t,e){var i,r=Math.ceil(t/2),n="\n    attribute vec2 aVertexPosition;\n\n    uniform mat3 projectionMatrix;\n\n    uniform float strength;\n\n    varying vec2 vBlurTexCoords[%size%];\n\n    uniform vec4 inputSize;\n    uniform vec4 outputFrame;\n\n    vec4 filterVertexPosition( void )\n    {\n        vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n        return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n    }\n\n    vec2 filterTextureCoord( void )\n    {\n        return aVertexPosition * (outputFrame.zw * inputSize.zw);\n    }\n\n    void main(void)\n    {\n        gl_Position = filterVertexPosition();\n\n        vec2 textureCoord = filterTextureCoord();\n        %blur%\n    }",s="";i=e?"vBlurTexCoords[%index%] =  textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] =  textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var o=0;o<t;o++){var a=i.replace("%index%",o.toString());s+=a=a.replace("%sampleIndex%",o-(r-1)+".0"),s+="\n"}return(n=n.replace("%blur%",s)).replace("%size%",t.toString())}(s,e),h=function(t){for(var e,i=pc[t],r=i.length,n=_c,s="",o=0;o<t;o++){var a="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",o.toString());e=o,o>=r&&(e=t-o-1),s+=a=a.replace("%value%",i[e].toString()),s+="\n"}return(n=n.replace("%blur%",s)).replace("%size%",t.toString())}(s);return(o=t.call(this,a,h)||this).horizontal=e,o.resolution=n,o._quality=0,o.quality=r,o.blur=i,o}return dc(e,t),e.prototype.apply=function(t,e,i,r){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/e.width):this.uniforms.strength=1/i.height*(i.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,i,r);else{var n=t.getFilterTexture(),s=t.renderer,o=e,a=n;this.state.blend=!1,t.applyFilter(this,o,a,g.CLEAR);for(var h=1;h<this.passes-1;h++){t.bindAndClear(o,g.BLIT),this.uniforms.uSampler=a;var u=a;a=o,o=u,s.shader.bind(this),s.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,a,i,r),t.returnFilterTexture(n)}},Object.defineProperty(e.prototype,"blur",{get:function(){return this.strength},set:function(t){this.padding=1+2*Math.abs(t),this.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=t,this.passes=t},enumerable:!1,configurable:!0}),e}(Or);!function(t){function e(e,i,r,n){void 0===e&&(e=8),void 0===i&&(i=4),void 0===r&&(r=X.FILTER_RESOLUTION),void 0===n&&(n=5);var s=t.call(this)||this;return s.blurXFilter=new mc(!0,e,i,r,n),s.blurYFilter=new mc(!1,e,i,r,n),s.resolution=r,s.quality=i,s.blur=e,s.repeatEdgePixels=!1,s}dc(e,t),e.prototype.apply=function(t,e,i,r){var n=Math.abs(this.blurXFilter.strength),s=Math.abs(this.blurYFilter.strength);if(n&&s){var o=t.getFilterTexture();this.blurXFilter.apply(t,e,o,g.CLEAR),this.blurYFilter.apply(t,o,i,r),t.returnFilterTexture(o)}else s?this.blurYFilter.apply(t,e,i,r):this.blurXFilter.apply(t,e,i,r)},e.prototype.updatePadding=function(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))},Object.defineProperty(e.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(t){this.blurXFilter.quality=this.blurYFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(t){this.blurYFilter.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"repeatEdgePixels",{get:function(){return this._repeatEdgePixels},set:function(t){this._repeatEdgePixels=t,this.updatePadding()},enumerable:!1,configurable:!0})}(Or);
/*!
   * @pixi/filter-color-matrix - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/filter-color-matrix is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
var gc=function(t,e){return gc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},gc(t,e)};var vc=function(t){function e(){var e=this,i={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return(e=t.call(this,cn,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n    vec4 c = texture2D(uSampler, vTextureCoord);\n\n    if (uAlpha == 0.0) {\n        gl_FragColor = c;\n        return;\n    }\n\n    // Un-premultiply alpha before applying the color matrix. See issue #3539.\n    if (c.a > 0.0) {\n      c.rgb /= c.a;\n    }\n\n    vec4 result;\n\n    result.r = (m[0] * c.r);\n        result.r += (m[1] * c.g);\n        result.r += (m[2] * c.b);\n        result.r += (m[3] * c.a);\n        result.r += m[4];\n\n    result.g = (m[5] * c.r);\n        result.g += (m[6] * c.g);\n        result.g += (m[7] * c.b);\n        result.g += (m[8] * c.a);\n        result.g += m[9];\n\n    result.b = (m[10] * c.r);\n       result.b += (m[11] * c.g);\n       result.b += (m[12] * c.b);\n       result.b += (m[13] * c.a);\n       result.b += m[14];\n\n    result.a = (m[15] * c.r);\n       result.a += (m[16] * c.g);\n       result.a += (m[17] * c.b);\n       result.a += (m[18] * c.a);\n       result.a += m[19];\n\n    vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n    // Premultiply alpha again.\n    rgb *= result.a;\n\n    gl_FragColor = vec4(rgb, result.a);\n}\n",i)||this).alpha=1,e}return function(t,e){function i(){this.constructor=t}gc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),e.prototype._loadMatrix=function(t,e){void 0===e&&(e=!1);var i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i},e.prototype._multiply=function(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t},e.prototype._colorMatrix=function(t){var e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e},e.prototype.brightness=function(t,e){var i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.tint=function(t,e){var i=[(t>>16&255)/255,0,0,0,0,0,(t>>8&255)/255,0,0,0,0,0,(255&t)/255,0,0,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.greyscale=function(t,e){var i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.blackAndWhite=function(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)},e.prototype.hue=function(t,e){t=(t||0)/180*Math.PI;var i=Math.cos(t),r=Math.sin(t),n=1/3,s=(0,Math.sqrt)(n),o=[i+(1-i)*n,n*(1-i)-s*r,n*(1-i)+s*r,0,0,n*(1-i)+s*r,i+n*(1-i),n*(1-i)-s*r,0,0,n*(1-i)-s*r,n*(1-i)+s*r,i+n*(1-i),0,0,0,0,0,1,0];this._loadMatrix(o,e)},e.prototype.contrast=function(t,e){var i=(t||0)+1,r=-.5*(i-1),n=[i,0,0,0,r,0,i,0,0,r,0,0,i,0,r,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.saturate=function(t,e){void 0===t&&(t=0);var i=2*t/3+1,r=-.5*(i-1),n=[i,r,r,0,0,r,i,r,0,0,r,r,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)},e.prototype.sepia=function(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)},e.prototype.technicolor=function(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)},e.prototype.polaroid=function(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)},e.prototype.toBGR=function(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)},e.prototype.kodachrome=function(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)},e.prototype.browni=function(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)},e.prototype.vintage=function(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)},e.prototype.colorTone=function(t,e,i,r,n){var s=((i=i||16770432)>>16&255)/255,o=(i>>8&255)/255,a=(255&i)/255,h=((r=r||3375104)>>16&255)/255,u=(r>>8&255)/255,l=(255&r)/255,c=[.3,.59,.11,0,0,s,o,a,t=t||.2,0,h,u,l,e=e||.15,0,s-h,o-u,a-l,0,0];this._loadMatrix(c,n)},e.prototype.night=function(t,e){var i=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.predator=function(t,e){var i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)},e.prototype.lsd=function(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)},e.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(Or);vc.prototype.grayscale=vc.prototype.greyscale;
/*!
   * @pixi/filter-displacement - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/filter-displacement is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
var yc=function(t,e){return yc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},yc(t,e)};!function(t){function e(e,i){var r=this,n=new Ve;return e.renderable=!1,(r=t.call(this,"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0)  ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n  vec4 map =  texture2D(mapSampler, vFilterCoord);\n\n  map -= 0.5;\n  map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n  gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:e._texture,filterMatrix:n,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=e,r.maskMatrix=n,null==i&&(i=20),r.scale=new Le(i,i),r}(function(t,e){function i(){this.constructor=t}yc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(e,t),e.prototype.apply=function(t,e,i,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var n=this.maskSprite.worldTransform,s=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);0!==s&&0!==o&&(this.uniforms.rotation[0]=n.a/s,this.uniforms.rotation[1]=n.b/s,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,i,r)},Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(t){this.uniforms.mapSampler=t},enumerable:!1,configurable:!0})}(Or);
/*!
   * @pixi/filter-fxaa - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/filter-fxaa is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
var bc=function(t,e){return bc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},bc(t,e)};!function(t){function e(){return t.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n               out vec2 v_rgbNW, out vec2 v_rgbNE,\n               out vec2 v_rgbSW, out vec2 v_rgbSE,\n               out vec2 v_rgbM) {\n    v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n    v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n    v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n    v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n    v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n   gl_Position = filterVertexPosition();\n\n   vFragCoord = aVertexPosition * outputFrame.zw;\n\n   texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN   (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL   (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX     8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n          vec2 v_rgbNW, vec2 v_rgbNE,\n          vec2 v_rgbSW, vec2 v_rgbSE,\n          vec2 v_rgbM) {\n    vec4 color;\n    vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n    vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n    vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n    vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n    vec4 texColor = texture2D(tex, v_rgbM);\n    vec3 rgbM  = texColor.xyz;\n    vec3 luma = vec3(0.299, 0.587, 0.114);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n    mediump vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n                          (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n    float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n              max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n                  dir * rcpDirMin)) * inverseVP;\n\n    vec3 rgbA = 0.5 * (\n                       texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n                       texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n    vec3 rgbB = rgbA * 0.5 + 0.25 * (\n                                     texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n                                     texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n    float lumaB = dot(rgbB, luma);\n    if ((lumaB < lumaMin) || (lumaB > lumaMax))\n        color = vec4(rgbA, texColor.a);\n    else\n        color = vec4(rgbB, texColor.a);\n    return color;\n}\n\nvoid main() {\n\n      vec4 color;\n\n      color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n      gl_FragColor = color;\n}\n')||this}(function(t,e){function i(){this.constructor=t}bc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(e,t)}(Or);
/*!
   * @pixi/filter-noise - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/filter-noise is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
var xc=function(t,e){return xc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},xc(t,e)};!function(t){function e(e,i){void 0===e&&(e=.5),void 0===i&&(i=Math.random());var r=t.call(this,cn,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n    vec4 color = texture2D(uSampler, vTextureCoord);\n    float randomValue = rand(gl_FragCoord.xy * uSeed);\n    float diff = (randomValue - 0.5) * uNoise;\n\n    // Un-premultiply alpha before applying the color matrix. See issue #3539.\n    if (color.a > 0.0) {\n        color.rgb /= color.a;\n    }\n\n    color.r += diff;\n    color.g += diff;\n    color.b += diff;\n\n    // Premultiply alpha again.\n    color.rgb *= color.a;\n\n    gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return r.noise=e,r.seed=i,r}(function(t,e){function i(){this.constructor=t}xc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(e,t),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0})}(Or);
/*!
   * @pixi/mixin-cache-as-bitmap - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
var Tc=new Ve;wn.prototype._cacheAsBitmap=!1,wn.prototype._cacheData=null,wn.prototype._cacheAsBitmapResolution=null,wn.prototype._cacheAsBitmapMultisample=T.NONE;var Ac=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null};Object.defineProperties(wn.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var e;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new Ac),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea))}}}),wn.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},wn.prototype._initCachedDisplayObject=function(t){var e;if(!this._cacheData||!this._cacheData.sprite){var i=this.alpha;this.alpha=1,t.batch.flush();var r=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var n=this.filters[0].padding;r.pad(n)}r.ceil(X.RESOLUTION);var s=t.renderTexture.current,o=t.renderTexture.sourceFrame.clone(),a=t.renderTexture.destinationFrame.clone(),h=t.projection.transform,u=$i.create({width:r.width,height:r.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:null!==(e=this.cacheAsBitmapMultisample)&&void 0!==e?e:t.multisample}),l="cacheAsBitmap_"+xe();this._cacheData.textureCacheId=l,mi.addToCache(u.baseTexture,l),Oi.addToCache(u,l);var c=this.transform.localTransform.copyTo(Tc).invert().translate(-r.x,-r.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:u,clear:!0,transform:c,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=h,t.renderTexture.bind(s,o,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var f=new hl(u);f.transform.worldTransform=this.transform.worldTransform,f.anchor.x=-r.x/r.width,f.anchor.y=-r.y/r.height,f.alpha=i,f._bounds=this._bounds,this._cacheData.sprite=f,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=f.containsPoint.bind(f)}},wn.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},wn.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var e=this.getLocalBounds(null,!0),i=this.alpha;this.alpha=1;var r=t.context,n=t._projTransform;e.ceil(X.RESOLUTION);var s=$i.create({width:e.width,height:e.height}),o="cacheAsBitmap_"+xe();this._cacheData.textureCacheId=o,mi.addToCache(s.baseTexture,o),Oi.addToCache(s,o);var a=Tc;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=e.x,a.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:s,clear:!0,transform:a,skipUpdateTransform:!1}),t.context=r,t._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var h=new hl(s);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-e.x/e.width,h.anchor.y=-e.y/e.height,h.alpha=i,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)}},wn.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},wn.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},wn.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,mi.removeFromCache(this._cacheData.textureCacheId),Oi.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},wn.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},
/*!
   * @pixi/mixin-get-child-by-name - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/mixin-get-child-by-name is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
wn.prototype.name=null,Mn.prototype.getChildByName=function(t,e){for(var i=0,r=this.children.length;i<r;i++)if(this.children[i].name===t)return this.children[i];if(e)for(i=0,r=this.children.length;i<r;i++){var n=this.children[i];if(n.getChildByName){var s=n.getChildByName(t,!0);if(s)return s}}return null},
/*!
   * @pixi/mixin-get-global-position - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/mixin-get-global-position is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
wn.prototype.getGlobalPosition=function(t,e){return void 0===t&&(t=new Le),void 0===e&&(e=!1),this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};
/*!
   * @pixi/app - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/app is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
var Ec=function(){function t(){}return t.init=function(t){var e=this;Object.defineProperty(this,"resizeTo",{set:function(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){e._resizeTo&&(e.cancelResize(),e._resizeId=requestAnimationFrame(function(){return e.resize()}))},this.cancelResize=function(){e._resizeId&&(cancelAnimationFrame(e._resizeId),e._resizeId=null)},this.resize=function(){if(e._resizeTo){var t,i;if(e.cancelResize(),e._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{var r=e._resizeTo;t=r.clientWidth,i=r.clientHeight}e.renderer.resize(t,i)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},t.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},t.extension=Qe.Application,t}(),wc=function(){function t(e){var i=this;this.stage=new Mn,e=Object.assign({forceCanvas:!1},e),this.renderer=function(t){return ln.create(t)}(e),t._plugins.forEach(function(t){t.init.call(i,e)})}return t.registerPlugin=function(t){Ae("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),ri.add({type:Qe.Application,ref:t})},t.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(t.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),t.prototype.destroy=function(e,i){var r=this,n=t._plugins.slice(0);n.reverse(),n.forEach(function(t){t.destroy.call(r)}),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null},t._plugins=[],t}();ri.handleByList(Qe.Application,wc._plugins),ri.add(Ec);
/*!
   * @pixi/mesh-extras - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/mesh-extras is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
var Sc=function(t,e){return Sc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Sc(t,e)};function Pc(t,e){function i(){this.constructor=t}Sc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var Mc=function(t){function e(e,i,r,n){void 0===e&&(e=100),void 0===i&&(i=100),void 0===r&&(r=10),void 0===n&&(n=10);var s=t.call(this)||this;return s.segWidth=r,s.segHeight=n,s.width=e,s.height=i,s.build(),s}return Pc(e,t),e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],i=[],r=[],n=this.segWidth-1,s=this.segHeight-1,o=this.width/n,a=this.height/s,h=0;h<t;h++){var u=h%this.segWidth,l=h/this.segWidth|0;e.push(u*o,l*a),i.push(u/n,l/s)}var c=n*s;for(h=0;h<c;h++){var f=h%n,d=h/n|0,p=d*this.segWidth+f,_=d*this.segWidth+f+1,m=(d+1)*this.segWidth+f,g=(d+1)*this.segWidth+f+1;r.push(p,_,m,_,g,m)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(ql),Ic=function(t){function e(e,i,r){void 0===e&&(e=200),void 0===r&&(r=0);var n=t.call(this,new Float32Array(4*i.length),new Float32Array(4*i.length),new Uint16Array(6*(i.length-1)))||this;return n.points=i,n._width=e,n.textureScale=r,n.build(),n}return Pc(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array(6*(t.length-1)));var n=i.data,s=r.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;for(var o=0,a=t[0],h=this._width*this.textureScale,u=t.length,l=0;l<u;l++){var c=4*l;if(this.textureScale>0){var f=a.x-t[l].x,d=a.y-t[l].y,p=Math.sqrt(f*f+d*d);a=t[l],o+=p/h}else o=l/(u-1);n[c]=o,n[c+1]=0,n[c+2]=o,n[c+3]=1}var _=0;for(l=0;l<u-1;l++){c=2*l;s[_++]=c,s[_++]=c+1,s[_++]=c+2,s[_++]=c+2,s[_++]=c+1,s[_++]=c+3}i.update(),r.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var e,i=t[0],r=0,n=0,s=this.buffers[0].data,o=t.length,a=0;a<o;a++){var h=t[a],u=4*a;n=-((e=a<t.length-1?t[a+1]:h).x-i.x),r=e.y-i.y;var l=Math.sqrt(r*r+n*n),c=this.textureScale>0?this.textureScale*this._width/2:this._width/2;r/=l,n/=l,r*=c,n*=c,s[u]=h.x+r,s[u+1]=h.y+n,s[u+2]=h.x-r,s[u+3]=h.y-n,i=h}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(ql);!function(t){function e(e,i,r){void 0===r&&(r=0);var n=this,s=new Ic(e.height,i,r),o=new Wl(e);return r>0&&(e.baseTexture.wrapMode=d.REPEAT),(n=t.call(this,s,o)||this).autoUpdate=!0,n}Pc(e,t),e.prototype._render=function(e){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),t.prototype._render.call(this,e)}}(zl);var Cc=function(t){function e(e,i,r){var n=this,s=new Mc(e.width,e.height,i,r),o=new Wl(Oi.WHITE);return(n=t.call(this,s,o)||this).texture=e,n.autoResize=!0,n}return Pc(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,e=this.shader.texture,i=e.width,r=e.height;!this.autoResize||t.width===i&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},e.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},e}(zl);!function(t){function e(e,i,r,n,s){void 0===e&&(e=Oi.EMPTY);var o=this,a=new ql(i,r,n);a.getBuffer("aVertexPosition").static=!1;var h=new Wl(e);return(o=t.call(this,a,h,null,s)||this).autoUpdate=!0,o}Pc(e,t),Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),t.prototype._render.call(this,e)}}(zl);!function(t){function e(e,i,r,n,s){void 0===i&&(i=10),void 0===r&&(r=10),void 0===n&&(n=10),void 0===s&&(s=10);var o=t.call(this,Oi.WHITE,4,4)||this;return o._origWidth=e.orig.width,o._origHeight=e.orig.height,o._width=o._origWidth,o._height=o._origHeight,o._leftWidth=i,o._rightWidth=n,o._topHeight=r,o._bottomHeight=s,o.texture=e,o}Pc(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight,r=this._height>i?1:this._height/i;return Math.min(e,r)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var i=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}(Cc);
/*!
   * @pixi/sprite-animated - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * @pixi/sprite-animated is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
/*! *****************************************************************************
  Copyright (c) Microsoft Corporation.

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
var Rc=function(t,e){return Rc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},Rc(t,e)};function Oc(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function $c(t){return function e(i){return 0===arguments.length||Oc(i)?e:t.apply(this,arguments)}}function Dc(t){return function e(i,r){switch(arguments.length){case 0:return e;case 1:return Oc(i)?e:$c(function(e){return t(i,e)});default:return Oc(i)&&Oc(r)?e:Oc(i)?$c(function(e){return t(e,r)}):Oc(r)?$c(function(e){return t(i,e)}):t(i,r)}}}function Lc(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,i){return e.apply(this,arguments)};case 3:return function(t,i,r){return e.apply(this,arguments)};case 4:return function(t,i,r,n){return e.apply(this,arguments)};case 5:return function(t,i,r,n,s){return e.apply(this,arguments)};case 6:return function(t,i,r,n,s,o){return e.apply(this,arguments)};case 7:return function(t,i,r,n,s,o,a){return e.apply(this,arguments)};case 8:return function(t,i,r,n,s,o,a,h){return e.apply(this,arguments)};case 9:return function(t,i,r,n,s,o,a,h,u){return e.apply(this,arguments)};case 10:return function(t,i,r,n,s,o,a,h,u,l){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function Fc(t,e,i){return function(){for(var r=[],n=0,s=t,o=0,a=!1;o<e.length||n<arguments.length;){var h;o<e.length&&(!Oc(e[o])||n>=arguments.length)?h=e[o]:(h=arguments[n],n+=1),r[o]=h,Oc(h)?a=!0:s-=1,o+=1}return!a&&s<=0?i.apply(this,r):Lc(Math.max(0,s),Fc(t,r,i))}}function kc(t){return function e(i,r,n){switch(arguments.length){case 0:return e;case 1:return Oc(i)?e:Dc(function(e,r){return t(i,e,r)});case 2:return Oc(i)&&Oc(r)?e:Oc(i)?Dc(function(e,i){return t(e,r,i)}):Oc(r)?Dc(function(e,r){return t(i,e,r)}):$c(function(e){return t(i,r,e)});default:return Oc(i)&&Oc(r)&&Oc(n)?e:Oc(i)&&Oc(r)?Dc(function(e,i){return t(e,i,n)}):Oc(i)&&Oc(n)?Dc(function(e,i){return t(e,r,i)}):Oc(r)&&Oc(n)?Dc(function(e,r){return t(i,e,r)}):Oc(i)?$c(function(e){return t(e,r,n)}):Oc(r)?$c(function(e){return t(i,e,n)}):Oc(n)?$c(function(e){return t(i,r,e)}):t(i,r,n)}}}!function(t){function e(e,i){void 0===i&&(i=!0);var r=t.call(this,e[0]instanceof Oi?e[0]:e[0].texture)||this;return r._textures=null,r._durations=null,r._autoUpdate=i,r._isConnectedToTicker=!1,r.animationSpeed=1,r.loop=!0,r.updateAnchor=!1,r.onComplete=null,r.onFrameChange=null,r.onLoop=null,r._currentTime=0,r._playing=!1,r._previousFrame=null,r.textures=e,r}(function(t,e){function i(){this.constructor=t}Rc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(e,t),e.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(oi.shared.remove(this.update,this),this._isConnectedToTicker=!1))},e.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(oi.shared.add(this.update,this,ei.HIGH),this._isConnectedToTicker=!0))},e.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},e.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},e.prototype.update=function(t){if(this._playing){var e=this.animationSpeed*t,i=this.currentFrame;if(null!==this._durations){var r=this._currentTime%1*this._durations[this.currentFrame];for(r+=e/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i||this.animationSpeed<0&&this.currentFrame>i)&&this.onLoop(),this.updateTexture())}},e.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},e.prototype.destroy=function(e){this.stop(),t.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},e.fromFrames=function(t){for(var i=[],r=0;r<t.length;++r)i.push(Oi.from(t[r]));return new e(i)},e.fromImages=function(t){for(var i=[],r=0;r<t.length;++r)i.push(Oi.from(t[r]));return new e(i)},Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},set:function(t){if(t[0]instanceof Oi)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(var e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(oi.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(oi.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0})}(hl),
/*!
   * pixi.js - v6.5.10
   * Compiled Thu, 06 Jul 2023 15:25:11 UTC
   *
   * pixi.js is licensed under the MIT License.
   * http://www.opensource.org/licenses/mit-license
   */
ri.add(Ja,hh,oh,Iu,$l,xn,Gl,lc,Uh,Tu,Au,Ll,ai,wh);var Bc=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)};function Nc(t,e,i){return function(){if(0===arguments.length)return i();var r=arguments[arguments.length-1];if(!Bc(r)){for(var n=0;n<t.length;){if("function"==typeof r[t[n]])return r[t[n]].apply(r,Array.prototype.slice.call(arguments,0,-1));n+=1}if(function(t){return null!=t&&"function"==typeof t["@@transducer/step"]}(r))return e.apply(null,Array.prototype.slice.call(arguments,0,-1))(r)}return i.apply(this,arguments)}}var Uc=function(){return this.xf["@@transducer/init"]()};function Gc(t){for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}function Xc(t,e,i){for(var r=0,n=i.length;r<n;){if(t(e,i[r]))return!0;r+=1}return!1}function Vc(t,e){return Object.prototype.hasOwnProperty.call(e,t)}var Hc="function"==typeof Object.is?Object.is:function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e},jc=Object.prototype.toString,Yc=function(){return"[object Arguments]"===jc.call(arguments)?function(t){return"[object Arguments]"===jc.call(t)}:function(t){return Vc("callee",t)}}(),zc=!{toString:null}.propertyIsEnumerable("toString"),Wc=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],qc=function(){return arguments.propertyIsEnumerable("length")}(),Zc=function(t,e){for(var i=0;i<t.length;){if(t[i]===e)return!0;i+=1}return!1},Qc="function"!=typeof Object.keys||qc?$c(function(t){if(Object(t)!==t)return[];var e,i,r=[],n=qc&&Yc(t);for(e in t)!Vc(e,t)||n&&"length"===e||(r[r.length]=e);if(zc)for(i=Wc.length-1;i>=0;)Vc(e=Wc[i],t)&&!Zc(r,e)&&(r[r.length]=e),i-=1;return r}):$c(function(t){return Object(t)!==t?[]:Object.keys(t)}),Jc=$c(function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)});function Kc(t,e,i,r){var n=Gc(t);function s(t,e){return tf(t,e,i.slice(),r.slice())}return!Xc(function(t,e){return!Xc(s,e,t)},Gc(e),n)}function tf(t,e,i,r){if(Hc(t,e))return!0;var n,s,o=Jc(t);if(o!==Jc(e))return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof e["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e)&&"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof e.equals)return"function"==typeof t.equals&&t.equals(e)&&"function"==typeof e.equals&&e.equals(t);switch(o){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(n=t.constructor,null==(s=String(n).match(/^function (\w*)/))?"":s[1]))return t===e;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof e||!Hc(t.valueOf(),e.valueOf()))return!1;break;case"Date":if(!Hc(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(t.source!==e.source||t.global!==e.global||t.ignoreCase!==e.ignoreCase||t.multiline!==e.multiline||t.sticky!==e.sticky||t.unicode!==e.unicode)return!1}for(var a=i.length-1;a>=0;){if(i[a]===t)return r[a]===e;a-=1}switch(o){case"Map":return t.size===e.size&&Kc(t.entries(),e.entries(),i.concat([t]),r.concat([e]));case"Set":return t.size===e.size&&Kc(t.values(),e.values(),i.concat([t]),r.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var h=Qc(t);if(h.length!==Qc(e).length)return!1;var u=i.concat([t]),l=r.concat([e]);for(a=h.length-1;a>=0;){var c=h[a];if(!Vc(c,e)||!tf(e[c],t[c],u,l))return!1;a-=1}return!0}var ef=Dc(function(t,e){return tf(t,e,[],[])});function rf(t){return"[object Object]"===Object.prototype.toString.call(t)}function nf(t){return"[object String]"===Object.prototype.toString.call(t)}var sf=$c(function(t){return!!Bc(t)||!!t&&("object"==typeof t&&(!nf(t)&&(0===t.length||t.length>0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))}),of="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function af(t,e,i){return function(r,n,s){if(sf(s))return t(r,n,s);if(null==s)return n;if("function"==typeof s["fantasy-land/reduce"])return e(r,n,s,"fantasy-land/reduce");if(null!=s[of])return i(r,n,s[of]());if("function"==typeof s.next)return i(r,n,s);if("function"==typeof s.reduce)return e(r,n,s,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function hf(t,e,i){for(var r=0,n=i.length;r<n;){if((e=t["@@transducer/step"](e,i[r]))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r+=1}return t["@@transducer/result"](e)}var uf=Dc(function(t,e){return Lc(t.length,function(){return t.apply(e,arguments)})});function lf(t,e,i){for(var r=i.next();!r.done;){if((e=t["@@transducer/step"](e,r.value))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r=i.next()}return t["@@transducer/result"](e)}function cf(t,e,i,r){return t["@@transducer/result"](i[r](uf(t["@@transducer/step"],t),e))}var ff=af(hf,cf,lf),df=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,e){return this.f(t,e)},t}();var pf=$c(function(t){return null==t});function _f(t,e,i){if(i||(i=new mf),function(t){var e=typeof t;return null==t||"object"!=e&&"function"!=e}(t))return t;var r,n=function(e){var r=i.get(t);if(r)return r;for(var n in i.set(t,e),t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e};switch(Jc(t)){case"Object":return n(Object.create(Object.getPrototypeOf(t)));case"Array":return n([]);case"Date":return new Date(t.valueOf());case"RegExp":return r=t,new RegExp(r.source,r.flags?r.flags:(r.global?"g":"")+(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.sticky?"y":"")+(r.unicode?"u":"")+(r.dotAll?"s":""));case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":return t.slice();default:return t}}var mf=function(){function t(){this.map={},this.length=0}return t.prototype.set=function(t,e){const i=this.hash(t);let r=this.map[i];r||(this.map[i]=r=[]),r.push([t,e]),this.length+=1},t.prototype.hash=function(t){let e=[];for(var i in t)e.push(Object.prototype.toString.call(t[i]));return e.join()},t.prototype.get=function(t){if(this.length<=180){for(const e in this.map){const i=this.map[e];for(let e=0;e<i.length;e+=1){const r=i[e];if(r[0]===t)return r[1]}}return}const e=this.hash(t),i=this.map[e];if(i)for(let e=0;e<i.length;e+=1){const r=i[e];if(r[0]===t)return r[1]}},t}();function gf(t,e){return function(){var i=arguments.length;if(0===i)return e();var r=arguments[i-1];return Bc(r)||"function"!=typeof r[t]?e.apply(this,arguments):r[t].apply(r,Array.prototype.slice.call(arguments,0,i-1))}}var vf=function(){function t(t,e,i,r){this.valueFn=t,this.valueAcc=e,this.keyFn=i,this.xf=r,this.inputs={}}return t.prototype["@@transducer/init"]=Uc,t.prototype["@@transducer/result"]=function(t){var e;for(e in this.inputs)if(Vc(e,this.inputs)&&(t=this.xf["@@transducer/step"](t,this.inputs[e]))["@@transducer/reduced"]){t=t["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](t)},t.prototype["@@transducer/step"]=function(t,e){var i=this.keyFn(e);return this.inputs[i]=this.inputs[i]||[i,_f(this.valueAcc)],this.inputs[i][1]=this.valueFn(this.inputs[i][1],e),t},t}();function yf(t,e,i){return function(r){return new vf(t,e,i,r)}}var bf=Fc(4,[],Nc([],yf,function(t,e,i,r){var n,s=(n=function(r,n){var s=i(n),o=t(Vc(s,r)?r[s]:_f(e),n);return o&&o["@@transducer/reduced"]?function(t){return t&&t["@@transducer/reduced"]?t:{"@@transducer/value":t,"@@transducer/reduced":!0}}(r):(r[s]=o,r)},new df(n));return ff(s,{},r)})),xf=Dc(function(t,e){return null==e||e!=e?t:e});var Tf=$c(function(t){return null!=t&&"function"==typeof t["fantasy-land/empty"]?t["fantasy-land/empty"]():null!=t&&null!=t.constructor&&"function"==typeof t.constructor["fantasy-land/empty"]?t.constructor["fantasy-land/empty"]():null!=t&&"function"==typeof t.empty?t.empty():null!=t&&null!=t.constructor&&"function"==typeof t.constructor.empty?t.constructor.empty():Bc(t)?[]:nf(t)?"":rf(t)?{}:Yc(t)?function(){return arguments}():function(t){var e=Object.prototype.toString.call(t);return"[object Uint8ClampedArray]"===e||"[object Int8Array]"===e||"[object Uint8Array]"===e||"[object Int16Array]"===e||"[object Uint16Array]"===e||"[object Int32Array]"===e||"[object Uint32Array]"===e||"[object Float32Array]"===e||"[object Float64Array]"===e||"[object BigInt64Array]"===e||"[object BigUint64Array]"===e}(t)?t.constructor.from(""):void 0}),Af=Dc(gf("groupBy",bf(function(t,e){return t.push(e),t},[]))),Ef=function(t,e){switch(arguments.length){case 0:return Ef;case 1:return function e(i){return 0===arguments.length?e:Hc(t,i)};default:return Hc(t,e)}};var wf="function"==typeof Object.assign?Object.assign:function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1,r=arguments.length;i<r;){var n=arguments[i];if(null!=n)for(var s in n)Vc(s,n)&&(e[s]=n[s]);i+=1}return e},Sf=Dc(function(t,e){return e instanceof t||null!=e&&(e.constructor===t||"Object"===t.name&&"object"==typeof e)}),Pf=$c(function(t){return null!=t&&ef(t,Tf(t))}),Mf=$c(function(t){return wf.apply(null,[{}].concat(t))}),If=kc(function(t,e,i){var r,n={};for(r in i=i||{},e=e||{})Vc(r,e)&&(n[r]=Vc(r,i)?t(r,e[r],i[r]):e[r]);for(r in i)Vc(r,i)&&!Vc(r,n)&&(n[r]=i[r]);return n}),Cf=kc(function t(e,i,r){return If(function(i,r,n){return rf(r)&&rf(n)?t(e,r,n):e(i,r,n)},i,r)}),Rf=kc(function(t,e,i){return Cf(function(e,i,r){return t(i,r)},e,i)});class Of{static mixin(t,...e){for(const i of e)for(const e of Object.getOwnPropertyNames(i.prototype))t.prototype.hasOwnProperty(e)||Object.defineProperty(t.prototype,e,Object.getOwnPropertyDescriptor(i.prototype,e));return t}static mixinProperty(t,...e){if(!t)return t;for(const i of e)if(i)for(const e of Object.keys(i))t[e]=i[e];return t}static isNotValid(t){return pf(t)||Ef(t,NaN)||Pf(t)}static isValid(t){return!Of.isNotValid(t)}static random(t=0,e=1,i=null){t>e&&(e=t);const r=Math.random()*(e-t)+t;return"floor"===i?Math.floor(r):"ceil"===i?Math.ceil(r):r}static groupBy(t,e){return Af(t)(e)}static is(t,e){return Sf(t,e)}static mergeAll(...t){return Mf(t)}static mergeDeepWith(...t){let e={};for(const r of t)e=Rf(i,e,r);return e;function i(t,e){return Sf(Array,t)&&Sf(Array,e)?t.concat(e):e}}static T(){return!0}static F(){return!1}static clamp(t,e,i){return t>e&&(e=t),i<t?t:i>e?e:i}static defaultTo(t,e){return xf(t,e)}static sayHello(){const t=["\n","%c🎉🎉🎉%c ✨ wl-live2d v1.0.4 - 欢迎你的使用 !! ✨ %c🎉🎉🎉","%c\n\n"],e=["background: linear-gradient(to right, #ff00cc, #ffcc00);padding: 8px 30px;font-size: 1em;","background: linear-gradient(to right, #ff4fa9, #ffa233) text, linear-gradient(to right, #ffcc00, #6fff66, #00ffcc) border-box;color: transparent;padding: 8px 30px;font-size: 1em;","background: linear-gradient(to right, #00ffcc, #ff00cc);padding: 8px 30px;font-size: 1em;",""];console.log(t.join(""),...e)}}class $f{}$f.init=Symbol("init"),$f.destroy=Symbol("destroy"),$f.modelStart=Symbol("model-start"),$f.modelLoaded=Symbol("model-loaded"),$f.modelError=Symbol("model-error"),$f.fadeStart=Symbol("fade-start"),$f.fadeEnd=Symbol("fade-end"),$f.fadeCancel=Symbol("fade-cancel"),$f.motionStart=Symbol("motion-start"),$f.motionFinish=Symbol("motion-finish");class Df{constructor(t){if(Of.isNotValid(t))throw Error("live2d is not valid");this._live2d=t,this._live2d.event.once($f.init,this.init,this),this._live2d.event.once($f.destroy,this.destroy,this)}get live2d(){return this._live2d}get options(){return this._live2d.data}get app(){return this._live2d.app}get event(){return this._live2d.event}get ref(){return this._live2d.ref}init(){}destroy(){this.event.removeListener($f.init,this.destroy,this),this.event.removeListener($f.destroy,this.destroy,this)}}var Lf=Math.pow;const Ff=new ke;class kf extends rl{constructor(){super(),this.initialized=!1,this.texts=[],this.strokeWidth=4,this.normalColor=14883354,this.activeColor=2017330,this.interactive=!0,this.on("added",this.init).on("pointermove",this.onPointerMove)}init(){const t=this.parent.internalModel,e=new fl({fontSize:24,fill:"#ffffff",stroke:"#000000",strokeThickness:4});this.texts=Object.keys(t.hitAreas).map(t=>{const i=new yl(t,e);return i.visible=!1,this.addChild(i),i})}onPointerMove(t){const e=this.parent.hitTest(t.data.global.x,t.data.global.y);this.texts.forEach(t=>{t.visible=e.includes(t.text)})}_render(t){const e=this.parent.internalModel,i=1/Math.sqrt(Lf(this.transform.worldTransform.a,2)+Lf(this.transform.worldTransform.b,2));this.texts.forEach(t=>{this.lineStyle({width:this.strokeWidth*i,color:t.visible?this.activeColor:this.normalColor});const r=e.getDrawableBounds(e.hitAreas[t.text].index,Ff),n=e.localTransform;r.x=r.x*n.a+n.tx,r.y=r.y*n.d+n.ty,r.width=r.width*n.a,r.height=r.height*n.d,this.drawRect(r.x,r.y,r.width,r.height),t.x=r.x+this.strokeWidth*i,t.y=r.y+this.strokeWidth*i,t.scale.set(i)}),super._render(t),this.clear()}}class Bf{constructor(t=null){Of.mixinProperty(this,t),this.condition=t?.condition??Of.T,this.text=t?.text??"",this.priority=t?.priority??Bf.priority,this.type=t?.type??null}}Bf.priority=2;class Nf{constructor(t=null){Of.mixinProperty(this,t),this.path=t?.path??"",this.volume=t?.volume??.5,this.scale=t?.scale??1,this.rotate=t?.rotate??0,this.position=t?.position??{x:0,y:0},this.backgroundColor=t?.backgroundColor??"transparent",this.width=t?.width??null,this.height=t?.height??null,this.motionPreload=t?.motionPreload??Wn.NONE}}class Uf{constructor(t=null){Of.mixinProperty(this,t),this.sayHello=t?.sayHello??!0,this.transitionTime=t?.transitionTime??500,this.models=t?.models??[],this.tips=t?.tips??null,this.menus=t?.menus??["home","switchModule","switchTexture","capture","info","quit"],this.selector=t?.selector??"",this.fixed=t?.fixed??!0,this.plugins=t?.plugins??[],this.drag=t?.drag??!0,this.homePath=t?.homePath??"",this.hitFrame=t?.hitFrame??!1,this.dockedRight=t?.dockedRight??!0}}class Gf{constructor(t=null){this.parent=t?.parent??document.body,this.wrapper=t?.wrapper??document.createElement("div"),this.canvas=t?.canvas??document.createElement("canvas"),this.tips=t?.tips??document.createElement("div"),this.menus=t?.menus??document.createElement("div"),this.other=t?.other??document.createElement("div")}}class Xf{constructor(t=null){Of.mixinProperty(this,t),this.minWidth=t?.minWidth??230,this.minHeight=t?.minHeight??100,this.offsetX=t?.offsetX??0,this.offsetY=t?.offsetY??0,this.duration=t?.duration??3e3,this.interval=t?.interval??5e3,this.message=t?.message??[],this.drag=t?.drag??!0,this.talk=t?.talk??!0,this.talkInterval=t?.talkInterval??3e4,this.talkApis=t?.talkApis??[],this.motionMessage=t?.motionMessage??!0}}class Vf extends Df{constructor(){super(...arguments),this._hitAreaFrames=null,this._modelId=0,this._textureId=0,this._model=null,this._currentMotion=null}get data(){return this._data}get modelId(){return this._modelId}set modelId(t){this._modelId=Of.clamp(0,this._data.length-1,t),localStorage.setItem("model-id",`${this._modelId}`)}get textureId(){return this._textureId}set textureId(t){this._textureId=Of.clamp(0,this.textureMaxIndex,t),localStorage.setItem("texture-id",`${this._textureId}`)}get textureMaxIndex(){let t=this.modelData;return Of.is(Array,t)?t.length-1:0}get model(){return this._model}get modelData(){return this._data[this.modelId]}get currentMotion(){return this._currentMotion}get backgroundColor(){let t=this.modelData;return Of.is(Array,t)&&(t=t[this.textureId]),t?.backgroundColor??"transparent"}}class Hf extends Vf{constructor(t,e=[]){super(t);const i=t=>Of.is(Array,t)?t.map(i):new Nf(t);this._data=Of.is(Array,e)?e.map(i):[],this.modelId=Of.defaultTo(0,parseInt(localStorage.getItem("model-id")??"")),this.textureId=Of.defaultTo(0,parseInt(localStorage.getItem("texture-id")??""))}init(){this.loadModel(this.modelId,this.textureId).catch(Of.F)}destroy(){super.destroy(),this._model?.destroy(),this._model=null,this._currentMotion=null}async loadModel(t,e=0){const i=this.app.stage,r=this.event;let n=this.data[t];if(n=Of.is(Array,n)?n[e]:n,Of.isNotValid(n))return void r.emit($f.modelError,new Error("没有找到模型哦"));r.emit($f.modelStart);let s=n.path;Of.isNotValid(s)&&(s="https://fastly.jsdelivr.net/gh/guansss/pixi-live2d-display/test/assets/shizuku/shizuku.model.json");const o=await window.ILive2DModel.from(s,{motionPreload:n.motionPreload,crossOrigin:"anonymous"}).catch(t=>t);if(Of.is(Error,o))return r.emit($f.modelError,o),r.emit($f.modelLoaded,null),void await this.live2d.tips.notify(o.message);this._model=o,i.removeChildren(0,i.children.length),this.modelId=t,this.textureId=e,o.x=n.position?.x??0,o.y=n.position?.y??0,o.scale.set(.15*(n.scale??1)),o.rotation=n.rotate??0,n.width&&(o.width=n.width),n.height&&(o.height=n.height),this._bindMotion(o),i.addChild(o),r.emit($f.modelLoaded,o)}async switchModel(t,e=0){const i=this.live2d.stage;await i.fadeOut(i.canvas),await this.loadModel(t,e),await i.fadeIn(i.canvas)}async nextModel(){const t=this._data.length-1;t<=0?await this.live2d.tips.notify("没有其它模型哦"):await this.switchModel(this.modelId>=t?0:this.modelId+1,0)}async nextTexture(){const t=this.textureMaxIndex;t<=0?await this.live2d.tips.notify("没有其它服装哦"):await this.switchModel(this.modelId,this.textureId>=t?0:this.textureId+1)}async resetModel(){await this.loadModel(this.modelId,this.textureId)}showHitAreaFrames(){null!=this._model&&(null==this._hitAreaFrames&&(this._hitAreaFrames=new kf),this._hitAreaFrames.visible=!0,this.model.addChild(this._hitAreaFrames))}hiddenHitAreaFrames(){null!=this._hitAreaFrames&&(this._hitAreaFrames.visible=!1,this.model?.removeChild(this._hitAreaFrames))}onModelHit(t,e,i=!1){i?this.model?.once("hit",t,e):this.model?.on("hit",t,e)}_bindMotion(t){t.on("hit",async e=>{e.find(t=>/head/i.test(t))&&await t.expression()});const e=t.internalModel.motionManager;return e.on("motionStart",(t,e,i)=>{let r=this.modelData;i&&Of.is(Nf,r)&&(i.volume=r.volume??.5),this._currentMotion=t,this.event.emit($f.motionStart,t,e,i)}),e.on("motionFinish",()=>{this._currentMotion=null,this.event.emit($f.motionFinish)}),this}}var jf={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function r(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function s(t,e,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new n(r,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,r,n=[];if(0===this._eventsCount)return n;for(r in t=this._events)e.call(t,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,s=r.length,o=new Array(s);n<s;n++)o[n]=r[n].fn;return o},a.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,n,s,o){var a=i?i+t:t;if(!this._events[a])return!1;var h,u,l=this._events[a],c=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,n),!0;case 5:return l.fn.call(l.context,e,r,n,s),!0;case 6:return l.fn.call(l.context,e,r,n,s,o),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h)}else{var f,d=l.length;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,r);break;case 4:l[u].fn.call(l[u].context,e,r,n);break;default:if(!h)for(f=1,h=new Array(c-1);f<c;f++)h[f-1]=arguments[f];l[u].fn.apply(l[u].context,h)}}return!0},a.prototype.on=function(t,e,i){return s(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return s(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,r,n){var s=i?i+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||n&&!a.once||r&&a.context!==r||o(this,s);else{for(var h=0,u=[],l=a.length;h<l;h++)(a[h].fn!==e||n&&!a[h].once||r&&a[h].context!==r)&&u.push(a[h]);u.length?this._events[s]=1===u.length?u[0]:u:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&o(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a}(jf);var Yf=V(jf.exports),zf={models:[{path:"https://fastly.jsdelivr.net/gh/Eikanya/Live2d-model/%E5%B4%A9%E5%9D%8F%E5%AD%A6%E5%9B%AD2/yiselin/model.json",scale:.7},{path:"https://fastly.jsdelivr.net/gh/Eikanya/Live2d-model/%E5%B0%91%E5%A5%B3%E5%89%8D%E7%BA%BF%20girls%20Frontline/live2dold/old/kp31/normal/model.json",scale:.5}],tips:{message:[{text:"好久不见,日子过得好快呢……"},{text:"大坏蛋!你都多久没理人家了呀,嘤嘤嘤~"},{text:"嗨~快来逗我玩吧!"},{text:"拿小拳拳锤你胸口!"},{text:"记得把小家加入收藏夹哦!"},{text:"了解真相,才能获得真正的自由~"},{text:"最近在看什么书呢?"},{text:"最近在玩什么游戏呢?"},{text:"今天学习了吗?"},{type:"seasons",date:"01/01",text:"<span>元旦</span>了呢,新的一年又开始了,今年是{year}年~"},{type:"seasons",date:"02/14",text:"又是一年<span>情人节</span>,{year}年找到对象了嘛~"},{type:"seasons",date:"03/08",text:"今天是<span>国际妇女节</span>!"},{type:"seasons",date:"03/12",text:"今天是<span>植树节</span>,要保护环境呀!"},{type:"seasons",date:"04/01",text:"悄悄告诉你一个秘密~<span>今天是愚人节,不要被骗了哦~</span>"},{type:"seasons",date:"05/01",text:"今天是<span>五一劳动节</span>,计划好假期去哪里了吗~"},{type:"seasons",date:"06/01",text:"<span>儿童节</span>了呢,快活的时光总是短暂,要是永远长不大该多好啊…"},{type:"seasons",date:"09/03",text:"<span>中国人民抗日战争胜利纪念日</span>,铭记历史、缅怀先烈、珍爱和平、开创未来。"},{type:"seasons",date:"09/10",text:"<span>教师节</span>,在学校要给老师问声好呀~"},{type:"seasons",date:"10/01",text:"<span>国庆节</span>到了,为祖国母亲庆生!"},{type:"seasons",date:"11/05-11/12",text:"今年的<span>双十一</span>是和谁一起过的呢~"},{type:"seasons",date:"12/20-12/31",text:"这几天是<span>圣诞节</span>,主人肯定又去剁手买买买了~"},{type:"hour",hour:"6-7",text:"早上好!一日之计在于晨,美好的一天就要开始了~"},{type:"hour",hour:"8-11",text:"上午好!工作顺利嘛,不要久坐,多起来走动走动哦!"},{type:"hour",hour:"12-13",text:"中午了,工作了一个上午,现在是午餐时间!"},{type:"hour",hour:"14-17",text:["午后很容易犯困呢,今天的运动目标完成了吗?","午后很容易犯困呢,来杯咖啡吧~"]},{type:"hour",hour:"18-19",text:["傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~","傍晚了!工作一天幸苦啦~"]},{type:"hour",hour:"20-21",text:"晚上好,今天过得怎么样?"},{type:"hour",hour:"22-23",text:["已经这么晚了呀,早点休息吧,晚安~","深夜时要爱护眼睛呀!"]},{type:"hour",hour:"0-4",text:"这么晚还不睡吗?当心熬夜秃头哦!"},{type:"hour",hour:"0-5",text:"你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?"},{type:"event",event:"console",text:"哈哈,你打开了控制台,是想要看看我的小秘密吗?"},{type:"event",event:"copy",text:["复制的内容如果需要转载记得注明出处哦~","你都复制了些什么呀,转载要记得加上出处哦~~"]},{type:"event",event:"visibilitychange",text:"哇,你终于回来了~"}]},selector:""};class Wf{constructor(){this.name="",this.priority=0,this._live2d=null}get live2d(){return this._live2d}static setContext(t,e){t._live2d=e}install(){}uninstall(){}}class qf extends Wf{constructor(){super(...arguments),this.name="capture",this.priority=24,this._button=null,this._func=void 0}install(){this.live2d.data.menus.includes(this.name)&&(this._button=document.createElement("div"),this._button.className="live2d-menu-item live2d-flex-center",this._button.title="保存图片",this._button.innerHTML='\n    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M220.6 121.2L271.1 96 448 96v96H333.2c-21.9-15.1-48.5-24-77.2-24s-55.2 8.9-77.2 24H64V128H192c9.9 0 19.7-2.3 28.6-6.8zM0 128V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H271.1c-9.9 0-19.7 2.3-28.6 6.8L192 64H160V48c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16l0 16C28.7 64 0 92.7 0 128zM344 304c0 48.6-39.4 88-88 88s-88-39.4-88-88s39.4-88 88-88s88 39.4 88 88z"></path></svg>\n    ',this._func=this.downloadImage.bind(this),this._button.addEventListener("click",this._func),this.live2d.stage.addMenu(this._button,this.priority))}uninstall(){this._button?.removeEventListener("click",this._func),this.live2d.stage.removeMenu(this._button),this._button=null}async downloadImage(){const{app:t}=this.live2d,e=t.renderer.plugins.extract.image(t.stage).getAttribute("src");await fetch(e).then(t=>t.blob()).then(t=>{const i=document.createElement("a");i.download=e.split("/").pop()?.slice(0,40),i.href=URL.createObjectURL(t),document.body.appendChild(i),i.click(),document.body.removeChild(i)})}}class Zf extends Wf{constructor(){super(...arguments),this.name="drag",this._screen={width:0,height:0},this._isLeft=!0,this._element=null,this._event=null}install(){this.live2d.data.drag&&(this._element=this.getDragElement(),this._startFun=this._start.bind(this),this._runFun=this._run.bind(this),this._endFun=this._end.bind(this),this._element.addEventListener("mousedown",this._startFun,{passive:!0}),this._element.addEventListener("touchstart",this._startFun,{passive:!0}))}uninstall(){this._element?.removeEventListener("mousedown",this._startFun),this._element?.removeEventListener("touchstart",this._startFun),this._element=null}getDragElement(){return this.live2d.stage.wrapper}getWidthHeight(){return{width:Math.min(window.screen.width,window.visualViewport.width,window.innerWidth),height:Math.min(window.screen.height,window.visualViewport.height,window.innerHeight)}}_run(t){const e=this._element.getBoundingClientRect(),i=t.targetTouches?.[0]??t,r=this._event?.targetTouches?.[0]??this._event,n=i.screenX-r.screenX,s=i.screenY-r.screenY,o=this._screen.width-e.width,a=this._screen.height-e.height;this._event=t;const{classList:h,style:u}=this._element,l=Of.clamp(0,o,e.left+n),c=Of.clamp(0,a,a-e.top-s),f=l<=.5*o;f!==this._isLeft&&((this._isLeft=f)?h.remove("live2d-right"):h.add("live2d-right")),u.left=`${l}px`,u.bottom=`${c}px`}_end(){const t=this._element;t.removeEventListener("mousemove",this._runFun),t.removeEventListener("mouseup",this._endFun),t.removeEventListener("mouseout",this._endFun),t.removeEventListener("touchmove",this._runFun),t.removeEventListener("touchend",this._endFun),t.removeEventListener("touchcancel",this._endFun),t.classList.remove("live2d-drag")}_start(t){this._event=t,this._screen=this.getWidthHeight();const e=this._element;e.classList.add("live2d-drag"),e.addEventListener("mousemove",this._runFun,{passive:!0}),e.addEventListener("mouseup",this._endFun,{passive:!0}),e.addEventListener("mouseout",this._endFun,{passive:!0}),e.addEventListener("touchmove",this._runFun,{passive:!0}),e.addEventListener("touchend",this._endFun,{passive:!0}),e.addEventListener("touchcancel",this._endFun,{passive:!0})}}class Qf extends Zf{constructor(){super(...arguments),this.name="tipsDrag"}install(){super.install(),this._element&&this._element.classList.add("live2d-cursor-default")}uninstall(){this._element?.classList.remove("live2d-cursor-default"),super.uninstall()}getDragElement(){return this.live2d.stage.tips}_start(t){t.stopPropagation(),super._start(t)}_run(t){t.stopPropagation();const e=t.targetTouches?.[0]??t,i=this._event?.targetTouches?.[0]??this._event,r=e.screenX-i.screenX,n=e.screenY-i.screenY,s=this._element.offsetTop+n,o=this._element.offsetLeft+r;this._event=t;const a=this._element.style;a.top=`${s}px`,a.left=`${o}px`}}class Jf extends Wf{constructor(){super(...arguments),this.name="home",this.priority=48,this._back=null,this._func=void 0}install(){this.live2d.data.menus.includes(this.name)&&(this._back=document.createElement("div"),this._back.className="live2d-menu-item live2d-flex-center",this._back.title="返回首页",this._back.innerHTML='\n    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M 25 1.0507812 C 24.7825 1.0507812 24.565859 1.1197656 24.380859 1.2597656 L 1.3808594 19.210938 C 0.95085938 19.550938 0.8709375 20.179141 1.2109375 20.619141 C 1.5509375 21.049141 2.1791406 21.129062 2.6191406 20.789062 L 4 19.710938 L 4 46 C 4 46.55 4.45 47 5 47 L 19 47 L 19 29 L 31 29 L 31 47 L 45 47 C 45.55 47 46 46.55 46 46 L 46 19.710938 L 47.380859 20.789062 C 47.570859 20.929063 47.78 21 48 21 C 48.3 21 48.589063 20.869141 48.789062 20.619141 C 49.129063 20.179141 49.049141 19.550938 48.619141 19.210938 L 25.619141 1.2597656 C 25.434141 1.1197656 25.2175 1.0507812 25 1.0507812 z M 35 5 L 35 6.0507812 L 41 10.730469 L 41 5 L 35 5 z"></path></svg>\n    ',this._func=this.backToHome.bind(this),this._back.addEventListener("click",this._func),this.live2d.stage.addMenu(this._back,this.priority))}uninstall(){this._back?.removeEventListener("click",this._func),this.live2d.stage.removeMenu(this._back),this._back=null}backToHome(){let t=this.live2d.data.homePath;/https?:\/\//.test(t)||(t.startsWith("/")&&(t="/"+t),t=window.location.origin+t),window.location.assign(t)}}class Kf extends Wf{constructor(){super(...arguments),this.name="info",this.priority=16,this._button=null}install(){this.live2d.data.menus.includes(this.name)&&(this._button=document.createElement("div"),this._button.className="live2d-menu-item live2d-flex-center",this._button.title="查看文档",this._button.innerHTML='\n    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-144c-17.7 0-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32z"></path></svg>\n    ',this._button.addEventListener("click",this.openDocs),this.live2d.stage.addMenu(this._button,this.priority))}uninstall(){this._button?.removeEventListener("click",this.openDocs),this.live2d.stage.removeMenu(this._button),this._button=null}openDocs(){window.open("https://live2d.doc.nianian.cn/")}}class td extends Wf{constructor(){super(...arguments),this.name="nullMessage",this.priority=2,this._type=null,this._messages=[]}install(){this._messages=this.live2d.tips.messages,this._messages=this._messages.filter(this.isType.bind(this));for(const t of this._messages)t.condition=this.condition.bind(t),t.priority===Bf.priority&&(t.priority=this.priority)}uninstall(){for(const t of this._messages)this.setDefault(t)}isType(t){return this._type===(t.type??null)&&t.condition===Of.T}condition(){return!0}setDefault(t){t.condition=Of.T,t.priority===this.priority&&(t.priority=Bf.priority)}}class ed extends td{constructor(){super(...arguments),this.name="eventMessage",this.priority=18,this._type="event",this._event=null}install(){super.install(),this.addListener()}uninstall(){super.uninstall(),this.removeListener()}isType(t){return super.isType(t)&&this._event===(t.event??null)}condition(){return!1}setDefault(t){super.setDefault(t),t.condition=Of.F}addListener(){}removeListener(){}async notify(){let t=this._messages;if(t.length<=0)return;let e,i=t[Of.random(0,t.length,"floor")];e=Of.is(Array,i.text)?i.text[Of.random(0,i.text.length,"floor")]:i.text,await this.live2d.tips.notify(e)}}class rd extends ed{constructor(){super(...arguments),this.name="consoleEventMessage",this._open=!1,this._event="console",this._func=void 0}addListener(){this._func=this.notify.bind(this),window.addEventListener("resize",this._func),this._func?.(null)}removeListener(){window.removeEventListener("resize",this._func)}async notify(){const t=this.isOpen();!this._open&&t&&await super.notify(),this._open=t}isOpen(){return window.outerWidth-window.innerWidth>30||window.outerHeight-window.innerHeight>140}}class nd extends ed{constructor(){super(...arguments),this.name="copyEventMessage",this._event="copy",this._func=void 0}addListener(){this._func=this.notify.bind(this),window.addEventListener("copy",this._func)}removeListener(){window.removeEventListener("copy",this._func)}}class sd extends ed{constructor(){super(...arguments),this.name="visibilityEventMessage",this._event="visibilitychange",this._show=!0,this._prop=null}addListener(){let t=!0;const e=this.live2d.stage.wrapper.classList,i=Object.getOwnPropertyDescriptor(e.__proto__,"add");this._prop=i;const r=this,n={configurable:i?.configurable,enumerable:i?.enumerable,writable:!0,value:function(...n){i?.value.bind(e)(...n);const s=/live2d-opacity-1/.test(e.value);t?t=!s:(!r._show&&s&&r.notify().catch(Of.F),r._show=s)}};Object.defineProperty(e,"add",n)}removeListener(){const t=this.live2d.stage.wrapper.classList;Object.defineProperty(t,"add",this._prop)}}class od extends td{constructor(){super(...arguments),this.name="hourMessage",this._type="hour",this.priority=8}condition(){!0===this.once&&(this.condition=Of.F);const t=this.hour+"-",e=(new Date).getHours();let[i,r]=t.split("-",2).map(t=>parseInt(t));return!Of.isNotValid(i)&&(Of.isNotValid(r)?i===e:i<=e&&e<=r)}}class ad extends Wf{constructor(){super(...arguments),this.name="motionMessage",this.priority=22}install(){this.live2d.tips.data.motionMessage&&this.live2d.event.on($f.motionStart,this.motion,this)}uninstall(){this.live2d.event.off($f.motionStart,this.motion,this)}async motion(t,e,i){if(/idle/.test(t))return;const{tips:r,model:n}=this.live2d,s=n.model.internalModel.settings.json,o=s?.motions||s?.FileReferences?.Motions,a=o?.[t]?.[e]?.text;if(Of.isNotValid(a))return;const h=r.duration,u=Of.isValid(i)?1e3*i.duration:h;r.data.duration=Math.max(u,h),await r.notify(a).finally(()=>r.data.duration=h)}}class hd extends td{constructor(){super(...arguments),this.name="seasonsMessage",this.priority=16,this._type="seasons"}condition(){!0===this.once&&(this.condition=Of.F);const t=new Date(this.date+""),e=t.getDate(),i=t.getMonth()+1;if(Of.isNotValid(e)||Of.isNotValid(i))return!1;const r=new Date;return e===r.getDate()&&i===r.getMonth()+1}}class ud extends Wf{constructor(){super(...arguments),this.name="sentenceMessage",this.priority=20,this._type="talk",this._message=null,this._handler=null,this._talkApis=[]}install(){const{talk:t,talkInterval:e,talkApis:i}=this.live2d.tips.data;t&&(this._message=new Bf,this._message.condition=Of.F,this._message.priority=2*this.priority,this._message.type=this._type,this._talkApis=[{url:"https://v1.hitokoto.cn/",handle:async t=>(await t.json()).hitokoto},{url:"https://api.nnxv.cn/api/yiyan.php",handle:async t=>(await t.json()).content},{url:"https://tenapi.cn/v2/yiyan",handle:async t=>(await t.json()).msg}],i&&i.length<=0&&i.push(...this._talkApis),this._handler=setInterval(this.getTalkValue.bind(this),e??3e4))}uninstall(){const{talkApis:t}=this.live2d.tips.data;this._handler&&clearInterval(this._handler),this._handler=null,this._message&&this.live2d.tips.removeMessage(this._message),this._message=null;for(const e of this._talkApis){let i=t?.indexOf(e)??-1;i>=0&&t?.splice(i,1)}}condition(t){return this.condition=Of.F,t.removeMessage(this),!0}async getTalkValue(){const{talkApis:t}=this.live2d.tips.data;try{for(const e of t??[])try{const t=await fetch(e.url,e.init);if(!t.ok)continue;return this._message.text=await e.handle(t),this._message.condition=this.condition.bind(this._message,this.live2d.tips),void this.live2d.tips.addMessage(this._message)}catch(t){}}catch(t){}}}class ld extends Wf{constructor(){super(...arguments),this.name="quit",this.priority=0,this._quit=null,this._show=null,this._hiddenFun=void 0,this._showFun=void 0}install(){this.live2d.data.menus.includes(this.name)&&(this._quit=document.createElement("div"),this._quit.className="live2d-menu-item live2d-flex-center",this._quit.title="休息",this._quit.innerHTML='\n    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z"></path></svg>\n    ',this._show=document.createElement("div"),this._show.className="live2d-fixed live2d-toggle live2d-transition-all live2d-opacity-0 live2d-hidden",this._show.innerHTML="看板娘休息中",this._hiddenFun=this.hiddenLive2d.bind(this),this._showFun=this.showLive2d.bind(this),this._quit.addEventListener("click",this._hiddenFun),this._show.addEventListener("click",this._showFun),this.live2d.stage.addMenu(this._quit,this.priority),document.body.appendChild(this._show))}uninstall(){this._quit?.removeEventListener("click",this._hiddenFun),this._show?.removeEventListener("click",this._showFun),this.live2d.stage.removeMenu(this._quit),this._show?.remove(),this._quit=null,this._show=null}hiddenLive2d(){this.isRight()&&!this._show.classList.contains("live2d-right")&&this._show.classList.add("live2d-right"),this.live2d.stage.fadeOut(null).catch(Of.F),this.live2d.stage.fadeIn(this._show).catch(Of.F)}showLive2d(){const{stage:t,model:e}=this.live2d;t.wrapper.classList.remove("live2d-hidden"),e.resetModel().then(()=>{t.fadeIn(t.wrapper).catch(Of.F),t.fadeOut(this._show).catch(Of.F)})}isRight(){return this.live2d.stage.isRight()}}class cd extends Wf{constructor(){super(...arguments),this.name="switch",this._button=null,this._loading=null,this._func=void 0}install(){this._button=document.createElement("div"),this._button.className="live2d-menu-item live2d-flex-center",this._loading=document.createElement("div"),this._loading.className="live2d-fixed live2d-toggle live2d-transition-all live2d-opacity-0 live2d-hidden",this._loading.innerHTML="加载中",this._func=this.startSwitch.bind(this),this._button.addEventListener("click",this._func),this.live2d.stage.addMenu(this._button,this.priority)}uninstall(){this._button?.removeEventListener("click",this._func),this.live2d.stage.removeMenu(this._button),this._button=null,this._loading=null}async startSwitch(){if(!this.showLoading())return await this.switch();const t=this.live2d.stage;t.isRight()?this._loading.classList.add("live2d-right"):this._loading.classList.remove("live2d-right"),t.other.appendChild(this._loading),await Promise.all([this.switch(),t.fadeIn(this._loading)]),await t.fadeOut(this._loading),t.other.removeChild(this._loading)}showLoading(){return!0}async switch(){}}class fd extends cd{constructor(){super(...arguments),this.name="switchModule",this.priority=40}install(){this.live2d.data.menus.includes(this.name)&&(super.install(),this._button.title="切换模型",this._button.innerHTML='\n    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M320 64c0-35.3-28.7-64-64-64s-64 28.7-64 64s28.7 64 64 64s64-28.7 64-64zm-96 96c-35.3 0-64 28.7-64 64v48c0 17.7 14.3 32 32 32h1.8l11.1 99.5c1.8 16.2 15.5 28.5 31.8 28.5h38.7c16.3 0 30-12.3 31.8-28.5L318.2 304H320c17.7 0 32-14.3 32-32V224c0-35.3-28.7-64-64-64H224zM132.3 394.2c13-2.4 21.7-14.9 19.3-27.9s-14.9-21.7-27.9-19.3c-32.4 5.9-60.9 14.2-82 24.8c-10.5 5.3-20.3 11.7-27.8 19.6C6.4 399.5 0 410.5 0 424c0 21.4 15.5 36.1 29.1 45c14.7 9.6 34.3 17.3 56.4 23.4C130.2 504.7 190.4 512 256 512s125.8-7.3 170.4-19.6c22.1-6.1 41.8-13.8 56.4-23.4c13.7-8.9 29.1-23.6 29.1-45c0-13.5-6.4-24.5-14-32.6c-7.5-7.9-17.3-14.3-27.8-19.6c-21-10.6-49.5-18.9-82-24.8c-13-2.4-25.5 6.3-27.9 19.3s6.3 25.5 19.3 27.9c30.2 5.5 53.7 12.8 69 20.5c3.2 1.6 5.8 3.1 7.9 4.5c3.6 2.4 3.6 7.2 0 9.6c-8.8 5.7-23.1 11.8-43 17.3C374.3 457 318.5 464 256 464s-118.3-7-157.7-17.9c-19.9-5.5-34.2-11.6-43-17.3c-3.6-2.4-3.6-7.2 0-9.6c2.1-1.4 4.8-2.9 7.9-4.5c15.3-7.7 38.8-14.9 69-20.5z"></path></svg>\n    ')}async switch(){await this.live2d.model.nextModel()}showLoading(){return this.live2d.model.data.length>1}}class dd extends cd{constructor(){super(...arguments),this.name="switchTexture",this.priority=32}install(){this.live2d.data.menus.includes(this.name)&&(super.install(),this._button.title="切换服装",this._button.innerHTML='\n    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M399 384.2C376.9 345.8 335.4 320 288 320H224c-47.4 0-88.9 25.8-111 64.2c35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8zM512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM256 272c39.8 0 72-32.2 72-72s-32.2-72-72-72s-72 32.2-72 72s32.2 72 72 72z"></path></svg>\n    ')}async switch(){await this.live2d.model.nextTexture()}showLoading(){return this.live2d.model.textureMaxIndex>1}}const pd={FHomePlugin:Jf,FDragPlugin:Zf,FInfoPlugin:Kf,FQuitPlugin:ld,FCapturePlugin:qf,FTipsDragPlugin:Qf,FTestFramePlugin:class extends Wf{constructor(){super(...arguments),this.name="hitFrames",this.priority=8,this._button=null,this._icons={open:"",close:""},this._func=void 0}install(){this.live2d.data.hitFrame&&(this._button=document.createElement("div"),this._button.className="live2d-menu-item live2d-flex-center",this._button.title="开启帧检测",this._icons.open='<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3-7.7 16.2-7.7 35.2 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766z"></path><path d="M508 336c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176z m0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"></path></svg>',this._icons.close='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path d="M942.3 486.4l-0.1-0.1-0.1-0.1c-36.4-76.7-80-138.7-130.7-186L760.7 351c43.7 40.2 81.5 93.7 114.1 160.9C791.5 684.2 673.4 766 512 766c-51.3 0-98.3-8.3-141.2-25.1l-54.7 54.7C374.6 823.8 439.8 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0.1-51.3zM878.3 154.2l-42.4-42.4c-3.1-3.1-8.2-3.1-11.3 0L707.8 228.5C649.4 200.2 584.2 186 512 186c-192.2 0-335.4 100.5-430.2 300.3v0.1c-7.7 16.2-7.7 35.2 0 51.5 36.4 76.7 80 138.7 130.7 186.1L111.8 824.5c-3.1 3.1-3.1 8.2 0 11.3l42.4 42.4c3.1 3.1 8.2 3.1 11.3 0l712.8-712.8c3.1-3 3.1-8.1 0-11.2zM398.9 537.4c-1.9-8.2-2.9-16.7-2.9-25.4 0-61.9 50.1-112 112-112 8.7 0 17.3 1 25.4 2.9L398.9 537.4z m184.5-184.5C560.5 342.1 535 336 508 336c-97.2 0-176 78.8-176 176 0 27 6.1 52.5 16.9 75.4L263.3 673c-43.7-40.2-81.5-93.7-114.1-160.9C232.6 339.8 350.7 258 512 258c51.3 0 98.3 8.3 141.2 25.1l-69.8 69.8z"/><path d="M508 624c-6.4 0-12.7-0.5-18.8-1.6l-51.1 51.1c21.4 9.3 45.1 14.4 69.9 14.4 97.2 0 176-78.8 176-176 0-24.8-5.1-48.5-14.4-69.9l-51.1 51.1c1 6.1 1.6 12.4 1.6 18.8C620 573.9 569.9 624 508 624z"/></svg>',this._button.innerHTML=this._icons.close,this._func=this.clickTestFrame.bind(this),this._button.addEventListener("click",this._func),this.live2d.stage.addMenu(this._button,this.priority))}uninstall(){this._button?.removeEventListener("click",this._func),this.live2d.stage.removeMenu(this._button),this._button?.remove(),this._button=null}clickTestFrame(){if(null==this._button)return;let t=/开启/.test(this._button.title);this._button.title=t?"关闭帧检测":"开启帧检测",this._button.innerHTML=t?this._icons.open:this._icons.close,t?this.live2d.model.showHitAreaFrames():this.live2d.model.hiddenHitAreaFrames()}},FSwitchModulePlugin:fd,FSwitchTexturePlugin:dd,FHourMessagePlugin:od,FMotionMessagePlugin:ad,FSeasonsMessagePlugin:hd,FTalkMessagePlugin:ud,FCopyMessagePlugin:nd,FConsoleMessagePlugin:rd,FVisibilityMessagePlugin:sd};var _d;!function(t){t.fadeIn="fadeIn",t.fadeOut="fadeOut"}(_d||(_d={}));class md extends Df{constructor(t,e=null,i=null){super(t),this._menuFunc=null,i=Of.mergeAll(i??{},{parent:this.getParentFromSelector(e)}),this._data=new Gf(i),this._menuItems=[],this.event.on($f.modelLoaded,this._onModelLoad,this),this.event.off($f.init,this.init,this),this.init()}get menuItems(){return this._menuItems}get wrapper(){return this._data.wrapper}get canvas(){return this._data.canvas}get tips(){return this._data.tips}get menus(){return this._data.menus}get other(){return this._data.other}get parent(){return this._data.parent}init(){this.wrapper.appendChild(this.canvas),this.wrapper.appendChild(this.menus),this.wrapper.appendChild(this.tips),this.wrapper.appendChild(this.other),this.parent.appendChild(this.wrapper);const{fixed:t,transitionTime:e,dockedRight:i}=this.options;let r=[t?"live2d-fixed":"live2d-relative",i?"right":""];this.wrapper.classList.add(...r,"live2d-wrapper","live2d-transition-all","live2d-opacity-0"),this.canvas.classList.add("live2d-canvas","live2d-transition-all","live2d-opacity-1"),this.tips.classList.add("live2d-tips","live2d-shake","live2d-transition-all","live2d-opacity-0"),this.menus.classList.add("live2d-menus","live2d-transition-all","live2d-opacity-0"),this.other.classList.add("live2d-other","live2d-transition-all","live2d-opacity-1"),this.canvas.style.setProperty("--live2d-duration",`${e}ms`),this._menuFunc=this._showAndHiddenMenus.bind(this),this.wrapper.addEventListener("mouseover",this._menuFunc),this.wrapper.addEventListener("mouseleave",this._menuFunc),document.addEventListener("touchstart",this._menuFunc)}destroy(){super.destroy(),this.event.removeListener($f.modelLoaded,this._onModelLoad,this);const t=this.menuItems.splice(0,this.menuItems.length);for(const e of t)e.element.remove();this.wrapper.removeEventListener("mouseover",this._menuFunc),this.wrapper.removeEventListener("mouseleave",this._menuFunc),document.removeEventListener("touchstart",this._menuFunc),this.wrapper.remove(),this._menuFunc=null,this._data=null}async fadeIn(t=null){await this._fade(t,_d.fadeIn,_d.fadeOut).catch(Of.F)}async fadeOut(t=null){await this._fade(t,_d.fadeOut,_d.fadeIn).catch(Of.F)}addMenu(t,e=2){return Of.is(HTMLElement,t)&&(this.menuItems.push({element:t,priority:e}),this.menuItems.sort((t,e)=>e.priority-t.priority),this.menus.innerHTML="",this.menus.append(...this.menuItems.map(t=>t.element))),this}removeMenu(t){const e=this.menuItems.findIndex(e=>t===e.element);return e>=0&&(this.menuItems.splice(e,1),t.remove()),this}getParentFromSelector(t=null){if(null==t)return document.body;try{let e;try{e=document.querySelector(t)}catch(i){e=document.evaluate(t,document).iterateNext()}return e??document.body}catch(t){return document.body}}getTransitionDuration(t){if(!t)return 0;let e=getComputedStyle(t).getPropertyValue("transition-duration");return Of.defaultTo(0,parseFloat(e))*(/ms/.test(e)?1:1e3)}isRight(){const t=this.wrapper,e=(Math.min(window.screen.width,window.visualViewport.width,window.innerWidth)-t.clientWidth)/2;return t.offsetLeft>e}_onModelLoad(t){this.wrapper.classList.remove("live2d-transition-all"),this.canvas.classList.remove("live2d-transition-all"),this.canvas.style.width=this.wrapper.style.width=`${t?.width??260}px`,this.canvas.style.height=this.wrapper.style.height=`${t?.height??260}px`,this.wrapper.style.backgroundColor=this.live2d.model.backgroundColor,this.isRight()?this.wrapper.classList.add("live2d-right"):this.wrapper.classList.remove("live2d-right"),this.app.resize(),this.wrapper.classList.add("live2d-transition-all"),this.canvas.classList.add("live2d-transition-all"),this.fadeIn().finally(()=>{})}_showAndHiddenMenus(t){let e="touchstart"===t.type&&this.wrapper.contains(t.touches[0].target);"mouseover"===t.type||e?this.fadeIn(this.menus).catch(Of.F):this.fadeOut(this.menus).catch(Of.F)}async _fade(t,e,i){const r={},n=t??(t=this.wrapper);n[i]?.(),n[e]?.(),n[e]=(i=!1)=>{for(const t in r)r[t]?.();n[e]=null,this.event.emit(i?$f.fadeEnd:$f.fadeCancel,t)},this.event.emit($f.fadeStart,t);let s=this.getTransitionDuration(t);async function o(t,e){await new Promise((i,n)=>{const s=setTimeout(()=>{r[e]=null,i()},t);r[e]=()=>{clearTimeout(s),n()}})}!t.classList.contains("live2d-transition-all")&&t.classList.add("live2d-transition-all"),e==_d.fadeIn?(t.classList.remove("live2d-hidden"),await o(20,"wait"),t.classList.remove("live2d-opacity-0"),t.classList.add("live2d-opacity-1"),await o(s-20,"cancel")):(t.classList.remove("live2d-opacity-1"),t.classList.add("live2d-opacity-0"),await o(s,"cancel"),t.classList.add("live2d-hidden")),n[e]?.(!0)}}class gd extends Df{get data(){return this._data}get messages(){return this._messages}get text(){return this._text}get stop(){return this._stop}get duration(){return this.data.duration}set duration(t){this.data.duration=t??3e3}get interval(){return this.data.interval}set interval(t){this.data.interval=t??5e3}}class vd extends gd{constructor(t,e=null){super(t),this._data=Of.mergeAll(new Xf,e??{}),this._messages=this._data.message?.map(t=>new Bf(t))??[],this._stop=!1,this._text="",this._showId=void 0,this._hiddenId=void 0;const i=this.live2d.stage.tips,{minWidth:r,minHeight:n,offsetX:s,offsetY:o}=this.data;i.style.minWidth=`${r}px`,i.style.minHeight=`${n}px`,i.style.setProperty("--tips-offset-x",`${s}px`),i.style.setProperty("--tips-offset-y",`${o}px`)}init(){this._hiddenId=setTimeout(this.startFade.bind(this),this.interval)}destroy(){super.destroy(),this.stopFade(),this._messages=[]}async fadeIn(t=!1){if(this.stop)return;if(t&&null!=this._showId&&this._showId>0)return;if(this._clearTime(),this.messages.length<=0||(this._text=this.getRandomMessage()).trim().length<=0)return void(this._showId=setTimeout(()=>{this._showId=void 0,this.fadeIn().catch(Of.F)},this.interval));let e=this.live2d.stage.tips;e.innerHTML=this._text,await this.live2d.stage.fadeIn(e),this._showId=setTimeout(()=>{this._showId=void 0,this.fadeOut().catch(Of.F)},this.duration)}async fadeOut(t=!1){t&&null!=this._hiddenId&&this._hiddenId>0||(this._clearTime(),await this.live2d.stage.fadeOut(this.live2d.stage.tips),this._hiddenId=setTimeout(()=>{this._hiddenId=void 0,this.fadeIn().catch(Of.F)},this.interval))}startFade(){this._stop=!1,this.fadeIn().catch(Of.F)}stopFade(){this.fadeOut().catch(Of.F),this._stop=!0}async notify(t){const e=new Bf;e.text=this._text=t,e.priority=99999,this.addMessage(e),await this.fadeIn().catch(Of.F).finally(()=>this.removeMessage(e))}addMessage(...t){return this.messages.push(...t.filter(t=>Of.is(Bf,t))),this}removeMessage(...t){for(const e of t){const t=this.messages.indexOf(e);t>=0&&this.messages.splice(t,1)}return this}getRandomMessage(){const t=this.messages.filter(t=>null==t.condition||t.condition()),e=Of.groupBy(t=>t.priority.toString(),t),i=Object.keys(e).map(t=>parseInt(t)).sort().map(t=>Array.from((t=>{let i=e[t.toString()].length;return{length:Math.ceil(i/5)+Math.max(t,0)}})(t),()=>t)).flat();if(i.length<=0)return this.text;const r=i[Of.random(0,i.length,"floor")],n=e[r],s=n[Of.random(0,n.length,"floor")];return Of.is(Array,s.text)?s.text[Of.random(0,s.text.length,"floor")]:s.text}_clearTime(){clearInterval(this._showId),clearInterval(this._hiddenId),this._showId=void 0,this._hiddenId=void 0}}class yd{get app(){return this._app}get data(){return this._data}get event(){return this._event}get plugins(){return this._plugins}get stage(){return this._stage}get model(){return this._model}get tips(){return this._tips}get ref(){return this._ref}}class bd extends yd{onModelStart(t,e,i=!1){this._onAddEvent($f.modelStart,t,e,i)}onModelLoaded(t,e,i=!1){this._onAddEvent($f.modelLoaded,t,e,i)}onModelError(t,e,i=!1){this._onAddEvent($f.modelError,t,e,i)}onFadeStart(t,e,i=!1){this._onAddEvent($f.fadeStart,t,e,i)}onFadeEnd(t,e,i=!1){this._onAddEvent($f.fadeEnd,t,e,i)}onFadeCancel(t,e,i=!1){this._onAddEvent($f.fadeCancel,t,e,i)}onMotionStart(t,e,i=!1){this._onAddEvent($f.motionStart,t,e,i)}onMotionFinish(t,e,i=!1){this._onAddEvent($f.motionFinish,t,e,i)}_onAddEvent(t,e,i,r=!1){r?this.event.once(t,e,i):this.event.on(t,e,i)}}class xd extends bd{constructor(t){super(),this._data=t=new Uf(t),this._event=new Yf,this._ref={},this._stage=new md(this,t.selector),this._model=new Hf(this,t.models),this._tips=new vd(this,t.tips),this._plugins=t.plugins?.filter(t=>Of.is(Wf,t))??[],this._app=new wc({view:this._stage.canvas,backgroundAlpha:0,backgroundColor:0,resolution:2,autoStart:!0,autoDensity:!0,resizeTo:this._stage.wrapper}),this.init()}static create(t=null){return new xd(Of.mergeAll(zf,t))}installPlugin(...t){const e=this.plugins.reduce((t,e)=>(t[e.name]=e.name,t),{});t=t.filter(t=>Of.is(Wf,t)&&!e[t.name]).sort(i),this.plugins.push(...t),this.plugins.sort(i);for(const e of t)Wf.setContext(e,this),e.install();function i(t,e){return e.priority-t.priority}}uninstallPlugin(...t){for(const e of t){const t=this.plugins.indexOf(e);t<0||(e.uninstall(),Wf.setContext(e,null),this.plugins.splice(t,1))}}init(){let t=this.plugins.splice(0,this.plugins.length);t.push(...Object.values(pd).map(t=>new t)),this.installPlugin(...t),this._data.sayHello&&Of.sayHello(),this._event.emit($f.init)}destroy(){const t=this.plugins;this.uninstallPlugin(...t),t.splice(0,t.length),this.app.renderer.destroy(!0),this.event.emit($f.destroy)}}!function(t,e){void 0===e&&(e={});var i=e.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}}(":root{--tips-bg:#58b0fc;--tips-color:#fff;--tips-shadow:#999;--tips-border-color:#fff;--tips-offset-x:0px;--tips-offset-y:0px;--tips-translate:translate(-50%,-100%);--tips-translate-to:translate(-50%,-105%);--menu-item:pink;--menu-item-hover:#43b1ee;--live2d-duration:500ms;--live2d-anim-duration:1000ms;--live2d-tips-duration:calc(var(--live2d-duration)*2);--toggle-bg:#fa0;--toggle-pos-start:-35px;--toggle-pos-end:-20px;--tips-anim-shake:live2d-shake}.live2d-hidden{display:none}.live2d-fixed{position:fixed}.live2d-relative{position:relative}.live2d-opacity-1{opacity:1;visibility:visible}.live2d-opacity-0{opacity:0;visibility:hidden}.live2d-cursor-default{cursor:default}.live2d-cursor-pointer{cursor:pointer}.live2d-transition-all{transition-duration:var(--live2d-duration);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.live2d-flex-center{align-items:center;display:flex;justify-content:center}.live2d-drag{transition-duration:var(--live2d-duration),0ms;transition-property:all,inset}.live2d-shake{--anim:var(--tips-anim-shake);animation-duration:var(--live2d-anim-duration);animation-fill-mode:none;animation-iteration-count:infinite;animation-name:var(--anim)}.live2d-wrapper{bottom:0;height:auto;left:0;width:-moz-min-content;width:min-content;z-index:5000}.live2d-wrapper.right{left:auto;right:0}.live2d-canvas{position:relative}.live2d-tips{--live2d-duration:var(--live2d-tips-duration);align-items:center;background-color:var(--tips-bg);border:2px solid var(--tips-border-color);border-radius:10px;color:var(--tips-color);display:flex;filter:drop-shadow(0 0 5px var(--tips-shadow));justify-content:center;left:calc(50% + var(--tips-offset-x));overflow:hidden;padding:.625em;top:calc(var(--tips-offset-y));transform:var(--tips-translate)}.live2d-menus,.live2d-tips{position:absolute;text-align:center;z-index:6000}.live2d-menus{right:0;top:10%}.live2d-menu-item{color:var(--menu-item);cursor:pointer;height:30px;width:25px}.live2d-menu-item:hover{color:var(--menu-item-hover)}.live2d-menu-item svg{fill:currentColor;height:25px}.live2d-toggle{background-color:var(--toggle-bg);border-radius:5px;bottom:66px;color:var(--tips-color);cursor:pointer;left:0;padding:5px;transform:translateX(var(--toggle-pos-start));width:60px;writing-mode:vertical-rl;z-index:4000}.live2d-toggle:hover{transform:translateX(var(--toggle-pos-end))}.live2d-toggle.live2d-right{left:auto;right:0;--toggle-pos-start:35px;--toggle-pos-end:20px;writing-mode:vertical-lr}.live2d-right .live2d-menus{left:0;right:auto}@keyframes live2d-shake{0%,to{transform:var(--tips-translate-to) scale(.99)}50%{transform:var(--tips-translate) scale(1)}}"),vs.registerTicker(oi);const Td=xd.create;window.wlLive2d=Td,window.ILive2DModel=vs,t.DEventMessage=class extends Bf{constructor(){super(...arguments),this.event=null}},t.DHourMessage=class extends Bf{constructor(){super(...arguments),this.hour=null,this.once=!0}},t.DLive2dOptions=Uf,t.DMessage=Bf,t.DModel=Nf,t.DSeasonsMessage=class extends Bf{constructor(){super(...arguments),this.date=null,this.once=!0}},t.DStage=Gf,t.DTips=Xf,t.FBasePlugin=Wf,t.FBaseSwitchPlugin=cd,t.FCapturePlugin=qf,t.FConsoleMessagePlugin=rd,t.FCopyMessagePlugin=nd,t.FDragPlugin=Zf,t.FEventMessagePlugin=ed,t.FHomePlugin=Jf,t.FHourMessagePlugin=od,t.FInfoPlugin=Kf,t.FMotionMessagePlugin=ad,t.FNullMessagePlugin=td,t.FQuitPlugin=ld,t.FSeasonsMessagePlugin=hd,t.FSwitchModulePlugin=fd,t.FSwitchTexturePlugin=dd,t.FTalkMessagePlugin=ud,t.FTipsDragPlugin=Qf,t.FVisibilityMessagePlugin=sd,t.default=Td,t.plugins=pd,t.wlLive2d=Td,Object.defineProperty(t,"__esModule",{value:!0})});