From 9f2faae4d0110edf369ef223efce68cc3762c1d7 Mon Sep 17 00:00:00 2001 From: lalalune Date: Mon, 7 Oct 2024 03:47:20 +0000 Subject: [PATCH] deploy: 2246c8a62af2b2686e6d842b72d19c057c7ebd07 --- ...{howler-6efb6bd7.js => howler-1ad5bdb0.js} | 2 +- .../{index-927f05c7.js => index-3c5be885.js} | 52 +++++++++---------- index.html | 2 +- 3 files changed, 28 insertions(+), 28 deletions(-) rename assets/{howler-6efb6bd7.js => howler-1ad5bdb0.js} (99%) rename assets/{index-927f05c7.js => index-3c5be885.js} (95%) diff --git a/assets/howler-6efb6bd7.js b/assets/howler-1ad5bdb0.js similarity index 99% rename from assets/howler-6efb6bd7.js rename to assets/howler-1ad5bdb0.js index f23b4ed9..616c89df 100644 --- a/assets/howler-6efb6bd7.js +++ b/assets/howler-1ad5bdb0.js @@ -1,4 +1,4 @@ -import{g as L,c as S}from"./index-927f05c7.js";function D(b,g){for(var r=0;ru[i]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var O={};/*! +import{g as L,c as S}from"./index-3c5be885.js";function D(b,g){for(var r=0;ru[i]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var O={};/*! * howler.js v2.2.3 * howlerjs.com * diff --git a/assets/index-927f05c7.js b/assets/index-3c5be885.js similarity index 95% rename from assets/index-927f05c7.js rename to assets/index-3c5be885.js index 22872a0b..71c21bbf 100644 --- a/assets/index-927f05c7.js +++ b/assets/index-3c5be885.js @@ -14,14 +14,14 @@ var Ez=Object.defineProperty;var _z=(n,e,t)=>e in n?Ez(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Jz=Be,Hz=Symbol.for("react.element"),zz=Symbol.for("react.fragment"),Yz=Object.prototype.hasOwnProperty,Xz=Jz.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,jz={key:!0,ref:!0,__self:!0,__source:!0};function ZV(n,e,t){var r,i={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)Yz.call(e,r)&&!jz.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Hz,type:n,key:s,ref:o,props:i,_owner:Xz.current}}BC.Fragment=zz;BC.jsx=ZV;BC.jsxs=ZV;NV.exports=BC;var L=NV.exports,$_={exports:{}};const Kz={},$z=Object.freeze(Object.defineProperty({__proto__:null,default:Kz},Symbol.toStringTag,{value:"Module"})),qz=Sz($z);$_.exports;(function(n){(function(e,t){function r(U,y){if(!U)throw new Error(y||"Assertion failed")}function i(U,y){U.super_=y;var I=function(){};I.prototype=y.prototype,U.prototype=new I,U.prototype.constructor=U}function s(U,y,I){if(s.isBN(U))return U;this.negative=0,this.words=null,this.length=0,this.red=null,U!==null&&((y==="le"||y==="be")&&(I=y,y=10),this._init(U||0,y||10,I||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=qz.Buffer}catch{}s.isBN=function(y){return y instanceof s?!0:y!==null&&typeof y=="object"&&y.constructor.wordSize===s.wordSize&&Array.isArray(y.words)},s.max=function(y,I){return y.cmp(I)>0?y:I},s.min=function(y,I){return y.cmp(I)<0?y:I},s.prototype._init=function(y,I,R){if(typeof y=="number")return this._initNumber(y,I,R);if(typeof y=="object")return this._initArray(y,I,R);I==="hex"&&(I=16),r(I===(I|0)&&I>=2&&I<=36),y=y.toString().replace(/\s+/g,"");var N=0;y[0]==="-"&&(N++,this.negative=1),N=0;N-=3)V=y[N]|y[N-1]<<8|y[N-2]<<16,this.words[k]|=V<>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);else if(R==="le")for(N=0,k=0;N>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);return this._strip()};function a(U,y){var I=U.charCodeAt(y);if(I>=48&&I<=57)return I-48;if(I>=65&&I<=70)return I-55;if(I>=97&&I<=102)return I-87;r(!1,"Invalid character in "+U)}function l(U,y,I){var R=a(U,I);return I-1>=y&&(R|=a(U,I-1)<<4),R}s.prototype._parseHex=function(y,I,R){this.length=Math.ceil((y.length-I)/6),this.words=new Array(this.length);for(var N=0;N=I;N-=2)G=l(y,I,N)<=18?(k-=18,V+=1,this.words[V]|=G>>>26):k+=8;else{var D=y.length-I;for(N=D%2===0?I+1:I;N=18?(k-=18,V+=1,this.words[V]|=G>>>26):k+=8}this._strip()};function A(U,y,I,R){for(var N=0,k=0,V=Math.min(U.length,I),G=y;G=49?k=D-49+10:D>=17?k=D-17+10:k=D,r(D>=0&&k1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(y,I){y=y||10,I=I|0||1;var R;if(y===16||y==="hex"){R="";for(var N=0,k=0,V=0;V>>24-N&16777215,N+=2,N>=26&&(N-=26,V--),k!==0||V!==this.length-1?R=h[6-D.length]+D+R:R=D+R}for(k!==0&&(R=k.toString(16)+R);R.length%I!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}if(y===(y|0)&&y>=2&&y<=36){var E=d[y],z=p[y];R="";var re=this.clone();for(re.negative=0;!re.isZero();){var T=re.modrn(z).toString(y);re=re.idivn(z),re.isZero()?R=T+R:R=h[E-T.length]+T+R}for(this.isZero()&&(R="0"+R);R.length%I!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(y,I){return this.toArrayLike(o,y,I)}),s.prototype.toArray=function(y,I){return this.toArrayLike(Array,y,I)};var f=function(y,I){return y.allocUnsafe?y.allocUnsafe(I):new y(I)};s.prototype.toArrayLike=function(y,I,R){this._strip();var N=this.byteLength(),k=R||Math.max(1,N);r(N<=k,"byte array longer than desired length"),r(k>0,"Requested array length <= 0");var V=f(y,k),G=I==="le"?"LE":"BE";return this["_toArrayLike"+G](V,N),V},s.prototype._toArrayLikeLE=function(y,I){for(var R=0,N=0,k=0,V=0;k>8&255),R>16&255),V===6?(R>24&255),N=0,V=0):(N=G>>>24,V+=2)}if(R=0&&(y[R--]=G>>8&255),R>=0&&(y[R--]=G>>16&255),V===6?(R>=0&&(y[R--]=G>>24&255),N=0,V=0):(N=G>>>24,V+=2)}if(R>=0)for(y[R--]=N;R>=0;)y[R--]=0},Math.clz32?s.prototype._countBits=function(y){return 32-Math.clz32(y)}:s.prototype._countBits=function(y){var I=y,R=0;return I>=4096&&(R+=13,I>>>=13),I>=64&&(R+=7,I>>>=7),I>=8&&(R+=4,I>>>=4),I>=2&&(R+=2,I>>>=2),R+I},s.prototype._zeroBits=function(y){if(y===0)return 26;var I=y,R=0;return I&8191||(R+=13,I>>>=13),I&127||(R+=7,I>>>=7),I&15||(R+=4,I>>>=4),I&3||(R+=2,I>>>=2),I&1||R++,R},s.prototype.bitLength=function(){var y=this.words[this.length-1],I=this._countBits(y);return(this.length-1)*26+I};function g(U){for(var y=new Array(U.bitLength()),I=0;I>>N&1}return y}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,I=0;Iy.length?this.clone().ior(y):y.clone().ior(this)},s.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},s.prototype.iuand=function(y){var I;this.length>y.length?I=y:I=this;for(var R=0;Ry.length?this.clone().iand(y):y.clone().iand(this)},s.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},s.prototype.iuxor=function(y){var I,R;this.length>y.length?(I=this,R=y):(I=y,R=this);for(var N=0;Ny.length?this.clone().ixor(y):y.clone().ixor(this)},s.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},s.prototype.inotn=function(y){r(typeof y=="number"&&y>=0);var I=Math.ceil(y/26)|0,R=y%26;this._expand(I),R>0&&I--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-R),this._strip()},s.prototype.notn=function(y){return this.clone().inotn(y)},s.prototype.setn=function(y,I){r(typeof y=="number"&&y>=0);var R=y/26|0,N=y%26;return this._expand(R+1),I?this.words[R]=this.words[R]|1<y.length?(R=this,N=y):(R=y,N=this);for(var k=0,V=0;V>>26;for(;k!==0&&V>>26;if(this.length=R.length,k!==0)this.words[this.length]=k,this.length++;else if(R!==this)for(;Vy.length?this.clone().iadd(y):y.clone().iadd(this)},s.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var I=this.iadd(y);return y.negative=1,I._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var R=this.cmp(y);if(R===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,k;R>0?(N=this,k=y):(N=y,k=this);for(var V=0,G=0;G>26,this.words[G]=I&67108863;for(;V!==0&&G>26,this.words[G]=I&67108863;if(V===0&&G>>26,re=D&67108863,T=Math.min(E,y.length-1),ee=Math.max(0,E-U.length+1);ee<=T;ee++){var pe=E-ee|0;N=U.words[pe]|0,k=y.words[ee]|0,V=N*k+re,z+=V/67108864|0,re=V&67108863}I.words[E]=re|0,D=z|0}return D!==0?I.words[E]=D|0:I.length--,I._strip()}var v=function(y,I,R){var N=y.words,k=I.words,V=R.words,G=0,D,E,z,re=N[0]|0,T=re&8191,ee=re>>>13,pe=N[1]|0,de=pe&8191,Ae=pe>>>13,$=N[2]|0,ce=$&8191,ge=$>>>13,Fe=N[3]|0,P=Fe&8191,fe=Fe>>>13,ue=N[4]|0,q=ue&8191,K=ue>>>13,oe=N[5]|0,ye=oe&8191,be=oe>>>13,W=N[6]|0,H=W&8191,ie=W>>>13,ae=N[7]|0,me=ae&8191,J=ae>>>13,Q=N[8]|0,S=Q&8191,Z=Q>>>13,te=N[9]|0,le=te&8191,se=te>>>13,Ue=k[0]|0,_e=Ue&8191,Te=Ue>>>13,Pe=k[1]|0,ke=Pe&8191,he=Pe>>>13,Ee=k[2]|0,Se=Ee&8191,Re=Ee>>>13,Je=k[3]|0,qe=Je&8191,dt=Je>>>13,cn=k[4]|0,Et=cn&8191,st=cn>>>13,Ar=k[5]|0,wt=Ar&8191,qt=Ar>>>13,co=k[6]|0,Yt=co&8191,en=co>>>13,ne=k[7]|0,ve=ne&8191,xe=ne>>>13,Ce=k[8]|0,Ie=Ce&8191,We=Ce>>>13,lt=k[9]|0,$e=lt&8191,je=lt>>>13;R.negative=y.negative^I.negative,R.length=19,D=Math.imul(T,_e),E=Math.imul(T,Te),E=E+Math.imul(ee,_e)|0,z=Math.imul(ee,Te);var Bt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,D=Math.imul(de,_e),E=Math.imul(de,Te),E=E+Math.imul(Ae,_e)|0,z=Math.imul(Ae,Te),D=D+Math.imul(T,ke)|0,E=E+Math.imul(T,he)|0,E=E+Math.imul(ee,ke)|0,z=z+Math.imul(ee,he)|0;var pt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(pt>>>26)|0,pt&=67108863,D=Math.imul(ce,_e),E=Math.imul(ce,Te),E=E+Math.imul(ge,_e)|0,z=Math.imul(ge,Te),D=D+Math.imul(de,ke)|0,E=E+Math.imul(de,he)|0,E=E+Math.imul(Ae,ke)|0,z=z+Math.imul(Ae,he)|0,D=D+Math.imul(T,Se)|0,E=E+Math.imul(T,Re)|0,E=E+Math.imul(ee,Se)|0,z=z+Math.imul(ee,Re)|0;var yt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(yt>>>26)|0,yt&=67108863,D=Math.imul(P,_e),E=Math.imul(P,Te),E=E+Math.imul(fe,_e)|0,z=Math.imul(fe,Te),D=D+Math.imul(ce,ke)|0,E=E+Math.imul(ce,he)|0,E=E+Math.imul(ge,ke)|0,z=z+Math.imul(ge,he)|0,D=D+Math.imul(de,Se)|0,E=E+Math.imul(de,Re)|0,E=E+Math.imul(Ae,Se)|0,z=z+Math.imul(Ae,Re)|0,D=D+Math.imul(T,qe)|0,E=E+Math.imul(T,dt)|0,E=E+Math.imul(ee,qe)|0,z=z+Math.imul(ee,dt)|0;var zt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(zt>>>26)|0,zt&=67108863,D=Math.imul(q,_e),E=Math.imul(q,Te),E=E+Math.imul(K,_e)|0,z=Math.imul(K,Te),D=D+Math.imul(P,ke)|0,E=E+Math.imul(P,he)|0,E=E+Math.imul(fe,ke)|0,z=z+Math.imul(fe,he)|0,D=D+Math.imul(ce,Se)|0,E=E+Math.imul(ce,Re)|0,E=E+Math.imul(ge,Se)|0,z=z+Math.imul(ge,Re)|0,D=D+Math.imul(de,qe)|0,E=E+Math.imul(de,dt)|0,E=E+Math.imul(Ae,qe)|0,z=z+Math.imul(Ae,dt)|0,D=D+Math.imul(T,Et)|0,E=E+Math.imul(T,st)|0,E=E+Math.imul(ee,Et)|0,z=z+Math.imul(ee,st)|0;var Wr=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,D=Math.imul(ye,_e),E=Math.imul(ye,Te),E=E+Math.imul(be,_e)|0,z=Math.imul(be,Te),D=D+Math.imul(q,ke)|0,E=E+Math.imul(q,he)|0,E=E+Math.imul(K,ke)|0,z=z+Math.imul(K,he)|0,D=D+Math.imul(P,Se)|0,E=E+Math.imul(P,Re)|0,E=E+Math.imul(fe,Se)|0,z=z+Math.imul(fe,Re)|0,D=D+Math.imul(ce,qe)|0,E=E+Math.imul(ce,dt)|0,E=E+Math.imul(ge,qe)|0,z=z+Math.imul(ge,dt)|0,D=D+Math.imul(de,Et)|0,E=E+Math.imul(de,st)|0,E=E+Math.imul(Ae,Et)|0,z=z+Math.imul(Ae,st)|0,D=D+Math.imul(T,wt)|0,E=E+Math.imul(T,qt)|0,E=E+Math.imul(ee,wt)|0,z=z+Math.imul(ee,qt)|0;var Wo=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Wo>>>26)|0,Wo&=67108863,D=Math.imul(H,_e),E=Math.imul(H,Te),E=E+Math.imul(ie,_e)|0,z=Math.imul(ie,Te),D=D+Math.imul(ye,ke)|0,E=E+Math.imul(ye,he)|0,E=E+Math.imul(be,ke)|0,z=z+Math.imul(be,he)|0,D=D+Math.imul(q,Se)|0,E=E+Math.imul(q,Re)|0,E=E+Math.imul(K,Se)|0,z=z+Math.imul(K,Re)|0,D=D+Math.imul(P,qe)|0,E=E+Math.imul(P,dt)|0,E=E+Math.imul(fe,qe)|0,z=z+Math.imul(fe,dt)|0,D=D+Math.imul(ce,Et)|0,E=E+Math.imul(ce,st)|0,E=E+Math.imul(ge,Et)|0,z=z+Math.imul(ge,st)|0,D=D+Math.imul(de,wt)|0,E=E+Math.imul(de,qt)|0,E=E+Math.imul(Ae,wt)|0,z=z+Math.imul(Ae,qt)|0,D=D+Math.imul(T,Yt)|0,E=E+Math.imul(T,en)|0,E=E+Math.imul(ee,Yt)|0,z=z+Math.imul(ee,en)|0;var Go=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Go>>>26)|0,Go&=67108863,D=Math.imul(me,_e),E=Math.imul(me,Te),E=E+Math.imul(J,_e)|0,z=Math.imul(J,Te),D=D+Math.imul(H,ke)|0,E=E+Math.imul(H,he)|0,E=E+Math.imul(ie,ke)|0,z=z+Math.imul(ie,he)|0,D=D+Math.imul(ye,Se)|0,E=E+Math.imul(ye,Re)|0,E=E+Math.imul(be,Se)|0,z=z+Math.imul(be,Re)|0,D=D+Math.imul(q,qe)|0,E=E+Math.imul(q,dt)|0,E=E+Math.imul(K,qe)|0,z=z+Math.imul(K,dt)|0,D=D+Math.imul(P,Et)|0,E=E+Math.imul(P,st)|0,E=E+Math.imul(fe,Et)|0,z=z+Math.imul(fe,st)|0,D=D+Math.imul(ce,wt)|0,E=E+Math.imul(ce,qt)|0,E=E+Math.imul(ge,wt)|0,z=z+Math.imul(ge,qt)|0,D=D+Math.imul(de,Yt)|0,E=E+Math.imul(de,en)|0,E=E+Math.imul(Ae,Yt)|0,z=z+Math.imul(Ae,en)|0,D=D+Math.imul(T,ve)|0,E=E+Math.imul(T,xe)|0,E=E+Math.imul(ee,ve)|0,z=z+Math.imul(ee,xe)|0;var bi=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(bi>>>26)|0,bi&=67108863,D=Math.imul(S,_e),E=Math.imul(S,Te),E=E+Math.imul(Z,_e)|0,z=Math.imul(Z,Te),D=D+Math.imul(me,ke)|0,E=E+Math.imul(me,he)|0,E=E+Math.imul(J,ke)|0,z=z+Math.imul(J,he)|0,D=D+Math.imul(H,Se)|0,E=E+Math.imul(H,Re)|0,E=E+Math.imul(ie,Se)|0,z=z+Math.imul(ie,Re)|0,D=D+Math.imul(ye,qe)|0,E=E+Math.imul(ye,dt)|0,E=E+Math.imul(be,qe)|0,z=z+Math.imul(be,dt)|0,D=D+Math.imul(q,Et)|0,E=E+Math.imul(q,st)|0,E=E+Math.imul(K,Et)|0,z=z+Math.imul(K,st)|0,D=D+Math.imul(P,wt)|0,E=E+Math.imul(P,qt)|0,E=E+Math.imul(fe,wt)|0,z=z+Math.imul(fe,qt)|0,D=D+Math.imul(ce,Yt)|0,E=E+Math.imul(ce,en)|0,E=E+Math.imul(ge,Yt)|0,z=z+Math.imul(ge,en)|0,D=D+Math.imul(de,ve)|0,E=E+Math.imul(de,xe)|0,E=E+Math.imul(Ae,ve)|0,z=z+Math.imul(Ae,xe)|0,D=D+Math.imul(T,Ie)|0,E=E+Math.imul(T,We)|0,E=E+Math.imul(ee,Ie)|0,z=z+Math.imul(ee,We)|0;var Pt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,D=Math.imul(le,_e),E=Math.imul(le,Te),E=E+Math.imul(se,_e)|0,z=Math.imul(se,Te),D=D+Math.imul(S,ke)|0,E=E+Math.imul(S,he)|0,E=E+Math.imul(Z,ke)|0,z=z+Math.imul(Z,he)|0,D=D+Math.imul(me,Se)|0,E=E+Math.imul(me,Re)|0,E=E+Math.imul(J,Se)|0,z=z+Math.imul(J,Re)|0,D=D+Math.imul(H,qe)|0,E=E+Math.imul(H,dt)|0,E=E+Math.imul(ie,qe)|0,z=z+Math.imul(ie,dt)|0,D=D+Math.imul(ye,Et)|0,E=E+Math.imul(ye,st)|0,E=E+Math.imul(be,Et)|0,z=z+Math.imul(be,st)|0,D=D+Math.imul(q,wt)|0,E=E+Math.imul(q,qt)|0,E=E+Math.imul(K,wt)|0,z=z+Math.imul(K,qt)|0,D=D+Math.imul(P,Yt)|0,E=E+Math.imul(P,en)|0,E=E+Math.imul(fe,Yt)|0,z=z+Math.imul(fe,en)|0,D=D+Math.imul(ce,ve)|0,E=E+Math.imul(ce,xe)|0,E=E+Math.imul(ge,ve)|0,z=z+Math.imul(ge,xe)|0,D=D+Math.imul(de,Ie)|0,E=E+Math.imul(de,We)|0,E=E+Math.imul(Ae,Ie)|0,z=z+Math.imul(Ae,We)|0,D=D+Math.imul(T,$e)|0,E=E+Math.imul(T,je)|0,E=E+Math.imul(ee,$e)|0,z=z+Math.imul(ee,je)|0;var Zo=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Zo>>>26)|0,Zo&=67108863,D=Math.imul(le,ke),E=Math.imul(le,he),E=E+Math.imul(se,ke)|0,z=Math.imul(se,he),D=D+Math.imul(S,Se)|0,E=E+Math.imul(S,Re)|0,E=E+Math.imul(Z,Se)|0,z=z+Math.imul(Z,Re)|0,D=D+Math.imul(me,qe)|0,E=E+Math.imul(me,dt)|0,E=E+Math.imul(J,qe)|0,z=z+Math.imul(J,dt)|0,D=D+Math.imul(H,Et)|0,E=E+Math.imul(H,st)|0,E=E+Math.imul(ie,Et)|0,z=z+Math.imul(ie,st)|0,D=D+Math.imul(ye,wt)|0,E=E+Math.imul(ye,qt)|0,E=E+Math.imul(be,wt)|0,z=z+Math.imul(be,qt)|0,D=D+Math.imul(q,Yt)|0,E=E+Math.imul(q,en)|0,E=E+Math.imul(K,Yt)|0,z=z+Math.imul(K,en)|0,D=D+Math.imul(P,ve)|0,E=E+Math.imul(P,xe)|0,E=E+Math.imul(fe,ve)|0,z=z+Math.imul(fe,xe)|0,D=D+Math.imul(ce,Ie)|0,E=E+Math.imul(ce,We)|0,E=E+Math.imul(ge,Ie)|0,z=z+Math.imul(ge,We)|0,D=D+Math.imul(de,$e)|0,E=E+Math.imul(de,je)|0,E=E+Math.imul(Ae,$e)|0,z=z+Math.imul(Ae,je)|0;var yn=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(yn>>>26)|0,yn&=67108863,D=Math.imul(le,Se),E=Math.imul(le,Re),E=E+Math.imul(se,Se)|0,z=Math.imul(se,Re),D=D+Math.imul(S,qe)|0,E=E+Math.imul(S,dt)|0,E=E+Math.imul(Z,qe)|0,z=z+Math.imul(Z,dt)|0,D=D+Math.imul(me,Et)|0,E=E+Math.imul(me,st)|0,E=E+Math.imul(J,Et)|0,z=z+Math.imul(J,st)|0,D=D+Math.imul(H,wt)|0,E=E+Math.imul(H,qt)|0,E=E+Math.imul(ie,wt)|0,z=z+Math.imul(ie,qt)|0,D=D+Math.imul(ye,Yt)|0,E=E+Math.imul(ye,en)|0,E=E+Math.imul(be,Yt)|0,z=z+Math.imul(be,en)|0,D=D+Math.imul(q,ve)|0,E=E+Math.imul(q,xe)|0,E=E+Math.imul(K,ve)|0,z=z+Math.imul(K,xe)|0,D=D+Math.imul(P,Ie)|0,E=E+Math.imul(P,We)|0,E=E+Math.imul(fe,Ie)|0,z=z+Math.imul(fe,We)|0,D=D+Math.imul(ce,$e)|0,E=E+Math.imul(ce,je)|0,E=E+Math.imul(ge,$e)|0,z=z+Math.imul(ge,je)|0;var Gr=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,D=Math.imul(le,qe),E=Math.imul(le,dt),E=E+Math.imul(se,qe)|0,z=Math.imul(se,dt),D=D+Math.imul(S,Et)|0,E=E+Math.imul(S,st)|0,E=E+Math.imul(Z,Et)|0,z=z+Math.imul(Z,st)|0,D=D+Math.imul(me,wt)|0,E=E+Math.imul(me,qt)|0,E=E+Math.imul(J,wt)|0,z=z+Math.imul(J,qt)|0,D=D+Math.imul(H,Yt)|0,E=E+Math.imul(H,en)|0,E=E+Math.imul(ie,Yt)|0,z=z+Math.imul(ie,en)|0,D=D+Math.imul(ye,ve)|0,E=E+Math.imul(ye,xe)|0,E=E+Math.imul(be,ve)|0,z=z+Math.imul(be,xe)|0,D=D+Math.imul(q,Ie)|0,E=E+Math.imul(q,We)|0,E=E+Math.imul(K,Ie)|0,z=z+Math.imul(K,We)|0,D=D+Math.imul(P,$e)|0,E=E+Math.imul(P,je)|0,E=E+Math.imul(fe,$e)|0,z=z+Math.imul(fe,je)|0;var Is=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Is>>>26)|0,Is&=67108863,D=Math.imul(le,Et),E=Math.imul(le,st),E=E+Math.imul(se,Et)|0,z=Math.imul(se,st),D=D+Math.imul(S,wt)|0,E=E+Math.imul(S,qt)|0,E=E+Math.imul(Z,wt)|0,z=z+Math.imul(Z,qt)|0,D=D+Math.imul(me,Yt)|0,E=E+Math.imul(me,en)|0,E=E+Math.imul(J,Yt)|0,z=z+Math.imul(J,en)|0,D=D+Math.imul(H,ve)|0,E=E+Math.imul(H,xe)|0,E=E+Math.imul(ie,ve)|0,z=z+Math.imul(ie,xe)|0,D=D+Math.imul(ye,Ie)|0,E=E+Math.imul(ye,We)|0,E=E+Math.imul(be,Ie)|0,z=z+Math.imul(be,We)|0,D=D+Math.imul(q,$e)|0,E=E+Math.imul(q,je)|0,E=E+Math.imul(K,$e)|0,z=z+Math.imul(K,je)|0;var Za=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Za>>>26)|0,Za&=67108863,D=Math.imul(le,wt),E=Math.imul(le,qt),E=E+Math.imul(se,wt)|0,z=Math.imul(se,qt),D=D+Math.imul(S,Yt)|0,E=E+Math.imul(S,en)|0,E=E+Math.imul(Z,Yt)|0,z=z+Math.imul(Z,en)|0,D=D+Math.imul(me,ve)|0,E=E+Math.imul(me,xe)|0,E=E+Math.imul(J,ve)|0,z=z+Math.imul(J,xe)|0,D=D+Math.imul(H,Ie)|0,E=E+Math.imul(H,We)|0,E=E+Math.imul(ie,Ie)|0,z=z+Math.imul(ie,We)|0,D=D+Math.imul(ye,$e)|0,E=E+Math.imul(ye,je)|0,E=E+Math.imul(be,$e)|0,z=z+Math.imul(be,je)|0;var bc=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(bc>>>26)|0,bc&=67108863,D=Math.imul(le,Yt),E=Math.imul(le,en),E=E+Math.imul(se,Yt)|0,z=Math.imul(se,en),D=D+Math.imul(S,ve)|0,E=E+Math.imul(S,xe)|0,E=E+Math.imul(Z,ve)|0,z=z+Math.imul(Z,xe)|0,D=D+Math.imul(me,Ie)|0,E=E+Math.imul(me,We)|0,E=E+Math.imul(J,Ie)|0,z=z+Math.imul(J,We)|0,D=D+Math.imul(H,$e)|0,E=E+Math.imul(H,je)|0,E=E+Math.imul(ie,$e)|0,z=z+Math.imul(ie,je)|0;var cr=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(cr>>>26)|0,cr&=67108863,D=Math.imul(le,ve),E=Math.imul(le,xe),E=E+Math.imul(se,ve)|0,z=Math.imul(se,xe),D=D+Math.imul(S,Ie)|0,E=E+Math.imul(S,We)|0,E=E+Math.imul(Z,Ie)|0,z=z+Math.imul(Z,We)|0,D=D+Math.imul(me,$e)|0,E=E+Math.imul(me,je)|0,E=E+Math.imul(J,$e)|0,z=z+Math.imul(J,je)|0;var uo=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(uo>>>26)|0,uo&=67108863,D=Math.imul(le,Ie),E=Math.imul(le,We),E=E+Math.imul(se,Ie)|0,z=Math.imul(se,We),D=D+Math.imul(S,$e)|0,E=E+Math.imul(S,je)|0,E=E+Math.imul(Z,$e)|0,z=z+Math.imul(Z,je)|0;var xc=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(xc>>>26)|0,xc&=67108863,D=Math.imul(le,$e),E=Math.imul(le,je),E=E+Math.imul(se,$e)|0,z=Math.imul(se,je);var Qr=(G+D|0)+((E&8191)<<13)|0;return G=(z+(E>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,V[0]=Bt,V[1]=pt,V[2]=yt,V[3]=zt,V[4]=Wr,V[5]=Wo,V[6]=Go,V[7]=bi,V[8]=Pt,V[9]=Zo,V[10]=yn,V[11]=Gr,V[12]=Is,V[13]=Za,V[14]=bc,V[15]=cr,V[16]=uo,V[17]=xc,V[18]=Qr,G!==0&&(V[19]=G,R.length++),R};Math.imul||(v=m);function w(U,y,I){I.negative=y.negative^U.negative,I.length=U.length+y.length;for(var R=0,N=0,k=0;k>>26)|0,N+=V>>>26,V&=67108863}I.words[k]=G,R=V,V=N}return R!==0?I.words[k]=R:I.length--,I._strip()}function B(U,y,I){return w(U,y,I)}s.prototype.mulTo=function(y,I){var R,N=this.length+y.length;return this.length===10&&y.length===10?R=v(this,y,I):N<63?R=m(this,y,I):N<1024?R=w(this,y,I):R=B(this,y,I),R},s.prototype.mul=function(y){var I=new s(null);return I.words=new Array(this.length+y.length),this.mulTo(y,I)},s.prototype.mulf=function(y){var I=new s(null);return I.words=new Array(this.length+y.length),B(this,y,I)},s.prototype.imul=function(y){return this.clone().mulTo(y,this)},s.prototype.imuln=function(y){var I=y<0;I&&(y=-y),r(typeof y=="number"),r(y<67108864);for(var R=0,N=0;N>=26,R+=k/67108864|0,R+=V>>>26,this.words[N]=V&67108863}return R!==0&&(this.words[N]=R,this.length++),I?this.ineg():this},s.prototype.muln=function(y){return this.clone().imuln(y)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(y){var I=g(y);if(I.length===0)return new s(1);for(var R=this,N=0;N=0);var I=y%26,R=(y-I)/26,N=67108863>>>26-I<<26-I,k;if(I!==0){var V=0;for(k=0;k>>26-I}V&&(this.words[k]=V,this.length++)}if(R!==0){for(k=this.length-1;k>=0;k--)this.words[k+R]=this.words[k];for(k=0;k=0);var N;I?N=(I-I%26)/26:N=0;var k=y%26,V=Math.min((y-k)/26,this.length),G=67108863^67108863>>>k<V)for(this.length-=V,E=0;E=0&&(z!==0||E>=N);E--){var re=this.words[E]|0;this.words[E]=z<<26-k|re>>>k,z=re&G}return D&&z!==0&&(D.words[D.length++]=z),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(y,I,R){return r(this.negative===0),this.iushrn(y,I,R)},s.prototype.shln=function(y){return this.clone().ishln(y)},s.prototype.ushln=function(y){return this.clone().iushln(y)},s.prototype.shrn=function(y){return this.clone().ishrn(y)},s.prototype.ushrn=function(y){return this.clone().iushrn(y)},s.prototype.testn=function(y){r(typeof y=="number"&&y>=0);var I=y%26,R=(y-I)/26,N=1<=0);var I=y%26,R=(y-I)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=R)return this;if(I!==0&&R++,this.length=Math.min(R,this.length),I!==0){var N=67108863^67108863>>>I<=67108864;I++)this.words[I]-=67108864,I===this.length-1?this.words[I+1]=1:this.words[I+1]++;return this.length=Math.max(this.length,I+1),this},s.prototype.isubn=function(y){if(r(typeof y=="number"),r(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var I=0;I>26)-(D/67108864|0),this.words[k+R]=V&67108863}for(;k>26,this.words[k+R]=V&67108863;if(G===0)return this._strip();for(r(G===-1),G=0,k=0;k>26,this.words[k]=V&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(y,I){var R=this.length-y.length,N=this.clone(),k=y,V=k.words[k.length-1]|0,G=this._countBits(V);R=26-G,R!==0&&(k=k.ushln(R),N.iushln(R),V=k.words[k.length-1]|0);var D=N.length-k.length,E;if(I!=="mod"){E=new s(null),E.length=D+1,E.words=new Array(E.length);for(var z=0;z=0;T--){var ee=(N.words[k.length+T]|0)*67108864+(N.words[k.length+T-1]|0);for(ee=Math.min(ee/V|0,67108863),N._ishlnsubmul(k,ee,T);N.negative!==0;)ee--,N.negative=0,N._ishlnsubmul(k,1,T),N.isZero()||(N.negative^=1);E&&(E.words[T]=ee)}return E&&E._strip(),N._strip(),I!=="div"&&R!==0&&N.iushrn(R),{div:E||null,mod:N}},s.prototype.divmod=function(y,I,R){if(r(!y.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var N,k,V;return this.negative!==0&&y.negative===0?(V=this.neg().divmod(y,I),I!=="mod"&&(N=V.div.neg()),I!=="div"&&(k=V.mod.neg(),R&&k.negative!==0&&k.iadd(y)),{div:N,mod:k}):this.negative===0&&y.negative!==0?(V=this.divmod(y.neg(),I),I!=="mod"&&(N=V.div.neg()),{div:N,mod:V.mod}):this.negative&y.negative?(V=this.neg().divmod(y.neg(),I),I!=="div"&&(k=V.mod.neg(),R&&k.negative!==0&&k.isub(y)),{div:V.div,mod:k}):y.length>this.length||this.cmp(y)<0?{div:new s(0),mod:this}:y.length===1?I==="div"?{div:this.divn(y.words[0]),mod:null}:I==="mod"?{div:null,mod:new s(this.modrn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new s(this.modrn(y.words[0]))}:this._wordDiv(y,I)},s.prototype.div=function(y){return this.divmod(y,"div",!1).div},s.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},s.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},s.prototype.divRound=function(y){var I=this.divmod(y);if(I.mod.isZero())return I.div;var R=I.div.negative!==0?I.mod.isub(y):I.mod,N=y.ushrn(1),k=y.andln(1),V=R.cmp(N);return V<0||k===1&&V===0?I.div:I.div.negative!==0?I.div.isubn(1):I.div.iaddn(1)},s.prototype.modrn=function(y){var I=y<0;I&&(y=-y),r(y<=67108863);for(var R=(1<<26)%y,N=0,k=this.length-1;k>=0;k--)N=(R*N+(this.words[k]|0))%y;return I?-N:N},s.prototype.modn=function(y){return this.modrn(y)},s.prototype.idivn=function(y){var I=y<0;I&&(y=-y),r(y<=67108863);for(var R=0,N=this.length-1;N>=0;N--){var k=(this.words[N]|0)+R*67108864;this.words[N]=k/y|0,R=k%y}return this._strip(),I?this.ineg():this},s.prototype.divn=function(y){return this.clone().idivn(y)},s.prototype.egcd=function(y){r(y.negative===0),r(!y.isZero());var I=this,R=y.clone();I.negative!==0?I=I.umod(y):I=I.clone();for(var N=new s(1),k=new s(0),V=new s(0),G=new s(1),D=0;I.isEven()&&R.isEven();)I.iushrn(1),R.iushrn(1),++D;for(var E=R.clone(),z=I.clone();!I.isZero();){for(var re=0,T=1;!(I.words[0]&T)&&re<26;++re,T<<=1);if(re>0)for(I.iushrn(re);re-- >0;)(N.isOdd()||k.isOdd())&&(N.iadd(E),k.isub(z)),N.iushrn(1),k.iushrn(1);for(var ee=0,pe=1;!(R.words[0]&pe)&&ee<26;++ee,pe<<=1);if(ee>0)for(R.iushrn(ee);ee-- >0;)(V.isOdd()||G.isOdd())&&(V.iadd(E),G.isub(z)),V.iushrn(1),G.iushrn(1);I.cmp(R)>=0?(I.isub(R),N.isub(V),k.isub(G)):(R.isub(I),V.isub(N),G.isub(k))}return{a:V,b:G,gcd:R.iushln(D)}},s.prototype._invmp=function(y){r(y.negative===0),r(!y.isZero());var I=this,R=y.clone();I.negative!==0?I=I.umod(y):I=I.clone();for(var N=new s(1),k=new s(0),V=R.clone();I.cmpn(1)>0&&R.cmpn(1)>0;){for(var G=0,D=1;!(I.words[0]&D)&&G<26;++G,D<<=1);if(G>0)for(I.iushrn(G);G-- >0;)N.isOdd()&&N.iadd(V),N.iushrn(1);for(var E=0,z=1;!(R.words[0]&z)&&E<26;++E,z<<=1);if(E>0)for(R.iushrn(E);E-- >0;)k.isOdd()&&k.iadd(V),k.iushrn(1);I.cmp(R)>=0?(I.isub(R),N.isub(k)):(R.isub(I),k.isub(N))}var re;return I.cmpn(1)===0?re=N:re=k,re.cmpn(0)<0&&re.iadd(y),re},s.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var I=this.clone(),R=y.clone();I.negative=0,R.negative=0;for(var N=0;I.isEven()&&R.isEven();N++)I.iushrn(1),R.iushrn(1);do{for(;I.isEven();)I.iushrn(1);for(;R.isEven();)R.iushrn(1);var k=I.cmp(R);if(k<0){var V=I;I=R,R=V}else if(k===0||R.cmpn(1)===0)break;I.isub(R)}while(!0);return R.iushln(N)},s.prototype.invm=function(y){return this.egcd(y).a.umod(y)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(y){return this.words[0]&y},s.prototype.bincn=function(y){r(typeof y=="number");var I=y%26,R=(y-I)/26,N=1<>>26,G&=67108863,this.words[V]=G}return k!==0&&(this.words[V]=k,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(y){var I=y<0;if(this.negative!==0&&!I)return-1;if(this.negative===0&&I)return 1;this._strip();var R;if(this.length>1)R=1;else{I&&(y=-y),r(y<=67108863,"Number is too big");var N=this.words[0]|0;R=N===y?0:Ny.length)return 1;if(this.length=0;R--){var N=this.words[R]|0,k=y.words[R]|0;if(N!==k){Nk&&(I=1);break}}return I},s.prototype.gtn=function(y){return this.cmpn(y)===1},s.prototype.gt=function(y){return this.cmp(y)===1},s.prototype.gten=function(y){return this.cmpn(y)>=0},s.prototype.gte=function(y){return this.cmp(y)>=0},s.prototype.ltn=function(y){return this.cmpn(y)===-1},s.prototype.lt=function(y){return this.cmp(y)===-1},s.prototype.lten=function(y){return this.cmpn(y)<=0},s.prototype.lte=function(y){return this.cmp(y)<=0},s.prototype.eqn=function(y){return this.cmpn(y)===0},s.prototype.eq=function(y){return this.cmp(y)===0},s.red=function(y){return new Y(y)},s.prototype.toRed=function(y){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(y){return this.red=y,this},s.prototype.forceRed=function(y){return r(!this.red,"Already a number in reduction context"),this._forceRed(y)},s.prototype.redAdd=function(y){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},s.prototype.redIAdd=function(y){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},s.prototype.redSub=function(y){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},s.prototype.redISub=function(y){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},s.prototype.redShl=function(y){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},s.prototype.redMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},s.prototype.redIMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(y){return r(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var C={k256:null,p224:null,p192:null,p25519:null};function b(U,y){this.name=U,this.p=new s(y,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}b.prototype._tmp=function(){var y=new s(null);return y.words=new Array(Math.ceil(this.n/13)),y},b.prototype.ireduce=function(y){var I=y,R;do this.split(I,this.tmp),I=this.imulK(I),I=I.iadd(this.tmp),R=I.bitLength();while(R>this.n);var N=R0?I.isub(this.p):I.strip!==void 0?I.strip():I._strip(),I},b.prototype.split=function(y,I){y.iushrn(this.n,0,I)},b.prototype.imulK=function(y){return y.imul(this.k)};function F(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(F,b),F.prototype.split=function(y,I){for(var R=4194303,N=Math.min(y.length,9),k=0;k>>22,V=G}V>>>=22,y.words[k-10]=V,V===0&&y.length>10?y.length-=10:y.length-=9},F.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var I=0,R=0;R>>=26,y.words[R]=k,I=N}return I!==0&&(y.words[y.length++]=I),y},s._prime=function(y){if(C[y])return C[y];var I;if(y==="k256")I=new F;else if(y==="p224")I=new x;else if(y==="p192")I=new _;else if(y==="p25519")I=new M;else throw new Error("Unknown prime "+y);return C[y]=I,I};function Y(U){if(typeof U=="string"){var y=s._prime(U);this.m=y.p,this.prime=y}else r(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}Y.prototype._verify1=function(y){r(y.negative===0,"red works only with positives"),r(y.red,"red works only with red numbers")},Y.prototype._verify2=function(y,I){r((y.negative|I.negative)===0,"red works only with positives"),r(y.red&&y.red===I.red,"red works only with red numbers")},Y.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):(c(y,y.umod(this.m)._forceRed(this)),y)},Y.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},Y.prototype.add=function(y,I){this._verify2(y,I);var R=y.add(I);return R.cmp(this.m)>=0&&R.isub(this.m),R._forceRed(this)},Y.prototype.iadd=function(y,I){this._verify2(y,I);var R=y.iadd(I);return R.cmp(this.m)>=0&&R.isub(this.m),R},Y.prototype.sub=function(y,I){this._verify2(y,I);var R=y.sub(I);return R.cmpn(0)<0&&R.iadd(this.m),R._forceRed(this)},Y.prototype.isub=function(y,I){this._verify2(y,I);var R=y.isub(I);return R.cmpn(0)<0&&R.iadd(this.m),R},Y.prototype.shl=function(y,I){return this._verify1(y),this.imod(y.ushln(I))},Y.prototype.imul=function(y,I){return this._verify2(y,I),this.imod(y.imul(I))},Y.prototype.mul=function(y,I){return this._verify2(y,I),this.imod(y.mul(I))},Y.prototype.isqr=function(y){return this.imul(y,y.clone())},Y.prototype.sqr=function(y){return this.mul(y,y)},Y.prototype.sqrt=function(y){if(y.isZero())return y.clone();var I=this.m.andln(3);if(r(I%2===1),I===3){var R=this.m.add(new s(1)).iushrn(2);return this.pow(y,R)}for(var N=this.m.subn(1),k=0;!N.isZero()&&N.andln(1)===0;)k++,N.iushrn(1);r(!N.isZero());var V=new s(1).toRed(this),G=V.redNeg(),D=this.m.subn(1).iushrn(1),E=this.m.bitLength();for(E=new s(2*E*E).toRed(this);this.pow(E,D).cmp(G)!==0;)E.redIAdd(G);for(var z=this.pow(E,N),re=this.pow(y,N.addn(1).iushrn(1)),T=this.pow(y,N),ee=k;T.cmp(V)!==0;){for(var pe=T,de=0;pe.cmp(V)!==0;de++)pe=pe.redSqr();r(de=0;k--){for(var z=I.words[k],re=E-1;re>=0;re--){var T=z>>re&1;if(V!==N[0]&&(V=this.sqr(V)),T===0&&G===0){D=0;continue}G<<=1,G|=T,D++,!(D!==R&&(k!==0||re!==0))&&(V=this.mul(V,N[G]),D=0,G=0)}E=26}return V},Y.prototype.convertTo=function(y){var I=y.umod(this.m);return I===y?I.clone():I},Y.prototype.convertFrom=function(y){var I=y.clone();return I.red=null,I},s.mont=function(y){return new O(y)};function O(U){Y.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(O,Y),O.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},O.prototype.convertFrom=function(y){var I=this.imod(y.mul(this.rinv));return I.red=null,I},O.prototype.imul=function(y,I){if(y.isZero()||I.isZero())return y.words[0]=0,y.length=1,y;var R=y.imul(I),N=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=R.isub(N).iushrn(this.shift),V=k;return k.cmp(this.m)>=0?V=k.isub(this.m):k.cmpn(0)<0&&(V=k.iadd(this.m)),V._forceRed(this)},O.prototype.mul=function(y,I){if(y.isZero()||I.isZero())return new s(0)._forceRed(this);var R=y.mul(I),N=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=R.isub(N).iushrn(this.shift),V=k;return k.cmp(this.m)>=0?V=k.isub(this.m):k.cmpn(0)<0&&(V=k.iadd(this.m)),V._forceRed(this)},O.prototype.invm=function(y){var I=this.imod(y._invmp(this.m).mul(this.r2));return I._forceRed(this)}})(n,pa)})($_);var e9=$_.exports;const vt=Zl(e9),t9="logger/5.7.0";let yR=!1,wR=!1;const Py={debug:1,default:2,info:2,warning:3,error:4,off:5};let BR=Py.default,jb=null;function n9(){try{const n=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{n.push(e)}}),n.length)throw new Error("missing "+n.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(n){return n.message}return null}const CR=n9();var tF;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(tF||(tF={}));var Io;(function(n){n.UNKNOWN_ERROR="UNKNOWN_ERROR",n.NOT_IMPLEMENTED="NOT_IMPLEMENTED",n.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",n.NETWORK_ERROR="NETWORK_ERROR",n.SERVER_ERROR="SERVER_ERROR",n.TIMEOUT="TIMEOUT",n.BUFFER_OVERRUN="BUFFER_OVERRUN",n.NUMERIC_FAULT="NUMERIC_FAULT",n.MISSING_NEW="MISSING_NEW",n.INVALID_ARGUMENT="INVALID_ARGUMENT",n.MISSING_ARGUMENT="MISSING_ARGUMENT",n.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",n.CALL_EXCEPTION="CALL_EXCEPTION",n.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",n.NONCE_EXPIRED="NONCE_EXPIRED",n.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",n.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",n.TRANSACTION_REPLACED="TRANSACTION_REPLACED",n.ACTION_REJECTED="ACTION_REJECTED"})(Io||(Io={}));const bR="0123456789abcdef";let we=class dr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();Py[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(BR>Py[r])&&console.log.apply(console,t)}debug(...e){this._log(dr.levels.DEBUG,e)}info(...e){this._log(dr.levels.INFO,e)}warn(...e){this._log(dr.levels.WARNING,e)}makeError(e,t,r){if(wR)return this.makeError("censored error",t,{});t||(t=dr.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(l=>{const A=r[l];try{if(A instanceof Uint8Array){let c="";for(let u=0;u>4],c+=bR[A[u]&15];i.push(l+"=Uint8Array(0x"+c+")")}else i.push(l+"="+JSON.stringify(A))}catch{i.push(l+"="+JSON.stringify(r[l].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);const s=e;let o="";switch(t){case Io.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Io.CALL_EXCEPTION:case Io.INSUFFICIENT_FUNDS:case Io.MISSING_NEW:case Io.NONCE_EXPIRED:case Io.REPLACEMENT_UNDERPRICED:case Io.TRANSACTION_REPLACED:case Io.UNPREDICTABLE_GAS_LIMIT:o=t;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=t,Object.keys(r).forEach(function(l){a[l]=r[l]}),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,dr.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,i){e||this.throwError(t,r,i)}assertArgument(e,t,r,i){e||this.throwArgumentError(t,r,i)}checkNormalize(e){CR&&this.throwError("platform missing String.prototype.normalize",dr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:CR})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,dr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,dr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",et&&this.throwError("too many arguments"+r,dr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",dr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",dr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",dr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return jb||(jb=new dr(t9)),jb}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",dr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),yR){if(!e)return;this.globalLogger().throwError("error censorship permanent",dr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}wR=!!e,yR=!!t}static setLogLevel(e){const t=Py[e.toLowerCase()];if(t==null){dr.globalLogger().warn("invalid log level - "+e);return}BR=t}static from(e){return new dr(e)}};we.errors=Io;we.levels=tF;const r9="bytes/5.7.0",Nn=new we(r9);function JV(n){return!!n.toHexString}function Mh(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return Mh(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function q_(n){return Ft(n)&&!(n.length%2)||CC(n)}function xR(n){return typeof n=="number"&&n==n&&n%1===0}function CC(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!xR(n.length)||n.length<0)return!1;for(let e=0;e=256)return!1}return!0}function At(n,e){if(e||(e={}),typeof n=="number"){Nn.checkSafeUint53(n,"invalid arrayify value");const t=[];for(;n;)t.unshift(n&255),n=parseInt(String(n/256));return t.length===0&&t.push(0),Mh(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),JV(n)&&(n=n.toHexString()),Ft(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Nn.throwArgumentError("hex data is odd-length","value",n));const r=[];for(let i=0;iAt(i)),t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t);return e.reduce((i,s)=>(r.set(s,i),i+s.length),0),Mh(r)}function tf(n){let e=At(n);if(e.length===0)return e;let t=0;for(;te&&Nn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),Mh(t)}function Ft(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const Kb="0123456789abcdef";function nt(n,e){if(e||(e={}),typeof n=="number"){Nn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=Kb[n&15]+t,n=Math.floor(n/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof n=="bigint")return n=n.toString(16),n.length%2?"0x0"+n:"0x"+n;if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),JV(n))return n.toHexString();if(Ft(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Nn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(CC(n)){let t="0x";for(let r=0;r>4]+Kb[i&15]}return t}return Nn.throwArgumentError("invalid hexlify value","value",n)}function hu(n){if(typeof n!="string")n=nt(n);else if(!Ft(n)||n.length%2)return null;return(n.length-2)/2}function zr(n,e,t){return typeof n!="string"?n=nt(n):(!Ft(n)||n.length%2)&&Nn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function Si(n){let e="0x";return n.forEach(t=>{e+=nt(t).substring(2)}),e}function bC(n){const e=s9(nt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function s9(n){typeof n!="string"&&(n=nt(n)),Ft(n)||Nn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Nn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function xC(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(q_(n)){let t=At(n);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=nt(t.slice(0,32)),e.s=nt(t.slice(32,64))):t.length===65?(e.r=nt(t.slice(0,32)),e.s=nt(t.slice(32,64)),e.v=t[64]):Nn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Nn.throwArgumentError("signature invalid v byte","signature",n)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=nt(t.slice(32,64))}else{if(e.r=n.r,e.s=n.s,e.v=n.v,e.recoveryParam=n.recoveryParam,e._vs=n._vs,e._vs!=null){const i=i9(At(e._vs),32);e._vs=nt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Nn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=nt(i);e.s==null?e.s=o:e.s!==o&&Nn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Nn.throwArgumentError("signature missing v and recoveryParam","signature",n):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Nn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Ft(e.r)?Nn.throwArgumentError("signature missing or invalid r","signature",n):e.r=Pn(e.r,32),e.s==null||!Ft(e.s)?Nn.throwArgumentError("signature missing or invalid s","signature",n):e.s=Pn(e.s,32);const t=At(e.s);t[0]>=128&&Nn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=nt(t);e._vs&&(Ft(e._vs)||Nn.throwArgumentError("signature invalid _vs","signature",n),e._vs=Pn(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Nn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const o9="bignumber/5.7.0";var Qw=vt.BN;const al=new we(o9),$b={},IR=9007199254740991;let FR=!1;class Ge{constructor(e,t){e!==$b&&al.throwError("cannot call constructor directly; use BigNumber.from",we.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return xi(St(this).fromTwos(e))}toTwos(e){return xi(St(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ge.from(this._hex.substring(1)):this}add(e){return xi(St(this).add(St(e)))}sub(e){return xi(St(this).sub(St(e)))}div(e){return Ge.from(e).isZero()&&Es("division-by-zero","div"),xi(St(this).div(St(e)))}mul(e){return xi(St(this).mul(St(e)))}mod(e){const t=St(e);return t.isNeg()&&Es("division-by-zero","mod"),xi(St(this).umod(t))}pow(e){const t=St(e);return t.isNeg()&&Es("negative-power","pow"),xi(St(this).pow(t))}and(e){const t=St(e);return(this.isNegative()||t.isNeg())&&Es("unbound-bitwise-result","and"),xi(St(this).and(t))}or(e){const t=St(e);return(this.isNegative()||t.isNeg())&&Es("unbound-bitwise-result","or"),xi(St(this).or(t))}xor(e){const t=St(e);return(this.isNegative()||t.isNeg())&&Es("unbound-bitwise-result","xor"),xi(St(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Es("negative-width","mask"),xi(St(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Es("negative-width","shl"),xi(St(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Es("negative-width","shr"),xi(St(this).shrn(e))}eq(e){return St(this).eq(St(e))}lt(e){return St(this).lt(St(e))}lte(e){return St(this).lte(St(e))}gt(e){return St(this).gt(St(e))}gte(e){return St(this).gte(St(e))}isNegative(){return this._hex[0]==="-"}isZero(){return St(this).isZero()}toNumber(){try{return St(this).toNumber()}catch{Es("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return al.throwError("this platform does not support BigInt",we.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?FR||(FR=!0,al.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?al.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",we.errors.UNEXPECTED_ARGUMENT,{}):al.throwError("BigNumber.toString does not accept parameters",we.errors.UNEXPECTED_ARGUMENT,{})),St(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ge)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Ge($b,qg(e)):e.match(/^-?[0-9]+$/)?new Ge($b,qg(new Qw(e))):al.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Es("underflow","BigNumber.from",e),(e>=IR||e<=-IR)&&Es("overflow","BigNumber.from",e),Ge.from(String(e));const t=e;if(typeof t=="bigint")return Ge.from(t.toString());if(CC(t))return Ge.from(nt(t));if(t)if(t.toHexString){const r=t.toHexString();if(typeof r=="string")return Ge.from(r)}else{let r=t._hex;if(r==null&&t.type==="BigNumber"&&(r=t.hex),typeof r=="string"&&(Ft(r)||r[0]==="-"&&Ft(r.substring(1))))return Ge.from(r)}return al.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function qg(n){if(typeof n!="string")return qg(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&al.throwArgumentError("invalid hex","value",n),n=qg(n),n==="0x00"?n:"-"+n;if(n.substring(0,2)!=="0x"&&(n="0x"+n),n==="0x")return"0x00";for(n.length%2&&(n="0x0"+n.substring(2));n.length>4&&n.substring(0,4)==="0x00";)n="0x"+n.substring(4);return n}function xi(n){return Ge.from(qg(n))}function St(n){const e=Ge.from(n).toHexString();return e[0]==="-"?new Qw("-"+e.substring(3),16):new Qw(e.substring(2),16)}function Es(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),al.throwError(n,we.errors.NUMERIC_FAULT,r)}function a9(n){return new Qw(n,36).toString(16)}const l9="properties/5.7.0";var A9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Rw=new we(l9);function Me(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function ss(n,e){for(let t=0;t<32;t++){if(n[e])return n[e];if(!n.prototype||typeof n.prototype!="object")break;n=Object.getPrototypeOf(n.prototype).constructor}return null}function qn(n){return A9(this,void 0,void 0,function*(){const e=Object.keys(n).map(r=>{const i=n[r];return Promise.resolve(i).then(s=>({key:r,value:s}))});return(yield Promise.all(e)).reduce((r,i)=>(r[i.key]=i.value,r),{})})}function c9(n,e){(!n||typeof n!="object")&&Rw.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||Rw.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function xn(n){const e={};for(const t in n)e[t]=n[t];return e}const u9={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function HV(n){if(n==null||u9[typeof n])return!0;if(Array.isArray(n)||typeof n=="object"){if(!Object.isFrozen(n))return!1;const e=Object.keys(n);for(let t=0;tls(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Me(e,t,ls(r))}return e}return Rw.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function ls(n){return d9(n)}class t0{constructor(e){for(const t in e)this[t]=ls(e[t])}}const h9="abstract-provider/5.7.0";var f9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const p9=new we(h9);class g9 extends t0{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class n0{constructor(){p9.checkAbstract(new.target,n0),Me(this,"_isProvider",!0)}getFeeData(){return f9(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield qn({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let r=null,i=null,s=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,s=Ge.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:t}})}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!!(e&&e._isProvider)}}const m9="networks/5.7.1",ER=new we(m9);function v9(n){return n&&typeof n.renetwork=="function"}function hl(n){const e=function(t,r){r==null&&(r={});const i=[];if(t.InfuraProvider&&r.infura!=="-")try{i.push(new t.InfuraProvider(n,r.infura))}catch{}if(t.EtherscanProvider&&r.etherscan!=="-")try{i.push(new t.EtherscanProvider(n,r.etherscan))}catch{}if(t.AlchemyProvider&&r.alchemy!=="-")try{i.push(new t.AlchemyProvider(n,r.alchemy))}catch{}if(t.PocketProvider&&r.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(n,r.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(t.CloudflareProvider&&r.cloudflare!=="-")try{i.push(new t.CloudflareProvider(n))}catch{}if(t.AnkrProvider&&r.ankr!=="-")try{const s=["ropsten"],o=new t.AnkrProvider(n,r.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(t.FallbackProvider){let s=1;return r.quorum!=null?s=r.quorum:n==="homestead"&&(s=2),new t.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(t){return hl(t)},e}function Mw(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return Mw(n,r)},t}const _R={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:hl("homestead")},SR={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:hl("ropsten")},UR={chainId:63,name:"classicMordor",_defaultProvider:Mw("https://www.ethercluster.com/mordor","classicMordor")},L0={unspecified:{chainId:0,name:"unspecified"},homestead:_R,mainnet:_R,morden:{chainId:2,name:"morden"},ropsten:SR,testnet:SR,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:hl("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:hl("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:hl("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:hl("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Mw("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:UR,classicTestnet:UR,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Mw("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:hl("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:hl("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function zV(n){if(n==null)return null;if(typeof n=="number"){for(const r in L0){const i=L0[r];if(i.chainId===n)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:n,name:"unknown"}}if(typeof n=="string"){const r=L0[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=L0[n.name];if(!e)return typeof n.chainId!="number"&&ER.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&ER.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(v9(e._defaultProvider)?t=e._defaultProvider.renetwork(n):t=e._defaultProvider),{name:n.name,chainId:e.chainId,ensAddress:n.ensAddress||e.ensAddress||null,_defaultProvider:t}}function YV(n){n=atob(n);const e=[];for(let t=0;t0;)r.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;t[s]===0&&s=0;--s)i+=this.alphabet[r[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let t=[];if(e.length===0)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;s>0;)t.push(s&255),s>>=8}for(let r=0;e[r]===this._leader&&r0?y:I},s.min=function(y,I){return y.cmp(I)<0?y:I},s.prototype._init=function(y,I,R){if(typeof y=="number")return this._initNumber(y,I,R);if(typeof y=="object")return this._initArray(y,I,R);I==="hex"&&(I=16),r(I===(I|0)&&I>=2&&I<=36),y=y.toString().replace(/\s+/g,"");var N=0;y[0]==="-"&&(N++,this.negative=1),N=0;N-=3)L=y[N]|y[N-1]<<8|y[N-2]<<16,this.words[k]|=L<>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);else if(R==="le")for(N=0,k=0;N>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);return this._strip()};function a(U,y){var I=U.charCodeAt(y);if(I>=48&&I<=57)return I-48;if(I>=65&&I<=70)return I-55;if(I>=97&&I<=102)return I-87;r(!1,"Invalid character in "+U)}function l(U,y,I){var R=a(U,I);return I-1>=y&&(R|=a(U,I-1)<<4),R}s.prototype._parseHex=function(y,I,R){this.length=Math.ceil((y.length-I)/6),this.words=new Array(this.length);for(var N=0;N=I;N-=2)G=l(y,I,N)<=18?(k-=18,L+=1,this.words[L]|=G>>>26):k+=8;else{var D=y.length-I;for(N=D%2===0?I+1:I;N=18?(k-=18,L+=1,this.words[L]|=G>>>26):k+=8}this._strip()};function A(U,y,I,R){for(var N=0,k=0,L=Math.min(U.length,I),G=y;G=49?k=D-49+10:D>=17?k=D-17+10:k=D,r(D>=0&&k1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(y,I){y=y||10,I=I|0||1;var R;if(y===16||y==="hex"){R="";for(var N=0,k=0,L=0;L>>24-N&16777215,N+=2,N>=26&&(N-=26,L--),k!==0||L!==this.length-1?R=h[6-D.length]+D+R:R=D+R}for(k!==0&&(R=k.toString(16)+R);R.length%I!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}if(y===(y|0)&&y>=2&&y<=36){var E=d[y],z=p[y];R="";var re=this.clone();for(re.negative=0;!re.isZero();){var T=re.modrn(z).toString(y);re=re.idivn(z),re.isZero()?R=T+R:R=h[E-T.length]+T+R}for(this.isZero()&&(R="0"+R);R.length%I!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(y,I){return this.toArrayLike(o,y,I)}),s.prototype.toArray=function(y,I){return this.toArrayLike(Array,y,I)};var f=function(y,I){return y.allocUnsafe?y.allocUnsafe(I):new y(I)};s.prototype.toArrayLike=function(y,I,R){this._strip();var N=this.byteLength(),k=R||Math.max(1,N);r(N<=k,"byte array longer than desired length"),r(k>0,"Requested array length <= 0");var L=f(y,k),G=I==="le"?"LE":"BE";return this["_toArrayLike"+G](L,N),L},s.prototype._toArrayLikeLE=function(y,I){for(var R=0,N=0,k=0,L=0;k>8&255),R>16&255),L===6?(R>24&255),N=0,L=0):(N=G>>>24,L+=2)}if(R=0&&(y[R--]=G>>8&255),R>=0&&(y[R--]=G>>16&255),L===6?(R>=0&&(y[R--]=G>>24&255),N=0,L=0):(N=G>>>24,L+=2)}if(R>=0)for(y[R--]=N;R>=0;)y[R--]=0},Math.clz32?s.prototype._countBits=function(y){return 32-Math.clz32(y)}:s.prototype._countBits=function(y){var I=y,R=0;return I>=4096&&(R+=13,I>>>=13),I>=64&&(R+=7,I>>>=7),I>=8&&(R+=4,I>>>=4),I>=2&&(R+=2,I>>>=2),R+I},s.prototype._zeroBits=function(y){if(y===0)return 26;var I=y,R=0;return I&8191||(R+=13,I>>>=13),I&127||(R+=7,I>>>=7),I&15||(R+=4,I>>>=4),I&3||(R+=2,I>>>=2),I&1||R++,R},s.prototype.bitLength=function(){var y=this.words[this.length-1],I=this._countBits(y);return(this.length-1)*26+I};function g(U){for(var y=new Array(U.bitLength()),I=0;I>>N&1}return y}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,I=0;Iy.length?this.clone().ior(y):y.clone().ior(this)},s.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},s.prototype.iuand=function(y){var I;this.length>y.length?I=y:I=this;for(var R=0;Ry.length?this.clone().iand(y):y.clone().iand(this)},s.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},s.prototype.iuxor=function(y){var I,R;this.length>y.length?(I=this,R=y):(I=y,R=this);for(var N=0;Ny.length?this.clone().ixor(y):y.clone().ixor(this)},s.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},s.prototype.inotn=function(y){r(typeof y=="number"&&y>=0);var I=Math.ceil(y/26)|0,R=y%26;this._expand(I),R>0&&I--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-R),this._strip()},s.prototype.notn=function(y){return this.clone().inotn(y)},s.prototype.setn=function(y,I){r(typeof y=="number"&&y>=0);var R=y/26|0,N=y%26;return this._expand(R+1),I?this.words[R]=this.words[R]|1<y.length?(R=this,N=y):(R=y,N=this);for(var k=0,L=0;L>>26;for(;k!==0&&L>>26;if(this.length=R.length,k!==0)this.words[this.length]=k,this.length++;else if(R!==this)for(;Ly.length?this.clone().iadd(y):y.clone().iadd(this)},s.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var I=this.iadd(y);return y.negative=1,I._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var R=this.cmp(y);if(R===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,k;R>0?(N=this,k=y):(N=y,k=this);for(var L=0,G=0;G>26,this.words[G]=I&67108863;for(;L!==0&&G>26,this.words[G]=I&67108863;if(L===0&&G>>26,re=D&67108863,T=Math.min(E,y.length-1),ee=Math.max(0,E-U.length+1);ee<=T;ee++){var pe=E-ee|0;N=U.words[pe]|0,k=y.words[ee]|0,L=N*k+re,z+=L/67108864|0,re=L&67108863}I.words[E]=re|0,D=z|0}return D!==0?I.words[E]=D|0:I.length--,I._strip()}var v=function(y,I,R){var N=y.words,k=I.words,L=R.words,G=0,D,E,z,re=N[0]|0,T=re&8191,ee=re>>>13,pe=N[1]|0,de=pe&8191,Ae=pe>>>13,$=N[2]|0,ce=$&8191,ge=$>>>13,Fe=N[3]|0,P=Fe&8191,fe=Fe>>>13,ue=N[4]|0,q=ue&8191,K=ue>>>13,oe=N[5]|0,ye=oe&8191,be=oe>>>13,W=N[6]|0,H=W&8191,ie=W>>>13,ae=N[7]|0,me=ae&8191,J=ae>>>13,Q=N[8]|0,S=Q&8191,Z=Q>>>13,te=N[9]|0,le=te&8191,se=te>>>13,Ue=k[0]|0,_e=Ue&8191,Te=Ue>>>13,Pe=k[1]|0,ke=Pe&8191,he=Pe>>>13,Ee=k[2]|0,Se=Ee&8191,Re=Ee>>>13,Je=k[3]|0,qe=Je&8191,dt=Je>>>13,cn=k[4]|0,Et=cn&8191,st=cn>>>13,Ar=k[5]|0,wt=Ar&8191,qt=Ar>>>13,co=k[6]|0,Yt=co&8191,en=co>>>13,ne=k[7]|0,ve=ne&8191,xe=ne>>>13,Ce=k[8]|0,Ie=Ce&8191,We=Ce>>>13,at=k[9]|0,$e=at&8191,je=at>>>13;R.negative=y.negative^I.negative,R.length=19,D=Math.imul(T,_e),E=Math.imul(T,Te),E=E+Math.imul(ee,_e)|0,z=Math.imul(ee,Te);var Bt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,D=Math.imul(de,_e),E=Math.imul(de,Te),E=E+Math.imul(Ae,_e)|0,z=Math.imul(Ae,Te),D=D+Math.imul(T,ke)|0,E=E+Math.imul(T,he)|0,E=E+Math.imul(ee,ke)|0,z=z+Math.imul(ee,he)|0;var pt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(pt>>>26)|0,pt&=67108863,D=Math.imul(ce,_e),E=Math.imul(ce,Te),E=E+Math.imul(ge,_e)|0,z=Math.imul(ge,Te),D=D+Math.imul(de,ke)|0,E=E+Math.imul(de,he)|0,E=E+Math.imul(Ae,ke)|0,z=z+Math.imul(Ae,he)|0,D=D+Math.imul(T,Se)|0,E=E+Math.imul(T,Re)|0,E=E+Math.imul(ee,Se)|0,z=z+Math.imul(ee,Re)|0;var yt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(yt>>>26)|0,yt&=67108863,D=Math.imul(P,_e),E=Math.imul(P,Te),E=E+Math.imul(fe,_e)|0,z=Math.imul(fe,Te),D=D+Math.imul(ce,ke)|0,E=E+Math.imul(ce,he)|0,E=E+Math.imul(ge,ke)|0,z=z+Math.imul(ge,he)|0,D=D+Math.imul(de,Se)|0,E=E+Math.imul(de,Re)|0,E=E+Math.imul(Ae,Se)|0,z=z+Math.imul(Ae,Re)|0,D=D+Math.imul(T,qe)|0,E=E+Math.imul(T,dt)|0,E=E+Math.imul(ee,qe)|0,z=z+Math.imul(ee,dt)|0;var zt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(zt>>>26)|0,zt&=67108863,D=Math.imul(q,_e),E=Math.imul(q,Te),E=E+Math.imul(K,_e)|0,z=Math.imul(K,Te),D=D+Math.imul(P,ke)|0,E=E+Math.imul(P,he)|0,E=E+Math.imul(fe,ke)|0,z=z+Math.imul(fe,he)|0,D=D+Math.imul(ce,Se)|0,E=E+Math.imul(ce,Re)|0,E=E+Math.imul(ge,Se)|0,z=z+Math.imul(ge,Re)|0,D=D+Math.imul(de,qe)|0,E=E+Math.imul(de,dt)|0,E=E+Math.imul(Ae,qe)|0,z=z+Math.imul(Ae,dt)|0,D=D+Math.imul(T,Et)|0,E=E+Math.imul(T,st)|0,E=E+Math.imul(ee,Et)|0,z=z+Math.imul(ee,st)|0;var Wr=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,D=Math.imul(ye,_e),E=Math.imul(ye,Te),E=E+Math.imul(be,_e)|0,z=Math.imul(be,Te),D=D+Math.imul(q,ke)|0,E=E+Math.imul(q,he)|0,E=E+Math.imul(K,ke)|0,z=z+Math.imul(K,he)|0,D=D+Math.imul(P,Se)|0,E=E+Math.imul(P,Re)|0,E=E+Math.imul(fe,Se)|0,z=z+Math.imul(fe,Re)|0,D=D+Math.imul(ce,qe)|0,E=E+Math.imul(ce,dt)|0,E=E+Math.imul(ge,qe)|0,z=z+Math.imul(ge,dt)|0,D=D+Math.imul(de,Et)|0,E=E+Math.imul(de,st)|0,E=E+Math.imul(Ae,Et)|0,z=z+Math.imul(Ae,st)|0,D=D+Math.imul(T,wt)|0,E=E+Math.imul(T,qt)|0,E=E+Math.imul(ee,wt)|0,z=z+Math.imul(ee,qt)|0;var Wo=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Wo>>>26)|0,Wo&=67108863,D=Math.imul(H,_e),E=Math.imul(H,Te),E=E+Math.imul(ie,_e)|0,z=Math.imul(ie,Te),D=D+Math.imul(ye,ke)|0,E=E+Math.imul(ye,he)|0,E=E+Math.imul(be,ke)|0,z=z+Math.imul(be,he)|0,D=D+Math.imul(q,Se)|0,E=E+Math.imul(q,Re)|0,E=E+Math.imul(K,Se)|0,z=z+Math.imul(K,Re)|0,D=D+Math.imul(P,qe)|0,E=E+Math.imul(P,dt)|0,E=E+Math.imul(fe,qe)|0,z=z+Math.imul(fe,dt)|0,D=D+Math.imul(ce,Et)|0,E=E+Math.imul(ce,st)|0,E=E+Math.imul(ge,Et)|0,z=z+Math.imul(ge,st)|0,D=D+Math.imul(de,wt)|0,E=E+Math.imul(de,qt)|0,E=E+Math.imul(Ae,wt)|0,z=z+Math.imul(Ae,qt)|0,D=D+Math.imul(T,Yt)|0,E=E+Math.imul(T,en)|0,E=E+Math.imul(ee,Yt)|0,z=z+Math.imul(ee,en)|0;var Go=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Go>>>26)|0,Go&=67108863,D=Math.imul(me,_e),E=Math.imul(me,Te),E=E+Math.imul(J,_e)|0,z=Math.imul(J,Te),D=D+Math.imul(H,ke)|0,E=E+Math.imul(H,he)|0,E=E+Math.imul(ie,ke)|0,z=z+Math.imul(ie,he)|0,D=D+Math.imul(ye,Se)|0,E=E+Math.imul(ye,Re)|0,E=E+Math.imul(be,Se)|0,z=z+Math.imul(be,Re)|0,D=D+Math.imul(q,qe)|0,E=E+Math.imul(q,dt)|0,E=E+Math.imul(K,qe)|0,z=z+Math.imul(K,dt)|0,D=D+Math.imul(P,Et)|0,E=E+Math.imul(P,st)|0,E=E+Math.imul(fe,Et)|0,z=z+Math.imul(fe,st)|0,D=D+Math.imul(ce,wt)|0,E=E+Math.imul(ce,qt)|0,E=E+Math.imul(ge,wt)|0,z=z+Math.imul(ge,qt)|0,D=D+Math.imul(de,Yt)|0,E=E+Math.imul(de,en)|0,E=E+Math.imul(Ae,Yt)|0,z=z+Math.imul(Ae,en)|0,D=D+Math.imul(T,ve)|0,E=E+Math.imul(T,xe)|0,E=E+Math.imul(ee,ve)|0,z=z+Math.imul(ee,xe)|0;var bi=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(bi>>>26)|0,bi&=67108863,D=Math.imul(S,_e),E=Math.imul(S,Te),E=E+Math.imul(Z,_e)|0,z=Math.imul(Z,Te),D=D+Math.imul(me,ke)|0,E=E+Math.imul(me,he)|0,E=E+Math.imul(J,ke)|0,z=z+Math.imul(J,he)|0,D=D+Math.imul(H,Se)|0,E=E+Math.imul(H,Re)|0,E=E+Math.imul(ie,Se)|0,z=z+Math.imul(ie,Re)|0,D=D+Math.imul(ye,qe)|0,E=E+Math.imul(ye,dt)|0,E=E+Math.imul(be,qe)|0,z=z+Math.imul(be,dt)|0,D=D+Math.imul(q,Et)|0,E=E+Math.imul(q,st)|0,E=E+Math.imul(K,Et)|0,z=z+Math.imul(K,st)|0,D=D+Math.imul(P,wt)|0,E=E+Math.imul(P,qt)|0,E=E+Math.imul(fe,wt)|0,z=z+Math.imul(fe,qt)|0,D=D+Math.imul(ce,Yt)|0,E=E+Math.imul(ce,en)|0,E=E+Math.imul(ge,Yt)|0,z=z+Math.imul(ge,en)|0,D=D+Math.imul(de,ve)|0,E=E+Math.imul(de,xe)|0,E=E+Math.imul(Ae,ve)|0,z=z+Math.imul(Ae,xe)|0,D=D+Math.imul(T,Ie)|0,E=E+Math.imul(T,We)|0,E=E+Math.imul(ee,Ie)|0,z=z+Math.imul(ee,We)|0;var Pt=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,D=Math.imul(le,_e),E=Math.imul(le,Te),E=E+Math.imul(se,_e)|0,z=Math.imul(se,Te),D=D+Math.imul(S,ke)|0,E=E+Math.imul(S,he)|0,E=E+Math.imul(Z,ke)|0,z=z+Math.imul(Z,he)|0,D=D+Math.imul(me,Se)|0,E=E+Math.imul(me,Re)|0,E=E+Math.imul(J,Se)|0,z=z+Math.imul(J,Re)|0,D=D+Math.imul(H,qe)|0,E=E+Math.imul(H,dt)|0,E=E+Math.imul(ie,qe)|0,z=z+Math.imul(ie,dt)|0,D=D+Math.imul(ye,Et)|0,E=E+Math.imul(ye,st)|0,E=E+Math.imul(be,Et)|0,z=z+Math.imul(be,st)|0,D=D+Math.imul(q,wt)|0,E=E+Math.imul(q,qt)|0,E=E+Math.imul(K,wt)|0,z=z+Math.imul(K,qt)|0,D=D+Math.imul(P,Yt)|0,E=E+Math.imul(P,en)|0,E=E+Math.imul(fe,Yt)|0,z=z+Math.imul(fe,en)|0,D=D+Math.imul(ce,ve)|0,E=E+Math.imul(ce,xe)|0,E=E+Math.imul(ge,ve)|0,z=z+Math.imul(ge,xe)|0,D=D+Math.imul(de,Ie)|0,E=E+Math.imul(de,We)|0,E=E+Math.imul(Ae,Ie)|0,z=z+Math.imul(Ae,We)|0,D=D+Math.imul(T,$e)|0,E=E+Math.imul(T,je)|0,E=E+Math.imul(ee,$e)|0,z=z+Math.imul(ee,je)|0;var Zo=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Zo>>>26)|0,Zo&=67108863,D=Math.imul(le,ke),E=Math.imul(le,he),E=E+Math.imul(se,ke)|0,z=Math.imul(se,he),D=D+Math.imul(S,Se)|0,E=E+Math.imul(S,Re)|0,E=E+Math.imul(Z,Se)|0,z=z+Math.imul(Z,Re)|0,D=D+Math.imul(me,qe)|0,E=E+Math.imul(me,dt)|0,E=E+Math.imul(J,qe)|0,z=z+Math.imul(J,dt)|0,D=D+Math.imul(H,Et)|0,E=E+Math.imul(H,st)|0,E=E+Math.imul(ie,Et)|0,z=z+Math.imul(ie,st)|0,D=D+Math.imul(ye,wt)|0,E=E+Math.imul(ye,qt)|0,E=E+Math.imul(be,wt)|0,z=z+Math.imul(be,qt)|0,D=D+Math.imul(q,Yt)|0,E=E+Math.imul(q,en)|0,E=E+Math.imul(K,Yt)|0,z=z+Math.imul(K,en)|0,D=D+Math.imul(P,ve)|0,E=E+Math.imul(P,xe)|0,E=E+Math.imul(fe,ve)|0,z=z+Math.imul(fe,xe)|0,D=D+Math.imul(ce,Ie)|0,E=E+Math.imul(ce,We)|0,E=E+Math.imul(ge,Ie)|0,z=z+Math.imul(ge,We)|0,D=D+Math.imul(de,$e)|0,E=E+Math.imul(de,je)|0,E=E+Math.imul(Ae,$e)|0,z=z+Math.imul(Ae,je)|0;var yn=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(yn>>>26)|0,yn&=67108863,D=Math.imul(le,Se),E=Math.imul(le,Re),E=E+Math.imul(se,Se)|0,z=Math.imul(se,Re),D=D+Math.imul(S,qe)|0,E=E+Math.imul(S,dt)|0,E=E+Math.imul(Z,qe)|0,z=z+Math.imul(Z,dt)|0,D=D+Math.imul(me,Et)|0,E=E+Math.imul(me,st)|0,E=E+Math.imul(J,Et)|0,z=z+Math.imul(J,st)|0,D=D+Math.imul(H,wt)|0,E=E+Math.imul(H,qt)|0,E=E+Math.imul(ie,wt)|0,z=z+Math.imul(ie,qt)|0,D=D+Math.imul(ye,Yt)|0,E=E+Math.imul(ye,en)|0,E=E+Math.imul(be,Yt)|0,z=z+Math.imul(be,en)|0,D=D+Math.imul(q,ve)|0,E=E+Math.imul(q,xe)|0,E=E+Math.imul(K,ve)|0,z=z+Math.imul(K,xe)|0,D=D+Math.imul(P,Ie)|0,E=E+Math.imul(P,We)|0,E=E+Math.imul(fe,Ie)|0,z=z+Math.imul(fe,We)|0,D=D+Math.imul(ce,$e)|0,E=E+Math.imul(ce,je)|0,E=E+Math.imul(ge,$e)|0,z=z+Math.imul(ge,je)|0;var Gr=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,D=Math.imul(le,qe),E=Math.imul(le,dt),E=E+Math.imul(se,qe)|0,z=Math.imul(se,dt),D=D+Math.imul(S,Et)|0,E=E+Math.imul(S,st)|0,E=E+Math.imul(Z,Et)|0,z=z+Math.imul(Z,st)|0,D=D+Math.imul(me,wt)|0,E=E+Math.imul(me,qt)|0,E=E+Math.imul(J,wt)|0,z=z+Math.imul(J,qt)|0,D=D+Math.imul(H,Yt)|0,E=E+Math.imul(H,en)|0,E=E+Math.imul(ie,Yt)|0,z=z+Math.imul(ie,en)|0,D=D+Math.imul(ye,ve)|0,E=E+Math.imul(ye,xe)|0,E=E+Math.imul(be,ve)|0,z=z+Math.imul(be,xe)|0,D=D+Math.imul(q,Ie)|0,E=E+Math.imul(q,We)|0,E=E+Math.imul(K,Ie)|0,z=z+Math.imul(K,We)|0,D=D+Math.imul(P,$e)|0,E=E+Math.imul(P,je)|0,E=E+Math.imul(fe,$e)|0,z=z+Math.imul(fe,je)|0;var Is=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Is>>>26)|0,Is&=67108863,D=Math.imul(le,Et),E=Math.imul(le,st),E=E+Math.imul(se,Et)|0,z=Math.imul(se,st),D=D+Math.imul(S,wt)|0,E=E+Math.imul(S,qt)|0,E=E+Math.imul(Z,wt)|0,z=z+Math.imul(Z,qt)|0,D=D+Math.imul(me,Yt)|0,E=E+Math.imul(me,en)|0,E=E+Math.imul(J,Yt)|0,z=z+Math.imul(J,en)|0,D=D+Math.imul(H,ve)|0,E=E+Math.imul(H,xe)|0,E=E+Math.imul(ie,ve)|0,z=z+Math.imul(ie,xe)|0,D=D+Math.imul(ye,Ie)|0,E=E+Math.imul(ye,We)|0,E=E+Math.imul(be,Ie)|0,z=z+Math.imul(be,We)|0,D=D+Math.imul(q,$e)|0,E=E+Math.imul(q,je)|0,E=E+Math.imul(K,$e)|0,z=z+Math.imul(K,je)|0;var Za=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(Za>>>26)|0,Za&=67108863,D=Math.imul(le,wt),E=Math.imul(le,qt),E=E+Math.imul(se,wt)|0,z=Math.imul(se,qt),D=D+Math.imul(S,Yt)|0,E=E+Math.imul(S,en)|0,E=E+Math.imul(Z,Yt)|0,z=z+Math.imul(Z,en)|0,D=D+Math.imul(me,ve)|0,E=E+Math.imul(me,xe)|0,E=E+Math.imul(J,ve)|0,z=z+Math.imul(J,xe)|0,D=D+Math.imul(H,Ie)|0,E=E+Math.imul(H,We)|0,E=E+Math.imul(ie,Ie)|0,z=z+Math.imul(ie,We)|0,D=D+Math.imul(ye,$e)|0,E=E+Math.imul(ye,je)|0,E=E+Math.imul(be,$e)|0,z=z+Math.imul(be,je)|0;var bc=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(bc>>>26)|0,bc&=67108863,D=Math.imul(le,Yt),E=Math.imul(le,en),E=E+Math.imul(se,Yt)|0,z=Math.imul(se,en),D=D+Math.imul(S,ve)|0,E=E+Math.imul(S,xe)|0,E=E+Math.imul(Z,ve)|0,z=z+Math.imul(Z,xe)|0,D=D+Math.imul(me,Ie)|0,E=E+Math.imul(me,We)|0,E=E+Math.imul(J,Ie)|0,z=z+Math.imul(J,We)|0,D=D+Math.imul(H,$e)|0,E=E+Math.imul(H,je)|0,E=E+Math.imul(ie,$e)|0,z=z+Math.imul(ie,je)|0;var cr=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(cr>>>26)|0,cr&=67108863,D=Math.imul(le,ve),E=Math.imul(le,xe),E=E+Math.imul(se,ve)|0,z=Math.imul(se,xe),D=D+Math.imul(S,Ie)|0,E=E+Math.imul(S,We)|0,E=E+Math.imul(Z,Ie)|0,z=z+Math.imul(Z,We)|0,D=D+Math.imul(me,$e)|0,E=E+Math.imul(me,je)|0,E=E+Math.imul(J,$e)|0,z=z+Math.imul(J,je)|0;var uo=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(uo>>>26)|0,uo&=67108863,D=Math.imul(le,Ie),E=Math.imul(le,We),E=E+Math.imul(se,Ie)|0,z=Math.imul(se,We),D=D+Math.imul(S,$e)|0,E=E+Math.imul(S,je)|0,E=E+Math.imul(Z,$e)|0,z=z+Math.imul(Z,je)|0;var xc=(G+D|0)+((E&8191)<<13)|0;G=(z+(E>>>13)|0)+(xc>>>26)|0,xc&=67108863,D=Math.imul(le,$e),E=Math.imul(le,je),E=E+Math.imul(se,$e)|0,z=Math.imul(se,je);var Qr=(G+D|0)+((E&8191)<<13)|0;return G=(z+(E>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,L[0]=Bt,L[1]=pt,L[2]=yt,L[3]=zt,L[4]=Wr,L[5]=Wo,L[6]=Go,L[7]=bi,L[8]=Pt,L[9]=Zo,L[10]=yn,L[11]=Gr,L[12]=Is,L[13]=Za,L[14]=bc,L[15]=cr,L[16]=uo,L[17]=xc,L[18]=Qr,G!==0&&(L[19]=G,R.length++),R};Math.imul||(v=m);function w(U,y,I){I.negative=y.negative^U.negative,I.length=U.length+y.length;for(var R=0,N=0,k=0;k>>26)|0,N+=L>>>26,L&=67108863}I.words[k]=G,R=L,L=N}return R!==0?I.words[k]=R:I.length--,I._strip()}function B(U,y,I){return w(U,y,I)}s.prototype.mulTo=function(y,I){var R,N=this.length+y.length;return this.length===10&&y.length===10?R=v(this,y,I):N<63?R=m(this,y,I):N<1024?R=w(this,y,I):R=B(this,y,I),R},s.prototype.mul=function(y){var I=new s(null);return I.words=new Array(this.length+y.length),this.mulTo(y,I)},s.prototype.mulf=function(y){var I=new s(null);return I.words=new Array(this.length+y.length),B(this,y,I)},s.prototype.imul=function(y){return this.clone().mulTo(y,this)},s.prototype.imuln=function(y){var I=y<0;I&&(y=-y),r(typeof y=="number"),r(y<67108864);for(var R=0,N=0;N>=26,R+=k/67108864|0,R+=L>>>26,this.words[N]=L&67108863}return R!==0&&(this.words[N]=R,this.length++),I?this.ineg():this},s.prototype.muln=function(y){return this.clone().imuln(y)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(y){var I=g(y);if(I.length===0)return new s(1);for(var R=this,N=0;N=0);var I=y%26,R=(y-I)/26,N=67108863>>>26-I<<26-I,k;if(I!==0){var L=0;for(k=0;k>>26-I}L&&(this.words[k]=L,this.length++)}if(R!==0){for(k=this.length-1;k>=0;k--)this.words[k+R]=this.words[k];for(k=0;k=0);var N;I?N=(I-I%26)/26:N=0;var k=y%26,L=Math.min((y-k)/26,this.length),G=67108863^67108863>>>k<L)for(this.length-=L,E=0;E=0&&(z!==0||E>=N);E--){var re=this.words[E]|0;this.words[E]=z<<26-k|re>>>k,z=re&G}return D&&z!==0&&(D.words[D.length++]=z),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(y,I,R){return r(this.negative===0),this.iushrn(y,I,R)},s.prototype.shln=function(y){return this.clone().ishln(y)},s.prototype.ushln=function(y){return this.clone().iushln(y)},s.prototype.shrn=function(y){return this.clone().ishrn(y)},s.prototype.ushrn=function(y){return this.clone().iushrn(y)},s.prototype.testn=function(y){r(typeof y=="number"&&y>=0);var I=y%26,R=(y-I)/26,N=1<=0);var I=y%26,R=(y-I)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=R)return this;if(I!==0&&R++,this.length=Math.min(R,this.length),I!==0){var N=67108863^67108863>>>I<=67108864;I++)this.words[I]-=67108864,I===this.length-1?this.words[I+1]=1:this.words[I+1]++;return this.length=Math.max(this.length,I+1),this},s.prototype.isubn=function(y){if(r(typeof y=="number"),r(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var I=0;I>26)-(D/67108864|0),this.words[k+R]=L&67108863}for(;k>26,this.words[k+R]=L&67108863;if(G===0)return this._strip();for(r(G===-1),G=0,k=0;k>26,this.words[k]=L&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(y,I){var R=this.length-y.length,N=this.clone(),k=y,L=k.words[k.length-1]|0,G=this._countBits(L);R=26-G,R!==0&&(k=k.ushln(R),N.iushln(R),L=k.words[k.length-1]|0);var D=N.length-k.length,E;if(I!=="mod"){E=new s(null),E.length=D+1,E.words=new Array(E.length);for(var z=0;z=0;T--){var ee=(N.words[k.length+T]|0)*67108864+(N.words[k.length+T-1]|0);for(ee=Math.min(ee/L|0,67108863),N._ishlnsubmul(k,ee,T);N.negative!==0;)ee--,N.negative=0,N._ishlnsubmul(k,1,T),N.isZero()||(N.negative^=1);E&&(E.words[T]=ee)}return E&&E._strip(),N._strip(),I!=="div"&&R!==0&&N.iushrn(R),{div:E||null,mod:N}},s.prototype.divmod=function(y,I,R){if(r(!y.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var N,k,L;return this.negative!==0&&y.negative===0?(L=this.neg().divmod(y,I),I!=="mod"&&(N=L.div.neg()),I!=="div"&&(k=L.mod.neg(),R&&k.negative!==0&&k.iadd(y)),{div:N,mod:k}):this.negative===0&&y.negative!==0?(L=this.divmod(y.neg(),I),I!=="mod"&&(N=L.div.neg()),{div:N,mod:L.mod}):this.negative&y.negative?(L=this.neg().divmod(y.neg(),I),I!=="div"&&(k=L.mod.neg(),R&&k.negative!==0&&k.isub(y)),{div:L.div,mod:k}):y.length>this.length||this.cmp(y)<0?{div:new s(0),mod:this}:y.length===1?I==="div"?{div:this.divn(y.words[0]),mod:null}:I==="mod"?{div:null,mod:new s(this.modrn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new s(this.modrn(y.words[0]))}:this._wordDiv(y,I)},s.prototype.div=function(y){return this.divmod(y,"div",!1).div},s.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},s.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},s.prototype.divRound=function(y){var I=this.divmod(y);if(I.mod.isZero())return I.div;var R=I.div.negative!==0?I.mod.isub(y):I.mod,N=y.ushrn(1),k=y.andln(1),L=R.cmp(N);return L<0||k===1&&L===0?I.div:I.div.negative!==0?I.div.isubn(1):I.div.iaddn(1)},s.prototype.modrn=function(y){var I=y<0;I&&(y=-y),r(y<=67108863);for(var R=(1<<26)%y,N=0,k=this.length-1;k>=0;k--)N=(R*N+(this.words[k]|0))%y;return I?-N:N},s.prototype.modn=function(y){return this.modrn(y)},s.prototype.idivn=function(y){var I=y<0;I&&(y=-y),r(y<=67108863);for(var R=0,N=this.length-1;N>=0;N--){var k=(this.words[N]|0)+R*67108864;this.words[N]=k/y|0,R=k%y}return this._strip(),I?this.ineg():this},s.prototype.divn=function(y){return this.clone().idivn(y)},s.prototype.egcd=function(y){r(y.negative===0),r(!y.isZero());var I=this,R=y.clone();I.negative!==0?I=I.umod(y):I=I.clone();for(var N=new s(1),k=new s(0),L=new s(0),G=new s(1),D=0;I.isEven()&&R.isEven();)I.iushrn(1),R.iushrn(1),++D;for(var E=R.clone(),z=I.clone();!I.isZero();){for(var re=0,T=1;!(I.words[0]&T)&&re<26;++re,T<<=1);if(re>0)for(I.iushrn(re);re-- >0;)(N.isOdd()||k.isOdd())&&(N.iadd(E),k.isub(z)),N.iushrn(1),k.iushrn(1);for(var ee=0,pe=1;!(R.words[0]&pe)&&ee<26;++ee,pe<<=1);if(ee>0)for(R.iushrn(ee);ee-- >0;)(L.isOdd()||G.isOdd())&&(L.iadd(E),G.isub(z)),L.iushrn(1),G.iushrn(1);I.cmp(R)>=0?(I.isub(R),N.isub(L),k.isub(G)):(R.isub(I),L.isub(N),G.isub(k))}return{a:L,b:G,gcd:R.iushln(D)}},s.prototype._invmp=function(y){r(y.negative===0),r(!y.isZero());var I=this,R=y.clone();I.negative!==0?I=I.umod(y):I=I.clone();for(var N=new s(1),k=new s(0),L=R.clone();I.cmpn(1)>0&&R.cmpn(1)>0;){for(var G=0,D=1;!(I.words[0]&D)&&G<26;++G,D<<=1);if(G>0)for(I.iushrn(G);G-- >0;)N.isOdd()&&N.iadd(L),N.iushrn(1);for(var E=0,z=1;!(R.words[0]&z)&&E<26;++E,z<<=1);if(E>0)for(R.iushrn(E);E-- >0;)k.isOdd()&&k.iadd(L),k.iushrn(1);I.cmp(R)>=0?(I.isub(R),N.isub(k)):(R.isub(I),k.isub(N))}var re;return I.cmpn(1)===0?re=N:re=k,re.cmpn(0)<0&&re.iadd(y),re},s.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var I=this.clone(),R=y.clone();I.negative=0,R.negative=0;for(var N=0;I.isEven()&&R.isEven();N++)I.iushrn(1),R.iushrn(1);do{for(;I.isEven();)I.iushrn(1);for(;R.isEven();)R.iushrn(1);var k=I.cmp(R);if(k<0){var L=I;I=R,R=L}else if(k===0||R.cmpn(1)===0)break;I.isub(R)}while(!0);return R.iushln(N)},s.prototype.invm=function(y){return this.egcd(y).a.umod(y)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(y){return this.words[0]&y},s.prototype.bincn=function(y){r(typeof y=="number");var I=y%26,R=(y-I)/26,N=1<>>26,G&=67108863,this.words[L]=G}return k!==0&&(this.words[L]=k,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(y){var I=y<0;if(this.negative!==0&&!I)return-1;if(this.negative===0&&I)return 1;this._strip();var R;if(this.length>1)R=1;else{I&&(y=-y),r(y<=67108863,"Number is too big");var N=this.words[0]|0;R=N===y?0:Ny.length)return 1;if(this.length=0;R--){var N=this.words[R]|0,k=y.words[R]|0;if(N!==k){Nk&&(I=1);break}}return I},s.prototype.gtn=function(y){return this.cmpn(y)===1},s.prototype.gt=function(y){return this.cmp(y)===1},s.prototype.gten=function(y){return this.cmpn(y)>=0},s.prototype.gte=function(y){return this.cmp(y)>=0},s.prototype.ltn=function(y){return this.cmpn(y)===-1},s.prototype.lt=function(y){return this.cmp(y)===-1},s.prototype.lten=function(y){return this.cmpn(y)<=0},s.prototype.lte=function(y){return this.cmp(y)<=0},s.prototype.eqn=function(y){return this.cmpn(y)===0},s.prototype.eq=function(y){return this.cmp(y)===0},s.red=function(y){return new Y(y)},s.prototype.toRed=function(y){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(y){return this.red=y,this},s.prototype.forceRed=function(y){return r(!this.red,"Already a number in reduction context"),this._forceRed(y)},s.prototype.redAdd=function(y){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},s.prototype.redIAdd=function(y){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},s.prototype.redSub=function(y){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},s.prototype.redISub=function(y){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},s.prototype.redShl=function(y){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},s.prototype.redMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},s.prototype.redIMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(y){return r(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var C={k256:null,p224:null,p192:null,p25519:null};function b(U,y){this.name=U,this.p=new s(y,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}b.prototype._tmp=function(){var y=new s(null);return y.words=new Array(Math.ceil(this.n/13)),y},b.prototype.ireduce=function(y){var I=y,R;do this.split(I,this.tmp),I=this.imulK(I),I=I.iadd(this.tmp),R=I.bitLength();while(R>this.n);var N=R0?I.isub(this.p):I.strip!==void 0?I.strip():I._strip(),I},b.prototype.split=function(y,I){y.iushrn(this.n,0,I)},b.prototype.imulK=function(y){return y.imul(this.k)};function F(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(F,b),F.prototype.split=function(y,I){for(var R=4194303,N=Math.min(y.length,9),k=0;k>>22,L=G}L>>>=22,y.words[k-10]=L,L===0&&y.length>10?y.length-=10:y.length-=9},F.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var I=0,R=0;R>>=26,y.words[R]=k,I=N}return I!==0&&(y.words[y.length++]=I),y},s._prime=function(y){if(C[y])return C[y];var I;if(y==="k256")I=new F;else if(y==="p224")I=new x;else if(y==="p192")I=new _;else if(y==="p25519")I=new M;else throw new Error("Unknown prime "+y);return C[y]=I,I};function Y(U){if(typeof U=="string"){var y=s._prime(U);this.m=y.p,this.prime=y}else r(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}Y.prototype._verify1=function(y){r(y.negative===0,"red works only with positives"),r(y.red,"red works only with red numbers")},Y.prototype._verify2=function(y,I){r((y.negative|I.negative)===0,"red works only with positives"),r(y.red&&y.red===I.red,"red works only with red numbers")},Y.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):(c(y,y.umod(this.m)._forceRed(this)),y)},Y.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},Y.prototype.add=function(y,I){this._verify2(y,I);var R=y.add(I);return R.cmp(this.m)>=0&&R.isub(this.m),R._forceRed(this)},Y.prototype.iadd=function(y,I){this._verify2(y,I);var R=y.iadd(I);return R.cmp(this.m)>=0&&R.isub(this.m),R},Y.prototype.sub=function(y,I){this._verify2(y,I);var R=y.sub(I);return R.cmpn(0)<0&&R.iadd(this.m),R._forceRed(this)},Y.prototype.isub=function(y,I){this._verify2(y,I);var R=y.isub(I);return R.cmpn(0)<0&&R.iadd(this.m),R},Y.prototype.shl=function(y,I){return this._verify1(y),this.imod(y.ushln(I))},Y.prototype.imul=function(y,I){return this._verify2(y,I),this.imod(y.imul(I))},Y.prototype.mul=function(y,I){return this._verify2(y,I),this.imod(y.mul(I))},Y.prototype.isqr=function(y){return this.imul(y,y.clone())},Y.prototype.sqr=function(y){return this.mul(y,y)},Y.prototype.sqrt=function(y){if(y.isZero())return y.clone();var I=this.m.andln(3);if(r(I%2===1),I===3){var R=this.m.add(new s(1)).iushrn(2);return this.pow(y,R)}for(var N=this.m.subn(1),k=0;!N.isZero()&&N.andln(1)===0;)k++,N.iushrn(1);r(!N.isZero());var L=new s(1).toRed(this),G=L.redNeg(),D=this.m.subn(1).iushrn(1),E=this.m.bitLength();for(E=new s(2*E*E).toRed(this);this.pow(E,D).cmp(G)!==0;)E.redIAdd(G);for(var z=this.pow(E,N),re=this.pow(y,N.addn(1).iushrn(1)),T=this.pow(y,N),ee=k;T.cmp(L)!==0;){for(var pe=T,de=0;pe.cmp(L)!==0;de++)pe=pe.redSqr();r(de=0;k--){for(var z=I.words[k],re=E-1;re>=0;re--){var T=z>>re&1;if(L!==N[0]&&(L=this.sqr(L)),T===0&&G===0){D=0;continue}G<<=1,G|=T,D++,!(D!==R&&(k!==0||re!==0))&&(L=this.mul(L,N[G]),D=0,G=0)}E=26}return L},Y.prototype.convertTo=function(y){var I=y.umod(this.m);return I===y?I.clone():I},Y.prototype.convertFrom=function(y){var I=y.clone();return I.red=null,I},s.mont=function(y){return new O(y)};function O(U){Y.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(O,Y),O.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},O.prototype.convertFrom=function(y){var I=this.imod(y.mul(this.rinv));return I.red=null,I},O.prototype.imul=function(y,I){if(y.isZero()||I.isZero())return y.words[0]=0,y.length=1,y;var R=y.imul(I),N=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=R.isub(N).iushrn(this.shift),L=k;return k.cmp(this.m)>=0?L=k.isub(this.m):k.cmpn(0)<0&&(L=k.iadd(this.m)),L._forceRed(this)},O.prototype.mul=function(y,I){if(y.isZero()||I.isZero())return new s(0)._forceRed(this);var R=y.mul(I),N=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=R.isub(N).iushrn(this.shift),L=k;return k.cmp(this.m)>=0?L=k.isub(this.m):k.cmpn(0)<0&&(L=k.iadd(this.m)),L._forceRed(this)},O.prototype.invm=function(y){var I=this.imod(y._invmp(this.m).mul(this.r2));return I._forceRed(this)}})(n,pa)})($_);var e9=$_.exports;const vt=Zl(e9),t9="logger/5.7.0";let yR=!1,wR=!1;const Py={debug:1,default:2,info:2,warning:3,error:4,off:5};let BR=Py.default,jb=null;function n9(){try{const n=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{n.push(e)}}),n.length)throw new Error("missing "+n.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(n){return n.message}return null}const CR=n9();var tF;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(tF||(tF={}));var Io;(function(n){n.UNKNOWN_ERROR="UNKNOWN_ERROR",n.NOT_IMPLEMENTED="NOT_IMPLEMENTED",n.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",n.NETWORK_ERROR="NETWORK_ERROR",n.SERVER_ERROR="SERVER_ERROR",n.TIMEOUT="TIMEOUT",n.BUFFER_OVERRUN="BUFFER_OVERRUN",n.NUMERIC_FAULT="NUMERIC_FAULT",n.MISSING_NEW="MISSING_NEW",n.INVALID_ARGUMENT="INVALID_ARGUMENT",n.MISSING_ARGUMENT="MISSING_ARGUMENT",n.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",n.CALL_EXCEPTION="CALL_EXCEPTION",n.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",n.NONCE_EXPIRED="NONCE_EXPIRED",n.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",n.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",n.TRANSACTION_REPLACED="TRANSACTION_REPLACED",n.ACTION_REJECTED="ACTION_REJECTED"})(Io||(Io={}));const bR="0123456789abcdef";let we=class dr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();Py[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(BR>Py[r])&&console.log.apply(console,t)}debug(...e){this._log(dr.levels.DEBUG,e)}info(...e){this._log(dr.levels.INFO,e)}warn(...e){this._log(dr.levels.WARNING,e)}makeError(e,t,r){if(wR)return this.makeError("censored error",t,{});t||(t=dr.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(l=>{const A=r[l];try{if(A instanceof Uint8Array){let c="";for(let u=0;u>4],c+=bR[A[u]&15];i.push(l+"=Uint8Array(0x"+c+")")}else i.push(l+"="+JSON.stringify(A))}catch{i.push(l+"="+JSON.stringify(r[l].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);const s=e;let o="";switch(t){case Io.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Io.CALL_EXCEPTION:case Io.INSUFFICIENT_FUNDS:case Io.MISSING_NEW:case Io.NONCE_EXPIRED:case Io.REPLACEMENT_UNDERPRICED:case Io.TRANSACTION_REPLACED:case Io.UNPREDICTABLE_GAS_LIMIT:o=t;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=t,Object.keys(r).forEach(function(l){a[l]=r[l]}),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,dr.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,i){e||this.throwError(t,r,i)}assertArgument(e,t,r,i){e||this.throwArgumentError(t,r,i)}checkNormalize(e){CR&&this.throwError("platform missing String.prototype.normalize",dr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:CR})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,dr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,dr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",et&&this.throwError("too many arguments"+r,dr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",dr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",dr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",dr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return jb||(jb=new dr(t9)),jb}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",dr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),yR){if(!e)return;this.globalLogger().throwError("error censorship permanent",dr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}wR=!!e,yR=!!t}static setLogLevel(e){const t=Py[e.toLowerCase()];if(t==null){dr.globalLogger().warn("invalid log level - "+e);return}BR=t}static from(e){return new dr(e)}};we.errors=Io;we.levels=tF;const r9="bytes/5.7.0",Nn=new we(r9);function JV(n){return!!n.toHexString}function Mh(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return Mh(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function q_(n){return Ft(n)&&!(n.length%2)||CC(n)}function xR(n){return typeof n=="number"&&n==n&&n%1===0}function CC(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!xR(n.length)||n.length<0)return!1;for(let e=0;e=256)return!1}return!0}function At(n,e){if(e||(e={}),typeof n=="number"){Nn.checkSafeUint53(n,"invalid arrayify value");const t=[];for(;n;)t.unshift(n&255),n=parseInt(String(n/256));return t.length===0&&t.push(0),Mh(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),JV(n)&&(n=n.toHexString()),Ft(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Nn.throwArgumentError("hex data is odd-length","value",n));const r=[];for(let i=0;iAt(i)),t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t);return e.reduce((i,s)=>(r.set(s,i),i+s.length),0),Mh(r)}function tf(n){let e=At(n);if(e.length===0)return e;let t=0;for(;te&&Nn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),Mh(t)}function Ft(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const Kb="0123456789abcdef";function nt(n,e){if(e||(e={}),typeof n=="number"){Nn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=Kb[n&15]+t,n=Math.floor(n/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof n=="bigint")return n=n.toString(16),n.length%2?"0x0"+n:"0x"+n;if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),JV(n))return n.toHexString();if(Ft(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Nn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(CC(n)){let t="0x";for(let r=0;r>4]+Kb[i&15]}return t}return Nn.throwArgumentError("invalid hexlify value","value",n)}function hu(n){if(typeof n!="string")n=nt(n);else if(!Ft(n)||n.length%2)return null;return(n.length-2)/2}function zr(n,e,t){return typeof n!="string"?n=nt(n):(!Ft(n)||n.length%2)&&Nn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function Si(n){let e="0x";return n.forEach(t=>{e+=nt(t).substring(2)}),e}function bC(n){const e=s9(nt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function s9(n){typeof n!="string"&&(n=nt(n)),Ft(n)||Nn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Nn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function xC(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(q_(n)){let t=At(n);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=nt(t.slice(0,32)),e.s=nt(t.slice(32,64))):t.length===65?(e.r=nt(t.slice(0,32)),e.s=nt(t.slice(32,64)),e.v=t[64]):Nn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Nn.throwArgumentError("signature invalid v byte","signature",n)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=nt(t.slice(32,64))}else{if(e.r=n.r,e.s=n.s,e.v=n.v,e.recoveryParam=n.recoveryParam,e._vs=n._vs,e._vs!=null){const i=i9(At(e._vs),32);e._vs=nt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Nn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=nt(i);e.s==null?e.s=o:e.s!==o&&Nn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Nn.throwArgumentError("signature missing v and recoveryParam","signature",n):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Nn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Ft(e.r)?Nn.throwArgumentError("signature missing or invalid r","signature",n):e.r=Pn(e.r,32),e.s==null||!Ft(e.s)?Nn.throwArgumentError("signature missing or invalid s","signature",n):e.s=Pn(e.s,32);const t=At(e.s);t[0]>=128&&Nn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=nt(t);e._vs&&(Ft(e._vs)||Nn.throwArgumentError("signature invalid _vs","signature",n),e._vs=Pn(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Nn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const o9="bignumber/5.7.0";var Qw=vt.BN;const al=new we(o9),$b={},IR=9007199254740991;let FR=!1;class Ge{constructor(e,t){e!==$b&&al.throwError("cannot call constructor directly; use BigNumber.from",we.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return xi(St(this).fromTwos(e))}toTwos(e){return xi(St(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ge.from(this._hex.substring(1)):this}add(e){return xi(St(this).add(St(e)))}sub(e){return xi(St(this).sub(St(e)))}div(e){return Ge.from(e).isZero()&&Es("division-by-zero","div"),xi(St(this).div(St(e)))}mul(e){return xi(St(this).mul(St(e)))}mod(e){const t=St(e);return t.isNeg()&&Es("division-by-zero","mod"),xi(St(this).umod(t))}pow(e){const t=St(e);return t.isNeg()&&Es("negative-power","pow"),xi(St(this).pow(t))}and(e){const t=St(e);return(this.isNegative()||t.isNeg())&&Es("unbound-bitwise-result","and"),xi(St(this).and(t))}or(e){const t=St(e);return(this.isNegative()||t.isNeg())&&Es("unbound-bitwise-result","or"),xi(St(this).or(t))}xor(e){const t=St(e);return(this.isNegative()||t.isNeg())&&Es("unbound-bitwise-result","xor"),xi(St(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Es("negative-width","mask"),xi(St(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Es("negative-width","shl"),xi(St(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Es("negative-width","shr"),xi(St(this).shrn(e))}eq(e){return St(this).eq(St(e))}lt(e){return St(this).lt(St(e))}lte(e){return St(this).lte(St(e))}gt(e){return St(this).gt(St(e))}gte(e){return St(this).gte(St(e))}isNegative(){return this._hex[0]==="-"}isZero(){return St(this).isZero()}toNumber(){try{return St(this).toNumber()}catch{Es("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return al.throwError("this platform does not support BigInt",we.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?FR||(FR=!0,al.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?al.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",we.errors.UNEXPECTED_ARGUMENT,{}):al.throwError("BigNumber.toString does not accept parameters",we.errors.UNEXPECTED_ARGUMENT,{})),St(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ge)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Ge($b,qg(e)):e.match(/^-?[0-9]+$/)?new Ge($b,qg(new Qw(e))):al.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Es("underflow","BigNumber.from",e),(e>=IR||e<=-IR)&&Es("overflow","BigNumber.from",e),Ge.from(String(e));const t=e;if(typeof t=="bigint")return Ge.from(t.toString());if(CC(t))return Ge.from(nt(t));if(t)if(t.toHexString){const r=t.toHexString();if(typeof r=="string")return Ge.from(r)}else{let r=t._hex;if(r==null&&t.type==="BigNumber"&&(r=t.hex),typeof r=="string"&&(Ft(r)||r[0]==="-"&&Ft(r.substring(1))))return Ge.from(r)}return al.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function qg(n){if(typeof n!="string")return qg(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&al.throwArgumentError("invalid hex","value",n),n=qg(n),n==="0x00"?n:"-"+n;if(n.substring(0,2)!=="0x"&&(n="0x"+n),n==="0x")return"0x00";for(n.length%2&&(n="0x0"+n.substring(2));n.length>4&&n.substring(0,4)==="0x00";)n="0x"+n.substring(4);return n}function xi(n){return Ge.from(qg(n))}function St(n){const e=Ge.from(n).toHexString();return e[0]==="-"?new Qw("-"+e.substring(3),16):new Qw(e.substring(2),16)}function Es(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),al.throwError(n,we.errors.NUMERIC_FAULT,r)}function a9(n){return new Qw(n,36).toString(16)}const l9="properties/5.7.0";var A9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Rw=new we(l9);function Me(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function ss(n,e){for(let t=0;t<32;t++){if(n[e])return n[e];if(!n.prototype||typeof n.prototype!="object")break;n=Object.getPrototypeOf(n.prototype).constructor}return null}function qn(n){return A9(this,void 0,void 0,function*(){const e=Object.keys(n).map(r=>{const i=n[r];return Promise.resolve(i).then(s=>({key:r,value:s}))});return(yield Promise.all(e)).reduce((r,i)=>(r[i.key]=i.value,r),{})})}function c9(n,e){(!n||typeof n!="object")&&Rw.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||Rw.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function xn(n){const e={};for(const t in n)e[t]=n[t];return e}const u9={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function HV(n){if(n==null||u9[typeof n])return!0;if(Array.isArray(n)||typeof n=="object"){if(!Object.isFrozen(n))return!1;const e=Object.keys(n);for(let t=0;tls(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Me(e,t,ls(r))}return e}return Rw.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function ls(n){return d9(n)}class t0{constructor(e){for(const t in e)this[t]=ls(e[t])}}const h9="abstract-provider/5.7.0";var f9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const p9=new we(h9);class g9 extends t0{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class n0{constructor(){p9.checkAbstract(new.target,n0),Me(this,"_isProvider",!0)}getFeeData(){return f9(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield qn({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let r=null,i=null,s=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,s=Ge.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:t}})}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!!(e&&e._isProvider)}}const m9="networks/5.7.1",ER=new we(m9);function v9(n){return n&&typeof n.renetwork=="function"}function hl(n){const e=function(t,r){r==null&&(r={});const i=[];if(t.InfuraProvider&&r.infura!=="-")try{i.push(new t.InfuraProvider(n,r.infura))}catch{}if(t.EtherscanProvider&&r.etherscan!=="-")try{i.push(new t.EtherscanProvider(n,r.etherscan))}catch{}if(t.AlchemyProvider&&r.alchemy!=="-")try{i.push(new t.AlchemyProvider(n,r.alchemy))}catch{}if(t.PocketProvider&&r.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(n,r.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(t.CloudflareProvider&&r.cloudflare!=="-")try{i.push(new t.CloudflareProvider(n))}catch{}if(t.AnkrProvider&&r.ankr!=="-")try{const s=["ropsten"],o=new t.AnkrProvider(n,r.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(t.FallbackProvider){let s=1;return r.quorum!=null?s=r.quorum:n==="homestead"&&(s=2),new t.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(t){return hl(t)},e}function Mw(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return Mw(n,r)},t}const _R={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:hl("homestead")},SR={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:hl("ropsten")},UR={chainId:63,name:"classicMordor",_defaultProvider:Mw("https://www.ethercluster.com/mordor","classicMordor")},L0={unspecified:{chainId:0,name:"unspecified"},homestead:_R,mainnet:_R,morden:{chainId:2,name:"morden"},ropsten:SR,testnet:SR,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:hl("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:hl("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:hl("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:hl("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Mw("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:UR,classicTestnet:UR,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Mw("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:hl("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:hl("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function zV(n){if(n==null)return null;if(typeof n=="number"){for(const r in L0){const i=L0[r];if(i.chainId===n)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:n,name:"unknown"}}if(typeof n=="string"){const r=L0[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=L0[n.name];if(!e)return typeof n.chainId!="number"&&ER.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&ER.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(v9(e._defaultProvider)?t=e._defaultProvider.renetwork(n):t=e._defaultProvider),{name:n.name,chainId:e.chainId,ensAddress:n.ensAddress||e.ensAddress||null,_defaultProvider:t}}function YV(n){n=atob(n);const e=[];for(let t=0;t0;)r.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;t[s]===0&&s=0;--s)i+=this.alphabet[r[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let t=[];if(e.length===0)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;s>0;)t.push(s&255),s>>=8}for(let r=0;e[r]===this._leader&&r>5,this.byteCount=this.blockCount<<2,this.outputBlocks=pe>>5,this.extraBytes=(pe&31)>>3;for(var de=0;de<50;++de)this.s[de]=0}E.prototype.update=function(T){if(this.finalized)throw new Error(t);var ee,pe=typeof T;if(pe!=="string"){if(pe==="object"){if(T===null)throw new Error(e);if(l&&T.constructor===ArrayBuffer)T=new Uint8Array(T);else if(!Array.isArray(T)&&(!l||!ArrayBuffer.isView(T)))throw new Error(e)}else throw new Error(e);ee=!0}for(var de=this.blocks,Ae=this.byteCount,$=T.length,ce=this.blockCount,ge=0,Fe=this.s,P,fe;ge<$;){if(this.reset)for(this.reset=!1,de[0]=this.block,P=1;P>2]|=T[ge]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(de[P>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Ae){for(this.start=P-Ae,this.block=de[ce],P=0;P>8,pe=T&255;pe>0;)Ae.unshift(pe),T=T>>8,pe=T&255,++de;return ee?Ae.push(de):Ae.unshift(de),this.update(Ae),Ae.length},E.prototype.encodeString=function(T){var ee,pe=typeof T;if(pe!=="string"){if(pe==="object"){if(T===null)throw new Error(e);if(l&&T.constructor===ArrayBuffer)T=new Uint8Array(T);else if(!Array.isArray(T)&&(!l||!ArrayBuffer.isView(T)))throw new Error(e)}else throw new Error(e);ee=!0}var de=0,Ae=T.length;if(ee)de=Ae;else for(var $=0;$=57344?de+=3:(ce=65536+((ce&1023)<<10|T.charCodeAt(++$)&1023),de+=4)}return de+=this.encode(de*8),this.update(T),de},E.prototype.bytepad=function(T,ee){for(var pe=this.encode(ee),de=0;de>2]|=this.padding[ee&3],this.lastByteIndex===this.byteCount)for(T[0]=T[pe],ee=1;ee>4&15]+A[ge&15]+A[ge>>12&15]+A[ge>>8&15]+A[ge>>20&15]+A[ge>>16&15]+A[ge>>28&15]+A[ge>>24&15];$%T===0&&(re(ee),Ae=0)}return de&&(ge=ee[Ae],ce+=A[ge>>4&15]+A[ge&15],de>1&&(ce+=A[ge>>12&15]+A[ge>>8&15]),de>2&&(ce+=A[ge>>20&15]+A[ge>>16&15])),ce},E.prototype.arrayBuffer=function(){this.finalize();var T=this.blockCount,ee=this.s,pe=this.outputBlocks,de=this.extraBytes,Ae=0,$=0,ce=this.outputBits>>3,ge;de?ge=new ArrayBuffer(pe+1<<2):ge=new ArrayBuffer(ce);for(var Fe=new Uint32Array(ge);$>8&255,ce[ge+2]=Fe>>16&255,ce[ge+3]=Fe>>24&255;$%T===0&&re(ee)}return de&&(ge=$<<2,Fe=ee[Ae],ce[ge]=Fe&255,de>1&&(ce[ge+1]=Fe>>8&255),de>2&&(ce[ge+2]=Fe>>16&255)),ce};function z(T,ee,pe){E.call(this,T,ee,pe)}z.prototype=new E,z.prototype.finalize=function(){return this.encode(this.outputBits,!0),E.prototype.finalize.call(this)};var re=function(T){var ee,pe,de,Ae,$,ce,ge,Fe,P,fe,ue,q,K,oe,ye,be,W,H,ie,ae,me,J,Q,S,Z,te,le,se,Ue,_e,Te,Pe,ke,he,Ee,Se,Re,Je,qe,dt,cn,Et,st,Ar,wt,qt,co,Yt,en,ne,ve,xe,Ce,Ie,We,lt,$e,je,Bt,pt,yt,zt,Wr;for(de=0;de<48;de+=2)Ae=T[0]^T[10]^T[20]^T[30]^T[40],$=T[1]^T[11]^T[21]^T[31]^T[41],ce=T[2]^T[12]^T[22]^T[32]^T[42],ge=T[3]^T[13]^T[23]^T[33]^T[43],Fe=T[4]^T[14]^T[24]^T[34]^T[44],P=T[5]^T[15]^T[25]^T[35]^T[45],fe=T[6]^T[16]^T[26]^T[36]^T[46],ue=T[7]^T[17]^T[27]^T[37]^T[47],q=T[8]^T[18]^T[28]^T[38]^T[48],K=T[9]^T[19]^T[29]^T[39]^T[49],ee=q^(ce<<1|ge>>>31),pe=K^(ge<<1|ce>>>31),T[0]^=ee,T[1]^=pe,T[10]^=ee,T[11]^=pe,T[20]^=ee,T[21]^=pe,T[30]^=ee,T[31]^=pe,T[40]^=ee,T[41]^=pe,ee=Ae^(Fe<<1|P>>>31),pe=$^(P<<1|Fe>>>31),T[2]^=ee,T[3]^=pe,T[12]^=ee,T[13]^=pe,T[22]^=ee,T[23]^=pe,T[32]^=ee,T[33]^=pe,T[42]^=ee,T[43]^=pe,ee=ce^(fe<<1|ue>>>31),pe=ge^(ue<<1|fe>>>31),T[4]^=ee,T[5]^=pe,T[14]^=ee,T[15]^=pe,T[24]^=ee,T[25]^=pe,T[34]^=ee,T[35]^=pe,T[44]^=ee,T[45]^=pe,ee=Fe^(q<<1|K>>>31),pe=P^(K<<1|q>>>31),T[6]^=ee,T[7]^=pe,T[16]^=ee,T[17]^=pe,T[26]^=ee,T[27]^=pe,T[36]^=ee,T[37]^=pe,T[46]^=ee,T[47]^=pe,ee=fe^(Ae<<1|$>>>31),pe=ue^($<<1|Ae>>>31),T[8]^=ee,T[9]^=pe,T[18]^=ee,T[19]^=pe,T[28]^=ee,T[29]^=pe,T[38]^=ee,T[39]^=pe,T[48]^=ee,T[49]^=pe,oe=T[0],ye=T[1],qt=T[11]<<4|T[10]>>>28,co=T[10]<<4|T[11]>>>28,se=T[20]<<3|T[21]>>>29,Ue=T[21]<<3|T[20]>>>29,pt=T[31]<<9|T[30]>>>23,yt=T[30]<<9|T[31]>>>23,Et=T[40]<<18|T[41]>>>14,st=T[41]<<18|T[40]>>>14,he=T[2]<<1|T[3]>>>31,Ee=T[3]<<1|T[2]>>>31,be=T[13]<<12|T[12]>>>20,W=T[12]<<12|T[13]>>>20,Yt=T[22]<<10|T[23]>>>22,en=T[23]<<10|T[22]>>>22,_e=T[33]<<13|T[32]>>>19,Te=T[32]<<13|T[33]>>>19,zt=T[42]<<2|T[43]>>>30,Wr=T[43]<<2|T[42]>>>30,Ie=T[5]<<30|T[4]>>>2,We=T[4]<<30|T[5]>>>2,Se=T[14]<<6|T[15]>>>26,Re=T[15]<<6|T[14]>>>26,H=T[25]<<11|T[24]>>>21,ie=T[24]<<11|T[25]>>>21,ne=T[34]<<15|T[35]>>>17,ve=T[35]<<15|T[34]>>>17,Pe=T[45]<<29|T[44]>>>3,ke=T[44]<<29|T[45]>>>3,S=T[6]<<28|T[7]>>>4,Z=T[7]<<28|T[6]>>>4,lt=T[17]<<23|T[16]>>>9,$e=T[16]<<23|T[17]>>>9,Je=T[26]<<25|T[27]>>>7,qe=T[27]<<25|T[26]>>>7,ae=T[36]<<21|T[37]>>>11,me=T[37]<<21|T[36]>>>11,xe=T[47]<<24|T[46]>>>8,Ce=T[46]<<24|T[47]>>>8,Ar=T[8]<<27|T[9]>>>5,wt=T[9]<<27|T[8]>>>5,te=T[18]<<20|T[19]>>>12,le=T[19]<<20|T[18]>>>12,je=T[29]<<7|T[28]>>>25,Bt=T[28]<<7|T[29]>>>25,dt=T[38]<<8|T[39]>>>24,cn=T[39]<<8|T[38]>>>24,J=T[48]<<14|T[49]>>>18,Q=T[49]<<14|T[48]>>>18,T[0]=oe^~be&H,T[1]=ye^~W&ie,T[10]=S^~te&se,T[11]=Z^~le&Ue,T[20]=he^~Se&Je,T[21]=Ee^~Re&qe,T[30]=Ar^~qt&Yt,T[31]=wt^~co&en,T[40]=Ie^~lt&je,T[41]=We^~$e&Bt,T[2]=be^~H&ae,T[3]=W^~ie&me,T[12]=te^~se&_e,T[13]=le^~Ue&Te,T[22]=Se^~Je&dt,T[23]=Re^~qe&cn,T[32]=qt^~Yt&ne,T[33]=co^~en&ve,T[42]=lt^~je&pt,T[43]=$e^~Bt&yt,T[4]=H^~ae&J,T[5]=ie^~me&Q,T[14]=se^~_e&Pe,T[15]=Ue^~Te&ke,T[24]=Je^~dt&Et,T[25]=qe^~cn&st,T[34]=Yt^~ne&xe,T[35]=en^~ve&Ce,T[44]=je^~pt&zt,T[45]=Bt^~yt&Wr,T[6]=ae^~J&oe,T[7]=me^~Q&ye,T[16]=_e^~Pe&S,T[17]=Te^~ke&Z,T[26]=dt^~Et&he,T[27]=cn^~st&Ee,T[36]=ne^~xe&Ar,T[37]=ve^~Ce&wt,T[46]=pt^~zt&Ie,T[47]=yt^~Wr&We,T[8]=J^~oe&be,T[9]=Q^~ye&W,T[18]=Pe^~S&te,T[19]=ke^~Z&le,T[28]=Et^~he&Se,T[29]=st^~Ee&Re,T[38]=xe^~Ar&qt,T[39]=Ce^~wt&co,T[48]=zt^~Ie<,T[49]=Wr^~We&$e,T[0]^=f[de],T[1]^=f[de+1]};if(a)n.exports=y;else for(R=0;R>6===2;o++)s++;return s}return n===qi.OVERRUN?t.length-e-1:0}function _9(n,e,t,r,i){return n===qi.OVERLONG?(r.push(i),0):(r.push(65533),eP(n,e,t))}const S9=Object.freeze({error:E9,ignore:eP,replace:_9});function tP(n,e){e==null&&(e=S9.error),n=At(n);const t=[];let r=0;for(;r>7)){t.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?r+=e(qi.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(qi.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(qi.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(qi.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(qi.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(qi.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function Fa(n,e=em.current){e!=em.current&&(qV.checkNormalize(),n=n.normalize(e));let t=[];for(let r=0;r>6|192),t.push(i&63|128);else if((i&64512)==55296){r++;const s=n.charCodeAt(r);if(r>=n.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return At(t)}function U9(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function r0(n,e){return U9(tP(n,e))}function Q9(n,e=em.current){return tP(Fa(n,e))}function sh(n){return ir(Fa(n))}const nP="hash/5.7.0";function rP(n,e){e==null&&(e=1);const t=[],r=t.forEach,i=function(s,o){r.call(s,function(a){o>0&&Array.isArray(a)?i(a,o-1):t.push(a)})};return i(n,e),t}function R9(n){const e={};for(let t=0;t>--l&1}const u=31,h=Math.pow(2,u),d=h>>>1,p=d>>1,f=h-1;let g=0;for(let C=0;C1;){let M=b+F>>>1;C>>1|c(),x=x<<1^d,_=(_^d)<<1|d|1;v=x,w=1+_-x}let B=r-4;return m.map(C=>{switch(C-B){case 3:return B+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return B+256+(n[a++]<<8|n[a++]);case 1:return B+n[a++];default:return C-1}})}function T9(n){let e=0;return()=>n[e++]}function N9(n){return T9(M9(n))}function k9(n){return n&1?~n>>1:n>>1}function D9(n,e){let t=Array(n);for(let r=0;re[o]):t}function V9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(O9(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(W9(t,n))}return R9(rP(e))}function P9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function iP(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function O9(n,e){let t=1+e(),r=e(),i=P9(e),s=iP(i.length,1+n,e);return rP(s.map((o,a)=>{const l=o[0],A=o.slice(1);return Array(i[a]).fill(void 0).map((c,u)=>{let h=u*r;return[l+u*t,A.map(d=>d+h)]})}))}function W9(n,e){let t=1+e();return iP(t,1+n,e).map(i=>[i[0],i.slice(1)])}function G9(n){let e=Tw(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let A=Tw(n,e);if(A.length==0)break;r.push({set:new Set(A),node:t()})}r.sort((A,c)=>c.set.size-A.set.size);let i=n(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:r,valid:s,fe0f:o,save:a,check:l}}}function Z9(){return N9(YV("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const IC=Z9(),J9=new Set(Tw(IC)),H9=new Set(Tw(IC)),z9=V9(IC),Y9=G9(IC),RR=45,MR=95;function sP(n){return Q9(n)}function X9(n){return n.filter(e=>e!=65039)}function oP(n){for(let e of n.split(".")){let t=sP(e);try{for(let r=t.lastIndexOf(MR)-1;r>=0;r--)if(t[r]!==MR)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===RR&&t[3]===RR)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function j9(n){return oP(K9(n,X9))}function K9(n,e){let t=sP(n).reverse(),r=[];for(;t.length;){let i=q9(t);if(i){r.push(...e(i));continue}let s=t.pop();if(J9.has(s)){r.push(s);continue}if(H9.has(s))continue;let o=z9[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return oP($9(String.fromCodePoint(...r)))}function $9(n){return n.normalize("NFC")}function q9(n,e){var t;let r=Y9,i,s,o=[],a=n.length;for(e&&(e.length=0);a;){let l=n[--a];if(r=(t=r.branches.find(A=>A.set.has(l)))===null||t===void 0?void 0:t.node,!r)break;if(r.save)s=l;else if(r.check&&l===s)break;o.push(l),r.fe0f&&(o.push(65039),a>0&&n[a-1]==65039&&a--),r.valid&&(i=o.slice(),r.valid==2&&i.splice(1,1),e&&e.push(...n.slice(a).reverse()),n.length=a)}return i}const e6=new we(nP),aP=new Uint8Array(32);aP.fill(0);function TR(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function lP(n){const e=Fa(j9(n)),t=[];if(n.length===0)return t;let r=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return t.push(TR(e.slice(r))),t}function Oy(n){typeof n!="string"&&e6.throwArgumentError("invalid ENS name; not a string","name",n);let e=aP;const t=lP(n);for(;t.length;)e=ir(is([e,ir(t.pop())]));return nt(e)}function t6(n){return nt(is(lP(n).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t})))+"00"}const n6="rlp/5.7.0",ia=new we(n6);function NR(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function kR(n,e,t){let r=0;for(let i=0;ie+1+r&&ia.throwError("child data too short",we.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function cP(n,e){if(n.length===0&&ia.throwError("data too short",we.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&ia.throwError("data short segment too short",we.errors.BUFFER_OVERRUN,{});const r=kR(n,e+1,t);return e+1+t+r>n.length&&ia.throwError("data long segment too short",we.errors.BUFFER_OVERRUN,{}),DR(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&ia.throwError("data array too short",we.errors.BUFFER_OVERRUN,{}),DR(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&ia.throwError("data array too short",we.errors.BUFFER_OVERRUN,{});const r=kR(n,e+1,t);e+1+t+r>n.length&&ia.throwError("data array too short",we.errors.BUFFER_OVERRUN,{});const i=nt(n.slice(e+1+t,e+1+t+r));return{consumed:1+t+r,result:i}}else if(n[e]>=128){const t=n[e]-128;e+1+t>n.length&&ia.throwError("data too short",we.errors.BUFFER_OVERRUN,{});const r=nt(n.slice(e+1,e+1+t));return{consumed:1+t,result:r}}return{consumed:1,result:nt(n[e])}}function eS(n){const e=At(n),t=cP(e,0);return t.consumed!==e.length&&ia.throwArgumentError("invalid rlp data","data",n),t.result}const r6="address/5.7.0",oh=new we(r6);function LR(n){Ft(n,20)||oh.throwArgumentError("invalid address","address",n),n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);const r=At(ir(t));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(r[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const i6=9007199254740991;function s6(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const tS={};for(let n=0;n<10;n++)tS[String(n)]=String(n);for(let n=0;n<26;n++)tS[String.fromCharCode(65+n)]=String(10+n);const VR=Math.floor(s6(i6));function o6(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>tS[r]).join("");for(;e.length>=VR;){let r=e.substring(0,VR);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function Vr(n){let e=null;if(typeof n!="string"&&oh.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=LR(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&oh.throwArgumentError("bad address checksum","address",n);else if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(n.substring(2,4)!==o6(n)&&oh.throwArgumentError("bad icap checksum","address",n),e=a9(n.substring(4));e.length<40;)e="0"+e;e=LR("0x"+e)}else oh.throwArgumentError("invalid address","address",n);return e}function uP(n){let e=null;try{e=Vr(n.from)}catch{oh.throwArgumentError("missing from address","transaction",n)}const t=tf(At(Ge.from(n.nonce).toHexString()));return Vr(zr(ir(FC([e,t])),12))}var a6=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const En=new we(nP),dP=new Uint8Array(32);dP.fill(0);const l6=Ge.from(-1),hP=Ge.from(0),fP=Ge.from(1),A6=Ge.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function c6(n){const e=At(n),t=e.length%32;return t?Si([e,dP.slice(t)]):nt(e)}const u6=Pn(fP.toHexString(),32),d6=Pn(hP.toHexString(),32),PR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},qb=["name","version","chainId","verifyingContract","salt"];function OR(n){return function(e){return typeof e!="string"&&En.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const h6={name:OR("name"),version:OR("version"),chainId:function(n){try{return Ge.from(n).toString()}catch{}return En.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return Vr(n).toLowerCase()}catch{}return En.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){try{const e=At(n);if(e.length!==32)throw new Error("bad length");return nt(e)}catch{}return En.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function ex(n){{const e=n.match(/^(u?)int(\d*)$/);if(e){const t=e[1]==="",r=parseInt(e[2]||"256");(r%8!==0||r>256||e[2]&&e[2]!==String(r))&&En.throwArgumentError("invalid numeric width","type",n);const i=A6.mask(t?r-1:r),s=t?i.add(fP).mul(l6):hP;return function(o){const a=Ge.from(o);return(a.lt(s)||a.gt(i))&&En.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),Pn(a.toTwos(256).toHexString(),32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return(t===0||t>32||e[1]!==String(t))&&En.throwArgumentError("invalid bytes width","type",n),function(r){return At(r).length!==t&&En.throwArgumentError(`invalid length for ${n}`,"value",r),c6(r)}}}switch(n){case"address":return function(e){return Pn(Vr(e),32)};case"bool":return function(e){return e?u6:d6};case"bytes":return function(e){return ir(e)};case"string":return function(e){return sh(e)}}return null}function WR(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class ji{constructor(e){Me(this,"types",Object.freeze(ls(e))),Me(this,"_encoderCache",{}),Me(this,"_types",{});const t={},r={},i={};Object.keys(e).forEach(a=>{t[a]={},r[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(A=>{l[A.name]&&En.throwArgumentError(`duplicate variable name ${JSON.stringify(A.name)} in ${JSON.stringify(a)}`,"types",e),l[A.name]=!0;const c=A.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===a&&En.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!ex(c)&&(r[c]||En.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),r[c].push(a),t[a][c]=!0)})}const s=Object.keys(r).filter(a=>r[a].length===0);s.length===0?En.throwArgumentError("missing primary type","types",e):s.length>1&&En.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Me(this,"primaryType",s[0]);function o(a,l){l[a]&&En.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(t[a]).forEach(A=>{r[A]&&(o(A,l),Object.keys(l).forEach(c=>{i[c][A]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=WR(a,e[a])+l.map(A=>WR(A,e[A])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const i=ex(e);if(i)return i}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const i=t[1],s=this.getEncoder(i),o=parseInt(t[3]);return a=>{o>=0&&a.length!==o&&En.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(ir)),ir(Si(l))}}const r=this.types[e];if(r){const i=sh(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const A=this.getEncoder(l)(s[a]);return this._types[l]?ir(A):A});return o.unshift(i),Si(o)}}return En.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||En.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return ir(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(ex(e))return r(e,t);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&t.length!==a&&En.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map(l=>this._visit(o,l,r))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],r),o),{}):En.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ji(e)}static getPrimaryType(e){return ji.from(e).primaryType}static hashStruct(e,t,r){return ji.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=PR[r];i||En.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>qb.indexOf(r.name)-qb.indexOf(i.name)),ji.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return Si(["0x1901",ji.hashDomain(e),ji.from(t).hash(r)])}static hash(e,t,r){return ir(ji.encode(e,t,r))}static resolveNames(e,t,r,i){return a6(this,void 0,void 0,function*(){e=xn(e);const s={};e.verifyingContract&&!Ft(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=ji.from(t);o.visit(r,(a,l)=>(a==="address"&&!Ft(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:r}})}static getPayload(e,t,r){ji.hashDomain(e);const i={},s=[];qb.forEach(l=>{const A=e[l];A!=null&&(i[l]=h6[l](A),s.push({name:l,type:PR[l]}))});const o=ji.from(t),a=xn(t);return a.EIP712Domain?En.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=s,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,(l,A)=>{if(l.match(/^bytes(\d*)/))return nt(At(A));if(l.match(/^u?int/))return Ge.from(A).toString();switch(l){case"address":return A.toLowerCase();case"bool":return!!A;case"string":return typeof A!="string"&&En.throwArgumentError("invalid string","value",A),A}return En.throwArgumentError("unsupported type","type",l)})}}}var pP={},Tt={},i0=gP;function gP(n,e){if(!n)throw new Error(e||"Assertion failed")}gP.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var rF={exports:{}};typeof Object.create=="function"?rF.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:rF.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var f6=rF.exports,p6=i0,g6=f6;Tt.inherits=g6;function m6(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function v6(n,e){if(Array.isArray(n))return n.slice();if(!n)return[];var t=[];if(typeof n=="string")if(e){if(e==="hex")for(n=n.replace(/[^a-z0-9]+/ig,""),n.length%2!==0&&(n="0"+n),i=0;i>6|192,t[r++]=s&63|128):m6(n,i)?(s=65536+((s&1023)<<10)+(n.charCodeAt(++i)&1023),t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=s&63|128):(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=s&63|128)}else for(i=0;i>>24|n>>>8&65280|n<<8&16711680|(n&255)<<24;return e>>>0}Tt.htonl=mP;function w6(n,e){for(var t="",r=0;r>>0}return s}Tt.join32=B6;function C6(n,e){for(var t=new Array(n.length*4),r=0,i=0;r>>24,t[i+1]=s>>>16&255,t[i+2]=s>>>8&255,t[i+3]=s&255):(t[i+3]=s>>>24,t[i+2]=s>>>16&255,t[i+1]=s>>>8&255,t[i]=s&255)}return t}Tt.split32=C6;function b6(n,e){return n>>>e|n<<32-e}Tt.rotr32=b6;function x6(n,e){return n<>>32-e}Tt.rotl32=x6;function I6(n,e){return n+e>>>0}Tt.sum32=I6;function F6(n,e,t){return n+e+t>>>0}Tt.sum32_3=F6;function E6(n,e,t,r){return n+e+t+r>>>0}Tt.sum32_4=E6;function _6(n,e,t,r,i){return n+e+t+r+i>>>0}Tt.sum32_5=_6;function S6(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}Tt.sum64=S6;function U6(n,e,t,r){var i=e+r>>>0,s=(i>>0}Tt.sum64_hi=U6;function Q6(n,e,t,r){var i=e+r;return i>>>0}Tt.sum64_lo=Q6;function R6(n,e,t,r,i,s,o,a){var l=0,A=e;A=A+r>>>0,l+=A>>0,l+=A>>0,l+=A>>0}Tt.sum64_4_hi=R6;function M6(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Tt.sum64_4_lo=M6;function T6(n,e,t,r,i,s,o,a,l,A){var c=0,u=e;u=u+r>>>0,c+=u>>0,c+=u>>0,c+=u>>0,c+=u>>0}Tt.sum64_5_hi=T6;function N6(n,e,t,r,i,s,o,a,l,A){var c=e+r+s+a+A;return c>>>0}Tt.sum64_5_lo=N6;function k6(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Tt.rotr64_hi=k6;function D6(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Tt.rotr64_lo=D6;function L6(n,e,t){return n>>>t}Tt.shr64_hi=L6;function V6(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Tt.shr64_lo=V6;var Rf={},GR=Tt,P6=i0;function EC(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Rf.BlockHash=EC;EC.prototype.update=function(e,t){if(e=GR.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=GR.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Da.g0_256=J6;function H6(n){return va(n,17)^va(n,19)^n>>>10}Da.g1_256=H6;var nf=Tt,z6=Rf,Y6=Da,tx=nf.rotl32,dp=nf.sum32,X6=nf.sum32_5,j6=Y6.ft_1,bP=z6.BlockHash,K6=[1518500249,1859775393,2400959708,3395469782];function Ea(){if(!(this instanceof Ea))return new Ea;bP.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}nf.inherits(Ea,bP);var $6=Ea;Ea.blockSize=512;Ea.outSize=160;Ea.hmacStrength=80;Ea.padLength=64;Ea.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),VY(e.length<=this.blockSize);for(var t=e.length;t{s[a.toLowerCase()]=o}):r.headers.keys().forEach(o=>{s[o.toLowerCase()]=r.headers.get(o)}),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:At(new Uint8Array(i))}})}var ZY=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Bo=new we(OY);function YR(n){return new Promise(e=>{setTimeout(e,n)})}function ql(n,e){if(n==null)return null;if(typeof n=="string")return n;if(q_(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return r0(n)}catch{}return nt(n)}return n}function JY(n){return Fa(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function HY(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;Bo.assertArgument(r>0&&r%1===0,"invalid connection throttle limit","connection.throttleLimit",r);const i=typeof n=="object"?n.throttleCallback:null,s=typeof n=="object"&&typeof n.throttleSlotInterval=="number"?n.throttleSlotInterval:100;Bo.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof n=="object"?!!n.errorPassThrough:!1,a={};let l=null;const A={method:"GET"};let c=!1,u=2*60*1e3;if(typeof n=="string")l=n;else if(typeof n=="object"){if((n==null||n.url==null)&&Bo.throwArgumentError("missing URL","connection.url",n),l=n.url,typeof n.timeout=="number"&&n.timeout>0&&(u=n.timeout),n.headers)for(const m in n.headers)a[m.toLowerCase()]={key:m,value:String(n.headers[m])},["if-none-match","if-modified-since"].indexOf(m.toLowerCase())>=0&&(c=!0);if(A.allowGzip=!!n.allowGzip,n.user!=null&&n.password!=null){l.substring(0,6)!=="https:"&&n.allowInsecureAuthentication!==!0&&Bo.throwError("basic authentication requires a secure https url",we.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const m=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+XV(Fa(m))}}n.skipFetchSetup!=null&&(A.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(A.fetchOptions=xn(n.fetchOptions))}const h=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),d=l?l.match(h):null;if(d)try{const m={statusCode:200,statusMessage:"OK",headers:{"content-type":d[1]||"text/plain"},body:d[2]?YV(d[3]):JY(d[3])};let v=m.body;return t&&(v=t(m.body,m)),Promise.resolve(v)}catch(m){Bo.throwError("processing response error",we.errors.SERVER_ERROR,{body:ql(d[1],d[2]),error:m,requestBody:null,requestMethod:"GET",url:l})}e&&(A.method="POST",A.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const p={};Object.keys(a).forEach(m=>{const v=a[m];p[v.key]=v.value}),A.headers=p;const f=function(){let m=null;return{promise:new Promise(function(B,C){u&&(m=setTimeout(()=>{m!=null&&(m=null,C(Bo.makeError("timeout",we.errors.TIMEOUT,{requestBody:ql(A.body,p["content-type"]),requestMethod:A.method,timeout:u,url:l})))},u))}),cancel:function(){m!=null&&(clearTimeout(m),m=null)}}}(),g=function(){return ZY(this,void 0,void 0,function*(){for(let m=0;m=300)&&(f.cancel(),Bo.throwError("bad response",we.errors.SERVER_ERROR,{status:v.statusCode,headers:v.headers,body:ql(w,v.headers?v.headers["content-type"]:null),requestBody:ql(A.body,p["content-type"]),requestMethod:A.method,url:l})),t)try{const B=yield t(w,v);return f.cancel(),B}catch(B){if(B.throttleRetry&&m{let a=null;if(s!=null)try{a=JSON.parse(r0(s))}catch(l){Bo.throwError("invalid JSON",we.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=Fa(e);const s=typeof n=="string"?{url:n}:xn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=xn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return HY(n,i,r)}function ah(n,e){return e||(e={}),e=xn(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(t,r){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&r(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function A(){return n().then(function(c){if(c!==void 0)o()&&t(c);else if(e.oncePoll)e.oncePoll.once("poll",A);else if(e.onceBlock)e.onceBlock.once("block",A);else if(!s){if(l++,l>a){o()&&r(new Error("retry limit reached"));return}let u=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));ue.ceiling&&(u=e.ceiling),setTimeout(A,u)}return null},function(c){o()&&r(c)})}A()})}var Nw="qpzry9x8gf2tvdw0s3jn54khce6mua7l",oF={};for(var P0=0;P0>25;return(n&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function TP(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Th(e)^r>>5}for(e=Th(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=TP(n);if(typeof r=="string")throw new Error(r);for(var i=n+"1",s=0;s>5)throw new Error("Non 5-bit word");r=Th(r)^o,i+=Nw.charAt(o)}for(s=0;s<6;++s)r=Th(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Nw.charAt(a)}return i}function NP(n,e){if(e=e||90,n.length<8)return n+" too short";if(n.length>e)return"Exceeds length limit";var t=n.toLowerCase(),r=n.toUpperCase();if(n!==t&&n!==r)return"Mixed-case string "+n;n=t;var i=n.lastIndexOf("1");if(i===-1)return"No separator character for "+n;if(i===0)return"Missing prefix for "+n;var s=n.slice(0,i),o=n.slice(i+1);if(o.length<6)return"Data too short";var a=TP(s);if(typeof a=="string")return a;for(var l=[],A=0;A=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+n:{prefix:s,words:l}}function YY(){var n=NP.apply(null,arguments);if(typeof n=="object")return n}function XY(n){var e=NP.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function SC(n,e,t,r){for(var i=0,s=0,o=(1<=t;)s-=t,a.push(i>>s&o);if(r)s>0&&a.push(i<=e)return"Excess padding";if(i<>8,h=c&255;u?l.push(u,h):l.push(h)}return l}t.toArray=r;function i(o){return o.length===1?"0"+o:o}t.zero2=i;function s(o){for(var a="",l=0;l(h>>1)-1?f=(h>>1)-g:f=g,d.isubn(f)):f=0,u[p]=f,d.iushrn(1)}return u}t.getNAF=r;function i(l,A){var c=[[],[]];l=l.clone(),A=A.clone();for(var u=0,h=0,d;l.cmpn(-u)>0||A.cmpn(-h)>0;){var p=l.andln(3)+u&3,f=A.andln(3)+h&3;p===3&&(p=-1),f===3&&(f=-1);var g;p&1?(d=l.andln(7)+u&7,(d===3||d===5)&&f===2?g=-p:g=p):g=0,c[0].push(g);var m;f&1?(d=A.andln(7)+h&7,(d===3||d===5)&&p===2?m=-f:m=f):m=0,c[1].push(m),2*u===g+1&&(u=1-u),2*h===m+1&&(h=1-h),l.iushrn(1),A.iushrn(1)}return c}t.getJSF=i;function s(l,A,c){var u="_"+A;l.prototype[A]=function(){return this[u]!==void 0?this[u]:this[u]=c.call(this)}}t.cachedProperty=s;function o(l){return typeof l=="string"?t.toArray(l,"hex"):l}t.parseBytes=o;function a(l){return new vt(l,"hex","le")}t.intFromLE=a}),kw=vs.getNAF,nX=vs.getJSF,Dw=vs.assert;function hc(n,e){this.type=n,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Su=hc;hc.prototype.point=function(){throw new Error("Not implemented")};hc.prototype.validate=function(){throw new Error("Not implemented")};hc.prototype._fixedNafMul=function(e,t){Dw(e.precomputed);var r=e._getDoubles(),i=kw(t,1,this._bitLength),s=(1<=a;A--)l=(l<<1)+i[A];o.push(l)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),h=s;h>0;h--){for(a=0;a=0;l--){for(var A=0;l>=0&&o[l]===0;l--)A++;if(l>=0&&A++,a=a.dblp(A),l<0)break;var c=o[l];Dw(c!==0),e.type==="affine"?c>0?a=a.mixedAdd(s[c-1>>1]):a=a.mixedAdd(s[-c-1>>1].neg()):c>0?a=a.add(s[c-1>>1]):a=a.add(s[-c-1>>1].neg())}return e.type==="affine"?a.toP():a};hc.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,A=0,c,u,h;for(c=0;c=1;c-=2){var p=c-1,f=c;if(o[p]!==1||o[f]!==1){l[p]=kw(r[p],o[p],this._bitLength),l[f]=kw(r[f],o[f],this._bitLength),A=Math.max(l[p].length,A),A=Math.max(l[f].length,A);continue}var g=[t[p],null,null,t[f]];t[p].y.cmp(t[f].y)===0?(g[1]=t[p].add(t[f]),g[2]=t[p].toJ().mixedAdd(t[f].neg())):t[p].y.cmp(t[f].y.redNeg())===0?(g[1]=t[p].toJ().mixedAdd(t[f]),g[2]=t[p].add(t[f].neg())):(g[1]=t[p].toJ().mixedAdd(t[f]),g[2]=t[p].toJ().mixedAdd(t[f].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],v=nX(r[p],r[f]);for(A=Math.max(v[0].length,A),l[p]=new Array(A),l[f]=new Array(A),u=0;u=0;c--){for(var F=0;c>=0;){var x=!0;for(u=0;u=0&&F++,C=C.dblp(F),c<0)break;for(u=0;u0?h=a[u][_-1>>1]:_<0&&(h=a[u][-_-1>>1].neg()),h.type==="affine"?C=C.mixedAdd(h):C=C.add(h))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step):!1};oo.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,s=0;s=0&&(d=A,p=c),u.negative&&(u=u.neg(),h=h.neg()),d.negative&&(d=d.neg(),p=p.neg()),[{a:u,b:h},{a:d,b:p}]};ao.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=s.mul(r.a),l=o.mul(i.a),A=s.mul(r.b),c=o.mul(i.b),u=e.sub(a).sub(l),h=A.add(c).neg();return{k1:u,k2:h}};ao.prototype.pointFromX=function(e,t){e=new vt(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)};ao.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0};ao.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Ur.prototype.isInfinity=function(){return this.inf};Ur.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)};Ur.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Ur.prototype.getX=function(){return this.x.fromRed()};Ur.prototype.getY=function(){return this.y.fromRed()};Ur.prototype.mul=function(e){return e=new vt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Ur.prototype.mulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Ur.prototype.jmulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Ur.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Ur.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t};Ur.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Or(n,e,t,r){Su.BasePoint.call(this,n,"jacobian"),e===null&&t===null&&r===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}rS(Or,Su.BasePoint);ao.prototype.jpoint=function(e,t,r){return new Or(this,e,t,r)};Or.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)};Or.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Or.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),l=i.redSub(s),A=o.redSub(a);if(l.cmpn(0)===0)return A.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=l.redSqr(),u=c.redMul(l),h=i.redMul(c),d=A.redSqr().redIAdd(u).redISub(h).redISub(h),p=A.redMul(h.redISub(d)).redISub(o.redMul(u)),f=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(d,p,f)};Or.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=a.redSqr(),c=A.redMul(a),u=r.redMul(A),h=l.redSqr().redIAdd(c).redISub(u).redISub(u),d=l.redMul(u.redISub(h)).redISub(s.redMul(c)),p=this.z.redMul(a);return this.curve.jpoint(h,d,p)};Or.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}};Or.prototype.inspect=function(){return this.isInfinity()?"":""};Or.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Wy=Nf(function(n,e){var t=e;t.base=Su,t.short=iX,t.mont=null,t.edwards=null}),Gy=Nf(function(n,e){var t=e,r=vs.assert;function i(a){a.type==="short"?this.curve=new Wy.short(a):a.type==="edwards"?this.curve=new Wy.edwards(a):this.curve=new Wy.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,r(this.g.validate(),"Invalid curve"),r(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=i;function s(a,l){Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){var A=new i(l);return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,value:A}),A}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:ta.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:ta.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:ta.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:ta.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:ta.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ta.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ta.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:ta.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function tc(n){if(!(this instanceof tc))return new tc(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Uo.toArray(n.entropy,n.entropyEnc||"hex"),t=Uo.toArray(n.nonce,n.nonceEnc||"hex"),r=Uo.toArray(n.pers,n.persEnc||"hex");nS(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var DP=tc;tc.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1};tc.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=r,r=t,t=null),r&&(r=Uo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var sX=vs.assert;function UC(n,e){if(n instanceof UC)return n;this._importDER(n,e)||(sX(n.r&&n.s,"Signature without r or s"),this.r=new vt(n.r,16),this.s=new vt(n.s,16),n.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=n.recoveryParam)}var QC=UC;function oX(){this.place=0}function sx(n,e){var t=n[e.place++];if(!(t&128))return t;var r=t&15;if(r===0||r>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function jR(n){for(var e=0,t=n.length-1;!n[e]&&!(n[e+1]&128)&&e>>3);for(n.push(t|128);--t;)n.push(e>>>(t<<3)&255);n.push(e)}UC.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),r[0]&128&&(r=[0].concat(r)),t=jR(t),r=jR(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];ox(i,t.length),i=i.concat(t),i.push(2),ox(i,r.length);var s=i.concat(r),o=[48];return ox(o,s.length),o=o.concat(s),vs.encode(o,e)};var aX=function(){throw new Error("unsupported")},LP=vs.assert;function eo(n){if(!(this instanceof eo))return new eo(n);typeof n=="string"&&(LP(Object.prototype.hasOwnProperty.call(Gy,n),"Unknown curve "+n),n=Gy[n]),n instanceof Gy.PresetCurve&&(n={curve:n}),this.curve=n.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=n.curve.g,this.g.precompute(n.curve.n.bitLength()+1),this.hash=n.hash||n.curve.hash}var lX=eo;eo.prototype.keyPair=function(e){return new iS(this,e)};eo.prototype.keyFromPrivate=function(e,t){return iS.fromPrivate(this,e,t)};eo.prototype.keyFromPublic=function(e,t){return iS.fromPublic(this,e,t)};eo.prototype.genKeyPair=function(e){e||(e={});for(var t=new DP({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||aX(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new vt(2));;){var s=new vt(t.generate(r));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};eo.prototype._truncateToN=function(e,t){var r=e.byteLength()*8-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};eo.prototype.sign=function(e,t,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new vt(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new DP({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),A=this.n.sub(new vt(1)),c=0;;c++){var u=i.k?i.k(c):new vt(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(A)>=0)){var h=this.g.mul(u);if(!h.isInfinity()){var d=h.getX(),p=d.umod(this.n);if(p.cmpn(0)!==0){var f=u.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(f=f.umod(this.n),f.cmpn(0)!==0){var g=(h.getY().isOdd()?1:0)|(d.cmp(p)!==0?2:0);return i.canonical&&f.cmp(this.nh)>0&&(f=this.n.sub(f),g^=1),new QC({r:p,s:f,recoveryParam:g})}}}}}};eo.prototype.verify=function(e,t,r,i){e=this._truncateToN(new vt(e,16)),r=this.keyFromPublic(r,i),t=new QC(t,"hex");var s=t.r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),A=a.mul(s).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(l,r.getPublic(),A),c.isInfinity()?!1:c.eqXToP(s)):(c=this.g.mulAdd(l,r.getPublic(),A),c.isInfinity()?!1:c.getX().umod(this.n).cmp(s)===0)};eo.prototype.recoverPubKey=function(n,e,t,r){LP((3&t)===t,"The recovery param is more than two bits"),e=new QC(e,r);var i=this.n,s=new vt(n),o=e.r,a=e.s,l=t&1,A=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&A)throw new Error("Unable to find sencond key candinate");A?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var c=e.r.invm(i),u=i.sub(s).mul(c).umod(i),h=a.mul(c).umod(i);return this.g.mulAdd(u,o,h)};eo.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new QC(e,r),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(n,e,i)}catch{continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var AX=Nf(function(n,e){var t=e;t.version="6.5.4",t.utils=vs,t.rand=function(){throw new Error("unsupported")},t.curve=Wy,t.curves=Gy,t.ec=lX,t.eddsa=null}),cX=AX.ec;const uX="signing-key/5.7.0",lF=new we(uX);let ax=null;function sa(){return ax||(ax=new cX("secp256k1")),ax}class dX{constructor(e){Me(this,"curve","secp256k1"),Me(this,"privateKey",nt(e)),hu(this.privateKey)!==32&&lF.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=sa().keyFromPrivate(At(this.privateKey));Me(this,"publicKey","0x"+t.getPublic(!1,"hex")),Me(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Me(this,"_isSigningKey",!0)}_addPoint(e){const t=sa().keyFromPublic(At(this.publicKey)),r=sa().keyFromPublic(At(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=sa().keyFromPrivate(At(this.privateKey)),r=At(e);r.length!==32&&lF.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return xC({recoveryParam:i.recoveryParam,r:Pn("0x"+i.r.toString(16),32),s:Pn("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=sa().keyFromPrivate(At(this.privateKey)),r=sa().keyFromPublic(At(VP(e)));return Pn("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function hX(n,e){const t=xC(e),r={r:At(t.r),s:At(t.s)};return"0x"+sa().recoverPubKey(At(n),r,t.recoveryParam).encode("hex",!1)}function VP(n,e){const t=At(n);if(t.length===32){const r=new dX(t);return e?"0x"+sa().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?nt(t):"0x"+sa().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+sa().keyFromPublic(t).getPublic(!0,"hex"):nt(t)}return lF.throwArgumentError("invalid public or private key","key","[REDACTED]")}const fX="transactions/5.7.0",Jl=new we(fX);var KR;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(KR||(KR={}));function sS(n){return n==="0x"?null:Vr(n)}function Xr(n){return n==="0x"?KV:Ge.from(n)}function pX(n){const e=VP(n);return Vr(zr(ir(zr(e,1)),12))}function PP(n,e){return pX(hX(At(n),e))}function es(n,e){const t=tf(Ge.from(n).toHexString());return t.length>32&&Jl.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function lx(n,e){return{address:Vr(n),storageKeys:(e||[]).map((t,r)=>(hu(t)!==32&&Jl.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function Uu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&Jl.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),lx(t[0],t[1])):lx(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return lx(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function OP(n){return Uu(n).map(e=>[e.address,e.storageKeys])}function gX(n,e){if(n.gasPrice!=null){const r=Ge.from(n.gasPrice),i=Ge.from(n.maxFeePerGas||0);r.eq(i)||Jl.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[es(n.chainId||0,"chainId"),es(n.nonce||0,"nonce"),es(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),es(n.maxFeePerGas||0,"maxFeePerGas"),es(n.gasLimit||0,"gasLimit"),n.to!=null?Vr(n.to):"0x",es(n.value||0,"value"),n.data||"0x",OP(n.accessList||[])];if(e){const r=xC(e);t.push(es(r.recoveryParam,"recoveryParam")),t.push(tf(r.r)),t.push(tf(r.s))}return Si(["0x02",FC(t)])}function mX(n,e){const t=[es(n.chainId||0,"chainId"),es(n.nonce||0,"nonce"),es(n.gasPrice||0,"gasPrice"),es(n.gasLimit||0,"gasLimit"),n.to!=null?Vr(n.to):"0x",es(n.value||0,"value"),n.data||"0x",OP(n.accessList||[])];if(e){const r=xC(e);t.push(es(r.recoveryParam,"recoveryParam")),t.push(tf(r.r)),t.push(tf(r.s))}return Si(["0x01",FC(t)])}function WP(n,e,t){try{const r=Xr(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{Jl.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=Pn(e[1],32),n.s=Pn(e[2],32);try{const r=ir(t(n));n.from=PP(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function vX(n){const e=eS(n.slice(1));e.length!==9&&e.length!==12&&Jl.throwArgumentError("invalid component count for transaction type: 2","payload",nt(n));const t=Xr(e[2]),r=Xr(e[3]),i={type:2,chainId:Xr(e[0]).toNumber(),nonce:Xr(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:Xr(e[4]),to:sS(e[5]),value:Xr(e[6]),data:e[7],accessList:Uu(e[8])};return e.length===9||(i.hash=ir(n),WP(i,e.slice(9),gX)),i}function yX(n){const e=eS(n.slice(1));e.length!==8&&e.length!==11&&Jl.throwArgumentError("invalid component count for transaction type: 1","payload",nt(n));const t={type:1,chainId:Xr(e[0]).toNumber(),nonce:Xr(e[1]).toNumber(),gasPrice:Xr(e[2]),gasLimit:Xr(e[3]),to:sS(e[4]),value:Xr(e[5]),data:e[6],accessList:Uu(e[7])};return e.length===8||(t.hash=ir(n),WP(t,e.slice(8),mX)),t}function wX(n){const e=eS(n);e.length!==9&&e.length!==6&&Jl.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:Xr(e[0]).toNumber(),gasPrice:Xr(e[1]),gasLimit:Xr(e[2]),to:sS(e[3]),value:Xr(e[4]),data:e[5],chainId:0};if(e.length===6)return t;try{t.v=Ge.from(e[6]).toNumber()}catch{return t}if(t.r=Pn(e[7],32),t.s=Pn(e[8],32),Ge.from(t.r).isZero()&&Ge.from(t.s).isZero())t.chainId=t.v,t.v=0;else{t.chainId=Math.floor((t.v-35)/2),t.chainId<0&&(t.chainId=0);let r=t.v-27;const i=e.slice(0,6);t.chainId!==0&&(i.push(nt(t.chainId)),i.push("0x"),i.push("0x"),r-=t.chainId*2+8);const s=ir(FC(i));try{t.from=PP(s,{r:nt(t.r),s:nt(t.s),recoveryParam:r})}catch{}t.hash=ir(n)}return t.type=null,t}function BX(n){const e=At(n);if(e[0]>127)return wX(e);switch(e[0]){case 1:return yX(e);case 2:return vX(e)}return Jl.throwError(`unsupported transaction type: ${e[0]}`,we.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const fp=new we(ri);let $R=class et{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),s=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),l=this.number.bind(this),A=this.type.bind(this),c=u=>this.data(u,!0);return e.transaction={hash:o,type:A,accessList:et.allowNull(this.accessList.bind(this),null),blockHash:et.allowNull(o,null),blockNumber:et.allowNull(l,null),transactionIndex:et.allowNull(l,null),confirmations:et.allowNull(l,null),from:t,gasPrice:et.allowNull(r),maxPriorityFeePerGas:et.allowNull(r),maxFeePerGas:et.allowNull(r),gasLimit:r,to:et.allowNull(t,null),value:r,nonce:l,data:s,r:et.allowNull(this.uint256),s:et.allowNull(this.uint256),v:et.allowNull(l),creates:et.allowNull(t,null),raw:et.allowNull(s)},e.transactionRequest={from:et.allowNull(t),nonce:et.allowNull(l),gasLimit:et.allowNull(r),gasPrice:et.allowNull(r),maxPriorityFeePerGas:et.allowNull(r),maxFeePerGas:et.allowNull(r),to:et.allowNull(t),value:et.allowNull(r),data:et.allowNull(c),type:et.allowNull(l),accessList:et.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:t,topics:et.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:et.allowNull(this.address,null),from:et.allowNull(this.address,null),contractAddress:et.allowNull(t,null),transactionIndex:l,root:et.allowNull(a),gasUsed:r,logsBloom:et.allowNull(s),blockHash:o,transactionHash:o,logs:et.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:et.allowNull(l,null),cumulativeGasUsed:r,effectiveGasPrice:et.allowNull(r),status:et.allowNull(l),type:A},e.block={hash:et.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:et.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:et.allowNull(t),extraData:s,transactions:et.allowNull(et.arrayOf(o)),baseFeePerGas:et.allowNull(r)},e.blockWithTransactions=xn(e.block),e.blockWithTransactions.transactions=et.allowNull(et.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:et.allowNull(i,void 0),toBlock:et.allowNull(i,void 0),blockHash:et.allowNull(o,void 0),address:et.allowNull(t,void 0),topics:et.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:et.allowNull(l),blockHash:et.allowNull(o),transactionIndex:l,removed:et.allowNull(this.boolean.bind(this)),address:t,data:et.allowFalsish(s,"0x"),topics:et.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return Uu(e||[])}number(e){return e==="0x"?0:Ge.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ge.from(e).toNumber()}bigNumber(e){return Ge.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return typeof e=="string"&&(!t&&e.substring(0,2)!=="0x"&&(e="0x"+e),Ft(e))?e.toLowerCase():fp.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!==0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return Vr(e)}callAddress(e){if(!Ft(e,32))return null;const t=Vr(zr(e,12));return t===y9?null:t}contractAddress(e){return uP(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||Ft(e))return bC(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return hu(r)!==32?fp.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(e==null)return null;const t=Ge.from(e);try{return t.toNumber()}catch{}return null}uint256(e){if(!Ft(e))throw new Error("invalid uint256");return Pn(e,32)}_block(e,t){e.author!=null&&e.miner==null&&(e.miner=e.author);const r=e._difficulty!=null?e._difficulty:e.difficulty,i=et.check(t,e);return i._difficulty=r==null?null:Ge.from(r),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return et.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ge.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const t=et.check(this.formats.transaction,e);if(e.chainId!=null){let r=e.chainId;Ft(r)&&(r=Ge.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),Ft(r)&&(r=Ge.from(r).toNumber()),typeof r!="number"&&t.v!=null&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),typeof r!="number"&&(r=0),t.chainId=r}return t.blockHash&&t.blockHash.replace(/0/g,"")==="x"&&(t.blockHash=null),t}transaction(e){return BX(e)}receiptLog(e){return et.check(this.formats.receiptLog,e)}receipt(e){const t=et.check(this.formats.receipt,e);if(t.root!=null)if(t.root.length<=4){const r=Ge.from(t.root).toNumber();r===0||r===1?(t.status!=null&&t.status!==r&&fp.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):fp.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&fp.throwArgumentError("invalid root hash","value.root",t.root);return t.status!=null&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map(t=>this.topics(t)):e!=null?this.hash(e,!0):null}filter(e){return et.check(this.formats.filter,e)}filterLog(e){return et.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const i in e)try{const s=e[i](t[i]);s!==void 0&&(r[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=t[i],s}return r}static allowNull(e,t){return function(r){return r==null?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach(function(i){r.push(e(i))}),r}}};function CX(n){return n&&typeof n.isCommunityResource=="function"}function qR(n){return CX(n)&&n.isCommunityResource()}let e2=!1;function RC(){e2||(e2=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var gt=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const xt=new we(ri),bX=10;function t2(n){return n==null?"null":(hu(n)!==32&&xt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function n2(n){for(n=n.slice();n.length>0&&n[n.length-1]==null;)n.pop();return n.map(e=>{if(Array.isArray(e)){const t={};e.forEach(i=>{t[t2(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return t2(e)}).join("&")}function xX(n){return n===""?[]:n.split(/&/g).map(e=>{if(e==="")return[];const t=e.split("|").map(r=>r==="null"?null:r);return t.length===1?t[0]:t})}function ju(n){if(typeof n=="string"){if(n=n.toLowerCase(),hu(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+n2(n);if(g9.isForkEvent(n))throw xt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+n2(n.topics||[])}throw new Error("invalid event - "+n)}function pp(){return new Date().getTime()}function r2(n){return new Promise(e=>{setTimeout(e,n)})}const IX=["block","network","pending","poll"];let FX=class{constructor(e,t,r){Me(this,"tag",e),Me(this,"listener",t),Me(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const t=e[1],r=xX(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||IX.indexOf(this.tag)>=0}};const EX={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Ax(n){return Pn(Ge.from(n).toHexString(),32)}function i2(n){return nF.encode(is([n,zr(zR(zR(n)),0,4)]))}const GP=new RegExp("^(ipfs)://(.*)$","i"),s2=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),GP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Zy(n,e){try{return r0(tm(n,e))}catch{}return null}function tm(n,e){if(n==="0x")return null;const t=Ge.from(zr(n,e,e+32)).toNumber(),r=Ge.from(zr(n,t,t+32)).toNumber();return zr(n,t+32,t+32+r)}function cx(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):xt.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function o2(n){const e=At(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function _X(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function ZP(n){const e=[];let t=0;for(let r=0;rGe.from(e).eq(1)).catch(e=>{if(e.code===we.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return gt(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:Si([e,Oy(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=Si(["0x9061b923",ZP([t6(this.name),r.data])]));try{let s=yield this.provider.call(r);return At(s).length%32===4&&xt.throwError("resolver threw error",we.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=tm(s,0)),s}catch(s){if(s.code===we.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return gt(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?tm(r,0):null})}_getAddress(e,t){const r=EX[String(e)];if(r==null&&xt.throwError(`unsupported coin type: ${e}`,we.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),r.ilk==="eth")return this.provider.formatter.address(t);const i=At(t);if(r.p2pkh!=null){const s=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return i2(is([[r.p2pkh],"0x"+s[2]]))}}if(r.p2sh!=null){const s=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return i2(is([[r.p2sh],"0x"+s[2]]))}}if(r.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=XR.toWords(i.slice(2));return a.unshift(o),XR.encode(r.prefix,a)}}return null}getAddress(e){return gt(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===b9?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===we.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Ax(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&xt.throwError("invalid or unsupported coin data",we.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return gt(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(t==null)return null;for(let r=0;ro[l])}return xt.throwError("invalid or unsupported content hash data",we.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return gt(this,void 0,void 0,function*(){let t=Fa(e);t=is([Ax(64),Ax(t.length),t]),t.length%32!==0&&(t=is([t,Pn("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nt(t));return r==null||r==="0x"?null:r0(r)})}}let ux=null,SX=1;class oS extends n0{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Me(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(t=>{}),this._ready().catch(t=>{});else{const t=ss(new.target,"getNetwork")(e);t?(Me(this,"_network",t),this.emit("network",t,null)):xt.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return gt(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||xt.throwError("no network detected",we.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Me(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ah(()=>this._ready().then(e=>e,e=>{if(!(e.code===we.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return ux==null&&(ux=new $R),ux}static getNetwork(e){return zV(e??"homestead")}ccipReadFetch(e,t,r){return gt(this,void 0,void 0,function*(){if(this.disableCcipRead||r.length===0)return null;const i=e.to.toLowerCase(),s=t.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield _C({url:A,errorPassThrough:!0},c,(d,p)=>(d.status=p.statusCode,d));if(u.data)return u.data;const h=u.message||"unknown error";if(u.status>=400&&u.status<500)return xt.throwError(`response not found during CCIP fetch: ${h}`,we.errors.SERVER_ERROR,{url:l,errorMessage:h});o.push(h)}return xt.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,we.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return gt(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(pp()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=pp(),r=qn({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),s;const o=pp();return i=Ge.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return gt(this,void 0,void 0,function*(){const e=SX++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)xt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",xt.makeError("network block skew detected",we.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let i=this._emitted.block+1;i<=r;i++)this.emit("block",i);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&r-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=r-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});t.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=r-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=r;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(A=>{A.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=A.blockNumber),this._emitted["b:"+A.blockHash]=A.blockNumber,this._emitted["t:"+A.transactionHash]=A.blockNumber,this.emit(s,A)})}).catch(l=>{this.emit("error",l),i._inflight=!1});t.push(a)}break}}}),this._lastBlockNumber=r,Promise.all(t).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return gt(this,void 0,void 0,function*(){return xt.throwError("provider does not support network detection",we.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return gt(this,void 0,void 0,function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield r2(0),this._network;const r=xt.makeError("underlying network changed",we.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=pp();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return gt(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return gt(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=t?s:new Promise((o,a)=>{const l=[];let A=!1;const c=function(){return A?!0:(A=!0,l.forEach(h=>{h()}),!1)},u=h=>{h.confirmations{this.removeListener(e,u)}),i){let h=i.startBlock,d=null;const p=f=>gt(this,void 0,void 0,function*(){A||(yield r2(1e3),this.getTransactionCount(i.from).then(g=>gt(this,void 0,void 0,function*(){if(!A){if(g<=i.nonce)h=f;else{{const m=yield this.getTransaction(e);if(m&&m.blockNumber!=null)return}for(d==null&&(d=h-3,d{A||this.once("block",p)}))});if(A)return;this.once("block",p),l.push(()=>{this.removeListener("block",p)})}if(typeof r=="number"&&r>0){const h=setTimeout(()=>{c()||a(xt.makeError("timeout exceeded",we.errors.TIMEOUT,{timeout:r}))},r);h.unref&&h.unref(),l.push(()=>{clearTimeout(h)})}})})}getBlockNumber(){return gt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ge.from(e)}catch(t){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getBalance",r);try{return Ge.from(i)}catch(s){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getTransactionCount",r);try{return Ge.from(i).toNumber()}catch(s){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getCode",r);try{return nt(i)}catch(s){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>bC(o))}),s=yield this.perform("getStorageAt",i);try{return nt(s)}catch(o){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&hu(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&xt.throwError("Transaction hash mismatch from Provider.sendTransaction.",we.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>gt(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&r!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&xt.throwError("transaction failed",we.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(s=>nt(s)),r=this.formatter.transaction(e);r.confirmations==null&&(r.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,s,i)}catch(s){throw s.transaction=r,s.transactionHash=r.hash,s}})}_getTransactionRequest(e){return gt(this,void 0,void 0,function*(){const t=yield e,r={};return["from","to"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?Ge.from(s):null))}),["type"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s??null))}),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?nt(s):null))}),this.formatter.transactionRequest(yield qn(r))})}_getFilter(e){return gt(this,void 0,void 0,function*(){e=yield e;const t={};return e.address!=null&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach(r=>{e[r]!=null&&(t[r]=e[r])}),["fromBlock","toBlock"].forEach(r=>{e[r]!=null&&(t[r]=this._getBlockTag(e[r]))}),this.formatter.filter(yield qn(t))})}_call(e,t,r){return gt(this,void 0,void 0,function*(){r>=bX&&xt.throwError("CCIP read exceeded maximum redirections",we.errors.SERVER_ERROR,{redirects:r,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&t==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&hu(s)%32===4)try{const o=zr(s,4),a=zr(o,0,32);Ge.from(a).eq(i)||xt.throwError("CCIP Read sender did not match",we.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],A=Ge.from(zr(o,32,64)).toNumber(),c=Ge.from(zr(o,A,A+32)).toNumber(),u=zr(o,A+32);for(let m=0;mgt(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&r>this._emitted.block?null:void 0;if(t){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return gt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ah(()=>gt(this,void 0,void 0,function*(){const r=yield this.perform("getTransaction",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return gt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ah(()=>gt(this,void 0,void 0,function*(){const r=yield this.perform("getTransactionReceipt",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;if(r.blockHash==null)return;const i=this.formatter.receipt(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield qn({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),$R.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return gt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return gt(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&xt.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)})}getResolver(e){return gt(this,void 0,void 0,function*(){let t=e;for(;;){if(t===""||t==="."||e!=="eth"&&t==="eth")return null;const r=yield this._getResolver(t,"getResolver");if(r!=null){const i=new a2(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return gt(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||xt.throwError("network does not support ENS",we.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Oy(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return gt(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(Ft(e))throw r}typeof e!="string"&&xt.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return gt(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const t=e.substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(r==null)return null;const i=Zy(yield this.call({to:r,data:"0x691f3431"+Oy(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return gt(this,void 0,void 0,function*(){let t=null;if(Ft(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new a2(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==we.errors.CALL_EXCEPTION)throw a}try{const a=Zy(yield this.call({to:o,data:"0x691f3431"+Oy(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==we.errors.CALL_EXCEPTION)throw a;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return r==null?null:r.url})}perform(e,t){return xt.throwError(e+" not implemented",we.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(e,t,r){const i=new FX(ju(e),t,r);return this._events.push(i),this._startEvent(i),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,i=[],s=ju(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,t)},0),r=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),r}listenerCount(e){if(!e)return this._events.length;let t=ju(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=ju(e);return this._events.filter(r=>r.tag===t).map(r=>r.listener)}off(e,t){if(t==null)return this.removeAllListeners(e);const r=[];let i=!1,s=ju(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=t||i?!0:(i=!0,r.push(o),!1)),r.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let t=[];if(e==null)t=this._events,this._events=[];else{const r=ju(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const UX="abstract-signer/5.7.0";var fo=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Us=new we(UX),QX=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],RX=[we.errors.INSUFFICIENT_FUNDS,we.errors.NONCE_EXPIRED,we.errors.REPLACEMENT_UNDERPRICED];class s0{constructor(){Us.checkAbstract(new.target,s0),Me(this,"_isSigner",!0)}getBalance(e){return fo(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return fo(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return fo(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield qn(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return fo(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield qn(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return fo(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)})}getChainId(){return fo(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return fo(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return fo(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return fo(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)QX.indexOf(r)===-1&&Us.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=xn(e);return t.from==null?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then(r=>(r[0].toLowerCase()!==r[1].toLowerCase()&&Us.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return fo(this,void 0,void 0,function*(){const t=yield qn(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>fo(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&Us.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),t.to.catch(i=>{}));const r=t.maxFeePerGas!=null||t.maxPriorityFeePerGas!=null;if(t.gasPrice!=null&&(t.type===2||r)?Us.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&Us.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(t.type===2||t.type==null)&&t.maxFeePerGas!=null&&t.maxPriorityFeePerGas!=null)t.type=2;else if(t.type===0||t.type===1)t.gasPrice==null&&(t.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(t.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(t.type=2,t.gasPrice!=null){const s=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=s,t.maxPriorityFeePerGas=s}else t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(r&&Us.throwError("network does not support EIP-1559",we.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):Us.throwError("failed to get consistent fee data",we.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else t.type===2&&(t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return t.nonce==null&&(t.nonce=this.getTransactionCount("pending")),t.gasLimit==null&&(t.gasLimit=this.estimateGas(t).catch(i=>{if(RX.indexOf(i.code)>=0)throw i;return Us.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",we.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:t})})),t.chainId==null?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Us.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield qn(t)})}_checkProvider(e){this.provider||Us.throwError("missing provider",we.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class aS extends s0{constructor(e,t){super(),Me(this,"address",e),Me(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{Us.throwError(e,we.errors.UNSUPPORTED_OPERATION,{operation:t})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new aS(this.address,e)}}var ll=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const er=new we(ri),MX=["call","estimateGas"];function Qg(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=Ft(n.data)?n.data:null;if(!e||t)return{message:n.message,data:t}}if(typeof n=="object"){for(const t in n){const r=Qg(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return Qg(JSON.parse(n),e)}catch{}return null}function JP(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=Qg(e,!0);if(s)return s.data;er.throwError("missing revert data in call exception; Transaction reverted without a reason string",we.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=Qg(e.body,!1);s==null&&(s=Qg(e,!1)),s&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",we.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===we.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&er.throwError("insufficient funds for intrinsic transaction cost",we.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&er.throwError("nonce has already been used",we.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&er.throwError("replacement fee too low",we.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&er.throwError("legacy pre-eip-155 transactions not supported",we.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),MX.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",we.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function l2(n){return new Promise(function(e){setTimeout(e,n)})}function TX(n){if(n.error){const e=new Error(n.error.message);throw e.code=n.error.code,e.data=n.error.data,e}return n.result}function gp(n){return n&&n.toLowerCase()}const AF={};class HP extends s0{constructor(e,t,r){if(super(),e!==AF)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Me(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Me(this,"_address",this.provider.formatter.address(r)),Me(this,"_index",null)):typeof r=="number"?(Me(this,"_index",r),Me(this,"_address",null)):er.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return er.throwError("cannot alter JSON-RPC Signer connection",we.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new NX(AF,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&er.throwError("unknown account #"+this._index,we.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=xn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=xn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>ll(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&er.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),qn({tx:qn(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&er.throwArgumentError("from address mismatch","transaction",e):r.from=i;const s=this.provider.constructor.hexlifyTransaction(r,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&er.throwError("user rejected transaction",we.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),JP("sendTransaction",o,s)))})}signTransaction(e){return er.throwError("signing transactions is unsupported",we.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return ll(this,void 0,void 0,function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield ah(()=>ll(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(r);if(i!==null)return this.provider._wrapTransaction(i,r,t)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=r,i}})}signMessage(e){return ll(this,void 0,void 0,function*(){const t=typeof e=="string"?Fa(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[nt(t),r.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&er.throwError("user rejected signing",we.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return ll(this,void 0,void 0,function*(){const t=typeof e=="string"?Fa(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),nt(t)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&er.throwError("user rejected signing",we.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return ll(this,void 0,void 0,function*(){const i=yield ji.resolveNames(e,t,r,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(ji.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&er.throwError("user rejected signing",we.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return ll(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class NX extends HP{sendTransaction(e){return this.sendUncheckedTransaction(e).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:r=>this.provider.waitForTransaction(t,r)}))}}const kX={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class nm extends oS{constructor(e,t){let r=t;r==null&&(r=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(r),e||(e=ss(this.constructor,"defaultUrl")()),typeof e=="string"?Me(this,"connection",Object.freeze({url:e})):Me(this,"connection",Object.freeze(xn(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return ll(this,void 0,void 0,function*(){yield l2(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const t=ss(this.constructor,"getNetwork");try{return t(Ge.from(e).toNumber())}catch(r){return er.throwError("could not detect network",we.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return er.throwError("could not detect network",we.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new HP(AF,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(t=>this.formatter.address(t)))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:ls(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=_C(this.connection,JSON.stringify(r),TX).then(o=>(this.emit("debug",{action:"response",request:r,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:r,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[gp(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[gp(t.address),t.blockTag]];case"getCode":return["eth_getCode",[gp(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[gp(t.address),Pn(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[ss(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[ss(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=gp(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return ll(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=t.transaction;if(i&&i.type!=null&&Ge.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=xn(t),t.transaction=xn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&er.throwError(e+" not implemented",we.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return JP(e,i,t)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then(function(r){function i(){e.send("eth_getFilterChanges",[r]).then(function(s){if(e._pendingFilter!=t)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return l2(1e3)})}).then(function(){if(e._pendingFilter!=t){e.send("eth_uninstallFilter",[r]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),r}).catch(r=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=xn(kX);if(t)for(const s in t)t[s]&&(r[s]=!0);c9(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=bC(Ge.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=nt(e[s]))}),e.accessList&&(i.accessList=Uu(e.accessList)),i}}let Rg=null;try{if(Rg=WebSocket,Rg==null)throw new Error("inject please")}catch{const e=new we(ri);Rg=function(){e.throwError("WebSockets not supported in this environment",we.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var dx=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const O0=new we(ri);let DX=1;class lS extends nm{constructor(e,t){t==="any"&&O0.throwError("WebSocketProvider does not support 'any' network yet",we.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Me(this,"_websocket",new Rg(this.connection.url)):Me(this,"_websocket",e),Me(this,"_requests",{}),Me(this,"_subs",{}),Me(this,"_subIds",{}),Me(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const s=i.data,o=JSON.parse(s);if(o.id!=null){const a=String(o.id),l=this._requests[a];if(delete this._requests[a],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let A=null;o.error?(A=new Error(o.error.message||"unknown error"),Me(A,"code",o.error.code||null),Me(A,"response",s)):A=new Error("unknown error"),l.callback(A,void 0),this.emit("debug",{action:"response",error:A,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const r=setInterval(()=>{this.emit("poll")},1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){O0.throwError("cannot reset events block on WebSocketProvider",we.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){O0.throwError("cannot set polling interval on WebSocketProvider",we.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return dx(this,void 0,void 0,function*(){return null})}set polling(e){e&&O0.throwError("cannot set polling on WebSocketProvider",we.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=DX++;return new Promise((i,s)=>{function o(l,A){return l?s(l):i(A)}const a=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(r)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return dx(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(t).then(o=>this.send("eth_subscribe",o)),this._subIds[e]=i);const s=yield i;this._subs[s]={tag:e,processFunc:r}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],t=>{const r=Ge.from(t.number).toNumber();this._emitted.block=r,this.emit("block",r)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],t=>{this.emit("pending",t)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],t=>{t.removed==null&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))});break;case"tx":{const t=r=>{const i=r.hash;this.getTransactionReceipt(i).then(s=>{s&&this.emit(i,s)})};t(e),this._subscribe("tx",["newHeads"],r=>{this._events.filter(i=>i.type==="tx").forEach(t)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let t=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return dx(this,void 0,void 0,function*(){this.websocket.readyState===Rg.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var LX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const og=new we(ri);class zP extends nm{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return LX(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||og.throwError("no network detected",we.errors.UNKNOWN_ERROR,{}),this._network==null&&(Me(this,"_network",t),this.emit("network",t,null))),t})}}class fc extends zP{constructor(e,t){og.checkAbstract(new.target,fc),e=ss(new.target,"getNetwork")(e),t=ss(new.target,"getApiKey")(t);const r=ss(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Me(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Me(this,i,t[i])})}_startPending(){og.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return og.throwError("API provider does not support signing",we.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return og.throwError("not implemented; sub-classes must override getUrl",we.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const A2=new we(ri),Jy="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class VX extends lS{constructor(e,t){const r=new YP(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Me(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===Jy}}class YP extends fc{static getWebSocketProvider(e,t){return new VX(e,t)}static getApiKey(e){return e==null?Jy:(e&&typeof e!="string"&&A2.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:A2.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===Jy&&RC(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Jy}}const PX=new we(ri),W0="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function OX(n){switch(n){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return PX.throwArgumentError("unsupported network","name",n)}class WX extends fc{isCommunityResource(){return this.apiKey===W0}static getApiKey(e){return e??W0}static getUrl(e,t){t==null&&(t=W0);const r={allowGzip:!0,url:"https://"+OX(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===W0&&RC(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var GX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const c2=new we(ri);class ZX extends fc{static getApiKey(e){return e!=null&&c2.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="https://cloudflare-eth.com/";break;default:c2.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return GX(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,e,t)})}}var G0=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const bA=new we(ri);function u2(n){const e={};for(let t in n){if(n[t]==null)continue;let r=n[t];t==="type"&&r===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[t]?r=bC(nt(r)):t==="accessList"?r="["+Uu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=nt(r),e[t]=r)}return e}function JX(n){if(n.status==0&&(n.message==="No records found"||n.message==="No transactions found"))return n.result;if(n.status!=1||typeof n.message!="string"||!n.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(n),(n.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return n.result}function d2(n){if(n&&n.status==0&&n.message=="NOTOK"&&(n.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(n),e.throttleRetry=!0,e}if(n.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(n),e}if(n.error){const e=new Error(n.error.message||"unknown error");throw n.error.code&&(e.code=n.error.code),n.error.data&&(e.data=n.error.data),e}return n.result}function h2(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function hx(n,e,t){if(n==="call"&&e.code===we.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let s=i.data;if(s&&(s="0x"+s.replace(/^.*0x/i,"")),Ft(s))return s;bA.throwError("missing revert data in call exception",we.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===we.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?r=e.error.message:typeof e.body=="string"?r=e.body:typeof e.responseText=="string"&&(r=e.responseText)),r=(r||"").toLowerCase(),r.match(/insufficient funds/)&&bA.throwError("insufficient funds for intrinsic transaction cost",we.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&bA.throwError("nonce has already been used",we.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&bA.throwError("replacement fee too low",we.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&bA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",we.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class HX extends oS{constructor(e,t){super(e),Me(this,"baseUrl",this.getBaseUrl()),Me(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return bA.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce((s,o)=>{const a=t[o];return a!=null&&(s+=`&${o}=${a}`),s},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return G0(this,void 0,void 0,function*(){const i=r?this.getPostUrl():this.getUrl(e,t),s=r?this.getPostData(e,t):null,o=e==="proxy"?d2:JX;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,u)=>(this.isCommunityResource()&&RC(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(c=>`${c}=${s[c]}`).join("&"));const A=yield _C(a,l,o||d2);return this.emit("debug",{action:"response",request:i,response:ls(A),provider:this}),A})}detectNetwork(){return G0(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return G0(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(i=>hx("sendTransaction",i,t.signedTransaction));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=u2(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return hx("call",s,t.transaction)}}case"estimateGas":{const i=u2(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return hx("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=h2(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=h2(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&bA.throwError("unsupported topic count",we.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&bA.throwError("unsupported topic format",we.errors.UNSUPPORTED_OPERATION,{topic0:a}),i.topic0=a}const s=yield this.fetch("logs",i);let o={};for(let a=0;a{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function zX(n){n=n.slice();for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}return n}var Lw=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Zc=new we(ri);function Z0(){return new Date().getTime()}function f2(n){let e=null;for(let t=0;te?null:(r+i)/2}function lh(n){if(n===null)return"null";if(typeof n=="number"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="string")return n;if(Ge.isBigNumber(n))return n.toString();if(Array.isArray(n))return JSON.stringify(n.map(e=>lh(e)));if(typeof n=="object"){const e=Object.keys(n);return e.sort(),"{"+e.map(t=>{let r=n[t];return typeof r=="function"?r="[function]":r=lh(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let YX=1;function g2(n){let e=null,t=null,r=new Promise(o=>{e=function(){t&&(clearTimeout(t),t=null),o()},t=setTimeout(e,n)});const i=o=>(r=r.then(o),r);function s(){return r}return{cancel:e,getPromise:s,wait:i}}const XX=[we.errors.CALL_EXCEPTION,we.errors.INSUFFICIENT_FUNDS,we.errors.NONCE_EXPIRED,we.errors.REPLACEMENT_UNDERPRICED,we.errors.UNPREDICTABLE_GAS_LIMIT],jX=["address","args","errorArgs","errorSignature","method","transaction"];function J0(n,e){const t={weight:n.weight};return Object.defineProperty(t,"provider",{get:()=>n.provider}),n.start&&(t.start=n.start),e&&(t.duration=e-n.start),n.done&&(n.error?t.error=n.error:t.result=n.result||null),t}function KX(n,e){return function(t){const r={};t.forEach(s=>{const o=n(s.result);r[o]||(r[o]={count:0,result:s.result}),r[o].count++});const i=Object.keys(r);for(let s=0;s=e)return o.result}}}function $X(n,e,t){let r=lh;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=p2(i.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),s.indexOf(o+1)>=0&&o++,o>=n._highestBlockNumber&&(n._highestBlockNumber=o),n._highestBlockNumber};case"getGasPrice":return function(i){const s=i.map(o=>o.result);return s.sort(),s[Math.floor(s.length/2)]};case"getEtherPrice":return function(i){return p2(i.map(s=>s.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":r=function(i){return i==null?null:(i=xn(i),i.confirmations=-1,lh(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=xn(i),i.transactions=i.transactions.map(s=>(s=xn(s),s.confirmations=-1,s)),lh(i))}:r=function(i){return i==null?null:lh(i)};break;default:throw new Error("unknown method: "+e)}return KX(r,n.quorum)}function mp(n,e){return Lw(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:ah(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function qX(n,e,t,r){return Lw(this,void 0,void 0,function*(){let i=n.provider;switch(t){case"getBlockNumber":case"getGasPrice":return i[t]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return r.blockTag&&Ft(r.blockTag)&&(i=yield mp(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Ft(r.blockTag)&&(i=yield mp(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Ft(r.blockTag)&&(i=yield mp(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Ft(r.blockTag)&&(i=yield mp(n,e)),t==="call"&&r.blockTag?i[t](r.transaction,r.blockTag):i[t](r.transaction);case"getTransaction":case"getTransactionReceipt":return i[t](r.transactionHash);case"getLogs":{let s=r.filter;return(s.fromBlock&&Ft(s.fromBlock)||s.toBlock&&Ft(s.toBlock))&&(i=yield mp(n,e)),i.getLogs(s)}}return Zc.throwError("unknown method error",we.errors.UNKNOWN_ERROR,{method:t,params:r})})}class e8 extends oS{constructor(e,t){e.length===0&&Zc.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(n0.isProvider(o)){const c=qR(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=xn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=qR(o)?2e3:750),l.weight==null&&(l.weight=1);const A=l.weight;return(A%1||A>512||A<1)&&Zc.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,A),Object.freeze(l)}),i=r.reduce((o,a)=>o+a.weight,0);t==null?t=i/2:t>i&&Zc.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=f2(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Me(this,"providerConfigs",Object.freeze(r)),Me(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return Lw(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return f2(e)})}perform(e,t){return Lw(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(A=>A.provider.sendTransaction(t.signedTransaction).then(c=>c.hash,c=>c)));for(let A=0;Al.priority-A.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=Z0();let A=i.filter(d=>d.runner&&l-d.startd+p.weight,0);for(;A{d.staller=null}),d.runner=qX(d,s,e,t).then(f=>{d.done=!0,d.result=f,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:J0(d,Z0()),request:{method:e,params:ls(t)},provider:this})},f=>{d.done=!0,d.error=f,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:J0(d,Z0()),request:{method:e,params:ls(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:J0(d,null),request:{method:e,params:ls(t)},provider:this}),A+=d.weight}const c=[];i.forEach(d=>{d.done||!d.runner||(c.push(d.runner),d.staller&&c.push(d.staller.getPromise()))}),c.length&&(yield Promise.race(c));const u=i.filter(d=>d.done&&d.error==null);if(u.length>=this.quorum){const d=r(u);if(d!==void 0)return i.forEach(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),d;a||(yield g2(100).getPromise()),a=!1}const h=i.reduce((d,p)=>{if(!p.done||p.error==null)return d;const f=p.error.code;return XX.indexOf(f)>=0&&(d[f]||(d[f]={error:p.error,weight:0}),d[f].weight+=p.weight),d},{});if(Object.keys(h).forEach(d=>{const p=h[d];if(p.weight{m.staller&&m.staller.cancel(),m.cancelled=!0});const f=p.error,g={};jX.forEach(m=>{f[m]!=null&&(g[m]=f[m])}),Zc.throwError(f.reason||f.message,d,g)}),i.filter(d=>!d.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),Zc.throwError("failed to meet quorum",we.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>J0(l)),provider:this})})}}const t8=null,Hy=new we(ri),ag="84842078b09946638c03157f83405213";class n8 extends lS{constructor(e,t){const r=new XP(e,t),i=r.connection;i.password&&Hy.throwError("INFURA WebSocket project secrets unsupported",we.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Me(this,"apiKey",r.projectId),Me(this,"projectId",r.projectId),Me(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===ag}}class XP extends fc{static getWebSocketProvider(e,t){return new n8(e,t)}static getApiKey(e){const t={apiKey:ag,projectId:ag,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(Hy.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),Hy.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:Hy.throwError("unsupported network",we.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===ag&&RC(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===ag}}const fx=new we(ri),r8="ETHERS_JS_SHARED";class i8 extends fc{static getApiKey(e){return e&&typeof e!="string"&&fx.throwArgumentError("invalid apiKey","apiKey",e),e||r8}static getUrl(e,t){fx.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:fx.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const m2=new we(ri),v2="62e1ad51b37b8e00394bda3b";class s8 extends fc{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=v2:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:m2.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:m2.throwError("unsupported network",we.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${r}/v1/lb/${t.applicationId}`,s={headers:{},url:i};return t.applicationSecretKey!=null&&(s.user="",s.password=t.applicationSecretKey),s}isCommunityResource(){return this.applicationId===v2}}const y2=new we(ri);let o8=1;function w2(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:o8++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:ls(s),provider:this}),e(s,(l,A)=>{if(l)return this.emit("debug",{action:"response",fetcher:t,error:l,request:s,provider:this}),a(l);if(this.emit("debug",{action:"response",fetcher:t,request:s,response:A,provider:this}),A.error){const c=new Error(A.error.message);return c.code=A.error.code,c.data=A.error.data,a(c)}o(A.result)})})}}function a8(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:ls(r),provider:this}),n.request(r).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:i,provider:this}),i})}}class AS extends nm{constructor(e,t){e==null&&y2.throwArgumentError("missing provider","provider",e);let r=null,i=null,s=null;typeof e=="function"?(r="unknown:",i=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),s=e,e.request?(r===""&&(r="eip-1193:"),i=a8(e)):e.sendAsync?i=w2(e,e.sendAsync.bind(e)):e.send?i=w2(e,e.send.bind(e)):y2.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Me(this,"jsonRpcFetchFunc",i),Me(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const B2=new we(ri);function l8(n,e){if(n==null&&(n="homestead"),typeof n=="string"){const r=n.match(/^(ws|http)s?:/i);if(r)switch(r[1].toLowerCase()){case"http":case"https":return new nm(n);case"ws":case"wss":return new lS(n);default:B2.throwArgumentError("unsupported URL scheme","network",n)}}const t=zV(n);return(!t||!t._defaultProvider)&&B2.throwError("unsupported getDefaultProvider network",we.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:e8,AlchemyProvider:YP,AnkrProvider:WX,CloudflareProvider:ZX,EtherscanProvider:HX,InfuraProvider:XP,JsonRpcProvider:nm,NodesmithProvider:i8,PocketProvider:s8,Web3Provider:AS,IpcProvider:t8},e)}var A8=!0,px="Invariant failed";function yl(n,e){if(!n){if(A8)throw new Error(px);var t=typeof e=="function"?e():e,r=t?"".concat(px,": ").concat(t):px;throw new Error(r)}}var _o;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(_o||(_o={}));function rm(){return rm=Object.assign||function(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function zy(n,e,t){return c8()?zy=Reflect.construct:zy=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&im(A,o.prototype),A},zy.apply(null,arguments)}function u8(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Vw(n){var e=typeof Map=="function"?new Map:void 0;return Vw=function(r){if(r===null||!u8(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return zy(r,arguments,cF(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),im(i,r)},Vw(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function C2(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function KP(n){if(typeof n=="string"){n=n.replace(/^Ox/,"0x");var e=Number.parseInt(n,n.trim().substring(0,2)==="0x"?16:10);return Number.isNaN(e)&&yl(!1),e}else return Number.isInteger(n)||yl(!1),n}function $P(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||yl(!1);for(var e=n.substring(0,2)==="0x"?n:"0x"+n,t=e.toLowerCase().substring(2).split(""),r=new Uint8Array(40),i=0;i<40;i++)r[i]=t[i].charCodeAt(0);for(var s=At(ir(r)),o=0;o<40;o+=2)s[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(s[o>>1]&15)>=8&&(t[o+1]=t[o+1].toUpperCase());var a="0x"+t.join("");return e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==a&&yl(!1),a}var b2=function(e,t){try{var r=function(o){return Promise.resolve(Promise.all([t.chainId===void 0?e.getChainId():t.chainId,t.account===void 0?e.getAccount():t.account])).then(function(a){var l=a[0],A=a[1],c=KP(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(c))throw new qP(c,e.supportedChainIds);var u=A===null?A:$P(A);return{provider:o,chainId:c,account:u}})},i=t.provider===void 0;return Promise.resolve(i?Promise.resolve(e.getProvider()).then(r):r(t.provider))}catch(s){return Promise.reject(s)}},H0=function(n){jP(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Vw(Error)),qP=function(n){jP(e,n);function e(t,r){var i;return i=n.call(this)||this,i.name=i.constructor.name,i.message="Unsupported chain id: "+t+". Supported chain ids are: "+r+".",i}return e}(Vw(Error)),Cr;(function(n){n[n.ACTIVATE_CONNECTOR=0]="ACTIVATE_CONNECTOR",n[n.UPDATE=1]="UPDATE",n[n.UPDATE_FROM_ERROR=2]="UPDATE_FROM_ERROR",n[n.ERROR=3]="ERROR",n[n.ERROR_FROM_ACTIVATION=4]="ERROR_FROM_ACTIVATION",n[n.DEACTIVATE_CONNECTOR=5]="DEACTIVATE_CONNECTOR"})(Cr||(Cr={}));function d8(n,e){var t=e.type,r=e.payload;switch(t){case Cr.ACTIVATE_CONNECTOR:{var i=r.connector,s=r.provider,o=r.chainId,a=r.account,l=r.onError;return{connector:i,provider:s,chainId:o,account:a,onError:l}}case Cr.UPDATE:{var A=r.provider,c=r.chainId,u=r.account;return rm({},n,A===void 0?{}:{provider:A},c===void 0?{}:{chainId:c},u===void 0?{}:{account:u})}case Cr.UPDATE_FROM_ERROR:{var h=r.provider,d=r.chainId,p=r.account;return rm({},n,h===void 0?{}:{provider:h},d===void 0?{}:{chainId:d},p===void 0?{}:{account:p},{error:void 0})}case Cr.ERROR:{var f=r.error,g=n.connector,m=n.onError;return{connector:g,error:f,onError:m}}case Cr.ERROR_FROM_ACTIVATION:{var v=r.connector,w=r.error;return{connector:v,error:w}}case Cr.DEACTIVATE_CONNECTOR:return{}}}function h8(){var n=Be.useReducer(d8,{}),e=n[0],t=n[1],r=e.connector,i=e.provider,s=e.chainId,o=e.account,a=e.onError,l=e.error,A=Be.useRef(-1);A.current+=1;var c=Be.useCallback(function(g,m,v){v===void 0&&(v=!1);try{var w=A.current,B=!1;return Promise.resolve(C2(function(){return Promise.resolve(g.activate().then(function(C){return B=!0,C})).then(function(C){return Promise.resolve(b2(g,C)).then(function(b){if(A.current>w)throw new H0;t({type:Cr.ACTIVATE_CONNECTOR,payload:rm({connector:g},b,{onError:m})})})})},function(C){if(C instanceof H0)B&&g.deactivate();else{if(v)throw B&&g.deactivate(),C;m?(B&&g.deactivate(),m(C)):t({type:Cr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:C}})}}))}catch(C){return Promise.reject(C)}},[]),u=Be.useCallback(function(g){t({type:Cr.ERROR,payload:{error:g}})},[]),h=Be.useCallback(function(){t({type:Cr.DEACTIVATE_CONNECTOR})},[]),d=Be.useCallback(function(g){try{if(!r)throw Error("This should never happen, it's just so Typescript stops complaining");var m=A.current;return Promise.resolve(function(){if(l)return C2(function(){return Promise.resolve(b2(r,g)).then(function(C){if(A.current>m)throw new H0;t({type:Cr.UPDATE_FROM_ERROR,payload:C})})},function(C){C instanceof H0||(a?a(C):t({type:Cr.ERROR,payload:{error:C}}))});var v=g.chainId===void 0?void 0:KP(g.chainId);if(v!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(v)){var w=new qP(v,r.supportedChainIds);a?a(w):t({type:Cr.ERROR,payload:{error:w}})}else{var B=typeof g.account=="string"?$P(g.account):g.account;t({type:Cr.UPDATE,payload:{provider:g.provider,chainId:v,account:B}})}}())}catch(v){return Promise.reject(v)}},[r,l,a]),p=Be.useCallback(function(g){a?a(g):t({type:Cr.ERROR,payload:{error:g}})},[a]),f=Be.useCallback(function(){t({type:Cr.DEACTIVATE_CONNECTOR})},[]);return Be.useEffect(function(){return function(){r&&r.deactivate()}},[r]),Be.useEffect(function(){return r&&r.on(_o.Update,d).on(_o.Error,p).on(_o.Deactivate,f),function(){r&&r.off(_o.Update,d).off(_o.Error,p).off(_o.Deactivate,f)}},[r,d,p,f]),{connector:r,provider:i,chainId:s,account:o,activate:c,setError:u,deactivate:h,error:l}}var eO="primary",Ah={};function f8(n){Ah[n]&&yl(!1),Ah[n]=Be.createContext({activate:function(){try{return yl(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){yl(!1)},deactivate:function(){yl(!1)},active:!1}),Ah[n].displayName="Web3ReactContext - "+n;var e=Ah[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=h8(),a=o.connector,l=o.provider,A=o.chainId,c=o.account,u=o.activate,h=o.setError,d=o.deactivate,p=o.error,f=a!==void 0&&A!==void 0&&c!==void 0&&!p,g=Be.useMemo(function(){return f&&A!==void 0&&Number.isInteger(A)&&a?i(l,a):void 0},[f,i,l,a,A]),m={connector:a,library:g,chainId:A,account:c,activate:u,setError:h,deactivate:d,active:f,error:p};return X.createElement(e,{value:m},s)}}var p8=f8(eO);function g8(n){return n===void 0&&(n=eO),Object.keys(Ah).includes(n)||yl(!1),Ah[n]}function m8(n){return Be.useContext(g8(n))}var uF={},tO={exports:{}},ys={},nO={exports:{}},rO={};/** + */(function(n){(function(){var e="input is invalid type",t="finalize already called",r=typeof window=="object",i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var s=!r&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=pa:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&n.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",A="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],u=[4,1024,262144,67108864],h=[1,256,65536,16777216],d=[6,1536,393216,100663296],p=[0,8,16,24],f=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],m=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(T){return Object.prototype.toString.call(T)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(T){return typeof T=="object"&&T.buffer&&T.buffer.constructor===ArrayBuffer});for(var B=function(T,ee,pe){return function(de){return new E(T,ee,T).update(de)[pe]()}},C=function(T,ee,pe){return function(de,Ae){return new E(T,ee,Ae).update(de)[pe]()}},b=function(T,ee,pe){return function(de,Ae,$,ce){return y["cshake"+T].update(de,Ae,$,ce)[pe]()}},F=function(T,ee,pe){return function(de,Ae,$,ce){return y["kmac"+T].update(de,Ae,$,ce)[pe]()}},x=function(T,ee,pe,de){for(var Ae=0;Ae>5,this.byteCount=this.blockCount<<2,this.outputBlocks=pe>>5,this.extraBytes=(pe&31)>>3;for(var de=0;de<50;++de)this.s[de]=0}E.prototype.update=function(T){if(this.finalized)throw new Error(t);var ee,pe=typeof T;if(pe!=="string"){if(pe==="object"){if(T===null)throw new Error(e);if(l&&T.constructor===ArrayBuffer)T=new Uint8Array(T);else if(!Array.isArray(T)&&(!l||!ArrayBuffer.isView(T)))throw new Error(e)}else throw new Error(e);ee=!0}for(var de=this.blocks,Ae=this.byteCount,$=T.length,ce=this.blockCount,ge=0,Fe=this.s,P,fe;ge<$;){if(this.reset)for(this.reset=!1,de[0]=this.block,P=1;P>2]|=T[ge]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(de[P>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=Ae){for(this.start=P-Ae,this.block=de[ce],P=0;P>8,pe=T&255;pe>0;)Ae.unshift(pe),T=T>>8,pe=T&255,++de;return ee?Ae.push(de):Ae.unshift(de),this.update(Ae),Ae.length},E.prototype.encodeString=function(T){var ee,pe=typeof T;if(pe!=="string"){if(pe==="object"){if(T===null)throw new Error(e);if(l&&T.constructor===ArrayBuffer)T=new Uint8Array(T);else if(!Array.isArray(T)&&(!l||!ArrayBuffer.isView(T)))throw new Error(e)}else throw new Error(e);ee=!0}var de=0,Ae=T.length;if(ee)de=Ae;else for(var $=0;$=57344?de+=3:(ce=65536+((ce&1023)<<10|T.charCodeAt(++$)&1023),de+=4)}return de+=this.encode(de*8),this.update(T),de},E.prototype.bytepad=function(T,ee){for(var pe=this.encode(ee),de=0;de>2]|=this.padding[ee&3],this.lastByteIndex===this.byteCount)for(T[0]=T[pe],ee=1;ee>4&15]+A[ge&15]+A[ge>>12&15]+A[ge>>8&15]+A[ge>>20&15]+A[ge>>16&15]+A[ge>>28&15]+A[ge>>24&15];$%T===0&&(re(ee),Ae=0)}return de&&(ge=ee[Ae],ce+=A[ge>>4&15]+A[ge&15],de>1&&(ce+=A[ge>>12&15]+A[ge>>8&15]),de>2&&(ce+=A[ge>>20&15]+A[ge>>16&15])),ce},E.prototype.arrayBuffer=function(){this.finalize();var T=this.blockCount,ee=this.s,pe=this.outputBlocks,de=this.extraBytes,Ae=0,$=0,ce=this.outputBits>>3,ge;de?ge=new ArrayBuffer(pe+1<<2):ge=new ArrayBuffer(ce);for(var Fe=new Uint32Array(ge);$>8&255,ce[ge+2]=Fe>>16&255,ce[ge+3]=Fe>>24&255;$%T===0&&re(ee)}return de&&(ge=$<<2,Fe=ee[Ae],ce[ge]=Fe&255,de>1&&(ce[ge+1]=Fe>>8&255),de>2&&(ce[ge+2]=Fe>>16&255)),ce};function z(T,ee,pe){E.call(this,T,ee,pe)}z.prototype=new E,z.prototype.finalize=function(){return this.encode(this.outputBits,!0),E.prototype.finalize.call(this)};var re=function(T){var ee,pe,de,Ae,$,ce,ge,Fe,P,fe,ue,q,K,oe,ye,be,W,H,ie,ae,me,J,Q,S,Z,te,le,se,Ue,_e,Te,Pe,ke,he,Ee,Se,Re,Je,qe,dt,cn,Et,st,Ar,wt,qt,co,Yt,en,ne,ve,xe,Ce,Ie,We,at,$e,je,Bt,pt,yt,zt,Wr;for(de=0;de<48;de+=2)Ae=T[0]^T[10]^T[20]^T[30]^T[40],$=T[1]^T[11]^T[21]^T[31]^T[41],ce=T[2]^T[12]^T[22]^T[32]^T[42],ge=T[3]^T[13]^T[23]^T[33]^T[43],Fe=T[4]^T[14]^T[24]^T[34]^T[44],P=T[5]^T[15]^T[25]^T[35]^T[45],fe=T[6]^T[16]^T[26]^T[36]^T[46],ue=T[7]^T[17]^T[27]^T[37]^T[47],q=T[8]^T[18]^T[28]^T[38]^T[48],K=T[9]^T[19]^T[29]^T[39]^T[49],ee=q^(ce<<1|ge>>>31),pe=K^(ge<<1|ce>>>31),T[0]^=ee,T[1]^=pe,T[10]^=ee,T[11]^=pe,T[20]^=ee,T[21]^=pe,T[30]^=ee,T[31]^=pe,T[40]^=ee,T[41]^=pe,ee=Ae^(Fe<<1|P>>>31),pe=$^(P<<1|Fe>>>31),T[2]^=ee,T[3]^=pe,T[12]^=ee,T[13]^=pe,T[22]^=ee,T[23]^=pe,T[32]^=ee,T[33]^=pe,T[42]^=ee,T[43]^=pe,ee=ce^(fe<<1|ue>>>31),pe=ge^(ue<<1|fe>>>31),T[4]^=ee,T[5]^=pe,T[14]^=ee,T[15]^=pe,T[24]^=ee,T[25]^=pe,T[34]^=ee,T[35]^=pe,T[44]^=ee,T[45]^=pe,ee=Fe^(q<<1|K>>>31),pe=P^(K<<1|q>>>31),T[6]^=ee,T[7]^=pe,T[16]^=ee,T[17]^=pe,T[26]^=ee,T[27]^=pe,T[36]^=ee,T[37]^=pe,T[46]^=ee,T[47]^=pe,ee=fe^(Ae<<1|$>>>31),pe=ue^($<<1|Ae>>>31),T[8]^=ee,T[9]^=pe,T[18]^=ee,T[19]^=pe,T[28]^=ee,T[29]^=pe,T[38]^=ee,T[39]^=pe,T[48]^=ee,T[49]^=pe,oe=T[0],ye=T[1],qt=T[11]<<4|T[10]>>>28,co=T[10]<<4|T[11]>>>28,se=T[20]<<3|T[21]>>>29,Ue=T[21]<<3|T[20]>>>29,pt=T[31]<<9|T[30]>>>23,yt=T[30]<<9|T[31]>>>23,Et=T[40]<<18|T[41]>>>14,st=T[41]<<18|T[40]>>>14,he=T[2]<<1|T[3]>>>31,Ee=T[3]<<1|T[2]>>>31,be=T[13]<<12|T[12]>>>20,W=T[12]<<12|T[13]>>>20,Yt=T[22]<<10|T[23]>>>22,en=T[23]<<10|T[22]>>>22,_e=T[33]<<13|T[32]>>>19,Te=T[32]<<13|T[33]>>>19,zt=T[42]<<2|T[43]>>>30,Wr=T[43]<<2|T[42]>>>30,Ie=T[5]<<30|T[4]>>>2,We=T[4]<<30|T[5]>>>2,Se=T[14]<<6|T[15]>>>26,Re=T[15]<<6|T[14]>>>26,H=T[25]<<11|T[24]>>>21,ie=T[24]<<11|T[25]>>>21,ne=T[34]<<15|T[35]>>>17,ve=T[35]<<15|T[34]>>>17,Pe=T[45]<<29|T[44]>>>3,ke=T[44]<<29|T[45]>>>3,S=T[6]<<28|T[7]>>>4,Z=T[7]<<28|T[6]>>>4,at=T[17]<<23|T[16]>>>9,$e=T[16]<<23|T[17]>>>9,Je=T[26]<<25|T[27]>>>7,qe=T[27]<<25|T[26]>>>7,ae=T[36]<<21|T[37]>>>11,me=T[37]<<21|T[36]>>>11,xe=T[47]<<24|T[46]>>>8,Ce=T[46]<<24|T[47]>>>8,Ar=T[8]<<27|T[9]>>>5,wt=T[9]<<27|T[8]>>>5,te=T[18]<<20|T[19]>>>12,le=T[19]<<20|T[18]>>>12,je=T[29]<<7|T[28]>>>25,Bt=T[28]<<7|T[29]>>>25,dt=T[38]<<8|T[39]>>>24,cn=T[39]<<8|T[38]>>>24,J=T[48]<<14|T[49]>>>18,Q=T[49]<<14|T[48]>>>18,T[0]=oe^~be&H,T[1]=ye^~W&ie,T[10]=S^~te&se,T[11]=Z^~le&Ue,T[20]=he^~Se&Je,T[21]=Ee^~Re&qe,T[30]=Ar^~qt&Yt,T[31]=wt^~co&en,T[40]=Ie^~at&je,T[41]=We^~$e&Bt,T[2]=be^~H&ae,T[3]=W^~ie&me,T[12]=te^~se&_e,T[13]=le^~Ue&Te,T[22]=Se^~Je&dt,T[23]=Re^~qe&cn,T[32]=qt^~Yt&ne,T[33]=co^~en&ve,T[42]=at^~je&pt,T[43]=$e^~Bt&yt,T[4]=H^~ae&J,T[5]=ie^~me&Q,T[14]=se^~_e&Pe,T[15]=Ue^~Te&ke,T[24]=Je^~dt&Et,T[25]=qe^~cn&st,T[34]=Yt^~ne&xe,T[35]=en^~ve&Ce,T[44]=je^~pt&zt,T[45]=Bt^~yt&Wr,T[6]=ae^~J&oe,T[7]=me^~Q&ye,T[16]=_e^~Pe&S,T[17]=Te^~ke&Z,T[26]=dt^~Et&he,T[27]=cn^~st&Ee,T[36]=ne^~xe&Ar,T[37]=ve^~Ce&wt,T[46]=pt^~zt&Ie,T[47]=yt^~Wr&We,T[8]=J^~oe&be,T[9]=Q^~ye&W,T[18]=Pe^~S&te,T[19]=ke^~Z&le,T[28]=Et^~he&Se,T[29]=st^~Ee&Re,T[38]=xe^~Ar&qt,T[39]=Ce^~wt&co,T[48]=zt^~Ie&at,T[49]=Wr^~We&$e,T[0]^=f[de],T[1]^=f[de+1]};if(a)n.exports=y;else for(R=0;R>6===2;o++)s++;return s}return n===qi.OVERRUN?t.length-e-1:0}function _9(n,e,t,r,i){return n===qi.OVERLONG?(r.push(i),0):(r.push(65533),eP(n,e,t))}const S9=Object.freeze({error:E9,ignore:eP,replace:_9});function tP(n,e){e==null&&(e=S9.error),n=At(n);const t=[];let r=0;for(;r>7)){t.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?r+=e(qi.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(qi.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(qi.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(qi.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(qi.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(qi.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function Fa(n,e=em.current){e!=em.current&&(qV.checkNormalize(),n=n.normalize(e));let t=[];for(let r=0;r>6|192),t.push(i&63|128);else if((i&64512)==55296){r++;const s=n.charCodeAt(r);if(r>=n.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return At(t)}function U9(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function r0(n,e){return U9(tP(n,e))}function Q9(n,e=em.current){return tP(Fa(n,e))}function sh(n){return ir(Fa(n))}const nP="hash/5.7.0";function rP(n,e){e==null&&(e=1);const t=[],r=t.forEach,i=function(s,o){r.call(s,function(a){o>0&&Array.isArray(a)?i(a,o-1):t.push(a)})};return i(n,e),t}function R9(n){const e={};for(let t=0;t>--l&1}const u=31,h=Math.pow(2,u),d=h>>>1,p=d>>1,f=h-1;let g=0;for(let C=0;C1;){let M=b+F>>>1;C>>1|c(),x=x<<1^d,_=(_^d)<<1|d|1;v=x,w=1+_-x}let B=r-4;return m.map(C=>{switch(C-B){case 3:return B+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return B+256+(n[a++]<<8|n[a++]);case 1:return B+n[a++];default:return C-1}})}function T9(n){let e=0;return()=>n[e++]}function N9(n){return T9(M9(n))}function k9(n){return n&1?~n>>1:n>>1}function D9(n,e){let t=Array(n);for(let r=0;re[o]):t}function V9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(O9(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(W9(t,n))}return R9(rP(e))}function P9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function iP(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function O9(n,e){let t=1+e(),r=e(),i=P9(e),s=iP(i.length,1+n,e);return rP(s.map((o,a)=>{const l=o[0],A=o.slice(1);return Array(i[a]).fill(void 0).map((c,u)=>{let h=u*r;return[l+u*t,A.map(d=>d+h)]})}))}function W9(n,e){let t=1+e();return iP(t,1+n,e).map(i=>[i[0],i.slice(1)])}function G9(n){let e=Tw(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let A=Tw(n,e);if(A.length==0)break;r.push({set:new Set(A),node:t()})}r.sort((A,c)=>c.set.size-A.set.size);let i=n(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:r,valid:s,fe0f:o,save:a,check:l}}}function Z9(){return N9(YV("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const IC=Z9(),J9=new Set(Tw(IC)),H9=new Set(Tw(IC)),z9=V9(IC),Y9=G9(IC),RR=45,MR=95;function sP(n){return Q9(n)}function X9(n){return n.filter(e=>e!=65039)}function oP(n){for(let e of n.split(".")){let t=sP(e);try{for(let r=t.lastIndexOf(MR)-1;r>=0;r--)if(t[r]!==MR)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===RR&&t[3]===RR)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function j9(n){return oP(K9(n,X9))}function K9(n,e){let t=sP(n).reverse(),r=[];for(;t.length;){let i=q9(t);if(i){r.push(...e(i));continue}let s=t.pop();if(J9.has(s)){r.push(s);continue}if(H9.has(s))continue;let o=z9[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return oP($9(String.fromCodePoint(...r)))}function $9(n){return n.normalize("NFC")}function q9(n,e){var t;let r=Y9,i,s,o=[],a=n.length;for(e&&(e.length=0);a;){let l=n[--a];if(r=(t=r.branches.find(A=>A.set.has(l)))===null||t===void 0?void 0:t.node,!r)break;if(r.save)s=l;else if(r.check&&l===s)break;o.push(l),r.fe0f&&(o.push(65039),a>0&&n[a-1]==65039&&a--),r.valid&&(i=o.slice(),r.valid==2&&i.splice(1,1),e&&e.push(...n.slice(a).reverse()),n.length=a)}return i}const e6=new we(nP),aP=new Uint8Array(32);aP.fill(0);function TR(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function lP(n){const e=Fa(j9(n)),t=[];if(n.length===0)return t;let r=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return t.push(TR(e.slice(r))),t}function Oy(n){typeof n!="string"&&e6.throwArgumentError("invalid ENS name; not a string","name",n);let e=aP;const t=lP(n);for(;t.length;)e=ir(is([e,ir(t.pop())]));return nt(e)}function t6(n){return nt(is(lP(n).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t})))+"00"}const n6="rlp/5.7.0",ia=new we(n6);function NR(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function kR(n,e,t){let r=0;for(let i=0;ie+1+r&&ia.throwError("child data too short",we.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function cP(n,e){if(n.length===0&&ia.throwError("data too short",we.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&ia.throwError("data short segment too short",we.errors.BUFFER_OVERRUN,{});const r=kR(n,e+1,t);return e+1+t+r>n.length&&ia.throwError("data long segment too short",we.errors.BUFFER_OVERRUN,{}),DR(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&ia.throwError("data array too short",we.errors.BUFFER_OVERRUN,{}),DR(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&ia.throwError("data array too short",we.errors.BUFFER_OVERRUN,{});const r=kR(n,e+1,t);e+1+t+r>n.length&&ia.throwError("data array too short",we.errors.BUFFER_OVERRUN,{});const i=nt(n.slice(e+1+t,e+1+t+r));return{consumed:1+t+r,result:i}}else if(n[e]>=128){const t=n[e]-128;e+1+t>n.length&&ia.throwError("data too short",we.errors.BUFFER_OVERRUN,{});const r=nt(n.slice(e+1,e+1+t));return{consumed:1+t,result:r}}return{consumed:1,result:nt(n[e])}}function eS(n){const e=At(n),t=cP(e,0);return t.consumed!==e.length&&ia.throwArgumentError("invalid rlp data","data",n),t.result}const r6="address/5.7.0",oh=new we(r6);function LR(n){Ft(n,20)||oh.throwArgumentError("invalid address","address",n),n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);const r=At(ir(t));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(r[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const i6=9007199254740991;function s6(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const tS={};for(let n=0;n<10;n++)tS[String(n)]=String(n);for(let n=0;n<26;n++)tS[String.fromCharCode(65+n)]=String(10+n);const VR=Math.floor(s6(i6));function o6(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>tS[r]).join("");for(;e.length>=VR;){let r=e.substring(0,VR);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function Vr(n){let e=null;if(typeof n!="string"&&oh.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=LR(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&oh.throwArgumentError("bad address checksum","address",n);else if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(n.substring(2,4)!==o6(n)&&oh.throwArgumentError("bad icap checksum","address",n),e=a9(n.substring(4));e.length<40;)e="0"+e;e=LR("0x"+e)}else oh.throwArgumentError("invalid address","address",n);return e}function uP(n){let e=null;try{e=Vr(n.from)}catch{oh.throwArgumentError("missing from address","transaction",n)}const t=tf(At(Ge.from(n.nonce).toHexString()));return Vr(zr(ir(FC([e,t])),12))}var a6=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const En=new we(nP),dP=new Uint8Array(32);dP.fill(0);const l6=Ge.from(-1),hP=Ge.from(0),fP=Ge.from(1),A6=Ge.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function c6(n){const e=At(n),t=e.length%32;return t?Si([e,dP.slice(t)]):nt(e)}const u6=Pn(fP.toHexString(),32),d6=Pn(hP.toHexString(),32),PR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},qb=["name","version","chainId","verifyingContract","salt"];function OR(n){return function(e){return typeof e!="string"&&En.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const h6={name:OR("name"),version:OR("version"),chainId:function(n){try{return Ge.from(n).toString()}catch{}return En.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return Vr(n).toLowerCase()}catch{}return En.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){try{const e=At(n);if(e.length!==32)throw new Error("bad length");return nt(e)}catch{}return En.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function ex(n){{const e=n.match(/^(u?)int(\d*)$/);if(e){const t=e[1]==="",r=parseInt(e[2]||"256");(r%8!==0||r>256||e[2]&&e[2]!==String(r))&&En.throwArgumentError("invalid numeric width","type",n);const i=A6.mask(t?r-1:r),s=t?i.add(fP).mul(l6):hP;return function(o){const a=Ge.from(o);return(a.lt(s)||a.gt(i))&&En.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),Pn(a.toTwos(256).toHexString(),32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return(t===0||t>32||e[1]!==String(t))&&En.throwArgumentError("invalid bytes width","type",n),function(r){return At(r).length!==t&&En.throwArgumentError(`invalid length for ${n}`,"value",r),c6(r)}}}switch(n){case"address":return function(e){return Pn(Vr(e),32)};case"bool":return function(e){return e?u6:d6};case"bytes":return function(e){return ir(e)};case"string":return function(e){return sh(e)}}return null}function WR(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class ji{constructor(e){Me(this,"types",Object.freeze(ls(e))),Me(this,"_encoderCache",{}),Me(this,"_types",{});const t={},r={},i={};Object.keys(e).forEach(a=>{t[a]={},r[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(A=>{l[A.name]&&En.throwArgumentError(`duplicate variable name ${JSON.stringify(A.name)} in ${JSON.stringify(a)}`,"types",e),l[A.name]=!0;const c=A.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===a&&En.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!ex(c)&&(r[c]||En.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),r[c].push(a),t[a][c]=!0)})}const s=Object.keys(r).filter(a=>r[a].length===0);s.length===0?En.throwArgumentError("missing primary type","types",e):s.length>1&&En.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Me(this,"primaryType",s[0]);function o(a,l){l[a]&&En.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(t[a]).forEach(A=>{r[A]&&(o(A,l),Object.keys(l).forEach(c=>{i[c][A]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=WR(a,e[a])+l.map(A=>WR(A,e[A])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const i=ex(e);if(i)return i}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const i=t[1],s=this.getEncoder(i),o=parseInt(t[3]);return a=>{o>=0&&a.length!==o&&En.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(ir)),ir(Si(l))}}const r=this.types[e];if(r){const i=sh(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const A=this.getEncoder(l)(s[a]);return this._types[l]?ir(A):A});return o.unshift(i),Si(o)}}return En.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||En.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return ir(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(ex(e))return r(e,t);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&t.length!==a&&En.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map(l=>this._visit(o,l,r))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],r),o),{}):En.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ji(e)}static getPrimaryType(e){return ji.from(e).primaryType}static hashStruct(e,t,r){return ji.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=PR[r];i||En.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>qb.indexOf(r.name)-qb.indexOf(i.name)),ji.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return Si(["0x1901",ji.hashDomain(e),ji.from(t).hash(r)])}static hash(e,t,r){return ir(ji.encode(e,t,r))}static resolveNames(e,t,r,i){return a6(this,void 0,void 0,function*(){e=xn(e);const s={};e.verifyingContract&&!Ft(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=ji.from(t);o.visit(r,(a,l)=>(a==="address"&&!Ft(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:r}})}static getPayload(e,t,r){ji.hashDomain(e);const i={},s=[];qb.forEach(l=>{const A=e[l];A!=null&&(i[l]=h6[l](A),s.push({name:l,type:PR[l]}))});const o=ji.from(t),a=xn(t);return a.EIP712Domain?En.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=s,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,(l,A)=>{if(l.match(/^bytes(\d*)/))return nt(At(A));if(l.match(/^u?int/))return Ge.from(A).toString();switch(l){case"address":return A.toLowerCase();case"bool":return!!A;case"string":return typeof A!="string"&&En.throwArgumentError("invalid string","value",A),A}return En.throwArgumentError("unsupported type","type",l)})}}}var pP={},Tt={},i0=gP;function gP(n,e){if(!n)throw new Error(e||"Assertion failed")}gP.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var rF={exports:{}};typeof Object.create=="function"?rF.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:rF.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var f6=rF.exports,p6=i0,g6=f6;Tt.inherits=g6;function m6(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function v6(n,e){if(Array.isArray(n))return n.slice();if(!n)return[];var t=[];if(typeof n=="string")if(e){if(e==="hex")for(n=n.replace(/[^a-z0-9]+/ig,""),n.length%2!==0&&(n="0"+n),i=0;i>6|192,t[r++]=s&63|128):m6(n,i)?(s=65536+((s&1023)<<10)+(n.charCodeAt(++i)&1023),t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=s&63|128):(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=s&63|128)}else for(i=0;i>>24|n>>>8&65280|n<<8&16711680|(n&255)<<24;return e>>>0}Tt.htonl=mP;function w6(n,e){for(var t="",r=0;r>>0}return s}Tt.join32=B6;function C6(n,e){for(var t=new Array(n.length*4),r=0,i=0;r>>24,t[i+1]=s>>>16&255,t[i+2]=s>>>8&255,t[i+3]=s&255):(t[i+3]=s>>>24,t[i+2]=s>>>16&255,t[i+1]=s>>>8&255,t[i]=s&255)}return t}Tt.split32=C6;function b6(n,e){return n>>>e|n<<32-e}Tt.rotr32=b6;function x6(n,e){return n<>>32-e}Tt.rotl32=x6;function I6(n,e){return n+e>>>0}Tt.sum32=I6;function F6(n,e,t){return n+e+t>>>0}Tt.sum32_3=F6;function E6(n,e,t,r){return n+e+t+r>>>0}Tt.sum32_4=E6;function _6(n,e,t,r,i){return n+e+t+r+i>>>0}Tt.sum32_5=_6;function S6(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}Tt.sum64=S6;function U6(n,e,t,r){var i=e+r>>>0,s=(i>>0}Tt.sum64_hi=U6;function Q6(n,e,t,r){var i=e+r;return i>>>0}Tt.sum64_lo=Q6;function R6(n,e,t,r,i,s,o,a){var l=0,A=e;A=A+r>>>0,l+=A>>0,l+=A>>0,l+=A>>0}Tt.sum64_4_hi=R6;function M6(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Tt.sum64_4_lo=M6;function T6(n,e,t,r,i,s,o,a,l,A){var c=0,u=e;u=u+r>>>0,c+=u>>0,c+=u>>0,c+=u>>0,c+=u>>0}Tt.sum64_5_hi=T6;function N6(n,e,t,r,i,s,o,a,l,A){var c=e+r+s+a+A;return c>>>0}Tt.sum64_5_lo=N6;function k6(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Tt.rotr64_hi=k6;function D6(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Tt.rotr64_lo=D6;function L6(n,e,t){return n>>>t}Tt.shr64_hi=L6;function V6(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Tt.shr64_lo=V6;var Rf={},GR=Tt,P6=i0;function EC(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Rf.BlockHash=EC;EC.prototype.update=function(e,t){if(e=GR.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=GR.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}Da.g0_256=J6;function H6(n){return va(n,17)^va(n,19)^n>>>10}Da.g1_256=H6;var nf=Tt,z6=Rf,Y6=Da,tx=nf.rotl32,dp=nf.sum32,X6=nf.sum32_5,j6=Y6.ft_1,bP=z6.BlockHash,K6=[1518500249,1859775393,2400959708,3395469782];function Ea(){if(!(this instanceof Ea))return new Ea;bP.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}nf.inherits(Ea,bP);var $6=Ea;Ea.blockSize=512;Ea.outSize=160;Ea.hmacStrength=80;Ea.padLength=64;Ea.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),VY(e.length<=this.blockSize);for(var t=e.length;t{s[a.toLowerCase()]=o}):r.headers.keys().forEach(o=>{s[o.toLowerCase()]=r.headers.get(o)}),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:At(new Uint8Array(i))}})}var ZY=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Bo=new we(OY);function YR(n){return new Promise(e=>{setTimeout(e,n)})}function ql(n,e){if(n==null)return null;if(typeof n=="string")return n;if(q_(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return r0(n)}catch{}return nt(n)}return n}function JY(n){return Fa(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function HY(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;Bo.assertArgument(r>0&&r%1===0,"invalid connection throttle limit","connection.throttleLimit",r);const i=typeof n=="object"?n.throttleCallback:null,s=typeof n=="object"&&typeof n.throttleSlotInterval=="number"?n.throttleSlotInterval:100;Bo.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof n=="object"?!!n.errorPassThrough:!1,a={};let l=null;const A={method:"GET"};let c=!1,u=2*60*1e3;if(typeof n=="string")l=n;else if(typeof n=="object"){if((n==null||n.url==null)&&Bo.throwArgumentError("missing URL","connection.url",n),l=n.url,typeof n.timeout=="number"&&n.timeout>0&&(u=n.timeout),n.headers)for(const m in n.headers)a[m.toLowerCase()]={key:m,value:String(n.headers[m])},["if-none-match","if-modified-since"].indexOf(m.toLowerCase())>=0&&(c=!0);if(A.allowGzip=!!n.allowGzip,n.user!=null&&n.password!=null){l.substring(0,6)!=="https:"&&n.allowInsecureAuthentication!==!0&&Bo.throwError("basic authentication requires a secure https url",we.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const m=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+XV(Fa(m))}}n.skipFetchSetup!=null&&(A.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(A.fetchOptions=xn(n.fetchOptions))}const h=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),d=l?l.match(h):null;if(d)try{const m={statusCode:200,statusMessage:"OK",headers:{"content-type":d[1]||"text/plain"},body:d[2]?YV(d[3]):JY(d[3])};let v=m.body;return t&&(v=t(m.body,m)),Promise.resolve(v)}catch(m){Bo.throwError("processing response error",we.errors.SERVER_ERROR,{body:ql(d[1],d[2]),error:m,requestBody:null,requestMethod:"GET",url:l})}e&&(A.method="POST",A.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const p={};Object.keys(a).forEach(m=>{const v=a[m];p[v.key]=v.value}),A.headers=p;const f=function(){let m=null;return{promise:new Promise(function(B,C){u&&(m=setTimeout(()=>{m!=null&&(m=null,C(Bo.makeError("timeout",we.errors.TIMEOUT,{requestBody:ql(A.body,p["content-type"]),requestMethod:A.method,timeout:u,url:l})))},u))}),cancel:function(){m!=null&&(clearTimeout(m),m=null)}}}(),g=function(){return ZY(this,void 0,void 0,function*(){for(let m=0;m=300)&&(f.cancel(),Bo.throwError("bad response",we.errors.SERVER_ERROR,{status:v.statusCode,headers:v.headers,body:ql(w,v.headers?v.headers["content-type"]:null),requestBody:ql(A.body,p["content-type"]),requestMethod:A.method,url:l})),t)try{const B=yield t(w,v);return f.cancel(),B}catch(B){if(B.throttleRetry&&m{let a=null;if(s!=null)try{a=JSON.parse(r0(s))}catch(l){Bo.throwError("invalid JSON",we.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=Fa(e);const s=typeof n=="string"?{url:n}:xn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=xn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return HY(n,i,r)}function ah(n,e){return e||(e={}),e=xn(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(t,r){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&r(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function A(){return n().then(function(c){if(c!==void 0)o()&&t(c);else if(e.oncePoll)e.oncePoll.once("poll",A);else if(e.onceBlock)e.onceBlock.once("block",A);else if(!s){if(l++,l>a){o()&&r(new Error("retry limit reached"));return}let u=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));ue.ceiling&&(u=e.ceiling),setTimeout(A,u)}return null},function(c){o()&&r(c)})}A()})}var Nw="qpzry9x8gf2tvdw0s3jn54khce6mua7l",oF={};for(var P0=0;P0>25;return(n&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function TP(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Th(e)^r>>5}for(e=Th(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=TP(n);if(typeof r=="string")throw new Error(r);for(var i=n+"1",s=0;s>5)throw new Error("Non 5-bit word");r=Th(r)^o,i+=Nw.charAt(o)}for(s=0;s<6;++s)r=Th(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Nw.charAt(a)}return i}function NP(n,e){if(e=e||90,n.length<8)return n+" too short";if(n.length>e)return"Exceeds length limit";var t=n.toLowerCase(),r=n.toUpperCase();if(n!==t&&n!==r)return"Mixed-case string "+n;n=t;var i=n.lastIndexOf("1");if(i===-1)return"No separator character for "+n;if(i===0)return"Missing prefix for "+n;var s=n.slice(0,i),o=n.slice(i+1);if(o.length<6)return"Data too short";var a=TP(s);if(typeof a=="string")return a;for(var l=[],A=0;A=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+n:{prefix:s,words:l}}function YY(){var n=NP.apply(null,arguments);if(typeof n=="object")return n}function XY(n){var e=NP.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function SC(n,e,t,r){for(var i=0,s=0,o=(1<=t;)s-=t,a.push(i>>s&o);if(r)s>0&&a.push(i<=e)return"Excess padding";if(i<>8,h=c&255;u?l.push(u,h):l.push(h)}return l}t.toArray=r;function i(o){return o.length===1?"0"+o:o}t.zero2=i;function s(o){for(var a="",l=0;l(h>>1)-1?f=(h>>1)-g:f=g,d.isubn(f)):f=0,u[p]=f,d.iushrn(1)}return u}t.getNAF=r;function i(l,A){var c=[[],[]];l=l.clone(),A=A.clone();for(var u=0,h=0,d;l.cmpn(-u)>0||A.cmpn(-h)>0;){var p=l.andln(3)+u&3,f=A.andln(3)+h&3;p===3&&(p=-1),f===3&&(f=-1);var g;p&1?(d=l.andln(7)+u&7,(d===3||d===5)&&f===2?g=-p:g=p):g=0,c[0].push(g);var m;f&1?(d=A.andln(7)+h&7,(d===3||d===5)&&p===2?m=-f:m=f):m=0,c[1].push(m),2*u===g+1&&(u=1-u),2*h===m+1&&(h=1-h),l.iushrn(1),A.iushrn(1)}return c}t.getJSF=i;function s(l,A,c){var u="_"+A;l.prototype[A]=function(){return this[u]!==void 0?this[u]:this[u]=c.call(this)}}t.cachedProperty=s;function o(l){return typeof l=="string"?t.toArray(l,"hex"):l}t.parseBytes=o;function a(l){return new vt(l,"hex","le")}t.intFromLE=a}),kw=vs.getNAF,nX=vs.getJSF,Dw=vs.assert;function hc(n,e){this.type=n,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Su=hc;hc.prototype.point=function(){throw new Error("Not implemented")};hc.prototype.validate=function(){throw new Error("Not implemented")};hc.prototype._fixedNafMul=function(e,t){Dw(e.precomputed);var r=e._getDoubles(),i=kw(t,1,this._bitLength),s=(1<=a;A--)l=(l<<1)+i[A];o.push(l)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),h=s;h>0;h--){for(a=0;a=0;l--){for(var A=0;l>=0&&o[l]===0;l--)A++;if(l>=0&&A++,a=a.dblp(A),l<0)break;var c=o[l];Dw(c!==0),e.type==="affine"?c>0?a=a.mixedAdd(s[c-1>>1]):a=a.mixedAdd(s[-c-1>>1].neg()):c>0?a=a.add(s[c-1>>1]):a=a.add(s[-c-1>>1].neg())}return e.type==="affine"?a.toP():a};hc.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,A=0,c,u,h;for(c=0;c=1;c-=2){var p=c-1,f=c;if(o[p]!==1||o[f]!==1){l[p]=kw(r[p],o[p],this._bitLength),l[f]=kw(r[f],o[f],this._bitLength),A=Math.max(l[p].length,A),A=Math.max(l[f].length,A);continue}var g=[t[p],null,null,t[f]];t[p].y.cmp(t[f].y)===0?(g[1]=t[p].add(t[f]),g[2]=t[p].toJ().mixedAdd(t[f].neg())):t[p].y.cmp(t[f].y.redNeg())===0?(g[1]=t[p].toJ().mixedAdd(t[f]),g[2]=t[p].add(t[f].neg())):(g[1]=t[p].toJ().mixedAdd(t[f]),g[2]=t[p].toJ().mixedAdd(t[f].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],v=nX(r[p],r[f]);for(A=Math.max(v[0].length,A),l[p]=new Array(A),l[f]=new Array(A),u=0;u=0;c--){for(var F=0;c>=0;){var x=!0;for(u=0;u=0&&F++,C=C.dblp(F),c<0)break;for(u=0;u0?h=a[u][_-1>>1]:_<0&&(h=a[u][-_-1>>1].neg()),h.type==="affine"?C=C.mixedAdd(h):C=C.add(h))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step):!1};oo.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,s=0;s=0&&(d=A,p=c),u.negative&&(u=u.neg(),h=h.neg()),d.negative&&(d=d.neg(),p=p.neg()),[{a:u,b:h},{a:d,b:p}]};ao.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=s.mul(r.a),l=o.mul(i.a),A=s.mul(r.b),c=o.mul(i.b),u=e.sub(a).sub(l),h=A.add(c).neg();return{k1:u,k2:h}};ao.prototype.pointFromX=function(e,t){e=new vt(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)};ao.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0};ao.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Ur.prototype.isInfinity=function(){return this.inf};Ur.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)};Ur.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Ur.prototype.getX=function(){return this.x.fromRed()};Ur.prototype.getY=function(){return this.y.fromRed()};Ur.prototype.mul=function(e){return e=new vt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Ur.prototype.mulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Ur.prototype.jmulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Ur.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Ur.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t};Ur.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Or(n,e,t,r){Su.BasePoint.call(this,n,"jacobian"),e===null&&t===null&&r===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}rS(Or,Su.BasePoint);ao.prototype.jpoint=function(e,t,r){return new Or(this,e,t,r)};Or.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)};Or.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Or.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),l=i.redSub(s),A=o.redSub(a);if(l.cmpn(0)===0)return A.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=l.redSqr(),u=c.redMul(l),h=i.redMul(c),d=A.redSqr().redIAdd(u).redISub(h).redISub(h),p=A.redMul(h.redISub(d)).redISub(o.redMul(u)),f=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(d,p,f)};Or.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=a.redSqr(),c=A.redMul(a),u=r.redMul(A),h=l.redSqr().redIAdd(c).redISub(u).redISub(u),d=l.redMul(u.redISub(h)).redISub(s.redMul(c)),p=this.z.redMul(a);return this.curve.jpoint(h,d,p)};Or.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}};Or.prototype.inspect=function(){return this.isInfinity()?"":""};Or.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Wy=Nf(function(n,e){var t=e;t.base=Su,t.short=iX,t.mont=null,t.edwards=null}),Gy=Nf(function(n,e){var t=e,r=vs.assert;function i(a){a.type==="short"?this.curve=new Wy.short(a):a.type==="edwards"?this.curve=new Wy.edwards(a):this.curve=new Wy.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,r(this.g.validate(),"Invalid curve"),r(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=i;function s(a,l){Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){var A=new i(l);return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,value:A}),A}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:ta.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:ta.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:ta.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:ta.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:ta.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ta.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ta.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:ta.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function tc(n){if(!(this instanceof tc))return new tc(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Uo.toArray(n.entropy,n.entropyEnc||"hex"),t=Uo.toArray(n.nonce,n.nonceEnc||"hex"),r=Uo.toArray(n.pers,n.persEnc||"hex");nS(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var DP=tc;tc.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1};tc.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=r,r=t,t=null),r&&(r=Uo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var sX=vs.assert;function UC(n,e){if(n instanceof UC)return n;this._importDER(n,e)||(sX(n.r&&n.s,"Signature without r or s"),this.r=new vt(n.r,16),this.s=new vt(n.s,16),n.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=n.recoveryParam)}var QC=UC;function oX(){this.place=0}function sx(n,e){var t=n[e.place++];if(!(t&128))return t;var r=t&15;if(r===0||r>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function jR(n){for(var e=0,t=n.length-1;!n[e]&&!(n[e+1]&128)&&e>>3);for(n.push(t|128);--t;)n.push(e>>>(t<<3)&255);n.push(e)}UC.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),r[0]&128&&(r=[0].concat(r)),t=jR(t),r=jR(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];ox(i,t.length),i=i.concat(t),i.push(2),ox(i,r.length);var s=i.concat(r),o=[48];return ox(o,s.length),o=o.concat(s),vs.encode(o,e)};var aX=function(){throw new Error("unsupported")},LP=vs.assert;function eo(n){if(!(this instanceof eo))return new eo(n);typeof n=="string"&&(LP(Object.prototype.hasOwnProperty.call(Gy,n),"Unknown curve "+n),n=Gy[n]),n instanceof Gy.PresetCurve&&(n={curve:n}),this.curve=n.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=n.curve.g,this.g.precompute(n.curve.n.bitLength()+1),this.hash=n.hash||n.curve.hash}var lX=eo;eo.prototype.keyPair=function(e){return new iS(this,e)};eo.prototype.keyFromPrivate=function(e,t){return iS.fromPrivate(this,e,t)};eo.prototype.keyFromPublic=function(e,t){return iS.fromPublic(this,e,t)};eo.prototype.genKeyPair=function(e){e||(e={});for(var t=new DP({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||aX(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new vt(2));;){var s=new vt(t.generate(r));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};eo.prototype._truncateToN=function(e,t){var r=e.byteLength()*8-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};eo.prototype.sign=function(e,t,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new vt(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new DP({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),A=this.n.sub(new vt(1)),c=0;;c++){var u=i.k?i.k(c):new vt(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(A)>=0)){var h=this.g.mul(u);if(!h.isInfinity()){var d=h.getX(),p=d.umod(this.n);if(p.cmpn(0)!==0){var f=u.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(f=f.umod(this.n),f.cmpn(0)!==0){var g=(h.getY().isOdd()?1:0)|(d.cmp(p)!==0?2:0);return i.canonical&&f.cmp(this.nh)>0&&(f=this.n.sub(f),g^=1),new QC({r:p,s:f,recoveryParam:g})}}}}}};eo.prototype.verify=function(e,t,r,i){e=this._truncateToN(new vt(e,16)),r=this.keyFromPublic(r,i),t=new QC(t,"hex");var s=t.r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),A=a.mul(s).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(l,r.getPublic(),A),c.isInfinity()?!1:c.eqXToP(s)):(c=this.g.mulAdd(l,r.getPublic(),A),c.isInfinity()?!1:c.getX().umod(this.n).cmp(s)===0)};eo.prototype.recoverPubKey=function(n,e,t,r){LP((3&t)===t,"The recovery param is more than two bits"),e=new QC(e,r);var i=this.n,s=new vt(n),o=e.r,a=e.s,l=t&1,A=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&A)throw new Error("Unable to find sencond key candinate");A?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var c=e.r.invm(i),u=i.sub(s).mul(c).umod(i),h=a.mul(c).umod(i);return this.g.mulAdd(u,o,h)};eo.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new QC(e,r),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(n,e,i)}catch{continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var AX=Nf(function(n,e){var t=e;t.version="6.5.4",t.utils=vs,t.rand=function(){throw new Error("unsupported")},t.curve=Wy,t.curves=Gy,t.ec=lX,t.eddsa=null}),cX=AX.ec;const uX="signing-key/5.7.0",lF=new we(uX);let ax=null;function sa(){return ax||(ax=new cX("secp256k1")),ax}class dX{constructor(e){Me(this,"curve","secp256k1"),Me(this,"privateKey",nt(e)),hu(this.privateKey)!==32&&lF.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=sa().keyFromPrivate(At(this.privateKey));Me(this,"publicKey","0x"+t.getPublic(!1,"hex")),Me(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Me(this,"_isSigningKey",!0)}_addPoint(e){const t=sa().keyFromPublic(At(this.publicKey)),r=sa().keyFromPublic(At(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=sa().keyFromPrivate(At(this.privateKey)),r=At(e);r.length!==32&&lF.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return xC({recoveryParam:i.recoveryParam,r:Pn("0x"+i.r.toString(16),32),s:Pn("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=sa().keyFromPrivate(At(this.privateKey)),r=sa().keyFromPublic(At(VP(e)));return Pn("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function hX(n,e){const t=xC(e),r={r:At(t.r),s:At(t.s)};return"0x"+sa().recoverPubKey(At(n),r,t.recoveryParam).encode("hex",!1)}function VP(n,e){const t=At(n);if(t.length===32){const r=new dX(t);return e?"0x"+sa().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?nt(t):"0x"+sa().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+sa().keyFromPublic(t).getPublic(!0,"hex"):nt(t)}return lF.throwArgumentError("invalid public or private key","key","[REDACTED]")}const fX="transactions/5.7.0",Jl=new we(fX);var KR;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(KR||(KR={}));function sS(n){return n==="0x"?null:Vr(n)}function Xr(n){return n==="0x"?KV:Ge.from(n)}function pX(n){const e=VP(n);return Vr(zr(ir(zr(e,1)),12))}function PP(n,e){return pX(hX(At(n),e))}function es(n,e){const t=tf(Ge.from(n).toHexString());return t.length>32&&Jl.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function lx(n,e){return{address:Vr(n),storageKeys:(e||[]).map((t,r)=>(hu(t)!==32&&Jl.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function Uu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&Jl.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),lx(t[0],t[1])):lx(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return lx(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function OP(n){return Uu(n).map(e=>[e.address,e.storageKeys])}function gX(n,e){if(n.gasPrice!=null){const r=Ge.from(n.gasPrice),i=Ge.from(n.maxFeePerGas||0);r.eq(i)||Jl.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[es(n.chainId||0,"chainId"),es(n.nonce||0,"nonce"),es(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),es(n.maxFeePerGas||0,"maxFeePerGas"),es(n.gasLimit||0,"gasLimit"),n.to!=null?Vr(n.to):"0x",es(n.value||0,"value"),n.data||"0x",OP(n.accessList||[])];if(e){const r=xC(e);t.push(es(r.recoveryParam,"recoveryParam")),t.push(tf(r.r)),t.push(tf(r.s))}return Si(["0x02",FC(t)])}function mX(n,e){const t=[es(n.chainId||0,"chainId"),es(n.nonce||0,"nonce"),es(n.gasPrice||0,"gasPrice"),es(n.gasLimit||0,"gasLimit"),n.to!=null?Vr(n.to):"0x",es(n.value||0,"value"),n.data||"0x",OP(n.accessList||[])];if(e){const r=xC(e);t.push(es(r.recoveryParam,"recoveryParam")),t.push(tf(r.r)),t.push(tf(r.s))}return Si(["0x01",FC(t)])}function WP(n,e,t){try{const r=Xr(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{Jl.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=Pn(e[1],32),n.s=Pn(e[2],32);try{const r=ir(t(n));n.from=PP(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function vX(n){const e=eS(n.slice(1));e.length!==9&&e.length!==12&&Jl.throwArgumentError("invalid component count for transaction type: 2","payload",nt(n));const t=Xr(e[2]),r=Xr(e[3]),i={type:2,chainId:Xr(e[0]).toNumber(),nonce:Xr(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:Xr(e[4]),to:sS(e[5]),value:Xr(e[6]),data:e[7],accessList:Uu(e[8])};return e.length===9||(i.hash=ir(n),WP(i,e.slice(9),gX)),i}function yX(n){const e=eS(n.slice(1));e.length!==8&&e.length!==11&&Jl.throwArgumentError("invalid component count for transaction type: 1","payload",nt(n));const t={type:1,chainId:Xr(e[0]).toNumber(),nonce:Xr(e[1]).toNumber(),gasPrice:Xr(e[2]),gasLimit:Xr(e[3]),to:sS(e[4]),value:Xr(e[5]),data:e[6],accessList:Uu(e[7])};return e.length===8||(t.hash=ir(n),WP(t,e.slice(8),mX)),t}function wX(n){const e=eS(n);e.length!==9&&e.length!==6&&Jl.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:Xr(e[0]).toNumber(),gasPrice:Xr(e[1]),gasLimit:Xr(e[2]),to:sS(e[3]),value:Xr(e[4]),data:e[5],chainId:0};if(e.length===6)return t;try{t.v=Ge.from(e[6]).toNumber()}catch{return t}if(t.r=Pn(e[7],32),t.s=Pn(e[8],32),Ge.from(t.r).isZero()&&Ge.from(t.s).isZero())t.chainId=t.v,t.v=0;else{t.chainId=Math.floor((t.v-35)/2),t.chainId<0&&(t.chainId=0);let r=t.v-27;const i=e.slice(0,6);t.chainId!==0&&(i.push(nt(t.chainId)),i.push("0x"),i.push("0x"),r-=t.chainId*2+8);const s=ir(FC(i));try{t.from=PP(s,{r:nt(t.r),s:nt(t.s),recoveryParam:r})}catch{}t.hash=ir(n)}return t.type=null,t}function BX(n){const e=At(n);if(e[0]>127)return wX(e);switch(e[0]){case 1:return yX(e);case 2:return vX(e)}return Jl.throwError(`unsupported transaction type: ${e[0]}`,we.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const fp=new we(ri);let $R=class et{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),s=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),l=this.number.bind(this),A=this.type.bind(this),c=u=>this.data(u,!0);return e.transaction={hash:o,type:A,accessList:et.allowNull(this.accessList.bind(this),null),blockHash:et.allowNull(o,null),blockNumber:et.allowNull(l,null),transactionIndex:et.allowNull(l,null),confirmations:et.allowNull(l,null),from:t,gasPrice:et.allowNull(r),maxPriorityFeePerGas:et.allowNull(r),maxFeePerGas:et.allowNull(r),gasLimit:r,to:et.allowNull(t,null),value:r,nonce:l,data:s,r:et.allowNull(this.uint256),s:et.allowNull(this.uint256),v:et.allowNull(l),creates:et.allowNull(t,null),raw:et.allowNull(s)},e.transactionRequest={from:et.allowNull(t),nonce:et.allowNull(l),gasLimit:et.allowNull(r),gasPrice:et.allowNull(r),maxPriorityFeePerGas:et.allowNull(r),maxFeePerGas:et.allowNull(r),to:et.allowNull(t),value:et.allowNull(r),data:et.allowNull(c),type:et.allowNull(l),accessList:et.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:t,topics:et.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:et.allowNull(this.address,null),from:et.allowNull(this.address,null),contractAddress:et.allowNull(t,null),transactionIndex:l,root:et.allowNull(a),gasUsed:r,logsBloom:et.allowNull(s),blockHash:o,transactionHash:o,logs:et.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:et.allowNull(l,null),cumulativeGasUsed:r,effectiveGasPrice:et.allowNull(r),status:et.allowNull(l),type:A},e.block={hash:et.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:et.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:et.allowNull(t),extraData:s,transactions:et.allowNull(et.arrayOf(o)),baseFeePerGas:et.allowNull(r)},e.blockWithTransactions=xn(e.block),e.blockWithTransactions.transactions=et.allowNull(et.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:et.allowNull(i,void 0),toBlock:et.allowNull(i,void 0),blockHash:et.allowNull(o,void 0),address:et.allowNull(t,void 0),topics:et.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:et.allowNull(l),blockHash:et.allowNull(o),transactionIndex:l,removed:et.allowNull(this.boolean.bind(this)),address:t,data:et.allowFalsish(s,"0x"),topics:et.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return Uu(e||[])}number(e){return e==="0x"?0:Ge.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ge.from(e).toNumber()}bigNumber(e){return Ge.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return typeof e=="string"&&(!t&&e.substring(0,2)!=="0x"&&(e="0x"+e),Ft(e))?e.toLowerCase():fp.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!==0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return Vr(e)}callAddress(e){if(!Ft(e,32))return null;const t=Vr(zr(e,12));return t===y9?null:t}contractAddress(e){return uP(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||Ft(e))return bC(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return hu(r)!==32?fp.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(e==null)return null;const t=Ge.from(e);try{return t.toNumber()}catch{}return null}uint256(e){if(!Ft(e))throw new Error("invalid uint256");return Pn(e,32)}_block(e,t){e.author!=null&&e.miner==null&&(e.miner=e.author);const r=e._difficulty!=null?e._difficulty:e.difficulty,i=et.check(t,e);return i._difficulty=r==null?null:Ge.from(r),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return et.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ge.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const t=et.check(this.formats.transaction,e);if(e.chainId!=null){let r=e.chainId;Ft(r)&&(r=Ge.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),Ft(r)&&(r=Ge.from(r).toNumber()),typeof r!="number"&&t.v!=null&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),typeof r!="number"&&(r=0),t.chainId=r}return t.blockHash&&t.blockHash.replace(/0/g,"")==="x"&&(t.blockHash=null),t}transaction(e){return BX(e)}receiptLog(e){return et.check(this.formats.receiptLog,e)}receipt(e){const t=et.check(this.formats.receipt,e);if(t.root!=null)if(t.root.length<=4){const r=Ge.from(t.root).toNumber();r===0||r===1?(t.status!=null&&t.status!==r&&fp.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):fp.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&fp.throwArgumentError("invalid root hash","value.root",t.root);return t.status!=null&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map(t=>this.topics(t)):e!=null?this.hash(e,!0):null}filter(e){return et.check(this.formats.filter,e)}filterLog(e){return et.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const i in e)try{const s=e[i](t[i]);s!==void 0&&(r[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=t[i],s}return r}static allowNull(e,t){return function(r){return r==null?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach(function(i){r.push(e(i))}),r}}};function CX(n){return n&&typeof n.isCommunityResource=="function"}function qR(n){return CX(n)&&n.isCommunityResource()}let e2=!1;function RC(){e2||(e2=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var gt=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const xt=new we(ri),bX=10;function t2(n){return n==null?"null":(hu(n)!==32&&xt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function n2(n){for(n=n.slice();n.length>0&&n[n.length-1]==null;)n.pop();return n.map(e=>{if(Array.isArray(e)){const t={};e.forEach(i=>{t[t2(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return t2(e)}).join("&")}function xX(n){return n===""?[]:n.split(/&/g).map(e=>{if(e==="")return[];const t=e.split("|").map(r=>r==="null"?null:r);return t.length===1?t[0]:t})}function ju(n){if(typeof n=="string"){if(n=n.toLowerCase(),hu(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+n2(n);if(g9.isForkEvent(n))throw xt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+n2(n.topics||[])}throw new Error("invalid event - "+n)}function pp(){return new Date().getTime()}function r2(n){return new Promise(e=>{setTimeout(e,n)})}const IX=["block","network","pending","poll"];let FX=class{constructor(e,t,r){Me(this,"tag",e),Me(this,"listener",t),Me(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const t=e[1],r=xX(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||IX.indexOf(this.tag)>=0}};const EX={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Ax(n){return Pn(Ge.from(n).toHexString(),32)}function i2(n){return nF.encode(is([n,zr(zR(zR(n)),0,4)]))}const GP=new RegExp("^(ipfs)://(.*)$","i"),s2=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),GP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Zy(n,e){try{return r0(tm(n,e))}catch{}return null}function tm(n,e){if(n==="0x")return null;const t=Ge.from(zr(n,e,e+32)).toNumber(),r=Ge.from(zr(n,t,t+32)).toNumber();return zr(n,t+32,t+32+r)}function cx(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):xt.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function o2(n){const e=At(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function _X(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function ZP(n){const e=[];let t=0;for(let r=0;rGe.from(e).eq(1)).catch(e=>{if(e.code===we.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return gt(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:Si([e,Oy(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=Si(["0x9061b923",ZP([t6(this.name),r.data])]));try{let s=yield this.provider.call(r);return At(s).length%32===4&&xt.throwError("resolver threw error",we.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=tm(s,0)),s}catch(s){if(s.code===we.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return gt(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?tm(r,0):null})}_getAddress(e,t){const r=EX[String(e)];if(r==null&&xt.throwError(`unsupported coin type: ${e}`,we.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),r.ilk==="eth")return this.provider.formatter.address(t);const i=At(t);if(r.p2pkh!=null){const s=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return i2(is([[r.p2pkh],"0x"+s[2]]))}}if(r.p2sh!=null){const s=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return i2(is([[r.p2sh],"0x"+s[2]]))}}if(r.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=XR.toWords(i.slice(2));return a.unshift(o),XR.encode(r.prefix,a)}}return null}getAddress(e){return gt(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===b9?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===we.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Ax(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&xt.throwError("invalid or unsupported coin data",we.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return gt(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(t==null)return null;for(let r=0;ro[l])}return xt.throwError("invalid or unsupported content hash data",we.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return gt(this,void 0,void 0,function*(){let t=Fa(e);t=is([Ax(64),Ax(t.length),t]),t.length%32!==0&&(t=is([t,Pn("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nt(t));return r==null||r==="0x"?null:r0(r)})}}let ux=null,SX=1;class oS extends n0{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Me(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(t=>{}),this._ready().catch(t=>{});else{const t=ss(new.target,"getNetwork")(e);t?(Me(this,"_network",t),this.emit("network",t,null)):xt.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return gt(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||xt.throwError("no network detected",we.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Me(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ah(()=>this._ready().then(e=>e,e=>{if(!(e.code===we.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return ux==null&&(ux=new $R),ux}static getNetwork(e){return zV(e??"homestead")}ccipReadFetch(e,t,r){return gt(this,void 0,void 0,function*(){if(this.disableCcipRead||r.length===0)return null;const i=e.to.toLowerCase(),s=t.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield _C({url:A,errorPassThrough:!0},c,(d,p)=>(d.status=p.statusCode,d));if(u.data)return u.data;const h=u.message||"unknown error";if(u.status>=400&&u.status<500)return xt.throwError(`response not found during CCIP fetch: ${h}`,we.errors.SERVER_ERROR,{url:l,errorMessage:h});o.push(h)}return xt.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,we.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return gt(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(pp()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=pp(),r=qn({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),s;const o=pp();return i=Ge.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return gt(this,void 0,void 0,function*(){const e=SX++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)xt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",xt.makeError("network block skew detected",we.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let i=this._emitted.block+1;i<=r;i++)this.emit("block",i);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&r-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=r-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});t.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=r-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=r;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(A=>{A.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=A.blockNumber),this._emitted["b:"+A.blockHash]=A.blockNumber,this._emitted["t:"+A.transactionHash]=A.blockNumber,this.emit(s,A)})}).catch(l=>{this.emit("error",l),i._inflight=!1});t.push(a)}break}}}),this._lastBlockNumber=r,Promise.all(t).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return gt(this,void 0,void 0,function*(){return xt.throwError("provider does not support network detection",we.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return gt(this,void 0,void 0,function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield r2(0),this._network;const r=xt.makeError("underlying network changed",we.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=pp();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return gt(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return gt(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=t?s:new Promise((o,a)=>{const l=[];let A=!1;const c=function(){return A?!0:(A=!0,l.forEach(h=>{h()}),!1)},u=h=>{h.confirmations{this.removeListener(e,u)}),i){let h=i.startBlock,d=null;const p=f=>gt(this,void 0,void 0,function*(){A||(yield r2(1e3),this.getTransactionCount(i.from).then(g=>gt(this,void 0,void 0,function*(){if(!A){if(g<=i.nonce)h=f;else{{const m=yield this.getTransaction(e);if(m&&m.blockNumber!=null)return}for(d==null&&(d=h-3,d{A||this.once("block",p)}))});if(A)return;this.once("block",p),l.push(()=>{this.removeListener("block",p)})}if(typeof r=="number"&&r>0){const h=setTimeout(()=>{c()||a(xt.makeError("timeout exceeded",we.errors.TIMEOUT,{timeout:r}))},r);h.unref&&h.unref(),l.push(()=>{clearTimeout(h)})}})})}getBlockNumber(){return gt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ge.from(e)}catch(t){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getBalance",r);try{return Ge.from(i)}catch(s){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getTransactionCount",r);try{return Ge.from(i).toNumber()}catch(s){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getCode",r);try{return nt(i)}catch(s){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>bC(o))}),s=yield this.perform("getStorageAt",i);try{return nt(s)}catch(o){return xt.throwError("bad result from backend",we.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&hu(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&xt.throwError("Transaction hash mismatch from Provider.sendTransaction.",we.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>gt(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&r!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&xt.throwError("transaction failed",we.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(s=>nt(s)),r=this.formatter.transaction(e);r.confirmations==null&&(r.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,s,i)}catch(s){throw s.transaction=r,s.transactionHash=r.hash,s}})}_getTransactionRequest(e){return gt(this,void 0,void 0,function*(){const t=yield e,r={};return["from","to"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?Ge.from(s):null))}),["type"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s??null))}),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?nt(s):null))}),this.formatter.transactionRequest(yield qn(r))})}_getFilter(e){return gt(this,void 0,void 0,function*(){e=yield e;const t={};return e.address!=null&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach(r=>{e[r]!=null&&(t[r]=e[r])}),["fromBlock","toBlock"].forEach(r=>{e[r]!=null&&(t[r]=this._getBlockTag(e[r]))}),this.formatter.filter(yield qn(t))})}_call(e,t,r){return gt(this,void 0,void 0,function*(){r>=bX&&xt.throwError("CCIP read exceeded maximum redirections",we.errors.SERVER_ERROR,{redirects:r,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&t==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&hu(s)%32===4)try{const o=zr(s,4),a=zr(o,0,32);Ge.from(a).eq(i)||xt.throwError("CCIP Read sender did not match",we.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],A=Ge.from(zr(o,32,64)).toNumber(),c=Ge.from(zr(o,A,A+32)).toNumber(),u=zr(o,A+32);for(let m=0;mgt(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&r>this._emitted.block?null:void 0;if(t){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return gt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ah(()=>gt(this,void 0,void 0,function*(){const r=yield this.perform("getTransaction",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return gt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ah(()=>gt(this,void 0,void 0,function*(){const r=yield this.perform("getTransactionReceipt",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;if(r.blockHash==null)return;const i=this.formatter.receipt(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return gt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield qn({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),$R.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return gt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return gt(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&xt.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)})}getResolver(e){return gt(this,void 0,void 0,function*(){let t=e;for(;;){if(t===""||t==="."||e!=="eth"&&t==="eth")return null;const r=yield this._getResolver(t,"getResolver");if(r!=null){const i=new a2(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return gt(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||xt.throwError("network does not support ENS",we.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Oy(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return gt(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(Ft(e))throw r}typeof e!="string"&&xt.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return gt(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const t=e.substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(r==null)return null;const i=Zy(yield this.call({to:r,data:"0x691f3431"+Oy(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return gt(this,void 0,void 0,function*(){let t=null;if(Ft(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new a2(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==we.errors.CALL_EXCEPTION)throw a}try{const a=Zy(yield this.call({to:o,data:"0x691f3431"+Oy(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==we.errors.CALL_EXCEPTION)throw a;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return r==null?null:r.url})}perform(e,t){return xt.throwError(e+" not implemented",we.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(e,t,r){const i=new FX(ju(e),t,r);return this._events.push(i),this._startEvent(i),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,i=[],s=ju(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,t)},0),r=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),r}listenerCount(e){if(!e)return this._events.length;let t=ju(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=ju(e);return this._events.filter(r=>r.tag===t).map(r=>r.listener)}off(e,t){if(t==null)return this.removeAllListeners(e);const r=[];let i=!1,s=ju(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=t||i?!0:(i=!0,r.push(o),!1)),r.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let t=[];if(e==null)t=this._events,this._events=[];else{const r=ju(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const UX="abstract-signer/5.7.0";var fo=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Us=new we(UX),QX=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],RX=[we.errors.INSUFFICIENT_FUNDS,we.errors.NONCE_EXPIRED,we.errors.REPLACEMENT_UNDERPRICED];class s0{constructor(){Us.checkAbstract(new.target,s0),Me(this,"_isSigner",!0)}getBalance(e){return fo(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return fo(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return fo(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield qn(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return fo(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield qn(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return fo(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)})}getChainId(){return fo(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return fo(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return fo(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return fo(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)QX.indexOf(r)===-1&&Us.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=xn(e);return t.from==null?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then(r=>(r[0].toLowerCase()!==r[1].toLowerCase()&&Us.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return fo(this,void 0,void 0,function*(){const t=yield qn(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>fo(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&Us.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),t.to.catch(i=>{}));const r=t.maxFeePerGas!=null||t.maxPriorityFeePerGas!=null;if(t.gasPrice!=null&&(t.type===2||r)?Us.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&Us.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(t.type===2||t.type==null)&&t.maxFeePerGas!=null&&t.maxPriorityFeePerGas!=null)t.type=2;else if(t.type===0||t.type===1)t.gasPrice==null&&(t.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(t.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(t.type=2,t.gasPrice!=null){const s=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=s,t.maxPriorityFeePerGas=s}else t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(r&&Us.throwError("network does not support EIP-1559",we.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):Us.throwError("failed to get consistent fee data",we.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else t.type===2&&(t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return t.nonce==null&&(t.nonce=this.getTransactionCount("pending")),t.gasLimit==null&&(t.gasLimit=this.estimateGas(t).catch(i=>{if(RX.indexOf(i.code)>=0)throw i;return Us.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",we.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:t})})),t.chainId==null?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Us.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield qn(t)})}_checkProvider(e){this.provider||Us.throwError("missing provider",we.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class aS extends s0{constructor(e,t){super(),Me(this,"address",e),Me(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{Us.throwError(e,we.errors.UNSUPPORTED_OPERATION,{operation:t})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new aS(this.address,e)}}var ll=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const er=new we(ri),MX=["call","estimateGas"];function Qg(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=Ft(n.data)?n.data:null;if(!e||t)return{message:n.message,data:t}}if(typeof n=="object"){for(const t in n){const r=Qg(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return Qg(JSON.parse(n),e)}catch{}return null}function JP(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=Qg(e,!0);if(s)return s.data;er.throwError("missing revert data in call exception; Transaction reverted without a reason string",we.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=Qg(e.body,!1);s==null&&(s=Qg(e,!1)),s&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",we.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===we.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&er.throwError("insufficient funds for intrinsic transaction cost",we.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&er.throwError("nonce has already been used",we.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&er.throwError("replacement fee too low",we.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&er.throwError("legacy pre-eip-155 transactions not supported",we.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),MX.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",we.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function l2(n){return new Promise(function(e){setTimeout(e,n)})}function TX(n){if(n.error){const e=new Error(n.error.message);throw e.code=n.error.code,e.data=n.error.data,e}return n.result}function gp(n){return n&&n.toLowerCase()}const AF={};class HP extends s0{constructor(e,t,r){if(super(),e!==AF)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Me(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Me(this,"_address",this.provider.formatter.address(r)),Me(this,"_index",null)):typeof r=="number"?(Me(this,"_index",r),Me(this,"_address",null)):er.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return er.throwError("cannot alter JSON-RPC Signer connection",we.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new NX(AF,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&er.throwError("unknown account #"+this._index,we.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=xn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=xn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>ll(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&er.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),qn({tx:qn(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&er.throwArgumentError("from address mismatch","transaction",e):r.from=i;const s=this.provider.constructor.hexlifyTransaction(r,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&er.throwError("user rejected transaction",we.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),JP("sendTransaction",o,s)))})}signTransaction(e){return er.throwError("signing transactions is unsupported",we.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return ll(this,void 0,void 0,function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield ah(()=>ll(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(r);if(i!==null)return this.provider._wrapTransaction(i,r,t)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=r,i}})}signMessage(e){return ll(this,void 0,void 0,function*(){const t=typeof e=="string"?Fa(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[nt(t),r.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&er.throwError("user rejected signing",we.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return ll(this,void 0,void 0,function*(){const t=typeof e=="string"?Fa(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),nt(t)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&er.throwError("user rejected signing",we.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return ll(this,void 0,void 0,function*(){const i=yield ji.resolveNames(e,t,r,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(ji.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&er.throwError("user rejected signing",we.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return ll(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class NX extends HP{sendTransaction(e){return this.sendUncheckedTransaction(e).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:r=>this.provider.waitForTransaction(t,r)}))}}const kX={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class nm extends oS{constructor(e,t){let r=t;r==null&&(r=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(r),e||(e=ss(this.constructor,"defaultUrl")()),typeof e=="string"?Me(this,"connection",Object.freeze({url:e})):Me(this,"connection",Object.freeze(xn(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return ll(this,void 0,void 0,function*(){yield l2(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const t=ss(this.constructor,"getNetwork");try{return t(Ge.from(e).toNumber())}catch(r){return er.throwError("could not detect network",we.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return er.throwError("could not detect network",we.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new HP(AF,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(t=>this.formatter.address(t)))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:ls(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=_C(this.connection,JSON.stringify(r),TX).then(o=>(this.emit("debug",{action:"response",request:r,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:r,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[gp(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[gp(t.address),t.blockTag]];case"getCode":return["eth_getCode",[gp(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[gp(t.address),Pn(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[ss(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[ss(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=gp(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return ll(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=t.transaction;if(i&&i.type!=null&&Ge.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=xn(t),t.transaction=xn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&er.throwError(e+" not implemented",we.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return JP(e,i,t)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then(function(r){function i(){e.send("eth_getFilterChanges",[r]).then(function(s){if(e._pendingFilter!=t)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return l2(1e3)})}).then(function(){if(e._pendingFilter!=t){e.send("eth_uninstallFilter",[r]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),r}).catch(r=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=xn(kX);if(t)for(const s in t)t[s]&&(r[s]=!0);c9(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=bC(Ge.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=nt(e[s]))}),e.accessList&&(i.accessList=Uu(e.accessList)),i}}let Rg=null;try{if(Rg=WebSocket,Rg==null)throw new Error("inject please")}catch{const e=new we(ri);Rg=function(){e.throwError("WebSockets not supported in this environment",we.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var dx=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const O0=new we(ri);let DX=1;class lS extends nm{constructor(e,t){t==="any"&&O0.throwError("WebSocketProvider does not support 'any' network yet",we.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Me(this,"_websocket",new Rg(this.connection.url)):Me(this,"_websocket",e),Me(this,"_requests",{}),Me(this,"_subs",{}),Me(this,"_subIds",{}),Me(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const s=i.data,o=JSON.parse(s);if(o.id!=null){const a=String(o.id),l=this._requests[a];if(delete this._requests[a],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let A=null;o.error?(A=new Error(o.error.message||"unknown error"),Me(A,"code",o.error.code||null),Me(A,"response",s)):A=new Error("unknown error"),l.callback(A,void 0),this.emit("debug",{action:"response",error:A,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const r=setInterval(()=>{this.emit("poll")},1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){O0.throwError("cannot reset events block on WebSocketProvider",we.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){O0.throwError("cannot set polling interval on WebSocketProvider",we.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return dx(this,void 0,void 0,function*(){return null})}set polling(e){e&&O0.throwError("cannot set polling on WebSocketProvider",we.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=DX++;return new Promise((i,s)=>{function o(l,A){return l?s(l):i(A)}const a=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(r)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return dx(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(t).then(o=>this.send("eth_subscribe",o)),this._subIds[e]=i);const s=yield i;this._subs[s]={tag:e,processFunc:r}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],t=>{const r=Ge.from(t.number).toNumber();this._emitted.block=r,this.emit("block",r)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],t=>{this.emit("pending",t)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],t=>{t.removed==null&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))});break;case"tx":{const t=r=>{const i=r.hash;this.getTransactionReceipt(i).then(s=>{s&&this.emit(i,s)})};t(e),this._subscribe("tx",["newHeads"],r=>{this._events.filter(i=>i.type==="tx").forEach(t)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let t=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return dx(this,void 0,void 0,function*(){this.websocket.readyState===Rg.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var LX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const og=new we(ri);class zP extends nm{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return LX(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||og.throwError("no network detected",we.errors.UNKNOWN_ERROR,{}),this._network==null&&(Me(this,"_network",t),this.emit("network",t,null))),t})}}class fc extends zP{constructor(e,t){og.checkAbstract(new.target,fc),e=ss(new.target,"getNetwork")(e),t=ss(new.target,"getApiKey")(t);const r=ss(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Me(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Me(this,i,t[i])})}_startPending(){og.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return og.throwError("API provider does not support signing",we.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return og.throwError("not implemented; sub-classes must override getUrl",we.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const A2=new we(ri),Jy="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class VX extends lS{constructor(e,t){const r=new YP(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Me(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===Jy}}class YP extends fc{static getWebSocketProvider(e,t){return new VX(e,t)}static getApiKey(e){return e==null?Jy:(e&&typeof e!="string"&&A2.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:A2.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===Jy&&RC(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Jy}}const PX=new we(ri),W0="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function OX(n){switch(n){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return PX.throwArgumentError("unsupported network","name",n)}class WX extends fc{isCommunityResource(){return this.apiKey===W0}static getApiKey(e){return e??W0}static getUrl(e,t){t==null&&(t=W0);const r={allowGzip:!0,url:"https://"+OX(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===W0&&RC(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var GX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const c2=new we(ri);class ZX extends fc{static getApiKey(e){return e!=null&&c2.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="https://cloudflare-eth.com/";break;default:c2.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return GX(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,e,t)})}}var G0=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const bA=new we(ri);function u2(n){const e={};for(let t in n){if(n[t]==null)continue;let r=n[t];t==="type"&&r===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[t]?r=bC(nt(r)):t==="accessList"?r="["+Uu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=nt(r),e[t]=r)}return e}function JX(n){if(n.status==0&&(n.message==="No records found"||n.message==="No transactions found"))return n.result;if(n.status!=1||typeof n.message!="string"||!n.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(n),(n.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return n.result}function d2(n){if(n&&n.status==0&&n.message=="NOTOK"&&(n.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(n),e.throttleRetry=!0,e}if(n.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(n),e}if(n.error){const e=new Error(n.error.message||"unknown error");throw n.error.code&&(e.code=n.error.code),n.error.data&&(e.data=n.error.data),e}return n.result}function h2(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function hx(n,e,t){if(n==="call"&&e.code===we.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let s=i.data;if(s&&(s="0x"+s.replace(/^.*0x/i,"")),Ft(s))return s;bA.throwError("missing revert data in call exception",we.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===we.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?r=e.error.message:typeof e.body=="string"?r=e.body:typeof e.responseText=="string"&&(r=e.responseText)),r=(r||"").toLowerCase(),r.match(/insufficient funds/)&&bA.throwError("insufficient funds for intrinsic transaction cost",we.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&bA.throwError("nonce has already been used",we.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&bA.throwError("replacement fee too low",we.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&bA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",we.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class HX extends oS{constructor(e,t){super(e),Me(this,"baseUrl",this.getBaseUrl()),Me(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return bA.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce((s,o)=>{const a=t[o];return a!=null&&(s+=`&${o}=${a}`),s},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return G0(this,void 0,void 0,function*(){const i=r?this.getPostUrl():this.getUrl(e,t),s=r?this.getPostData(e,t):null,o=e==="proxy"?d2:JX;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,u)=>(this.isCommunityResource()&&RC(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(c=>`${c}=${s[c]}`).join("&"));const A=yield _C(a,l,o||d2);return this.emit("debug",{action:"response",request:i,response:ls(A),provider:this}),A})}detectNetwork(){return G0(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return G0(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(i=>hx("sendTransaction",i,t.signedTransaction));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=u2(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return hx("call",s,t.transaction)}}case"estimateGas":{const i=u2(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return hx("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=h2(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=h2(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&bA.throwError("unsupported topic count",we.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&bA.throwError("unsupported topic format",we.errors.UNSUPPORTED_OPERATION,{topic0:a}),i.topic0=a}const s=yield this.fetch("logs",i);let o={};for(let a=0;a{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function zX(n){n=n.slice();for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}return n}var Lw=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Zc=new we(ri);function Z0(){return new Date().getTime()}function f2(n){let e=null;for(let t=0;te?null:(r+i)/2}function lh(n){if(n===null)return"null";if(typeof n=="number"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="string")return n;if(Ge.isBigNumber(n))return n.toString();if(Array.isArray(n))return JSON.stringify(n.map(e=>lh(e)));if(typeof n=="object"){const e=Object.keys(n);return e.sort(),"{"+e.map(t=>{let r=n[t];return typeof r=="function"?r="[function]":r=lh(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let YX=1;function g2(n){let e=null,t=null,r=new Promise(o=>{e=function(){t&&(clearTimeout(t),t=null),o()},t=setTimeout(e,n)});const i=o=>(r=r.then(o),r);function s(){return r}return{cancel:e,getPromise:s,wait:i}}const XX=[we.errors.CALL_EXCEPTION,we.errors.INSUFFICIENT_FUNDS,we.errors.NONCE_EXPIRED,we.errors.REPLACEMENT_UNDERPRICED,we.errors.UNPREDICTABLE_GAS_LIMIT],jX=["address","args","errorArgs","errorSignature","method","transaction"];function J0(n,e){const t={weight:n.weight};return Object.defineProperty(t,"provider",{get:()=>n.provider}),n.start&&(t.start=n.start),e&&(t.duration=e-n.start),n.done&&(n.error?t.error=n.error:t.result=n.result||null),t}function KX(n,e){return function(t){const r={};t.forEach(s=>{const o=n(s.result);r[o]||(r[o]={count:0,result:s.result}),r[o].count++});const i=Object.keys(r);for(let s=0;s=e)return o.result}}}function $X(n,e,t){let r=lh;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=p2(i.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),s.indexOf(o+1)>=0&&o++,o>=n._highestBlockNumber&&(n._highestBlockNumber=o),n._highestBlockNumber};case"getGasPrice":return function(i){const s=i.map(o=>o.result);return s.sort(),s[Math.floor(s.length/2)]};case"getEtherPrice":return function(i){return p2(i.map(s=>s.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":r=function(i){return i==null?null:(i=xn(i),i.confirmations=-1,lh(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=xn(i),i.transactions=i.transactions.map(s=>(s=xn(s),s.confirmations=-1,s)),lh(i))}:r=function(i){return i==null?null:lh(i)};break;default:throw new Error("unknown method: "+e)}return KX(r,n.quorum)}function mp(n,e){return Lw(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:ah(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function qX(n,e,t,r){return Lw(this,void 0,void 0,function*(){let i=n.provider;switch(t){case"getBlockNumber":case"getGasPrice":return i[t]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return r.blockTag&&Ft(r.blockTag)&&(i=yield mp(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Ft(r.blockTag)&&(i=yield mp(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Ft(r.blockTag)&&(i=yield mp(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Ft(r.blockTag)&&(i=yield mp(n,e)),t==="call"&&r.blockTag?i[t](r.transaction,r.blockTag):i[t](r.transaction);case"getTransaction":case"getTransactionReceipt":return i[t](r.transactionHash);case"getLogs":{let s=r.filter;return(s.fromBlock&&Ft(s.fromBlock)||s.toBlock&&Ft(s.toBlock))&&(i=yield mp(n,e)),i.getLogs(s)}}return Zc.throwError("unknown method error",we.errors.UNKNOWN_ERROR,{method:t,params:r})})}class e8 extends oS{constructor(e,t){e.length===0&&Zc.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(n0.isProvider(o)){const c=qR(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=xn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=qR(o)?2e3:750),l.weight==null&&(l.weight=1);const A=l.weight;return(A%1||A>512||A<1)&&Zc.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,A),Object.freeze(l)}),i=r.reduce((o,a)=>o+a.weight,0);t==null?t=i/2:t>i&&Zc.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=f2(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Me(this,"providerConfigs",Object.freeze(r)),Me(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return Lw(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return f2(e)})}perform(e,t){return Lw(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(A=>A.provider.sendTransaction(t.signedTransaction).then(c=>c.hash,c=>c)));for(let A=0;Al.priority-A.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=Z0();let A=i.filter(d=>d.runner&&l-d.startd+p.weight,0);for(;A{d.staller=null}),d.runner=qX(d,s,e,t).then(f=>{d.done=!0,d.result=f,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:J0(d,Z0()),request:{method:e,params:ls(t)},provider:this})},f=>{d.done=!0,d.error=f,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:J0(d,Z0()),request:{method:e,params:ls(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:J0(d,null),request:{method:e,params:ls(t)},provider:this}),A+=d.weight}const c=[];i.forEach(d=>{d.done||!d.runner||(c.push(d.runner),d.staller&&c.push(d.staller.getPromise()))}),c.length&&(yield Promise.race(c));const u=i.filter(d=>d.done&&d.error==null);if(u.length>=this.quorum){const d=r(u);if(d!==void 0)return i.forEach(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),d;a||(yield g2(100).getPromise()),a=!1}const h=i.reduce((d,p)=>{if(!p.done||p.error==null)return d;const f=p.error.code;return XX.indexOf(f)>=0&&(d[f]||(d[f]={error:p.error,weight:0}),d[f].weight+=p.weight),d},{});if(Object.keys(h).forEach(d=>{const p=h[d];if(p.weight{m.staller&&m.staller.cancel(),m.cancelled=!0});const f=p.error,g={};jX.forEach(m=>{f[m]!=null&&(g[m]=f[m])}),Zc.throwError(f.reason||f.message,d,g)}),i.filter(d=>!d.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),Zc.throwError("failed to meet quorum",we.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>J0(l)),provider:this})})}}const t8=null,Hy=new we(ri),ag="84842078b09946638c03157f83405213";class n8 extends lS{constructor(e,t){const r=new XP(e,t),i=r.connection;i.password&&Hy.throwError("INFURA WebSocket project secrets unsupported",we.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Me(this,"apiKey",r.projectId),Me(this,"projectId",r.projectId),Me(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===ag}}class XP extends fc{static getWebSocketProvider(e,t){return new n8(e,t)}static getApiKey(e){const t={apiKey:ag,projectId:ag,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(Hy.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),Hy.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:Hy.throwError("unsupported network",we.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===ag&&RC(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===ag}}const fx=new we(ri),r8="ETHERS_JS_SHARED";class i8 extends fc{static getApiKey(e){return e&&typeof e!="string"&&fx.throwArgumentError("invalid apiKey","apiKey",e),e||r8}static getUrl(e,t){fx.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:fx.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const m2=new we(ri),v2="62e1ad51b37b8e00394bda3b";class s8 extends fc{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=v2:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:m2.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:m2.throwError("unsupported network",we.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${r}/v1/lb/${t.applicationId}`,s={headers:{},url:i};return t.applicationSecretKey!=null&&(s.user="",s.password=t.applicationSecretKey),s}isCommunityResource(){return this.applicationId===v2}}const y2=new we(ri);let o8=1;function w2(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:o8++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:ls(s),provider:this}),e(s,(l,A)=>{if(l)return this.emit("debug",{action:"response",fetcher:t,error:l,request:s,provider:this}),a(l);if(this.emit("debug",{action:"response",fetcher:t,request:s,response:A,provider:this}),A.error){const c=new Error(A.error.message);return c.code=A.error.code,c.data=A.error.data,a(c)}o(A.result)})})}}function a8(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:ls(r),provider:this}),n.request(r).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:i,provider:this}),i})}}class AS extends nm{constructor(e,t){e==null&&y2.throwArgumentError("missing provider","provider",e);let r=null,i=null,s=null;typeof e=="function"?(r="unknown:",i=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),s=e,e.request?(r===""&&(r="eip-1193:"),i=a8(e)):e.sendAsync?i=w2(e,e.sendAsync.bind(e)):e.send?i=w2(e,e.send.bind(e)):y2.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Me(this,"jsonRpcFetchFunc",i),Me(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const B2=new we(ri);function l8(n,e){if(n==null&&(n="homestead"),typeof n=="string"){const r=n.match(/^(ws|http)s?:/i);if(r)switch(r[1].toLowerCase()){case"http":case"https":return new nm(n);case"ws":case"wss":return new lS(n);default:B2.throwArgumentError("unsupported URL scheme","network",n)}}const t=zV(n);return(!t||!t._defaultProvider)&&B2.throwError("unsupported getDefaultProvider network",we.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:e8,AlchemyProvider:YP,AnkrProvider:WX,CloudflareProvider:ZX,EtherscanProvider:HX,InfuraProvider:XP,JsonRpcProvider:nm,NodesmithProvider:i8,PocketProvider:s8,Web3Provider:AS,IpcProvider:t8},e)}var A8=!0,px="Invariant failed";function yl(n,e){if(!n){if(A8)throw new Error(px);var t=typeof e=="function"?e():e,r=t?"".concat(px,": ").concat(t):px;throw new Error(r)}}var _o;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(_o||(_o={}));function rm(){return rm=Object.assign||function(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function zy(n,e,t){return c8()?zy=Reflect.construct:zy=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&im(A,o.prototype),A},zy.apply(null,arguments)}function u8(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Vw(n){var e=typeof Map=="function"?new Map:void 0;return Vw=function(r){if(r===null||!u8(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return zy(r,arguments,cF(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),im(i,r)},Vw(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function C2(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function KP(n){if(typeof n=="string"){n=n.replace(/^Ox/,"0x");var e=Number.parseInt(n,n.trim().substring(0,2)==="0x"?16:10);return Number.isNaN(e)&&yl(!1),e}else return Number.isInteger(n)||yl(!1),n}function $P(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||yl(!1);for(var e=n.substring(0,2)==="0x"?n:"0x"+n,t=e.toLowerCase().substring(2).split(""),r=new Uint8Array(40),i=0;i<40;i++)r[i]=t[i].charCodeAt(0);for(var s=At(ir(r)),o=0;o<40;o+=2)s[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(s[o>>1]&15)>=8&&(t[o+1]=t[o+1].toUpperCase());var a="0x"+t.join("");return e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==a&&yl(!1),a}var b2=function(e,t){try{var r=function(o){return Promise.resolve(Promise.all([t.chainId===void 0?e.getChainId():t.chainId,t.account===void 0?e.getAccount():t.account])).then(function(a){var l=a[0],A=a[1],c=KP(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(c))throw new qP(c,e.supportedChainIds);var u=A===null?A:$P(A);return{provider:o,chainId:c,account:u}})},i=t.provider===void 0;return Promise.resolve(i?Promise.resolve(e.getProvider()).then(r):r(t.provider))}catch(s){return Promise.reject(s)}},H0=function(n){jP(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Vw(Error)),qP=function(n){jP(e,n);function e(t,r){var i;return i=n.call(this)||this,i.name=i.constructor.name,i.message="Unsupported chain id: "+t+". Supported chain ids are: "+r+".",i}return e}(Vw(Error)),Cr;(function(n){n[n.ACTIVATE_CONNECTOR=0]="ACTIVATE_CONNECTOR",n[n.UPDATE=1]="UPDATE",n[n.UPDATE_FROM_ERROR=2]="UPDATE_FROM_ERROR",n[n.ERROR=3]="ERROR",n[n.ERROR_FROM_ACTIVATION=4]="ERROR_FROM_ACTIVATION",n[n.DEACTIVATE_CONNECTOR=5]="DEACTIVATE_CONNECTOR"})(Cr||(Cr={}));function d8(n,e){var t=e.type,r=e.payload;switch(t){case Cr.ACTIVATE_CONNECTOR:{var i=r.connector,s=r.provider,o=r.chainId,a=r.account,l=r.onError;return{connector:i,provider:s,chainId:o,account:a,onError:l}}case Cr.UPDATE:{var A=r.provider,c=r.chainId,u=r.account;return rm({},n,A===void 0?{}:{provider:A},c===void 0?{}:{chainId:c},u===void 0?{}:{account:u})}case Cr.UPDATE_FROM_ERROR:{var h=r.provider,d=r.chainId,p=r.account;return rm({},n,h===void 0?{}:{provider:h},d===void 0?{}:{chainId:d},p===void 0?{}:{account:p},{error:void 0})}case Cr.ERROR:{var f=r.error,g=n.connector,m=n.onError;return{connector:g,error:f,onError:m}}case Cr.ERROR_FROM_ACTIVATION:{var v=r.connector,w=r.error;return{connector:v,error:w}}case Cr.DEACTIVATE_CONNECTOR:return{}}}function h8(){var n=Be.useReducer(d8,{}),e=n[0],t=n[1],r=e.connector,i=e.provider,s=e.chainId,o=e.account,a=e.onError,l=e.error,A=Be.useRef(-1);A.current+=1;var c=Be.useCallback(function(g,m,v){v===void 0&&(v=!1);try{var w=A.current,B=!1;return Promise.resolve(C2(function(){return Promise.resolve(g.activate().then(function(C){return B=!0,C})).then(function(C){return Promise.resolve(b2(g,C)).then(function(b){if(A.current>w)throw new H0;t({type:Cr.ACTIVATE_CONNECTOR,payload:rm({connector:g},b,{onError:m})})})})},function(C){if(C instanceof H0)B&&g.deactivate();else{if(v)throw B&&g.deactivate(),C;m?(B&&g.deactivate(),m(C)):t({type:Cr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:C}})}}))}catch(C){return Promise.reject(C)}},[]),u=Be.useCallback(function(g){t({type:Cr.ERROR,payload:{error:g}})},[]),h=Be.useCallback(function(){t({type:Cr.DEACTIVATE_CONNECTOR})},[]),d=Be.useCallback(function(g){try{if(!r)throw Error("This should never happen, it's just so Typescript stops complaining");var m=A.current;return Promise.resolve(function(){if(l)return C2(function(){return Promise.resolve(b2(r,g)).then(function(C){if(A.current>m)throw new H0;t({type:Cr.UPDATE_FROM_ERROR,payload:C})})},function(C){C instanceof H0||(a?a(C):t({type:Cr.ERROR,payload:{error:C}}))});var v=g.chainId===void 0?void 0:KP(g.chainId);if(v!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(v)){var w=new qP(v,r.supportedChainIds);a?a(w):t({type:Cr.ERROR,payload:{error:w}})}else{var B=typeof g.account=="string"?$P(g.account):g.account;t({type:Cr.UPDATE,payload:{provider:g.provider,chainId:v,account:B}})}}())}catch(v){return Promise.reject(v)}},[r,l,a]),p=Be.useCallback(function(g){a?a(g):t({type:Cr.ERROR,payload:{error:g}})},[a]),f=Be.useCallback(function(){t({type:Cr.DEACTIVATE_CONNECTOR})},[]);return Be.useEffect(function(){return function(){r&&r.deactivate()}},[r]),Be.useEffect(function(){return r&&r.on(_o.Update,d).on(_o.Error,p).on(_o.Deactivate,f),function(){r&&r.off(_o.Update,d).off(_o.Error,p).off(_o.Deactivate,f)}},[r,d,p,f]),{connector:r,provider:i,chainId:s,account:o,activate:c,setError:u,deactivate:h,error:l}}var eO="primary",Ah={};function f8(n){Ah[n]&&yl(!1),Ah[n]=Be.createContext({activate:function(){try{return yl(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){yl(!1)},deactivate:function(){yl(!1)},active:!1}),Ah[n].displayName="Web3ReactContext - "+n;var e=Ah[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=h8(),a=o.connector,l=o.provider,A=o.chainId,c=o.account,u=o.activate,h=o.setError,d=o.deactivate,p=o.error,f=a!==void 0&&A!==void 0&&c!==void 0&&!p,g=Be.useMemo(function(){return f&&A!==void 0&&Number.isInteger(A)&&a?i(l,a):void 0},[f,i,l,a,A]),m={connector:a,library:g,chainId:A,account:c,activate:u,setError:h,deactivate:d,active:f,error:p};return X.createElement(e,{value:m},s)}}var p8=f8(eO);function g8(n){return n===void 0&&(n=eO),Object.keys(Ah).includes(n)||yl(!1),Ah[n]}function m8(n){return Be.useContext(g8(n))}var uF={},tO={exports:{}},ys={},nO={exports:{}},rO={};/** * @license React * scheduler.production.min.js * @@ -29,7 +29,7 @@ var Ez=Object.defineProperty;var _z=(n,e,t)=>e in n?Ez(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(n){function e(k,V){var G=k.length;k.push(V);e:for(;0>>1,E=k[D];if(0>>1;Di(T,G))eei(pe,T)?(k[D]=pe,k[ee]=G,D=ee):(k[D]=T,k[re]=G,D=re);else if(eei(pe,G))k[D]=pe,k[ee]=G,D=ee;else break e}}return V}function i(k,V){var G=k.sortIndex-V.sortIndex;return G!==0?G:k.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],A=[],c=1,u=null,h=3,d=!1,p=!1,f=!1,g=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(k){for(var V=t(A);V!==null;){if(V.callback===null)r(A);else if(V.startTime<=k)r(A),V.sortIndex=V.expirationTime,e(l,V);else break;V=t(A)}}function B(k){if(f=!1,w(k),!p)if(t(l)!==null)p=!0,R(C);else{var V=t(A);V!==null&&N(B,V.startTime-k)}}function C(k,V){p=!1,f&&(f=!1,m(x),x=-1),d=!0;var G=h;try{for(w(V),u=t(l);u!==null&&(!(u.expirationTime>V)||k&&!Y());){var D=u.callback;if(typeof D=="function"){u.callback=null,h=u.priorityLevel;var E=D(u.expirationTime<=V);V=n.unstable_now(),typeof E=="function"?u.callback=E:u===t(l)&&r(l),w(V)}else r(l);u=t(l)}if(u!==null)var z=!0;else{var re=t(A);re!==null&&N(B,re.startTime-V),z=!1}return z}finally{u=null,h=G,d=!1}}var b=!1,F=null,x=-1,_=5,M=-1;function Y(){return!(n.unstable_now()-M<_)}function O(){if(F!==null){var k=n.unstable_now();M=k;var V=!0;try{V=F(!0,k)}finally{V?U():(b=!1,F=null)}}else b=!1}var U;if(typeof v=="function")U=function(){v(O)};else if(typeof MessageChannel<"u"){var y=new MessageChannel,I=y.port2;y.port1.onmessage=O,U=function(){I.postMessage(null)}}else U=function(){g(O,0)};function R(k){F=k,b||(b=!0,U())}function N(k,V){x=g(function(){k(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(k){k.callback=null},n.unstable_continueExecution=function(){p||d||(p=!0,R(C))},n.unstable_forceFrameRate=function(k){0>k||125D?(k.sortIndex=G,e(A,k),t(l)===null&&k===t(A)&&(f?(m(x),x=-1):f=!0,N(B,G-D))):(k.sortIndex=E,e(l,k),p||d||(p=!0,R(C))),k},n.unstable_shouldYield=Y,n.unstable_wrapCallback=function(k){var V=h;return function(){var G=h;h=V;try{return k.apply(this,arguments)}finally{h=G}}}})(rO);nO.exports=rO;var v8=nO.exports;/** + */(function(n){function e(k,L){var G=k.length;k.push(L);e:for(;0>>1,E=k[D];if(0>>1;Di(T,G))eei(pe,T)?(k[D]=pe,k[ee]=G,D=ee):(k[D]=T,k[re]=G,D=re);else if(eei(pe,G))k[D]=pe,k[ee]=G,D=ee;else break e}}return L}function i(k,L){var G=k.sortIndex-L.sortIndex;return G!==0?G:k.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],A=[],c=1,u=null,h=3,d=!1,p=!1,f=!1,g=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(k){for(var L=t(A);L!==null;){if(L.callback===null)r(A);else if(L.startTime<=k)r(A),L.sortIndex=L.expirationTime,e(l,L);else break;L=t(A)}}function B(k){if(f=!1,w(k),!p)if(t(l)!==null)p=!0,R(C);else{var L=t(A);L!==null&&N(B,L.startTime-k)}}function C(k,L){p=!1,f&&(f=!1,m(x),x=-1),d=!0;var G=h;try{for(w(L),u=t(l);u!==null&&(!(u.expirationTime>L)||k&&!Y());){var D=u.callback;if(typeof D=="function"){u.callback=null,h=u.priorityLevel;var E=D(u.expirationTime<=L);L=n.unstable_now(),typeof E=="function"?u.callback=E:u===t(l)&&r(l),w(L)}else r(l);u=t(l)}if(u!==null)var z=!0;else{var re=t(A);re!==null&&N(B,re.startTime-L),z=!1}return z}finally{u=null,h=G,d=!1}}var b=!1,F=null,x=-1,_=5,M=-1;function Y(){return!(n.unstable_now()-M<_)}function O(){if(F!==null){var k=n.unstable_now();M=k;var L=!0;try{L=F(!0,k)}finally{L?U():(b=!1,F=null)}}else b=!1}var U;if(typeof v=="function")U=function(){v(O)};else if(typeof MessageChannel<"u"){var y=new MessageChannel,I=y.port2;y.port1.onmessage=O,U=function(){I.postMessage(null)}}else U=function(){g(O,0)};function R(k){F=k,b||(b=!0,U())}function N(k,L){x=g(function(){k(n.unstable_now())},L)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(k){k.callback=null},n.unstable_continueExecution=function(){p||d||(p=!0,R(C))},n.unstable_forceFrameRate=function(k){0>k||125D?(k.sortIndex=G,e(A,k),t(l)===null&&k===t(A)&&(f?(m(x),x=-1):f=!0,N(B,G-D))):(k.sortIndex=E,e(l,k),p||d||(p=!0,R(C))),k},n.unstable_shouldYield=Y,n.unstable_wrapCallback=function(k){var L=h;return function(){var G=h;h=L;try{return k.apply(this,arguments)}finally{h=G}}}})(rO);nO.exports=rO;var v8=nO.exports;/** * @license React * react-dom.production.min.js * @@ -44,7 +44,7 @@ var Ez=Object.defineProperty;var _z=(n,e,t)=>e in n?Ez(n,e,{enumerable:!0,config `+i[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{mx=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?lg(n):""}function b8(n){switch(n.tag){case 5:return lg(n.type);case 16:return lg("Lazy");case 13:return lg("Suspense");case 19:return lg("SuspenseList");case 0:case 2:case 15:return n=vx(n.type,!1),n;case 11:return n=vx(n.type.render,!1),n;case 1:return n=vx(n.type,!0),n;default:return""}}function gF(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case uh:return"Fragment";case ch:return"Portal";case hF:return"Profiler";case hS:return"StrictMode";case fF:return"Suspense";case pF:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case aO:return(n.displayName||"Context")+".Consumer";case oO:return(n._context.displayName||"Context")+".Provider";case fS:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case pS:return e=n.displayName||null,e!==null?e:gF(n.type)||"Memo";case vA:e=n._payload,n=n._init;try{return gF(n(e))}catch{}}return null}function x8(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return gF(e);case 8:return e===hS?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function nc(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function AO(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function I8(n){var e=AO(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Y0(n){n._valueTracker||(n._valueTracker=I8(n))}function cO(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=AO(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function Pw(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function mF(n,e){var t=e.checked;return Rn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function E2(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=nc(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function uO(n,e){e=e.checked,e!=null&&dS(n,"checked",e,!1)}function vF(n,e){uO(n,e);var t=nc(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?yF(n,e.type,t):e.hasOwnProperty("defaultValue")&&yF(n,e.type,nc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function _2(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function yF(n,e,t){(e!=="number"||Pw(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Ag=Array.isArray;function Nh(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=X0.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function om(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Mg={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},F8=["Webkit","ms","Moz","O"];Object.keys(Mg).forEach(function(n){F8.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Mg[e]=Mg[n]})});function pO(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Mg.hasOwnProperty(n)&&Mg[n]?(""+e).trim():e+"px"}function gO(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=pO(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var E8=Rn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function CF(n,e){if(e){if(E8[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ne(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ne(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ne(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ne(62))}}function bF(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xF=null;function gS(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var IF=null,kh=null,Dh=null;function Q2(n){if(n=l0(n)){if(typeof IF!="function")throw Error(Ne(280));var e=n.stateNode;e&&(e=DC(e),IF(n.stateNode,n.type,e))}}function mO(n){kh?Dh?Dh.push(n):Dh=[n]:kh=n}function vO(){if(kh){var n=kh,e=Dh;if(Dh=kh=null,Q2(n),e)for(n=0;n>>=0,n===0?32:31-(L8(n)/V8|0)|0}var j0=64,K0=4194304;function cg(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Zw(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=cg(a):(s&=o,s!==0&&(r=cg(s)))}else o=t&~i,o!==0?r=cg(o):s!==0&&(r=cg(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function o0(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Ro(e),n[e]=t}function G8(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0=Ng),P2=String.fromCharCode(32),O2=!1;function LO(n,e){switch(n){case"keyup":return mj.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function VO(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var dh=!1;function yj(n,e){switch(n){case"compositionend":return VO(e);case"keypress":return e.which!==32?null:(O2=!0,P2);case"textInput":return n=e.data,n===P2&&O2?null:n;default:return null}}function wj(n,e){if(dh)return n==="compositionend"||!xS&&LO(n,e)?(n=kO(),Xy=BS=_A=null,dh=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=J2(t)}}function GO(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?GO(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function ZO(){for(var n=window,e=Pw();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Pw(n.document)}return e}function IS(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function Sj(n){var e=ZO(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&GO(t.ownerDocument.documentElement,t)){if(r!==null&&IS(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=H2(t,s);var o=H2(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,hh=null,QF=null,Dg=null,RF=!1;function z2(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;RF||hh==null||hh!==Pw(r)||(r=hh,"selectionStart"in r&&IS(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dg&&dm(Dg,r)||(Dg=r,r=zw(QF,"onSelect"),0gh||(n.current=LF[gh],LF[gh]=null,gh--)}function hn(n,e){gh++,LF[gh]=n.current,n.current=e}var rc={},ni=gc(rc),Mi=gc(!1),pu=rc;function af(n,e){var t=n.type.contextTypes;if(!t)return rc;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function Ti(n){return n=n.childContextTypes,n!=null}function Xw(){vn(Mi),vn(ni)}function eM(n,e,t){if(ni.current!==rc)throw Error(Ne(168));hn(ni,e),hn(Mi,t)}function qO(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Ne(108,x8(n)||"Unknown",i));return Rn({},t,r)}function jw(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||rc,pu=ni.current,hn(ni,n),hn(Mi,Mi.current),!0}function tM(n,e,t){var r=n.stateNode;if(!r)throw Error(Ne(169));t?(n=qO(n,e,pu),r.__reactInternalMemoizedMergedChildContext=n,vn(Mi),vn(ni),hn(ni,n)):vn(Mi),hn(Mi,t)}var fl=null,LC=!1,Rx=!1;function eW(n){fl===null?fl=[n]:fl.push(n)}function Oj(n){LC=!0,eW(n)}function mc(){if(!Rx&&fl!==null){Rx=!0;var n=0,e=tn;try{var t=fl;for(tn=1;n>=o,i-=o,wl=1<<32-Ro(e)+i|t<x?(_=F,F=null):_=F.sibling;var M=h(m,F,w[x],B);if(M===null){F===null&&(F=_);break}n&&F&&M.alternate===null&&e(m,F),v=s(M,v,x),b===null?C=M:b.sibling=M,b=M,F=_}if(x===w.length)return t(m,F),bn&&Dc(m,x),C;if(F===null){for(;xx?(_=F,F=null):_=F.sibling;var Y=h(m,F,M.value,B);if(Y===null){F===null&&(F=_);break}n&&F&&Y.alternate===null&&e(m,F),v=s(Y,v,x),b===null?C=Y:b.sibling=Y,b=Y,F=_}if(M.done)return t(m,F),bn&&Dc(m,x),C;if(F===null){for(;!M.done;x++,M=w.next())M=u(m,M.value,B),M!==null&&(v=s(M,v,x),b===null?C=M:b.sibling=M,b=M);return bn&&Dc(m,x),C}for(F=r(m,F);!M.done;x++,M=w.next())M=d(F,m,x,M.value,B),M!==null&&(n&&M.alternate!==null&&F.delete(M.key===null?x:M.key),v=s(M,v,x),b===null?C=M:b.sibling=M,b=M);return n&&F.forEach(function(O){return e(m,O)}),bn&&Dc(m,x),C}function g(m,v,w,B){if(typeof w=="object"&&w!==null&&w.type===uh&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case z0:e:{for(var C=w.key,b=v;b!==null;){if(b.key===C){if(C=w.type,C===uh){if(b.tag===7){t(m,b.sibling),v=i(b,w.props.children),v.return=m,m=v;break e}}else if(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===vA&&lM(C)===b.type){t(m,b.sibling),v=i(b,w.props),v.ref=bp(m,b,w),v.return=m,m=v;break e}t(m,b);break}else e(m,b);b=b.sibling}w.type===uh?(v=su(w.props.children,m.mode,B,w.key),v.return=m,m=v):(B=rw(w.type,w.key,w.props,null,m.mode,B),B.ref=bp(m,v,w),B.return=m,m=B)}return o(m);case ch:e:{for(b=w.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){t(m,v.sibling),v=i(v,w.children||[]),v.return=m,m=v;break e}else{t(m,v);break}else e(m,v);v=v.sibling}v=Px(w,m.mode,B),v.return=m,m=v}return o(m);case vA:return b=w._init,g(m,v,b(w._payload),B)}if(Ag(w))return p(m,v,w,B);if(vp(w))return f(m,v,w,B);iv(m,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(t(m,v.sibling),v=i(v,w),v.return=m,m=v):(t(m,v),v=Vx(w,m.mode,B),v.return=m,m=v),o(m)):t(m,v)}return g}var Af=lW(!0),AW=lW(!1),A0={},Ca=gc(A0),gm=gc(A0),mm=gc(A0);function Xc(n){if(n===A0)throw Error(Ne(174));return n}function TS(n,e){switch(hn(mm,e),hn(gm,n),hn(Ca,A0),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:BF(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=BF(e,n)}vn(Ca),hn(Ca,e)}function cf(){vn(Ca),vn(gm),vn(mm)}function cW(n){Xc(mm.current);var e=Xc(Ca.current),t=BF(e,n.type);e!==t&&(hn(gm,n),hn(Ca,t))}function NS(n){gm.current===n&&(vn(Ca),vn(gm))}var _n=gc(0);function nB(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mx=[];function kS(){for(var n=0;nt?t:4,n(!0);var r=Tx.transition;Tx.transition={};try{n(!1),e()}finally{tn=t,Tx.transition=r}}function FW(){return no().memoizedState}function Jj(n,e,t){var r=JA(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},EW(n))_W(e,t);else if(t=iW(n,e,t,r),t!==null){var i=vi();Mo(t,n,r,i),SW(t,e,r)}}function Hj(n,e,t){var r=JA(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(EW(n))_W(e,i);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,Do(a,o)){var l=e.interleaved;l===null?(i.next=i,RS(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=iW(n,e,i,r),t!==null&&(i=vi(),Mo(t,n,r,i),SW(t,e,r))}}function EW(n){var e=n.alternate;return n===Qn||e!==null&&e===Qn}function _W(n,e){Lg=rB=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function SW(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,vS(n,t)}}var iB={readContext:to,useCallback:Zr,useContext:Zr,useEffect:Zr,useImperativeHandle:Zr,useInsertionEffect:Zr,useLayoutEffect:Zr,useMemo:Zr,useReducer:Zr,useRef:Zr,useState:Zr,useDebugValue:Zr,useDeferredValue:Zr,useTransition:Zr,useMutableSource:Zr,useSyncExternalStore:Zr,useId:Zr,unstable_isNewReconciler:!1},zj={readContext:to,useCallback:function(n,e){return na().memoizedState=[n,e===void 0?null:e],n},useContext:to,useEffect:cM,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,qy(4194308,4,BW.bind(null,e,n),t)},useLayoutEffect:function(n,e){return qy(4194308,4,n,e)},useInsertionEffect:function(n,e){return qy(4,2,n,e)},useMemo:function(n,e){var t=na();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=na();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=Jj.bind(null,Qn,n),[r.memoizedState,n]},useRef:function(n){var e=na();return n={current:n},e.memoizedState=n},useState:AM,useDebugValue:OS,useDeferredValue:function(n){return na().memoizedState=n},useTransition:function(){var n=AM(!1),e=n[0];return n=Zj.bind(null,n[1]),na().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Qn,i=na();if(bn){if(t===void 0)throw Error(Ne(407));t=t()}else{if(t=e(),Er===null)throw Error(Ne(349));mu&30||hW(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,cM(pW.bind(null,r,s,n),[n]),r.flags|=2048,wm(9,fW.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=na(),e=Er.identifierPrefix;if(bn){var t=Bl,r=wl;t=(r&~(1<<32-Ro(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=vm++,0<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[la]=e,n[pm]=r,LW(n,e,!1,!1),e.stateNode=n;e:{switch(o=bF(t,r),t){case"dialog":fn("cancel",n),fn("close",n),i=r;break;case"iframe":case"object":case"embed":fn("load",n),i=r;break;case"video":case"audio":for(i=0;idf&&(e.flags|=128,r=!0,xp(s,!1),e.lanes=4194304)}else{if(!r)if(n=nB(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),xp(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!bn)return Jr(e),null}else 2*Yn()-s.renderingStartTime>df&&t!==1073741824&&(e.flags|=128,r=!0,xp(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Yn(),e.sibling=null,t=_n.current,hn(_n,r?t&1|2:t&1),e):(Jr(e),null);case 22:case 23:return zS(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?$i&1073741824&&(Jr(e),e.subtreeFlags&6&&(e.flags|=8192)):Jr(e),null;case 24:return null;case 25:return null}throw Error(Ne(156,e.tag))}function tK(n,e){switch(ES(e),e.tag){case 1:return Ti(e.type)&&Xw(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return cf(),vn(Mi),vn(ni),kS(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return NS(e),null;case 13:if(vn(_n),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Ne(340));lf()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return vn(_n),null;case 4:return cf(),null;case 10:return QS(e.type._context),null;case 22:case 23:return zS(),null;case 24:return null;default:return null}}var ov=!1,jr=!1,nK=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function wh(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Dn(n,e,r)}else t.current=null}function jF(n,e,t){try{t()}catch(r){Dn(n,e,r)}}var yM=!1;function rK(n,e){if(MF=Jw,n=ZO(),IS(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,A=0,c=0,u=n,h=null;t:for(;;){for(var d;u!==t||i!==0&&u.nodeType!==3||(a=o+i),u!==s||r!==0&&u.nodeType!==3||(l=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(d=u.firstChild)!==null;)h=u,u=d;for(;;){if(u===n)break t;if(h===t&&++A===i&&(a=o),h===s&&++c===r&&(l=o),(d=u.nextSibling)!==null)break;u=h,h=u.parentNode}u=d}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(TF={focusedElem:n,selectionRange:t},Jw=!1,Xe=e;Xe!==null;)if(e=Xe,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Xe=n;else for(;Xe!==null;){e=Xe;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var f=p.memoizedProps,g=p.memoizedState,m=e.stateNode,v=m.getSnapshotBeforeUpdate(e.elementType===e.type?f:Fo(e.type,f),g);m.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ne(163))}}catch(B){Dn(e,e.return,B)}if(n=e.sibling,n!==null){n.return=e.return,Xe=n;break}Xe=e.return}return p=yM,yM=!1,p}function Vg(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&jF(e,t,s)}i=i.next}while(i!==r)}}function OC(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function KF(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function OW(n){var e=n.alternate;e!==null&&(n.alternate=null,OW(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[la],delete e[pm],delete e[DF],delete e[Vj],delete e[Pj])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function WW(n){return n.tag===5||n.tag===3||n.tag===4}function wM(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||WW(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function $F(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Yw));else if(r!==4&&(n=n.child,n!==null))for($F(n,e,t),n=n.sibling;n!==null;)$F(n,e,t),n=n.sibling}function qF(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(qF(n,e,t),n=n.sibling;n!==null;)qF(n,e,t),n=n.sibling}var Mr=null,Eo=!1;function eA(n,e,t){for(t=t.child;t!==null;)GW(n,e,t),t=t.sibling}function GW(n,e,t){if(Ba&&typeof Ba.onCommitFiberUnmount=="function")try{Ba.onCommitFiberUnmount(MC,t)}catch{}switch(t.tag){case 5:jr||wh(t,e);case 6:var r=Mr,i=Eo;Mr=null,eA(n,e,t),Mr=r,Eo=i,Mr!==null&&(Eo?(n=Mr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Mr.removeChild(t.stateNode));break;case 18:Mr!==null&&(Eo?(n=Mr,t=t.stateNode,n.nodeType===8?Qx(n.parentNode,t):n.nodeType===1&&Qx(n,t),cm(n)):Qx(Mr,t.stateNode));break;case 4:r=Mr,i=Eo,Mr=t.stateNode.containerInfo,Eo=!0,eA(n,e,t),Mr=r,Eo=i;break;case 0:case 11:case 14:case 15:if(!jr&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&jF(t,e,o),i=i.next}while(i!==r)}eA(n,e,t);break;case 1:if(!jr&&(wh(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Dn(t,e,a)}eA(n,e,t);break;case 21:eA(n,e,t);break;case 22:t.mode&1?(jr=(r=jr)||t.memoizedState!==null,eA(n,e,t),jr=r):eA(n,e,t);break;default:eA(n,e,t)}}function BM(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new nK),e.forEach(function(r){var i=dK.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function po(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Yn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sK(r/1960))-r,10n?16:n,SA===null)var r=!1;else{if(n=SA,SA=null,aB=0,Gt&6)throw Error(Ne(331));var i=Gt;for(Gt|=4,Xe=n.current;Xe!==null;){var s=Xe,o=s.child;if(Xe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lYn()-JS?iu(n,0):ZS|=t),Ni(n,e)}function KW(n,e){e===0&&(n.mode&1?(e=K0,K0<<=1,!(K0&130023424)&&(K0=4194304)):e=1);var t=vi();n=kl(n,e),n!==null&&(o0(n,e,t),Ni(n,t))}function uK(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),KW(n,t)}function dK(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(Ne(314))}r!==null&&r.delete(e),KW(n,t)}var $W;$W=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Mi.current)Qi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Qi=!1,qj(n,e,t);Qi=!!(n.flags&131072)}else Qi=!1,bn&&e.flags&1048576&&tW(e,$w,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ew(n,e),n=e.pendingProps;var i=af(e,ni.current);Vh(e,t),i=LS(null,e,r,n,i,t);var s=VS();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ti(r)?(s=!0,jw(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,MS(e),i.updater=VC,e.stateNode=i,i._reactInternals=e,GF(e,r,n,t),e=HF(null,e,r,!0,s,t)):(e.tag=0,bn&&s&&FS(e),Ai(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(ew(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=fK(r),n=Fo(r,n),i){case 0:e=JF(null,e,r,n,t);break e;case 1:e=gM(null,e,r,n,t);break e;case 11:e=fM(null,e,r,n,t);break e;case 14:e=pM(null,e,r,Fo(r.type,n),t);break e}throw Error(Ne(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fo(r,i),JF(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fo(r,i),gM(n,e,r,i,t);case 3:e:{if(NW(e),n===null)throw Error(Ne(387));r=e.pendingProps,s=e.memoizedState,i=s.element,sW(n,e),tB(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=uf(Error(Ne(423)),e),e=mM(n,e,r,t,i);break e}else if(r!==i){i=uf(Error(Ne(424)),e),e=mM(n,e,r,t,i);break e}else for(os=WA(e.stateNode.containerInfo.firstChild),As=e,bn=!0,So=null,t=AW(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(lf(),r===i){e=Dl(n,e,t);break e}Ai(n,e,r,t)}e=e.child}return e;case 5:return cW(e),n===null&&PF(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,NF(r,i)?o=null:s!==null&&NF(r,s)&&(e.flags|=32),TW(n,e),Ai(n,e,o,t),e.child;case 6:return n===null&&PF(e),null;case 13:return kW(n,e,t);case 4:return TS(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=Af(e,null,r,t):Ai(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fo(r,i),fM(n,e,r,i,t);case 7:return Ai(n,e,e.pendingProps,t),e.child;case 8:return Ai(n,e,e.pendingProps.children,t),e.child;case 12:return Ai(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,hn(qw,r._currentValue),r._currentValue=o,s!==null)if(Do(s.value,o)){if(s.children===i.children&&!Mi.current){e=Dl(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Fl(-1,t&-t),l.tag=2;var A=s.updateQueue;if(A!==null){A=A.shared;var c=A.pending;c===null?l.next=l:(l.next=c.next,c.next=l),A.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),OF(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Ne(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),OF(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ai(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Vh(e,t),i=to(i),r=r(i),e.flags|=1,Ai(n,e,r,t),e.child;case 14:return r=e.type,i=Fo(r,e.pendingProps),i=Fo(r.type,i),pM(n,e,r,i,t);case 15:return RW(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fo(r,i),ew(n,e),e.tag=1,Ti(r)?(n=!0,jw(e)):n=!1,Vh(e,t),aW(e,r,i),GF(e,r,i,t),HF(null,e,r,!0,n,t);case 19:return DW(n,e,t);case 22:return MW(n,e,t)}throw Error(Ne(156,e.tag))};function qW(n,e){return IO(n,e)}function hK(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gs(n,e,t,r){return new hK(n,e,t,r)}function XS(n){return n=n.prototype,!(!n||!n.isReactComponent)}function fK(n){if(typeof n=="function")return XS(n)?1:0;if(n!=null){if(n=n.$$typeof,n===fS)return 11;if(n===pS)return 14}return 2}function HA(n,e){var t=n.alternate;return t===null?(t=Gs(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function rw(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")XS(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case uh:return su(t.children,i,s,e);case hS:o=8,i|=8;break;case hF:return n=Gs(12,t,e,i|2),n.elementType=hF,n.lanes=s,n;case fF:return n=Gs(13,t,e,i),n.elementType=fF,n.lanes=s,n;case pF:return n=Gs(19,t,e,i),n.elementType=pF,n.lanes=s,n;case lO:return GC(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case oO:o=10;break e;case aO:o=9;break e;case fS:o=11;break e;case pS:o=14;break e;case vA:o=16,r=null;break e}throw Error(Ne(130,n==null?n:typeof n,""))}return e=Gs(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function su(n,e,t,r){return n=Gs(7,n,r,e),n.lanes=t,n}function GC(n,e,t,r){return n=Gs(22,n,r,e),n.elementType=lO,n.lanes=t,n.stateNode={isHidden:!1},n}function Vx(n,e,t){return n=Gs(6,n,null,e),n.lanes=t,n}function Px(n,e,t){return e=Gs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function pK(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=wx(0),this.expirationTimes=wx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wx(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function jS(n,e,t,r,i,s,o,a,l){return n=new pK(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Gs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},MS(s),n}function gK(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rG)}catch(n){console.error(n)}}rG(),tO.exports=ys;var BK=tO.exports,SM=BK;uF.createRoot=SM.createRoot,uF.hydrateRoot=SM.hydrateRoot;const CK="/CharacterStudio/assets/cc_bgm_balanced-f542698c.wav",Bs=Be.createContext(),bK=({children:n})=>{const[e,t]=Be.useState(!1),r=X.useRef(null),i=()=>{t(!1);const o=r.current;o.src=CK,o.loop=!0,o.volume=0,o.play();let a=0;const l=5,A=setInterval(()=>{a=Math.max(a+1/(10*l*60),1),a>=1&&clearInterval(A),o.volume=a},1e3/60)},s=()=>{t(!0),r.current.pause()};return L.jsxs(Bs.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[L.jsx("audio",{ref:r}),n]})},xK=Be.createContext(),IK=n=>{const[e,t]=Be.useState(null),[r,i]=Be.useState(null),[s,o]=Be.useState(!1),[a,l]=Be.useState([]);return L.jsx(xK.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function cl(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function iG(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! +`+s.stack}return{value:n,source:e,stack:i,digest:null}}function Dx(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function ZF(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var jj=typeof WeakMap=="function"?WeakMap:Map;function UW(n,e,t){t=Fl(-1,t),t.tag=3,t.payload={element:null};var r=e.value;return t.callback=function(){oB||(oB=!0,eE=r),ZF(n,e)},t}function QW(n,e,t){t=Fl(-1,t),t.tag=3;var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;t.payload=function(){return r(i)},t.callback=function(){ZF(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){ZF(n,e),typeof r!="function"&&(ZA===null?ZA=new Set([this]):ZA.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function uM(n,e,t){var r=n.pingCache;if(r===null){r=n.pingCache=new jj;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(t)||(i.add(t),n=cK.bind(null,n,e,t),e.then(n,n))}function dM(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function hM(n,e,t,r,i){return n.mode&1?(n.flags|=65536,n.lanes=i,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Fl(-1,1),e.tag=2,GA(t,e,1))),t.lanes|=1),n)}var Kj=Hl.ReactCurrentOwner,Qi=!1;function Ai(n,e,t,r){e.child=n===null?AW(e,null,t,r):Af(e,n.child,t,r)}function fM(n,e,t,r,i){t=t.render;var s=e.ref;return Vh(e,i),r=LS(n,e,t,r,s,i),t=VS(),n!==null&&!Qi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,Dl(n,e,i)):(bn&&t&&FS(e),e.flags|=1,Ai(n,e,r,i),e.child)}function pM(n,e,t,r,i){if(n===null){var s=t.type;return typeof s=="function"&&!XS(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,RW(n,e,s,r,i)):(n=rw(t.type,null,r,e,e.mode,i),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&i)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:dm,t(o,r)&&n.ref===e.ref)return Dl(n,e,i)}return e.flags|=1,n=HA(s,r),n.ref=e.ref,n.return=e,e.child=n}function RW(n,e,t,r,i){if(n!==null){var s=n.memoizedProps;if(dm(s,r)&&n.ref===e.ref)if(Qi=!1,e.pendingProps=r=s,(n.lanes&i)!==0)n.flags&131072&&(Qi=!0);else return e.lanes=n.lanes,Dl(n,e,i)}return JF(n,e,t,r,i)}function MW(n,e,t){var r=e.pendingProps,i=r.children,s=n!==null?n.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},hn(Bh,$i),$i|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,hn(Bh,$i),$i|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,hn(Bh,$i),$i|=r}else s!==null?(r=s.baseLanes|t,e.memoizedState=null):r=t,hn(Bh,$i),$i|=r;return Ai(n,e,i,t),e.child}function TW(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function JF(n,e,t,r,i){var s=Ti(t)?pu:ni.current;return s=af(e,s),Vh(e,i),t=LS(n,e,t,r,s,i),r=VS(),n!==null&&!Qi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,Dl(n,e,i)):(bn&&r&&FS(e),e.flags|=1,Ai(n,e,t,i),e.child)}function gM(n,e,t,r,i){if(Ti(t)){var s=!0;jw(e)}else s=!1;if(Vh(e,i),e.stateNode===null)ew(n,e),aW(e,t,r),GF(e,t,r,i),r=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,A=t.contextType;typeof A=="object"&&A!==null?A=to(A):(A=Ti(t)?pu:ni.current,A=af(e,A));var c=t.getDerivedStateFromProps,u=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==A)&&aM(e,o,r,A),yA=!1;var h=e.memoizedState;o.state=h,tB(e,r,o,i),l=e.memoizedState,a!==r||h!==l||Mi.current||yA?(typeof c=="function"&&(WF(e,t,c,r),l=e.memoizedState),(a=yA||oM(e,t,a,r,h,l,A))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=A,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,sW(n,e),a=e.memoizedProps,A=e.type===e.elementType?a:Fo(e.type,a),o.props=A,u=e.pendingProps,h=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=to(l):(l=Ti(t)?pu:ni.current,l=af(e,l));var d=t.getDerivedStateFromProps;(c=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||h!==l)&&aM(e,o,r,l),yA=!1,h=e.memoizedState,o.state=h,tB(e,r,o,i);var p=e.memoizedState;a!==u||h!==p||Mi.current||yA?(typeof d=="function"&&(WF(e,t,d,r),p=e.memoizedState),(A=yA||oM(e,t,A,r,h,p,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=l,r=A):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),r=!1)}return HF(n,e,t,r,s,i)}function HF(n,e,t,r,i,s){TW(n,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&tM(e,t,!1),Dl(n,e,s);r=e.stateNode,Kj.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,n!==null&&o?(e.child=Af(e,n.child,null,s),e.child=Af(e,null,a,s)):Ai(n,e,a,s),e.memoizedState=r.state,i&&tM(e,t,!0),e.child}function NW(n){var e=n.stateNode;e.pendingContext?eM(n,e.pendingContext,e.pendingContext!==e.context):e.context&&eM(n,e.context,!1),TS(n,e.containerInfo)}function mM(n,e,t,r,i){return lf(),_S(i),e.flags|=256,Ai(n,e,t,r),e.child}var zF={dehydrated:null,treeContext:null,retryLane:0};function YF(n){return{baseLanes:n,cachePool:null,transitions:null}}function kW(n,e,t){var r=e.pendingProps,i=_n.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(i|=1),hn(_n,i&1),n===null)return PF(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,n=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=GC(o,r,0,null),n=su(n,r,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=YF(t),e.memoizedState=zF,n):WS(e,o));if(i=n.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return $j(n,e,o,r,a,i,t);if(s){s=r.fallback,o=e.mode,i=n.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=HA(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=HA(a,s):(s=su(s,o,t,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=n.child.memoizedState,o=o===null?YF(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=zF,r}return s=n.child,n=s.sibling,r=HA(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=t),r.return=e,r.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=r,e.memoizedState=null,r}function WS(n,e){return e=GC({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function sv(n,e,t,r){return r!==null&&_S(r),Af(e,n.child,null,t),n=WS(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function $j(n,e,t,r,i,s,o){if(t)return e.flags&256?(e.flags&=-257,r=Dx(Error(Ne(422))),sv(n,e,o,r)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=GC({mode:"visible",children:r.children},i,0,null),s=su(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&Af(e,n.child,null,o),e.child.memoizedState=YF(o),e.memoizedState=zF,s);if(!(e.mode&1))return sv(n,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(Ne(419)),r=Dx(s,r,void 0),sv(n,e,o,r)}if(a=(o&n.childLanes)!==0,Qi||a){if(r=Er,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,kl(n,i),Mo(r,n,i,-1))}return YS(),r=Dx(Error(Ne(421))),sv(n,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=n.child,e=uK.bind(null,n),i._reactRetry=e,null):(n=s.treeContext,os=WA(i.nextSibling),As=e,bn=!0,So=null,n!==null&&(Ls[Vs++]=wl,Ls[Vs++]=Bl,Ls[Vs++]=gu,wl=n.id,Bl=n.overflow,gu=e),e=WS(e,r.children),e.flags|=4096,e)}function vM(n,e,t){n.lanes|=e;var r=n.alternate;r!==null&&(r.lanes|=e),OF(n.return,e,t)}function Lx(n,e,t,r,i){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=t,s.tailMode=i)}function DW(n,e,t){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Ai(n,e,r.children,t),r=_n.current,r&2)r=r&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&vM(n,t,e);else if(n.tag===19)vM(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}r&=1}if(hn(_n,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(t=e.child,i=null;t!==null;)n=t.alternate,n!==null&&nB(n)===null&&(i=t),t=t.sibling;t=i,t===null?(i=e.child,e.child=null):(i=t.sibling,t.sibling=null),Lx(e,!1,i,t,s);break;case"backwards":for(t=null,i=e.child,e.child=null;i!==null;){if(n=i.alternate,n!==null&&nB(n)===null){e.child=i;break}n=i.sibling,i.sibling=t,t=i,i=n}Lx(e,!0,t,null,s);break;case"together":Lx(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ew(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function Dl(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),vu|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(Ne(153));if(e.child!==null){for(n=e.child,t=HA(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=HA(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function qj(n,e,t){switch(e.tag){case 3:NW(e),lf();break;case 5:cW(e);break;case 1:Ti(e.type)&&jw(e);break;case 4:TS(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;hn(qw,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(hn(_n,_n.current&1),e.flags|=128,null):t&e.child.childLanes?kW(n,e,t):(hn(_n,_n.current&1),n=Dl(n,e,t),n!==null?n.sibling:null);hn(_n,_n.current&1);break;case 19:if(r=(t&e.childLanes)!==0,n.flags&128){if(r)return DW(n,e,t);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),hn(_n,_n.current),r)break;return null;case 22:case 23:return e.lanes=0,MW(n,e,t)}return Dl(n,e,t)}var LW,XF,VW,PW;LW=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};XF=function(){};VW=function(n,e,t,r){var i=n.memoizedProps;if(i!==r){n=e.stateNode,Xc(Ca.current);var s=null;switch(t){case"input":i=mF(n,i),r=mF(n,r),s=[];break;case"select":i=Rn({},i,{value:void 0}),r=Rn({},r,{value:void 0}),s=[];break;case"textarea":i=wF(n,i),r=wF(n,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(n.onclick=Yw)}CF(t,r);var o;t=null;for(A in i)if(!r.hasOwnProperty(A)&&i.hasOwnProperty(A)&&i[A]!=null)if(A==="style"){var a=i[A];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else A!=="dangerouslySetInnerHTML"&&A!=="children"&&A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&A!=="autoFocus"&&(sm.hasOwnProperty(A)?s||(s=[]):(s=s||[]).push(A,null));for(A in r){var l=r[A];if(a=i!=null?i[A]:void 0,r.hasOwnProperty(A)&&l!==a&&(l!=null||a!=null))if(A==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(A,t)),t=l;else A==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(A,l)):A==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(A,""+l):A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&(sm.hasOwnProperty(A)?(l!=null&&A==="onScroll"&&fn("scroll",n),s||a===l||(s=[])):(s=s||[]).push(A,l))}t&&(s=s||[]).push("style",t);var A=s;(e.updateQueue=A)&&(e.flags|=4)}};PW=function(n,e,t,r){t!==r&&(e.flags|=4)};function xp(n,e){if(!bn)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:r.sibling=null}}function Jr(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,r=0;if(e)for(var i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=n,i=i.sibling;else for(i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=n,i=i.sibling;return n.subtreeFlags|=r,n.childLanes=t,e}function eK(n,e,t){var r=e.pendingProps;switch(ES(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jr(e),null;case 1:return Ti(e.type)&&Xw(),Jr(e),null;case 3:return r=e.stateNode,cf(),vn(Mi),vn(ni),kS(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(rv(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,So!==null&&(rE(So),So=null))),XF(n,e),Jr(e),null;case 5:NS(e);var i=Xc(mm.current);if(t=e.type,n!==null&&e.stateNode!=null)VW(n,e,t,r,i),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Ne(166));return Jr(e),null}if(n=Xc(Ca.current),rv(e)){r=e.stateNode,t=e.type;var s=e.memoizedProps;switch(r[la]=e,r[pm]=s,n=(e.mode&1)!==0,t){case"dialog":fn("cancel",r),fn("close",r);break;case"iframe":case"object":case"embed":fn("load",r);break;case"video":case"audio":for(i=0;i<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[la]=e,n[pm]=r,LW(n,e,!1,!1),e.stateNode=n;e:{switch(o=bF(t,r),t){case"dialog":fn("cancel",n),fn("close",n),i=r;break;case"iframe":case"object":case"embed":fn("load",n),i=r;break;case"video":case"audio":for(i=0;idf&&(e.flags|=128,r=!0,xp(s,!1),e.lanes=4194304)}else{if(!r)if(n=nB(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),xp(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!bn)return Jr(e),null}else 2*Yn()-s.renderingStartTime>df&&t!==1073741824&&(e.flags|=128,r=!0,xp(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Yn(),e.sibling=null,t=_n.current,hn(_n,r?t&1|2:t&1),e):(Jr(e),null);case 22:case 23:return zS(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?$i&1073741824&&(Jr(e),e.subtreeFlags&6&&(e.flags|=8192)):Jr(e),null;case 24:return null;case 25:return null}throw Error(Ne(156,e.tag))}function tK(n,e){switch(ES(e),e.tag){case 1:return Ti(e.type)&&Xw(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return cf(),vn(Mi),vn(ni),kS(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return NS(e),null;case 13:if(vn(_n),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Ne(340));lf()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return vn(_n),null;case 4:return cf(),null;case 10:return QS(e.type._context),null;case 22:case 23:return zS(),null;case 24:return null;default:return null}}var ov=!1,jr=!1,nK=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function wh(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Dn(n,e,r)}else t.current=null}function jF(n,e,t){try{t()}catch(r){Dn(n,e,r)}}var yM=!1;function rK(n,e){if(MF=Jw,n=ZO(),IS(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,A=0,c=0,u=n,h=null;t:for(;;){for(var d;u!==t||i!==0&&u.nodeType!==3||(a=o+i),u!==s||r!==0&&u.nodeType!==3||(l=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(d=u.firstChild)!==null;)h=u,u=d;for(;;){if(u===n)break t;if(h===t&&++A===i&&(a=o),h===s&&++c===r&&(l=o),(d=u.nextSibling)!==null)break;u=h,h=u.parentNode}u=d}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(TF={focusedElem:n,selectionRange:t},Jw=!1,Xe=e;Xe!==null;)if(e=Xe,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Xe=n;else for(;Xe!==null;){e=Xe;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var f=p.memoizedProps,g=p.memoizedState,m=e.stateNode,v=m.getSnapshotBeforeUpdate(e.elementType===e.type?f:Fo(e.type,f),g);m.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ne(163))}}catch(B){Dn(e,e.return,B)}if(n=e.sibling,n!==null){n.return=e.return,Xe=n;break}Xe=e.return}return p=yM,yM=!1,p}function Vg(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&jF(e,t,s)}i=i.next}while(i!==r)}}function OC(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function KF(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function OW(n){var e=n.alternate;e!==null&&(n.alternate=null,OW(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[la],delete e[pm],delete e[DF],delete e[Vj],delete e[Pj])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function WW(n){return n.tag===5||n.tag===3||n.tag===4}function wM(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||WW(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function $F(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Yw));else if(r!==4&&(n=n.child,n!==null))for($F(n,e,t),n=n.sibling;n!==null;)$F(n,e,t),n=n.sibling}function qF(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(qF(n,e,t),n=n.sibling;n!==null;)qF(n,e,t),n=n.sibling}var Mr=null,Eo=!1;function eA(n,e,t){for(t=t.child;t!==null;)GW(n,e,t),t=t.sibling}function GW(n,e,t){if(Ba&&typeof Ba.onCommitFiberUnmount=="function")try{Ba.onCommitFiberUnmount(MC,t)}catch{}switch(t.tag){case 5:jr||wh(t,e);case 6:var r=Mr,i=Eo;Mr=null,eA(n,e,t),Mr=r,Eo=i,Mr!==null&&(Eo?(n=Mr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Mr.removeChild(t.stateNode));break;case 18:Mr!==null&&(Eo?(n=Mr,t=t.stateNode,n.nodeType===8?Qx(n.parentNode,t):n.nodeType===1&&Qx(n,t),cm(n)):Qx(Mr,t.stateNode));break;case 4:r=Mr,i=Eo,Mr=t.stateNode.containerInfo,Eo=!0,eA(n,e,t),Mr=r,Eo=i;break;case 0:case 11:case 14:case 15:if(!jr&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&jF(t,e,o),i=i.next}while(i!==r)}eA(n,e,t);break;case 1:if(!jr&&(wh(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Dn(t,e,a)}eA(n,e,t);break;case 21:eA(n,e,t);break;case 22:t.mode&1?(jr=(r=jr)||t.memoizedState!==null,eA(n,e,t),jr=r):eA(n,e,t);break;default:eA(n,e,t)}}function BM(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new nK),e.forEach(function(r){var i=dK.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function po(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Yn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sK(r/1960))-r,10n?16:n,SA===null)var r=!1;else{if(n=SA,SA=null,aB=0,Gt&6)throw Error(Ne(331));var i=Gt;for(Gt|=4,Xe=n.current;Xe!==null;){var s=Xe,o=s.child;if(Xe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lYn()-JS?iu(n,0):ZS|=t),Ni(n,e)}function KW(n,e){e===0&&(n.mode&1?(e=K0,K0<<=1,!(K0&130023424)&&(K0=4194304)):e=1);var t=vi();n=kl(n,e),n!==null&&(o0(n,e,t),Ni(n,t))}function uK(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),KW(n,t)}function dK(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(Ne(314))}r!==null&&r.delete(e),KW(n,t)}var $W;$W=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Mi.current)Qi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Qi=!1,qj(n,e,t);Qi=!!(n.flags&131072)}else Qi=!1,bn&&e.flags&1048576&&tW(e,$w,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ew(n,e),n=e.pendingProps;var i=af(e,ni.current);Vh(e,t),i=LS(null,e,r,n,i,t);var s=VS();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ti(r)?(s=!0,jw(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,MS(e),i.updater=VC,e.stateNode=i,i._reactInternals=e,GF(e,r,n,t),e=HF(null,e,r,!0,s,t)):(e.tag=0,bn&&s&&FS(e),Ai(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(ew(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=fK(r),n=Fo(r,n),i){case 0:e=JF(null,e,r,n,t);break e;case 1:e=gM(null,e,r,n,t);break e;case 11:e=fM(null,e,r,n,t);break e;case 14:e=pM(null,e,r,Fo(r.type,n),t);break e}throw Error(Ne(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fo(r,i),JF(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fo(r,i),gM(n,e,r,i,t);case 3:e:{if(NW(e),n===null)throw Error(Ne(387));r=e.pendingProps,s=e.memoizedState,i=s.element,sW(n,e),tB(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=uf(Error(Ne(423)),e),e=mM(n,e,r,t,i);break e}else if(r!==i){i=uf(Error(Ne(424)),e),e=mM(n,e,r,t,i);break e}else for(os=WA(e.stateNode.containerInfo.firstChild),As=e,bn=!0,So=null,t=AW(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(lf(),r===i){e=Dl(n,e,t);break e}Ai(n,e,r,t)}e=e.child}return e;case 5:return cW(e),n===null&&PF(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,NF(r,i)?o=null:s!==null&&NF(r,s)&&(e.flags|=32),TW(n,e),Ai(n,e,o,t),e.child;case 6:return n===null&&PF(e),null;case 13:return kW(n,e,t);case 4:return TS(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=Af(e,null,r,t):Ai(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fo(r,i),fM(n,e,r,i,t);case 7:return Ai(n,e,e.pendingProps,t),e.child;case 8:return Ai(n,e,e.pendingProps.children,t),e.child;case 12:return Ai(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,hn(qw,r._currentValue),r._currentValue=o,s!==null)if(Do(s.value,o)){if(s.children===i.children&&!Mi.current){e=Dl(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Fl(-1,t&-t),l.tag=2;var A=s.updateQueue;if(A!==null){A=A.shared;var c=A.pending;c===null?l.next=l:(l.next=c.next,c.next=l),A.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),OF(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Ne(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),OF(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ai(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Vh(e,t),i=to(i),r=r(i),e.flags|=1,Ai(n,e,r,t),e.child;case 14:return r=e.type,i=Fo(r,e.pendingProps),i=Fo(r.type,i),pM(n,e,r,i,t);case 15:return RW(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fo(r,i),ew(n,e),e.tag=1,Ti(r)?(n=!0,jw(e)):n=!1,Vh(e,t),aW(e,r,i),GF(e,r,i,t),HF(null,e,r,!0,n,t);case 19:return DW(n,e,t);case 22:return MW(n,e,t)}throw Error(Ne(156,e.tag))};function qW(n,e){return IO(n,e)}function hK(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gs(n,e,t,r){return new hK(n,e,t,r)}function XS(n){return n=n.prototype,!(!n||!n.isReactComponent)}function fK(n){if(typeof n=="function")return XS(n)?1:0;if(n!=null){if(n=n.$$typeof,n===fS)return 11;if(n===pS)return 14}return 2}function HA(n,e){var t=n.alternate;return t===null?(t=Gs(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function rw(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")XS(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case uh:return su(t.children,i,s,e);case hS:o=8,i|=8;break;case hF:return n=Gs(12,t,e,i|2),n.elementType=hF,n.lanes=s,n;case fF:return n=Gs(13,t,e,i),n.elementType=fF,n.lanes=s,n;case pF:return n=Gs(19,t,e,i),n.elementType=pF,n.lanes=s,n;case lO:return GC(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case oO:o=10;break e;case aO:o=9;break e;case fS:o=11;break e;case pS:o=14;break e;case vA:o=16,r=null;break e}throw Error(Ne(130,n==null?n:typeof n,""))}return e=Gs(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function su(n,e,t,r){return n=Gs(7,n,r,e),n.lanes=t,n}function GC(n,e,t,r){return n=Gs(22,n,r,e),n.elementType=lO,n.lanes=t,n.stateNode={isHidden:!1},n}function Vx(n,e,t){return n=Gs(6,n,null,e),n.lanes=t,n}function Px(n,e,t){return e=Gs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function pK(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=wx(0),this.expirationTimes=wx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wx(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function jS(n,e,t,r,i,s,o,a,l){return n=new pK(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Gs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},MS(s),n}function gK(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rG)}catch(n){console.error(n)}}rG(),tO.exports=ys;var BK=tO.exports,SM=BK;uF.createRoot=SM.createRoot,uF.hydrateRoot=SM.hydrateRoot;const CK="/CharacterStudio/assets/cc_bgm_balanced-f542698c.wav",Bs=Be.createContext(),bK=({children:n})=>{const[e,t]=Be.useState(!1),r=X.useRef(null),i=()=>{t(!1);const o=r.current;o.src=CK,o.loop=!0,o.volume=0,o.play();let a=0;const l=5,A=setInterval(()=>{a=Math.max(a+1/(10*l*60),1),a>=1&&clearInterval(A),o.volume=a},1e3/60)},s=()=>{t(!0),r.current.pause()};return V.jsxs(Bs.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[V.jsx("audio",{ref:r}),n]})},xK=Be.createContext(),IK=n=>{const[e,t]=Be.useState(null),[r,i]=Be.useState(null),[s,o]=Be.useState(!1),[a,l]=Be.useState([]);return V.jsx(xK.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function cl(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function iG(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! * GSAP 3.11.4 * https://greensock.com * @@ -52,7 +52,7 @@ Error generating stack: `+s.message+` * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com -*/var cs={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},hf={duration:.5,overwrite:!1,delay:0},eU,ei,tr,Zs=1e8,An=1/Zs,iE=Math.PI*2,FK=iE/4,EK=0,sG=Math.sqrt,_K=Math.cos,SK=Math.sin,_r=function(e){return typeof e=="string"},Vn=function(e){return typeof e=="function"},Ll=function(e){return typeof e=="number"},tU=function(e){return typeof e>"u"},Ua=function(e){return typeof e=="object"},ki=function(e){return e!==!1},oG=function(){return typeof window<"u"},Av=function(e){return Vn(e)||_r(e)},aG=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ti=Array.isArray,sE=/(?:-?\.?\d|\.)+/gi,lG=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ch=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Ox=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,AG=/[+-]=-?[.\d]+/,cG=/[^,'"\[\]\s]+/gi,UK=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Sn,Ts,oE,nU,hs={},cB={},uG,dG=function(e){return(cB=wu(e,hs))&&fs},rU=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},uB=function(e,t){return!t&&console.warn(e)},hG=function(e,t){return e&&(hs[e]=t)&&cB&&(cB[e]=t)||hs},Cm=function(){return 0},QK={suppressEvents:!0,isStart:!0,kill:!1},iw={suppressEvents:!0,kill:!1},RK={suppressEvents:!0},iU={},zA=[],aE={},fG,ts={},Wx={},UM=30,sw=[],sU="",oU=function(e){var t=e[0],r,i;if(Ua(t)||Vn(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=sw.length;i--&&!sw[i].targetTest(t););r=sw[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new kG(e[i],r)))||e.splice(i,1);return e},ou=function(e){return e._gsap||oU(Js(e))[0]._gsap},pG=function(e,t,r){return(r=e[t])&&Vn(r)?e[t]():tU(r)&&e.getAttribute&&e.getAttribute(t)||r},Di=function(e,t){return(e=e.split(",")).forEach(t)||e},zn=function(e){return Math.round(e*1e5)/1e5||0},Tr=function(e){return Math.round(e*1e7)/1e7||0},Oh=function(e,t){var r=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),r==="+"?e+i:r==="-"?e-i:r==="*"?e*i:e/i},MK=function(e,t){for(var r=t.length,i=0;e.indexOf(t[i])<0&&++ia;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[r],e[r]=t),t._next?t._next._prev=t:e[i]=t,t._prev=o,t.parent=t._dp=e,t},YC=function(e,t,r,i){r===void 0&&(r="_first"),i===void 0&&(i="_last");var s=t._prev,o=t._next;s?s._next=o:e[r]===t&&(e[r]=o),o?o._prev=s:e[i]===t&&(e[i]=s),t._next=t._prev=t.parent=null},ic=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove(e),e._act=0},au=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},kK=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},lE=function(e,t,r,i){return e._startAt&&(ei?e._startAt.revert(iw):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},DK=function n(e){return!e||e._ts&&n(e.parent)},RM=function(e){return e._repeat?ff(e._tTime,e=e.duration()+e._rDelay)*e:0},ff=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},fB=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},XC=function(e){return e._end=Tr(e._start+(e._tDur/Math.abs(e._ts||e._rts||An)||0))},jC=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=Tr(r._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),XC(e),r._dirty||au(r,e)),e},wG=function(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=fB(e.rawTime(),t),(!t._dur||c0(0,t.totalDuration(),r)-t._tTime>An)&&t.render(r,!0)),au(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-An}},Aa=function(e,t,r,i){return t.parent&&ic(t),t._start=Tr((Ll(r)?r:r||e!==Sn?Ms(e,r,t):e._time)+t._delay),t._end=Tr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),yG(e,t,"_first","_last",e._sort?"_start":0),AE(t)||(e._recent=t),i||wG(e,t),e._ts<0&&jC(e,e._tTime),e},BG=function(e,t){return(hs.ScrollTrigger||rU("scrollTrigger",t))&&hs.ScrollTrigger.create(t,e)},CG=function(e,t,r,i,s){if(lU(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!ei&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&fG!==ns.frame)return zA.push(e),e._lazy=[s,i],1},LK=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},AE=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},VK=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&LK(e)&&!(!e._initted&&AE(e))||(e._ts<0||e._dp._ts<0)&&!AE(e))?0:1,a=e._rDelay,l=0,A,c,u;if(a&&e._repeat&&(l=c0(0,e._tDur,t),c=ff(l,a),e._yoyo&&c&1&&(o=1-o),c!==ff(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||ei||i||e._zTime===An||!t&&e._zTime){if(!e._initted&&CG(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?An:0),r||(r=t&&!u),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,A=e._pt;A;)A.r(o,A.d),A=A._next;t<0&&lE(e,t,r,!0),e._onUpdate&&!r&&Hs(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Hs(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&ic(e,1),!r&&!ei&&(Hs(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},PK=function(e,t,r){var i;if(r>t)for(i=e._first;i&&i._start<=r;){if(i.data==="isPause"&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=r;){if(i.data==="isPause"&&i._start0&&!i&&jC(e,e._tTime=e._tDur*a),e.parent&&XC(e),r||au(e.parent,e),e},MM=function(e){return e instanceof Ui?au(e):pf(e,e._dur)},OK={_start:0,endTime:Cm,totalDuration:Cm},Ms=function n(e,t,r){var i=e.labels,s=e._recent||OK,o=e.duration()>=Zs?s.endTime(!1):e._dur,a,l,A;return _r(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),A=t.substr(-1)==="%",a=t.indexOf("="),l==="<"||l===">"?(a>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(A?(a<0?s:r).totalDuration()/100:1)):a<0?(t in i||(i[t]=o),i[t]):(l=parseFloat(t.charAt(a-1)+t.substr(a+1)),A&&r&&(l=l/100*(ti(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},Gg=function(e,t,r){var i=Ll(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s],a,l;if(i&&(o.duration=t[1]),o.parent=r,e){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=ki(l.vars.inherit)&&l.parent;o.immediateRender=ki(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new fr(t[0],o,t[s+1])},vc=function(e,t){return e||e===0?t(e):t},c0=function(e,t,r){return rt?t:r},Kr=function(e,t){return!_r(e)||!(t=UK.exec(e))?"":t[1]},WK=function(e,t,r){return vc(r,function(i){return c0(e,t,i)})},cE=[].slice,bG=function(e,t){return e&&Ua(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Ua(e[0]))&&!e.nodeType&&e!==Ts},GK=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return _r(i)&&!t||bG(i,1)?(s=r).push.apply(s,Js(i)):r.push(i)})||r},Js=function(e,t,r){return tr&&!t&&tr.selector?tr.selector(e):_r(e)&&!r&&(oE||!gf())?cE.call((t||nU).querySelectorAll(e),0):ti(e)?GK(e,r):bG(e)?cE.call(e,0):e?[e]:[]},uE=function(e){return e=Js(e)[0]||uB("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Js(t,r.querySelectorAll?r:r===e?uB("Invalid scope")||nU.createElement("div"):e)}},xG=function(e){return e.sort(function(){return .5-Math.random()})},IG=function(e){if(Vn(e))return e;var t=Ua(e)?e:{each:e},r=lu(t.ease),i=t.from||0,s=parseFloat(t.base)||0,o={},a=i>0&&i<1,l=isNaN(i)||a,A=t.axis,c=i,u=i;return _r(i)?c=u={center:.5,edges:.5,end:1}[i]||0:!a&&l&&(c=i[0],u=i[1]),function(h,d,p){var f=(p||t).length,g=o[f],m,v,w,B,C,b,F,x,_;if(!g){if(_=t.grid==="auto"?0:(t.grid||[1,Zs])[1],!_){for(F=-Zs;F<(F=p[_++].getBoundingClientRect().left)&&_F&&(F=C),Cf?f-1:A?A==="y"?f/_:_:Math.max(_,f/_))||0)*(i==="edges"?-1:1),g.b=f<0?s-f:s,g.u=Kr(t.amount||t.each)||0,r=r&&f<0?MG(r):r}return f=(g[h]-g.min)/g.max||0,Tr(g.b+(r?r(f):f)*g.v)+g.u}},dE=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var i=Tr(Math.round(parseFloat(r)/e)*e*t);return(i-i%1)/t+(Ll(r)?0:Kr(r))}},FG=function(e,t){var r=ti(e),i,s;return!r&&Ua(e)&&(i=r=e.radius||Zs,e.values?(e=Js(e.values),(s=!Ll(e[0]))&&(i*=i)):e=dE(e.increment)),vc(t,r?Vn(e)?function(o){return s=e(o),Math.abs(s-o)<=i?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),A=Zs,c=0,u=e.length,h,d;u--;)s?(h=e[u].x-a,d=e[u].y-l,h=h*h+d*d):h=Math.abs(e[u]-a),hi?s-o:o)})},bm=function(e){for(var t=0,r="",i,s,o,a;~(i=e.indexOf("random(",t));)o=e.indexOf(")",i),a=e.charAt(i+7)==="[",s=e.substr(i+7,o-i-7).match(a?cG:sE),r+=e.substr(t,i-t)+EG(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},SG=function(e,t,r,i,s){var o=t-e,a=i-r;return vc(s,function(l){return r+((l-e)/o*a||0)})},XK=function n(e,t,r,i){var s=isNaN(e+t)?0:function(d){return(1-d)*e+d*t};if(!s){var o=_r(e),a={},l,A,c,u,h;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(ti(e)&&!ti(t)){for(c=[],u=e.length,h=u-2,A=1;A(a=Math.abs(a))&&(l=o,s=a);return l},Hs=function(e,t,r){var i=e.vars,s=i[t],o=tr,a=e._ctx,l,A,c;if(s)return l=i[t+"Params"],A=i.callbackScope||e,r&&zA.length&&dB(),a&&(tr=a),c=l?s.apply(A,l):s.call(A),tr=o,c},dg=function(e){return ic(e),e.scrollTrigger&&e.scrollTrigger.kill(!!ei),e.progress()<1&&Hs(e,"onInterrupt"),e},bh,jK=function(e){e=!e.name&&e.default||e;var t=e.name,r=Vn(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Cm,render:uU,add:aU,kill:d7,modifier:u7,rawVars:0},o={targetTest:0,get:0,getSetter:cU,aliases:{},register:0};if(gf(),e!==i){if(ts[t])return;ro(i,ro(hB(e,s),o)),wu(i.prototype,wu(s,hB(e,o))),ts[i.prop=t]=i,e.targetTest&&(sw.push(i),iU[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}hG(t,i),e.register&&e.register(fs,i,Li)},an=255,hg={aqua:[0,an,an],lime:[0,an,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,an],navy:[0,0,128],white:[an,an,an],olive:[128,128,0],yellow:[an,an,0],orange:[an,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[an,0,0],pink:[an,192,203],cyan:[0,an,an],transparent:[an,an,an,0]},Gx=function(e,t,r){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(r-t)*e*6:e<.5?r:e*3<2?t+(r-t)*(2/3-e)*6:t)*an+.5|0},UG=function(e,t,r){var i=e?Ll(e)?[e>>16,e>>8&an,e&an]:0:hg.black,s,o,a,l,A,c,u,h,d,p;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),hg[e])i=hg[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),o=e.charAt(2),a=e.charAt(3),e="#"+s+s+o+o+a+a+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return i=parseInt(e.substr(1,6),16),[i>>16,i>>8&an,i&an,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&an,e&an]}else if(e.substr(0,3)==="hsl"){if(i=p=e.match(sE),!t)l=+i[0]%360/360,A=+i[1]/100,c=+i[2]/100,o=c<=.5?c*(A+1):c+A-c*A,s=c*2-o,i.length>3&&(i[3]*=1),i[0]=Gx(l+1/3,s,o),i[1]=Gx(l,s,o),i[2]=Gx(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(lG),r&&i.length<4&&(i[3]=1),i}else i=e.match(sE)||hg.transparent;i=i.map(Number)}return t&&!p&&(s=i[0]/an,o=i[1]/an,a=i[2]/an,u=Math.max(s,o,a),h=Math.min(s,o,a),c=(u+h)/2,u===h?l=A=0:(d=u-h,A=c>.5?d/(2-u-h):d/(u+h),l=u===s?(o-a)/d+(oe&&(r+=m-t),i+=m,C=i-r,w=C-o,(w>0||v)&&(b=++u.frame,h=C-u.time*1e3,u.time=C=C/1e3,o+=w+(w>=s?4:s-w),B=1),v||(l=A(f)),B)for(d=0;d=m&&d--},_listeners:a},u}(),gf=function(){return!xm&&ns.wake()},Vt={},$K=/^[\d.\-M][\d.\-,\s]/,qK=/["']/g,e7=function(e){for(var t={},r=e.substr(1,e.length-3).split(":"),i=r[0],s=1,o=r.length,a,l,A;s1&&r.config?r.config.apply(null,~e.indexOf("{")?[e7(t[1])]:t7(e).split(",").map(mG)):Vt._CE&&$K.test(e)?Vt._CE("",e):r},MG=function(e){return function(t){return 1-e(1-t)}},TG=function n(e,t){for(var r=e._first,i;r;)r instanceof Ui?n(r,t):r.vars.yoyoEase&&(!r._yoyo||!r._repeat)&&r._yoyo!==t&&(r.timeline?n(r.timeline,t):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=t)),r=r._next},lu=function(e,t){return e&&(Vn(e)?e:Vt[e]||n7(e))||t},Mu=function(e,t,r,i){r===void 0&&(r=function(l){return 1-t(1-l)}),i===void 0&&(i=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:r,easeInOut:i},o;return Di(e,function(a){Vt[a]=hs[a]=s,Vt[o=a.toLowerCase()]=r;for(var l in s)Vt[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Vt[a+"."+l]=s[l]}),s},NG=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},Zx=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/iE*(Math.asin(1/i)||0),a=function(c){return c===1?1:i*Math.pow(2,-10*c)*SK((c-o)*s)+1},l=e==="out"?a:e==="in"?function(A){return 1-a(1-A)}:NG(a);return s=iE/s,l.config=function(A,c){return n(e,A,c)},l},Jx=function n(e,t){t===void 0&&(t=1.70158);var r=function(o){return o?--o*o*((t+1)*o+t)+1:0},i=e==="out"?r:e==="in"?function(s){return 1-r(1-s)}:NG(r);return i.config=function(s){return n(e,s)},i};Di("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;Mu(n+",Power"+(t-1),e?function(r){return Math.pow(r,t)}:function(r){return r},function(r){return 1-Math.pow(1-r,t)},function(r){return r<.5?Math.pow(r*2,t)/2:1-Math.pow((1-r)*2,t)/2})});Vt.Linear.easeNone=Vt.none=Vt.Linear.easeIn;Mu("Elastic",Zx("in"),Zx("out"),Zx());(function(n,e){var t=1/e,r=2*t,i=2.5*t,s=function(a){return a0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},e.totalDuration=function(r){return arguments.length?(this._dirty=0,pf(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(gf(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(jC(this,r),!s._dp||s.parent||wG(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r0||!this._tDur&&!r)&&Aa(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===An||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),gG(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+RM(this))%(this._dur+this._rDelay)||(r?this._dur:0),i):this._time},e.totalProgress=function(r,i){return arguments.length?this.totalTime(this.totalDuration()*r,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},e.progress=function(r,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+RM(this),i):this.duration()?Math.min(1,this._time/this._dur):this.ratio},e.iteration=function(r,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,i):this._repeat?ff(this._tTime,s)+1:1},e.timeScale=function(r){if(!arguments.length)return this._rts===-An?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?fB(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-An?0:this._rts,this.totalTime(c0(-this._delay,this._tDur,i),!0),XC(this),kK(this)},e.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(gf(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==An&&(this._tTime-=An)))),this):this._ps},e.startTime=function(r){if(arguments.length){this._start=r;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Aa(i,this,r-this._delay),this}return this._start},e.endTime=function(r){return this._start+(ki(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(r){var i=this.parent||this._dp;return i?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?fB(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=RK);var i=ei;return ei=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),ei=i,this},e.globalTime=function(r){for(var i=this,s=arguments.length?r:i.rawTime();i;)s=i._start+s/(i._ts||1),i=i._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1:this._sat.globalTime(r):s},e.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,MM(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,MM(this),i?this.time(i):this}return this._rDelay},e.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},e.seek=function(r,i){return this.totalTime(Ms(this,r),ki(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,ki(i))},e.play=function(r,i){return r!=null&&this.seek(r,i),this.reversed(!1).paused(!1)},e.reverse=function(r,i){return r!=null&&this.seek(r||this.totalDuration(),i),this.reversed(!0).paused(!1)},e.pause=function(r,i){return r!=null&&this.seek(r,i),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-An:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-An,this},e.isActive=function(){var r=this.parent||this._dp,i=this._start,s;return!!(!r||this._ts&&this._initted&&r.isActive()&&(s=r.rawTime(!0))>=i&&s1?(i?(o[r]=i,s&&(o[r+"Params"]=s),r==="onUpdate"&&(this._onUpdate=i)):delete o[r],this):o[r]},e.then=function(r){var i=this;return new Promise(function(s){var o=Vn(r)?r:vG,a=function(){var A=i.then;i.then=null,Vn(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=A),s(o),i.then=A};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?a():i._prom=a})},e.kill=function(){dg(this)},n}();ro(mf.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-An,_prom:0,_ps:!1,_rts:1});var Ui=function(n){iG(e,n);function e(r,i){var s;return r===void 0&&(r={}),s=n.call(this,r)||this,s.labels={},s.smoothChildTiming=!!r.smoothChildTiming,s.autoRemoveChildren=!!r.autoRemoveChildren,s._sort=ki(r.sortChildren),Sn&&Aa(r.parent||Sn,cl(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&BG(cl(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return Gg(0,arguments,this),this},t.from=function(i,s,o){return Gg(1,arguments,this),this},t.fromTo=function(i,s,o,a){return Gg(2,arguments,this),this},t.set=function(i,s,o){return s.duration=0,s.parent=this,Wg(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new fr(i,s,Ms(this,o),1),this},t.call=function(i,s,o){return Aa(this,fr.delayedCall(0,i,s),o)},t.staggerTo=function(i,s,o,a,l,A,c){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=A,o.onCompleteParams=c,o.parent=this,new fr(i,o,Ms(this,l)),this},t.staggerFrom=function(i,s,o,a,l,A,c){return o.runBackwards=1,Wg(o).immediateRender=ki(o.immediateRender),this.staggerTo(i,s,o,a,l,A,c)},t.staggerFromTo=function(i,s,o,a,l,A,c,u){return a.startAt=o,Wg(a).immediateRender=ki(a.immediateRender),this.staggerTo(i,s,a,l,A,c,u)},t.render=function(i,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,A=this._dur,c=i<=0?0:Tr(i),u=this._zTime<0!=i<0&&(this._initted||!A),h,d,p,f,g,m,v,w,B,C,b,F;if(this!==Sn&&c>l&&i>=0&&(c=l),c!==this._tTime||o||u){if(a!==this._time&&A&&(c+=this._time-a,i+=this._time-a),h=c,B=this._start,w=this._ts,m=!w,u&&(A||(a=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(b=this._yoyo,g=A+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,s,o);if(h=Tr(c%g),c===l?(f=this._repeat,h=A):(f=~~(c/g),f&&f===c/g&&(h=A,f--),h>A&&(h=A)),C=ff(this._tTime,g),!a&&this._tTime&&C!==f&&(C=f),b&&f&1&&(h=A-h,F=1),f!==C&&!this._lock){var x=b&&C&1,_=x===(b&&f&1);if(f=a&&i>=0)for(d=this._first;d;){if(p=d._next,(d._act||h>=d._start)&&d._ts&&v!==d){if(d.parent!==this)return this.render(i,s,o);if(d.render(d._ts>0?(h-d._start)*d._ts:(d._dirty?d.totalDuration():d._tDur)+(h-d._start)*d._ts,s,o),h!==this._time||!this._ts&&!m){v=0,p&&(c+=this._zTime=-An);break}}d=p}else{d=this._last;for(var M=i<0?i:h;d;){if(p=d._prev,(d._act||M<=d._end)&&d._ts&&v!==d){if(d.parent!==this)return this.render(i,s,o);if(d.render(d._ts>0?(M-d._start)*d._ts:(d._dirty?d.totalDuration():d._tDur)+(M-d._start)*d._ts,s,o||ei&&(d._initted||d._startAt)),h!==this._time||!this._ts&&!m){v=0,p&&(c+=this._zTime=M?-An:An);break}}d=p}}if(v&&!s&&(this.pause(),v.render(h>=a?0:-An)._zTime=h>=a?1:-1,this._ts))return this._start=B,XC(this),this.render(i,s,o);this._onUpdate&&!s&&Hs(this,"onUpdate",!0),(c===l&&this._tTime>=this.totalDuration()||!c&&a)&&(B===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!A)&&(c===l&&this._ts>0||!c&&this._ts<0)&&ic(this,1),!s&&!(i<0&&!a)&&(c||a||!l)&&(Hs(this,c===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(Ll(s)||(s=Ms(this,s,i)),!(i instanceof mf)){if(ti(i))return i.forEach(function(a){return o.add(a,s)}),this;if(_r(i))return this.addLabel(i,s);if(Vn(i))i=fr.delayedCall(0,i);else return this}return this!==i?Aa(this,i,s):this},t.getChildren=function(i,s,o,a){i===void 0&&(i=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-Zs);for(var l=[],A=this._first;A;)A._start>=a&&(A instanceof fr?s&&l.push(A):(o&&l.push(A),i&&l.push.apply(l,A.getChildren(!0,s,o)))),A=A._next;return l},t.getById=function(i){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===i)return s[o]},t.remove=function(i){return _r(i)?this.removeLabel(i):Vn(i)?this.killTweensOf(i):(YC(this,i),i===this._recent&&(this._recent=this._last),au(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Tr(ns.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),n.prototype.totalTime.call(this,i,s),this._forcing=0,this):this._tTime},t.addLabel=function(i,s){return this.labels[i]=Ms(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,o){var a=fr.delayedCall(0,s||Cm,o);return a.data="isPause",this._hasPause=1,Aa(this,a,Ms(this,i))},t.removePause=function(i){var s=this._first;for(i=Ms(this,i);s;)s._start===i&&s.data==="isPause"&&ic(s),s=s._next},t.killTweensOf=function(i,s,o){for(var a=this.getTweensOf(i,o),l=a.length;l--;)UA!==a[l]&&a[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var o=[],a=Js(i),l=this._first,A=Ll(s),c;l;)l instanceof fr?MK(l._targets,a)&&(A?(!UA||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(c=l.getTweensOf(a,s)).length&&o.push.apply(o,c),l=l._next;return o},t.tweenTo=function(i,s){s=s||{};var o=this,a=Ms(o,i),l=s,A=l.startAt,c=l.onStart,u=l.onStartParams,h=l.immediateRender,d,p=fr.to(o,ro({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(A&&"time"in A?A.time:o._time))/o.timeScale())||An,onStart:function(){if(o.pause(),!d){var g=s.duration||Math.abs((a-(A&&"time"in A?A.time:o._time))/o.timeScale());p._dur!==g&&pf(p,g,0,1).render(p._time,!0,!0),d=1}c&&c.apply(p,u||[])}},s));return h?p.render(0):p},t.tweenFromTo=function(i,s,o){return this.tweenTo(s,ro({startAt:{time:Ms(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),TM(this,Ms(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),TM(this,Ms(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+An)},t.shiftChildren=function(i,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,A;a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(s)for(A in l)l[A]>=o&&(l[A]+=i);return au(this)},t.invalidate=function(i){var s=this._first;for(this._lock=0;s;)s.invalidate(i),s=s._next;return n.prototype.invalidate.call(this,i)},t.clear=function(i){i===void 0&&(i=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),au(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=Zs,A,c,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-i:i));if(o._dirty){for(u=o.parent;a;)A=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Aa(o,a,c-a._delay,1)._lock=0):l=c,c<0&&a._ts&&(s-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=A;pf(o,o===Sn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(Sn._ts&&(gG(Sn,fB(i,Sn)),fG=ns.frame),ns.frame>=UM){UM+=cs.autoSleep||120;var s=Sn._first;if((!s||!s._ts)&&cs.autoSleep&&ns._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||ns.sleep()}}},e}(mf);ro(Ui.prototype,{_lock:0,_hasPause:0,_forcing:0});var r7=function(e,t,r,i,s,o,a){var l=new Li(this._pt,e,t,0,1,WG,null,s),A=0,c=0,u,h,d,p,f,g,m,v;for(l.b=r,l.e=i,r+="",i+="",(m=~i.indexOf("random("))&&(i=bm(i)),o&&(v=[r,i],o(v,e,t),r=v[0],i=v[1]),h=r.match(Ox)||[];u=Ox.exec(i);)p=u[0],f=i.substring(A,u.index),d?d=(d+1)%5:f.substr(-5)==="rgba("&&(d=1),p!==h[c++]&&(g=parseFloat(h[c-1])||0,l._pt={_next:l._pt,p:f||c===1?f:",",s:g,c:p.charAt(1)==="="?Oh(g,p)-g:parseFloat(p)-g,m:d&&d<4?Math.round:0},A=Ox.lastIndex);return l.c=A")}),B.duration();else{b={};for(x in p)x==="ease"||x==="easeEach"||a7(x,p[x],b,p.easeEach);for(x in b)for(U=b[x].sort(function(R,N){return R.t-N.t}),O=0,C=0;Cl-An&&!c?l:iA&&(h=A)),m=this._yoyo&&p&1,m&&(B=this._yEase,h=A-h),g=ff(this._tTime,f),h===a&&!o&&this._initted)return this._tTime=u,this;p!==g&&(w&&this._yEase&&TG(w,m),this.vars.repeatRefresh&&!m&&!this._lock&&(this._lock=o=1,this.render(Tr(f*p),!0).invalidate()._lock=0))}if(!this._initted){if(CG(this,c?i:h,o,s,u))return this._tTime=0,this;if(a!==this._time)return this;if(A!==this._dur)return this.render(i,s,o)}if(this._tTime=u,this._time=h,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=v=(B||this._ease)(h/A),this._from&&(this.ratio=v=1-v),h&&!a&&!s&&(Hs(this,"onStart"),this._tTime!==u))return this;for(d=this._pt;d;)d.r(v,d.d),d=d._next;w&&w.render(i<0?i:!h&&m?-An:w._dur*w._ease(h/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(c&&lE(this,i,s,o),Hs(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!s&&this.parent&&Hs(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&lE(this,i,!0,!0),(i||!A)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&ic(this,1),!s&&!(c&&!a)&&(u||a||m)&&(Hs(this,u===l?"onComplete":"onReverseComplete",!0),this._prom&&!(u0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),n.prototype.invalidate.call(this,i)},t.resetTo=function(i,s,o,a){xm||ns.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||lU(this,l),A=this._ease(l/this._dur),s7(this,i,s,o,a,A,l)?this.resetTo(i,s,o,a):(jC(this,0),this.parent||yG(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(i,s){if(s===void 0&&(s="all"),!i&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?dg(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,UA&&UA.vars.overwrite!==!0)._first||dg(this),this.parent&&o!==this.timeline.totalDuration()&&pf(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?Js(i):a,A=this._ptLookup,c=this._pt,u,h,d,p,f,g,m;if((!s||s==="all")&&NK(a,l))return s==="all"&&(this._pt=0),dg(this);for(u=this._op=this._op||[],s!=="all"&&(_r(s)&&(f={},Di(s,function(v){return f[v]=1}),s=f),s=o7(a,s)),m=a.length;m--;)if(~l.indexOf(a[m])){h=A[m],s==="all"?(u[m]=s,p=h,d={}):(d=u[m]=u[m]||{},p=s);for(f in p)g=h&&h[f],g&&((!("kill"in g.d)||g.d.kill(f)===!0)&&YC(this,g,"_pt"),delete h[f]),d!=="all"&&(d[f]=1)}return this._initted&&!this._pt&&c&&dg(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return Gg(1,arguments)},e.delayedCall=function(i,s,o,a){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},e.fromTo=function(i,s,o){return Gg(2,arguments)},e.set=function(i,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(i,s)},e.killTweensOf=function(i,s,o){return Sn.killTweensOf(i,s,o)},e}(mf);ro(fr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Di("staggerTo,staggerFrom,staggerFromTo",function(n){fr[n]=function(){var e=new Ui,t=cE.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var AU=function(e,t,r){return e[t]=r},PG=function(e,t,r){return e[t](r)},l7=function(e,t,r,i){return e[t](i.fp,r)},A7=function(e,t,r){return e.setAttribute(t,r)},cU=function(e,t){return Vn(e[t])?PG:tU(e[t])&&e.setAttribute?A7:AU},OG=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},c7=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},WG=function(e,t){var r=t._pt,i="";if(!e&&t.b)i=t.b;else if(e===1&&t.e)i=t.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*e):Math.round((r.s+r.c*e)*1e4)/1e4)+i,r=r._next;i+=t.c}t.set(t.t,t.p,i,t)},uU=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},u7=function(e,t,r,i){for(var s=this._pt,o;s;)o=s._next,s.p===i&&s.modifier(e,t,r),s=o},d7=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?YC(this,t,"_pt"):t.dep||(r=1),t=i;return!r},h7=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},GG=function(e){for(var t=e._pt,r,i,s,o;t;){for(r=t._next,i=s;i&&i.pr>t.pr;)i=i._next;(t._prev=i?i._prev:o)?t._prev._next=t:s=t,(t._next=i)?i._prev=t:o=t,t=r}e._pt=s},Li=function(){function n(t,r,i,s,o,a,l,A,c){this.t=r,this.s=s,this.c=o,this.p=i,this.r=a||OG,this.d=l||this,this.set=A||AU,this.pr=c||0,this._next=t,t&&(t._prev=this)}var e=n.prototype;return e.modifier=function(r,i,s){this.mSet=this.mSet||this.set,this.set=h7,this.m=r,this.mt=s,this.tween=i},n}();Di(sU+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return iU[n]=1});hs.TweenMax=hs.TweenLite=fr;hs.TimelineLite=hs.TimelineMax=Ui;Sn=new Ui({sortChildren:!1,defaults:hf,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});cs.stringFilter=RG;var vf=[],ow={},f7=[],kM=0,Hx=function(e){return(ow[e]||f7).map(function(t){return t()})},fE=function(){var e=Date.now(),t=[];e-kM>2&&(Hx("matchMediaInit"),vf.forEach(function(r){var i=r.queries,s=r.conditions,o,a,l,A;for(a in i)o=Ts.matchMedia(i[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,A=1);A&&(r.revert(),l&&t.push(r))}),Hx("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r)}),kM=e,Hx("matchMedia"))},ZG=function(){function n(t,r){this.selector=r&&uE(r),this.data=[],this._r=[],this.isReverted=!1,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){Vn(r)&&(s=i,i=r,r=Vn);var o=this,a=function(){var A=tr,c=o.selector,u;return A&&A!==o&&A.data.push(o),s&&(o.selector=uE(s)),tr=o,u=i.apply(o,arguments),Vn(u)&&o._r.push(u),tr=A,o.selector=c,o.isReverted=!1,u};return o.last=a,r===Vn?a(o):r?o[r]=a:a},e.ignore=function(r){var i=tr;tr=null,r(this),tr=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof fr&&!(i.parent&&i.parent.data==="nested")&&r.push(i)}),r},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(r,i){var s=this;if(r){var o=this.getTweens();this.data.forEach(function(l){l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(A){return o.splice(o.indexOf(A),1)}))}),o.map(function(l){return{g:l.globalTime(0),t:l}}).sort(function(l,A){return A.g-l.g||-1}).forEach(function(l){return l.t.revert(r)}),this.data.forEach(function(l){return!(l instanceof mf)&&l.revert&&l.revert(r)}),this._r.forEach(function(l){return l(r,s)}),this.isReverted=!0}else this.data.forEach(function(l){return l.kill&&l.kill()});if(this.clear(),i){var a=vf.indexOf(this);~a&&vf.splice(a,1)}},e.revert=function(r){this.kill(r||{})},n}(),p7=function(){function n(t){this.contexts=[],this.scope=t}var e=n.prototype;return e.add=function(r,i,s){Ua(r)||(r={matches:r});var o=new ZG(0,s||this.scope),a=o.conditions={},l,A,c;this.contexts.push(o),i=o.add("onMatch",i),o.queries=r;for(A in r)A==="all"?c=1:(l=Ts.matchMedia(r[A]),l&&(vf.indexOf(o)<0&&vf.push(o),(a[A]=l.matches)&&(c=1),l.addListener?l.addListener(fE):l.addEventListener("change",fE)));return c&&i(o),this},e.revert=function(r){this.kill(r||{})},e.kill=function(r){this.contexts.forEach(function(i){return i.kill(r,!0)})},n}(),pB={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(c){return fs.quickSetter(c,t,r)}),s=i.length;return function(c){for(var u=s;u--;)i[u](c)}}e=e[0]||{};var o=ts[t],a=ou(e),l=a.harness&&(a.harness.aliases||{})[t]||t,A=o?function(c){var u=new o;bh._pt=0,u.init(e,r?c+r:c,bh,0,[e]),u.render(1,u),bh._pt&&uU(1,bh)}:a.set(e,l);return o?A:function(c){return A(e,l,r?c+r:c,a,1)}},quickTo:function(e,t,r){var i,s=fs.to(e,wu((i={},i[t]="+=0.1",i.paused=!0,i),r||{})),o=function(l,A,c){return s.resetTo(t,l,A,c)};return o.tween=s,o},isTweening:function(e){return Sn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=lu(e.ease,hf.ease)),QM(hf,e||{})},config:function(e){return QM(cs,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,i=e.plugins,s=e.defaults,o=e.extendTimeline;(i||"").split(",").forEach(function(a){return a&&!ts[a]&&!hs[a]&&uB(t+" effect requires "+a+" plugin.")}),Wx[t]=function(a,l,A){return r(Js(a),ro(l||{},s),A)},o&&(Ui.prototype[t]=function(a,l,A){return this.add(Wx[t](a,Ua(l)?l:(A=l)&&{},this),A)})},registerEase:function(e,t){Vt[e]=lu(t)},parseEase:function(e,t){return arguments.length?lu(e,t):Vt},getById:function(e){return Sn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new Ui(e),i,s;for(r.smoothChildTiming=ki(e.smoothChildTiming),Sn.remove(r),r._dp=0,r._time=r._tTime=Sn._time,i=Sn._first;i;)s=i._next,(t||!(!i._dur&&i instanceof fr&&i.vars.onComplete===i._targets[0]))&&Aa(r,i,i._start-i._delay),i=s;return Aa(Sn,r,0),r},context:function(e,t){return e?new ZG(e,t):tr},matchMedia:function(e){return new p7(e)},matchMediaRefresh:function(){return vf.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||fE()},addEventListener:function(e,t){var r=ow[e]||(ow[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=ow[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:zK,wrapYoyo:YK,distribute:IG,random:EG,snap:FG,normalize:HK,getUnit:Kr,clamp:WK,splitColor:UG,toArray:Js,selector:uE,mapRange:SG,pipe:ZK,unitize:JK,interpolate:XK,shuffle:xG},install:dG,effects:Wx,ticker:ns,updateRoot:Ui.updateRoot,plugins:ts,globalTimeline:Sn,core:{PropTween:Li,globals:hG,Tween:fr,Timeline:Ui,Animation:mf,getCache:ou,_removeLinkedListItem:YC,reverting:function(){return ei},context:function(e){return e&&tr&&(tr.data.push(e),e._ctx=tr),tr},suppressOverwrites:function(e){return eU=e}}};Di("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return pB[n]=fr[n]});ns.add(Ui.updateRoot);bh=pB.to({},{duration:0});var g7=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},m7=function(e,t){var r=e._targets,i,s,o;for(i in t)for(s=r.length;s--;)o=e._ptLookup[s][i],o&&(o=o.d)&&(o._pt&&(o=g7(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},zx=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,A;if(_r(s)&&(l={},Di(s,function(c){return l[c]=1}),s=l),t){l={};for(A in s)l[A]=t(s[A]);s=l}m7(a,s)}}}},fs=pB.registerPlugin({name:"attr",init:function(e,t,r,i,s){var o,a,l;this.tween=r;for(o in t)l=e.getAttribute(o)||"",a=this.add(e,"setAttribute",(l||0)+"",t[o],i,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(e,t){for(var r=t._pt;r;)ei?r.set(r.t,r.p,r.b,r):r.r(e,r.d),r=r._next}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r],0,0,0,0,0,1)}},zx("roundProps",dE),zx("modifiers"),zx("snap",FG))||pB;fr.version=Ui.version=fs.version="3.11.4";uG=1;oG()&&gf();Vt.Power0;Vt.Power1;Vt.Power2;Vt.Power3;Vt.Power4;Vt.Linear;Vt.Quad;Vt.Cubic;Vt.Quart;Vt.Quint;Vt.Strong;Vt.Elastic;Vt.Back;Vt.SteppedEase;Vt.Bounce;Vt.Sine;Vt.Expo;Vt.Circ;/*! +*/var cs={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},hf={duration:.5,overwrite:!1,delay:0},eU,ei,tr,Zs=1e8,An=1/Zs,iE=Math.PI*2,FK=iE/4,EK=0,sG=Math.sqrt,_K=Math.cos,SK=Math.sin,_r=function(e){return typeof e=="string"},Vn=function(e){return typeof e=="function"},Ll=function(e){return typeof e=="number"},tU=function(e){return typeof e>"u"},Ua=function(e){return typeof e=="object"},ki=function(e){return e!==!1},oG=function(){return typeof window<"u"},Av=function(e){return Vn(e)||_r(e)},aG=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ti=Array.isArray,sE=/(?:-?\.?\d|\.)+/gi,lG=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ch=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Ox=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,AG=/[+-]=-?[.\d]+/,cG=/[^,'"\[\]\s]+/gi,UK=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Sn,Ts,oE,nU,hs={},cB={},uG,dG=function(e){return(cB=wu(e,hs))&&fs},rU=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},uB=function(e,t){return!t&&console.warn(e)},hG=function(e,t){return e&&(hs[e]=t)&&cB&&(cB[e]=t)||hs},Cm=function(){return 0},QK={suppressEvents:!0,isStart:!0,kill:!1},iw={suppressEvents:!0,kill:!1},RK={suppressEvents:!0},iU={},zA=[],aE={},fG,ts={},Wx={},UM=30,sw=[],sU="",oU=function(e){var t=e[0],r,i;if(Ua(t)||Vn(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=sw.length;i--&&!sw[i].targetTest(t););r=sw[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new kG(e[i],r)))||e.splice(i,1);return e},ou=function(e){return e._gsap||oU(Js(e))[0]._gsap},pG=function(e,t,r){return(r=e[t])&&Vn(r)?e[t]():tU(r)&&e.getAttribute&&e.getAttribute(t)||r},Di=function(e,t){return(e=e.split(",")).forEach(t)||e},zn=function(e){return Math.round(e*1e5)/1e5||0},Tr=function(e){return Math.round(e*1e7)/1e7||0},Oh=function(e,t){var r=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),r==="+"?e+i:r==="-"?e-i:r==="*"?e*i:e/i},MK=function(e,t){for(var r=t.length,i=0;e.indexOf(t[i])<0&&++ia;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[r],e[r]=t),t._next?t._next._prev=t:e[i]=t,t._prev=o,t.parent=t._dp=e,t},YC=function(e,t,r,i){r===void 0&&(r="_first"),i===void 0&&(i="_last");var s=t._prev,o=t._next;s?s._next=o:e[r]===t&&(e[r]=o),o?o._prev=s:e[i]===t&&(e[i]=s),t._next=t._prev=t.parent=null},ic=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove(e),e._act=0},au=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},kK=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},lE=function(e,t,r,i){return e._startAt&&(ei?e._startAt.revert(iw):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},DK=function n(e){return!e||e._ts&&n(e.parent)},RM=function(e){return e._repeat?ff(e._tTime,e=e.duration()+e._rDelay)*e:0},ff=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},fB=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},XC=function(e){return e._end=Tr(e._start+(e._tDur/Math.abs(e._ts||e._rts||An)||0))},jC=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=Tr(r._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),XC(e),r._dirty||au(r,e)),e},wG=function(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=fB(e.rawTime(),t),(!t._dur||c0(0,t.totalDuration(),r)-t._tTime>An)&&t.render(r,!0)),au(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-An}},Aa=function(e,t,r,i){return t.parent&&ic(t),t._start=Tr((Ll(r)?r:r||e!==Sn?Ms(e,r,t):e._time)+t._delay),t._end=Tr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),yG(e,t,"_first","_last",e._sort?"_start":0),AE(t)||(e._recent=t),i||wG(e,t),e._ts<0&&jC(e,e._tTime),e},BG=function(e,t){return(hs.ScrollTrigger||rU("scrollTrigger",t))&&hs.ScrollTrigger.create(t,e)},CG=function(e,t,r,i,s){if(lU(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!ei&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&fG!==ns.frame)return zA.push(e),e._lazy=[s,i],1},LK=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},AE=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},VK=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&LK(e)&&!(!e._initted&&AE(e))||(e._ts<0||e._dp._ts<0)&&!AE(e))?0:1,a=e._rDelay,l=0,A,c,u;if(a&&e._repeat&&(l=c0(0,e._tDur,t),c=ff(l,a),e._yoyo&&c&1&&(o=1-o),c!==ff(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||ei||i||e._zTime===An||!t&&e._zTime){if(!e._initted&&CG(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?An:0),r||(r=t&&!u),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,A=e._pt;A;)A.r(o,A.d),A=A._next;t<0&&lE(e,t,r,!0),e._onUpdate&&!r&&Hs(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Hs(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&ic(e,1),!r&&!ei&&(Hs(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},PK=function(e,t,r){var i;if(r>t)for(i=e._first;i&&i._start<=r;){if(i.data==="isPause"&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=r;){if(i.data==="isPause"&&i._start0&&!i&&jC(e,e._tTime=e._tDur*a),e.parent&&XC(e),r||au(e.parent,e),e},MM=function(e){return e instanceof Ui?au(e):pf(e,e._dur)},OK={_start:0,endTime:Cm,totalDuration:Cm},Ms=function n(e,t,r){var i=e.labels,s=e._recent||OK,o=e.duration()>=Zs?s.endTime(!1):e._dur,a,l,A;return _r(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),A=t.substr(-1)==="%",a=t.indexOf("="),l==="<"||l===">"?(a>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(A?(a<0?s:r).totalDuration()/100:1)):a<0?(t in i||(i[t]=o),i[t]):(l=parseFloat(t.charAt(a-1)+t.substr(a+1)),A&&r&&(l=l/100*(ti(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},Gg=function(e,t,r){var i=Ll(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s],a,l;if(i&&(o.duration=t[1]),o.parent=r,e){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=ki(l.vars.inherit)&&l.parent;o.immediateRender=ki(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new fr(t[0],o,t[s+1])},vc=function(e,t){return e||e===0?t(e):t},c0=function(e,t,r){return rt?t:r},Kr=function(e,t){return!_r(e)||!(t=UK.exec(e))?"":t[1]},WK=function(e,t,r){return vc(r,function(i){return c0(e,t,i)})},cE=[].slice,bG=function(e,t){return e&&Ua(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Ua(e[0]))&&!e.nodeType&&e!==Ts},GK=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return _r(i)&&!t||bG(i,1)?(s=r).push.apply(s,Js(i)):r.push(i)})||r},Js=function(e,t,r){return tr&&!t&&tr.selector?tr.selector(e):_r(e)&&!r&&(oE||!gf())?cE.call((t||nU).querySelectorAll(e),0):ti(e)?GK(e,r):bG(e)?cE.call(e,0):e?[e]:[]},uE=function(e){return e=Js(e)[0]||uB("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Js(t,r.querySelectorAll?r:r===e?uB("Invalid scope")||nU.createElement("div"):e)}},xG=function(e){return e.sort(function(){return .5-Math.random()})},IG=function(e){if(Vn(e))return e;var t=Ua(e)?e:{each:e},r=lu(t.ease),i=t.from||0,s=parseFloat(t.base)||0,o={},a=i>0&&i<1,l=isNaN(i)||a,A=t.axis,c=i,u=i;return _r(i)?c=u={center:.5,edges:.5,end:1}[i]||0:!a&&l&&(c=i[0],u=i[1]),function(h,d,p){var f=(p||t).length,g=o[f],m,v,w,B,C,b,F,x,_;if(!g){if(_=t.grid==="auto"?0:(t.grid||[1,Zs])[1],!_){for(F=-Zs;F<(F=p[_++].getBoundingClientRect().left)&&_F&&(F=C),Cf?f-1:A?A==="y"?f/_:_:Math.max(_,f/_))||0)*(i==="edges"?-1:1),g.b=f<0?s-f:s,g.u=Kr(t.amount||t.each)||0,r=r&&f<0?MG(r):r}return f=(g[h]-g.min)/g.max||0,Tr(g.b+(r?r(f):f)*g.v)+g.u}},dE=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var i=Tr(Math.round(parseFloat(r)/e)*e*t);return(i-i%1)/t+(Ll(r)?0:Kr(r))}},FG=function(e,t){var r=ti(e),i,s;return!r&&Ua(e)&&(i=r=e.radius||Zs,e.values?(e=Js(e.values),(s=!Ll(e[0]))&&(i*=i)):e=dE(e.increment)),vc(t,r?Vn(e)?function(o){return s=e(o),Math.abs(s-o)<=i?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),A=Zs,c=0,u=e.length,h,d;u--;)s?(h=e[u].x-a,d=e[u].y-l,h=h*h+d*d):h=Math.abs(e[u]-a),hi?s-o:o)})},bm=function(e){for(var t=0,r="",i,s,o,a;~(i=e.indexOf("random(",t));)o=e.indexOf(")",i),a=e.charAt(i+7)==="[",s=e.substr(i+7,o-i-7).match(a?cG:sE),r+=e.substr(t,i-t)+EG(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},SG=function(e,t,r,i,s){var o=t-e,a=i-r;return vc(s,function(l){return r+((l-e)/o*a||0)})},XK=function n(e,t,r,i){var s=isNaN(e+t)?0:function(d){return(1-d)*e+d*t};if(!s){var o=_r(e),a={},l,A,c,u,h;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(ti(e)&&!ti(t)){for(c=[],u=e.length,h=u-2,A=1;A(a=Math.abs(a))&&(l=o,s=a);return l},Hs=function(e,t,r){var i=e.vars,s=i[t],o=tr,a=e._ctx,l,A,c;if(s)return l=i[t+"Params"],A=i.callbackScope||e,r&&zA.length&&dB(),a&&(tr=a),c=l?s.apply(A,l):s.call(A),tr=o,c},dg=function(e){return ic(e),e.scrollTrigger&&e.scrollTrigger.kill(!!ei),e.progress()<1&&Hs(e,"onInterrupt"),e},bh,jK=function(e){e=!e.name&&e.default||e;var t=e.name,r=Vn(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Cm,render:uU,add:aU,kill:d7,modifier:u7,rawVars:0},o={targetTest:0,get:0,getSetter:cU,aliases:{},register:0};if(gf(),e!==i){if(ts[t])return;ro(i,ro(hB(e,s),o)),wu(i.prototype,wu(s,hB(e,o))),ts[i.prop=t]=i,e.targetTest&&(sw.push(i),iU[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}hG(t,i),e.register&&e.register(fs,i,Li)},an=255,hg={aqua:[0,an,an],lime:[0,an,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,an],navy:[0,0,128],white:[an,an,an],olive:[128,128,0],yellow:[an,an,0],orange:[an,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[an,0,0],pink:[an,192,203],cyan:[0,an,an],transparent:[an,an,an,0]},Gx=function(e,t,r){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(r-t)*e*6:e<.5?r:e*3<2?t+(r-t)*(2/3-e)*6:t)*an+.5|0},UG=function(e,t,r){var i=e?Ll(e)?[e>>16,e>>8&an,e&an]:0:hg.black,s,o,a,l,A,c,u,h,d,p;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),hg[e])i=hg[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),o=e.charAt(2),a=e.charAt(3),e="#"+s+s+o+o+a+a+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return i=parseInt(e.substr(1,6),16),[i>>16,i>>8&an,i&an,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&an,e&an]}else if(e.substr(0,3)==="hsl"){if(i=p=e.match(sE),!t)l=+i[0]%360/360,A=+i[1]/100,c=+i[2]/100,o=c<=.5?c*(A+1):c+A-c*A,s=c*2-o,i.length>3&&(i[3]*=1),i[0]=Gx(l+1/3,s,o),i[1]=Gx(l,s,o),i[2]=Gx(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(lG),r&&i.length<4&&(i[3]=1),i}else i=e.match(sE)||hg.transparent;i=i.map(Number)}return t&&!p&&(s=i[0]/an,o=i[1]/an,a=i[2]/an,u=Math.max(s,o,a),h=Math.min(s,o,a),c=(u+h)/2,u===h?l=A=0:(d=u-h,A=c>.5?d/(2-u-h):d/(u+h),l=u===s?(o-a)/d+(oe&&(r+=m-t),i+=m,C=i-r,w=C-o,(w>0||v)&&(b=++u.frame,h=C-u.time*1e3,u.time=C=C/1e3,o+=w+(w>=s?4:s-w),B=1),v||(l=A(f)),B)for(d=0;d=m&&d--},_listeners:a},u}(),gf=function(){return!xm&&ns.wake()},Vt={},$K=/^[\d.\-M][\d.\-,\s]/,qK=/["']/g,e7=function(e){for(var t={},r=e.substr(1,e.length-3).split(":"),i=r[0],s=1,o=r.length,a,l,A;s1&&r.config?r.config.apply(null,~e.indexOf("{")?[e7(t[1])]:t7(e).split(",").map(mG)):Vt._CE&&$K.test(e)?Vt._CE("",e):r},MG=function(e){return function(t){return 1-e(1-t)}},TG=function n(e,t){for(var r=e._first,i;r;)r instanceof Ui?n(r,t):r.vars.yoyoEase&&(!r._yoyo||!r._repeat)&&r._yoyo!==t&&(r.timeline?n(r.timeline,t):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=t)),r=r._next},lu=function(e,t){return e&&(Vn(e)?e:Vt[e]||n7(e))||t},Mu=function(e,t,r,i){r===void 0&&(r=function(l){return 1-t(1-l)}),i===void 0&&(i=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:r,easeInOut:i},o;return Di(e,function(a){Vt[a]=hs[a]=s,Vt[o=a.toLowerCase()]=r;for(var l in s)Vt[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Vt[a+"."+l]=s[l]}),s},NG=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},Zx=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/iE*(Math.asin(1/i)||0),a=function(c){return c===1?1:i*Math.pow(2,-10*c)*SK((c-o)*s)+1},l=e==="out"?a:e==="in"?function(A){return 1-a(1-A)}:NG(a);return s=iE/s,l.config=function(A,c){return n(e,A,c)},l},Jx=function n(e,t){t===void 0&&(t=1.70158);var r=function(o){return o?--o*o*((t+1)*o+t)+1:0},i=e==="out"?r:e==="in"?function(s){return 1-r(1-s)}:NG(r);return i.config=function(s){return n(e,s)},i};Di("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;Mu(n+",Power"+(t-1),e?function(r){return Math.pow(r,t)}:function(r){return r},function(r){return 1-Math.pow(1-r,t)},function(r){return r<.5?Math.pow(r*2,t)/2:1-Math.pow((1-r)*2,t)/2})});Vt.Linear.easeNone=Vt.none=Vt.Linear.easeIn;Mu("Elastic",Zx("in"),Zx("out"),Zx());(function(n,e){var t=1/e,r=2*t,i=2.5*t,s=function(a){return a0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},e.totalDuration=function(r){return arguments.length?(this._dirty=0,pf(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(gf(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(jC(this,r),!s._dp||s.parent||wG(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r0||!this._tDur&&!r)&&Aa(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===An||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),gG(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+RM(this))%(this._dur+this._rDelay)||(r?this._dur:0),i):this._time},e.totalProgress=function(r,i){return arguments.length?this.totalTime(this.totalDuration()*r,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},e.progress=function(r,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+RM(this),i):this.duration()?Math.min(1,this._time/this._dur):this.ratio},e.iteration=function(r,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,i):this._repeat?ff(this._tTime,s)+1:1},e.timeScale=function(r){if(!arguments.length)return this._rts===-An?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?fB(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-An?0:this._rts,this.totalTime(c0(-this._delay,this._tDur,i),!0),XC(this),kK(this)},e.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(gf(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==An&&(this._tTime-=An)))),this):this._ps},e.startTime=function(r){if(arguments.length){this._start=r;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Aa(i,this,r-this._delay),this}return this._start},e.endTime=function(r){return this._start+(ki(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(r){var i=this.parent||this._dp;return i?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?fB(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=RK);var i=ei;return ei=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),ei=i,this},e.globalTime=function(r){for(var i=this,s=arguments.length?r:i.rawTime();i;)s=i._start+s/(i._ts||1),i=i._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1:this._sat.globalTime(r):s},e.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,MM(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,MM(this),i?this.time(i):this}return this._rDelay},e.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},e.seek=function(r,i){return this.totalTime(Ms(this,r),ki(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,ki(i))},e.play=function(r,i){return r!=null&&this.seek(r,i),this.reversed(!1).paused(!1)},e.reverse=function(r,i){return r!=null&&this.seek(r||this.totalDuration(),i),this.reversed(!0).paused(!1)},e.pause=function(r,i){return r!=null&&this.seek(r,i),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-An:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-An,this},e.isActive=function(){var r=this.parent||this._dp,i=this._start,s;return!!(!r||this._ts&&this._initted&&r.isActive()&&(s=r.rawTime(!0))>=i&&s1?(i?(o[r]=i,s&&(o[r+"Params"]=s),r==="onUpdate"&&(this._onUpdate=i)):delete o[r],this):o[r]},e.then=function(r){var i=this;return new Promise(function(s){var o=Vn(r)?r:vG,a=function(){var A=i.then;i.then=null,Vn(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=A),s(o),i.then=A};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?a():i._prom=a})},e.kill=function(){dg(this)},n}();ro(mf.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-An,_prom:0,_ps:!1,_rts:1});var Ui=function(n){iG(e,n);function e(r,i){var s;return r===void 0&&(r={}),s=n.call(this,r)||this,s.labels={},s.smoothChildTiming=!!r.smoothChildTiming,s.autoRemoveChildren=!!r.autoRemoveChildren,s._sort=ki(r.sortChildren),Sn&&Aa(r.parent||Sn,cl(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&BG(cl(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return Gg(0,arguments,this),this},t.from=function(i,s,o){return Gg(1,arguments,this),this},t.fromTo=function(i,s,o,a){return Gg(2,arguments,this),this},t.set=function(i,s,o){return s.duration=0,s.parent=this,Wg(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new fr(i,s,Ms(this,o),1),this},t.call=function(i,s,o){return Aa(this,fr.delayedCall(0,i,s),o)},t.staggerTo=function(i,s,o,a,l,A,c){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=A,o.onCompleteParams=c,o.parent=this,new fr(i,o,Ms(this,l)),this},t.staggerFrom=function(i,s,o,a,l,A,c){return o.runBackwards=1,Wg(o).immediateRender=ki(o.immediateRender),this.staggerTo(i,s,o,a,l,A,c)},t.staggerFromTo=function(i,s,o,a,l,A,c,u){return a.startAt=o,Wg(a).immediateRender=ki(a.immediateRender),this.staggerTo(i,s,a,l,A,c,u)},t.render=function(i,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,A=this._dur,c=i<=0?0:Tr(i),u=this._zTime<0!=i<0&&(this._initted||!A),h,d,p,f,g,m,v,w,B,C,b,F;if(this!==Sn&&c>l&&i>=0&&(c=l),c!==this._tTime||o||u){if(a!==this._time&&A&&(c+=this._time-a,i+=this._time-a),h=c,B=this._start,w=this._ts,m=!w,u&&(A||(a=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(b=this._yoyo,g=A+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,s,o);if(h=Tr(c%g),c===l?(f=this._repeat,h=A):(f=~~(c/g),f&&f===c/g&&(h=A,f--),h>A&&(h=A)),C=ff(this._tTime,g),!a&&this._tTime&&C!==f&&(C=f),b&&f&1&&(h=A-h,F=1),f!==C&&!this._lock){var x=b&&C&1,_=x===(b&&f&1);if(f=a&&i>=0)for(d=this._first;d;){if(p=d._next,(d._act||h>=d._start)&&d._ts&&v!==d){if(d.parent!==this)return this.render(i,s,o);if(d.render(d._ts>0?(h-d._start)*d._ts:(d._dirty?d.totalDuration():d._tDur)+(h-d._start)*d._ts,s,o),h!==this._time||!this._ts&&!m){v=0,p&&(c+=this._zTime=-An);break}}d=p}else{d=this._last;for(var M=i<0?i:h;d;){if(p=d._prev,(d._act||M<=d._end)&&d._ts&&v!==d){if(d.parent!==this)return this.render(i,s,o);if(d.render(d._ts>0?(M-d._start)*d._ts:(d._dirty?d.totalDuration():d._tDur)+(M-d._start)*d._ts,s,o||ei&&(d._initted||d._startAt)),h!==this._time||!this._ts&&!m){v=0,p&&(c+=this._zTime=M?-An:An);break}}d=p}}if(v&&!s&&(this.pause(),v.render(h>=a?0:-An)._zTime=h>=a?1:-1,this._ts))return this._start=B,XC(this),this.render(i,s,o);this._onUpdate&&!s&&Hs(this,"onUpdate",!0),(c===l&&this._tTime>=this.totalDuration()||!c&&a)&&(B===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!A)&&(c===l&&this._ts>0||!c&&this._ts<0)&&ic(this,1),!s&&!(i<0&&!a)&&(c||a||!l)&&(Hs(this,c===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(Ll(s)||(s=Ms(this,s,i)),!(i instanceof mf)){if(ti(i))return i.forEach(function(a){return o.add(a,s)}),this;if(_r(i))return this.addLabel(i,s);if(Vn(i))i=fr.delayedCall(0,i);else return this}return this!==i?Aa(this,i,s):this},t.getChildren=function(i,s,o,a){i===void 0&&(i=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-Zs);for(var l=[],A=this._first;A;)A._start>=a&&(A instanceof fr?s&&l.push(A):(o&&l.push(A),i&&l.push.apply(l,A.getChildren(!0,s,o)))),A=A._next;return l},t.getById=function(i){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===i)return s[o]},t.remove=function(i){return _r(i)?this.removeLabel(i):Vn(i)?this.killTweensOf(i):(YC(this,i),i===this._recent&&(this._recent=this._last),au(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Tr(ns.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),n.prototype.totalTime.call(this,i,s),this._forcing=0,this):this._tTime},t.addLabel=function(i,s){return this.labels[i]=Ms(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,o){var a=fr.delayedCall(0,s||Cm,o);return a.data="isPause",this._hasPause=1,Aa(this,a,Ms(this,i))},t.removePause=function(i){var s=this._first;for(i=Ms(this,i);s;)s._start===i&&s.data==="isPause"&&ic(s),s=s._next},t.killTweensOf=function(i,s,o){for(var a=this.getTweensOf(i,o),l=a.length;l--;)UA!==a[l]&&a[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var o=[],a=Js(i),l=this._first,A=Ll(s),c;l;)l instanceof fr?MK(l._targets,a)&&(A?(!UA||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(c=l.getTweensOf(a,s)).length&&o.push.apply(o,c),l=l._next;return o},t.tweenTo=function(i,s){s=s||{};var o=this,a=Ms(o,i),l=s,A=l.startAt,c=l.onStart,u=l.onStartParams,h=l.immediateRender,d,p=fr.to(o,ro({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(A&&"time"in A?A.time:o._time))/o.timeScale())||An,onStart:function(){if(o.pause(),!d){var g=s.duration||Math.abs((a-(A&&"time"in A?A.time:o._time))/o.timeScale());p._dur!==g&&pf(p,g,0,1).render(p._time,!0,!0),d=1}c&&c.apply(p,u||[])}},s));return h?p.render(0):p},t.tweenFromTo=function(i,s,o){return this.tweenTo(s,ro({startAt:{time:Ms(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),TM(this,Ms(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),TM(this,Ms(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+An)},t.shiftChildren=function(i,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,A;a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(s)for(A in l)l[A]>=o&&(l[A]+=i);return au(this)},t.invalidate=function(i){var s=this._first;for(this._lock=0;s;)s.invalidate(i),s=s._next;return n.prototype.invalidate.call(this,i)},t.clear=function(i){i===void 0&&(i=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),au(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=Zs,A,c,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-i:i));if(o._dirty){for(u=o.parent;a;)A=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Aa(o,a,c-a._delay,1)._lock=0):l=c,c<0&&a._ts&&(s-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=A;pf(o,o===Sn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(Sn._ts&&(gG(Sn,fB(i,Sn)),fG=ns.frame),ns.frame>=UM){UM+=cs.autoSleep||120;var s=Sn._first;if((!s||!s._ts)&&cs.autoSleep&&ns._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||ns.sleep()}}},e}(mf);ro(Ui.prototype,{_lock:0,_hasPause:0,_forcing:0});var r7=function(e,t,r,i,s,o,a){var l=new Li(this._pt,e,t,0,1,WG,null,s),A=0,c=0,u,h,d,p,f,g,m,v;for(l.b=r,l.e=i,r+="",i+="",(m=~i.indexOf("random("))&&(i=bm(i)),o&&(v=[r,i],o(v,e,t),r=v[0],i=v[1]),h=r.match(Ox)||[];u=Ox.exec(i);)p=u[0],f=i.substring(A,u.index),d?d=(d+1)%5:f.substr(-5)==="rgba("&&(d=1),p!==h[c++]&&(g=parseFloat(h[c-1])||0,l._pt={_next:l._pt,p:f||c===1?f:",",s:g,c:p.charAt(1)==="="?Oh(g,p)-g:parseFloat(p)-g,m:d&&d<4?Math.round:0},A=Ox.lastIndex);return l.c=A")}),B.duration();else{b={};for(x in p)x==="ease"||x==="easeEach"||a7(x,p[x],b,p.easeEach);for(x in b)for(U=b[x].sort(function(R,N){return R.t-N.t}),O=0,C=0;Cl-An&&!c?l:iA&&(h=A)),m=this._yoyo&&p&1,m&&(B=this._yEase,h=A-h),g=ff(this._tTime,f),h===a&&!o&&this._initted)return this._tTime=u,this;p!==g&&(w&&this._yEase&&TG(w,m),this.vars.repeatRefresh&&!m&&!this._lock&&(this._lock=o=1,this.render(Tr(f*p),!0).invalidate()._lock=0))}if(!this._initted){if(CG(this,c?i:h,o,s,u))return this._tTime=0,this;if(a!==this._time)return this;if(A!==this._dur)return this.render(i,s,o)}if(this._tTime=u,this._time=h,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=v=(B||this._ease)(h/A),this._from&&(this.ratio=v=1-v),h&&!a&&!s&&(Hs(this,"onStart"),this._tTime!==u))return this;for(d=this._pt;d;)d.r(v,d.d),d=d._next;w&&w.render(i<0?i:!h&&m?-An:w._dur*w._ease(h/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(c&&lE(this,i,s,o),Hs(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!s&&this.parent&&Hs(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&lE(this,i,!0,!0),(i||!A)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&ic(this,1),!s&&!(c&&!a)&&(u||a||m)&&(Hs(this,u===l?"onComplete":"onReverseComplete",!0),this._prom&&!(u0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),n.prototype.invalidate.call(this,i)},t.resetTo=function(i,s,o,a){xm||ns.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||lU(this,l),A=this._ease(l/this._dur),s7(this,i,s,o,a,A,l)?this.resetTo(i,s,o,a):(jC(this,0),this.parent||yG(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(i,s){if(s===void 0&&(s="all"),!i&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?dg(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,UA&&UA.vars.overwrite!==!0)._first||dg(this),this.parent&&o!==this.timeline.totalDuration()&&pf(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?Js(i):a,A=this._ptLookup,c=this._pt,u,h,d,p,f,g,m;if((!s||s==="all")&&NK(a,l))return s==="all"&&(this._pt=0),dg(this);for(u=this._op=this._op||[],s!=="all"&&(_r(s)&&(f={},Di(s,function(v){return f[v]=1}),s=f),s=o7(a,s)),m=a.length;m--;)if(~l.indexOf(a[m])){h=A[m],s==="all"?(u[m]=s,p=h,d={}):(d=u[m]=u[m]||{},p=s);for(f in p)g=h&&h[f],g&&((!("kill"in g.d)||g.d.kill(f)===!0)&&YC(this,g,"_pt"),delete h[f]),d!=="all"&&(d[f]=1)}return this._initted&&!this._pt&&c&&dg(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return Gg(1,arguments)},e.delayedCall=function(i,s,o,a){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},e.fromTo=function(i,s,o){return Gg(2,arguments)},e.set=function(i,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(i,s)},e.killTweensOf=function(i,s,o){return Sn.killTweensOf(i,s,o)},e}(mf);ro(fr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Di("staggerTo,staggerFrom,staggerFromTo",function(n){fr[n]=function(){var e=new Ui,t=cE.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var AU=function(e,t,r){return e[t]=r},PG=function(e,t,r){return e[t](r)},l7=function(e,t,r,i){return e[t](i.fp,r)},A7=function(e,t,r){return e.setAttribute(t,r)},cU=function(e,t){return Vn(e[t])?PG:tU(e[t])&&e.setAttribute?A7:AU},OG=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},c7=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},WG=function(e,t){var r=t._pt,i="";if(!e&&t.b)i=t.b;else if(e===1&&t.e)i=t.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*e):Math.round((r.s+r.c*e)*1e4)/1e4)+i,r=r._next;i+=t.c}t.set(t.t,t.p,i,t)},uU=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},u7=function(e,t,r,i){for(var s=this._pt,o;s;)o=s._next,s.p===i&&s.modifier(e,t,r),s=o},d7=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?YC(this,t,"_pt"):t.dep||(r=1),t=i;return!r},h7=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},GG=function(e){for(var t=e._pt,r,i,s,o;t;){for(r=t._next,i=s;i&&i.pr>t.pr;)i=i._next;(t._prev=i?i._prev:o)?t._prev._next=t:s=t,(t._next=i)?i._prev=t:o=t,t=r}e._pt=s},Li=function(){function n(t,r,i,s,o,a,l,A,c){this.t=r,this.s=s,this.c=o,this.p=i,this.r=a||OG,this.d=l||this,this.set=A||AU,this.pr=c||0,this._next=t,t&&(t._prev=this)}var e=n.prototype;return e.modifier=function(r,i,s){this.mSet=this.mSet||this.set,this.set=h7,this.m=r,this.mt=s,this.tween=i},n}();Di(sU+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return iU[n]=1});hs.TweenMax=hs.TweenLite=fr;hs.TimelineLite=hs.TimelineMax=Ui;Sn=new Ui({sortChildren:!1,defaults:hf,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});cs.stringFilter=RG;var vf=[],ow={},f7=[],kM=0,Hx=function(e){return(ow[e]||f7).map(function(t){return t()})},fE=function(){var e=Date.now(),t=[];e-kM>2&&(Hx("matchMediaInit"),vf.forEach(function(r){var i=r.queries,s=r.conditions,o,a,l,A;for(a in i)o=Ts.matchMedia(i[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,A=1);A&&(r.revert(),l&&t.push(r))}),Hx("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r)}),kM=e,Hx("matchMedia"))},ZG=function(){function n(t,r){this.selector=r&&uE(r),this.data=[],this._r=[],this.isReverted=!1,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){Vn(r)&&(s=i,i=r,r=Vn);var o=this,a=function(){var A=tr,c=o.selector,u;return A&&A!==o&&A.data.push(o),s&&(o.selector=uE(s)),tr=o,u=i.apply(o,arguments),Vn(u)&&o._r.push(u),tr=A,o.selector=c,o.isReverted=!1,u};return o.last=a,r===Vn?a(o):r?o[r]=a:a},e.ignore=function(r){var i=tr;tr=null,r(this),tr=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof fr&&!(i.parent&&i.parent.data==="nested")&&r.push(i)}),r},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(r,i){var s=this;if(r){var o=this.getTweens();this.data.forEach(function(l){l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(A){return o.splice(o.indexOf(A),1)}))}),o.map(function(l){return{g:l.globalTime(0),t:l}}).sort(function(l,A){return A.g-l.g||-1}).forEach(function(l){return l.t.revert(r)}),this.data.forEach(function(l){return!(l instanceof mf)&&l.revert&&l.revert(r)}),this._r.forEach(function(l){return l(r,s)}),this.isReverted=!0}else this.data.forEach(function(l){return l.kill&&l.kill()});if(this.clear(),i){var a=vf.indexOf(this);~a&&vf.splice(a,1)}},e.revert=function(r){this.kill(r||{})},n}(),p7=function(){function n(t){this.contexts=[],this.scope=t}var e=n.prototype;return e.add=function(r,i,s){Ua(r)||(r={matches:r});var o=new ZG(0,s||this.scope),a=o.conditions={},l,A,c;this.contexts.push(o),i=o.add("onMatch",i),o.queries=r;for(A in r)A==="all"?c=1:(l=Ts.matchMedia(r[A]),l&&(vf.indexOf(o)<0&&vf.push(o),(a[A]=l.matches)&&(c=1),l.addListener?l.addListener(fE):l.addEventListener("change",fE)));return c&&i(o),this},e.revert=function(r){this.kill(r||{})},e.kill=function(r){this.contexts.forEach(function(i){return i.kill(r,!0)})},n}(),pB={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(c){return fs.quickSetter(c,t,r)}),s=i.length;return function(c){for(var u=s;u--;)i[u](c)}}e=e[0]||{};var o=ts[t],a=ou(e),l=a.harness&&(a.harness.aliases||{})[t]||t,A=o?function(c){var u=new o;bh._pt=0,u.init(e,r?c+r:c,bh,0,[e]),u.render(1,u),bh._pt&&uU(1,bh)}:a.set(e,l);return o?A:function(c){return A(e,l,r?c+r:c,a,1)}},quickTo:function(e,t,r){var i,s=fs.to(e,wu((i={},i[t]="+=0.1",i.paused=!0,i),r||{})),o=function(l,A,c){return s.resetTo(t,l,A,c)};return o.tween=s,o},isTweening:function(e){return Sn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=lu(e.ease,hf.ease)),QM(hf,e||{})},config:function(e){return QM(cs,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,i=e.plugins,s=e.defaults,o=e.extendTimeline;(i||"").split(",").forEach(function(a){return a&&!ts[a]&&!hs[a]&&uB(t+" effect requires "+a+" plugin.")}),Wx[t]=function(a,l,A){return r(Js(a),ro(l||{},s),A)},o&&(Ui.prototype[t]=function(a,l,A){return this.add(Wx[t](a,Ua(l)?l:(A=l)&&{},this),A)})},registerEase:function(e,t){Vt[e]=lu(t)},parseEase:function(e,t){return arguments.length?lu(e,t):Vt},getById:function(e){return Sn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new Ui(e),i,s;for(r.smoothChildTiming=ki(e.smoothChildTiming),Sn.remove(r),r._dp=0,r._time=r._tTime=Sn._time,i=Sn._first;i;)s=i._next,(t||!(!i._dur&&i instanceof fr&&i.vars.onComplete===i._targets[0]))&&Aa(r,i,i._start-i._delay),i=s;return Aa(Sn,r,0),r},context:function(e,t){return e?new ZG(e,t):tr},matchMedia:function(e){return new p7(e)},matchMediaRefresh:function(){return vf.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||fE()},addEventListener:function(e,t){var r=ow[e]||(ow[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=ow[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:zK,wrapYoyo:YK,distribute:IG,random:EG,snap:FG,normalize:HK,getUnit:Kr,clamp:WK,splitColor:UG,toArray:Js,selector:uE,mapRange:SG,pipe:ZK,unitize:JK,interpolate:XK,shuffle:xG},install:dG,effects:Wx,ticker:ns,updateRoot:Ui.updateRoot,plugins:ts,globalTimeline:Sn,core:{PropTween:Li,globals:hG,Tween:fr,Timeline:Ui,Animation:mf,getCache:ou,_removeLinkedListItem:YC,reverting:function(){return ei},context:function(e){return e&&tr&&(tr.data.push(e),e._ctx=tr),tr},suppressOverwrites:function(e){return eU=e}}};Di("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return pB[n]=fr[n]});ns.add(Ui.updateRoot);bh=pB.to({},{duration:0});var g7=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},m7=function(e,t){var r=e._targets,i,s,o;for(i in t)for(s=r.length;s--;)o=e._ptLookup[s][i],o&&(o=o.d)&&(o._pt&&(o=g7(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},zx=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,A;if(_r(s)&&(l={},Di(s,function(c){return l[c]=1}),s=l),t){l={};for(A in s)l[A]=t(s[A]);s=l}m7(a,s)}}}},fs=pB.registerPlugin({name:"attr",init:function(e,t,r,i,s){var o,a,l;this.tween=r;for(o in t)l=e.getAttribute(o)||"",a=this.add(e,"setAttribute",(l||0)+"",t[o],i,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(e,t){for(var r=t._pt;r;)ei?r.set(r.t,r.p,r.b,r):r.r(e,r.d),r=r._next}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r],0,0,0,0,0,1)}},zx("roundProps",dE),zx("modifiers"),zx("snap",FG))||pB;fr.version=Ui.version=fs.version="3.11.4";uG=1;oG()&&gf();Vt.Power0;Vt.Power1;Vt.Power2;Vt.Power3;Vt.Power4;Vt.Linear;Vt.Quad;Vt.Cubic;Vt.Quart;Vt.Quint;Vt.Strong;Vt.Elastic;Vt.Back;Vt.SteppedEase;Vt.Bounce;Vt.Sine;Vt.Expo;Vt.Circ;/*! * CSSPlugin 3.11.4 * https://greensock.com * @@ -60,11 +60,11 @@ Error generating stack: `+s.message+` * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com -*/var DM,QA,Wh,dU,jc,LM,hU,v7=function(){return typeof window<"u"},Vl={},Vc=180/Math.PI,Gh=Math.PI/180,$u=Math.atan2,VM=1e8,fU=/([A-Z])/g,y7=/(left|right|width|margin|padding|x)/i,w7=/[\s,\(]\S/,Cl={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},pE=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},B7=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},C7=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},b7=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},JG=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},HG=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},x7=function(e,t,r){return e.style[t]=r},I7=function(e,t,r){return e.style.setProperty(t,r)},F7=function(e,t,r){return e._gsap[t]=r},E7=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},_7=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},S7=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Un="transform",To=Un+"Origin",U7=function(e,t){var r=this,i=this.target,s=i.style;if(e in Vl){if(this.tfm=this.tfm||{},e!=="transform"&&(e=Cl[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return r.tfm[o]=pl(i,o)}):this.tfm[e]=i._gsap.x?i._gsap[e]:pl(i,e)),this.props.indexOf(Un)>=0)return;i._gsap.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(To,t,"")),e=Un}(s||t)&&this.props.push(e,t,s[e])},zG=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},Q7=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?PM[o]:"")+e},mE=function(){v7()&&window.document&&(DM=window,QA=DM.document,Wh=QA.documentElement,jc=gE("div")||{style:{}},gE("div"),Un=yf(Un),To=Un+"Origin",jc.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",XG=!!yf("perspective"),hU=fs.core.reverting,dU=1)},Yx=function n(e){var t=gE("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,i=this.nextSibling,s=this.style.cssText,o;if(Wh.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=n}catch{}else this._gsapBBox&&(o=this._gsapBBox());return r&&(i?r.insertBefore(this,i):r.appendChild(this)),Wh.removeChild(t),this.style.cssText=s,o},OM=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},jG=function(e){var t;try{t=e.getBBox()}catch{t=Yx.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===Yx||(t=Yx.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+OM(e,["x","cx","x1"])||0,y:+OM(e,["y","cy","y1"])||0,width:0,height:0}:t},KG=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&jG(e))},Im=function(e,t){if(t){var r=e.style;t in Vl&&t!==To&&(t=Un),r.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(t.replace(fU,"-$1").toLowerCase())):r.removeAttribute(t)}},RA=function(e,t,r,i,s,o){var a=new Li(e._pt,t,r,0,1,o?HG:JG);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},WM={deg:1,rad:1,turn:1},R7={grid:1,flex:1},sc=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=jc.style,l=y7.test(t),A=e.tagName.toLowerCase()==="svg",c=(A?"client":"offset")+(l?"Width":"Height"),u=100,h=i==="px",d=i==="%",p,f,g,m;return i===o||!s||WM[i]||WM[o]?s:(o!=="px"&&!h&&(s=n(e,t,r,"px")),m=e.getCTM&&KG(e),(d||o==="%")&&(Vl[t]||~t.indexOf("adius"))?(p=m?e.getBBox()[l?"width":"height"]:e[c],zn(d?s/p*u:s/100*p)):(a[l?"width":"height"]=u+(h?o:i),f=~t.indexOf("adius")||i==="em"&&e.appendChild&&!A?e:e.parentNode,m&&(f=(e.ownerSVGElement||{}).parentNode),(!f||f===QA||!f.appendChild)&&(f=QA.body),g=f._gsap,g&&d&&g.width&&l&&g.time===ns.time&&!g.uncache?zn(s/g.width*u):((d||o==="%")&&!R7[ba(f,"display")]&&(a.position=ba(e,"position")),f===e&&(a.position="static"),f.appendChild(jc),p=jc[c],f.removeChild(jc),a.position="absolute",l&&d&&(g=ou(f),g.time=ns.time,g.width=f[c]),zn(h?p*s/u:p&&s?u/p*s:0))))},pl=function(e,t,r,i){var s;return dU||mE(),t in Cl&&t!=="transform"&&(t=Cl[t],~t.indexOf(",")&&(t=t.split(",")[0])),Vl[t]&&t!=="transform"?(s=Em(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:mB(ba(e,To))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=gB[t]&&gB[t](e,t,r)||ba(e,t)||pG(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?sc(e,t,s,r)+r:s},M7=function(e,t,r,i){if(!r||r==="none"){var s=yf(t,e,1),o=s&&ba(e,s,1);o&&o!==r?(t=s,r=o):t==="borderColor"&&(r=ba(e,"borderTopColor"))}var a=new Li(this._pt,e.style,t,0,1,WG),l=0,A=0,c,u,h,d,p,f,g,m,v,w,B,C;if(a.b=r,a.e=i,r+="",i+="",i==="auto"&&(e.style[t]=i,i=ba(e,t)||i,e.style[t]=r),c=[r,i],RG(c),r=c[0],i=c[1],h=r.match(Ch)||[],C=i.match(Ch)||[],C.length){for(;u=Ch.exec(i);)g=u[0],v=i.substring(l,u.index),p?p=(p+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(p=1),g!==(f=h[A++]||"")&&(d=parseFloat(f)||0,B=f.substr((d+"").length),g.charAt(1)==="="&&(g=Oh(d,g)+B),m=parseFloat(g),w=g.substr((m+"").length),l=Ch.lastIndex-w.length,w||(w=w||cs.units[t]||B,l===i.length&&(i+=w,a.e+=w)),B!==w&&(d=sc(e,t,f,w)||0),a._pt={_next:a._pt,p:v||A===1?v:",",s:d,c:m-d,m:p&&p<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[A],Vl[a]&&(l=1,a=a==="transformOrigin"?To:Un),Im(r,a);l&&(Im(r,Un),o&&(o.svg&&r.removeAttribute("transform"),Em(r,1),o.uncache=1,zG(i)))}},gB={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new Li(e._pt,t,r,0,0,N7);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Fm=[1,0,0,1,0,0],$G={},qG=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},ZM=function(e){var t=ba(e,Un);return qG(t)?Fm:t.substr(7).match(lG).map(zn)},pU=function(e,t){var r=e._gsap||ou(e),i=e.style,s=ZM(e),o,a,l,A;return r.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?Fm:s):(s===Fm&&!e.offsetParent&&e!==Wh&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(A=1,a=e.nextElementSibling,Wh.appendChild(e)),s=ZM(e),l?i.display=l:Im(e,"display"),A&&(a?o.insertBefore(e,a):o?o.appendChild(e):Wh.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},vE=function(e,t,r,i,s,o){var a=e._gsap,l=s||pU(e,!0),A=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,h=a.yOffset||0,d=l[0],p=l[1],f=l[2],g=l[3],m=l[4],v=l[5],w=t.split(" "),B=parseFloat(w[0])||0,C=parseFloat(w[1])||0,b,F,x,_;r?l!==Fm&&(F=d*g-p*f)&&(x=B*(g/F)+C*(-f/F)+(f*v-g*m)/F,_=B*(-p/F)+C*(d/F)-(d*v-p*m)/F,B=x,C=_):(b=jG(e),B=b.x+(~w[0].indexOf("%")?B/100*b.width:B),C=b.y+(~(w[1]||w[0]).indexOf("%")?C/100*b.height:C)),i||i!==!1&&a.smooth?(m=B-A,v=C-c,a.xOffset=u+(m*d+v*f)-m,a.yOffset=h+(m*p+v*g)-v):a.xOffset=a.yOffset=0,a.xOrigin=B,a.yOrigin=C,a.smooth=!!i,a.origin=t,a.originIsAbsolute=!!r,e.style[To]="0px 0px",o&&(RA(o,a,"xOrigin",A,B),RA(o,a,"yOrigin",c,C),RA(o,a,"xOffset",u,a.xOffset),RA(o,a,"yOffset",h,a.yOffset)),e.setAttribute("data-svg-origin",B+" "+C)},Em=function(e,t){var r=e._gsap||new kG(e);if("x"in r&&!t&&!r.uncache)return r;var i=e.style,s=r.scaleX<0,o="px",a="deg",l=getComputedStyle(e),A=ba(e,To)||"0",c,u,h,d,p,f,g,m,v,w,B,C,b,F,x,_,M,Y,O,U,y,I,R,N,k,V,G,D,E,z,re,T;return c=u=h=f=g=m=v=w=B=0,d=p=1,r.svg=!!(e.getCTM&&KG(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Un]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Un]!=="none"?l[Un]:"")),i.scale=i.rotate=i.translate="none"),F=pU(e,r.svg),r.svg&&(r.uncache?(k=e.getBBox(),A=r.xOrigin-k.x+"px "+(r.yOrigin-k.y)+"px",N=""):N=!t&&e.getAttribute("data-svg-origin"),vE(e,N||A,!!N||r.originIsAbsolute,r.smooth!==!1,F)),C=r.xOrigin||0,b=r.yOrigin||0,F!==Fm&&(Y=F[0],O=F[1],U=F[2],y=F[3],c=I=F[4],u=R=F[5],F.length===6?(d=Math.sqrt(Y*Y+O*O),p=Math.sqrt(y*y+U*U),f=Y||O?$u(O,Y)*Vc:0,v=U||y?$u(U,y)*Vc+f:0,v&&(p*=Math.abs(Math.cos(v*Gh))),r.svg&&(c-=C-(C*Y+b*U),u-=b-(C*O+b*y))):(T=F[6],z=F[7],G=F[8],D=F[9],E=F[10],re=F[11],c=F[12],u=F[13],h=F[14],x=$u(T,E),g=x*Vc,x&&(_=Math.cos(-x),M=Math.sin(-x),N=I*_+G*M,k=R*_+D*M,V=T*_+E*M,G=I*-M+G*_,D=R*-M+D*_,E=T*-M+E*_,re=z*-M+re*_,I=N,R=k,T=V),x=$u(-U,E),m=x*Vc,x&&(_=Math.cos(-x),M=Math.sin(-x),N=Y*_-G*M,k=O*_-D*M,V=U*_-E*M,re=y*M+re*_,Y=N,O=k,U=V),x=$u(O,Y),f=x*Vc,x&&(_=Math.cos(x),M=Math.sin(x),N=Y*_+O*M,k=I*_+R*M,O=O*_-Y*M,R=R*_-I*M,Y=N,I=k),g&&Math.abs(g)+Math.abs(f)>359.9&&(g=f=0,m=180-m),d=zn(Math.sqrt(Y*Y+O*O+U*U)),p=zn(Math.sqrt(R*R+T*T)),x=$u(I,R),v=Math.abs(x)>2e-4?x*Vc:0,B=re?1/(re<0?-re:re):0),r.svg&&(N=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!qG(ba(e,Un)),N&&e.setAttribute("transform",N))),Math.abs(v)>90&&Math.abs(v)<270&&(s?(d*=-1,v+=f<=0?180:-180,f+=f<=0?180:-180):(p*=-1,v+=v<=0?180:-180)),t=t||r.uncache,r.x=c-((r.xPercent=c&&(!t&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-c)?-50:0)))?e.offsetWidth*r.xPercent/100:0)+o,r.y=u-((r.yPercent=u&&(!t&&r.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-u)?-50:0)))?e.offsetHeight*r.yPercent/100:0)+o,r.z=h+o,r.scaleX=zn(d),r.scaleY=zn(p),r.rotation=zn(f)+a,r.rotationX=zn(g)+a,r.rotationY=zn(m)+a,r.skewX=v+a,r.skewY=w+a,r.transformPerspective=B+o,(r.zOrigin=parseFloat(A.split(" ")[2])||0)&&(i[To]=mB(A)),r.xOffset=r.yOffset=0,r.force3D=cs.force3D,r.renderTransform=r.svg?D7:XG?eZ:k7,r.uncache=0,r},mB=function(e){return(e=e.split(" "))[0]+" "+e[1]},Xx=function(e,t,r){var i=Kr(t);return zn(parseFloat(t)+parseFloat(sc(e,"x",r+"px",i)))+i},k7=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,eZ(e,t)},Ic="0deg",Fp="0px",Fc=") ",eZ=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,A=r.rotation,c=r.rotationY,u=r.rotationX,h=r.skewX,d=r.skewY,p=r.scaleX,f=r.scaleY,g=r.transformPerspective,m=r.force3D,v=r.target,w=r.zOrigin,B="",C=m==="auto"&&e&&e!==1||m===!0;if(w&&(u!==Ic||c!==Ic)){var b=parseFloat(c)*Gh,F=Math.sin(b),x=Math.cos(b),_;b=parseFloat(u)*Gh,_=Math.cos(b),o=Xx(v,o,F*_*-w),a=Xx(v,a,-Math.sin(b)*-w),l=Xx(v,l,x*_*-w+w)}g!==Fp&&(B+="perspective("+g+Fc),(i||s)&&(B+="translate("+i+"%, "+s+"%) "),(C||o!==Fp||a!==Fp||l!==Fp)&&(B+=l!==Fp||C?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+Fc),A!==Ic&&(B+="rotate("+A+Fc),c!==Ic&&(B+="rotateY("+c+Fc),u!==Ic&&(B+="rotateX("+u+Fc),(h!==Ic||d!==Ic)&&(B+="skew("+h+", "+d+Fc),(p!==1||f!==1)&&(B+="scale("+p+", "+f+Fc),v.style[Un]=B||"translate(0, 0)"},D7=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,A=r.skewX,c=r.skewY,u=r.scaleX,h=r.scaleY,d=r.target,p=r.xOrigin,f=r.yOrigin,g=r.xOffset,m=r.yOffset,v=r.forceCSS,w=parseFloat(o),B=parseFloat(a),C,b,F,x,_;l=parseFloat(l),A=parseFloat(A),c=parseFloat(c),c&&(c=parseFloat(c),A+=c,l+=c),l||A?(l*=Gh,A*=Gh,C=Math.cos(l)*u,b=Math.sin(l)*u,F=Math.sin(l-A)*-h,x=Math.cos(l-A)*h,A&&(c*=Gh,_=Math.tan(A-c),_=Math.sqrt(1+_*_),F*=_,x*=_,c&&(_=Math.tan(c),_=Math.sqrt(1+_*_),C*=_,b*=_)),C=zn(C),b=zn(b),F=zn(F),x=zn(x)):(C=u,x=h,b=F=0),(w&&!~(o+"").indexOf("px")||B&&!~(a+"").indexOf("px"))&&(w=sc(d,"x",o,"px"),B=sc(d,"y",a,"px")),(p||f||g||m)&&(w=zn(w+p-(p*C+f*F)+g),B=zn(B+f-(p*b+f*x)+m)),(i||s)&&(_=d.getBBox(),w=zn(w+i/100*_.width),B=zn(B+s/100*_.height)),_="matrix("+C+","+b+","+F+","+x+","+w+","+B+")",d.setAttribute("transform",_),v&&(d.style[Un]=_)},L7=function(e,t,r,i,s){var o=360,a=_r(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?Vc:1),A=l-i,c=i+A+"deg",u,h;return a&&(u=s.split("_")[1],u==="short"&&(A%=o,A!==A%(o/2)&&(A+=A<0?o:-o)),u==="cw"&&A<0?A=(A+o*VM)%o-~~(A/o)*o:u==="ccw"&&A>0&&(A=(A-o*VM)%o-~~(A/o)*o)),e._pt=h=new Li(e._pt,t,r,i,A,B7),h.e=c,h.u="deg",e._props.push(r),h},JM=function(e,t){for(var r in t)e[r]=t[r];return e},V7=function(e,t,r){var i=JM({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,A,c,u,h,d,p;i.svg?(A=r.getAttribute("transform"),r.setAttribute("transform",""),o[Un]=t,a=Em(r,1),Im(r,Un),r.setAttribute("transform",A)):(A=getComputedStyle(r)[Un],o[Un]=t,a=Em(r,1),o[Un]=A);for(l in Vl)A=i[l],c=a[l],A!==c&&s.indexOf(l)<0&&(d=Kr(A),p=Kr(c),u=d!==p?sc(r,l,A,p):parseFloat(A),h=parseFloat(c),e._pt=new Li(e._pt,a,l,u,h-u,pE),e._pt.u=p||0,e._props.push(l));JM(a,i)};Di("padding,margin,Width,Radius",function(n,e){var t="Top",r="Right",i="Bottom",s="Left",o=(e<3?[t,r,i,s]:[t+s,t+r,i+r,i+s]).map(function(a){return e<2?n+a:"border"+a+n});gB[e>1?"border"+n:n]=function(a,l,A,c,u){var h,d;if(arguments.length<4)return h=o.map(function(p){return pl(a,p,A)}),d=h.join(" "),d.split(h[0]).length===5?h[0]:d;h=(c+"").split(" "),d={},o.forEach(function(p,f){return d[p]=h[f]=h[f]||h[(f-1)/2|0]}),a.init(l,d,u)}});var tZ={name:"css",register:mE,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,r,i,s){var o=this._props,a=e.style,l=r.vars.startAt,A,c,u,h,d,p,f,g,m,v,w,B,C,b,F,x;dU||mE(),this.styles=this.styles||YG(e),x=this.styles.props,this.tween=r;for(f in t)if(f!=="autoRound"&&(c=t[f],!(ts[f]&&DG(f,t,r,i,e,s)))){if(d=typeof c,p=gB[f],d==="function"&&(c=c.call(r,i,e,s),d=typeof c),d==="string"&&~c.indexOf("random(")&&(c=bm(c)),p)p(this,e,f,c,r)&&(F=1);else if(f.substr(0,2)==="--")A=(getComputedStyle(e).getPropertyValue(f)+"").trim(),c+="",YA.lastIndex=0,YA.test(A)||(g=Kr(A),m=Kr(c)),m?g!==m&&(A=sc(e,f,A,m)+m):g&&(c+=g),this.add(a,"setProperty",A,c,i,s,0,0,f),o.push(f),x.push(f,0,a[f]);else if(d!=="undefined"){if(l&&f in l?(A=typeof l[f]=="function"?l[f].call(r,i,e,s):l[f],_r(A)&&~A.indexOf("random(")&&(A=bm(A)),Kr(A+"")||(A+=cs.units[f]||Kr(pl(e,f))||""),(A+"").charAt(1)==="="&&(A=pl(e,f))):A=pl(e,f),h=parseFloat(A),v=d==="string"&&c.charAt(1)==="="&&c.substr(0,2),v&&(c=c.substr(2)),u=parseFloat(c),f in Cl&&(f==="autoAlpha"&&(h===1&&pl(e,"visibility")==="hidden"&&u&&(h=0),x.push("visibility",0,a.visibility),RA(this,a,"visibility",h?"inherit":"hidden",u?"inherit":"hidden",!u)),f!=="scale"&&f!=="transform"&&(f=Cl[f],~f.indexOf(",")&&(f=f.split(",")[0]))),w=f in Vl,w){if(this.styles.save(f),B||(C=e._gsap,C.renderTransform&&!t.parseTransform||Em(e,t.parseTransform),b=t.smoothOrigin!==!1&&C.smooth,B=this._pt=new Li(this._pt,a,Un,0,1,C.renderTransform,C,0,-1),B.dep=1),f==="scale")this._pt=new Li(this._pt,C,"scaleY",C.scaleY,(v?Oh(C.scaleY,v+u):u)-C.scaleY||0,pE),this._pt.u=0,o.push("scaleY",f),f+="X";else if(f==="transformOrigin"){x.push(To,0,a[To]),c=T7(c),C.svg?vE(e,c,0,b,0,this):(m=parseFloat(c.split(" ")[2])||0,m!==C.zOrigin&&RA(this,C,"zOrigin",C.zOrigin,m),RA(this,a,f,mB(A),mB(c)));continue}else if(f==="svgOrigin"){vE(e,c,1,b,0,this);continue}else if(f in $G){L7(this,C,f,h,v?Oh(h,v+c):c);continue}else if(f==="smoothOrigin"){RA(this,C,"smooth",C.smooth,c);continue}else if(f==="force3D"){C[f]=c;continue}else if(f==="transform"){V7(this,c,e);continue}}else f in a||(f=yf(f)||f);if(w||(u||u===0)&&(h||h===0)&&!w7.test(c)&&f in a)g=(A+"").substr((h+"").length),u||(u=0),m=Kr(c)||(f in cs.units?cs.units[f]:g),g!==m&&(h=sc(e,f,A,m)),this._pt=new Li(this._pt,w?C:a,f,h,(v?Oh(h,v+u):u)-h,!w&&(m==="px"||f==="zIndex")&&t.autoRound!==!1?b7:pE),this._pt.u=m||0,g!==m&&m!=="%"&&(this._pt.b=A,this._pt.r=C7);else if(f in a)M7.call(this,e,f,A,v?v+c:c);else if(f in e)this.add(e,f,A||e[f],v?v+c:c,i,s);else if(f!=="parseTransform"){rU(f,c);continue}w||(f in a?x.push(f,0,a[f]):x.push(f,1,A||e[f])),o.push(f)}}F&&GG(this)},render:function(e,t){if(t.tween._time||!hU())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:pl,aliases:Cl,getSetter:function(e,t,r){var i=Cl[t];return i&&i.indexOf(",")<0&&(t=i),t in Vl&&t!==To&&(e._gsap.x||pl(e,"x"))?r&&LM===r?t==="scale"?E7:F7:(LM=r||{})&&(t==="scale"?_7:S7):e.style&&!tU(e.style[t])?x7:~t.indexOf("-")?I7:cU(e,t)},core:{_removeProperty:Im,_getMatrix:pU}};fs.utils.checkPrefix=yf;fs.core.getStyleSaver=YG;(function(n,e,t,r){var i=Di(n+","+e+","+t,function(s){Vl[s]=1});Di(e,function(s){cs.units[s]="deg",$G[s]=1}),Cl[i[13]]=n+","+e,Di(r,function(s){var o=s.split(":");Cl[o[1]]=i[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");Di("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){cs.units[n]="px"});fs.registerPlugin(tZ);var yE=fs.registerPlugin(tZ)||fs;yE.core.Tween;function Lf(){localStorage&&Object.keys(localStorage).map(n=>{this.setItem(n,localStorage[n],!1)}),Object.defineProperty(this,"length",{get:function(){return Object.keys(this).length},enumerable:!1})}Lf.prototype.key=function(n){return Object.keys(this)[n]};Lf.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Lf.prototype.setItem=function(n,e,t=!0){const r=typeof e=="string"?e:JSON.stringify(e);return t&&localStorage.setItem(n,r),this[n]=r};Lf.prototype.removeItem=function(n){delete this[n]};Lf.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let P7=new Lf;const O7=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),W7=(n=P7)=>new Proxy({},O7(n)),De=W7();/** +*/var DM,QA,Wh,dU,jc,LM,hU,v7=function(){return typeof window<"u"},Vl={},Vc=180/Math.PI,Gh=Math.PI/180,$u=Math.atan2,VM=1e8,fU=/([A-Z])/g,y7=/(left|right|width|margin|padding|x)/i,w7=/[\s,\(]\S/,Cl={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},pE=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},B7=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},C7=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},b7=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},JG=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},HG=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},x7=function(e,t,r){return e.style[t]=r},I7=function(e,t,r){return e.style.setProperty(t,r)},F7=function(e,t,r){return e._gsap[t]=r},E7=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},_7=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},S7=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Un="transform",To=Un+"Origin",U7=function(e,t){var r=this,i=this.target,s=i.style;if(e in Vl){if(this.tfm=this.tfm||{},e!=="transform"&&(e=Cl[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return r.tfm[o]=pl(i,o)}):this.tfm[e]=i._gsap.x?i._gsap[e]:pl(i,e)),this.props.indexOf(Un)>=0)return;i._gsap.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(To,t,"")),e=Un}(s||t)&&this.props.push(e,t,s[e])},zG=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},Q7=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?PM[o]:"")+e},mE=function(){v7()&&window.document&&(DM=window,QA=DM.document,Wh=QA.documentElement,jc=gE("div")||{style:{}},gE("div"),Un=yf(Un),To=Un+"Origin",jc.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",XG=!!yf("perspective"),hU=fs.core.reverting,dU=1)},Yx=function n(e){var t=gE("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,i=this.nextSibling,s=this.style.cssText,o;if(Wh.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=n}catch{}else this._gsapBBox&&(o=this._gsapBBox());return r&&(i?r.insertBefore(this,i):r.appendChild(this)),Wh.removeChild(t),this.style.cssText=s,o},OM=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},jG=function(e){var t;try{t=e.getBBox()}catch{t=Yx.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===Yx||(t=Yx.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+OM(e,["x","cx","x1"])||0,y:+OM(e,["y","cy","y1"])||0,width:0,height:0}:t},KG=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&jG(e))},Im=function(e,t){if(t){var r=e.style;t in Vl&&t!==To&&(t=Un),r.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(t.replace(fU,"-$1").toLowerCase())):r.removeAttribute(t)}},RA=function(e,t,r,i,s,o){var a=new Li(e._pt,t,r,0,1,o?HG:JG);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},WM={deg:1,rad:1,turn:1},R7={grid:1,flex:1},sc=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=jc.style,l=y7.test(t),A=e.tagName.toLowerCase()==="svg",c=(A?"client":"offset")+(l?"Width":"Height"),u=100,h=i==="px",d=i==="%",p,f,g,m;return i===o||!s||WM[i]||WM[o]?s:(o!=="px"&&!h&&(s=n(e,t,r,"px")),m=e.getCTM&&KG(e),(d||o==="%")&&(Vl[t]||~t.indexOf("adius"))?(p=m?e.getBBox()[l?"width":"height"]:e[c],zn(d?s/p*u:s/100*p)):(a[l?"width":"height"]=u+(h?o:i),f=~t.indexOf("adius")||i==="em"&&e.appendChild&&!A?e:e.parentNode,m&&(f=(e.ownerSVGElement||{}).parentNode),(!f||f===QA||!f.appendChild)&&(f=QA.body),g=f._gsap,g&&d&&g.width&&l&&g.time===ns.time&&!g.uncache?zn(s/g.width*u):((d||o==="%")&&!R7[ba(f,"display")]&&(a.position=ba(e,"position")),f===e&&(a.position="static"),f.appendChild(jc),p=jc[c],f.removeChild(jc),a.position="absolute",l&&d&&(g=ou(f),g.time=ns.time,g.width=f[c]),zn(h?p*s/u:p&&s?u/p*s:0))))},pl=function(e,t,r,i){var s;return dU||mE(),t in Cl&&t!=="transform"&&(t=Cl[t],~t.indexOf(",")&&(t=t.split(",")[0])),Vl[t]&&t!=="transform"?(s=Em(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:mB(ba(e,To))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=gB[t]&&gB[t](e,t,r)||ba(e,t)||pG(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?sc(e,t,s,r)+r:s},M7=function(e,t,r,i){if(!r||r==="none"){var s=yf(t,e,1),o=s&&ba(e,s,1);o&&o!==r?(t=s,r=o):t==="borderColor"&&(r=ba(e,"borderTopColor"))}var a=new Li(this._pt,e.style,t,0,1,WG),l=0,A=0,c,u,h,d,p,f,g,m,v,w,B,C;if(a.b=r,a.e=i,r+="",i+="",i==="auto"&&(e.style[t]=i,i=ba(e,t)||i,e.style[t]=r),c=[r,i],RG(c),r=c[0],i=c[1],h=r.match(Ch)||[],C=i.match(Ch)||[],C.length){for(;u=Ch.exec(i);)g=u[0],v=i.substring(l,u.index),p?p=(p+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(p=1),g!==(f=h[A++]||"")&&(d=parseFloat(f)||0,B=f.substr((d+"").length),g.charAt(1)==="="&&(g=Oh(d,g)+B),m=parseFloat(g),w=g.substr((m+"").length),l=Ch.lastIndex-w.length,w||(w=w||cs.units[t]||B,l===i.length&&(i+=w,a.e+=w)),B!==w&&(d=sc(e,t,f,w)||0),a._pt={_next:a._pt,p:v||A===1?v:",",s:d,c:m-d,m:p&&p<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[A],Vl[a]&&(l=1,a=a==="transformOrigin"?To:Un),Im(r,a);l&&(Im(r,Un),o&&(o.svg&&r.removeAttribute("transform"),Em(r,1),o.uncache=1,zG(i)))}},gB={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new Li(e._pt,t,r,0,0,N7);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Fm=[1,0,0,1,0,0],$G={},qG=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},ZM=function(e){var t=ba(e,Un);return qG(t)?Fm:t.substr(7).match(lG).map(zn)},pU=function(e,t){var r=e._gsap||ou(e),i=e.style,s=ZM(e),o,a,l,A;return r.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?Fm:s):(s===Fm&&!e.offsetParent&&e!==Wh&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(A=1,a=e.nextElementSibling,Wh.appendChild(e)),s=ZM(e),l?i.display=l:Im(e,"display"),A&&(a?o.insertBefore(e,a):o?o.appendChild(e):Wh.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},vE=function(e,t,r,i,s,o){var a=e._gsap,l=s||pU(e,!0),A=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,h=a.yOffset||0,d=l[0],p=l[1],f=l[2],g=l[3],m=l[4],v=l[5],w=t.split(" "),B=parseFloat(w[0])||0,C=parseFloat(w[1])||0,b,F,x,_;r?l!==Fm&&(F=d*g-p*f)&&(x=B*(g/F)+C*(-f/F)+(f*v-g*m)/F,_=B*(-p/F)+C*(d/F)-(d*v-p*m)/F,B=x,C=_):(b=jG(e),B=b.x+(~w[0].indexOf("%")?B/100*b.width:B),C=b.y+(~(w[1]||w[0]).indexOf("%")?C/100*b.height:C)),i||i!==!1&&a.smooth?(m=B-A,v=C-c,a.xOffset=u+(m*d+v*f)-m,a.yOffset=h+(m*p+v*g)-v):a.xOffset=a.yOffset=0,a.xOrigin=B,a.yOrigin=C,a.smooth=!!i,a.origin=t,a.originIsAbsolute=!!r,e.style[To]="0px 0px",o&&(RA(o,a,"xOrigin",A,B),RA(o,a,"yOrigin",c,C),RA(o,a,"xOffset",u,a.xOffset),RA(o,a,"yOffset",h,a.yOffset)),e.setAttribute("data-svg-origin",B+" "+C)},Em=function(e,t){var r=e._gsap||new kG(e);if("x"in r&&!t&&!r.uncache)return r;var i=e.style,s=r.scaleX<0,o="px",a="deg",l=getComputedStyle(e),A=ba(e,To)||"0",c,u,h,d,p,f,g,m,v,w,B,C,b,F,x,_,M,Y,O,U,y,I,R,N,k,L,G,D,E,z,re,T;return c=u=h=f=g=m=v=w=B=0,d=p=1,r.svg=!!(e.getCTM&&KG(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Un]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Un]!=="none"?l[Un]:"")),i.scale=i.rotate=i.translate="none"),F=pU(e,r.svg),r.svg&&(r.uncache?(k=e.getBBox(),A=r.xOrigin-k.x+"px "+(r.yOrigin-k.y)+"px",N=""):N=!t&&e.getAttribute("data-svg-origin"),vE(e,N||A,!!N||r.originIsAbsolute,r.smooth!==!1,F)),C=r.xOrigin||0,b=r.yOrigin||0,F!==Fm&&(Y=F[0],O=F[1],U=F[2],y=F[3],c=I=F[4],u=R=F[5],F.length===6?(d=Math.sqrt(Y*Y+O*O),p=Math.sqrt(y*y+U*U),f=Y||O?$u(O,Y)*Vc:0,v=U||y?$u(U,y)*Vc+f:0,v&&(p*=Math.abs(Math.cos(v*Gh))),r.svg&&(c-=C-(C*Y+b*U),u-=b-(C*O+b*y))):(T=F[6],z=F[7],G=F[8],D=F[9],E=F[10],re=F[11],c=F[12],u=F[13],h=F[14],x=$u(T,E),g=x*Vc,x&&(_=Math.cos(-x),M=Math.sin(-x),N=I*_+G*M,k=R*_+D*M,L=T*_+E*M,G=I*-M+G*_,D=R*-M+D*_,E=T*-M+E*_,re=z*-M+re*_,I=N,R=k,T=L),x=$u(-U,E),m=x*Vc,x&&(_=Math.cos(-x),M=Math.sin(-x),N=Y*_-G*M,k=O*_-D*M,L=U*_-E*M,re=y*M+re*_,Y=N,O=k,U=L),x=$u(O,Y),f=x*Vc,x&&(_=Math.cos(x),M=Math.sin(x),N=Y*_+O*M,k=I*_+R*M,O=O*_-Y*M,R=R*_-I*M,Y=N,I=k),g&&Math.abs(g)+Math.abs(f)>359.9&&(g=f=0,m=180-m),d=zn(Math.sqrt(Y*Y+O*O+U*U)),p=zn(Math.sqrt(R*R+T*T)),x=$u(I,R),v=Math.abs(x)>2e-4?x*Vc:0,B=re?1/(re<0?-re:re):0),r.svg&&(N=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!qG(ba(e,Un)),N&&e.setAttribute("transform",N))),Math.abs(v)>90&&Math.abs(v)<270&&(s?(d*=-1,v+=f<=0?180:-180,f+=f<=0?180:-180):(p*=-1,v+=v<=0?180:-180)),t=t||r.uncache,r.x=c-((r.xPercent=c&&(!t&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-c)?-50:0)))?e.offsetWidth*r.xPercent/100:0)+o,r.y=u-((r.yPercent=u&&(!t&&r.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-u)?-50:0)))?e.offsetHeight*r.yPercent/100:0)+o,r.z=h+o,r.scaleX=zn(d),r.scaleY=zn(p),r.rotation=zn(f)+a,r.rotationX=zn(g)+a,r.rotationY=zn(m)+a,r.skewX=v+a,r.skewY=w+a,r.transformPerspective=B+o,(r.zOrigin=parseFloat(A.split(" ")[2])||0)&&(i[To]=mB(A)),r.xOffset=r.yOffset=0,r.force3D=cs.force3D,r.renderTransform=r.svg?D7:XG?eZ:k7,r.uncache=0,r},mB=function(e){return(e=e.split(" "))[0]+" "+e[1]},Xx=function(e,t,r){var i=Kr(t);return zn(parseFloat(t)+parseFloat(sc(e,"x",r+"px",i)))+i},k7=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,eZ(e,t)},Ic="0deg",Fp="0px",Fc=") ",eZ=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,A=r.rotation,c=r.rotationY,u=r.rotationX,h=r.skewX,d=r.skewY,p=r.scaleX,f=r.scaleY,g=r.transformPerspective,m=r.force3D,v=r.target,w=r.zOrigin,B="",C=m==="auto"&&e&&e!==1||m===!0;if(w&&(u!==Ic||c!==Ic)){var b=parseFloat(c)*Gh,F=Math.sin(b),x=Math.cos(b),_;b=parseFloat(u)*Gh,_=Math.cos(b),o=Xx(v,o,F*_*-w),a=Xx(v,a,-Math.sin(b)*-w),l=Xx(v,l,x*_*-w+w)}g!==Fp&&(B+="perspective("+g+Fc),(i||s)&&(B+="translate("+i+"%, "+s+"%) "),(C||o!==Fp||a!==Fp||l!==Fp)&&(B+=l!==Fp||C?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+Fc),A!==Ic&&(B+="rotate("+A+Fc),c!==Ic&&(B+="rotateY("+c+Fc),u!==Ic&&(B+="rotateX("+u+Fc),(h!==Ic||d!==Ic)&&(B+="skew("+h+", "+d+Fc),(p!==1||f!==1)&&(B+="scale("+p+", "+f+Fc),v.style[Un]=B||"translate(0, 0)"},D7=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,A=r.skewX,c=r.skewY,u=r.scaleX,h=r.scaleY,d=r.target,p=r.xOrigin,f=r.yOrigin,g=r.xOffset,m=r.yOffset,v=r.forceCSS,w=parseFloat(o),B=parseFloat(a),C,b,F,x,_;l=parseFloat(l),A=parseFloat(A),c=parseFloat(c),c&&(c=parseFloat(c),A+=c,l+=c),l||A?(l*=Gh,A*=Gh,C=Math.cos(l)*u,b=Math.sin(l)*u,F=Math.sin(l-A)*-h,x=Math.cos(l-A)*h,A&&(c*=Gh,_=Math.tan(A-c),_=Math.sqrt(1+_*_),F*=_,x*=_,c&&(_=Math.tan(c),_=Math.sqrt(1+_*_),C*=_,b*=_)),C=zn(C),b=zn(b),F=zn(F),x=zn(x)):(C=u,x=h,b=F=0),(w&&!~(o+"").indexOf("px")||B&&!~(a+"").indexOf("px"))&&(w=sc(d,"x",o,"px"),B=sc(d,"y",a,"px")),(p||f||g||m)&&(w=zn(w+p-(p*C+f*F)+g),B=zn(B+f-(p*b+f*x)+m)),(i||s)&&(_=d.getBBox(),w=zn(w+i/100*_.width),B=zn(B+s/100*_.height)),_="matrix("+C+","+b+","+F+","+x+","+w+","+B+")",d.setAttribute("transform",_),v&&(d.style[Un]=_)},L7=function(e,t,r,i,s){var o=360,a=_r(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?Vc:1),A=l-i,c=i+A+"deg",u,h;return a&&(u=s.split("_")[1],u==="short"&&(A%=o,A!==A%(o/2)&&(A+=A<0?o:-o)),u==="cw"&&A<0?A=(A+o*VM)%o-~~(A/o)*o:u==="ccw"&&A>0&&(A=(A-o*VM)%o-~~(A/o)*o)),e._pt=h=new Li(e._pt,t,r,i,A,B7),h.e=c,h.u="deg",e._props.push(r),h},JM=function(e,t){for(var r in t)e[r]=t[r];return e},V7=function(e,t,r){var i=JM({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,A,c,u,h,d,p;i.svg?(A=r.getAttribute("transform"),r.setAttribute("transform",""),o[Un]=t,a=Em(r,1),Im(r,Un),r.setAttribute("transform",A)):(A=getComputedStyle(r)[Un],o[Un]=t,a=Em(r,1),o[Un]=A);for(l in Vl)A=i[l],c=a[l],A!==c&&s.indexOf(l)<0&&(d=Kr(A),p=Kr(c),u=d!==p?sc(r,l,A,p):parseFloat(A),h=parseFloat(c),e._pt=new Li(e._pt,a,l,u,h-u,pE),e._pt.u=p||0,e._props.push(l));JM(a,i)};Di("padding,margin,Width,Radius",function(n,e){var t="Top",r="Right",i="Bottom",s="Left",o=(e<3?[t,r,i,s]:[t+s,t+r,i+r,i+s]).map(function(a){return e<2?n+a:"border"+a+n});gB[e>1?"border"+n:n]=function(a,l,A,c,u){var h,d;if(arguments.length<4)return h=o.map(function(p){return pl(a,p,A)}),d=h.join(" "),d.split(h[0]).length===5?h[0]:d;h=(c+"").split(" "),d={},o.forEach(function(p,f){return d[p]=h[f]=h[f]||h[(f-1)/2|0]}),a.init(l,d,u)}});var tZ={name:"css",register:mE,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,r,i,s){var o=this._props,a=e.style,l=r.vars.startAt,A,c,u,h,d,p,f,g,m,v,w,B,C,b,F,x;dU||mE(),this.styles=this.styles||YG(e),x=this.styles.props,this.tween=r;for(f in t)if(f!=="autoRound"&&(c=t[f],!(ts[f]&&DG(f,t,r,i,e,s)))){if(d=typeof c,p=gB[f],d==="function"&&(c=c.call(r,i,e,s),d=typeof c),d==="string"&&~c.indexOf("random(")&&(c=bm(c)),p)p(this,e,f,c,r)&&(F=1);else if(f.substr(0,2)==="--")A=(getComputedStyle(e).getPropertyValue(f)+"").trim(),c+="",YA.lastIndex=0,YA.test(A)||(g=Kr(A),m=Kr(c)),m?g!==m&&(A=sc(e,f,A,m)+m):g&&(c+=g),this.add(a,"setProperty",A,c,i,s,0,0,f),o.push(f),x.push(f,0,a[f]);else if(d!=="undefined"){if(l&&f in l?(A=typeof l[f]=="function"?l[f].call(r,i,e,s):l[f],_r(A)&&~A.indexOf("random(")&&(A=bm(A)),Kr(A+"")||(A+=cs.units[f]||Kr(pl(e,f))||""),(A+"").charAt(1)==="="&&(A=pl(e,f))):A=pl(e,f),h=parseFloat(A),v=d==="string"&&c.charAt(1)==="="&&c.substr(0,2),v&&(c=c.substr(2)),u=parseFloat(c),f in Cl&&(f==="autoAlpha"&&(h===1&&pl(e,"visibility")==="hidden"&&u&&(h=0),x.push("visibility",0,a.visibility),RA(this,a,"visibility",h?"inherit":"hidden",u?"inherit":"hidden",!u)),f!=="scale"&&f!=="transform"&&(f=Cl[f],~f.indexOf(",")&&(f=f.split(",")[0]))),w=f in Vl,w){if(this.styles.save(f),B||(C=e._gsap,C.renderTransform&&!t.parseTransform||Em(e,t.parseTransform),b=t.smoothOrigin!==!1&&C.smooth,B=this._pt=new Li(this._pt,a,Un,0,1,C.renderTransform,C,0,-1),B.dep=1),f==="scale")this._pt=new Li(this._pt,C,"scaleY",C.scaleY,(v?Oh(C.scaleY,v+u):u)-C.scaleY||0,pE),this._pt.u=0,o.push("scaleY",f),f+="X";else if(f==="transformOrigin"){x.push(To,0,a[To]),c=T7(c),C.svg?vE(e,c,0,b,0,this):(m=parseFloat(c.split(" ")[2])||0,m!==C.zOrigin&&RA(this,C,"zOrigin",C.zOrigin,m),RA(this,a,f,mB(A),mB(c)));continue}else if(f==="svgOrigin"){vE(e,c,1,b,0,this);continue}else if(f in $G){L7(this,C,f,h,v?Oh(h,v+c):c);continue}else if(f==="smoothOrigin"){RA(this,C,"smooth",C.smooth,c);continue}else if(f==="force3D"){C[f]=c;continue}else if(f==="transform"){V7(this,c,e);continue}}else f in a||(f=yf(f)||f);if(w||(u||u===0)&&(h||h===0)&&!w7.test(c)&&f in a)g=(A+"").substr((h+"").length),u||(u=0),m=Kr(c)||(f in cs.units?cs.units[f]:g),g!==m&&(h=sc(e,f,A,m)),this._pt=new Li(this._pt,w?C:a,f,h,(v?Oh(h,v+u):u)-h,!w&&(m==="px"||f==="zIndex")&&t.autoRound!==!1?b7:pE),this._pt.u=m||0,g!==m&&m!=="%"&&(this._pt.b=A,this._pt.r=C7);else if(f in a)M7.call(this,e,f,A,v?v+c:c);else if(f in e)this.add(e,f,A||e[f],v?v+c:c,i,s);else if(f!=="parseTransform"){rU(f,c);continue}w||(f in a?x.push(f,0,a[f]):x.push(f,1,A||e[f])),o.push(f)}}F&&GG(this)},render:function(e,t){if(t.tween._time||!hU())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:pl,aliases:Cl,getSetter:function(e,t,r){var i=Cl[t];return i&&i.indexOf(",")<0&&(t=i),t in Vl&&t!==To&&(e._gsap.x||pl(e,"x"))?r&&LM===r?t==="scale"?E7:F7:(LM=r||{})&&(t==="scale"?_7:S7):e.style&&!tU(e.style[t])?x7:~t.indexOf("-")?I7:cU(e,t)},core:{_removeProperty:Im,_getMatrix:pU}};fs.utils.checkPrefix=yf;fs.core.getStyleSaver=YG;(function(n,e,t,r){var i=Di(n+","+e+","+t,function(s){Vl[s]=1});Di(e,function(s){cs.units[s]="deg",$G[s]=1}),Cl[i[13]]=n+","+e,Di(r,function(s){var o=s.split(":");Cl[o[1]]=i[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");Di("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){cs.units[n]="px"});fs.registerPlugin(tZ);var yE=fs.registerPlugin(tZ)||fs;yE.core.Tween;function Lf(){localStorage&&Object.keys(localStorage).map(n=>{this.setItem(n,localStorage[n],!1)}),Object.defineProperty(this,"length",{get:function(){return Object.keys(this).length},enumerable:!1})}Lf.prototype.key=function(n){return Object.keys(this)[n]};Lf.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Lf.prototype.setItem=function(n,e,t=!0){const r=typeof e=="string"?e:JSON.stringify(e);return t&&localStorage.setItem(n,r),this[n]=r};Lf.prototype.removeItem=function(n){delete this[n]};Lf.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let P7=new Lf;const O7=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),W7=(n=P7)=>new Proxy({},O7(n)),De=W7();/** * @license * Copyright 2010-2022 Three.js Authors * SPDX-License-Identifier: MIT - */const Ps="146",qu={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ed={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},G7=0,HM=1,Z7=2,nZ=1,J7=2,fg=3,Lo=0,yi=1,mi=2,XA=0,Zh=1,Bu=2,zM=3,YM=4,H7=5,kd=100,z7=101,Y7=102,XM=103,jM=104,X7=200,j7=201,K7=202,$7=203,rZ=204,iZ=205,q7=206,e$=207,t$=208,n$=209,r$=210,i$=0,s$=1,o$=2,wE=3,a$=4,l$=5,A$=6,c$=7,KC=0,u$=1,d$=2,El=0,h$=1,f$=2,p$=3,g$=4,m$=5,sZ=300,wf=301,Bf=302,vB=303,BE=304,$C=306,ps=1e3,fi=1001,_m=1002,nr=1003,yB=1004,wB=1005,ci=1006,gU=1007,Tu=1008,oc=1009,v$=1010,y$=1011,oZ=1012,w$=1013,Kc=1014,MA=1015,Sm=1016,B$=1017,C$=1018,Jh=1020,b$=1021,x$=1022,Ir=1023,I$=1024,F$=1025,Au=1026,Cf=1027,E$=1028,_$=1029,S$=1030,U$=1031,Q$=1033,jx=33776,Kx=33777,$x=33778,qx=33779,KM=35840,$M=35841,qM=35842,eT=35843,R$=36196,tT=37492,nT=37496,rT=37808,iT=37809,sT=37810,oT=37811,aT=37812,lT=37813,AT=37814,cT=37815,uT=37816,dT=37817,hT=37818,fT=37819,pT=37820,gT=37821,mT=36492,M$=2200,T$=2201,N$=2202,bf=2300,Cu=2301,e1=2302,xh=2400,Ih=2401,BB=2402,mU=2500,k$=2501,D$=1,aZ=2,gs=3e3,mt=3001,L$=3200,V$=3201,Nu=0,P$=1,O$="",ul="srgb",$c="srgb-linear",t1=7680,W$=519,CE=35044,G$=35048,vT="300 es",bE=1035;class yc{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+Hr[n>>16&255]+Hr[n>>24&255]+"-"+Hr[e&255]+Hr[e>>8&255]+"-"+Hr[e>>16&15|64]+Hr[e>>24&255]+"-"+Hr[t&63|128]+Hr[t>>8&255]+"-"+Hr[t>>16&255]+Hr[t>>24&255]+Hr[r&255]+Hr[r>>8&255]+Hr[r>>16&255]+Hr[r>>24&255]).toLowerCase()}function pr(n,e,t){return Math.max(e,Math.min(t,n))}function vU(n,e){return(n%e+e)%e}function Z$(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function J$(n,e,t){return n!==e?(t-n)/(e-n):0}function Hg(n,e,t){return(1-t)*n+t*e}function H$(n,e,t,r){return Hg(n,e,1-Math.exp(-t*r))}function z$(n,e=1){return e-Math.abs(vU(n,e*2)-e)}function Y$(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function X$(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function j$(n,e){return n+Math.floor(Math.random()*(e-n+1))}function K$(n,e){return n+Math.random()*(e-n)}function $$(n){return n*(.5-Math.random())}function q$(n){n!==void 0&&(yT=n);let e=yT+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function eq(n){return n*Jg}function tq(n){return n*Um}function xE(n){return(n&n-1)===0&&n!==0}function lZ(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function CB(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function nq(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),A=s((e+r)/2),c=o((e+r)/2),u=s((e-r)/2),h=o((e-r)/2),d=s((r-e)/2),p=o((r-e)/2);switch(i){case"XYX":n.set(a*c,l*u,l*h,a*A);break;case"YZY":n.set(l*h,a*c,l*u,a*A);break;case"ZXZ":n.set(l*u,l*h,a*c,a*A);break;case"XZX":n.set(a*c,l*p,l*d,a*A);break;case"YXY":n.set(l*d,a*c,l*p,a*A);break;case"ZYZ":n.set(l*p,l*d,a*c,a*A);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function bl(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function ln(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Wt=Object.freeze({__proto__:null,DEG2RAD:Jg,RAD2DEG:Um,generateUUID:No,clamp:pr,euclideanModulo:vU,mapLinear:Z$,inverseLerp:J$,lerp:Hg,damp:H$,pingpong:z$,smoothstep:Y$,smootherstep:X$,randInt:j$,randFloat:K$,randFloatSpread:$$,seededRandom:q$,degToRad:eq,radToDeg:tq,isPowerOfTwo:xE,ceilPowerOfTwo:lZ,floorPowerOfTwo:CB,setQuaternionFromProperEuler:nq,normalize:ln,denormalize:bl});class Ye{constructor(e=0,t=0){Ye.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ln{constructor(){Ln.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,i,s,o,a,l,A){const c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=r,c[7]=o,c[8]=A,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],A=r[1],c=r[4],u=r[7],h=r[2],d=r[5],p=r[8],f=i[0],g=i[3],m=i[6],v=i[1],w=i[4],B=i[7],C=i[2],b=i[5],F=i[8];return s[0]=o*f+a*v+l*C,s[3]=o*g+a*w+l*b,s[6]=o*m+a*B+l*F,s[1]=A*f+c*v+u*C,s[4]=A*g+c*w+u*b,s[7]=A*m+c*B+u*F,s[2]=h*f+d*v+p*C,s[5]=h*g+d*w+p*b,s[8]=h*m+d*B+p*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],A=e[7],c=e[8];return t*o*c-t*a*A-r*s*c+r*a*l+i*s*A-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],A=e[7],c=e[8],u=c*o-a*A,h=a*l-c*s,d=A*s-o*l,p=t*u+r*h+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=u*f,e[1]=(i*A-c*r)*f,e[2]=(a*r-i*o)*f,e[3]=h*f,e[4]=(c*t-i*l)*f,e[5]=(i*s-a*t)*f,e[6]=d*f,e[7]=(r*l-A*t)*f,e[8]=(o*t-r*s)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),A=Math.sin(s);return this.set(r*l,r*A,-r*(l*o+A*a)+o+e,-i*A,i*l,-i*(-A*o+l*a)+a+t,0,0,1),this}scale(e,t){const r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this}rotate(e){const t=Math.cos(e),r=Math.sin(e),i=this.elements,s=i[0],o=i[3],a=i[6],l=i[1],A=i[4],c=i[7];return i[0]=t*s+r*l,i[3]=t*o+r*A,i[6]=t*a+r*c,i[1]=-r*s+t*l,i[4]=-r*o+t*A,i[7]=-r*a+t*c,this}translate(e,t){const r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}function AZ(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Qm(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function cu(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function aw(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const n1={[ul]:{[$c]:cu},[$c]:{[ul]:aw}},go={legacyMode:!0,get workingColorSpace(){return $c},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(n1[e]&&n1[e][t]!==void 0){const r=n1[e][t];return n.r=r(n.r),n.g=r(n.g),n.b=r(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},cZ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ur={r:0,g:0,b:0},mo={h:0,s:0,l:0},cv={h:0,s:0,l:0};function r1(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function uv(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class Le{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ul){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,go.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=$c){return this.r=e,this.g=t,this.b=r,go.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=$c){if(e=vU(e,1),t=pr(t,0,1),r=pr(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=r1(o,s,e+1/3),this.g=r1(o,s,e),this.b=r1(o,s,e-1/3)}return go.toWorkingColorSpace(this,i),this}setStyle(e,t=ul){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,go.toWorkingColorSpace(this,t),r(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,go.toWorkingColorSpace(this,t),r(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(s[1])/360,A=parseFloat(s[2])/100,c=parseFloat(s[3])/100;return r(s[4]),this.setHSL(l,A,c,t)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,go.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,go.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=ul){const r=cZ[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=cu(e.r),this.g=cu(e.g),this.b=cu(e.b),this}copyLinearToSRGB(e){return this.r=aw(e.r),this.g=aw(e.g),this.b=aw(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ul){return go.fromWorkingColorSpace(uv(this,ur),e),pr(ur.r*255,0,255)<<16^pr(ur.g*255,0,255)<<8^pr(ur.b*255,0,255)<<0}getHexString(e=ul){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$c){go.fromWorkingColorSpace(uv(this,ur),t);const r=ur.r,i=ur.g,s=ur.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,A;const c=(a+o)/2;if(a===o)l=0,A=0;else{const u=o-a;switch(A=c<=.5?u/(o+a):u/(2-o-a),o){case r:l=(i-s)/u+(i"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{td===void 0&&(td=Qm("canvas")),td.width=e.width,td.height=e.height;const r=td.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=td}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Qm("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o1)switch(this.wrapS){case ps:e.x=e.x-Math.floor(e.x);break;case fi:e.x=e.x<0?0:1;break;case _m:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ps:e.y=e.y-Math.floor(e.y);break;case fi:e.y=e.y<0?0:1;break;case _m:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}or.DEFAULT_IMAGE=null;or.DEFAULT_MAPPING=sZ;class Dt{constructor(e=0,t=0,r=0,i=1){Dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,A=l[0],c=l[4],u=l[8],h=l[1],d=l[5],p=l[9],f=l[2],g=l[6],m=l[10];if(Math.abs(c-h)<.01&&Math.abs(u-f)<.01&&Math.abs(p-g)<.01){if(Math.abs(c+h)<.1&&Math.abs(u+f)<.1&&Math.abs(p+g)<.1&&Math.abs(A+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(A+1)/2,B=(d+1)/2,C=(m+1)/2,b=(c+h)/4,F=(u+f)/4,x=(p+g)/4;return w>B&&w>C?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=b/r,s=F/r):B>C?B<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(B),r=b/i,s=x/i):C<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(C),r=F/s,i=x/s),this.set(r,i,s,t),this}let v=Math.sqrt((g-p)*(g-p)+(u-f)*(u-f)+(h-c)*(h-c));return Math.abs(v)<.001&&(v=1),this.x=(g-p)/v,this.y=(u-f)/v,this.z=(h-c)/v,this.w=Math.acos((A+d+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Qa extends yc{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Dt(0,0,e,t),this.scissorTest=!1,this.viewport=new Dt(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new or(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:ci,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new yU(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class dZ extends or{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=nr,this.minFilter=nr,this.wrapR=fi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class iq extends or{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=nr,this.minFilter=nr,this.wrapR=fi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rt{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,s,o,a){let l=r[i+0],A=r[i+1],c=r[i+2],u=r[i+3];const h=s[o+0],d=s[o+1],p=s[o+2],f=s[o+3];if(a===0){e[t+0]=l,e[t+1]=A,e[t+2]=c,e[t+3]=u;return}if(a===1){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(u!==f||l!==h||A!==d||c!==p){let g=1-a;const m=l*h+A*d+c*p+u*f,v=m>=0?1:-1,w=1-m*m;if(w>Number.EPSILON){const C=Math.sqrt(w),b=Math.atan2(C,m*v);g=Math.sin(g*b)/C,a=Math.sin(a*b)/C}const B=a*v;if(l=l*g+h*B,A=A*g+d*B,c=c*g+p*B,u=u*g+f*B,g===1-a){const C=1/Math.sqrt(l*l+A*A+c*c+u*u);l*=C,A*=C,c*=C,u*=C}}e[t]=l,e[t+1]=A,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],A=r[i+2],c=r[i+3],u=s[o],h=s[o+1],d=s[o+2],p=s[o+3];return e[t]=a*p+c*u+l*d-A*h,e[t+1]=l*p+c*h+A*u-a*d,e[t+2]=A*p+c*d+a*h-l*u,e[t+3]=c*p-a*u-l*h-A*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,A=a(r/2),c=a(i/2),u=a(s/2),h=l(r/2),d=l(i/2),p=l(s/2);switch(o){case"XYZ":this._x=h*c*u+A*d*p,this._y=A*d*u-h*c*p,this._z=A*c*p+h*d*u,this._w=A*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+A*d*p,this._y=A*d*u-h*c*p,this._z=A*c*p-h*d*u,this._w=A*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-A*d*p,this._y=A*d*u+h*c*p,this._z=A*c*p+h*d*u,this._w=A*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-A*d*p,this._y=A*d*u+h*c*p,this._z=A*c*p-h*d*u,this._w=A*c*u+h*d*p;break;case"YZX":this._x=h*c*u+A*d*p,this._y=A*d*u+h*c*p,this._z=A*c*p-h*d*u,this._w=A*c*u-h*d*p;break;case"XZY":this._x=h*c*u-A*d*p,this._y=A*d*u-h*c*p,this._z=A*c*p+h*d*u,this._w=A*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],A=t[2],c=t[6],u=t[10],h=r+a+u;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(c-l)*d,this._y=(s-A)*d,this._z=(o-i)*d}else if(r>a&&r>u){const d=2*Math.sqrt(1+r-a-u);this._w=(c-l)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+A)/d}else if(a>u){const d=2*Math.sqrt(1+a-r-u);this._w=(s-A)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(l+c)/d}else{const d=2*Math.sqrt(1+u-r-a);this._w=(o-i)/d,this._x=(s+A)/d,this._y=(l+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(pr(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,A=t._z,c=t._w;return this._x=r*c+o*a+i*A-s*l,this._y=i*c+o*l+s*a-r*A,this._z=s*c+o*A+r*l-i*a,this._w=o*c-r*a-i*l-s*A,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*r+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const A=Math.sqrt(l),c=Math.atan2(A,a),u=Math.sin((1-t)*c)/A,h=Math.sin(t*c)/A;return this._w=o*u+this._w*h,this._x=r*u+this._x*h,this._y=i*u+this._y*h,this._z=s*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(s),r*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class j{constructor(e=0,t=0,r=0){j.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(wT.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(wT.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,A=l*t+o*i-a*r,c=l*r+a*t-s*i,u=l*i+s*r-o*t,h=-s*t-o*r-a*i;return this.x=A*l+h*-s+c*-a-u*-o,this.y=c*l+h*-o+u*-s-A*-a,this.z=u*l+h*-a+A*-o-c*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return s1.copy(this).projectOnVector(e),this.sub(s1)}reflect(e){return this.sub(s1.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(pr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const s1=new j,wT=new rt;class Cs{constructor(e=new j(1/0,1/0,1/0),t=new j(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,r=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,A=e.length;ls&&(s=c),u>o&&(o=u),h>a&&(a=h)}return this.min.set(t,r,i),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,r=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,A=e.count;ls&&(s=c),u>o&&(o=u),h>a&&(a=h)}return this.min.set(t,r,i),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ec),Ec.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ep),dv.subVectors(this.max,Ep),nd.subVectors(e.a,Ep),rd.subVectors(e.b,Ep),id.subVectors(e.c,Ep),tA.subVectors(rd,nd),nA.subVectors(id,rd),_c.subVectors(nd,id);let t=[0,-tA.z,tA.y,0,-nA.z,nA.y,0,-_c.z,_c.y,tA.z,0,-tA.x,nA.z,0,-nA.x,_c.z,0,-_c.x,-tA.y,tA.x,0,-nA.y,nA.x,0,-_c.y,_c.x,0];return!a1(t,nd,rd,id,dv)||(t=[1,0,0,0,1,0,0,0,1],!a1(t,nd,rd,id,dv))?!1:(hv.crossVectors(tA,nA),t=[hv.x,hv.y,hv.z],a1(t,nd,rd,id,dv))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ec.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Ec).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ja[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ja[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ja[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ja[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ja[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ja[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ja[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ja[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ja),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Ja=[new j,new j,new j,new j,new j,new j,new j,new j],Ec=new j,o1=new Cs,nd=new j,rd=new j,id=new j,tA=new j,nA=new j,_c=new j,Ep=new j,dv=new j,hv=new j,Sc=new j;function a1(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Sc.fromArray(n,s);const a=i.x*Math.abs(Sc.x)+i.y*Math.abs(Sc.y)+i.z*Math.abs(Sc.z),l=e.dot(Sc),A=t.dot(Sc),c=r.dot(Sc);if(Math.max(-Math.max(l,A,c),Math.min(l,A,c))>a)return!1}return!0}const sq=new Cs,_p=new j,l1=new j;class ku{constructor(e=new j,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):sq.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;_p.subVectors(e,this.center);const t=_p.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(_p,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(l1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_p.copy(e.center).add(l1)),this.expandByPoint(_p.copy(e.center).sub(l1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ha=new j,A1=new j,fv=new j,rA=new j,c1=new j,pv=new j,u1=new j;class u0{constructor(e=new j,t=new j(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ha)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ha.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ha.copy(this.direction).multiplyScalar(t).add(this.origin),Ha.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){A1.copy(e).add(t).multiplyScalar(.5),fv.copy(t).sub(e).normalize(),rA.copy(this.origin).sub(A1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(fv),a=rA.dot(this.direction),l=-rA.dot(fv),A=rA.lengthSq(),c=Math.abs(1-o*o);let u,h,d,p;if(c>0)if(u=o*l-a,h=o*a-l,p=s*c,u>=0)if(h>=-p)if(h<=p){const f=1/c;u*=f,h*=f,d=u*(u+o*h+2*a)+h*(o*u+h+2*l)+A}else h=s,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*l)+A;else h=-s,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*l)+A;else h<=-p?(u=Math.max(0,-(-o*s+a)),h=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+h*(h+2*l)+A):h<=p?(u=0,h=Math.min(Math.max(-s,-l),s),d=h*(h+2*l)+A):(u=Math.max(0,-(o*s+a)),h=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+h*(h+2*l)+A);else h=o>0?-s:s,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*l)+A;return r&&r.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(fv).multiplyScalar(h).add(A1),d}intersectSphere(e,t){Ha.subVectors(e.center,this.origin);const r=Ha.dot(this.direction),i=Ha.dot(Ha)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return a<0&&l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const A=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return A>=0?(r=(e.min.x-h.x)*A,i=(e.max.x-h.x)*A):(r=(e.max.x-h.x)*A,i=(e.min.x-h.x)*A),c>=0?(s=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(s=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-h.z)*u,l=(e.max.z-h.z)*u):(a=(e.max.z-h.z)*u,l=(e.min.z-h.z)*u),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,Ha)!==null}intersectTriangle(e,t,r,i,s){c1.subVectors(t,e),pv.subVectors(r,e),u1.crossVectors(c1,pv);let o=this.direction.dot(u1),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;rA.subVectors(this.origin,e);const l=a*this.direction.dot(pv.crossVectors(rA,pv));if(l<0)return null;const A=a*this.direction.dot(c1.cross(rA));if(A<0||l+A>o)return null;const c=-a*rA.dot(u1);return c<0?null:this.at(c/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class He{constructor(){He.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,i,s,o,a,l,A,c,u,h,d,p,f,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=r,m[12]=i,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=A,m[6]=c,m[10]=u,m[14]=h,m[3]=d,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new He().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/sd.setFromMatrixColumn(e,0).length(),s=1/sd.setFromMatrixColumn(e,1).length(),o=1/sd.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),A=Math.sin(i),c=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const h=o*c,d=o*u,p=a*c,f=a*u;t[0]=l*c,t[4]=-l*u,t[8]=A,t[1]=d+p*A,t[5]=h-f*A,t[9]=-a*l,t[2]=f-h*A,t[6]=p+d*A,t[10]=o*l}else if(e.order==="YXZ"){const h=l*c,d=l*u,p=A*c,f=A*u;t[0]=h+f*a,t[4]=p*a-d,t[8]=o*A,t[1]=o*u,t[5]=o*c,t[9]=-a,t[2]=d*a-p,t[6]=f+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*c,d=l*u,p=A*c,f=A*u;t[0]=h-f*a,t[4]=-o*u,t[8]=p+d*a,t[1]=d+p*a,t[5]=o*c,t[9]=f-h*a,t[2]=-o*A,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*c,d=o*u,p=a*c,f=a*u;t[0]=l*c,t[4]=p*A-d,t[8]=h*A+f,t[1]=l*u,t[5]=f*A+h,t[9]=d*A-p,t[2]=-A,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,d=o*A,p=a*l,f=a*A;t[0]=l*c,t[4]=f-h*u,t[8]=p*u+d,t[1]=u,t[5]=o*c,t[9]=-a*c,t[2]=-A*c,t[6]=d*u+p,t[10]=h-f*u}else if(e.order==="XZY"){const h=o*l,d=o*A,p=a*l,f=a*A;t[0]=l*c,t[4]=-u,t[8]=A*c,t[1]=h*u+f,t[5]=o*c,t[9]=d*u-p,t[2]=p*u-d,t[6]=a*c,t[10]=f*u+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(oq,e,aq)}lookAt(e,t,r){const i=this.elements;return Gi.subVectors(e,t),Gi.lengthSq()===0&&(Gi.z=1),Gi.normalize(),iA.crossVectors(r,Gi),iA.lengthSq()===0&&(Math.abs(r.z)===1?Gi.x+=1e-4:Gi.z+=1e-4,Gi.normalize(),iA.crossVectors(r,Gi)),iA.normalize(),gv.crossVectors(Gi,iA),i[0]=iA.x,i[4]=gv.x,i[8]=Gi.x,i[1]=iA.y,i[5]=gv.y,i[9]=Gi.y,i[2]=iA.z,i[6]=gv.z,i[10]=Gi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],A=r[12],c=r[1],u=r[5],h=r[9],d=r[13],p=r[2],f=r[6],g=r[10],m=r[14],v=r[3],w=r[7],B=r[11],C=r[15],b=i[0],F=i[4],x=i[8],_=i[12],M=i[1],Y=i[5],O=i[9],U=i[13],y=i[2],I=i[6],R=i[10],N=i[14],k=i[3],V=i[7],G=i[11],D=i[15];return s[0]=o*b+a*M+l*y+A*k,s[4]=o*F+a*Y+l*I+A*V,s[8]=o*x+a*O+l*R+A*G,s[12]=o*_+a*U+l*N+A*D,s[1]=c*b+u*M+h*y+d*k,s[5]=c*F+u*Y+h*I+d*V,s[9]=c*x+u*O+h*R+d*G,s[13]=c*_+u*U+h*N+d*D,s[2]=p*b+f*M+g*y+m*k,s[6]=p*F+f*Y+g*I+m*V,s[10]=p*x+f*O+g*R+m*G,s[14]=p*_+f*U+g*N+m*D,s[3]=v*b+w*M+B*y+C*k,s[7]=v*F+w*Y+B*I+C*V,s[11]=v*x+w*O+B*R+C*G,s[15]=v*_+w*U+B*N+C*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],A=e[13],c=e[2],u=e[6],h=e[10],d=e[14],p=e[3],f=e[7],g=e[11],m=e[15];return p*(+s*l*u-i*A*u-s*a*h+r*A*h+i*a*d-r*l*d)+f*(+t*l*d-t*A*h+s*o*h-i*o*d+i*A*c-s*l*c)+g*(+t*A*u-t*a*d-s*o*u+r*o*d+s*a*c-r*A*c)+m*(-i*a*c-t*l*u+t*a*h+i*o*u-r*o*h+r*l*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],A=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],g=e[14],m=e[15],v=u*g*A-f*h*A+f*l*d-a*g*d-u*l*m+a*h*m,w=p*h*A-c*g*A-p*l*d+o*g*d+c*l*m-o*h*m,B=c*f*A-p*u*A+p*a*d-o*f*d-c*a*m+o*u*m,C=p*u*l-c*f*l-p*a*h+o*f*h+c*a*g-o*u*g,b=t*v+r*w+i*B+s*C;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const F=1/b;return e[0]=v*F,e[1]=(f*h*s-u*g*s-f*i*d+r*g*d+u*i*m-r*h*m)*F,e[2]=(a*g*s-f*l*s+f*i*A-r*g*A-a*i*m+r*l*m)*F,e[3]=(u*l*s-a*h*s-u*i*A+r*h*A+a*i*d-r*l*d)*F,e[4]=w*F,e[5]=(c*g*s-p*h*s+p*i*d-t*g*d-c*i*m+t*h*m)*F,e[6]=(p*l*s-o*g*s-p*i*A+t*g*A+o*i*m-t*l*m)*F,e[7]=(o*h*s-c*l*s+c*i*A-t*h*A-o*i*d+t*l*d)*F,e[8]=B*F,e[9]=(p*u*s-c*f*s-p*r*d+t*f*d+c*r*m-t*u*m)*F,e[10]=(o*f*s-p*a*s+p*r*A-t*f*A-o*r*m+t*a*m)*F,e[11]=(c*a*s-o*u*s-c*r*A+t*u*A+o*r*d-t*a*d)*F,e[12]=C*F,e[13]=(c*f*i-p*u*i+p*r*h-t*f*h-c*r*g+t*u*g)*F,e[14]=(p*a*i-o*f*i-p*r*l+t*f*l+o*r*g-t*a*g)*F,e[15]=(o*u*i-c*a*i+c*r*l-t*u*l-o*r*h+t*a*h)*F,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,A=s*o,c=s*a;return this.set(A*o+r,A*a-i*l,A*l+i*a,0,A*a+i*l,c*a+r,c*l-i*o,0,A*l-i*a,c*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,A=s+s,c=o+o,u=a+a,h=s*A,d=s*c,p=s*u,f=o*c,g=o*u,m=a*u,v=l*A,w=l*c,B=l*u,C=r.x,b=r.y,F=r.z;return i[0]=(1-(f+m))*C,i[1]=(d+B)*C,i[2]=(p-w)*C,i[3]=0,i[4]=(d-B)*b,i[5]=(1-(h+m))*b,i[6]=(g+v)*b,i[7]=0,i[8]=(p+w)*F,i[9]=(g-v)*F,i[10]=(1-(h+f))*F,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=sd.set(i[0],i[1],i[2]).length();const o=sd.set(i[4],i[5],i[6]).length(),a=sd.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],vo.copy(this);const A=1/s,c=1/o,u=1/a;return vo.elements[0]*=A,vo.elements[1]*=A,vo.elements[2]*=A,vo.elements[4]*=c,vo.elements[5]*=c,vo.elements[6]*=c,vo.elements[8]*=u,vo.elements[9]*=u,vo.elements[10]*=u,t.setFromRotationMatrix(vo),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o){const a=this.elements,l=2*s/(t-e),A=2*s/(r-i),c=(t+e)/(t-e),u=(r+i)/(r-i),h=-(o+s)/(o-s),d=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=A,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,r,i,s,o){const a=this.elements,l=1/(t-e),A=1/(r-i),c=1/(o-s),u=(t+e)*l,h=(r+i)*A,d=(o+s)*c;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*A,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const sd=new j,vo=new He,oq=new j(0,0,0),aq=new j(1,1,1),iA=new j,gv=new j,Gi=new j,BT=new He,CT=new rt;class $r{constructor(e=0,t=0,r=0,i=$r.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],A=i[5],c=i[9],u=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(pr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,A),this._z=0);break;case"YXZ":this._x=Math.asin(-pr(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,A)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(pr(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,A)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-pr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,A));break;case"YZX":this._z=Math.asin(pr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,A),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-pr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,A),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return BT.makeRotationFromQuaternion(e),this.setFromRotationMatrix(BT,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return CT.setFromEuler(this),this.setFromQuaternion(CT,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}$r.DefaultOrder="XYZ";$r.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class wU{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),A.length>0&&(r.textures=A),c.length>0&&(r.images=c),u.length>0&&(r.shapes=u),h.length>0&&(r.skeletons=h),d.length>0&&(r.animations=d),p.length>0&&(r.nodes=p)}return r.object=i,r;function o(a){const l=[];for(const A in a){const c=a[A];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){yo.subVectors(i,t),Ya.subVectors(r,t),d1.subVectors(e,t);const o=yo.dot(yo),a=yo.dot(Ya),l=yo.dot(d1),A=Ya.dot(Ya),c=Ya.dot(d1),u=o*A-a*a;if(u===0)return s.set(-2,-1,-1);const h=1/u,d=(A*l-a*c)*h,p=(o*c-a*l)*h;return s.set(1-d-p,p,d)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Xa),Xa.x>=0&&Xa.y>=0&&Xa.x+Xa.y<=1}static getUV(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,Xa),l.set(0,0),l.addScaledVector(s,Xa.x),l.addScaledVector(o,Xa.y),l.addScaledVector(a,Xa.z),l}static isFrontFacing(e,t,r,i){return yo.subVectors(r,t),Ya.subVectors(e,t),yo.cross(Ya).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return yo.subVectors(this.c,this.b),Ya.subVectors(this.a,this.b),yo.cross(Ya).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return rs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return rs.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return rs.getUV(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return rs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return rs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;ad.subVectors(i,r),ld.subVectors(s,r),h1.subVectors(e,r);const l=ad.dot(h1),A=ld.dot(h1);if(l<=0&&A<=0)return t.copy(r);f1.subVectors(e,i);const c=ad.dot(f1),u=ld.dot(f1);if(c>=0&&u<=c)return t.copy(i);const h=l*u-c*A;if(h<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(r).addScaledVector(ad,o);p1.subVectors(e,s);const d=ad.dot(p1),p=ld.dot(p1);if(p>=0&&d<=p)return t.copy(s);const f=d*A-l*p;if(f<=0&&A>=0&&p<=0)return a=A/(A-p),t.copy(r).addScaledVector(ld,a);const g=c*p-d*u;if(g<=0&&u-c>=0&&d-p>=0)return _T.subVectors(s,i),a=(u-c)/(u-c+(d-p)),t.copy(i).addScaledVector(_T,a);const m=1/(g+f+h);return o=f*m,a=h*m,t.copy(r).addScaledVector(ad,o).addScaledVector(ld,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let dq=0,us=class extends yc{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:dq++}),this.uuid=No(),this.name="",this.type="Material",this.blending=Zh,this.side=Lo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=rZ,this.blendDst=iZ,this.blendEquation=kd,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=wE,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=W$,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=t1,this.stencilZFail=t1,this.stencilZPass=t1,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Zh&&(r.blending=this.blending),this.side!==Lo&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};class Ri extends us{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=KC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const jn=new j,vv=new Ye;class ut{constructor(e,t,r){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r===!0,this.usage=CE,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const A in l)l[A]!==void 0&&(e[A]=l[A]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const A=r[l];e.data.attributes[l]=A.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const A=this.morphAttributes[l],c=[];for(let u=0,h=A.length;u0&&(i[l]=c,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const A in i){const c=i[A];this.setAttribute(A,c.clone(t))}const s=e.morphAttributes;for(const A in s){const c=[],u=s[A];for(let h=0,d=u.length;h0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;st.far?null:{distance:A,point:Iv.clone(),object:n}}function Fv(n,e,t,r,i,s,o,a,l,A,c,u){sA.fromBufferAttribute(i,A),oA.fromBufferAttribute(i,c),aA.fromBufferAttribute(i,u);const h=n.morphTargetInfluences;if(s&&h){yv.set(0,0,0),wv.set(0,0,0),Bv.set(0,0,0);for(let p=0,f=s.length;p0?1:-1,c.push(V.x,V.y,V.z),u.push(E/F),u.push(1-G/x),N+=1}}for(let G=0;G>8&255]+Hr[n>>16&255]+Hr[n>>24&255]+"-"+Hr[e&255]+Hr[e>>8&255]+"-"+Hr[e>>16&15|64]+Hr[e>>24&255]+"-"+Hr[t&63|128]+Hr[t>>8&255]+"-"+Hr[t>>16&255]+Hr[t>>24&255]+Hr[r&255]+Hr[r>>8&255]+Hr[r>>16&255]+Hr[r>>24&255]).toLowerCase()}function pr(n,e,t){return Math.max(e,Math.min(t,n))}function vU(n,e){return(n%e+e)%e}function Z$(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function J$(n,e,t){return n!==e?(t-n)/(e-n):0}function Hg(n,e,t){return(1-t)*n+t*e}function H$(n,e,t,r){return Hg(n,e,1-Math.exp(-t*r))}function z$(n,e=1){return e-Math.abs(vU(n,e*2)-e)}function Y$(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function X$(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function j$(n,e){return n+Math.floor(Math.random()*(e-n+1))}function K$(n,e){return n+Math.random()*(e-n)}function $$(n){return n*(.5-Math.random())}function q$(n){n!==void 0&&(yT=n);let e=yT+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function eq(n){return n*Jg}function tq(n){return n*Um}function xE(n){return(n&n-1)===0&&n!==0}function lZ(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function CB(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function nq(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),A=s((e+r)/2),c=o((e+r)/2),u=s((e-r)/2),h=o((e-r)/2),d=s((r-e)/2),p=o((r-e)/2);switch(i){case"XYX":n.set(a*c,l*u,l*h,a*A);break;case"YZY":n.set(l*h,a*c,l*u,a*A);break;case"ZXZ":n.set(l*u,l*h,a*c,a*A);break;case"XZX":n.set(a*c,l*p,l*d,a*A);break;case"YXY":n.set(l*d,a*c,l*p,a*A);break;case"ZYZ":n.set(l*p,l*d,a*c,a*A);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function bl(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function ln(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Wt=Object.freeze({__proto__:null,DEG2RAD:Jg,RAD2DEG:Um,generateUUID:No,clamp:pr,euclideanModulo:vU,mapLinear:Z$,inverseLerp:J$,lerp:Hg,damp:H$,pingpong:z$,smoothstep:Y$,smootherstep:X$,randInt:j$,randFloat:K$,randFloatSpread:$$,seededRandom:q$,degToRad:eq,radToDeg:tq,isPowerOfTwo:xE,ceilPowerOfTwo:lZ,floorPowerOfTwo:CB,setQuaternionFromProperEuler:nq,normalize:ln,denormalize:bl});class Ye{constructor(e=0,t=0){Ye.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ln{constructor(){Ln.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,i,s,o,a,l,A){const c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=r,c[7]=o,c[8]=A,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],A=r[1],c=r[4],u=r[7],h=r[2],d=r[5],p=r[8],f=i[0],g=i[3],m=i[6],v=i[1],w=i[4],B=i[7],C=i[2],b=i[5],F=i[8];return s[0]=o*f+a*v+l*C,s[3]=o*g+a*w+l*b,s[6]=o*m+a*B+l*F,s[1]=A*f+c*v+u*C,s[4]=A*g+c*w+u*b,s[7]=A*m+c*B+u*F,s[2]=h*f+d*v+p*C,s[5]=h*g+d*w+p*b,s[8]=h*m+d*B+p*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],A=e[7],c=e[8];return t*o*c-t*a*A-r*s*c+r*a*l+i*s*A-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],A=e[7],c=e[8],u=c*o-a*A,h=a*l-c*s,d=A*s-o*l,p=t*u+r*h+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=u*f,e[1]=(i*A-c*r)*f,e[2]=(a*r-i*o)*f,e[3]=h*f,e[4]=(c*t-i*l)*f,e[5]=(i*s-a*t)*f,e[6]=d*f,e[7]=(r*l-A*t)*f,e[8]=(o*t-r*s)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),A=Math.sin(s);return this.set(r*l,r*A,-r*(l*o+A*a)+o+e,-i*A,i*l,-i*(-A*o+l*a)+a+t,0,0,1),this}scale(e,t){const r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this}rotate(e){const t=Math.cos(e),r=Math.sin(e),i=this.elements,s=i[0],o=i[3],a=i[6],l=i[1],A=i[4],c=i[7];return i[0]=t*s+r*l,i[3]=t*o+r*A,i[6]=t*a+r*c,i[1]=-r*s+t*l,i[4]=-r*o+t*A,i[7]=-r*a+t*c,this}translate(e,t){const r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}function AZ(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Qm(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function cu(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function aw(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const n1={[ul]:{[$c]:cu},[$c]:{[ul]:aw}},go={legacyMode:!0,get workingColorSpace(){return $c},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(n1[e]&&n1[e][t]!==void 0){const r=n1[e][t];return n.r=r(n.r),n.g=r(n.g),n.b=r(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},cZ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ur={r:0,g:0,b:0},mo={h:0,s:0,l:0},cv={h:0,s:0,l:0};function r1(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function uv(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class Le{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ul){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,go.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=$c){return this.r=e,this.g=t,this.b=r,go.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=$c){if(e=vU(e,1),t=pr(t,0,1),r=pr(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=r1(o,s,e+1/3),this.g=r1(o,s,e),this.b=r1(o,s,e-1/3)}return go.toWorkingColorSpace(this,i),this}setStyle(e,t=ul){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,go.toWorkingColorSpace(this,t),r(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,go.toWorkingColorSpace(this,t),r(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(s[1])/360,A=parseFloat(s[2])/100,c=parseFloat(s[3])/100;return r(s[4]),this.setHSL(l,A,c,t)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,go.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,go.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=ul){const r=cZ[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=cu(e.r),this.g=cu(e.g),this.b=cu(e.b),this}copyLinearToSRGB(e){return this.r=aw(e.r),this.g=aw(e.g),this.b=aw(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ul){return go.fromWorkingColorSpace(uv(this,ur),e),pr(ur.r*255,0,255)<<16^pr(ur.g*255,0,255)<<8^pr(ur.b*255,0,255)<<0}getHexString(e=ul){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$c){go.fromWorkingColorSpace(uv(this,ur),t);const r=ur.r,i=ur.g,s=ur.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,A;const c=(a+o)/2;if(a===o)l=0,A=0;else{const u=o-a;switch(A=c<=.5?u/(o+a):u/(2-o-a),o){case r:l=(i-s)/u+(i"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{td===void 0&&(td=Qm("canvas")),td.width=e.width,td.height=e.height;const r=td.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=td}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Qm("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o1)switch(this.wrapS){case ps:e.x=e.x-Math.floor(e.x);break;case fi:e.x=e.x<0?0:1;break;case _m:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ps:e.y=e.y-Math.floor(e.y);break;case fi:e.y=e.y<0?0:1;break;case _m:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}or.DEFAULT_IMAGE=null;or.DEFAULT_MAPPING=sZ;class Dt{constructor(e=0,t=0,r=0,i=1){Dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,A=l[0],c=l[4],u=l[8],h=l[1],d=l[5],p=l[9],f=l[2],g=l[6],m=l[10];if(Math.abs(c-h)<.01&&Math.abs(u-f)<.01&&Math.abs(p-g)<.01){if(Math.abs(c+h)<.1&&Math.abs(u+f)<.1&&Math.abs(p+g)<.1&&Math.abs(A+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(A+1)/2,B=(d+1)/2,C=(m+1)/2,b=(c+h)/4,F=(u+f)/4,x=(p+g)/4;return w>B&&w>C?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=b/r,s=F/r):B>C?B<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(B),r=b/i,s=x/i):C<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(C),r=F/s,i=x/s),this.set(r,i,s,t),this}let v=Math.sqrt((g-p)*(g-p)+(u-f)*(u-f)+(h-c)*(h-c));return Math.abs(v)<.001&&(v=1),this.x=(g-p)/v,this.y=(u-f)/v,this.z=(h-c)/v,this.w=Math.acos((A+d+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Qa extends yc{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Dt(0,0,e,t),this.scissorTest=!1,this.viewport=new Dt(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new or(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:ci,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new yU(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class dZ extends or{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=nr,this.minFilter=nr,this.wrapR=fi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class iq extends or{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=nr,this.minFilter=nr,this.wrapR=fi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rt{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,s,o,a){let l=r[i+0],A=r[i+1],c=r[i+2],u=r[i+3];const h=s[o+0],d=s[o+1],p=s[o+2],f=s[o+3];if(a===0){e[t+0]=l,e[t+1]=A,e[t+2]=c,e[t+3]=u;return}if(a===1){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(u!==f||l!==h||A!==d||c!==p){let g=1-a;const m=l*h+A*d+c*p+u*f,v=m>=0?1:-1,w=1-m*m;if(w>Number.EPSILON){const C=Math.sqrt(w),b=Math.atan2(C,m*v);g=Math.sin(g*b)/C,a=Math.sin(a*b)/C}const B=a*v;if(l=l*g+h*B,A=A*g+d*B,c=c*g+p*B,u=u*g+f*B,g===1-a){const C=1/Math.sqrt(l*l+A*A+c*c+u*u);l*=C,A*=C,c*=C,u*=C}}e[t]=l,e[t+1]=A,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],A=r[i+2],c=r[i+3],u=s[o],h=s[o+1],d=s[o+2],p=s[o+3];return e[t]=a*p+c*u+l*d-A*h,e[t+1]=l*p+c*h+A*u-a*d,e[t+2]=A*p+c*d+a*h-l*u,e[t+3]=c*p-a*u-l*h-A*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,A=a(r/2),c=a(i/2),u=a(s/2),h=l(r/2),d=l(i/2),p=l(s/2);switch(o){case"XYZ":this._x=h*c*u+A*d*p,this._y=A*d*u-h*c*p,this._z=A*c*p+h*d*u,this._w=A*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+A*d*p,this._y=A*d*u-h*c*p,this._z=A*c*p-h*d*u,this._w=A*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-A*d*p,this._y=A*d*u+h*c*p,this._z=A*c*p+h*d*u,this._w=A*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-A*d*p,this._y=A*d*u+h*c*p,this._z=A*c*p-h*d*u,this._w=A*c*u+h*d*p;break;case"YZX":this._x=h*c*u+A*d*p,this._y=A*d*u+h*c*p,this._z=A*c*p-h*d*u,this._w=A*c*u-h*d*p;break;case"XZY":this._x=h*c*u-A*d*p,this._y=A*d*u-h*c*p,this._z=A*c*p+h*d*u,this._w=A*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],A=t[2],c=t[6],u=t[10],h=r+a+u;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(c-l)*d,this._y=(s-A)*d,this._z=(o-i)*d}else if(r>a&&r>u){const d=2*Math.sqrt(1+r-a-u);this._w=(c-l)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+A)/d}else if(a>u){const d=2*Math.sqrt(1+a-r-u);this._w=(s-A)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(l+c)/d}else{const d=2*Math.sqrt(1+u-r-a);this._w=(o-i)/d,this._x=(s+A)/d,this._y=(l+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(pr(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,A=t._z,c=t._w;return this._x=r*c+o*a+i*A-s*l,this._y=i*c+o*l+s*a-r*A,this._z=s*c+o*A+r*l-i*a,this._w=o*c-r*a-i*l-s*A,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*r+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const A=Math.sqrt(l),c=Math.atan2(A,a),u=Math.sin((1-t)*c)/A,h=Math.sin(t*c)/A;return this._w=o*u+this._w*h,this._x=r*u+this._x*h,this._y=i*u+this._y*h,this._z=s*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(s),r*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class j{constructor(e=0,t=0,r=0){j.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(wT.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(wT.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,A=l*t+o*i-a*r,c=l*r+a*t-s*i,u=l*i+s*r-o*t,h=-s*t-o*r-a*i;return this.x=A*l+h*-s+c*-a-u*-o,this.y=c*l+h*-o+u*-s-A*-a,this.z=u*l+h*-a+A*-o-c*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return s1.copy(this).projectOnVector(e),this.sub(s1)}reflect(e){return this.sub(s1.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(pr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const s1=new j,wT=new rt;class Cs{constructor(e=new j(1/0,1/0,1/0),t=new j(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,r=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,A=e.length;ls&&(s=c),u>o&&(o=u),h>a&&(a=h)}return this.min.set(t,r,i),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,r=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,A=e.count;ls&&(s=c),u>o&&(o=u),h>a&&(a=h)}return this.min.set(t,r,i),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ec),Ec.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ep),dv.subVectors(this.max,Ep),nd.subVectors(e.a,Ep),rd.subVectors(e.b,Ep),id.subVectors(e.c,Ep),tA.subVectors(rd,nd),nA.subVectors(id,rd),_c.subVectors(nd,id);let t=[0,-tA.z,tA.y,0,-nA.z,nA.y,0,-_c.z,_c.y,tA.z,0,-tA.x,nA.z,0,-nA.x,_c.z,0,-_c.x,-tA.y,tA.x,0,-nA.y,nA.x,0,-_c.y,_c.x,0];return!a1(t,nd,rd,id,dv)||(t=[1,0,0,0,1,0,0,0,1],!a1(t,nd,rd,id,dv))?!1:(hv.crossVectors(tA,nA),t=[hv.x,hv.y,hv.z],a1(t,nd,rd,id,dv))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ec.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Ec).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ja[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ja[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ja[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ja[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ja[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ja[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ja[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ja[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ja),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Ja=[new j,new j,new j,new j,new j,new j,new j,new j],Ec=new j,o1=new Cs,nd=new j,rd=new j,id=new j,tA=new j,nA=new j,_c=new j,Ep=new j,dv=new j,hv=new j,Sc=new j;function a1(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Sc.fromArray(n,s);const a=i.x*Math.abs(Sc.x)+i.y*Math.abs(Sc.y)+i.z*Math.abs(Sc.z),l=e.dot(Sc),A=t.dot(Sc),c=r.dot(Sc);if(Math.max(-Math.max(l,A,c),Math.min(l,A,c))>a)return!1}return!0}const sq=new Cs,_p=new j,l1=new j;class ku{constructor(e=new j,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):sq.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;_p.subVectors(e,this.center);const t=_p.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(_p,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(l1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_p.copy(e.center).add(l1)),this.expandByPoint(_p.copy(e.center).sub(l1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ha=new j,A1=new j,fv=new j,rA=new j,c1=new j,pv=new j,u1=new j;class u0{constructor(e=new j,t=new j(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ha)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ha.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ha.copy(this.direction).multiplyScalar(t).add(this.origin),Ha.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){A1.copy(e).add(t).multiplyScalar(.5),fv.copy(t).sub(e).normalize(),rA.copy(this.origin).sub(A1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(fv),a=rA.dot(this.direction),l=-rA.dot(fv),A=rA.lengthSq(),c=Math.abs(1-o*o);let u,h,d,p;if(c>0)if(u=o*l-a,h=o*a-l,p=s*c,u>=0)if(h>=-p)if(h<=p){const f=1/c;u*=f,h*=f,d=u*(u+o*h+2*a)+h*(o*u+h+2*l)+A}else h=s,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*l)+A;else h=-s,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*l)+A;else h<=-p?(u=Math.max(0,-(-o*s+a)),h=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+h*(h+2*l)+A):h<=p?(u=0,h=Math.min(Math.max(-s,-l),s),d=h*(h+2*l)+A):(u=Math.max(0,-(o*s+a)),h=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+h*(h+2*l)+A);else h=o>0?-s:s,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*l)+A;return r&&r.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(fv).multiplyScalar(h).add(A1),d}intersectSphere(e,t){Ha.subVectors(e.center,this.origin);const r=Ha.dot(this.direction),i=Ha.dot(Ha)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return a<0&&l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const A=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return A>=0?(r=(e.min.x-h.x)*A,i=(e.max.x-h.x)*A):(r=(e.max.x-h.x)*A,i=(e.min.x-h.x)*A),c>=0?(s=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(s=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-h.z)*u,l=(e.max.z-h.z)*u):(a=(e.max.z-h.z)*u,l=(e.min.z-h.z)*u),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,Ha)!==null}intersectTriangle(e,t,r,i,s){c1.subVectors(t,e),pv.subVectors(r,e),u1.crossVectors(c1,pv);let o=this.direction.dot(u1),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;rA.subVectors(this.origin,e);const l=a*this.direction.dot(pv.crossVectors(rA,pv));if(l<0)return null;const A=a*this.direction.dot(c1.cross(rA));if(A<0||l+A>o)return null;const c=-a*rA.dot(u1);return c<0?null:this.at(c/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class He{constructor(){He.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,i,s,o,a,l,A,c,u,h,d,p,f,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=r,m[12]=i,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=A,m[6]=c,m[10]=u,m[14]=h,m[3]=d,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new He().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/sd.setFromMatrixColumn(e,0).length(),s=1/sd.setFromMatrixColumn(e,1).length(),o=1/sd.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),A=Math.sin(i),c=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const h=o*c,d=o*u,p=a*c,f=a*u;t[0]=l*c,t[4]=-l*u,t[8]=A,t[1]=d+p*A,t[5]=h-f*A,t[9]=-a*l,t[2]=f-h*A,t[6]=p+d*A,t[10]=o*l}else if(e.order==="YXZ"){const h=l*c,d=l*u,p=A*c,f=A*u;t[0]=h+f*a,t[4]=p*a-d,t[8]=o*A,t[1]=o*u,t[5]=o*c,t[9]=-a,t[2]=d*a-p,t[6]=f+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*c,d=l*u,p=A*c,f=A*u;t[0]=h-f*a,t[4]=-o*u,t[8]=p+d*a,t[1]=d+p*a,t[5]=o*c,t[9]=f-h*a,t[2]=-o*A,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*c,d=o*u,p=a*c,f=a*u;t[0]=l*c,t[4]=p*A-d,t[8]=h*A+f,t[1]=l*u,t[5]=f*A+h,t[9]=d*A-p,t[2]=-A,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,d=o*A,p=a*l,f=a*A;t[0]=l*c,t[4]=f-h*u,t[8]=p*u+d,t[1]=u,t[5]=o*c,t[9]=-a*c,t[2]=-A*c,t[6]=d*u+p,t[10]=h-f*u}else if(e.order==="XZY"){const h=o*l,d=o*A,p=a*l,f=a*A;t[0]=l*c,t[4]=-u,t[8]=A*c,t[1]=h*u+f,t[5]=o*c,t[9]=d*u-p,t[2]=p*u-d,t[6]=a*c,t[10]=f*u+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(oq,e,aq)}lookAt(e,t,r){const i=this.elements;return Gi.subVectors(e,t),Gi.lengthSq()===0&&(Gi.z=1),Gi.normalize(),iA.crossVectors(r,Gi),iA.lengthSq()===0&&(Math.abs(r.z)===1?Gi.x+=1e-4:Gi.z+=1e-4,Gi.normalize(),iA.crossVectors(r,Gi)),iA.normalize(),gv.crossVectors(Gi,iA),i[0]=iA.x,i[4]=gv.x,i[8]=Gi.x,i[1]=iA.y,i[5]=gv.y,i[9]=Gi.y,i[2]=iA.z,i[6]=gv.z,i[10]=Gi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],A=r[12],c=r[1],u=r[5],h=r[9],d=r[13],p=r[2],f=r[6],g=r[10],m=r[14],v=r[3],w=r[7],B=r[11],C=r[15],b=i[0],F=i[4],x=i[8],_=i[12],M=i[1],Y=i[5],O=i[9],U=i[13],y=i[2],I=i[6],R=i[10],N=i[14],k=i[3],L=i[7],G=i[11],D=i[15];return s[0]=o*b+a*M+l*y+A*k,s[4]=o*F+a*Y+l*I+A*L,s[8]=o*x+a*O+l*R+A*G,s[12]=o*_+a*U+l*N+A*D,s[1]=c*b+u*M+h*y+d*k,s[5]=c*F+u*Y+h*I+d*L,s[9]=c*x+u*O+h*R+d*G,s[13]=c*_+u*U+h*N+d*D,s[2]=p*b+f*M+g*y+m*k,s[6]=p*F+f*Y+g*I+m*L,s[10]=p*x+f*O+g*R+m*G,s[14]=p*_+f*U+g*N+m*D,s[3]=v*b+w*M+B*y+C*k,s[7]=v*F+w*Y+B*I+C*L,s[11]=v*x+w*O+B*R+C*G,s[15]=v*_+w*U+B*N+C*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],A=e[13],c=e[2],u=e[6],h=e[10],d=e[14],p=e[3],f=e[7],g=e[11],m=e[15];return p*(+s*l*u-i*A*u-s*a*h+r*A*h+i*a*d-r*l*d)+f*(+t*l*d-t*A*h+s*o*h-i*o*d+i*A*c-s*l*c)+g*(+t*A*u-t*a*d-s*o*u+r*o*d+s*a*c-r*A*c)+m*(-i*a*c-t*l*u+t*a*h+i*o*u-r*o*h+r*l*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],A=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],g=e[14],m=e[15],v=u*g*A-f*h*A+f*l*d-a*g*d-u*l*m+a*h*m,w=p*h*A-c*g*A-p*l*d+o*g*d+c*l*m-o*h*m,B=c*f*A-p*u*A+p*a*d-o*f*d-c*a*m+o*u*m,C=p*u*l-c*f*l-p*a*h+o*f*h+c*a*g-o*u*g,b=t*v+r*w+i*B+s*C;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const F=1/b;return e[0]=v*F,e[1]=(f*h*s-u*g*s-f*i*d+r*g*d+u*i*m-r*h*m)*F,e[2]=(a*g*s-f*l*s+f*i*A-r*g*A-a*i*m+r*l*m)*F,e[3]=(u*l*s-a*h*s-u*i*A+r*h*A+a*i*d-r*l*d)*F,e[4]=w*F,e[5]=(c*g*s-p*h*s+p*i*d-t*g*d-c*i*m+t*h*m)*F,e[6]=(p*l*s-o*g*s-p*i*A+t*g*A+o*i*m-t*l*m)*F,e[7]=(o*h*s-c*l*s+c*i*A-t*h*A-o*i*d+t*l*d)*F,e[8]=B*F,e[9]=(p*u*s-c*f*s-p*r*d+t*f*d+c*r*m-t*u*m)*F,e[10]=(o*f*s-p*a*s+p*r*A-t*f*A-o*r*m+t*a*m)*F,e[11]=(c*a*s-o*u*s-c*r*A+t*u*A+o*r*d-t*a*d)*F,e[12]=C*F,e[13]=(c*f*i-p*u*i+p*r*h-t*f*h-c*r*g+t*u*g)*F,e[14]=(p*a*i-o*f*i-p*r*l+t*f*l+o*r*g-t*a*g)*F,e[15]=(o*u*i-c*a*i+c*r*l-t*u*l-o*r*h+t*a*h)*F,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,A=s*o,c=s*a;return this.set(A*o+r,A*a-i*l,A*l+i*a,0,A*a+i*l,c*a+r,c*l-i*o,0,A*l-i*a,c*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,A=s+s,c=o+o,u=a+a,h=s*A,d=s*c,p=s*u,f=o*c,g=o*u,m=a*u,v=l*A,w=l*c,B=l*u,C=r.x,b=r.y,F=r.z;return i[0]=(1-(f+m))*C,i[1]=(d+B)*C,i[2]=(p-w)*C,i[3]=0,i[4]=(d-B)*b,i[5]=(1-(h+m))*b,i[6]=(g+v)*b,i[7]=0,i[8]=(p+w)*F,i[9]=(g-v)*F,i[10]=(1-(h+f))*F,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=sd.set(i[0],i[1],i[2]).length();const o=sd.set(i[4],i[5],i[6]).length(),a=sd.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],vo.copy(this);const A=1/s,c=1/o,u=1/a;return vo.elements[0]*=A,vo.elements[1]*=A,vo.elements[2]*=A,vo.elements[4]*=c,vo.elements[5]*=c,vo.elements[6]*=c,vo.elements[8]*=u,vo.elements[9]*=u,vo.elements[10]*=u,t.setFromRotationMatrix(vo),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o){const a=this.elements,l=2*s/(t-e),A=2*s/(r-i),c=(t+e)/(t-e),u=(r+i)/(r-i),h=-(o+s)/(o-s),d=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=A,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,r,i,s,o){const a=this.elements,l=1/(t-e),A=1/(r-i),c=1/(o-s),u=(t+e)*l,h=(r+i)*A,d=(o+s)*c;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*A,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const sd=new j,vo=new He,oq=new j(0,0,0),aq=new j(1,1,1),iA=new j,gv=new j,Gi=new j,BT=new He,CT=new rt;class $r{constructor(e=0,t=0,r=0,i=$r.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],A=i[5],c=i[9],u=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(pr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,A),this._z=0);break;case"YXZ":this._x=Math.asin(-pr(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,A)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(pr(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,A)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-pr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,A));break;case"YZX":this._z=Math.asin(pr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,A),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-pr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,A),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return BT.makeRotationFromQuaternion(e),this.setFromRotationMatrix(BT,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return CT.setFromEuler(this),this.setFromQuaternion(CT,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}$r.DefaultOrder="XYZ";$r.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class wU{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),A.length>0&&(r.textures=A),c.length>0&&(r.images=c),u.length>0&&(r.shapes=u),h.length>0&&(r.skeletons=h),d.length>0&&(r.animations=d),p.length>0&&(r.nodes=p)}return r.object=i,r;function o(a){const l=[];for(const A in a){const c=a[A];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){yo.subVectors(i,t),Ya.subVectors(r,t),d1.subVectors(e,t);const o=yo.dot(yo),a=yo.dot(Ya),l=yo.dot(d1),A=Ya.dot(Ya),c=Ya.dot(d1),u=o*A-a*a;if(u===0)return s.set(-2,-1,-1);const h=1/u,d=(A*l-a*c)*h,p=(o*c-a*l)*h;return s.set(1-d-p,p,d)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Xa),Xa.x>=0&&Xa.y>=0&&Xa.x+Xa.y<=1}static getUV(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,Xa),l.set(0,0),l.addScaledVector(s,Xa.x),l.addScaledVector(o,Xa.y),l.addScaledVector(a,Xa.z),l}static isFrontFacing(e,t,r,i){return yo.subVectors(r,t),Ya.subVectors(e,t),yo.cross(Ya).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return yo.subVectors(this.c,this.b),Ya.subVectors(this.a,this.b),yo.cross(Ya).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return rs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return rs.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return rs.getUV(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return rs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return rs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;ad.subVectors(i,r),ld.subVectors(s,r),h1.subVectors(e,r);const l=ad.dot(h1),A=ld.dot(h1);if(l<=0&&A<=0)return t.copy(r);f1.subVectors(e,i);const c=ad.dot(f1),u=ld.dot(f1);if(c>=0&&u<=c)return t.copy(i);const h=l*u-c*A;if(h<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(r).addScaledVector(ad,o);p1.subVectors(e,s);const d=ad.dot(p1),p=ld.dot(p1);if(p>=0&&d<=p)return t.copy(s);const f=d*A-l*p;if(f<=0&&A>=0&&p<=0)return a=A/(A-p),t.copy(r).addScaledVector(ld,a);const g=c*p-d*u;if(g<=0&&u-c>=0&&d-p>=0)return _T.subVectors(s,i),a=(u-c)/(u-c+(d-p)),t.copy(i).addScaledVector(_T,a);const m=1/(g+f+h);return o=f*m,a=h*m,t.copy(r).addScaledVector(ad,o).addScaledVector(ld,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let dq=0,us=class extends yc{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:dq++}),this.uuid=No(),this.name="",this.type="Material",this.blending=Zh,this.side=Lo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=rZ,this.blendDst=iZ,this.blendEquation=kd,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=wE,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=W$,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=t1,this.stencilZFail=t1,this.stencilZPass=t1,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Zh&&(r.blending=this.blending),this.side!==Lo&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};class Ri extends us{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=KC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const jn=new j,vv=new Ye;class ut{constructor(e,t,r){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r===!0,this.usage=CE,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const A in l)l[A]!==void 0&&(e[A]=l[A]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const A=r[l];e.data.attributes[l]=A.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const A=this.morphAttributes[l],c=[];for(let u=0,h=A.length;u0&&(i[l]=c,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const A in i){const c=i[A];this.setAttribute(A,c.clone(t))}const s=e.morphAttributes;for(const A in s){const c=[],u=s[A];for(let h=0,d=u.length;h0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;st.far?null:{distance:A,point:Iv.clone(),object:n}}function Fv(n,e,t,r,i,s,o,a,l,A,c,u){sA.fromBufferAttribute(i,A),oA.fromBufferAttribute(i,c),aA.fromBufferAttribute(i,u);const h=n.morphTargetInfluences;if(s&&h){yv.set(0,0,0),wv.set(0,0,0),Bv.set(0,0,0);for(let p=0,f=s.length;p0?1:-1,c.push(L.x,L.y,L.z),u.push(E/F),u.push(1-G/x),N+=1}}for(let G=0;G #include #include -}`,Ct={alphamap_fragment:bq,alphamap_pars_fragment:xq,alphatest_fragment:Iq,alphatest_pars_fragment:Fq,aomap_fragment:Eq,aomap_pars_fragment:_q,begin_vertex:Sq,beginnormal_vertex:Uq,bsdfs:Qq,iridescence_fragment:Rq,bumpmap_pars_fragment:Mq,clipping_planes_fragment:Tq,clipping_planes_pars_fragment:Nq,clipping_planes_pars_vertex:kq,clipping_planes_vertex:Dq,color_fragment:Lq,color_pars_fragment:Vq,color_pars_vertex:Pq,color_vertex:Oq,common:Wq,cube_uv_reflection_fragment:Gq,defaultnormal_vertex:Zq,displacementmap_pars_vertex:Jq,displacementmap_vertex:Hq,emissivemap_fragment:zq,emissivemap_pars_fragment:Yq,encodings_fragment:Xq,encodings_pars_fragment:jq,envmap_fragment:Kq,envmap_common_pars_fragment:$q,envmap_pars_fragment:qq,envmap_pars_vertex:eee,envmap_physical_pars_fragment:dee,envmap_vertex:tee,fog_vertex:nee,fog_pars_vertex:ree,fog_fragment:iee,fog_pars_fragment:see,gradientmap_pars_fragment:oee,lightmap_fragment:aee,lightmap_pars_fragment:lee,lights_lambert_fragment:Aee,lights_lambert_pars_fragment:cee,lights_pars_begin:uee,lights_toon_fragment:hee,lights_toon_pars_fragment:fee,lights_phong_fragment:pee,lights_phong_pars_fragment:gee,lights_physical_fragment:mee,lights_physical_pars_fragment:vee,lights_fragment_begin:yee,lights_fragment_maps:wee,lights_fragment_end:Bee,logdepthbuf_fragment:Cee,logdepthbuf_pars_fragment:bee,logdepthbuf_pars_vertex:xee,logdepthbuf_vertex:Iee,map_fragment:Fee,map_pars_fragment:Eee,map_particle_fragment:_ee,map_particle_pars_fragment:See,metalnessmap_fragment:Uee,metalnessmap_pars_fragment:Qee,morphcolor_vertex:Ree,morphnormal_vertex:Mee,morphtarget_pars_vertex:Tee,morphtarget_vertex:Nee,normal_fragment_begin:kee,normal_fragment_maps:Dee,normal_pars_fragment:Lee,normal_pars_vertex:Vee,normal_vertex:Pee,normalmap_pars_fragment:Oee,clearcoat_normal_fragment_begin:Wee,clearcoat_normal_fragment_maps:Gee,clearcoat_pars_fragment:Zee,iridescence_pars_fragment:Jee,output_fragment:Hee,packing:zee,premultiplied_alpha_fragment:Yee,project_vertex:Xee,dithering_fragment:jee,dithering_pars_fragment:Kee,roughnessmap_fragment:$ee,roughnessmap_pars_fragment:qee,shadowmap_pars_fragment:ete,shadowmap_pars_vertex:tte,shadowmap_vertex:nte,shadowmask_pars_fragment:rte,skinbase_vertex:ite,skinning_pars_vertex:ste,skinning_vertex:ote,skinnormal_vertex:ate,specularmap_fragment:lte,specularmap_pars_fragment:Ate,tonemapping_fragment:cte,tonemapping_pars_fragment:ute,transmission_fragment:dte,transmission_pars_fragment:hte,uv_pars_fragment:fte,uv_pars_vertex:pte,uv_vertex:gte,uv2_pars_fragment:mte,uv2_pars_vertex:vte,uv2_vertex:yte,worldpos_vertex:wte,background_vert:Bte,background_frag:Cte,backgroundCube_vert:bte,backgroundCube_frag:xte,cube_vert:Ite,cube_frag:Fte,depth_vert:Ete,depth_frag:_te,distanceRGBA_vert:Ste,distanceRGBA_frag:Ute,equirect_vert:Qte,equirect_frag:Rte,linedashed_vert:Mte,linedashed_frag:Tte,meshbasic_vert:Nte,meshbasic_frag:kte,meshlambert_vert:Dte,meshlambert_frag:Lte,meshmatcap_vert:Vte,meshmatcap_frag:Pte,meshnormal_vert:Ote,meshnormal_frag:Wte,meshphong_vert:Gte,meshphong_frag:Zte,meshphysical_vert:Jte,meshphysical_frag:Hte,meshtoon_vert:zte,meshtoon_frag:Yte,points_vert:Xte,points_frag:jte,shadow_vert:Kte,shadow_frag:$te,sprite_vert:qte,sprite_frag:ene},Ve={common:{diffuse:{value:new Le(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ln},uv2Transform:{value:new Ln},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Ye(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ln}},sprite:{diffuse:{value:new Le(16777215)},opacity:{value:1},center:{value:new Ye(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ln}}},oa={basic:{uniforms:li([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.fog]),vertexShader:Ct.meshbasic_vert,fragmentShader:Ct.meshbasic_frag},lambert:{uniforms:li([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,Ve.lights,{emissive:{value:new Le(0)}}]),vertexShader:Ct.meshlambert_vert,fragmentShader:Ct.meshlambert_frag},phong:{uniforms:li([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,Ve.lights,{emissive:{value:new Le(0)},specular:{value:new Le(1118481)},shininess:{value:30}}]),vertexShader:Ct.meshphong_vert,fragmentShader:Ct.meshphong_frag},standard:{uniforms:li([Ve.common,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.roughnessmap,Ve.metalnessmap,Ve.fog,Ve.lights,{emissive:{value:new Le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ct.meshphysical_vert,fragmentShader:Ct.meshphysical_frag},toon:{uniforms:li([Ve.common,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.gradientmap,Ve.fog,Ve.lights,{emissive:{value:new Le(0)}}]),vertexShader:Ct.meshtoon_vert,fragmentShader:Ct.meshtoon_frag},matcap:{uniforms:li([Ve.common,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,{matcap:{value:null}}]),vertexShader:Ct.meshmatcap_vert,fragmentShader:Ct.meshmatcap_frag},points:{uniforms:li([Ve.points,Ve.fog]),vertexShader:Ct.points_vert,fragmentShader:Ct.points_frag},dashed:{uniforms:li([Ve.common,Ve.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ct.linedashed_vert,fragmentShader:Ct.linedashed_frag},depth:{uniforms:li([Ve.common,Ve.displacementmap]),vertexShader:Ct.depth_vert,fragmentShader:Ct.depth_frag},normal:{uniforms:li([Ve.common,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,{opacity:{value:1}}]),vertexShader:Ct.meshnormal_vert,fragmentShader:Ct.meshnormal_frag},sprite:{uniforms:li([Ve.sprite,Ve.fog]),vertexShader:Ct.sprite_vert,fragmentShader:Ct.sprite_frag},background:{uniforms:{uvTransform:{value:new Ln},t2D:{value:null}},vertexShader:Ct.background_vert,fragmentShader:Ct.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0}},vertexShader:Ct.backgroundCube_vert,fragmentShader:Ct.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ct.cube_vert,fragmentShader:Ct.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ct.equirect_vert,fragmentShader:Ct.equirect_frag},distanceRGBA:{uniforms:li([Ve.common,Ve.displacementmap,{referencePosition:{value:new j},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ct.distanceRGBA_vert,fragmentShader:Ct.distanceRGBA_frag},shadow:{uniforms:li([Ve.lights,Ve.fog,{color:{value:new Le(0)},opacity:{value:1}}]),vertexShader:Ct.shadow_vert,fragmentShader:Ct.shadow_frag}};oa.physical={uniforms:li([oa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ye(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Le(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ye},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Le(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Le(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Ct.meshphysical_vert,fragmentShader:Ct.meshphysical_frag};function tne(n,e,t,r,i,s,o){const a=new Le(0);let l=s===!0?0:1,A,c,u=null,h=0,d=null;function p(g,m){let v=!1,w=m.isScene===!0?m.background:null;w&&w.isTexture&&(w=(m.backgroundBlurriness>0?t:e).get(w));const B=n.xr,C=B.getSession&&B.getSession();C&&C.environmentBlendMode==="additive"&&(w=null),w===null?f(a,l):w&&w.isColor&&(f(w,1),v=!0),(n.autoClear||v)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),w&&(w.isCubeTexture||w.mapping===$C)?(c===void 0&&(c=new In(new d0(1,1,1),new Sr({name:"BackgroundCubeMaterial",uniforms:xf(oa.backgroundCube.uniforms),vertexShader:oa.backgroundCube.vertexShader,fragmentShader:oa.backgroundCube.fragmentShader,side:yi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(b,F,x){this.matrixWorld.copyPosition(x.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=w,c.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,(u!==w||h!==w.version||d!==n.toneMapping)&&(c.material.needsUpdate=!0,u=w,h=w.version,d=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null)):w&&w.isTexture&&(A===void 0&&(A=new In(new Du(2,2),new Sr({name:"BackgroundMaterial",uniforms:xf(oa.background.uniforms),vertexShader:oa.background.vertexShader,fragmentShader:oa.background.fragmentShader,side:Lo,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),Object.defineProperty(A.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(A)),A.material.uniforms.t2D.value=w,w.matrixAutoUpdate===!0&&w.updateMatrix(),A.material.uniforms.uvTransform.value.copy(w.matrix),(u!==w||h!==w.version||d!==n.toneMapping)&&(A.material.needsUpdate=!0,u=w,h=w.version,d=n.toneMapping),A.layers.enableAll(),g.unshift(A,A.geometry,A.material,0,0,null))}function f(g,m){r.buffers.color.setClear(g.r,g.g,g.b,m,o)}return{getClearColor:function(){return a},setClearColor:function(g,m=1){a.set(g),l=m,f(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,f(a,l)},render:p}}function nne(n,e,t,r){const i=n.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=g(null);let A=l,c=!1;function u(y,I,R,N,k){let V=!1;if(o){const G=f(N,R,I);A!==G&&(A=G,d(A.object)),V=m(y,N,R,k),V&&v(y,N,R,k)}else{const G=I.wireframe===!0;(A.geometry!==N.id||A.program!==R.id||A.wireframe!==G)&&(A.geometry=N.id,A.program=R.id,A.wireframe=G,V=!0)}k!==null&&t.update(k,34963),(V||c)&&(c=!1,x(y,I,R,N),k!==null&&n.bindBuffer(34963,t.get(k).buffer))}function h(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function d(y){return r.isWebGL2?n.bindVertexArray(y):s.bindVertexArrayOES(y)}function p(y){return r.isWebGL2?n.deleteVertexArray(y):s.deleteVertexArrayOES(y)}function f(y,I,R){const N=R.wireframe===!0;let k=a[y.id];k===void 0&&(k={},a[y.id]=k);let V=k[I.id];V===void 0&&(V={},k[I.id]=V);let G=V[N];return G===void 0&&(G=g(h()),V[N]=G),G}function g(y){const I=[],R=[],N=[];for(let k=0;k=0){const re=k[E];let T=V[E];if(T===void 0&&(E==="instanceMatrix"&&y.instanceMatrix&&(T=y.instanceMatrix),E==="instanceColor"&&y.instanceColor&&(T=y.instanceColor)),re===void 0||re.attribute!==T||T&&re.data!==T.data)return!0;G++}return A.attributesNum!==G||A.index!==N}function v(y,I,R,N){const k={},V=I.attributes;let G=0;const D=R.getAttributes();for(const E in D)if(D[E].location>=0){let re=V[E];re===void 0&&(E==="instanceMatrix"&&y.instanceMatrix&&(re=y.instanceMatrix),E==="instanceColor"&&y.instanceColor&&(re=y.instanceColor));const T={};T.attribute=re,re&&re.data&&(T.data=re.data),k[E]=T,G++}A.attributes=k,A.attributesNum=G,A.index=N}function w(){const y=A.newAttributes;for(let I=0,R=y.length;I=0){let z=k[D];if(z===void 0&&(D==="instanceMatrix"&&y.instanceMatrix&&(z=y.instanceMatrix),D==="instanceColor"&&y.instanceColor&&(z=y.instanceColor)),z!==void 0){const re=z.normalized,T=z.itemSize,ee=t.get(z);if(ee===void 0)continue;const pe=ee.buffer,de=ee.type,Ae=ee.bytesPerElement;if(z.isInterleavedBufferAttribute){const $=z.data,ce=$.stride,ge=z.offset;if($.isInstancedInterleavedBuffer){for(let Fe=0;Fe0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";F="mediump"}return F==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&n instanceof WebGL2ComputeRenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const A=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,u=n.getParameter(34930),h=n.getParameter(35660),d=n.getParameter(3379),p=n.getParameter(34076),f=n.getParameter(34921),g=n.getParameter(36347),m=n.getParameter(36348),v=n.getParameter(36349),w=h>0,B=o||e.has("OES_texture_float"),C=w&&B,b=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:A,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:w,floatFragmentTextures:B,floatVertexTextures:C,maxSamples:b}}function sne(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new gl,a=new Ln,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h,d){const p=u.length!==0||h||r!==0||i;return i=h,t=c(u,d,0),r=u.length,p},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1,A()},this.setState=function(u,h,d){const p=u.clippingPlanes,f=u.clipIntersection,g=u.clipShadows,m=n.get(u);if(!i||p===null||p.length===0||s&&!g)s?c(null):A();else{const v=s?0:r,w=v*4;let B=m.clippingState||null;l.value=B,B=c(p,h,w,d);for(let C=0;C!==w;++C)B[C]=t[C];m.clippingState=B,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=v}};function A(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function c(u,h,d,p){const f=u!==null?u.length:0;let g=null;if(f!==0){if(g=l.value,p!==!0||g===null){const m=d+f*4,v=h.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length0){const A=new yq(l.height/2);return A.fromEquirectangularTexture(n,o),e.set(o,A),o.addEventListener("dispose",i),t(A.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Lu extends fZ{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const A=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=A*this.view.offsetX,o=s+A*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Fh=4,UT=[.125,.215,.35,.446,.526,.582],Jc=20,b1=new Lu,QT=new Le;let x1=null;const Pc=(1+Math.sqrt(5))/2,fd=1/Pc,RT=[new j(1,1,1),new j(-1,1,1),new j(1,1,-1),new j(-1,1,-1),new j(0,Pc,fd),new j(0,Pc,-fd),new j(fd,0,Pc),new j(-fd,0,Pc),new j(Pc,fd,0),new j(-Pc,fd,0)];class MT{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100){x1=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=kT(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=NT(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?w:0,w,w),c.setRenderTarget(i),f&&c.render(p,a),c.render(e,a)}p.geometry.dispose(),p.material.dispose(),c.toneMapping=h,c.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===wf||e.mapping===Bf;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=kT()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=NT());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new In(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;_v(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,b1)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;iJc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Jc}`);const m=[];let v=0;for(let F=0;Fw-Fh?i-w+Fh:0),b=4*(this._cubeSize-B);_v(t,C,b,3*B,2*B),l.setRenderTarget(t),l.render(u,b1)}}function ane(n){const e=[],t=[],r=[];let i=n;const s=n-Fh+1+UT.length;for(let o=0;on-Fh?l=UT[o-n+Fh-1]:o===0&&(l=0),r.push(l);const A=1/(a-2),c=-A,u=1+A,h=[c,c,u,c,u,u,c,c,u,u,c,u],d=6,p=6,f=3,g=2,m=1,v=new Float32Array(f*p*d),w=new Float32Array(g*p*d),B=new Float32Array(m*p*d);for(let b=0;b2?0:-1,_=[F,x,0,F+2/3,x,0,F+2/3,x+1,0,F,x,0,F+2/3,x+1,0,F,x+1,0];v.set(_,f*p*b),w.set(h,g*p*b);const M=[b,b,b,b,b,b];B.set(M,m*p*b)}const C=new Ht;C.setAttribute("position",new ut(v,f)),C.setAttribute("uv",new ut(w,g)),C.setAttribute("faceIndex",new ut(B,m)),e.push(C),i>Fh&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function TT(n,e,t){const r=new Qa(n,e,t);return r.texture.mapping=$C,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function _v(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function lne(n,e,t){const r=new Float32Array(Jc),i=new j(0,1,0);return new Sr({name:"SphericalGaussianBlur",defines:{n:Jc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:bU(),fragmentShader:` +}`,Ct={alphamap_fragment:bq,alphamap_pars_fragment:xq,alphatest_fragment:Iq,alphatest_pars_fragment:Fq,aomap_fragment:Eq,aomap_pars_fragment:_q,begin_vertex:Sq,beginnormal_vertex:Uq,bsdfs:Qq,iridescence_fragment:Rq,bumpmap_pars_fragment:Mq,clipping_planes_fragment:Tq,clipping_planes_pars_fragment:Nq,clipping_planes_pars_vertex:kq,clipping_planes_vertex:Dq,color_fragment:Lq,color_pars_fragment:Vq,color_pars_vertex:Pq,color_vertex:Oq,common:Wq,cube_uv_reflection_fragment:Gq,defaultnormal_vertex:Zq,displacementmap_pars_vertex:Jq,displacementmap_vertex:Hq,emissivemap_fragment:zq,emissivemap_pars_fragment:Yq,encodings_fragment:Xq,encodings_pars_fragment:jq,envmap_fragment:Kq,envmap_common_pars_fragment:$q,envmap_pars_fragment:qq,envmap_pars_vertex:eee,envmap_physical_pars_fragment:dee,envmap_vertex:tee,fog_vertex:nee,fog_pars_vertex:ree,fog_fragment:iee,fog_pars_fragment:see,gradientmap_pars_fragment:oee,lightmap_fragment:aee,lightmap_pars_fragment:lee,lights_lambert_fragment:Aee,lights_lambert_pars_fragment:cee,lights_pars_begin:uee,lights_toon_fragment:hee,lights_toon_pars_fragment:fee,lights_phong_fragment:pee,lights_phong_pars_fragment:gee,lights_physical_fragment:mee,lights_physical_pars_fragment:vee,lights_fragment_begin:yee,lights_fragment_maps:wee,lights_fragment_end:Bee,logdepthbuf_fragment:Cee,logdepthbuf_pars_fragment:bee,logdepthbuf_pars_vertex:xee,logdepthbuf_vertex:Iee,map_fragment:Fee,map_pars_fragment:Eee,map_particle_fragment:_ee,map_particle_pars_fragment:See,metalnessmap_fragment:Uee,metalnessmap_pars_fragment:Qee,morphcolor_vertex:Ree,morphnormal_vertex:Mee,morphtarget_pars_vertex:Tee,morphtarget_vertex:Nee,normal_fragment_begin:kee,normal_fragment_maps:Dee,normal_pars_fragment:Lee,normal_pars_vertex:Vee,normal_vertex:Pee,normalmap_pars_fragment:Oee,clearcoat_normal_fragment_begin:Wee,clearcoat_normal_fragment_maps:Gee,clearcoat_pars_fragment:Zee,iridescence_pars_fragment:Jee,output_fragment:Hee,packing:zee,premultiplied_alpha_fragment:Yee,project_vertex:Xee,dithering_fragment:jee,dithering_pars_fragment:Kee,roughnessmap_fragment:$ee,roughnessmap_pars_fragment:qee,shadowmap_pars_fragment:ete,shadowmap_pars_vertex:tte,shadowmap_vertex:nte,shadowmask_pars_fragment:rte,skinbase_vertex:ite,skinning_pars_vertex:ste,skinning_vertex:ote,skinnormal_vertex:ate,specularmap_fragment:lte,specularmap_pars_fragment:Ate,tonemapping_fragment:cte,tonemapping_pars_fragment:ute,transmission_fragment:dte,transmission_pars_fragment:hte,uv_pars_fragment:fte,uv_pars_vertex:pte,uv_vertex:gte,uv2_pars_fragment:mte,uv2_pars_vertex:vte,uv2_vertex:yte,worldpos_vertex:wte,background_vert:Bte,background_frag:Cte,backgroundCube_vert:bte,backgroundCube_frag:xte,cube_vert:Ite,cube_frag:Fte,depth_vert:Ete,depth_frag:_te,distanceRGBA_vert:Ste,distanceRGBA_frag:Ute,equirect_vert:Qte,equirect_frag:Rte,linedashed_vert:Mte,linedashed_frag:Tte,meshbasic_vert:Nte,meshbasic_frag:kte,meshlambert_vert:Dte,meshlambert_frag:Lte,meshmatcap_vert:Vte,meshmatcap_frag:Pte,meshnormal_vert:Ote,meshnormal_frag:Wte,meshphong_vert:Gte,meshphong_frag:Zte,meshphysical_vert:Jte,meshphysical_frag:Hte,meshtoon_vert:zte,meshtoon_frag:Yte,points_vert:Xte,points_frag:jte,shadow_vert:Kte,shadow_frag:$te,sprite_vert:qte,sprite_frag:ene},Ve={common:{diffuse:{value:new Le(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ln},uv2Transform:{value:new Ln},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Ye(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ln}},sprite:{diffuse:{value:new Le(16777215)},opacity:{value:1},center:{value:new Ye(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ln}}},oa={basic:{uniforms:li([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.fog]),vertexShader:Ct.meshbasic_vert,fragmentShader:Ct.meshbasic_frag},lambert:{uniforms:li([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,Ve.lights,{emissive:{value:new Le(0)}}]),vertexShader:Ct.meshlambert_vert,fragmentShader:Ct.meshlambert_frag},phong:{uniforms:li([Ve.common,Ve.specularmap,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,Ve.lights,{emissive:{value:new Le(0)},specular:{value:new Le(1118481)},shininess:{value:30}}]),vertexShader:Ct.meshphong_vert,fragmentShader:Ct.meshphong_frag},standard:{uniforms:li([Ve.common,Ve.envmap,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.roughnessmap,Ve.metalnessmap,Ve.fog,Ve.lights,{emissive:{value:new Le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ct.meshphysical_vert,fragmentShader:Ct.meshphysical_frag},toon:{uniforms:li([Ve.common,Ve.aomap,Ve.lightmap,Ve.emissivemap,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.gradientmap,Ve.fog,Ve.lights,{emissive:{value:new Le(0)}}]),vertexShader:Ct.meshtoon_vert,fragmentShader:Ct.meshtoon_frag},matcap:{uniforms:li([Ve.common,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,Ve.fog,{matcap:{value:null}}]),vertexShader:Ct.meshmatcap_vert,fragmentShader:Ct.meshmatcap_frag},points:{uniforms:li([Ve.points,Ve.fog]),vertexShader:Ct.points_vert,fragmentShader:Ct.points_frag},dashed:{uniforms:li([Ve.common,Ve.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ct.linedashed_vert,fragmentShader:Ct.linedashed_frag},depth:{uniforms:li([Ve.common,Ve.displacementmap]),vertexShader:Ct.depth_vert,fragmentShader:Ct.depth_frag},normal:{uniforms:li([Ve.common,Ve.bumpmap,Ve.normalmap,Ve.displacementmap,{opacity:{value:1}}]),vertexShader:Ct.meshnormal_vert,fragmentShader:Ct.meshnormal_frag},sprite:{uniforms:li([Ve.sprite,Ve.fog]),vertexShader:Ct.sprite_vert,fragmentShader:Ct.sprite_frag},background:{uniforms:{uvTransform:{value:new Ln},t2D:{value:null}},vertexShader:Ct.background_vert,fragmentShader:Ct.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0}},vertexShader:Ct.backgroundCube_vert,fragmentShader:Ct.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ct.cube_vert,fragmentShader:Ct.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ct.equirect_vert,fragmentShader:Ct.equirect_frag},distanceRGBA:{uniforms:li([Ve.common,Ve.displacementmap,{referencePosition:{value:new j},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ct.distanceRGBA_vert,fragmentShader:Ct.distanceRGBA_frag},shadow:{uniforms:li([Ve.lights,Ve.fog,{color:{value:new Le(0)},opacity:{value:1}}]),vertexShader:Ct.shadow_vert,fragmentShader:Ct.shadow_frag}};oa.physical={uniforms:li([oa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ye(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Le(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ye},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Le(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Le(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Ct.meshphysical_vert,fragmentShader:Ct.meshphysical_frag};function tne(n,e,t,r,i,s,o){const a=new Le(0);let l=s===!0?0:1,A,c,u=null,h=0,d=null;function p(g,m){let v=!1,w=m.isScene===!0?m.background:null;w&&w.isTexture&&(w=(m.backgroundBlurriness>0?t:e).get(w));const B=n.xr,C=B.getSession&&B.getSession();C&&C.environmentBlendMode==="additive"&&(w=null),w===null?f(a,l):w&&w.isColor&&(f(w,1),v=!0),(n.autoClear||v)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),w&&(w.isCubeTexture||w.mapping===$C)?(c===void 0&&(c=new In(new d0(1,1,1),new Sr({name:"BackgroundCubeMaterial",uniforms:xf(oa.backgroundCube.uniforms),vertexShader:oa.backgroundCube.vertexShader,fragmentShader:oa.backgroundCube.fragmentShader,side:yi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(b,F,x){this.matrixWorld.copyPosition(x.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=w,c.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,(u!==w||h!==w.version||d!==n.toneMapping)&&(c.material.needsUpdate=!0,u=w,h=w.version,d=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null)):w&&w.isTexture&&(A===void 0&&(A=new In(new Du(2,2),new Sr({name:"BackgroundMaterial",uniforms:xf(oa.background.uniforms),vertexShader:oa.background.vertexShader,fragmentShader:oa.background.fragmentShader,side:Lo,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),Object.defineProperty(A.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(A)),A.material.uniforms.t2D.value=w,w.matrixAutoUpdate===!0&&w.updateMatrix(),A.material.uniforms.uvTransform.value.copy(w.matrix),(u!==w||h!==w.version||d!==n.toneMapping)&&(A.material.needsUpdate=!0,u=w,h=w.version,d=n.toneMapping),A.layers.enableAll(),g.unshift(A,A.geometry,A.material,0,0,null))}function f(g,m){r.buffers.color.setClear(g.r,g.g,g.b,m,o)}return{getClearColor:function(){return a},setClearColor:function(g,m=1){a.set(g),l=m,f(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,f(a,l)},render:p}}function nne(n,e,t,r){const i=n.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=g(null);let A=l,c=!1;function u(y,I,R,N,k){let L=!1;if(o){const G=f(N,R,I);A!==G&&(A=G,d(A.object)),L=m(y,N,R,k),L&&v(y,N,R,k)}else{const G=I.wireframe===!0;(A.geometry!==N.id||A.program!==R.id||A.wireframe!==G)&&(A.geometry=N.id,A.program=R.id,A.wireframe=G,L=!0)}k!==null&&t.update(k,34963),(L||c)&&(c=!1,x(y,I,R,N),k!==null&&n.bindBuffer(34963,t.get(k).buffer))}function h(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function d(y){return r.isWebGL2?n.bindVertexArray(y):s.bindVertexArrayOES(y)}function p(y){return r.isWebGL2?n.deleteVertexArray(y):s.deleteVertexArrayOES(y)}function f(y,I,R){const N=R.wireframe===!0;let k=a[y.id];k===void 0&&(k={},a[y.id]=k);let L=k[I.id];L===void 0&&(L={},k[I.id]=L);let G=L[N];return G===void 0&&(G=g(h()),L[N]=G),G}function g(y){const I=[],R=[],N=[];for(let k=0;k=0){const re=k[E];let T=L[E];if(T===void 0&&(E==="instanceMatrix"&&y.instanceMatrix&&(T=y.instanceMatrix),E==="instanceColor"&&y.instanceColor&&(T=y.instanceColor)),re===void 0||re.attribute!==T||T&&re.data!==T.data)return!0;G++}return A.attributesNum!==G||A.index!==N}function v(y,I,R,N){const k={},L=I.attributes;let G=0;const D=R.getAttributes();for(const E in D)if(D[E].location>=0){let re=L[E];re===void 0&&(E==="instanceMatrix"&&y.instanceMatrix&&(re=y.instanceMatrix),E==="instanceColor"&&y.instanceColor&&(re=y.instanceColor));const T={};T.attribute=re,re&&re.data&&(T.data=re.data),k[E]=T,G++}A.attributes=k,A.attributesNum=G,A.index=N}function w(){const y=A.newAttributes;for(let I=0,R=y.length;I=0){let z=k[D];if(z===void 0&&(D==="instanceMatrix"&&y.instanceMatrix&&(z=y.instanceMatrix),D==="instanceColor"&&y.instanceColor&&(z=y.instanceColor)),z!==void 0){const re=z.normalized,T=z.itemSize,ee=t.get(z);if(ee===void 0)continue;const pe=ee.buffer,de=ee.type,Ae=ee.bytesPerElement;if(z.isInterleavedBufferAttribute){const $=z.data,ce=$.stride,ge=z.offset;if($.isInstancedInterleavedBuffer){for(let Fe=0;Fe0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";F="mediump"}return F==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&n instanceof WebGL2ComputeRenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const A=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,u=n.getParameter(34930),h=n.getParameter(35660),d=n.getParameter(3379),p=n.getParameter(34076),f=n.getParameter(34921),g=n.getParameter(36347),m=n.getParameter(36348),v=n.getParameter(36349),w=h>0,B=o||e.has("OES_texture_float"),C=w&&B,b=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:A,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:w,floatFragmentTextures:B,floatVertexTextures:C,maxSamples:b}}function sne(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new gl,a=new Ln,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h,d){const p=u.length!==0||h||r!==0||i;return i=h,t=c(u,d,0),r=u.length,p},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1,A()},this.setState=function(u,h,d){const p=u.clippingPlanes,f=u.clipIntersection,g=u.clipShadows,m=n.get(u);if(!i||p===null||p.length===0||s&&!g)s?c(null):A();else{const v=s?0:r,w=v*4;let B=m.clippingState||null;l.value=B,B=c(p,h,w,d);for(let C=0;C!==w;++C)B[C]=t[C];m.clippingState=B,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=v}};function A(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function c(u,h,d,p){const f=u!==null?u.length:0;let g=null;if(f!==0){if(g=l.value,p!==!0||g===null){const m=d+f*4,v=h.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length0){const A=new yq(l.height/2);return A.fromEquirectangularTexture(n,o),e.set(o,A),o.addEventListener("dispose",i),t(A.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Lu extends fZ{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const A=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=A*this.view.offsetX,o=s+A*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Fh=4,UT=[.125,.215,.35,.446,.526,.582],Jc=20,b1=new Lu,QT=new Le;let x1=null;const Pc=(1+Math.sqrt(5))/2,fd=1/Pc,RT=[new j(1,1,1),new j(-1,1,1),new j(1,1,-1),new j(-1,1,-1),new j(0,Pc,fd),new j(0,Pc,-fd),new j(fd,0,Pc),new j(-fd,0,Pc),new j(Pc,fd,0),new j(-Pc,fd,0)];class MT{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100){x1=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=kT(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=NT(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?w:0,w,w),c.setRenderTarget(i),f&&c.render(p,a),c.render(e,a)}p.geometry.dispose(),p.material.dispose(),c.toneMapping=h,c.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===wf||e.mapping===Bf;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=kT()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=NT());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new In(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;_v(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,b1)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;iJc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Jc}`);const m=[];let v=0;for(let F=0;Fw-Fh?i-w+Fh:0),b=4*(this._cubeSize-B);_v(t,C,b,3*B,2*B),l.setRenderTarget(t),l.render(u,b1)}}function ane(n){const e=[],t=[],r=[];let i=n;const s=n-Fh+1+UT.length;for(let o=0;on-Fh?l=UT[o-n+Fh-1]:o===0&&(l=0),r.push(l);const A=1/(a-2),c=-A,u=1+A,h=[c,c,u,c,u,u,c,c,u,u,c,u],d=6,p=6,f=3,g=2,m=1,v=new Float32Array(f*p*d),w=new Float32Array(g*p*d),B=new Float32Array(m*p*d);for(let b=0;b2?0:-1,_=[F,x,0,F+2/3,x,0,F+2/3,x+1,0,F,x,0,F+2/3,x+1,0,F,x+1,0];v.set(_,f*p*b),w.set(h,g*p*b);const M=[b,b,b,b,b,b];B.set(M,m*p*b)}const C=new Ht;C.setAttribute("position",new ut(v,f)),C.setAttribute("uv",new ut(w,g)),C.setAttribute("faceIndex",new ut(B,m)),e.push(C),i>Fh&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function TT(n,e,t){const r=new Qa(n,e,t);return r.texture.mapping=$C,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function _v(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function lne(n,e,t){const r=new Float32Array(Jc),i=new j(0,1,0);return new Sr({name:"SphericalGaussianBlur",defines:{n:Jc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:bU(),fragmentShader:` precision mediump float; precision mediump int; @@ -3143,7 +3143,7 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function Ane(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,A=l===vB||l===BE,c=l===wf||l===Bf;if(A||c)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let u=e.get(a);return t===null&&(t=new MT(n)),u=A?t.fromEquirectangular(a,u):t.fromCubemap(a,u),e.set(a,u),u.texture}else{if(e.has(a))return e.get(a).texture;{const u=a.image;if(A&&u&&u.height>0||c&&u&&i(u)){t===null&&(t=new MT(n));const h=A?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",s),h.texture}else return null}}}return a}function i(a){let l=0;const A=6;for(let c=0;ce.maxTextureSize&&(Y=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const O=new Float32Array(M*Y*4*f),U=new dZ(O,M,Y,f);U.type=MA,U.needsUpdate=!0;const y=_*4;for(let R=0;R0)return n;const i=e*t;let s=DT[i];if(s===void 0&&(s=new Float32Array(i),DT[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function vr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t0||c&&u&&i(u)){t===null&&(t=new MT(n));const h=A?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",s),h.texture}else return null}}}return a}function i(a){let l=0;const A=6;for(let c=0;ce.maxTextureSize&&(Y=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const O=new Float32Array(M*Y*4*f),U=new dZ(O,M,Y,f);U.type=MA,U.needsUpdate=!0;const y=_*4;for(let R=0;R0)return n;const i=e*t;let s=DT[i];if(s===void 0&&(s=new Float32Array(i),DT[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function vr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` `)}function cre(n){switch(n){case gs:return["Linear","( value )"];case mt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function ZT(n,e,t){const r=n.getShaderParameter(e,35713),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` @@ -3173,7 +3173,7 @@ precision `+n.precision+" int;";return n.precision==="highp"?e+=` Program Info Log: `+_+` `+y+` -`+I)}else _!==""?console.warn("THREE.WebGLProgram: Program Info Log:",_):(M===""||Y==="")&&(U=!1);U&&(this.diagnostics={runnable:O,programLog:_,vertexShader:{log:M,prefix:g},fragmentShader:{log:Y,prefix:m}})}i.deleteShader(C),i.deleteShader(b);let F;this.getUniforms=function(){return F===void 0&&(F=new lw(i,f)),F};let x;return this.getAttributes=function(){return x===void 0&&(x=pre(i,f)),x},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=t.shaderName,this.id=lre++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=C,this.fragmentShader=b,this}let Fre=0;class Ere{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new _re(e),t.set(e,r)),r}}class _re{constructor(e){this.id=Fre++,this.code=e,this.usedTimes=0}}function Sre(n,e,t,r,i,s,o){const a=new wU,l=new Ere,A=[],c=i.isWebGL2,u=i.logarithmicDepthBuffer,h=i.vertexTextures;let d=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(x,_,M,Y,O){const U=Y.fog,y=O.geometry,I=x.isMeshStandardMaterial?Y.environment:null,R=(x.isMeshStandardMaterial?t:e).get(x.envMap||I),N=R&&R.mapping===$C?R.image.height:null,k=p[x.type];x.precision!==null&&(d=i.getMaxPrecision(x.precision),d!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",d,"instead."));const V=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,G=V!==void 0?V.length:0;let D=0;y.morphAttributes.position!==void 0&&(D=1),y.morphAttributes.normal!==void 0&&(D=2),y.morphAttributes.color!==void 0&&(D=3);let E,z,re,T;if(k){const ce=oa[k];E=ce.vertexShader,z=ce.fragmentShader}else E=x.vertexShader,z=x.fragmentShader,l.update(x),re=l.getVertexShaderID(x),T=l.getFragmentShaderID(x);const ee=n.getRenderTarget(),pe=x.alphaTest>0,de=x.clearcoat>0,Ae=x.iridescence>0;return{isWebGL2:c,shaderID:k,shaderName:x.type,vertexShader:E,fragmentShader:z,defines:x.defines,customVertexShaderID:re,customFragmentShaderID:T,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:d,instancing:O.isInstancedMesh===!0,instancingColor:O.isInstancedMesh===!0&&O.instanceColor!==null,supportsVertexTextures:h,outputEncoding:ee===null?n.outputEncoding:ee.isXRRenderTarget===!0?ee.texture.encoding:gs,map:!!x.map,matcap:!!x.matcap,envMap:!!R,envMapMode:R&&R.mapping,envMapCubeUVHeight:N,lightMap:!!x.lightMap,aoMap:!!x.aoMap,emissiveMap:!!x.emissiveMap,bumpMap:!!x.bumpMap,normalMap:!!x.normalMap,objectSpaceNormalMap:x.normalMapType===P$,tangentSpaceNormalMap:x.normalMapType===Nu,decodeVideoTexture:!!x.map&&x.map.isVideoTexture===!0&&x.map.encoding===mt,clearcoat:de,clearcoatMap:de&&!!x.clearcoatMap,clearcoatRoughnessMap:de&&!!x.clearcoatRoughnessMap,clearcoatNormalMap:de&&!!x.clearcoatNormalMap,iridescence:Ae,iridescenceMap:Ae&&!!x.iridescenceMap,iridescenceThicknessMap:Ae&&!!x.iridescenceThicknessMap,displacementMap:!!x.displacementMap,roughnessMap:!!x.roughnessMap,metalnessMap:!!x.metalnessMap,specularMap:!!x.specularMap,specularIntensityMap:!!x.specularIntensityMap,specularColorMap:!!x.specularColorMap,opaque:x.transparent===!1&&x.blending===Zh,alphaMap:!!x.alphaMap,alphaTest:pe,gradientMap:!!x.gradientMap,sheen:x.sheen>0,sheenColorMap:!!x.sheenColorMap,sheenRoughnessMap:!!x.sheenRoughnessMap,transmission:x.transmission>0,transmissionMap:!!x.transmissionMap,thicknessMap:!!x.thicknessMap,combine:x.combine,vertexTangents:!!x.normalMap&&!!y.attributes.tangent,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,vertexUvs:!!x.map||!!x.bumpMap||!!x.normalMap||!!x.specularMap||!!x.alphaMap||!!x.emissiveMap||!!x.roughnessMap||!!x.metalnessMap||!!x.clearcoatMap||!!x.clearcoatRoughnessMap||!!x.clearcoatNormalMap||!!x.iridescenceMap||!!x.iridescenceThicknessMap||!!x.displacementMap||!!x.transmissionMap||!!x.thicknessMap||!!x.specularIntensityMap||!!x.specularColorMap||!!x.sheenColorMap||!!x.sheenRoughnessMap,uvsVertexOnly:!(x.map||x.bumpMap||x.normalMap||x.specularMap||x.alphaMap||x.emissiveMap||x.roughnessMap||x.metalnessMap||x.clearcoatNormalMap||x.iridescenceMap||x.iridescenceThicknessMap||x.transmission>0||x.transmissionMap||x.thicknessMap||x.specularIntensityMap||x.specularColorMap||x.sheen>0||x.sheenColorMap||x.sheenRoughnessMap)&&!!x.displacementMap,fog:!!U,useFog:x.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:!!x.flatShading,sizeAttenuation:x.sizeAttenuation,logarithmicDepthBuffer:u,skinning:O.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:D,numDirLights:_.directional.length,numPointLights:_.point.length,numSpotLights:_.spot.length,numSpotLightMaps:_.spotLightMap.length,numRectAreaLights:_.rectArea.length,numHemiLights:_.hemi.length,numDirLightShadows:_.directionalShadowMap.length,numPointLightShadows:_.pointShadowMap.length,numSpotLightShadows:_.spotShadowMap.length,numSpotLightShadowsWithMaps:_.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&M.length>0,shadowMapType:n.shadowMap.type,toneMapping:x.toneMapped?n.toneMapping:El,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===mi,flipSided:x.side===yi,useDepthPacking:!!x.depthPacking,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionDerivatives:x.extensions&&x.extensions.derivatives,extensionFragDepth:x.extensions&&x.extensions.fragDepth,extensionDrawBuffers:x.extensions&&x.extensions.drawBuffers,extensionShaderTextureLOD:x.extensions&&x.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:x.customProgramCacheKey()}}function g(x){const _=[];if(x.shaderID?_.push(x.shaderID):(_.push(x.customVertexShaderID),_.push(x.customFragmentShaderID)),x.defines!==void 0)for(const M in x.defines)_.push(M),_.push(x.defines[M]);return x.isRawShaderMaterial===!1&&(m(_,x),v(_,x),_.push(n.outputEncoding)),_.push(x.customProgramCacheKey),_.join()}function m(x,_){x.push(_.precision),x.push(_.outputEncoding),x.push(_.envMapMode),x.push(_.envMapCubeUVHeight),x.push(_.combine),x.push(_.vertexUvs),x.push(_.fogExp2),x.push(_.sizeAttenuation),x.push(_.morphTargetsCount),x.push(_.morphAttributeCount),x.push(_.numDirLights),x.push(_.numPointLights),x.push(_.numSpotLights),x.push(_.numSpotLightMaps),x.push(_.numHemiLights),x.push(_.numRectAreaLights),x.push(_.numDirLightShadows),x.push(_.numPointLightShadows),x.push(_.numSpotLightShadows),x.push(_.numSpotLightShadowsWithMaps),x.push(_.shadowMapType),x.push(_.toneMapping),x.push(_.numClippingPlanes),x.push(_.numClipIntersection),x.push(_.depthPacking)}function v(x,_){a.disableAll(),_.isWebGL2&&a.enable(0),_.supportsVertexTextures&&a.enable(1),_.instancing&&a.enable(2),_.instancingColor&&a.enable(3),_.map&&a.enable(4),_.matcap&&a.enable(5),_.envMap&&a.enable(6),_.lightMap&&a.enable(7),_.aoMap&&a.enable(8),_.emissiveMap&&a.enable(9),_.bumpMap&&a.enable(10),_.normalMap&&a.enable(11),_.objectSpaceNormalMap&&a.enable(12),_.tangentSpaceNormalMap&&a.enable(13),_.clearcoat&&a.enable(14),_.clearcoatMap&&a.enable(15),_.clearcoatRoughnessMap&&a.enable(16),_.clearcoatNormalMap&&a.enable(17),_.iridescence&&a.enable(18),_.iridescenceMap&&a.enable(19),_.iridescenceThicknessMap&&a.enable(20),_.displacementMap&&a.enable(21),_.specularMap&&a.enable(22),_.roughnessMap&&a.enable(23),_.metalnessMap&&a.enable(24),_.gradientMap&&a.enable(25),_.alphaMap&&a.enable(26),_.alphaTest&&a.enable(27),_.vertexColors&&a.enable(28),_.vertexAlphas&&a.enable(29),_.vertexUvs&&a.enable(30),_.vertexTangents&&a.enable(31),_.uvsVertexOnly&&a.enable(32),x.push(a.mask),a.disableAll(),_.fog&&a.enable(0),_.useFog&&a.enable(1),_.flatShading&&a.enable(2),_.logarithmicDepthBuffer&&a.enable(3),_.skinning&&a.enable(4),_.morphTargets&&a.enable(5),_.morphNormals&&a.enable(6),_.morphColors&&a.enable(7),_.premultipliedAlpha&&a.enable(8),_.shadowMapEnabled&&a.enable(9),_.physicallyCorrectLights&&a.enable(10),_.doubleSided&&a.enable(11),_.flipSided&&a.enable(12),_.useDepthPacking&&a.enable(13),_.dithering&&a.enable(14),_.specularIntensityMap&&a.enable(15),_.specularColorMap&&a.enable(16),_.transmission&&a.enable(17),_.transmissionMap&&a.enable(18),_.thicknessMap&&a.enable(19),_.sheen&&a.enable(20),_.sheenColorMap&&a.enable(21),_.sheenRoughnessMap&&a.enable(22),_.decodeVideoTexture&&a.enable(23),_.opaque&&a.enable(24),x.push(a.mask)}function w(x){const _=p[x.type];let M;if(_){const Y=oa[_];M=BU.clone(Y.uniforms)}else M=x.uniforms;return M}function B(x,_){let M;for(let Y=0,O=A.length;Y0?r.push(m):d.transparent===!0?i.push(m):t.push(m)}function l(u,h,d,p,f,g){const m=o(u,h,d,p,f,g);d.transmission>0?r.unshift(m):d.transparent===!0?i.unshift(m):t.unshift(m)}function A(u,h){t.length>1&&t.sort(u||Qre),r.length>1&&r.sort(h||XT),i.length>1&&i.sort(h||XT)}function c(){for(let u=e,h=n.length;u=s.length?(o=new jT,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function Mre(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new j,color:new Le};break;case"SpotLight":t={position:new j,direction:new j,color:new Le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new j,color:new Le,distance:0,decay:0};break;case"HemisphereLight":t={direction:new j,skyColor:new Le,groundColor:new Le};break;case"RectAreaLight":t={color:new Le,position:new j,halfWidth:new j,halfHeight:new j};break}return n[e.id]=t,t}}}function Tre(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Nre=0;function kre(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Dre(n,e){const t=new Mre,r=Tre(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let c=0;c<9;c++)i.probe.push(new j);const s=new j,o=new He,a=new He;function l(c,u){let h=0,d=0,p=0;for(let Y=0;Y<9;Y++)i.probe[Y].set(0,0,0);let f=0,g=0,m=0,v=0,w=0,B=0,C=0,b=0,F=0,x=0;c.sort(kre);const _=u!==!0?Math.PI:1;for(let Y=0,O=c.length;Y0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ve.LTC_FLOAT_1,i.rectAreaLTC2=Ve.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Ve.LTC_HALF_1,i.rectAreaLTC2=Ve.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=h,i.ambient[1]=d,i.ambient[2]=p;const M=i.hash;(M.directionalLength!==f||M.pointLength!==g||M.spotLength!==m||M.rectAreaLength!==v||M.hemiLength!==w||M.numDirectionalShadows!==B||M.numPointShadows!==C||M.numSpotShadows!==b||M.numSpotMaps!==F)&&(i.directional.length=f,i.spot.length=m,i.rectArea.length=v,i.point.length=g,i.hemi.length=w,i.directionalShadow.length=B,i.directionalShadowMap.length=B,i.pointShadow.length=C,i.pointShadowMap.length=C,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=B,i.pointShadowMatrix.length=C,i.spotLightMatrix.length=b+F-x,i.spotLightMap.length=F,i.numSpotLightShadowsWithMaps=x,M.directionalLength=f,M.pointLength=g,M.spotLength=m,M.rectAreaLength=v,M.hemiLength=w,M.numDirectionalShadows=B,M.numPointShadows=C,M.numSpotShadows=b,M.numSpotMaps=F,i.version=Nre++)}function A(c,u){let h=0,d=0,p=0,f=0,g=0;const m=u.matrixWorldInverse;for(let v=0,w=c.length;v=a.length?(l=new KT(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class Vre extends us{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=L$,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Pre extends us{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new j,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Ore=`void main() { +`+I)}else _!==""?console.warn("THREE.WebGLProgram: Program Info Log:",_):(M===""||Y==="")&&(U=!1);U&&(this.diagnostics={runnable:O,programLog:_,vertexShader:{log:M,prefix:g},fragmentShader:{log:Y,prefix:m}})}i.deleteShader(C),i.deleteShader(b);let F;this.getUniforms=function(){return F===void 0&&(F=new lw(i,f)),F};let x;return this.getAttributes=function(){return x===void 0&&(x=pre(i,f)),x},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=t.shaderName,this.id=lre++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=C,this.fragmentShader=b,this}let Fre=0;class Ere{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new _re(e),t.set(e,r)),r}}class _re{constructor(e){this.id=Fre++,this.code=e,this.usedTimes=0}}function Sre(n,e,t,r,i,s,o){const a=new wU,l=new Ere,A=[],c=i.isWebGL2,u=i.logarithmicDepthBuffer,h=i.vertexTextures;let d=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(x,_,M,Y,O){const U=Y.fog,y=O.geometry,I=x.isMeshStandardMaterial?Y.environment:null,R=(x.isMeshStandardMaterial?t:e).get(x.envMap||I),N=R&&R.mapping===$C?R.image.height:null,k=p[x.type];x.precision!==null&&(d=i.getMaxPrecision(x.precision),d!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",d,"instead."));const L=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,G=L!==void 0?L.length:0;let D=0;y.morphAttributes.position!==void 0&&(D=1),y.morphAttributes.normal!==void 0&&(D=2),y.morphAttributes.color!==void 0&&(D=3);let E,z,re,T;if(k){const ce=oa[k];E=ce.vertexShader,z=ce.fragmentShader}else E=x.vertexShader,z=x.fragmentShader,l.update(x),re=l.getVertexShaderID(x),T=l.getFragmentShaderID(x);const ee=n.getRenderTarget(),pe=x.alphaTest>0,de=x.clearcoat>0,Ae=x.iridescence>0;return{isWebGL2:c,shaderID:k,shaderName:x.type,vertexShader:E,fragmentShader:z,defines:x.defines,customVertexShaderID:re,customFragmentShaderID:T,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:d,instancing:O.isInstancedMesh===!0,instancingColor:O.isInstancedMesh===!0&&O.instanceColor!==null,supportsVertexTextures:h,outputEncoding:ee===null?n.outputEncoding:ee.isXRRenderTarget===!0?ee.texture.encoding:gs,map:!!x.map,matcap:!!x.matcap,envMap:!!R,envMapMode:R&&R.mapping,envMapCubeUVHeight:N,lightMap:!!x.lightMap,aoMap:!!x.aoMap,emissiveMap:!!x.emissiveMap,bumpMap:!!x.bumpMap,normalMap:!!x.normalMap,objectSpaceNormalMap:x.normalMapType===P$,tangentSpaceNormalMap:x.normalMapType===Nu,decodeVideoTexture:!!x.map&&x.map.isVideoTexture===!0&&x.map.encoding===mt,clearcoat:de,clearcoatMap:de&&!!x.clearcoatMap,clearcoatRoughnessMap:de&&!!x.clearcoatRoughnessMap,clearcoatNormalMap:de&&!!x.clearcoatNormalMap,iridescence:Ae,iridescenceMap:Ae&&!!x.iridescenceMap,iridescenceThicknessMap:Ae&&!!x.iridescenceThicknessMap,displacementMap:!!x.displacementMap,roughnessMap:!!x.roughnessMap,metalnessMap:!!x.metalnessMap,specularMap:!!x.specularMap,specularIntensityMap:!!x.specularIntensityMap,specularColorMap:!!x.specularColorMap,opaque:x.transparent===!1&&x.blending===Zh,alphaMap:!!x.alphaMap,alphaTest:pe,gradientMap:!!x.gradientMap,sheen:x.sheen>0,sheenColorMap:!!x.sheenColorMap,sheenRoughnessMap:!!x.sheenRoughnessMap,transmission:x.transmission>0,transmissionMap:!!x.transmissionMap,thicknessMap:!!x.thicknessMap,combine:x.combine,vertexTangents:!!x.normalMap&&!!y.attributes.tangent,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,vertexUvs:!!x.map||!!x.bumpMap||!!x.normalMap||!!x.specularMap||!!x.alphaMap||!!x.emissiveMap||!!x.roughnessMap||!!x.metalnessMap||!!x.clearcoatMap||!!x.clearcoatRoughnessMap||!!x.clearcoatNormalMap||!!x.iridescenceMap||!!x.iridescenceThicknessMap||!!x.displacementMap||!!x.transmissionMap||!!x.thicknessMap||!!x.specularIntensityMap||!!x.specularColorMap||!!x.sheenColorMap||!!x.sheenRoughnessMap,uvsVertexOnly:!(x.map||x.bumpMap||x.normalMap||x.specularMap||x.alphaMap||x.emissiveMap||x.roughnessMap||x.metalnessMap||x.clearcoatNormalMap||x.iridescenceMap||x.iridescenceThicknessMap||x.transmission>0||x.transmissionMap||x.thicknessMap||x.specularIntensityMap||x.specularColorMap||x.sheen>0||x.sheenColorMap||x.sheenRoughnessMap)&&!!x.displacementMap,fog:!!U,useFog:x.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:!!x.flatShading,sizeAttenuation:x.sizeAttenuation,logarithmicDepthBuffer:u,skinning:O.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:D,numDirLights:_.directional.length,numPointLights:_.point.length,numSpotLights:_.spot.length,numSpotLightMaps:_.spotLightMap.length,numRectAreaLights:_.rectArea.length,numHemiLights:_.hemi.length,numDirLightShadows:_.directionalShadowMap.length,numPointLightShadows:_.pointShadowMap.length,numSpotLightShadows:_.spotShadowMap.length,numSpotLightShadowsWithMaps:_.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&M.length>0,shadowMapType:n.shadowMap.type,toneMapping:x.toneMapped?n.toneMapping:El,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===mi,flipSided:x.side===yi,useDepthPacking:!!x.depthPacking,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionDerivatives:x.extensions&&x.extensions.derivatives,extensionFragDepth:x.extensions&&x.extensions.fragDepth,extensionDrawBuffers:x.extensions&&x.extensions.drawBuffers,extensionShaderTextureLOD:x.extensions&&x.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:x.customProgramCacheKey()}}function g(x){const _=[];if(x.shaderID?_.push(x.shaderID):(_.push(x.customVertexShaderID),_.push(x.customFragmentShaderID)),x.defines!==void 0)for(const M in x.defines)_.push(M),_.push(x.defines[M]);return x.isRawShaderMaterial===!1&&(m(_,x),v(_,x),_.push(n.outputEncoding)),_.push(x.customProgramCacheKey),_.join()}function m(x,_){x.push(_.precision),x.push(_.outputEncoding),x.push(_.envMapMode),x.push(_.envMapCubeUVHeight),x.push(_.combine),x.push(_.vertexUvs),x.push(_.fogExp2),x.push(_.sizeAttenuation),x.push(_.morphTargetsCount),x.push(_.morphAttributeCount),x.push(_.numDirLights),x.push(_.numPointLights),x.push(_.numSpotLights),x.push(_.numSpotLightMaps),x.push(_.numHemiLights),x.push(_.numRectAreaLights),x.push(_.numDirLightShadows),x.push(_.numPointLightShadows),x.push(_.numSpotLightShadows),x.push(_.numSpotLightShadowsWithMaps),x.push(_.shadowMapType),x.push(_.toneMapping),x.push(_.numClippingPlanes),x.push(_.numClipIntersection),x.push(_.depthPacking)}function v(x,_){a.disableAll(),_.isWebGL2&&a.enable(0),_.supportsVertexTextures&&a.enable(1),_.instancing&&a.enable(2),_.instancingColor&&a.enable(3),_.map&&a.enable(4),_.matcap&&a.enable(5),_.envMap&&a.enable(6),_.lightMap&&a.enable(7),_.aoMap&&a.enable(8),_.emissiveMap&&a.enable(9),_.bumpMap&&a.enable(10),_.normalMap&&a.enable(11),_.objectSpaceNormalMap&&a.enable(12),_.tangentSpaceNormalMap&&a.enable(13),_.clearcoat&&a.enable(14),_.clearcoatMap&&a.enable(15),_.clearcoatRoughnessMap&&a.enable(16),_.clearcoatNormalMap&&a.enable(17),_.iridescence&&a.enable(18),_.iridescenceMap&&a.enable(19),_.iridescenceThicknessMap&&a.enable(20),_.displacementMap&&a.enable(21),_.specularMap&&a.enable(22),_.roughnessMap&&a.enable(23),_.metalnessMap&&a.enable(24),_.gradientMap&&a.enable(25),_.alphaMap&&a.enable(26),_.alphaTest&&a.enable(27),_.vertexColors&&a.enable(28),_.vertexAlphas&&a.enable(29),_.vertexUvs&&a.enable(30),_.vertexTangents&&a.enable(31),_.uvsVertexOnly&&a.enable(32),x.push(a.mask),a.disableAll(),_.fog&&a.enable(0),_.useFog&&a.enable(1),_.flatShading&&a.enable(2),_.logarithmicDepthBuffer&&a.enable(3),_.skinning&&a.enable(4),_.morphTargets&&a.enable(5),_.morphNormals&&a.enable(6),_.morphColors&&a.enable(7),_.premultipliedAlpha&&a.enable(8),_.shadowMapEnabled&&a.enable(9),_.physicallyCorrectLights&&a.enable(10),_.doubleSided&&a.enable(11),_.flipSided&&a.enable(12),_.useDepthPacking&&a.enable(13),_.dithering&&a.enable(14),_.specularIntensityMap&&a.enable(15),_.specularColorMap&&a.enable(16),_.transmission&&a.enable(17),_.transmissionMap&&a.enable(18),_.thicknessMap&&a.enable(19),_.sheen&&a.enable(20),_.sheenColorMap&&a.enable(21),_.sheenRoughnessMap&&a.enable(22),_.decodeVideoTexture&&a.enable(23),_.opaque&&a.enable(24),x.push(a.mask)}function w(x){const _=p[x.type];let M;if(_){const Y=oa[_];M=BU.clone(Y.uniforms)}else M=x.uniforms;return M}function B(x,_){let M;for(let Y=0,O=A.length;Y0?r.push(m):d.transparent===!0?i.push(m):t.push(m)}function l(u,h,d,p,f,g){const m=o(u,h,d,p,f,g);d.transmission>0?r.unshift(m):d.transparent===!0?i.unshift(m):t.unshift(m)}function A(u,h){t.length>1&&t.sort(u||Qre),r.length>1&&r.sort(h||XT),i.length>1&&i.sort(h||XT)}function c(){for(let u=e,h=n.length;u=s.length?(o=new jT,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function Mre(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new j,color:new Le};break;case"SpotLight":t={position:new j,direction:new j,color:new Le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new j,color:new Le,distance:0,decay:0};break;case"HemisphereLight":t={direction:new j,skyColor:new Le,groundColor:new Le};break;case"RectAreaLight":t={color:new Le,position:new j,halfWidth:new j,halfHeight:new j};break}return n[e.id]=t,t}}}function Tre(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Nre=0;function kre(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Dre(n,e){const t=new Mre,r=Tre(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let c=0;c<9;c++)i.probe.push(new j);const s=new j,o=new He,a=new He;function l(c,u){let h=0,d=0,p=0;for(let Y=0;Y<9;Y++)i.probe[Y].set(0,0,0);let f=0,g=0,m=0,v=0,w=0,B=0,C=0,b=0,F=0,x=0;c.sort(kre);const _=u!==!0?Math.PI:1;for(let Y=0,O=c.length;Y0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ve.LTC_FLOAT_1,i.rectAreaLTC2=Ve.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Ve.LTC_HALF_1,i.rectAreaLTC2=Ve.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=h,i.ambient[1]=d,i.ambient[2]=p;const M=i.hash;(M.directionalLength!==f||M.pointLength!==g||M.spotLength!==m||M.rectAreaLength!==v||M.hemiLength!==w||M.numDirectionalShadows!==B||M.numPointShadows!==C||M.numSpotShadows!==b||M.numSpotMaps!==F)&&(i.directional.length=f,i.spot.length=m,i.rectArea.length=v,i.point.length=g,i.hemi.length=w,i.directionalShadow.length=B,i.directionalShadowMap.length=B,i.pointShadow.length=C,i.pointShadowMap.length=C,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=B,i.pointShadowMatrix.length=C,i.spotLightMatrix.length=b+F-x,i.spotLightMap.length=F,i.numSpotLightShadowsWithMaps=x,M.directionalLength=f,M.pointLength=g,M.spotLength=m,M.rectAreaLength=v,M.hemiLength=w,M.numDirectionalShadows=B,M.numPointShadows=C,M.numSpotShadows=b,M.numSpotMaps=F,i.version=Nre++)}function A(c,u){let h=0,d=0,p=0,f=0,g=0;const m=u.matrixWorldInverse;for(let v=0,w=c.length;v=a.length?(l=new KT(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class Vre extends us{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=L$,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Pre extends us{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new j,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Ore=`void main() { gl_Position = vec4( position, 1.0 ); }`,Wre=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3201,7 +3201,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function Gre(n,e,t){let r=new CU;const i=new Ye,s=new Ye,o=new Dt,a=new Vre({depthPacking:V$}),l=new Pre,A={},c=t.maxTextureSize,u={0:yi,1:Lo,2:mi},h=new Sr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ye},radius:{value:4}},vertexShader:Ore,fragmentShader:Wre}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const p=new Ht;p.setAttribute("position",new ut(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new In(p,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=nZ,this.render=function(B,C,b){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||B.length===0)return;const F=n.getRenderTarget(),x=n.getActiveCubeFace(),_=n.getActiveMipmapLevel(),M=n.state;M.setBlending(XA),M.buffers.color.setClear(1,1,1,1),M.buffers.depth.setTest(!0),M.setScissorTest(!1);for(let Y=0,O=B.length;Yc||i.y>c)&&(i.x>c&&(s.x=Math.floor(c/I.x),i.x=s.x*I.x,y.mapSize.x=s.x),i.y>c&&(s.y=Math.floor(c/I.y),i.y=s.y*I.y,y.mapSize.y=s.y)),y.map===null){const N=this.type!==fg?{minFilter:nr,magFilter:nr}:{};y.map=new Qa(i.x,i.y,N),y.map.texture.name=U.name+".shadowMap",y.camera.updateProjectionMatrix()}n.setRenderTarget(y.map),n.clear();const R=y.getViewportCount();for(let N=0;N0){const O=M.uuid,U=C.uuid;let y=A[O];y===void 0&&(y={},A[O]=y);let I=y[U];I===void 0&&(I=M.clone(),y[U]=I),M=I}return M.visible=C.visible,M.wireframe=C.wireframe,_===fg?M.side=C.shadowSide!==null?C.shadowSide:C.side:M.side=C.shadowSide!==null?C.shadowSide:u[C.side],M.alphaMap=C.alphaMap,M.alphaTest=C.alphaTest,M.clipShadows=C.clipShadows,M.clippingPlanes=C.clippingPlanes,M.clipIntersection=C.clipIntersection,M.displacementMap=C.displacementMap,M.displacementScale=C.displacementScale,M.displacementBias=C.displacementBias,M.wireframeLinewidth=C.wireframeLinewidth,M.linewidth=C.linewidth,b.isPointLight===!0&&M.isMeshDistanceMaterial===!0&&(M.referencePosition.setFromMatrixPosition(b.matrixWorld),M.nearDistance=F,M.farDistance=x),M}function w(B,C,b,F,x){if(B.visible===!1)return;if(B.layers.test(C.layers)&&(B.isMesh||B.isLine||B.isPoints)&&(B.castShadow||B.receiveShadow&&x===fg)&&(!B.frustumCulled||r.intersectsObject(B))){B.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,B.matrixWorld);const Y=e.update(B),O=B.material;if(Array.isArray(O)){const U=Y.groups;for(let y=0,I=U.length;y=1):k.indexOf("OpenGL ES")!==-1&&(N=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),R=N>=2);let V=null,G={};const D=n.getParameter(3088),E=n.getParameter(2978),z=new Dt().fromArray(D),re=new Dt().fromArray(E);function T(he,Ee,Se){const Re=new Uint8Array(4),Je=n.createTexture();n.bindTexture(he,Je),n.texParameteri(he,10241,9728),n.texParameteri(he,10240,9728);for(let qe=0;qe"u"?"":navigator.userAgent),p=new WeakMap;let f;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(W,H){return m?new OffscreenCanvas(W,H):Qm("canvas")}function w(W,H,ie,ae){let me=1;if((W.width>ae||W.height>ae)&&(me=ae/Math.max(W.width,W.height)),me<1||H===!0)if(typeof HTMLImageElement<"u"&&W instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&W instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&W instanceof ImageBitmap){const J=H?CB:Math.floor,Q=J(me*W.width),S=J(me*W.height);f===void 0&&(f=v(Q,S));const Z=ie?v(Q,S):f;return Z.width=Q,Z.height=S,Z.getContext("2d").drawImage(W,0,0,Q,S),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+W.width+"x"+W.height+") to ("+Q+"x"+S+")."),Z}else return"data"in W&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+W.width+"x"+W.height+")."),W;return W}function B(W){return xE(W.width)&&xE(W.height)}function C(W){return a?!1:W.wrapS!==fi||W.wrapT!==fi||W.minFilter!==nr&&W.minFilter!==ci}function b(W,H){return W.generateMipmaps&&H&&W.minFilter!==nr&&W.minFilter!==ci}function F(W){n.generateMipmap(W)}function x(W,H,ie,ae,me=!1){if(a===!1)return H;if(W!==null){if(n[W]!==void 0)return n[W];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+W+"'")}let J=H;return H===6403&&(ie===5126&&(J=33326),ie===5131&&(J=33325),ie===5121&&(J=33321)),H===33319&&(ie===5126&&(J=33328),ie===5131&&(J=33327),ie===5121&&(J=33323)),H===6408&&(ie===5126&&(J=34836),ie===5131&&(J=34842),ie===5121&&(J=ae===mt&&me===!1?35907:32856),ie===32819&&(J=32854),ie===32820&&(J=32855)),(J===33325||J===33326||J===33327||J===33328||J===34842||J===34836)&&e.get("EXT_color_buffer_float"),J}function _(W,H,ie){return b(W,ie)===!0||W.isFramebufferTexture&&W.minFilter!==nr&&W.minFilter!==ci?Math.log2(Math.max(H.width,H.height))+1:W.mipmaps!==void 0&&W.mipmaps.length>0?W.mipmaps.length:W.isCompressedTexture&&Array.isArray(W.image)?H.mipmaps.length:1}function M(W){return W===nr||W===yB||W===wB?9728:9729}function Y(W){const H=W.target;H.removeEventListener("dispose",Y),U(H),H.isVideoTexture&&p.delete(H)}function O(W){const H=W.target;H.removeEventListener("dispose",O),I(H)}function U(W){const H=r.get(W);if(H.__webglInit===void 0)return;const ie=W.source,ae=g.get(ie);if(ae){const me=ae[H.__cacheKey];me.usedTimes--,me.usedTimes===0&&y(W),Object.keys(ae).length===0&&g.delete(ie)}r.remove(W)}function y(W){const H=r.get(W);n.deleteTexture(H.__webglTexture);const ie=W.source,ae=g.get(ie);delete ae[H.__cacheKey],o.memory.textures--}function I(W){const H=W.texture,ie=r.get(W),ae=r.get(H);if(ae.__webglTexture!==void 0&&(n.deleteTexture(ae.__webglTexture),o.memory.textures--),W.depthTexture&&W.depthTexture.dispose(),W.isWebGLCubeRenderTarget)for(let me=0;me<6;me++)n.deleteFramebuffer(ie.__webglFramebuffer[me]),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer[me]);else{if(n.deleteFramebuffer(ie.__webglFramebuffer),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer),ie.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ie.__webglMultisampledFramebuffer),ie.__webglColorRenderbuffer)for(let me=0;me=l&&console.warn("THREE.WebGLTextures: Trying to use "+W+" texture units while this GPU supports only "+l),R+=1,W}function V(W){const H=[];return H.push(W.wrapS),H.push(W.wrapT),H.push(W.wrapR||0),H.push(W.magFilter),H.push(W.minFilter),H.push(W.anisotropy),H.push(W.internalFormat),H.push(W.format),H.push(W.type),H.push(W.generateMipmaps),H.push(W.premultiplyAlpha),H.push(W.flipY),H.push(W.unpackAlignment),H.push(W.encoding),H.join()}function G(W,H){const ie=r.get(W);if(W.isVideoTexture&&ye(W),W.isRenderTargetTexture===!1&&W.version>0&&ie.__version!==W.version){const ae=W.image;if(ae===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ae.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{de(ie,W,H);return}}t.bindTexture(3553,ie.__webglTexture,33984+H)}function D(W,H){const ie=r.get(W);if(W.version>0&&ie.__version!==W.version){de(ie,W,H);return}t.bindTexture(35866,ie.__webglTexture,33984+H)}function E(W,H){const ie=r.get(W);if(W.version>0&&ie.__version!==W.version){de(ie,W,H);return}t.bindTexture(32879,ie.__webglTexture,33984+H)}function z(W,H){const ie=r.get(W);if(W.version>0&&ie.__version!==W.version){Ae(ie,W,H);return}t.bindTexture(34067,ie.__webglTexture,33984+H)}const re={[ps]:10497,[fi]:33071,[_m]:33648},T={[nr]:9728,[yB]:9984,[wB]:9986,[ci]:9729,[gU]:9985,[Tu]:9987};function ee(W,H,ie){if(ie?(n.texParameteri(W,10242,re[H.wrapS]),n.texParameteri(W,10243,re[H.wrapT]),(W===32879||W===35866)&&n.texParameteri(W,32882,re[H.wrapR]),n.texParameteri(W,10240,T[H.magFilter]),n.texParameteri(W,10241,T[H.minFilter])):(n.texParameteri(W,10242,33071),n.texParameteri(W,10243,33071),(W===32879||W===35866)&&n.texParameteri(W,32882,33071),(H.wrapS!==fi||H.wrapT!==fi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(W,10240,M(H.magFilter)),n.texParameteri(W,10241,M(H.minFilter)),H.minFilter!==nr&&H.minFilter!==ci&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ae=e.get("EXT_texture_filter_anisotropic");if(H.type===MA&&e.has("OES_texture_float_linear")===!1||a===!1&&H.type===Sm&&e.has("OES_texture_half_float_linear")===!1)return;(H.anisotropy>1||r.get(H).__currentAnisotropy)&&(n.texParameterf(W,ae.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(H.anisotropy,i.getMaxAnisotropy())),r.get(H).__currentAnisotropy=H.anisotropy)}}function pe(W,H){let ie=!1;W.__webglInit===void 0&&(W.__webglInit=!0,H.addEventListener("dispose",Y));const ae=H.source;let me=g.get(ae);me===void 0&&(me={},g.set(ae,me));const J=V(H);if(J!==W.__cacheKey){me[J]===void 0&&(me[J]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ie=!0),me[J].usedTimes++;const Q=me[W.__cacheKey];Q!==void 0&&(me[W.__cacheKey].usedTimes--,Q.usedTimes===0&&y(H)),W.__cacheKey=J,W.__webglTexture=me[J].texture}return ie}function de(W,H,ie){let ae=3553;(H.isDataArrayTexture||H.isCompressedArrayTexture)&&(ae=35866),H.isData3DTexture&&(ae=32879);const me=pe(W,H),J=H.source;t.bindTexture(ae,W.__webglTexture,33984+ie);const Q=r.get(J);if(J.version!==Q.__version||me===!0){t.activeTexture(33984+ie),n.pixelStorei(37440,H.flipY),n.pixelStorei(37441,H.premultiplyAlpha),n.pixelStorei(3317,H.unpackAlignment),n.pixelStorei(37443,0);const S=C(H)&&B(H.image)===!1;let Z=w(H.image,S,!1,c);Z=be(H,Z);const te=B(Z)||a,le=s.convert(H.format,H.encoding);let se=s.convert(H.type),Ue=x(H.internalFormat,le,se,H.encoding,H.isVideoTexture);ee(ae,H,te);let _e;const Te=H.mipmaps,Pe=a&&H.isVideoTexture!==!0,ke=Q.__version===void 0||me===!0,he=_(H,Z,te);if(H.isDepthTexture)Ue=6402,a?H.type===MA?Ue=36012:H.type===Kc?Ue=33190:H.type===Jh?Ue=35056:Ue=33189:H.type===MA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),H.format===Au&&Ue===6402&&H.type!==oZ&&H.type!==Kc&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),H.type=Kc,se=s.convert(H.type)),H.format===Cf&&Ue===6402&&(Ue=34041,H.type!==Jh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),H.type=Jh,se=s.convert(H.type))),ke&&(Pe?t.texStorage2D(3553,1,Ue,Z.width,Z.height):t.texImage2D(3553,0,Ue,Z.width,Z.height,0,le,se,null));else if(H.isDataTexture)if(Te.length>0&&te){Pe&&ke&&t.texStorage2D(3553,he,Ue,Te[0].width,Te[0].height);for(let Ee=0,Se=Te.length;Ee>=1,Se>>=1}}else if(Te.length>0&&te){Pe&&ke&&t.texStorage2D(3553,he,Ue,Te[0].width,Te[0].height);for(let Ee=0,Se=Te.length;Ee0&&ke++,t.texStorage2D(34067,ke,_e,Z[0].width,Z[0].height));for(let Ee=0;Ee<6;Ee++)if(S){Te?t.texSubImage2D(34069+Ee,0,0,0,Z[Ee].width,Z[Ee].height,se,Ue,Z[Ee].data):t.texImage2D(34069+Ee,0,_e,Z[Ee].width,Z[Ee].height,0,se,Ue,Z[Ee].data);for(let Se=0;Se=34069&&me<=34074)&&n.framebufferTexture2D(36160,ae,me,r.get(ie).__webglTexture,0),t.bindFramebuffer(36160,null)}function ce(W,H,ie){if(n.bindRenderbuffer(36161,W),H.depthBuffer&&!H.stencilBuffer){let ae=33189;if(ie||oe(H)){const me=H.depthTexture;me&&me.isDepthTexture&&(me.type===MA?ae=36012:me.type===Kc&&(ae=33190));const J=K(H);oe(H)?h.renderbufferStorageMultisampleEXT(36161,J,ae,H.width,H.height):n.renderbufferStorageMultisample(36161,J,ae,H.width,H.height)}else n.renderbufferStorage(36161,ae,H.width,H.height);n.framebufferRenderbuffer(36160,36096,36161,W)}else if(H.depthBuffer&&H.stencilBuffer){const ae=K(H);ie&&oe(H)===!1?n.renderbufferStorageMultisample(36161,ae,35056,H.width,H.height):oe(H)?h.renderbufferStorageMultisampleEXT(36161,ae,35056,H.width,H.height):n.renderbufferStorage(36161,34041,H.width,H.height),n.framebufferRenderbuffer(36160,33306,36161,W)}else{const ae=H.isWebGLMultipleRenderTargets===!0?H.texture:[H.texture];for(let me=0;me0&&oe(W)===!1){const S=J?H:[H];ie.__webglMultisampledFramebuffer=n.createFramebuffer(),ie.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,ie.__webglMultisampledFramebuffer);for(let Z=0;Z0&&oe(W)===!1){const H=W.isWebGLMultipleRenderTargets?W.texture:[W.texture],ie=W.width,ae=W.height;let me=16384;const J=[],Q=W.stencilBuffer?33306:36096,S=r.get(W),Z=W.isWebGLMultipleRenderTargets===!0;if(Z)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&H.__useRenderToTexture!==!1}function ye(W){const H=o.render.frame;p.get(W)!==H&&(p.set(W,H),W.update())}function be(W,H){const ie=W.encoding,ae=W.format,me=W.type;return W.isCompressedTexture===!0||W.isVideoTexture===!0||W.format===bE||ie!==gs&&(ie===mt?a===!1?e.has("EXT_sRGB")===!0&&ae===Ir?(W.format=bE,W.minFilter=ci,W.generateMipmaps=!1):H=uZ.sRGBToLinear(H):(ae!==Ir||me!==oc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",ie)),H}this.allocateTextureUnit=k,this.resetTextureUnits=N,this.setTexture2D=G,this.setTexture2DArray=D,this.setTexture3D=E,this.setTextureCube=z,this.rebindTextures=P,this.setupRenderTarget=fe,this.updateRenderTargetMipmap=ue,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=Fe,this.setupFrameBufferTexture=$,this.useMultisampledRTT=oe}function Hre(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===oc)return 5121;if(s===B$)return 32819;if(s===C$)return 32820;if(s===v$)return 5120;if(s===y$)return 5122;if(s===oZ)return 5123;if(s===w$)return 5124;if(s===Kc)return 5125;if(s===MA)return 5126;if(s===Sm)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===b$)return 6406;if(s===Ir)return 6408;if(s===I$)return 6409;if(s===F$)return 6410;if(s===Au)return 6402;if(s===Cf)return 34041;if(s===E$)return 6403;if(s===x$)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===bE)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===_$)return 36244;if(s===S$)return 33319;if(s===U$)return 33320;if(s===Q$)return 36249;if(s===jx||s===Kx||s===$x||s===qx)if(o===mt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===jx)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Kx)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===$x)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===qx)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===jx)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Kx)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===$x)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===qx)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===KM||s===$M||s===qM||s===eT)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===KM)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===$M)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===qM)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===eT)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===R$)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===tT||s===nT)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===tT)return o===mt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===nT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===rT||s===iT||s===sT||s===oT||s===aT||s===lT||s===AT||s===cT||s===uT||s===dT||s===hT||s===fT||s===pT||s===gT)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===rT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===iT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===sT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===oT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===aT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===lT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===AT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===cT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===uT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===dT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===hT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===fT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===pT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===gT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===mT)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===mT)return o===mt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===Jh?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:i}}class zre extends Nr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class kr extends Rt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Yre={type:"move"};class F1{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new kr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new kr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new kr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,A=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(A&&e.hand){o=!0;for(const f of e.hand.values()){const g=t.getJointPose(f,r);if(A.joints[f.jointName]===void 0){const v=new kr;v.matrixAutoUpdate=!1,v.visible=!1,A.joints[f.jointName]=v,A.add(v)}const m=A.joints[f.jointName];g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}const c=A.joints["index-finger-tip"],u=A.joints["thumb-tip"],h=c.position.distanceTo(u.position),d=.02,p=.005;A.inputState.pinching&&h>d+p?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!A.inputState.pinching&&h<=d-p&&(A.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Yre)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),A!==null&&(A.visible=o!==null),this}}class BZ extends or{constructor(e,t,r,i,s,o,a,l,A,c){if(c=c!==void 0?c:Au,c!==Au&&c!==Cf)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&c===Au&&(r=Kc),r===void 0&&c===Cf&&(r=Jh),super(null,i,s,o,a,l,c,r,A),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:nr,this.minFilter=l!==void 0?l:nr,this.flipY=!1,this.generateMipmaps=!1}}class Xre extends yc{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=null,A=null,c=null,u=null,h=null,d=null;const p=t.getContextAttributes();let f=null,g=null;const m=[],v=[],w=new Nr;w.layers.enable(1),w.viewport=new Dt;const B=new Nr;B.layers.enable(2),B.viewport=new Dt;const C=[w,B],b=new zre;b.layers.enable(1),b.layers.enable(2);let F=null,x=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let G=m[V];return G===void 0&&(G=new F1,m[V]=G),G.getTargetRaySpace()},this.getControllerGrip=function(V){let G=m[V];return G===void 0&&(G=new F1,m[V]=G),G.getGripSpace()},this.getHand=function(V){let G=m[V];return G===void 0&&(G=new F1,m[V]=G),G.getHandSpace()};function _(V){const G=v.indexOf(V.inputSource);if(G===-1)return;const D=m[G];D!==void 0&&D.dispatchEvent({type:V.type,data:V.inputSource})}function M(){i.removeEventListener("select",_),i.removeEventListener("selectstart",_),i.removeEventListener("selectend",_),i.removeEventListener("squeeze",_),i.removeEventListener("squeezestart",_),i.removeEventListener("squeezeend",_),i.removeEventListener("end",M),i.removeEventListener("inputsourceschange",Y);for(let V=0;V=0&&(v[E]=null,m[E].dispatchEvent({type:"disconnected",data:D}))}for(let G=0;G=v.length){v.push(D),E=re;break}else if(v[re]===null){v[re]=D,E=re;break}if(E===-1)break}const z=m[E];z&&z.dispatchEvent({type:"connected",data:D})}}const O=new j,U=new j;function y(V,G,D){O.setFromMatrixPosition(G.matrixWorld),U.setFromMatrixPosition(D.matrixWorld);const E=O.distanceTo(U),z=G.projectionMatrix.elements,re=D.projectionMatrix.elements,T=z[14]/(z[10]-1),ee=z[14]/(z[10]+1),pe=(z[9]+1)/z[5],de=(z[9]-1)/z[5],Ae=(z[8]-1)/z[0],$=(re[8]+1)/re[0],ce=T*Ae,ge=T*$,Fe=E/(-Ae+$),P=Fe*-Ae;G.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(P),V.translateZ(Fe),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const fe=T+Fe,ue=ee+Fe,q=ce-P,K=ge+(E-P),oe=pe*ee/ue*fe,ye=de*ee/ue*fe;V.projectionMatrix.makePerspective(q,K,oe,ye,fe,ue)}function I(V,G){G===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(G.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;b.near=B.near=w.near=V.near,b.far=B.far=w.far=V.far,(F!==b.near||x!==b.far)&&(i.updateRenderState({depthNear:b.near,depthFar:b.far}),F=b.near,x=b.far);const G=V.parent,D=b.cameras;I(b,G);for(let z=0;z0&&(f.alphaTest.value=g.alphaTest);const m=e.get(g).envMap;if(m&&(f.envMap.value=m,f.flipEnvMap.value=m.isCubeTexture&&m.isRenderTargetTexture===!1?-1:1,f.reflectivity.value=g.reflectivity,f.ior.value=g.ior,f.refractionRatio.value=g.refractionRatio),g.lightMap){f.lightMap.value=g.lightMap;const B=n.physicallyCorrectLights!==!0?Math.PI:1;f.lightMapIntensity.value=g.lightMapIntensity*B}g.aoMap&&(f.aoMap.value=g.aoMap,f.aoMapIntensity.value=g.aoMapIntensity);let v;g.map?v=g.map:g.specularMap?v=g.specularMap:g.displacementMap?v=g.displacementMap:g.normalMap?v=g.normalMap:g.bumpMap?v=g.bumpMap:g.roughnessMap?v=g.roughnessMap:g.metalnessMap?v=g.metalnessMap:g.alphaMap?v=g.alphaMap:g.emissiveMap?v=g.emissiveMap:g.clearcoatMap?v=g.clearcoatMap:g.clearcoatNormalMap?v=g.clearcoatNormalMap:g.clearcoatRoughnessMap?v=g.clearcoatRoughnessMap:g.iridescenceMap?v=g.iridescenceMap:g.iridescenceThicknessMap?v=g.iridescenceThicknessMap:g.specularIntensityMap?v=g.specularIntensityMap:g.specularColorMap?v=g.specularColorMap:g.transmissionMap?v=g.transmissionMap:g.thicknessMap?v=g.thicknessMap:g.sheenColorMap?v=g.sheenColorMap:g.sheenRoughnessMap&&(v=g.sheenRoughnessMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),f.uvTransform.value.copy(v.matrix));let w;g.aoMap?w=g.aoMap:g.lightMap&&(w=g.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),f.uv2Transform.value.copy(w.matrix))}function s(f,g){f.diffuse.value.copy(g.color),f.opacity.value=g.opacity}function o(f,g){f.dashSize.value=g.dashSize,f.totalSize.value=g.dashSize+g.gapSize,f.scale.value=g.scale}function a(f,g,m,v){f.diffuse.value.copy(g.color),f.opacity.value=g.opacity,f.size.value=g.size*m,f.scale.value=v*.5,g.map&&(f.map.value=g.map),g.alphaMap&&(f.alphaMap.value=g.alphaMap),g.alphaTest>0&&(f.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),f.uvTransform.value.copy(w.matrix))}function l(f,g){f.diffuse.value.copy(g.color),f.opacity.value=g.opacity,f.rotation.value=g.rotation,g.map&&(f.map.value=g.map),g.alphaMap&&(f.alphaMap.value=g.alphaMap),g.alphaTest>0&&(f.alphaTest.value=g.alphaTest);let m;g.map?m=g.map:g.alphaMap&&(m=g.alphaMap),m!==void 0&&(m.matrixAutoUpdate===!0&&m.updateMatrix(),f.uvTransform.value.copy(m.matrix))}function A(f,g){f.specular.value.copy(g.specular),f.shininess.value=Math.max(g.shininess,1e-4)}function c(f,g){g.gradientMap&&(f.gradientMap.value=g.gradientMap)}function u(f,g){f.roughness.value=g.roughness,f.metalness.value=g.metalness,g.roughnessMap&&(f.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(f.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(f.envMapIntensity.value=g.envMapIntensity)}function h(f,g,m){f.ior.value=g.ior,g.sheen>0&&(f.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),f.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(f.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(f.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(f.clearcoat.value=g.clearcoat,f.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(f.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(f.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),f.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===yi&&f.clearcoatNormalScale.value.negate())),g.iridescence>0&&(f.iridescence.value=g.iridescence,f.iridescenceIOR.value=g.iridescenceIOR,f.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(f.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(f.transmission.value=g.transmission,f.transmissionSamplerMap.value=m.texture,f.transmissionSamplerSize.value.set(m.width,m.height),g.transmissionMap&&(f.transmissionMap.value=g.transmissionMap),f.thickness.value=g.thickness,g.thicknessMap&&(f.thicknessMap.value=g.thicknessMap),f.attenuationDistance.value=g.attenuationDistance,f.attenuationColor.value.copy(g.attenuationColor)),f.specularIntensity.value=g.specularIntensity,f.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(f.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(f.specularColorMap.value=g.specularColorMap)}function d(f,g){g.matcap&&(f.matcap.value=g.matcap)}function p(f,g){f.referencePosition.value.copy(g.referencePosition),f.nearDistance.value=g.nearDistance,f.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function Kre(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(v,w){const B=w.program;r.uniformBlockBinding(v,B)}function A(v,w){let B=i[v.id];B===void 0&&(p(v),B=c(v),i[v.id]=B,v.addEventListener("dispose",g));const C=w.program;r.updateUBOMapping(v,C);const b=e.render.frame;s[v.id]!==b&&(h(v),s[v.id]=b)}function c(v){const w=u();v.__bindingPointIndex=w;const B=n.createBuffer(),C=v.__size,b=v.usage;return n.bindBuffer(35345,B),n.bufferData(35345,C,b),n.bindBuffer(35345,null),n.bindBufferBase(35345,w,B),B}function u(){for(let v=0;v0){b=B%C;const Y=C-b;b!==0&&Y-M.boundary<0&&(B+=C-b,_.__offset=B)}B+=M.storage}return b=B%C,b>0&&(B+=C-b),v.__size=B,v.__cache={},this}function f(v){const w=v.value,B={boundary:0,storage:0};return typeof w=="number"?(B.boundary=4,B.storage=4):w.isVector2?(B.boundary=8,B.storage=8):w.isVector3||w.isColor?(B.boundary=16,B.storage=12):w.isVector4?(B.boundary=16,B.storage=16):w.isMatrix3?(B.boundary=48,B.storage=48):w.isMatrix4?(B.boundary=64,B.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),B}function g(v){const w=v.target;w.removeEventListener("dispose",g);const B=o.indexOf(w.__bindingPointIndex);o.splice(B,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function m(){for(const v in i)n.deleteBuffer(i[v]);o=[],i={},s={}}return{bind:l,update:A,dispose:m}}function $re(){const n=Qm("canvas");return n.style.display="block",n}function h0(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:$re(),t=n.context!==void 0?n.context:null,r=n.depth!==void 0?n.depth:!0,i=n.stencil!==void 0?n.stencil:!0,s=n.antialias!==void 0?n.antialias:!1,o=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,a=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",A=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let c;t!==null?c=t.getContextAttributes().alpha:c=n.alpha!==void 0?n.alpha:!1;let u=null,h=null;const d=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=gs,this.physicallyCorrectLights=!1,this.toneMapping=El,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const f=this;let g=!1,m=0,v=0,w=null,B=-1,C=null;const b=new Dt,F=new Dt;let x=null,_=e.width,M=e.height,Y=1,O=null,U=null;const y=new Dt(0,0,_,M),I=new Dt(0,0,_,M);let R=!1;const N=new CU;let k=!1,V=!1,G=null;const D=new He,E=new Ye,z=new j,re={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function T(){return w===null?Y:1}let ee=t;function pe(ne,ve){for(let xe=0;xe0?h=p[p.length-1]:h=null,d.pop(),d.length>0?u=d[d.length-1]:u=null};function dt(ne,ve,xe,Ce){if(ne.visible===!1)return;if(ne.layers.test(ve.layers)){if(ne.isGroup)xe=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(ve);else if(ne.isLight)h.pushLight(ne),ne.castShadow&&h.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||N.intersectsSprite(ne)){Ce&&z.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(D);const lt=K.update(ne),$e=ne.material;$e.visible&&u.push(ne,lt,$e,xe,z.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(ne.isSkinnedMesh&&ne.skeleton.frame!==ce.render.frame&&(ne.skeleton.update(),ne.skeleton.frame=ce.render.frame),!ne.frustumCulled||N.intersectsObject(ne))){Ce&&z.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(D);const lt=K.update(ne),$e=ne.material;if(Array.isArray($e)){const je=lt.groups;for(let Bt=0,pt=je.length;Bt0&&Et(Ie,ve,xe),Ce&&$.viewport(b.copy(Ce)),Ie.length>0&&st(Ie,ve,xe),We.length>0&&st(We,ve,xe),lt.length>0&&st(lt,ve,xe),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Et(ne,ve,xe){const Ce=Ae.isWebGL2;G===null&&(G=new Qa(1,1,{generateMipmaps:!0,type:de.has("EXT_color_buffer_half_float")?Sm:oc,minFilter:Tu,samples:Ce&&s===!0?4:0})),f.getDrawingBufferSize(E),Ce?G.setSize(E.x,E.y):G.setSize(CB(E.x),CB(E.y));const Ie=f.getRenderTarget();f.setRenderTarget(G),f.clear();const We=f.toneMapping;f.toneMapping=El,st(ne,ve,xe),f.toneMapping=We,Fe.updateMultisampleRenderTarget(G),Fe.updateRenderTargetMipmap(G),f.setRenderTarget(Ie)}function st(ne,ve,xe){const Ce=ve.isScene===!0?ve.overrideMaterial:null;for(let Ie=0,We=ne.length;Ie0&&Fe.useMultisampledRTT(ne)===!1?Ie=ge.get(ne).__webglMultisampledFramebuffer:Ie=pt,b.copy(ne.viewport),F.copy(ne.scissor),x=ne.scissorTest}else b.copy(y).multiplyScalar(Y).floor(),F.copy(I).multiplyScalar(Y).floor(),x=R;if($.bindFramebuffer(36160,Ie)&&Ae.drawBuffers&&Ce&&$.drawBuffers(ne,Ie),$.viewport(b),$.scissor(F),$.setScissorTest(x),We){const je=ge.get(ne.texture);ee.framebufferTexture2D(36160,36064,34069+ve,je.__webglTexture,xe)}else if(lt){const je=ge.get(ne.texture),Bt=ve||0;ee.framebufferTextureLayer(36160,36064,je.__webglTexture,xe||0,Bt)}B=-1},this.readRenderTargetPixels=function(ne,ve,xe,Ce,Ie,We,lt){if(!(ne&&ne.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let $e=ge.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&<!==void 0&&($e=$e[lt]),$e){$.bindFramebuffer(36160,$e);try{const je=ne.texture,Bt=je.format,pt=je.type;if(Bt!==Ir&&S.convert(Bt)!==ee.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const yt=pt===Sm&&(de.has("EXT_color_buffer_half_float")||Ae.isWebGL2&&de.has("EXT_color_buffer_float"));if(pt!==oc&&S.convert(pt)!==ee.getParameter(35738)&&!(pt===MA&&(Ae.isWebGL2||de.has("OES_texture_float")||de.has("WEBGL_color_buffer_float")))&&!yt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ve>=0&&ve<=ne.width-Ce&&xe>=0&&xe<=ne.height-Ie&&ee.readPixels(ve,xe,Ce,Ie,S.convert(Bt),S.convert(pt),We)}finally{const je=w!==null?ge.get(w).__webglFramebuffer:null;$.bindFramebuffer(36160,je)}}},this.copyFramebufferToTexture=function(ne,ve,xe=0){const Ce=Math.pow(2,-xe),Ie=Math.floor(ve.image.width*Ce),We=Math.floor(ve.image.height*Ce);Fe.setTexture2D(ve,0),ee.copyTexSubImage2D(3553,xe,0,0,ne.x,ne.y,Ie,We),$.unbindTexture()},this.copyTextureToTexture=function(ne,ve,xe,Ce=0){const Ie=ve.image.width,We=ve.image.height,lt=S.convert(xe.format),$e=S.convert(xe.type);Fe.setTexture2D(xe,0),ee.pixelStorei(37440,xe.flipY),ee.pixelStorei(37441,xe.premultiplyAlpha),ee.pixelStorei(3317,xe.unpackAlignment),ve.isDataTexture?ee.texSubImage2D(3553,Ce,ne.x,ne.y,Ie,We,lt,$e,ve.image.data):ve.isCompressedTexture?ee.compressedTexSubImage2D(3553,Ce,ne.x,ne.y,ve.mipmaps[0].width,ve.mipmaps[0].height,lt,ve.mipmaps[0].data):ee.texSubImage2D(3553,Ce,ne.x,ne.y,lt,$e,ve.image),Ce===0&&xe.generateMipmaps&&ee.generateMipmap(3553),$.unbindTexture()},this.copyTextureToTexture3D=function(ne,ve,xe,Ce,Ie=0){if(f.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const We=ne.max.x-ne.min.x+1,lt=ne.max.y-ne.min.y+1,$e=ne.max.z-ne.min.z+1,je=S.convert(Ce.format),Bt=S.convert(Ce.type);let pt;if(Ce.isData3DTexture)Fe.setTexture3D(Ce,0),pt=32879;else if(Ce.isDataArrayTexture)Fe.setTexture2DArray(Ce,0),pt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ee.pixelStorei(37440,Ce.flipY),ee.pixelStorei(37441,Ce.premultiplyAlpha),ee.pixelStorei(3317,Ce.unpackAlignment);const yt=ee.getParameter(3314),zt=ee.getParameter(32878),Wr=ee.getParameter(3316),Wo=ee.getParameter(3315),Go=ee.getParameter(32877),bi=xe.isCompressedTexture?xe.mipmaps[0]:xe.image;ee.pixelStorei(3314,bi.width),ee.pixelStorei(32878,bi.height),ee.pixelStorei(3316,ne.min.x),ee.pixelStorei(3315,ne.min.y),ee.pixelStorei(32877,ne.min.z),xe.isDataTexture||xe.isData3DTexture?ee.texSubImage3D(pt,Ie,ve.x,ve.y,ve.z,We,lt,$e,je,Bt,bi.data):xe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ee.compressedTexSubImage3D(pt,Ie,ve.x,ve.y,ve.z,We,lt,$e,je,bi.data)):ee.texSubImage3D(pt,Ie,ve.x,ve.y,ve.z,We,lt,$e,je,Bt,bi),ee.pixelStorei(3314,yt),ee.pixelStorei(32878,zt),ee.pixelStorei(3316,Wr),ee.pixelStorei(3315,Wo),ee.pixelStorei(32877,Go),Ie===0&&Ce.generateMipmaps&&ee.generateMipmap(pt),$.unbindTexture()},this.initTexture=function(ne){ne.isCubeTexture?Fe.setTextureCube(ne,0):ne.isData3DTexture?Fe.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Fe.setTexture2DArray(ne,0):Fe.setTexture2D(ne,0),$.unbindTexture()},this.resetState=function(){m=0,v=0,w=null,$.reset(),Z.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class qre extends h0{}qre.prototype.isWebGL1Renderer=!0;class bB extends Rt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.backgroundBlurriness=this.backgroundBlurriness),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class eie{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=CE,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=No()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;il)continue;h.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(h);xe.far||t.push({distance:x,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),v=Math.min(g.count,o.start+o.count);for(let w=m,B=v-1;wl)continue;h.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(h);be.far||t.push({distance:b,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:A,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class oie{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,A;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),A=r[i]-o,A<0)a=i+1;else if(A>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const c=r[i],h=r[i+1]-c,d=(o-c)/h;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new Ye:new j);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new j,i=[],s=[],o=[],a=new j,l=new He;for(let d=0;d<=e;d++){const p=d/e;i[d]=this.getTangentAt(p,new j)}s[0]=new j,o[0]=new j;let A=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),h=Math.abs(i[0].z);c<=A&&(A=c,r.set(1,0,0)),u<=A&&(A=u,r.set(0,1,0)),h<=A&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(pr(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,p))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(pr(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],d*p)),o[p].crossVectors(i[p],s[p])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class nb extends Ht{constructor(e=1,t=1,r=1,i=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const A=this;i=Math.floor(i),s=Math.floor(s);const c=[],u=[],h=[],d=[];let p=0;const f=[],g=r/2;let m=0;v(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(c),this.setAttribute("position",new rn(u,3)),this.setAttribute("normal",new rn(h,3)),this.setAttribute("uv",new rn(d,2));function v(){const B=new j,C=new j;let b=0;const F=(t-e)/r;for(let x=0;x<=s;x++){const _=[],M=x/s,Y=M*(t-e)+e;for(let O=0;O<=i;O++){const U=O/i,y=U*l+a,I=Math.sin(y),R=Math.cos(y);C.x=Y*I,C.y=-M*r+g,C.z=Y*R,u.push(C.x,C.y,C.z),B.set(I,F,R).normalize(),h.push(B.x,B.y,B.z),d.push(U,1-M),_.push(p++)}f.push(_)}for(let x=0;x0)&&d.push(w,B,b),(m!==r-1||l0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class _1 extends us{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Le(16777215),this.specular=new Le(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nu,this.normalScale=new Ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=KC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aie extends us{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nu,this.normalScale=new Ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class lie extends us{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nu,this.normalScale=new Ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=KC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function lA(n,e,t){return xZ(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function Mv(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function xZ(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Aie(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function dN(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function IZ(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}class p0{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,i=t[r],s=t[r-1];e:{t:{let o;n:{r:if(!(e=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=lA(r,s,o),this.values=lA(this.values,s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&xZ(i))for(let a=0,l=i.length;a!==l;++a){const A=i[a];if(isNaN(A)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,A),e=!1;break}}return e}optimize(){const e=lA(this.times),t=lA(this.values),r=this.getValueSize(),i=this.getInterpolation()===e1,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,A=0;A!==r;++A)t[l+A]=t[a+A];++o}return o!==e.length?(this.times=lA(e,0,o),this.values=lA(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=lA(this.times,0),t=lA(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}La.prototype.TimeBufferType=Float32Array;La.prototype.ValueBufferType=Float32Array;La.prototype.DefaultInterpolation=Cu;class Of extends La{}Of.prototype.ValueTypeName="bool";Of.prototype.ValueBufferType=Array;Of.prototype.DefaultInterpolation=bf;Of.prototype.InterpolantFactoryMethodLinear=void 0;Of.prototype.InterpolantFactoryMethodSmooth=void 0;class EZ extends La{}EZ.prototype.ValueTypeName="color";class If extends La{}If.prototype.ValueTypeName="number";class die extends p0{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let A=e*a;for(let c=A+a;A!==c;A+=4)rt.slerpFlat(s,0,o,A-a,o,A,l);return s}}class Ra extends La{InterpolantFactoryMethodLinear(e){return new die(this.times,this.values,this.getValueSize(),e)}}Ra.prototype.ValueTypeName="quaternion";Ra.prototype.DefaultInterpolation=Cu;Ra.prototype.InterpolantFactoryMethodSmooth=void 0;class Wf extends La{}Wf.prototype.ValueTypeName="string";Wf.prototype.ValueBufferType=Array;Wf.prototype.DefaultInterpolation=bf;Wf.prototype.InterpolantFactoryMethodLinear=void 0;Wf.prototype.InterpolantFactoryMethodSmooth=void 0;class ac extends La{}ac.prototype.ValueTypeName="vector";class xu{constructor(e,t=-1,r,i=mU){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=No(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(fie(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(La.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const u=c[1];let h=i[u];h||(i[u]=h=[]),h.push(A)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(u,h,d,p,f){if(d.length!==0){const g=[],m=[];IZ(d,g,m,p),g.length!==0&&f.push(new u(h,g,m))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const A=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(ja[e]!==void 0){ja[e].push({onLoad:t,onProgress:r,onError:i});return}ja[e]=[],ja[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(A=>{if(A.status===200||A.status===0){if(A.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||A.body===void 0||A.body.getReader===void 0)return A;const c=ja[e],u=A.body.getReader(),h=A.headers.get("Content-Length"),d=h?parseInt(h):0,p=d!==0;let f=0;const g=new ReadableStream({start(m){v();function v(){u.read().then(({done:w,value:B})=>{if(w)m.close();else{f+=B.byteLength;const C=new ProgressEvent("progress",{lengthComputable:p,loaded:f,total:d});for(let b=0,F=c.length;b{switch(l){case"arraybuffer":return A.arrayBuffer();case"blob":return A.blob();case"document":return A.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return A.json();default:if(a===void 0)return A.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),h=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(h);return A.arrayBuffer().then(p=>d.decode(p))}}}).then(A=>{Ff.add(e,A);const c=ja[e];delete ja[e];for(let u=0,h=c.length;u{const c=ja[e];if(c===void 0)throw this.manager.itemError(e),A;delete ja[e];for(let u=0,h=c.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class SZ extends Gf{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ff.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Qm("img");function l(){c(),Ff.add(e,this),t&&t(this),s.manager.itemEnd(e)}function A(u){c(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function c(){a.removeEventListener("load",l,!1),a.removeEventListener("error",A,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",A,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Pu extends Gf{constructor(e){super(e)}load(e,t,r,i){const s=new or,o=new SZ(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}}class rb extends Rt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Le(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const S1=new He,hN=new j,fN=new j;class EU{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ye(512,512),this.map=null,this.mapPass=null,this.matrix=new He,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new CU,this._frameExtents=new Ye(1,1),this._viewportCount=1,this._viewports=[new Dt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;hN.setFromMatrixPosition(e.matrixWorld),t.position.copy(hN),fN.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(fN),t.updateMatrixWorld(),S1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(S1),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(S1)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class mie extends EU{constructor(){super(new Nr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Um*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class UZ extends rb{constructor(e,t,r=0,i=Math.PI/3,s=0,o=1){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.target=new Rt,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new mie}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const pN=new He,Rp=new j,U1=new j;class vie extends EU{constructor(){super(new Nr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ye(4,2),this._viewportCount=6,this._viewports=[new Dt(2,1,1,1),new Dt(0,1,1,1),new Dt(3,1,1,1),new Dt(1,1,1,1),new Dt(3,0,1,1),new Dt(1,0,1,1)],this._cubeDirections=[new j(1,0,0),new j(-1,0,0),new j(0,0,1),new j(0,0,-1),new j(0,1,0),new j(0,-1,0)],this._cubeUps=[new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,0,1),new j(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Rp.setFromMatrixPosition(e.matrixWorld),r.position.copy(Rp),U1.copy(r.position),U1.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(U1),r.updateMatrixWorld(),i.makeTranslation(-Rp.x,-Rp.y,-Rp.z),pN.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pN)}}class EE extends rb{constructor(e,t,r=0,i=1){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new vie}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class yie extends EU{constructor(){super(new Lu(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class _U extends rb{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.target=new Rt,this.shadow=new yie}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class QZ extends rb{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class xa{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ff.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Ff.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}class RZ{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=gN(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=gN();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function gN(){return(typeof performance>"u"?Date:performance).now()}class Bie{constructor(e,t,r){this.binding=e,this.valueSize=r;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(r,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let l=t,A=t+t;l!==A;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){rt.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;rt.multiplyQuaternionsFlat(e,o,e,t,e,r),rt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const SU="\\[\\]\\.:\\/",Cie=new RegExp("["+SU+"]","g"),UU="[^"+SU+"]",bie="[^"+SU.replace("\\.","")+"]",xie=/((?:WC+[\/:])*)/.source.replace("WC",UU),Iie=/(WCOD+)?/.source.replace("WCOD",bie),Fie=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",UU),Eie=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",UU),_ie=new RegExp("^"+xie+Iie+Fie+Eie+"$"),Sie=["material","materials","bones","map"];class Uie{constructor(e,t,r){const i=r||bt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class bt{constructor(e,t,r){this.path=t,this.parsedPath=r||bt.parseTrackName(t),this.node=bt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new bt.Composite(e,t,r):new bt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Cie,"")}static parseTrackName(e){const t=_ie.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);Sie.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o0){const l=this._interpolants,A=this._propertyBindings;switch(this.blendMode){case k$:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulateAdditive(a);break;case mU:default:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===N$;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===M$){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const A=e<0;this._setEndings(A,!A,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=Ih,i.endingEnd=Ih):(e?i.endingStart=this.zeroSlopeAtStart?Ih:xh:i.endingStart=BB,t?i.endingEnd=this.zeroSlopeAtEnd?Ih:xh:i.endingEnd=BB)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const Rie=new Float32Array(1);class Mie extends yc{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,A=this._bindingsByRootAndName;let c=A[l];c===void 0&&(c={},A[l]=c);for(let u=0;u!==s;++u){const h=i[u],d=h.name;let p=c[d];if(p!==void 0)++p.referenceCount,o[u]=p;else{if(p=o[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,d));continue}const f=t&&t._propertyBindings[u].binding.parsedPath;p=new Bie(bt.create(r,d,f),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,d),o[u]=p}a[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let A=0;A!==r;++A)t[A]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let A=0;A!==l;++A)a[A].apply(o);return this}setTime(e){this.time=0;for(let t=0;tMath.PI&&(Pe-=Ue),ke<-Math.PI?ke+=Ue:ke>Math.PI&&(ke-=Ue),Pe<=ke?a.theta=Math.max(Pe,Math.min(ke,a.theta)):a.theta=a.theta>(Pe+ke)/2?Math.max(Pe,a.theta):Math.min(ke,a.theta)),a.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=A,a.radius=Math.max(r.minDistance,Math.min(r.maxDistance,a.radius)),r.enableDamping===!0?r.target.addScaledVector(c,r.dampingFactor):r.target.add(c),S.setFromSpherical(a),S.applyQuaternion(te),Te.copy(r.target).add(S),r.object.lookAt(r.target),r.enableDamping===!0?(l.theta*=1-r.dampingFactor,l.phi*=1-r.dampingFactor,c.multiplyScalar(1-r.dampingFactor)):(l.set(0,0,0),c.set(0,0,0)),A=1,u||le.distanceToSquared(r.object.position)>o||8*(1-se.dot(r.object.quaternion))>o?(r.dispatchEvent(BN),le.copy(r.object.position),se.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",ie),r.domElement.removeEventListener("pointerdown",P),r.domElement.removeEventListener("pointercancel",q),r.domElement.removeEventListener("wheel",ye),r.domElement.removeEventListener("pointermove",fe),r.domElement.removeEventListener("pointerup",ue),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",be)};const r=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const o=1e-6,a=new yN,l=new yN;let A=1;const c=new j;let u=!1;const h=new Ye,d=new Ye,p=new Ye,f=new Ye,g=new Ye,m=new Ye,v=new Ye,w=new Ye,B=new Ye,C=[],b={};function F(){return 2*Math.PI/60/60*r.autoRotateSpeed}function x(){return Math.pow(.95,r.zoomSpeed)}function _(S){l.theta-=S}function M(S){l.phi-=S}const Y=function(){const S=new j;return function(te,le){S.setFromMatrixColumn(le,0),S.multiplyScalar(-te),c.add(S)}}(),O=function(){const S=new j;return function(te,le){r.screenSpacePanning===!0?S.setFromMatrixColumn(le,1):(S.setFromMatrixColumn(le,0),S.crossVectors(r.object.up,S)),S.multiplyScalar(te),c.add(S)}}(),U=function(){const S=new j;return function(te,le){const se=r.domElement;if(r.object.isPerspectiveCamera){const Ue=r.object.position;S.copy(Ue).sub(r.target);let _e=S.length();_e*=Math.tan(r.object.fov/2*Math.PI/180),Y(2*te*_e/se.clientHeight,r.object.matrix),O(2*le*_e/se.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(Y(te*(r.object.right-r.object.left)/r.object.zoom/se.clientWidth,r.object.matrix),O(le*(r.object.top-r.object.bottom)/r.object.zoom/se.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function y(S){r.object.isPerspectiveCamera?A/=S:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*S)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function I(S){r.object.isPerspectiveCamera?A*=S:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/S)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function R(S){h.set(S.clientX,S.clientY)}function N(S){v.set(S.clientX,S.clientY)}function k(S){f.set(S.clientX,S.clientY)}function V(S){d.set(S.clientX,S.clientY),p.subVectors(d,h).multiplyScalar(r.rotateSpeed);const Z=r.domElement;_(2*Math.PI*p.x/Z.clientHeight),M(2*Math.PI*p.y/Z.clientHeight),h.copy(d),r.update()}function G(S){w.set(S.clientX,S.clientY),B.subVectors(w,v),B.y>0?y(x()):B.y<0&&I(x()),v.copy(w),r.update()}function D(S){g.set(S.clientX,S.clientY),m.subVectors(g,f).multiplyScalar(r.panSpeed),U(m.x,m.y),f.copy(g),r.update()}function E(S){S.deltaY<0?I(x()):S.deltaY>0&&y(x()),r.update()}function z(S){let Z=!1;switch(S.code){case r.keys.UP:U(0,r.keyPanSpeed),Z=!0;break;case r.keys.BOTTOM:U(0,-r.keyPanSpeed),Z=!0;break;case r.keys.LEFT:U(r.keyPanSpeed,0),Z=!0;break;case r.keys.RIGHT:U(-r.keyPanSpeed,0),Z=!0;break}Z&&(S.preventDefault(),r.update())}function re(){if(C.length===1)h.set(C[0].pageX,C[0].pageY);else{const S=.5*(C[0].pageX+C[1].pageX),Z=.5*(C[0].pageY+C[1].pageY);h.set(S,Z)}}function T(){if(C.length===1)f.set(C[0].pageX,C[0].pageY);else{const S=.5*(C[0].pageX+C[1].pageX),Z=.5*(C[0].pageY+C[1].pageY);f.set(S,Z)}}function ee(){const S=C[0].pageX-C[1].pageX,Z=C[0].pageY-C[1].pageY,te=Math.sqrt(S*S+Z*Z);v.set(0,te)}function pe(){r.enableZoom&&ee(),r.enablePan&&T()}function de(){r.enableZoom&&ee(),r.enableRotate&&re()}function Ae(S){if(C.length==1)d.set(S.pageX,S.pageY);else{const te=Q(S),le=.5*(S.pageX+te.x),se=.5*(S.pageY+te.y);d.set(le,se)}p.subVectors(d,h).multiplyScalar(r.rotateSpeed);const Z=r.domElement;_(2*Math.PI*p.x/Z.clientHeight),M(2*Math.PI*p.y/Z.clientHeight),h.copy(d)}function $(S){if(C.length===1)g.set(S.pageX,S.pageY);else{const Z=Q(S),te=.5*(S.pageX+Z.x),le=.5*(S.pageY+Z.y);g.set(te,le)}m.subVectors(g,f).multiplyScalar(r.panSpeed),U(m.x,m.y),f.copy(g)}function ce(S){const Z=Q(S),te=S.pageX-Z.x,le=S.pageY-Z.y,se=Math.sqrt(te*te+le*le);w.set(0,se),B.set(0,Math.pow(w.y/v.y,r.zoomSpeed)),y(B.y),v.copy(w)}function ge(S){r.enableZoom&&ce(S),r.enablePan&&$(S)}function Fe(S){r.enableZoom&&ce(S),r.enableRotate&&Ae(S)}function P(S){r.enabled!==!1&&(C.length===0&&(r.domElement.setPointerCapture(S.pointerId),r.domElement.addEventListener("pointermove",fe),r.domElement.addEventListener("pointerup",ue)),ae(S),S.pointerType==="touch"?W(S):K(S))}function fe(S){r.enabled!==!1&&(S.pointerType==="touch"?H(S):oe(S))}function ue(S){me(S),C.length===0&&(r.domElement.releasePointerCapture(S.pointerId),r.domElement.removeEventListener("pointermove",fe),r.domElement.removeEventListener("pointerup",ue)),r.dispatchEvent(CN),s=i.NONE}function q(S){me(S)}function K(S){let Z;switch(S.button){case 0:Z=r.mouseButtons.LEFT;break;case 1:Z=r.mouseButtons.MIDDLE;break;case 2:Z=r.mouseButtons.RIGHT;break;default:Z=-1}switch(Z){case qu.DOLLY:if(r.enableZoom===!1)return;N(S),s=i.DOLLY;break;case qu.ROTATE:if(S.ctrlKey||S.metaKey||S.shiftKey){if(r.enablePan===!1)return;k(S),s=i.PAN}else{if(r.enableRotate===!1)return;R(S),s=i.ROTATE}break;case qu.PAN:if(S.ctrlKey||S.metaKey||S.shiftKey){if(r.enableRotate===!1)return;R(S),s=i.ROTATE}else{if(r.enablePan===!1)return;k(S),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(Q1)}function oe(S){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;V(S);break;case i.DOLLY:if(r.enableZoom===!1)return;G(S);break;case i.PAN:if(r.enablePan===!1)return;D(S);break}}function ye(S){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(S.preventDefault(),r.dispatchEvent(Q1),E(S),r.dispatchEvent(CN))}function be(S){r.enabled===!1||r.enablePan===!1||z(S)}function W(S){switch(J(S),C.length){case 1:switch(r.touches.ONE){case ed.ROTATE:if(r.enableRotate===!1)return;re(),s=i.TOUCH_ROTATE;break;case ed.PAN:if(r.enablePan===!1)return;T(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case ed.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;pe(),s=i.TOUCH_DOLLY_PAN;break;case ed.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;de(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(Q1)}function H(S){switch(J(S),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;Ae(S),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;$(S),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ge(S),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Fe(S),r.update();break;default:s=i.NONE}}function ie(S){r.enabled!==!1&&S.preventDefault()}function ae(S){C.push(S)}function me(S){delete b[S.pointerId];for(let Z=0;Z=2.0 are supported."));return}const l=new cse(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let A=0;A=0&&a[c]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+c+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function kie(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const It={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Die{constructor(e){this.parser=e,this.name=It.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class Yie{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const A=r.options.manager.getHandler(a.uri);A!==null&&(l=A)}return this.detectSupport().then(function(A){if(A)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Xie{constructor(e){this.name=It.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,A=i.byteLength||0,c=i.count,u=i.byteStride,h=new Uint8Array(a,l,A);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(c,u,h,i.mode,i.filter).then(function(d){return d.buffer}):o.ready.then(function(){const d=new ArrayBuffer(c*u);return o.decodeGltfBuffer(new Uint8Array(d),c,u,h,i.mode,i.filter),d})})}else return null}}class jie{constructor(e){this.name=It.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const A of i.primitives)if(A.mode!==Ns.TRIANGLES&&A.mode!==Ns.TRIANGLE_STRIP&&A.mode!==Ns.TRIANGLE_FAN&&A.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const A in o)a.push(this.parser.getDependency("accessor",o[A]).then(c=>(l[A]=c,l[A])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(A=>{const c=A.pop(),u=c.isGroup?c.children:[c],h=A[0].count,d=[];for(const p of u){const f=new He,g=new j,m=new rt,v=new j(1,1,1),w=new tb(p.geometry,p.material,h);for(let B=0;Bc||i.y>c)&&(i.x>c&&(s.x=Math.floor(c/I.x),i.x=s.x*I.x,y.mapSize.x=s.x),i.y>c&&(s.y=Math.floor(c/I.y),i.y=s.y*I.y,y.mapSize.y=s.y)),y.map===null){const N=this.type!==fg?{minFilter:nr,magFilter:nr}:{};y.map=new Qa(i.x,i.y,N),y.map.texture.name=U.name+".shadowMap",y.camera.updateProjectionMatrix()}n.setRenderTarget(y.map),n.clear();const R=y.getViewportCount();for(let N=0;N0){const O=M.uuid,U=C.uuid;let y=A[O];y===void 0&&(y={},A[O]=y);let I=y[U];I===void 0&&(I=M.clone(),y[U]=I),M=I}return M.visible=C.visible,M.wireframe=C.wireframe,_===fg?M.side=C.shadowSide!==null?C.shadowSide:C.side:M.side=C.shadowSide!==null?C.shadowSide:u[C.side],M.alphaMap=C.alphaMap,M.alphaTest=C.alphaTest,M.clipShadows=C.clipShadows,M.clippingPlanes=C.clippingPlanes,M.clipIntersection=C.clipIntersection,M.displacementMap=C.displacementMap,M.displacementScale=C.displacementScale,M.displacementBias=C.displacementBias,M.wireframeLinewidth=C.wireframeLinewidth,M.linewidth=C.linewidth,b.isPointLight===!0&&M.isMeshDistanceMaterial===!0&&(M.referencePosition.setFromMatrixPosition(b.matrixWorld),M.nearDistance=F,M.farDistance=x),M}function w(B,C,b,F,x){if(B.visible===!1)return;if(B.layers.test(C.layers)&&(B.isMesh||B.isLine||B.isPoints)&&(B.castShadow||B.receiveShadow&&x===fg)&&(!B.frustumCulled||r.intersectsObject(B))){B.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,B.matrixWorld);const Y=e.update(B),O=B.material;if(Array.isArray(O)){const U=Y.groups;for(let y=0,I=U.length;y=1):k.indexOf("OpenGL ES")!==-1&&(N=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),R=N>=2);let L=null,G={};const D=n.getParameter(3088),E=n.getParameter(2978),z=new Dt().fromArray(D),re=new Dt().fromArray(E);function T(he,Ee,Se){const Re=new Uint8Array(4),Je=n.createTexture();n.bindTexture(he,Je),n.texParameteri(he,10241,9728),n.texParameteri(he,10240,9728);for(let qe=0;qe"u"?"":navigator.userAgent),p=new WeakMap;let f;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(W,H){return m?new OffscreenCanvas(W,H):Qm("canvas")}function w(W,H,ie,ae){let me=1;if((W.width>ae||W.height>ae)&&(me=ae/Math.max(W.width,W.height)),me<1||H===!0)if(typeof HTMLImageElement<"u"&&W instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&W instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&W instanceof ImageBitmap){const J=H?CB:Math.floor,Q=J(me*W.width),S=J(me*W.height);f===void 0&&(f=v(Q,S));const Z=ie?v(Q,S):f;return Z.width=Q,Z.height=S,Z.getContext("2d").drawImage(W,0,0,Q,S),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+W.width+"x"+W.height+") to ("+Q+"x"+S+")."),Z}else return"data"in W&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+W.width+"x"+W.height+")."),W;return W}function B(W){return xE(W.width)&&xE(W.height)}function C(W){return a?!1:W.wrapS!==fi||W.wrapT!==fi||W.minFilter!==nr&&W.minFilter!==ci}function b(W,H){return W.generateMipmaps&&H&&W.minFilter!==nr&&W.minFilter!==ci}function F(W){n.generateMipmap(W)}function x(W,H,ie,ae,me=!1){if(a===!1)return H;if(W!==null){if(n[W]!==void 0)return n[W];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+W+"'")}let J=H;return H===6403&&(ie===5126&&(J=33326),ie===5131&&(J=33325),ie===5121&&(J=33321)),H===33319&&(ie===5126&&(J=33328),ie===5131&&(J=33327),ie===5121&&(J=33323)),H===6408&&(ie===5126&&(J=34836),ie===5131&&(J=34842),ie===5121&&(J=ae===mt&&me===!1?35907:32856),ie===32819&&(J=32854),ie===32820&&(J=32855)),(J===33325||J===33326||J===33327||J===33328||J===34842||J===34836)&&e.get("EXT_color_buffer_float"),J}function _(W,H,ie){return b(W,ie)===!0||W.isFramebufferTexture&&W.minFilter!==nr&&W.minFilter!==ci?Math.log2(Math.max(H.width,H.height))+1:W.mipmaps!==void 0&&W.mipmaps.length>0?W.mipmaps.length:W.isCompressedTexture&&Array.isArray(W.image)?H.mipmaps.length:1}function M(W){return W===nr||W===yB||W===wB?9728:9729}function Y(W){const H=W.target;H.removeEventListener("dispose",Y),U(H),H.isVideoTexture&&p.delete(H)}function O(W){const H=W.target;H.removeEventListener("dispose",O),I(H)}function U(W){const H=r.get(W);if(H.__webglInit===void 0)return;const ie=W.source,ae=g.get(ie);if(ae){const me=ae[H.__cacheKey];me.usedTimes--,me.usedTimes===0&&y(W),Object.keys(ae).length===0&&g.delete(ie)}r.remove(W)}function y(W){const H=r.get(W);n.deleteTexture(H.__webglTexture);const ie=W.source,ae=g.get(ie);delete ae[H.__cacheKey],o.memory.textures--}function I(W){const H=W.texture,ie=r.get(W),ae=r.get(H);if(ae.__webglTexture!==void 0&&(n.deleteTexture(ae.__webglTexture),o.memory.textures--),W.depthTexture&&W.depthTexture.dispose(),W.isWebGLCubeRenderTarget)for(let me=0;me<6;me++)n.deleteFramebuffer(ie.__webglFramebuffer[me]),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer[me]);else{if(n.deleteFramebuffer(ie.__webglFramebuffer),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer),ie.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ie.__webglMultisampledFramebuffer),ie.__webglColorRenderbuffer)for(let me=0;me=l&&console.warn("THREE.WebGLTextures: Trying to use "+W+" texture units while this GPU supports only "+l),R+=1,W}function L(W){const H=[];return H.push(W.wrapS),H.push(W.wrapT),H.push(W.wrapR||0),H.push(W.magFilter),H.push(W.minFilter),H.push(W.anisotropy),H.push(W.internalFormat),H.push(W.format),H.push(W.type),H.push(W.generateMipmaps),H.push(W.premultiplyAlpha),H.push(W.flipY),H.push(W.unpackAlignment),H.push(W.encoding),H.join()}function G(W,H){const ie=r.get(W);if(W.isVideoTexture&&ye(W),W.isRenderTargetTexture===!1&&W.version>0&&ie.__version!==W.version){const ae=W.image;if(ae===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ae.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{de(ie,W,H);return}}t.bindTexture(3553,ie.__webglTexture,33984+H)}function D(W,H){const ie=r.get(W);if(W.version>0&&ie.__version!==W.version){de(ie,W,H);return}t.bindTexture(35866,ie.__webglTexture,33984+H)}function E(W,H){const ie=r.get(W);if(W.version>0&&ie.__version!==W.version){de(ie,W,H);return}t.bindTexture(32879,ie.__webglTexture,33984+H)}function z(W,H){const ie=r.get(W);if(W.version>0&&ie.__version!==W.version){Ae(ie,W,H);return}t.bindTexture(34067,ie.__webglTexture,33984+H)}const re={[ps]:10497,[fi]:33071,[_m]:33648},T={[nr]:9728,[yB]:9984,[wB]:9986,[ci]:9729,[gU]:9985,[Tu]:9987};function ee(W,H,ie){if(ie?(n.texParameteri(W,10242,re[H.wrapS]),n.texParameteri(W,10243,re[H.wrapT]),(W===32879||W===35866)&&n.texParameteri(W,32882,re[H.wrapR]),n.texParameteri(W,10240,T[H.magFilter]),n.texParameteri(W,10241,T[H.minFilter])):(n.texParameteri(W,10242,33071),n.texParameteri(W,10243,33071),(W===32879||W===35866)&&n.texParameteri(W,32882,33071),(H.wrapS!==fi||H.wrapT!==fi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(W,10240,M(H.magFilter)),n.texParameteri(W,10241,M(H.minFilter)),H.minFilter!==nr&&H.minFilter!==ci&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ae=e.get("EXT_texture_filter_anisotropic");if(H.type===MA&&e.has("OES_texture_float_linear")===!1||a===!1&&H.type===Sm&&e.has("OES_texture_half_float_linear")===!1)return;(H.anisotropy>1||r.get(H).__currentAnisotropy)&&(n.texParameterf(W,ae.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(H.anisotropy,i.getMaxAnisotropy())),r.get(H).__currentAnisotropy=H.anisotropy)}}function pe(W,H){let ie=!1;W.__webglInit===void 0&&(W.__webglInit=!0,H.addEventListener("dispose",Y));const ae=H.source;let me=g.get(ae);me===void 0&&(me={},g.set(ae,me));const J=L(H);if(J!==W.__cacheKey){me[J]===void 0&&(me[J]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ie=!0),me[J].usedTimes++;const Q=me[W.__cacheKey];Q!==void 0&&(me[W.__cacheKey].usedTimes--,Q.usedTimes===0&&y(H)),W.__cacheKey=J,W.__webglTexture=me[J].texture}return ie}function de(W,H,ie){let ae=3553;(H.isDataArrayTexture||H.isCompressedArrayTexture)&&(ae=35866),H.isData3DTexture&&(ae=32879);const me=pe(W,H),J=H.source;t.bindTexture(ae,W.__webglTexture,33984+ie);const Q=r.get(J);if(J.version!==Q.__version||me===!0){t.activeTexture(33984+ie),n.pixelStorei(37440,H.flipY),n.pixelStorei(37441,H.premultiplyAlpha),n.pixelStorei(3317,H.unpackAlignment),n.pixelStorei(37443,0);const S=C(H)&&B(H.image)===!1;let Z=w(H.image,S,!1,c);Z=be(H,Z);const te=B(Z)||a,le=s.convert(H.format,H.encoding);let se=s.convert(H.type),Ue=x(H.internalFormat,le,se,H.encoding,H.isVideoTexture);ee(ae,H,te);let _e;const Te=H.mipmaps,Pe=a&&H.isVideoTexture!==!0,ke=Q.__version===void 0||me===!0,he=_(H,Z,te);if(H.isDepthTexture)Ue=6402,a?H.type===MA?Ue=36012:H.type===Kc?Ue=33190:H.type===Jh?Ue=35056:Ue=33189:H.type===MA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),H.format===Au&&Ue===6402&&H.type!==oZ&&H.type!==Kc&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),H.type=Kc,se=s.convert(H.type)),H.format===Cf&&Ue===6402&&(Ue=34041,H.type!==Jh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),H.type=Jh,se=s.convert(H.type))),ke&&(Pe?t.texStorage2D(3553,1,Ue,Z.width,Z.height):t.texImage2D(3553,0,Ue,Z.width,Z.height,0,le,se,null));else if(H.isDataTexture)if(Te.length>0&&te){Pe&&ke&&t.texStorage2D(3553,he,Ue,Te[0].width,Te[0].height);for(let Ee=0,Se=Te.length;Ee>=1,Se>>=1}}else if(Te.length>0&&te){Pe&&ke&&t.texStorage2D(3553,he,Ue,Te[0].width,Te[0].height);for(let Ee=0,Se=Te.length;Ee0&&ke++,t.texStorage2D(34067,ke,_e,Z[0].width,Z[0].height));for(let Ee=0;Ee<6;Ee++)if(S){Te?t.texSubImage2D(34069+Ee,0,0,0,Z[Ee].width,Z[Ee].height,se,Ue,Z[Ee].data):t.texImage2D(34069+Ee,0,_e,Z[Ee].width,Z[Ee].height,0,se,Ue,Z[Ee].data);for(let Se=0;Se=34069&&me<=34074)&&n.framebufferTexture2D(36160,ae,me,r.get(ie).__webglTexture,0),t.bindFramebuffer(36160,null)}function ce(W,H,ie){if(n.bindRenderbuffer(36161,W),H.depthBuffer&&!H.stencilBuffer){let ae=33189;if(ie||oe(H)){const me=H.depthTexture;me&&me.isDepthTexture&&(me.type===MA?ae=36012:me.type===Kc&&(ae=33190));const J=K(H);oe(H)?h.renderbufferStorageMultisampleEXT(36161,J,ae,H.width,H.height):n.renderbufferStorageMultisample(36161,J,ae,H.width,H.height)}else n.renderbufferStorage(36161,ae,H.width,H.height);n.framebufferRenderbuffer(36160,36096,36161,W)}else if(H.depthBuffer&&H.stencilBuffer){const ae=K(H);ie&&oe(H)===!1?n.renderbufferStorageMultisample(36161,ae,35056,H.width,H.height):oe(H)?h.renderbufferStorageMultisampleEXT(36161,ae,35056,H.width,H.height):n.renderbufferStorage(36161,34041,H.width,H.height),n.framebufferRenderbuffer(36160,33306,36161,W)}else{const ae=H.isWebGLMultipleRenderTargets===!0?H.texture:[H.texture];for(let me=0;me0&&oe(W)===!1){const S=J?H:[H];ie.__webglMultisampledFramebuffer=n.createFramebuffer(),ie.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,ie.__webglMultisampledFramebuffer);for(let Z=0;Z0&&oe(W)===!1){const H=W.isWebGLMultipleRenderTargets?W.texture:[W.texture],ie=W.width,ae=W.height;let me=16384;const J=[],Q=W.stencilBuffer?33306:36096,S=r.get(W),Z=W.isWebGLMultipleRenderTargets===!0;if(Z)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&H.__useRenderToTexture!==!1}function ye(W){const H=o.render.frame;p.get(W)!==H&&(p.set(W,H),W.update())}function be(W,H){const ie=W.encoding,ae=W.format,me=W.type;return W.isCompressedTexture===!0||W.isVideoTexture===!0||W.format===bE||ie!==gs&&(ie===mt?a===!1?e.has("EXT_sRGB")===!0&&ae===Ir?(W.format=bE,W.minFilter=ci,W.generateMipmaps=!1):H=uZ.sRGBToLinear(H):(ae!==Ir||me!==oc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",ie)),H}this.allocateTextureUnit=k,this.resetTextureUnits=N,this.setTexture2D=G,this.setTexture2DArray=D,this.setTexture3D=E,this.setTextureCube=z,this.rebindTextures=P,this.setupRenderTarget=fe,this.updateRenderTargetMipmap=ue,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=Fe,this.setupFrameBufferTexture=$,this.useMultisampledRTT=oe}function Hre(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===oc)return 5121;if(s===B$)return 32819;if(s===C$)return 32820;if(s===v$)return 5120;if(s===y$)return 5122;if(s===oZ)return 5123;if(s===w$)return 5124;if(s===Kc)return 5125;if(s===MA)return 5126;if(s===Sm)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===b$)return 6406;if(s===Ir)return 6408;if(s===I$)return 6409;if(s===F$)return 6410;if(s===Au)return 6402;if(s===Cf)return 34041;if(s===E$)return 6403;if(s===x$)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===bE)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===_$)return 36244;if(s===S$)return 33319;if(s===U$)return 33320;if(s===Q$)return 36249;if(s===jx||s===Kx||s===$x||s===qx)if(o===mt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===jx)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Kx)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===$x)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===qx)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===jx)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Kx)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===$x)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===qx)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===KM||s===$M||s===qM||s===eT)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===KM)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===$M)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===qM)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===eT)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===R$)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===tT||s===nT)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===tT)return o===mt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===nT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===rT||s===iT||s===sT||s===oT||s===aT||s===lT||s===AT||s===cT||s===uT||s===dT||s===hT||s===fT||s===pT||s===gT)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===rT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===iT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===sT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===oT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===aT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===lT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===AT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===cT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===uT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===dT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===hT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===fT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===pT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===gT)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===mT)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===mT)return o===mt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===Jh?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:i}}class zre extends Nr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class kr extends Rt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Yre={type:"move"};class F1{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new kr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new kr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new kr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,A=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(A&&e.hand){o=!0;for(const f of e.hand.values()){const g=t.getJointPose(f,r);if(A.joints[f.jointName]===void 0){const v=new kr;v.matrixAutoUpdate=!1,v.visible=!1,A.joints[f.jointName]=v,A.add(v)}const m=A.joints[f.jointName];g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}const c=A.joints["index-finger-tip"],u=A.joints["thumb-tip"],h=c.position.distanceTo(u.position),d=.02,p=.005;A.inputState.pinching&&h>d+p?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!A.inputState.pinching&&h<=d-p&&(A.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Yre)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),A!==null&&(A.visible=o!==null),this}}class BZ extends or{constructor(e,t,r,i,s,o,a,l,A,c){if(c=c!==void 0?c:Au,c!==Au&&c!==Cf)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&c===Au&&(r=Kc),r===void 0&&c===Cf&&(r=Jh),super(null,i,s,o,a,l,c,r,A),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:nr,this.minFilter=l!==void 0?l:nr,this.flipY=!1,this.generateMipmaps=!1}}class Xre extends yc{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=null,A=null,c=null,u=null,h=null,d=null;const p=t.getContextAttributes();let f=null,g=null;const m=[],v=[],w=new Nr;w.layers.enable(1),w.viewport=new Dt;const B=new Nr;B.layers.enable(2),B.viewport=new Dt;const C=[w,B],b=new zre;b.layers.enable(1),b.layers.enable(2);let F=null,x=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(L){let G=m[L];return G===void 0&&(G=new F1,m[L]=G),G.getTargetRaySpace()},this.getControllerGrip=function(L){let G=m[L];return G===void 0&&(G=new F1,m[L]=G),G.getGripSpace()},this.getHand=function(L){let G=m[L];return G===void 0&&(G=new F1,m[L]=G),G.getHandSpace()};function _(L){const G=v.indexOf(L.inputSource);if(G===-1)return;const D=m[G];D!==void 0&&D.dispatchEvent({type:L.type,data:L.inputSource})}function M(){i.removeEventListener("select",_),i.removeEventListener("selectstart",_),i.removeEventListener("selectend",_),i.removeEventListener("squeeze",_),i.removeEventListener("squeezestart",_),i.removeEventListener("squeezeend",_),i.removeEventListener("end",M),i.removeEventListener("inputsourceschange",Y);for(let L=0;L=0&&(v[E]=null,m[E].dispatchEvent({type:"disconnected",data:D}))}for(let G=0;G=v.length){v.push(D),E=re;break}else if(v[re]===null){v[re]=D,E=re;break}if(E===-1)break}const z=m[E];z&&z.dispatchEvent({type:"connected",data:D})}}const O=new j,U=new j;function y(L,G,D){O.setFromMatrixPosition(G.matrixWorld),U.setFromMatrixPosition(D.matrixWorld);const E=O.distanceTo(U),z=G.projectionMatrix.elements,re=D.projectionMatrix.elements,T=z[14]/(z[10]-1),ee=z[14]/(z[10]+1),pe=(z[9]+1)/z[5],de=(z[9]-1)/z[5],Ae=(z[8]-1)/z[0],$=(re[8]+1)/re[0],ce=T*Ae,ge=T*$,Fe=E/(-Ae+$),P=Fe*-Ae;G.matrixWorld.decompose(L.position,L.quaternion,L.scale),L.translateX(P),L.translateZ(Fe),L.matrixWorld.compose(L.position,L.quaternion,L.scale),L.matrixWorldInverse.copy(L.matrixWorld).invert();const fe=T+Fe,ue=ee+Fe,q=ce-P,K=ge+(E-P),oe=pe*ee/ue*fe,ye=de*ee/ue*fe;L.projectionMatrix.makePerspective(q,K,oe,ye,fe,ue)}function I(L,G){G===null?L.matrixWorld.copy(L.matrix):L.matrixWorld.multiplyMatrices(G.matrixWorld,L.matrix),L.matrixWorldInverse.copy(L.matrixWorld).invert()}this.updateCamera=function(L){if(i===null)return;b.near=B.near=w.near=L.near,b.far=B.far=w.far=L.far,(F!==b.near||x!==b.far)&&(i.updateRenderState({depthNear:b.near,depthFar:b.far}),F=b.near,x=b.far);const G=L.parent,D=b.cameras;I(b,G);for(let z=0;z0&&(f.alphaTest.value=g.alphaTest);const m=e.get(g).envMap;if(m&&(f.envMap.value=m,f.flipEnvMap.value=m.isCubeTexture&&m.isRenderTargetTexture===!1?-1:1,f.reflectivity.value=g.reflectivity,f.ior.value=g.ior,f.refractionRatio.value=g.refractionRatio),g.lightMap){f.lightMap.value=g.lightMap;const B=n.physicallyCorrectLights!==!0?Math.PI:1;f.lightMapIntensity.value=g.lightMapIntensity*B}g.aoMap&&(f.aoMap.value=g.aoMap,f.aoMapIntensity.value=g.aoMapIntensity);let v;g.map?v=g.map:g.specularMap?v=g.specularMap:g.displacementMap?v=g.displacementMap:g.normalMap?v=g.normalMap:g.bumpMap?v=g.bumpMap:g.roughnessMap?v=g.roughnessMap:g.metalnessMap?v=g.metalnessMap:g.alphaMap?v=g.alphaMap:g.emissiveMap?v=g.emissiveMap:g.clearcoatMap?v=g.clearcoatMap:g.clearcoatNormalMap?v=g.clearcoatNormalMap:g.clearcoatRoughnessMap?v=g.clearcoatRoughnessMap:g.iridescenceMap?v=g.iridescenceMap:g.iridescenceThicknessMap?v=g.iridescenceThicknessMap:g.specularIntensityMap?v=g.specularIntensityMap:g.specularColorMap?v=g.specularColorMap:g.transmissionMap?v=g.transmissionMap:g.thicknessMap?v=g.thicknessMap:g.sheenColorMap?v=g.sheenColorMap:g.sheenRoughnessMap&&(v=g.sheenRoughnessMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),f.uvTransform.value.copy(v.matrix));let w;g.aoMap?w=g.aoMap:g.lightMap&&(w=g.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),f.uv2Transform.value.copy(w.matrix))}function s(f,g){f.diffuse.value.copy(g.color),f.opacity.value=g.opacity}function o(f,g){f.dashSize.value=g.dashSize,f.totalSize.value=g.dashSize+g.gapSize,f.scale.value=g.scale}function a(f,g,m,v){f.diffuse.value.copy(g.color),f.opacity.value=g.opacity,f.size.value=g.size*m,f.scale.value=v*.5,g.map&&(f.map.value=g.map),g.alphaMap&&(f.alphaMap.value=g.alphaMap),g.alphaTest>0&&(f.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),f.uvTransform.value.copy(w.matrix))}function l(f,g){f.diffuse.value.copy(g.color),f.opacity.value=g.opacity,f.rotation.value=g.rotation,g.map&&(f.map.value=g.map),g.alphaMap&&(f.alphaMap.value=g.alphaMap),g.alphaTest>0&&(f.alphaTest.value=g.alphaTest);let m;g.map?m=g.map:g.alphaMap&&(m=g.alphaMap),m!==void 0&&(m.matrixAutoUpdate===!0&&m.updateMatrix(),f.uvTransform.value.copy(m.matrix))}function A(f,g){f.specular.value.copy(g.specular),f.shininess.value=Math.max(g.shininess,1e-4)}function c(f,g){g.gradientMap&&(f.gradientMap.value=g.gradientMap)}function u(f,g){f.roughness.value=g.roughness,f.metalness.value=g.metalness,g.roughnessMap&&(f.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(f.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(f.envMapIntensity.value=g.envMapIntensity)}function h(f,g,m){f.ior.value=g.ior,g.sheen>0&&(f.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),f.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(f.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(f.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(f.clearcoat.value=g.clearcoat,f.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(f.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(f.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),f.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===yi&&f.clearcoatNormalScale.value.negate())),g.iridescence>0&&(f.iridescence.value=g.iridescence,f.iridescenceIOR.value=g.iridescenceIOR,f.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(f.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(f.transmission.value=g.transmission,f.transmissionSamplerMap.value=m.texture,f.transmissionSamplerSize.value.set(m.width,m.height),g.transmissionMap&&(f.transmissionMap.value=g.transmissionMap),f.thickness.value=g.thickness,g.thicknessMap&&(f.thicknessMap.value=g.thicknessMap),f.attenuationDistance.value=g.attenuationDistance,f.attenuationColor.value.copy(g.attenuationColor)),f.specularIntensity.value=g.specularIntensity,f.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(f.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(f.specularColorMap.value=g.specularColorMap)}function d(f,g){g.matcap&&(f.matcap.value=g.matcap)}function p(f,g){f.referencePosition.value.copy(g.referencePosition),f.nearDistance.value=g.nearDistance,f.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function Kre(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(v,w){const B=w.program;r.uniformBlockBinding(v,B)}function A(v,w){let B=i[v.id];B===void 0&&(p(v),B=c(v),i[v.id]=B,v.addEventListener("dispose",g));const C=w.program;r.updateUBOMapping(v,C);const b=e.render.frame;s[v.id]!==b&&(h(v),s[v.id]=b)}function c(v){const w=u();v.__bindingPointIndex=w;const B=n.createBuffer(),C=v.__size,b=v.usage;return n.bindBuffer(35345,B),n.bufferData(35345,C,b),n.bindBuffer(35345,null),n.bindBufferBase(35345,w,B),B}function u(){for(let v=0;v0){b=B%C;const Y=C-b;b!==0&&Y-M.boundary<0&&(B+=C-b,_.__offset=B)}B+=M.storage}return b=B%C,b>0&&(B+=C-b),v.__size=B,v.__cache={},this}function f(v){const w=v.value,B={boundary:0,storage:0};return typeof w=="number"?(B.boundary=4,B.storage=4):w.isVector2?(B.boundary=8,B.storage=8):w.isVector3||w.isColor?(B.boundary=16,B.storage=12):w.isVector4?(B.boundary=16,B.storage=16):w.isMatrix3?(B.boundary=48,B.storage=48):w.isMatrix4?(B.boundary=64,B.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),B}function g(v){const w=v.target;w.removeEventListener("dispose",g);const B=o.indexOf(w.__bindingPointIndex);o.splice(B,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function m(){for(const v in i)n.deleteBuffer(i[v]);o=[],i={},s={}}return{bind:l,update:A,dispose:m}}function $re(){const n=Qm("canvas");return n.style.display="block",n}function h0(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:$re(),t=n.context!==void 0?n.context:null,r=n.depth!==void 0?n.depth:!0,i=n.stencil!==void 0?n.stencil:!0,s=n.antialias!==void 0?n.antialias:!1,o=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,a=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",A=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let c;t!==null?c=t.getContextAttributes().alpha:c=n.alpha!==void 0?n.alpha:!1;let u=null,h=null;const d=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=gs,this.physicallyCorrectLights=!1,this.toneMapping=El,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const f=this;let g=!1,m=0,v=0,w=null,B=-1,C=null;const b=new Dt,F=new Dt;let x=null,_=e.width,M=e.height,Y=1,O=null,U=null;const y=new Dt(0,0,_,M),I=new Dt(0,0,_,M);let R=!1;const N=new CU;let k=!1,L=!1,G=null;const D=new He,E=new Ye,z=new j,re={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function T(){return w===null?Y:1}let ee=t;function pe(ne,ve){for(let xe=0;xe0?h=p[p.length-1]:h=null,d.pop(),d.length>0?u=d[d.length-1]:u=null};function dt(ne,ve,xe,Ce){if(ne.visible===!1)return;if(ne.layers.test(ve.layers)){if(ne.isGroup)xe=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(ve);else if(ne.isLight)h.pushLight(ne),ne.castShadow&&h.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||N.intersectsSprite(ne)){Ce&&z.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(D);const at=K.update(ne),$e=ne.material;$e.visible&&u.push(ne,at,$e,xe,z.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(ne.isSkinnedMesh&&ne.skeleton.frame!==ce.render.frame&&(ne.skeleton.update(),ne.skeleton.frame=ce.render.frame),!ne.frustumCulled||N.intersectsObject(ne))){Ce&&z.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(D);const at=K.update(ne),$e=ne.material;if(Array.isArray($e)){const je=at.groups;for(let Bt=0,pt=je.length;Bt0&&Et(Ie,ve,xe),Ce&&$.viewport(b.copy(Ce)),Ie.length>0&&st(Ie,ve,xe),We.length>0&&st(We,ve,xe),at.length>0&&st(at,ve,xe),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Et(ne,ve,xe){const Ce=Ae.isWebGL2;G===null&&(G=new Qa(1,1,{generateMipmaps:!0,type:de.has("EXT_color_buffer_half_float")?Sm:oc,minFilter:Tu,samples:Ce&&s===!0?4:0})),f.getDrawingBufferSize(E),Ce?G.setSize(E.x,E.y):G.setSize(CB(E.x),CB(E.y));const Ie=f.getRenderTarget();f.setRenderTarget(G),f.clear();const We=f.toneMapping;f.toneMapping=El,st(ne,ve,xe),f.toneMapping=We,Fe.updateMultisampleRenderTarget(G),Fe.updateRenderTargetMipmap(G),f.setRenderTarget(Ie)}function st(ne,ve,xe){const Ce=ve.isScene===!0?ve.overrideMaterial:null;for(let Ie=0,We=ne.length;Ie0&&Fe.useMultisampledRTT(ne)===!1?Ie=ge.get(ne).__webglMultisampledFramebuffer:Ie=pt,b.copy(ne.viewport),F.copy(ne.scissor),x=ne.scissorTest}else b.copy(y).multiplyScalar(Y).floor(),F.copy(I).multiplyScalar(Y).floor(),x=R;if($.bindFramebuffer(36160,Ie)&&Ae.drawBuffers&&Ce&&$.drawBuffers(ne,Ie),$.viewport(b),$.scissor(F),$.setScissorTest(x),We){const je=ge.get(ne.texture);ee.framebufferTexture2D(36160,36064,34069+ve,je.__webglTexture,xe)}else if(at){const je=ge.get(ne.texture),Bt=ve||0;ee.framebufferTextureLayer(36160,36064,je.__webglTexture,xe||0,Bt)}B=-1},this.readRenderTargetPixels=function(ne,ve,xe,Ce,Ie,We,at){if(!(ne&&ne.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let $e=ge.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&at!==void 0&&($e=$e[at]),$e){$.bindFramebuffer(36160,$e);try{const je=ne.texture,Bt=je.format,pt=je.type;if(Bt!==Ir&&S.convert(Bt)!==ee.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const yt=pt===Sm&&(de.has("EXT_color_buffer_half_float")||Ae.isWebGL2&&de.has("EXT_color_buffer_float"));if(pt!==oc&&S.convert(pt)!==ee.getParameter(35738)&&!(pt===MA&&(Ae.isWebGL2||de.has("OES_texture_float")||de.has("WEBGL_color_buffer_float")))&&!yt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ve>=0&&ve<=ne.width-Ce&&xe>=0&&xe<=ne.height-Ie&&ee.readPixels(ve,xe,Ce,Ie,S.convert(Bt),S.convert(pt),We)}finally{const je=w!==null?ge.get(w).__webglFramebuffer:null;$.bindFramebuffer(36160,je)}}},this.copyFramebufferToTexture=function(ne,ve,xe=0){const Ce=Math.pow(2,-xe),Ie=Math.floor(ve.image.width*Ce),We=Math.floor(ve.image.height*Ce);Fe.setTexture2D(ve,0),ee.copyTexSubImage2D(3553,xe,0,0,ne.x,ne.y,Ie,We),$.unbindTexture()},this.copyTextureToTexture=function(ne,ve,xe,Ce=0){const Ie=ve.image.width,We=ve.image.height,at=S.convert(xe.format),$e=S.convert(xe.type);Fe.setTexture2D(xe,0),ee.pixelStorei(37440,xe.flipY),ee.pixelStorei(37441,xe.premultiplyAlpha),ee.pixelStorei(3317,xe.unpackAlignment),ve.isDataTexture?ee.texSubImage2D(3553,Ce,ne.x,ne.y,Ie,We,at,$e,ve.image.data):ve.isCompressedTexture?ee.compressedTexSubImage2D(3553,Ce,ne.x,ne.y,ve.mipmaps[0].width,ve.mipmaps[0].height,at,ve.mipmaps[0].data):ee.texSubImage2D(3553,Ce,ne.x,ne.y,at,$e,ve.image),Ce===0&&xe.generateMipmaps&&ee.generateMipmap(3553),$.unbindTexture()},this.copyTextureToTexture3D=function(ne,ve,xe,Ce,Ie=0){if(f.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const We=ne.max.x-ne.min.x+1,at=ne.max.y-ne.min.y+1,$e=ne.max.z-ne.min.z+1,je=S.convert(Ce.format),Bt=S.convert(Ce.type);let pt;if(Ce.isData3DTexture)Fe.setTexture3D(Ce,0),pt=32879;else if(Ce.isDataArrayTexture)Fe.setTexture2DArray(Ce,0),pt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ee.pixelStorei(37440,Ce.flipY),ee.pixelStorei(37441,Ce.premultiplyAlpha),ee.pixelStorei(3317,Ce.unpackAlignment);const yt=ee.getParameter(3314),zt=ee.getParameter(32878),Wr=ee.getParameter(3316),Wo=ee.getParameter(3315),Go=ee.getParameter(32877),bi=xe.isCompressedTexture?xe.mipmaps[0]:xe.image;ee.pixelStorei(3314,bi.width),ee.pixelStorei(32878,bi.height),ee.pixelStorei(3316,ne.min.x),ee.pixelStorei(3315,ne.min.y),ee.pixelStorei(32877,ne.min.z),xe.isDataTexture||xe.isData3DTexture?ee.texSubImage3D(pt,Ie,ve.x,ve.y,ve.z,We,at,$e,je,Bt,bi.data):xe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ee.compressedTexSubImage3D(pt,Ie,ve.x,ve.y,ve.z,We,at,$e,je,bi.data)):ee.texSubImage3D(pt,Ie,ve.x,ve.y,ve.z,We,at,$e,je,Bt,bi),ee.pixelStorei(3314,yt),ee.pixelStorei(32878,zt),ee.pixelStorei(3316,Wr),ee.pixelStorei(3315,Wo),ee.pixelStorei(32877,Go),Ie===0&&Ce.generateMipmaps&&ee.generateMipmap(pt),$.unbindTexture()},this.initTexture=function(ne){ne.isCubeTexture?Fe.setTextureCube(ne,0):ne.isData3DTexture?Fe.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Fe.setTexture2DArray(ne,0):Fe.setTexture2D(ne,0),$.unbindTexture()},this.resetState=function(){m=0,v=0,w=null,$.reset(),Z.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class qre extends h0{}qre.prototype.isWebGL1Renderer=!0;class bB extends Rt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.backgroundBlurriness=this.backgroundBlurriness),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class eie{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=CE,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=No()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;il)continue;h.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(h);xe.far||t.push({distance:x,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),v=Math.min(g.count,o.start+o.count);for(let w=m,B=v-1;wl)continue;h.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(h);be.far||t.push({distance:b,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:A,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class oie{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,A;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),A=r[i]-o,A<0)a=i+1;else if(A>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const c=r[i],h=r[i+1]-c,d=(o-c)/h;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new Ye:new j);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new j,i=[],s=[],o=[],a=new j,l=new He;for(let d=0;d<=e;d++){const p=d/e;i[d]=this.getTangentAt(p,new j)}s[0]=new j,o[0]=new j;let A=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),h=Math.abs(i[0].z);c<=A&&(A=c,r.set(1,0,0)),u<=A&&(A=u,r.set(0,1,0)),h<=A&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(pr(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,p))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(pr(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],d*p)),o[p].crossVectors(i[p],s[p])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class nb extends Ht{constructor(e=1,t=1,r=1,i=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const A=this;i=Math.floor(i),s=Math.floor(s);const c=[],u=[],h=[],d=[];let p=0;const f=[],g=r/2;let m=0;v(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(c),this.setAttribute("position",new rn(u,3)),this.setAttribute("normal",new rn(h,3)),this.setAttribute("uv",new rn(d,2));function v(){const B=new j,C=new j;let b=0;const F=(t-e)/r;for(let x=0;x<=s;x++){const _=[],M=x/s,Y=M*(t-e)+e;for(let O=0;O<=i;O++){const U=O/i,y=U*l+a,I=Math.sin(y),R=Math.cos(y);C.x=Y*I,C.y=-M*r+g,C.z=Y*R,u.push(C.x,C.y,C.z),B.set(I,F,R).normalize(),h.push(B.x,B.y,B.z),d.push(U,1-M),_.push(p++)}f.push(_)}for(let x=0;x0)&&d.push(w,B,b),(m!==r-1||l0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class _1 extends us{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Le(16777215),this.specular=new Le(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nu,this.normalScale=new Ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=KC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aie extends us{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nu,this.normalScale=new Ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class lie extends us{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Le(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nu,this.normalScale=new Ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=KC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function lA(n,e,t){return xZ(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function Mv(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function xZ(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Aie(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function dN(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function IZ(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}class p0{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,i=t[r],s=t[r-1];e:{t:{let o;n:{r:if(!(e=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=lA(r,s,o),this.values=lA(this.values,s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&xZ(i))for(let a=0,l=i.length;a!==l;++a){const A=i[a];if(isNaN(A)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,A),e=!1;break}}return e}optimize(){const e=lA(this.times),t=lA(this.values),r=this.getValueSize(),i=this.getInterpolation()===e1,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,A=0;A!==r;++A)t[l+A]=t[a+A];++o}return o!==e.length?(this.times=lA(e,0,o),this.values=lA(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=lA(this.times,0),t=lA(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}La.prototype.TimeBufferType=Float32Array;La.prototype.ValueBufferType=Float32Array;La.prototype.DefaultInterpolation=Cu;class Of extends La{}Of.prototype.ValueTypeName="bool";Of.prototype.ValueBufferType=Array;Of.prototype.DefaultInterpolation=bf;Of.prototype.InterpolantFactoryMethodLinear=void 0;Of.prototype.InterpolantFactoryMethodSmooth=void 0;class EZ extends La{}EZ.prototype.ValueTypeName="color";class If extends La{}If.prototype.ValueTypeName="number";class die extends p0{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let A=e*a;for(let c=A+a;A!==c;A+=4)rt.slerpFlat(s,0,o,A-a,o,A,l);return s}}class Ra extends La{InterpolantFactoryMethodLinear(e){return new die(this.times,this.values,this.getValueSize(),e)}}Ra.prototype.ValueTypeName="quaternion";Ra.prototype.DefaultInterpolation=Cu;Ra.prototype.InterpolantFactoryMethodSmooth=void 0;class Wf extends La{}Wf.prototype.ValueTypeName="string";Wf.prototype.ValueBufferType=Array;Wf.prototype.DefaultInterpolation=bf;Wf.prototype.InterpolantFactoryMethodLinear=void 0;Wf.prototype.InterpolantFactoryMethodSmooth=void 0;class ac extends La{}ac.prototype.ValueTypeName="vector";class xu{constructor(e,t=-1,r,i=mU){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=No(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(fie(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(La.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const u=c[1];let h=i[u];h||(i[u]=h=[]),h.push(A)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(u,h,d,p,f){if(d.length!==0){const g=[],m=[];IZ(d,g,m,p),g.length!==0&&f.push(new u(h,g,m))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const A=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(ja[e]!==void 0){ja[e].push({onLoad:t,onProgress:r,onError:i});return}ja[e]=[],ja[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(A=>{if(A.status===200||A.status===0){if(A.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||A.body===void 0||A.body.getReader===void 0)return A;const c=ja[e],u=A.body.getReader(),h=A.headers.get("Content-Length"),d=h?parseInt(h):0,p=d!==0;let f=0;const g=new ReadableStream({start(m){v();function v(){u.read().then(({done:w,value:B})=>{if(w)m.close();else{f+=B.byteLength;const C=new ProgressEvent("progress",{lengthComputable:p,loaded:f,total:d});for(let b=0,F=c.length;b{switch(l){case"arraybuffer":return A.arrayBuffer();case"blob":return A.blob();case"document":return A.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return A.json();default:if(a===void 0)return A.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),h=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(h);return A.arrayBuffer().then(p=>d.decode(p))}}}).then(A=>{Ff.add(e,A);const c=ja[e];delete ja[e];for(let u=0,h=c.length;u{const c=ja[e];if(c===void 0)throw this.manager.itemError(e),A;delete ja[e];for(let u=0,h=c.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class SZ extends Gf{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ff.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Qm("img");function l(){c(),Ff.add(e,this),t&&t(this),s.manager.itemEnd(e)}function A(u){c(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function c(){a.removeEventListener("load",l,!1),a.removeEventListener("error",A,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",A,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Pu extends Gf{constructor(e){super(e)}load(e,t,r,i){const s=new or,o=new SZ(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}}class rb extends Rt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Le(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const S1=new He,hN=new j,fN=new j;class EU{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ye(512,512),this.map=null,this.mapPass=null,this.matrix=new He,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new CU,this._frameExtents=new Ye(1,1),this._viewportCount=1,this._viewports=[new Dt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;hN.setFromMatrixPosition(e.matrixWorld),t.position.copy(hN),fN.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(fN),t.updateMatrixWorld(),S1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(S1),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(S1)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class mie extends EU{constructor(){super(new Nr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Um*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class UZ extends rb{constructor(e,t,r=0,i=Math.PI/3,s=0,o=1){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.target=new Rt,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new mie}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const pN=new He,Rp=new j,U1=new j;class vie extends EU{constructor(){super(new Nr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ye(4,2),this._viewportCount=6,this._viewports=[new Dt(2,1,1,1),new Dt(0,1,1,1),new Dt(3,1,1,1),new Dt(1,1,1,1),new Dt(3,0,1,1),new Dt(1,0,1,1)],this._cubeDirections=[new j(1,0,0),new j(-1,0,0),new j(0,0,1),new j(0,0,-1),new j(0,1,0),new j(0,-1,0)],this._cubeUps=[new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,1,0),new j(0,0,1),new j(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Rp.setFromMatrixPosition(e.matrixWorld),r.position.copy(Rp),U1.copy(r.position),U1.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(U1),r.updateMatrixWorld(),i.makeTranslation(-Rp.x,-Rp.y,-Rp.z),pN.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pN)}}class EE extends rb{constructor(e,t,r=0,i=1){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new vie}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class yie extends EU{constructor(){super(new Lu(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class _U extends rb{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.target=new Rt,this.shadow=new yie}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class QZ extends rb{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class xa{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ff.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Ff.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}class RZ{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=gN(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=gN();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function gN(){return(typeof performance>"u"?Date:performance).now()}class Bie{constructor(e,t,r){this.binding=e,this.valueSize=r;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(r,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let l=t,A=t+t;l!==A;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){rt.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;rt.multiplyQuaternionsFlat(e,o,e,t,e,r),rt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const SU="\\[\\]\\.:\\/",Cie=new RegExp("["+SU+"]","g"),UU="[^"+SU+"]",bie="[^"+SU.replace("\\.","")+"]",xie=/((?:WC+[\/:])*)/.source.replace("WC",UU),Iie=/(WCOD+)?/.source.replace("WCOD",bie),Fie=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",UU),Eie=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",UU),_ie=new RegExp("^"+xie+Iie+Fie+Eie+"$"),Sie=["material","materials","bones","map"];class Uie{constructor(e,t,r){const i=r||bt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class bt{constructor(e,t,r){this.path=t,this.parsedPath=r||bt.parseTrackName(t),this.node=bt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new bt.Composite(e,t,r):new bt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Cie,"")}static parseTrackName(e){const t=_ie.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);Sie.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o0){const l=this._interpolants,A=this._propertyBindings;switch(this.blendMode){case k$:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulateAdditive(a);break;case mU:default:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===N$;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===M$){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const A=e<0;this._setEndings(A,!A,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=Ih,i.endingEnd=Ih):(e?i.endingStart=this.zeroSlopeAtStart?Ih:xh:i.endingStart=BB,t?i.endingEnd=this.zeroSlopeAtEnd?Ih:xh:i.endingEnd=BB)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const Rie=new Float32Array(1);class Mie extends yc{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,A=this._bindingsByRootAndName;let c=A[l];c===void 0&&(c={},A[l]=c);for(let u=0;u!==s;++u){const h=i[u],d=h.name;let p=c[d];if(p!==void 0)++p.referenceCount,o[u]=p;else{if(p=o[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,d));continue}const f=t&&t._propertyBindings[u].binding.parsedPath;p=new Bie(bt.create(r,d,f),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,d),o[u]=p}a[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let A=0;A!==r;++A)t[A]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let A=0;A!==l;++A)a[A].apply(o);return this}setTime(e){this.time=0;for(let t=0;tMath.PI&&(Pe-=Ue),ke<-Math.PI?ke+=Ue:ke>Math.PI&&(ke-=Ue),Pe<=ke?a.theta=Math.max(Pe,Math.min(ke,a.theta)):a.theta=a.theta>(Pe+ke)/2?Math.max(Pe,a.theta):Math.min(ke,a.theta)),a.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=A,a.radius=Math.max(r.minDistance,Math.min(r.maxDistance,a.radius)),r.enableDamping===!0?r.target.addScaledVector(c,r.dampingFactor):r.target.add(c),S.setFromSpherical(a),S.applyQuaternion(te),Te.copy(r.target).add(S),r.object.lookAt(r.target),r.enableDamping===!0?(l.theta*=1-r.dampingFactor,l.phi*=1-r.dampingFactor,c.multiplyScalar(1-r.dampingFactor)):(l.set(0,0,0),c.set(0,0,0)),A=1,u||le.distanceToSquared(r.object.position)>o||8*(1-se.dot(r.object.quaternion))>o?(r.dispatchEvent(BN),le.copy(r.object.position),se.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",ie),r.domElement.removeEventListener("pointerdown",P),r.domElement.removeEventListener("pointercancel",q),r.domElement.removeEventListener("wheel",ye),r.domElement.removeEventListener("pointermove",fe),r.domElement.removeEventListener("pointerup",ue),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",be)};const r=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const o=1e-6,a=new yN,l=new yN;let A=1;const c=new j;let u=!1;const h=new Ye,d=new Ye,p=new Ye,f=new Ye,g=new Ye,m=new Ye,v=new Ye,w=new Ye,B=new Ye,C=[],b={};function F(){return 2*Math.PI/60/60*r.autoRotateSpeed}function x(){return Math.pow(.95,r.zoomSpeed)}function _(S){l.theta-=S}function M(S){l.phi-=S}const Y=function(){const S=new j;return function(te,le){S.setFromMatrixColumn(le,0),S.multiplyScalar(-te),c.add(S)}}(),O=function(){const S=new j;return function(te,le){r.screenSpacePanning===!0?S.setFromMatrixColumn(le,1):(S.setFromMatrixColumn(le,0),S.crossVectors(r.object.up,S)),S.multiplyScalar(te),c.add(S)}}(),U=function(){const S=new j;return function(te,le){const se=r.domElement;if(r.object.isPerspectiveCamera){const Ue=r.object.position;S.copy(Ue).sub(r.target);let _e=S.length();_e*=Math.tan(r.object.fov/2*Math.PI/180),Y(2*te*_e/se.clientHeight,r.object.matrix),O(2*le*_e/se.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(Y(te*(r.object.right-r.object.left)/r.object.zoom/se.clientWidth,r.object.matrix),O(le*(r.object.top-r.object.bottom)/r.object.zoom/se.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function y(S){r.object.isPerspectiveCamera?A/=S:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*S)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function I(S){r.object.isPerspectiveCamera?A*=S:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/S)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function R(S){h.set(S.clientX,S.clientY)}function N(S){v.set(S.clientX,S.clientY)}function k(S){f.set(S.clientX,S.clientY)}function L(S){d.set(S.clientX,S.clientY),p.subVectors(d,h).multiplyScalar(r.rotateSpeed);const Z=r.domElement;_(2*Math.PI*p.x/Z.clientHeight),M(2*Math.PI*p.y/Z.clientHeight),h.copy(d),r.update()}function G(S){w.set(S.clientX,S.clientY),B.subVectors(w,v),B.y>0?y(x()):B.y<0&&I(x()),v.copy(w),r.update()}function D(S){g.set(S.clientX,S.clientY),m.subVectors(g,f).multiplyScalar(r.panSpeed),U(m.x,m.y),f.copy(g),r.update()}function E(S){S.deltaY<0?I(x()):S.deltaY>0&&y(x()),r.update()}function z(S){let Z=!1;switch(S.code){case r.keys.UP:U(0,r.keyPanSpeed),Z=!0;break;case r.keys.BOTTOM:U(0,-r.keyPanSpeed),Z=!0;break;case r.keys.LEFT:U(r.keyPanSpeed,0),Z=!0;break;case r.keys.RIGHT:U(-r.keyPanSpeed,0),Z=!0;break}Z&&(S.preventDefault(),r.update())}function re(){if(C.length===1)h.set(C[0].pageX,C[0].pageY);else{const S=.5*(C[0].pageX+C[1].pageX),Z=.5*(C[0].pageY+C[1].pageY);h.set(S,Z)}}function T(){if(C.length===1)f.set(C[0].pageX,C[0].pageY);else{const S=.5*(C[0].pageX+C[1].pageX),Z=.5*(C[0].pageY+C[1].pageY);f.set(S,Z)}}function ee(){const S=C[0].pageX-C[1].pageX,Z=C[0].pageY-C[1].pageY,te=Math.sqrt(S*S+Z*Z);v.set(0,te)}function pe(){r.enableZoom&&ee(),r.enablePan&&T()}function de(){r.enableZoom&&ee(),r.enableRotate&&re()}function Ae(S){if(C.length==1)d.set(S.pageX,S.pageY);else{const te=Q(S),le=.5*(S.pageX+te.x),se=.5*(S.pageY+te.y);d.set(le,se)}p.subVectors(d,h).multiplyScalar(r.rotateSpeed);const Z=r.domElement;_(2*Math.PI*p.x/Z.clientHeight),M(2*Math.PI*p.y/Z.clientHeight),h.copy(d)}function $(S){if(C.length===1)g.set(S.pageX,S.pageY);else{const Z=Q(S),te=.5*(S.pageX+Z.x),le=.5*(S.pageY+Z.y);g.set(te,le)}m.subVectors(g,f).multiplyScalar(r.panSpeed),U(m.x,m.y),f.copy(g)}function ce(S){const Z=Q(S),te=S.pageX-Z.x,le=S.pageY-Z.y,se=Math.sqrt(te*te+le*le);w.set(0,se),B.set(0,Math.pow(w.y/v.y,r.zoomSpeed)),y(B.y),v.copy(w)}function ge(S){r.enableZoom&&ce(S),r.enablePan&&$(S)}function Fe(S){r.enableZoom&&ce(S),r.enableRotate&&Ae(S)}function P(S){r.enabled!==!1&&(C.length===0&&(r.domElement.setPointerCapture(S.pointerId),r.domElement.addEventListener("pointermove",fe),r.domElement.addEventListener("pointerup",ue)),ae(S),S.pointerType==="touch"?W(S):K(S))}function fe(S){r.enabled!==!1&&(S.pointerType==="touch"?H(S):oe(S))}function ue(S){me(S),C.length===0&&(r.domElement.releasePointerCapture(S.pointerId),r.domElement.removeEventListener("pointermove",fe),r.domElement.removeEventListener("pointerup",ue)),r.dispatchEvent(CN),s=i.NONE}function q(S){me(S)}function K(S){let Z;switch(S.button){case 0:Z=r.mouseButtons.LEFT;break;case 1:Z=r.mouseButtons.MIDDLE;break;case 2:Z=r.mouseButtons.RIGHT;break;default:Z=-1}switch(Z){case qu.DOLLY:if(r.enableZoom===!1)return;N(S),s=i.DOLLY;break;case qu.ROTATE:if(S.ctrlKey||S.metaKey||S.shiftKey){if(r.enablePan===!1)return;k(S),s=i.PAN}else{if(r.enableRotate===!1)return;R(S),s=i.ROTATE}break;case qu.PAN:if(S.ctrlKey||S.metaKey||S.shiftKey){if(r.enableRotate===!1)return;R(S),s=i.ROTATE}else{if(r.enablePan===!1)return;k(S),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(Q1)}function oe(S){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;L(S);break;case i.DOLLY:if(r.enableZoom===!1)return;G(S);break;case i.PAN:if(r.enablePan===!1)return;D(S);break}}function ye(S){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(S.preventDefault(),r.dispatchEvent(Q1),E(S),r.dispatchEvent(CN))}function be(S){r.enabled===!1||r.enablePan===!1||z(S)}function W(S){switch(J(S),C.length){case 1:switch(r.touches.ONE){case ed.ROTATE:if(r.enableRotate===!1)return;re(),s=i.TOUCH_ROTATE;break;case ed.PAN:if(r.enablePan===!1)return;T(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case ed.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;pe(),s=i.TOUCH_DOLLY_PAN;break;case ed.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;de(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(Q1)}function H(S){switch(J(S),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;Ae(S),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;$(S),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ge(S),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Fe(S),r.update();break;default:s=i.NONE}}function ie(S){r.enabled!==!1&&S.preventDefault()}function ae(S){C.push(S)}function me(S){delete b[S.pointerId];for(let Z=0;Z=2.0 are supported."));return}const l=new cse(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let A=0;A=0&&a[c]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+c+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function kie(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const It={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Die{constructor(e){this.parser=e,this.name=It.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class Yie{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const A=r.options.manager.getHandler(a.uri);A!==null&&(l=A)}return this.detectSupport().then(function(A){if(A)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Xie{constructor(e){this.name=It.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,A=i.byteLength||0,c=i.count,u=i.byteStride,h=new Uint8Array(a,l,A);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(c,u,h,i.mode,i.filter).then(function(d){return d.buffer}):o.ready.then(function(){const d=new ArrayBuffer(c*u);return o.decodeGltfBuffer(new Uint8Array(d),c,u,h,i.mode,i.filter),d})})}else return null}}class jie{constructor(e){this.name=It.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const A of i.primitives)if(A.mode!==Ns.TRIANGLES&&A.mode!==Ns.TRIANGLE_STRIP&&A.mode!==Ns.TRIANGLE_FAN&&A.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const A in o)a.push(this.parser.getDependency("accessor",o[A]).then(c=>(l[A]=c,l[A])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(A=>{const c=A.pop(),u=c.isGroup?c.children:[c],h=A[0].count,d=[];for(const p of u){const f=new He,g=new j,m=new rt,v=new j(1,1,1),w=new tb(p.geometry,p.material,h);for(let B=0;B Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.6.9 -*/var UN={},RE=function(n){return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))},DZ=function(n){return new Worker(n)};try{URL.revokeObjectURL(RE(""))}catch{RE=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},DZ=function(e){return new Worker(e,{type:"module"})}}var dse=function(n,e,t,r,i){var s=DZ(UN[e]||(UN[e]=RE(n)));return s.onerror=function(o){return i(o.error,null)},s.onmessage=function(o){return i(null,o.data)},s.postMessage(t,r),s},Qt=Uint8Array,Fr=Uint16Array,Pl=Uint32Array,Zf=new Qt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Jf=new Qt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Mm=new Qt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),LZ=function(n,e){for(var t=new Fr(31),r=0;r<31;++r)t[r]=e+=1<>>1|(mn&21845)<<1;cA=(cA&52428)>>>2|(cA&13107)<<2,cA=(cA&61680)>>>4|(cA&3855)<<4,Tm[mn]=((cA&65280)>>>8|(cA&255)<<8)>>>1}var js=function(n,e,t){for(var r=n.length,i=0,s=new Fr(e);i>>l]=A}else for(a=new Fr(r),i=0;i>>15-n[i]);return a},Ol=new Qt(288);for(var mn=0;mn<144;++mn)Ol[mn]=8;for(var mn=144;mn<256;++mn)Ol[mn]=9;for(var mn=256;mn<280;++mn)Ol[mn]=7;for(var mn=280;mn<288;++mn)Ol[mn]=8;var Ef=new Qt(32);for(var mn=0;mn<32;++mn)Ef[mn]=5;var WZ=js(Ol,9,0),GZ=js(Ol,9,1),ZZ=js(Ef,5,0),JZ=js(Ef,5,1),Aw=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Qs=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},cw=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},g0=function(n){return(n/8|0)+(n&7&&1)},Ks=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof Fr?Fr:n instanceof Pl?Pl:Qt)(t-e);return r.set(n.subarray(e,t)),r},m0=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new Qt(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Qt(r*3));var o=function(ee){var pe=e.length;if(ee>pe){var de=new Qt(Math.max(pe*2,ee));de.set(e),e=de}},a=t.f||0,l=t.p||0,A=t.b||0,c=t.l,u=t.d,h=t.m,d=t.n,p=r*8;do{if(!c){t.f=a=Qs(n,l,1);var f=Qs(n,l+1,3);if(l+=3,f)if(f==1)c=GZ,u=JZ,h=9,d=5;else if(f==2){var w=Qs(n,l,31)+257,B=Qs(n,l+10,15)+4,C=w+Qs(n,l+5,31)+1;l+=14;for(var b=new Qt(C),F=new Qt(19),x=0;x>>4;if(g<16)b[x++]=g;else{var U=0,y=0;for(g==16?(y=3+Qs(n,l,3),l+=2,U=b[x-1]):g==17?(y=3+Qs(n,l,7),l+=3):g==18&&(y=11+Qs(n,l,127),l+=7);y--;)b[x++]=U}}var I=b.subarray(0,w),R=b.subarray(w);h=Aw(I),d=Aw(R),c=js(I,h,1),u=js(R,d,1)}else throw"invalid block type";else{var g=g0(l)+4,m=n[g-4]|n[g-3]<<8,v=g+m;if(v>r){if(s)throw"unexpected EOF";break}i&&o(A+m),e.set(n.subarray(g,v),A),t.b=A+=m,t.p=l=v*8;continue}if(l>p){if(s)throw"unexpected EOF";break}}i&&o(A+131072);for(var N=(1<>>4;if(l+=U&15,l>p){if(s)throw"unexpected EOF";break}if(!U)throw"invalid length/literal";if(G<256)e[A++]=G;else if(G==256){V=l,c=null;break}else{var D=G-254;if(G>264){var x=G-257,E=Zf[x];D=Qs(n,l,(1<>>4;if(!z)throw"invalid distance";l+=z&15;var R=OZ[re];if(re>3){var E=Jf[re];R+=cw(n,l)&(1<p){if(s)throw"unexpected EOF";break}i&&o(A+131072);for(var T=A+D;A>>8},Dd=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>>8,n[r+2]|=t>>>16},uw=function(n,e){for(var t=[],r=0;rh&&(h=s[r].s);var d=new Fr(h+1),p=EB(t[c-1],d,0);if(p>e){var r=0,f=0,g=p-e,m=1<e)f+=m-(1<>>=g;f>0;){var w=s[r].s;d[w]=0&&f;--r){var B=s[r].s;d[B]==e&&(--d[B],++f)}p=e}return[new Qt(d),p]},EB=function(n,e,t){return n.s==-1?Math.max(EB(n.l,e,t+1),EB(n.r,e,t+1)):e[n.s]=t},TE=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Fr(++e),r=0,i=n[0],s=1,o=function(l){t[r++]=l},a=1;a<=e;++a)if(n[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=n[a]}return[t.subarray(0,r),e]},Ld=function(n,e){for(var t=0,r=0;r>>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var s=0;s4&&!M[Mm[O-1]];--O);var U=A+5<<3,y=Ld(i,Ol)+Ld(s,Ef)+o,I=Ld(i,h)+Ld(s,f)+o+14+3*O+Ld(F,M)+(2*F[16]+3*F[17]+7*F[18]);if(U<=y&&U<=I)return zg(e,c,n.subarray(l,l+A));var R,N,k,V;if(ea(e,c,1+(I15&&(ea(e,c,z[x]>>>5&127),c+=z[x]>>>12)}}else R=WZ,N=Ol,k=ZZ,V=Ef;for(var x=0;x255){var re=r[x]>>>18&31;Dd(e,c,R[re+257]),c+=N[re+257],re>7&&(ea(e,c,r[x]>>>23&31),c+=Zf[re]);var T=r[x]&31;Dd(e,c,k[T]),c+=V[T],T>3&&(Dd(e,c,r[x]>>>5&8191),c+=Jf[T])}else Dd(e,c,R[r[x]]),c+=N[r[x]];return Dd(e,c,R[256]),c+N[256]},HZ=new Pl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),xl=new Qt(0),zZ=function(n,e,t,r,i,s){var o=n.length,a=new Qt(r+o+5*(1+Math.ceil(o/7e3))+i),l=a.subarray(r,a.length-i),A=0;if(!e||o<8)for(var c=0;c<=o;c+=65535){var u=c+65535;u>>13,p=h&8191,f=(1<7e3||M>24576)&&R>423){A=NE(n,l,0,C,b,F,_,M,O,c-O,A),M=x=_=0,O=c;for(var N=0;N<286;++N)b[N]=0;for(var N=0;N<30;++N)F[N]=0}var k=2,V=0,G=p,D=y-I&32767;if(R>2&&U==B(c-D))for(var E=Math.min(d,R)-1,z=Math.min(32767,c),re=Math.min(258,R);D<=z&&--G&&y!=I;){if(n[c+k]==n[c+k-D]){for(var T=0;Tk){if(k=T,V=D,T>E)break;for(var ee=Math.min(D,T-2),pe=0,N=0;Npe&&(pe=$,I=de)}}}y=I,I=g[y],D+=y-I+32768&32767}if(V){C[M++]=268435456|FB[k]<<18|ME[V];var ce=FB[k]&31,ge=ME[V]&31;_+=Zf[ce]+Jf[ge],++b[257+ce],++F[ge],Y=c+k,++x}else C[M++]=n[c],++b[n[c]]}}A=NE(n,l,s,C,b,F,_,M,O,c-O,A),!s&&A&7&&(A=zg(l,A+1,xl))}return Ks(a,0,r+g0(A)+i)},YZ=function(){for(var n=new Pl(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(t&1&&3988292384)^t>>>1;n[e]=t}return n}(),Hf=function(){var n=-1;return{p:function(e){for(var t=n,r=0;r>>8;n=t},d:function(){return~n}}},MU=function(){var n=1,e=0;return{p:function(t){for(var r=n,i=e,s=t.length,o=0;o!=s;){for(var a=Math.min(o+2655,s);o>16),i=(i&65535)+15*(i>>16)}n=r,e=i},d:function(){return n%=65521,e%=65521,(n&255)<<24|n>>>8<<16|(e&255)<<8|e>>>8}}},Ou=function(n,e,t,r,i){return zZ(n,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):12+e.mem,t,r,!i)},v0=function(n,e){var t={};for(var r in n)t[r]=n[r];for(var r in e)t[r]=e[r];return t},QN=function(n,e,t){for(var r=n(),i=n.toString(),s=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o>>0},M1=function(n,e){return Xn(n,e)+Xn(n,e+4)*4294967296},$t=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},NU=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&$t(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var r=0;r<=t.length;++r)n[r+10]=t.charCodeAt(r)}},kU=function(n){if(n[0]!=31||n[1]!=139||n[2]!=8)throw"invalid gzip data";var e=n[3],t=10;e&4&&(t+=n[10]|(n[11]<<8)+2);for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!n[t++]);return t+(e&2)},e4=function(n){var e=n.length;return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0},DU=function(n){return 10+(n.filename&&n.filename.length+1||0)},LU=function(n,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;n[0]=120,n[1]=r<<6|(r?32-2*r:1)},t4=function(n){if((n[0]&15)!=8||n[0]>>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function VU(n,e){return!e&&typeof n=="function"&&(e=n,n={}),this.ondata=e,n}var Ma=function(){function n(e,t){!t&&typeof e=="function"&&(t=e,e={}),this.ondata=t,this.o=e||{}}return n.prototype.p=function(e,t){this.ondata(Ou(e,this.o,0,0,!t),t)},n.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},n}(),n4=function(){function n(e,t){jf([Yf,function(){return[io,Ma]}],this,VU.call(this,e,t),function(r){var i=new Ma(r.data);onmessage=io(i)},6)}return n}();function r4(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[Yf],function(r){return Bc(y0(r.data[0],r.data[1]))},0,t)}function y0(n,e){return Ou(n,e||{},0,0)}var Vi=function(){function n(e){this.s={},this.p=new Qt(0),this.ondata=e}return n.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new Qt(t+e.length);r.set(this.p),r.set(e,t),this.p=r},n.prototype.c=function(e){this.d=this.s.i=e||!1;var t=this.s.b,r=m0(this.p,this.o,this.s);this.ondata(Ks(r,t,this.s.b),this.d),this.o=Ks(r,this.s.b-32768),this.s.b=this.o.length,this.p=Ks(this.p,this.s.p/8|0),this.s.p&=7},n.prototype.push=function(e,t){this.e(e),this.c(t)},n}(),PU=function(){function n(e){this.ondata=e,jf([zf,function(){return[io,Vi]}],this,0,function(){var t=new Vi;onmessage=io(t)},7)}return n}();function OU(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[zf],function(r){return Bc(Kf(r.data[0],TU(r.data[1])))},1,t)}function Kf(n,e){return m0(n,e)}var _B=function(){function n(e,t){this.c=Hf(),this.l=0,this.v=1,Ma.call(this,e,t)}return n.prototype.push=function(e,t){Ma.prototype.push.call(this,e,t)},n.prototype.p=function(e,t){this.c.p(e),this.l+=e.length;var r=Ou(e,this.o,this.v&&DU(this.o),t&&8,!t);this.v&&(NU(r,this.o),this.v=0),t&&($t(r,r.length-8,this.c.d()),$t(r,r.length-4,this.l)),this.ondata(r,t)},n}(),RN=function(){function n(e,t){jf([Yf,jZ,function(){return[io,Ma,_B]}],this,VU.call(this,e,t),function(r){var i=new _B(r.data);onmessage=io(i)},8)}return n}();function MN(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[Yf,jZ,function(){return[SB]}],function(r){return Bc(SB(r.data[0],r.data[1]))},2,t)}function SB(n,e){e||(e={});var t=Hf(),r=n.length;t.p(n);var i=Ou(n,e,DU(e),8),s=i.length;return NU(i,e),$t(i,s-8,t.d()),$t(i,s-4,r),i}var UB=function(){function n(e){this.v=1,Vi.call(this,e)}return n.prototype.push=function(e,t){if(Vi.prototype.e.call(this,e),this.v){var r=this.p.length>3?kU(this.p):4;if(r>=this.p.length&&!t)return;this.p=this.p.subarray(r),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Vi.prototype.c.call(this,t)},n}(),i4=function(){function n(e){this.ondata=e,jf([zf,KZ,function(){return[io,Vi,UB]}],this,0,function(){var t=new UB;onmessage=io(t)},9)}return n}();function s4(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[zf,KZ,function(){return[QB]}],function(r){return Bc(QB(r.data[0]))},3,t)}function QB(n,e){return m0(n.subarray(kU(n),-8),e||new Qt(e4(n)))}var kE=function(){function n(e,t){this.c=MU(),this.v=1,Ma.call(this,e,t)}return n.prototype.push=function(e,t){Ma.prototype.push.call(this,e,t)},n.prototype.p=function(e,t){this.c.p(e);var r=Ou(e,this.o,this.v&&2,t&&4,!t);this.v&&(LU(r,this.o),this.v=0),t&&$t(r,r.length-4,this.c.d()),this.ondata(r,t)},n}(),fse=function(){function n(e,t){jf([Yf,$Z,function(){return[io,Ma,kE]}],this,VU.call(this,e,t),function(r){var i=new kE(r.data);onmessage=io(i)},10)}return n}();function pse(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[Yf,$Z,function(){return[DE]}],function(r){return Bc(DE(r.data[0],r.data[1]))},4,t)}function DE(n,e){e||(e={});var t=MU();t.p(n);var r=Ou(n,e,2,4);return LU(r,e),$t(r,r.length-4,t.d()),r}var RB=function(){function n(e){this.v=1,Vi.call(this,e)}return n.prototype.push=function(e,t){if(Vi.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Vi.prototype.c.call(this,t)},n}(),o4=function(){function n(e){this.ondata=e,jf([zf,qZ,function(){return[io,Vi,RB]}],this,0,function(){var t=new RB;onmessage=io(t)},11)}return n}();function a4(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[zf,qZ,function(){return[Nm]}],function(r){return Bc(Nm(r.data[0],TU(r.data[1])))},5,t)}function Nm(n,e){return m0((t4(n),n.subarray(2,-4)),e)}var l4=function(){function n(e){this.G=UB,this.I=Vi,this.Z=RB,this.ondata=e}return n.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var r=new Qt(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length)}else this.p=e;if(this.p.length>2){var i=this,s=function(){i.ondata.apply(i,arguments)};this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(s):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(s):new this.Z(s),this.s.push(this.p,t),this.p=null}}},n}(),gse=function(){function n(e){this.G=i4,this.I=PU,this.Z=o4,this.ondata=e}return n.prototype.push=function(e,t){l4.prototype.push.call(this,e,t)},n}();function mse(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return n[0]==31&&n[1]==139&&n[2]==8?s4(n,e,t):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?OU(n,e,t):a4(n,e,t)}function vse(n,e){return n[0]==31&&n[1]==139&&n[2]==8?QB(n,e):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?Kf(n,e):Nm(n,e)}var WU=function(n,e,t,r){for(var i in n){var s=n[i],o=e+i;s instanceof Qt?t[o]=[s,r]:Array.isArray(s)?t[o]=[s[0],v0(r,s[1])]:WU(s,o+"/",t,r)}},TN=typeof TextEncoder<"u"&&new TextEncoder,LE=typeof TextDecoder<"u"&&new TextDecoder,A4=0;try{LE.decode(xl,{stream:!0}),A4=1}catch{}var c4=function(n){for(var e="",t=0;;){var r=n[t++],i=(r>127)+(r>223)+(r>239);if(t+i>n.length)return[e,Ks(n,t-1)];i?i==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}},yse=function(){function n(e){this.ondata=e,A4?this.t=new TextDecoder:this.p=xl}return n.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}return}if(!this.p)throw"stream finished";var r=new Qt(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length);var i=c4(r),s=i[0],o=i[1];if(t){if(o.length)throw"invalid utf-8 data";this.p=null}else this.p=o;this.ondata(s,t)},n}(),wse=function(){function n(e){this.ondata=e}return n.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(lc(e),this.d=t||!1)},n}();function lc(n,e){if(e){for(var t=new Qt(n.length),r=0;r>1)),o=0,a=function(c){s[o++]=c},r=0;rs.length){var l=new Qt(o+8+(i-r<<1));l.set(s),s=l}var A=n.charCodeAt(r);A<128||e?a(A):A<2048?(a(192|A>>6),a(128|A&63)):A>55295&&A<57344?(A=65536+(A&1047552)|n.charCodeAt(++r)&1023,a(240|A>>18),a(128|A>>12&63),a(128|A>>6&63),a(128|A&63)):(a(224|A>>12),a(128|A>>6&63),a(128|A&63))}return Ks(s,0,o)}function GU(n,e){if(e){for(var t="",r=0;r65535)throw"extra field too long";e+=r+4}return e},_f=function(n,e,t,r,i,s,o,a){var l=r.length,A=t.extra,c=a&&a.length,u=jA(A);$t(n,e,o!=null?33639248:67324752),e+=4,o!=null&&(n[e++]=20,n[e++]=t.os),n[e]=20,e+=2,n[e++]=t.flag<<1|(s==null&&8),n[e++]=i&&8,n[e++]=t.compression&255,n[e++]=t.compression>>8;var h=new Date(t.mtime==null?Date.now():t.mtime),d=h.getFullYear()-1980;if(d<0||d>119)throw"date not in range 1980-2099";if($t(n,e,d<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>>1),e+=4,s!=null&&($t(n,e,t.crc),$t(n,e+4,s),$t(n,e+8,t.size)),$t(n,e+12,l),$t(n,e+14,u),e+=16,o!=null&&($t(n,e,c),$t(n,e+6,t.attrs),$t(n,e+10,o),e+=14),n.set(r,e),e+=l,u)for(var p in A){var f=A[p],g=f.length;$t(n,e,+p),$t(n,e+2,g),n.set(f,e+4),e+=4+g}return c&&(n.set(a,e),e+=c),e},ZU=function(n,e,t,r,i){$t(n,e,101010256),$t(n,e+8,t),$t(n,e+10,t),$t(n,e+12,r),$t(n,e+16,i)},km=function(){function n(e){this.filename=e,this.c=Hf(),this.size=0,this.compression=0}return n.prototype.process=function(e,t){this.ondata(null,e,t)},n.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},n}(),Bse=function(){function n(e,t){var r=this;t||(t={}),km.call(this,e),this.d=new Ma(t,function(i,s){r.ondata(null,i,s)}),this.compression=8,this.flag=u4(t.level)}return n.prototype.process=function(e,t){try{this.d.push(e,t)}catch(r){this.ondata(r,null,t)}},n.prototype.push=function(e,t){km.prototype.push.call(this,e,t)},n}(),Cse=function(){function n(e,t){var r=this;t||(t={}),km.call(this,e),this.d=new n4(t,function(i,s,o){r.ondata(i,s,o)}),this.compression=8,this.flag=u4(t.level),this.terminate=this.d.terminate}return n.prototype.process=function(e,t){this.d.push(e,t)},n.prototype.push=function(e,t){km.prototype.push.call(this,e,t)},n}(),bse=function(){function n(e){this.ondata=e,this.u=[],this.d=1}return n.prototype.add=function(e){var t=this;if(this.d&2)throw"stream finished";var r=lc(e.filename),i=r.length,s=e.comment,o=s&&lc(s),a=i!=e.filename.length||o&&s.length!=o.length,l=i+jA(e.extra)+30;if(i>65535)throw"filename too long";var A=new Qt(l);_f(A,0,e,r,a);var c=[A],u=function(){for(var g=0,m=c;g65535&&U("filename too long",null),!O)U(null,v);else if(C<16e4)try{U(null,y0(v,w))}catch(y){U(y,null)}else c.push(r4(v,w,U))},p=0;p65535)throw"filename too long";var m=c?y0(l,A):l,v=m.length,w=Hf();w.p(l),r.push(v0(A,{size:l.length,crc:w.d(),c:m,f:u,m:p,u:h!=o.length||p&&d.length!=f,o:i,compression:c})),i+=30+h+g+v,s+=76+2*(h+g)+(f||0)+v}for(var B=new Qt(s+22),C=i,b=s-i,F=0;F0){var i=Math.min(this.c,e.length),s=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(s,!this.c):this.k[0].push(s),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,a=0,l=void 0,A=void 0;this.p.length?e.length?(A=new Qt(this.p.length+e.length),A.set(this.p),A.set(e,this.p.length)):A=this.p:A=e;for(var c=A.length,u=this.c,h=u&&this.d,d=function(){var m,v=Xn(A,a);if(v==67324752){o=1,l=a,p.d=null,p.c=0;var w=pi(A,a+6),B=pi(A,a+8),C=w&2048,b=w&8,F=pi(A,a+26),x=pi(A,a+28);if(c>a+30+F+x){var _=[];p.k.unshift(_),o=2;var M=Xn(A,a+18),Y=Xn(A,a+22),O=GU(A.subarray(a+30,a+=30+F),!C);M==4294967295?(m=b?[-2]:f4(A,a),M=m[0],Y=m[1]):b&&(M=-1),a+=x,p.c=M;var U,y={name:O,compression:B,start:function(){if(!y.ondata)throw"no callback";if(!M)y.ondata(null,xl,!0);else{var I=r.o[B];if(!I)throw"unknown compression type "+B;U=M<0?new I(O):new I(O,M,Y),U.ondata=function(V,G,D){y.ondata(V,G,D)};for(var R=0,N=_;R=0&&(y.size=M,y.originalSize=Y),p.onfile(y)}return"break"}else if(u){if(v==134695760)return l=a+=12+(u==-2&&8),o=3,p.c=0,"break";if(v==33639248)return l=a-=4,o=3,p.c=0,"break"}},p=this;a65558){e("invalid zip file",null);return}var o=pi(n,s+8);o||e(null,{});var a=o,l=Xn(n,s+16),A=l==4294967295;if(A){if(s=Xn(n,s-12),Xn(n,s)!=101075792){e("invalid zip file",null);return}a=o=Xn(n,s+32),l=Xn(n,s+48)}for(var c=function(h){var d=h4(n,l,A),p=d[0],f=d[1],g=d[2],m=d[3],v=d[4],w=d[5],B=d4(n,w);l=v;var C=function(F,x){F?(r(),e(F,null)):(i[m]=x,--o||e(null,i))};if(!p)C(null,Ks(n,B,B+f));else if(p==8){var b=n.subarray(B,B+f);if(f<32e4)try{C(null,Kf(b,new Qt(g)))}catch(F){C(F,null)}else t.push(OU(b,{size:g},C))}else C("unknown compression type "+p,null)},u=0;u65558)throw"invalid zip file";var r=pi(n,t+8);if(!r)return{};var i=Xn(n,t+16),s=i==4294967295;if(s){if(t=Xn(n,t-12),Xn(n,t)!=101075792)throw"invalid zip file";r=Xn(n,t+32),i=Xn(n,t+48)}for(var o=0;o=t[r])return r-1;if(e<=t[n])return n;let i=n,s=r,o=Math.floor((i+s)/2);for(;e=t[o+1];)e=f&&(p[d][0]=p[h][0]/a[v+1][m],g=p[d][0]*a[m][v]);const w=m>=-1?1:-m,B=u-1<=v?f-1:t-u;for(let b=w;b<=B;++b)p[d][b]=(p[h][b]-p[h][b-1])/a[v+1][m+b],g+=p[d][b]*a[m+b][v];u<=v&&(p[d][f]=-p[h][f-1]/a[v+1][u],g+=p[d][f]*a[u][v]),o[f][u]=g;const C=h;h=d,d=C}}let c=t;for(let u=1;u<=r;++u){for(let h=0;h<=t;++h)o[u][h]*=c;c*=t-u}return o}function Nse(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const A=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=A}}}}for(const r in e){const i=e[r];t[i]!==void 0?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in _t.Objects){const r=_t.Objects.Texture;for(const i in r){const s=this.parseTexture(r[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,o=i!==void 0?i.value:0,a=s!==void 0?s.value:0;if(r.wrapS=o===0?ps:fi,r.wrapT=a===0?ps:fi,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;r.offset.x=l[0],r.offset.y=l[1]}return r}loadTexture(e,t){let r;const i=this.textureLoader.path,s=Jn.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(r=t[s[0].ID],(r.indexOf("blob:")===0||r.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new or):(l.setPath(this.textureLoader.path),o=l.load(r))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new or):o=this.textureLoader.load(r);return this.textureLoader.setPath(i),o}parseMaterials(e){const t=new Map;if("Material"in _t.Objects){const r=_t.Objects.Material;for(const i in r){const s=this.parseMaterial(r[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const r=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!Jn.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new _1;break;case"lambert":a=new lie;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new _1;break}return a.setValues(o),a.name=i,a}parseParameters(e,t,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new Le().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new Le().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new Le().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new Le().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new Le().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new Le().fromArray(e.SpecularColor.value));const s=this;return Jn.get(r).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":i.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,o.ID),i.map!==void 0&&(i.map.encoding=mt);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,o.ID),i.emissiveMap!==void 0&&(i.emissiveMap.encoding=mt);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,o.ID),i.envMap!==void 0&&(i.envMap.mapping=vB,i.envMap.encoding=mt);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.encoding=mt);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,o.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in _t.Objects&&t in _t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Jn.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in _t.Objects){const r=_t.Objects.Deformer;for(const i in r){const s=r[i],o=Jn.get(parseInt(i));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,r);a.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[i]=a}else if(s.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(o,r),a.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const r=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const o={ID:i.ID,indices:[],weights:[],transformLink:new He().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),r.push(o)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i1?o=a:a.length>0?o=a[0]:(o=new _1({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new _l(s,o),i.normalizeSkinWeights()):i=new In(s,o),i}createCurve(e,t){const r=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),i=new zl({color:3342591,linewidth:1});return new Pf(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=y4(t.RotationOrder.value):r.eulerOrder="ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&Jn.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=_t.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Ii.add(e.target)):e.lookAt(new j().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];Jn.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const A=l.ID;Jn.get(A).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new wc(o.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in _t.Objects){const t=_t.Objects.Pose;for(const r in t)if(t[r].attrType==="BindPose"&&t[r].NbPoseNodes>0){const i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new He().fromArray(s.Matrix.a)}):e[i.Node]=new He().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in _t&&"AmbientColor"in _t.GlobalSettings){const e=_t.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new Le(t,r,i);Ii.add(new QZ(s,1))}}}}class Ose{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in _t.Objects){const r=_t.Objects.Geometry;for(const i in r){const s=Jn.get(parseInt(i)),o=this.parseGeometry(s,r[i],e);t.set(parseInt(i),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,s=[],o=e.parents.map(function(u){return _t.Objects.Model[u.ID]});if(o.length===0)return;const a=e.children.reduce(function(u,h){return i[h.ID]!==void 0&&(u=i[h.ID]),u},null);e.children.forEach(function(u){r.morphTargets[u.ID]!==void 0&&s.push(r.morphTargets[u.ID])});const l=o[0],A={};"RotationOrder"in l&&(A.eulerOrder=y4(l.RotationOrder.value)),"InheritType"in l&&(A.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(A.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(A.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(A.scale=l.GeometricScaling.value);const c=v4(A);return this.genGeometry(t,a,s,c)}genGeometry(e,t,r,i){const s=new Ht;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new rn(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new rn(a.colors,3)),t&&(s.setAttribute("skinIndex",new qC(a.weightsIndices,4)),s.setAttribute("skinWeight",new rn(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const A=new Ln().getNormalMatrix(i),c=new rn(a.normal,3);c.applyNormalMatrix(A),s.setAttribute("normal",c)}if(a.uvs.forEach(function(A,c){let u="uv"+(c+1).toString();c===0&&(u="uv"),s.setAttribute(u,new rn(a.uvs[c],2))}),o.material&&o.material.mappingType!=="AllSame"){let A=a.materialIndex[0],c=0;if(a.materialIndex.forEach(function(u,h){u!==A&&(s.addGroup(c,h-c,A),A=u,c=h)}),s.groups.length>0){const u=s.groups[s.groups.length-1],h=u.start+u.count;h!==a.materialIndex.length&&s.addGroup(h,a.materialIndex.length-h,A)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,r,i),s}parseGeoNode(e,t){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},t!==null&&(r.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(o,a){r.weightTable[o]===void 0&&(r.weightTable[o]=[]),r.weightTable[o].push({id:s,weight:i.weights[a]})})})),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,s=!1,o=[],a=[],l=[],A=[],c=[],u=[];const h=this;return e.vertexIndices.forEach(function(d,p){let f,g=!1;d<0&&(d=d^-1,g=!0);let m=[],v=[];if(o.push(d*3,d*3+1,d*3+2),e.color){const w=kv(p,r,d,e.color);l.push(w[0],w[1],w[2])}if(e.skeleton){if(e.weightTable[d]!==void 0&&e.weightTable[d].forEach(function(w){v.push(w.weight),m.push(w.id)}),v.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const w=[0,0,0,0],B=[0,0,0,0];v.forEach(function(C,b){let F=C,x=m[b];B.forEach(function(_,M,Y){if(F>_){Y[M]=F,F=_;const O=w[M];w[M]=x,x=O}})}),m=w,v=B}for(;v.length<4;)v.push(0),m.push(0);for(let w=0;w<4;++w)c.push(v[w]),u.push(m[w])}if(e.normal){const w=kv(p,r,d,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(f=kv(p,r,d,e.material)[0],f<0&&(h.negativeMaterialIndices=!0,f=0)),e.uv&&e.uv.forEach(function(w,B){const C=kv(p,r,d,w);A[B]===void 0&&(A[B]=[]),A[B].push(C[0]),A[B].push(C[1])}),i++,g&&(h.genFace(t,e,o,f,a,l,A,c,u,i),r++,i=0,o=[],a=[],l=[],A=[],c=[],u=[])}),t}genFace(e,t,r,i,s,o,a,l,A,c){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);r[i]={name:t[i].attrName,layer:o}}return r}addClip(e){let t=[];const r=this;return e.layer.forEach(function(i){t=t.concat(r.generateTracks(i))}),new xu(e.name,-1,t)}generateTracks(e){const t=[];let r=new j,i=new rt,s=new j;if(e.transform&&e.transform.decompose(r,i,s),r=r.toArray(),i=new $r().setFromQuaternion(i,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const o=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){const o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new ac(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Wt.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Wt.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Wt.degToRad));const a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,r);i!==void 0&&(i=i.map(Wt.degToRad),i.push(o),i=new $r().fromArray(i),i=new rt().setFromEuler(i)),s!==void 0&&(s=s.map(Wt.degToRad),s.push(o),s=new $r().fromArray(s),s=new rt().setFromEuler(s).invert());const A=new rt,c=new $r,u=[];for(let h=0;h1){let r=1,i=t[0];for(let s=1;s=180){const o=s/180,a=i/o;let l=r+a;const A=e.times[t-1],u=(e.times[t]-A)/o;let h=A+u;const d=[],p=[];for(;h1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),A=parseInt(l[0]),c=parseInt(l[1]);let u=s.split(",").slice(3);u=u.map(function(h){return h.trim().replace(/^"/,"")}),i="connections",s=[A,c],Xse(s,u),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=s),i in o&&Array.isArray(o[i])?o[i].push(s):i!=="a"?o[i]=s:o.a=s,this.setCurrentProp(o,i),i==="a"&&s.slice(-1)!==","&&(o.a=N1(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=N1(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(c){return c.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let A=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":A=parseFloat(A);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":A=N1(A);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:A},this.setCurrentProp(this.getPrevNode(),s)}}class Zse{parse(e){const t=new kN(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new m4;for(;!this.endOfContent(t);){const s=this.parseNode(t,r);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(i===0)return null;const l=[];for(let h=0;h0?l[0]:"",c=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(r.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const h=this.parseNode(e,t);h!==null&&this.parseSubNode(a,r,h)}return r.propertyList=l,typeof A=="number"&&(r.id=A),c!==""&&(r.attrName=c),u!==""&&(r.attrType=u),a!==""&&(r.name=a),r}parseSubNode(e,t,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(s,o){o!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(s){t[s]=r[s]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],s=r.propertyList[1];const o=r.propertyList[2],a=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],t[i]={type:s,type2:o,flag:a,value:l}}else t[r.name]===void 0?typeof r.id=="number"?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:r.name==="PoseNode"?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):t[r.name][r.id]===void 0&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}typeof Qse>"u"&&console.error("THREE.FBXLoader: External library fflate.min.js required.");const a=Nm(new Uint8Array(e.getArrayBuffer(o))),l=new kN(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class kN{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let r=0;r=0&&(t=t.slice(0,r)),xa.decodeText(new Uint8Array(t))}}class m4{add(e,t){this[e]=t}}function Jse(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===w4(n,0,e.length)}function Hse(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function r(i){const s=n[i-1];return n=n.slice(t+i),t++,s}for(let i=0;i4?o=n.array[i*n.itemSize+s]:s===0?o=n.getX(i):s===1?o=n.getY(i):s===2?o=n.getZ(i):s===3&&(o=n.getW(i)),r.min[s]=Math.min(r.min[s],o),r.max[s]=Math.max(r.max[s],o)}return r}function B4(n){return Math.ceil(n/4)*4}function k1(n,e=0){const t=B4(n.byteLength);if(t!==n.byteLength){const r=new Uint8Array(t);if(r.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function GN(n,e){if(n.toBlob!==void 0)return new Promise(r=>n.toBlob(r,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),n.convertToBlob({type:e,quality:t})}class ioe{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,s=i.buffers,o=i.json;r=i.options;const a=i.extensionsUsed,l=new Blob(s,{type:"application/octet-stream"}),A=Object.keys(a);if(A.length>0&&(o.extensionsUsed=A),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=l.size),r.binary===!0){const c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){const u=k1(c.result),h=new DataView(new ArrayBuffer(ON));h.setUint32(0,u.byteLength,!0),h.setUint32(4,eoe,!0);const d=k1(toe(JSON.stringify(o)),32),p=new DataView(new ArrayBuffer(ON));p.setUint32(0,d.byteLength,!0),p.setUint32(4,qse,!0);const f=new ArrayBuffer(PN),g=new DataView(f);g.setUint32(0,Kse,!0),g.setUint32(4,$se,!0);const m=PN+p.byteLength+d.byteLength+h.byteLength+u.byteLength;g.setUint32(8,m,!0);const v=new Blob([f,p,d,h,u],{type:"application/octet-stream"}),w=new FileReader;w.readAsArrayBuffer(v),w.onloadend=function(){t(w.result)}}}else if(o.buffers&&o.buffers.length>0){const c=new FileReader;c.readAsDataURL(l),c.onloadend=function(){const u=c.result;o.buffers[0].uri=u,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],i[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const r=new j;for(let i=0,s=e.count;i5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),i=new j;for(let s=0,o=r.count;s4?f=e.array[d*e.itemSize+p]:p===0?f=e.getX(d):p===1?f=e.getY(d):p===2?f=e.getZ(d):p===3&&(f=e.getW(d)),t===nn.FLOAT?A.setFloat32(c,f,!0):t===nn.UNSIGNED_INT?A.setUint32(c,f,!0):t===nn.UNSIGNED_SHORT?A.setUint16(c,f,!0):t===nn.UNSIGNED_BYTE&&A.setUint8(c,f),c+=a}const u={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(u.target=s),s===nn.ARRAY_BUFFER&&(u.byteStride=e.itemSize*a),this.byteOffset+=l,o.bufferViews.push(u),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const o=k1(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,i){const s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=nn.FLOAT;else if(e.array.constructor===Uint32Array)a=nn.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)a=nn.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)a=nn.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(r===void 0&&(r=0),i===void 0&&(i=e.count),i===0)return null;const l=roe(e,r,i);let A;t!==void 0&&(A=e===t.index?nn.ELEMENT_ARRAY_BUFFER:nn.ARRAY_BUFFER);const c=this.processBufferView(e,a,r,i,A),u={bufferView:c.id,byteOffset:c.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(u)-1}processImage(e,t,r,i="image/png"){const s=this,o=s.cache,a=s.json,l=s.options,A=s.pending;o.images.has(e)||o.images.set(e,{});const c=o.images.get(e),u=i+":flipY/"+r.toString();if(c[u]!==void 0)return c[u];a.images||(a.images=[]);const h={mimeType:i},d=WN();d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize);const p=d.getContext("2d");if(r===!0&&(p.translate(0,d.height),p.scale(1,-1)),e.data!==void 0){t!==Ir&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const g=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;ms.processBufferViewImage(g)).then(g=>{h.bufferView=g})):d.toDataURL!==void 0?h.uri=d.toDataURL(i):A.push(GN(d,i).then(g=>new FileReader().readAsDataURL(g)).then(g=>{h.uri=g}));const f=a.images.push(h)-1;return c[u]=f,f}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:as[e.magFilter],minFilter:as[e.minFilter],wrapS:as[e.wrapS],wrapT:as[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);let i=e.userData.mimeType;i==="image/webp"&&(i="image/png");const s={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)};e.name&&(s.name=e.name),this._invokeAll(function(a){a.writeTexture&&a.writeTexture(e,s)});const o=r.textures.push(s)-1;return t.textures.set(e,o),o}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(gg(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(a)};this.applyTextureTransform(l,a),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),l=Math.max(a.r,a.g,a.b);if(l>1&&(a.multiplyScalar(1/l),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),l>0&&(i.emissiveFactor=a.toArray()),e.emissiveMap){const A={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(A,e.emissiveMap),i.emissiveTexture=A}}if(e.normalMap){const a={index:this.processTexture(e.normalMap)};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:1};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===mi&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=r.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let w=0,B=e.material.length;w0){const w=[],B=[],C={};if(e.morphTargetDictionary!==void 0)for(const b in e.morphTargetDictionary)C[e.morphTargetDictionary[b]]=b;for(let b=0;b0&&(l.extras={},l.extras.targetNames=B)}const f=Array.isArray(e.material);if(f&&o.groups.length===0)return null;const g=f?e.material:[e.material],m=f?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let w=0,B=m.length;w0&&(C.targets=u),o.index!==null){let F=this.getUID(o.index);(m[w].start!==void 0||m[w].count!==void 0)&&(F+=":"+m[w].start+":"+m[w].count),t.attributes.has(F)?C.indices=t.attributes.get(F):(C.indices=this.processAccessor(o.index,o,m[w].start,m[w].count),t.attributes.set(F,C.indices)),C.indices===null&&delete C.indices}const b=this.processMaterial(g[m[w].materialIndex]);b!==null&&(C.material=b),c.push(C)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(w){w.writeMesh&&w.writeMesh(e,l)});const v=r.meshes.push(l)-1;return t.meshes.set(s,v),v}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Wt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=JU.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l0){const a=[];for(let l=0,A=e.children.length;l0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});const o=t.nodes.push(s)-1;return i.set(e,o),o}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let o=0,a=e.children.length;o0&&(i.nodes=s),this.serializeUserData(e,i)}processObjects(e){const t=new bB;t.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class ooe{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class aoe{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;const r=this.writer,i=r.extensionsUsed,s={};t.pbrMetallicRoughness.baseColorFactor&&(s.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);const o=[1,1,1];if(e.specular.toArray(o,0),s.specularFactor=o,s.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(s.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){const a={index:r.processTexture(e.specularMap)};r.applyTextureTransform(a,e.specularMap),s.specularGlossinessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class loe{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:r.processTexture(e.clearcoatMap)};r.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap)};r.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap)};r.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Aoe{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:r.processTexture(e.iridescenceMap)};r.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:r.processTexture(e.iridescenceThicknessMap)};r.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class coe{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const o={index:r.processTexture(e.transmissionMap)};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class uoe{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const o={index:r.processTexture(e.thicknessMap)};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}s.attenuationDistance=e.attenuationDistance,s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}JU.Utils={insertKeyframe:function(n,e){const r=n.getValueSize(),i=new n.TimeBufferType(n.times.length+1),s=new n.ValueBufferType(n.values.length+r),o=n.createInterpolant(new n.ValueBufferType(r));let a;if(n.times.length===0){i[0]=e;for(let l=0;ln.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),s.set(n.values,0),s.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let l=0;le){i.set(n.times.slice(0,l+1),0),i[l+1]=e,i.set(n.times.slice(l+1),l+2),s.set(n.values.slice(0,(l+1)*r),0),s.set(o.evaluate(e),(l+1)*r),s.set(n.values.slice((l+1)*r),(l+2)*r),a=l+1;break}}return n.times=i,n.values=s,a},mergeMorphTargetTracks:function(n,e){const t=[],r={},i=n.tracks;for(let s=0;s0)throw new Error("Invalid string. Length must be a multiple of 4");var t=n.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function foe(n){var e=b4(n),t=e[0],r=e[1];return(t+r)*3/4-r}function poe(n,e,t){return(e+t)*3/4-t}function goe(n){var e,t=b4(n),r=t[0],i=t[1],s=new doe(poe(n,r,i)),o=0,a=i>0?r-4:r,l;for(l=0;l>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ks[n.charCodeAt(l)]<<2|ks[n.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=ks[n.charCodeAt(l)]<<10|ks[n.charCodeAt(l+1)]<<4|ks[n.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function moe(n){return ca[n>>18&63]+ca[n>>12&63]+ca[n>>6&63]+ca[n&63]}function voe(n,e,t){for(var r,i=[],s=e;sa?a:o+s));return r===1?(e=n[t-1],i.push(ca[e>>2]+ca[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(ca[e>>10]+ca[e>>4&63]+ca[e<<2&63]+"=")),i.join("")}var HU={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */HU.read=function(n,e,t,r,i){var s,o,a=i*8-r-1,l=(1<>1,c=-7,u=t?i-1:0,h=t?-1:1,d=n[e+u];for(u+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=s*256+n[e+u],u+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=r;c>0;o=o*256+n[e+u],u+=h,c-=8);if(s===0)s=1-A;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-A}return(d?-1:1)*o*Math.pow(2,s-r)};HU.write=function(n,e,t,r,i,s){var o,a,l,A=s*8-i-1,c=(1<>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1,f=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?e+=h/l:e+=h*Math.pow(2,1-u),e*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(e*l-1)*Math.pow(2,i),o=o+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;n[t+d]=a&255,d+=p,a/=256,i-=8);for(o=o<0;n[t+d]=o&255,d+=p,o/=256,A-=8);n[t+d-p]|=f*128};/*! +*/var UN={},RE=function(n){return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))},DZ=function(n){return new Worker(n)};try{URL.revokeObjectURL(RE(""))}catch{RE=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},DZ=function(e){return new Worker(e,{type:"module"})}}var dse=function(n,e,t,r,i){var s=DZ(UN[e]||(UN[e]=RE(n)));return s.onerror=function(o){return i(o.error,null)},s.onmessage=function(o){return i(null,o.data)},s.postMessage(t,r),s},Qt=Uint8Array,Fr=Uint16Array,Pl=Uint32Array,Zf=new Qt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Jf=new Qt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Mm=new Qt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),LZ=function(n,e){for(var t=new Fr(31),r=0;r<31;++r)t[r]=e+=1<>>1|(mn&21845)<<1;cA=(cA&52428)>>>2|(cA&13107)<<2,cA=(cA&61680)>>>4|(cA&3855)<<4,Tm[mn]=((cA&65280)>>>8|(cA&255)<<8)>>>1}var js=function(n,e,t){for(var r=n.length,i=0,s=new Fr(e);i>>l]=A}else for(a=new Fr(r),i=0;i>>15-n[i]);return a},Ol=new Qt(288);for(var mn=0;mn<144;++mn)Ol[mn]=8;for(var mn=144;mn<256;++mn)Ol[mn]=9;for(var mn=256;mn<280;++mn)Ol[mn]=7;for(var mn=280;mn<288;++mn)Ol[mn]=8;var Ef=new Qt(32);for(var mn=0;mn<32;++mn)Ef[mn]=5;var WZ=js(Ol,9,0),GZ=js(Ol,9,1),ZZ=js(Ef,5,0),JZ=js(Ef,5,1),Aw=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Qs=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},cw=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},g0=function(n){return(n/8|0)+(n&7&&1)},Ks=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof Fr?Fr:n instanceof Pl?Pl:Qt)(t-e);return r.set(n.subarray(e,t)),r},m0=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new Qt(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Qt(r*3));var o=function(ee){var pe=e.length;if(ee>pe){var de=new Qt(Math.max(pe*2,ee));de.set(e),e=de}},a=t.f||0,l=t.p||0,A=t.b||0,c=t.l,u=t.d,h=t.m,d=t.n,p=r*8;do{if(!c){t.f=a=Qs(n,l,1);var f=Qs(n,l+1,3);if(l+=3,f)if(f==1)c=GZ,u=JZ,h=9,d=5;else if(f==2){var w=Qs(n,l,31)+257,B=Qs(n,l+10,15)+4,C=w+Qs(n,l+5,31)+1;l+=14;for(var b=new Qt(C),F=new Qt(19),x=0;x>>4;if(g<16)b[x++]=g;else{var U=0,y=0;for(g==16?(y=3+Qs(n,l,3),l+=2,U=b[x-1]):g==17?(y=3+Qs(n,l,7),l+=3):g==18&&(y=11+Qs(n,l,127),l+=7);y--;)b[x++]=U}}var I=b.subarray(0,w),R=b.subarray(w);h=Aw(I),d=Aw(R),c=js(I,h,1),u=js(R,d,1)}else throw"invalid block type";else{var g=g0(l)+4,m=n[g-4]|n[g-3]<<8,v=g+m;if(v>r){if(s)throw"unexpected EOF";break}i&&o(A+m),e.set(n.subarray(g,v),A),t.b=A+=m,t.p=l=v*8;continue}if(l>p){if(s)throw"unexpected EOF";break}}i&&o(A+131072);for(var N=(1<>>4;if(l+=U&15,l>p){if(s)throw"unexpected EOF";break}if(!U)throw"invalid length/literal";if(G<256)e[A++]=G;else if(G==256){L=l,c=null;break}else{var D=G-254;if(G>264){var x=G-257,E=Zf[x];D=Qs(n,l,(1<>>4;if(!z)throw"invalid distance";l+=z&15;var R=OZ[re];if(re>3){var E=Jf[re];R+=cw(n,l)&(1<p){if(s)throw"unexpected EOF";break}i&&o(A+131072);for(var T=A+D;A>>8},Dd=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>>8,n[r+2]|=t>>>16},uw=function(n,e){for(var t=[],r=0;rh&&(h=s[r].s);var d=new Fr(h+1),p=EB(t[c-1],d,0);if(p>e){var r=0,f=0,g=p-e,m=1<e)f+=m-(1<>>=g;f>0;){var w=s[r].s;d[w]=0&&f;--r){var B=s[r].s;d[B]==e&&(--d[B],++f)}p=e}return[new Qt(d),p]},EB=function(n,e,t){return n.s==-1?Math.max(EB(n.l,e,t+1),EB(n.r,e,t+1)):e[n.s]=t},TE=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Fr(++e),r=0,i=n[0],s=1,o=function(l){t[r++]=l},a=1;a<=e;++a)if(n[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=n[a]}return[t.subarray(0,r),e]},Ld=function(n,e){for(var t=0,r=0;r>>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var s=0;s4&&!M[Mm[O-1]];--O);var U=A+5<<3,y=Ld(i,Ol)+Ld(s,Ef)+o,I=Ld(i,h)+Ld(s,f)+o+14+3*O+Ld(F,M)+(2*F[16]+3*F[17]+7*F[18]);if(U<=y&&U<=I)return zg(e,c,n.subarray(l,l+A));var R,N,k,L;if(ea(e,c,1+(I15&&(ea(e,c,z[x]>>>5&127),c+=z[x]>>>12)}}else R=WZ,N=Ol,k=ZZ,L=Ef;for(var x=0;x255){var re=r[x]>>>18&31;Dd(e,c,R[re+257]),c+=N[re+257],re>7&&(ea(e,c,r[x]>>>23&31),c+=Zf[re]);var T=r[x]&31;Dd(e,c,k[T]),c+=L[T],T>3&&(Dd(e,c,r[x]>>>5&8191),c+=Jf[T])}else Dd(e,c,R[r[x]]),c+=N[r[x]];return Dd(e,c,R[256]),c+N[256]},HZ=new Pl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),xl=new Qt(0),zZ=function(n,e,t,r,i,s){var o=n.length,a=new Qt(r+o+5*(1+Math.ceil(o/7e3))+i),l=a.subarray(r,a.length-i),A=0;if(!e||o<8)for(var c=0;c<=o;c+=65535){var u=c+65535;u>>13,p=h&8191,f=(1<7e3||M>24576)&&R>423){A=NE(n,l,0,C,b,F,_,M,O,c-O,A),M=x=_=0,O=c;for(var N=0;N<286;++N)b[N]=0;for(var N=0;N<30;++N)F[N]=0}var k=2,L=0,G=p,D=y-I&32767;if(R>2&&U==B(c-D))for(var E=Math.min(d,R)-1,z=Math.min(32767,c),re=Math.min(258,R);D<=z&&--G&&y!=I;){if(n[c+k]==n[c+k-D]){for(var T=0;Tk){if(k=T,L=D,T>E)break;for(var ee=Math.min(D,T-2),pe=0,N=0;Npe&&(pe=$,I=de)}}}y=I,I=g[y],D+=y-I+32768&32767}if(L){C[M++]=268435456|FB[k]<<18|ME[L];var ce=FB[k]&31,ge=ME[L]&31;_+=Zf[ce]+Jf[ge],++b[257+ce],++F[ge],Y=c+k,++x}else C[M++]=n[c],++b[n[c]]}}A=NE(n,l,s,C,b,F,_,M,O,c-O,A),!s&&A&7&&(A=zg(l,A+1,xl))}return Ks(a,0,r+g0(A)+i)},YZ=function(){for(var n=new Pl(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(t&1&&3988292384)^t>>>1;n[e]=t}return n}(),Hf=function(){var n=-1;return{p:function(e){for(var t=n,r=0;r>>8;n=t},d:function(){return~n}}},MU=function(){var n=1,e=0;return{p:function(t){for(var r=n,i=e,s=t.length,o=0;o!=s;){for(var a=Math.min(o+2655,s);o>16),i=(i&65535)+15*(i>>16)}n=r,e=i},d:function(){return n%=65521,e%=65521,(n&255)<<24|n>>>8<<16|(e&255)<<8|e>>>8}}},Ou=function(n,e,t,r,i){return zZ(n,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):12+e.mem,t,r,!i)},v0=function(n,e){var t={};for(var r in n)t[r]=n[r];for(var r in e)t[r]=e[r];return t},QN=function(n,e,t){for(var r=n(),i=n.toString(),s=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o>>0},M1=function(n,e){return Xn(n,e)+Xn(n,e+4)*4294967296},$t=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},NU=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&$t(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var r=0;r<=t.length;++r)n[r+10]=t.charCodeAt(r)}},kU=function(n){if(n[0]!=31||n[1]!=139||n[2]!=8)throw"invalid gzip data";var e=n[3],t=10;e&4&&(t+=n[10]|(n[11]<<8)+2);for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!n[t++]);return t+(e&2)},e4=function(n){var e=n.length;return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0},DU=function(n){return 10+(n.filename&&n.filename.length+1||0)},LU=function(n,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;n[0]=120,n[1]=r<<6|(r?32-2*r:1)},t4=function(n){if((n[0]&15)!=8||n[0]>>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function VU(n,e){return!e&&typeof n=="function"&&(e=n,n={}),this.ondata=e,n}var Ma=function(){function n(e,t){!t&&typeof e=="function"&&(t=e,e={}),this.ondata=t,this.o=e||{}}return n.prototype.p=function(e,t){this.ondata(Ou(e,this.o,0,0,!t),t)},n.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},n}(),n4=function(){function n(e,t){jf([Yf,function(){return[io,Ma]}],this,VU.call(this,e,t),function(r){var i=new Ma(r.data);onmessage=io(i)},6)}return n}();function r4(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[Yf],function(r){return Bc(y0(r.data[0],r.data[1]))},0,t)}function y0(n,e){return Ou(n,e||{},0,0)}var Vi=function(){function n(e){this.s={},this.p=new Qt(0),this.ondata=e}return n.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new Qt(t+e.length);r.set(this.p),r.set(e,t),this.p=r},n.prototype.c=function(e){this.d=this.s.i=e||!1;var t=this.s.b,r=m0(this.p,this.o,this.s);this.ondata(Ks(r,t,this.s.b),this.d),this.o=Ks(r,this.s.b-32768),this.s.b=this.o.length,this.p=Ks(this.p,this.s.p/8|0),this.s.p&=7},n.prototype.push=function(e,t){this.e(e),this.c(t)},n}(),PU=function(){function n(e){this.ondata=e,jf([zf,function(){return[io,Vi]}],this,0,function(){var t=new Vi;onmessage=io(t)},7)}return n}();function OU(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[zf],function(r){return Bc(Kf(r.data[0],TU(r.data[1])))},1,t)}function Kf(n,e){return m0(n,e)}var _B=function(){function n(e,t){this.c=Hf(),this.l=0,this.v=1,Ma.call(this,e,t)}return n.prototype.push=function(e,t){Ma.prototype.push.call(this,e,t)},n.prototype.p=function(e,t){this.c.p(e),this.l+=e.length;var r=Ou(e,this.o,this.v&&DU(this.o),t&&8,!t);this.v&&(NU(r,this.o),this.v=0),t&&($t(r,r.length-8,this.c.d()),$t(r,r.length-4,this.l)),this.ondata(r,t)},n}(),RN=function(){function n(e,t){jf([Yf,jZ,function(){return[io,Ma,_B]}],this,VU.call(this,e,t),function(r){var i=new _B(r.data);onmessage=io(i)},8)}return n}();function MN(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[Yf,jZ,function(){return[SB]}],function(r){return Bc(SB(r.data[0],r.data[1]))},2,t)}function SB(n,e){e||(e={});var t=Hf(),r=n.length;t.p(n);var i=Ou(n,e,DU(e),8),s=i.length;return NU(i,e),$t(i,s-8,t.d()),$t(i,s-4,r),i}var UB=function(){function n(e){this.v=1,Vi.call(this,e)}return n.prototype.push=function(e,t){if(Vi.prototype.e.call(this,e),this.v){var r=this.p.length>3?kU(this.p):4;if(r>=this.p.length&&!t)return;this.p=this.p.subarray(r),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Vi.prototype.c.call(this,t)},n}(),i4=function(){function n(e){this.ondata=e,jf([zf,KZ,function(){return[io,Vi,UB]}],this,0,function(){var t=new UB;onmessage=io(t)},9)}return n}();function s4(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[zf,KZ,function(){return[QB]}],function(r){return Bc(QB(r.data[0]))},3,t)}function QB(n,e){return m0(n.subarray(kU(n),-8),e||new Qt(e4(n)))}var kE=function(){function n(e,t){this.c=MU(),this.v=1,Ma.call(this,e,t)}return n.prototype.push=function(e,t){Ma.prototype.push.call(this,e,t)},n.prototype.p=function(e,t){this.c.p(e);var r=Ou(e,this.o,this.v&&2,t&&4,!t);this.v&&(LU(r,this.o),this.v=0),t&&$t(r,r.length-4,this.c.d()),this.ondata(r,t)},n}(),fse=function(){function n(e,t){jf([Yf,$Z,function(){return[io,Ma,kE]}],this,VU.call(this,e,t),function(r){var i=new kE(r.data);onmessage=io(i)},10)}return n}();function pse(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[Yf,$Z,function(){return[DE]}],function(r){return Bc(DE(r.data[0],r.data[1]))},4,t)}function DE(n,e){e||(e={});var t=MU();t.p(n);var r=Ou(n,e,2,4);return LU(r,e),$t(r,r.length-4,t.d()),r}var RB=function(){function n(e){this.v=1,Vi.call(this,e)}return n.prototype.push=function(e,t){if(Vi.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Vi.prototype.c.call(this,t)},n}(),o4=function(){function n(e){this.ondata=e,jf([zf,qZ,function(){return[io,Vi,RB]}],this,0,function(){var t=new RB;onmessage=io(t)},11)}return n}();function a4(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Xf(n,e,[zf,qZ,function(){return[Nm]}],function(r){return Bc(Nm(r.data[0],TU(r.data[1])))},5,t)}function Nm(n,e){return m0((t4(n),n.subarray(2,-4)),e)}var l4=function(){function n(e){this.G=UB,this.I=Vi,this.Z=RB,this.ondata=e}return n.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var r=new Qt(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length)}else this.p=e;if(this.p.length>2){var i=this,s=function(){i.ondata.apply(i,arguments)};this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(s):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(s):new this.Z(s),this.s.push(this.p,t),this.p=null}}},n}(),gse=function(){function n(e){this.G=i4,this.I=PU,this.Z=o4,this.ondata=e}return n.prototype.push=function(e,t){l4.prototype.push.call(this,e,t)},n}();function mse(n,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return n[0]==31&&n[1]==139&&n[2]==8?s4(n,e,t):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?OU(n,e,t):a4(n,e,t)}function vse(n,e){return n[0]==31&&n[1]==139&&n[2]==8?QB(n,e):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?Kf(n,e):Nm(n,e)}var WU=function(n,e,t,r){for(var i in n){var s=n[i],o=e+i;s instanceof Qt?t[o]=[s,r]:Array.isArray(s)?t[o]=[s[0],v0(r,s[1])]:WU(s,o+"/",t,r)}},TN=typeof TextEncoder<"u"&&new TextEncoder,LE=typeof TextDecoder<"u"&&new TextDecoder,A4=0;try{LE.decode(xl,{stream:!0}),A4=1}catch{}var c4=function(n){for(var e="",t=0;;){var r=n[t++],i=(r>127)+(r>223)+(r>239);if(t+i>n.length)return[e,Ks(n,t-1)];i?i==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}},yse=function(){function n(e){this.ondata=e,A4?this.t=new TextDecoder:this.p=xl}return n.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}return}if(!this.p)throw"stream finished";var r=new Qt(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length);var i=c4(r),s=i[0],o=i[1];if(t){if(o.length)throw"invalid utf-8 data";this.p=null}else this.p=o;this.ondata(s,t)},n}(),wse=function(){function n(e){this.ondata=e}return n.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(lc(e),this.d=t||!1)},n}();function lc(n,e){if(e){for(var t=new Qt(n.length),r=0;r>1)),o=0,a=function(c){s[o++]=c},r=0;rs.length){var l=new Qt(o+8+(i-r<<1));l.set(s),s=l}var A=n.charCodeAt(r);A<128||e?a(A):A<2048?(a(192|A>>6),a(128|A&63)):A>55295&&A<57344?(A=65536+(A&1047552)|n.charCodeAt(++r)&1023,a(240|A>>18),a(128|A>>12&63),a(128|A>>6&63),a(128|A&63)):(a(224|A>>12),a(128|A>>6&63),a(128|A&63))}return Ks(s,0,o)}function GU(n,e){if(e){for(var t="",r=0;r65535)throw"extra field too long";e+=r+4}return e},_f=function(n,e,t,r,i,s,o,a){var l=r.length,A=t.extra,c=a&&a.length,u=jA(A);$t(n,e,o!=null?33639248:67324752),e+=4,o!=null&&(n[e++]=20,n[e++]=t.os),n[e]=20,e+=2,n[e++]=t.flag<<1|(s==null&&8),n[e++]=i&&8,n[e++]=t.compression&255,n[e++]=t.compression>>8;var h=new Date(t.mtime==null?Date.now():t.mtime),d=h.getFullYear()-1980;if(d<0||d>119)throw"date not in range 1980-2099";if($t(n,e,d<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>>1),e+=4,s!=null&&($t(n,e,t.crc),$t(n,e+4,s),$t(n,e+8,t.size)),$t(n,e+12,l),$t(n,e+14,u),e+=16,o!=null&&($t(n,e,c),$t(n,e+6,t.attrs),$t(n,e+10,o),e+=14),n.set(r,e),e+=l,u)for(var p in A){var f=A[p],g=f.length;$t(n,e,+p),$t(n,e+2,g),n.set(f,e+4),e+=4+g}return c&&(n.set(a,e),e+=c),e},ZU=function(n,e,t,r,i){$t(n,e,101010256),$t(n,e+8,t),$t(n,e+10,t),$t(n,e+12,r),$t(n,e+16,i)},km=function(){function n(e){this.filename=e,this.c=Hf(),this.size=0,this.compression=0}return n.prototype.process=function(e,t){this.ondata(null,e,t)},n.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},n}(),Bse=function(){function n(e,t){var r=this;t||(t={}),km.call(this,e),this.d=new Ma(t,function(i,s){r.ondata(null,i,s)}),this.compression=8,this.flag=u4(t.level)}return n.prototype.process=function(e,t){try{this.d.push(e,t)}catch(r){this.ondata(r,null,t)}},n.prototype.push=function(e,t){km.prototype.push.call(this,e,t)},n}(),Cse=function(){function n(e,t){var r=this;t||(t={}),km.call(this,e),this.d=new n4(t,function(i,s,o){r.ondata(i,s,o)}),this.compression=8,this.flag=u4(t.level),this.terminate=this.d.terminate}return n.prototype.process=function(e,t){this.d.push(e,t)},n.prototype.push=function(e,t){km.prototype.push.call(this,e,t)},n}(),bse=function(){function n(e){this.ondata=e,this.u=[],this.d=1}return n.prototype.add=function(e){var t=this;if(this.d&2)throw"stream finished";var r=lc(e.filename),i=r.length,s=e.comment,o=s&&lc(s),a=i!=e.filename.length||o&&s.length!=o.length,l=i+jA(e.extra)+30;if(i>65535)throw"filename too long";var A=new Qt(l);_f(A,0,e,r,a);var c=[A],u=function(){for(var g=0,m=c;g65535&&U("filename too long",null),!O)U(null,v);else if(C<16e4)try{U(null,y0(v,w))}catch(y){U(y,null)}else c.push(r4(v,w,U))},p=0;p65535)throw"filename too long";var m=c?y0(l,A):l,v=m.length,w=Hf();w.p(l),r.push(v0(A,{size:l.length,crc:w.d(),c:m,f:u,m:p,u:h!=o.length||p&&d.length!=f,o:i,compression:c})),i+=30+h+g+v,s+=76+2*(h+g)+(f||0)+v}for(var B=new Qt(s+22),C=i,b=s-i,F=0;F0){var i=Math.min(this.c,e.length),s=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(s,!this.c):this.k[0].push(s),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,a=0,l=void 0,A=void 0;this.p.length?e.length?(A=new Qt(this.p.length+e.length),A.set(this.p),A.set(e,this.p.length)):A=this.p:A=e;for(var c=A.length,u=this.c,h=u&&this.d,d=function(){var m,v=Xn(A,a);if(v==67324752){o=1,l=a,p.d=null,p.c=0;var w=pi(A,a+6),B=pi(A,a+8),C=w&2048,b=w&8,F=pi(A,a+26),x=pi(A,a+28);if(c>a+30+F+x){var _=[];p.k.unshift(_),o=2;var M=Xn(A,a+18),Y=Xn(A,a+22),O=GU(A.subarray(a+30,a+=30+F),!C);M==4294967295?(m=b?[-2]:f4(A,a),M=m[0],Y=m[1]):b&&(M=-1),a+=x,p.c=M;var U,y={name:O,compression:B,start:function(){if(!y.ondata)throw"no callback";if(!M)y.ondata(null,xl,!0);else{var I=r.o[B];if(!I)throw"unknown compression type "+B;U=M<0?new I(O):new I(O,M,Y),U.ondata=function(L,G,D){y.ondata(L,G,D)};for(var R=0,N=_;R=0&&(y.size=M,y.originalSize=Y),p.onfile(y)}return"break"}else if(u){if(v==134695760)return l=a+=12+(u==-2&&8),o=3,p.c=0,"break";if(v==33639248)return l=a-=4,o=3,p.c=0,"break"}},p=this;a65558){e("invalid zip file",null);return}var o=pi(n,s+8);o||e(null,{});var a=o,l=Xn(n,s+16),A=l==4294967295;if(A){if(s=Xn(n,s-12),Xn(n,s)!=101075792){e("invalid zip file",null);return}a=o=Xn(n,s+32),l=Xn(n,s+48)}for(var c=function(h){var d=h4(n,l,A),p=d[0],f=d[1],g=d[2],m=d[3],v=d[4],w=d[5],B=d4(n,w);l=v;var C=function(F,x){F?(r(),e(F,null)):(i[m]=x,--o||e(null,i))};if(!p)C(null,Ks(n,B,B+f));else if(p==8){var b=n.subarray(B,B+f);if(f<32e4)try{C(null,Kf(b,new Qt(g)))}catch(F){C(F,null)}else t.push(OU(b,{size:g},C))}else C("unknown compression type "+p,null)},u=0;u65558)throw"invalid zip file";var r=pi(n,t+8);if(!r)return{};var i=Xn(n,t+16),s=i==4294967295;if(s){if(t=Xn(n,t-12),Xn(n,t)!=101075792)throw"invalid zip file";r=Xn(n,t+32),i=Xn(n,t+48)}for(var o=0;o=t[r])return r-1;if(e<=t[n])return n;let i=n,s=r,o=Math.floor((i+s)/2);for(;e=t[o+1];)e=f&&(p[d][0]=p[h][0]/a[v+1][m],g=p[d][0]*a[m][v]);const w=m>=-1?1:-m,B=u-1<=v?f-1:t-u;for(let b=w;b<=B;++b)p[d][b]=(p[h][b]-p[h][b-1])/a[v+1][m+b],g+=p[d][b]*a[m+b][v];u<=v&&(p[d][f]=-p[h][f-1]/a[v+1][u],g+=p[d][f]*a[u][v]),o[f][u]=g;const C=h;h=d,d=C}}let c=t;for(let u=1;u<=r;++u){for(let h=0;h<=t;++h)o[u][h]*=c;c*=t-u}return o}function Nse(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const A=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=A}}}}for(const r in e){const i=e[r];t[i]!==void 0?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in _t.Objects){const r=_t.Objects.Texture;for(const i in r){const s=this.parseTexture(r[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,o=i!==void 0?i.value:0,a=s!==void 0?s.value:0;if(r.wrapS=o===0?ps:fi,r.wrapT=a===0?ps:fi,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;r.offset.x=l[0],r.offset.y=l[1]}return r}loadTexture(e,t){let r;const i=this.textureLoader.path,s=Jn.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(r=t[s[0].ID],(r.indexOf("blob:")===0||r.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new or):(l.setPath(this.textureLoader.path),o=l.load(r))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new or):o=this.textureLoader.load(r);return this.textureLoader.setPath(i),o}parseMaterials(e){const t=new Map;if("Material"in _t.Objects){const r=_t.Objects.Material;for(const i in r){const s=this.parseMaterial(r[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const r=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!Jn.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new _1;break;case"lambert":a=new lie;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new _1;break}return a.setValues(o),a.name=i,a}parseParameters(e,t,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new Le().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new Le().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new Le().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new Le().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new Le().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new Le().fromArray(e.SpecularColor.value));const s=this;return Jn.get(r).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":i.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,o.ID),i.map!==void 0&&(i.map.encoding=mt);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,o.ID),i.emissiveMap!==void 0&&(i.emissiveMap.encoding=mt);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,o.ID),i.envMap!==void 0&&(i.envMap.mapping=vB,i.envMap.encoding=mt);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.encoding=mt);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,o.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in _t.Objects&&t in _t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Jn.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in _t.Objects){const r=_t.Objects.Deformer;for(const i in r){const s=r[i],o=Jn.get(parseInt(i));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,r);a.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[i]=a}else if(s.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(o,r),a.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const r=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const o={ID:i.ID,indices:[],weights:[],transformLink:new He().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),r.push(o)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i1?o=a:a.length>0?o=a[0]:(o=new _1({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new _l(s,o),i.normalizeSkinWeights()):i=new In(s,o),i}createCurve(e,t){const r=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),i=new zl({color:3342591,linewidth:1});return new Pf(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=y4(t.RotationOrder.value):r.eulerOrder="ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&Jn.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=_t.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Ii.add(e.target)):e.lookAt(new j().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];Jn.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const A=l.ID;Jn.get(A).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new wc(o.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in _t.Objects){const t=_t.Objects.Pose;for(const r in t)if(t[r].attrType==="BindPose"&&t[r].NbPoseNodes>0){const i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new He().fromArray(s.Matrix.a)}):e[i.Node]=new He().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in _t&&"AmbientColor"in _t.GlobalSettings){const e=_t.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new Le(t,r,i);Ii.add(new QZ(s,1))}}}}class Ose{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in _t.Objects){const r=_t.Objects.Geometry;for(const i in r){const s=Jn.get(parseInt(i)),o=this.parseGeometry(s,r[i],e);t.set(parseInt(i),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,s=[],o=e.parents.map(function(u){return _t.Objects.Model[u.ID]});if(o.length===0)return;const a=e.children.reduce(function(u,h){return i[h.ID]!==void 0&&(u=i[h.ID]),u},null);e.children.forEach(function(u){r.morphTargets[u.ID]!==void 0&&s.push(r.morphTargets[u.ID])});const l=o[0],A={};"RotationOrder"in l&&(A.eulerOrder=y4(l.RotationOrder.value)),"InheritType"in l&&(A.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(A.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(A.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(A.scale=l.GeometricScaling.value);const c=v4(A);return this.genGeometry(t,a,s,c)}genGeometry(e,t,r,i){const s=new Ht;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new rn(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new rn(a.colors,3)),t&&(s.setAttribute("skinIndex",new qC(a.weightsIndices,4)),s.setAttribute("skinWeight",new rn(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const A=new Ln().getNormalMatrix(i),c=new rn(a.normal,3);c.applyNormalMatrix(A),s.setAttribute("normal",c)}if(a.uvs.forEach(function(A,c){let u="uv"+(c+1).toString();c===0&&(u="uv"),s.setAttribute(u,new rn(a.uvs[c],2))}),o.material&&o.material.mappingType!=="AllSame"){let A=a.materialIndex[0],c=0;if(a.materialIndex.forEach(function(u,h){u!==A&&(s.addGroup(c,h-c,A),A=u,c=h)}),s.groups.length>0){const u=s.groups[s.groups.length-1],h=u.start+u.count;h!==a.materialIndex.length&&s.addGroup(h,a.materialIndex.length-h,A)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,r,i),s}parseGeoNode(e,t){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},t!==null&&(r.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(o,a){r.weightTable[o]===void 0&&(r.weightTable[o]=[]),r.weightTable[o].push({id:s,weight:i.weights[a]})})})),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,s=!1,o=[],a=[],l=[],A=[],c=[],u=[];const h=this;return e.vertexIndices.forEach(function(d,p){let f,g=!1;d<0&&(d=d^-1,g=!0);let m=[],v=[];if(o.push(d*3,d*3+1,d*3+2),e.color){const w=kv(p,r,d,e.color);l.push(w[0],w[1],w[2])}if(e.skeleton){if(e.weightTable[d]!==void 0&&e.weightTable[d].forEach(function(w){v.push(w.weight),m.push(w.id)}),v.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const w=[0,0,0,0],B=[0,0,0,0];v.forEach(function(C,b){let F=C,x=m[b];B.forEach(function(_,M,Y){if(F>_){Y[M]=F,F=_;const O=w[M];w[M]=x,x=O}})}),m=w,v=B}for(;v.length<4;)v.push(0),m.push(0);for(let w=0;w<4;++w)c.push(v[w]),u.push(m[w])}if(e.normal){const w=kv(p,r,d,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(f=kv(p,r,d,e.material)[0],f<0&&(h.negativeMaterialIndices=!0,f=0)),e.uv&&e.uv.forEach(function(w,B){const C=kv(p,r,d,w);A[B]===void 0&&(A[B]=[]),A[B].push(C[0]),A[B].push(C[1])}),i++,g&&(h.genFace(t,e,o,f,a,l,A,c,u,i),r++,i=0,o=[],a=[],l=[],A=[],c=[],u=[])}),t}genFace(e,t,r,i,s,o,a,l,A,c){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);r[i]={name:t[i].attrName,layer:o}}return r}addClip(e){let t=[];const r=this;return e.layer.forEach(function(i){t=t.concat(r.generateTracks(i))}),new xu(e.name,-1,t)}generateTracks(e){const t=[];let r=new j,i=new rt,s=new j;if(e.transform&&e.transform.decompose(r,i,s),r=r.toArray(),i=new $r().setFromQuaternion(i,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const o=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){const o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new ac(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Wt.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Wt.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Wt.degToRad));const a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,r);i!==void 0&&(i=i.map(Wt.degToRad),i.push(o),i=new $r().fromArray(i),i=new rt().setFromEuler(i)),s!==void 0&&(s=s.map(Wt.degToRad),s.push(o),s=new $r().fromArray(s),s=new rt().setFromEuler(s).invert());const A=new rt,c=new $r,u=[];for(let h=0;h1){let r=1,i=t[0];for(let s=1;s=180){const o=s/180,a=i/o;let l=r+a;const A=e.times[t-1],u=(e.times[t]-A)/o;let h=A+u;const d=[],p=[];for(;h1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),A=parseInt(l[0]),c=parseInt(l[1]);let u=s.split(",").slice(3);u=u.map(function(h){return h.trim().replace(/^"/,"")}),i="connections",s=[A,c],Xse(s,u),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=s),i in o&&Array.isArray(o[i])?o[i].push(s):i!=="a"?o[i]=s:o.a=s,this.setCurrentProp(o,i),i==="a"&&s.slice(-1)!==","&&(o.a=N1(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=N1(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(c){return c.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let A=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":A=parseFloat(A);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":A=N1(A);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:A},this.setCurrentProp(this.getPrevNode(),s)}}class Zse{parse(e){const t=new kN(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new m4;for(;!this.endOfContent(t);){const s=this.parseNode(t,r);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(i===0)return null;const l=[];for(let h=0;h0?l[0]:"",c=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(r.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const h=this.parseNode(e,t);h!==null&&this.parseSubNode(a,r,h)}return r.propertyList=l,typeof A=="number"&&(r.id=A),c!==""&&(r.attrName=c),u!==""&&(r.attrType=u),a!==""&&(r.name=a),r}parseSubNode(e,t,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(s,o){o!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(s){t[s]=r[s]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],s=r.propertyList[1];const o=r.propertyList[2],a=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],t[i]={type:s,type2:o,flag:a,value:l}}else t[r.name]===void 0?typeof r.id=="number"?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:r.name==="PoseNode"?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):t[r.name][r.id]===void 0&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}typeof Qse>"u"&&console.error("THREE.FBXLoader: External library fflate.min.js required.");const a=Nm(new Uint8Array(e.getArrayBuffer(o))),l=new kN(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class kN{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let r=0;r=0&&(t=t.slice(0,r)),xa.decodeText(new Uint8Array(t))}}class m4{add(e,t){this[e]=t}}function Jse(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===w4(n,0,e.length)}function Hse(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function r(i){const s=n[i-1];return n=n.slice(t+i),t++,s}for(let i=0;i4?o=n.array[i*n.itemSize+s]:s===0?o=n.getX(i):s===1?o=n.getY(i):s===2?o=n.getZ(i):s===3&&(o=n.getW(i)),r.min[s]=Math.min(r.min[s],o),r.max[s]=Math.max(r.max[s],o)}return r}function B4(n){return Math.ceil(n/4)*4}function k1(n,e=0){const t=B4(n.byteLength);if(t!==n.byteLength){const r=new Uint8Array(t);if(r.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function GN(n,e){if(n.toBlob!==void 0)return new Promise(r=>n.toBlob(r,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),n.convertToBlob({type:e,quality:t})}class ioe{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,s=i.buffers,o=i.json;r=i.options;const a=i.extensionsUsed,l=new Blob(s,{type:"application/octet-stream"}),A=Object.keys(a);if(A.length>0&&(o.extensionsUsed=A),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=l.size),r.binary===!0){const c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){const u=k1(c.result),h=new DataView(new ArrayBuffer(ON));h.setUint32(0,u.byteLength,!0),h.setUint32(4,eoe,!0);const d=k1(toe(JSON.stringify(o)),32),p=new DataView(new ArrayBuffer(ON));p.setUint32(0,d.byteLength,!0),p.setUint32(4,qse,!0);const f=new ArrayBuffer(PN),g=new DataView(f);g.setUint32(0,Kse,!0),g.setUint32(4,$se,!0);const m=PN+p.byteLength+d.byteLength+h.byteLength+u.byteLength;g.setUint32(8,m,!0);const v=new Blob([f,p,d,h,u],{type:"application/octet-stream"}),w=new FileReader;w.readAsArrayBuffer(v),w.onloadend=function(){t(w.result)}}}else if(o.buffers&&o.buffers.length>0){const c=new FileReader;c.readAsDataURL(l),c.onloadend=function(){const u=c.result;o.buffers[0].uri=u,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],i[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const r=new j;for(let i=0,s=e.count;i5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),i=new j;for(let s=0,o=r.count;s4?f=e.array[d*e.itemSize+p]:p===0?f=e.getX(d):p===1?f=e.getY(d):p===2?f=e.getZ(d):p===3&&(f=e.getW(d)),t===nn.FLOAT?A.setFloat32(c,f,!0):t===nn.UNSIGNED_INT?A.setUint32(c,f,!0):t===nn.UNSIGNED_SHORT?A.setUint16(c,f,!0):t===nn.UNSIGNED_BYTE&&A.setUint8(c,f),c+=a}const u={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(u.target=s),s===nn.ARRAY_BUFFER&&(u.byteStride=e.itemSize*a),this.byteOffset+=l,o.bufferViews.push(u),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const o=k1(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,i){const s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=nn.FLOAT;else if(e.array.constructor===Uint32Array)a=nn.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)a=nn.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)a=nn.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(r===void 0&&(r=0),i===void 0&&(i=e.count),i===0)return null;const l=roe(e,r,i);let A;t!==void 0&&(A=e===t.index?nn.ELEMENT_ARRAY_BUFFER:nn.ARRAY_BUFFER);const c=this.processBufferView(e,a,r,i,A),u={bufferView:c.id,byteOffset:c.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(u)-1}processImage(e,t,r,i="image/png"){const s=this,o=s.cache,a=s.json,l=s.options,A=s.pending;o.images.has(e)||o.images.set(e,{});const c=o.images.get(e),u=i+":flipY/"+r.toString();if(c[u]!==void 0)return c[u];a.images||(a.images=[]);const h={mimeType:i},d=WN();d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize);const p=d.getContext("2d");if(r===!0&&(p.translate(0,d.height),p.scale(1,-1)),e.data!==void 0){t!==Ir&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const g=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;ms.processBufferViewImage(g)).then(g=>{h.bufferView=g})):d.toDataURL!==void 0?h.uri=d.toDataURL(i):A.push(GN(d,i).then(g=>new FileReader().readAsDataURL(g)).then(g=>{h.uri=g}));const f=a.images.push(h)-1;return c[u]=f,f}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:as[e.magFilter],minFilter:as[e.minFilter],wrapS:as[e.wrapS],wrapT:as[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);let i=e.userData.mimeType;i==="image/webp"&&(i="image/png");const s={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)};e.name&&(s.name=e.name),this._invokeAll(function(a){a.writeTexture&&a.writeTexture(e,s)});const o=r.textures.push(s)-1;return t.textures.set(e,o),o}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(gg(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(a)};this.applyTextureTransform(l,a),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),l=Math.max(a.r,a.g,a.b);if(l>1&&(a.multiplyScalar(1/l),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),l>0&&(i.emissiveFactor=a.toArray()),e.emissiveMap){const A={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(A,e.emissiveMap),i.emissiveTexture=A}}if(e.normalMap){const a={index:this.processTexture(e.normalMap)};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:1};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===mi&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=r.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let w=0,B=e.material.length;w0){const w=[],B=[],C={};if(e.morphTargetDictionary!==void 0)for(const b in e.morphTargetDictionary)C[e.morphTargetDictionary[b]]=b;for(let b=0;b0&&(l.extras={},l.extras.targetNames=B)}const f=Array.isArray(e.material);if(f&&o.groups.length===0)return null;const g=f?e.material:[e.material],m=f?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let w=0,B=m.length;w0&&(C.targets=u),o.index!==null){let F=this.getUID(o.index);(m[w].start!==void 0||m[w].count!==void 0)&&(F+=":"+m[w].start+":"+m[w].count),t.attributes.has(F)?C.indices=t.attributes.get(F):(C.indices=this.processAccessor(o.index,o,m[w].start,m[w].count),t.attributes.set(F,C.indices)),C.indices===null&&delete C.indices}const b=this.processMaterial(g[m[w].materialIndex]);b!==null&&(C.material=b),c.push(C)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(w){w.writeMesh&&w.writeMesh(e,l)});const v=r.meshes.push(l)-1;return t.meshes.set(s,v),v}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Wt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=JU.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l0){const a=[];for(let l=0,A=e.children.length;l0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});const o=t.nodes.push(s)-1;return i.set(e,o),o}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let o=0,a=e.children.length;o0&&(i.nodes=s),this.serializeUserData(e,i)}processObjects(e){const t=new bB;t.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class ooe{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class aoe{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;const r=this.writer,i=r.extensionsUsed,s={};t.pbrMetallicRoughness.baseColorFactor&&(s.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);const o=[1,1,1];if(e.specular.toArray(o,0),s.specularFactor=o,s.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(s.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){const a={index:r.processTexture(e.specularMap)};r.applyTextureTransform(a,e.specularMap),s.specularGlossinessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class loe{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:r.processTexture(e.clearcoatMap)};r.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap)};r.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap)};r.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Aoe{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:r.processTexture(e.iridescenceMap)};r.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:r.processTexture(e.iridescenceThicknessMap)};r.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class coe{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const o={index:r.processTexture(e.transmissionMap)};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class uoe{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const o={index:r.processTexture(e.thicknessMap)};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}s.attenuationDistance=e.attenuationDistance,s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}JU.Utils={insertKeyframe:function(n,e){const r=n.getValueSize(),i=new n.TimeBufferType(n.times.length+1),s=new n.ValueBufferType(n.values.length+r),o=n.createInterpolant(new n.ValueBufferType(r));let a;if(n.times.length===0){i[0]=e;for(let l=0;ln.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),s.set(n.values,0),s.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let l=0;le){i.set(n.times.slice(0,l+1),0),i[l+1]=e,i.set(n.times.slice(l+1),l+2),s.set(n.values.slice(0,(l+1)*r),0),s.set(o.evaluate(e),(l+1)*r),s.set(n.values.slice((l+1)*r),(l+2)*r),a=l+1;break}}return n.times=i,n.values=s,a},mergeMorphTargetTracks:function(n,e){const t=[],r={},i=n.tracks;for(let s=0;s0)throw new Error("Invalid string. Length must be a multiple of 4");var t=n.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function foe(n){var e=b4(n),t=e[0],r=e[1];return(t+r)*3/4-r}function poe(n,e,t){return(e+t)*3/4-t}function goe(n){var e,t=b4(n),r=t[0],i=t[1],s=new doe(poe(n,r,i)),o=0,a=i>0?r-4:r,l;for(l=0;l>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ks[n.charCodeAt(l)]<<2|ks[n.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=ks[n.charCodeAt(l)]<<10|ks[n.charCodeAt(l+1)]<<4|ks[n.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function moe(n){return ca[n>>18&63]+ca[n>>12&63]+ca[n>>6&63]+ca[n&63]}function voe(n,e,t){for(var r,i=[],s=e;sa?a:o+s));return r===1?(e=n[t-1],i.push(ca[e>>2]+ca[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(ca[e>>10]+ca[e>>4&63]+ca[e<<2&63]+"=")),i.join("")}var HU={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */HU.read=function(n,e,t,r,i){var s,o,a=i*8-r-1,l=(1<>1,c=-7,u=t?i-1:0,h=t?-1:1,d=n[e+u];for(u+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=s*256+n[e+u],u+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=r;c>0;o=o*256+n[e+u],u+=h,c-=8);if(s===0)s=1-A;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-A}return(d?-1:1)*o*Math.pow(2,s-r)};HU.write=function(n,e,t,r,i,s){var o,a,l,A=s*8-i-1,c=(1<>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1,f=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?e+=h/l:e+=h*Math.pow(2,1-u),e*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(e*l-1)*Math.pow(2,i),o=o+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;n[t+d]=a&255,d+=p,a/=256,i-=8);for(o=o<0;n[t+d]=o&255,d+=p,o/=256,A-=8);n[t+d-p]|=f*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(n){const e=ib,t=HU,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50;const i=2147483647;n.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const J=new Uint8Array(1),Q={foo:function(){return 42}};return Object.setPrototypeOf(Q,Uint8Array.prototype),Object.setPrototypeOf(J,Q),J.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(J){if(J>i)throw new RangeError('The value "'+J+'" is invalid for option "size"');const Q=new Uint8Array(J);return Object.setPrototypeOf(Q,a.prototype),Q}function a(J,Q,S){if(typeof J=="number"){if(typeof Q=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(J)}return l(J,Q,S)}a.poolSize=8192;function l(J,Q,S){if(typeof J=="string")return h(J,Q);if(ArrayBuffer.isView(J))return p(J);if(J==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof J);if(W(J,ArrayBuffer)||J&&W(J.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(W(J,SharedArrayBuffer)||J&&W(J.buffer,SharedArrayBuffer)))return f(J,Q,S);if(typeof J=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Z=J.valueOf&&J.valueOf();if(Z!=null&&Z!==J)return a.from(Z,Q,S);const te=g(J);if(te)return te;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof J[Symbol.toPrimitive]=="function")return a.from(J[Symbol.toPrimitive]("string"),Q,S);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof J)}a.from=function(J,Q,S){return l(J,Q,S)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(J){if(typeof J!="number")throw new TypeError('"size" argument must be of type number');if(J<0)throw new RangeError('The value "'+J+'" is invalid for option "size"')}function c(J,Q,S){return A(J),J<=0?o(J):Q!==void 0?typeof S=="string"?o(J).fill(Q,S):o(J).fill(Q):o(J)}a.alloc=function(J,Q,S){return c(J,Q,S)};function u(J){return A(J),o(J<0?0:m(J)|0)}a.allocUnsafe=function(J){return u(J)},a.allocUnsafeSlow=function(J){return u(J)};function h(J,Q){if((typeof Q!="string"||Q==="")&&(Q="utf8"),!a.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);const S=w(J,Q)|0;let Z=o(S);const te=Z.write(J,Q);return te!==S&&(Z=Z.slice(0,te)),Z}function d(J){const Q=J.length<0?0:m(J.length)|0,S=o(Q);for(let Z=0;Z=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return J|0}function v(J){return+J!=J&&(J=0),a.alloc(+J)}a.isBuffer=function(Q){return Q!=null&&Q._isBuffer===!0&&Q!==a.prototype},a.compare=function(Q,S){if(W(Q,Uint8Array)&&(Q=a.from(Q,Q.offset,Q.byteLength)),W(S,Uint8Array)&&(S=a.from(S,S.offset,S.byteLength)),!a.isBuffer(Q)||!a.isBuffer(S))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Q===S)return 0;let Z=Q.length,te=S.length;for(let le=0,se=Math.min(Z,te);lete.length?(a.isBuffer(se)||(se=a.from(se)),se.copy(te,le)):Uint8Array.prototype.set.call(te,se,le);else if(a.isBuffer(se))se.copy(te,le);else throw new TypeError('"list" argument must be an Array of Buffers');le+=se.length}return te};function w(J,Q){if(a.isBuffer(J))return J.length;if(ArrayBuffer.isView(J)||W(J,ArrayBuffer))return J.byteLength;if(typeof J!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof J);const S=J.length,Z=arguments.length>2&&arguments[2]===!0;if(!Z&&S===0)return 0;let te=!1;for(;;)switch(Q){case"ascii":case"latin1":case"binary":return S;case"utf8":case"utf-8":return q(J).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S*2;case"hex":return S>>>1;case"base64":return ye(J).length;default:if(te)return Z?-1:q(J).length;Q=(""+Q).toLowerCase(),te=!0}}a.byteLength=w;function B(J,Q,S){let Z=!1;if((Q===void 0||Q<0)&&(Q=0),Q>this.length||((S===void 0||S>this.length)&&(S=this.length),S<=0)||(S>>>=0,Q>>>=0,S<=Q))return"";for(J||(J="utf8");;)switch(J){case"hex":return V(this,Q,S);case"utf8":case"utf-8":return y(this,Q,S);case"ascii":return N(this,Q,S);case"latin1":case"binary":return k(this,Q,S);case"base64":return U(this,Q,S);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,Q,S);default:if(Z)throw new TypeError("Unknown encoding: "+J);J=(J+"").toLowerCase(),Z=!0}}a.prototype._isBuffer=!0;function C(J,Q,S){const Z=J[Q];J[Q]=J[S],J[S]=Z}a.prototype.swap16=function(){const Q=this.length;if(Q%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let S=0;SS&&(Q+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(Q,S,Z,te,le){if(W(Q,Uint8Array)&&(Q=a.from(Q,Q.offset,Q.byteLength)),!a.isBuffer(Q))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Q);if(S===void 0&&(S=0),Z===void 0&&(Z=Q?Q.length:0),te===void 0&&(te=0),le===void 0&&(le=this.length),S<0||Z>Q.length||te<0||le>this.length)throw new RangeError("out of range index");if(te>=le&&S>=Z)return 0;if(te>=le)return-1;if(S>=Z)return 1;if(S>>>=0,Z>>>=0,te>>>=0,le>>>=0,this===Q)return 0;let se=le-te,Ue=Z-S;const _e=Math.min(se,Ue),Te=this.slice(te,le),Pe=Q.slice(S,Z);for(let ke=0;ke<_e;++ke)if(Te[ke]!==Pe[ke]){se=Te[ke],Ue=Pe[ke];break}return se2147483647?S=2147483647:S<-2147483648&&(S=-2147483648),S=+S,H(S)&&(S=te?0:J.length-1),S<0&&(S=J.length+S),S>=J.length){if(te)return-1;S=J.length-1}else if(S<0)if(te)S=0;else return-1;if(typeof Q=="string"&&(Q=a.from(Q,Z)),a.isBuffer(Q))return Q.length===0?-1:F(J,Q,S,Z,te);if(typeof Q=="number")return Q=Q&255,typeof Uint8Array.prototype.indexOf=="function"?te?Uint8Array.prototype.indexOf.call(J,Q,S):Uint8Array.prototype.lastIndexOf.call(J,Q,S):F(J,[Q],S,Z,te);throw new TypeError("val must be string, number or Buffer")}function F(J,Q,S,Z,te){let le=1,se=J.length,Ue=Q.length;if(Z!==void 0&&(Z=String(Z).toLowerCase(),Z==="ucs2"||Z==="ucs-2"||Z==="utf16le"||Z==="utf-16le")){if(J.length<2||Q.length<2)return-1;le=2,se/=2,Ue/=2,S/=2}function _e(Pe,ke){return le===1?Pe[ke]:Pe.readUInt16BE(ke*le)}let Te;if(te){let Pe=-1;for(Te=S;Tese&&(S=se-Ue),Te=S;Te>=0;Te--){let Pe=!0;for(let ke=0;kete&&(Z=te)):Z=te;const le=Q.length;Z>le/2&&(Z=le/2);let se;for(se=0;se>>0,isFinite(Z)?(Z=Z>>>0,te===void 0&&(te="utf8")):(te=Z,Z=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const le=this.length-S;if((Z===void 0||Z>le)&&(Z=le),Q.length>0&&(Z<0||S<0)||S>this.length)throw new RangeError("Attempt to write outside buffer bounds");te||(te="utf8");let se=!1;for(;;)switch(te){case"hex":return x(this,Q,S,Z);case"utf8":case"utf-8":return _(this,Q,S,Z);case"ascii":case"latin1":case"binary":return M(this,Q,S,Z);case"base64":return Y(this,Q,S,Z);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,Q,S,Z);default:if(se)throw new TypeError("Unknown encoding: "+te);te=(""+te).toLowerCase(),se=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function U(J,Q,S){return Q===0&&S===J.length?e.fromByteArray(J):e.fromByteArray(J.slice(Q,S))}function y(J,Q,S){S=Math.min(J.length,S);const Z=[];let te=Q;for(;te239?4:le>223?3:le>191?2:1;if(te+Ue<=S){let _e,Te,Pe,ke;switch(Ue){case 1:le<128&&(se=le);break;case 2:_e=J[te+1],(_e&192)===128&&(ke=(le&31)<<6|_e&63,ke>127&&(se=ke));break;case 3:_e=J[te+1],Te=J[te+2],(_e&192)===128&&(Te&192)===128&&(ke=(le&15)<<12|(_e&63)<<6|Te&63,ke>2047&&(ke<55296||ke>57343)&&(se=ke));break;case 4:_e=J[te+1],Te=J[te+2],Pe=J[te+3],(_e&192)===128&&(Te&192)===128&&(Pe&192)===128&&(ke=(le&15)<<18|(_e&63)<<12|(Te&63)<<6|Pe&63,ke>65535&&ke<1114112&&(se=ke))}}se===null?(se=65533,Ue=1):se>65535&&(se-=65536,Z.push(se>>>10&1023|55296),se=56320|se&1023),Z.push(se),te+=Ue}return R(Z)}const I=4096;function R(J){const Q=J.length;if(Q<=I)return String.fromCharCode.apply(String,J);let S="",Z=0;for(;ZZ)&&(S=Z);let te="";for(let le=Q;leZ&&(Q=Z),S<0?(S+=Z,S<0&&(S=0)):S>Z&&(S=Z),SS)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(Q,S,Z){Q=Q>>>0,S=S>>>0,Z||D(Q,S,this.length);let te=this[Q],le=1,se=0;for(;++se>>0,S=S>>>0,Z||D(Q,S,this.length);let te=this[Q+--S],le=1;for(;S>0&&(le*=256);)te+=this[Q+--S]*le;return te},a.prototype.readUint8=a.prototype.readUInt8=function(Q,S){return Q=Q>>>0,S||D(Q,1,this.length),this[Q]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(Q,S){return Q=Q>>>0,S||D(Q,2,this.length),this[Q]|this[Q+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(Q,S){return Q=Q>>>0,S||D(Q,2,this.length),this[Q]<<8|this[Q+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),(this[Q]|this[Q+1]<<8|this[Q+2]<<16)+this[Q+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),this[Q]*16777216+(this[Q+1]<<16|this[Q+2]<<8|this[Q+3])},a.prototype.readBigUInt64LE=ae(function(Q){Q=Q>>>0,Fe(Q,"offset");const S=this[Q],Z=this[Q+7];(S===void 0||Z===void 0)&&P(Q,this.length-8);const te=S+this[++Q]*2**8+this[++Q]*2**16+this[++Q]*2**24,le=this[++Q]+this[++Q]*2**8+this[++Q]*2**16+Z*2**24;return BigInt(te)+(BigInt(le)<>>0,Fe(Q,"offset");const S=this[Q],Z=this[Q+7];(S===void 0||Z===void 0)&&P(Q,this.length-8);const te=S*2**24+this[++Q]*2**16+this[++Q]*2**8+this[++Q],le=this[++Q]*2**24+this[++Q]*2**16+this[++Q]*2**8+Z;return(BigInt(te)<>>0,S=S>>>0,Z||D(Q,S,this.length);let te=this[Q],le=1,se=0;for(;++se=le&&(te-=Math.pow(2,8*S)),te},a.prototype.readIntBE=function(Q,S,Z){Q=Q>>>0,S=S>>>0,Z||D(Q,S,this.length);let te=S,le=1,se=this[Q+--te];for(;te>0&&(le*=256);)se+=this[Q+--te]*le;return le*=128,se>=le&&(se-=Math.pow(2,8*S)),se},a.prototype.readInt8=function(Q,S){return Q=Q>>>0,S||D(Q,1,this.length),this[Q]&128?(255-this[Q]+1)*-1:this[Q]},a.prototype.readInt16LE=function(Q,S){Q=Q>>>0,S||D(Q,2,this.length);const Z=this[Q]|this[Q+1]<<8;return Z&32768?Z|4294901760:Z},a.prototype.readInt16BE=function(Q,S){Q=Q>>>0,S||D(Q,2,this.length);const Z=this[Q+1]|this[Q]<<8;return Z&32768?Z|4294901760:Z},a.prototype.readInt32LE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),this[Q]|this[Q+1]<<8|this[Q+2]<<16|this[Q+3]<<24},a.prototype.readInt32BE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),this[Q]<<24|this[Q+1]<<16|this[Q+2]<<8|this[Q+3]},a.prototype.readBigInt64LE=ae(function(Q){Q=Q>>>0,Fe(Q,"offset");const S=this[Q],Z=this[Q+7];(S===void 0||Z===void 0)&&P(Q,this.length-8);const te=this[Q+4]+this[Q+5]*2**8+this[Q+6]*2**16+(Z<<24);return(BigInt(te)<>>0,Fe(Q,"offset");const S=this[Q],Z=this[Q+7];(S===void 0||Z===void 0)&&P(Q,this.length-8);const te=(S<<24)+this[++Q]*2**16+this[++Q]*2**8+this[++Q];return(BigInt(te)<>>0,S||D(Q,4,this.length),t.read(this,Q,!0,23,4)},a.prototype.readFloatBE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),t.read(this,Q,!1,23,4)},a.prototype.readDoubleLE=function(Q,S){return Q=Q>>>0,S||D(Q,8,this.length),t.read(this,Q,!0,52,8)},a.prototype.readDoubleBE=function(Q,S){return Q=Q>>>0,S||D(Q,8,this.length),t.read(this,Q,!1,52,8)};function E(J,Q,S,Z,te,le){if(!a.isBuffer(J))throw new TypeError('"buffer" argument must be a Buffer instance');if(Q>te||QJ.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(Q,S,Z,te){if(Q=+Q,S=S>>>0,Z=Z>>>0,!te){const Ue=Math.pow(2,8*Z)-1;E(this,Q,S,Z,Ue,0)}let le=1,se=0;for(this[S]=Q&255;++se>>0,Z=Z>>>0,!te){const Ue=Math.pow(2,8*Z)-1;E(this,Q,S,Z,Ue,0)}let le=Z-1,se=1;for(this[S+le]=Q&255;--le>=0&&(se*=256);)this[S+le]=Q/se&255;return S+Z},a.prototype.writeUint8=a.prototype.writeUInt8=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,1,255,0),this[S]=Q&255,S+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,2,65535,0),this[S]=Q&255,this[S+1]=Q>>>8,S+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,2,65535,0),this[S]=Q>>>8,this[S+1]=Q&255,S+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,4,4294967295,0),this[S+3]=Q>>>24,this[S+2]=Q>>>16,this[S+1]=Q>>>8,this[S]=Q&255,S+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,4,4294967295,0),this[S]=Q>>>24,this[S+1]=Q>>>16,this[S+2]=Q>>>8,this[S+3]=Q&255,S+4};function z(J,Q,S,Z,te){ge(Q,Z,te,J,S,7);let le=Number(Q&BigInt(4294967295));J[S++]=le,le=le>>8,J[S++]=le,le=le>>8,J[S++]=le,le=le>>8,J[S++]=le;let se=Number(Q>>BigInt(32)&BigInt(4294967295));return J[S++]=se,se=se>>8,J[S++]=se,se=se>>8,J[S++]=se,se=se>>8,J[S++]=se,S}function re(J,Q,S,Z,te){ge(Q,Z,te,J,S,7);let le=Number(Q&BigInt(4294967295));J[S+7]=le,le=le>>8,J[S+6]=le,le=le>>8,J[S+5]=le,le=le>>8,J[S+4]=le;let se=Number(Q>>BigInt(32)&BigInt(4294967295));return J[S+3]=se,se=se>>8,J[S+2]=se,se=se>>8,J[S+1]=se,se=se>>8,J[S]=se,S+8}a.prototype.writeBigUInt64LE=ae(function(Q,S=0){return z(this,Q,S,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=ae(function(Q,S=0){return re(this,Q,S,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(Q,S,Z,te){if(Q=+Q,S=S>>>0,!te){const _e=Math.pow(2,8*Z-1);E(this,Q,S,Z,_e-1,-_e)}let le=0,se=1,Ue=0;for(this[S]=Q&255;++le>0)-Ue&255;return S+Z},a.prototype.writeIntBE=function(Q,S,Z,te){if(Q=+Q,S=S>>>0,!te){const _e=Math.pow(2,8*Z-1);E(this,Q,S,Z,_e-1,-_e)}let le=Z-1,se=1,Ue=0;for(this[S+le]=Q&255;--le>=0&&(se*=256);)Q<0&&Ue===0&&this[S+le+1]!==0&&(Ue=1),this[S+le]=(Q/se>>0)-Ue&255;return S+Z},a.prototype.writeInt8=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,1,127,-128),Q<0&&(Q=255+Q+1),this[S]=Q&255,S+1},a.prototype.writeInt16LE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,2,32767,-32768),this[S]=Q&255,this[S+1]=Q>>>8,S+2},a.prototype.writeInt16BE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,2,32767,-32768),this[S]=Q>>>8,this[S+1]=Q&255,S+2},a.prototype.writeInt32LE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,4,2147483647,-2147483648),this[S]=Q&255,this[S+1]=Q>>>8,this[S+2]=Q>>>16,this[S+3]=Q>>>24,S+4},a.prototype.writeInt32BE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,4,2147483647,-2147483648),Q<0&&(Q=4294967295+Q+1),this[S]=Q>>>24,this[S+1]=Q>>>16,this[S+2]=Q>>>8,this[S+3]=Q&255,S+4},a.prototype.writeBigInt64LE=ae(function(Q,S=0){return z(this,Q,S,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=ae(function(Q,S=0){return re(this,Q,S,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function T(J,Q,S,Z,te,le){if(S+Z>J.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("Index out of range")}function ee(J,Q,S,Z,te){return Q=+Q,S=S>>>0,te||T(J,Q,S,4),t.write(J,Q,S,Z,23,4),S+4}a.prototype.writeFloatLE=function(Q,S,Z){return ee(this,Q,S,!0,Z)},a.prototype.writeFloatBE=function(Q,S,Z){return ee(this,Q,S,!1,Z)};function pe(J,Q,S,Z,te){return Q=+Q,S=S>>>0,te||T(J,Q,S,8),t.write(J,Q,S,Z,52,8),S+8}a.prototype.writeDoubleLE=function(Q,S,Z){return pe(this,Q,S,!0,Z)},a.prototype.writeDoubleBE=function(Q,S,Z){return pe(this,Q,S,!1,Z)},a.prototype.copy=function(Q,S,Z,te){if(!a.isBuffer(Q))throw new TypeError("argument should be a Buffer");if(Z||(Z=0),!te&&te!==0&&(te=this.length),S>=Q.length&&(S=Q.length),S||(S=0),te>0&&te=this.length)throw new RangeError("Index out of range");if(te<0)throw new RangeError("sourceEnd out of bounds");te>this.length&&(te=this.length),Q.length-S>>0,Z=Z===void 0?this.length:Z>>>0,Q||(Q=0);let le;if(typeof Q=="number")for(le=S;le2**32?te=$(String(S)):typeof S=="bigint"&&(te=String(S),(S>BigInt(2)**BigInt(32)||S<-(BigInt(2)**BigInt(32)))&&(te=$(te)),te+="n"),Z+=` It must be ${Q}. Received ${te}`,Z},RangeError);function $(J){let Q="",S=J.length;const Z=J[0]==="-"?1:0;for(;S>=Z+4;S-=3)Q=`_${J.slice(S-3,S)}${Q}`;return`${J.slice(0,S)}${Q}`}function ce(J,Q,S){Fe(Q,"offset"),(J[Q]===void 0||J[Q+S]===void 0)&&P(Q,J.length-(S+1))}function ge(J,Q,S,Z,te,le){if(J>S||J3?Q===0||Q===BigInt(0)?Ue=`>= 0${se} and < 2${se} ** ${(le+1)*8}${se}`:Ue=`>= -(2${se} ** ${(le+1)*8-1}${se}) and < 2 ** ${(le+1)*8-1}${se}`:Ue=`>= ${Q}${se} and <= ${S}${se}`,new de.ERR_OUT_OF_RANGE("value",Ue,J)}ce(Z,te,le)}function Fe(J,Q){if(typeof J!="number")throw new de.ERR_INVALID_ARG_TYPE(Q,"number",J)}function P(J,Q,S){throw Math.floor(J)!==J?(Fe(J,S),new de.ERR_OUT_OF_RANGE(S||"offset","an integer",J)):Q<0?new de.ERR_BUFFER_OUT_OF_BOUNDS:new de.ERR_OUT_OF_RANGE(S||"offset",`>= ${S?1:0} and <= ${Q}`,J)}const fe=/[^+/0-9A-Za-z-_]/g;function ue(J){if(J=J.split("=")[0],J=J.trim().replace(fe,""),J.length<2)return"";for(;J.length%4!==0;)J=J+"=";return J}function q(J,Q){Q=Q||1/0;let S;const Z=J.length;let te=null;const le=[];for(let se=0;se55295&&S<57344){if(!te){if(S>56319){(Q-=3)>-1&&le.push(239,191,189);continue}else if(se+1===Z){(Q-=3)>-1&&le.push(239,191,189);continue}te=S;continue}if(S<56320){(Q-=3)>-1&&le.push(239,191,189),te=S;continue}S=(te-55296<<10|S-56320)+65536}else te&&(Q-=3)>-1&&le.push(239,191,189);if(te=null,S<128){if((Q-=1)<0)break;le.push(S)}else if(S<2048){if((Q-=2)<0)break;le.push(S>>6|192,S&63|128)}else if(S<65536){if((Q-=3)<0)break;le.push(S>>12|224,S>>6&63|128,S&63|128)}else if(S<1114112){if((Q-=4)<0)break;le.push(S>>18|240,S>>12&63|128,S>>6&63|128,S&63|128)}else throw new Error("Invalid code point")}return le}function K(J){const Q=[];for(let S=0;S>8,te=S%256,le.push(te),le.push(Z);return le}function ye(J){return e.toByteArray(ue(J))}function be(J,Q,S,Z){let te;for(te=0;te=Q.length||te>=J.length);++te)Q[te+S]=J[te];return te}function W(J,Q){return J instanceof Q||J!=null&&J.constructor!=null&&J.constructor.name!=null&&J.constructor.name===Q.name}function H(J){return J!==J}const ie=function(){const J="0123456789abcdef",Q=new Array(256);for(let S=0;S<16;++S){const Z=S*16;for(let te=0;te<16;++te)Q[Z+te]=J[S]+J[te]}return Q}();function ae(J){return typeof BigInt>"u"?me:J}function me(){throw new Error("BigInt not supported")}})(C4);/*! + */(function(n){const e=ib,t=HU,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50;const i=2147483647;n.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const J=new Uint8Array(1),Q={foo:function(){return 42}};return Object.setPrototypeOf(Q,Uint8Array.prototype),Object.setPrototypeOf(J,Q),J.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(J){if(J>i)throw new RangeError('The value "'+J+'" is invalid for option "size"');const Q=new Uint8Array(J);return Object.setPrototypeOf(Q,a.prototype),Q}function a(J,Q,S){if(typeof J=="number"){if(typeof Q=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(J)}return l(J,Q,S)}a.poolSize=8192;function l(J,Q,S){if(typeof J=="string")return h(J,Q);if(ArrayBuffer.isView(J))return p(J);if(J==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof J);if(W(J,ArrayBuffer)||J&&W(J.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(W(J,SharedArrayBuffer)||J&&W(J.buffer,SharedArrayBuffer)))return f(J,Q,S);if(typeof J=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Z=J.valueOf&&J.valueOf();if(Z!=null&&Z!==J)return a.from(Z,Q,S);const te=g(J);if(te)return te;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof J[Symbol.toPrimitive]=="function")return a.from(J[Symbol.toPrimitive]("string"),Q,S);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof J)}a.from=function(J,Q,S){return l(J,Q,S)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(J){if(typeof J!="number")throw new TypeError('"size" argument must be of type number');if(J<0)throw new RangeError('The value "'+J+'" is invalid for option "size"')}function c(J,Q,S){return A(J),J<=0?o(J):Q!==void 0?typeof S=="string"?o(J).fill(Q,S):o(J).fill(Q):o(J)}a.alloc=function(J,Q,S){return c(J,Q,S)};function u(J){return A(J),o(J<0?0:m(J)|0)}a.allocUnsafe=function(J){return u(J)},a.allocUnsafeSlow=function(J){return u(J)};function h(J,Q){if((typeof Q!="string"||Q==="")&&(Q="utf8"),!a.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);const S=w(J,Q)|0;let Z=o(S);const te=Z.write(J,Q);return te!==S&&(Z=Z.slice(0,te)),Z}function d(J){const Q=J.length<0?0:m(J.length)|0,S=o(Q);for(let Z=0;Z=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return J|0}function v(J){return+J!=J&&(J=0),a.alloc(+J)}a.isBuffer=function(Q){return Q!=null&&Q._isBuffer===!0&&Q!==a.prototype},a.compare=function(Q,S){if(W(Q,Uint8Array)&&(Q=a.from(Q,Q.offset,Q.byteLength)),W(S,Uint8Array)&&(S=a.from(S,S.offset,S.byteLength)),!a.isBuffer(Q)||!a.isBuffer(S))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Q===S)return 0;let Z=Q.length,te=S.length;for(let le=0,se=Math.min(Z,te);lete.length?(a.isBuffer(se)||(se=a.from(se)),se.copy(te,le)):Uint8Array.prototype.set.call(te,se,le);else if(a.isBuffer(se))se.copy(te,le);else throw new TypeError('"list" argument must be an Array of Buffers');le+=se.length}return te};function w(J,Q){if(a.isBuffer(J))return J.length;if(ArrayBuffer.isView(J)||W(J,ArrayBuffer))return J.byteLength;if(typeof J!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof J);const S=J.length,Z=arguments.length>2&&arguments[2]===!0;if(!Z&&S===0)return 0;let te=!1;for(;;)switch(Q){case"ascii":case"latin1":case"binary":return S;case"utf8":case"utf-8":return q(J).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S*2;case"hex":return S>>>1;case"base64":return ye(J).length;default:if(te)return Z?-1:q(J).length;Q=(""+Q).toLowerCase(),te=!0}}a.byteLength=w;function B(J,Q,S){let Z=!1;if((Q===void 0||Q<0)&&(Q=0),Q>this.length||((S===void 0||S>this.length)&&(S=this.length),S<=0)||(S>>>=0,Q>>>=0,S<=Q))return"";for(J||(J="utf8");;)switch(J){case"hex":return L(this,Q,S);case"utf8":case"utf-8":return y(this,Q,S);case"ascii":return N(this,Q,S);case"latin1":case"binary":return k(this,Q,S);case"base64":return U(this,Q,S);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,Q,S);default:if(Z)throw new TypeError("Unknown encoding: "+J);J=(J+"").toLowerCase(),Z=!0}}a.prototype._isBuffer=!0;function C(J,Q,S){const Z=J[Q];J[Q]=J[S],J[S]=Z}a.prototype.swap16=function(){const Q=this.length;if(Q%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let S=0;SS&&(Q+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(Q,S,Z,te,le){if(W(Q,Uint8Array)&&(Q=a.from(Q,Q.offset,Q.byteLength)),!a.isBuffer(Q))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Q);if(S===void 0&&(S=0),Z===void 0&&(Z=Q?Q.length:0),te===void 0&&(te=0),le===void 0&&(le=this.length),S<0||Z>Q.length||te<0||le>this.length)throw new RangeError("out of range index");if(te>=le&&S>=Z)return 0;if(te>=le)return-1;if(S>=Z)return 1;if(S>>>=0,Z>>>=0,te>>>=0,le>>>=0,this===Q)return 0;let se=le-te,Ue=Z-S;const _e=Math.min(se,Ue),Te=this.slice(te,le),Pe=Q.slice(S,Z);for(let ke=0;ke<_e;++ke)if(Te[ke]!==Pe[ke]){se=Te[ke],Ue=Pe[ke];break}return se2147483647?S=2147483647:S<-2147483648&&(S=-2147483648),S=+S,H(S)&&(S=te?0:J.length-1),S<0&&(S=J.length+S),S>=J.length){if(te)return-1;S=J.length-1}else if(S<0)if(te)S=0;else return-1;if(typeof Q=="string"&&(Q=a.from(Q,Z)),a.isBuffer(Q))return Q.length===0?-1:F(J,Q,S,Z,te);if(typeof Q=="number")return Q=Q&255,typeof Uint8Array.prototype.indexOf=="function"?te?Uint8Array.prototype.indexOf.call(J,Q,S):Uint8Array.prototype.lastIndexOf.call(J,Q,S):F(J,[Q],S,Z,te);throw new TypeError("val must be string, number or Buffer")}function F(J,Q,S,Z,te){let le=1,se=J.length,Ue=Q.length;if(Z!==void 0&&(Z=String(Z).toLowerCase(),Z==="ucs2"||Z==="ucs-2"||Z==="utf16le"||Z==="utf-16le")){if(J.length<2||Q.length<2)return-1;le=2,se/=2,Ue/=2,S/=2}function _e(Pe,ke){return le===1?Pe[ke]:Pe.readUInt16BE(ke*le)}let Te;if(te){let Pe=-1;for(Te=S;Tese&&(S=se-Ue),Te=S;Te>=0;Te--){let Pe=!0;for(let ke=0;kete&&(Z=te)):Z=te;const le=Q.length;Z>le/2&&(Z=le/2);let se;for(se=0;se>>0,isFinite(Z)?(Z=Z>>>0,te===void 0&&(te="utf8")):(te=Z,Z=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const le=this.length-S;if((Z===void 0||Z>le)&&(Z=le),Q.length>0&&(Z<0||S<0)||S>this.length)throw new RangeError("Attempt to write outside buffer bounds");te||(te="utf8");let se=!1;for(;;)switch(te){case"hex":return x(this,Q,S,Z);case"utf8":case"utf-8":return _(this,Q,S,Z);case"ascii":case"latin1":case"binary":return M(this,Q,S,Z);case"base64":return Y(this,Q,S,Z);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,Q,S,Z);default:if(se)throw new TypeError("Unknown encoding: "+te);te=(""+te).toLowerCase(),se=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function U(J,Q,S){return Q===0&&S===J.length?e.fromByteArray(J):e.fromByteArray(J.slice(Q,S))}function y(J,Q,S){S=Math.min(J.length,S);const Z=[];let te=Q;for(;te239?4:le>223?3:le>191?2:1;if(te+Ue<=S){let _e,Te,Pe,ke;switch(Ue){case 1:le<128&&(se=le);break;case 2:_e=J[te+1],(_e&192)===128&&(ke=(le&31)<<6|_e&63,ke>127&&(se=ke));break;case 3:_e=J[te+1],Te=J[te+2],(_e&192)===128&&(Te&192)===128&&(ke=(le&15)<<12|(_e&63)<<6|Te&63,ke>2047&&(ke<55296||ke>57343)&&(se=ke));break;case 4:_e=J[te+1],Te=J[te+2],Pe=J[te+3],(_e&192)===128&&(Te&192)===128&&(Pe&192)===128&&(ke=(le&15)<<18|(_e&63)<<12|(Te&63)<<6|Pe&63,ke>65535&&ke<1114112&&(se=ke))}}se===null?(se=65533,Ue=1):se>65535&&(se-=65536,Z.push(se>>>10&1023|55296),se=56320|se&1023),Z.push(se),te+=Ue}return R(Z)}const I=4096;function R(J){const Q=J.length;if(Q<=I)return String.fromCharCode.apply(String,J);let S="",Z=0;for(;ZZ)&&(S=Z);let te="";for(let le=Q;leZ&&(Q=Z),S<0?(S+=Z,S<0&&(S=0)):S>Z&&(S=Z),SS)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(Q,S,Z){Q=Q>>>0,S=S>>>0,Z||D(Q,S,this.length);let te=this[Q],le=1,se=0;for(;++se>>0,S=S>>>0,Z||D(Q,S,this.length);let te=this[Q+--S],le=1;for(;S>0&&(le*=256);)te+=this[Q+--S]*le;return te},a.prototype.readUint8=a.prototype.readUInt8=function(Q,S){return Q=Q>>>0,S||D(Q,1,this.length),this[Q]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(Q,S){return Q=Q>>>0,S||D(Q,2,this.length),this[Q]|this[Q+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(Q,S){return Q=Q>>>0,S||D(Q,2,this.length),this[Q]<<8|this[Q+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),(this[Q]|this[Q+1]<<8|this[Q+2]<<16)+this[Q+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),this[Q]*16777216+(this[Q+1]<<16|this[Q+2]<<8|this[Q+3])},a.prototype.readBigUInt64LE=ae(function(Q){Q=Q>>>0,Fe(Q,"offset");const S=this[Q],Z=this[Q+7];(S===void 0||Z===void 0)&&P(Q,this.length-8);const te=S+this[++Q]*2**8+this[++Q]*2**16+this[++Q]*2**24,le=this[++Q]+this[++Q]*2**8+this[++Q]*2**16+Z*2**24;return BigInt(te)+(BigInt(le)<>>0,Fe(Q,"offset");const S=this[Q],Z=this[Q+7];(S===void 0||Z===void 0)&&P(Q,this.length-8);const te=S*2**24+this[++Q]*2**16+this[++Q]*2**8+this[++Q],le=this[++Q]*2**24+this[++Q]*2**16+this[++Q]*2**8+Z;return(BigInt(te)<>>0,S=S>>>0,Z||D(Q,S,this.length);let te=this[Q],le=1,se=0;for(;++se=le&&(te-=Math.pow(2,8*S)),te},a.prototype.readIntBE=function(Q,S,Z){Q=Q>>>0,S=S>>>0,Z||D(Q,S,this.length);let te=S,le=1,se=this[Q+--te];for(;te>0&&(le*=256);)se+=this[Q+--te]*le;return le*=128,se>=le&&(se-=Math.pow(2,8*S)),se},a.prototype.readInt8=function(Q,S){return Q=Q>>>0,S||D(Q,1,this.length),this[Q]&128?(255-this[Q]+1)*-1:this[Q]},a.prototype.readInt16LE=function(Q,S){Q=Q>>>0,S||D(Q,2,this.length);const Z=this[Q]|this[Q+1]<<8;return Z&32768?Z|4294901760:Z},a.prototype.readInt16BE=function(Q,S){Q=Q>>>0,S||D(Q,2,this.length);const Z=this[Q+1]|this[Q]<<8;return Z&32768?Z|4294901760:Z},a.prototype.readInt32LE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),this[Q]|this[Q+1]<<8|this[Q+2]<<16|this[Q+3]<<24},a.prototype.readInt32BE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),this[Q]<<24|this[Q+1]<<16|this[Q+2]<<8|this[Q+3]},a.prototype.readBigInt64LE=ae(function(Q){Q=Q>>>0,Fe(Q,"offset");const S=this[Q],Z=this[Q+7];(S===void 0||Z===void 0)&&P(Q,this.length-8);const te=this[Q+4]+this[Q+5]*2**8+this[Q+6]*2**16+(Z<<24);return(BigInt(te)<>>0,Fe(Q,"offset");const S=this[Q],Z=this[Q+7];(S===void 0||Z===void 0)&&P(Q,this.length-8);const te=(S<<24)+this[++Q]*2**16+this[++Q]*2**8+this[++Q];return(BigInt(te)<>>0,S||D(Q,4,this.length),t.read(this,Q,!0,23,4)},a.prototype.readFloatBE=function(Q,S){return Q=Q>>>0,S||D(Q,4,this.length),t.read(this,Q,!1,23,4)},a.prototype.readDoubleLE=function(Q,S){return Q=Q>>>0,S||D(Q,8,this.length),t.read(this,Q,!0,52,8)},a.prototype.readDoubleBE=function(Q,S){return Q=Q>>>0,S||D(Q,8,this.length),t.read(this,Q,!1,52,8)};function E(J,Q,S,Z,te,le){if(!a.isBuffer(J))throw new TypeError('"buffer" argument must be a Buffer instance');if(Q>te||QJ.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(Q,S,Z,te){if(Q=+Q,S=S>>>0,Z=Z>>>0,!te){const Ue=Math.pow(2,8*Z)-1;E(this,Q,S,Z,Ue,0)}let le=1,se=0;for(this[S]=Q&255;++se>>0,Z=Z>>>0,!te){const Ue=Math.pow(2,8*Z)-1;E(this,Q,S,Z,Ue,0)}let le=Z-1,se=1;for(this[S+le]=Q&255;--le>=0&&(se*=256);)this[S+le]=Q/se&255;return S+Z},a.prototype.writeUint8=a.prototype.writeUInt8=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,1,255,0),this[S]=Q&255,S+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,2,65535,0),this[S]=Q&255,this[S+1]=Q>>>8,S+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,2,65535,0),this[S]=Q>>>8,this[S+1]=Q&255,S+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,4,4294967295,0),this[S+3]=Q>>>24,this[S+2]=Q>>>16,this[S+1]=Q>>>8,this[S]=Q&255,S+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,4,4294967295,0),this[S]=Q>>>24,this[S+1]=Q>>>16,this[S+2]=Q>>>8,this[S+3]=Q&255,S+4};function z(J,Q,S,Z,te){ge(Q,Z,te,J,S,7);let le=Number(Q&BigInt(4294967295));J[S++]=le,le=le>>8,J[S++]=le,le=le>>8,J[S++]=le,le=le>>8,J[S++]=le;let se=Number(Q>>BigInt(32)&BigInt(4294967295));return J[S++]=se,se=se>>8,J[S++]=se,se=se>>8,J[S++]=se,se=se>>8,J[S++]=se,S}function re(J,Q,S,Z,te){ge(Q,Z,te,J,S,7);let le=Number(Q&BigInt(4294967295));J[S+7]=le,le=le>>8,J[S+6]=le,le=le>>8,J[S+5]=le,le=le>>8,J[S+4]=le;let se=Number(Q>>BigInt(32)&BigInt(4294967295));return J[S+3]=se,se=se>>8,J[S+2]=se,se=se>>8,J[S+1]=se,se=se>>8,J[S]=se,S+8}a.prototype.writeBigUInt64LE=ae(function(Q,S=0){return z(this,Q,S,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=ae(function(Q,S=0){return re(this,Q,S,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(Q,S,Z,te){if(Q=+Q,S=S>>>0,!te){const _e=Math.pow(2,8*Z-1);E(this,Q,S,Z,_e-1,-_e)}let le=0,se=1,Ue=0;for(this[S]=Q&255;++le>0)-Ue&255;return S+Z},a.prototype.writeIntBE=function(Q,S,Z,te){if(Q=+Q,S=S>>>0,!te){const _e=Math.pow(2,8*Z-1);E(this,Q,S,Z,_e-1,-_e)}let le=Z-1,se=1,Ue=0;for(this[S+le]=Q&255;--le>=0&&(se*=256);)Q<0&&Ue===0&&this[S+le+1]!==0&&(Ue=1),this[S+le]=(Q/se>>0)-Ue&255;return S+Z},a.prototype.writeInt8=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,1,127,-128),Q<0&&(Q=255+Q+1),this[S]=Q&255,S+1},a.prototype.writeInt16LE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,2,32767,-32768),this[S]=Q&255,this[S+1]=Q>>>8,S+2},a.prototype.writeInt16BE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,2,32767,-32768),this[S]=Q>>>8,this[S+1]=Q&255,S+2},a.prototype.writeInt32LE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,4,2147483647,-2147483648),this[S]=Q&255,this[S+1]=Q>>>8,this[S+2]=Q>>>16,this[S+3]=Q>>>24,S+4},a.prototype.writeInt32BE=function(Q,S,Z){return Q=+Q,S=S>>>0,Z||E(this,Q,S,4,2147483647,-2147483648),Q<0&&(Q=4294967295+Q+1),this[S]=Q>>>24,this[S+1]=Q>>>16,this[S+2]=Q>>>8,this[S+3]=Q&255,S+4},a.prototype.writeBigInt64LE=ae(function(Q,S=0){return z(this,Q,S,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=ae(function(Q,S=0){return re(this,Q,S,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function T(J,Q,S,Z,te,le){if(S+Z>J.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("Index out of range")}function ee(J,Q,S,Z,te){return Q=+Q,S=S>>>0,te||T(J,Q,S,4),t.write(J,Q,S,Z,23,4),S+4}a.prototype.writeFloatLE=function(Q,S,Z){return ee(this,Q,S,!0,Z)},a.prototype.writeFloatBE=function(Q,S,Z){return ee(this,Q,S,!1,Z)};function pe(J,Q,S,Z,te){return Q=+Q,S=S>>>0,te||T(J,Q,S,8),t.write(J,Q,S,Z,52,8),S+8}a.prototype.writeDoubleLE=function(Q,S,Z){return pe(this,Q,S,!0,Z)},a.prototype.writeDoubleBE=function(Q,S,Z){return pe(this,Q,S,!1,Z)},a.prototype.copy=function(Q,S,Z,te){if(!a.isBuffer(Q))throw new TypeError("argument should be a Buffer");if(Z||(Z=0),!te&&te!==0&&(te=this.length),S>=Q.length&&(S=Q.length),S||(S=0),te>0&&te=this.length)throw new RangeError("Index out of range");if(te<0)throw new RangeError("sourceEnd out of bounds");te>this.length&&(te=this.length),Q.length-S>>0,Z=Z===void 0?this.length:Z>>>0,Q||(Q=0);let le;if(typeof Q=="number")for(le=S;le2**32?te=$(String(S)):typeof S=="bigint"&&(te=String(S),(S>BigInt(2)**BigInt(32)||S<-(BigInt(2)**BigInt(32)))&&(te=$(te)),te+="n"),Z+=` It must be ${Q}. Received ${te}`,Z},RangeError);function $(J){let Q="",S=J.length;const Z=J[0]==="-"?1:0;for(;S>=Z+4;S-=3)Q=`_${J.slice(S-3,S)}${Q}`;return`${J.slice(0,S)}${Q}`}function ce(J,Q,S){Fe(Q,"offset"),(J[Q]===void 0||J[Q+S]===void 0)&&P(Q,J.length-(S+1))}function ge(J,Q,S,Z,te,le){if(J>S||J3?Q===0||Q===BigInt(0)?Ue=`>= 0${se} and < 2${se} ** ${(le+1)*8}${se}`:Ue=`>= -(2${se} ** ${(le+1)*8-1}${se}) and < 2 ** ${(le+1)*8-1}${se}`:Ue=`>= ${Q}${se} and <= ${S}${se}`,new de.ERR_OUT_OF_RANGE("value",Ue,J)}ce(Z,te,le)}function Fe(J,Q){if(typeof J!="number")throw new de.ERR_INVALID_ARG_TYPE(Q,"number",J)}function P(J,Q,S){throw Math.floor(J)!==J?(Fe(J,S),new de.ERR_OUT_OF_RANGE(S||"offset","an integer",J)):Q<0?new de.ERR_BUFFER_OUT_OF_BOUNDS:new de.ERR_OUT_OF_RANGE(S||"offset",`>= ${S?1:0} and <= ${Q}`,J)}const fe=/[^+/0-9A-Za-z-_]/g;function ue(J){if(J=J.split("=")[0],J=J.trim().replace(fe,""),J.length<2)return"";for(;J.length%4!==0;)J=J+"=";return J}function q(J,Q){Q=Q||1/0;let S;const Z=J.length;let te=null;const le=[];for(let se=0;se55295&&S<57344){if(!te){if(S>56319){(Q-=3)>-1&&le.push(239,191,189);continue}else if(se+1===Z){(Q-=3)>-1&&le.push(239,191,189);continue}te=S;continue}if(S<56320){(Q-=3)>-1&&le.push(239,191,189),te=S;continue}S=(te-55296<<10|S-56320)+65536}else te&&(Q-=3)>-1&&le.push(239,191,189);if(te=null,S<128){if((Q-=1)<0)break;le.push(S)}else if(S<2048){if((Q-=2)<0)break;le.push(S>>6|192,S&63|128)}else if(S<65536){if((Q-=3)<0)break;le.push(S>>12|224,S>>6&63|128,S&63|128)}else if(S<1114112){if((Q-=4)<0)break;le.push(S>>18|240,S>>12&63|128,S>>6&63|128,S&63|128)}else throw new Error("Invalid code point")}return le}function K(J){const Q=[];for(let S=0;S>8,te=S%256,le.push(te),le.push(Z);return le}function ye(J){return e.toByteArray(ue(J))}function be(J,Q,S,Z){let te;for(te=0;te=Q.length||te>=J.length);++te)Q[te+S]=J[te];return te}function W(J,Q){return J instanceof Q||J!=null&&J.constructor!=null&&J.constructor.name!=null&&J.constructor.name===Q.name}function H(J){return J!==J}const ie=function(){const J="0123456789abcdef",Q=new Array(256);for(let S=0;S<16;++S){const Z=S*16;for(let te=0;te<16;++te)Q[Z+te]=J[S]+J[te]}return Q}();function ae(J){return typeof BigInt>"u"?me:J}function me(){throw new Error("BigInt not supported")}})(C4);/*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License @@ -3233,7 +3233,7 @@ 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 VE=function(n,e){return VE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},VE(n,e)};function Vo(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");VE(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Rs(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function Hi(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(A){return function(c){return l([A,c])}}function l(A){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=A[0]&2?i.return:A[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,A[1])).done)return s;switch(i=0,s&&(A=[A[0]&2,s.value]),A[0]){case 0:case 1:s=A;break;case 4:return t.label++,{value:A[1],done:!1};case 5:t.label++,i=A[1],A=[0];continue;case 7:A=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(A[0]===6||A[0]===2)){t=0;continue}if(A[0]===3&&(!s||A[1]>s[0]&&A[1]=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},ZN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",woe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Dv=0;Dv"u"?[]:new Uint8Array(256);for(var Lv=0;Lv>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},Coe=function(n){for(var e=n.length,t=[],r=0;r>uu,Ioe=1<>uu,Eoe=x4+Foe,_oe=Eoe,Soe=32,Uoe=_oe+Soe,Qoe=65536>>YU,Roe=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>uu],t=(t<>uu)],t=(t<>YU),t=this.index[t],t+=e>>uu&Moe,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var Vv=0;VvYN?(i.push(!0),a-=YN):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(WE);if(a===Poe||a===PE){if(o===0)return r.push(o),t.push(Hc);var l=t[o-1];return Yoe.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(Hc))}if(r.push(o),a===Joe)return t.push(e==="strict"?GE:Dm);if(a===_4||a===Zoe)return t.push(Hc);if(a===Hoe)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Dm):t.push(Hc);t.push(a)}),[r,t,i]},W1=function(n,e,t,r){var i=r[t];if(Array.isArray(n)?n.indexOf(i)!==-1:n===i)for(var s=t;s<=r.length;){s++;var o=r[s];if(o===e)return!0;if(o!==TA)break}if(i===TA)for(var s=t;s>0;){s--;var a=r[s];if(Array.isArray(n)?n.indexOf(a)!==-1:n===a)for(var l=t;l<=r.length;){l++;var o=r[l];if(o===e)return!0;if(o!==TA)break}if(a!==TA)break}return!1},tk=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===TA)t--;else return r}return 0},Koe=function(n,e,t,r,i){if(t[r]===0)return Ut;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return Ut;var o=s-1,a=s+1,l=e[s],A=o>=0?e[o]:0,c=e[a];if(l===I4&&c===F4)return Ut;if(XE.indexOf(l)!==-1)return S4;if(XE.indexOf(c)!==-1||U4.indexOf(c)!==-1)return Ut;if(tk(s,e)===E4)return Gv;if(YE.get(n[s])===PE||(l===Ov||l===Wv)&&YE.get(n[a])===PE||l===XN||c===XN||l===jN||[TA,OE,vg].indexOf(l)===-1&&c===jN||[Pv,Np,Goe,md,vd].indexOf(c)!==-1||tk(s,e)===kp||W1(P1,kp,s,e)||W1([Pv,Np],GE,s,e)||W1(KN,KN,s,e))return Ut;if(l===TA)return Gv;if(l===P1||c===P1)return Ut;if(c===WE||l===WE)return Gv;if([OE,vg,GE].indexOf(c)!==-1||l===Woe||A===HE&&Xoe.indexOf(l)!==-1||l===vd&&c===HE||c===$N||Ka.indexOf(c)!==-1&&l===zi||Ka.indexOf(l)!==-1&&c===zi||l===wg&&[Dm,Ov,Wv].indexOf(c)!==-1||[Dm,Ov,Wv].indexOf(l)!==-1&&c===yg||Ka.indexOf(l)!==-1&&qN.indexOf(c)!==-1||qN.indexOf(l)!==-1&&Ka.indexOf(c)!==-1||[wg,yg].indexOf(l)!==-1&&(c===zi||[kp,vg].indexOf(c)!==-1&&e[a+1]===zi)||[kp,vg].indexOf(l)!==-1&&c===zi||l===zi&&[zi,vd,md].indexOf(c)!==-1)return Ut;if([zi,vd,md,Pv,Np].indexOf(c)!==-1)for(var u=s;u>=0;){var h=e[u];if(h===zi)return Ut;if([vd,md].indexOf(h)!==-1)u--;else break}if([wg,yg].indexOf(c)!==-1)for(var u=[Pv,Np].indexOf(l)!==-1?o:s;u>=0;){var h=e[u];if(h===zi)return Ut;if([vd,md].indexOf(h)!==-1)u--;else break}if(zE===l&&[zE,dw,ZE,JE].indexOf(c)!==-1||[dw,ZE].indexOf(l)!==-1&&[dw,hw].indexOf(c)!==-1||[hw,JE].indexOf(l)!==-1&&c===hw||ek.indexOf(l)!==-1&&[$N,yg].indexOf(c)!==-1||ek.indexOf(c)!==-1&&l===wg||Ka.indexOf(l)!==-1&&Ka.indexOf(c)!==-1||l===md&&Ka.indexOf(c)!==-1||Ka.concat(zi).indexOf(l)!==-1&&c===kp&&zoe.indexOf(n[a])===-1||Ka.concat(zi).indexOf(c)!==-1&&l===Np)return Ut;if(l===O1&&c===O1){for(var d=t[s],p=1;d>0&&(d--,e[d]===O1);)p++;if(p%2!==0)return Ut}return l===Ov&&c===Wv?Ut:Gv},$oe=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=joe(n,e.lineBreak),r=t[0],i=t[1],s=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[zi,Hc,_4].indexOf(a)!==-1?Dm:a}));var o=e.wordBreak==="keep-all"?s.map(function(a,l){return a&&n[l]>=19968&&n[l]<=40959}):void 0;return[r,i,o]},qoe=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===S4,this.start=r,this.end=i}return n.prototype.slice=function(){return Zn.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),eae=function(n,e){var t=sb(n),r=$oe(t,e),i=r[0],s=r[1],o=r[2],a=t.length,l=0,A=0;return{next:function(){if(A>=a)return{done:!0,value:null};for(var c=Ut;A=Q4&&n<=57},Tae=function(n){return n>=55296&&n<=57343},yd=function(n){return Yr(n)||n>=T4&&n<=k4||n>=R4&&n<=Sae},Nae=function(n){return n>=R4&&n<=Qae},kae=function(n){return n>=T4&&n<=Mae},Dae=function(n){return Nae(n)||kae(n)},Lae=function(n){return n>=yae},Yv=function(n){return n===MB||n===rae||n===iae},TB=function(n){return Dae(n)||Lae(n)||n===lae},ok=function(n){return TB(n)||Yr(n)||n===Ei},Vae=function(n){return n>=bae&&n<=xae||n===Iae||n>=Fae&&n<=Eae||n===_ae},wA=function(n,e){return n!==Yg?!1:e!==MB},Xv=function(n,e,t){return n===Ei?TB(e)||wA(e,t):TB(n)?!0:!!(n===Yg&&wA(n,e))},Z1=function(n,e,t){return n===qc||n===Ei?Yr(e)?!0:e===Lm&&Yr(t):Yr(n===Lm?e:n)},Pae=function(n){var e=0,t=1;(n[e]===qc||n[e]===Ei)&&(n[e]===Ei&&(t=-1),e++);for(var r=[];Yr(n[e]);)r.push(n[e++]);var i=r.length?parseInt(Zn.apply(void 0,r),10):0;n[e]===Lm&&e++;for(var s=[];Yr(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(Zn.apply(void 0,s),10):0;(n[e]===N4||n[e]===M4)&&e++;var l=1;(n[e]===qc||n[e]===Ei)&&(n[e]===Ei&&(l=-1),e++);for(var A=[];Yr(n[e]);)A.push(n[e++]);var c=A.length?parseInt(Zn.apply(void 0,A),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*c)},Oae={type:2},Wae={type:3},Gae={type:4},Zae={type:13},Jae={type:8},Hae={type:21},zae={type:9},Yae={type:10},Xae={type:11},jae={type:12},Kae={type:14},jv={type:23},$ae={type:1},qae={type:25},ele={type:24},tle={type:26},nle={type:27},rle={type:28},ile={type:29},sle={type:31},jE={type:32},D4=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(sb(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==jE;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Zv:return this.consumeStringToken(Zv);case sae:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(ok(t)||wA(r,i)){var s=Xv(t,r,i)?nae:tae,o=this.consumeName();return{type:5,value:o,flags:s}}break;case oae:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),Zae;break;case Jv:return this.consumeStringToken(Jv);case Hv:return Oae;case Lp:return Wae;case G1:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),Kae;break;case qc:if(Z1(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case wae:return Gae;case Ei:var a=e,l=this.peekCodePoint(0),A=this.peekCodePoint(1);if(Z1(a,l,A))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Xv(a,l,A))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Ei&&A===uae)return this.consumeCodePoint(),this.consumeCodePoint(),ele;break;case Lm:if(Z1(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case rk:if(this.peekCodePoint(0)===G1)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===G1&&(c=this.consumeCodePoint(),c===rk))return this.consumeToken();if(c===Ho)return this.consumeToken()}break;case Bae:return tle;case Cae:return nle;case cae:if(this.peekCodePoint(0)===Aae&&this.peekCodePoint(1)===Ei&&this.peekCodePoint(2)===Ei)return this.consumeCodePoint(),this.consumeCodePoint(),qae;break;case dae:var u=this.peekCodePoint(0),h=this.peekCodePoint(1),d=this.peekCodePoint(2);if(Xv(u,h,d)){var o=this.consumeName();return{type:7,value:o}}break;case hae:return rle;case Yg:if(wA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case fae:return ile;case pae:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),Jae;break;case gae:return Xae;case mae:return jae;case Uae:case Rae:var p=this.peekCodePoint(0),f=this.peekCodePoint(1);return p===qc&&(yd(f)||f===zv)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case ik:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),zae;if(this.peekCodePoint(0)===ik)return this.consumeCodePoint(),Hae;break;case vae:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),Yae;break;case Ho:return jE}return Yv(e)?(this.consumeWhiteSpace(),sle):Yr(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):TB(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Zn(e)}},n.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},n.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},n.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},n.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();yd(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===zv&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(Zn.apply(void 0,e.map(function(l){return l===zv?Q4:l})),16),s=parseInt(Zn.apply(void 0,e.map(function(l){return l===zv?k4:l})),16);return{type:30,start:i,end:s}}var o=parseInt(Zn.apply(void 0,e),16);if(this.peekCodePoint(0)===Ei&&yd(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];yd(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(Zn.apply(void 0,a),16);return{type:30,start:o,end:s}}else return{type:30,start:o,end:o}},n.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===Hv?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Hv?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ho)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===Jv||t===Zv){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ho||this.peekCodePoint(0)===Lp)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),jv)}for(;;){var i=this.consumeCodePoint();if(i===Ho||i===Lp)return{type:22,value:Zn.apply(void 0,e)};if(Yv(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Ho||this.peekCodePoint(0)===Lp?(this.consumeCodePoint(),{type:22,value:Zn.apply(void 0,e)}):(this.consumeBadUrlRemnants(),jv);if(i===Zv||i===Jv||i===Hv||Vae(i))return this.consumeBadUrlRemnants(),jv;if(i===Yg)if(wA(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),jv;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;Yv(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Lp||e===Ho)return;wA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},n.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var i=Math.min(t,e);r+=Zn.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),r},n.prototype.consumeStringToken=function(e){var t="",r=0;do{var i=this._value[r];if(i===Ho||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===MB)return this._value.splice(0,r),$ae;if(i===Yg){var s=this._value[r+1];s!==Ho&&s!==void 0&&(s===MB?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):wA(i,s)&&(t+=this.consumeStringSlice(r),t+=Zn(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=w0,r=this.peekCodePoint(0);for((r===qc||r===Ei)&&e.push(this.consumeCodePoint());Yr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===Lm&&Yr(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=nk;Yr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===N4||r===M4)&&((i===qc||i===Ei)&&Yr(s)||Yr(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=nk;Yr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Pae(e),t]},n.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],i=this.peekCodePoint(0),s=this.peekCodePoint(1),o=this.peekCodePoint(2);if(Xv(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===aae?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(yd(e)){for(var t=Zn(e);yd(this.peekCodePoint(0))&&t.length<6;)t+=Zn(this.consumeCodePoint());Yv(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||Tae(r)||r>1114111?sk:r}return e===Ho?sk:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(ok(t))e+=Zn(t);else if(wA(t,this.peekCodePoint(0)))e+=Zn(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),L4=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new D4;return t.write(e),new n(t.read())},n.parseValue=function(e){return n.create(e).parseComponentValue()},n.parseValues=function(e){return n.create(e).parseComponentValues()},n.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},n.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},n.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},n.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||ole(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},n.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},n.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?jE:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),B0=function(n){return n.type===15},ob=function(n){return n.type===17},On=function(n){return n.type===20},KE=function(n,e){return On(n)&&n.value===e},ab=function(n){return n.type!==31&&n.type!==4},Va=function(n){var e=[],t=[];return n.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},ole=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},Ac=function(n){return n.type===17||n.type===15},rr=function(n){return n.type===16||Ac(n)},V4=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},Dr={type:17,number:0,flags:w0},XU={type:16,number:50,flags:w0},NA={type:16,number:100,flags:w0},Bg=function(n,e,t){var r=n[0],i=n[1];return[dn(r,e),dn(typeof i<"u"?i:r,t)]},dn=function(n,e){if(n.type===16)return n.number/100*e;if(B0(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},P4="deg",O4="grad",W4="rad",G4="turn",lb={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case P4:return Math.PI*e.number/180;case O4:return Math.PI/200*e.number;case W4:return e.number;case G4:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Z4=function(n){return n.type===15&&(n.unit===P4||n.unit===O4||n.unit===W4||n.unit===G4)},J4=function(n){var e=n.filter(On).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Dr,Dr];case"to top":case"bottom":return zs(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Dr,NA];case"to right":case"left":return zs(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[NA,NA];case"to bottom":case"top":return zs(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[NA,Dr];case"to left":case"right":return zs(270)}return 0},zs=function(n){return Math.PI*n/180},KA={name:"color",parse:function(n,e){if(e.type===18){var t=ale[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(n,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3);return kA(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3),o=e.value.substring(3,4);return kA(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),parseInt(o+o,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6);return kA(parseInt(r,16),parseInt(i,16),parseInt(s,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6),o=e.value.substring(6,8);return kA(parseInt(r,16),parseInt(i,16),parseInt(s,16),parseInt(o,16)/255)}}if(e.type===20){var a=Vm[e.value.toUpperCase()];if(typeof a<"u")return a}return Vm.TRANSPARENT}},Hh=function(n){return(255&n)===0},Br=function(n){var e=255&n,t=255&n>>8,r=255&n>>16,i=255&n>>24;return e<255?"rgba("+i+","+r+","+t+","+e/255+")":"rgb("+i+","+r+","+t+")"},kA=function(n,e,t,r){return(n<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},ak=function(n,e){if(n.type===17)return n.number;if(n.type===16){var t=e===3?1:255;return e===3?n.number/100*t:Math.round(n.number/100*t)}return 0},lk=function(n,e){var t=e.filter(ab);if(t.length===3){var r=t.map(ak),i=r[0],s=r[1],o=r[2];return kA(i,s,o,1)}if(t.length===4){var a=t.map(ak),i=a[0],s=a[1],o=a[2],l=a[3];return kA(i,s,o,l)}return 0};function J1(n,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-n)*t*6+n:t<1/2?e:t<2/3?(e-n)*6*(2/3-t)+n:n}var Ak=function(n,e){var t=e.filter(ab),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?zs(r.number):lb.parse(n,r))/(Math.PI*2),l=rr(i)?i.number/100:0,A=rr(s)?s.number/100:0,c=typeof o<"u"&&rr(o)?dn(o,1):1;if(l===0)return kA(A*255,A*255,A*255,1);var u=A<=.5?A*(l+1):A+l-A*l,h=A*2-u,d=J1(h,u,a+1/3),p=J1(h,u,a),f=J1(h,u,a-1/3);return kA(d*255,p*255,f*255,c)},ale={hsl:Ak,hsla:Ak,rgb:lk,rgba:lk},ck=function(n,e){return KA.parse(n,L4.create(e).parseComponentValue())},Vm={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},lle={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(On(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ale={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Ab=function(n,e){var t=KA.parse(n,e[0]),r=e[1];return r&&rr(r)?{color:t,stop:r}:{color:t,stop:null}},uk=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=Dr),r.stop===null&&(r.stop=NA);for(var i=[],s=0,o=0;os?i.push(l):i.push(s),s=l}else i.push(null)}for(var A=null,o=0;oo.optimumDistance)?{optimumCorner:a,optimumDistance:c}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},dle=function(n,e,t,r,i){var s=0,o=0;switch(n.size){case 0:n.shape===0?s=o=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.min(Math.abs(e),Math.abs(e-r)),o=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(n.shape===0)s=o=Math.min(Co(e,t),Co(e,t-i),Co(e-r,t),Co(e-r,t-i));else if(n.shape===1){var a=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-r)),l=dk(r,i,e,t,!0),A=l[0],c=l[1];s=Co(A-e,(c-t)/a),o=a*s}break;case 1:n.shape===0?s=o=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.max(Math.abs(e),Math.abs(e-r)),o=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(n.shape===0)s=o=Math.max(Co(e,t),Co(e,t-i),Co(e-r,t),Co(e-r,t-i));else if(n.shape===1){var a=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-r)),u=dk(r,i,e,t,!1),A=u[0],c=u[1];s=Co(A-e,(c-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=dn(n.size[0],r),o=n.size.length===2?dn(n.size[1],i):s),[s,o]},hle=function(n,e){var t=zs(180),r=[];return Va(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=J4(i);return}else if(Z4(o)){t=lb.parse(n,o);return}}var a=Ab(n,i);r.push(a)}),{angle:t,stops:r,type:1}},Kv=function(n,e){var t=zs(180),r=[];return Va(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&["top","left","right","bottom"].indexOf(o.value)!==-1){t=J4(i);return}else if(Z4(o)){t=(lb.parse(n,o)+zs(270))%zs(360);return}}var a=Ab(n,i);r.push(a)}),{angle:t,stops:r,type:1}},fle=function(n,e){var t=zs(180),r=[],i=1,s=0,o=3,a=[];return Va(e).forEach(function(l,A){var c=l[0];if(A===0){if(On(c)&&c.value==="linear"){i=1;return}else if(On(c)&&c.value==="radial"){i=2;return}}if(c.type===18){if(c.name==="from"){var u=KA.parse(n,c.values[0]);r.push({stop:Dr,color:u})}else if(c.name==="to"){var u=KA.parse(n,c.values[0]);r.push({stop:NA,color:u})}else if(c.name==="color-stop"){var h=c.values.filter(ab);if(h.length===2){var u=KA.parse(n,h[1]),d=h[0];ob(d)&&r.push({stop:{type:16,number:d.number*100,flags:d.flags},color:u})}}}}),i===1?{angle:(t+zs(180))%zs(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},H4="closest-side",z4="farthest-side",Y4="closest-corner",X4="farthest-corner",j4="circle",K4="ellipse",$4="cover",q4="contain",ple=function(n,e){var t=0,r=3,i=[],s=[];return Va(e).forEach(function(o,a){var l=!0;if(a===0){var A=!1;l=o.reduce(function(u,h){if(A)if(On(h))switch(h.value){case"center":return s.push(XU),u;case"top":case"left":return s.push(Dr),u;case"right":case"bottom":return s.push(NA),u}else(rr(h)||Ac(h))&&s.push(h);else if(On(h))switch(h.value){case j4:return t=0,!1;case K4:return t=1,!1;case"at":return A=!0,!1;case H4:return r=0,!1;case $4:case z4:return r=1,!1;case q4:case Y4:return r=2,!1;case X4:return r=3,!1}else if(Ac(h)||rr(h))return Array.isArray(r)||(r=[]),r.push(h),!1;return u},l)}if(l){var c=Ab(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},$v=function(n,e){var t=0,r=3,i=[],s=[];return Va(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(c,u){if(On(u))switch(u.value){case"center":return s.push(XU),!1;case"top":case"left":return s.push(Dr),!1;case"right":case"bottom":return s.push(NA),!1}else if(rr(u)||Ac(u))return s.push(u),!1;return c},l):a===1&&(l=o.reduce(function(c,u){if(On(u))switch(u.value){case j4:return t=0,!1;case K4:return t=1,!1;case q4:case H4:return r=0,!1;case z4:return r=1,!1;case Y4:return r=2,!1;case $4:case X4:return r=3,!1}else if(Ac(u)||rr(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return c},l)),l){var A=Ab(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},gle=function(n){return n.type===1},mle=function(n){return n.type===2},jU={name:"image",parse:function(n,e){if(e.type===22){var t={url:e.value,type:0};return n.cache.addImage(e.value),t}if(e.type===18){var r=eJ[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(n,e.values)}throw new Error("Unsupported image type "+e.type)}};function vle(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!eJ[n.name])}var eJ={"linear-gradient":hle,"-moz-linear-gradient":Kv,"-ms-linear-gradient":Kv,"-o-linear-gradient":Kv,"-webkit-linear-gradient":Kv,"radial-gradient":ple,"-moz-radial-gradient":$v,"-ms-radial-gradient":$v,"-o-radial-gradient":$v,"-webkit-radial-gradient":$v,"-webkit-gradient":fle},yle={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return ab(r)&&vle(r)}).map(function(r){return jU.parse(n,r)})}},wle={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(On(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ble={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return Va(e).map(function(t){return t.filter(rr)}).map(V4)}},Cle={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return Va(e).map(function(t){return t.filter(On).map(function(r){return r.value}).join(" ")}).map(ble)}},ble=function(n){switch(n){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},zh;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(zh||(zh={}));var xle={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return Va(e).map(function(t){return t.filter(Ile)})}},Ile=function(n){return On(n)||rr(n)},cb=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Fle=cb("top"),Ele=cb("right"),_le=cb("bottom"),Sle=cb("left"),ub=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return V4(t.filter(rr))}}},Ule=ub("top-left"),Qle=ub("top-right"),Rle=ub("bottom-right"),Mle=ub("bottom-left"),db=function(n){return{name:"border-"+n+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Tle=db("top"),Nle=db("right"),kle=db("bottom"),Dle=db("left"),hb=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return B0(t)?t.number:0}}},Lle=hb("top"),Vle=hb("right"),Ple=hb("bottom"),Ole=hb("left"),Wle={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Gle={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},Zle={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(On).reduce(function(t,r){return t|Jle(r.value)},0)}},Jle=function(n){switch(n){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Hle={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},zle={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(n,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},NB;(function(n){n.NORMAL="normal",n.STRICT="strict"})(NB||(NB={}));var Yle={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return NB.STRICT;case"normal":default:return NB.NORMAL}}},Xle={name:"line-height",initialValue:"normal",prefix:!1,type:4},hk=function(n,e){return On(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:rr(n)?dn(n,e):e},jle={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:jU.parse(n,e)}},Kle={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(n,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},$le={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},fb=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},qle=fb("top"),eAe=fb("right"),tAe=fb("bottom"),nAe=fb("left"),rAe={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(On).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},iAe={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},pb=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},sAe=pb("top"),oAe=pb("right"),aAe=pb("bottom"),lAe=pb("left"),AAe={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(n,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},cAe={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(n,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},uAe={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&KE(e[0],"none")?[]:Va(e).map(function(t){for(var r={color:Vm.TRANSPARENT,offsetX:Dr,offsetY:Dr,blur:Dr},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},fAe=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},pAe=function(n){var e=n.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],r=e[1];e[2],e[3];var i=e[4],s=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var o=e[12],a=e[13];return e[14],e[15],e.length===16?[t,r,i,s,o,a]:null},gAe={matrix:fAe,matrix3d:pAe},fk={type:16,number:50,flags:w0},mAe=[fk,fk],vAe={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(rr);return t.length!==2?mAe:[t[0],t[1]]}},yAe={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},Xg;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(Xg||(Xg={}));var wAe={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return Xg.BREAK_ALL;case"keep-all":return Xg.KEEP_ALL;case"normal":default:return Xg.NORMAL}}},BAe={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(ob(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},tJ={name:"time",parse:function(n,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},CAe={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return ob(e)?e.number:1}},bAe={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},xAe={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(On).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},IAe={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(n,e){var t=[],r=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},FAe={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},EAe={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(ob(e))return e.number;if(On(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},_Ae={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(On).map(function(t){return t.value})}},SAe={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},gr=function(n,e){return(n&e)!==0},UAe={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(B0).map(function(t){return tJ.parse(n,t)})}},QAe={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&KE(e[0],"none")?[]:Va(e).map(function(t){for(var r={color:255,offsetX:Dr,offsetY:Dr,blur:Dr,spread:Dr,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=Ke(e,iAe,t.overflowWrap),this.paddingTop=Ke(e,sAe,t.paddingTop),this.paddingRight=Ke(e,oAe,t.paddingRight),this.paddingBottom=Ke(e,aAe,t.paddingBottom),this.paddingLeft=Ke(e,lAe,t.paddingLeft),this.paintOrder=Ke(e,RAe,t.paintOrder),this.position=Ke(e,cAe,t.position),this.textAlign=Ke(e,AAe,t.textAlign),this.textDecorationColor=Ke(e,bAe,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=Ke(e,xAe,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=Ke(e,uAe,t.textShadow),this.textTransform=Ke(e,dAe,t.textTransform),this.transform=Ke(e,hAe,t.transform),this.transformOrigin=Ke(e,vAe,t.transformOrigin),this.visibility=Ke(e,yAe,t.visibility),this.webkitTextStrokeColor=Ke(e,MAe,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Ke(e,TAe,t.webkitTextStrokeWidth),this.wordBreak=Ke(e,wAe,t.wordBreak),this.zIndex=Ke(e,BAe,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return Hh(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return gr(this.display,4)||gr(this.display,33554432)||gr(this.display,268435456)||gr(this.display,536870912)||gr(this.display,67108864)||gr(this.display,134217728)},n}(),Ke=function(n,e,t){var r=new D4,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new L4(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,On(o)?o.value:e.initialValue);case 0:return e.parse(n,s.parseComponentValue());case 1:return e.parse(n,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(e.format){case"angle":return lb.parse(n,s.parseComponentValue());case"color":return KA.parse(n,s.parseComponentValue());case"image":return jU.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return Ac(a)?a:Dr;case"length-percentage":var l=s.parseComponentValue();return rr(l)?l:Dr;case"time":return tJ.parse(n,s.parseComponentValue())}break}},kAe="data-html2canvas-debug",DAe=function(n){var e=n.getAttribute(kAe);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},pk=function(n,e){var t=DAe(n);return t===1||e===t},Pa=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,pk(t,3))debugger;this.styles=new NAe(e,window.getComputedStyle(t,null)),Dce(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=zU(this.context,t),pk(t,4)&&(this.flags|=16)}return n}(),LAe="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",gk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var qv=0;qv>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},PAe=function(n){for(var e=n.length,t=[],r=0;r>du,GAe=1<>du,JAe=nJ+ZAe,HAe=JAe,zAe=32,YAe=HAe+zAe,XAe=65536>>KU,jAe=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>du],t=(t<>du)],t=(t<>KU),t=this.index[t],t+=e>>du&KAe,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var ey=0;ey=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},oce=qAe(LAe),Ds="×",q1="÷",ace=function(n){return oce.get(n)},lce=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===Y1&&o===X1)return Ds;if(s===Y1||s===X1||s===yk||o===Y1||o===X1||o===yk)return q1;if(s===Bk&&[Bk,j1,Ck,bk].indexOf(o)!==-1||(s===Ck||s===j1)&&(o===j1||o===K1)||(s===bk||s===K1)&&o===K1||o===xk||o===wk||o===rce||s===nce)return Ds;if(s===xk&&o===Ik){for(;i===wk;)i=e[--r];if(i===Ik)return Ds}if(s===$1&&o===$1){for(var a=0;i===$1;)a++,i=e[--r];if(a%2===0)return Ds}return q1},Ace=function(n){var e=ice(n),t=e.length,r=0,i=0,s=e.map(ace);return{next:function(){if(r>=t)return{done:!0,value:null};for(var o=Ds;ro.x||c.y>o.y;return o=c,A===0?!0:u});return n.body.removeChild(e),a},hce=function(){return typeof new Image().crossOrigin<"u"},fce=function(){return typeof new XMLHttpRequest().responseType=="string"},pce=function(n){var e=new Image,t=n.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},Fk=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},gce=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var i=new Image,s=e.toDataURL();i.src=s;var o=$E(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),Ek(o).then(function(a){r.drawImage(a,0,0);var l=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var A=n.createElement("div");return A.style.backgroundImage="url("+s+")",A.style.height=t+"px",Fk(l)?Ek($E(t,t,0,0,A)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),Fk(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},$E=function(n,e,t,r,i){var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return o.setAttributeNS(null,"width",n.toString()),o.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(a),a.appendChild(i),o},Ek=function(n){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(n))})},Ki={get SUPPORT_RANGE_BOUNDS(){var n=uce(document);return Object.defineProperty(Ki,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=Ki.SUPPORT_RANGE_BOUNDS&&dce(document);return Object.defineProperty(Ki,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=pce(document);return Object.defineProperty(Ki,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?gce(document):Promise.resolve(!1);return Object.defineProperty(Ki,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=hce();return Object.defineProperty(Ki,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=fce();return Object.defineProperty(Ki,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ki,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ki,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},jg=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),mce=function(n,e,t,r){var i=wce(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(Ki.SUPPORT_RANGE_BOUNDS){var l=_k(r,o,a.length).getClientRects();if(l.length>1){var A=$U(a),c=0;A.forEach(function(h){s.push(new jg(h,Iu.fromDOMRectList(n,_k(r,c+o,h.length).getClientRects()))),c+=h.length})}else s.push(new jg(a,Iu.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new jg(a,vce(n,r))),r=u}else Ki.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},vce=function(n,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var s=zU(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Iu.EMPTY},_k=function(n,e,t){var r=n.ownerDocument;if(!r)throw new Error("Node has no owner document");var i=r.createRange();return i.setStart(n,e),i.setEnd(n,e+t),i},$U=function(n){if(Ki.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(n)).map(function(t){return t.segment})}return cce(n)},yce=function(n,e){if(Ki.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(n)).map(function(r){return r.segment})}return Cce(n,e)},wce=function(n,e){return e.letterSpacing!==0?$U(n):yce(n,e)},Bce=[32,160,4961,65792,65793,4153,4241],Cce=function(n,e){for(var t=eae(n,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],i,s=function(){if(i.value){var o=i.value.slice(),a=sb(o),l="";a.forEach(function(A){Bce.indexOf(A)===-1?l+=Zn(A):(l.length&&r.push(l),r.push(Zn(A)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},bce=function(){function n(e,t,r){this.text=xce(t.data,r.textTransform),this.textBounds=mce(e,this.text,r,t)}return n}(),xce=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(Ice,Fce);case 2:return n.toUpperCase();default:return n}},Ice=/(^|\s|:|-|\(|\))([a-z])/g,Fce=function(n,e,t){return n.length>0?e+t.toUpperCase():n},rJ=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.src=r.currentSrc||r.src,i.intrinsicWidth=r.naturalWidth,i.intrinsicHeight=r.naturalHeight,i.context.cache.addImage(i.src),i}return e}(Pa),iJ=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.canvas=r,i.intrinsicWidth=r.width,i.intrinsicHeight=r.height,i}return e}(Pa),sJ=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=zU(t,r);return r.setAttribute("width",o.width+"px"),r.setAttribute("height",o.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(r)),i.intrinsicWidth=r.width.baseVal.value,i.intrinsicHeight=r.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(Pa),oJ=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.value=r.value,i}return e}(Pa),qE=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.start=r.start,i.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,i}return e}(Pa),Ece=[{type:15,flags:0,unit:"px",number:3}],_ce=[{type:16,flags:0,number:50}],Sce=function(n){return n.width>n.height?new Iu(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new bce(n,i,t.styles));else if(uJ(i))if(Hce(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return fw(n,a,t,r)});else{var o=cJ(n,i);o.styles.isVisible()&&(Tce(i,o,r)?o.flags|=4:Nce(o.styles)&&(o.flags|=2),Rce.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?fw(n,i.shadowRoot,o,r):!hJ(i)&&!dJ(i)&&!fJ(i)&&fw(n,i,o,r))}},cJ=function(n,e){return Zce(e)?new rJ(n,e):Gce(e)?new iJ(n,e):dJ(e)?new sJ(n,e):Vce(e)?new oJ(n,e):Pce(e)?new qE(n,e):Oce(e)?new qU(n,e):fJ(e)?new aJ(n,e):hJ(e)?new lJ(n,e):Jce(e)?new AJ(n,e):new Pa(n,e)},Mce=function(n,e){var t=cJ(n,e);return t.flags|=4,fw(n,e,t,t),t},Tce=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Wce(n)&&t.styles.isTransparent()},Nce=function(n){return n.isPositioned()||n.isFloating()},kce=function(n){return n.nodeType===Node.TEXT_NODE},uJ=function(n){return n.nodeType===Node.ELEMENT_NODE},Dce=function(n){return uJ(n)&&typeof n.style<"u"&&!Lce(n)},Lce=function(n){return typeof n.className=="object"},Vce=function(n){return n.tagName==="LI"},Pce=function(n){return n.tagName==="OL"},Oce=function(n){return n.tagName==="INPUT"},dJ=function(n){return n.tagName==="svg"},Wce=function(n){return n.tagName==="BODY"},Gce=function(n){return n.tagName==="CANVAS"},Zce=function(n){return n.tagName==="IMG"},Jce=function(n){return n.tagName==="IFRAME"},hJ=function(n){return n.tagName==="TEXTAREA"},fJ=function(n){return n.tagName==="SELECT"},Hce=function(n){return n.tagName==="SLOT"},Uk={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Qk={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},zce={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Yce={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},wd=function(n,e,t,r,i,s){return nt?eQ(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},pJ=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},Wn=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+(pJ(Math.abs(n),s,r,function(o){return Zn(Math.floor(o%s)+e)})+i)},Uc=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return pJ(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},Vd=1,gA=2,mA=4,bg=8,$a=function(n,e,t,r,i,s){if(n<-9999||n>9999)return eQ(n,4,i.length>0);var o=Math.abs(n),a=i;if(o===0)return e[0]+a;for(var l=0;o>0&&l<=4;l++){var A=o%10;A===0&&gr(s,Vd)&&a!==""?a=e[A]+a:A>1||A===1&&l===0||A===1&&l===1&&gr(s,gA)||A===1&&l===1&&gr(s,mA)&&n>100||A===1&&l>1&&gr(s,bg)?a=e[A]+(l>0?t[l-1]:"")+a:A===1&&l>0&&(a=t[l-1]+a),o=Math.floor(o/10)}return(n<0?r:"")+a},Rk="十百千萬",Mk="拾佰仟萬",Tk="マイナス",eI="마이너스",eQ=function(n,e,t){var r=t?". ":"",i=t?"、":"",s=t?", ":"",o=t?" ":"";switch(e){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=Wn(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return Uc(n,"〇一二三四五六七八九",i);case 6:return wd(n,1,3999,Uk,3,r).toLowerCase();case 7:return wd(n,1,3999,Uk,3,r);case 8:return Wn(n,945,969,!1,r);case 9:return Wn(n,97,122,!1,r);case 10:return Wn(n,65,90,!1,r);case 11:return Wn(n,1632,1641,!0,r);case 12:case 49:return wd(n,1,9999,Qk,3,r);case 35:return wd(n,1,9999,Qk,3,r).toLowerCase();case 13:return Wn(n,2534,2543,!0,r);case 14:case 30:return Wn(n,6112,6121,!0,r);case 15:return Uc(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return Uc(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return $a(n,"零一二三四五六七八九",Rk,"負",i,gA|mA|bg);case 47:return $a(n,"零壹貳參肆伍陸柒捌玖",Mk,"負",i,Vd|gA|mA|bg);case 42:return $a(n,"零一二三四五六七八九",Rk,"负",i,gA|mA|bg);case 41:return $a(n,"零壹贰叁肆伍陆柒捌玖",Mk,"负",i,Vd|gA|mA|bg);case 26:return $a(n,"〇一二三四五六七八九","十百千万",Tk,i,0);case 25:return $a(n,"零壱弐参四伍六七八九","拾百千万",Tk,i,Vd|gA|mA);case 31:return $a(n,"영일이삼사오육칠팔구","십백천만",eI,s,Vd|gA|mA);case 33:return $a(n,"零一二三四五六七八九","十百千萬",eI,s,0);case 32:return $a(n,"零壹貳參四五六七八九","拾百千",eI,s,Vd|gA|mA);case 18:return Wn(n,2406,2415,!0,r);case 20:return wd(n,1,19999,Yce,3,r);case 21:return Wn(n,2790,2799,!0,r);case 22:return Wn(n,2662,2671,!0,r);case 22:return wd(n,1,10999,zce,3,r);case 23:return Uc(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Uc(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Wn(n,3302,3311,!0,r);case 28:return Uc(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return Uc(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return Wn(n,3792,3801,!0,r);case 37:return Wn(n,6160,6169,!0,r);case 38:return Wn(n,4160,4169,!0,r);case 39:return Wn(n,2918,2927,!0,r);case 40:return Wn(n,1776,1785,!0,r);case 43:return Wn(n,3046,3055,!0,r);case 44:return Wn(n,3174,3183,!0,r);case 45:return Wn(n,3664,3673,!0,r);case 46:return Wn(n,3872,3881,!0,r);case 3:default:return Wn(n,48,57,!0,r)}},Nk;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(Nk||(Nk={}));var Xce=function(){function n(){}return n.getOrigin=function(e){var t=n._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},n.isSameOrigin=function(e){return n.getOrigin(e)===n._origin},n.setContext=function(e){n._link=e.document.createElement("a"),n._origin=n.getOrigin(e.location.href)},n._origin="about:blank",n}(),ze=function(){function n(e,t){this.type=0,this.x=e,this.y=t}return n.prototype.add=function(e,t){return new n(this.x+e,this.y+t)},n}(),Bd=function(n,e,t){return new ze(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},ty=function(){function n(e,t,r,i){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=i}return n.prototype.subdivide=function(e,t){var r=Bd(this.start,this.startControl,e),i=Bd(this.startControl,this.endControl,e),s=Bd(this.endControl,this.end,e),o=Bd(r,i,e),a=Bd(i,s,e),l=Bd(o,a,e);return t?new n(this.start,r,o,l):new n(l,a,s,this.end)},n.prototype.add=function(e,t){return new n(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},n.prototype.reverse=function(){return new n(this.end,this.endControl,this.startControl,this.start)},n}(),Os=function(n){return n.type===1},jce=function(){function n(e){var t=e.styles,r=e.bounds,i=Bg(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Bg(t.borderTopRightRadius,r.width,r.height),l=a[0],A=a[1],c=Bg(t.borderBottomRightRadius,r.width,r.height),u=c[0],h=c[1],d=Bg(t.borderBottomLeftRadius,r.width,r.height),p=d[0],f=d[1],g=[];g.push((s+l)/r.width),g.push((p+u)/r.width),g.push((o+f)/r.height),g.push((A+h)/r.height);var m=Math.max.apply(Math,g);m>1&&(s/=m,o/=m,l/=m,A/=m,u/=m,h/=m,p/=m,f/=m);var v=r.width-l,w=r.height-h,B=r.width-u,C=r.height-f,b=t.borderTopWidth,F=t.borderRightWidth,x=t.borderBottomWidth,_=t.borderLeftWidth,M=dn(t.paddingTop,e.bounds.width),Y=dn(t.paddingRight,e.bounds.width),O=dn(t.paddingBottom,e.bounds.width),U=dn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?wn(r.left+_/3,r.top+b/3,s-_/3,o-b/3,Xt.TOP_LEFT):new ze(r.left+_/3,r.top+b/3),this.topRightBorderDoubleOuterBox=s>0||o>0?wn(r.left+v,r.top+b/3,l-F/3,A-b/3,Xt.TOP_RIGHT):new ze(r.left+r.width-F/3,r.top+b/3),this.bottomRightBorderDoubleOuterBox=u>0||h>0?wn(r.left+B,r.top+w,u-F/3,h-x/3,Xt.BOTTOM_RIGHT):new ze(r.left+r.width-F/3,r.top+r.height-x/3),this.bottomLeftBorderDoubleOuterBox=p>0||f>0?wn(r.left+_/3,r.top+C,p-_/3,f-x/3,Xt.BOTTOM_LEFT):new ze(r.left+_/3,r.top+r.height-x/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?wn(r.left+_*2/3,r.top+b*2/3,s-_*2/3,o-b*2/3,Xt.TOP_LEFT):new ze(r.left+_*2/3,r.top+b*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?wn(r.left+v,r.top+b*2/3,l-F*2/3,A-b*2/3,Xt.TOP_RIGHT):new ze(r.left+r.width-F*2/3,r.top+b*2/3),this.bottomRightBorderDoubleInnerBox=u>0||h>0?wn(r.left+B,r.top+w,u-F*2/3,h-x*2/3,Xt.BOTTOM_RIGHT):new ze(r.left+r.width-F*2/3,r.top+r.height-x*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||f>0?wn(r.left+_*2/3,r.top+C,p-_*2/3,f-x*2/3,Xt.BOTTOM_LEFT):new ze(r.left+_*2/3,r.top+r.height-x*2/3),this.topLeftBorderStroke=s>0||o>0?wn(r.left+_/2,r.top+b/2,s-_/2,o-b/2,Xt.TOP_LEFT):new ze(r.left+_/2,r.top+b/2),this.topRightBorderStroke=s>0||o>0?wn(r.left+v,r.top+b/2,l-F/2,A-b/2,Xt.TOP_RIGHT):new ze(r.left+r.width-F/2,r.top+b/2),this.bottomRightBorderStroke=u>0||h>0?wn(r.left+B,r.top+w,u-F/2,h-x/2,Xt.BOTTOM_RIGHT):new ze(r.left+r.width-F/2,r.top+r.height-x/2),this.bottomLeftBorderStroke=p>0||f>0?wn(r.left+_/2,r.top+C,p-_/2,f-x/2,Xt.BOTTOM_LEFT):new ze(r.left+_/2,r.top+r.height-x/2),this.topLeftBorderBox=s>0||o>0?wn(r.left,r.top,s,o,Xt.TOP_LEFT):new ze(r.left,r.top),this.topRightBorderBox=l>0||A>0?wn(r.left+v,r.top,l,A,Xt.TOP_RIGHT):new ze(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||h>0?wn(r.left+B,r.top+w,u,h,Xt.BOTTOM_RIGHT):new ze(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||f>0?wn(r.left,r.top+C,p,f,Xt.BOTTOM_LEFT):new ze(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?wn(r.left+_,r.top+b,Math.max(0,s-_),Math.max(0,o-b),Xt.TOP_LEFT):new ze(r.left+_,r.top+b),this.topRightPaddingBox=l>0||A>0?wn(r.left+Math.min(v,r.width-F),r.top+b,v>r.width+F?0:Math.max(0,l-F),Math.max(0,A-b),Xt.TOP_RIGHT):new ze(r.left+r.width-F,r.top+b),this.bottomRightPaddingBox=u>0||h>0?wn(r.left+Math.min(B,r.width-_),r.top+Math.min(w,r.height-x),Math.max(0,u-F),Math.max(0,h-x),Xt.BOTTOM_RIGHT):new ze(r.left+r.width-F,r.top+r.height-x),this.bottomLeftPaddingBox=p>0||f>0?wn(r.left+_,r.top+Math.min(C,r.height-x),Math.max(0,p-_),Math.max(0,f-x),Xt.BOTTOM_LEFT):new ze(r.left+_,r.top+r.height-x),this.topLeftContentBox=s>0||o>0?wn(r.left+_+U,r.top+b+M,Math.max(0,s-(_+U)),Math.max(0,o-(b+M)),Xt.TOP_LEFT):new ze(r.left+_+U,r.top+b+M),this.topRightContentBox=l>0||A>0?wn(r.left+Math.min(v,r.width+_+U),r.top+b+M,v>r.width+_+U?0:l-_+U,A-(b+M),Xt.TOP_RIGHT):new ze(r.left+r.width-(F+Y),r.top+b+M),this.bottomRightContentBox=u>0||h>0?wn(r.left+Math.min(B,r.width-(_+U)),r.top+Math.min(w,r.height+b+M),Math.max(0,u-(F+Y)),h-(x+O),Xt.BOTTOM_RIGHT):new ze(r.left+r.width-(F+Y),r.top+r.height-(x+O)),this.bottomLeftContentBox=p>0||f>0?wn(r.left+_+U,r.top+C,Math.max(0,p-(_+U)),f-(x+O),Xt.BOTTOM_LEFT):new ze(r.left+_+U,r.top+r.height-(x+O))}return n}(),Xt;(function(n){n[n.TOP_LEFT=0]="TOP_LEFT",n[n.TOP_RIGHT=1]="TOP_RIGHT",n[n.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",n[n.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Xt||(Xt={}));var wn=function(n,e,t,r,i){var s=4*((Math.sqrt(2)-1)/3),o=t*s,a=r*s,l=n+t,A=e+r;switch(i){case Xt.TOP_LEFT:return new ty(new ze(n,A),new ze(n,A-a),new ze(l-o,e),new ze(l,e));case Xt.TOP_RIGHT:return new ty(new ze(n,e),new ze(n+o,e),new ze(l,A-a),new ze(l,A));case Xt.BOTTOM_RIGHT:return new ty(new ze(l,e),new ze(l,e+a),new ze(n+o,A),new ze(n,A));case Xt.BOTTOM_LEFT:default:return new ty(new ze(l,A),new ze(l-o,A),new ze(n,e+a),new ze(n,e))}},LB=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},Kce=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},VB=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},$ce=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),ny=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),qce=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),eue=function(n){return n.type===0},gJ=function(n){return n.type===1},tue=function(n){return n.type===2},kk=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},nue=function(n,e,t,r,i){return n.map(function(s,o){switch(o){case 0:return s.add(e,t);case 1:return s.add(e+r,t);case 2:return s.add(e+r,t+i);case 3:return s.add(e,t+i)}return s})},mJ=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),vJ=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new jce(this.container),this.container.styles.opacity<1&&this.effects.push(new qce(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new $ce(r,i,s))}if(this.container.styles.overflowX!==0){var o=LB(this.curves),a=VB(this.curves);kk(o,a)?this.effects.push(new ny(o,6)):(this.effects.push(new ny(o,2)),this.effects.push(new ny(a,4)))}}return n.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,i=this.effects.slice(0);r;){var s=r.effects.filter(function(l){return!gJ(l)});if(t||r.container.styles.position!==0||!r.parent){if(i.unshift.apply(i,s),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var o=LB(r.curves),a=VB(r.curves);kk(o,a)||i.unshift(new ny(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return gr(l.target,e)})},n}(),e_=function(n,e,t,r){n.container.elements.forEach(function(i){var s=gr(i.flags,4),o=gr(i.flags,2),a=new vJ(i,n);gr(i.styles.display,2048)&&r.push(a);var l=gr(i.flags,8)?[]:r;if(s||o){var A=s||i.styles.isPositioned()?t:e,c=new mJ(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var h=0;A.negativeZIndex.some(function(p,f){return u>p.element.container.styles.zIndex.order?(h=f,!1):h>0}),A.negativeZIndex.splice(h,0,c)}else if(u>0){var d=0;A.positiveZIndex.some(function(p,f){return u>=p.element.container.styles.zIndex.order?(d=f+1,!1):d>0}),A.positiveZIndex.splice(d,0,c)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else i.styles.isFloating()?A.nonPositionedFloats.push(c):A.nonPositionedInlineLevel.push(c);e_(a,c,s?c:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),e_(a,e,t,l);gr(i.flags,8)&&yJ(i,l)})},yJ=function(n,e){for(var t=n instanceof qE?n.start:1,r=n instanceof qE?n.reversed:!1,i=0;i"u"?n[0]:t},cue=function(n,e,t,r,i){var s=e[0],o=e[1],a=t[0],l=t[1];switch(n){case 2:return[new ze(Math.round(r.left),Math.round(r.top+o)),new ze(Math.round(r.left+r.width),Math.round(r.top+o)),new ze(Math.round(r.left+r.width),Math.round(l+r.top+o)),new ze(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new ze(Math.round(r.left+s),Math.round(r.top)),new ze(Math.round(r.left+s+a),Math.round(r.top)),new ze(Math.round(r.left+s+a),Math.round(r.height+r.top)),new ze(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new ze(Math.round(r.left+s),Math.round(r.top+o)),new ze(Math.round(r.left+s+a),Math.round(r.top+o)),new ze(Math.round(r.left+s+a),Math.round(r.top+o+l)),new ze(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new ze(Math.round(i.left),Math.round(i.top)),new ze(Math.round(i.left+i.width),Math.round(i.top)),new ze(Math.round(i.left+i.width),Math.round(i.height+i.top)),new ze(Math.round(i.left),Math.round(i.height+i.top))]}},uue="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Lk="Hidden Text",due=function(){function n(e){this._data={},this._document=e}return n.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),i=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),i.src=uue,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=t,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Lk)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(Lk)),r.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:a,middle:l}},n.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},n}(),BJ=function(){function n(e,t){this.context=e,this.options=t}return n}(),hue=1e4;(function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i._activeEffects=[],i.canvas=r.canvas?r.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),r.canvas||(i.canvas.width=Math.floor(r.width*r.scale),i.canvas.height=Math.floor(r.height*r.scale),i.canvas.style.width=r.width+"px",i.canvas.style.height=r.height+"px"),i.fontMetrics=new due(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-r.x,-r.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),i}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return r.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),tue(t)&&(this.ctx.globalAlpha=t.opacity),eue(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),gJ(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Rs(this,void 0,void 0,function(){var r;return Hi(this,function(i){switch(i.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Rs(this,void 0,void 0,function(){return Hi(this,function(r){switch(r.label){case 0:if(gr(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,i){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var o=$U(t.text);o.reduce(function(a,l){return s.ctx.fillText(l,a,t.bounds.top+i),a+s.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),i=vue(t.fontFamily).join(", "),s=B0(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,s,i].join(" "),i,s]},e.prototype.renderTextNode=function(t,r){return Rs(this,void 0,void 0,function(){var i,s,o,a,l,A,c,u,h=this;return Hi(this,function(d){return i=this.createFontStyle(r),s=i[0],o=i[1],a=i[2],this.ctx.font=s,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(o,a),A=l.baseline,c=l.middle,u=r.paintOrder,t.textBounds.forEach(function(p){u.forEach(function(f){switch(f){case 0:h.ctx.fillStyle=Br(r.color),h.renderTextWithLetterSpacing(p,r.letterSpacing,A);var g=r.textShadow;g.length&&p.text.trim().length&&(g.slice(0).reverse().forEach(function(m){h.ctx.shadowColor=Br(m.color),h.ctx.shadowOffsetX=m.offsetX.number*h.options.scale,h.ctx.shadowOffsetY=m.offsetY.number*h.options.scale,h.ctx.shadowBlur=m.blur.number,h.renderTextWithLetterSpacing(p,r.letterSpacing,A)}),h.ctx.shadowColor="",h.ctx.shadowOffsetX=0,h.ctx.shadowOffsetY=0,h.ctx.shadowBlur=0),r.textDecorationLine.length&&(h.ctx.fillStyle=Br(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(m){switch(m){case 1:h.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+A),p.bounds.width,1);break;case 2:h.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:h.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+c),p.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&p.text.trim().length&&(h.ctx.strokeStyle=Br(r.webkitTextStrokeColor),h.ctx.lineWidth=r.webkitTextStrokeWidth,h.ctx.lineJoin=window.chrome?"miter":"round",h.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+A)),h.ctx.strokeStyle="",h.ctx.lineWidth=0,h.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,i){if(i&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var s=PB(t),o=VB(r);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Rs(this,void 0,void 0,function(){var r,i,s,o,a,l,v,v,A,c,u,h,B,d,p,C,f,g,m,v,w,B,C;return Hi(this,function(b){switch(b.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,b.label=1;case 1:return o0&&y>0&&(x=s.ctx.createPattern(C,"repeat"),s.renderRepeat(M,x,R,N))):mle(c)&&(_=tI(t,r,[null,null,null]),M=_[0],Y=_[1],O=_[2],U=_[3],y=_[4],I=c.position.length===0?[XU]:c.position,R=dn(I[0],U),N=dn(I[I.length-1],y),k=dle(c,R,N,U,y),V=k[0],G=k[1],V>0&&G>0&&(D=s.ctx.createRadialGradient(Y+R,O+N,0,Y+R,O+N,V),uk(c.stops,V*2).forEach(function(pe){return D.addColorStop(pe.stop,Br(pe.color))}),s.path(M),s.ctx.fillStyle=D,V!==G?(E=t.bounds.left+.5*t.bounds.width,z=t.bounds.top+.5*t.bounds.height,re=G/V,T=1/re,s.ctx.save(),s.ctx.translate(E,z),s.ctx.transform(1,0,0,re,0,0),s.ctx.translate(-E,-z),s.ctx.fillRect(Y,T*(O-z)+z,U,y*T),s.ctx.restore()):s.ctx.fill())),ee.label=6;case 6:return r--,[2]}})},s=this,o=0,a=t.styles.backgroundImage.slice(0).reverse(),A.label=1;case 1:return o0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,a,t.curves,2)]:[3,11]):[3,13];case 4:return h.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,a,t.curves,3)];case 6:return h.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,a,t.curves)];case 8:return h.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,a,t.curves)];case 10:h.sent(),h.label=11;case 11:a++,h.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,i,s,o){return Rs(this,void 0,void 0,function(){var a,l,A,c,u,h,d,p,f,g,m,v,w,B,C,b,C,b;return Hi(this,function(F){return this.ctx.save(),a=oue(s,i),l=Dk(s,i),o===2&&(this.path(l),this.ctx.clip()),Os(l[0])?(A=l[0].start.x,c=l[0].start.y):(A=l[0].x,c=l[0].y),Os(l[1])?(u=l[1].end.x,h=l[1].end.y):(u=l[1].x,h=l[1].y),i===0||i===2?d=Math.abs(A-u):d=Math.abs(c-h),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),p=r<3?r*3:r*2,f=r<3?r*2:r,o===3&&(p=r,f=r),g=!0,d<=p*2?g=!1:d<=p*2+f?(m=d/(2*p+f),p*=m,f*=m):(v=Math.floor((d+f)/(p+f)),w=(d-v*p)/(v-1),B=(d-(v+1)*p)/v,f=B<=0||Math.abs(f-w)0&&s[s.length-1])&&(A[0]===6||A[0]===2)){t=0;continue}if(A[0]===3&&(!s||A[1]>s[0]&&A[1]=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},ZN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",woe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Dv=0;Dv"u"?[]:new Uint8Array(256);for(var Lv=0;Lv>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},Coe=function(n){for(var e=n.length,t=[],r=0;r>uu,Ioe=1<>uu,Eoe=x4+Foe,_oe=Eoe,Soe=32,Uoe=_oe+Soe,Qoe=65536>>YU,Roe=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>uu],t=(t<>uu)],t=(t<>YU),t=this.index[t],t+=e>>uu&Moe,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var Vv=0;VvYN?(i.push(!0),a-=YN):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(WE);if(a===Poe||a===PE){if(o===0)return r.push(o),t.push(Hc);var l=t[o-1];return Yoe.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(Hc))}if(r.push(o),a===Joe)return t.push(e==="strict"?GE:Dm);if(a===_4||a===Zoe)return t.push(Hc);if(a===Hoe)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Dm):t.push(Hc);t.push(a)}),[r,t,i]},W1=function(n,e,t,r){var i=r[t];if(Array.isArray(n)?n.indexOf(i)!==-1:n===i)for(var s=t;s<=r.length;){s++;var o=r[s];if(o===e)return!0;if(o!==TA)break}if(i===TA)for(var s=t;s>0;){s--;var a=r[s];if(Array.isArray(n)?n.indexOf(a)!==-1:n===a)for(var l=t;l<=r.length;){l++;var o=r[l];if(o===e)return!0;if(o!==TA)break}if(a!==TA)break}return!1},tk=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===TA)t--;else return r}return 0},Koe=function(n,e,t,r,i){if(t[r]===0)return Ut;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return Ut;var o=s-1,a=s+1,l=e[s],A=o>=0?e[o]:0,c=e[a];if(l===I4&&c===F4)return Ut;if(XE.indexOf(l)!==-1)return S4;if(XE.indexOf(c)!==-1||U4.indexOf(c)!==-1)return Ut;if(tk(s,e)===E4)return Gv;if(YE.get(n[s])===PE||(l===Ov||l===Wv)&&YE.get(n[a])===PE||l===XN||c===XN||l===jN||[TA,OE,vg].indexOf(l)===-1&&c===jN||[Pv,Np,Goe,md,vd].indexOf(c)!==-1||tk(s,e)===kp||W1(P1,kp,s,e)||W1([Pv,Np],GE,s,e)||W1(KN,KN,s,e))return Ut;if(l===TA)return Gv;if(l===P1||c===P1)return Ut;if(c===WE||l===WE)return Gv;if([OE,vg,GE].indexOf(c)!==-1||l===Woe||A===HE&&Xoe.indexOf(l)!==-1||l===vd&&c===HE||c===$N||Ka.indexOf(c)!==-1&&l===zi||Ka.indexOf(l)!==-1&&c===zi||l===wg&&[Dm,Ov,Wv].indexOf(c)!==-1||[Dm,Ov,Wv].indexOf(l)!==-1&&c===yg||Ka.indexOf(l)!==-1&&qN.indexOf(c)!==-1||qN.indexOf(l)!==-1&&Ka.indexOf(c)!==-1||[wg,yg].indexOf(l)!==-1&&(c===zi||[kp,vg].indexOf(c)!==-1&&e[a+1]===zi)||[kp,vg].indexOf(l)!==-1&&c===zi||l===zi&&[zi,vd,md].indexOf(c)!==-1)return Ut;if([zi,vd,md,Pv,Np].indexOf(c)!==-1)for(var u=s;u>=0;){var h=e[u];if(h===zi)return Ut;if([vd,md].indexOf(h)!==-1)u--;else break}if([wg,yg].indexOf(c)!==-1)for(var u=[Pv,Np].indexOf(l)!==-1?o:s;u>=0;){var h=e[u];if(h===zi)return Ut;if([vd,md].indexOf(h)!==-1)u--;else break}if(zE===l&&[zE,dw,ZE,JE].indexOf(c)!==-1||[dw,ZE].indexOf(l)!==-1&&[dw,hw].indexOf(c)!==-1||[hw,JE].indexOf(l)!==-1&&c===hw||ek.indexOf(l)!==-1&&[$N,yg].indexOf(c)!==-1||ek.indexOf(c)!==-1&&l===wg||Ka.indexOf(l)!==-1&&Ka.indexOf(c)!==-1||l===md&&Ka.indexOf(c)!==-1||Ka.concat(zi).indexOf(l)!==-1&&c===kp&&zoe.indexOf(n[a])===-1||Ka.concat(zi).indexOf(c)!==-1&&l===Np)return Ut;if(l===O1&&c===O1){for(var d=t[s],p=1;d>0&&(d--,e[d]===O1);)p++;if(p%2!==0)return Ut}return l===Ov&&c===Wv?Ut:Gv},$oe=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=joe(n,e.lineBreak),r=t[0],i=t[1],s=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[zi,Hc,_4].indexOf(a)!==-1?Dm:a}));var o=e.wordBreak==="keep-all"?s.map(function(a,l){return a&&n[l]>=19968&&n[l]<=40959}):void 0;return[r,i,o]},qoe=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===S4,this.start=r,this.end=i}return n.prototype.slice=function(){return Zn.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),eae=function(n,e){var t=sb(n),r=$oe(t,e),i=r[0],s=r[1],o=r[2],a=t.length,l=0,A=0;return{next:function(){if(A>=a)return{done:!0,value:null};for(var c=Ut;A=Q4&&n<=57},Tae=function(n){return n>=55296&&n<=57343},yd=function(n){return Yr(n)||n>=T4&&n<=k4||n>=R4&&n<=Sae},Nae=function(n){return n>=R4&&n<=Qae},kae=function(n){return n>=T4&&n<=Mae},Dae=function(n){return Nae(n)||kae(n)},Lae=function(n){return n>=yae},Yv=function(n){return n===MB||n===rae||n===iae},TB=function(n){return Dae(n)||Lae(n)||n===lae},ok=function(n){return TB(n)||Yr(n)||n===Ei},Vae=function(n){return n>=bae&&n<=xae||n===Iae||n>=Fae&&n<=Eae||n===_ae},wA=function(n,e){return n!==Yg?!1:e!==MB},Xv=function(n,e,t){return n===Ei?TB(e)||wA(e,t):TB(n)?!0:!!(n===Yg&&wA(n,e))},Z1=function(n,e,t){return n===qc||n===Ei?Yr(e)?!0:e===Lm&&Yr(t):Yr(n===Lm?e:n)},Pae=function(n){var e=0,t=1;(n[e]===qc||n[e]===Ei)&&(n[e]===Ei&&(t=-1),e++);for(var r=[];Yr(n[e]);)r.push(n[e++]);var i=r.length?parseInt(Zn.apply(void 0,r),10):0;n[e]===Lm&&e++;for(var s=[];Yr(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(Zn.apply(void 0,s),10):0;(n[e]===N4||n[e]===M4)&&e++;var l=1;(n[e]===qc||n[e]===Ei)&&(n[e]===Ei&&(l=-1),e++);for(var A=[];Yr(n[e]);)A.push(n[e++]);var c=A.length?parseInt(Zn.apply(void 0,A),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*c)},Oae={type:2},Wae={type:3},Gae={type:4},Zae={type:13},Jae={type:8},Hae={type:21},zae={type:9},Yae={type:10},Xae={type:11},jae={type:12},Kae={type:14},jv={type:23},$ae={type:1},qae={type:25},ele={type:24},tle={type:26},nle={type:27},rle={type:28},ile={type:29},sle={type:31},jE={type:32},D4=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(sb(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==jE;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Zv:return this.consumeStringToken(Zv);case sae:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(ok(t)||wA(r,i)){var s=Xv(t,r,i)?nae:tae,o=this.consumeName();return{type:5,value:o,flags:s}}break;case oae:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),Zae;break;case Jv:return this.consumeStringToken(Jv);case Hv:return Oae;case Lp:return Wae;case G1:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),Kae;break;case qc:if(Z1(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case wae:return Gae;case Ei:var a=e,l=this.peekCodePoint(0),A=this.peekCodePoint(1);if(Z1(a,l,A))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Xv(a,l,A))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Ei&&A===uae)return this.consumeCodePoint(),this.consumeCodePoint(),ele;break;case Lm:if(Z1(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case rk:if(this.peekCodePoint(0)===G1)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===G1&&(c=this.consumeCodePoint(),c===rk))return this.consumeToken();if(c===Ho)return this.consumeToken()}break;case Bae:return tle;case Cae:return nle;case cae:if(this.peekCodePoint(0)===Aae&&this.peekCodePoint(1)===Ei&&this.peekCodePoint(2)===Ei)return this.consumeCodePoint(),this.consumeCodePoint(),qae;break;case dae:var u=this.peekCodePoint(0),h=this.peekCodePoint(1),d=this.peekCodePoint(2);if(Xv(u,h,d)){var o=this.consumeName();return{type:7,value:o}}break;case hae:return rle;case Yg:if(wA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case fae:return ile;case pae:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),Jae;break;case gae:return Xae;case mae:return jae;case Uae:case Rae:var p=this.peekCodePoint(0),f=this.peekCodePoint(1);return p===qc&&(yd(f)||f===zv)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case ik:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),zae;if(this.peekCodePoint(0)===ik)return this.consumeCodePoint(),Hae;break;case vae:if(this.peekCodePoint(0)===Dp)return this.consumeCodePoint(),Yae;break;case Ho:return jE}return Yv(e)?(this.consumeWhiteSpace(),sle):Yr(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):TB(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Zn(e)}},n.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},n.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},n.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},n.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();yd(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===zv&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(Zn.apply(void 0,e.map(function(l){return l===zv?Q4:l})),16),s=parseInt(Zn.apply(void 0,e.map(function(l){return l===zv?k4:l})),16);return{type:30,start:i,end:s}}var o=parseInt(Zn.apply(void 0,e),16);if(this.peekCodePoint(0)===Ei&&yd(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];yd(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(Zn.apply(void 0,a),16);return{type:30,start:o,end:s}}else return{type:30,start:o,end:o}},n.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===Hv?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Hv?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ho)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===Jv||t===Zv){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ho||this.peekCodePoint(0)===Lp)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),jv)}for(;;){var i=this.consumeCodePoint();if(i===Ho||i===Lp)return{type:22,value:Zn.apply(void 0,e)};if(Yv(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Ho||this.peekCodePoint(0)===Lp?(this.consumeCodePoint(),{type:22,value:Zn.apply(void 0,e)}):(this.consumeBadUrlRemnants(),jv);if(i===Zv||i===Jv||i===Hv||Vae(i))return this.consumeBadUrlRemnants(),jv;if(i===Yg)if(wA(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),jv;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;Yv(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Lp||e===Ho)return;wA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},n.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var i=Math.min(t,e);r+=Zn.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),r},n.prototype.consumeStringToken=function(e){var t="",r=0;do{var i=this._value[r];if(i===Ho||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===MB)return this._value.splice(0,r),$ae;if(i===Yg){var s=this._value[r+1];s!==Ho&&s!==void 0&&(s===MB?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):wA(i,s)&&(t+=this.consumeStringSlice(r),t+=Zn(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=w0,r=this.peekCodePoint(0);for((r===qc||r===Ei)&&e.push(this.consumeCodePoint());Yr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===Lm&&Yr(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=nk;Yr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===N4||r===M4)&&((i===qc||i===Ei)&&Yr(s)||Yr(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=nk;Yr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Pae(e),t]},n.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],i=this.peekCodePoint(0),s=this.peekCodePoint(1),o=this.peekCodePoint(2);if(Xv(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===aae?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(yd(e)){for(var t=Zn(e);yd(this.peekCodePoint(0))&&t.length<6;)t+=Zn(this.consumeCodePoint());Yv(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||Tae(r)||r>1114111?sk:r}return e===Ho?sk:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(ok(t))e+=Zn(t);else if(wA(t,this.peekCodePoint(0)))e+=Zn(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),L4=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new D4;return t.write(e),new n(t.read())},n.parseValue=function(e){return n.create(e).parseComponentValue()},n.parseValues=function(e){return n.create(e).parseComponentValues()},n.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},n.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},n.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},n.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||ole(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},n.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},n.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?jE:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),B0=function(n){return n.type===15},ob=function(n){return n.type===17},On=function(n){return n.type===20},KE=function(n,e){return On(n)&&n.value===e},ab=function(n){return n.type!==31&&n.type!==4},Va=function(n){var e=[],t=[];return n.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},ole=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},Ac=function(n){return n.type===17||n.type===15},rr=function(n){return n.type===16||Ac(n)},V4=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},Dr={type:17,number:0,flags:w0},XU={type:16,number:50,flags:w0},NA={type:16,number:100,flags:w0},Bg=function(n,e,t){var r=n[0],i=n[1];return[dn(r,e),dn(typeof i<"u"?i:r,t)]},dn=function(n,e){if(n.type===16)return n.number/100*e;if(B0(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},P4="deg",O4="grad",W4="rad",G4="turn",lb={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case P4:return Math.PI*e.number/180;case O4:return Math.PI/200*e.number;case W4:return e.number;case G4:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Z4=function(n){return n.type===15&&(n.unit===P4||n.unit===O4||n.unit===W4||n.unit===G4)},J4=function(n){var e=n.filter(On).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Dr,Dr];case"to top":case"bottom":return zs(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Dr,NA];case"to right":case"left":return zs(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[NA,NA];case"to bottom":case"top":return zs(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[NA,Dr];case"to left":case"right":return zs(270)}return 0},zs=function(n){return Math.PI*n/180},KA={name:"color",parse:function(n,e){if(e.type===18){var t=ale[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(n,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3);return kA(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3),o=e.value.substring(3,4);return kA(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),parseInt(o+o,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6);return kA(parseInt(r,16),parseInt(i,16),parseInt(s,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6),o=e.value.substring(6,8);return kA(parseInt(r,16),parseInt(i,16),parseInt(s,16),parseInt(o,16)/255)}}if(e.type===20){var a=Vm[e.value.toUpperCase()];if(typeof a<"u")return a}return Vm.TRANSPARENT}},Hh=function(n){return(255&n)===0},Br=function(n){var e=255&n,t=255&n>>8,r=255&n>>16,i=255&n>>24;return e<255?"rgba("+i+","+r+","+t+","+e/255+")":"rgb("+i+","+r+","+t+")"},kA=function(n,e,t,r){return(n<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},ak=function(n,e){if(n.type===17)return n.number;if(n.type===16){var t=e===3?1:255;return e===3?n.number/100*t:Math.round(n.number/100*t)}return 0},lk=function(n,e){var t=e.filter(ab);if(t.length===3){var r=t.map(ak),i=r[0],s=r[1],o=r[2];return kA(i,s,o,1)}if(t.length===4){var a=t.map(ak),i=a[0],s=a[1],o=a[2],l=a[3];return kA(i,s,o,l)}return 0};function J1(n,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-n)*t*6+n:t<1/2?e:t<2/3?(e-n)*6*(2/3-t)+n:n}var Ak=function(n,e){var t=e.filter(ab),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?zs(r.number):lb.parse(n,r))/(Math.PI*2),l=rr(i)?i.number/100:0,A=rr(s)?s.number/100:0,c=typeof o<"u"&&rr(o)?dn(o,1):1;if(l===0)return kA(A*255,A*255,A*255,1);var u=A<=.5?A*(l+1):A+l-A*l,h=A*2-u,d=J1(h,u,a+1/3),p=J1(h,u,a),f=J1(h,u,a-1/3);return kA(d*255,p*255,f*255,c)},ale={hsl:Ak,hsla:Ak,rgb:lk,rgba:lk},ck=function(n,e){return KA.parse(n,L4.create(e).parseComponentValue())},Vm={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},lle={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(On(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ale={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Ab=function(n,e){var t=KA.parse(n,e[0]),r=e[1];return r&&rr(r)?{color:t,stop:r}:{color:t,stop:null}},uk=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=Dr),r.stop===null&&(r.stop=NA);for(var i=[],s=0,o=0;os?i.push(l):i.push(s),s=l}else i.push(null)}for(var A=null,o=0;oo.optimumDistance)?{optimumCorner:a,optimumDistance:c}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},dle=function(n,e,t,r,i){var s=0,o=0;switch(n.size){case 0:n.shape===0?s=o=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.min(Math.abs(e),Math.abs(e-r)),o=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(n.shape===0)s=o=Math.min(Co(e,t),Co(e,t-i),Co(e-r,t),Co(e-r,t-i));else if(n.shape===1){var a=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-r)),l=dk(r,i,e,t,!0),A=l[0],c=l[1];s=Co(A-e,(c-t)/a),o=a*s}break;case 1:n.shape===0?s=o=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.max(Math.abs(e),Math.abs(e-r)),o=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(n.shape===0)s=o=Math.max(Co(e,t),Co(e,t-i),Co(e-r,t),Co(e-r,t-i));else if(n.shape===1){var a=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-r)),u=dk(r,i,e,t,!1),A=u[0],c=u[1];s=Co(A-e,(c-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=dn(n.size[0],r),o=n.size.length===2?dn(n.size[1],i):s),[s,o]},hle=function(n,e){var t=zs(180),r=[];return Va(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=J4(i);return}else if(Z4(o)){t=lb.parse(n,o);return}}var a=Ab(n,i);r.push(a)}),{angle:t,stops:r,type:1}},Kv=function(n,e){var t=zs(180),r=[];return Va(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&["top","left","right","bottom"].indexOf(o.value)!==-1){t=J4(i);return}else if(Z4(o)){t=(lb.parse(n,o)+zs(270))%zs(360);return}}var a=Ab(n,i);r.push(a)}),{angle:t,stops:r,type:1}},fle=function(n,e){var t=zs(180),r=[],i=1,s=0,o=3,a=[];return Va(e).forEach(function(l,A){var c=l[0];if(A===0){if(On(c)&&c.value==="linear"){i=1;return}else if(On(c)&&c.value==="radial"){i=2;return}}if(c.type===18){if(c.name==="from"){var u=KA.parse(n,c.values[0]);r.push({stop:Dr,color:u})}else if(c.name==="to"){var u=KA.parse(n,c.values[0]);r.push({stop:NA,color:u})}else if(c.name==="color-stop"){var h=c.values.filter(ab);if(h.length===2){var u=KA.parse(n,h[1]),d=h[0];ob(d)&&r.push({stop:{type:16,number:d.number*100,flags:d.flags},color:u})}}}}),i===1?{angle:(t+zs(180))%zs(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},H4="closest-side",z4="farthest-side",Y4="closest-corner",X4="farthest-corner",j4="circle",K4="ellipse",$4="cover",q4="contain",ple=function(n,e){var t=0,r=3,i=[],s=[];return Va(e).forEach(function(o,a){var l=!0;if(a===0){var A=!1;l=o.reduce(function(u,h){if(A)if(On(h))switch(h.value){case"center":return s.push(XU),u;case"top":case"left":return s.push(Dr),u;case"right":case"bottom":return s.push(NA),u}else(rr(h)||Ac(h))&&s.push(h);else if(On(h))switch(h.value){case j4:return t=0,!1;case K4:return t=1,!1;case"at":return A=!0,!1;case H4:return r=0,!1;case $4:case z4:return r=1,!1;case q4:case Y4:return r=2,!1;case X4:return r=3,!1}else if(Ac(h)||rr(h))return Array.isArray(r)||(r=[]),r.push(h),!1;return u},l)}if(l){var c=Ab(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},$v=function(n,e){var t=0,r=3,i=[],s=[];return Va(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(c,u){if(On(u))switch(u.value){case"center":return s.push(XU),!1;case"top":case"left":return s.push(Dr),!1;case"right":case"bottom":return s.push(NA),!1}else if(rr(u)||Ac(u))return s.push(u),!1;return c},l):a===1&&(l=o.reduce(function(c,u){if(On(u))switch(u.value){case j4:return t=0,!1;case K4:return t=1,!1;case q4:case H4:return r=0,!1;case z4:return r=1,!1;case Y4:return r=2,!1;case $4:case X4:return r=3,!1}else if(Ac(u)||rr(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return c},l)),l){var A=Ab(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},gle=function(n){return n.type===1},mle=function(n){return n.type===2},jU={name:"image",parse:function(n,e){if(e.type===22){var t={url:e.value,type:0};return n.cache.addImage(e.value),t}if(e.type===18){var r=eJ[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(n,e.values)}throw new Error("Unsupported image type "+e.type)}};function vle(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!eJ[n.name])}var eJ={"linear-gradient":hle,"-moz-linear-gradient":Kv,"-ms-linear-gradient":Kv,"-o-linear-gradient":Kv,"-webkit-linear-gradient":Kv,"radial-gradient":ple,"-moz-radial-gradient":$v,"-ms-radial-gradient":$v,"-o-radial-gradient":$v,"-webkit-radial-gradient":$v,"-webkit-gradient":fle},yle={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return ab(r)&&vle(r)}).map(function(r){return jU.parse(n,r)})}},wle={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(On(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ble={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return Va(e).map(function(t){return t.filter(rr)}).map(V4)}},Cle={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return Va(e).map(function(t){return t.filter(On).map(function(r){return r.value}).join(" ")}).map(ble)}},ble=function(n){switch(n){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},zh;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(zh||(zh={}));var xle={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return Va(e).map(function(t){return t.filter(Ile)})}},Ile=function(n){return On(n)||rr(n)},cb=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Fle=cb("top"),Ele=cb("right"),_le=cb("bottom"),Sle=cb("left"),ub=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return V4(t.filter(rr))}}},Ule=ub("top-left"),Qle=ub("top-right"),Rle=ub("bottom-right"),Mle=ub("bottom-left"),db=function(n){return{name:"border-"+n+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Tle=db("top"),Nle=db("right"),kle=db("bottom"),Dle=db("left"),hb=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return B0(t)?t.number:0}}},Lle=hb("top"),Vle=hb("right"),Ple=hb("bottom"),Ole=hb("left"),Wle={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Gle={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},Zle={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(On).reduce(function(t,r){return t|Jle(r.value)},0)}},Jle=function(n){switch(n){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Hle={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},zle={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(n,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},NB;(function(n){n.NORMAL="normal",n.STRICT="strict"})(NB||(NB={}));var Yle={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return NB.STRICT;case"normal":default:return NB.NORMAL}}},Xle={name:"line-height",initialValue:"normal",prefix:!1,type:4},hk=function(n,e){return On(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:rr(n)?dn(n,e):e},jle={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:jU.parse(n,e)}},Kle={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(n,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},$le={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},fb=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},qle=fb("top"),eAe=fb("right"),tAe=fb("bottom"),nAe=fb("left"),rAe={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(On).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},iAe={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},pb=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},sAe=pb("top"),oAe=pb("right"),aAe=pb("bottom"),lAe=pb("left"),AAe={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(n,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},cAe={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(n,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},uAe={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&KE(e[0],"none")?[]:Va(e).map(function(t){for(var r={color:Vm.TRANSPARENT,offsetX:Dr,offsetY:Dr,blur:Dr},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},fAe=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},pAe=function(n){var e=n.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],r=e[1];e[2],e[3];var i=e[4],s=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var o=e[12],a=e[13];return e[14],e[15],e.length===16?[t,r,i,s,o,a]:null},gAe={matrix:fAe,matrix3d:pAe},fk={type:16,number:50,flags:w0},mAe=[fk,fk],vAe={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(rr);return t.length!==2?mAe:[t[0],t[1]]}},yAe={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},Xg;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(Xg||(Xg={}));var wAe={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return Xg.BREAK_ALL;case"keep-all":return Xg.KEEP_ALL;case"normal":default:return Xg.NORMAL}}},BAe={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(ob(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},tJ={name:"time",parse:function(n,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},CAe={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return ob(e)?e.number:1}},bAe={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},xAe={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(On).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},IAe={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(n,e){var t=[],r=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},FAe={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},EAe={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(ob(e))return e.number;if(On(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},_Ae={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(On).map(function(t){return t.value})}},SAe={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},gr=function(n,e){return(n&e)!==0},UAe={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(B0).map(function(t){return tJ.parse(n,t)})}},QAe={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&KE(e[0],"none")?[]:Va(e).map(function(t){for(var r={color:255,offsetX:Dr,offsetY:Dr,blur:Dr,spread:Dr,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=Ke(e,iAe,t.overflowWrap),this.paddingTop=Ke(e,sAe,t.paddingTop),this.paddingRight=Ke(e,oAe,t.paddingRight),this.paddingBottom=Ke(e,aAe,t.paddingBottom),this.paddingLeft=Ke(e,lAe,t.paddingLeft),this.paintOrder=Ke(e,RAe,t.paintOrder),this.position=Ke(e,cAe,t.position),this.textAlign=Ke(e,AAe,t.textAlign),this.textDecorationColor=Ke(e,bAe,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=Ke(e,xAe,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=Ke(e,uAe,t.textShadow),this.textTransform=Ke(e,dAe,t.textTransform),this.transform=Ke(e,hAe,t.transform),this.transformOrigin=Ke(e,vAe,t.transformOrigin),this.visibility=Ke(e,yAe,t.visibility),this.webkitTextStrokeColor=Ke(e,MAe,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Ke(e,TAe,t.webkitTextStrokeWidth),this.wordBreak=Ke(e,wAe,t.wordBreak),this.zIndex=Ke(e,BAe,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return Hh(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return gr(this.display,4)||gr(this.display,33554432)||gr(this.display,268435456)||gr(this.display,536870912)||gr(this.display,67108864)||gr(this.display,134217728)},n}(),Ke=function(n,e,t){var r=new D4,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new L4(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,On(o)?o.value:e.initialValue);case 0:return e.parse(n,s.parseComponentValue());case 1:return e.parse(n,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(e.format){case"angle":return lb.parse(n,s.parseComponentValue());case"color":return KA.parse(n,s.parseComponentValue());case"image":return jU.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return Ac(a)?a:Dr;case"length-percentage":var l=s.parseComponentValue();return rr(l)?l:Dr;case"time":return tJ.parse(n,s.parseComponentValue())}break}},kAe="data-html2canvas-debug",DAe=function(n){var e=n.getAttribute(kAe);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},pk=function(n,e){var t=DAe(n);return t===1||e===t},Pa=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,pk(t,3))debugger;this.styles=new NAe(e,window.getComputedStyle(t,null)),Dce(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=zU(this.context,t),pk(t,4)&&(this.flags|=16)}return n}(),LAe="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",gk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var qv=0;qv>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},PAe=function(n){for(var e=n.length,t=[],r=0;r>du,GAe=1<>du,JAe=nJ+ZAe,HAe=JAe,zAe=32,YAe=HAe+zAe,XAe=65536>>KU,jAe=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>du],t=(t<>du)],t=(t<>KU),t=this.index[t],t+=e>>du&KAe,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var ey=0;ey=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},oce=qAe(LAe),Ds="×",q1="÷",ace=function(n){return oce.get(n)},lce=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===Y1&&o===X1)return Ds;if(s===Y1||s===X1||s===yk||o===Y1||o===X1||o===yk)return q1;if(s===Bk&&[Bk,j1,Ck,bk].indexOf(o)!==-1||(s===Ck||s===j1)&&(o===j1||o===K1)||(s===bk||s===K1)&&o===K1||o===xk||o===wk||o===rce||s===nce)return Ds;if(s===xk&&o===Ik){for(;i===wk;)i=e[--r];if(i===Ik)return Ds}if(s===$1&&o===$1){for(var a=0;i===$1;)a++,i=e[--r];if(a%2===0)return Ds}return q1},Ace=function(n){var e=ice(n),t=e.length,r=0,i=0,s=e.map(ace);return{next:function(){if(r>=t)return{done:!0,value:null};for(var o=Ds;ro.x||c.y>o.y;return o=c,A===0?!0:u});return n.body.removeChild(e),a},hce=function(){return typeof new Image().crossOrigin<"u"},fce=function(){return typeof new XMLHttpRequest().responseType=="string"},pce=function(n){var e=new Image,t=n.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},Fk=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},gce=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var i=new Image,s=e.toDataURL();i.src=s;var o=$E(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),Ek(o).then(function(a){r.drawImage(a,0,0);var l=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var A=n.createElement("div");return A.style.backgroundImage="url("+s+")",A.style.height=t+"px",Fk(l)?Ek($E(t,t,0,0,A)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),Fk(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},$E=function(n,e,t,r,i){var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return o.setAttributeNS(null,"width",n.toString()),o.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(a),a.appendChild(i),o},Ek=function(n){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(n))})},Ki={get SUPPORT_RANGE_BOUNDS(){var n=uce(document);return Object.defineProperty(Ki,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=Ki.SUPPORT_RANGE_BOUNDS&&dce(document);return Object.defineProperty(Ki,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=pce(document);return Object.defineProperty(Ki,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?gce(document):Promise.resolve(!1);return Object.defineProperty(Ki,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=hce();return Object.defineProperty(Ki,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=fce();return Object.defineProperty(Ki,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ki,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ki,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},jg=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),mce=function(n,e,t,r){var i=wce(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(Ki.SUPPORT_RANGE_BOUNDS){var l=_k(r,o,a.length).getClientRects();if(l.length>1){var A=$U(a),c=0;A.forEach(function(h){s.push(new jg(h,Iu.fromDOMRectList(n,_k(r,c+o,h.length).getClientRects()))),c+=h.length})}else s.push(new jg(a,Iu.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new jg(a,vce(n,r))),r=u}else Ki.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},vce=function(n,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var s=zU(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Iu.EMPTY},_k=function(n,e,t){var r=n.ownerDocument;if(!r)throw new Error("Node has no owner document");var i=r.createRange();return i.setStart(n,e),i.setEnd(n,e+t),i},$U=function(n){if(Ki.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(n)).map(function(t){return t.segment})}return cce(n)},yce=function(n,e){if(Ki.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(n)).map(function(r){return r.segment})}return Cce(n,e)},wce=function(n,e){return e.letterSpacing!==0?$U(n):yce(n,e)},Bce=[32,160,4961,65792,65793,4153,4241],Cce=function(n,e){for(var t=eae(n,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],i,s=function(){if(i.value){var o=i.value.slice(),a=sb(o),l="";a.forEach(function(A){Bce.indexOf(A)===-1?l+=Zn(A):(l.length&&r.push(l),r.push(Zn(A)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},bce=function(){function n(e,t,r){this.text=xce(t.data,r.textTransform),this.textBounds=mce(e,this.text,r,t)}return n}(),xce=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(Ice,Fce);case 2:return n.toUpperCase();default:return n}},Ice=/(^|\s|:|-|\(|\))([a-z])/g,Fce=function(n,e,t){return n.length>0?e+t.toUpperCase():n},rJ=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.src=r.currentSrc||r.src,i.intrinsicWidth=r.naturalWidth,i.intrinsicHeight=r.naturalHeight,i.context.cache.addImage(i.src),i}return e}(Pa),iJ=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.canvas=r,i.intrinsicWidth=r.width,i.intrinsicHeight=r.height,i}return e}(Pa),sJ=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=zU(t,r);return r.setAttribute("width",o.width+"px"),r.setAttribute("height",o.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(r)),i.intrinsicWidth=r.width.baseVal.value,i.intrinsicHeight=r.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(Pa),oJ=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.value=r.value,i}return e}(Pa),qE=function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.start=r.start,i.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,i}return e}(Pa),Ece=[{type:15,flags:0,unit:"px",number:3}],_ce=[{type:16,flags:0,number:50}],Sce=function(n){return n.width>n.height?new Iu(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new bce(n,i,t.styles));else if(uJ(i))if(Hce(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return fw(n,a,t,r)});else{var o=cJ(n,i);o.styles.isVisible()&&(Tce(i,o,r)?o.flags|=4:Nce(o.styles)&&(o.flags|=2),Rce.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?fw(n,i.shadowRoot,o,r):!hJ(i)&&!dJ(i)&&!fJ(i)&&fw(n,i,o,r))}},cJ=function(n,e){return Zce(e)?new rJ(n,e):Gce(e)?new iJ(n,e):dJ(e)?new sJ(n,e):Vce(e)?new oJ(n,e):Pce(e)?new qE(n,e):Oce(e)?new qU(n,e):fJ(e)?new aJ(n,e):hJ(e)?new lJ(n,e):Jce(e)?new AJ(n,e):new Pa(n,e)},Mce=function(n,e){var t=cJ(n,e);return t.flags|=4,fw(n,e,t,t),t},Tce=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Wce(n)&&t.styles.isTransparent()},Nce=function(n){return n.isPositioned()||n.isFloating()},kce=function(n){return n.nodeType===Node.TEXT_NODE},uJ=function(n){return n.nodeType===Node.ELEMENT_NODE},Dce=function(n){return uJ(n)&&typeof n.style<"u"&&!Lce(n)},Lce=function(n){return typeof n.className=="object"},Vce=function(n){return n.tagName==="LI"},Pce=function(n){return n.tagName==="OL"},Oce=function(n){return n.tagName==="INPUT"},dJ=function(n){return n.tagName==="svg"},Wce=function(n){return n.tagName==="BODY"},Gce=function(n){return n.tagName==="CANVAS"},Zce=function(n){return n.tagName==="IMG"},Jce=function(n){return n.tagName==="IFRAME"},hJ=function(n){return n.tagName==="TEXTAREA"},fJ=function(n){return n.tagName==="SELECT"},Hce=function(n){return n.tagName==="SLOT"},Uk={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Qk={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},zce={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Yce={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},wd=function(n,e,t,r,i,s){return nt?eQ(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},pJ=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},Wn=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+(pJ(Math.abs(n),s,r,function(o){return Zn(Math.floor(o%s)+e)})+i)},Uc=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return pJ(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},Vd=1,gA=2,mA=4,bg=8,$a=function(n,e,t,r,i,s){if(n<-9999||n>9999)return eQ(n,4,i.length>0);var o=Math.abs(n),a=i;if(o===0)return e[0]+a;for(var l=0;o>0&&l<=4;l++){var A=o%10;A===0&&gr(s,Vd)&&a!==""?a=e[A]+a:A>1||A===1&&l===0||A===1&&l===1&&gr(s,gA)||A===1&&l===1&&gr(s,mA)&&n>100||A===1&&l>1&&gr(s,bg)?a=e[A]+(l>0?t[l-1]:"")+a:A===1&&l>0&&(a=t[l-1]+a),o=Math.floor(o/10)}return(n<0?r:"")+a},Rk="十百千萬",Mk="拾佰仟萬",Tk="マイナス",eI="마이너스",eQ=function(n,e,t){var r=t?". ":"",i=t?"、":"",s=t?", ":"",o=t?" ":"";switch(e){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=Wn(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return Uc(n,"〇一二三四五六七八九",i);case 6:return wd(n,1,3999,Uk,3,r).toLowerCase();case 7:return wd(n,1,3999,Uk,3,r);case 8:return Wn(n,945,969,!1,r);case 9:return Wn(n,97,122,!1,r);case 10:return Wn(n,65,90,!1,r);case 11:return Wn(n,1632,1641,!0,r);case 12:case 49:return wd(n,1,9999,Qk,3,r);case 35:return wd(n,1,9999,Qk,3,r).toLowerCase();case 13:return Wn(n,2534,2543,!0,r);case 14:case 30:return Wn(n,6112,6121,!0,r);case 15:return Uc(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return Uc(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return $a(n,"零一二三四五六七八九",Rk,"負",i,gA|mA|bg);case 47:return $a(n,"零壹貳參肆伍陸柒捌玖",Mk,"負",i,Vd|gA|mA|bg);case 42:return $a(n,"零一二三四五六七八九",Rk,"负",i,gA|mA|bg);case 41:return $a(n,"零壹贰叁肆伍陆柒捌玖",Mk,"负",i,Vd|gA|mA|bg);case 26:return $a(n,"〇一二三四五六七八九","十百千万",Tk,i,0);case 25:return $a(n,"零壱弐参四伍六七八九","拾百千万",Tk,i,Vd|gA|mA);case 31:return $a(n,"영일이삼사오육칠팔구","십백천만",eI,s,Vd|gA|mA);case 33:return $a(n,"零一二三四五六七八九","十百千萬",eI,s,0);case 32:return $a(n,"零壹貳參四五六七八九","拾百千",eI,s,Vd|gA|mA);case 18:return Wn(n,2406,2415,!0,r);case 20:return wd(n,1,19999,Yce,3,r);case 21:return Wn(n,2790,2799,!0,r);case 22:return Wn(n,2662,2671,!0,r);case 22:return wd(n,1,10999,zce,3,r);case 23:return Uc(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Uc(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Wn(n,3302,3311,!0,r);case 28:return Uc(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return Uc(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return Wn(n,3792,3801,!0,r);case 37:return Wn(n,6160,6169,!0,r);case 38:return Wn(n,4160,4169,!0,r);case 39:return Wn(n,2918,2927,!0,r);case 40:return Wn(n,1776,1785,!0,r);case 43:return Wn(n,3046,3055,!0,r);case 44:return Wn(n,3174,3183,!0,r);case 45:return Wn(n,3664,3673,!0,r);case 46:return Wn(n,3872,3881,!0,r);case 3:default:return Wn(n,48,57,!0,r)}},Nk;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(Nk||(Nk={}));var Xce=function(){function n(){}return n.getOrigin=function(e){var t=n._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},n.isSameOrigin=function(e){return n.getOrigin(e)===n._origin},n.setContext=function(e){n._link=e.document.createElement("a"),n._origin=n.getOrigin(e.location.href)},n._origin="about:blank",n}(),ze=function(){function n(e,t){this.type=0,this.x=e,this.y=t}return n.prototype.add=function(e,t){return new n(this.x+e,this.y+t)},n}(),Bd=function(n,e,t){return new ze(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},ty=function(){function n(e,t,r,i){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=i}return n.prototype.subdivide=function(e,t){var r=Bd(this.start,this.startControl,e),i=Bd(this.startControl,this.endControl,e),s=Bd(this.endControl,this.end,e),o=Bd(r,i,e),a=Bd(i,s,e),l=Bd(o,a,e);return t?new n(this.start,r,o,l):new n(l,a,s,this.end)},n.prototype.add=function(e,t){return new n(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},n.prototype.reverse=function(){return new n(this.end,this.endControl,this.startControl,this.start)},n}(),Os=function(n){return n.type===1},jce=function(){function n(e){var t=e.styles,r=e.bounds,i=Bg(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Bg(t.borderTopRightRadius,r.width,r.height),l=a[0],A=a[1],c=Bg(t.borderBottomRightRadius,r.width,r.height),u=c[0],h=c[1],d=Bg(t.borderBottomLeftRadius,r.width,r.height),p=d[0],f=d[1],g=[];g.push((s+l)/r.width),g.push((p+u)/r.width),g.push((o+f)/r.height),g.push((A+h)/r.height);var m=Math.max.apply(Math,g);m>1&&(s/=m,o/=m,l/=m,A/=m,u/=m,h/=m,p/=m,f/=m);var v=r.width-l,w=r.height-h,B=r.width-u,C=r.height-f,b=t.borderTopWidth,F=t.borderRightWidth,x=t.borderBottomWidth,_=t.borderLeftWidth,M=dn(t.paddingTop,e.bounds.width),Y=dn(t.paddingRight,e.bounds.width),O=dn(t.paddingBottom,e.bounds.width),U=dn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?wn(r.left+_/3,r.top+b/3,s-_/3,o-b/3,Xt.TOP_LEFT):new ze(r.left+_/3,r.top+b/3),this.topRightBorderDoubleOuterBox=s>0||o>0?wn(r.left+v,r.top+b/3,l-F/3,A-b/3,Xt.TOP_RIGHT):new ze(r.left+r.width-F/3,r.top+b/3),this.bottomRightBorderDoubleOuterBox=u>0||h>0?wn(r.left+B,r.top+w,u-F/3,h-x/3,Xt.BOTTOM_RIGHT):new ze(r.left+r.width-F/3,r.top+r.height-x/3),this.bottomLeftBorderDoubleOuterBox=p>0||f>0?wn(r.left+_/3,r.top+C,p-_/3,f-x/3,Xt.BOTTOM_LEFT):new ze(r.left+_/3,r.top+r.height-x/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?wn(r.left+_*2/3,r.top+b*2/3,s-_*2/3,o-b*2/3,Xt.TOP_LEFT):new ze(r.left+_*2/3,r.top+b*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?wn(r.left+v,r.top+b*2/3,l-F*2/3,A-b*2/3,Xt.TOP_RIGHT):new ze(r.left+r.width-F*2/3,r.top+b*2/3),this.bottomRightBorderDoubleInnerBox=u>0||h>0?wn(r.left+B,r.top+w,u-F*2/3,h-x*2/3,Xt.BOTTOM_RIGHT):new ze(r.left+r.width-F*2/3,r.top+r.height-x*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||f>0?wn(r.left+_*2/3,r.top+C,p-_*2/3,f-x*2/3,Xt.BOTTOM_LEFT):new ze(r.left+_*2/3,r.top+r.height-x*2/3),this.topLeftBorderStroke=s>0||o>0?wn(r.left+_/2,r.top+b/2,s-_/2,o-b/2,Xt.TOP_LEFT):new ze(r.left+_/2,r.top+b/2),this.topRightBorderStroke=s>0||o>0?wn(r.left+v,r.top+b/2,l-F/2,A-b/2,Xt.TOP_RIGHT):new ze(r.left+r.width-F/2,r.top+b/2),this.bottomRightBorderStroke=u>0||h>0?wn(r.left+B,r.top+w,u-F/2,h-x/2,Xt.BOTTOM_RIGHT):new ze(r.left+r.width-F/2,r.top+r.height-x/2),this.bottomLeftBorderStroke=p>0||f>0?wn(r.left+_/2,r.top+C,p-_/2,f-x/2,Xt.BOTTOM_LEFT):new ze(r.left+_/2,r.top+r.height-x/2),this.topLeftBorderBox=s>0||o>0?wn(r.left,r.top,s,o,Xt.TOP_LEFT):new ze(r.left,r.top),this.topRightBorderBox=l>0||A>0?wn(r.left+v,r.top,l,A,Xt.TOP_RIGHT):new ze(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||h>0?wn(r.left+B,r.top+w,u,h,Xt.BOTTOM_RIGHT):new ze(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||f>0?wn(r.left,r.top+C,p,f,Xt.BOTTOM_LEFT):new ze(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?wn(r.left+_,r.top+b,Math.max(0,s-_),Math.max(0,o-b),Xt.TOP_LEFT):new ze(r.left+_,r.top+b),this.topRightPaddingBox=l>0||A>0?wn(r.left+Math.min(v,r.width-F),r.top+b,v>r.width+F?0:Math.max(0,l-F),Math.max(0,A-b),Xt.TOP_RIGHT):new ze(r.left+r.width-F,r.top+b),this.bottomRightPaddingBox=u>0||h>0?wn(r.left+Math.min(B,r.width-_),r.top+Math.min(w,r.height-x),Math.max(0,u-F),Math.max(0,h-x),Xt.BOTTOM_RIGHT):new ze(r.left+r.width-F,r.top+r.height-x),this.bottomLeftPaddingBox=p>0||f>0?wn(r.left+_,r.top+Math.min(C,r.height-x),Math.max(0,p-_),Math.max(0,f-x),Xt.BOTTOM_LEFT):new ze(r.left+_,r.top+r.height-x),this.topLeftContentBox=s>0||o>0?wn(r.left+_+U,r.top+b+M,Math.max(0,s-(_+U)),Math.max(0,o-(b+M)),Xt.TOP_LEFT):new ze(r.left+_+U,r.top+b+M),this.topRightContentBox=l>0||A>0?wn(r.left+Math.min(v,r.width+_+U),r.top+b+M,v>r.width+_+U?0:l-_+U,A-(b+M),Xt.TOP_RIGHT):new ze(r.left+r.width-(F+Y),r.top+b+M),this.bottomRightContentBox=u>0||h>0?wn(r.left+Math.min(B,r.width-(_+U)),r.top+Math.min(w,r.height+b+M),Math.max(0,u-(F+Y)),h-(x+O),Xt.BOTTOM_RIGHT):new ze(r.left+r.width-(F+Y),r.top+r.height-(x+O)),this.bottomLeftContentBox=p>0||f>0?wn(r.left+_+U,r.top+C,Math.max(0,p-(_+U)),f-(x+O),Xt.BOTTOM_LEFT):new ze(r.left+_+U,r.top+r.height-(x+O))}return n}(),Xt;(function(n){n[n.TOP_LEFT=0]="TOP_LEFT",n[n.TOP_RIGHT=1]="TOP_RIGHT",n[n.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",n[n.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Xt||(Xt={}));var wn=function(n,e,t,r,i){var s=4*((Math.sqrt(2)-1)/3),o=t*s,a=r*s,l=n+t,A=e+r;switch(i){case Xt.TOP_LEFT:return new ty(new ze(n,A),new ze(n,A-a),new ze(l-o,e),new ze(l,e));case Xt.TOP_RIGHT:return new ty(new ze(n,e),new ze(n+o,e),new ze(l,A-a),new ze(l,A));case Xt.BOTTOM_RIGHT:return new ty(new ze(l,e),new ze(l,e+a),new ze(n+o,A),new ze(n,A));case Xt.BOTTOM_LEFT:default:return new ty(new ze(l,A),new ze(l-o,A),new ze(n,e+a),new ze(n,e))}},LB=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},Kce=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},VB=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},$ce=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),ny=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),qce=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),eue=function(n){return n.type===0},gJ=function(n){return n.type===1},tue=function(n){return n.type===2},kk=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},nue=function(n,e,t,r,i){return n.map(function(s,o){switch(o){case 0:return s.add(e,t);case 1:return s.add(e+r,t);case 2:return s.add(e+r,t+i);case 3:return s.add(e,t+i)}return s})},mJ=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),vJ=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new jce(this.container),this.container.styles.opacity<1&&this.effects.push(new qce(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new $ce(r,i,s))}if(this.container.styles.overflowX!==0){var o=LB(this.curves),a=VB(this.curves);kk(o,a)?this.effects.push(new ny(o,6)):(this.effects.push(new ny(o,2)),this.effects.push(new ny(a,4)))}}return n.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,i=this.effects.slice(0);r;){var s=r.effects.filter(function(l){return!gJ(l)});if(t||r.container.styles.position!==0||!r.parent){if(i.unshift.apply(i,s),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var o=LB(r.curves),a=VB(r.curves);kk(o,a)||i.unshift(new ny(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return gr(l.target,e)})},n}(),e_=function(n,e,t,r){n.container.elements.forEach(function(i){var s=gr(i.flags,4),o=gr(i.flags,2),a=new vJ(i,n);gr(i.styles.display,2048)&&r.push(a);var l=gr(i.flags,8)?[]:r;if(s||o){var A=s||i.styles.isPositioned()?t:e,c=new mJ(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var h=0;A.negativeZIndex.some(function(p,f){return u>p.element.container.styles.zIndex.order?(h=f,!1):h>0}),A.negativeZIndex.splice(h,0,c)}else if(u>0){var d=0;A.positiveZIndex.some(function(p,f){return u>=p.element.container.styles.zIndex.order?(d=f+1,!1):d>0}),A.positiveZIndex.splice(d,0,c)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else i.styles.isFloating()?A.nonPositionedFloats.push(c):A.nonPositionedInlineLevel.push(c);e_(a,c,s?c:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),e_(a,e,t,l);gr(i.flags,8)&&yJ(i,l)})},yJ=function(n,e){for(var t=n instanceof qE?n.start:1,r=n instanceof qE?n.reversed:!1,i=0;i"u"?n[0]:t},cue=function(n,e,t,r,i){var s=e[0],o=e[1],a=t[0],l=t[1];switch(n){case 2:return[new ze(Math.round(r.left),Math.round(r.top+o)),new ze(Math.round(r.left+r.width),Math.round(r.top+o)),new ze(Math.round(r.left+r.width),Math.round(l+r.top+o)),new ze(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new ze(Math.round(r.left+s),Math.round(r.top)),new ze(Math.round(r.left+s+a),Math.round(r.top)),new ze(Math.round(r.left+s+a),Math.round(r.height+r.top)),new ze(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new ze(Math.round(r.left+s),Math.round(r.top+o)),new ze(Math.round(r.left+s+a),Math.round(r.top+o)),new ze(Math.round(r.left+s+a),Math.round(r.top+o+l)),new ze(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new ze(Math.round(i.left),Math.round(i.top)),new ze(Math.round(i.left+i.width),Math.round(i.top)),new ze(Math.round(i.left+i.width),Math.round(i.height+i.top)),new ze(Math.round(i.left),Math.round(i.height+i.top))]}},uue="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Lk="Hidden Text",due=function(){function n(e){this._data={},this._document=e}return n.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),i=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),i.src=uue,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=t,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Lk)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(Lk)),r.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:a,middle:l}},n.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},n}(),BJ=function(){function n(e,t){this.context=e,this.options=t}return n}(),hue=1e4;(function(n){Vo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i._activeEffects=[],i.canvas=r.canvas?r.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),r.canvas||(i.canvas.width=Math.floor(r.width*r.scale),i.canvas.height=Math.floor(r.height*r.scale),i.canvas.style.width=r.width+"px",i.canvas.style.height=r.height+"px"),i.fontMetrics=new due(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-r.x,-r.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),i}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return r.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),tue(t)&&(this.ctx.globalAlpha=t.opacity),eue(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),gJ(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Rs(this,void 0,void 0,function(){var r;return Hi(this,function(i){switch(i.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Rs(this,void 0,void 0,function(){return Hi(this,function(r){switch(r.label){case 0:if(gr(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,i){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var o=$U(t.text);o.reduce(function(a,l){return s.ctx.fillText(l,a,t.bounds.top+i),a+s.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),i=vue(t.fontFamily).join(", "),s=B0(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,s,i].join(" "),i,s]},e.prototype.renderTextNode=function(t,r){return Rs(this,void 0,void 0,function(){var i,s,o,a,l,A,c,u,h=this;return Hi(this,function(d){return i=this.createFontStyle(r),s=i[0],o=i[1],a=i[2],this.ctx.font=s,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(o,a),A=l.baseline,c=l.middle,u=r.paintOrder,t.textBounds.forEach(function(p){u.forEach(function(f){switch(f){case 0:h.ctx.fillStyle=Br(r.color),h.renderTextWithLetterSpacing(p,r.letterSpacing,A);var g=r.textShadow;g.length&&p.text.trim().length&&(g.slice(0).reverse().forEach(function(m){h.ctx.shadowColor=Br(m.color),h.ctx.shadowOffsetX=m.offsetX.number*h.options.scale,h.ctx.shadowOffsetY=m.offsetY.number*h.options.scale,h.ctx.shadowBlur=m.blur.number,h.renderTextWithLetterSpacing(p,r.letterSpacing,A)}),h.ctx.shadowColor="",h.ctx.shadowOffsetX=0,h.ctx.shadowOffsetY=0,h.ctx.shadowBlur=0),r.textDecorationLine.length&&(h.ctx.fillStyle=Br(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(m){switch(m){case 1:h.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+A),p.bounds.width,1);break;case 2:h.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:h.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+c),p.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&p.text.trim().length&&(h.ctx.strokeStyle=Br(r.webkitTextStrokeColor),h.ctx.lineWidth=r.webkitTextStrokeWidth,h.ctx.lineJoin=window.chrome?"miter":"round",h.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+A)),h.ctx.strokeStyle="",h.ctx.lineWidth=0,h.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,i){if(i&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var s=PB(t),o=VB(r);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Rs(this,void 0,void 0,function(){var r,i,s,o,a,l,v,v,A,c,u,h,B,d,p,C,f,g,m,v,w,B,C;return Hi(this,function(b){switch(b.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,b.label=1;case 1:return o0&&y>0&&(x=s.ctx.createPattern(C,"repeat"),s.renderRepeat(M,x,R,N))):mle(c)&&(_=tI(t,r,[null,null,null]),M=_[0],Y=_[1],O=_[2],U=_[3],y=_[4],I=c.position.length===0?[XU]:c.position,R=dn(I[0],U),N=dn(I[I.length-1],y),k=dle(c,R,N,U,y),L=k[0],G=k[1],L>0&&G>0&&(D=s.ctx.createRadialGradient(Y+R,O+N,0,Y+R,O+N,L),uk(c.stops,L*2).forEach(function(pe){return D.addColorStop(pe.stop,Br(pe.color))}),s.path(M),s.ctx.fillStyle=D,L!==G?(E=t.bounds.left+.5*t.bounds.width,z=t.bounds.top+.5*t.bounds.height,re=G/L,T=1/re,s.ctx.save(),s.ctx.translate(E,z),s.ctx.transform(1,0,0,re,0,0),s.ctx.translate(-E,-z),s.ctx.fillRect(Y,T*(O-z)+z,U,y*T),s.ctx.restore()):s.ctx.fill())),ee.label=6;case 6:return r--,[2]}})},s=this,o=0,a=t.styles.backgroundImage.slice(0).reverse(),A.label=1;case 1:return o0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,a,t.curves,2)]:[3,11]):[3,13];case 4:return h.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,a,t.curves,3)];case 6:return h.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,a,t.curves)];case 8:return h.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,a,t.curves)];case 10:h.sent(),h.label=11;case 11:a++,h.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,i,s,o){return Rs(this,void 0,void 0,function(){var a,l,A,c,u,h,d,p,f,g,m,v,w,B,C,b,C,b;return Hi(this,function(F){return this.ctx.save(),a=oue(s,i),l=Dk(s,i),o===2&&(this.path(l),this.ctx.clip()),Os(l[0])?(A=l[0].start.x,c=l[0].start.y):(A=l[0].x,c=l[0].y),Os(l[1])?(u=l[1].end.x,h=l[1].end.y):(u=l[1].x,h=l[1].y),i===0||i===2?d=Math.abs(A-u):d=Math.abs(c-h),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),p=r<3?r*3:r*2,f=r<3?r*2:r,o===3&&(p=r,f=r),g=!0,d<=p*2?g=!1:d<=p*2+f?(m=d/(2*p+f),p*=m,f*=m):(v=Math.floor((d+f)/(p+f)),w=(d-v*p)/(v-1),B=(d-(v+1)*p)/v,f=B<=0||Math.abs(f-w){var a,l;const A=(a=t.materials)===null||a===void 0?void 0:a[o];if(A==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${o}] of glTF but the material doesn't exist`);return}if(s.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(s,A);t.materials[o]=c}else if(!((l=s.shader)===null||l===void 0)&&l.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(s,A);t.materials[o]=c}else s.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${s.shader}`)}))})}_parseV0MToonProperties(e,t){var r,i,s,o,a,l,A,c,u,h,d,p,f,g,m,v,w,B,C,b,F,x,_,M,Y,O,U,y,I,R,N,k,V,G,D,E,z,re,T,ee,pe,de,Ae,$;const ce=(i=(r=e.keywordMap)===null||r===void 0?void 0:r._ALPHABLEND_ON)!==null&&i!==void 0?i:!1,Fe=((s=e.floatProperties)===null||s===void 0?void 0:s._ZWrite)===1&&ce,P=this._v0ParseRenderQueue(e),fe=(a=(o=e.keywordMap)===null||o===void 0?void 0:o._ALPHATEST_ON)!==null&&a!==void 0?a:!1,ue=ce?"BLEND":fe?"MASK":"OPAQUE",q=fe?(l=e.floatProperties)===null||l===void 0?void 0:l._Cutoff:void 0,oe=((c=(A=e.floatProperties)===null||A===void 0?void 0:A._CullMode)!==null&&c!==void 0?c:2)===0,ye=this._portTextureTransform(e),be=(h=(u=e.vectorProperties)===null||u===void 0?void 0:u._Color)===null||h===void 0?void 0:h.map((Ie,We)=>We===3?Ie:xd(Ie)),W=(d=e.textureProperties)===null||d===void 0?void 0:d._MainTex,H=W!=null?{index:W,extensions:Object.assign({},ye)}:void 0,ie=(p=e.floatProperties)===null||p===void 0?void 0:p._BumpScale,ae=(f=e.textureProperties)===null||f===void 0?void 0:f._BumpMap,me=ae!=null?{index:ae,scale:ie,extensions:Object.assign({},ye)}:void 0,J=(m=(g=e.vectorProperties)===null||g===void 0?void 0:g._EmissionColor)===null||m===void 0?void 0:m.map(xd),Q=(v=e.textureProperties)===null||v===void 0?void 0:v._EmissionMap,S=Q!=null?{index:Q,extensions:Object.assign({},ye)}:void 0,Z=(B=(w=e.vectorProperties)===null||w===void 0?void 0:w._ShadeColor)===null||B===void 0?void 0:B.map(xd),te=(C=e.textureProperties)===null||C===void 0?void 0:C._ShadeTexture,le=te!=null?{index:te,extensions:Object.assign({},ye)}:void 0;let se=(F=(b=e.floatProperties)===null||b===void 0?void 0:b._ShadeShift)!==null&&F!==void 0?F:0,Ue=(_=(x=e.floatProperties)===null||x===void 0?void 0:x._ShadeToony)!==null&&_!==void 0?_:.9;Ue=Wt.lerp(Ue,1,.5+.5*se),se=-se-(1-Ue);const _e=(M=e.floatProperties)===null||M===void 0?void 0:M._IndirectLightIntensity,Te=_e?1-_e:void 0,Pe=(Y=e.textureProperties)===null||Y===void 0?void 0:Y._SphereAdd,ke=Pe!=null?[1,1,1]:void 0,he=Pe!=null?{index:Pe}:void 0,Ee=(O=e.floatProperties)===null||O===void 0?void 0:O._RimLightingMix,Se=(U=e.textureProperties)===null||U===void 0?void 0:U._RimTexture,Re=Se!=null?{index:Se,extensions:Object.assign({},ye)}:void 0,Je=(I=(y=e.vectorProperties)===null||y===void 0?void 0:y._RimColor)===null||I===void 0?void 0:I.map(xd),qe=(R=e.floatProperties)===null||R===void 0?void 0:R._RimFresnelPower,dt=(N=e.floatProperties)===null||N===void 0?void 0:N._RimLift,cn=["none","worldCoordinates","screenCoordinates"][(V=(k=e.floatProperties)===null||k===void 0?void 0:k._OutlineWidthMode)!==null&&V!==void 0?V:0];let Et=(D=(G=e.floatProperties)===null||G===void 0?void 0:G._OutlineWidth)!==null&&D!==void 0?D:0;Et=.01*Et;const st=(E=e.textureProperties)===null||E===void 0?void 0:E._OutlineWidthTexture,Ar=st!=null?{index:st,extensions:Object.assign({},ye)}:void 0,wt=(re=(z=e.vectorProperties)===null||z===void 0?void 0:z._OutlineColor)===null||re===void 0?void 0:re.map(xd),co=((T=e.floatProperties)===null||T===void 0?void 0:T._OutlineColorMode)===1?(ee=e.floatProperties)===null||ee===void 0?void 0:ee._OutlineLightingMix:0,Yt=(pe=e.textureProperties)===null||pe===void 0?void 0:pe._UvAnimMaskTexture,en=Yt!=null?{index:Yt,extensions:Object.assign({},ye)}:void 0,ne=(de=e.floatProperties)===null||de===void 0?void 0:de._UvAnimScrollX;let ve=(Ae=e.floatProperties)===null||Ae===void 0?void 0:Ae._UvAnimScrollY;ve!=null&&(ve=-ve);const xe=($=e.floatProperties)===null||$===void 0?void 0:$._UvAnimRotation,Ce={specVersion:"1.0",transparentWithZWrite:Fe,renderQueueOffsetNumber:P,shadeColorFactor:Z,shadeMultiplyTexture:le,shadingShiftFactor:se,shadingToonyFactor:Ue,giEqualizationFactor:Te,matcapFactor:ke,matcapTexture:he,rimLightingMixFactor:Ee,rimMultiplyTexture:Re,parametricRimColorFactor:Je,parametricRimFresnelPowerFactor:qe,parametricRimLiftFactor:dt,outlineWidthMode:cn,outlineWidthFactor:Et,outlineWidthMultiplyTexture:Ar,outlineColorFactor:wt,outlineLightingMixFactor:co,uvAnimationMaskTexture:en,uvAnimationScrollXSpeedFactor:ne,uvAnimationScrollYSpeedFactor:ve,uvAnimationRotationSpeedFactor:xe};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:be,baseColorTexture:H},normalTexture:me,emissiveTexture:S,emissiveFactor:J,alphaMode:ue,alphaCutoff:q,doubleSided:oe,extensions:{VRMC_materials_mtoon:Ce}})}_parseV0UnlitProperties(e,t){var r,i,s,o;const a=e.shader==="VRM/UnlitTransparentZWrite",l=e.shader==="VRM/UnlitTransparent"||a,A=this._v0ParseRenderQueue(e),c=e.shader==="VRM/UnlitCutout",u=l?"BLEND":c?"MASK":"OPAQUE",h=c?(r=e.floatProperties)===null||r===void 0?void 0:r._Cutoff:void 0,d=this._portTextureTransform(e),p=(s=(i=e.vectorProperties)===null||i===void 0?void 0:i._Color)===null||s===void 0?void 0:s.map(xd),f=(o=e.textureProperties)===null||o===void 0?void 0:o._MainTex,g=f!=null?{index:f,extensions:Object.assign({},d)}:void 0,m={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:A,shadeColorFactor:p,shadeMultiplyTexture:g};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:p,baseColorTexture:g},alphaMode:u,alphaCutoff:h,extensions:{VRMC_materials_mtoon:m}})}_portTextureTransform(e){var t,r,i,s,o;const a=(t=e.vectorProperties)===null||t===void 0?void 0:t._MainTex;if(a==null)return{};const l=[(r=a==null?void 0:a[0])!==null&&r!==void 0?r:0,(i=a==null?void 0:a[1])!==null&&i!==void 0?i:0],A=[(s=a==null?void 0:a[2])!==null&&s!==void 0?s:1,(o=a==null?void 0:a[3])!==null&&o!==void 0?o:1];return l[1]=A[1]*(1-l[1])%1,{KHR_texture_transform:{offset:l,scale:A}}}_v0ParseRenderQueue(e){var t,r,i;const s=(r=(t=e.keywordMap)===null||t===void 0?void 0:t._ALPHABLEND_ON)!==null&&r!==void 0?r:!1,o=((i=e.floatProperties)===null||i===void 0?void 0:i._ZWrite)===1;let a=0;if(s){const l=e.renderQueue;l!=null&&(o?a=this._renderQueueMapTransparentZWrite.get(l):a=this._renderQueueMapTransparent.get(l))}return a}_populateRenderQueueMap(e){const t=new Set,r=new Set;e.forEach(i=>{var s,o,a;const l=(o=(s=i.keywordMap)===null||s===void 0?void 0:s._ALPHABLEND_ON)!==null&&o!==void 0?o:!1,A=((a=i.floatProperties)===null||a===void 0?void 0:a._ZWrite)===1;if(l){const c=i.renderQueue;c!=null&&(A?r.add(c):t.add(c))}}),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),r.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${r.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(t).sort().forEach((i,s)=>{const o=Math.min(Math.max(s-t.size+1,-9),0);this._renderQueueMapTransparent.set(i,o)}),Array.from(r).sort().forEach((i,s)=>{const o=Math.min(Math.max(s,0),9);this._renderQueueMapTransparentZWrite.set(i,o)})}}/*! + */function cde(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function xd(n){return Math.pow(n,2.2)}class ude{constructor(e){var t;this.parser=e,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const r=this.parser.json;r.extensionsUsed=(t=r.extensionsUsed)!==null&&t!==void 0?t:[],r.extensionsUsed.indexOf("KHR_texture_transform")===-1&&r.extensionsUsed.push("KHR_texture_transform")}get name(){return"VRMMaterialsV0CompatPlugin"}beforeRoot(){var e;return cde(this,void 0,void 0,function*(){const t=this.parser.json,r=(e=t.extensions)===null||e===void 0?void 0:e.VRM,i=r==null?void 0:r.materialProperties;i&&(this._populateRenderQueueMap(i),i.forEach((s,o)=>{var a,l;const A=(a=t.materials)===null||a===void 0?void 0:a[o];if(A==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${o}] of glTF but the material doesn't exist`);return}if(s.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(s,A);t.materials[o]=c}else if(!((l=s.shader)===null||l===void 0)&&l.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(s,A);t.materials[o]=c}else s.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${s.shader}`)}))})}_parseV0MToonProperties(e,t){var r,i,s,o,a,l,A,c,u,h,d,p,f,g,m,v,w,B,C,b,F,x,_,M,Y,O,U,y,I,R,N,k,L,G,D,E,z,re,T,ee,pe,de,Ae,$;const ce=(i=(r=e.keywordMap)===null||r===void 0?void 0:r._ALPHABLEND_ON)!==null&&i!==void 0?i:!1,Fe=((s=e.floatProperties)===null||s===void 0?void 0:s._ZWrite)===1&&ce,P=this._v0ParseRenderQueue(e),fe=(a=(o=e.keywordMap)===null||o===void 0?void 0:o._ALPHATEST_ON)!==null&&a!==void 0?a:!1,ue=ce?"BLEND":fe?"MASK":"OPAQUE",q=fe?(l=e.floatProperties)===null||l===void 0?void 0:l._Cutoff:void 0,oe=((c=(A=e.floatProperties)===null||A===void 0?void 0:A._CullMode)!==null&&c!==void 0?c:2)===0,ye=this._portTextureTransform(e),be=(h=(u=e.vectorProperties)===null||u===void 0?void 0:u._Color)===null||h===void 0?void 0:h.map((Ie,We)=>We===3?Ie:xd(Ie)),W=(d=e.textureProperties)===null||d===void 0?void 0:d._MainTex,H=W!=null?{index:W,extensions:Object.assign({},ye)}:void 0,ie=(p=e.floatProperties)===null||p===void 0?void 0:p._BumpScale,ae=(f=e.textureProperties)===null||f===void 0?void 0:f._BumpMap,me=ae!=null?{index:ae,scale:ie,extensions:Object.assign({},ye)}:void 0,J=(m=(g=e.vectorProperties)===null||g===void 0?void 0:g._EmissionColor)===null||m===void 0?void 0:m.map(xd),Q=(v=e.textureProperties)===null||v===void 0?void 0:v._EmissionMap,S=Q!=null?{index:Q,extensions:Object.assign({},ye)}:void 0,Z=(B=(w=e.vectorProperties)===null||w===void 0?void 0:w._ShadeColor)===null||B===void 0?void 0:B.map(xd),te=(C=e.textureProperties)===null||C===void 0?void 0:C._ShadeTexture,le=te!=null?{index:te,extensions:Object.assign({},ye)}:void 0;let se=(F=(b=e.floatProperties)===null||b===void 0?void 0:b._ShadeShift)!==null&&F!==void 0?F:0,Ue=(_=(x=e.floatProperties)===null||x===void 0?void 0:x._ShadeToony)!==null&&_!==void 0?_:.9;Ue=Wt.lerp(Ue,1,.5+.5*se),se=-se-(1-Ue);const _e=(M=e.floatProperties)===null||M===void 0?void 0:M._IndirectLightIntensity,Te=_e?1-_e:void 0,Pe=(Y=e.textureProperties)===null||Y===void 0?void 0:Y._SphereAdd,ke=Pe!=null?[1,1,1]:void 0,he=Pe!=null?{index:Pe}:void 0,Ee=(O=e.floatProperties)===null||O===void 0?void 0:O._RimLightingMix,Se=(U=e.textureProperties)===null||U===void 0?void 0:U._RimTexture,Re=Se!=null?{index:Se,extensions:Object.assign({},ye)}:void 0,Je=(I=(y=e.vectorProperties)===null||y===void 0?void 0:y._RimColor)===null||I===void 0?void 0:I.map(xd),qe=(R=e.floatProperties)===null||R===void 0?void 0:R._RimFresnelPower,dt=(N=e.floatProperties)===null||N===void 0?void 0:N._RimLift,cn=["none","worldCoordinates","screenCoordinates"][(L=(k=e.floatProperties)===null||k===void 0?void 0:k._OutlineWidthMode)!==null&&L!==void 0?L:0];let Et=(D=(G=e.floatProperties)===null||G===void 0?void 0:G._OutlineWidth)!==null&&D!==void 0?D:0;Et=.01*Et;const st=(E=e.textureProperties)===null||E===void 0?void 0:E._OutlineWidthTexture,Ar=st!=null?{index:st,extensions:Object.assign({},ye)}:void 0,wt=(re=(z=e.vectorProperties)===null||z===void 0?void 0:z._OutlineColor)===null||re===void 0?void 0:re.map(xd),co=((T=e.floatProperties)===null||T===void 0?void 0:T._OutlineColorMode)===1?(ee=e.floatProperties)===null||ee===void 0?void 0:ee._OutlineLightingMix:0,Yt=(pe=e.textureProperties)===null||pe===void 0?void 0:pe._UvAnimMaskTexture,en=Yt!=null?{index:Yt,extensions:Object.assign({},ye)}:void 0,ne=(de=e.floatProperties)===null||de===void 0?void 0:de._UvAnimScrollX;let ve=(Ae=e.floatProperties)===null||Ae===void 0?void 0:Ae._UvAnimScrollY;ve!=null&&(ve=-ve);const xe=($=e.floatProperties)===null||$===void 0?void 0:$._UvAnimRotation,Ce={specVersion:"1.0",transparentWithZWrite:Fe,renderQueueOffsetNumber:P,shadeColorFactor:Z,shadeMultiplyTexture:le,shadingShiftFactor:se,shadingToonyFactor:Ue,giEqualizationFactor:Te,matcapFactor:ke,matcapTexture:he,rimLightingMixFactor:Ee,rimMultiplyTexture:Re,parametricRimColorFactor:Je,parametricRimFresnelPowerFactor:qe,parametricRimLiftFactor:dt,outlineWidthMode:cn,outlineWidthFactor:Et,outlineWidthMultiplyTexture:Ar,outlineColorFactor:wt,outlineLightingMixFactor:co,uvAnimationMaskTexture:en,uvAnimationScrollXSpeedFactor:ne,uvAnimationScrollYSpeedFactor:ve,uvAnimationRotationSpeedFactor:xe};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:be,baseColorTexture:H},normalTexture:me,emissiveTexture:S,emissiveFactor:J,alphaMode:ue,alphaCutoff:q,doubleSided:oe,extensions:{VRMC_materials_mtoon:Ce}})}_parseV0UnlitProperties(e,t){var r,i,s,o;const a=e.shader==="VRM/UnlitTransparentZWrite",l=e.shader==="VRM/UnlitTransparent"||a,A=this._v0ParseRenderQueue(e),c=e.shader==="VRM/UnlitCutout",u=l?"BLEND":c?"MASK":"OPAQUE",h=c?(r=e.floatProperties)===null||r===void 0?void 0:r._Cutoff:void 0,d=this._portTextureTransform(e),p=(s=(i=e.vectorProperties)===null||i===void 0?void 0:i._Color)===null||s===void 0?void 0:s.map(xd),f=(o=e.textureProperties)===null||o===void 0?void 0:o._MainTex,g=f!=null?{index:f,extensions:Object.assign({},d)}:void 0,m={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:A,shadeColorFactor:p,shadeMultiplyTexture:g};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:p,baseColorTexture:g},alphaMode:u,alphaCutoff:h,extensions:{VRMC_materials_mtoon:m}})}_portTextureTransform(e){var t,r,i,s,o;const a=(t=e.vectorProperties)===null||t===void 0?void 0:t._MainTex;if(a==null)return{};const l=[(r=a==null?void 0:a[0])!==null&&r!==void 0?r:0,(i=a==null?void 0:a[1])!==null&&i!==void 0?i:0],A=[(s=a==null?void 0:a[2])!==null&&s!==void 0?s:1,(o=a==null?void 0:a[3])!==null&&o!==void 0?o:1];return l[1]=A[1]*(1-l[1])%1,{KHR_texture_transform:{offset:l,scale:A}}}_v0ParseRenderQueue(e){var t,r,i;const s=(r=(t=e.keywordMap)===null||t===void 0?void 0:t._ALPHABLEND_ON)!==null&&r!==void 0?r:!1,o=((i=e.floatProperties)===null||i===void 0?void 0:i._ZWrite)===1;let a=0;if(s){const l=e.renderQueue;l!=null&&(o?a=this._renderQueueMapTransparentZWrite.get(l):a=this._renderQueueMapTransparent.get(l))}return a}_populateRenderQueueMap(e){const t=new Set,r=new Set;e.forEach(i=>{var s,o,a;const l=(o=(s=i.keywordMap)===null||s===void 0?void 0:s._ALPHABLEND_ON)!==null&&o!==void 0?o:!1,A=((a=i.floatProperties)===null||a===void 0?void 0:a._ZWrite)===1;if(l){const c=i.renderQueue;c!=null&&(A?r.add(c):t.add(c))}}),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),r.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${r.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(t).sort().forEach((i,s)=>{const o=Math.min(Math.max(s-t.size+1,-9),0);this._renderQueueMapTransparent.set(i,o)}),Array.from(r).sort().forEach((i,s)=>{const o=Math.min(Math.max(s,0),9);this._renderQueueMapTransparentZWrite.set(i,o)})}}/*! * @pixiv/three-vrm-node-constraint v1.0.9 * Node constraint module for @pixiv/three-vrm * @@ -4104,7 +4104,7 @@ void main() { * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */class IJ{}const AI=new j,Mc=new j;class FJ extends IJ{constructor(e){var t,r,i;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new j(0,0,0),this.tail=(r=e==null?void 0:e.tail)!==null&&r!==void 0?r:new j(0,0,0),this.radius=(i=e==null?void 0:e.radius)!==null&&i!==void 0?i:0}get type(){return"capsule"}calculateCollision(e,t,r,i){AI.copy(this.offset).applyMatrix4(e),Mc.copy(this.tail).applyMatrix4(e),Mc.sub(AI);const s=Mc.lengthSq();i.copy(t).sub(AI);const o=Mc.dot(i);o<=0||(s<=o||Mc.multiplyScalar(o/s),i.sub(Mc));const a=r+this.radius,l=i.length()-a;return i.normalize(),l}}class EJ extends IJ{constructor(e){var t,r;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new j(0,0,0),this.radius=(r=e==null?void 0:e.radius)!==null&&r!==void 0?r:0}get type(){return"sphere"}calculateCollision(e,t,r,i){i.copy(this.offset).applyMatrix4(e),i.negate().add(t);const s=r+this.radius,o=i.length()-s;return i.normalize(),o}}const Yo=new j;class Rde extends Ht{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new j,this._currentTail=new j,this._shape=e,this._attrPos=new ut(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ut(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);const r=Yo.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(r)>1e-10&&(this._currentTail.copy(r),e=!0),e&&this._buildPosition()}_buildPosition(){Yo.copy(this._currentTail).sub(this._currentOffset);const e=Yo.length()/this._currentRadius;for(let i=0;i<=16;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+i,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+i,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+i,e+Math.sin(s),0,Math.cos(s))}for(let i=0;i<32;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(s),Math.cos(s)),this._attrPos.setXYZ(100+i,e,Math.sin(s),Math.cos(s))}const t=Math.atan2(Yo.y,Math.sqrt(Yo.x*Yo.x+Yo.z*Yo.z)),r=-Math.atan2(Yo.z,Yo.x);this.rotateZ(t),this.rotateY(r),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(68+e*2,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+t),this._attrIndex.setXY(200+e*2,100+e,100+t)}this._attrIndex.needsUpdate=!0}}class Mde extends Ht{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new j,this._shape=e,this._attrPos=new ut(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ut(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.needsUpdate=!0}}const Tde=new j;class sD extends kr{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof EJ)this._geometry=new Mde(this.collider.shape);else if(this.collider.shape instanceof FJ)this._geometry=new Rde(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new zl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new f0(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=Tde.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class Nde extends Ht{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new j,this._springBone=e,this._attrPos=new ut(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ut(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const kde=new j;class Dde extends kr{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new Nde(this.springBone);const t=new zl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new f0(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=kde.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class oD extends Rt{constructor(e){super(),this.shape=e}}const Lde=new He;function _J(n){return n.invert?n.invert():n.getInverse(Lde.copy(n)),n}class Vde{constructor(e){this._inverseCache=new He,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(r,i,s)=>(this._shouldUpdateInverse=!0,r[i]=s,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),_J(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const Pde=new He,qa=new j,Op=new j,Ode=new j,Id=new j,aD=new j,Wp=new j,lD=new rt,Fd=new He,Wde=new He;class Gde{constructor(e,t,r={},i=[]){var s,o,a,l,A,c;this._currentTail=new j,this._prevTail=new j,this._boneAxis=new j,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new He,this._initialLocalRotation=new rt,this._initialLocalChildPosition=new j,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(s=r.hitRadius)!==null&&s!==void 0?s:0,stiffness:(o=r.stiffness)!==null&&o!==void 0?o:1,gravityPower:(a=r.gravityPower)!==null&&a!==void 0?a:0,gravityDir:(A=(l=r.gravityDir)===null||l===void 0?void 0:l.clone())!==null&&A!==void 0?A:new j(0,-1,0),dragForce:(c=r.dragForce)!==null&&c!==void 0?c:.4},this.colliderGroups=i}get center(){return this._center}set center(e){var t;!((t=this._center)===null||t===void 0)&&t.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new Vde(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:Pde}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const e=this._getMatrixWorldToCenter(Fd);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const e=this._getMatrixWorldToCenter(Fd);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength(),Id.setFromMatrixPosition(this.bone.matrixWorld);let t=this._getMatrixWorldToCenter(Fd);aD.copy(Id).applyMatrix4(t);const r=lD.setFromRotationMatrix(t),i=Wde.copy(t).multiply(this._parentMatrixWorld),s=Op.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(aD).normalize(),o=Ode.copy(this.settings.gravityDir).applyQuaternion(r).normalize(),a=this._getMatrixCenterToWorld(Fd);Wp.copy(this._currentTail).add(qa.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(qa.copy(s).multiplyScalar(this.settings.stiffness*e)).add(qa.copy(o).multiplyScalar(this.settings.gravityPower*e)).applyMatrix4(a),Wp.sub(Id).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Id),this._collision(Wp),t=this._getMatrixWorldToCenter(Fd),this._prevTail.copy(this._currentTail),this._currentTail.copy(qa.copy(Wp).applyMatrix4(t));const l=_J(Fd.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),A=lD.setFromUnitVectors(this._boneAxis,qa.copy(Wp).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(A),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{const i=r.shape.calculateCollision(r.matrixWorld,e,this.settings.hitRadius,qa);i<0&&(e.add(qa.multiplyScalar(-i)),e.sub(Id).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Id))})})}_calcWorldSpaceBoneLength(){qa.setFromMatrixPosition(this.bone.matrixWorld),this.child?Op.setFromMatrixPosition(this.child.matrixWorld):(Op.copy(this._initialLocalChildPosition),Op.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=qa.sub(Op).length()}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}}function ay(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function Zde(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function SJ(n,e){n.children.forEach(t=>{e(t)||SJ(t,e)})}class AD{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(r=>{e.add(r)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{e.add(r)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e)}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e),this._objectSpringBonesMap.get(e.bone).delete(e)}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.setInitState())}reset(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.reset())}update(e){const t=new Set,r=new Set,i=new Set;for(const s of this._joints)this._processSpringBone(s,t,r,i,o=>o.update(e)),SJ(s.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(e,t,r,i,s){if(r.has(e))return;if(t.has(e))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");t.add(e);const o=this._getDependencies(e);for(const a of o)Zde(a,l=>{const A=this._objectSpringBonesMap.get(l);if(A)for(const c of A)this._processSpringBone(c,t,r,i,s);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),s(e),i.add(e.bone),r.add(e)}_getDependencies(e){const t=new Set,r=e.bone.parent;return r&&t.add(r),e.colliderGroups.forEach(i=>{i.colliders.forEach(s=>{t.add(s)})}),t}}const Jde=new Set(["1.0","1.0-beta"]);class nu{constructor(e,t){this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot}get name(){return nu.EXTENSION_NAME}afterRoot(e){return ay(this,void 0,void 0,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return ay(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i,s,o;return ay(this,void 0,void 0,function*(){const a=e.parser.json;if(!(((t=a.extensionsUsed)===null||t===void 0?void 0:t.indexOf(nu.EXTENSION_NAME))!==-1))return null;const A=new AD,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)===null||r===void 0?void 0:r[nu.EXTENSION_NAME];if(!u)return null;const h=u.specVersion;if(!Jde.has(h))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${nu.EXTENSION_NAME} specVersion "${h}"`),null;const d=(i=u.colliders)===null||i===void 0?void 0:i.map((f,g)=>{var m,v,w,B,C;const b=c[f.node],F=f.shape;if(F.sphere)return this._importSphereCollider(b,{offset:new j().fromArray((m=F.sphere.offset)!==null&&m!==void 0?m:[0,0,0]),radius:(v=F.sphere.radius)!==null&&v!==void 0?v:0});if(F.capsule)return this._importCapsuleCollider(b,{offset:new j().fromArray((w=F.capsule.offset)!==null&&w!==void 0?w:[0,0,0]),radius:(B=F.capsule.radius)!==null&&B!==void 0?B:0,tail:new j().fromArray((C=F.capsule.tail)!==null&&C!==void 0?C:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),p=(s=u.colliderGroups)===null||s===void 0?void 0:s.map((f,g)=>{var m;return{colliders:((m=f.colliders)!==null&&m!==void 0?m:[]).map(w=>{const B=d==null?void 0:d[w];if(B==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return B}),name:f.name}});return(o=u.springs)===null||o===void 0||o.forEach((f,g)=>{var m;const v=f.joints,w=(m=f.colliderGroups)===null||m===void 0?void 0:m.map(b=>{const F=p==null?void 0:p[b];if(F==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${b} but not found`);return F}),B=f.center!=null?c[f.center]:void 0;let C;v.forEach(b=>{if(C){const F=C.node,x=c[F],_=b.node,M=c[_],Y={hitRadius:C.hitRadius,dragForce:C.dragForce,gravityPower:C.gravityPower,stiffness:C.stiffness,gravityDir:C.gravityDir!=null?new j().fromArray(C.gravityDir):void 0},O=this._importJoint(x,M,Y,w);B&&(O.center=B),A.addJoint(O)}C=b})}),A.setInitState(),A})}_v0Import(e){var t,r,i;return ay(this,void 0,void 0,function*(){const s=e.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new AD,u=yield e.parser.getDependencies("node"),h=(i=l.colliderGroups)===null||i===void 0?void 0:i.map(d=>{var p;const f=u[d.node];return{colliders:((p=d.colliders)!==null&&p!==void 0?p:[]).map((m,v)=>{var w,B,C;const b=new j(0,0,0);return m.offset&&b.set((w=m.offset.x)!==null&&w!==void 0?w:0,(B=m.offset.y)!==null&&B!==void 0?B:0,m.offset.z?-m.offset.z:0),this._importSphereCollider(f,{offset:b,radius:(C=m.radius)!==null&&C!==void 0?C:0})})}});return A==null||A.forEach((d,p)=>{const f=d.bones;f&&f.forEach(g=>{var m,v,w,B;const C=u[g],b=new j;d.gravityDir?b.set((m=d.gravityDir.x)!==null&&m!==void 0?m:0,(v=d.gravityDir.y)!==null&&v!==void 0?v:0,(w=d.gravityDir.z)!==null&&w!==void 0?w:0):b.set(0,-1,0);const F=d.center!=null?u[d.center]:void 0,x={hitRadius:d.hitRadius,dragForce:d.dragForce,gravityPower:d.gravityPower,stiffness:d.stiffiness,gravityDir:b},_=(B=d.colliderGroups)===null||B===void 0?void 0:B.map(M=>{const Y=h==null?void 0:h[M];if(Y==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${M} but not found`);return Y});C.traverse(M=>{var Y;const O=(Y=M.children[0])!==null&&Y!==void 0?Y:null,U=this._importJoint(M,O,x,_);F&&(U.center=F),c.addJoint(U)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new Gde(e,t,r,i);if(this.jointHelperRoot){const o=new Dde(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const{offset:r,radius:i}=t,s=new EJ({offset:r,radius:i}),o=new oD(s);if(e.add(o),this.colliderHelperRoot){const a=new sD(o);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(e,t){const{offset:r,radius:i,tail:s}=t,o=new FJ({offset:r,radius:i,tail:s}),a=new oD(o);if(e.add(a),this.colliderHelperRoot){const l=new sD(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}}nu.EXTENSION_NAME="VRMC_springBone";class Hde{constructor(e,t){var r,i,s,o,a,l,A,c,u,h;this.parser=e;const d=t==null?void 0:t.helperRoot,p=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(r=t==null?void 0:t.expressionPlugin)!==null&&r!==void 0?r:new gb(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!==null&&i!==void 0?i:new xue(e),this.humanoidPlugin=(s=t==null?void 0:t.humanoidPlugin)!==null&&s!==void 0?s:new Rue(e,{helperRoot:d,autoUpdateHumanBones:p}),this.lookAtPlugin=(o=t==null?void 0:t.lookAtPlugin)!==null&&o!==void 0?o:new Hue(e,{helperRoot:d}),this.metaPlugin=(a=t==null?void 0:t.metaPlugin)!==null&&a!==void 0?a:new Xue(e),this.mtoonMaterialPlugin=(l=t==null?void 0:t.mtoonMaterialPlugin)!==null&&l!==void 0?l:new Yh(e),this.materialsHDREmissiveMultiplierPlugin=(A=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!==null&&A!==void 0?A:new Gm(e),this.materialsV0CompatPlugin=(c=t==null?void 0:t.materialsV0CompatPlugin)!==null&&c!==void 0?c:new ude(e),this.springBonePlugin=(u=t==null?void 0:t.springBonePlugin)!==null&&u!==void 0?u:new nu(e,{colliderHelperRoot:d,jointHelperRoot:d}),this.nodeConstraintPlugin=(h=t==null?void 0:t.nodeConstraintPlugin)!==null&&h!==void 0?h:new tu(e,{helperRoot:d})}get name(){return"VRMLoaderPlugin"}beforeRoot(){return oy(this,void 0,void 0,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return oy(this,void 0,void 0,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return t??null}extendMaterialParams(e,t){return oy(this,void 0,void 0,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return oy(this,void 0,void 0,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){const i=new Kue({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=i}})}}function cD(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function zde(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>cD(i)):r&&cD(r))}function Yde(n){n.traverse(zde)}function Xde(n){const e=new Map;n.traverse(t=>{if(t.type!=="SkinnedMesh")return;const r=t,s=r.geometry.getAttribute("skinIndex");let o=e.get(s);if(!o){const a=[],l=[],A={},c=s.array;for(let u=0;u{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,A=l.index;if(A==null)return;const c=e.get(l);if(c!=null){a.geometry=c;return}const u=new Ht;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(f=>{u.addGroup(f.start,f.count,f.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)===null||r===void 0?void 0:r.clone())!==null&&i!==void 0?i:null,u.boundingSphere=(o=(s=l.boundingSphere)===null||s===void 0?void 0:s.clone())!==null&&o!==void 0?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const h=[],d=[];{const f=A.array,g=new f.constructor(f.length);let m=0;for(let v=0;v{const g=l.attributes[f];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const m=g.array,{itemSize:v,normalized:w}=g,B=new m.constructor(d.length*v);d.forEach((C,b)=>{for(let F=0;F{u.morphAttributes[f]=[];const g=l.morphAttributes[f];for(let m=0;m{for(let _=0;_F===0),u.morphAttributes[f][m]=new ut(b,B,C)}}),p&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function Kde(n){var e;((e=n.meta)===null||e===void 0?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}class C0{constructor(){}}C0.deepDispose=Yde;C0.removeUnnecessaryJoints=Xde;C0.removeUnnecessaryVertices=jde;C0.rotateVRM0=Kde;var $n;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})($n||($n={}));const JB="blend_",uD="vrmColliderSphere";class $de{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},A={},c={},u=e.lookAt,h={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const d=a.filter(($,ce,ge)=>ge.findIndex(Fe=>Fe.name===$.name.replace(" (Outline)",""))===ce).map($=>$),p=d.map($=>$.name),f=r?{name:"icon",imageBitmap:r.image}:null,g=d.filter($=>$.map).map($=>{if(!$.map)throw new Error($.name+" map is null");return{name:$.name,imageBitmap:$.map.image}}),m=d.filter($=>$.userData.shadeTexture).map($=>{if(!$.userData.shadeTexture)throw new Error($.userData.shadeTexture+" map is null");return{name:$.name+"_shade",imageBitmap:$.userData.shadeTexture.image}}),v=g.concat(m),w=rhe(v,f),B=ihe(w),C=she(w),b=nhe(d,v),F=t.children.filter($=>$.children.length>0&&$.children[0].type===di.Bone)[0],x=UJ(F).filter($=>$.name!==uD),_=x.map($=>$.name),M=x.map($=>({children:$.children.filter(ce=>ce.name!==uD).map(ce=>_.indexOf(ce.name)),name:$.name,rotation:[$.quaternion.x,$.quaternion.y,$.quaternion.z,$.quaternion.w],scale:[$.scale.x,$.scale.y,$.scale.z],translation:[$.position.x,$.position.y,$.position.z]})),Y=[],O=t.children.filter($=>$.type===di.Group||$.type===di.SkinnedMesh),U=[];O.forEach($=>{const ce=$.type===di.Group?$.children[0]:$,ge=ce.geometry.attributes;U.push(new el(ge.position,$n.FLOAT,jt.POSITION,xo.VEC3,ce.name,void 0)),U.push(new el(ge.normal,$n.FLOAT,jt.NORMAL,xo.VEC3,ce.name,void 0)),U.push(new el(ge.uv,$n.FLOAT,jt.UV,xo.VEC2,ce.name,void 0)),U.push(new el(ge.skinWeight,$n.FLOAT,jt.SKIN_WEIGHT,xo.VEC4,ce.name,void 0)),U.push(new el(ge.skinIndex,$n.UNSIGNED_SHORT,jt.SKIN_INDEX,xo.VEC4,ce.name,void 0)),($.type===di.Group?$.children.map(P=>P):[$]).forEach(P=>{if(!P.geometry.index)throw new Error(P.name+" geometry.index is null");U.push(new el(P.geometry.index,$n.UNSIGNED_INT,jt.INDEX,xo.SCALAR,ce.name,P.name))}),ce.morphTargetDictionary||(ce.morphTargetDictionary={},ce.morphTargetInfluences=[],ce.geometry.morphAttributes={},ce.updateMorphTargets()),ce.geometry.userData.targetNames=[];for(const P in e.expressionManager.expressionMap){const fe=e.expressionManager.expressionMap[P],ue=fe._binds.map(K=>({node:x.length,index:K.index,weight:K.weight}));let q=!1;for(const K in ui)if(P.toLowerCase()===ui[K].toLowerCase()){l[ui[K]]={morphTargetBinds:ue,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth},q=!0;break}!q&&P.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:ue,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth},q=!0),q===!1&&(A[P]={morphTargetBinds:ue,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth})}for(const P in ce.morphTargetDictionary){ce.geometry.userData.targetNames.push(P);const fe=ce.morphTargetDictionary[P],ue=ce.geometry.morphAttributes;U.push(new el(ue.position[fe],$n.FLOAT,jt.BLEND_POSITION,xo.VEC3,ce.name,JB+P)),U.push(new el(ue.normal[fe],$n.FLOAT,jt.BLEND_NORMAL,xo.VEC3,ce.name,JB+P))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),O.forEach($=>{const ce=$.type===di.Group?$.children[0]:$,ge=new Float32Array(ce.skeleton.boneInverses.map(Fe=>Fe.elements).flat());U.push(new el(new ut(ge,16),$n.FLOAT,jt.BIND_MATRIX,xo.MAT4,ce.name,ce.name))}),Y.push(...U.map($=>({bufferView:-1,byteOffset:0,componentType:$.valueType,count:$.attribute.count,max:$.max,min:$.min,normalized:!1,type:$.accessorsType})));const y=ehe(O,U,p);O.forEach(($,ce)=>{M.push({mesh:ce,name:$.name,rotation:[$.quaternion.x,$.quaternion.y,$.quaternion.z,$.quaternion.w],scale:[$.scale.x,$.scale.y,$.scale.z],skin:ce,translation:[$.position.x,$.position.y,$.position.z]})});const I=the(O,U,_),R={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},N={humanBones:{}};for(const $ in s.humanBones)N.humanBones[$]={node:_.indexOf(s.humanBones[$].node.name)};const k=o,V=[];V.push(...v.map($=>({buffer:dD($.imageBitmap),type:jt.IMAGE}))),V.push(...U.map($=>({buffer:$.buffer,type:$.type}))),f&&V.push({buffer:dD(f.imageBitmap),type:jt.IMAGE});let G=0,D=0,E=0;const z=V.map(($,ce)=>{const ge={buffer:0,byteLength:$.buffer.byteLength,byteOffset:G,target:$.type===jt.IMAGE||$.type===jt.BIND_MATRIX?void 0:$.type===jt.INDEX?$n.ELEMENT_ARRAY_BUFFER:$n.ARRAY_BUFFER};return G+=$.buffer.byteLength,$.type===jt.IMAGE?w[D++].bufferView=ce:Y[E++].bufferView=ce,ge}),re=ohe(t,M),T={accessors:Y,asset:h,buffers:[{byteLength:G}],bufferViews:z,extensions:{VRMC_vrm:{expressions:c,humanoid:N,lookAt:R,meta:k,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:b,meshes:y,nodes:M,samplers:B,avatar:0,scenes:re,skins:I,textures:C},ee=new hD(s_(JSON.stringify(T,void 0,2)),"JSON"),pe=new hD(xg(V.map($=>$.buffer)),"BIN\0"),de=xg([ee.buffer,pe.buffer]),Ae=xg([s_("glTF"),i_(2,4),i_(de.byteLength+12,4)]);i(xg([Ae,de]))}}function UJ(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>UJ(e)).flat())}function dD(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===$n.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===$n.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let hD=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=xg([i_(r.byteLength,4),s_(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===jt.POSITION||r===jt.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var Eh;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Eh||(Eh={}));var xo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(xo||(xo={}));var jt;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(jt||(jt={}));var di;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(di||(di={}));const ehe=(n,e,t)=>n.map(r=>{const i=r.type===di.Group?r.children[0]:r,s=r.type===di.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(jt.SKIN_INDEX),NORMAL:a.indexOf(jt.NORMAL),POSITION:a.indexOf(jt.POSITION),TEXCOORD_0:a.indexOf(jt.UV),WEIGHTS_0:a.indexOf(jt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===jt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>({NORMAL:e.map(c=>c.type===jt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(JB+A),POSITION:e.map(c=>c.type===jt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(JB+A)})):void 0}})}}),the=(n,e,t)=>n.map(r=>{const i=r.type===di.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===jt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),nhe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(c=>c.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const A=t;r=A.color?[A.color.r,A.color.g,A.color.b,1]:void 0}let s=-1;t.map?s=e.map(A=>A.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(A=>A.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case Eh.MeshStandardMaterial:return t.metalness;case Eh.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Eh.MeshStandardMaterial:return t.roughness;case Eh.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),rhe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),ihe=n=>n.map(()=>({magFilter:$n.LINEAR,minFilter:$n.LINEAR,wrapS:$n.REPEAT,wrapT:$n.REPEAT})),she=n=>n.map((e,t)=>({sampler:0,source:t})),ohe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===di.Object3D||r.type===di.SkinnedMesh||r.type===di.Group||r.type===di.Bone).map(r=>t.indexOf(r.name))}]},QJ=0,ahe=1,RJ=2,fD=2,cI=1.25,pD=1,vw=6*4+4+4,o_=65535,lhe=Math.pow(2,-24);class ly{constructor(){}}function da(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function gD(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function mD(n,e){e.set(n)}function vD(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function Ay(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function Gp(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}function Ahe(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let i;t>65535?i=new Uint32Array(new r(4*t)):i=new Uint16Array(new r(2*t)),n.setIndex(new ut(i,1));for(let s=0;si-s);for(let i=0;il&&(l=F),m&&Bp&&(p=B);const x=n[v+2],_=n[v+3],M=x-_,Y=x+_;MA&&(A=Y),m&&xf&&(f=x);const O=n[v+4],U=n[v+5],y=O-U,I=O+U;yc&&(c=I),m&&Og&&(g=O)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=A,r[5]=c,m&&(i[0]=u,i[1]=h,i[2]=d,i[3]=p,i[4]=f,i[5]=g)}function uhe(n,e,t,r){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,A=-1/0;for(let c=e*6,u=(e+t)*6;ca&&(a=h);const d=n[c+2];dl&&(l=d);const p=n[c+4];pA&&(A=p)}r[0]=i,r[1]=s,r[2]=o,r[3]=a,r[4]=l,r[5]=A}function dhe(n,e,t,r,i){let s=t,o=t+r-1;const a=i.pos,l=i.axis*2;for(;;){for(;s<=o&&e[s*6+l]=a;)o--;if(sn.candidate-e.candidate,dA=new Array(sl).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),cy=new Float32Array(6);function fhe(n,e,t,r,i,s){let o=-1,a=0;if(s===QJ)o=gD(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===ahe)o=gD(n),o!==-1&&(a=phe(t,r,i,o));else if(s===RJ){const l=Gp(n);let A=cI*i;const c=r*6,u=(r+i)*6;for(let h=0;h<3;h++){const d=e[h],g=(e[h+3]-d)/sl;if(i=F.candidate?Ay(B,t,F.rightCacheBounds):(Ay(B,t,F.leftCacheBounds),F.count++)}}for(let B=0;B=sl&&(b=sl-1);const F=dA[b];F.count++,Ay(w,t,F.bounds)}const m=dA[sl-1];mD(m.bounds,m.rightCacheBounds);for(let w=sl-2;w>=0;w--){const B=dA[w],C=dA[w+1];vD(B.bounds,C.rightCacheBounds,B.rightCacheBounds)}let v=0;for(let w=0;wb&&(b=w),B>b&&(b=B);const F=(b-C)/2,x=m*2;s[d+x+0]=C+F,s[d+x+1]=F+(Math.abs(C)+F)*lhe,Ce[m+3]&&(e[m+3]=b)}}return s}function mhe(n,e){function t(m){h&&h(m/d)}function r(m,v,w,B=null,C=0){if(!p&&C>=l&&(p=!0,A&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(n))),w<=c||C>=l)return t(v+w),m.offset=v,m.count=w,m;const b=fhe(m.boundingData,B,o,v,w,u);if(b.axis===-1)return t(v+w),m.offset=v,m.count=w,m;const F=dhe(a,o,v,w,b);if(F===v||F===v+w)t(v+w),m.offset=v,m.count=w;else{m.splitAxis=b.axis;const x=new ly,_=v,M=F-v;m.left=x,x.boundingData=new Float32Array(6),uI(o,_,M,x.boundingData,s),r(x,_,M,s,C+1);const Y=new ly,O=F,U=w-M;m.right=Y,Y.boundingData=new Float32Array(6),uI(o,O,U,Y.boundingData,s),r(Y,O,U,s,C+1)}return m}Ahe(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=ghe(n,i),a=n.index.array,l=e.maxDepth,A=e.verbose,c=e.maxLeafTris,u=e.strategy,h=e.onProgress,d=n.index.count/3;let p=!1;const f=[],g=che(n);if(g.length===1){const m=g[0],v=new ly;v.boundingData=i,uhe(o,m.offset,m.count,s),r(v,m.offset,m.count,s),f.push(v)}else for(let m of g){const v=new ly;v.boundingData=new Float32Array(6),uI(o,m.offset,m.count,v.boundingData,s),r(v,m.offset,m.count,s),f.push(v)}return f}function vhe(n,e){const t=mhe(n,e);let r,i,s;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[h+6]=w/4,w=A(w,m),i[h+7]=v,w}}}class Wl{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}Wl.prototype.setFromBox=function(){const n=new j;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let A=0;A<=1;A++)for(let c=0;c<=1;c++){n.x=i.x*l+s.x*(1-l),n.y=i.y*A+s.y*(1-A),n.z=i.z*c+s.z*(1-c);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const yhe=function(){const n=new j,e=new j,t=new j;return function(i,s,o){const a=i.start,l=n,A=s.start,c=e;t.subVectors(a,A),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(c),h=c.dot(l),d=c.dot(c),p=t.dot(l),g=l.dot(l)*d-h*h;let m,v;g!==0?m=(u*h-p*d)/g:m=0,v=(u+m*h)/d,o.x=m,o.y=v}}(),nQ=function(){const n=new Ye,e=new j,t=new j;return function(i,s,o,a){yhe(i,s,n);let l=n.x,A=n.y;if(l>=0&&l<=1&&A>=0&&A<=1){i.at(l,o),s.at(A,a);return}else if(l>=0&&l<=1){A<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(A>=0&&A<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let c;l<0?c=i.start:c=i.end;let u;A<0?u=s.start:u=s.end;const h=e,d=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(c,!0,t),h.distanceToSquared(u)<=d.distanceToSquared(c)){o.copy(h),a.copy(u);return}else{o.copy(c),a.copy(d);return}}}}(),whe=function(){const n=new j,e=new j,t=new gl,r=new Sl;return function(s,o){const{radius:a,center:l}=s,{a:A,b:c,c:u}=o;if(r.start=A,r.end=c,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const f=o.getPlane(t);if(Math.abs(f.distanceToPoint(l))<=a){const m=f.projectPoint(l,e);if(o.containsPoint(m))return!0}return!1}}(),Bhe=1e-15;function Ed(n){return Math.abs(n)new j),this.satBounds=new Array(4).fill().map(()=>new Wl),this.points=[this.a,this.b,this.c],this.sphere=new ku,this.plane=new gl,this.needsUpdate=!0}intersectsSphere(e){return whe(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const A=s[1],c=o[1];A.subVectors(e,t),c.setFromPoints(A,i);const u=s[2],h=o[2];u.subVectors(t,r),h.setFromPoints(u,i);const d=s[3],p=o[3];d.subVectors(r,e),p.setFromPoints(d,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}Gl.prototype.closestPointToSegment=function(){const n=new j,e=new j,t=new Sl;return function(i,s=null,o=null){const{start:a,end:l}=i,A=this.points;let c,u=1/0;for(let h=0;h<3;h++){const d=(h+1)%3;t.start.copy(A[h]),t.end.copy(A[d]),nQ(t,i,n,e),c=n.distanceToSquared(e),c1-1e-10){const v=this.satBounds,w=this.satAxes;t[0]=d.a,t[1]=d.b,t[2]=d.c;for(let b=0;b<4;b++){const F=v[b],x=w[b];if(r.setFromPoints(x,t),F.isSeparated(r))return!1}const B=d.satBounds,C=d.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let b=0;b<4;b++){const F=B[b],x=C[b];if(r.setFromPoints(x,e),F.isSeparated(r))return!1}for(let b=0;b<4;b++){const F=w[b];for(let x=0;x<4;x++){const _=C[x];if(s.crossVectors(F,_),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(f||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const v=this.points;let w=!1,B=0;for(let y=0;y<3;y++){const I=v[y],R=v[(y+1)%3];A.start.copy(I),A.end.copy(R),A.delta(o);const N=w?c.start:c.end,k=Ed(m.distanceToPoint(I));if(Ed(m.normal.dot(o))&&k){c.copy(A),B=2;break}if((m.intersectLine(A,N)||k)&&!Ed(N.distanceTo(R))){if(B++,w)break;w=!0}}if(B===1&&d.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(B!==2)return!1;const C=d.points;let b=!1,F=0;for(let y=0;y<3;y++){const I=C[y],R=C[(y+1)%3];A.start.copy(I),A.end.copy(R),A.delta(a);const N=b?u.start:u.end,k=Ed(g.distanceToPoint(I));if(Ed(g.normal.dot(a))&&k){u.copy(A),F=2;break}if((g.intersectLine(A,N)||k)&&!Ed(N.distanceTo(R))){if(F++,b)break;b=!0}}if(F===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(F!==2)return!1;if(c.delta(o),u.delta(a),o.dot(a)<0){let y=u.start;u.start=u.end,u.end=y}const x=c.start.dot(o),_=c.end.dot(o),M=u.start.dot(o),Y=u.end.dot(o),O=_0?p.start.copy(c.start):p.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(o)<0?p.end.copy(c.end):p.end.copy(u.end)),!0)}}}();Gl.prototype.distanceToPoint=function(){const n=new j;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();Gl.prototype.distanceToTriangle=function(){const n=new j,e=new j,t=["a","b","c"],r=new Sl,i=new Sl;return function(o,a=null,l=null){const A=a||l?r:null;if(this.intersectsTriangle(o,A))return(a||l)&&(a&&A.getCenter(a),l&&A.getCenter(l)),0;let c=1/0;for(let u=0;u<3;u++){let h;const d=t[u],p=o[d];this.closestPointToPoint(p,n),h=p.distanceToSquared(n),hnew j),this.satAxes=new Array(3).fill().map(()=>new j),this.satBounds=new Array(3).fill().map(()=>new Wl),this.alignedSatBounds=new Array(3).fill().map(()=>new Wl),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Ta.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let A=0;A<=1;A++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){const h=1*A|2*c|4*u,d=i[h];d.x=A?r.x:t.x,d.y=c?r.y:t.y,d.z=u?r.z:t.z,d.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let A=0;A<3;A++){const c=o[A],u=s[A],h=1<new Sl),t=new Array(12).fill().map(()=>new Sl),r=new j,i=new j;return function(o,a=0,l=null,A=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||A)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),A&&A.copy(i)),0;const c=a*a,u=o.min,h=o.max,d=this.points;let p=1/0;for(let g=0;g<8;g++){const m=d[g];i.copy(m).clamp(u,h);const v=m.distanceToSquared(i);if(vt.far)?null:n}function aa(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,A=e+2;t&&(a=t.getX(e),l=t.getX(e+1),A=t.getX(e+2)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(A),o.y=r.getY(A),o.z=r.getZ(A)}function xD(n,e,t,r,i,s,o){const a=t.index,l=t.attributes.position;for(let A=n,c=e+n;A=0;let d,p;h?(d=Jm(n),p=Hm(n,a)):(d=Hm(n,a),p=Jm(n));const g=zB(d,s,r,HB)?l_(d,e,t,r):null;if(g){const w=g.point[c];if(h?w<=s[p+A]:w>=s[p+A+3])return g}const v=zB(p,s,r,HB)?l_(p,e,t,r):null;return g&&v?g.distance<=v.distance?g:v:g||v||null}}const _he=function(){let n,e;const t=[],r=new TJ(()=>new Cs);return function(...o){n=r.getPrimitive(),e=r.getPrimitive(),t.push(n,e);const a=i(...o);r.releasePrimitive(n),r.releasePrimitive(e),t.pop(),t.pop();const l=t.length;return l>0&&(e=t[l-1],n=t[l-2]),a};function i(s,o,a,l,A=null,c=0,u=0){function h(w){let B=w*2,C=$A,b=qA;for(;!FA(B,C);)w=Jm(w),B=w*2;return Xh(w,b)}function d(w){let B=w*2,C=$A,b=qA;for(;!FA(B,C);)w=Hm(w,b),B=w*2;return Xh(w,b)+Zm(B,C)}let p=s*2,f=$f,g=$A,m=qA;if(FA(p,g)){const w=Xh(s,m),B=Zm(p,g);return da(s,f,n),l(w,B,!1,u,c+s,n)}else{const w=Jm(s),B=Hm(s,m);let C=w,b=B,F,x,_,M;if(A&&(_=n,M=e,da(C,f,_),da(b,f,M),F=A(_),x=A(M),xi.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(A),x.b.applyMatrix4(A),x.c.applyMatrix4(A),x.needsUpdate=!0;for(let _=C*3,M=(b+C)*3;_new Gl);class Kg{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),Kg.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};const r=e.geometry,i=e._roots,s=r.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:s.array.slice()}:o={roots:i,index:s.array},o}static deserialize(e,t,r={}){if(typeof r=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),Kg.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});r={setIndex:!0,...r};const{index:i,roots:s}=e,o=new Kg(t,{...r,[dI]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new ut(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:QJ,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[dI]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[dI]||(this._roots=vhe(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Cs))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=this.geometry,r=t.index.array,i=t.attributes.position;let s,o,a,l,A=0;const c=this._roots;for(let h=0,d=c.length;hb&&(b=O),UF&&(F=U),yx&&(x=y)}return l[h+0]!==w||l[h+1]!==B||l[h+2]!==C||l[h+3]!==b||l[h+4]!==F||l[h+5]!==x?(l[h+0]=w,l[h+1]=B,l[h+2]=C,l[h+3]=b,l[h+4]=F,l[h+5]=x,!0):!1}else{const m=h+8,v=o[h+6],w=m+d,B=v+d;let C=p,b=!1,F=!1;e?C||(b=e.has(w),F=e.has(B),C=!b&&!F):(b=!0,F=!0);const x=C||b,_=C||F;let M=!1;x&&(M=u(m,d,C));let Y=!1;_&&(Y=u(v,d,C));const O=M||Y;if(O)for(let U=0;U<3;U++){const y=m+U,I=v+U,R=l[y],N=l[y+3],k=l[I],V=l[I+3];l[h+U]=RV?N:V}return O}}}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const A=a*2,c=s[A+15]===o_;if(c){const u=i[a+6],h=s[A+14];e(l,c,new Float32Array(r,a*4,6),u,h)}else{const u=a+vw/4,h=i[a+6],d=i[a+7];e(l,c,new Float32Array(r,a*4,6),d)||(o(u,l+1),o(h,l+1))}}}raycast(e,t=Lo){const r=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,A=o?t.side:t;for(let c=0,u=r.length;c{const m=p*3;return h(d,m,m+1,m+2,f,g)}}e={boundsTraverseOrder:r,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const s=Xo.getPrimitive();let{boundsTraverseOrder:o,intersectsBounds:a,intersectsRange:l,intersectsTriangle:A}=e;if(l&&A){const h=l;l=(d,p,f,g,m)=>h(d,p,f,g,m)?!0:xD(d,p,i,A,f,g,s)}else l||(A?l=(h,d,p,f)=>xD(h,d,i,A,p,f,s):l=(h,d,p)=>p);let c=!1,u=0;for(const h of this._roots){if(Ig(h),c=_he(0,i,a,l,o,u),fy(),c)break;u+=h.byteLength}return Xo.releasePrimitive(s),c}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:s}=r;const o=this.geometry.index,a=this.geometry.attributes.position,l=e.geometry.index,A=e.geometry.attributes.position;_d.copy(t).invert();const c=Xo.getPrimitive(),u=Xo.getPrimitive();if(s){let d=function(p,f,g,m,v,w,B,C){for(let b=g,F=g+m;bfI.intersectsBox(d),intersectsRange:(d,p,f,g,m,v)=>(hI.copy(v),hI.applyMatrix4(_d),e.shapecast({intersectsBounds:w=>hI.intersectsBox(w),intersectsRange:(w,B,C,b,F)=>i(d,p,w,B,g,m,b,F)}))});return Xo.releasePrimitive(c),Xo.releasePrimitive(u),h}intersectsBox(e,t){return Tc.set(e.min,e.max,t),Tc.needsUpdate=!0,this.shapecast({intersectsBounds:r=>Tc.intersectsBox(r),intersectsTriangle:r=>Tc.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){e.boundingBox||e.computeBoundingBox(),Tc.set(e.boundingBox.min,e.boundingBox.max,t),Tc.needsUpdate=!0;const a=this.geometry,l=a.attributes.position,A=a.index,c=e.attributes.position,u=e.index,h=Xo.getPrimitive(),d=Xo.getPrimitive();let p=py,f=Uhe,g=null,m=null;i&&(g=Qhe,m=Rhe);let v=1/0,w=null,B=null;return _d.copy(t).invert(),Zp.matrix.copy(_d),this.shapecast({boundsTraverseOrder:C=>Tc.distanceToBox(C),intersectsBounds:(C,b,F)=>F{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:F=>Zp.distanceToBox(F),intersectsBounds:(F,x,_)=>_{for(let _=F*3,M=(F+x)*3;_(Jp.copy(e).clamp(c.min,c.max),Jp.distanceToSquared(e)),intersectsBounds:(c,u,h)=>h{c.closestPointToPoint(e,Jp);const h=e.distanceToSquared(Jp);return h{da(0,new Float32Array(r),ID),e.union(ID)}),e}}const pI=new u0,FD=new He,Mhe=In.prototype.raycast;function The(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;FD.copy(this.matrixWorld).invert(),pI.copy(n.ray).applyMatrix4(FD);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=bD(t.raycastFirst(pI,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(pI,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new rs,i=new j,s=new j,o=new j,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&ww(n.userData.cancelMesh))},NJ=n=>{var e,t;n.userData.cullingClone&&(ww(n.userData.cullingClone),n.userData.cullingClone=null,ww(n.userData.cullingCloneP),n.userData.cullingCloneP=null,ww(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},Ghe=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Fg=n[0].parent,Fg.lines!=null&&(Fg.lines.forEach(i=>{i.visible=!1}),Fg.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=Whe(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=Vhe,a.userData.cancelMesh=o,a.material=Phe,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},Zhe=n=>{let e=Dhe,t=Lhe;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},Jhe=(n,e,t,r,i,s,o=!1)=>{const a=[],l=Zhe(s);let A=l[0],c=l[1];gy.far=A+c;for(let h=0;h=0;v--)A-m[v].distance>=m[v].object.userData.maxCullDistance&&m.splice(v,1);if(m.length===0){for(let v=0;v<3;v++)a.push(n[d+v]);break}else{const v=m.map(w=>w.object);for(let w=0;ww).length===0){for(let w=0;w<3;w++)a.push(n[d+w]);break}if(f===0)p=m.map(w=>w.object);else if(p=m.map(w=>{if(p.indexOf(w.object)!==-1)return w.object}),p=p.filter(w=>w),f===2&&p.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[d+w]);o&&Hhe(gI,Hp.clone().multiplyScalar(-1),gy.far,16711680,Fg)}}}const u=new Uint32Array(a);return new ut(u,1,!1)};function Hhe(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new j;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new Ht().setFromPoints(o),l=[];l.push(new Le(0)),l.push(new Le(16777215));let A=new zl({color:r});var c=new Pf(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}function kJ(n){let e,t,r,i=0;for(let a=0;atypeof window>"u"?await $he({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await qhe({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o}),$he=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(F=>{const x=F.material;let _=a.find(M=>M.material===x);if(!_)a.push({material:x,mesh:F});else{const{dest:M}=rQ({meshes:[_.mesh,F]});_.mesh.geometry=M}});const l=Object.fromEntries(o.map(F=>[F,DJ({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((F,x)=>{const _=new Ye(x%A,Math.floor(x/A)).multiplyScalar(1/A),M=new Ye(_.x+1/A,_.y+1/A);return[F.mesh,{min:_,max:M}]})),h={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},d=[],p=[];a.forEach(F=>{const{min:x,max:_}=u.get(F.mesh);p.push(_),d.push(x)});const f=new Ye(Math.max(...p.map(F=>F.x)),Math.max(...p.map(F=>F.y))),g=new Ye(Math.min(...d.map(F=>F.x)),Math.min(...d.map(F=>F.y))),m=1/(f.x-g.x),v=1/(f.y-g.y),w=c*m,B=c*v,C=new Map(a.map(F=>{let{min:x,max:_}=u.get(F.mesh);return x.x=x.x*m,x.y=x.y*v,_.x=_.x*m,_.y=_.y*v,[F.mesh,{min:x,max:_}]}));a.forEach(F=>{const{material:x,mesh:_}=F,{min:M,max:Y}=C.get(_);o.forEach(I=>{const R=l[I];R.globalCompositeOperation="source-over";let N=c_(x,h[I].find(k=>c_(x,k)));if(N!==""&&N!==void 0)try{const k=new Uint8ClampedArray(N.data),V=new ImageData(k,w,B),G=document.createElement("canvas");G.width=w,G.height=B;const D=G.getContext("2d");D.putImageData(V,0,0),D.save(),R.drawImage(G,M.x*s,M.y*s,w,B)}catch(k){console.error("error",k)}else R.fillStyle=I==="diffuse"?`#${x.color.clone().getHexString()}`:I==="normal"?"#8080ff":I==="orm"?`#${new Le(x.aoMapIntensity,x.roughness,x.metalness).getHexString()}`:"#7F7F7F",R.fillRect(M.x*s,M.y*s,w,B)});const O=_.geometry,U=O.attributes.uv;if(U)for(let I=0;I{const x=new or(l[F].canvas);return x.flipY=!1,[F,x]})));return{bakeObjects:a,textures:b,uvs:C}},qhe=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o})=>{zhe();const a=t,l=r?["diffuse"]:["diffuse","orm","normal"],A=[];let c=null;e.forEach(y=>{y=y.clone();const I=y.material.length==null?y.material:y.material[0];r&&c==null&&I.type=="ShaderMaterial"&&(c=I.clone());let R=A.find(N=>{N.material});if(!R)A.push({material:I,mesh:y});else{const{dest:N}=rQ({meshes:[R.mesh,y]});R.mesh.geometry=N}});const u=Object.fromEntries(l.map(y=>[y,DJ({width:a,height:a,transparent:s&&y=="diffuse"})])),h=Math.floor(Math.sqrt(e.length)+1),d=a/h,p=new Map(A.map((y,I)=>{const R=new Ye(I%h,Math.floor(I/h)).multiplyScalar(1/h),N=new Ye(R.x+1/h,R.y+1/h);return[y.mesh,{min:R,max:N}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},g=[],m=[];A.forEach(y=>{const{min:I,max:R}=p.get(y.mesh);m.push(R),g.push(I)});const v=new Ye(Math.max(...m.map(y=>y.x)),Math.max(...m.map(y=>y.y))),w=new Ye(Math.min(...g.map(y=>y.x)),Math.min(...g.map(y=>y.y))),B=1/(v.x-w.x),C=1/(v.y-w.y),b=d*B,F=d*C,x=new Map(A.map(y=>{let{min:I,max:R}=p.get(y.mesh);return I.x=I.x*B,I.y=I.y*C,R.x=R.x*B,R.y=R.y*C,[y.mesh,{min:I,max:R}]}));let _=!1;A.forEach(y=>{const{material:I,mesh:R}=y,{min:N,max:k}=x.get(R);l.forEach(E=>{var de;const z=u[E];z.globalCompositeOperation="source-over";let re,T=new Le(1,1,1);switch(E){case"diffuse":re=I.color||n,(de=I.uniforms)!=null&&de.litFactor?T=I.uniforms.litFactor.value:T=I.color;break;case"normal":re=new Le(8421631);break;case"orm":re=new Le(0,I.roughness,I.metalness);break;default:re=new Le(1,1,1);break}let ee=jhe(I,f[E].find(Ae=>c_(I,Ae)));_==!1&&E=="normal"&&ee!=null&&(_=!0);const pe=Xhe(ee,T,re,a,a,E=="diffuse"&&s,E!="normal");createImageBitmap(pe).then(Ae=>z.drawImage(Ae,N.x*a,N.y*a,b,F))});const V=R.geometry.clone();R.geometry=V;const G=V.attributes.uv.clone();if(V.attributes.uv=G,G)for(let E=0;E{const I=new or(u[y].canvas);return I.flipY=!1,[y,I]}))),Y=o?mi:Lo;let O;const U=i?"transparent":"opaque";return r?(O=new bu({map:M.diffuse,transparent:i,side:Y}),c==null&&(c=new mw),c.side=Y,c.uniforms.map=M.diffuse,c.uniforms.shadeMultiplyTexture=M.diffuse,c.transparent=i,s&&!i&&(O.alphaTest=.5,c.alphaTest=.5),O.userData.vrmMaterial=c,O.userData.shadeTexture=M.uniformColor,O.name="mToon_"+U,O.map.name=O.name):(O=new bu({map:M.diffuse,roughnessMap:M.orm,metalnessMap:M.orm,normalMap:_?M.normal:null,transparent:i,side:Y}),s&&!i&&(O.alphaTest=.5),O.name="standard_"+U,O.roughnessMap!=null&&(O.roughnessMap.name=O.name+"_orm"),O.normalMap!=null&&(O.normalMap.name=O.name+"_normal")),{bakeObjects:A,material:O}};function LJ(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new wc(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function VJ(n,e){const t=new Map;new j(-1,1,-1),new He,new j;let r=0;n.forEach(l=>{if(l.skeleton){var A=LJ(l);const c=A.bones;A.bones.forEach((u,h)=>{var d;if(c.indexOf(u)!==-1){const p=t.get(u.name);if(p==null){const f={index:r,boneInverses:A.boneInverses[h],bone:u.clone(!1),parentName:((d=u.parent)==null?void 0:d.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,f)}else u.userData.VRMcolliders!=null&&(p.bone.userData.VRMcolliders==null?p.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=p.bone.userData.VRMcollidersID&&(p.bone.userData.VRMcolliders=[...p.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var A;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const c=(A=t.get(l.parentName))==null?void 0:A.bone;c&&c.add(l.bone)}});const a=new wc(i,s);return a.bones.forEach(l=>{var c;const A=(c=l.userData)==null?void 0:c.vrm0RestPosition;A&&l.position.set(-A.x,A.y,-A.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function efe(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(c=>c.name===o.name),A=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,A)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function tfe(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function YB(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function ife(n,e){const{scale:t,isVrm0:r}=e,i=[],s=[];Sf(n,"SkinnedMesh").forEach(A=>{const c=A.clone();i.push(c),Array.isArray(A.material)?s.push(...A.material):s.push(A.material)});const a=VJ(i,t),l=new Rt;return l.name="AvatarRoot",i.forEach(A=>{var b;const c=new Ht,u={};for(const F in A.geometry.attributes){const x=A.geometry.attributes[F];u[F]=x.clone()}if((b=A.userData)!=null&&b.isVRM0)for(let F=0;F[F,F.geometry.morphAttributes])),p=new Map([A].map(F=>[F,F.morphTargetDictionary||{}]));if(h.morphAttributes=OJ({meshes:[A],sourceMorphAttributes:d,sourceMorphTargetDictionaries:p,destMorphTargetDictionary:h.morphTargetDictionary,scale:t},r),r)for(let F=0;Fd.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new j(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],A=[],c=t.geometry.attributes.position.array,u=new j,h=e.userData.isVRM0?-1:1;for(let d=0;d0){const{bakeObjects:M,material:Y}=await Khe({transparentColor:t,atlasSize:x.size,meshes:_,mtoon:x.isMtoon,transparentMaterial:x.transparentMaterial,transparentTexture:w,twoSidedMaterial:u}),O=M.map(k=>k.mesh),U=[];O.forEach(k=>{k.type=="Mesh"&&(k=ofe(C,k)),U.push(k);const V=k.geometry,G=V.index.array,D=PJ(k.geometry.index.array),E=[];for(let T=0;T{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function Afe({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=kJ(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function cfe({sourceMorphTargetDictionaries:n}){const e=new Set;Array.from(n.values()).forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map((i,s)=>{r[i]=s}),r}function OJ({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i},s=!1){const o=new Set;Array.from(t.values()).forEach(u=>{Object.keys(u).forEach(h=>o.add(h))});const l=Array.from(o),A={};l.forEach(u=>{A[u]=[],Object.entries(r).forEach(([h,d])=>{A[u][d]=[],n.forEach(p=>{let f;const g=e.get(p);if(g.hasOwnProperty(h)&&p.geometry.morphAttributes[u]){const m=g[h];f=p.geometry.morphAttributes[u][m]}else{const m=p.geometry.attributes[u],v=new m.array.constructor(new Array(m.array.length).fill(0));f=new ut(v,m.itemSize,m.normalized)}A[u][d].push(f)})})});const c={};return l.forEach(u=>{c[u]=[];for(let h=0;h{const i=r.geometry.index;for(var s=0;s{var l;if(r+=a.geometry.attributes.uv.count,(l=a.userData)!=null&&l.isVRM0)for(let A=0;A[a,a.geometry.attributes])),morphAttributes:new Map(n.map(a=>[a,a.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(a=>[a,a.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(a=>[a,a.morphTargetInfluences||[]]))},s={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};s.attributes=Afe({sourceAttributes:i.attributes});const o=cfe({sourceMorphTargetDictionaries:i.morphTargetDictionaries});return s.morphTargetDictionary=o,s.morphAttributes=OJ({meshes:n,sourceMorphAttributes:i.morphAttributes,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o,scale:e},t),s.morphTargetInfluences=lfe({meshes:n,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o}),s.index=ufe({meshes:n}),s.animations={},{source:i,dest:s}}function ht(n){return n==null?[]:Array.isArray(n)?n:[n]}function dfe(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function hfe(n,e){const r=await new Pu().load(e);r.encoding=mt,r.flipY=!1,n.traverse(i=>{if(i instanceof In){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}Ghe(e)};function gfe(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=ht(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((A=l.uniforms.alphaTest)==null?void 0:A.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function mfe(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ht(a.material).forEach(A=>{A.type=="ShaderMaterial"?A.transparent==!0?o.push(A):A.uniforms.alphaTest.value!=0?s.push(A):i.push(A):A.transparent==!0?r.push(A):A.alphaTest!=0?t.push(A):e.push(A)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function _D(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function vfe(n,e){if(n.data!=null)return n.data[e]}function yfe(n){const e=vfe(n,"cullingMeshes");e&&(e.forEach(t=>{NJ(t)}),n.data.cullingMeshes=null)}function Cn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function wfe(n){const e=n.scene;yfe(n),e.traverse(t=>{t.material&&u_(t.material),t.geometry&&(NJ(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),C0.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&u_(i.material)})})});for(const t in n)n[t]=null}const u_=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{let e,t,r=0;return Array.isArray(n)?(e=n[0]||0,t=n[1]||0,r=n[2]||0):(typeof n=="string"||n instanceof String)&&n.split("-").forEach(s=>{switch(s=s.toLowerCase(),s){case"left":e=-1;break;case"right":e=1;break;case"bottom":case"down":t=-1;break;case"top":case"up":t=1;break;case"back":case"backward":r=-1;break;case"front":case"forward":r=1;break;default:console.warn("unkown cameraPosition name: "+s+" in: "+n+". Please use left, right, bottom, top, back or front");break}}),new j(e,t,r)},WJ=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},Bfe=n=>{var t,r,i,s,o,a,l,A,c,u,h;const e=n.humanoid.humanBones;e.hips.node.parent.name="rootBone",e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:e.upperChest!=null&&(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((A=e.spine)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((c=e.neck)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let d in Wm)d=d.charAt(0).toLowerCase()+d.slice(1),(h=e[d])!=null&&h.node&&(e[d].node.name=d)};function GJ({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),GJ({candidates:n,predicate:e}))}function ZJ(n,e){return GJ({candidates:[n],predicate:t=>t.name===e})}function JJ({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),JJ({candidates:n,predicate:e,results:t})}function Sf(n,e){return JJ({candidates:[n],predicate:t=>ht(e).includes(t.type)})}const Cfe={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function HJ(n,e,t){var f;const r=xu.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new rt,o=new rt,a=new rt,l=new j,A=e.getObjectByName("mixamorigHips").position.y,c=(f=t.humanoid)==null?void 0:f.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,d=Math.abs(c-u)/A;return r.tracks.forEach(g=>{const m=g.clone(),v=m.name.split("."),w=v[0],C=Cfe[w],b=e.getObjectByName(w);if(C!=null){const F=v[1];if(b.getWorldQuaternion(s).invert(),b.parent.getWorldQuaternion(o),m instanceof Ra){for(let x=0;x{m.values[Y+x]=M})}i.push(new Ra(`${C}.${F}`,m.times,m.values.map((x,_)=>{var M;return((M=t.meta)==null?void 0:M.metaVersion)==="0"&&_%2===0?-x:x})))}else if(m instanceof ac){const x=m.values.map((_,M)=>{var Y;return(((Y=t.meta)==null?void 0:Y.metaVersion)==="0"&&M%3!==1?-_:_)*d});i.push(new ac(`${C}.${F}`,m.times,x))}}}),new xu("vrmAnimation",r.duration,i)}const bfe=new Vse,xfe=new QU,yI=.2,Ife=n=>Math.floor(Math.random()*n);class SD{constructor(e,t,r,i,s,o,a){var l,A,c,u;this.mixer=new Mie(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(A=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:A.neck,this.spineBone=(u=(c=r==null?void 0:r.humanoid)==null?void 0:c.humanBones)==null?void 0:u.spine,this.timeScale=1,i&&(this.setAnimations(i,null,null,a),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play())}setTimeScale(e){this.timeScale=e,this.actions.forEach(t=>{t.timeScale=e})}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t=null,r=null,i=!1){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const s=HJ(e,t,this.vrm);s&&(e=[s],this.mixamoModel=t)}}else{const s=[];e.forEach(o=>{s.push(o.clone())}),e=s}if(r&&e[0].tracks.map((s,o)=>{(s.name==="neck.quaternion"||s.name==="spine.quaternion")&&e[0].tracks.splice(o,1)}),i){this.actions.forEach(s=>{s.weight=0,s.stop()}),this.actions=[],this.newAnimationWeight=1;for(let s=0;s{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}setTime(e){this.mixer.setTime(e)}getTime(){return this.mixer.time}dispose(){this.animationManager.disposeAnimation(this)}}class Ffe{constructor(){this.animationPaths=[],this.defaultAnimations=[],this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.paused=!1,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,this.currentClip=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t,r=0,i=!0,s="",o=""){const a=s+(s!=""?"/":"")+ht(e)[0];o=o==""?Ul(a):o,this.currentAnimationName=o;const A=await(i?bfe:xfe).loadAsync(a);A.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(A.animations);const c=xu.findByName(A.animations,"mixamo.com");c!=null?(this.mixamoModel=A.clone(),this.mixamoAnimations=A.animations,this.currentClip=c):(this.mixamoModel=null,this.animations=A.animations,this.currentClip=A.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new SD(this,A,null,A.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(A.animations,this.mixamoModel,this.mouseLookEnabled,t)}),this.setTime(r),t?this.pause():this.play()}getCurrentClip(){return this.currentClip}getCurrentClipDuration(){return this.currentClip?this.currentClip.duration:0}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=this.defaultAnimations,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t,r=!0){const i=ht(e);r?this.animationPaths=[...this.defaultAnimations,...i.map(s=>`${t}/${s}`)]:this.animationPaths=i.map(s=>t!=""?`${t}/${s}`:s)}storeDefaultAnimationPaths(e,t){const r=ht(e);this.defaultAnimations=r.map(i=>t!=""?`${t}/${i}`:i),this.animationPaths=this.defaultAnimations}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=Ife(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-yI)},e*1e3)}pause(){this.paused=!0}play(){this.paused=!1}isPaused(){return this.paused}setTime(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTime(e)})}setFrame(e){this.setTime(e*30)}setSpeed(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTimeScale(e)})}update(e=!1){(this.mainControl&&!this.paused||e)&&(this.animationControls.forEach(t=>{t.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*yI):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*yI):this.weightOut=0)}}const UD={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + */class IJ{}const AI=new j,Mc=new j;class FJ extends IJ{constructor(e){var t,r,i;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new j(0,0,0),this.tail=(r=e==null?void 0:e.tail)!==null&&r!==void 0?r:new j(0,0,0),this.radius=(i=e==null?void 0:e.radius)!==null&&i!==void 0?i:0}get type(){return"capsule"}calculateCollision(e,t,r,i){AI.copy(this.offset).applyMatrix4(e),Mc.copy(this.tail).applyMatrix4(e),Mc.sub(AI);const s=Mc.lengthSq();i.copy(t).sub(AI);const o=Mc.dot(i);o<=0||(s<=o||Mc.multiplyScalar(o/s),i.sub(Mc));const a=r+this.radius,l=i.length()-a;return i.normalize(),l}}class EJ extends IJ{constructor(e){var t,r;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new j(0,0,0),this.radius=(r=e==null?void 0:e.radius)!==null&&r!==void 0?r:0}get type(){return"sphere"}calculateCollision(e,t,r,i){i.copy(this.offset).applyMatrix4(e),i.negate().add(t);const s=r+this.radius,o=i.length()-s;return i.normalize(),o}}const Yo=new j;class Rde extends Ht{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new j,this._currentTail=new j,this._shape=e,this._attrPos=new ut(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ut(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);const r=Yo.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(r)>1e-10&&(this._currentTail.copy(r),e=!0),e&&this._buildPosition()}_buildPosition(){Yo.copy(this._currentTail).sub(this._currentOffset);const e=Yo.length()/this._currentRadius;for(let i=0;i<=16;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+i,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+i,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+i,e+Math.sin(s),0,Math.cos(s))}for(let i=0;i<32;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(s),Math.cos(s)),this._attrPos.setXYZ(100+i,e,Math.sin(s),Math.cos(s))}const t=Math.atan2(Yo.y,Math.sqrt(Yo.x*Yo.x+Yo.z*Yo.z)),r=-Math.atan2(Yo.z,Yo.x);this.rotateZ(t),this.rotateY(r),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(68+e*2,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+t),this._attrIndex.setXY(200+e*2,100+e,100+t)}this._attrIndex.needsUpdate=!0}}class Mde extends Ht{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new j,this._shape=e,this._attrPos=new ut(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ut(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.needsUpdate=!0}}const Tde=new j;class sD extends kr{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof EJ)this._geometry=new Mde(this.collider.shape);else if(this.collider.shape instanceof FJ)this._geometry=new Rde(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new zl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new f0(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=Tde.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class Nde extends Ht{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new j,this._springBone=e,this._attrPos=new ut(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ut(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const kde=new j;class Dde extends kr{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new Nde(this.springBone);const t=new zl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new f0(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=kde.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class oD extends Rt{constructor(e){super(),this.shape=e}}const Lde=new He;function _J(n){return n.invert?n.invert():n.getInverse(Lde.copy(n)),n}class Vde{constructor(e){this._inverseCache=new He,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(r,i,s)=>(this._shouldUpdateInverse=!0,r[i]=s,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),_J(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const Pde=new He,qa=new j,Op=new j,Ode=new j,Id=new j,aD=new j,Wp=new j,lD=new rt,Fd=new He,Wde=new He;class Gde{constructor(e,t,r={},i=[]){var s,o,a,l,A,c;this._currentTail=new j,this._prevTail=new j,this._boneAxis=new j,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new He,this._initialLocalRotation=new rt,this._initialLocalChildPosition=new j,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(s=r.hitRadius)!==null&&s!==void 0?s:0,stiffness:(o=r.stiffness)!==null&&o!==void 0?o:1,gravityPower:(a=r.gravityPower)!==null&&a!==void 0?a:0,gravityDir:(A=(l=r.gravityDir)===null||l===void 0?void 0:l.clone())!==null&&A!==void 0?A:new j(0,-1,0),dragForce:(c=r.dragForce)!==null&&c!==void 0?c:.4},this.colliderGroups=i}get center(){return this._center}set center(e){var t;!((t=this._center)===null||t===void 0)&&t.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new Vde(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:Pde}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const e=this._getMatrixWorldToCenter(Fd);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const e=this._getMatrixWorldToCenter(Fd);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength(),Id.setFromMatrixPosition(this.bone.matrixWorld);let t=this._getMatrixWorldToCenter(Fd);aD.copy(Id).applyMatrix4(t);const r=lD.setFromRotationMatrix(t),i=Wde.copy(t).multiply(this._parentMatrixWorld),s=Op.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(aD).normalize(),o=Ode.copy(this.settings.gravityDir).applyQuaternion(r).normalize(),a=this._getMatrixCenterToWorld(Fd);Wp.copy(this._currentTail).add(qa.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(qa.copy(s).multiplyScalar(this.settings.stiffness*e)).add(qa.copy(o).multiplyScalar(this.settings.gravityPower*e)).applyMatrix4(a),Wp.sub(Id).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Id),this._collision(Wp),t=this._getMatrixWorldToCenter(Fd),this._prevTail.copy(this._currentTail),this._currentTail.copy(qa.copy(Wp).applyMatrix4(t));const l=_J(Fd.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),A=lD.setFromUnitVectors(this._boneAxis,qa.copy(Wp).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(A),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{const i=r.shape.calculateCollision(r.matrixWorld,e,this.settings.hitRadius,qa);i<0&&(e.add(qa.multiplyScalar(-i)),e.sub(Id).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Id))})})}_calcWorldSpaceBoneLength(){qa.setFromMatrixPosition(this.bone.matrixWorld),this.child?Op.setFromMatrixPosition(this.child.matrixWorld):(Op.copy(this._initialLocalChildPosition),Op.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=qa.sub(Op).length()}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}}function ay(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function Zde(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function SJ(n,e){n.children.forEach(t=>{e(t)||SJ(t,e)})}class AD{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(r=>{e.add(r)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{e.add(r)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e)}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e),this._objectSpringBonesMap.get(e.bone).delete(e)}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.setInitState())}reset(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.reset())}update(e){const t=new Set,r=new Set,i=new Set;for(const s of this._joints)this._processSpringBone(s,t,r,i,o=>o.update(e)),SJ(s.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(e,t,r,i,s){if(r.has(e))return;if(t.has(e))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");t.add(e);const o=this._getDependencies(e);for(const a of o)Zde(a,l=>{const A=this._objectSpringBonesMap.get(l);if(A)for(const c of A)this._processSpringBone(c,t,r,i,s);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),s(e),i.add(e.bone),r.add(e)}_getDependencies(e){const t=new Set,r=e.bone.parent;return r&&t.add(r),e.colliderGroups.forEach(i=>{i.colliders.forEach(s=>{t.add(s)})}),t}}const Jde=new Set(["1.0","1.0-beta"]);class nu{constructor(e,t){this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot}get name(){return nu.EXTENSION_NAME}afterRoot(e){return ay(this,void 0,void 0,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return ay(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i,s,o;return ay(this,void 0,void 0,function*(){const a=e.parser.json;if(!(((t=a.extensionsUsed)===null||t===void 0?void 0:t.indexOf(nu.EXTENSION_NAME))!==-1))return null;const A=new AD,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)===null||r===void 0?void 0:r[nu.EXTENSION_NAME];if(!u)return null;const h=u.specVersion;if(!Jde.has(h))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${nu.EXTENSION_NAME} specVersion "${h}"`),null;const d=(i=u.colliders)===null||i===void 0?void 0:i.map((f,g)=>{var m,v,w,B,C;const b=c[f.node],F=f.shape;if(F.sphere)return this._importSphereCollider(b,{offset:new j().fromArray((m=F.sphere.offset)!==null&&m!==void 0?m:[0,0,0]),radius:(v=F.sphere.radius)!==null&&v!==void 0?v:0});if(F.capsule)return this._importCapsuleCollider(b,{offset:new j().fromArray((w=F.capsule.offset)!==null&&w!==void 0?w:[0,0,0]),radius:(B=F.capsule.radius)!==null&&B!==void 0?B:0,tail:new j().fromArray((C=F.capsule.tail)!==null&&C!==void 0?C:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),p=(s=u.colliderGroups)===null||s===void 0?void 0:s.map((f,g)=>{var m;return{colliders:((m=f.colliders)!==null&&m!==void 0?m:[]).map(w=>{const B=d==null?void 0:d[w];if(B==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return B}),name:f.name}});return(o=u.springs)===null||o===void 0||o.forEach((f,g)=>{var m;const v=f.joints,w=(m=f.colliderGroups)===null||m===void 0?void 0:m.map(b=>{const F=p==null?void 0:p[b];if(F==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${b} but not found`);return F}),B=f.center!=null?c[f.center]:void 0;let C;v.forEach(b=>{if(C){const F=C.node,x=c[F],_=b.node,M=c[_],Y={hitRadius:C.hitRadius,dragForce:C.dragForce,gravityPower:C.gravityPower,stiffness:C.stiffness,gravityDir:C.gravityDir!=null?new j().fromArray(C.gravityDir):void 0},O=this._importJoint(x,M,Y,w);B&&(O.center=B),A.addJoint(O)}C=b})}),A.setInitState(),A})}_v0Import(e){var t,r,i;return ay(this,void 0,void 0,function*(){const s=e.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new AD,u=yield e.parser.getDependencies("node"),h=(i=l.colliderGroups)===null||i===void 0?void 0:i.map(d=>{var p;const f=u[d.node];return{colliders:((p=d.colliders)!==null&&p!==void 0?p:[]).map((m,v)=>{var w,B,C;const b=new j(0,0,0);return m.offset&&b.set((w=m.offset.x)!==null&&w!==void 0?w:0,(B=m.offset.y)!==null&&B!==void 0?B:0,m.offset.z?-m.offset.z:0),this._importSphereCollider(f,{offset:b,radius:(C=m.radius)!==null&&C!==void 0?C:0})})}});return A==null||A.forEach((d,p)=>{const f=d.bones;f&&f.forEach(g=>{var m,v,w,B;const C=u[g],b=new j;d.gravityDir?b.set((m=d.gravityDir.x)!==null&&m!==void 0?m:0,(v=d.gravityDir.y)!==null&&v!==void 0?v:0,(w=d.gravityDir.z)!==null&&w!==void 0?w:0):b.set(0,-1,0);const F=d.center!=null?u[d.center]:void 0,x={hitRadius:d.hitRadius,dragForce:d.dragForce,gravityPower:d.gravityPower,stiffness:d.stiffiness,gravityDir:b},_=(B=d.colliderGroups)===null||B===void 0?void 0:B.map(M=>{const Y=h==null?void 0:h[M];if(Y==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${M} but not found`);return Y});C.traverse(M=>{var Y;const O=(Y=M.children[0])!==null&&Y!==void 0?Y:null,U=this._importJoint(M,O,x,_);F&&(U.center=F),c.addJoint(U)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new Gde(e,t,r,i);if(this.jointHelperRoot){const o=new Dde(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const{offset:r,radius:i}=t,s=new EJ({offset:r,radius:i}),o=new oD(s);if(e.add(o),this.colliderHelperRoot){const a=new sD(o);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(e,t){const{offset:r,radius:i,tail:s}=t,o=new FJ({offset:r,radius:i,tail:s}),a=new oD(o);if(e.add(a),this.colliderHelperRoot){const l=new sD(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}}nu.EXTENSION_NAME="VRMC_springBone";class Hde{constructor(e,t){var r,i,s,o,a,l,A,c,u,h;this.parser=e;const d=t==null?void 0:t.helperRoot,p=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(r=t==null?void 0:t.expressionPlugin)!==null&&r!==void 0?r:new gb(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!==null&&i!==void 0?i:new xue(e),this.humanoidPlugin=(s=t==null?void 0:t.humanoidPlugin)!==null&&s!==void 0?s:new Rue(e,{helperRoot:d,autoUpdateHumanBones:p}),this.lookAtPlugin=(o=t==null?void 0:t.lookAtPlugin)!==null&&o!==void 0?o:new Hue(e,{helperRoot:d}),this.metaPlugin=(a=t==null?void 0:t.metaPlugin)!==null&&a!==void 0?a:new Xue(e),this.mtoonMaterialPlugin=(l=t==null?void 0:t.mtoonMaterialPlugin)!==null&&l!==void 0?l:new Yh(e),this.materialsHDREmissiveMultiplierPlugin=(A=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!==null&&A!==void 0?A:new Gm(e),this.materialsV0CompatPlugin=(c=t==null?void 0:t.materialsV0CompatPlugin)!==null&&c!==void 0?c:new ude(e),this.springBonePlugin=(u=t==null?void 0:t.springBonePlugin)!==null&&u!==void 0?u:new nu(e,{colliderHelperRoot:d,jointHelperRoot:d}),this.nodeConstraintPlugin=(h=t==null?void 0:t.nodeConstraintPlugin)!==null&&h!==void 0?h:new tu(e,{helperRoot:d})}get name(){return"VRMLoaderPlugin"}beforeRoot(){return oy(this,void 0,void 0,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return oy(this,void 0,void 0,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return t??null}extendMaterialParams(e,t){return oy(this,void 0,void 0,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return oy(this,void 0,void 0,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){const i=new Kue({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=i}})}}function cD(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function zde(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>cD(i)):r&&cD(r))}function Yde(n){n.traverse(zde)}function Xde(n){const e=new Map;n.traverse(t=>{if(t.type!=="SkinnedMesh")return;const r=t,s=r.geometry.getAttribute("skinIndex");let o=e.get(s);if(!o){const a=[],l=[],A={},c=s.array;for(let u=0;u{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,A=l.index;if(A==null)return;const c=e.get(l);if(c!=null){a.geometry=c;return}const u=new Ht;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(f=>{u.addGroup(f.start,f.count,f.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)===null||r===void 0?void 0:r.clone())!==null&&i!==void 0?i:null,u.boundingSphere=(o=(s=l.boundingSphere)===null||s===void 0?void 0:s.clone())!==null&&o!==void 0?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const h=[],d=[];{const f=A.array,g=new f.constructor(f.length);let m=0;for(let v=0;v{const g=l.attributes[f];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const m=g.array,{itemSize:v,normalized:w}=g,B=new m.constructor(d.length*v);d.forEach((C,b)=>{for(let F=0;F{u.morphAttributes[f]=[];const g=l.morphAttributes[f];for(let m=0;m{for(let _=0;_F===0),u.morphAttributes[f][m]=new ut(b,B,C)}}),p&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function Kde(n){var e;((e=n.meta)===null||e===void 0?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}class C0{constructor(){}}C0.deepDispose=Yde;C0.removeUnnecessaryJoints=Xde;C0.removeUnnecessaryVertices=jde;C0.rotateVRM0=Kde;var $n;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})($n||($n={}));const JB="blend_",uD="vrmColliderSphere";class $de{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},A={},c={},u=e.lookAt,h={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const d=a.filter(($,ce,ge)=>ge.findIndex(Fe=>Fe.name===$.name.replace(" (Outline)",""))===ce).map($=>$),p=d.map($=>$.name),f=r?{name:"icon",imageBitmap:r.image}:null,g=d.filter($=>$.map).map($=>{if(!$.map)throw new Error($.name+" map is null");return{name:$.name,imageBitmap:$.map.image}}),m=d.filter($=>$.userData.shadeTexture).map($=>{if(!$.userData.shadeTexture)throw new Error($.userData.shadeTexture+" map is null");return{name:$.name+"_shade",imageBitmap:$.userData.shadeTexture.image}}),v=g.concat(m),w=rhe(v,f),B=ihe(w),C=she(w),b=nhe(d,v),F=t.children.filter($=>$.children.length>0&&$.children[0].type===di.Bone)[0],x=UJ(F).filter($=>$.name!==uD),_=x.map($=>$.name),M=x.map($=>({children:$.children.filter(ce=>ce.name!==uD).map(ce=>_.indexOf(ce.name)),name:$.name,rotation:[$.quaternion.x,$.quaternion.y,$.quaternion.z,$.quaternion.w],scale:[$.scale.x,$.scale.y,$.scale.z],translation:[$.position.x,$.position.y,$.position.z]})),Y=[],O=t.children.filter($=>$.type===di.Group||$.type===di.SkinnedMesh),U=[];O.forEach($=>{const ce=$.type===di.Group?$.children[0]:$,ge=ce.geometry.attributes;U.push(new el(ge.position,$n.FLOAT,jt.POSITION,xo.VEC3,ce.name,void 0)),U.push(new el(ge.normal,$n.FLOAT,jt.NORMAL,xo.VEC3,ce.name,void 0)),U.push(new el(ge.uv,$n.FLOAT,jt.UV,xo.VEC2,ce.name,void 0)),U.push(new el(ge.skinWeight,$n.FLOAT,jt.SKIN_WEIGHT,xo.VEC4,ce.name,void 0)),U.push(new el(ge.skinIndex,$n.UNSIGNED_SHORT,jt.SKIN_INDEX,xo.VEC4,ce.name,void 0)),($.type===di.Group?$.children.map(P=>P):[$]).forEach(P=>{if(!P.geometry.index)throw new Error(P.name+" geometry.index is null");U.push(new el(P.geometry.index,$n.UNSIGNED_INT,jt.INDEX,xo.SCALAR,ce.name,P.name))}),ce.morphTargetDictionary||(ce.morphTargetDictionary={},ce.morphTargetInfluences=[],ce.geometry.morphAttributes={},ce.updateMorphTargets()),ce.geometry.userData.targetNames=[];for(const P in e.expressionManager.expressionMap){const fe=e.expressionManager.expressionMap[P],ue=fe._binds.map(K=>({node:x.length,index:K.index,weight:K.weight}));let q=!1;for(const K in ui)if(P.toLowerCase()===ui[K].toLowerCase()){l[ui[K]]={morphTargetBinds:ue,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth},q=!0;break}!q&&P.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:ue,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth},q=!0),q===!1&&(A[P]={morphTargetBinds:ue,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth})}for(const P in ce.morphTargetDictionary){ce.geometry.userData.targetNames.push(P);const fe=ce.morphTargetDictionary[P],ue=ce.geometry.morphAttributes;U.push(new el(ue.position[fe],$n.FLOAT,jt.BLEND_POSITION,xo.VEC3,ce.name,JB+P)),U.push(new el(ue.normal[fe],$n.FLOAT,jt.BLEND_NORMAL,xo.VEC3,ce.name,JB+P))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),O.forEach($=>{const ce=$.type===di.Group?$.children[0]:$,ge=new Float32Array(ce.skeleton.boneInverses.map(Fe=>Fe.elements).flat());U.push(new el(new ut(ge,16),$n.FLOAT,jt.BIND_MATRIX,xo.MAT4,ce.name,ce.name))}),Y.push(...U.map($=>({bufferView:-1,byteOffset:0,componentType:$.valueType,count:$.attribute.count,max:$.max,min:$.min,normalized:!1,type:$.accessorsType})));const y=ehe(O,U,p);O.forEach(($,ce)=>{M.push({mesh:ce,name:$.name,rotation:[$.quaternion.x,$.quaternion.y,$.quaternion.z,$.quaternion.w],scale:[$.scale.x,$.scale.y,$.scale.z],skin:ce,translation:[$.position.x,$.position.y,$.position.z]})});const I=the(O,U,_),R={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},N={humanBones:{}};for(const $ in s.humanBones)N.humanBones[$]={node:_.indexOf(s.humanBones[$].node.name)};const k=o,L=[];L.push(...v.map($=>({buffer:dD($.imageBitmap),type:jt.IMAGE}))),L.push(...U.map($=>({buffer:$.buffer,type:$.type}))),f&&L.push({buffer:dD(f.imageBitmap),type:jt.IMAGE});let G=0,D=0,E=0;const z=L.map(($,ce)=>{const ge={buffer:0,byteLength:$.buffer.byteLength,byteOffset:G,target:$.type===jt.IMAGE||$.type===jt.BIND_MATRIX?void 0:$.type===jt.INDEX?$n.ELEMENT_ARRAY_BUFFER:$n.ARRAY_BUFFER};return G+=$.buffer.byteLength,$.type===jt.IMAGE?w[D++].bufferView=ce:Y[E++].bufferView=ce,ge}),re=ohe(t,M),T={accessors:Y,asset:h,buffers:[{byteLength:G}],bufferViews:z,extensions:{VRMC_vrm:{expressions:c,humanoid:N,lookAt:R,meta:k,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:b,meshes:y,nodes:M,samplers:B,avatar:0,scenes:re,skins:I,textures:C},ee=new hD(s_(JSON.stringify(T,void 0,2)),"JSON"),pe=new hD(xg(L.map($=>$.buffer)),"BIN\0"),de=xg([ee.buffer,pe.buffer]),Ae=xg([s_("glTF"),i_(2,4),i_(de.byteLength+12,4)]);i(xg([Ae,de]))}}function UJ(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>UJ(e)).flat())}function dD(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===$n.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===$n.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let hD=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=xg([i_(r.byteLength,4),s_(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===jt.POSITION||r===jt.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var Eh;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Eh||(Eh={}));var xo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(xo||(xo={}));var jt;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(jt||(jt={}));var di;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(di||(di={}));const ehe=(n,e,t)=>n.map(r=>{const i=r.type===di.Group?r.children[0]:r,s=r.type===di.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(jt.SKIN_INDEX),NORMAL:a.indexOf(jt.NORMAL),POSITION:a.indexOf(jt.POSITION),TEXCOORD_0:a.indexOf(jt.UV),WEIGHTS_0:a.indexOf(jt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===jt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>({NORMAL:e.map(c=>c.type===jt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(JB+A),POSITION:e.map(c=>c.type===jt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(JB+A)})):void 0}})}}),the=(n,e,t)=>n.map(r=>{const i=r.type===di.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===jt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),nhe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(c=>c.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const A=t;r=A.color?[A.color.r,A.color.g,A.color.b,1]:void 0}let s=-1;t.map?s=e.map(A=>A.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(A=>A.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case Eh.MeshStandardMaterial:return t.metalness;case Eh.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Eh.MeshStandardMaterial:return t.roughness;case Eh.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),rhe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),ihe=n=>n.map(()=>({magFilter:$n.LINEAR,minFilter:$n.LINEAR,wrapS:$n.REPEAT,wrapT:$n.REPEAT})),she=n=>n.map((e,t)=>({sampler:0,source:t})),ohe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===di.Object3D||r.type===di.SkinnedMesh||r.type===di.Group||r.type===di.Bone).map(r=>t.indexOf(r.name))}]},QJ=0,ahe=1,RJ=2,fD=2,cI=1.25,pD=1,vw=6*4+4+4,o_=65535,lhe=Math.pow(2,-24);class ly{constructor(){}}function da(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function gD(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function mD(n,e){e.set(n)}function vD(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function Ay(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function Gp(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}function Ahe(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let i;t>65535?i=new Uint32Array(new r(4*t)):i=new Uint16Array(new r(2*t)),n.setIndex(new ut(i,1));for(let s=0;si-s);for(let i=0;il&&(l=F),m&&Bp&&(p=B);const x=n[v+2],_=n[v+3],M=x-_,Y=x+_;MA&&(A=Y),m&&xf&&(f=x);const O=n[v+4],U=n[v+5],y=O-U,I=O+U;yc&&(c=I),m&&Og&&(g=O)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=A,r[5]=c,m&&(i[0]=u,i[1]=h,i[2]=d,i[3]=p,i[4]=f,i[5]=g)}function uhe(n,e,t,r){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,A=-1/0;for(let c=e*6,u=(e+t)*6;ca&&(a=h);const d=n[c+2];dl&&(l=d);const p=n[c+4];pA&&(A=p)}r[0]=i,r[1]=s,r[2]=o,r[3]=a,r[4]=l,r[5]=A}function dhe(n,e,t,r,i){let s=t,o=t+r-1;const a=i.pos,l=i.axis*2;for(;;){for(;s<=o&&e[s*6+l]=a;)o--;if(sn.candidate-e.candidate,dA=new Array(sl).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),cy=new Float32Array(6);function fhe(n,e,t,r,i,s){let o=-1,a=0;if(s===QJ)o=gD(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===ahe)o=gD(n),o!==-1&&(a=phe(t,r,i,o));else if(s===RJ){const l=Gp(n);let A=cI*i;const c=r*6,u=(r+i)*6;for(let h=0;h<3;h++){const d=e[h],g=(e[h+3]-d)/sl;if(i=F.candidate?Ay(B,t,F.rightCacheBounds):(Ay(B,t,F.leftCacheBounds),F.count++)}}for(let B=0;B=sl&&(b=sl-1);const F=dA[b];F.count++,Ay(w,t,F.bounds)}const m=dA[sl-1];mD(m.bounds,m.rightCacheBounds);for(let w=sl-2;w>=0;w--){const B=dA[w],C=dA[w+1];vD(B.bounds,C.rightCacheBounds,B.rightCacheBounds)}let v=0;for(let w=0;wb&&(b=w),B>b&&(b=B);const F=(b-C)/2,x=m*2;s[d+x+0]=C+F,s[d+x+1]=F+(Math.abs(C)+F)*lhe,Ce[m+3]&&(e[m+3]=b)}}return s}function mhe(n,e){function t(m){h&&h(m/d)}function r(m,v,w,B=null,C=0){if(!p&&C>=l&&(p=!0,A&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(n))),w<=c||C>=l)return t(v+w),m.offset=v,m.count=w,m;const b=fhe(m.boundingData,B,o,v,w,u);if(b.axis===-1)return t(v+w),m.offset=v,m.count=w,m;const F=dhe(a,o,v,w,b);if(F===v||F===v+w)t(v+w),m.offset=v,m.count=w;else{m.splitAxis=b.axis;const x=new ly,_=v,M=F-v;m.left=x,x.boundingData=new Float32Array(6),uI(o,_,M,x.boundingData,s),r(x,_,M,s,C+1);const Y=new ly,O=F,U=w-M;m.right=Y,Y.boundingData=new Float32Array(6),uI(o,O,U,Y.boundingData,s),r(Y,O,U,s,C+1)}return m}Ahe(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=ghe(n,i),a=n.index.array,l=e.maxDepth,A=e.verbose,c=e.maxLeafTris,u=e.strategy,h=e.onProgress,d=n.index.count/3;let p=!1;const f=[],g=che(n);if(g.length===1){const m=g[0],v=new ly;v.boundingData=i,uhe(o,m.offset,m.count,s),r(v,m.offset,m.count,s),f.push(v)}else for(let m of g){const v=new ly;v.boundingData=new Float32Array(6),uI(o,m.offset,m.count,v.boundingData,s),r(v,m.offset,m.count,s),f.push(v)}return f}function vhe(n,e){const t=mhe(n,e);let r,i,s;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[h+6]=w/4,w=A(w,m),i[h+7]=v,w}}}class Wl{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}Wl.prototype.setFromBox=function(){const n=new j;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let A=0;A<=1;A++)for(let c=0;c<=1;c++){n.x=i.x*l+s.x*(1-l),n.y=i.y*A+s.y*(1-A),n.z=i.z*c+s.z*(1-c);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const yhe=function(){const n=new j,e=new j,t=new j;return function(i,s,o){const a=i.start,l=n,A=s.start,c=e;t.subVectors(a,A),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(c),h=c.dot(l),d=c.dot(c),p=t.dot(l),g=l.dot(l)*d-h*h;let m,v;g!==0?m=(u*h-p*d)/g:m=0,v=(u+m*h)/d,o.x=m,o.y=v}}(),nQ=function(){const n=new Ye,e=new j,t=new j;return function(i,s,o,a){yhe(i,s,n);let l=n.x,A=n.y;if(l>=0&&l<=1&&A>=0&&A<=1){i.at(l,o),s.at(A,a);return}else if(l>=0&&l<=1){A<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(A>=0&&A<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let c;l<0?c=i.start:c=i.end;let u;A<0?u=s.start:u=s.end;const h=e,d=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(c,!0,t),h.distanceToSquared(u)<=d.distanceToSquared(c)){o.copy(h),a.copy(u);return}else{o.copy(c),a.copy(d);return}}}}(),whe=function(){const n=new j,e=new j,t=new gl,r=new Sl;return function(s,o){const{radius:a,center:l}=s,{a:A,b:c,c:u}=o;if(r.start=A,r.end=c,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const f=o.getPlane(t);if(Math.abs(f.distanceToPoint(l))<=a){const m=f.projectPoint(l,e);if(o.containsPoint(m))return!0}return!1}}(),Bhe=1e-15;function Ed(n){return Math.abs(n)new j),this.satBounds=new Array(4).fill().map(()=>new Wl),this.points=[this.a,this.b,this.c],this.sphere=new ku,this.plane=new gl,this.needsUpdate=!0}intersectsSphere(e){return whe(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const A=s[1],c=o[1];A.subVectors(e,t),c.setFromPoints(A,i);const u=s[2],h=o[2];u.subVectors(t,r),h.setFromPoints(u,i);const d=s[3],p=o[3];d.subVectors(r,e),p.setFromPoints(d,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}Gl.prototype.closestPointToSegment=function(){const n=new j,e=new j,t=new Sl;return function(i,s=null,o=null){const{start:a,end:l}=i,A=this.points;let c,u=1/0;for(let h=0;h<3;h++){const d=(h+1)%3;t.start.copy(A[h]),t.end.copy(A[d]),nQ(t,i,n,e),c=n.distanceToSquared(e),c1-1e-10){const v=this.satBounds,w=this.satAxes;t[0]=d.a,t[1]=d.b,t[2]=d.c;for(let b=0;b<4;b++){const F=v[b],x=w[b];if(r.setFromPoints(x,t),F.isSeparated(r))return!1}const B=d.satBounds,C=d.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let b=0;b<4;b++){const F=B[b],x=C[b];if(r.setFromPoints(x,e),F.isSeparated(r))return!1}for(let b=0;b<4;b++){const F=w[b];for(let x=0;x<4;x++){const _=C[x];if(s.crossVectors(F,_),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(f||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const v=this.points;let w=!1,B=0;for(let y=0;y<3;y++){const I=v[y],R=v[(y+1)%3];A.start.copy(I),A.end.copy(R),A.delta(o);const N=w?c.start:c.end,k=Ed(m.distanceToPoint(I));if(Ed(m.normal.dot(o))&&k){c.copy(A),B=2;break}if((m.intersectLine(A,N)||k)&&!Ed(N.distanceTo(R))){if(B++,w)break;w=!0}}if(B===1&&d.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(B!==2)return!1;const C=d.points;let b=!1,F=0;for(let y=0;y<3;y++){const I=C[y],R=C[(y+1)%3];A.start.copy(I),A.end.copy(R),A.delta(a);const N=b?u.start:u.end,k=Ed(g.distanceToPoint(I));if(Ed(g.normal.dot(a))&&k){u.copy(A),F=2;break}if((g.intersectLine(A,N)||k)&&!Ed(N.distanceTo(R))){if(F++,b)break;b=!0}}if(F===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(F!==2)return!1;if(c.delta(o),u.delta(a),o.dot(a)<0){let y=u.start;u.start=u.end,u.end=y}const x=c.start.dot(o),_=c.end.dot(o),M=u.start.dot(o),Y=u.end.dot(o),O=_0?p.start.copy(c.start):p.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(o)<0?p.end.copy(c.end):p.end.copy(u.end)),!0)}}}();Gl.prototype.distanceToPoint=function(){const n=new j;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();Gl.prototype.distanceToTriangle=function(){const n=new j,e=new j,t=["a","b","c"],r=new Sl,i=new Sl;return function(o,a=null,l=null){const A=a||l?r:null;if(this.intersectsTriangle(o,A))return(a||l)&&(a&&A.getCenter(a),l&&A.getCenter(l)),0;let c=1/0;for(let u=0;u<3;u++){let h;const d=t[u],p=o[d];this.closestPointToPoint(p,n),h=p.distanceToSquared(n),hnew j),this.satAxes=new Array(3).fill().map(()=>new j),this.satBounds=new Array(3).fill().map(()=>new Wl),this.alignedSatBounds=new Array(3).fill().map(()=>new Wl),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Ta.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let A=0;A<=1;A++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){const h=1*A|2*c|4*u,d=i[h];d.x=A?r.x:t.x,d.y=c?r.y:t.y,d.z=u?r.z:t.z,d.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let A=0;A<3;A++){const c=o[A],u=s[A],h=1<new Sl),t=new Array(12).fill().map(()=>new Sl),r=new j,i=new j;return function(o,a=0,l=null,A=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||A)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),A&&A.copy(i)),0;const c=a*a,u=o.min,h=o.max,d=this.points;let p=1/0;for(let g=0;g<8;g++){const m=d[g];i.copy(m).clamp(u,h);const v=m.distanceToSquared(i);if(vt.far)?null:n}function aa(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,A=e+2;t&&(a=t.getX(e),l=t.getX(e+1),A=t.getX(e+2)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(A),o.y=r.getY(A),o.z=r.getZ(A)}function xD(n,e,t,r,i,s,o){const a=t.index,l=t.attributes.position;for(let A=n,c=e+n;A=0;let d,p;h?(d=Jm(n),p=Hm(n,a)):(d=Hm(n,a),p=Jm(n));const g=zB(d,s,r,HB)?l_(d,e,t,r):null;if(g){const w=g.point[c];if(h?w<=s[p+A]:w>=s[p+A+3])return g}const v=zB(p,s,r,HB)?l_(p,e,t,r):null;return g&&v?g.distance<=v.distance?g:v:g||v||null}}const _he=function(){let n,e;const t=[],r=new TJ(()=>new Cs);return function(...o){n=r.getPrimitive(),e=r.getPrimitive(),t.push(n,e);const a=i(...o);r.releasePrimitive(n),r.releasePrimitive(e),t.pop(),t.pop();const l=t.length;return l>0&&(e=t[l-1],n=t[l-2]),a};function i(s,o,a,l,A=null,c=0,u=0){function h(w){let B=w*2,C=$A,b=qA;for(;!FA(B,C);)w=Jm(w),B=w*2;return Xh(w,b)}function d(w){let B=w*2,C=$A,b=qA;for(;!FA(B,C);)w=Hm(w,b),B=w*2;return Xh(w,b)+Zm(B,C)}let p=s*2,f=$f,g=$A,m=qA;if(FA(p,g)){const w=Xh(s,m),B=Zm(p,g);return da(s,f,n),l(w,B,!1,u,c+s,n)}else{const w=Jm(s),B=Hm(s,m);let C=w,b=B,F,x,_,M;if(A&&(_=n,M=e,da(C,f,_),da(b,f,M),F=A(_),x=A(M),xi.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(A),x.b.applyMatrix4(A),x.c.applyMatrix4(A),x.needsUpdate=!0;for(let _=C*3,M=(b+C)*3;_new Gl);class Kg{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),Kg.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};const r=e.geometry,i=e._roots,s=r.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:s.array.slice()}:o={roots:i,index:s.array},o}static deserialize(e,t,r={}){if(typeof r=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),Kg.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});r={setIndex:!0,...r};const{index:i,roots:s}=e,o=new Kg(t,{...r,[dI]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new ut(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:QJ,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[dI]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[dI]||(this._roots=vhe(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Cs))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=this.geometry,r=t.index.array,i=t.attributes.position;let s,o,a,l,A=0;const c=this._roots;for(let h=0,d=c.length;hb&&(b=O),UF&&(F=U),yx&&(x=y)}return l[h+0]!==w||l[h+1]!==B||l[h+2]!==C||l[h+3]!==b||l[h+4]!==F||l[h+5]!==x?(l[h+0]=w,l[h+1]=B,l[h+2]=C,l[h+3]=b,l[h+4]=F,l[h+5]=x,!0):!1}else{const m=h+8,v=o[h+6],w=m+d,B=v+d;let C=p,b=!1,F=!1;e?C||(b=e.has(w),F=e.has(B),C=!b&&!F):(b=!0,F=!0);const x=C||b,_=C||F;let M=!1;x&&(M=u(m,d,C));let Y=!1;_&&(Y=u(v,d,C));const O=M||Y;if(O)for(let U=0;U<3;U++){const y=m+U,I=v+U,R=l[y],N=l[y+3],k=l[I],L=l[I+3];l[h+U]=RL?N:L}return O}}}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const A=a*2,c=s[A+15]===o_;if(c){const u=i[a+6],h=s[A+14];e(l,c,new Float32Array(r,a*4,6),u,h)}else{const u=a+vw/4,h=i[a+6],d=i[a+7];e(l,c,new Float32Array(r,a*4,6),d)||(o(u,l+1),o(h,l+1))}}}raycast(e,t=Lo){const r=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,A=o?t.side:t;for(let c=0,u=r.length;c{const m=p*3;return h(d,m,m+1,m+2,f,g)}}e={boundsTraverseOrder:r,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const s=Xo.getPrimitive();let{boundsTraverseOrder:o,intersectsBounds:a,intersectsRange:l,intersectsTriangle:A}=e;if(l&&A){const h=l;l=(d,p,f,g,m)=>h(d,p,f,g,m)?!0:xD(d,p,i,A,f,g,s)}else l||(A?l=(h,d,p,f)=>xD(h,d,i,A,p,f,s):l=(h,d,p)=>p);let c=!1,u=0;for(const h of this._roots){if(Ig(h),c=_he(0,i,a,l,o,u),fy(),c)break;u+=h.byteLength}return Xo.releasePrimitive(s),c}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:s}=r;const o=this.geometry.index,a=this.geometry.attributes.position,l=e.geometry.index,A=e.geometry.attributes.position;_d.copy(t).invert();const c=Xo.getPrimitive(),u=Xo.getPrimitive();if(s){let d=function(p,f,g,m,v,w,B,C){for(let b=g,F=g+m;bfI.intersectsBox(d),intersectsRange:(d,p,f,g,m,v)=>(hI.copy(v),hI.applyMatrix4(_d),e.shapecast({intersectsBounds:w=>hI.intersectsBox(w),intersectsRange:(w,B,C,b,F)=>i(d,p,w,B,g,m,b,F)}))});return Xo.releasePrimitive(c),Xo.releasePrimitive(u),h}intersectsBox(e,t){return Tc.set(e.min,e.max,t),Tc.needsUpdate=!0,this.shapecast({intersectsBounds:r=>Tc.intersectsBox(r),intersectsTriangle:r=>Tc.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){e.boundingBox||e.computeBoundingBox(),Tc.set(e.boundingBox.min,e.boundingBox.max,t),Tc.needsUpdate=!0;const a=this.geometry,l=a.attributes.position,A=a.index,c=e.attributes.position,u=e.index,h=Xo.getPrimitive(),d=Xo.getPrimitive();let p=py,f=Uhe,g=null,m=null;i&&(g=Qhe,m=Rhe);let v=1/0,w=null,B=null;return _d.copy(t).invert(),Zp.matrix.copy(_d),this.shapecast({boundsTraverseOrder:C=>Tc.distanceToBox(C),intersectsBounds:(C,b,F)=>F{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:F=>Zp.distanceToBox(F),intersectsBounds:(F,x,_)=>_{for(let _=F*3,M=(F+x)*3;_(Jp.copy(e).clamp(c.min,c.max),Jp.distanceToSquared(e)),intersectsBounds:(c,u,h)=>h{c.closestPointToPoint(e,Jp);const h=e.distanceToSquared(Jp);return h{da(0,new Float32Array(r),ID),e.union(ID)}),e}}const pI=new u0,FD=new He,Mhe=In.prototype.raycast;function The(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;FD.copy(this.matrixWorld).invert(),pI.copy(n.ray).applyMatrix4(FD);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=bD(t.raycastFirst(pI,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(pI,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new rs,i=new j,s=new j,o=new j,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&ww(n.userData.cancelMesh))},NJ=n=>{var e,t;n.userData.cullingClone&&(ww(n.userData.cullingClone),n.userData.cullingClone=null,ww(n.userData.cullingCloneP),n.userData.cullingCloneP=null,ww(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},Ghe=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Fg=n[0].parent,Fg.lines!=null&&(Fg.lines.forEach(i=>{i.visible=!1}),Fg.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=Whe(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=Vhe,a.userData.cancelMesh=o,a.material=Phe,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},Zhe=n=>{let e=Dhe,t=Lhe;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},Jhe=(n,e,t,r,i,s,o=!1)=>{const a=[],l=Zhe(s);let A=l[0],c=l[1];gy.far=A+c;for(let h=0;h=0;v--)A-m[v].distance>=m[v].object.userData.maxCullDistance&&m.splice(v,1);if(m.length===0){for(let v=0;v<3;v++)a.push(n[d+v]);break}else{const v=m.map(w=>w.object);for(let w=0;ww).length===0){for(let w=0;w<3;w++)a.push(n[d+w]);break}if(f===0)p=m.map(w=>w.object);else if(p=m.map(w=>{if(p.indexOf(w.object)!==-1)return w.object}),p=p.filter(w=>w),f===2&&p.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[d+w]);o&&Hhe(gI,Hp.clone().multiplyScalar(-1),gy.far,16711680,Fg)}}}const u=new Uint32Array(a);return new ut(u,1,!1)};function Hhe(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new j;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new Ht().setFromPoints(o),l=[];l.push(new Le(0)),l.push(new Le(16777215));let A=new zl({color:r});var c=new Pf(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}function kJ(n){let e,t,r,i=0;for(let a=0;atypeof window>"u"?await $he({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await qhe({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o}),$he=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(F=>{const x=F.material;let _=a.find(M=>M.material===x);if(!_)a.push({material:x,mesh:F});else{const{dest:M}=rQ({meshes:[_.mesh,F]});_.mesh.geometry=M}});const l=Object.fromEntries(o.map(F=>[F,DJ({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((F,x)=>{const _=new Ye(x%A,Math.floor(x/A)).multiplyScalar(1/A),M=new Ye(_.x+1/A,_.y+1/A);return[F.mesh,{min:_,max:M}]})),h={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},d=[],p=[];a.forEach(F=>{const{min:x,max:_}=u.get(F.mesh);p.push(_),d.push(x)});const f=new Ye(Math.max(...p.map(F=>F.x)),Math.max(...p.map(F=>F.y))),g=new Ye(Math.min(...d.map(F=>F.x)),Math.min(...d.map(F=>F.y))),m=1/(f.x-g.x),v=1/(f.y-g.y),w=c*m,B=c*v,C=new Map(a.map(F=>{let{min:x,max:_}=u.get(F.mesh);return x.x=x.x*m,x.y=x.y*v,_.x=_.x*m,_.y=_.y*v,[F.mesh,{min:x,max:_}]}));a.forEach(F=>{const{material:x,mesh:_}=F,{min:M,max:Y}=C.get(_);o.forEach(I=>{const R=l[I];R.globalCompositeOperation="source-over";let N=c_(x,h[I].find(k=>c_(x,k)));if(N!==""&&N!==void 0)try{const k=new Uint8ClampedArray(N.data),L=new ImageData(k,w,B),G=document.createElement("canvas");G.width=w,G.height=B;const D=G.getContext("2d");D.putImageData(L,0,0),D.save(),R.drawImage(G,M.x*s,M.y*s,w,B)}catch(k){console.error("error",k)}else R.fillStyle=I==="diffuse"?`#${x.color.clone().getHexString()}`:I==="normal"?"#8080ff":I==="orm"?`#${new Le(x.aoMapIntensity,x.roughness,x.metalness).getHexString()}`:"#7F7F7F",R.fillRect(M.x*s,M.y*s,w,B)});const O=_.geometry,U=O.attributes.uv;if(U)for(let I=0;I{const x=new or(l[F].canvas);return x.flipY=!1,[F,x]})));return{bakeObjects:a,textures:b,uvs:C}},qhe=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o})=>{zhe();const a=t,l=r?["diffuse"]:["diffuse","orm","normal"],A=[];let c=null;e.forEach(y=>{y=y.clone();const I=y.material.length==null?y.material:y.material[0];r&&c==null&&I.type=="ShaderMaterial"&&(c=I.clone());let R=A.find(N=>{N.material});if(!R)A.push({material:I,mesh:y});else{const{dest:N}=rQ({meshes:[R.mesh,y]});R.mesh.geometry=N}});const u=Object.fromEntries(l.map(y=>[y,DJ({width:a,height:a,transparent:s&&y=="diffuse"})])),h=Math.floor(Math.sqrt(e.length)+1),d=a/h,p=new Map(A.map((y,I)=>{const R=new Ye(I%h,Math.floor(I/h)).multiplyScalar(1/h),N=new Ye(R.x+1/h,R.y+1/h);return[y.mesh,{min:R,max:N}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},g=[],m=[];A.forEach(y=>{const{min:I,max:R}=p.get(y.mesh);m.push(R),g.push(I)});const v=new Ye(Math.max(...m.map(y=>y.x)),Math.max(...m.map(y=>y.y))),w=new Ye(Math.min(...g.map(y=>y.x)),Math.min(...g.map(y=>y.y))),B=1/(v.x-w.x),C=1/(v.y-w.y),b=d*B,F=d*C,x=new Map(A.map(y=>{let{min:I,max:R}=p.get(y.mesh);return I.x=I.x*B,I.y=I.y*C,R.x=R.x*B,R.y=R.y*C,[y.mesh,{min:I,max:R}]}));let _=!1;A.forEach(y=>{const{material:I,mesh:R}=y,{min:N,max:k}=x.get(R);l.forEach(E=>{var de;const z=u[E];z.globalCompositeOperation="source-over";let re,T=new Le(1,1,1);switch(E){case"diffuse":re=I.color||n,(de=I.uniforms)!=null&&de.litFactor?T=I.uniforms.litFactor.value:T=I.color;break;case"normal":re=new Le(8421631);break;case"orm":re=new Le(0,I.roughness,I.metalness);break;default:re=new Le(1,1,1);break}let ee=jhe(I,f[E].find(Ae=>c_(I,Ae)));_==!1&&E=="normal"&&ee!=null&&(_=!0);const pe=Xhe(ee,T,re,a,a,E=="diffuse"&&s,E!="normal");createImageBitmap(pe).then(Ae=>z.drawImage(Ae,N.x*a,N.y*a,b,F))});const L=R.geometry.clone();R.geometry=L;const G=L.attributes.uv.clone();if(L.attributes.uv=G,G)for(let E=0;E{const I=new or(u[y].canvas);return I.flipY=!1,[y,I]}))),Y=o?mi:Lo;let O;const U=i?"transparent":"opaque";return r?(O=new bu({map:M.diffuse,transparent:i,side:Y}),c==null&&(c=new mw),c.side=Y,c.uniforms.map=M.diffuse,c.uniforms.shadeMultiplyTexture=M.diffuse,c.transparent=i,s&&!i&&(O.alphaTest=.5,c.alphaTest=.5),O.userData.vrmMaterial=c,O.userData.shadeTexture=M.uniformColor,O.name="mToon_"+U,O.map.name=O.name):(O=new bu({map:M.diffuse,roughnessMap:M.orm,metalnessMap:M.orm,normalMap:_?M.normal:null,transparent:i,side:Y}),s&&!i&&(O.alphaTest=.5),O.name="standard_"+U,O.roughnessMap!=null&&(O.roughnessMap.name=O.name+"_orm"),O.normalMap!=null&&(O.normalMap.name=O.name+"_normal")),{bakeObjects:A,material:O}};function LJ(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new wc(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function VJ(n,e){const t=new Map;new j(-1,1,-1),new He,new j;let r=0;n.forEach(l=>{if(l.skeleton){var A=LJ(l);const c=A.bones;A.bones.forEach((u,h)=>{var d;if(c.indexOf(u)!==-1){const p=t.get(u.name);if(p==null){const f={index:r,boneInverses:A.boneInverses[h],bone:u.clone(!1),parentName:((d=u.parent)==null?void 0:d.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,f)}else u.userData.VRMcolliders!=null&&(p.bone.userData.VRMcolliders==null?p.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=p.bone.userData.VRMcollidersID&&(p.bone.userData.VRMcolliders=[...p.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var A;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const c=(A=t.get(l.parentName))==null?void 0:A.bone;c&&c.add(l.bone)}});const a=new wc(i,s);return a.bones.forEach(l=>{var c;const A=(c=l.userData)==null?void 0:c.vrm0RestPosition;A&&l.position.set(-A.x,A.y,-A.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function efe(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(c=>c.name===o.name),A=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,A)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function tfe(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function YB(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function ife(n,e){const{scale:t,isVrm0:r}=e,i=[],s=[];Sf(n,"SkinnedMesh").forEach(A=>{const c=A.clone();i.push(c),Array.isArray(A.material)?s.push(...A.material):s.push(A.material)});const a=VJ(i,t),l=new Rt;return l.name="AvatarRoot",i.forEach(A=>{var b;const c=new Ht,u={};for(const F in A.geometry.attributes){const x=A.geometry.attributes[F];u[F]=x.clone()}if((b=A.userData)!=null&&b.isVRM0)for(let F=0;F[F,F.geometry.morphAttributes])),p=new Map([A].map(F=>[F,F.morphTargetDictionary||{}]));if(h.morphAttributes=OJ({meshes:[A],sourceMorphAttributes:d,sourceMorphTargetDictionaries:p,destMorphTargetDictionary:h.morphTargetDictionary,scale:t},r),r)for(let F=0;Fd.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new j(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],A=[],c=t.geometry.attributes.position.array,u=new j,h=e.userData.isVRM0?-1:1;for(let d=0;d0){const{bakeObjects:M,material:Y}=await Khe({transparentColor:t,atlasSize:x.size,meshes:_,mtoon:x.isMtoon,transparentMaterial:x.transparentMaterial,transparentTexture:w,twoSidedMaterial:u}),O=M.map(k=>k.mesh),U=[];O.forEach(k=>{k.type=="Mesh"&&(k=ofe(C,k)),U.push(k);const L=k.geometry,G=L.index.array,D=PJ(k.geometry.index.array),E=[];for(let T=0;T{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function Afe({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=kJ(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function cfe({sourceMorphTargetDictionaries:n}){const e=new Set;Array.from(n.values()).forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map((i,s)=>{r[i]=s}),r}function OJ({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i},s=!1){const o=new Set;Array.from(t.values()).forEach(u=>{Object.keys(u).forEach(h=>o.add(h))});const l=Array.from(o),A={};l.forEach(u=>{A[u]=[],Object.entries(r).forEach(([h,d])=>{A[u][d]=[],n.forEach(p=>{let f;const g=e.get(p);if(g.hasOwnProperty(h)&&p.geometry.morphAttributes[u]){const m=g[h];f=p.geometry.morphAttributes[u][m]}else{const m=p.geometry.attributes[u],v=new m.array.constructor(new Array(m.array.length).fill(0));f=new ut(v,m.itemSize,m.normalized)}A[u][d].push(f)})})});const c={};return l.forEach(u=>{c[u]=[];for(let h=0;h{const i=r.geometry.index;for(var s=0;s{var l;if(r+=a.geometry.attributes.uv.count,(l=a.userData)!=null&&l.isVRM0)for(let A=0;A[a,a.geometry.attributes])),morphAttributes:new Map(n.map(a=>[a,a.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(a=>[a,a.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(a=>[a,a.morphTargetInfluences||[]]))},s={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};s.attributes=Afe({sourceAttributes:i.attributes});const o=cfe({sourceMorphTargetDictionaries:i.morphTargetDictionaries});return s.morphTargetDictionary=o,s.morphAttributes=OJ({meshes:n,sourceMorphAttributes:i.morphAttributes,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o,scale:e},t),s.morphTargetInfluences=lfe({meshes:n,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o}),s.index=ufe({meshes:n}),s.animations={},{source:i,dest:s}}function ht(n){return n==null?[]:Array.isArray(n)?n:[n]}function dfe(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function hfe(n,e){const r=await new Pu().load(e);r.encoding=mt,r.flipY=!1,n.traverse(i=>{if(i instanceof In){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}Ghe(e)};function gfe(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=ht(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((A=l.uniforms.alphaTest)==null?void 0:A.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function mfe(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ht(a.material).forEach(A=>{A.type=="ShaderMaterial"?A.transparent==!0?o.push(A):A.uniforms.alphaTest.value!=0?s.push(A):i.push(A):A.transparent==!0?r.push(A):A.alphaTest!=0?t.push(A):e.push(A)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function _D(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function vfe(n,e){if(n.data!=null)return n.data[e]}function yfe(n){const e=vfe(n,"cullingMeshes");e&&(e.forEach(t=>{NJ(t)}),n.data.cullingMeshes=null)}function Cn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function wfe(n){const e=n.scene;yfe(n),e.traverse(t=>{t.material&&u_(t.material),t.geometry&&(NJ(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),C0.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&u_(i.material)})})});for(const t in n)n[t]=null}const u_=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{let e,t,r=0;return Array.isArray(n)?(e=n[0]||0,t=n[1]||0,r=n[2]||0):(typeof n=="string"||n instanceof String)&&n.split("-").forEach(s=>{switch(s=s.toLowerCase(),s){case"left":e=-1;break;case"right":e=1;break;case"bottom":case"down":t=-1;break;case"top":case"up":t=1;break;case"back":case"backward":r=-1;break;case"front":case"forward":r=1;break;default:console.warn("unkown cameraPosition name: "+s+" in: "+n+". Please use left, right, bottom, top, back or front");break}}),new j(e,t,r)},WJ=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},Bfe=n=>{var t,r,i,s,o,a,l,A,c,u,h;const e=n.humanoid.humanBones;e.hips.node.parent.name="rootBone",e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:e.upperChest!=null&&(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((A=e.spine)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((c=e.neck)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let d in Wm)d=d.charAt(0).toLowerCase()+d.slice(1),(h=e[d])!=null&&h.node&&(e[d].node.name=d)};function GJ({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),GJ({candidates:n,predicate:e}))}function ZJ(n,e){return GJ({candidates:[n],predicate:t=>t.name===e})}function JJ({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),JJ({candidates:n,predicate:e,results:t})}function Sf(n,e){return JJ({candidates:[n],predicate:t=>ht(e).includes(t.type)})}const Cfe={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function HJ(n,e,t){var f;const r=xu.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new rt,o=new rt,a=new rt,l=new j,A=e.getObjectByName("mixamorigHips").position.y,c=(f=t.humanoid)==null?void 0:f.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,d=Math.abs(c-u)/A;return r.tracks.forEach(g=>{const m=g.clone(),v=m.name.split("."),w=v[0],C=Cfe[w],b=e.getObjectByName(w);if(C!=null){const F=v[1];if(b.getWorldQuaternion(s).invert(),b.parent.getWorldQuaternion(o),m instanceof Ra){for(let x=0;x{m.values[Y+x]=M})}i.push(new Ra(`${C}.${F}`,m.times,m.values.map((x,_)=>{var M;return((M=t.meta)==null?void 0:M.metaVersion)==="0"&&_%2===0?-x:x})))}else if(m instanceof ac){const x=m.values.map((_,M)=>{var Y;return(((Y=t.meta)==null?void 0:Y.metaVersion)==="0"&&M%3!==1?-_:_)*d});i.push(new ac(`${C}.${F}`,m.times,x))}}}),new xu("vrmAnimation",r.duration,i)}const bfe=new Vse,xfe=new QU,yI=.2,Ife=n=>Math.floor(Math.random()*n);class SD{constructor(e,t,r,i,s,o,a){var l,A,c,u;this.mixer=new Mie(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(A=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:A.neck,this.spineBone=(u=(c=r==null?void 0:r.humanoid)==null?void 0:c.humanBones)==null?void 0:u.spine,this.timeScale=1,i&&(this.setAnimations(i,null,null,a),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play())}setTimeScale(e){this.timeScale=e,this.actions.forEach(t=>{t.timeScale=e})}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t=null,r=null,i=!1){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const s=HJ(e,t,this.vrm);s&&(e=[s],this.mixamoModel=t)}}else{const s=[];e.forEach(o=>{s.push(o.clone())}),e=s}if(r&&e[0].tracks.map((s,o)=>{(s.name==="neck.quaternion"||s.name==="spine.quaternion")&&e[0].tracks.splice(o,1)}),i){this.actions.forEach(s=>{s.weight=0,s.stop()}),this.actions=[],this.newAnimationWeight=1;for(let s=0;s{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}setTime(e){this.mixer.setTime(e)}getTime(){return this.mixer.time}dispose(){this.animationManager.disposeAnimation(this)}}class Ffe{constructor(){this.animationPaths=[],this.defaultAnimations=[],this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.paused=!1,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,this.currentClip=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t,r=0,i=!0,s="",o=""){const a=s+(s!=""?"/":"")+ht(e)[0];o=o==""?Ul(a):o,this.currentAnimationName=o;const A=await(i?bfe:xfe).loadAsync(a);A.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(A.animations);const c=xu.findByName(A.animations,"mixamo.com");c!=null?(this.mixamoModel=A.clone(),this.mixamoAnimations=A.animations,this.currentClip=c):(this.mixamoModel=null,this.animations=A.animations,this.currentClip=A.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new SD(this,A,null,A.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(A.animations,this.mixamoModel,this.mouseLookEnabled,t)}),this.setTime(r),t?this.pause():this.play()}getCurrentClip(){return this.currentClip}getCurrentClipDuration(){return this.currentClip?this.currentClip.duration:0}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=this.defaultAnimations,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t,r=!0){const i=ht(e);r?this.animationPaths=[...this.defaultAnimations,...i.map(s=>`${t}/${s}`)]:this.animationPaths=i.map(s=>t!=""?`${t}/${s}`:s)}storeDefaultAnimationPaths(e,t){const r=ht(e);this.defaultAnimations=r.map(i=>t!=""?`${t}/${i}`:i),this.animationPaths=this.defaultAnimations}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=Ife(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-yI)},e*1e3)}pause(){this.paused=!0}play(){this.paused=!1}isPaused(){return this.paused}setTime(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTime(e)})}setFrame(e){this.setTime(e*30)}setSpeed(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTimeScale(e)})}update(e=!1){(this.mainControl&&!this.paused||e)&&(this.animationControls.forEach(t=>{t.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*yI):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*yI):this.weightOut=0)}}const UD={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -4214,7 +4214,7 @@ void main() { texel.rgb = pow(texel.rgb, vec3(1.0 / 2.2)); gl_FragColor = texel; } - `})}}const XB=4096,zp=new j;class Mfe{constructor(e,t,r){const i=new h0({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new Ye(XB,XB);i.setClearColor(0,0),i.outputEncoding=gs,i.setSize(s.x,s.y),i.setPixelRatio(window.devicePixelRatio);let o=s.clone().divideScalar(r);o.x|=0,o.y|=0;const a=new Sfe(i);a.addPass(new Ufe(e,t)),this._renderPixelPass=new Qfe(o,e,t),this._pixelPass=new Rfe(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new Ye(e,t).clone().divideScalar(this.pixelSize);i.x|=0,i.y|=0,this.renderer.setSize(e,t),this._renderPixelPass.setResolution(i),this._pixelPass.setResolution(i)}setPixelSize(e){this.pixelSize=e}render(){this.composer.render()}}class Tfe{constructor(e,t){this.renderer=new h0({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputEncoding=mt,this.renderer.setSize(XB,XB),this.camera=new Nr(30,1,.1,1e3),this.textureLoader=new Pu,this.sceneBackground=new Le(.1,.1,.1),this.sceneBackgroundAlpha=1,this.frameOffset={min:.2,max:.2},this.usesBackgroundImage=!1,this.backgroundMaterial=new Ri({color:16777215,transparent:!0,opacity:.5});const r=new Du(1e3,1e3),i=new In(r,this.backgroundMaterial);i.renderOrder=-1,this.backgroundPlane=i,this.pixelRenderer=new Mfe(t,this.camera,20),this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setScene(e){this.scene=e}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=r}_getCharacterMinMax(){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY;return this.characterManager.characterModel.traverse(r=>{r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(r.geometry.boundingBox.applyMatrix4(r.matrixWorld),r.geometry.boundingBox.min.yt&&(t=r.geometry.boundingBox.max.y)))}),{minY:e,maxY:t}}frameCloseupShot(){this.frameShot("head","head")}frameMediumShot(){this.frameShot("chest","head")}frameCowboyShot(){this.frameShot("hips","head")}frameFullShot(){this.frameShot("leftFoot","head")}frameShot(e,t,r=null,i=!1,s=!0){const o=this._getBoneWorldPositionWithOffset(e,i),a=this._getBoneWorldPositionWithOffset(t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new j(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}async calculateBoneOffsets(e){for(const t in this.boneOffsets){const r=await this._getMinMaxOffsetByBone(this.characterManager.characterModel,t,e);this.boneOffsets[t]=r}}_getBoneWorldPositionWithOffset(e,t){const r=this._getFirstBoneWithName(e);if(!r||!this.boneOffsets[e])return new j;const i=new j;r.getWorldPosition(i);const s=t?this.boneOffsets[e].max:this.boneOffsets[e].min;return i.y+=s.y,i}_getBoneWorldPosition(e){const t=this._getFirstBoneWithName(e);return t!=null?new j().setFromMatrixPosition(t.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new j(0,0,0))}_getFirstBoneWithName(e){let t=null;return this.characterManager.characterModel.traverse(r=>{if(r instanceof _l){if(!r.geometry){console.error("Invalid skinned mesh found in children.");return}const i=r.skeleton.bones.findIndex(s=>s.name===e);if(i!==-1){t=r.skeleton.bones[i];return}}}),t}setCameraFrameWithName(e,t){switch(e.toLowerCase()){case"fullshot":this.frameShot("leftFoot","head",t);break;case"cowboyshot":this.frameShot("hips","head",t);break;case"mediumshot":this.frameShot("chest","head",t);break;case"mediumcloseup":case"mediumcloseupshot":this.frameShot("chest","head",t,!0);break;case"closeup":case"closeupshot":this.frameShot("head","head",t);break;default:console.warn("unkown cameraFrame: "+e+". Please use fullShot, cowboyShot, mediumShot, mediumCloseup or closeup"),this.frameShot("leftFoot","head",t);break}}async _getMinMaxOffsetByBone(e,t,r){return new Promise(async(i,s)=>{(!e||!e.traverse)&&(console.error("Invalid parent object provided."),s(null));const o=new j(1/0,1/0,1/0),a=new j(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof _l&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let A=0;await(u=>new Promise(h=>setTimeout(h,u)))(10),e.traverse(u=>{if(u instanceof _l){if(!u.geometry){console.error("Invalid skinned mesh found in children.");return}const h=u.skeleton.bones.findIndex(g=>g.name===t);if(h===-1){console.error(`Bone with name '${t}' not found in one of the skinned meshes.`);return}const d=u.geometry.getAttribute("position"),p=u.geometry.getAttribute("skinWeight"),f=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const B=u.skeleton.bones[h],C=new j().setFromMatrixPosition(B.matrixWorld),b=m.clone().sub(C);o.min(b),a.max(b)}}this._restoreSavedPose(l[A],u.skeleton),A++}}),i({min:o,max:a})})}_saveBonesPos(e){let t=[];return e.bones.forEach(r=>{t.push({position:r.position.clone(),rotation:r.rotation.clone(),scale:r.scale.clone()})}),t}_restoreSavedPose(e,t){e&&t.bones.forEach((r,i)=>{r.position.copy(e[i].position),r.rotation.copy(e[i].rotation),r.scale.copy(e[i].scale)})}positionCameraBetweenPoints(e,t,r,i=30){const s=new Cs;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new j).length()/(2*Math.tan(o/2));s.getCenter(zp),this.camera.position.copy(zp),r.y*=.5,this.camera.lookAt(zp.clone().sub(r));const A=new j;this.camera.getWorldDirection(A),this.camera.position.addScaledVector(A,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,zp.set(0,0,-1),this.cameraDir=zp.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setBackground(e){if(Array.isArray(e)){const t=e[3]==null?1:e[3];this.setBackgroundColor(e[0],e[1],e[2],t)}else this.setBackgroundImage(e)}setBackgroundColor(e,t,r,i){const s=new Le(e,t,r,i);this.sceneBackground=s,i==null&&(i=1),i>1&&(i=1),i<0&&(i=0),this.sceneBackgroundAlpha=i,this.backgroundMaterial.color=s,this.usesBackgroundImage=!1}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=ps,this.sceneBackground=i,this.usesBackgroundImage=!0,this.sceneBackgroundAlpha=1,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}_setBackground(){if(this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1)if(this.sceneBackgroundAlpha==0)this.scene.background=null;else{this.scene.background=null,this.scene.add(this.backgroundPlane),this.backgroundPlane.position.copy(this.camera.position);var e=new j(0,0,-1);e.applyQuaternion(this.camera.quaternion);var t=100;this.backgroundPlane.position.addScaledVector(e,t),this.backgroundPlane.lookAt(this.camera.position)}else this.scene.background=this.sceneBackground}_restoreBackground(){this.scene.background=null,this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1&&this.scene.remove(this.backgroundPlane)}getImageData(e,t,r=null){return this._createImage(e,t,r).split("base64,")[1]}_createImage(e,t,r=null){const i=e/t;typeof r=="number"&&this.pixelRenderer.setPixelSize(r),this.renderer.setSize(e,t),this.pixelRenderer.setSize(e,t);const s="image/png";this.camera.aspect=i,this.camera.updateProjectionMatrix();const o=typeof r=="number"?this.pixelRenderer:this.renderer;try{this._setBackground(),o.render(this.scene,this.camera);let a=o.domElement.toDataURL(s);return this._restoreBackground(),a}catch(a){return console.error(a),null}}savePixelScreenshot(e,t,r,i){this.pixelRenderer.setPixelSize(i),this.pixelRenderer.setSize(t,r);const s=this._createImage(t,r,!0),o="image/octet-stream",a="image/png";this.saveFile(s.replace(a,o),e+".png")}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new or(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=C4.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const Nfe=2;class kfe{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new RZ,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=Nfe,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(ui.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function YJ(){return(YJ=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;h%8&&(h+=8-h%8);let d=[],p=new DataView(new ArrayBuffer(24*n.levels.length)),f=(h||u+s.byteLength)+t.byteLength;for(let v=0;v0?h:0),!0),m.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(Xp([new Uint8Array(Rr).buffer,g,p.buffer,a,s,new ArrayBuffer(h>0?h-(u+s.byteLength):0),t,...d]))}var h_,f_,Gfe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},p_=new OffscreenCanvas(128,128),kD=p_.getContext("2d",{willReadFrequently:!0}),XJ=typeof document>"u";function Zfe(n){return createImageBitmap(n).then(function(e){return p_.width=e.width,p_.height=e.height,kD.drawImage(e,0,0),kD.getImageData(0,0,e.width,e.height)})}function Jfe(n,e){return e===void 0&&(e={}),zfe().then(function(t){var r=new t.BasisEncoder;return Hfe(e,r),r.setTexType(h_.cBASISTexType2D),Lfe(n,ArrayBuffer)&&(n=new Blob([n])),Zfe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,f_.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=Pfe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=Wfe(l,{keepWriter:!0})}return a})})}function Hfe(n,e){n===void 0&&(n={}),(n=Dfe({},Gfe,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var wI=null;function zfe(){return wI||(wI=new Promise(function(n,e){XJ?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),wI}XJ&&self.addEventListener("message",function(n){Jfe(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class Yfe{constructor(e,t){if(this.gl=e,this.libktx=null,e!==void 0)if(t===void 0&&LIBKTX!==void 0&&(t=LIBKTX),t!==void 0)this.initializied=this.init(e,t);else{console.error("Failed to initalize KTXDecoder: ktx library undefined");return}else{console.error("Failed to initalize KTXDecoder: WebGL context undefined");return}}async init(e,t){this.libktx=await t({preinitializedWebGLContext:e}),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(e.canvas,{majorVersion:2}))}stringToUastcFlags(e){return e==="FASTER"?this.libktx.UastcFlags.LEVEL_FASTER.value:e==="FASTEST"?this.libktx.UastcFlags.LEVEL_FASTEST.value:e==="SLOWER"?this.libktx.UastcFlags.LEVEL_SLOWER.value:e==="SLOWEST"?this.libktx.UastcFlags.LEVEL_VERYSLOW.value:this.libktx.UastcFlags.LEVEL_DEFAULT.value}stringToSupercmpScheme(e){return e==="Zstd"?this.libktx.SupercmpScheme.ZSTD:e==="Zlib"?this.libktx.SupercmpScheme.ZLIB:e==="BasisLZ"?this.libktx.SupercmpScheme.BASIS_LZ:this.libktx.SupercmpScheme.NONE}transcodeRGBA(e){if(!e.needsTranscoding)return;const t=this.libktx.TranscodeTarget.RGBA8888;e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}transcode(e){if(e.gpuFormat="RGBA8888",e.needsTranscoding){let t,r=!1,i=!1,s=!1,o=!1,a=!1;r=!!this.gl.getExtension("WEBGL_compressed_texture_astc"),i=!!this.gl.getExtension("WEBGL_compressed_texture_etc1"),s=!!this.gl.getExtension("WEBGL_compressed_texture_s3tc"),o=!!this.gl.getExtension("EXT_texture_compression_bptc"),a=!!this.gl.getExtension("WEBGL_compressed_texture_pvrtc")||!!this.gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),r?(t=this.libktx.TranscodeTarget.ASTC_4x4_RGBA,e.gpuFormat="ASTC_4x4_RGBA"):o?(t=this.libktx.TranscodeTarget.BC7_RGBA,e.gpuFormat="BC7_RGBA"):s?(t=this.libktx.TranscodeTarget.BC1_OR_3,e.gpuFormat="BC1_OR_3"):a?(t=this.libktx.TranscodeTarget.PVRTC1_4_RGBA,e.gpuFormat="PVRTC1_4_RGBA"):i?(t=this.libktx.TranscodeTarget.ETC,e.gpuFormat="ETC"):(t=this.libktx.TranscodeTarget.RGBA8888,e.gpuFormat="RGBA8888"),e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}}async loadKtxFromUri(e){await this.initializied;const t=await fetch(e),r=new Uint8Array(await t.arrayBuffer()),i=new this.libktx.ktxTexture(r);this.transcode(i);let s=i.glUpload();if(s.texture==null){console.error("Could not load KTX data");return}return s.texture.levels=Math.log2(i.baseWidth),s.texture.width=i.baseWidth,s.texture.height=i.baseHeight,s.texture.gpuSize=i.dataSize,s.texture.gpuFormat=i.gpuFormat,s.texture.isSRGB=i.isSRGB,s.texture}async loadKtxFromBuffer(e){await this.initializied;const t=new this.libktx.ktxTexture(e);this.transcode(t);const r=t.glUpload();if(r.texture==null){console.error("Could not load KTX data");return}return r.texture.levels=Math.log2(t.baseWidth),r.texture.width=t.baseWidth,r.texture.height=t.baseHeight,r.texture.gpuSize=t.dataSize,r.texture.gpuFormat=t.gpuFormat,r.texture.isSRGB=t.isSRGB,r.texture}async compress(e,t,r,i,s={}){const o=new this.libktx.ktxTexture(e,t,r,i,s.srgb);if(!s.hasOwnProperty("basisu_options")){const A=new this.libktx.ktxBasisParams;A.uastc=!1,A.noSSE=!0,A.verbose=!1,A.qualityLevel=100,A.compressionLevel=2,s.basisu_options=A}s.hasOwnProperty("compression_level")||(s.compression_level=18),s.hasOwnProperty("supercmp_scheme")||(s.supercmp_scheme=this.libktx.SupercmpScheme.NONE),console.log(s);const a=o.compressBasisU(s.basisu_options,s.supercmp_scheme,s.compression_level);return Uint8ClampedArray.from(a)}}class Xfe{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new Yfe(t,window.LIBKTX);await r.init(t,window.LIBKTX),this.ktxEncoder=r,this.libktx=r.libktx}async compress(e,t,r,i,s={}){const o=await new this.libktx.ktxBasisParams,a=s;return o.uastc=a.uastc!==void 0?a.uastc:!1,o.noSSE=a.noSSE!==void 0?a.noSSE:!1,o.verbose=a.verbose!==void 0?a.verbose:!1,o.normalMap=a.normalMap!==void 0?a.normalMap:!1,o.compressionLevel=a.compressionLevel!==void 0?a.compressionLevel:1,o.qualityLevel=a.qualityLevel!==void 0?a.qualityLevel:60,o.maxEndpoints=a.ETC1SmaxEndpoints!==void 0?a.ETC1SmaxEndpoints:0,o.endpointRDOThreshold=a.ETC1SEndpointRdoThreshold!==void 0?a.ETC1SEndpointRdoThreshold:1.25,o.maxSelectors=a.ETC1SMaxSelectors!==void 0?a.ETC1SMaxSelectors:0,o.selectorRDOThreshold=a.ETC1SSelectorRdoThreshold!==void 0?a.ETC1SSelectorRdoThreshold:1.25,o.noEndpointRDO=a.ETC1SNoEndpointRdo!==void 0?a.ETC1SNoEndpointRdo:!1,o.noSelectorRDO=a.ETC1SNoSelectorRdo!==void 0?a.ETC1SNoSelectorRdo:!1,o.uastcFlags=this.ktxEncoder.stringToUastcFlags(a.uastcFlags),o.uastcRDO=o.uastcRDO!==void 0?o.uastcRDO:!1,o.uastcRDOQualityScalar=a.uastcRDOQualityScalar!==void 0?a.uastcRDOQualityScalar:1,o.uastcRDODictSize=a.uastcRDODictSize!==void 0?a.uastcRDOQualityScalar:4096,o.uastcRDOMaxSmoothBlockErrorScale=a.uastcRDOMaxSmoothBlockErrorScale!==void 0?a.uastcRDOMaxSmoothBlockErrorScale:10,o.uastcRDOMaxSmoothBlockStdDev=a.uastcRDOMaxSmoothBlockStdDev!==void 0?a.uastcRDOMaxSmoothBlockStdDev:18,o.uastcRDODontFavorSimplerModes=a.uastcRDODontFavorSimplerModes!==void 0?a.uastcRDODontFavorSimplerModes:!1,s.basisu_options=o,s.hasOwnProperty("supercmp_scheme")?s.supercmp_scheme=this.ktxEncoder.stringToSupercmpScheme(s.supercmp_scheme):s.supercmp_scheme=this.libktx.SupercmpScheme.NONE,await this.ktxEncoder.compress(e,t,r,i,s)}}var kn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(kn||(kn={}));const g_="blend_",DD="vrmColliderSphere";function jfe(n){var e;return{title:n.name,version:"v0",author:((e=n.authors)==null?void 0:e.length)>0?n.authors.join(", "):"",reference:n.references!=null?n.references.join(", "):"",contactInformation:n.contactInformation!=null?n.contactInformation:"",otherPermissionUrl:n.otherPermissionUrl,allowedUserName:n.avatarPermission!=null?n.avatarPermission:"",violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:n.commercialUsage=="personalProfit"||n.commercialUsage=="corporation"?"Allow":"Disallow",licenseName:n.copyrightInformation,otherLicenseUrl:n.otherLicenseUrl,metaVersion:"0"}}function Kfe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function $fe(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function qfe(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class epe{async parse(e,t,r,i,s,o,a){var be;const l=jfe(e.meta),A=Kfe(e.humanoid),c=e.materials,u=[],h={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(A)if(l){if(!c)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const d=c.filter((W,H,ie)=>ie.findIndex(ae=>ae.name===W.name.replace(" (Outline)",""))===H).map(W=>W),p=d.map(W=>W.name),f=r?{name:"icon",imageBitmap:r.image}:null,g=d.filter(W=>W.map).map(W=>{if(!W.map)throw new Error(W.name+" map is null");return{name:W.name,imageBitmap:W.map.image}}),m=d.filter(W=>W.userData.shadeTexture).map(W=>{if(!W.userData.shadeTexture)throw new Error(W.userData.shadeTexture+" map is null");return{name:W.name+"_shade",imageBitmap:W.userData.shadeTexture.image}}),v=d.filter(W=>W.roughnessMap).map(W=>W.roughnessMap?{name:W.name+"_orm",imageBitmap:W.roughnessMap.image}:null),w=d.filter(W=>W.roughnessMap).map(W=>W.normalMap?{name:W.name+"_normal",imageBitmap:W.normalMap.image}:null),B=[...g,...m,...v,...w].filter(W=>W!==null),C=ope(B,f,s?"image/ktx2":"image/png"),b=ape(C),F=lpe(C,s),x=spe(d,B),_=t.children.filter(W=>W.children.length>0&&W.children[0].type===hi.Bone)[0],M=jJ(_).filter(W=>W.name!==DD),Y=M.map(W=>W.name),O=M.map(W=>{const H=W.children.filter(ie=>ie.name!==DD).map(ie=>Y.indexOf(ie.name));return{name:W.name,rotation:[W.quaternion.x,W.quaternion.y,W.quaternion.z,W.quaternion.w],scale:[W.scale.x,W.scale.y,W.scale.z],translation:[W.position.x,W.position.y,W.position.z],children:H.length>0?H:void 0}}),U=[],y=t.children.filter(W=>W.type===hi.Group||W.type===hi.SkinnedMesh),I=[];y.forEach((W,H)=>{const ie=W.type===hi.Group?W.children[0]:W,ae=ie.geometry.attributes,me=new hA(ae.position,kn.FLOAT,Kt.POSITION,ra.VEC3,ie.name,void 0);I.push(me);const J=I.length-1,Q=ae.normal.array,S=new Float32Array(Q.length);for(let se=0;sese):[W]).forEach(se=>{if(!se.geometry.index)throw new Error(se.name+" geometry.index is null");I.push(new hA(se.geometry.index,kn.UNSIGNED_INT,Kt.INDEX,ra.SCALAR,ie.name,se.name))}),ie.morphTargetDictionary||(ie.morphTargetDictionary={},ie.morphTargetInfluences=[],ie.geometry.morphAttributes={},ie.updateMorphTargets()),ie.geometry.userData.targetNames=[];const le=(se,Ue,_e,Te)=>{const Pe=[],ke=[];for(let he=0;he0){const he=[...Pe].sort((Re,Je)=>Re-Je),Ee=[];for(let Re=0;Re({mesh:0,index:ae.index,weight:ae.weight*100}));if(ie.length>0){let ae=!1;for(const me in ui)if(W===ui[me]&&W!=="surprised"){u.push({name:W,presetName:$fe(W),binds:ie,isBinary:H.isBinary}),ae=!0;break}ae===!1&&u.push({name:W,presetName:"unknown",binds:ie,isBinary:H.isBinary})}}y.forEach(W=>{const H=W.type===hi.Group?W.children[0]:W,ie=new Float32Array(H.skeleton.boneInverses.map(ae=>ae.elements).flat());I.push(new hA(new ut(ie,16),kn.FLOAT,Kt.BIND_MATRIX,ra.MAT4,H.name,H.name))}),U.push(...I.map(W=>({componentType:W.valueType,count:W.attribute.count,max:W.max,min:W.min,normalized:!1,type:W.accessorsType})));const R=rpe(y,I,p);y.forEach((W,H)=>{O.push({mesh:H,name:W.name,rotation:[W.quaternion.x,W.quaternion.y,W.quaternion.z,W.quaternion.w],scale:[W.scale.x,W.scale.y,W.scale.z],skin:H,translation:[W.position.x,W.position.y,W.position.z]})});const N=ipe(y,I,Y),k={humanBones:[]};A.humanBones.forEach(W=>{Y.indexOf(W.node.name)!=-1&&k.humanBones.push({bone:qfe(W.bone),node:Y.indexOf(W.node.name),useDefaultValues:!0})});const V={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},G={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},D=[];d.forEach(W=>{W.type=="ShaderMaterial"?D.push(Object.assign({},V)):D.push(Object.assign({},G))});const E=l;i.forEach(W=>{for(let H=0;HW.isSkinnedMesh))==null?void 0:be.skeleton)||null;for(let W=0;W{const me=ae.sphere;ie.colliders.push({radius:me.radius*o,offset:{x:me.offset[0]*o,y:me.offset[1]*o,z:me.offset[2]*o}})}),z.push(ie)}}console.log("COLLIDER GROUPS",z);const T=W=>{for(let H=0;H{var J;const H=T(W.name);if(H===-1){console.warn("Spring bone "+W.name+" was removed during cleanup process. Skipping.");return}const ie=[];W.colliderGroups.forEach(Q=>{const S=Q.colliders[0];if(S!=null){const Z=S.parent,te=z.findIndex(le=>le.name===Z.name);te!=-1&&(ie.includes(te)||ie.push(te))}});let ae=T((J=W.center)==null?void 0:J.name);ae==-1&&console.warn("no center bone for spring bone "+W.name);const me=W.settings;ee.push({bones:[H],center:ae,colliderGroups:ie,dragForce:me.dragForce,gravityDir:{x:me.gravityDir.x,y:me.gravityDir.y,z:me.gravityDir.z},gravityPower:me.gravityPower,hitRadius:me.hitRadius,stiffiness:me.stiffness})});const pe={boneGroups:ee,colliderGroups:z};console.log(pe),E.texture=f?C.length-1:void 0;const de=await Promise.all(B.map(async W=>({buffer:s?await LD(W.imageBitmap):VD(W.imageBitmap),type:Kt.IMAGE})));I.forEach((W,H)=>{W.buffer?de.push({buffer:W.buffer,typeString:"",type:W.type}):W.sparse&&(de.push({buffer:W.sparse.indices,typeString:"indices",type:W.type,count:W.sparse.count}),de.push({buffer:W.sparse.values,typeString:"values",type:W.type})),de.length-1}),f&&de.push({buffer:s?await LD(f.imageBitmap):VD(f.imageBitmap),type:Kt.IMAGE});let Ae=0,$=0,ce=0,ge=0;const Fe=de.map(W=>{const H={buffer:0,byteLength:W.buffer.byteLength,byteOffset:Ae,target:W.type===Kt.IMAGE||W.type===Kt.BIND_MATRIX||W.typeString==="indices"||W.typeString==="values"?void 0:W.type===Kt.INDEX?kn.ELEMENT_ARRAY_BUFFER:kn.ARRAY_BUFFER};return Ae+=W.buffer.byteLength,W.type===Kt.IMAGE?(C[$++].bufferView=ge,ge++):I[ce].sparse?(U[ce].sparse==null&&(U[ce].sparse={}),W.typeString==="indices"&&(U[ce].sparse.count=W.count,U[ce].sparse[W.typeString]={bufferView:ge,byteOffset:0,componentType:kn.UNSIGNED_INT}),W.typeString==="values"&&(U[ce].sparse[W.typeString]={bufferView:ge,byteOffset:0}),W.typeString==="values"&&ce++,ge++):(I[ce].bufferIndex=ge,U[ce].bufferView=ge,ce++,ge++),H}),P=Ape(t,O);tpe(E);const fe=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&fe.push("KHR_texture_basisu");const ue={accessors:U,asset:h,buffers:[{byteLength:Ae}],bufferViews:Fe,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new j,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:D,humanoid:k,meta:E,secondaryAnimation:pe,specVersion:"0.0"}},extensionsUsed:fe,images:C,materials:x,meshes:R,nodes:O,samplers:b,scenes:P,skins:N,textures:F};console.log("output",ue);const q=new PD(v_(JSON.stringify(ue,void 0,2)),"JSON"),K=new PD(Eg(de.map(W=>W.buffer)),"BIN\0"),oe=Eg([q.buffer,K.buffer]),ye=Eg([v_("glTF"),m_(2,4),m_(oe.byteLength+12,4)]);a(Eg([ye,oe]))}}function tpe(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function jJ(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>jJ(e)).flat())}const npe=new Xfe;async function LD(n){const e=await createImageBitmap(n),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0);const i=r.getImageData(0,0,t.width,t.height),s=new Uint8Array(i.data.buffer);return await npe.compress(s,t.width,t.height,4,{normalMap:!1,uastc:!1,qualityLevel:50,compressionLevel:2,uastcFlags:"DEFAULT",compressionUASTC_Rdo_Level:18,uastcRDO:!1,uastcRDOQualityScalar:1,uastcRDODictSize:4096,uastcRDOMaxSmoothBlockErrorScale:10,uastcRDOMaxSmoothBlockStdDev:18,uastcRDODontFavorSimplerModes:!1,ETC1SQualityLevel:128,ETC1SmaxEndpoints:0,ETC1SEndpointRdoThreshold:1.25,ETC1SMaxSelectors:0,ETC1SSelectorRdoThreshold:1.25,ETC1SNoEndpointRdo:!1,ETC1SNoSelectorRdo:!1,supercmp_scheme:"Zstd"})}function VD(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===kn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===kn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class PD{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Eg([m_(r.byteLength,4),v_(this.type),r])}padBuffer(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),new Uint8Array(i).fill(t,e.byteLength),i}}const OD=n=>{const e=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],t=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;rn.map(r=>{const i=r.type===hi.Group?r.children[0]:r,s=r.type===hi.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Kt.SKIN_INDEX),NORMAL:a.indexOf(Kt.NORMAL),POSITION:a.indexOf(Kt.POSITION),TEXCOORD_0:a.indexOf(Kt.UV),WEIGHTS_0:a.indexOf(Kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>{const c=e.map(d=>d.type===Kt.BLEND_NORMAL&&d.meshName===i.name?d.name:null).indexOf(g_+A),u=e.map(d=>d.type===Kt.BLEND_POSITION&&d.meshName===i.name?d.name:null).indexOf(g_+A),h={};return u!==-1&&(h.POSITION=u),c!==-1&&(h.NORMAL=c),h}):void 0}})}}),ipe=(n,e,t)=>n.map(r=>{const i=r.type===hi.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Kt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),spe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(p=>p.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const d=t;r=d.color?[d.color.r,d.color.g,d.color.b,1]:void 0}let s=-1;t.map?s=e.map(d=>d.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(d=>d.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(d=>d.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(d=>d.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,A={baseColorFactor:r,baseColorTexture:l},c=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(c)A.metallicRoughnessTexture=c;else{const d=(()=>{switch(t.type){case Sh.MeshStandardMaterial:return t.metalness;case Sh.MeshBasicMaterial:return 0;default:return 0}})(),p=(()=>{switch(t.type){case Sh.MeshStandardMaterial:return t.roughness;case Sh.MeshBasicMaterial:return .9;default:return .9}})();A.metallicFactor=d,A.roughnessFactor=p}const h={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{}}:void 0,name:t.name,pbrMetallicRoughness:A};return u&&(h.normalTexture=u),h}),ope=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),ape=n=>n.map(()=>({magFilter:kn.LINEAR,minFilter:kn.LINEAR,wrapS:kn.REPEAT,wrapT:kn.REPEAT})),lpe=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),Ape=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===hi.Object3D||r.type===hi.SkinnedMesh||r.type===hi.Group||r.type===hi.Bone).map(r=>t.indexOf(r.name))}]};function cpe(n,e,t){var a,l;const r=[],i=[];for(const A in n)((l=(a=n[A])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[A].vrm.meta.authors!=null?i.push(n[A].vrm.meta):r.push(n[A].vrm.meta));r.length+i.length==1&&(r.length==1?r[0].title!=null&&(t=r[0].title):i[0].name!=null&&(t=i[0].name)),e!=null&&(e.authors!=null?i.push(e):r.push(e));const s=dpe(r),o=upe(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function upe(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:A="",avatarPermission:c=void 0,otherPermissionUrl:u=[]}=n,h,d,p,f="unnecessary",g,m=[];e.forEach(x=>{t=t.concat(ht(x.authors)),r=r.concat(ht(x.otherLicenseUrl)),i=i.concat(ht(x.contactInformation)),s=s.concat(ht(x.references)),u=u.concat(ht(x.otherPermissionUrl)),x.allowExcessivelyViolentUsage===!1&&(o=!1),x.allowExcessivelySexualUsage===!1&&(a=!1),l=ml(ppe,l,x.commercialUsage),A=ml(KJ,A,x.copyrightInformation),c=ml(gpe,c,x.avatarPermission),x.allowAntisocialOrHateUsage===!1&&(h=h=!1),x.allowPoliticalOrReligiousUsage===!1&&(d=d=!1),x.allowRedistribution===!1&&(p=p=!1),x.creditNotation==="required"&&(f="required"),m=m.concat(ht(x.thirdPartyLicenses)),g=ml(fpe,g,x.modification)});const v=[...new Set(t)].filter(x=>x!=""&&x!=null&&x!="undefined"),w=[...new Set(r)].filter(x=>x!=""&&x!=null&&x!="undefined"),B=[...new Set(i)].filter(x=>x!=""&&x!=null&&x!="undefined"),C=[...new Set(s)].filter(x=>x!=""&&x!=null&&x!="undefined"),b=[...new Set(u)].filter(x=>x!=""&&x!=null&&x!="undefined"),F=[...new Set(m)].filter(x=>x!=""&&x!=null&&x!="undefined");return{authors:v,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:B.length==0?"":B.join(", "),references:C,otherPermissionUrl:b.length==0?"":b.join(", "),thirdPartyLicenses:F.length==0?"":F.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:A,avatarPermission:c,allowAntisocialOrHateUsage:h,allowPoliticalOrReligiousUsage:d,allowRedistribution:p,creditNotation:f,modification:g}}function dpe(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,A,c;n.forEach(g=>{e=e.concat(ht(g.author)),t=t.concat(ht(g.contactInformation)),r=r.concat(ht(g.reference)),i=i.concat(ht(g.otherPermissionUrl)),s=s.concat(ht(g.otherLicenseUrl)),o=ml(mpe,o,g.allowedUsername),a=ml(CI,a,g.violentUssageName),l=ml(CI,l,g.sexualUssageName),A=ml(CI,A,g.commercialUssageName),c=ml(KJ,c,g.licenseName)});const u=[...new Set(e)].filter(g=>g!=""&&g!=null&&g!="undefined"),h=[...new Set(t)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(r)].filter(g=>g!=""&&g!=null&&g!="undefined"),p=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),f=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:f,contactInformation:h,references:d,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:A==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:c,avatarPermission:hpe(o),otherPermissionUrl:p}}function hpe(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const fpe={prohibited:0,allowModification:1,allowModificationRedistribution:2},ppe={personalNonProfit:0,personalProfit:1,corporation:2},gpe={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},mpe={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},CI={Disallow:0,Allow:1},KJ={Redistribution_Prohibited:0,Other:1,CC_BY_NC_ND:2,CC_BY_ND:3,CC_BY_NC_SA:4,CC_BY_SA:5,CC_BY_NC:6,CC_BY:7,CC0:8};function ml(n,e,t){return e===void 0?t:t==null||!(t in n)||n[e]{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function vpe(n){const e=$J(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=LJ(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new bu,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new kr;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function ype(n,e,t){const r=await aQ(n,t),i=await qJ(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function wpe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;Bpe(n,e,r).then(a=>{tH(a,`${o}.vrm`),i()})})}async function Bpe(n,e,t){const r=await aQ(n,t);return qJ(r,e,t)}function aQ(n,e){const t=$J(n),{createTextureAtlas:r=!0}=e;return r?afe(t,e):(console.log("no atlas"),ife(t,e))}async function Cpe(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await aQ(n,t):vpe(n);bpe(s).then(o=>{if(o instanceof ArrayBuffer)tH(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);_pe(a,`${r}.gltf`)}})}function bpe(n){return new Promise(e=>new JU().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function xpe(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(A=>A.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in Wm)if(s.bone.parent.name==Wm[o]){t.push(s);break}}),t}function Ipe(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Wm)if(Wm[r]===t.name){e[t.name]={node:t};break}}),e}function Fpe(n,e){const t=Sf(n,"SkinnedMesh");return{humanBones:Ipe(t[0]),materials:n.userData.atlasMaterial,meta:Epe(e)}}function Epe(n){return n=n||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:"CharacterCreator",licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...n}}function qJ(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=cpe(e,s,a);return new Promise(async A=>{const c=i?new epe:new $de,u={...Upe(e),...Fpe(n,l)};let h;n.traverse(f=>{f.isSkinnedMesh&&(h=f)}),(()=>{for(let f=0;f{f.updateMatrix(),f.updateMatrixWorld()}),h.skeleton.calculateInverses(),h.skeleton.computeBoneTexture(),h.skeleton.update()})(),h.skeleton.bones.filter(f=>f.name==="head")[0];const p=xpe(e);c.parse(u,n,r,p,t.ktxCompression,o,f=>{A(f)})})}function eH(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function _pe(n,e){eH(new Blob([n],{type:"text/plain"}),e)}function tH(n,e){eH(Spe(n),e)}function Spe(n){return new Blob([n],{type:"application/octet-stream"})}function Upe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}const Qpe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?Rpe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?Mpe(n):console.warn("No valid vrm file was provided")},Rpe=n=>{var a,l,A;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:A.colliderGroups,s=[],o=r.map(c=>nH(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],h=ZJ(t,u);if(h!=null){const d=c.colliders;h.userData.VRMcolliders=d.map(p=>({sphere:{radius:p.radius,offset:[p.offset.x,p.offset.y,p.offset.z]}}))}h.userData.VRMcollidersID=WJ()})},Mpe=n=>{var l,A,c,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:A.colliderGroups,s=(u=(c=e.extensions)==null?void 0:c.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(h=>nH(h.name,o));i!=null&&i.forEach(h=>{const d=ht(h.colliders);let p=-1,f=null;d.forEach(g=>{if(p!=s[g].node){p=s[g].node;const m=a[p];f=ZJ(t,m),f.userData.VRMcolliders=[]}if(f!=null){const m=s[g].shape;for(const v in m){const w=m[v];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}f.userData.VRMcollidersID=WJ(),f.userData.VRMcolliders.push(m)}else console.error("no node with name "+a[p]+" was found")})})},nH=(n,e)=>{const t=bt.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},jB=[0,400,560,2400,4800],KB=[0,500,700,3e3,6e3],y_=[],ol=[],lQ=1024,rH=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=$B.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=lQ,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=$B.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(ui.Oh,0),this.vrm.expressionManager.setValue(ui.Ah,0),this.vrm.expressionManager.setValue(ui.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(ui.Oh,i),this.vrm.expressionManager.setValue(ui.Ah,r),this.vrm.expressionManager.setValue(ui.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(A){const u=new Float32Array(A.length);for(let h=0;h0&&(i[A]+=r[c]);i[A]/=ol[A+1]-ol[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=ol[A+1]-ol[A],s[A]=s[A]/(y_[A+1]-y_[A])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let A=0;A=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const bI=new j;class Tpe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new Ye,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,A,c={x:window.innerWidth,y:window.innerHeight};return e<=c.x/2&&(o=c.x/2-e,a=o/(c.x/2)*100,i=r.maxx*a/100*-1),e>=c.x/2&&(o=e-c.x/2,a=o/(c.x/2)*100,i=r.minx*a/100),t<=c.y/2&&(l=c.y/2-t,A=l/(c.y/2)*100,s=r.maxy*.5*A/100*-1),t>=c.y/2&&(l=t-c.y/2,A=l/(c.y/2)*100,s=r.miny*A/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Wt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Wt.degToRad(s.y*r),e.rotation.x,o)}}update(){bI.set(0,0,1),bI.applyQuaternion(this.camera.quaternion);const e=bI.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class xI{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:A,requiredTraits:c,randomTraits:u,colliderTraits:h,lipSyncTraits:d,blinkerTraits:p,typeRestrictions:f,defaultCullingLayer:g,defaultCullingDistance:m,offset:v,vrmMeta:w,traits:B,textureCollections:C,colorCollections:b,canDownload:F=!0,downloadOptions:x={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ht(o),this.requiredTraits=ht(c),this.randomTraits=ht(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ht(h),this.lipSyncTraits=ht(d),this.blinkerTraits=ht(p),this.typeRestrictions=f,this.defaultCullingLayer=g,this.defaultCullingDistance=m,this.offset=v,this.canDownload=F,this.downloadOptions=x;const _=()=>{const O=[];for(const U in B)O.push(B[U].trait);return O};this.allTraits=_(),_(),(()=>{if(this.typeRestrictions)for(const O in this.typeRestrictions)ht(this.typeRestrictions[O]).forEach(y=>{this.typeRestrictions[y]==null&&(this.typeRestrictions[y]=[]),this.typeRestrictions[y].indexOf(O)==-1&&this.typeRestrictions[y].push(O)})})(),(()=>{x.vrmMeta=x.vrmMeta||w,x.scale=x.scale||a||1,x.mToonAtlasSize=x.mToonAtlasSize||2048,x.mToonAtlasSizeTransp=x.mToonAtlasSizeTransp||1024,x.stdAtlasSize=x.stdAtlasSize||2048,x.stdAtlasSizeTransp=x.stdAtlasSizeTransp||1024,x.exportStdAtlas=x.exportStdAtlas||!1,x.exportMtoonAtlas=x.exportMtoonAtlas||!0,x.screenshotFaceDistance=x.screenshotFaceDistance||1,x.screenshotFaceOffset=x.screenshotFaceOffset||[0,0,0],x.screenshotResolution=x.screenshotResolution||[512,512],x.screenshotBackground=x.screenshotBackground||[.1,.1,.1],x.screenshotFOV=x.screenshotFOV||75,!x.exportStdAtlas&&!x.exportMtoonAtlas&&(x.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(C),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(b),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(B)}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=ht(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new II(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new II(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new II(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]),ht(e).forEach(r=>{this.modelTraits.push(new Npe(this,r))}),this.modelTraitsMap=new Map(this.modelTraits.map(r=>[r.trait,r])),this.modelTraits.forEach(r=>{r.restrictedTraits.forEach(i=>{const s=this.getModelGroup(i);console.log(s),s&&s.addTraitRestriction(r.trait)})})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),ht(e).forEach(r=>{this.textureTraits.push(new kpe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ht(e).forEach(r=>{this.colorTraits.push(new Dpe(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class Npe{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:A,restrictedTraits:c=[],restrictedTypes:u=[]}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.restrictedTraits=c,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(A)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}addTraitRestriction(e){this.restrictedTraits.indexOf(e)==-1&&this.restrictedTraits.push(e)}createCollection(e,t=!1){t&&(this.collection=[]),ht(e).forEach(r=>{this.collection.push(new WD(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new WD(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class kpe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ht(e).forEach(r=>{this.collection.push(new Lpe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class Dpe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ht(e).forEach(r=>{this.collection.push(new Vpe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class WD{constructor(e,t){const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,colorCollection:u,fullDirectory:h,fullThumbnail:d}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,h)this.fullDirectory=h;else if(Array.isArray(i)){this.fullDirectory=[];for(let p=0;p0&&this.manifestData.restrictedTypes>0){haveCommonValue=(i,s)=>{if(i==null||s==null)return!1;for(let o=0;ohaveCommonValue(r[i],traitTypes))}return!1}}class Lpe{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(nl)}),nl.z+=.3,nl.y+=s,this.screenshotManager.setCamera(nl,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&(A.userData.clippedIndexGeometry=A.geometry.index.clone(),A.geometry.setIndex(A.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&A.geometry.setIndex(A.userData.clippedIndexGeometry)})},o=(A,c)=>{for(let u=0;u{var f,g;const u=A.object,h=A.face,d=[h.a,h.b,h.c],p=(g=(f=u.userData)==null?void 0:f.clippedIndexGeometry)==null?void 0:g.array;if(p!=null){const m=o(p,d),v=Array.from(p);if(m==-1&&!c){const w=[...v,...d];u.userData.clippedIndexGeometry=new ut(new Uint32Array(w),1,!1)}m!=1&&c&&(v.splice(m,3),u.userData.clippedIndexGeometry=new ut(new Uint32Array(v),1,!1))}};FI.x=e,FI.y=t,i(),GD.setFromCamera(FI,this.renderCamera);const l=GD.intersectObjects(this.characterModel.children);if(l.length>0){const A=l[0];a(A,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new Bw({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.isVrm0=!0,o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await wpe(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};Cpe(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(ht(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadTrait(e,t,r=!1){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getTraitOption(e,t);o&&(await this._loadTraits(ht(o),r),i())}catch(o){console.error("Error loading specific trait:",o.message),s(new Error("Failed to load specific trait."))}else{const o="No manifest was loaded, specific trait cannot be loaded.";console.error(o),s(new Error(o))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(ht(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await hfe(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new Le(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new Le(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new Bw({traitGroupID:e,traitModel:null});this._addLoadedData(i),vI(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){vI(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new xI(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new xI(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new xI(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async soloTargetGroupTrait(e){const t=ht(e),r=[];for(const i in this.avatar)t.includes(i)&&r.push(this.manifestData.getTraitOption(i,this.avatar[i].traitInfo.id));await this._loadTraits(r,!0)}storeCurrentAvatar(){this.storedAvatar={...this.avatar}}async loadStoredAvatar(){const e=[];for(const t in this.storedAvatar)e.push(this.manifestData.getTraitOption(t,this.storedAvatar[t].traitInfo.id));console.log(e),this._loadTraits(e,!0)}async _loadTraits(e,t=!1){console.log("laoded traits:",e),await this.traitLoadManager.loadTraitOptions(ht(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new Bw({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),vI(this.avatar)})}async _animationManagerSetup(e,t,r){const i=ht(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,!1,0,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(d=>d.name==="head")[0].getWorldPosition(nl)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];nl.x+=s[0],nl.y+=s[1],nl.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.setCamera(nl,i,a);const c=e?this.screenshotManager.getScreenshotBlob(l,A):this.screenshotManager.getScreenshotTexture(l,A);return this.blinkManager.disableScreenshot(),c}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new Le(o,a,l)},r=new Ri({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;if(e.userData.vrm==null)return console.error("No valid VRM was provided for "+r+" trait, skipping file."),null;if(_D(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&Qpe(e),Bfe(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new $B(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"){if(o.humanoid.humanBones.hips.node.parent==o.scene){const A=new Rt;A.name="newRootNode",dfe(o.scene,A),A.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(A=>{var c;if(A.isSkinnedMesh){const u={},h=ht((c=A.geometry.userData)==null?void 0:c.targetNames);for(let d=0;d{const h=e.scene.getObjectByName(u);h!=null&&h.isMesh&&o.push(h)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const A=this.manifest,c=this.manifestData.getModelGroup(r);_D(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:c.cullingLayer!=null?c.cullingLayer:A.defaultCullingLayer!=null?A.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:c.cullingDistance!=null?c.cullingDistance:A.defaultCullingDistance!=null?A.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,h)=>{if(i){const d=i[h]||i[0];d!=null&&(u.material.type==="MeshStandardMaterial"?Array.isArray(u.material)?u.material.forEach(p=>{p.map=d}):u.material.map=d:console.warn("XXX set material texture to shader material",u.material))}if(s){const d=s[h]||s[0];d!=null&&(u.material[0].uniforms.litFactor.value=d,u.material[0].uniforms.shadeColorFactor.value=new Le(d.r*.8,d.g*.8,d.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),wfe(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),this.avatar[t]={});return}let A=null;o.map(c=>{c!=null&&(A=this._VRMBaseSetup(c,r,t,a,l))}),A!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(A),this._displayModel(A),this._applyManagers(A),console.log(this.characterModel),this.avatar[t]={traitInfo:r,textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class Ope{constructor(){const e=new _Z;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new QU(e);t.crossOrigin="anonymous",t.register(i=>new Hde(i,{autoUpdateHumanBones:!0}));const r=new Pu(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var c,u,h;if(s==null){r[o]=null;return}const a=await Promise.all(ht((c=s==null?void 0:s.traitModel)==null?void 0:c.fullDirectory).map(async d=>{try{return await this.gltfLoader.loadAsync(d)}catch(p){return console.error(`Error loading modelsss ${d}:`,p),null}})),l=await Promise.all(ht((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(d=>new Promise(p=>{this.textureLoader.load(d,f=>{f.flipY=!1,f.encoding=mt,p(f)},null,f=>{console.error("error loading texture: ",f),p(null)})}))),A=ht((h=s==null?void 0:s.traitColor)==null?void 0:h.value).map(d=>new Le(d));r[o]=new Bw({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:A})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class Bw{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function Wpe(n){const e=new bB,t=new QZ(16777215,.5);e.add(t);const r=new _U(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new Rt;e.add(i);const s=new Nr(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new Ppe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new h0({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new Nie(s,l.domElement);A.minDistance=1,A.maxDistance=4,A.maxPolarAngle=Math.PI/2,A.enablePan=!0,A.target=new j(0,1,0),A.enableDamping=!0,A.dampingFactor=.1;const c=new j(-.5,0,-.5),u=new j(.5,1.5,.5),h=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",h),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputEncoding=mt;const d=()=>{requestAnimationFrame(d),A.target.clamp(c,u),A==null||A.update(),o.update(),l.render(e,s)};d();const p=g=>{const m=g.ctrlKey,v=a.getBoundingClientRect(),w=(g.clientX-v.left)/v.width*2-1,B=-((g.clientY-v.top)/v.height)*2+1;o.cameraRaycastCulling(w,B,m)};async function f(){const g="./3d/Platform.glb",v=await new QU().loadAsync(g);i.add(v.scene)}return f(),a.addEventListener("click",p),{scene:e,camera:s,controls:A,characterManager:o,sceneElements:i}}function By(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var iH={exports:{}};/*! + `})}}const XB=4096,zp=new j;class Mfe{constructor(e,t,r){const i=new h0({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new Ye(XB,XB);i.setClearColor(0,0),i.outputEncoding=gs,i.setSize(s.x,s.y),i.setPixelRatio(window.devicePixelRatio);let o=s.clone().divideScalar(r);o.x|=0,o.y|=0;const a=new Sfe(i);a.addPass(new Ufe(e,t)),this._renderPixelPass=new Qfe(o,e,t),this._pixelPass=new Rfe(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new Ye(e,t).clone().divideScalar(this.pixelSize);i.x|=0,i.y|=0,this.renderer.setSize(e,t),this._renderPixelPass.setResolution(i),this._pixelPass.setResolution(i)}setPixelSize(e){this.pixelSize=e}render(){this.composer.render()}}class Tfe{constructor(e,t){this.renderer=new h0({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputEncoding=mt,this.renderer.setSize(XB,XB),this.camera=new Nr(30,1,.1,1e3),this.textureLoader=new Pu,this.sceneBackground=new Le(.1,.1,.1),this.sceneBackgroundAlpha=1,this.frameOffset={min:.2,max:.2},this.usesBackgroundImage=!1,this.backgroundMaterial=new Ri({color:16777215,transparent:!0,opacity:.5});const r=new Du(1e3,1e3),i=new In(r,this.backgroundMaterial);i.renderOrder=-1,this.backgroundPlane=i,this.pixelRenderer=new Mfe(t,this.camera,20),this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setScene(e){this.scene=e}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=r}_getCharacterMinMax(){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY;return this.characterManager.characterModel.traverse(r=>{r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(r.geometry.boundingBox.applyMatrix4(r.matrixWorld),r.geometry.boundingBox.min.yt&&(t=r.geometry.boundingBox.max.y)))}),{minY:e,maxY:t}}frameCloseupShot(){this.frameShot("head","head")}frameMediumShot(){this.frameShot("chest","head")}frameCowboyShot(){this.frameShot("hips","head")}frameFullShot(){this.frameShot("leftFoot","head")}frameShot(e,t,r=null,i=!1,s=!0){const o=this._getBoneWorldPositionWithOffset(e,i),a=this._getBoneWorldPositionWithOffset(t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new j(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}async calculateBoneOffsets(e){for(const t in this.boneOffsets){const r=await this._getMinMaxOffsetByBone(this.characterManager.characterModel,t,e);this.boneOffsets[t]=r}}_getBoneWorldPositionWithOffset(e,t){const r=this._getFirstBoneWithName(e);if(!r||!this.boneOffsets[e])return new j;const i=new j;r.getWorldPosition(i);const s=t?this.boneOffsets[e].max:this.boneOffsets[e].min;return i.y+=s.y,i}_getBoneWorldPosition(e){const t=this._getFirstBoneWithName(e);return t!=null?new j().setFromMatrixPosition(t.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new j(0,0,0))}_getFirstBoneWithName(e){let t=null;return this.characterManager.characterModel.traverse(r=>{if(r instanceof _l){if(!r.geometry){console.error("Invalid skinned mesh found in children.");return}const i=r.skeleton.bones.findIndex(s=>s.name===e);if(i!==-1){t=r.skeleton.bones[i];return}}}),t}setCameraFrameWithName(e,t){switch(e.toLowerCase()){case"fullshot":this.frameShot("leftFoot","head",t);break;case"cowboyshot":this.frameShot("hips","head",t);break;case"mediumshot":this.frameShot("chest","head",t);break;case"mediumcloseup":case"mediumcloseupshot":this.frameShot("chest","head",t,!0);break;case"closeup":case"closeupshot":this.frameShot("head","head",t);break;default:console.warn("unkown cameraFrame: "+e+". Please use fullShot, cowboyShot, mediumShot, mediumCloseup or closeup"),this.frameShot("leftFoot","head",t);break}}async _getMinMaxOffsetByBone(e,t,r){return new Promise(async(i,s)=>{(!e||!e.traverse)&&(console.error("Invalid parent object provided."),s(null));const o=new j(1/0,1/0,1/0),a=new j(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof _l&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let A=0;await(u=>new Promise(h=>setTimeout(h,u)))(10),e.traverse(u=>{if(u instanceof _l){if(!u.geometry){console.error("Invalid skinned mesh found in children.");return}const h=u.skeleton.bones.findIndex(g=>g.name===t);if(h===-1){console.error(`Bone with name '${t}' not found in one of the skinned meshes.`);return}const d=u.geometry.getAttribute("position"),p=u.geometry.getAttribute("skinWeight"),f=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const B=u.skeleton.bones[h],C=new j().setFromMatrixPosition(B.matrixWorld),b=m.clone().sub(C);o.min(b),a.max(b)}}this._restoreSavedPose(l[A],u.skeleton),A++}}),i({min:o,max:a})})}_saveBonesPos(e){let t=[];return e.bones.forEach(r=>{t.push({position:r.position.clone(),rotation:r.rotation.clone(),scale:r.scale.clone()})}),t}_restoreSavedPose(e,t){e&&t.bones.forEach((r,i)=>{r.position.copy(e[i].position),r.rotation.copy(e[i].rotation),r.scale.copy(e[i].scale)})}positionCameraBetweenPoints(e,t,r,i=30){const s=new Cs;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new j).length()/(2*Math.tan(o/2));s.getCenter(zp),this.camera.position.copy(zp),r.y*=.5,this.camera.lookAt(zp.clone().sub(r));const A=new j;this.camera.getWorldDirection(A),this.camera.position.addScaledVector(A,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,zp.set(0,0,-1),this.cameraDir=zp.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setBackground(e){if(Array.isArray(e)){const t=e[3]==null?1:e[3];this.setBackgroundColor(e[0],e[1],e[2],t)}else this.setBackgroundImage(e)}setBackgroundColor(e,t,r,i){const s=new Le(e,t,r,i);this.sceneBackground=s,i==null&&(i=1),i>1&&(i=1),i<0&&(i=0),this.sceneBackgroundAlpha=i,this.backgroundMaterial.color=s,this.usesBackgroundImage=!1}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=ps,this.sceneBackground=i,this.usesBackgroundImage=!0,this.sceneBackgroundAlpha=1,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}_setBackground(){if(this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1)if(this.sceneBackgroundAlpha==0)this.scene.background=null;else{this.scene.background=null,this.scene.add(this.backgroundPlane),this.backgroundPlane.position.copy(this.camera.position);var e=new j(0,0,-1);e.applyQuaternion(this.camera.quaternion);var t=100;this.backgroundPlane.position.addScaledVector(e,t),this.backgroundPlane.lookAt(this.camera.position)}else this.scene.background=this.sceneBackground}_restoreBackground(){this.scene.background=null,this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1&&this.scene.remove(this.backgroundPlane)}getImageData(e,t,r=null){return this._createImage(e,t,r).split("base64,")[1]}_createImage(e,t,r=null){const i=e/t;typeof r=="number"&&this.pixelRenderer.setPixelSize(r),this.renderer.setSize(e,t),this.pixelRenderer.setSize(e,t);const s="image/png";this.camera.aspect=i,this.camera.updateProjectionMatrix();const o=typeof r=="number"?this.pixelRenderer:this.renderer;try{this._setBackground(),o.render(this.scene,this.camera);let a=o.domElement.toDataURL(s);return this._restoreBackground(),a}catch(a){return console.error(a),null}}savePixelScreenshot(e,t,r,i){this.pixelRenderer.setPixelSize(i),this.pixelRenderer.setSize(t,r);const s=this._createImage(t,r,!0),o="image/octet-stream",a="image/png";this.saveFile(s.replace(a,o),e+".png")}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new or(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=C4.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const Nfe=2;class kfe{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new RZ,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=Nfe,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(ui.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function YJ(){return(YJ=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;h%8&&(h+=8-h%8);let d=[],p=new DataView(new ArrayBuffer(24*n.levels.length)),f=(h||u+s.byteLength)+t.byteLength;for(let v=0;v0?h:0),!0),m.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(Xp([new Uint8Array(Rr).buffer,g,p.buffer,a,s,new ArrayBuffer(h>0?h-(u+s.byteLength):0),t,...d]))}var h_,f_,Gfe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},p_=new OffscreenCanvas(128,128),kD=p_.getContext("2d",{willReadFrequently:!0}),XJ=typeof document>"u";function Zfe(n){return createImageBitmap(n).then(function(e){return p_.width=e.width,p_.height=e.height,kD.drawImage(e,0,0),kD.getImageData(0,0,e.width,e.height)})}function Jfe(n,e){return e===void 0&&(e={}),zfe().then(function(t){var r=new t.BasisEncoder;return Hfe(e,r),r.setTexType(h_.cBASISTexType2D),Lfe(n,ArrayBuffer)&&(n=new Blob([n])),Zfe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,f_.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=Pfe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=Wfe(l,{keepWriter:!0})}return a})})}function Hfe(n,e){n===void 0&&(n={}),(n=Dfe({},Gfe,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var wI=null;function zfe(){return wI||(wI=new Promise(function(n,e){XJ?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),wI}XJ&&self.addEventListener("message",function(n){Jfe(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class Yfe{constructor(e,t){if(this.gl=e,this.libktx=null,e!==void 0)if(t===void 0&&LIBKTX!==void 0&&(t=LIBKTX),t!==void 0)this.initializied=this.init(e,t);else{console.error("Failed to initalize KTXDecoder: ktx library undefined");return}else{console.error("Failed to initalize KTXDecoder: WebGL context undefined");return}}async init(e,t){this.libktx=await t({preinitializedWebGLContext:e}),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(e.canvas,{majorVersion:2}))}stringToUastcFlags(e){return e==="FASTER"?this.libktx.UastcFlags.LEVEL_FASTER.value:e==="FASTEST"?this.libktx.UastcFlags.LEVEL_FASTEST.value:e==="SLOWER"?this.libktx.UastcFlags.LEVEL_SLOWER.value:e==="SLOWEST"?this.libktx.UastcFlags.LEVEL_VERYSLOW.value:this.libktx.UastcFlags.LEVEL_DEFAULT.value}stringToSupercmpScheme(e){return e==="Zstd"?this.libktx.SupercmpScheme.ZSTD:e==="Zlib"?this.libktx.SupercmpScheme.ZLIB:e==="BasisLZ"?this.libktx.SupercmpScheme.BASIS_LZ:this.libktx.SupercmpScheme.NONE}transcodeRGBA(e){if(!e.needsTranscoding)return;const t=this.libktx.TranscodeTarget.RGBA8888;e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}transcode(e){if(e.gpuFormat="RGBA8888",e.needsTranscoding){let t,r=!1,i=!1,s=!1,o=!1,a=!1;r=!!this.gl.getExtension("WEBGL_compressed_texture_astc"),i=!!this.gl.getExtension("WEBGL_compressed_texture_etc1"),s=!!this.gl.getExtension("WEBGL_compressed_texture_s3tc"),o=!!this.gl.getExtension("EXT_texture_compression_bptc"),a=!!this.gl.getExtension("WEBGL_compressed_texture_pvrtc")||!!this.gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),r?(t=this.libktx.TranscodeTarget.ASTC_4x4_RGBA,e.gpuFormat="ASTC_4x4_RGBA"):o?(t=this.libktx.TranscodeTarget.BC7_RGBA,e.gpuFormat="BC7_RGBA"):s?(t=this.libktx.TranscodeTarget.BC1_OR_3,e.gpuFormat="BC1_OR_3"):a?(t=this.libktx.TranscodeTarget.PVRTC1_4_RGBA,e.gpuFormat="PVRTC1_4_RGBA"):i?(t=this.libktx.TranscodeTarget.ETC,e.gpuFormat="ETC"):(t=this.libktx.TranscodeTarget.RGBA8888,e.gpuFormat="RGBA8888"),e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}}async loadKtxFromUri(e){await this.initializied;const t=await fetch(e),r=new Uint8Array(await t.arrayBuffer()),i=new this.libktx.ktxTexture(r);this.transcode(i);let s=i.glUpload();if(s.texture==null){console.error("Could not load KTX data");return}return s.texture.levels=Math.log2(i.baseWidth),s.texture.width=i.baseWidth,s.texture.height=i.baseHeight,s.texture.gpuSize=i.dataSize,s.texture.gpuFormat=i.gpuFormat,s.texture.isSRGB=i.isSRGB,s.texture}async loadKtxFromBuffer(e){await this.initializied;const t=new this.libktx.ktxTexture(e);this.transcode(t);const r=t.glUpload();if(r.texture==null){console.error("Could not load KTX data");return}return r.texture.levels=Math.log2(t.baseWidth),r.texture.width=t.baseWidth,r.texture.height=t.baseHeight,r.texture.gpuSize=t.dataSize,r.texture.gpuFormat=t.gpuFormat,r.texture.isSRGB=t.isSRGB,r.texture}async compress(e,t,r,i,s={}){const o=new this.libktx.ktxTexture(e,t,r,i,s.srgb);if(!s.hasOwnProperty("basisu_options")){const A=new this.libktx.ktxBasisParams;A.uastc=!1,A.noSSE=!0,A.verbose=!1,A.qualityLevel=100,A.compressionLevel=2,s.basisu_options=A}s.hasOwnProperty("compression_level")||(s.compression_level=18),s.hasOwnProperty("supercmp_scheme")||(s.supercmp_scheme=this.libktx.SupercmpScheme.NONE),console.log(s);const a=o.compressBasisU(s.basisu_options,s.supercmp_scheme,s.compression_level);return Uint8ClampedArray.from(a)}}class Xfe{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new Yfe(t,window.LIBKTX);await r.init(t,window.LIBKTX),this.ktxEncoder=r,this.libktx=r.libktx}async compress(e,t,r,i,s={}){const o=await new this.libktx.ktxBasisParams,a=s;return o.uastc=a.uastc!==void 0?a.uastc:!1,o.noSSE=a.noSSE!==void 0?a.noSSE:!1,o.verbose=a.verbose!==void 0?a.verbose:!1,o.normalMap=a.normalMap!==void 0?a.normalMap:!1,o.compressionLevel=a.compressionLevel!==void 0?a.compressionLevel:1,o.qualityLevel=a.qualityLevel!==void 0?a.qualityLevel:60,o.maxEndpoints=a.ETC1SmaxEndpoints!==void 0?a.ETC1SmaxEndpoints:0,o.endpointRDOThreshold=a.ETC1SEndpointRdoThreshold!==void 0?a.ETC1SEndpointRdoThreshold:1.25,o.maxSelectors=a.ETC1SMaxSelectors!==void 0?a.ETC1SMaxSelectors:0,o.selectorRDOThreshold=a.ETC1SSelectorRdoThreshold!==void 0?a.ETC1SSelectorRdoThreshold:1.25,o.noEndpointRDO=a.ETC1SNoEndpointRdo!==void 0?a.ETC1SNoEndpointRdo:!1,o.noSelectorRDO=a.ETC1SNoSelectorRdo!==void 0?a.ETC1SNoSelectorRdo:!1,o.uastcFlags=this.ktxEncoder.stringToUastcFlags(a.uastcFlags),o.uastcRDO=o.uastcRDO!==void 0?o.uastcRDO:!1,o.uastcRDOQualityScalar=a.uastcRDOQualityScalar!==void 0?a.uastcRDOQualityScalar:1,o.uastcRDODictSize=a.uastcRDODictSize!==void 0?a.uastcRDOQualityScalar:4096,o.uastcRDOMaxSmoothBlockErrorScale=a.uastcRDOMaxSmoothBlockErrorScale!==void 0?a.uastcRDOMaxSmoothBlockErrorScale:10,o.uastcRDOMaxSmoothBlockStdDev=a.uastcRDOMaxSmoothBlockStdDev!==void 0?a.uastcRDOMaxSmoothBlockStdDev:18,o.uastcRDODontFavorSimplerModes=a.uastcRDODontFavorSimplerModes!==void 0?a.uastcRDODontFavorSimplerModes:!1,s.basisu_options=o,s.hasOwnProperty("supercmp_scheme")?s.supercmp_scheme=this.ktxEncoder.stringToSupercmpScheme(s.supercmp_scheme):s.supercmp_scheme=this.libktx.SupercmpScheme.NONE,await this.ktxEncoder.compress(e,t,r,i,s)}}var kn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(kn||(kn={}));const g_="blend_",DD="vrmColliderSphere";function jfe(n){var e;return{title:n.name,version:"v0",author:((e=n.authors)==null?void 0:e.length)>0?n.authors.join(", "):"",reference:n.references!=null?n.references.join(", "):"",contactInformation:n.contactInformation!=null?n.contactInformation:"",otherPermissionUrl:n.otherPermissionUrl,allowedUserName:n.avatarPermission!=null?n.avatarPermission:"",violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:n.commercialUsage=="personalProfit"||n.commercialUsage=="corporation"?"Allow":"Disallow",licenseName:n.copyrightInformation,otherLicenseUrl:n.otherLicenseUrl,metaVersion:"0"}}function Kfe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function $fe(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function qfe(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class epe{async parse(e,t,r,i,s,o,a){var be;const l=jfe(e.meta),A=Kfe(e.humanoid),c=e.materials,u=[],h={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(A)if(l){if(!c)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const d=c.filter((W,H,ie)=>ie.findIndex(ae=>ae.name===W.name.replace(" (Outline)",""))===H).map(W=>W),p=d.map(W=>W.name),f=r?{name:"icon",imageBitmap:r.image}:null,g=d.filter(W=>W.map).map(W=>{if(!W.map)throw new Error(W.name+" map is null");return{name:W.name,imageBitmap:W.map.image}}),m=d.filter(W=>W.userData.shadeTexture).map(W=>{if(!W.userData.shadeTexture)throw new Error(W.userData.shadeTexture+" map is null");return{name:W.name+"_shade",imageBitmap:W.userData.shadeTexture.image}}),v=d.filter(W=>W.roughnessMap).map(W=>W.roughnessMap?{name:W.name+"_orm",imageBitmap:W.roughnessMap.image}:null),w=d.filter(W=>W.roughnessMap).map(W=>W.normalMap?{name:W.name+"_normal",imageBitmap:W.normalMap.image}:null),B=[...g,...m,...v,...w].filter(W=>W!==null),C=ope(B,f,s?"image/ktx2":"image/png"),b=ape(C),F=lpe(C,s),x=spe(d,B),_=t.children.filter(W=>W.children.length>0&&W.children[0].type===hi.Bone)[0],M=jJ(_).filter(W=>W.name!==DD),Y=M.map(W=>W.name),O=M.map(W=>{const H=W.children.filter(ie=>ie.name!==DD).map(ie=>Y.indexOf(ie.name));return{name:W.name,rotation:[W.quaternion.x,W.quaternion.y,W.quaternion.z,W.quaternion.w],scale:[W.scale.x,W.scale.y,W.scale.z],translation:[W.position.x,W.position.y,W.position.z],children:H.length>0?H:void 0}}),U=[],y=t.children.filter(W=>W.type===hi.Group||W.type===hi.SkinnedMesh),I=[];y.forEach((W,H)=>{const ie=W.type===hi.Group?W.children[0]:W,ae=ie.geometry.attributes,me=new hA(ae.position,kn.FLOAT,Kt.POSITION,ra.VEC3,ie.name,void 0);I.push(me);const J=I.length-1,Q=ae.normal.array,S=new Float32Array(Q.length);for(let se=0;sese):[W]).forEach(se=>{if(!se.geometry.index)throw new Error(se.name+" geometry.index is null");I.push(new hA(se.geometry.index,kn.UNSIGNED_INT,Kt.INDEX,ra.SCALAR,ie.name,se.name))}),ie.morphTargetDictionary||(ie.morphTargetDictionary={},ie.morphTargetInfluences=[],ie.geometry.morphAttributes={},ie.updateMorphTargets()),ie.geometry.userData.targetNames=[];const le=(se,Ue,_e,Te)=>{const Pe=[],ke=[];for(let he=0;he0){const he=[...Pe].sort((Re,Je)=>Re-Je),Ee=[];for(let Re=0;Re({mesh:0,index:ae.index,weight:ae.weight*100}));if(ie.length>0){let ae=!1;for(const me in ui)if(W===ui[me]&&W!=="surprised"){u.push({name:W,presetName:$fe(W),binds:ie,isBinary:H.isBinary}),ae=!0;break}ae===!1&&u.push({name:W,presetName:"unknown",binds:ie,isBinary:H.isBinary})}}y.forEach(W=>{const H=W.type===hi.Group?W.children[0]:W,ie=new Float32Array(H.skeleton.boneInverses.map(ae=>ae.elements).flat());I.push(new hA(new ut(ie,16),kn.FLOAT,Kt.BIND_MATRIX,ra.MAT4,H.name,H.name))}),U.push(...I.map(W=>({componentType:W.valueType,count:W.attribute.count,max:W.max,min:W.min,normalized:!1,type:W.accessorsType})));const R=rpe(y,I,p);y.forEach((W,H)=>{O.push({mesh:H,name:W.name,rotation:[W.quaternion.x,W.quaternion.y,W.quaternion.z,W.quaternion.w],scale:[W.scale.x,W.scale.y,W.scale.z],skin:H,translation:[W.position.x,W.position.y,W.position.z]})});const N=ipe(y,I,Y),k={humanBones:[]};A.humanBones.forEach(W=>{Y.indexOf(W.node.name)!=-1&&k.humanBones.push({bone:qfe(W.bone),node:Y.indexOf(W.node.name),useDefaultValues:!0})});const L={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},G={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},D=[];d.forEach(W=>{W.type=="ShaderMaterial"?D.push(Object.assign({},L)):D.push(Object.assign({},G))});const E=l;i.forEach(W=>{for(let H=0;HW.isSkinnedMesh))==null?void 0:be.skeleton)||null;for(let W=0;W{const me=ae.sphere;ie.colliders.push({radius:me.radius*o,offset:{x:me.offset[0]*o,y:me.offset[1]*o,z:me.offset[2]*o}})}),z.push(ie)}}console.log("COLLIDER GROUPS",z);const T=W=>{for(let H=0;H{var J;const H=T(W.name);if(H===-1){console.warn("Spring bone "+W.name+" was removed during cleanup process. Skipping.");return}const ie=[];W.colliderGroups.forEach(Q=>{const S=Q.colliders[0];if(S!=null){const Z=S.parent,te=z.findIndex(le=>le.name===Z.name);te!=-1&&(ie.includes(te)||ie.push(te))}});let ae=T((J=W.center)==null?void 0:J.name);ae==-1&&console.warn("no center bone for spring bone "+W.name);const me=W.settings;ee.push({bones:[H],center:ae,colliderGroups:ie,dragForce:me.dragForce,gravityDir:{x:me.gravityDir.x,y:me.gravityDir.y,z:me.gravityDir.z},gravityPower:me.gravityPower,hitRadius:me.hitRadius,stiffiness:me.stiffness})});const pe={boneGroups:ee,colliderGroups:z};console.log(pe),E.texture=f?C.length-1:void 0;const de=await Promise.all(B.map(async W=>({buffer:s?await LD(W.imageBitmap):VD(W.imageBitmap),type:Kt.IMAGE})));I.forEach((W,H)=>{W.buffer?de.push({buffer:W.buffer,typeString:"",type:W.type}):W.sparse&&(de.push({buffer:W.sparse.indices,typeString:"indices",type:W.type,count:W.sparse.count}),de.push({buffer:W.sparse.values,typeString:"values",type:W.type})),de.length-1}),f&&de.push({buffer:s?await LD(f.imageBitmap):VD(f.imageBitmap),type:Kt.IMAGE});let Ae=0,$=0,ce=0,ge=0;const Fe=de.map(W=>{const H={buffer:0,byteLength:W.buffer.byteLength,byteOffset:Ae,target:W.type===Kt.IMAGE||W.type===Kt.BIND_MATRIX||W.typeString==="indices"||W.typeString==="values"?void 0:W.type===Kt.INDEX?kn.ELEMENT_ARRAY_BUFFER:kn.ARRAY_BUFFER};return Ae+=W.buffer.byteLength,W.type===Kt.IMAGE?(C[$++].bufferView=ge,ge++):I[ce].sparse?(U[ce].sparse==null&&(U[ce].sparse={}),W.typeString==="indices"&&(U[ce].sparse.count=W.count,U[ce].sparse[W.typeString]={bufferView:ge,byteOffset:0,componentType:kn.UNSIGNED_INT}),W.typeString==="values"&&(U[ce].sparse[W.typeString]={bufferView:ge,byteOffset:0}),W.typeString==="values"&&ce++,ge++):(I[ce].bufferIndex=ge,U[ce].bufferView=ge,ce++,ge++),H}),P=Ape(t,O);tpe(E);const fe=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&fe.push("KHR_texture_basisu");const ue={accessors:U,asset:h,buffers:[{byteLength:Ae}],bufferViews:Fe,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new j,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:D,humanoid:k,meta:E,secondaryAnimation:pe,specVersion:"0.0"}},extensionsUsed:fe,images:C,materials:x,meshes:R,nodes:O,samplers:b,scenes:P,skins:N,textures:F};console.log("output",ue);const q=new PD(v_(JSON.stringify(ue,void 0,2)),"JSON"),K=new PD(Eg(de.map(W=>W.buffer)),"BIN\0"),oe=Eg([q.buffer,K.buffer]),ye=Eg([v_("glTF"),m_(2,4),m_(oe.byteLength+12,4)]);a(Eg([ye,oe]))}}function tpe(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function jJ(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>jJ(e)).flat())}const npe=new Xfe;async function LD(n){const e=await createImageBitmap(n),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0);const i=r.getImageData(0,0,t.width,t.height),s=new Uint8Array(i.data.buffer);return await npe.compress(s,t.width,t.height,4,{normalMap:!1,uastc:!1,qualityLevel:50,compressionLevel:2,uastcFlags:"DEFAULT",compressionUASTC_Rdo_Level:18,uastcRDO:!1,uastcRDOQualityScalar:1,uastcRDODictSize:4096,uastcRDOMaxSmoothBlockErrorScale:10,uastcRDOMaxSmoothBlockStdDev:18,uastcRDODontFavorSimplerModes:!1,ETC1SQualityLevel:128,ETC1SmaxEndpoints:0,ETC1SEndpointRdoThreshold:1.25,ETC1SMaxSelectors:0,ETC1SSelectorRdoThreshold:1.25,ETC1SNoEndpointRdo:!1,ETC1SNoSelectorRdo:!1,supercmp_scheme:"Zstd"})}function VD(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===kn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===kn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class PD{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Eg([m_(r.byteLength,4),v_(this.type),r])}padBuffer(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),new Uint8Array(i).fill(t,e.byteLength),i}}const OD=n=>{const e=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],t=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;rn.map(r=>{const i=r.type===hi.Group?r.children[0]:r,s=r.type===hi.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Kt.SKIN_INDEX),NORMAL:a.indexOf(Kt.NORMAL),POSITION:a.indexOf(Kt.POSITION),TEXCOORD_0:a.indexOf(Kt.UV),WEIGHTS_0:a.indexOf(Kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>{const c=e.map(d=>d.type===Kt.BLEND_NORMAL&&d.meshName===i.name?d.name:null).indexOf(g_+A),u=e.map(d=>d.type===Kt.BLEND_POSITION&&d.meshName===i.name?d.name:null).indexOf(g_+A),h={};return u!==-1&&(h.POSITION=u),c!==-1&&(h.NORMAL=c),h}):void 0}})}}),ipe=(n,e,t)=>n.map(r=>{const i=r.type===hi.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Kt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),spe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(p=>p.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const d=t;r=d.color?[d.color.r,d.color.g,d.color.b,1]:void 0}let s=-1;t.map?s=e.map(d=>d.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(d=>d.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(d=>d.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(d=>d.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,A={baseColorFactor:r,baseColorTexture:l},c=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(c)A.metallicRoughnessTexture=c;else{const d=(()=>{switch(t.type){case Sh.MeshStandardMaterial:return t.metalness;case Sh.MeshBasicMaterial:return 0;default:return 0}})(),p=(()=>{switch(t.type){case Sh.MeshStandardMaterial:return t.roughness;case Sh.MeshBasicMaterial:return .9;default:return .9}})();A.metallicFactor=d,A.roughnessFactor=p}const h={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{}}:void 0,name:t.name,pbrMetallicRoughness:A};return u&&(h.normalTexture=u),h}),ope=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),ape=n=>n.map(()=>({magFilter:kn.LINEAR,minFilter:kn.LINEAR,wrapS:kn.REPEAT,wrapT:kn.REPEAT})),lpe=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),Ape=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===hi.Object3D||r.type===hi.SkinnedMesh||r.type===hi.Group||r.type===hi.Bone).map(r=>t.indexOf(r.name))}]};function cpe(n,e,t){var a,l;const r=[],i=[];for(const A in n)((l=(a=n[A])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[A].vrm.meta.authors!=null?i.push(n[A].vrm.meta):r.push(n[A].vrm.meta));r.length+i.length==1&&(r.length==1?r[0].title!=null&&(t=r[0].title):i[0].name!=null&&(t=i[0].name)),e!=null&&(e.authors!=null?i.push(e):r.push(e));const s=dpe(r),o=upe(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function upe(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:A="",avatarPermission:c=void 0,otherPermissionUrl:u=[]}=n,h,d,p,f="unnecessary",g,m=[];e.forEach(x=>{t=t.concat(ht(x.authors)),r=r.concat(ht(x.otherLicenseUrl)),i=i.concat(ht(x.contactInformation)),s=s.concat(ht(x.references)),u=u.concat(ht(x.otherPermissionUrl)),x.allowExcessivelyViolentUsage===!1&&(o=!1),x.allowExcessivelySexualUsage===!1&&(a=!1),l=ml(ppe,l,x.commercialUsage),A=ml(KJ,A,x.copyrightInformation),c=ml(gpe,c,x.avatarPermission),x.allowAntisocialOrHateUsage===!1&&(h=h=!1),x.allowPoliticalOrReligiousUsage===!1&&(d=d=!1),x.allowRedistribution===!1&&(p=p=!1),x.creditNotation==="required"&&(f="required"),m=m.concat(ht(x.thirdPartyLicenses)),g=ml(fpe,g,x.modification)});const v=[...new Set(t)].filter(x=>x!=""&&x!=null&&x!="undefined"),w=[...new Set(r)].filter(x=>x!=""&&x!=null&&x!="undefined"),B=[...new Set(i)].filter(x=>x!=""&&x!=null&&x!="undefined"),C=[...new Set(s)].filter(x=>x!=""&&x!=null&&x!="undefined"),b=[...new Set(u)].filter(x=>x!=""&&x!=null&&x!="undefined"),F=[...new Set(m)].filter(x=>x!=""&&x!=null&&x!="undefined");return{authors:v,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:B.length==0?"":B.join(", "),references:C,otherPermissionUrl:b.length==0?"":b.join(", "),thirdPartyLicenses:F.length==0?"":F.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:A,avatarPermission:c,allowAntisocialOrHateUsage:h,allowPoliticalOrReligiousUsage:d,allowRedistribution:p,creditNotation:f,modification:g}}function dpe(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,A,c;n.forEach(g=>{e=e.concat(ht(g.author)),t=t.concat(ht(g.contactInformation)),r=r.concat(ht(g.reference)),i=i.concat(ht(g.otherPermissionUrl)),s=s.concat(ht(g.otherLicenseUrl)),o=ml(mpe,o,g.allowedUsername),a=ml(CI,a,g.violentUssageName),l=ml(CI,l,g.sexualUssageName),A=ml(CI,A,g.commercialUssageName),c=ml(KJ,c,g.licenseName)});const u=[...new Set(e)].filter(g=>g!=""&&g!=null&&g!="undefined"),h=[...new Set(t)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(r)].filter(g=>g!=""&&g!=null&&g!="undefined"),p=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),f=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:f,contactInformation:h,references:d,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:A==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:c,avatarPermission:hpe(o),otherPermissionUrl:p}}function hpe(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const fpe={prohibited:0,allowModification:1,allowModificationRedistribution:2},ppe={personalNonProfit:0,personalProfit:1,corporation:2},gpe={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},mpe={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},CI={Disallow:0,Allow:1},KJ={Redistribution_Prohibited:0,Other:1,CC_BY_NC_ND:2,CC_BY_ND:3,CC_BY_NC_SA:4,CC_BY_SA:5,CC_BY_NC:6,CC_BY:7,CC0:8};function ml(n,e,t){return e===void 0?t:t==null||!(t in n)||n[e]{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function vpe(n){const e=$J(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=LJ(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new bu,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new kr;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function ype(n,e,t){const r=await aQ(n,t),i=await qJ(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function wpe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;Bpe(n,e,r).then(a=>{tH(a,`${o}.vrm`),i()})})}async function Bpe(n,e,t){const r=await aQ(n,t);return qJ(r,e,t)}function aQ(n,e){const t=$J(n),{createTextureAtlas:r=!0}=e;return r?afe(t,e):(console.log("no atlas"),ife(t,e))}async function Cpe(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await aQ(n,t):vpe(n);bpe(s).then(o=>{if(o instanceof ArrayBuffer)tH(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);_pe(a,`${r}.gltf`)}})}function bpe(n){return new Promise(e=>new JU().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function xpe(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(A=>A.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in Wm)if(s.bone.parent.name==Wm[o]){t.push(s);break}}),t}function Ipe(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Wm)if(Wm[r]===t.name){e[t.name]={node:t};break}}),e}function Fpe(n,e){const t=Sf(n,"SkinnedMesh");return{humanBones:Ipe(t[0]),materials:n.userData.atlasMaterial,meta:Epe(e)}}function Epe(n){return n=n||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:"CharacterCreator",licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...n}}function qJ(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=cpe(e,s,a);return new Promise(async A=>{const c=i?new epe:new $de,u={...Upe(e),...Fpe(n,l)};let h;n.traverse(f=>{f.isSkinnedMesh&&(h=f)}),(()=>{for(let f=0;f{f.updateMatrix(),f.updateMatrixWorld()}),h.skeleton.calculateInverses(),h.skeleton.computeBoneTexture(),h.skeleton.update()})(),h.skeleton.bones.filter(f=>f.name==="head")[0];const p=xpe(e);c.parse(u,n,r,p,t.ktxCompression,o,f=>{A(f)})})}function eH(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function _pe(n,e){eH(new Blob([n],{type:"text/plain"}),e)}function tH(n,e){eH(Spe(n),e)}function Spe(n){return new Blob([n],{type:"application/octet-stream"})}function Upe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}const Qpe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?Rpe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?Mpe(n):console.warn("No valid vrm file was provided")},Rpe=n=>{var a,l,A;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:A.colliderGroups,s=[],o=r.map(c=>nH(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],h=ZJ(t,u);if(h!=null){const d=c.colliders;h.userData.VRMcolliders=d.map(p=>({sphere:{radius:p.radius,offset:[p.offset.x,p.offset.y,p.offset.z]}}))}h.userData.VRMcollidersID=WJ()})},Mpe=n=>{var l,A,c,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:A.colliderGroups,s=(u=(c=e.extensions)==null?void 0:c.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(h=>nH(h.name,o));i!=null&&i.forEach(h=>{const d=ht(h.colliders);let p=-1,f=null;d.forEach(g=>{if(p!=s[g].node){p=s[g].node;const m=a[p];f=ZJ(t,m),f.userData.VRMcolliders=[]}if(f!=null){const m=s[g].shape;for(const v in m){const w=m[v];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}f.userData.VRMcollidersID=WJ(),f.userData.VRMcolliders.push(m)}else console.error("no node with name "+a[p]+" was found")})})},nH=(n,e)=>{const t=bt.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},jB=[0,400,560,2400,4800],KB=[0,500,700,3e3,6e3],y_=[],ol=[],lQ=1024,rH=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=$B.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=lQ,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=$B.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(ui.Oh,0),this.vrm.expressionManager.setValue(ui.Ah,0),this.vrm.expressionManager.setValue(ui.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(ui.Oh,i),this.vrm.expressionManager.setValue(ui.Ah,r),this.vrm.expressionManager.setValue(ui.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(A){const u=new Float32Array(A.length);for(let h=0;h0&&(i[A]+=r[c]);i[A]/=ol[A+1]-ol[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=ol[A+1]-ol[A],s[A]=s[A]/(y_[A+1]-y_[A])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let A=0;A=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const bI=new j;class Tpe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new Ye,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,A,c={x:window.innerWidth,y:window.innerHeight};return e<=c.x/2&&(o=c.x/2-e,a=o/(c.x/2)*100,i=r.maxx*a/100*-1),e>=c.x/2&&(o=e-c.x/2,a=o/(c.x/2)*100,i=r.minx*a/100),t<=c.y/2&&(l=c.y/2-t,A=l/(c.y/2)*100,s=r.maxy*.5*A/100*-1),t>=c.y/2&&(l=t-c.y/2,A=l/(c.y/2)*100,s=r.miny*A/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Wt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Wt.degToRad(s.y*r),e.rotation.x,o)}}update(){bI.set(0,0,1),bI.applyQuaternion(this.camera.quaternion);const e=bI.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class xI{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:A,requiredTraits:c,randomTraits:u,colliderTraits:h,lipSyncTraits:d,blinkerTraits:p,typeRestrictions:f,defaultCullingLayer:g,defaultCullingDistance:m,offset:v,vrmMeta:w,traits:B,textureCollections:C,colorCollections:b,canDownload:F=!0,downloadOptions:x={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ht(o),this.requiredTraits=ht(c),this.randomTraits=ht(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ht(h),this.lipSyncTraits=ht(d),this.blinkerTraits=ht(p),this.typeRestrictions=f,this.defaultCullingLayer=g,this.defaultCullingDistance=m,this.offset=v,this.canDownload=F,this.downloadOptions=x;const _=()=>{const O=[];for(const U in B)O.push(B[U].trait);return O};this.allTraits=_(),_(),(()=>{if(this.typeRestrictions)for(const O in this.typeRestrictions)ht(this.typeRestrictions[O]).forEach(y=>{this.typeRestrictions[y]==null&&(this.typeRestrictions[y]=[]),this.typeRestrictions[y].indexOf(O)==-1&&this.typeRestrictions[y].push(O)})})(),(()=>{x.vrmMeta=x.vrmMeta||w,x.scale=x.scale||a||1,x.mToonAtlasSize=x.mToonAtlasSize||2048,x.mToonAtlasSizeTransp=x.mToonAtlasSizeTransp||1024,x.stdAtlasSize=x.stdAtlasSize||2048,x.stdAtlasSizeTransp=x.stdAtlasSizeTransp||1024,x.exportStdAtlas=x.exportStdAtlas||!1,x.exportMtoonAtlas=x.exportMtoonAtlas||!0,x.screenshotFaceDistance=x.screenshotFaceDistance||1,x.screenshotFaceOffset=x.screenshotFaceOffset||[0,0,0],x.screenshotResolution=x.screenshotResolution||[512,512],x.screenshotBackground=x.screenshotBackground||[.1,.1,.1],x.screenshotFOV=x.screenshotFOV||75,!x.exportStdAtlas&&!x.exportMtoonAtlas&&(x.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(C),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(b),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(B)}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=ht(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new II(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new II(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new II(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]),ht(e).forEach(r=>{this.modelTraits.push(new Npe(this,r))}),this.modelTraitsMap=new Map(this.modelTraits.map(r=>[r.trait,r])),this.modelTraits.forEach(r=>{r.restrictedTraits.forEach(i=>{const s=this.getModelGroup(i);console.log(s),s&&s.addTraitRestriction(r.trait)})})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),ht(e).forEach(r=>{this.textureTraits.push(new kpe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ht(e).forEach(r=>{this.colorTraits.push(new Dpe(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class Npe{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:A,restrictedTraits:c=[],restrictedTypes:u=[]}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.restrictedTraits=c,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(A)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}addTraitRestriction(e){this.restrictedTraits.indexOf(e)==-1&&this.restrictedTraits.push(e)}createCollection(e,t=!1){t&&(this.collection=[]),ht(e).forEach(r=>{this.collection.push(new WD(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new WD(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class kpe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ht(e).forEach(r=>{this.collection.push(new Lpe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class Dpe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ht(e).forEach(r=>{this.collection.push(new Vpe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class WD{constructor(e,t){const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,colorCollection:u,fullDirectory:h,fullThumbnail:d}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,h)this.fullDirectory=h;else if(Array.isArray(i)){this.fullDirectory=[];for(let p=0;p0&&this.manifestData.restrictedTypes>0){haveCommonValue=(i,s)=>{if(i==null||s==null)return!1;for(let o=0;ohaveCommonValue(r[i],traitTypes))}return!1}}class Lpe{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(nl)}),nl.z+=.3,nl.y+=s,this.screenshotManager.setCamera(nl,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&(A.userData.clippedIndexGeometry=A.geometry.index.clone(),A.geometry.setIndex(A.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&A.geometry.setIndex(A.userData.clippedIndexGeometry)})},o=(A,c)=>{for(let u=0;u{var f,g;const u=A.object,h=A.face,d=[h.a,h.b,h.c],p=(g=(f=u.userData)==null?void 0:f.clippedIndexGeometry)==null?void 0:g.array;if(p!=null){const m=o(p,d),v=Array.from(p);if(m==-1&&!c){const w=[...v,...d];u.userData.clippedIndexGeometry=new ut(new Uint32Array(w),1,!1)}m!=1&&c&&(v.splice(m,3),u.userData.clippedIndexGeometry=new ut(new Uint32Array(v),1,!1))}};FI.x=e,FI.y=t,i(),GD.setFromCamera(FI,this.renderCamera);const l=GD.intersectObjects(this.characterModel.children);if(l.length>0){const A=l[0];a(A,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new Bw({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.isVrm0=!0,o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await wpe(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};Cpe(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(ht(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadTrait(e,t,r=!1){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getTraitOption(e,t);o&&(await this._loadTraits(ht(o),r),i())}catch(o){console.error("Error loading specific trait:",o.message),s(new Error("Failed to load specific trait."))}else{const o="No manifest was loaded, specific trait cannot be loaded.";console.error(o),s(new Error(o))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(ht(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await hfe(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new Le(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new Le(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new Bw({traitGroupID:e,traitModel:null});this._addLoadedData(i),vI(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){vI(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new xI(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new xI(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new xI(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async soloTargetGroupTrait(e){const t=ht(e),r=[];for(const i in this.avatar)t.includes(i)&&r.push(this.manifestData.getTraitOption(i,this.avatar[i].traitInfo.id));await this._loadTraits(r,!0)}storeCurrentAvatar(){this.storedAvatar={...this.avatar}}async loadStoredAvatar(){const e=[];for(const t in this.storedAvatar)e.push(this.manifestData.getTraitOption(t,this.storedAvatar[t].traitInfo.id));console.log(e),this._loadTraits(e,!0)}async _loadTraits(e,t=!1){console.log("laoded traits:",e),await this.traitLoadManager.loadTraitOptions(ht(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new Bw({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),vI(this.avatar)})}async _animationManagerSetup(e,t,r){const i=ht(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,!1,0,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(d=>d.name==="head")[0].getWorldPosition(nl)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];nl.x+=s[0],nl.y+=s[1],nl.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.setCamera(nl,i,a);const c=e?this.screenshotManager.getScreenshotBlob(l,A):this.screenshotManager.getScreenshotTexture(l,A);return this.blinkManager.disableScreenshot(),c}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new Le(o,a,l)},r=new Ri({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;if(e.userData.vrm==null)return console.error("No valid VRM was provided for "+r+" trait, skipping file."),null;if(_D(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&Qpe(e),Bfe(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new $B(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"){if(o.humanoid.humanBones.hips.node.parent==o.scene){const A=new Rt;A.name="newRootNode",dfe(o.scene,A),A.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(A=>{var c;if(A.isSkinnedMesh){const u={},h=ht((c=A.geometry.userData)==null?void 0:c.targetNames);for(let d=0;d{const h=e.scene.getObjectByName(u);h!=null&&h.isMesh&&o.push(h)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const A=this.manifest,c=this.manifestData.getModelGroup(r);_D(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:c.cullingLayer!=null?c.cullingLayer:A.defaultCullingLayer!=null?A.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:c.cullingDistance!=null?c.cullingDistance:A.defaultCullingDistance!=null?A.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,h)=>{if(i){const d=i[h]||i[0];d!=null&&(u.material.type==="MeshStandardMaterial"?Array.isArray(u.material)?u.material.forEach(p=>{p.map=d}):u.material.map=d:console.warn("XXX set material texture to shader material",u.material))}if(s){const d=s[h]||s[0];d!=null&&(u.material[0].uniforms.litFactor.value=d,u.material[0].uniforms.shadeColorFactor.value=new Le(d.r*.8,d.g*.8,d.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),wfe(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),this.avatar[t]={});return}let A=null;o.map(c=>{c!=null&&(A=this._VRMBaseSetup(c,r,t,a,l))}),A!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(A),this._displayModel(A),this._applyManagers(A),console.log(this.characterModel),this.avatar[t]={traitInfo:r,textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class Ope{constructor(){const e=new _Z;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new QU(e);t.crossOrigin="anonymous",t.register(i=>new Hde(i,{autoUpdateHumanBones:!0}));const r=new Pu(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var c,u,h;if(s==null){r[o]=null;return}const a=await Promise.all(ht((c=s==null?void 0:s.traitModel)==null?void 0:c.fullDirectory).map(async d=>{try{return await this.gltfLoader.loadAsync(d)}catch(p){return console.error(`Error loading modelsss ${d}:`,p),null}})),l=await Promise.all(ht((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(d=>new Promise(p=>{this.textureLoader.load(d,f=>{f.flipY=!1,f.encoding=mt,p(f)},null,f=>{console.error("error loading texture: ",f),p(null)})}))),A=ht((h=s==null?void 0:s.traitColor)==null?void 0:h.value).map(d=>new Le(d));r[o]=new Bw({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:A})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class Bw{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function Wpe(n){const e=new bB,t=new QZ(16777215,.5);e.add(t);const r=new _U(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new Rt;e.add(i);const s=new Nr(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new Ppe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new h0({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new Nie(s,l.domElement);A.minDistance=1,A.maxDistance=4,A.maxPolarAngle=Math.PI/2,A.enablePan=!0,A.target=new j(0,1,0),A.enableDamping=!0,A.dampingFactor=.1;const c=new j(-.5,0,-.5),u=new j(.5,1.5,.5),h=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",h),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputEncoding=mt;const d=()=>{requestAnimationFrame(d),A.target.clamp(c,u),A==null||A.update(),o.update(),l.render(e,s)};d();const p=g=>{const m=g.ctrlKey,v=a.getBoundingClientRect(),w=(g.clientX-v.left)/v.width*2-1,B=-((g.clientY-v.top)/v.height)*2+1;o.cameraRaycastCulling(w,B,m)};async function f(){const g="./3d/Platform.glb",v=await new QU().loadAsync(g);i.add(v.scene)}return f(),a.addEventListener("click",p),{scene:e,camera:s,controls:A,characterManager:o,sceneElements:i}}function By(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var iH={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -4224,9 +4224,9 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,i,s){function o(A,c){if(!i[A]){if(!r[A]){var u=typeof By=="function"&&By;if(!c&&u)return u(A,!0);if(a)return a(A,!0);var h=new Error("Cannot find module '"+A+"'");throw h.code="MODULE_NOT_FOUND",h}var d=i[A]={exports:{}};r[A][0].call(d.exports,function(p){var f=r[A][1][p];return o(f||p)},d,d.exports,t,r,i,s)}return i[A].exports}for(var a=typeof By=="function"&&By,l=0;l>2,d=(3&A)<<4|c>>4,p=1>6:64,f=2>4,c=(15&h)<<4|(d=a.indexOf(l.charAt(f++)))>>2,u=(3&d)<<6|(p=a.indexOf(l.charAt(f++))),v[g++]=A,d!==64&&(v[g++]=c),p!==64&&(v[g++]=u);return v}},{"./support":30,"./utils":32}],2:[function(t,r,i){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function A(c,u,h,d,p){this.compressedSize=c,this.uncompressedSize=u,this.crc32=h,this.compression=d,this.compressedContent=p}A.prototype={getContentWorker:function(){var c=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return c.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},A.createWorkerFrom=function(c,u,h){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(h)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},r.exports=A},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,i){var s=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,i){var s=t("./utils"),o=function(){for(var a,l=[],A=0;A<256;A++){a=A;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[A]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(A,c,u,h){var d=o,p=h+u;A^=-1;for(var f=h;f>>8^d[255&(A^c[f])];return-1^A}(0|l,a,a.length,0):function(A,c,u,h){var d=o,p=h+u;A^=-1;for(var f=h;f>>8^d[255&(A^c.charCodeAt(f))];return-1^A}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,r,i){var s=null;s=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:s}},{lie:37}],7:[function(t,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),A=s?"uint8array":"array";function c(u,h){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=h,this.meta={}}i.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(A,u.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(h){u.push({data:h,meta:u.meta})}},i.compressWorker=function(u){return new c("Deflate",u)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,i){function s(d,p){var f,g="";for(f=0;f>>=8;return g}function o(d,p,f,g,m,v){var w,B,C=d.file,b=d.compression,F=v!==A.utf8encode,x=a.transformTo("string",v(C.name)),_=a.transformTo("string",A.utf8encode(C.name)),M=C.comment,Y=a.transformTo("string",v(M)),O=a.transformTo("string",A.utf8encode(M)),U=_.length!==C.name.length,y=O.length!==M.length,I="",R="",N="",k=C.dir,V=C.date,G={crc32:0,compressedSize:0,uncompressedSize:0};p&&!f||(G.crc32=d.crc32,G.compressedSize=d.compressedSize,G.uncompressedSize=d.uncompressedSize);var D=0;p&&(D|=8),F||!U&&!y||(D|=2048);var E=0,z=0;k&&(E|=16),m==="UNIX"?(z=798,E|=function(T,ee){var pe=T;return T||(pe=ee?16893:33204),(65535&pe)<<16}(C.unixPermissions,k)):(z=20,E|=function(T){return 63&(T||0)}(C.dosPermissions)),w=V.getUTCHours(),w<<=6,w|=V.getUTCMinutes(),w<<=5,w|=V.getUTCSeconds()/2,B=V.getUTCFullYear()-1980,B<<=4,B|=V.getUTCMonth()+1,B<<=5,B|=V.getUTCDate(),U&&(R=s(1,1)+s(c(x),4)+_,I+="up"+s(R.length,2)+R),y&&(N=s(1,1)+s(c(Y),4)+O,I+="uc"+s(N.length,2)+N);var re="";return re+=` -\0`,re+=s(D,2),re+=b.magic,re+=s(w,2),re+=s(B,2),re+=s(G.crc32,4),re+=s(G.compressedSize,4),re+=s(G.uncompressedSize,4),re+=s(x.length,2),re+=s(I.length,2),{fileRecord:u.LOCAL_FILE_HEADER+re+x+I,dirRecord:u.CENTRAL_FILE_HEADER+s(z,2)+re+s(Y.length,2)+"\0\0\0\0"+s(E,4)+s(g,4)+x+I+Y}}var a=t("../utils"),l=t("../stream/GenericWorker"),A=t("../utf8"),c=t("../crc32"),u=t("../signature");function h(d,p,f,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=f,this.encodeFileName=g,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(d){var p=d.meta.percent||0,f=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,l.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:f?(p+100*(f-g-1))/f:100}}))},h.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var p=this.streamFiles&&!d.file.dir;if(p){var f=o(d,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(d){this.accumulate=!1;var p=this.streamFiles&&!d.file.dir,f=o(d,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),p)this.push({data:function(g){return u.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var d=this.bytesWritten,p=0;p=this.index;l--)A=(A<<8)+this.byteAt(l);return this.index+=a,A},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=o},{"../utils":32}],19:[function(t,r,i){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,i){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,r,i){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,i){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),A=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");r.exports=function(u){var h=s.getTypeOf(u);return s.checkSupport(h),h!=="string"||o.uint8array?h==="nodebuffer"?new A(u):o.uint8array?new c(s.transformTo("uint8array",u)):new a(s.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,r,i){var s=t("./GenericWorker"),o=t("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,i){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var A=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=A+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var A=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){A.dataIsReady=!0,A.data=c,A.max=c&&c.length||0,A.type=s.getTypeOf(c),A.isPaused||A._tickAndRepeat()},function(c){A.error(c)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,A=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,A);break;case"uint8array":l=this.data.subarray(this.index,A);break;case"array":case"nodebuffer":l=this.data.slice(this.index,A)}return this.index=A,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},r.exports=s},{}],29:[function(t,r,i){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),A=t("../support"),c=t("../external"),u=null;if(A.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(p,f){return new c.Promise(function(g,m){var v=[],w=p._internalType,B=p._outputType,C=p._mimeType;p.on("data",function(b,F){v.push(b),f&&f(F)}).on("error",function(b){v=[],m(b)}).on("end",function(){try{var b=function(F,x,_){switch(F){case"blob":return s.newBlob(s.transformTo("arraybuffer",x),_);case"base64":return l.encode(x);default:return s.transformTo(F,x)}}(B,function(F,x){var _,M=0,Y=null,O=0;for(_=0;_"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,i){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),A=new Array(256),c=0;c<256;c++)A[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;A[254]=A[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}i.utf8encode=function(d){return o.nodebuffer?a.newBufferFrom(d,"utf-8"):function(p){var f,g,m,v,w,B=p.length,C=0;for(v=0;v>>6:(g<65536?f[w++]=224|g>>>12:(f[w++]=240|g>>>18,f[w++]=128|g>>>12&63),f[w++]=128|g>>>6&63),f[w++]=128|63&g);return f}(d)},i.utf8decode=function(d){return o.nodebuffer?s.transformTo("nodebuffer",d).toString("utf-8"):function(p){var f,g,m,v,w=p.length,B=new Array(2*w);for(f=g=0;f>10&1023,B[g++]=56320|1023&m)}return B.length!==g&&(B.subarray?B=B.subarray(0,g):B.length=g),s.applyFromCharCode(B)}(d=s.transformTo(o.uint8array?"uint8array":"array",d))},s.inherits(u,l),u.prototype.processChunk=function(d){var p=s.transformTo(o.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var f=p;(p=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),p.set(f,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=function(v,w){var B;for((w=w||v.length)>v.length&&(w=v.length),B=w-1;0<=B&&(192&v[B])==128;)B--;return B<0||B===0?w:B+A[v[B]]>w?B:w}(p),m=p;g!==p.length&&(o.uint8array?(m=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(m=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:i.utf8decode(m),meta:d.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,s.inherits(h,l),h.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,i){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function A(f){return f}function c(f,g){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var p,f,g,m=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4>>6:(d<65536?h[g++]=224|d>>>12:(h[g++]=240|d>>>18,h[g++]=128|d>>>12&63),h[g++]=128|d>>>6&63),h[g++]=128|63&d);return h},i.buf2binstring=function(u){return c(u,u.length)},i.binstring2buf=function(u){for(var h=new s.Buf8(u.length),d=0,p=h.length;d>10&1023,v[p++]=56320|1023&f)}return c(v,p)},i.utf8border=function(u,h){var d;for((h=h||u.length)>u.length&&(h=u.length),d=h-1;0<=d&&(192&u[d])==128;)d--;return d<0||d===0?h:d+l[u[d]]>h?d:h}},{"./common":41}],43:[function(t,r,i){r.exports=function(s,o,a,l){for(var A=65535&s|0,c=s>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,A){var c=s,u=A+l;o^=-1;for(var h=A;h>>8^c[255&(o^a[h])];return-1^o}},{}],46:[function(t,r,i){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),A=t("./crc32"),c=t("./messages"),u=0,h=4,d=0,p=-2,f=-1,g=4,m=2,v=8,w=9,B=286,C=30,b=19,F=2*B+1,x=15,_=3,M=258,Y=M+_+1,O=42,U=113,y=1,I=2,R=3,N=4;function k(P,fe){return P.msg=c[fe],fe}function V(P){return(P<<1)-(4P.avail_out&&(ue=P.avail_out),ue!==0&&(o.arraySet(P.output,fe.pending_buf,fe.pending_out,ue,P.next_out),P.next_out+=ue,fe.pending_out+=ue,P.total_out+=ue,P.avail_out-=ue,fe.pending-=ue,fe.pending===0&&(fe.pending_out=0))}function E(P,fe){a._tr_flush_block(P,0<=P.block_start?P.block_start:-1,P.strstart-P.block_start,fe),P.block_start=P.strstart,D(P.strm)}function z(P,fe){P.pending_buf[P.pending++]=fe}function re(P,fe){P.pending_buf[P.pending++]=fe>>>8&255,P.pending_buf[P.pending++]=255&fe}function T(P,fe){var ue,q,K=P.max_chain_length,oe=P.strstart,ye=P.prev_length,be=P.nice_match,W=P.strstart>P.w_size-Y?P.strstart-(P.w_size-Y):0,H=P.window,ie=P.w_mask,ae=P.prev,me=P.strstart+M,J=H[oe+ye-1],Q=H[oe+ye];P.prev_length>=P.good_match&&(K>>=2),be>P.lookahead&&(be=P.lookahead);do if(H[(ue=fe)+ye]===Q&&H[ue+ye-1]===J&&H[ue]===H[oe]&&H[++ue]===H[oe+1]){oe+=2,ue++;do;while(H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&oeW&&--K!=0);return ye<=P.lookahead?ye:P.lookahead}function ee(P){var fe,ue,q,K,oe,ye,be,W,H,ie,ae=P.w_size;do{if(K=P.window_size-P.lookahead-P.strstart,P.strstart>=ae+(ae-Y)){for(o.arraySet(P.window,P.window,ae,ae,0),P.match_start-=ae,P.strstart-=ae,P.block_start-=ae,fe=ue=P.hash_size;q=P.head[--fe],P.head[fe]=ae<=q?q-ae:0,--ue;);for(fe=ue=ae;q=P.prev[--fe],P.prev[fe]=ae<=q?q-ae:0,--ue;);K+=ae}if(P.strm.avail_in===0)break;if(ye=P.strm,be=P.window,W=P.strstart+P.lookahead,H=K,ie=void 0,ie=ye.avail_in,H=_)for(oe=P.strstart-P.insert,P.ins_h=P.window[oe],P.ins_h=(P.ins_h<=_&&(P.ins_h=(P.ins_h<=_)if(q=a._tr_tally(P,P.strstart-P.match_start,P.match_length-_),P.lookahead-=P.match_length,P.match_length<=P.max_lazy_match&&P.lookahead>=_){for(P.match_length--;P.strstart++,P.ins_h=(P.ins_h<=_&&(P.ins_h=(P.ins_h<=_&&P.match_length<=P.prev_length){for(K=P.strstart+P.lookahead-_,q=a._tr_tally(P,P.strstart-1-P.prev_match,P.prev_length-_),P.lookahead-=P.prev_length-1,P.prev_length-=2;++P.strstart<=K&&(P.ins_h=(P.ins_h<P.pending_buf_size-5&&(ue=P.pending_buf_size-5);;){if(P.lookahead<=1){if(ee(P),P.lookahead===0&&fe===u)return y;if(P.lookahead===0)break}P.strstart+=P.lookahead,P.lookahead=0;var q=P.block_start+ue;if((P.strstart===0||P.strstart>=q)&&(P.lookahead=P.strstart-q,P.strstart=q,E(P,!1),P.strm.avail_out===0)||P.strstart-P.block_start>=P.w_size-Y&&(E(P,!1),P.strm.avail_out===0))return y}return P.insert=0,fe===h?(E(P,!0),P.strm.avail_out===0?R:N):(P.strstart>P.block_start&&(E(P,!1),P.strm.avail_out),y)}),new Ae(4,4,8,4,pe),new Ae(4,5,16,8,pe),new Ae(4,6,32,32,pe),new Ae(4,4,16,16,de),new Ae(8,16,32,32,de),new Ae(8,16,128,128,de),new Ae(8,32,128,256,de),new Ae(32,128,258,1024,de),new Ae(32,258,258,4096,de)],i.deflateInit=function(P,fe){return Fe(P,fe,v,15,8,0)},i.deflateInit2=Fe,i.deflateReset=ge,i.deflateResetKeep=ce,i.deflateSetHeader=function(P,fe){return P&&P.state?P.state.wrap!==2?p:(P.state.gzhead=fe,d):p},i.deflate=function(P,fe){var ue,q,K,oe;if(!P||!P.state||5>8&255),z(q,q.gzhead.time>>16&255),z(q,q.gzhead.time>>24&255),z(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),z(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(z(q,255&q.gzhead.extra.length),z(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(P.adler=A(P.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(z(q,0),z(q,0),z(q,0),z(q,0),z(q,0),z(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),z(q,3),q.status=U);else{var ye=v+(q.w_bits-8<<4)<<8;ye|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(ye|=32),ye+=31-ye%31,q.status=U,re(q,ye),q.strstart!==0&&(re(q,P.adler>>>16),re(q,65535&P.adler)),P.adler=1}if(q.status===69)if(q.gzhead.extra){for(K=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>K&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),D(P),K=q.pending,q.pending!==q.pending_buf_size));)z(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>K&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){K=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>K&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),D(P),K=q.pending,q.pending===q.pending_buf_size)){oe=1;break}oe=q.gzindexK&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),oe===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){K=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>K&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),D(P),K=q.pending,q.pending===q.pending_buf_size)){oe=1;break}oe=q.gzindexK&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),oe===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&D(P),q.pending+2<=q.pending_buf_size&&(z(q,255&P.adler),z(q,P.adler>>8&255),P.adler=0,q.status=U)):q.status=U),q.pending!==0){if(D(P),P.avail_out===0)return q.last_flush=-1,d}else if(P.avail_in===0&&V(fe)<=V(ue)&&fe!==h)return k(P,-5);if(q.status===666&&P.avail_in!==0)return k(P,-5);if(P.avail_in!==0||q.lookahead!==0||fe!==u&&q.status!==666){var be=q.strategy===2?function(W,H){for(var ie;;){if(W.lookahead===0&&(ee(W),W.lookahead===0)){if(H===u)return y;break}if(W.match_length=0,ie=a._tr_tally(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++,ie&&(E(W,!1),W.strm.avail_out===0))return y}return W.insert=0,H===h?(E(W,!0),W.strm.avail_out===0?R:N):W.last_lit&&(E(W,!1),W.strm.avail_out===0)?y:I}(q,fe):q.strategy===3?function(W,H){for(var ie,ae,me,J,Q=W.window;;){if(W.lookahead<=M){if(ee(W),W.lookahead<=M&&H===u)return y;if(W.lookahead===0)break}if(W.match_length=0,W.lookahead>=_&&0W.lookahead&&(W.match_length=W.lookahead)}if(W.match_length>=_?(ie=a._tr_tally(W,1,W.match_length-_),W.lookahead-=W.match_length,W.strstart+=W.match_length,W.match_length=0):(ie=a._tr_tally(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++),ie&&(E(W,!1),W.strm.avail_out===0))return y}return W.insert=0,H===h?(E(W,!0),W.strm.avail_out===0?R:N):W.last_lit&&(E(W,!1),W.strm.avail_out===0)?y:I}(q,fe):s[q.level].func(q,fe);if(be!==R&&be!==N||(q.status=666),be===y||be===R)return P.avail_out===0&&(q.last_flush=-1),d;if(be===I&&(fe===1?a._tr_align(q):fe!==5&&(a._tr_stored_block(q,0,0,!1),fe===3&&(G(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),D(P),P.avail_out===0))return q.last_flush=-1,d}return fe!==h?d:q.wrap<=0?1:(q.wrap===2?(z(q,255&P.adler),z(q,P.adler>>8&255),z(q,P.adler>>16&255),z(q,P.adler>>24&255),z(q,255&P.total_in),z(q,P.total_in>>8&255),z(q,P.total_in>>16&255),z(q,P.total_in>>24&255)):(re(q,P.adler>>>16),re(q,65535&P.adler)),D(P),0=ue.w_size&&(oe===0&&(G(ue.head),ue.strstart=0,ue.block_start=0,ue.insert=0),H=new o.Buf8(ue.w_size),o.arraySet(H,fe,ie-ue.w_size,ue.w_size,0),fe=H,ie=ue.w_size),ye=P.avail_in,be=P.next_in,W=P.input,P.avail_in=ie,P.next_in=0,P.input=fe,ee(ue);ue.lookahead>=_;){for(q=ue.strstart,K=ue.lookahead-(_-1);ue.ins_h=(ue.ins_h<>>=_=x>>>24,w-=_,(_=x>>>16&255)===0)I[c++]=65535&x;else{if(!(16&_)){if(!(64&_)){x=B[(65535&x)+(v&(1<<_)-1)];continue t}if(32&_){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}M=65535&x,(_&=15)&&(w<_&&(v+=y[l++]<>>=_,w-=_),w<15&&(v+=y[l++]<>>=_=x>>>24,w-=_,!(16&(_=x>>>16&255))){if(!(64&_)){x=C[(65535&x)+(v&(1<<_)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(Y=65535&x,w<(_&=15)&&(v+=y[l++]<>>=_,w-=_,(_=c-u)>3,v&=(1<<(w-=M<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(O>>>8&65280)+((65280&O)<<8)+((255&O)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(O){var U;return O&&O.state?(U=O.state,O.total_in=O.total_out=U.total=0,O.msg="",U.wrap&&(O.adler=1&U.wrap),U.mode=p,U.last=0,U.havedict=0,U.dmax=32768,U.head=null,U.hold=0,U.bits=0,U.lencode=U.lendyn=new s.Buf32(f),U.distcode=U.distdyn=new s.Buf32(g),U.sane=1,U.back=-1,h):d}function B(O){var U;return O&&O.state?((U=O.state).wsize=0,U.whave=0,U.wnext=0,w(O)):d}function C(O,U){var y,I;return O&&O.state?(I=O.state,U<0?(y=0,U=-U):(y=1+(U>>4),U<48&&(U&=15)),U&&(U<8||15=N.wsize?(s.arraySet(N.window,U,y-N.wsize,N.wsize,0),N.wnext=0,N.whave=N.wsize):(I<(R=N.wsize-N.wnext)&&(R=I),s.arraySet(N.window,U,y-I,R,N.wnext),(I-=R)?(s.arraySet(N.window,U,y-I,I,0),N.wnext=I,N.whave=N.wsize):(N.wnext+=R,N.wnext===N.wsize&&(N.wnext=0),N.whave>>8&255,y.check=a(y.check,oe,2,0),E=D=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&D)<<8)+(D>>8))%31){O.msg="incorrect header check",y.mode=30;break}if((15&D)!=8){O.msg="unknown compression method",y.mode=30;break}if(E-=4,P=8+(15&(D>>>=4)),y.wbits===0)y.wbits=P;else if(P>y.wbits){O.msg="invalid window size",y.mode=30;break}y.dmax=1<>8&1),512&y.flags&&(oe[0]=255&D,oe[1]=D>>>8&255,y.check=a(y.check,oe,2,0)),E=D=0,y.mode=3;case 3:for(;E<32;){if(V===0)break e;V--,D+=I[N++]<>>8&255,oe[2]=D>>>16&255,oe[3]=D>>>24&255,y.check=a(y.check,oe,4,0)),E=D=0,y.mode=4;case 4:for(;E<16;){if(V===0)break e;V--,D+=I[N++]<>8),512&y.flags&&(oe[0]=255&D,oe[1]=D>>>8&255,y.check=a(y.check,oe,2,0)),E=D=0,y.mode=5;case 5:if(1024&y.flags){for(;E<16;){if(V===0)break e;V--,D+=I[N++]<>>8&255,y.check=a(y.check,oe,2,0)),E=D=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(V<(T=y.length)&&(T=V),T&&(y.head&&(P=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),s.arraySet(y.head.extra,I,N,T,P)),512&y.flags&&(y.check=a(y.check,I,T,N)),V-=T,N+=T,y.length-=T),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(V===0)break e;for(T=0;P=I[N+T++],y.head&&P&&y.length<65536&&(y.head.name+=String.fromCharCode(P)),P&&T>9&1,y.head.done=!0),O.adler=y.check=0,y.mode=12;break;case 10:for(;E<32;){if(V===0)break e;V--,D+=I[N++]<>>=7&E,E-=7&E,y.mode=27;break}for(;E<3;){if(V===0)break e;V--,D+=I[N++]<>>=1)){case 0:y.mode=14;break;case 1:if(M(y),y.mode=20,U!==6)break;D>>>=2,E-=2;break e;case 2:y.mode=17;break;case 3:O.msg="invalid block type",y.mode=30}D>>>=2,E-=2;break;case 14:for(D>>>=7&E,E-=7&E;E<32;){if(V===0)break e;V--,D+=I[N++]<>>16^65535)){O.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&D,E=D=0,y.mode=15,U===6)break e;case 15:y.mode=16;case 16:if(T=y.length){if(V>>=5,E-=5,y.ndist=1+(31&D),D>>>=5,E-=5,y.ncode=4+(15&D),D>>>=4,E-=4,286>>=3,E-=3}for(;y.have<19;)y.lens[ye[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,ue={bits:y.lenbits},fe=A(0,y.lens,0,19,y.lencode,0,y.work,ue),y.lenbits=ue.bits,fe){O.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have>>16&255,$=65535&K,!((de=K>>>24)<=E);){if(V===0)break e;V--,D+=I[N++]<>>=de,E-=de,y.lens[y.have++]=$;else{if($===16){for(q=de+2;E>>=de,E-=de,y.have===0){O.msg="invalid bit length repeat",y.mode=30;break}P=y.lens[y.have-1],T=3+(3&D),D>>>=2,E-=2}else if($===17){for(q=de+3;E>>=de)),D>>>=3,E-=3}else{for(q=de+7;E>>=de)),D>>>=7,E-=7}if(y.have+T>y.nlen+y.ndist){O.msg="invalid bit length repeat",y.mode=30;break}for(;T--;)y.lens[y.have++]=P}}if(y.mode===30)break;if(y.lens[256]===0){O.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,ue={bits:y.lenbits},fe=A(c,y.lens,0,y.nlen,y.lencode,0,y.work,ue),y.lenbits=ue.bits,fe){O.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,ue={bits:y.distbits},fe=A(u,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,ue),y.distbits=ue.bits,fe){O.msg="invalid distances set",y.mode=30;break}if(y.mode=20,U===6)break e;case 20:y.mode=21;case 21:if(6<=V&&258<=G){O.next_out=k,O.avail_out=G,O.next_in=N,O.avail_in=V,y.hold=D,y.bits=E,l(O,re),k=O.next_out,R=O.output,G=O.avail_out,N=O.next_in,I=O.input,V=O.avail_in,D=y.hold,E=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;Ae=(K=y.lencode[D&(1<>>16&255,$=65535&K,!((de=K>>>24)<=E);){if(V===0)break e;V--,D+=I[N++]<>ce)])>>>16&255,$=65535&K,!(ce+(de=K>>>24)<=E);){if(V===0)break e;V--,D+=I[N++]<>>=ce,E-=ce,y.back+=ce}if(D>>>=de,E-=de,y.back+=de,y.length=$,Ae===0){y.mode=26;break}if(32&Ae){y.back=-1,y.mode=12;break}if(64&Ae){O.msg="invalid literal/length code",y.mode=30;break}y.extra=15&Ae,y.mode=22;case 22:if(y.extra){for(q=y.extra;E>>=y.extra,E-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;Ae=(K=y.distcode[D&(1<>>16&255,$=65535&K,!((de=K>>>24)<=E);){if(V===0)break e;V--,D+=I[N++]<>ce)])>>>16&255,$=65535&K,!(ce+(de=K>>>24)<=E);){if(V===0)break e;V--,D+=I[N++]<>>=ce,E-=ce,y.back+=ce}if(D>>>=de,E-=de,y.back+=de,64&Ae){O.msg="invalid distance code",y.mode=30;break}y.offset=$,y.extra=15&Ae,y.mode=24;case 24:if(y.extra){for(q=y.extra;E>>=y.extra,E-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){O.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(G===0)break e;if(T=re-G,y.offset>T){if((T=y.offset-T)>y.whave&&y.sane){O.msg="invalid distance too far back",y.mode=30;break}ee=T>y.wnext?(T-=y.wnext,y.wsize-T):y.wnext-T,T>y.length&&(T=y.length),pe=y.window}else pe=R,ee=k-y.offset,T=y.length;for(GF?(_=ee[pe+g[U]],E[z+g[U]]):(_=96,0),v=1<>k)+(w-=v)]=x<<24|_<<16|M|0,w!==0;);for(v=1<>=1;if(v!==0?(D&=v-1,D+=v):D=0,U++,--re[O]==0){if(O===I)break;O=u[h+g[U]]}if(R>>7)]}function z(K,oe){K.pending_buf[K.pending++]=255&oe,K.pending_buf[K.pending++]=oe>>>8&255}function re(K,oe,ye){K.bi_valid>m-ye?(K.bi_buf|=oe<>m-K.bi_valid,K.bi_valid+=ye-m):(K.bi_buf|=oe<>>=1,ye<<=1,0<--oe;);return ye>>>1}function pe(K,oe,ye){var be,W,H=new Array(g+1),ie=0;for(be=1;be<=g;be++)H[be]=ie=ie+ye[be-1]<<1;for(W=0;W<=oe;W++){var ae=K[2*W+1];ae!==0&&(K[2*W]=ee(H[ae]++,ae))}}function de(K){var oe;for(oe=0;oe>1;1<=ye;ye--)ce(K,H,ye);for(W=me;ye=K.heap[1],K.heap[1]=K.heap[K.heap_len--],ce(K,H,1),be=K.heap[1],K.heap[--K.heap_max]=ye,K.heap[--K.heap_max]=be,H[2*W]=H[2*ye]+H[2*be],K.depth[W]=(K.depth[ye]>=K.depth[be]?K.depth[ye]:K.depth[be])+1,H[2*ye+1]=H[2*be+1]=W,K.heap[1]=W++,ce(K,H,1),2<=K.heap_len;);K.heap[--K.heap_max]=K.heap[1],function(Q,S){var Z,te,le,se,Ue,_e,Te=S.dyn_tree,Pe=S.max_code,ke=S.stat_desc.static_tree,he=S.stat_desc.has_stree,Ee=S.stat_desc.extra_bits,Se=S.stat_desc.extra_base,Re=S.stat_desc.max_length,Je=0;for(se=0;se<=g;se++)Q.bl_count[se]=0;for(Te[2*Q.heap[Q.heap_max]+1]=0,Z=Q.heap_max+1;Z>=7;W>>=1)if(1&J&&ae.dyn_ltree[2*me]!==0)return o;if(ae.dyn_ltree[18]!==0||ae.dyn_ltree[20]!==0||ae.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=K.static_len+3+7>>>3)<=W&&(W=H)):W=H=ye+5,ye+4<=W&&oe!==-1?q(K,oe,ye,be):K.strategy===4||H===W?(re(K,2+(be?1:0),3),ge(K,Y,O)):(re(K,4+(be?1:0),3),function(ae,me,J,Q){var S;for(re(ae,me-257,5),re(ae,J-1,5),re(ae,Q-4,4),S=0;S>>8&255,K.pending_buf[K.d_buf+2*K.last_lit+1]=255&oe,K.pending_buf[K.l_buf+K.last_lit]=255&ye,K.last_lit++,oe===0?K.dyn_ltree[2*ye]++:(K.matches++,oe--,K.dyn_ltree[2*(y[ye]+u+1)]++,K.dyn_dtree[2*E(oe)]++),K.last_lit===K.lit_bufsize-1},i._tr_align=function(K){re(K,2,3),T(K,w,Y),function(oe){oe.bi_valid===16?(z(oe,oe.bi_buf),oe.bi_buf=0,oe.bi_valid=0):8<=oe.bi_valid&&(oe.pending_buf[oe.pending++]=255&oe.bi_buf,oe.bi_buf>>=8,oe.bi_valid-=8)}(K)}},{"../utils/common":41}],53:[function(t,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,r,i){(function(s){(function(o,a){if(!o.setImmediate){var l,A,c,u,h=1,d={},p=!1,f=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(B){process.nextTick(function(){v(B)})}:function(){if(o.postMessage&&!o.importScripts){var B=!0,C=o.onmessage;return o.onmessage=function(){B=!1},o.postMessage("","*"),o.onmessage=C,B}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(B){o.postMessage(u+B,"*")}):o.MessageChannel?((c=new MessageChannel).port1.onmessage=function(B){v(B.data)},function(B){c.port2.postMessage(B)}):f&&"onreadystatechange"in f.createElement("script")?(A=f.documentElement,function(B){var C=f.createElement("script");C.onreadystatechange=function(){v(B),C.onreadystatechange=null,A.removeChild(C),C=null},A.appendChild(C)}):function(B){setTimeout(v,0,B)},g.setImmediate=function(B){typeof B!="function"&&(B=new Function(""+B));for(var C=new Array(arguments.length-1),b=0;b"u"?s===void 0?this:s:self)}).call(this,typeof pa<"u"?pa:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(iH);var Gpe=iH.exports;const Zpe=Zl(Gpe);class ep{constructor(){this.zipContainer={}}addData(e,t,r,i=""){i==""&&(i="_"),this.zipContainer[i]==null&&(this.zipContainer[i]=[]),this.zipContainer[i].push({data:e,name:t,extension:r})}saveZip(e,t=!0){const r=this.zipContainer,i=new Zpe;for(const s in r)if(s=="_")r[s].forEach((o,a)=>{i.file(o.name+"."+o.extension,o.data,{base64:!0})});else{const o=i.folder(s);r[s].forEach((a,l)=>{const A=a.extension!="txt";o.file(a.name+"."+a.extension,a.data,{base64:A})})}i.generateAsync({type:"blob"}).then(s=>{this._saveZipFile(s,e+".zip")}),t&&(this.zipContainer={})}_saveZipFile(e,t){const r=new Blob([e],{type:"application/zip"});if(typeof window.navigator.msSaveBlob<"u")window.navigator.msSaveBlob(r,t);else{const i=document.createElement("a");typeof i.download=="string"?(document.body.appendChild(i),i.download=t,i.href=URL.createObjectURL(r),i.click(),document.body.removeChild(i)):window.open(e,"_blank").document.write(""+t+"")}}}new j;class Jpe{constructor(e){this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager,this.temptime=0}async createLoraData(e,t=null,r="",i){const s=e.manifest,o=e.name?"loraData/"+e.name:"loraData",a=await this._fetchManifest(s),{assetsLocation:l="",animationsDirectory:A="",backgroundGrayscale:c=1,topFrameOffsetPixels:u=64,bottomFrameOffsetPixels:h=64,backgroundDescription:d="",width:p=512,height:f=512,dataCollection:g}=a,m=l+A+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.calculateBoneOffsets(.2);let v=0;const w=this;if(Array.isArray(g)){const B=t??new ep;await(async()=>{if(Array.isArray(g))for(let b=0;b{const G=[];return ht(R).forEach(E=>{G.push({id:E})}),G},k=R==null?v.characterManager.getTraits(F):N();if(k==null){console.log("SKipping Thumbnail Generation for trait group "+F+", its not present in the character manifest.");continue}const V=iQ(x);I?v.screenshotManager.setCameraFrameWithName(I,V):v.screenshotManager.frameShot(_,Y,V,M,O);for(let G=0;G{const[e,t]=Be.useState(null),[r,i]=Be.useState(null),[s,o]=Be.useState(null),[a,l]=Be.useState(null),[A,c]=Be.useState(null),[u,h]=Be.useState(null),[d,p]=Be.useState(null),[f,g]=Be.useState(null),[m,v]=Be.useState(null),[w,B]=Be.useState(null),[C,b]=Be.useState(null),[F,x]=Be.useState(!1);let _=!1,[M,Y]=Be.useState(!1);Be.useEffect(()=>{if(_||M)return;Y(!0),_=!0;const{scene:I,camera:R,controls:N,characterManager:k,sceneElements:V}=Wpe("editor-scene");v(R),g(I),t(k),c(V),h(k.animationManager),p(k.lookAtManager),B(N),i(new Jpe(k)),o(new Hpe(k)),l(new zpe(k))},[]);const O=I=>{I==null&&(I=!F),x(I),f.traverse(R=>{R.isMesh&&R.setDebugMode&&R.setDebugMode(I)})};Be.useEffect(()=>{if(C!=null&&C.defaultAnimations){const I=C.defaultAnimations.map(R=>R.location);u.storeDefaultAnimationPaths(I,"")}},[C]);const U=I=>{I?f.add(A):f.remove(A)},y=I=>{w&&(yE.to(w.target,{x:I.targetX??0,y:I.targetY??0,z:I.targetZ??0,duration:1}),yE.fromTo(w,{maxDistance:w.getDistance(),minDistance:w.getDistance(),minPolarAngle:w.getPolarAngle(),maxPolarAngle:w.getPolarAngle(),minAzimuthAngle:w.getAzimuthalAngle(),maxAzimuthAngle:w.getAzimuthalAngle()},{maxDistance:I.distance,minDistance:I.distance,minPolarAngle:Math.PI/2-.11,maxPolarAngle:Math.PI/2-.11,minAzimuthAngle:-.78,maxAzimuthAngle:-.78,duration:1}).then(()=>{w.minPolarAngle=0,w.maxPolarAngle=3.1415,w.minDistance=.5,w.maxDistance=10,w.minAzimuthAngle=1/0,w.maxAzimuthAngle=1/0}))};return L.jsx(lr.Provider,{value:{manifest:C,setManifest:b,scene:f,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:U,debugMode:F,toggleDebugMode:O,animationManager:u,lookAtManager:d,camera:m,moveCamera:y,controls:w,sceneElements:A},children:n.children})},Xpe={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},ot={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",BIO:"BIO",SAVE:"SAVE",MINT:"MINT",CHAT:"CHAT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},Ci=X.createContext(),jpe=n=>{const[e,t]=X.useState(Xpe.NORMAL),[r,i]=X.useState(ot.LANDING),[s,o]=X.useState(!1),[a,l]=X.useState(!1);return L.jsx(Ci.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},Kpe="modulepreload",$pe=function(n){return"/CharacterStudio/"+n},ZD={},qpe=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=$pe(s),s in ZD)return;ZD[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const u=i[c];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const A=document.createElement("link");if(A.rel=o?"stylesheet":Kpe,o||(A.as="script",A.crossOrigin=""),A.href=s,document.head.appendChild(A),o)return new Promise((c,u)=>{A.addEventListener("load",c),A.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function qB(){return qB=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function tge(n){Be.useEffect(n,[])}function nge(n,e){e===void 0&&(e={});var t=e,r=t.volume,i=r===void 0?1:r,s=t.playbackRate,o=s===void 0?1:s,a=t.soundEnabled,l=a===void 0?!0:a,A=t.interrupt,c=A===void 0?!1:A,u=t.onload,h=ege(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),d=X.useRef(null),p=X.useRef(!1),f=X.useState(null),g=f[0],m=f[1],v=X.useState(null),w=v[0],B=v[1],C=function(){typeof u=="function"&&u.call(this),p.current&&m(this.duration()*1e3),B(this)};tge(function(){return qpe(()=>import("./howler-6efb6bd7.js").then(M=>M.h),[]).then(function(M){if(!p.current){var Y;d.current=(Y=M.Howl)!==null&&Y!==void 0?Y:M.default.Howl,p.current=!0,new d.current(qB({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:C},h))}}),function(){p.current=!1}}),X.useEffect(function(){d.current&&w&&B(new d.current(qB({src:Array.isArray(n)?n:[n],volume:i,onload:C},h)))},[JSON.stringify(n)]),X.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var b=X.useCallback(function(M){typeof M>"u"&&(M={}),!(!w||!l&&!M.forceSoundEnabled)&&(c&&w.stop(),M.playbackRate&&w.rate(M.playbackRate),w.play(M.id))},[w,l,c]),F=X.useCallback(function(M){w&&w.stop(M)},[w]),x=X.useCallback(function(M){w&&w.pause(M)},[w]),_=[b,{sound:w,stop:F,pause:x,duration:g}];return _}const rge=[{name:"background/cc_bgm.wav",offset:0,duration:123458.58333333334},{name:"background/cc_bgm_balanced.wav",offset:123458.58333333334,duration:123458.60416666666},{name:"effect/character-load.wav",offset:246917.1875,duration:3030},{name:"effect/class-select.wav",offset:249947.1875,duration:2780},{name:"effect/switchingItem.wav",offset:252727.1875,duration:623.75},{name:"ui/back-next-button.wav",offset:253350.9375,duration:155.02083333333334},{name:"ui/class-mouse-over.wav",offset:253505.95833333334,duration:217.52083333333334},{name:"ui/class_click.wav",offset:253723.4791666667,duration:3123.75},{name:"ui/class_pass.wav",offset:256847.2291666667,duration:155},{name:"ui/option_click.wav",offset:257002.2291666667,duration:155.02083333333334},{name:"ui/randomize-button.wav",offset:257157.25000000003,duration:342.5208333333333},{name:"ui/section_click.wav",offset:257499.77083333337,duration:155}],ige="/CharacterStudio/assets/sounds-3322d50e.mp3",bs=Be.createContext(),sge=n=>{const e=i=>rge.find(s=>i.test(s.name)),[t]=nge(ige,{sprite:{switchItem:[e(/switchingItem/).offset,e(/switchingItem/).duration],classSelect:[e(/class-select/).offset,e(/class-select/).duration],characterLoad:[e(/character-load/).offset,e(/character-load/).duration],randomizeButton:[e(/randomize-button/).offset,e(/randomize-button/).duration],classMouseOver:[e(/class-mouse-over/).offset,e(/class-mouse-over/).duration],backNextButton:[e(/back-next-button/).offset,e(/back-next-button/).duration]}}),r=(i,s=0)=>{s===0?t({id:i}):setTimeout(()=>{t({id:i})},s)};return L.jsx(bs.Provider,{value:{playSound:r},children:n.children})};function $s(n){"@babel/helpers - typeof";return $s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$s(n)}function lo(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function oge(n,e){if($s(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if($s(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function sH(n){var e=oge(n,"string");return $s(e)=="symbol"?e:e+""}function JD(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.init(e,t)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||Age,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),i=0;i1?r-1:0),s=1;s-1?a.replace(/###/g,"."):a}function i(){return!n||typeof n=="string"}for(var s=typeof e!="string"?[].concat(e):e.split(".");s.length>1;){if(i())return{};var o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function jD(n,e,t){var r=AQ(n,e,Object),i=r.obj,s=r.k;i[s]=t}function dge(n,e,t,r){var i=AQ(n,e,Object),s=i.obj,o=i.k;s[o]=s[o]||[],r&&(s[o]=s[o].concat(t)),r||s[o].push(t)}function eC(n,e){var t=AQ(n,e),r=t.obj,i=t.k;if(r)return r[i]}function KD(n,e,t){var r=eC(n,t);return r!==void 0?r:eC(e,t)}function AH(n,e,t){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):AH(n[r],e[r],t):n[r]=e[r]);return n}function Ud(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var hge={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function fge(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return hge[e]}):n}var yb=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,pge=[" ",",","?","!",";"];function gge(n,e,t){e=e||"",t=t||"";var r=pge.filter(function(a){return e.indexOf(a)<0&&t.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),s=!i.test(n);if(!s){var o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function $D(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Cy(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function cH(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(n){if(n[e])return n[e];for(var r=e.split(t),i=n,s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var A=r.slice(s+o).join(t);return A?cH(l,A,t):void 0}i=i[r[s]]}return i}}var yge=function(n){vb(t,n);var e=mge(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return lo(this,t),i=e.call(this),yb&&cc.call(ec(i)),i.data=r||{},i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return Ao(t,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,A=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,c=[i,s];o&&typeof o!="string"&&(c=c.concat(o)),o&&typeof o=="string"&&(c=c.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(c=i.split("."));var u=eC(this.data,c);return u||!A||typeof o!="string"?u:cH(this.data&&this.data[i]&&this.data[i][s],o,l)}},{key:"addResource",value:function(i,s,o,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},A=this.options.keySeparator;A===void 0&&(A=".");var c=[i,s];o&&(c=c.concat(A?o.split(A):o)),i.indexOf(".")>-1&&(c=i.split("."),a=s,s=c[1]),this.addNamespaces(s),jD(this.data,c,a),l.silent||this.emit("added",i,s,o,a)}},{key:"addResources",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in o)(typeof o[l]=="string"||Object.prototype.toString.apply(o[l])==="[object Array]")&&this.addResource(i,s,l,o[l],{silent:!0});a.silent||this.emit("added",i,s,o)}},{key:"addResourceBundle",value:function(i,s,o,a,l){var A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},c=[i,s];i.indexOf(".")>-1&&(c=i.split("."),a=o,o=s,s=c[1]),this.addNamespaces(s);var u=eC(this.data,c)||{};a?AH(u,o,l):u=Cy(Cy({},u),o),jD(this.data,c,u),A.silent||this.emit("added",i,s,o)}},{key:"removeResourceBundle",value:function(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}},{key:"hasResourceBundle",value:function(i,s){return this.getResource(i,s)!==void 0}},{key:"getResourceBundle",value:function(i,s){return s||(s=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Cy(Cy({},{}),this.getResource(i,s)):this.getResource(i,s)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var s=this.getDataByLanguage(i),o=s&&Object.keys(s)||[];return!!o.find(function(a){return s[a]&&Object.keys(s[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(cc),uH={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var o=this;return e.forEach(function(a){o.processors[a]&&(t=o.processors[a].process(t,r,i,s))}),t}};function qD(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function oi(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var eL={},tL=function(n){vb(t,n);var e=wge(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return lo(this,t),i=e.call(this),yb&&cc.call(ec(i)),uge(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,ec(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ga.create("translator"),i}return Ao(t,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var o=this.resolve(i,s);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(i,s){var o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,l=s.ns||this.options.defaultNS||[],A=o&&i.indexOf(o)>-1,c=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!gge(i,o,a);if(A&&!c){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var h=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(h[0])>-1)&&(l=h.shift()),i=h.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if($s(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,A=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,c=this.extractFromKey(i[i.length-1],s),u=c.key,h=c.namespaces,d=h[h.length-1],p=s.lng||this.language,f=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(f){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(d).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:p,usedNS:d}:"".concat(d).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:p,usedNS:d}:u}var m=this.resolve(i,s),v=m&&m.res,w=m&&m.usedKey||u,B=m&&m.exactUsedKey||u,C=Object.prototype.toString.apply(v),b=["[object Number]","[object Function]","[object RegExp]"],F=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,_=typeof v!="string"&&typeof v!="boolean"&&typeof v!="number";if(x&&v&&_&&b.indexOf(C)<0&&!(typeof F=="string"&&C==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,v,oi(oi({},s),{},{ns:h})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(m.res=M,m):M}if(A){var Y=C==="[object Array]",O=Y?[]:{},U=Y?B:w;for(var y in v)if(Object.prototype.hasOwnProperty.call(v,y)){var I="".concat(U).concat(A).concat(y);O[y]=this.translate(I,oi(oi({},s),{joinArrays:!1,ns:h})),O[y]===I&&(O[y]=v[y])}v=O}}else if(x&&typeof F=="string"&&C==="[object Array]")v=v.join(F),v&&(v=this.extendTranslation(v,i,s,o));else{var R=!1,N=!1,k=s.count!==void 0&&typeof s.count!="string",V=t.hasDefaultValue(s),G=k?this.pluralResolver.getSuffix(p,s.count,s):"",D=s["defaultValue".concat(G)]||s.defaultValue;!this.isValidLookup(v)&&V&&(R=!0,v=D),this.isValidLookup(v)||(N=!0,v=u);var E=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,z=E&&N?void 0:v,re=V&&D!==v&&this.options.updateMissing;if(N||R||re){if(this.logger.log(re?"updateKey":"missingKey",p,d,u,re?D:v),A){var T=this.resolve(u,oi(oi({},s),{},{keySeparator:!1}));T&&T.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var ee=[],pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(var de=0;de1&&arguments[1]!==void 0?arguments[1]:{},a,l,A,c,u;return typeof i=="string"&&(i=[i]),i.forEach(function(h){if(!s.isValidLookup(a)){var d=s.extractFromKey(h,o),p=d.key;l=p;var f=d.namespaces;s.options.fallbackNS&&(f=f.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",m=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),v=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",w=o.lngs?o.lngs:s.languageUtils.toResolveHierarchy(o.lng||s.language,o.fallbackLng);f.forEach(function(B){s.isValidLookup(a)||(u=B,!eL["".concat(w[0],"-").concat(B)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(eL["".concat(w[0],"-").concat(B)]=!0,s.logger.warn('key "'.concat(l,'" for languages "').concat(w.join(", "),`" won't get resolved as namespace "`).concat(u,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(function(C){if(!s.isValidLookup(a)){c=C;var b=[p];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(b,p,C,B,o);else{var F;g&&(F=s.pluralResolver.getSuffix(C,o.count,o));var x="".concat(s.options.pluralSeparator,"zero");if(g&&(b.push(p+F),m&&b.push(p+x)),v){var _="".concat(p).concat(s.options.contextSeparator).concat(o.context);b.push(_),g&&(b.push(_+F),m&&b.push(_+x))}}for(var M;M=b.pop();)s.isValidLookup(a)||(A=M,a=s.getResource(C,B,M,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:A,usedLng:c,usedNS:u}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,s,o,a):this.resourceStore.getResource(i,s,o,a)}}],[{key:"hasDefaultValue",value:function(i){var s="defaultValue";for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}]),t}(cc);function EI(n){return n.charAt(0).toUpperCase()+n.slice(1)}var nL=function(){function n(e){lo(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ga.create("languageUtils")}return Ao(n,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var r=t.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map(function(s){return s.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=EI(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=EI(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=EI(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var r=this;if(!t)return null;var i;return t.forEach(function(s){if(!i){var o=r.formatLanguageCode(s);(!r.options.supportedLngs||r.isSupportedCode(o))&&(i=o)}}),!i&&this.options.supportedLngs&&t.forEach(function(s){if(!i){var o=r.getLanguagePartFromCode(s);if(r.isSupportedCode(o))return i=o;i=r.options.supportedLngs.find(function(a){if(a.indexOf(o)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];var i=t[r];return i||(i=t[this.getScriptPartFromCode(r)]),i||(i=t[this.formatLanguageCode(r)]),i||(i=t[this.getLanguagePartFromCode(r)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,r){var i=this,s=this.getFallbackCodes(r||this.options.fallbackLng||[],t),o=[],a=function(A){A&&(i.isSupportedCode(A)?o.push(A):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(A)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),s.forEach(function(l){o.indexOf(l)<0&&a(i.formatLanguageCode(l))}),o}}]),n}(),Cge=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],bge={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}},xge=["v1","v2","v3"],rL={zero:0,one:1,two:2,few:3,many:4,other:5};function Ige(){var n={};return Cge.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:bge[e.fc]}})}),n}var Fge=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.languageUtils=e,this.options=t,this.logger=ga.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Ige()}return Ao(n,[{key:"addRule",value:function(t,r){this.rules[t]=r}},{key:"getRule",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(t,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,i).map(function(s){return"".concat(r).concat(s)})}},{key:"getSuffixes",value:function(t){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort(function(o,a){return rL[o]-rL[a]}).map(function(o){return"".concat(r.options.prepend).concat(o)}):s.numbers.map(function(o){return r.getSuffix(t,o,i)}):[]}},{key:"getSuffix",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(r)):this.getSuffixRetroCompatible(s,r):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,r){var i=this,s=t.noAbs?t.plurals(r):t.plurals(Math.abs(r)),o=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var a=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!xge.includes(this.options.compatibilityJSON)}}]),n}();function iL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wo(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};lo(this,n),this.logger=ga.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Ao(n,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var r=t.interpolation;this.escape=r.escape!==void 0?r.escape:fge,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Ud(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Ud(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?Ud(r.nestingPrefix):r.nestingPrefixEscaped||Ud("$t("),this.nestingSuffix=r.nestingSuffix?Ud(r.nestingSuffix):r.nestingSuffixEscaped||Ud(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,r,i,s){var o=this,a,l,A,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var h=function(m){if(m.indexOf(o.formatSeparator)<0){var v=KD(r,c,m);return o.alwaysFormat?o.format(v,void 0,i,wo(wo(wo({},s),r),{},{interpolationkey:m})):v}var w=m.split(o.formatSeparator),B=w.shift().trim(),C=w.join(o.formatSeparator).trim();return o.format(KD(r,c,B),C,i,wo(wo(wo({},s),r),{},{interpolationkey:B}))};this.resetRegExp();var d=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,p=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,f=[{regex:this.regexpUnescape,safeValue:function(m){return u(m)}},{regex:this.regexp,safeValue:function(m){return o.escapeValue?u(o.escape(m)):u(m)}}];return f.forEach(function(g){for(A=0;a=g.regex.exec(t);){var m=a[1].trim();if(l=h(m),l===void 0)if(typeof d=="function"){var v=d(t,a,s);l=typeof v=="string"?v:""}else if(s&&Object.prototype.hasOwnProperty.call(s,m))l="";else if(p){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(m," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=XD(l));var w=g.safeValue(l);if(t=t.replace(a[0],w),p?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,A++,A>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,r){var i=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,a,l;function A(d,p){var f=this.nestingOptionsSeparator;if(d.indexOf(f)<0)return d;var g=d.split(new RegExp("".concat(f,"[ ]*{"))),m="{".concat(g[1]);d=g[0],m=this.interpolate(m,l);var v=m.match(/'/g),w=m.match(/"/g);(v&&v.length%2===0&&!w||w.length%2!==0)&&(m=m.replace(/'/g,'"'));try{l=JSON.parse(m),p&&(l=wo(wo({},p),l))}catch(B){return this.logger.warn("failed parsing options string in nesting for key ".concat(d),B),"".concat(d).concat(f).concat(m)}return delete l.defaultValue,d}for(;o=this.nestingRegexp.exec(t);){var c=[];l=wo({},s),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var h=o[1].split(this.formatSeparator).map(function(d){return d.trim()});o[1]=h.shift(),c=h,u=!0}if(a=r(A.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=XD(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=c.reduce(function(d,p){return i.format(d,p,s.lng,wo(wo({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function sL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function rl(n){for(var e=1;e-1){var r=n.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)t.currency||(t.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)t.range||(t.range=i.trim());else{var s=i.split(";");s.forEach(function(o){if(o){var a=o.split(":"),l=lge(a),A=l[0],c=l.slice(1),u=c.join(":").trim().replace(/^'+|'+$/g,"");t[A.trim()]||(t[A.trim()]=u),u==="false"&&(t[A.trim()]=!1),u==="true"&&(t[A.trim()]=!0),isNaN(u)||(t[A.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function Qd(n){var e={};return function(r,i,s){var o=i+JSON.stringify(s),a=e[o];return a||(a=n(i,s),e[o]=a),a(r)}}var Sge=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lo(this,n),this.logger=ga.create("formatter"),this.options=e,this.formats={number:Qd(function(t,r){var i=new Intl.NumberFormat(t,rl({},r));return function(s){return i.format(s)}}),currency:Qd(function(t,r){var i=new Intl.NumberFormat(t,rl(rl({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Qd(function(t,r){var i=new Intl.DateTimeFormat(t,rl({},r));return function(s){return i.format(s)}}),relativetime:Qd(function(t,r){var i=new Intl.RelativeTimeFormat(t,rl({},r));return function(s){return i.format(s,r.range||"day")}}),list:Qd(function(t,r){var i=new Intl.ListFormat(t,rl({},r));return function(s){return i.format(s)}})},this.init(e)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(t,r){this.formats[t.toLowerCase().trim()]=r}},{key:"addCached",value:function(t,r){this.formats[t.toLowerCase().trim()]=Qd(r)}},{key:"format",value:function(t,r,i){var s=this,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.split(this.formatSeparator),l=a.reduce(function(A,c){var u=_ge(c),h=u.formatName,d=u.formatOptions;if(s.formats[h]){var p=A;try{var f=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=f.locale||f.lng||o.locale||o.lng||i;p=s.formats[h](A,g,rl(rl(rl({},d),o),f))}catch(m){s.logger.warn(m)}return p}else s.logger.warn("there was no format function for ".concat(h));return A},t);return l}}]),n}();function oL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aL(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rge(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var Mge=function(n){vb(t,n);var e=Uge(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return lo(this,t),o=e.call(this),yb&&cc.call(ec(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=ga.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(s,a.backend,a),o}return Ao(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,A={},c={},u={},h={};return i.forEach(function(d){var p=!0;s.forEach(function(f){var g="".concat(d,"|").concat(f);!o.reload&&l.store.hasResourceBundle(d,f)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?c[g]===void 0&&(c[g]=!0):(l.state[g]=1,p=!1,c[g]===void 0&&(c[g]=!0),A[g]===void 0&&(A[g]=!0),h[f]===void 0&&(h[f]=!0)))}),p||(u[d]=!0)}),(Object.keys(A).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(A),pending:Object.keys(c),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(h)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],A=a[1];s&&this.emit("failedLoading",l,A,s),o&&this.store.addResourceBundle(l,A,o),this.state[i]=s?-1:2;var c={};this.queue.forEach(function(u){dge(u.loaded,[l],A),Rge(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(h){c[h]||(c[h]={});var d=u.loaded[h];d.length&&d.forEach(function(p){c[h][p]===void 0&&(c[h][p]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(function(u){return!u.done})}},{key:"read",value:function(i,s,o){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,A=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!i.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:A,callback:c});return}this.readingCalls++;var u=function(f,g){if(a.readingCalls--,a.waitingReads.length>0){var m=a.waitingReads.shift();a.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(f&&g&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof s=="string"&&(s=[s]);var A=this.queueLoad(i,s,a,l);if(!A.toLoad.length)return A.pending.length||l(),null;A.toLoad.forEach(function(c){o.loadOne(c)})}},{key:"load",value:function(i,s,o){this.prepareLoading(i,s,{},o)}},{key:"reload",value:function(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}},{key:"loadOne",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],A=a[1];this.read(l,A,"read",void 0,void 0,function(c,u){c&&s.logger.warn("".concat(o,"loading namespace ").concat(A," for language ").concat(l," failed"),c),!c&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(A," for language ").concat(l),u),s.loaded(i,c,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(s)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){var u=aL(aL({},A),{},{isUpdate:l}),h=this.backend.create.bind(this.backend);if(h.length<6)try{var d;h.length===5?d=h(i,s,o,a,u):d=h(i,s,o,a),d&&typeof d.then=="function"?d.then(function(p){return c(null,p)}).catch(c):c(null,d)}catch(p){c(p)}else h(i,s,o,a,c,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(cc);function lL(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if($s(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),$s(e[2])==="object"||$s(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function AL(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function cL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jo(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function by(){}function kge(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var tC=function(n){vb(t,n);var e=Tge(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(lo(this,t),r=e.call(this),yb&&cc.call(ec(r)),r.options=AL(i),r.services={},r.logger=ga,r.modules={external:[]},kge(ec(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),b0(r,ec(r));setTimeout(function(){r.init(i,s)},0)}return r}return Ao(t,[{key:"init",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof s=="function"&&(o=s,s={}),!s.defaultNS&&s.defaultNS!==!1&&s.ns&&(typeof s.ns=="string"?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));var a=lL();this.options=jo(jo(jo({},a),this.options),AL(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=jo(jo({},a.interpolation),this.options.interpolation)),s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);function l(m){return m?typeof m=="function"?new m:m:null}if(!this.options.isClone){this.modules.logger?ga.init(l(this.modules.logger),this.options):ga.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=Sge);var c=new nL(this.options);this.store=new yge(this.options.resources,this.options);var u=this.services;u.logger=ga,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new Fge(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),A&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(A),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Ege(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Mge(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(m){for(var v=arguments.length,w=new Array(v>1?v-1:0),B=1;B1?v-1:0),B=1;B0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var d=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];d.forEach(function(m){i[m]=function(){var v;return(v=i.store)[m].apply(v,arguments)}});var p=["addResource","addResources","addResourceBundle","removeResourceBundle"];p.forEach(function(m){i[m]=function(){var v;return(v=i.store)[m].apply(v,arguments),i}});var f=jp(),g=function(){var v=function(B,C){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),f.resolve(C),o(B,C)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return v(null,i.t.bind(i));i.changeLanguage(i.options.lng,v)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),f}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:by,a=o,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var A=[],c=function(d){if(d){var p=s.services.languageUtils.toResolveHierarchy(d);p.forEach(function(f){A.indexOf(f)<0&&A.push(f)})}};if(l)c(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(h){return c(h)})}this.options.preload&&this.options.preload.forEach(function(h){return c(h)}),this.services.backendConnector.load(A,this.options.ns,function(h){!h&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(h)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=jp();return i||(i=this.languages),s||(s=this.options.ns),o||(o=by),this.services.backendConnector.reload(i,s,function(l){a.resolve(),o(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&uH.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var s=0;s-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}},{key:"changeLanguage",value:function(i,s){var o=this;this.isLanguageChangingTo=i;var a=jp();this.emit("languageChanging",i);var l=function(h){o.language=h,o.languages=o.services.languageUtils.toResolveHierarchy(h),o.resolvedLanguage=void 0,o.setResolvedLanguage(h)},A=function(h,d){d?(l(d),o.translator.changeLanguage(d),o.isLanguageChangingTo=void 0,o.emit("languageChanged",d),o.logger.log("languageChanged",d)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(h,function(){return o.t.apply(o,arguments)})},c=function(h){!i&&!h&&o.services.languageDetector&&(h=[]);var d=typeof h=="string"?h:o.services.languageUtils.getBestMatchFromCodes(h);d&&(o.language||l(d),o.translator.language||o.translator.changeLanguage(d),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(d)),o.loadResources(d,function(p){A(p,d)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function A(c,u){var h;if($s(u)!=="object"){for(var d=arguments.length,p=new Array(d>2?d-2:0),f=2;f1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,A=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var c=function(d,p){var f=s.services.backendConnector.state["".concat(d,"|").concat(p)];return f===-1||f===2};if(o.precheck){var u=o.precheck(this,c);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(a,i)&&(!l||c(A,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=jp();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){o.options.ns.indexOf(l)<0&&o.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),s&&s(l)}),a):(s&&s(),Promise.resolve())}},{key:"loadLanguages",value:function(i,s){var o=jp();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(A){return a.indexOf(A)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(A){o.resolve(),s&&s(A)}),o):(s&&s(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new nL(lL());return s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:by,a=jo(jo(jo({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var A=["store","services","language"];return A.forEach(function(c){l[c]=i[c]}),l.services=jo({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new tL(l.services,l.options),l.translator.on("*",function(c){for(var u=arguments.length,h=new Array(u>1?u-1:0),d=1;d0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new tC(n,e)});var ii=tC.createInstance();ii.createInstance=tC.createInstance;ii.createInstance;ii.dir;ii.init;ii.loadResources;ii.reloadResources;ii.use;ii.changeLanguage;ii.getFixedT;ii.t;ii.exists;ii.setDefaultNamespace;ii.hasLoadedNamespace;ii.loadNamespaces;ii.loadLanguages;function Dge(){if(console&&console.warn){for(var n,e=arguments.length,t=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var o=function(l,A){var c=e.services.backendConnector.state["".concat(l,"|").concat(A)];return c===-1||c===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,n)?!1:!!(e.hasResourceBundle(r,n)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,n)&&(!i||o(s,n)))}function Vge(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return B_("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):Lge(n,e,t)}var Pge=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Oge={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Wge=function(e){return Oge[e]},Gge=function(e){return e.replace(Pge,Wge)};function hL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function fL(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};C_=fL(fL({},C_),n)}function Jge(){return C_}var dH;function Hge(n){dH=n}function zge(){return dH}var Yge={type:"3rdParty",init:function(e){Zge(e.options.react),Hge(e)}},Xge=Be.createContext(),jge=function(){function n(){lo(this,n),this.usedNamespaces={}}return Ao(n,[{key:"addUsedNamespaces",value:function(t){var r=this;t.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),n}();function Kge(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,A=!1;try{if(s=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(c){A=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(A)throw i}}return a}}function $ge(n,e){return oH(n)||Kge(n,e)||aH(n,e)||lH()}function pL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _I(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=Be.useContext(Xge)||{},i=r.i18n,s=r.defaultNS,o=t||i||zge();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new jge),!o){B_("You will need to pass in an i18next instance by using initReactI18next");var a=function(_,M){return typeof M=="string"?M:M&&$s(M)==="object"&&typeof M.defaultValue=="string"?M.defaultValue:Array.isArray(_)?_[_.length-1]:_},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&B_("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=_I(_I(_I({},Jge()),o.options.react),e),c=A.useSuspense,u=A.keyPrefix,h=n||s||o.options&&o.options.defaultNS;h=typeof h=="string"?[h]:h||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(h);var d=(o.isInitialized||o.initializedStoreOnce)&&h.every(function(x){return Vge(x,o,A)});function p(){return o.getFixedT(null,A.nsMode==="fallback"?h:h[0],u)}var f=Be.useState(p),g=$ge(f,2),m=g[0],v=g[1],w=h.join(),B=qge(w),C=Be.useRef(!0);Be.useEffect(function(){var x=A.bindI18n,_=A.bindI18nStore;C.current=!0,!d&&!c&&dL(o,h,function(){C.current&&v(p)}),d&&B&&B!==w&&C.current&&v(p);function M(){C.current&&v(p)}return x&&o&&o.on(x,M),_&&o&&o.store.on(_,M),function(){C.current=!1,x&&o&&x.split(" ").forEach(function(Y){return o.off(Y,M)}),_&&o&&_.split(" ").forEach(function(Y){return o.store.off(Y,M)})}},[o,w]);var b=Be.useRef(!0);Be.useEffect(function(){C.current&&!b.current&&v(p),b.current=!1},[o,u]);var F=[m,o,d];if(F.t=m,F.i18n=o,F.ready=d,d||!d&&!c)return F;throw new Promise(function(x){dL(o,h,function(){x()})})}var hH=[],tme=hH.forEach,nme=hH.slice;function rme(n){return tme.call(nme.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var gL=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,ime=function(e,t,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(t),o="".concat(e,"=").concat(s);if(i.maxAge>0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!gL.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!gL.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},mL={create:function(e,t,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=ime(e,encodeURIComponent(t),s)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o0){var l=s[o].substring(0,a);l===e.lookupQuerystring&&(t=s[o].substring(a+1))}}}return t}},Kp=null,vL=function(){if(Kp!==null)return Kp;try{Kp=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Kp=!1}return Kp},ame={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&vL()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&vL()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},$p=null,yL=function(){if($p!==null)return $p;try{$p=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{$p=!1}return $p},lme={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&yL()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&yL()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Ame={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},cme={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},ume={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},dme={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[t]}};function hme(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var fH=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=rme(r,this.options||{},hme()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(sme),this.addDetector(ome),this.addDetector(ame),this.addDetector(lme),this.addDetector(Ame),this.addDetector(cme),this.addDetector(ume),this.addDetector(dme)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var i=[];return t.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(t,i.options)}))}}]),n}();fH.type="languageDetector";const fme={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",createBio:"Create Bio",saveCharacter:"Save Your Character",chat:"Chat With Your Character"},classes:{beastPainter:{name:"Beast Painter",description:"Paints beasts"},engineer:{name:"Engineer",description:"Builds things"},dropHunter:{name:"Drop Hunter",description:"Hunts drops"},theDegen:{name:"The Degen",description:"Degens"},neuralHacker:{name:"Neural Hacker",description:"Hacks neural networks"},liskWitch:{name:"Lisk Witch",description:"Witches lisk"},bruiser:{name:"Bruiser",description:"Bruises things"}},callToAction:{next:"Next",back:"Back",randomize:"Randomize",chat:"Chat",send:"Send"},editor:{title:"Appearance",head:"Head",body:"Body",eyes:"Eyes",outer:"Outer",chest:"Chest",legs:"Legs",feet:"Feet",accessories:"Accessories"},labels:{name:"Name",voice:"Voice",favoriteColor:"Favorite Color",preferredGreeting:"Preferred Greeting",bio:"Bio",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},pme={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",createBio:"Создать Биографию",saveCharacter:"Сохранить Персонажа",chat:"Общаться Со Своим Персонажем"},classes:{beastPainter:{name:"Анималист",description:"Рисует зверей"},engineer:{name:"Инженер",description:"Строит вещи"},dropHunter:{name:"Охотник за дропами",description:"Охотится на дропы"},theDegen:{name:"Деген",description:"Дегены"},neuralHacker:{name:"Нейронный Хакер",description:"Взламывает нейр. сети"},liskWitch:{name:"Лиск Ведьма",description:"Лиск Ведьмы"},bruiser:{name:"Громила",description:"Громит вещи"}},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",chat:"Чат",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",bio:"Биография",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},gme={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",createBio:"创建简介",saveCharacter:"保存角色",chat:"与你的角色聊天"},classes:{beastPainter:{name:"野兽画家",description:"画野兽"},engineer:{name:"工程师",description:"建造物品"},dropHunter:{name:"投放猎手",description:"猎取投放品"},theDegen:{name:"豪赌家",description:"资深赌徒"},neuralHacker:{name:"神经黑客",description:"侵入神经网络"},liskWitch:{name:"Lisk 巫师",description:"施法于 Lisk"},bruiser:{name:"碾压者",description:"碾碎一切"}},callToAction:{next:"下一步",back:"返回",randomize:"随机",chat:"聊天",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",bio:"简介",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},mme={en:fme,ru:pme,zh:gme};ii.use(fH).use(Yge).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:mme});const xs=Be.createContext(),vme=n=>{const{t:e}=eme();return L.jsx(xs.Provider,{value:{t:e},children:n.children})},yme=` +*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,i,s){function o(A,c){if(!i[A]){if(!r[A]){var u=typeof By=="function"&&By;if(!c&&u)return u(A,!0);if(a)return a(A,!0);var h=new Error("Cannot find module '"+A+"'");throw h.code="MODULE_NOT_FOUND",h}var d=i[A]={exports:{}};r[A][0].call(d.exports,function(p){var f=r[A][1][p];return o(f||p)},d,d.exports,t,r,i,s)}return i[A].exports}for(var a=typeof By=="function"&&By,l=0;l>2,d=(3&A)<<4|c>>4,p=1>6:64,f=2>4,c=(15&h)<<4|(d=a.indexOf(l.charAt(f++)))>>2,u=(3&d)<<6|(p=a.indexOf(l.charAt(f++))),v[g++]=A,d!==64&&(v[g++]=c),p!==64&&(v[g++]=u);return v}},{"./support":30,"./utils":32}],2:[function(t,r,i){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function A(c,u,h,d,p){this.compressedSize=c,this.uncompressedSize=u,this.crc32=h,this.compression=d,this.compressedContent=p}A.prototype={getContentWorker:function(){var c=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return c.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},A.createWorkerFrom=function(c,u,h){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(h)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},r.exports=A},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,i){var s=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,i){var s=t("./utils"),o=function(){for(var a,l=[],A=0;A<256;A++){a=A;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[A]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(A,c,u,h){var d=o,p=h+u;A^=-1;for(var f=h;f>>8^d[255&(A^c[f])];return-1^A}(0|l,a,a.length,0):function(A,c,u,h){var d=o,p=h+u;A^=-1;for(var f=h;f>>8^d[255&(A^c.charCodeAt(f))];return-1^A}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,r,i){var s=null;s=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:s}},{lie:37}],7:[function(t,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),A=s?"uint8array":"array";function c(u,h){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=h,this.meta={}}i.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(A,u.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(h){u.push({data:h,meta:u.meta})}},i.compressWorker=function(u){return new c("Deflate",u)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,i){function s(d,p){var f,g="";for(f=0;f>>=8;return g}function o(d,p,f,g,m,v){var w,B,C=d.file,b=d.compression,F=v!==A.utf8encode,x=a.transformTo("string",v(C.name)),_=a.transformTo("string",A.utf8encode(C.name)),M=C.comment,Y=a.transformTo("string",v(M)),O=a.transformTo("string",A.utf8encode(M)),U=_.length!==C.name.length,y=O.length!==M.length,I="",R="",N="",k=C.dir,L=C.date,G={crc32:0,compressedSize:0,uncompressedSize:0};p&&!f||(G.crc32=d.crc32,G.compressedSize=d.compressedSize,G.uncompressedSize=d.uncompressedSize);var D=0;p&&(D|=8),F||!U&&!y||(D|=2048);var E=0,z=0;k&&(E|=16),m==="UNIX"?(z=798,E|=function(T,ee){var pe=T;return T||(pe=ee?16893:33204),(65535&pe)<<16}(C.unixPermissions,k)):(z=20,E|=function(T){return 63&(T||0)}(C.dosPermissions)),w=L.getUTCHours(),w<<=6,w|=L.getUTCMinutes(),w<<=5,w|=L.getUTCSeconds()/2,B=L.getUTCFullYear()-1980,B<<=4,B|=L.getUTCMonth()+1,B<<=5,B|=L.getUTCDate(),U&&(R=s(1,1)+s(c(x),4)+_,I+="up"+s(R.length,2)+R),y&&(N=s(1,1)+s(c(Y),4)+O,I+="uc"+s(N.length,2)+N);var re="";return re+=` +\0`,re+=s(D,2),re+=b.magic,re+=s(w,2),re+=s(B,2),re+=s(G.crc32,4),re+=s(G.compressedSize,4),re+=s(G.uncompressedSize,4),re+=s(x.length,2),re+=s(I.length,2),{fileRecord:u.LOCAL_FILE_HEADER+re+x+I,dirRecord:u.CENTRAL_FILE_HEADER+s(z,2)+re+s(Y.length,2)+"\0\0\0\0"+s(E,4)+s(g,4)+x+I+Y}}var a=t("../utils"),l=t("../stream/GenericWorker"),A=t("../utf8"),c=t("../crc32"),u=t("../signature");function h(d,p,f,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=f,this.encodeFileName=g,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(d){var p=d.meta.percent||0,f=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,l.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:f?(p+100*(f-g-1))/f:100}}))},h.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var p=this.streamFiles&&!d.file.dir;if(p){var f=o(d,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(d){this.accumulate=!1;var p=this.streamFiles&&!d.file.dir,f=o(d,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),p)this.push({data:function(g){return u.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var d=this.bytesWritten,p=0;p=this.index;l--)A=(A<<8)+this.byteAt(l);return this.index+=a,A},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=o},{"../utils":32}],19:[function(t,r,i){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,i){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,r,i){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,i){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),A=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");r.exports=function(u){var h=s.getTypeOf(u);return s.checkSupport(h),h!=="string"||o.uint8array?h==="nodebuffer"?new A(u):o.uint8array?new c(s.transformTo("uint8array",u)):new a(s.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,r,i){var s=t("./GenericWorker"),o=t("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,i){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var A=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=A+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var A=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){A.dataIsReady=!0,A.data=c,A.max=c&&c.length||0,A.type=s.getTypeOf(c),A.isPaused||A._tickAndRepeat()},function(c){A.error(c)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,A=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,A);break;case"uint8array":l=this.data.subarray(this.index,A);break;case"array":case"nodebuffer":l=this.data.slice(this.index,A)}return this.index=A,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},r.exports=s},{}],29:[function(t,r,i){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),A=t("../support"),c=t("../external"),u=null;if(A.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(p,f){return new c.Promise(function(g,m){var v=[],w=p._internalType,B=p._outputType,C=p._mimeType;p.on("data",function(b,F){v.push(b),f&&f(F)}).on("error",function(b){v=[],m(b)}).on("end",function(){try{var b=function(F,x,_){switch(F){case"blob":return s.newBlob(s.transformTo("arraybuffer",x),_);case"base64":return l.encode(x);default:return s.transformTo(F,x)}}(B,function(F,x){var _,M=0,Y=null,O=0;for(_=0;_"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,i){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),A=new Array(256),c=0;c<256;c++)A[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;A[254]=A[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}i.utf8encode=function(d){return o.nodebuffer?a.newBufferFrom(d,"utf-8"):function(p){var f,g,m,v,w,B=p.length,C=0;for(v=0;v>>6:(g<65536?f[w++]=224|g>>>12:(f[w++]=240|g>>>18,f[w++]=128|g>>>12&63),f[w++]=128|g>>>6&63),f[w++]=128|63&g);return f}(d)},i.utf8decode=function(d){return o.nodebuffer?s.transformTo("nodebuffer",d).toString("utf-8"):function(p){var f,g,m,v,w=p.length,B=new Array(2*w);for(f=g=0;f>10&1023,B[g++]=56320|1023&m)}return B.length!==g&&(B.subarray?B=B.subarray(0,g):B.length=g),s.applyFromCharCode(B)}(d=s.transformTo(o.uint8array?"uint8array":"array",d))},s.inherits(u,l),u.prototype.processChunk=function(d){var p=s.transformTo(o.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var f=p;(p=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),p.set(f,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=function(v,w){var B;for((w=w||v.length)>v.length&&(w=v.length),B=w-1;0<=B&&(192&v[B])==128;)B--;return B<0||B===0?w:B+A[v[B]]>w?B:w}(p),m=p;g!==p.length&&(o.uint8array?(m=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(m=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:i.utf8decode(m),meta:d.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,s.inherits(h,l),h.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,i){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function A(f){return f}function c(f,g){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var p,f,g,m=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4>>6:(d<65536?h[g++]=224|d>>>12:(h[g++]=240|d>>>18,h[g++]=128|d>>>12&63),h[g++]=128|d>>>6&63),h[g++]=128|63&d);return h},i.buf2binstring=function(u){return c(u,u.length)},i.binstring2buf=function(u){for(var h=new s.Buf8(u.length),d=0,p=h.length;d>10&1023,v[p++]=56320|1023&f)}return c(v,p)},i.utf8border=function(u,h){var d;for((h=h||u.length)>u.length&&(h=u.length),d=h-1;0<=d&&(192&u[d])==128;)d--;return d<0||d===0?h:d+l[u[d]]>h?d:h}},{"./common":41}],43:[function(t,r,i){r.exports=function(s,o,a,l){for(var A=65535&s|0,c=s>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,A){var c=s,u=A+l;o^=-1;for(var h=A;h>>8^c[255&(o^a[h])];return-1^o}},{}],46:[function(t,r,i){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),A=t("./crc32"),c=t("./messages"),u=0,h=4,d=0,p=-2,f=-1,g=4,m=2,v=8,w=9,B=286,C=30,b=19,F=2*B+1,x=15,_=3,M=258,Y=M+_+1,O=42,U=113,y=1,I=2,R=3,N=4;function k(P,fe){return P.msg=c[fe],fe}function L(P){return(P<<1)-(4P.avail_out&&(ue=P.avail_out),ue!==0&&(o.arraySet(P.output,fe.pending_buf,fe.pending_out,ue,P.next_out),P.next_out+=ue,fe.pending_out+=ue,P.total_out+=ue,P.avail_out-=ue,fe.pending-=ue,fe.pending===0&&(fe.pending_out=0))}function E(P,fe){a._tr_flush_block(P,0<=P.block_start?P.block_start:-1,P.strstart-P.block_start,fe),P.block_start=P.strstart,D(P.strm)}function z(P,fe){P.pending_buf[P.pending++]=fe}function re(P,fe){P.pending_buf[P.pending++]=fe>>>8&255,P.pending_buf[P.pending++]=255&fe}function T(P,fe){var ue,q,K=P.max_chain_length,oe=P.strstart,ye=P.prev_length,be=P.nice_match,W=P.strstart>P.w_size-Y?P.strstart-(P.w_size-Y):0,H=P.window,ie=P.w_mask,ae=P.prev,me=P.strstart+M,J=H[oe+ye-1],Q=H[oe+ye];P.prev_length>=P.good_match&&(K>>=2),be>P.lookahead&&(be=P.lookahead);do if(H[(ue=fe)+ye]===Q&&H[ue+ye-1]===J&&H[ue]===H[oe]&&H[++ue]===H[oe+1]){oe+=2,ue++;do;while(H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&H[++oe]===H[++ue]&&oeW&&--K!=0);return ye<=P.lookahead?ye:P.lookahead}function ee(P){var fe,ue,q,K,oe,ye,be,W,H,ie,ae=P.w_size;do{if(K=P.window_size-P.lookahead-P.strstart,P.strstart>=ae+(ae-Y)){for(o.arraySet(P.window,P.window,ae,ae,0),P.match_start-=ae,P.strstart-=ae,P.block_start-=ae,fe=ue=P.hash_size;q=P.head[--fe],P.head[fe]=ae<=q?q-ae:0,--ue;);for(fe=ue=ae;q=P.prev[--fe],P.prev[fe]=ae<=q?q-ae:0,--ue;);K+=ae}if(P.strm.avail_in===0)break;if(ye=P.strm,be=P.window,W=P.strstart+P.lookahead,H=K,ie=void 0,ie=ye.avail_in,H=_)for(oe=P.strstart-P.insert,P.ins_h=P.window[oe],P.ins_h=(P.ins_h<=_&&(P.ins_h=(P.ins_h<=_)if(q=a._tr_tally(P,P.strstart-P.match_start,P.match_length-_),P.lookahead-=P.match_length,P.match_length<=P.max_lazy_match&&P.lookahead>=_){for(P.match_length--;P.strstart++,P.ins_h=(P.ins_h<=_&&(P.ins_h=(P.ins_h<=_&&P.match_length<=P.prev_length){for(K=P.strstart+P.lookahead-_,q=a._tr_tally(P,P.strstart-1-P.prev_match,P.prev_length-_),P.lookahead-=P.prev_length-1,P.prev_length-=2;++P.strstart<=K&&(P.ins_h=(P.ins_h<P.pending_buf_size-5&&(ue=P.pending_buf_size-5);;){if(P.lookahead<=1){if(ee(P),P.lookahead===0&&fe===u)return y;if(P.lookahead===0)break}P.strstart+=P.lookahead,P.lookahead=0;var q=P.block_start+ue;if((P.strstart===0||P.strstart>=q)&&(P.lookahead=P.strstart-q,P.strstart=q,E(P,!1),P.strm.avail_out===0)||P.strstart-P.block_start>=P.w_size-Y&&(E(P,!1),P.strm.avail_out===0))return y}return P.insert=0,fe===h?(E(P,!0),P.strm.avail_out===0?R:N):(P.strstart>P.block_start&&(E(P,!1),P.strm.avail_out),y)}),new Ae(4,4,8,4,pe),new Ae(4,5,16,8,pe),new Ae(4,6,32,32,pe),new Ae(4,4,16,16,de),new Ae(8,16,32,32,de),new Ae(8,16,128,128,de),new Ae(8,32,128,256,de),new Ae(32,128,258,1024,de),new Ae(32,258,258,4096,de)],i.deflateInit=function(P,fe){return Fe(P,fe,v,15,8,0)},i.deflateInit2=Fe,i.deflateReset=ge,i.deflateResetKeep=ce,i.deflateSetHeader=function(P,fe){return P&&P.state?P.state.wrap!==2?p:(P.state.gzhead=fe,d):p},i.deflate=function(P,fe){var ue,q,K,oe;if(!P||!P.state||5>8&255),z(q,q.gzhead.time>>16&255),z(q,q.gzhead.time>>24&255),z(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),z(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(z(q,255&q.gzhead.extra.length),z(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(P.adler=A(P.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(z(q,0),z(q,0),z(q,0),z(q,0),z(q,0),z(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),z(q,3),q.status=U);else{var ye=v+(q.w_bits-8<<4)<<8;ye|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(ye|=32),ye+=31-ye%31,q.status=U,re(q,ye),q.strstart!==0&&(re(q,P.adler>>>16),re(q,65535&P.adler)),P.adler=1}if(q.status===69)if(q.gzhead.extra){for(K=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>K&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),D(P),K=q.pending,q.pending!==q.pending_buf_size));)z(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>K&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){K=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>K&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),D(P),K=q.pending,q.pending===q.pending_buf_size)){oe=1;break}oe=q.gzindexK&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),oe===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){K=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>K&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),D(P),K=q.pending,q.pending===q.pending_buf_size)){oe=1;break}oe=q.gzindexK&&(P.adler=A(P.adler,q.pending_buf,q.pending-K,K)),oe===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&D(P),q.pending+2<=q.pending_buf_size&&(z(q,255&P.adler),z(q,P.adler>>8&255),P.adler=0,q.status=U)):q.status=U),q.pending!==0){if(D(P),P.avail_out===0)return q.last_flush=-1,d}else if(P.avail_in===0&&L(fe)<=L(ue)&&fe!==h)return k(P,-5);if(q.status===666&&P.avail_in!==0)return k(P,-5);if(P.avail_in!==0||q.lookahead!==0||fe!==u&&q.status!==666){var be=q.strategy===2?function(W,H){for(var ie;;){if(W.lookahead===0&&(ee(W),W.lookahead===0)){if(H===u)return y;break}if(W.match_length=0,ie=a._tr_tally(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++,ie&&(E(W,!1),W.strm.avail_out===0))return y}return W.insert=0,H===h?(E(W,!0),W.strm.avail_out===0?R:N):W.last_lit&&(E(W,!1),W.strm.avail_out===0)?y:I}(q,fe):q.strategy===3?function(W,H){for(var ie,ae,me,J,Q=W.window;;){if(W.lookahead<=M){if(ee(W),W.lookahead<=M&&H===u)return y;if(W.lookahead===0)break}if(W.match_length=0,W.lookahead>=_&&0W.lookahead&&(W.match_length=W.lookahead)}if(W.match_length>=_?(ie=a._tr_tally(W,1,W.match_length-_),W.lookahead-=W.match_length,W.strstart+=W.match_length,W.match_length=0):(ie=a._tr_tally(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++),ie&&(E(W,!1),W.strm.avail_out===0))return y}return W.insert=0,H===h?(E(W,!0),W.strm.avail_out===0?R:N):W.last_lit&&(E(W,!1),W.strm.avail_out===0)?y:I}(q,fe):s[q.level].func(q,fe);if(be!==R&&be!==N||(q.status=666),be===y||be===R)return P.avail_out===0&&(q.last_flush=-1),d;if(be===I&&(fe===1?a._tr_align(q):fe!==5&&(a._tr_stored_block(q,0,0,!1),fe===3&&(G(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),D(P),P.avail_out===0))return q.last_flush=-1,d}return fe!==h?d:q.wrap<=0?1:(q.wrap===2?(z(q,255&P.adler),z(q,P.adler>>8&255),z(q,P.adler>>16&255),z(q,P.adler>>24&255),z(q,255&P.total_in),z(q,P.total_in>>8&255),z(q,P.total_in>>16&255),z(q,P.total_in>>24&255)):(re(q,P.adler>>>16),re(q,65535&P.adler)),D(P),0=ue.w_size&&(oe===0&&(G(ue.head),ue.strstart=0,ue.block_start=0,ue.insert=0),H=new o.Buf8(ue.w_size),o.arraySet(H,fe,ie-ue.w_size,ue.w_size,0),fe=H,ie=ue.w_size),ye=P.avail_in,be=P.next_in,W=P.input,P.avail_in=ie,P.next_in=0,P.input=fe,ee(ue);ue.lookahead>=_;){for(q=ue.strstart,K=ue.lookahead-(_-1);ue.ins_h=(ue.ins_h<>>=_=x>>>24,w-=_,(_=x>>>16&255)===0)I[c++]=65535&x;else{if(!(16&_)){if(!(64&_)){x=B[(65535&x)+(v&(1<<_)-1)];continue t}if(32&_){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}M=65535&x,(_&=15)&&(w<_&&(v+=y[l++]<>>=_,w-=_),w<15&&(v+=y[l++]<>>=_=x>>>24,w-=_,!(16&(_=x>>>16&255))){if(!(64&_)){x=C[(65535&x)+(v&(1<<_)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(Y=65535&x,w<(_&=15)&&(v+=y[l++]<>>=_,w-=_,(_=c-u)>3,v&=(1<<(w-=M<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(O>>>8&65280)+((65280&O)<<8)+((255&O)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(O){var U;return O&&O.state?(U=O.state,O.total_in=O.total_out=U.total=0,O.msg="",U.wrap&&(O.adler=1&U.wrap),U.mode=p,U.last=0,U.havedict=0,U.dmax=32768,U.head=null,U.hold=0,U.bits=0,U.lencode=U.lendyn=new s.Buf32(f),U.distcode=U.distdyn=new s.Buf32(g),U.sane=1,U.back=-1,h):d}function B(O){var U;return O&&O.state?((U=O.state).wsize=0,U.whave=0,U.wnext=0,w(O)):d}function C(O,U){var y,I;return O&&O.state?(I=O.state,U<0?(y=0,U=-U):(y=1+(U>>4),U<48&&(U&=15)),U&&(U<8||15=N.wsize?(s.arraySet(N.window,U,y-N.wsize,N.wsize,0),N.wnext=0,N.whave=N.wsize):(I<(R=N.wsize-N.wnext)&&(R=I),s.arraySet(N.window,U,y-I,R,N.wnext),(I-=R)?(s.arraySet(N.window,U,y-I,I,0),N.wnext=I,N.whave=N.wsize):(N.wnext+=R,N.wnext===N.wsize&&(N.wnext=0),N.whave>>8&255,y.check=a(y.check,oe,2,0),E=D=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&D)<<8)+(D>>8))%31){O.msg="incorrect header check",y.mode=30;break}if((15&D)!=8){O.msg="unknown compression method",y.mode=30;break}if(E-=4,P=8+(15&(D>>>=4)),y.wbits===0)y.wbits=P;else if(P>y.wbits){O.msg="invalid window size",y.mode=30;break}y.dmax=1<>8&1),512&y.flags&&(oe[0]=255&D,oe[1]=D>>>8&255,y.check=a(y.check,oe,2,0)),E=D=0,y.mode=3;case 3:for(;E<32;){if(L===0)break e;L--,D+=I[N++]<>>8&255,oe[2]=D>>>16&255,oe[3]=D>>>24&255,y.check=a(y.check,oe,4,0)),E=D=0,y.mode=4;case 4:for(;E<16;){if(L===0)break e;L--,D+=I[N++]<>8),512&y.flags&&(oe[0]=255&D,oe[1]=D>>>8&255,y.check=a(y.check,oe,2,0)),E=D=0,y.mode=5;case 5:if(1024&y.flags){for(;E<16;){if(L===0)break e;L--,D+=I[N++]<>>8&255,y.check=a(y.check,oe,2,0)),E=D=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(L<(T=y.length)&&(T=L),T&&(y.head&&(P=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),s.arraySet(y.head.extra,I,N,T,P)),512&y.flags&&(y.check=a(y.check,I,T,N)),L-=T,N+=T,y.length-=T),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(L===0)break e;for(T=0;P=I[N+T++],y.head&&P&&y.length<65536&&(y.head.name+=String.fromCharCode(P)),P&&T>9&1,y.head.done=!0),O.adler=y.check=0,y.mode=12;break;case 10:for(;E<32;){if(L===0)break e;L--,D+=I[N++]<>>=7&E,E-=7&E,y.mode=27;break}for(;E<3;){if(L===0)break e;L--,D+=I[N++]<>>=1)){case 0:y.mode=14;break;case 1:if(M(y),y.mode=20,U!==6)break;D>>>=2,E-=2;break e;case 2:y.mode=17;break;case 3:O.msg="invalid block type",y.mode=30}D>>>=2,E-=2;break;case 14:for(D>>>=7&E,E-=7&E;E<32;){if(L===0)break e;L--,D+=I[N++]<>>16^65535)){O.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&D,E=D=0,y.mode=15,U===6)break e;case 15:y.mode=16;case 16:if(T=y.length){if(L>>=5,E-=5,y.ndist=1+(31&D),D>>>=5,E-=5,y.ncode=4+(15&D),D>>>=4,E-=4,286>>=3,E-=3}for(;y.have<19;)y.lens[ye[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,ue={bits:y.lenbits},fe=A(0,y.lens,0,19,y.lencode,0,y.work,ue),y.lenbits=ue.bits,fe){O.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have>>16&255,$=65535&K,!((de=K>>>24)<=E);){if(L===0)break e;L--,D+=I[N++]<>>=de,E-=de,y.lens[y.have++]=$;else{if($===16){for(q=de+2;E>>=de,E-=de,y.have===0){O.msg="invalid bit length repeat",y.mode=30;break}P=y.lens[y.have-1],T=3+(3&D),D>>>=2,E-=2}else if($===17){for(q=de+3;E>>=de)),D>>>=3,E-=3}else{for(q=de+7;E>>=de)),D>>>=7,E-=7}if(y.have+T>y.nlen+y.ndist){O.msg="invalid bit length repeat",y.mode=30;break}for(;T--;)y.lens[y.have++]=P}}if(y.mode===30)break;if(y.lens[256]===0){O.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,ue={bits:y.lenbits},fe=A(c,y.lens,0,y.nlen,y.lencode,0,y.work,ue),y.lenbits=ue.bits,fe){O.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,ue={bits:y.distbits},fe=A(u,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,ue),y.distbits=ue.bits,fe){O.msg="invalid distances set",y.mode=30;break}if(y.mode=20,U===6)break e;case 20:y.mode=21;case 21:if(6<=L&&258<=G){O.next_out=k,O.avail_out=G,O.next_in=N,O.avail_in=L,y.hold=D,y.bits=E,l(O,re),k=O.next_out,R=O.output,G=O.avail_out,N=O.next_in,I=O.input,L=O.avail_in,D=y.hold,E=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;Ae=(K=y.lencode[D&(1<>>16&255,$=65535&K,!((de=K>>>24)<=E);){if(L===0)break e;L--,D+=I[N++]<>ce)])>>>16&255,$=65535&K,!(ce+(de=K>>>24)<=E);){if(L===0)break e;L--,D+=I[N++]<>>=ce,E-=ce,y.back+=ce}if(D>>>=de,E-=de,y.back+=de,y.length=$,Ae===0){y.mode=26;break}if(32&Ae){y.back=-1,y.mode=12;break}if(64&Ae){O.msg="invalid literal/length code",y.mode=30;break}y.extra=15&Ae,y.mode=22;case 22:if(y.extra){for(q=y.extra;E>>=y.extra,E-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;Ae=(K=y.distcode[D&(1<>>16&255,$=65535&K,!((de=K>>>24)<=E);){if(L===0)break e;L--,D+=I[N++]<>ce)])>>>16&255,$=65535&K,!(ce+(de=K>>>24)<=E);){if(L===0)break e;L--,D+=I[N++]<>>=ce,E-=ce,y.back+=ce}if(D>>>=de,E-=de,y.back+=de,64&Ae){O.msg="invalid distance code",y.mode=30;break}y.offset=$,y.extra=15&Ae,y.mode=24;case 24:if(y.extra){for(q=y.extra;E>>=y.extra,E-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){O.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(G===0)break e;if(T=re-G,y.offset>T){if((T=y.offset-T)>y.whave&&y.sane){O.msg="invalid distance too far back",y.mode=30;break}ee=T>y.wnext?(T-=y.wnext,y.wsize-T):y.wnext-T,T>y.length&&(T=y.length),pe=y.window}else pe=R,ee=k-y.offset,T=y.length;for(GF?(_=ee[pe+g[U]],E[z+g[U]]):(_=96,0),v=1<>k)+(w-=v)]=x<<24|_<<16|M|0,w!==0;);for(v=1<>=1;if(v!==0?(D&=v-1,D+=v):D=0,U++,--re[O]==0){if(O===I)break;O=u[h+g[U]]}if(R>>7)]}function z(K,oe){K.pending_buf[K.pending++]=255&oe,K.pending_buf[K.pending++]=oe>>>8&255}function re(K,oe,ye){K.bi_valid>m-ye?(K.bi_buf|=oe<>m-K.bi_valid,K.bi_valid+=ye-m):(K.bi_buf|=oe<>>=1,ye<<=1,0<--oe;);return ye>>>1}function pe(K,oe,ye){var be,W,H=new Array(g+1),ie=0;for(be=1;be<=g;be++)H[be]=ie=ie+ye[be-1]<<1;for(W=0;W<=oe;W++){var ae=K[2*W+1];ae!==0&&(K[2*W]=ee(H[ae]++,ae))}}function de(K){var oe;for(oe=0;oe>1;1<=ye;ye--)ce(K,H,ye);for(W=me;ye=K.heap[1],K.heap[1]=K.heap[K.heap_len--],ce(K,H,1),be=K.heap[1],K.heap[--K.heap_max]=ye,K.heap[--K.heap_max]=be,H[2*W]=H[2*ye]+H[2*be],K.depth[W]=(K.depth[ye]>=K.depth[be]?K.depth[ye]:K.depth[be])+1,H[2*ye+1]=H[2*be+1]=W,K.heap[1]=W++,ce(K,H,1),2<=K.heap_len;);K.heap[--K.heap_max]=K.heap[1],function(Q,S){var Z,te,le,se,Ue,_e,Te=S.dyn_tree,Pe=S.max_code,ke=S.stat_desc.static_tree,he=S.stat_desc.has_stree,Ee=S.stat_desc.extra_bits,Se=S.stat_desc.extra_base,Re=S.stat_desc.max_length,Je=0;for(se=0;se<=g;se++)Q.bl_count[se]=0;for(Te[2*Q.heap[Q.heap_max]+1]=0,Z=Q.heap_max+1;Z>=7;W>>=1)if(1&J&&ae.dyn_ltree[2*me]!==0)return o;if(ae.dyn_ltree[18]!==0||ae.dyn_ltree[20]!==0||ae.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=K.static_len+3+7>>>3)<=W&&(W=H)):W=H=ye+5,ye+4<=W&&oe!==-1?q(K,oe,ye,be):K.strategy===4||H===W?(re(K,2+(be?1:0),3),ge(K,Y,O)):(re(K,4+(be?1:0),3),function(ae,me,J,Q){var S;for(re(ae,me-257,5),re(ae,J-1,5),re(ae,Q-4,4),S=0;S>>8&255,K.pending_buf[K.d_buf+2*K.last_lit+1]=255&oe,K.pending_buf[K.l_buf+K.last_lit]=255&ye,K.last_lit++,oe===0?K.dyn_ltree[2*ye]++:(K.matches++,oe--,K.dyn_ltree[2*(y[ye]+u+1)]++,K.dyn_dtree[2*E(oe)]++),K.last_lit===K.lit_bufsize-1},i._tr_align=function(K){re(K,2,3),T(K,w,Y),function(oe){oe.bi_valid===16?(z(oe,oe.bi_buf),oe.bi_buf=0,oe.bi_valid=0):8<=oe.bi_valid&&(oe.pending_buf[oe.pending++]=255&oe.bi_buf,oe.bi_buf>>=8,oe.bi_valid-=8)}(K)}},{"../utils/common":41}],53:[function(t,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,r,i){(function(s){(function(o,a){if(!o.setImmediate){var l,A,c,u,h=1,d={},p=!1,f=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(B){process.nextTick(function(){v(B)})}:function(){if(o.postMessage&&!o.importScripts){var B=!0,C=o.onmessage;return o.onmessage=function(){B=!1},o.postMessage("","*"),o.onmessage=C,B}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(B){o.postMessage(u+B,"*")}):o.MessageChannel?((c=new MessageChannel).port1.onmessage=function(B){v(B.data)},function(B){c.port2.postMessage(B)}):f&&"onreadystatechange"in f.createElement("script")?(A=f.documentElement,function(B){var C=f.createElement("script");C.onreadystatechange=function(){v(B),C.onreadystatechange=null,A.removeChild(C),C=null},A.appendChild(C)}):function(B){setTimeout(v,0,B)},g.setImmediate=function(B){typeof B!="function"&&(B=new Function(""+B));for(var C=new Array(arguments.length-1),b=0;b"u"?s===void 0?this:s:self)}).call(this,typeof pa<"u"?pa:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(iH);var Gpe=iH.exports;const Zpe=Zl(Gpe);class ep{constructor(){this.zipContainer={}}addData(e,t,r,i=""){i==""&&(i="_"),this.zipContainer[i]==null&&(this.zipContainer[i]=[]),this.zipContainer[i].push({data:e,name:t,extension:r})}saveZip(e,t=!0){const r=this.zipContainer,i=new Zpe;for(const s in r)if(s=="_")r[s].forEach((o,a)=>{i.file(o.name+"."+o.extension,o.data,{base64:!0})});else{const o=i.folder(s);r[s].forEach((a,l)=>{const A=a.extension!="txt";o.file(a.name+"."+a.extension,a.data,{base64:A})})}i.generateAsync({type:"blob"}).then(s=>{this._saveZipFile(s,e+".zip")}),t&&(this.zipContainer={})}_saveZipFile(e,t){const r=new Blob([e],{type:"application/zip"});if(typeof window.navigator.msSaveBlob<"u")window.navigator.msSaveBlob(r,t);else{const i=document.createElement("a");typeof i.download=="string"?(document.body.appendChild(i),i.download=t,i.href=URL.createObjectURL(r),i.click(),document.body.removeChild(i)):window.open(e,"_blank").document.write(""+t+"")}}}new j;class Jpe{constructor(e){this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager,this.temptime=0}async createLoraData(e,t=null,r="",i){const s=e.manifest,o=e.name?"loraData/"+e.name:"loraData",a=await this._fetchManifest(s),{assetsLocation:l="",animationsDirectory:A="",backgroundGrayscale:c=1,topFrameOffsetPixels:u=64,bottomFrameOffsetPixels:h=64,backgroundDescription:d="",width:p=512,height:f=512,dataCollection:g}=a,m=l+A+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.calculateBoneOffsets(.2);let v=0;const w=this;if(Array.isArray(g)){const B=t??new ep;await(async()=>{if(Array.isArray(g))for(let b=0;b{const G=[];return ht(R).forEach(E=>{G.push({id:E})}),G},k=R==null?v.characterManager.getTraits(F):N();if(k==null){console.log("SKipping Thumbnail Generation for trait group "+F+", its not present in the character manifest.");continue}const L=iQ(x);I?v.screenshotManager.setCameraFrameWithName(I,L):v.screenshotManager.frameShot(_,Y,L,M,O);for(let G=0;G{const[e,t]=Be.useState(null),[r,i]=Be.useState(null),[s,o]=Be.useState(null),[a,l]=Be.useState(null),[A,c]=Be.useState(null),[u,h]=Be.useState(null),[d,p]=Be.useState(null),[f,g]=Be.useState(null),[m,v]=Be.useState(null),[w,B]=Be.useState(null),[C,b]=Be.useState(null),[F,x]=Be.useState(!1);let _=!1,[M,Y]=Be.useState(!1);Be.useEffect(()=>{if(_||M)return;Y(!0),_=!0;const{scene:I,camera:R,controls:N,characterManager:k,sceneElements:L}=Wpe("editor-scene");v(R),g(I),t(k),c(L),h(k.animationManager),p(k.lookAtManager),B(N),i(new Jpe(k)),o(new Hpe(k)),l(new zpe(k))},[]);const O=I=>{I==null&&(I=!F),x(I),f.traverse(R=>{R.isMesh&&R.setDebugMode&&R.setDebugMode(I)})};Be.useEffect(()=>{if(C!=null&&C.defaultAnimations){const I=C.defaultAnimations.map(R=>R.location);u.storeDefaultAnimationPaths(I,"")}},[C]);const U=I=>{I?f.add(A):f.remove(A)},y=I=>{w&&(yE.to(w.target,{x:I.targetX??0,y:I.targetY??0,z:I.targetZ??0,duration:1}),yE.fromTo(w,{maxDistance:w.getDistance(),minDistance:w.getDistance(),minPolarAngle:w.getPolarAngle(),maxPolarAngle:w.getPolarAngle(),minAzimuthAngle:w.getAzimuthalAngle(),maxAzimuthAngle:w.getAzimuthalAngle()},{maxDistance:I.distance,minDistance:I.distance,minPolarAngle:Math.PI/2-.11,maxPolarAngle:Math.PI/2-.11,minAzimuthAngle:-.78,maxAzimuthAngle:-.78,duration:1}).then(()=>{w.minPolarAngle=0,w.maxPolarAngle=3.1415,w.minDistance=.5,w.maxDistance=10,w.minAzimuthAngle=1/0,w.maxAzimuthAngle=1/0}))};return V.jsx(lr.Provider,{value:{manifest:C,setManifest:b,scene:f,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:U,debugMode:F,toggleDebugMode:O,animationManager:u,lookAtManager:d,camera:m,moveCamera:y,controls:w,sceneElements:A},children:n.children})},Xpe={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},ot={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",BIO:"BIO",SAVE:"SAVE",MINT:"MINT",CHAT:"CHAT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},Ci=X.createContext(),jpe=n=>{const[e,t]=X.useState(Xpe.NORMAL),[r,i]=X.useState(ot.LANDING),[s,o]=X.useState(!1),[a,l]=X.useState(!1);return V.jsx(Ci.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},Kpe="modulepreload",$pe=function(n){return"/CharacterStudio/"+n},ZD={},qpe=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=$pe(s),s in ZD)return;ZD[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const u=i[c];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const A=document.createElement("link");if(A.rel=o?"stylesheet":Kpe,o||(A.as="script",A.crossOrigin=""),A.href=s,document.head.appendChild(A),o)return new Promise((c,u)=>{A.addEventListener("load",c),A.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function qB(){return qB=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function tge(n){Be.useEffect(n,[])}function nge(n,e){e===void 0&&(e={});var t=e,r=t.volume,i=r===void 0?1:r,s=t.playbackRate,o=s===void 0?1:s,a=t.soundEnabled,l=a===void 0?!0:a,A=t.interrupt,c=A===void 0?!1:A,u=t.onload,h=ege(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),d=X.useRef(null),p=X.useRef(!1),f=X.useState(null),g=f[0],m=f[1],v=X.useState(null),w=v[0],B=v[1],C=function(){typeof u=="function"&&u.call(this),p.current&&m(this.duration()*1e3),B(this)};tge(function(){return qpe(()=>import("./howler-1ad5bdb0.js").then(M=>M.h),[]).then(function(M){if(!p.current){var Y;d.current=(Y=M.Howl)!==null&&Y!==void 0?Y:M.default.Howl,p.current=!0,new d.current(qB({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:C},h))}}),function(){p.current=!1}}),X.useEffect(function(){d.current&&w&&B(new d.current(qB({src:Array.isArray(n)?n:[n],volume:i,onload:C},h)))},[JSON.stringify(n)]),X.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var b=X.useCallback(function(M){typeof M>"u"&&(M={}),!(!w||!l&&!M.forceSoundEnabled)&&(c&&w.stop(),M.playbackRate&&w.rate(M.playbackRate),w.play(M.id))},[w,l,c]),F=X.useCallback(function(M){w&&w.stop(M)},[w]),x=X.useCallback(function(M){w&&w.pause(M)},[w]),_=[b,{sound:w,stop:F,pause:x,duration:g}];return _}const rge=[{name:"background/cc_bgm.wav",offset:0,duration:123458.58333333334},{name:"background/cc_bgm_balanced.wav",offset:123458.58333333334,duration:123458.60416666666},{name:"effect/character-load.wav",offset:246917.1875,duration:3030},{name:"effect/class-select.wav",offset:249947.1875,duration:2780},{name:"effect/switchingItem.wav",offset:252727.1875,duration:623.75},{name:"ui/back-next-button.wav",offset:253350.9375,duration:155.02083333333334},{name:"ui/class-mouse-over.wav",offset:253505.95833333334,duration:217.52083333333334},{name:"ui/class_click.wav",offset:253723.4791666667,duration:3123.75},{name:"ui/class_pass.wav",offset:256847.2291666667,duration:155},{name:"ui/option_click.wav",offset:257002.2291666667,duration:155.02083333333334},{name:"ui/randomize-button.wav",offset:257157.25000000003,duration:342.5208333333333},{name:"ui/section_click.wav",offset:257499.77083333337,duration:155}],ige="/CharacterStudio/assets/sounds-3322d50e.mp3",bs=Be.createContext(),sge=n=>{const e=i=>rge.find(s=>i.test(s.name)),[t]=nge(ige,{sprite:{switchItem:[e(/switchingItem/).offset,e(/switchingItem/).duration],classSelect:[e(/class-select/).offset,e(/class-select/).duration],characterLoad:[e(/character-load/).offset,e(/character-load/).duration],randomizeButton:[e(/randomize-button/).offset,e(/randomize-button/).duration],classMouseOver:[e(/class-mouse-over/).offset,e(/class-mouse-over/).duration],backNextButton:[e(/back-next-button/).offset,e(/back-next-button/).duration]}}),r=(i,s=0)=>{s===0?t({id:i}):setTimeout(()=>{t({id:i})},s)};return V.jsx(bs.Provider,{value:{playSound:r},children:n.children})};function $s(n){"@babel/helpers - typeof";return $s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$s(n)}function lo(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function oge(n,e){if($s(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if($s(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function sH(n){var e=oge(n,"string");return $s(e)=="symbol"?e:e+""}function JD(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.init(e,t)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||Age,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),i=0;i1?r-1:0),s=1;s-1?a.replace(/###/g,"."):a}function i(){return!n||typeof n=="string"}for(var s=typeof e!="string"?[].concat(e):e.split(".");s.length>1;){if(i())return{};var o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function jD(n,e,t){var r=AQ(n,e,Object),i=r.obj,s=r.k;i[s]=t}function dge(n,e,t,r){var i=AQ(n,e,Object),s=i.obj,o=i.k;s[o]=s[o]||[],r&&(s[o]=s[o].concat(t)),r||s[o].push(t)}function eC(n,e){var t=AQ(n,e),r=t.obj,i=t.k;if(r)return r[i]}function KD(n,e,t){var r=eC(n,t);return r!==void 0?r:eC(e,t)}function AH(n,e,t){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):AH(n[r],e[r],t):n[r]=e[r]);return n}function Ud(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var hge={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function fge(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return hge[e]}):n}var yb=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,pge=[" ",",","?","!",";"];function gge(n,e,t){e=e||"",t=t||"";var r=pge.filter(function(a){return e.indexOf(a)<0&&t.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),s=!i.test(n);if(!s){var o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function $D(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Cy(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function cH(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(n){if(n[e])return n[e];for(var r=e.split(t),i=n,s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var A=r.slice(s+o).join(t);return A?cH(l,A,t):void 0}i=i[r[s]]}return i}}var yge=function(n){vb(t,n);var e=mge(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return lo(this,t),i=e.call(this),yb&&cc.call(ec(i)),i.data=r||{},i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return Ao(t,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,A=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,c=[i,s];o&&typeof o!="string"&&(c=c.concat(o)),o&&typeof o=="string"&&(c=c.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(c=i.split("."));var u=eC(this.data,c);return u||!A||typeof o!="string"?u:cH(this.data&&this.data[i]&&this.data[i][s],o,l)}},{key:"addResource",value:function(i,s,o,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},A=this.options.keySeparator;A===void 0&&(A=".");var c=[i,s];o&&(c=c.concat(A?o.split(A):o)),i.indexOf(".")>-1&&(c=i.split("."),a=s,s=c[1]),this.addNamespaces(s),jD(this.data,c,a),l.silent||this.emit("added",i,s,o,a)}},{key:"addResources",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in o)(typeof o[l]=="string"||Object.prototype.toString.apply(o[l])==="[object Array]")&&this.addResource(i,s,l,o[l],{silent:!0});a.silent||this.emit("added",i,s,o)}},{key:"addResourceBundle",value:function(i,s,o,a,l){var A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},c=[i,s];i.indexOf(".")>-1&&(c=i.split("."),a=o,o=s,s=c[1]),this.addNamespaces(s);var u=eC(this.data,c)||{};a?AH(u,o,l):u=Cy(Cy({},u),o),jD(this.data,c,u),A.silent||this.emit("added",i,s,o)}},{key:"removeResourceBundle",value:function(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}},{key:"hasResourceBundle",value:function(i,s){return this.getResource(i,s)!==void 0}},{key:"getResourceBundle",value:function(i,s){return s||(s=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Cy(Cy({},{}),this.getResource(i,s)):this.getResource(i,s)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var s=this.getDataByLanguage(i),o=s&&Object.keys(s)||[];return!!o.find(function(a){return s[a]&&Object.keys(s[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(cc),uH={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var o=this;return e.forEach(function(a){o.processors[a]&&(t=o.processors[a].process(t,r,i,s))}),t}};function qD(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function oi(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var eL={},tL=function(n){vb(t,n);var e=wge(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return lo(this,t),i=e.call(this),yb&&cc.call(ec(i)),uge(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,ec(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ga.create("translator"),i}return Ao(t,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var o=this.resolve(i,s);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(i,s){var o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,l=s.ns||this.options.defaultNS||[],A=o&&i.indexOf(o)>-1,c=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!gge(i,o,a);if(A&&!c){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var h=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(h[0])>-1)&&(l=h.shift()),i=h.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if($s(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,A=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,c=this.extractFromKey(i[i.length-1],s),u=c.key,h=c.namespaces,d=h[h.length-1],p=s.lng||this.language,f=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(f){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(d).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:p,usedNS:d}:"".concat(d).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:p,usedNS:d}:u}var m=this.resolve(i,s),v=m&&m.res,w=m&&m.usedKey||u,B=m&&m.exactUsedKey||u,C=Object.prototype.toString.apply(v),b=["[object Number]","[object Function]","[object RegExp]"],F=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,_=typeof v!="string"&&typeof v!="boolean"&&typeof v!="number";if(x&&v&&_&&b.indexOf(C)<0&&!(typeof F=="string"&&C==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,v,oi(oi({},s),{},{ns:h})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(m.res=M,m):M}if(A){var Y=C==="[object Array]",O=Y?[]:{},U=Y?B:w;for(var y in v)if(Object.prototype.hasOwnProperty.call(v,y)){var I="".concat(U).concat(A).concat(y);O[y]=this.translate(I,oi(oi({},s),{joinArrays:!1,ns:h})),O[y]===I&&(O[y]=v[y])}v=O}}else if(x&&typeof F=="string"&&C==="[object Array]")v=v.join(F),v&&(v=this.extendTranslation(v,i,s,o));else{var R=!1,N=!1,k=s.count!==void 0&&typeof s.count!="string",L=t.hasDefaultValue(s),G=k?this.pluralResolver.getSuffix(p,s.count,s):"",D=s["defaultValue".concat(G)]||s.defaultValue;!this.isValidLookup(v)&&L&&(R=!0,v=D),this.isValidLookup(v)||(N=!0,v=u);var E=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,z=E&&N?void 0:v,re=L&&D!==v&&this.options.updateMissing;if(N||R||re){if(this.logger.log(re?"updateKey":"missingKey",p,d,u,re?D:v),A){var T=this.resolve(u,oi(oi({},s),{},{keySeparator:!1}));T&&T.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var ee=[],pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(var de=0;de1&&arguments[1]!==void 0?arguments[1]:{},a,l,A,c,u;return typeof i=="string"&&(i=[i]),i.forEach(function(h){if(!s.isValidLookup(a)){var d=s.extractFromKey(h,o),p=d.key;l=p;var f=d.namespaces;s.options.fallbackNS&&(f=f.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",m=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),v=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",w=o.lngs?o.lngs:s.languageUtils.toResolveHierarchy(o.lng||s.language,o.fallbackLng);f.forEach(function(B){s.isValidLookup(a)||(u=B,!eL["".concat(w[0],"-").concat(B)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(eL["".concat(w[0],"-").concat(B)]=!0,s.logger.warn('key "'.concat(l,'" for languages "').concat(w.join(", "),`" won't get resolved as namespace "`).concat(u,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(function(C){if(!s.isValidLookup(a)){c=C;var b=[p];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(b,p,C,B,o);else{var F;g&&(F=s.pluralResolver.getSuffix(C,o.count,o));var x="".concat(s.options.pluralSeparator,"zero");if(g&&(b.push(p+F),m&&b.push(p+x)),v){var _="".concat(p).concat(s.options.contextSeparator).concat(o.context);b.push(_),g&&(b.push(_+F),m&&b.push(_+x))}}for(var M;M=b.pop();)s.isValidLookup(a)||(A=M,a=s.getResource(C,B,M,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:A,usedLng:c,usedNS:u}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,s,o,a):this.resourceStore.getResource(i,s,o,a)}}],[{key:"hasDefaultValue",value:function(i){var s="defaultValue";for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}]),t}(cc);function EI(n){return n.charAt(0).toUpperCase()+n.slice(1)}var nL=function(){function n(e){lo(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ga.create("languageUtils")}return Ao(n,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var r=t.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map(function(s){return s.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=EI(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=EI(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=EI(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var r=this;if(!t)return null;var i;return t.forEach(function(s){if(!i){var o=r.formatLanguageCode(s);(!r.options.supportedLngs||r.isSupportedCode(o))&&(i=o)}}),!i&&this.options.supportedLngs&&t.forEach(function(s){if(!i){var o=r.getLanguagePartFromCode(s);if(r.isSupportedCode(o))return i=o;i=r.options.supportedLngs.find(function(a){if(a.indexOf(o)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];var i=t[r];return i||(i=t[this.getScriptPartFromCode(r)]),i||(i=t[this.formatLanguageCode(r)]),i||(i=t[this.getLanguagePartFromCode(r)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,r){var i=this,s=this.getFallbackCodes(r||this.options.fallbackLng||[],t),o=[],a=function(A){A&&(i.isSupportedCode(A)?o.push(A):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(A)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),s.forEach(function(l){o.indexOf(l)<0&&a(i.formatLanguageCode(l))}),o}}]),n}(),Cge=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],bge={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}},xge=["v1","v2","v3"],rL={zero:0,one:1,two:2,few:3,many:4,other:5};function Ige(){var n={};return Cge.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:bge[e.fc]}})}),n}var Fge=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.languageUtils=e,this.options=t,this.logger=ga.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Ige()}return Ao(n,[{key:"addRule",value:function(t,r){this.rules[t]=r}},{key:"getRule",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(t,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,i).map(function(s){return"".concat(r).concat(s)})}},{key:"getSuffixes",value:function(t){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort(function(o,a){return rL[o]-rL[a]}).map(function(o){return"".concat(r.options.prepend).concat(o)}):s.numbers.map(function(o){return r.getSuffix(t,o,i)}):[]}},{key:"getSuffix",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(r)):this.getSuffixRetroCompatible(s,r):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,r){var i=this,s=t.noAbs?t.plurals(r):t.plurals(Math.abs(r)),o=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var a=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!xge.includes(this.options.compatibilityJSON)}}]),n}();function iL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wo(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};lo(this,n),this.logger=ga.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Ao(n,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var r=t.interpolation;this.escape=r.escape!==void 0?r.escape:fge,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Ud(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Ud(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?Ud(r.nestingPrefix):r.nestingPrefixEscaped||Ud("$t("),this.nestingSuffix=r.nestingSuffix?Ud(r.nestingSuffix):r.nestingSuffixEscaped||Ud(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,r,i,s){var o=this,a,l,A,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var h=function(m){if(m.indexOf(o.formatSeparator)<0){var v=KD(r,c,m);return o.alwaysFormat?o.format(v,void 0,i,wo(wo(wo({},s),r),{},{interpolationkey:m})):v}var w=m.split(o.formatSeparator),B=w.shift().trim(),C=w.join(o.formatSeparator).trim();return o.format(KD(r,c,B),C,i,wo(wo(wo({},s),r),{},{interpolationkey:B}))};this.resetRegExp();var d=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,p=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,f=[{regex:this.regexpUnescape,safeValue:function(m){return u(m)}},{regex:this.regexp,safeValue:function(m){return o.escapeValue?u(o.escape(m)):u(m)}}];return f.forEach(function(g){for(A=0;a=g.regex.exec(t);){var m=a[1].trim();if(l=h(m),l===void 0)if(typeof d=="function"){var v=d(t,a,s);l=typeof v=="string"?v:""}else if(s&&Object.prototype.hasOwnProperty.call(s,m))l="";else if(p){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(m," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=XD(l));var w=g.safeValue(l);if(t=t.replace(a[0],w),p?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,A++,A>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,r){var i=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,a,l;function A(d,p){var f=this.nestingOptionsSeparator;if(d.indexOf(f)<0)return d;var g=d.split(new RegExp("".concat(f,"[ ]*{"))),m="{".concat(g[1]);d=g[0],m=this.interpolate(m,l);var v=m.match(/'/g),w=m.match(/"/g);(v&&v.length%2===0&&!w||w.length%2!==0)&&(m=m.replace(/'/g,'"'));try{l=JSON.parse(m),p&&(l=wo(wo({},p),l))}catch(B){return this.logger.warn("failed parsing options string in nesting for key ".concat(d),B),"".concat(d).concat(f).concat(m)}return delete l.defaultValue,d}for(;o=this.nestingRegexp.exec(t);){var c=[];l=wo({},s),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var h=o[1].split(this.formatSeparator).map(function(d){return d.trim()});o[1]=h.shift(),c=h,u=!0}if(a=r(A.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=XD(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=c.reduce(function(d,p){return i.format(d,p,s.lng,wo(wo({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function sL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function rl(n){for(var e=1;e-1){var r=n.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)t.currency||(t.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)t.range||(t.range=i.trim());else{var s=i.split(";");s.forEach(function(o){if(o){var a=o.split(":"),l=lge(a),A=l[0],c=l.slice(1),u=c.join(":").trim().replace(/^'+|'+$/g,"");t[A.trim()]||(t[A.trim()]=u),u==="false"&&(t[A.trim()]=!1),u==="true"&&(t[A.trim()]=!0),isNaN(u)||(t[A.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function Qd(n){var e={};return function(r,i,s){var o=i+JSON.stringify(s),a=e[o];return a||(a=n(i,s),e[o]=a),a(r)}}var Sge=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lo(this,n),this.logger=ga.create("formatter"),this.options=e,this.formats={number:Qd(function(t,r){var i=new Intl.NumberFormat(t,rl({},r));return function(s){return i.format(s)}}),currency:Qd(function(t,r){var i=new Intl.NumberFormat(t,rl(rl({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Qd(function(t,r){var i=new Intl.DateTimeFormat(t,rl({},r));return function(s){return i.format(s)}}),relativetime:Qd(function(t,r){var i=new Intl.RelativeTimeFormat(t,rl({},r));return function(s){return i.format(s,r.range||"day")}}),list:Qd(function(t,r){var i=new Intl.ListFormat(t,rl({},r));return function(s){return i.format(s)}})},this.init(e)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(t,r){this.formats[t.toLowerCase().trim()]=r}},{key:"addCached",value:function(t,r){this.formats[t.toLowerCase().trim()]=Qd(r)}},{key:"format",value:function(t,r,i){var s=this,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.split(this.formatSeparator),l=a.reduce(function(A,c){var u=_ge(c),h=u.formatName,d=u.formatOptions;if(s.formats[h]){var p=A;try{var f=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=f.locale||f.lng||o.locale||o.lng||i;p=s.formats[h](A,g,rl(rl(rl({},d),o),f))}catch(m){s.logger.warn(m)}return p}else s.logger.warn("there was no format function for ".concat(h));return A},t);return l}}]),n}();function oL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aL(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rge(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var Mge=function(n){vb(t,n);var e=Uge(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return lo(this,t),o=e.call(this),yb&&cc.call(ec(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=ga.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(s,a.backend,a),o}return Ao(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,A={},c={},u={},h={};return i.forEach(function(d){var p=!0;s.forEach(function(f){var g="".concat(d,"|").concat(f);!o.reload&&l.store.hasResourceBundle(d,f)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?c[g]===void 0&&(c[g]=!0):(l.state[g]=1,p=!1,c[g]===void 0&&(c[g]=!0),A[g]===void 0&&(A[g]=!0),h[f]===void 0&&(h[f]=!0)))}),p||(u[d]=!0)}),(Object.keys(A).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(A),pending:Object.keys(c),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(h)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],A=a[1];s&&this.emit("failedLoading",l,A,s),o&&this.store.addResourceBundle(l,A,o),this.state[i]=s?-1:2;var c={};this.queue.forEach(function(u){dge(u.loaded,[l],A),Rge(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(h){c[h]||(c[h]={});var d=u.loaded[h];d.length&&d.forEach(function(p){c[h][p]===void 0&&(c[h][p]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(function(u){return!u.done})}},{key:"read",value:function(i,s,o){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,A=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!i.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:A,callback:c});return}this.readingCalls++;var u=function(f,g){if(a.readingCalls--,a.waitingReads.length>0){var m=a.waitingReads.shift();a.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(f&&g&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof s=="string"&&(s=[s]);var A=this.queueLoad(i,s,a,l);if(!A.toLoad.length)return A.pending.length||l(),null;A.toLoad.forEach(function(c){o.loadOne(c)})}},{key:"load",value:function(i,s,o){this.prepareLoading(i,s,{},o)}},{key:"reload",value:function(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}},{key:"loadOne",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],A=a[1];this.read(l,A,"read",void 0,void 0,function(c,u){c&&s.logger.warn("".concat(o,"loading namespace ").concat(A," for language ").concat(l," failed"),c),!c&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(A," for language ").concat(l),u),s.loaded(i,c,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(s)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){var u=aL(aL({},A),{},{isUpdate:l}),h=this.backend.create.bind(this.backend);if(h.length<6)try{var d;h.length===5?d=h(i,s,o,a,u):d=h(i,s,o,a),d&&typeof d.then=="function"?d.then(function(p){return c(null,p)}).catch(c):c(null,d)}catch(p){c(p)}else h(i,s,o,a,c,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(cc);function lL(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if($s(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),$s(e[2])==="object"||$s(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function AL(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function cL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jo(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function by(){}function kge(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var tC=function(n){vb(t,n);var e=Tge(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(lo(this,t),r=e.call(this),yb&&cc.call(ec(r)),r.options=AL(i),r.services={},r.logger=ga,r.modules={external:[]},kge(ec(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),b0(r,ec(r));setTimeout(function(){r.init(i,s)},0)}return r}return Ao(t,[{key:"init",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof s=="function"&&(o=s,s={}),!s.defaultNS&&s.defaultNS!==!1&&s.ns&&(typeof s.ns=="string"?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));var a=lL();this.options=jo(jo(jo({},a),this.options),AL(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=jo(jo({},a.interpolation),this.options.interpolation)),s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);function l(m){return m?typeof m=="function"?new m:m:null}if(!this.options.isClone){this.modules.logger?ga.init(l(this.modules.logger),this.options):ga.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=Sge);var c=new nL(this.options);this.store=new yge(this.options.resources,this.options);var u=this.services;u.logger=ga,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new Fge(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),A&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(A),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Ege(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Mge(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(m){for(var v=arguments.length,w=new Array(v>1?v-1:0),B=1;B1?v-1:0),B=1;B0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var d=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];d.forEach(function(m){i[m]=function(){var v;return(v=i.store)[m].apply(v,arguments)}});var p=["addResource","addResources","addResourceBundle","removeResourceBundle"];p.forEach(function(m){i[m]=function(){var v;return(v=i.store)[m].apply(v,arguments),i}});var f=jp(),g=function(){var v=function(B,C){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),f.resolve(C),o(B,C)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return v(null,i.t.bind(i));i.changeLanguage(i.options.lng,v)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),f}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:by,a=o,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var A=[],c=function(d){if(d){var p=s.services.languageUtils.toResolveHierarchy(d);p.forEach(function(f){A.indexOf(f)<0&&A.push(f)})}};if(l)c(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(h){return c(h)})}this.options.preload&&this.options.preload.forEach(function(h){return c(h)}),this.services.backendConnector.load(A,this.options.ns,function(h){!h&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(h)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=jp();return i||(i=this.languages),s||(s=this.options.ns),o||(o=by),this.services.backendConnector.reload(i,s,function(l){a.resolve(),o(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&uH.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var s=0;s-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}},{key:"changeLanguage",value:function(i,s){var o=this;this.isLanguageChangingTo=i;var a=jp();this.emit("languageChanging",i);var l=function(h){o.language=h,o.languages=o.services.languageUtils.toResolveHierarchy(h),o.resolvedLanguage=void 0,o.setResolvedLanguage(h)},A=function(h,d){d?(l(d),o.translator.changeLanguage(d),o.isLanguageChangingTo=void 0,o.emit("languageChanged",d),o.logger.log("languageChanged",d)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(h,function(){return o.t.apply(o,arguments)})},c=function(h){!i&&!h&&o.services.languageDetector&&(h=[]);var d=typeof h=="string"?h:o.services.languageUtils.getBestMatchFromCodes(h);d&&(o.language||l(d),o.translator.language||o.translator.changeLanguage(d),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(d)),o.loadResources(d,function(p){A(p,d)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function A(c,u){var h;if($s(u)!=="object"){for(var d=arguments.length,p=new Array(d>2?d-2:0),f=2;f1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,A=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var c=function(d,p){var f=s.services.backendConnector.state["".concat(d,"|").concat(p)];return f===-1||f===2};if(o.precheck){var u=o.precheck(this,c);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(a,i)&&(!l||c(A,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=jp();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){o.options.ns.indexOf(l)<0&&o.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),s&&s(l)}),a):(s&&s(),Promise.resolve())}},{key:"loadLanguages",value:function(i,s){var o=jp();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(A){return a.indexOf(A)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(A){o.resolve(),s&&s(A)}),o):(s&&s(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new nL(lL());return s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:by,a=jo(jo(jo({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var A=["store","services","language"];return A.forEach(function(c){l[c]=i[c]}),l.services=jo({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new tL(l.services,l.options),l.translator.on("*",function(c){for(var u=arguments.length,h=new Array(u>1?u-1:0),d=1;d0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new tC(n,e)});var ii=tC.createInstance();ii.createInstance=tC.createInstance;ii.createInstance;ii.dir;ii.init;ii.loadResources;ii.reloadResources;ii.use;ii.changeLanguage;ii.getFixedT;ii.t;ii.exists;ii.setDefaultNamespace;ii.hasLoadedNamespace;ii.loadNamespaces;ii.loadLanguages;function Dge(){if(console&&console.warn){for(var n,e=arguments.length,t=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var o=function(l,A){var c=e.services.backendConnector.state["".concat(l,"|").concat(A)];return c===-1||c===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,n)?!1:!!(e.hasResourceBundle(r,n)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,n)&&(!i||o(s,n)))}function Vge(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return B_("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):Lge(n,e,t)}var Pge=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Oge={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Wge=function(e){return Oge[e]},Gge=function(e){return e.replace(Pge,Wge)};function hL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function fL(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};C_=fL(fL({},C_),n)}function Jge(){return C_}var dH;function Hge(n){dH=n}function zge(){return dH}var Yge={type:"3rdParty",init:function(e){Zge(e.options.react),Hge(e)}},Xge=Be.createContext(),jge=function(){function n(){lo(this,n),this.usedNamespaces={}}return Ao(n,[{key:"addUsedNamespaces",value:function(t){var r=this;t.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),n}();function Kge(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,A=!1;try{if(s=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(c){A=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(A)throw i}}return a}}function $ge(n,e){return oH(n)||Kge(n,e)||aH(n,e)||lH()}function pL(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _I(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=Be.useContext(Xge)||{},i=r.i18n,s=r.defaultNS,o=t||i||zge();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new jge),!o){B_("You will need to pass in an i18next instance by using initReactI18next");var a=function(_,M){return typeof M=="string"?M:M&&$s(M)==="object"&&typeof M.defaultValue=="string"?M.defaultValue:Array.isArray(_)?_[_.length-1]:_},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&B_("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=_I(_I(_I({},Jge()),o.options.react),e),c=A.useSuspense,u=A.keyPrefix,h=n||s||o.options&&o.options.defaultNS;h=typeof h=="string"?[h]:h||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(h);var d=(o.isInitialized||o.initializedStoreOnce)&&h.every(function(x){return Vge(x,o,A)});function p(){return o.getFixedT(null,A.nsMode==="fallback"?h:h[0],u)}var f=Be.useState(p),g=$ge(f,2),m=g[0],v=g[1],w=h.join(),B=qge(w),C=Be.useRef(!0);Be.useEffect(function(){var x=A.bindI18n,_=A.bindI18nStore;C.current=!0,!d&&!c&&dL(o,h,function(){C.current&&v(p)}),d&&B&&B!==w&&C.current&&v(p);function M(){C.current&&v(p)}return x&&o&&o.on(x,M),_&&o&&o.store.on(_,M),function(){C.current=!1,x&&o&&x.split(" ").forEach(function(Y){return o.off(Y,M)}),_&&o&&_.split(" ").forEach(function(Y){return o.store.off(Y,M)})}},[o,w]);var b=Be.useRef(!0);Be.useEffect(function(){C.current&&!b.current&&v(p),b.current=!1},[o,u]);var F=[m,o,d];if(F.t=m,F.i18n=o,F.ready=d,d||!d&&!c)return F;throw new Promise(function(x){dL(o,h,function(){x()})})}var hH=[],tme=hH.forEach,nme=hH.slice;function rme(n){return tme.call(nme.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var gL=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,ime=function(e,t,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(t),o="".concat(e,"=").concat(s);if(i.maxAge>0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!gL.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!gL.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},mL={create:function(e,t,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=ime(e,encodeURIComponent(t),s)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o0){var l=s[o].substring(0,a);l===e.lookupQuerystring&&(t=s[o].substring(a+1))}}}return t}},Kp=null,vL=function(){if(Kp!==null)return Kp;try{Kp=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Kp=!1}return Kp},ame={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&vL()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&vL()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},$p=null,yL=function(){if($p!==null)return $p;try{$p=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{$p=!1}return $p},lme={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&yL()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&yL()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Ame={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},cme={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},ume={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},dme={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[t]}};function hme(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var fH=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=rme(r,this.options||{},hme()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(sme),this.addDetector(ome),this.addDetector(ame),this.addDetector(lme),this.addDetector(Ame),this.addDetector(cme),this.addDetector(ume),this.addDetector(dme)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var i=[];return t.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(t,i.options)}))}}]),n}();fH.type="languageDetector";const fme={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",createBio:"Create Bio",saveCharacter:"Save Your Character",chat:"Chat With Your Character"},classes:{beastPainter:{name:"Beast Painter",description:"Paints beasts"},engineer:{name:"Engineer",description:"Builds things"},dropHunter:{name:"Drop Hunter",description:"Hunts drops"},theDegen:{name:"The Degen",description:"Degens"},neuralHacker:{name:"Neural Hacker",description:"Hacks neural networks"},liskWitch:{name:"Lisk Witch",description:"Witches lisk"},bruiser:{name:"Bruiser",description:"Bruises things"}},callToAction:{next:"Next",back:"Back",randomize:"Randomize",chat:"Chat",send:"Send"},editor:{title:"Appearance",head:"Head",body:"Body",eyes:"Eyes",outer:"Outer",chest:"Chest",legs:"Legs",feet:"Feet",accessories:"Accessories"},labels:{name:"Name",voice:"Voice",favoriteColor:"Favorite Color",preferredGreeting:"Preferred Greeting",bio:"Bio",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},pme={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",createBio:"Создать Биографию",saveCharacter:"Сохранить Персонажа",chat:"Общаться Со Своим Персонажем"},classes:{beastPainter:{name:"Анималист",description:"Рисует зверей"},engineer:{name:"Инженер",description:"Строит вещи"},dropHunter:{name:"Охотник за дропами",description:"Охотится на дропы"},theDegen:{name:"Деген",description:"Дегены"},neuralHacker:{name:"Нейронный Хакер",description:"Взламывает нейр. сети"},liskWitch:{name:"Лиск Ведьма",description:"Лиск Ведьмы"},bruiser:{name:"Громила",description:"Громит вещи"}},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",chat:"Чат",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",bio:"Биография",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},gme={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",createBio:"创建简介",saveCharacter:"保存角色",chat:"与你的角色聊天"},classes:{beastPainter:{name:"野兽画家",description:"画野兽"},engineer:{name:"工程师",description:"建造物品"},dropHunter:{name:"投放猎手",description:"猎取投放品"},theDegen:{name:"豪赌家",description:"资深赌徒"},neuralHacker:{name:"神经黑客",description:"侵入神经网络"},liskWitch:{name:"Lisk 巫师",description:"施法于 Lisk"},bruiser:{name:"碾压者",description:"碾碎一切"}},callToAction:{next:"下一步",back:"返回",randomize:"随机",chat:"聊天",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",bio:"简介",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},mme={en:fme,ru:pme,zh:gme};ii.use(fH).use(Yge).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:mme});const xs=Be.createContext(),vme=n=>{const{t:e}=eme();return V.jsx(xs.Provider,{value:{t:e},children:n.children})},yme=` uniform vec3 cameraDir; uniform vec3 eye; @@ -4610,7 +4610,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var r=[],i=0;it.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function sn(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:A,onSubmit:c,minWidth:u,disabled:h}=n,d=Be.useRef(null);return Be.useEffect(()=>{t&&r0e(t).then(p=>{d.current&&(d.current.innerHTML="",p&&(p.classList.add(Mn.icon),d.current.append(p)))})},[t]),o&&o==="login"?L.jsxs("div",{className:jh(r,Mn.iconButtonWrap,s&&s==="dark"?Mn.dark:Mn.light,A&&Mn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[L.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Mn.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[L.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Mn.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),L.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Mn.innerBackgroundColor})]}),L.jsx("span",{ref:d,className:Mn.iconWrap})]}):o&&o==="icon"?L.jsxs("div",{className:jh(r,Mn.iconButtonWrap,s&&s==="dark"?Mn.dark:Mn.light,A&&Mn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[L.jsxs("svg",{className:Mn.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[L.jsx("path",{d:"M5 2H2.85562L3.00485 4.13918L6.7903 58.4048L6.9201 60.2656H8.78545H62.6772H64.6178L64.6763 58.3259L66.3135 4.06031L66.3756 2H64.3144H5Z",fill:"#efefef",className:Mn.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),L.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Mn.innerBackgroundColor})]}),L.jsx("span",{ref:d,className:Mn.iconWrap})]}):L.jsx("button",{className:jh(r,Mn.buttonWrap,s&&s==="dark"?Mn.dark:Mn.light),onClick:i,onMouseEnter:l,onSubmit:c,type:o,disabled:h,style:{minWidth:u?u+"px":""},children:L.jsxs("div",{className:Mn.innerWrap,style:{fontSize:e},children:[t&&L.jsx("span",{ref:d,className:Mn.buttonIconWrap,style:{height:e,width:e,opacity:h?"0.4":"1"}}),a&&a]})})}function i0e(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?L.jsx("div",{className:xy.container,children:L.jsxs("div",{className:xy.messageWindow,children:[L.jsx("div",{className:xy.messageTitle,children:t}),L.jsxs("div",{className:xy.buttonContainer,children:[e&&L.jsx(sn,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),L.jsx(sn,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):L.jsx("div",{})}const s0e="/CharacterStudio/assets/anata-a574c58f.png",o0e="_backgroundImg_iv22q_1",a0e="_darkBackground_iv22q_16",l0e="_Background_iv22q_29",A0e="_webamark_iv22q_37",c0e="_logo_iv22q_45",Rd={backgroundImg:o0e,darkBackground:a0e,Background:l0e,webamark:A0e,logo:c0e};function u0e(){const{debugMode:n}=X.useContext(lr);return L.jsxs("div",{className:n?Rd.darkBackground:Rd.backgroundImg,children:[L.jsx("div",{className:Rd.backgroundBlur}),L.jsx("div",{className:Rd.Background,children:L.jsx("div",{className:Rd.webamark,children:L.jsx("img",{src:s0e,className:Rd.logo})})})]})}const d0e="_chatContainer_1659d_1",h0e="_scrollContainer_1659d_16",f0e="_topLine_1659d_26",p0e="_bottomLine_1659d_54",g0e="_buttonContainer_1659d_82",m0e="_buttonLeft_1659d_91",v0e="_buttonRight_1659d_95",y0e="_buttonCenter_1659d_99",Nc={chatContainer:d0e,scrollContainer:h0e,topLine:f0e,bottomLine:p0e,buttonContainer:g0e,buttonLeft:m0e,buttonRight:v0e,buttonCenter:y0e};function yH(n,e){return function(){return n.apply(e,arguments)}}const{toString:w0e}=Object.prototype,{getPrototypeOf:uQ}=Object,wb=(n=>e=>{const t=w0e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Wa=n=>(n=n.toLowerCase(),e=>wb(e)===n),Bb=n=>e=>typeof e===n,{isArray:tp}=Array,zm=Bb("undefined");function B0e(n){return n!==null&&!zm(n)&&n.constructor!==null&&!zm(n.constructor)&&qs(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const wH=Wa("ArrayBuffer");function C0e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&wH(n.buffer),e}const b0e=Bb("string"),qs=Bb("function"),BH=Bb("number"),Cb=n=>n!==null&&typeof n=="object",x0e=n=>n===!0||n===!1,bw=n=>{if(wb(n)!=="object")return!1;const e=uQ(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},I0e=Wa("Date"),F0e=Wa("File"),E0e=Wa("Blob"),_0e=Wa("FileList"),S0e=n=>Cb(n)&&qs(n.pipe),U0e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||qs(n.append)&&((e=wb(n))==="formdata"||e==="object"&&qs(n.toString)&&n.toString()==="[object FormData]"))},Q0e=Wa("URLSearchParams"),R0e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function x0(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),tp(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const bH=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),xH=n=>!zm(n)&&n!==bH;function F_(){const{caseless:n}=xH(this)&&this||{},e={},t=(r,i)=>{const s=n&&CH(e,i)||i;bw(e[s])&&bw(r)?e[s]=F_(e[s],r):bw(r)?e[s]=F_({},r):tp(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(x0(e,(i,s)=>{t&&qs(i)?n[s]=yH(i,t):n[s]=i},{allOwnKeys:r}),n),T0e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),N0e=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},k0e=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&uQ(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},D0e=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},L0e=n=>{if(!n)return null;if(tp(n))return n;let e=n.length;if(!BH(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},V0e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&uQ(Uint8Array)),P0e=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},O0e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},W0e=Wa("HTMLFormElement"),G0e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),xL=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Z0e=Wa("RegExp"),IH=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};x0(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},J0e=n=>{IH(n,(e,t)=>{if(qs(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(qs(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},H0e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return tp(n)?r(n):r(String(n).split(e)),t},z0e=()=>{},Y0e=(n,e)=>(n=+n,Number.isFinite(n)?n:e),SI="abcdefghijklmnopqrstuvwxyz",IL="0123456789",FH={DIGIT:IL,ALPHA:SI,ALPHA_DIGIT:SI+SI.toUpperCase()+IL},X0e=(n=16,e=FH.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function j0e(n){return!!(n&&qs(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const K0e=n=>{const e=new Array(10),t=(r,i)=>{if(Cb(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=tp(r)?[]:{};return x0(r,(o,a)=>{const l=t(o,i+1);!zm(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},$0e=Wa("AsyncFunction"),q0e=n=>n&&(Cb(n)||qs(n))&&qs(n.then)&&qs(n.catch),Qe={isArray:tp,isArrayBuffer:wH,isBuffer:B0e,isFormData:U0e,isArrayBufferView:C0e,isString:b0e,isNumber:BH,isBoolean:x0e,isObject:Cb,isPlainObject:bw,isUndefined:zm,isDate:I0e,isFile:F0e,isBlob:E0e,isRegExp:Z0e,isFunction:qs,isStream:S0e,isURLSearchParams:Q0e,isTypedArray:V0e,isFileList:_0e,forEach:x0,merge:F_,extend:M0e,trim:R0e,stripBOM:T0e,inherits:N0e,toFlatObject:k0e,kindOf:wb,kindOfTest:Wa,endsWith:D0e,toArray:L0e,forEachEntry:P0e,matchAll:O0e,isHTMLForm:W0e,hasOwnProperty:xL,hasOwnProp:xL,reduceDescriptors:IH,freezeMethods:J0e,toObjectSet:H0e,toCamelCase:G0e,noop:z0e,toFiniteNumber:Y0e,findKey:CH,global:bH,isContextDefined:xH,ALPHABET:FH,generateString:X0e,isSpecCompliantForm:j0e,toJSONObject:K0e,isAsyncFn:$0e,isThenable:q0e};function Ot(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i)}Qe.inherits(Ot,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Qe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const EH=Ot.prototype,_H={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{_H[n]={value:n}});Object.defineProperties(Ot,_H);Object.defineProperty(EH,"isAxiosError",{value:!0});Ot.from=(n,e,t,r,i,s)=>{const o=Object.create(EH);return Qe.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Ot.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const eve=null;function E_(n){return Qe.isPlainObject(n)||Qe.isArray(n)}function SH(n){return Qe.endsWith(n,"[]")?n.slice(0,-2):n}function FL(n,e,t){return n?n.concat(e).map(function(i,s){return i=SH(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function tve(n){return Qe.isArray(n)&&!n.some(E_)}const nve=Qe.toFlatObject(Qe,{},null,function(e){return/^is[A-Z]/.test(e)});function bb(n,e,t){if(!Qe.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Qe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,g){return!Qe.isUndefined(g[f])});const r=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Qe.isSpecCompliantForm(e);if(!Qe.isFunction(i))throw new TypeError("visitor must be a function");function A(p){if(p===null)return"";if(Qe.isDate(p))return p.toISOString();if(!l&&Qe.isBlob(p))throw new Ot("Blob is not supported. Use a Buffer instead.");return Qe.isArrayBuffer(p)||Qe.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,f,g){let m=p;if(p&&!g&&typeof p=="object"){if(Qe.endsWith(f,"{}"))f=r?f:f.slice(0,-2),p=JSON.stringify(p);else if(Qe.isArray(p)&&tve(p)||(Qe.isFileList(p)||Qe.endsWith(f,"[]"))&&(m=Qe.toArray(p)))return f=SH(f),m.forEach(function(w,B){!(Qe.isUndefined(w)||w===null)&&e.append(o===!0?FL([f],B,s):o===null?f:f+"[]",A(w))}),!1}return E_(p)?!0:(e.append(FL(g,f,s),A(p)),!1)}const u=[],h=Object.assign(nve,{defaultVisitor:c,convertValue:A,isVisitable:E_});function d(p,f){if(!Qe.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+f.join("."));u.push(p),Qe.forEach(p,function(m,v){(!(Qe.isUndefined(m)||m===null)&&i.call(e,m,Qe.isString(v)?v.trim():v,f,h))===!0&&d(m,f?f.concat(v):[v])}),u.pop()}}if(!Qe.isObject(n))throw new TypeError("data must be an object");return d(n),e}function EL(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function dQ(n,e){this._pairs=[],n&&bb(n,this,e)}const UH=dQ.prototype;UH.append=function(e,t){this._pairs.push([e,t])};UH.toString=function(e){const t=e?function(r){return e.call(this,r,EL)}:EL;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function rve(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function QH(n,e,t){if(!e)return n;const r=t&&t.encode||rve,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Qe.isURLSearchParams(e)?e.toString():new dQ(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class ive{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Qe.forEach(this.handlers,function(r){r!==null&&e(r)})}}const _L=ive,RH={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},sve=typeof URLSearchParams<"u"?URLSearchParams:dQ,ove=typeof FormData<"u"?FormData:null,ave=typeof Blob<"u"?Blob:null,lve={isBrowser:!0,classes:{URLSearchParams:sve,FormData:ove,Blob:ave},protocols:["http","https","file","blob","url","data"]},MH=typeof window<"u"&&typeof document<"u",Ave=(n=>MH&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),cve=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),uve=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:MH,hasStandardBrowserEnv:Ave,hasStandardBrowserWebWorkerEnv:cve},Symbol.toStringTag,{value:"Module"})),ma={...uve,...lve};function dve(n,e){return bb(n,new ma.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ma.isNode&&Qe.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function hve(n){return Qe.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function fve(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Qe.isArray(i)?i.length:o,l?(Qe.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Qe.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Qe.isArray(i[o])&&(i[o]=fve(i[o])),!a)}if(Qe.isFormData(n)&&Qe.isFunction(n.entries)){const t={};return Qe.forEachEntry(n,(r,i)=>{e(hve(r),i,t,0)}),t}return null}function pve(n,e,t){if(Qe.isString(n))try{return(e||JSON.parse)(n),Qe.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const hQ={transitional:RH,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Qe.isObject(e);if(s&&Qe.isHTMLForm(e)&&(e=new FormData(e)),Qe.isFormData(e))return i?JSON.stringify(TH(e)):e;if(Qe.isArrayBuffer(e)||Qe.isBuffer(e)||Qe.isStream(e)||Qe.isFile(e)||Qe.isBlob(e))return e;if(Qe.isArrayBufferView(e))return e.buffer;if(Qe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return dve(e,this.formSerializer).toString();if((a=Qe.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return bb(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),pve(e)):e}],transformResponse:[function(e){const t=this.transitional||hQ.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Qe.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Ot.from(a,Ot.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ma.classes.FormData,Blob:ma.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Qe.forEach(["delete","get","head","post","put","patch"],n=>{hQ.headers[n]={}});const fQ=hQ,gve=Qe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),mve=n=>{const e={};let t,r,i;return n&&n.split(` +*/(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var r=[],i=0;it.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function sn(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:A,onSubmit:c,minWidth:u,disabled:h}=n,d=Be.useRef(null);return Be.useEffect(()=>{t&&r0e(t).then(p=>{d.current&&(d.current.innerHTML="",p&&(p.classList.add(Mn.icon),d.current.append(p)))})},[t]),o&&o==="login"?V.jsxs("div",{className:jh(r,Mn.iconButtonWrap,s&&s==="dark"?Mn.dark:Mn.light,A&&Mn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[V.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Mn.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[V.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Mn.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),V.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Mn.innerBackgroundColor})]}),V.jsx("span",{ref:d,className:Mn.iconWrap})]}):o&&o==="icon"?V.jsxs("div",{className:jh(r,Mn.iconButtonWrap,s&&s==="dark"?Mn.dark:Mn.light,A&&Mn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[V.jsxs("svg",{className:Mn.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[V.jsx("path",{d:"M5 2H2.85562L3.00485 4.13918L6.7903 58.4048L6.9201 60.2656H8.78545H62.6772H64.6178L64.6763 58.3259L66.3135 4.06031L66.3756 2H64.3144H5Z",fill:"#efefef",className:Mn.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),V.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Mn.innerBackgroundColor})]}),V.jsx("span",{ref:d,className:Mn.iconWrap})]}):V.jsx("button",{className:jh(r,Mn.buttonWrap,s&&s==="dark"?Mn.dark:Mn.light),onClick:i,onMouseEnter:l,onSubmit:c,type:o,disabled:h,style:{minWidth:u?u+"px":""},children:V.jsxs("div",{className:Mn.innerWrap,style:{fontSize:e},children:[t&&V.jsx("span",{ref:d,className:Mn.buttonIconWrap,style:{height:e,width:e,opacity:h?"0.4":"1"}}),a&&a]})})}function i0e(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?V.jsx("div",{className:xy.container,children:V.jsxs("div",{className:xy.messageWindow,children:[V.jsx("div",{className:xy.messageTitle,children:t}),V.jsxs("div",{className:xy.buttonContainer,children:[e&&V.jsx(sn,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),V.jsx(sn,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):V.jsx("div",{})}const s0e="/CharacterStudio/assets/anata-a574c58f.png",o0e="_backgroundImg_iv22q_1",a0e="_darkBackground_iv22q_16",l0e="_Background_iv22q_29",A0e="_webamark_iv22q_37",c0e="_logo_iv22q_45",Rd={backgroundImg:o0e,darkBackground:a0e,Background:l0e,webamark:A0e,logo:c0e};function u0e(){const{debugMode:n}=X.useContext(lr);return V.jsxs("div",{className:n?Rd.darkBackground:Rd.backgroundImg,children:[V.jsx("div",{className:Rd.backgroundBlur}),V.jsx("div",{className:Rd.Background,children:V.jsx("div",{className:Rd.webamark,children:V.jsx("img",{src:s0e,className:Rd.logo})})})]})}const d0e="_chatContainer_1659d_1",h0e="_scrollContainer_1659d_16",f0e="_topLine_1659d_26",p0e="_bottomLine_1659d_54",g0e="_buttonContainer_1659d_82",m0e="_buttonLeft_1659d_91",v0e="_buttonRight_1659d_95",y0e="_buttonCenter_1659d_99",Nc={chatContainer:d0e,scrollContainer:h0e,topLine:f0e,bottomLine:p0e,buttonContainer:g0e,buttonLeft:m0e,buttonRight:v0e,buttonCenter:y0e};function yH(n,e){return function(){return n.apply(e,arguments)}}const{toString:w0e}=Object.prototype,{getPrototypeOf:uQ}=Object,wb=(n=>e=>{const t=w0e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Wa=n=>(n=n.toLowerCase(),e=>wb(e)===n),Bb=n=>e=>typeof e===n,{isArray:tp}=Array,zm=Bb("undefined");function B0e(n){return n!==null&&!zm(n)&&n.constructor!==null&&!zm(n.constructor)&&qs(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const wH=Wa("ArrayBuffer");function C0e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&wH(n.buffer),e}const b0e=Bb("string"),qs=Bb("function"),BH=Bb("number"),Cb=n=>n!==null&&typeof n=="object",x0e=n=>n===!0||n===!1,bw=n=>{if(wb(n)!=="object")return!1;const e=uQ(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},I0e=Wa("Date"),F0e=Wa("File"),E0e=Wa("Blob"),_0e=Wa("FileList"),S0e=n=>Cb(n)&&qs(n.pipe),U0e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||qs(n.append)&&((e=wb(n))==="formdata"||e==="object"&&qs(n.toString)&&n.toString()==="[object FormData]"))},Q0e=Wa("URLSearchParams"),R0e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function x0(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),tp(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const bH=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),xH=n=>!zm(n)&&n!==bH;function F_(){const{caseless:n}=xH(this)&&this||{},e={},t=(r,i)=>{const s=n&&CH(e,i)||i;bw(e[s])&&bw(r)?e[s]=F_(e[s],r):bw(r)?e[s]=F_({},r):tp(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(x0(e,(i,s)=>{t&&qs(i)?n[s]=yH(i,t):n[s]=i},{allOwnKeys:r}),n),T0e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),N0e=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},k0e=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&uQ(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},D0e=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},L0e=n=>{if(!n)return null;if(tp(n))return n;let e=n.length;if(!BH(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},V0e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&uQ(Uint8Array)),P0e=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},O0e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},W0e=Wa("HTMLFormElement"),G0e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),xL=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Z0e=Wa("RegExp"),IH=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};x0(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},J0e=n=>{IH(n,(e,t)=>{if(qs(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(qs(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},H0e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return tp(n)?r(n):r(String(n).split(e)),t},z0e=()=>{},Y0e=(n,e)=>(n=+n,Number.isFinite(n)?n:e),SI="abcdefghijklmnopqrstuvwxyz",IL="0123456789",FH={DIGIT:IL,ALPHA:SI,ALPHA_DIGIT:SI+SI.toUpperCase()+IL},X0e=(n=16,e=FH.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function j0e(n){return!!(n&&qs(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const K0e=n=>{const e=new Array(10),t=(r,i)=>{if(Cb(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=tp(r)?[]:{};return x0(r,(o,a)=>{const l=t(o,i+1);!zm(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},$0e=Wa("AsyncFunction"),q0e=n=>n&&(Cb(n)||qs(n))&&qs(n.then)&&qs(n.catch),Qe={isArray:tp,isArrayBuffer:wH,isBuffer:B0e,isFormData:U0e,isArrayBufferView:C0e,isString:b0e,isNumber:BH,isBoolean:x0e,isObject:Cb,isPlainObject:bw,isUndefined:zm,isDate:I0e,isFile:F0e,isBlob:E0e,isRegExp:Z0e,isFunction:qs,isStream:S0e,isURLSearchParams:Q0e,isTypedArray:V0e,isFileList:_0e,forEach:x0,merge:F_,extend:M0e,trim:R0e,stripBOM:T0e,inherits:N0e,toFlatObject:k0e,kindOf:wb,kindOfTest:Wa,endsWith:D0e,toArray:L0e,forEachEntry:P0e,matchAll:O0e,isHTMLForm:W0e,hasOwnProperty:xL,hasOwnProp:xL,reduceDescriptors:IH,freezeMethods:J0e,toObjectSet:H0e,toCamelCase:G0e,noop:z0e,toFiniteNumber:Y0e,findKey:CH,global:bH,isContextDefined:xH,ALPHABET:FH,generateString:X0e,isSpecCompliantForm:j0e,toJSONObject:K0e,isAsyncFn:$0e,isThenable:q0e};function Ot(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i)}Qe.inherits(Ot,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Qe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const EH=Ot.prototype,_H={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{_H[n]={value:n}});Object.defineProperties(Ot,_H);Object.defineProperty(EH,"isAxiosError",{value:!0});Ot.from=(n,e,t,r,i,s)=>{const o=Object.create(EH);return Qe.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Ot.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const eve=null;function E_(n){return Qe.isPlainObject(n)||Qe.isArray(n)}function SH(n){return Qe.endsWith(n,"[]")?n.slice(0,-2):n}function FL(n,e,t){return n?n.concat(e).map(function(i,s){return i=SH(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function tve(n){return Qe.isArray(n)&&!n.some(E_)}const nve=Qe.toFlatObject(Qe,{},null,function(e){return/^is[A-Z]/.test(e)});function bb(n,e,t){if(!Qe.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Qe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,g){return!Qe.isUndefined(g[f])});const r=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Qe.isSpecCompliantForm(e);if(!Qe.isFunction(i))throw new TypeError("visitor must be a function");function A(p){if(p===null)return"";if(Qe.isDate(p))return p.toISOString();if(!l&&Qe.isBlob(p))throw new Ot("Blob is not supported. Use a Buffer instead.");return Qe.isArrayBuffer(p)||Qe.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,f,g){let m=p;if(p&&!g&&typeof p=="object"){if(Qe.endsWith(f,"{}"))f=r?f:f.slice(0,-2),p=JSON.stringify(p);else if(Qe.isArray(p)&&tve(p)||(Qe.isFileList(p)||Qe.endsWith(f,"[]"))&&(m=Qe.toArray(p)))return f=SH(f),m.forEach(function(w,B){!(Qe.isUndefined(w)||w===null)&&e.append(o===!0?FL([f],B,s):o===null?f:f+"[]",A(w))}),!1}return E_(p)?!0:(e.append(FL(g,f,s),A(p)),!1)}const u=[],h=Object.assign(nve,{defaultVisitor:c,convertValue:A,isVisitable:E_});function d(p,f){if(!Qe.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+f.join("."));u.push(p),Qe.forEach(p,function(m,v){(!(Qe.isUndefined(m)||m===null)&&i.call(e,m,Qe.isString(v)?v.trim():v,f,h))===!0&&d(m,f?f.concat(v):[v])}),u.pop()}}if(!Qe.isObject(n))throw new TypeError("data must be an object");return d(n),e}function EL(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function dQ(n,e){this._pairs=[],n&&bb(n,this,e)}const UH=dQ.prototype;UH.append=function(e,t){this._pairs.push([e,t])};UH.toString=function(e){const t=e?function(r){return e.call(this,r,EL)}:EL;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function rve(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function QH(n,e,t){if(!e)return n;const r=t&&t.encode||rve,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Qe.isURLSearchParams(e)?e.toString():new dQ(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class ive{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Qe.forEach(this.handlers,function(r){r!==null&&e(r)})}}const _L=ive,RH={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},sve=typeof URLSearchParams<"u"?URLSearchParams:dQ,ove=typeof FormData<"u"?FormData:null,ave=typeof Blob<"u"?Blob:null,lve={isBrowser:!0,classes:{URLSearchParams:sve,FormData:ove,Blob:ave},protocols:["http","https","file","blob","url","data"]},MH=typeof window<"u"&&typeof document<"u",Ave=(n=>MH&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),cve=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),uve=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:MH,hasStandardBrowserEnv:Ave,hasStandardBrowserWebWorkerEnv:cve},Symbol.toStringTag,{value:"Module"})),ma={...uve,...lve};function dve(n,e){return bb(n,new ma.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ma.isNode&&Qe.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function hve(n){return Qe.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function fve(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Qe.isArray(i)?i.length:o,l?(Qe.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Qe.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Qe.isArray(i[o])&&(i[o]=fve(i[o])),!a)}if(Qe.isFormData(n)&&Qe.isFunction(n.entries)){const t={};return Qe.forEachEntry(n,(r,i)=>{e(hve(r),i,t,0)}),t}return null}function pve(n,e,t){if(Qe.isString(n))try{return(e||JSON.parse)(n),Qe.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const hQ={transitional:RH,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Qe.isObject(e);if(s&&Qe.isHTMLForm(e)&&(e=new FormData(e)),Qe.isFormData(e))return i?JSON.stringify(TH(e)):e;if(Qe.isArrayBuffer(e)||Qe.isBuffer(e)||Qe.isStream(e)||Qe.isFile(e)||Qe.isBlob(e))return e;if(Qe.isArrayBufferView(e))return e.buffer;if(Qe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return dve(e,this.formSerializer).toString();if((a=Qe.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return bb(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),pve(e)):e}],transformResponse:[function(e){const t=this.transitional||hQ.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Qe.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Ot.from(a,Ot.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ma.classes.FormData,Blob:ma.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Qe.forEach(["delete","get","head","post","put","patch"],n=>{hQ.headers[n]={}});const fQ=hQ,gve=Qe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),mve=n=>{const e={};let t,r,i;return n&&n.split(` `).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&gve[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},SL=Symbol("internals");function qp(n){return n&&String(n).trim().toLowerCase()}function xw(n){return n===!1||n==null?n:Qe.isArray(n)?n.map(xw):String(n)}function vve(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const yve=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function UI(n,e,t,r,i){if(Qe.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Qe.isString(e)){if(Qe.isString(r))return e.indexOf(r)!==-1;if(Qe.isRegExp(r))return r.test(e)}}function wve(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function Bve(n,e){const t=Qe.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class xb{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,A){const c=qp(l);if(!c)throw new Error("header name must be a non-empty string");const u=Qe.findKey(i,c);(!u||i[u]===void 0||A===!0||A===void 0&&i[u]!==!1)&&(i[u||l]=xw(a))}const o=(a,l)=>Qe.forEach(a,(A,c)=>s(A,c,l));return Qe.isPlainObject(e)||e instanceof this.constructor?o(e,t):Qe.isString(e)&&(e=e.trim())&&!yve(e)?o(mve(e),t):e!=null&&s(t,e,r),this}get(e,t){if(e=qp(e),e){const r=Qe.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return vve(i);if(Qe.isFunction(t))return t.call(this,i,r);if(Qe.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=qp(e),e){const r=Qe.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||UI(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=qp(o),o){const a=Qe.findKey(r,o);a&&(!t||UI(r,r[a],a,t))&&(delete r[a],i=!0)}}return Qe.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||UI(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Qe.forEach(this,(i,s)=>{const o=Qe.findKey(r,s);if(o){t[o]=xw(i),delete t[s];return}const a=e?wve(s):String(s).trim();a!==s&&delete t[s],t[a]=xw(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Qe.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Qe.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[SL]=this[SL]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=qp(o);r[a]||(Bve(i,o),r[a]=!0)}return Qe.isArray(e)?e.forEach(s):s(e),this}}xb.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Qe.reduceDescriptors(xb.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Qe.freezeMethods(xb);const Ql=xb;function QI(n,e){const t=this||fQ,r=e||t,i=Ql.from(r.headers);let s=r.data;return Qe.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function NH(n){return!!(n&&n.__CANCEL__)}function I0(n,e,t){Ot.call(this,n??"canceled",Ot.ERR_CANCELED,e,t),this.name="CanceledError"}Qe.inherits(I0,Ot,{__CANCEL__:!0});function Cve(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new Ot("Request failed with status code "+t.status,[Ot.ERR_BAD_REQUEST,Ot.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const bve=ma.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Qe.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Qe.isString(r)&&o.push("path="+r),Qe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function xve(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Ive(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function kH(n,e){return n&&!xve(e)?Ive(n,e):e}const Fve=ma.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(o){const a=Qe.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function Eve(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function _ve(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const A=Date.now(),c=r[s];o||(o=A),t[i]=l,r[i]=A;let u=s,h=0;for(;u!==i;)h+=t[u++],u=u%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),A-o{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-t,l=r(a),A=s<=o;t=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&A?(o-s)/l:void 0,event:i};c[e?"download":"upload"]=!0,n(c)}}const Sve=typeof XMLHttpRequest<"u",Uve=Sve&&function(n){return new Promise(function(t,r){let i=n.data;const s=Ql.from(n.headers).normalize();let{responseType:o,withXSRFToken:a}=n,l;function A(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let c;if(Qe.isFormData(i)){if(ma.hasStandardBrowserEnv||ma.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((c=s.getContentType())!==!1){const[f,...g]=c?c.split(";").map(m=>m.trim()).filter(Boolean):[];s.setContentType([f||"multipart/form-data",...g].join("; "))}}let u=new XMLHttpRequest;if(n.auth){const f=n.auth.username||"",g=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(f+":"+g))}const h=kH(n.baseURL,n.url);u.open(n.method.toUpperCase(),QH(h,n.params,n.paramsSerializer),!0),u.timeout=n.timeout;function d(){if(!u)return;const f=Ql.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!o||o==="text"||o==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:f,config:n,request:u};Cve(function(w){t(w),A()},function(w){r(w),A()},m),u=null}if("onloadend"in u?u.onloadend=d:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(d)},u.onabort=function(){u&&(r(new Ot("Request aborted",Ot.ECONNABORTED,n,u)),u=null)},u.onerror=function(){r(new Ot("Network Error",Ot.ERR_NETWORK,n,u)),u=null},u.ontimeout=function(){let g=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const m=n.transitional||RH;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),r(new Ot(g,m.clarifyTimeoutError?Ot.ETIMEDOUT:Ot.ECONNABORTED,n,u)),u=null},ma.hasStandardBrowserEnv&&(a&&Qe.isFunction(a)&&(a=a(n)),a||a!==!1&&Fve(h))){const f=n.xsrfHeaderName&&n.xsrfCookieName&&bve.read(n.xsrfCookieName);f&&s.set(n.xsrfHeaderName,f)}i===void 0&&s.setContentType(null),"setRequestHeader"in u&&Qe.forEach(s.toJSON(),function(g,m){u.setRequestHeader(m,g)}),Qe.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),o&&o!=="json"&&(u.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&u.addEventListener("progress",UL(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",UL(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=f=>{u&&(r(!f||f.type?new I0(null,n,u):f),u.abort(),u=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const p=Eve(h);if(p&&ma.protocols.indexOf(p)===-1){r(new Ot("Unsupported protocol "+p+":",Ot.ERR_BAD_REQUEST,n));return}u.send(i||null)})},__={http:eve,xhr:Uve};Qe.forEach(__,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const QL=n=>`- ${n}`,Qve=n=>Qe.isFunction(n)||n===null||n===!1,DH={getAdapter:n=>{n=Qe.isArray(n)?n:[n];const{length:e}=n;let t,r;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(QL).join(` @@ -4968,9 +4968,9 @@ class SpeexResampleProcessor extends AudioWorkletProcessor {\r }\r }\r \r -registerProcessor('speex-resample-switch', SpeexResampleProcessor);`;if(typeof dl!="object"){var dl={};window.SepiaFW=dl}(function(n){var e=n.webAudio||{};e.version="0.9.11";var t=window.AudioContext||window.webkitAudioContext,r=void 0,i=void 0;function s(){return r=!!t&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,!!r||i}e.isStreamRecorderSupported=s(),e.isNativeStreamResamplingSupported=!0,e.tryNativeStreamResampling=!0,e.contentFetchTimeout=8e3,e.defaultProcessorOptions={moduleFolder:"modules",initSuccessCallback:console.log,initErrorCallback:console.error,onerror:console.error};var o={};e.clearPreLoadCache=function(){o={}},e.getSupportedAudioConstraints=function(){var p=navigator.mediaDevices.getSupportedConstraints(),f={},g=e.overwriteSupportedAudioConstraints;return p.deviceId&&(f.deviceId=g.deviceId!=null?g.deviceId:void 0),p.channelCount&&(f.channelCount=g.channelCount!=null?g.channelCount:1),p.noiseSuppression&&(f.noiseSuppression=g.noiseSuppression!=null?g.noiseSuppression:!0),p.autoGainControl&&(f.autoGainControl=g.autoGainControl!=null?g.autoGainControl:!1),p.echoCancellation&&(f.echoCancellation=g.echoCancellation!=null?g.echoCancellation:!1),p.sampleRate&&(f.sampleRate=g.sampleRate!=null?g.sampleRate:48e3),f},e.overwriteSupportedAudioConstraints={},e.defaultMimeTypesForCodecs={ogg:"audio/ogg",ogg_opus:"audio/ogg;codecs=opus",ogg_vorbis:"audio/ogg;codecs=vorbis",ogg_speex:"audio/ogg;codecs=speex",opus:"audio/opus",vorbis:"audio/vorbis",speex:"audio/speex",wav:"audio/wav",raw:"audio/wav",webm_ogg_opus:"audio/webm;codecs=opus",webm_ogg_vorbis:"audio/webm;codecs=vorbis",webm_mkv_pcm:"audio/webm;codecs=pcm",mp3:"audio/mpeg",mp4:"audio/mp4",flac:"audio/flac",mpeg:"audio/mpeg"},e.getSupportedMediaRecorderCodecs=function(){var p={};return window.MediaRecorder&&Object.keys(e.defaultMimeTypesForCodecs).forEach(function(f){var g=e.defaultMimeTypesForCodecs[f];window.MediaRecorder.isTypeSupported(g)&&(p[f]=g)}),p},e.createAudioContext=function(p,f){var g={};!f&&p.targetSampleRate&&(g.sampleRate=p.targetSampleRate);var m=new t(g);return m},e.Processor=function(p,f,g){var m=this;g||(g=e.defaultProcessorOptions.initErrorCallback),f||(f=e.defaultProcessorOptions.initSuccessCallback),p||(p={});var v=p.onerror||e.defaultProcessorOptions.onerror,w=(p.moduleFolder||e.defaultProcessorOptions.moduleFolder).replace(/\/$/,"")+"/",B,C=0,b,F,x,_,M=!1,Y=!1,O=!1,U=p.initializerTimeout||3e3,y,I={},R={},N=[];function k($){p.debugLog&&p.debugLog("Started init. condition: "+$),I[$]=1}function V($){I[$]&&(delete I[$],p.debugLog&&p.debugLog("Completed init. condition: "+$),Object.keys(I).length==0&&(Y||(clearTimeout(y),Y=!0,O=!1,f({name:"ProcessorReady",message:"Processor is ready for action",inputSampleRate:B,targetSampleRate:p.targetSampleRate||B,sourceInfo:R,modulesInfo:N}))))}function G(){clearTimeout(y),Y=!1,O=!1,I={},k("sourceSetup"),k("modulesSetup")}function D($){G(),g($)}G(),O=!0,y=setTimeout(function(){D({message:"Initialization took too long! If you expect long running init. process use option 'initializerTimeout' (ms).",name:"ProcessorInitTimeout"})},U);async function E($,ce){if(b&&$&&(b.state!="closed"&&await b.close(),b=null),!b||b.state=="closed")if(b=e.createAudioContext(p,ce),p.startSuspended==null||p.startSuspended){try{await b.resume()}catch{}await b.suspend()}else await b.resume();return b}async function z(){if(p.modules)for(let $=0;$2)throw{name:"PreLoadError",message:"Missing 'path' (url) or unsupported type (use 1=text or 2=arraybuffer)"};le==1?_e=await A(te):le==2&&(_e=await l(te)),typeof se=="function"&&(_e=se(_e)),W[S]=_e,o[Ue]=_e}catch(Te){throw{name:"AddModuleError",message:"Failed to pre-load data: "+S+" - name: "+ye,info:Te}}}))}catch(S){D(S);return}var ie=be.options||{};ie.preLoadResults=W;var ae;function me(S){if(!(!S||S.data==null))if(S.data.moduleState==1)ae.isReady=!0,V("module-"+q),S.data.moduleInfo&&(ae.moduleInfo=S.data.moduleInfo),P[q]={moduleName:ae.moduleName,moduleInfo:ae.moduleInfo},--fe==0&&ge(P);else if(S.data.moduleState==9&&!ae.isTerminated){if(typeof ae.terminate=="function")try{ae.isTerminated=!0,ae.terminate()}catch(Z){ae.isTerminated=!0,J({name:"TerminateError",message:"Failed to terminate module",info:Z})}}else S.data.moduleState==10?(S.data.error.target=S.target,J(S.data.error)):S.data.moduleResponse||be.sendToModules&&(S.data.moduleEvent?be.sendToModules.forEach(function(Z){$[Z]&&!$[Z].ignoreSendToModules&&$[Z].sendToModule({ctrl:{action:"handle",data:S.data}})}):be.sendToModules.forEach(function(Z){$[Z]&&!$[Z].ignoreSendToModules&&$[Z].sendToModule({ctrl:{action:"process",data:S.data}})}));be.onmessage&&be.onmessage(S.data,$)}function J(S){var Z;S.message&&S.message.indexOf("Uncaught {")==0?(S.preventDefault(),Z=JSON.parse(S.message.replace(/^Uncaught /,"")),S.message=Z):Z=S,v({name:"AudioModuleProcessorException",message:"Error in module: "+S.target.moduleName+" - "+(Z&&Z.message?Z.message:"Check console for details."),module:S.target.moduleName,info:Z}),O&&!Y&&D({message:"Error during setup of module: "+ae.moduleName,name:"ProcessorInitError",info:Z}),be.onerror&&be.onerror(S)}if(oe==1){if(!ce){D({name:"AddModuleError",message:"Source does not support 'AudioWorkletProcessor' (use only workers instead) - name: "+ye});return}ie.processorOptions||(ie.processorOptions=ie.setup||{}),ie.processorOptions.ctxInfo||(ie.processorOptions.ctxInfo={sampleRate:b.sampleRate,targetSampleRate:p.targetSampleRate}),ae=new AudioWorkletNode(b,ye,ie),ae.isReady=!1,ae.moduleName=ye,ae.port.onmessage=me,ae.onprocessorerror=J,ae.sendToModule=function(S){ae.isReady?ae.port.postMessage(S):v({name:"AudioModuleProcessorException",message:"'sendToModule' was called before module was actually ready. Consider 'startSuspended' option maybe.'",module:ae.moduleName})}}else if(oe==2)ie.setup||(ie.setup={}),ie.setup.ctxInfo||(ie.setup.ctxInfo={sampleRate:b.sampleRate,targetSampleRate:p.targetSampleRate}),ye.includes("webrtc-vad")?ae=tye():ye.includes("stt-socket")&&(ae=nye()),ae.isReady=!1,ae.moduleName=ye,ae.onmessage=me,ae.onerror=J,ae.sendToModule=function(S){ae.isReady||S&&S.ctrl&&S.ctrl.action=="construct"?ae.postMessage(S):v({name:"AudioModuleProcessorException",message:"'sendToModule' was called before module was actually ready. Consider 'startSuspended' option maybe.",module:ae.moduleName})},ae.sendToModule({ctrl:{action:"construct",options:ie}});else if(oe==3){D({name:"AddModuleError",message:"ScriptProcessor nodes are currently not supported as modules (only source)."});return}else if(oe==4){D({name:"AddModuleError",message:"AudioNodes are currently not supported as modules (you can use them as custom source)."});return}else{D({name:"AddModuleError",message:"Unknown module type."});return}if(ae.moduleType=oe,ae.ignoreSendToModules=!1,ae.deactivate=function(){ae.ignoreSendToModules=!0,M&&(ae.sendToModule({ctrl:{action:"stop"}}),ae.sendToModule({ctrl:{action:"reset"}}))},ae.activate=function(){ae.ignoreSendToModules=!1,M&&ae.sendToModule({ctrl:{action:"start"}})},ue.handle=ae,!ce&&q==0){var Q=$[0];if(!Q.onmessage){D({name:"AddModuleError",message:"If source is not compatible to 'AudioWorklet' it has to have a 'onmessage' event to get the processed data."});return}Q.onmessage=function(S){!S||S.data==null||(S.data.moduleEvent||S.data.sourceEvent?ae.sendToModule({ctrl:{action:"handle",data:S.data}}):ae.sendToModule({ctrl:{action:"process",data:S.data}}))}}$[Fe+q]=ae})}else ge([])}function Ae($,ce,ge){B=b.sampleRate,ge||(ge={}),p.targetSampleRate&&p.targetSampleRate!=B&&(e.isNativeStreamResamplingSupported=!1,C=B-p.targetSampleRate);var Fe=[$],P=[],fe=!0;ge.hasWorkletSupport!=null?fe=ge.hasWorkletSupport:ge.type=="scriptProcessor"&&(fe=!1),de(Fe,fe,function(q){N=q,V("modulesSetup"),m.processNodes=Fe;let K=!1;if(Fe.forEach(function(oe,ye){fe&&(!oe.moduleType||oe.moduleType==1)&&P.push(oe),oe.moduleInfo&&oe.moduleInfo.resamplingMode&&(K=!0)}),C&&!K){D({message:"Samplerate mismatch and no resampler found!",name:"ProcessorInitError"});return}});var ue=p.destinationNode||b.destination;m.mainAudioContext=b,m.source=$,m.sourceInfo=ge,R=ge,ce||(ce={}),F=function(q,K){Promise.resolve((ce.onBeforeStart||d)()).then(function(){return b.resume()}).then(function(){if(P.length>1){for(var oe=1;oe1)return v({message:"Sorry, but this recorder only supports MONO audio at the moment.",name:"NotSupportedError"});var C=g.mimeType||e.defaultMimeTypesForCodecs[g.codec]||e.defaultMimeTypesForCodecs.webm_ogg_opus,b=g.sampleTime||(g.chunkSize?Math.floor(1e3/w*g.chunkSize):0);if(b&&g.decodeToAudioBuffer&&console.error("WARNING: Partial decoding is not supported at the moment! It is possible but requires adding custom headers for each blob!"),window.MediaRecorder)if(MediaRecorder.isTypeSupported(C)){var F=new MediaRecorder(p,{mimeType:C,bitsPerSecond:w*2*B}),x,_,M=!1;F.onerror=g.onerror||console.error,g.onstart&&(F.onstart=g.onstart),g.onpause&&(F.onpause=g.onpause),g.onresume&&(F.onresume=g.onresume);var Y=g.onstop;F.onstop=function(R){Y&&!g.decodeToAudioBuffer&&Y()};var O=g.ondataavailable||g.onprocess;g.decodeToAudioBuffer?O&&(F.ondataavailable=function(R){if(F.state=="inactive"&&(M=!0),R&&R.data){let N=Date.now();e.offlineAudioContextBlobDecoder(w,B,R.data,function(k){k&&O({data:k.getChannelData(0),decodeTime:Date.now()-N}),!M&&g.recordLimitMs&&Date.now()-x>=g.recordLimitMs?y():M&&Y&&Y()})}}):O&&(F.ondataavailable=function(R){O(R),g.recordLimitMs&&Date.now()-x>=g.recordLimitMs&&y()});var U,y=function(){U&&clearTimeout(U),_=Date.now(),F.state!="inactive"&&F.stop()},I=function(){x=Date.now(),_=void 0,M=!1,b?F.start(b):(F.start(),g.recordLimitMs&&(U=setTimeout(y,g.recordLimitMs)))};return m({getMediaRecorder:function(){return F},mimeType:C,sourceInfo:f,sampleTime:b,start:I,stop:y})}else return v({message:"MIME-Type '"+C+"' is not supported!",name:"NotSupportedError"});else return v({message:"'MediaRecorder' is not available!",name:"NotSupportedError"})}catch(R){return console.error("AudioRecorder",R),v(R)}})()})},e.offlineAudioContextBlobDecoder=function(p,f,g,m){a(g,function(v){if(!v)m();else{var w=new OfflineAudioContext(f,v.byteLength,p);w.decodeAudioData(v,function(B){m(B)},function(B){console.error("offlineAudioContext.decodeAudioData ERROR",B),m()})}})};function a(p,f){if(!p||!p.size)f();else if(typeof p.arrayBuffer=="function")p.arrayBuffer().then(function(m){f(m)}).catch(function(m){console.error("blobToArray '.arrayBuffer' ERROR",m),f()});else{var g=new FileReader;g.onload=function(){f(g.result)},g.onerror=function(m){console.error("blobToArray 'FileReader' ERROR",reader.error,m),f()},g.readAsArrayBuffer(p)}}e.blobToArray=a,e.createLegacyMicrophoneScriptProcessor=function(p){return p||(p={}),e.getMicrophone(p,void 0).then(function(f){var g=f.source,m=g.context,v=m.sampleRate,w=p.bufferSize||2048,B=1,C=m.createScriptProcessor(w,B,B);g.connect(C);var b={node:C,type:"scriptProcessor",typeData:f.info,hasWorkletSupport:!1,start:function(){f.controls.onAfterStart&&f.controls.onAfterStart()},stop:function(){f.controls.onBeforeStop&&f.controls.onBeforeStop()},release:function(){f.controls.onAfterRelease&&f.controls.onAfterRelease()}};if(f.controls&&(f.controls.onBeforeStart&&(b.beforeStart=f.controls.onBeforeStart),f.controls.onAfterStop&&(b.afterStop=f.controls.onAfterStop),f.controls.onBeforeRelease&&(b.beforeRelease=f.controls.onBeforeRelease)),p.onaudioprocess)C.onaudioprocess=p.onaudioprocess;else{let F=function(x){if(x&&x.inputBuffer){var _=[x.inputBuffer.getChannelData(0)];C.onmessage({data:{samples:_,sampleRate:v,channels:B,type:_[0].constructor.name}})}};C.onaudioprocess=function(x){F(x)},C.onmessage=p.onmessage||function(x){}}return b})},e.createWhiteNoiseGeneratorNode=function(p,f,g){f||(f={});var m=e.defaultProcessorOptions.moduleFolder.replace(/\/$/,"")+"/";return new Promise(function(v,w){(async function(){try{var B=e.createAudioContext(f);try{await B.resume()}catch{}await B.suspend();var C=m+"white-noise-generator.js";await B.audioWorklet.addModule(C);var b=new AudioWorkletNode(B,"white-noise-generator",{processorOptions:{gain:p||.1}});g&&(b.port.onmessage=g),v(b)}catch(F){return w(F)}})()})},e.createFileSource=function(p,f,g,m){return f||(f={}),new Promise(function(v,w){try{let B=function(b){w(b)},C=function(b){e.createAudioBufferSource(b,f,g,m).then(function(F){F.typeData={fileUrl:p},v(F)}).catch(B)};e.readFileAsBuffer(p,C,B)}catch(B){w(B)}})},e.createAudioBufferSource=function(p,f,g,m){return f||(f={}),new Promise(function(v,w){(async function(){try{var B=e.createAudioContext(f);try{await B.resume()}catch{}await B.suspend();var C=B.createBufferSource();B.decodeAudioData(p,function(b){return C.buffer=b,C.loop=g??!0,m&&(C.onended=m),v({node:C,type:"fileAudioBuffer",typeData:{},start:function(){C.start()},stop:function(){C.stop()},release:function(){}})},function(b){return w(b)})}catch(b){return w(b)}})()})},e.createSourceAudioPlayer=function(p,f,g,m,v){f||(f={}),f.modules=g||[],f.customSource=p,f.startSuspended==null&&(f.startSuspended=!0);var w=new e.Processor(f,m,v);return w},e.encodeWaveBuffer=function(p,f,g,m,v,w){var B=e.defaultProcessorOptions.moduleFolder.replace(/\/$/,"")+"/",C=new Worker(B+"wave-encoder-worker.js");v||(v=console.log),w||(w=console.error);var b={setup:{inputSampleRate:f,inputSampleSize:p.length,lookbackBufferMs:0}};C.onmessage=function(F){F.data.moduleState==1?C.postMessage({encode:{format:"wave",data:{samples:[p],sampleRate:f,channels:g,isFloat32:m}}}):F.data.encoderResult&&(C.terminate(),F.data.error?w({name:"EncoderError",message:F.data.error}):v(F.data.encoderResult))},C.onerror=function(F){C.terminate(),w(F)},C.postMessage({ctrl:{action:"construct",options:b}})},e.decodeAudioFile=function(p,f,g,m,v){e.readFileAsBuffer(p,function(w){var B=new OfflineAudioContext(g,w.byteLength,f);B.decodeAudioData(w,function(C){m(C)},function(C){v(C)})},function(w){v(w)})},e.decodeAudioFileToInt16Mono=function(p,f,g,m){var v=1;e.decodeAudioFile(p,f,v,function(w){var B=!0;e.encodeWaveBuffer(w.getChannelData(0),f,v,B,function(C){try{var b=new Int16Array(C.wav.buffer);g(b)}catch(F){m(F)}},m)},m)},e.resampleBufferViaSpeex=function(p,f,g,m,v,w,B){w||(w=console.log),B||(B=console.error);try{var C=new OfflineAudioContext(m,p.length,f),b=e.defaultProcessorOptions.moduleFolder.replace(/\/$/,"")+"/",F="speex-resample-switch";C.audioWorklet.addModule(b+F+".js").then(function(){var x={processorOptions:{ctxInfo:{sampleRate:f},targetSampleRate:g,resampleQuality:v,bufferSize:p.length}},_=new AudioWorkletNode(C,F,x);_.port.onmessage=function(M){M.data.moduleState==1?_.port.postMessage({resample:{samples:[p],isInt16:!0}}):M.data.resampleResult&&(C=null,M.data.error?B({name:"ResampleError",message:M.data.error}):w(M.data.resampleResult))},_.onprocessorerror=function(M){C=null,B(M)}})}catch(x){B(x)}},e.readFileAsBuffer=function(p,f,g){dl&&dl.files?dl.files.fetch(p,f,g,"arraybuffer",e.contentFetchTimeout):c("arraybuffer",p,f,g)},e.readFileAsText=function(p,f,g){dl&&dl.files?dl.files.fetch(p,f,g,void 0,e.contentFetchTimeout):c("text",p,f,g)};function l(p){return new Promise(function(f,g){e.readFileAsBuffer(p,function(m){f(m)},function(m){g(m)})})}function A(p){return new Promise(function(f,g){e.readFileAsText(p,function(m){f(m)},function(m){g(m)})})}function c(p,f,g,m){var v=new XMLHttpRequest;v.open("GET",f),v.responseType=p,v.timeout=e.contentFetchTimeout,v.onload=function(w){v.status>=200&&v.status<300?g(v.response):m({status:v.status,message:v.statusText})},v.onerror=function(w){m(w)},v.ontimeout=function(w){m(w)},v.send()}function u(p){try{for(var f=atob(p),g=new Uint8Array(f.length),m=0;m1&&console.error("SepiaVoiceRecorder.decodeAudioFileToInt16Mono - Channels > 1 not supported. Result will only contain data of channel 0."),g||(g=console.log),m||(m=console.error),SepiaFW.webAudio.decodeAudioFileToInt16Mono(d,p,g,m)},n.addAudioElementToPage=function(d,p,f){return SepiaFW.webAudio.addAudioElementToPage(d,p,f)},window.SepiaVoiceRecorder=n})();class iye{constructor(e,t){it(this,"volumeThresholds",[.05,10]);it(this,"gain",1);it(this,"isLoading",!1);it(this,"isRecording",!1);it(this,"isWaitingForFinalResult",!1);it(this,"waitingForFinalResultTimer");it(this,"waitingForFinalResultDelay",4e3);it(this,"asrStreaming",!1);it(this,"sourceInfo","-?-");if(window.SepiaFW&&(SepiaFW.webAudio.defaultProcessorOptions.moduleFolder="lib"),!window.SepiaVoiceRecorder)SepiaVoiceRecorder={notSupported:!0},console.error("SEPIA Web Audio Library not found or not supported (IE11?)!");else{this.sepiaSpeechRecognition=e,this.sepiaSpeechRecognitionConfig=t;const r=this;SepiaVoiceRecorder.onProcessorReady=function(i){console.log("SepiaVoiceRecorder - onProcessorReady",i),this.sourceInfo="Sample-rate: "+i.targetSampleRate+"Hz (factor: "+i.inputSampleRate/i.targetSampleRate+`) +registerProcessor('speex-resample-switch', SpeexResampleProcessor);`;if(typeof dl!="object"){var dl={};window.SepiaFW=dl}(function(n){var e=n.webAudio||{};e.version="0.9.11";var t=window.AudioContext||window.webkitAudioContext,r=void 0,i=void 0;function s(){return r=!!t&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,!!r||i}e.isStreamRecorderSupported=s(),e.isNativeStreamResamplingSupported=!0,e.tryNativeStreamResampling=!0,e.contentFetchTimeout=8e3,e.defaultProcessorOptions={moduleFolder:"modules",initSuccessCallback:console.log,initErrorCallback:console.error,onerror:console.error};var o={};e.clearPreLoadCache=function(){o={}},e.getSupportedAudioConstraints=function(){var p=navigator.mediaDevices.getSupportedConstraints(),f={},g=e.overwriteSupportedAudioConstraints;return p.deviceId&&(f.deviceId=g.deviceId!=null?g.deviceId:void 0),p.channelCount&&(f.channelCount=g.channelCount!=null?g.channelCount:1),p.noiseSuppression&&(f.noiseSuppression=g.noiseSuppression!=null?g.noiseSuppression:!0),p.autoGainControl&&(f.autoGainControl=g.autoGainControl!=null?g.autoGainControl:!1),p.echoCancellation&&(f.echoCancellation=g.echoCancellation!=null?g.echoCancellation:!1),p.sampleRate&&(f.sampleRate=g.sampleRate!=null?g.sampleRate:48e3),f},e.overwriteSupportedAudioConstraints={},e.defaultMimeTypesForCodecs={ogg:"audio/ogg",ogg_opus:"audio/ogg;codecs=opus",ogg_vorbis:"audio/ogg;codecs=vorbis",ogg_speex:"audio/ogg;codecs=speex",opus:"audio/opus",vorbis:"audio/vorbis",speex:"audio/speex",wav:"audio/wav",raw:"audio/wav",webm_ogg_opus:"audio/webm;codecs=opus",webm_ogg_vorbis:"audio/webm;codecs=vorbis",webm_mkv_pcm:"audio/webm;codecs=pcm",mp3:"audio/mpeg",mp4:"audio/mp4",flac:"audio/flac",mpeg:"audio/mpeg"},e.getSupportedMediaRecorderCodecs=function(){var p={};return window.MediaRecorder&&Object.keys(e.defaultMimeTypesForCodecs).forEach(function(f){var g=e.defaultMimeTypesForCodecs[f];window.MediaRecorder.isTypeSupported(g)&&(p[f]=g)}),p},e.createAudioContext=function(p,f){var g={};!f&&p.targetSampleRate&&(g.sampleRate=p.targetSampleRate);var m=new t(g);return m},e.Processor=function(p,f,g){var m=this;g||(g=e.defaultProcessorOptions.initErrorCallback),f||(f=e.defaultProcessorOptions.initSuccessCallback),p||(p={});var v=p.onerror||e.defaultProcessorOptions.onerror,w=(p.moduleFolder||e.defaultProcessorOptions.moduleFolder).replace(/\/$/,"")+"/",B,C=0,b,F,x,_,M=!1,Y=!1,O=!1,U=p.initializerTimeout||3e3,y,I={},R={},N=[];function k($){p.debugLog&&p.debugLog("Started init. condition: "+$),I[$]=1}function L($){I[$]&&(delete I[$],p.debugLog&&p.debugLog("Completed init. condition: "+$),Object.keys(I).length==0&&(Y||(clearTimeout(y),Y=!0,O=!1,f({name:"ProcessorReady",message:"Processor is ready for action",inputSampleRate:B,targetSampleRate:p.targetSampleRate||B,sourceInfo:R,modulesInfo:N}))))}function G(){clearTimeout(y),Y=!1,O=!1,I={},k("sourceSetup"),k("modulesSetup")}function D($){G(),g($)}G(),O=!0,y=setTimeout(function(){D({message:"Initialization took too long! If you expect long running init. process use option 'initializerTimeout' (ms).",name:"ProcessorInitTimeout"})},U);async function E($,ce){if(b&&$&&(b.state!="closed"&&await b.close(),b=null),!b||b.state=="closed")if(b=e.createAudioContext(p,ce),p.startSuspended==null||p.startSuspended){try{await b.resume()}catch{}await b.suspend()}else await b.resume();return b}async function z(){if(p.modules)for(let $=0;$2)throw{name:"PreLoadError",message:"Missing 'path' (url) or unsupported type (use 1=text or 2=arraybuffer)"};le==1?_e=await A(te):le==2&&(_e=await l(te)),typeof se=="function"&&(_e=se(_e)),W[S]=_e,o[Ue]=_e}catch(Te){throw{name:"AddModuleError",message:"Failed to pre-load data: "+S+" - name: "+ye,info:Te}}}))}catch(S){D(S);return}var ie=be.options||{};ie.preLoadResults=W;var ae;function me(S){if(!(!S||S.data==null))if(S.data.moduleState==1)ae.isReady=!0,L("module-"+q),S.data.moduleInfo&&(ae.moduleInfo=S.data.moduleInfo),P[q]={moduleName:ae.moduleName,moduleInfo:ae.moduleInfo},--fe==0&&ge(P);else if(S.data.moduleState==9&&!ae.isTerminated){if(typeof ae.terminate=="function")try{ae.isTerminated=!0,ae.terminate()}catch(Z){ae.isTerminated=!0,J({name:"TerminateError",message:"Failed to terminate module",info:Z})}}else S.data.moduleState==10?(S.data.error.target=S.target,J(S.data.error)):S.data.moduleResponse||be.sendToModules&&(S.data.moduleEvent?be.sendToModules.forEach(function(Z){$[Z]&&!$[Z].ignoreSendToModules&&$[Z].sendToModule({ctrl:{action:"handle",data:S.data}})}):be.sendToModules.forEach(function(Z){$[Z]&&!$[Z].ignoreSendToModules&&$[Z].sendToModule({ctrl:{action:"process",data:S.data}})}));be.onmessage&&be.onmessage(S.data,$)}function J(S){var Z;S.message&&S.message.indexOf("Uncaught {")==0?(S.preventDefault(),Z=JSON.parse(S.message.replace(/^Uncaught /,"")),S.message=Z):Z=S,v({name:"AudioModuleProcessorException",message:"Error in module: "+S.target.moduleName+" - "+(Z&&Z.message?Z.message:"Check console for details."),module:S.target.moduleName,info:Z}),O&&!Y&&D({message:"Error during setup of module: "+ae.moduleName,name:"ProcessorInitError",info:Z}),be.onerror&&be.onerror(S)}if(oe==1){if(!ce){D({name:"AddModuleError",message:"Source does not support 'AudioWorkletProcessor' (use only workers instead) - name: "+ye});return}ie.processorOptions||(ie.processorOptions=ie.setup||{}),ie.processorOptions.ctxInfo||(ie.processorOptions.ctxInfo={sampleRate:b.sampleRate,targetSampleRate:p.targetSampleRate}),ae=new AudioWorkletNode(b,ye,ie),ae.isReady=!1,ae.moduleName=ye,ae.port.onmessage=me,ae.onprocessorerror=J,ae.sendToModule=function(S){ae.isReady?ae.port.postMessage(S):v({name:"AudioModuleProcessorException",message:"'sendToModule' was called before module was actually ready. Consider 'startSuspended' option maybe.'",module:ae.moduleName})}}else if(oe==2)ie.setup||(ie.setup={}),ie.setup.ctxInfo||(ie.setup.ctxInfo={sampleRate:b.sampleRate,targetSampleRate:p.targetSampleRate}),ye.includes("webrtc-vad")?ae=tye():ye.includes("stt-socket")&&(ae=nye()),ae.isReady=!1,ae.moduleName=ye,ae.onmessage=me,ae.onerror=J,ae.sendToModule=function(S){ae.isReady||S&&S.ctrl&&S.ctrl.action=="construct"?ae.postMessage(S):v({name:"AudioModuleProcessorException",message:"'sendToModule' was called before module was actually ready. Consider 'startSuspended' option maybe.",module:ae.moduleName})},ae.sendToModule({ctrl:{action:"construct",options:ie}});else if(oe==3){D({name:"AddModuleError",message:"ScriptProcessor nodes are currently not supported as modules (only source)."});return}else if(oe==4){D({name:"AddModuleError",message:"AudioNodes are currently not supported as modules (you can use them as custom source)."});return}else{D({name:"AddModuleError",message:"Unknown module type."});return}if(ae.moduleType=oe,ae.ignoreSendToModules=!1,ae.deactivate=function(){ae.ignoreSendToModules=!0,M&&(ae.sendToModule({ctrl:{action:"stop"}}),ae.sendToModule({ctrl:{action:"reset"}}))},ae.activate=function(){ae.ignoreSendToModules=!1,M&&ae.sendToModule({ctrl:{action:"start"}})},ue.handle=ae,!ce&&q==0){var Q=$[0];if(!Q.onmessage){D({name:"AddModuleError",message:"If source is not compatible to 'AudioWorklet' it has to have a 'onmessage' event to get the processed data."});return}Q.onmessage=function(S){!S||S.data==null||(S.data.moduleEvent||S.data.sourceEvent?ae.sendToModule({ctrl:{action:"handle",data:S.data}}):ae.sendToModule({ctrl:{action:"process",data:S.data}}))}}$[Fe+q]=ae})}else ge([])}function Ae($,ce,ge){B=b.sampleRate,ge||(ge={}),p.targetSampleRate&&p.targetSampleRate!=B&&(e.isNativeStreamResamplingSupported=!1,C=B-p.targetSampleRate);var Fe=[$],P=[],fe=!0;ge.hasWorkletSupport!=null?fe=ge.hasWorkletSupport:ge.type=="scriptProcessor"&&(fe=!1),de(Fe,fe,function(q){N=q,L("modulesSetup"),m.processNodes=Fe;let K=!1;if(Fe.forEach(function(oe,ye){fe&&(!oe.moduleType||oe.moduleType==1)&&P.push(oe),oe.moduleInfo&&oe.moduleInfo.resamplingMode&&(K=!0)}),C&&!K){D({message:"Samplerate mismatch and no resampler found!",name:"ProcessorInitError"});return}});var ue=p.destinationNode||b.destination;m.mainAudioContext=b,m.source=$,m.sourceInfo=ge,R=ge,ce||(ce={}),F=function(q,K){Promise.resolve((ce.onBeforeStart||d)()).then(function(){return b.resume()}).then(function(){if(P.length>1){for(var oe=1;oe1)return v({message:"Sorry, but this recorder only supports MONO audio at the moment.",name:"NotSupportedError"});var C=g.mimeType||e.defaultMimeTypesForCodecs[g.codec]||e.defaultMimeTypesForCodecs.webm_ogg_opus,b=g.sampleTime||(g.chunkSize?Math.floor(1e3/w*g.chunkSize):0);if(b&&g.decodeToAudioBuffer&&console.error("WARNING: Partial decoding is not supported at the moment! It is possible but requires adding custom headers for each blob!"),window.MediaRecorder)if(MediaRecorder.isTypeSupported(C)){var F=new MediaRecorder(p,{mimeType:C,bitsPerSecond:w*2*B}),x,_,M=!1;F.onerror=g.onerror||console.error,g.onstart&&(F.onstart=g.onstart),g.onpause&&(F.onpause=g.onpause),g.onresume&&(F.onresume=g.onresume);var Y=g.onstop;F.onstop=function(R){Y&&!g.decodeToAudioBuffer&&Y()};var O=g.ondataavailable||g.onprocess;g.decodeToAudioBuffer?O&&(F.ondataavailable=function(R){if(F.state=="inactive"&&(M=!0),R&&R.data){let N=Date.now();e.offlineAudioContextBlobDecoder(w,B,R.data,function(k){k&&O({data:k.getChannelData(0),decodeTime:Date.now()-N}),!M&&g.recordLimitMs&&Date.now()-x>=g.recordLimitMs?y():M&&Y&&Y()})}}):O&&(F.ondataavailable=function(R){O(R),g.recordLimitMs&&Date.now()-x>=g.recordLimitMs&&y()});var U,y=function(){U&&clearTimeout(U),_=Date.now(),F.state!="inactive"&&F.stop()},I=function(){x=Date.now(),_=void 0,M=!1,b?F.start(b):(F.start(),g.recordLimitMs&&(U=setTimeout(y,g.recordLimitMs)))};return m({getMediaRecorder:function(){return F},mimeType:C,sourceInfo:f,sampleTime:b,start:I,stop:y})}else return v({message:"MIME-Type '"+C+"' is not supported!",name:"NotSupportedError"});else return v({message:"'MediaRecorder' is not available!",name:"NotSupportedError"})}catch(R){return console.error("AudioRecorder",R),v(R)}})()})},e.offlineAudioContextBlobDecoder=function(p,f,g,m){a(g,function(v){if(!v)m();else{var w=new OfflineAudioContext(f,v.byteLength,p);w.decodeAudioData(v,function(B){m(B)},function(B){console.error("offlineAudioContext.decodeAudioData ERROR",B),m()})}})};function a(p,f){if(!p||!p.size)f();else if(typeof p.arrayBuffer=="function")p.arrayBuffer().then(function(m){f(m)}).catch(function(m){console.error("blobToArray '.arrayBuffer' ERROR",m),f()});else{var g=new FileReader;g.onload=function(){f(g.result)},g.onerror=function(m){console.error("blobToArray 'FileReader' ERROR",reader.error,m),f()},g.readAsArrayBuffer(p)}}e.blobToArray=a,e.createLegacyMicrophoneScriptProcessor=function(p){return p||(p={}),e.getMicrophone(p,void 0).then(function(f){var g=f.source,m=g.context,v=m.sampleRate,w=p.bufferSize||2048,B=1,C=m.createScriptProcessor(w,B,B);g.connect(C);var b={node:C,type:"scriptProcessor",typeData:f.info,hasWorkletSupport:!1,start:function(){f.controls.onAfterStart&&f.controls.onAfterStart()},stop:function(){f.controls.onBeforeStop&&f.controls.onBeforeStop()},release:function(){f.controls.onAfterRelease&&f.controls.onAfterRelease()}};if(f.controls&&(f.controls.onBeforeStart&&(b.beforeStart=f.controls.onBeforeStart),f.controls.onAfterStop&&(b.afterStop=f.controls.onAfterStop),f.controls.onBeforeRelease&&(b.beforeRelease=f.controls.onBeforeRelease)),p.onaudioprocess)C.onaudioprocess=p.onaudioprocess;else{let F=function(x){if(x&&x.inputBuffer){var _=[x.inputBuffer.getChannelData(0)];C.onmessage({data:{samples:_,sampleRate:v,channels:B,type:_[0].constructor.name}})}};C.onaudioprocess=function(x){F(x)},C.onmessage=p.onmessage||function(x){}}return b})},e.createWhiteNoiseGeneratorNode=function(p,f,g){f||(f={});var m=e.defaultProcessorOptions.moduleFolder.replace(/\/$/,"")+"/";return new Promise(function(v,w){(async function(){try{var B=e.createAudioContext(f);try{await B.resume()}catch{}await B.suspend();var C=m+"white-noise-generator.js";await B.audioWorklet.addModule(C);var b=new AudioWorkletNode(B,"white-noise-generator",{processorOptions:{gain:p||.1}});g&&(b.port.onmessage=g),v(b)}catch(F){return w(F)}})()})},e.createFileSource=function(p,f,g,m){return f||(f={}),new Promise(function(v,w){try{let B=function(b){w(b)},C=function(b){e.createAudioBufferSource(b,f,g,m).then(function(F){F.typeData={fileUrl:p},v(F)}).catch(B)};e.readFileAsBuffer(p,C,B)}catch(B){w(B)}})},e.createAudioBufferSource=function(p,f,g,m){return f||(f={}),new Promise(function(v,w){(async function(){try{var B=e.createAudioContext(f);try{await B.resume()}catch{}await B.suspend();var C=B.createBufferSource();B.decodeAudioData(p,function(b){return C.buffer=b,C.loop=g??!0,m&&(C.onended=m),v({node:C,type:"fileAudioBuffer",typeData:{},start:function(){C.start()},stop:function(){C.stop()},release:function(){}})},function(b){return w(b)})}catch(b){return w(b)}})()})},e.createSourceAudioPlayer=function(p,f,g,m,v){f||(f={}),f.modules=g||[],f.customSource=p,f.startSuspended==null&&(f.startSuspended=!0);var w=new e.Processor(f,m,v);return w},e.encodeWaveBuffer=function(p,f,g,m,v,w){var B=e.defaultProcessorOptions.moduleFolder.replace(/\/$/,"")+"/",C=new Worker(B+"wave-encoder-worker.js");v||(v=console.log),w||(w=console.error);var b={setup:{inputSampleRate:f,inputSampleSize:p.length,lookbackBufferMs:0}};C.onmessage=function(F){F.data.moduleState==1?C.postMessage({encode:{format:"wave",data:{samples:[p],sampleRate:f,channels:g,isFloat32:m}}}):F.data.encoderResult&&(C.terminate(),F.data.error?w({name:"EncoderError",message:F.data.error}):v(F.data.encoderResult))},C.onerror=function(F){C.terminate(),w(F)},C.postMessage({ctrl:{action:"construct",options:b}})},e.decodeAudioFile=function(p,f,g,m,v){e.readFileAsBuffer(p,function(w){var B=new OfflineAudioContext(g,w.byteLength,f);B.decodeAudioData(w,function(C){m(C)},function(C){v(C)})},function(w){v(w)})},e.decodeAudioFileToInt16Mono=function(p,f,g,m){var v=1;e.decodeAudioFile(p,f,v,function(w){var B=!0;e.encodeWaveBuffer(w.getChannelData(0),f,v,B,function(C){try{var b=new Int16Array(C.wav.buffer);g(b)}catch(F){m(F)}},m)},m)},e.resampleBufferViaSpeex=function(p,f,g,m,v,w,B){w||(w=console.log),B||(B=console.error);try{var C=new OfflineAudioContext(m,p.length,f),b=e.defaultProcessorOptions.moduleFolder.replace(/\/$/,"")+"/",F="speex-resample-switch";C.audioWorklet.addModule(b+F+".js").then(function(){var x={processorOptions:{ctxInfo:{sampleRate:f},targetSampleRate:g,resampleQuality:v,bufferSize:p.length}},_=new AudioWorkletNode(C,F,x);_.port.onmessage=function(M){M.data.moduleState==1?_.port.postMessage({resample:{samples:[p],isInt16:!0}}):M.data.resampleResult&&(C=null,M.data.error?B({name:"ResampleError",message:M.data.error}):w(M.data.resampleResult))},_.onprocessorerror=function(M){C=null,B(M)}})}catch(x){B(x)}},e.readFileAsBuffer=function(p,f,g){dl&&dl.files?dl.files.fetch(p,f,g,"arraybuffer",e.contentFetchTimeout):c("arraybuffer",p,f,g)},e.readFileAsText=function(p,f,g){dl&&dl.files?dl.files.fetch(p,f,g,void 0,e.contentFetchTimeout):c("text",p,f,g)};function l(p){return new Promise(function(f,g){e.readFileAsBuffer(p,function(m){f(m)},function(m){g(m)})})}function A(p){return new Promise(function(f,g){e.readFileAsText(p,function(m){f(m)},function(m){g(m)})})}function c(p,f,g,m){var v=new XMLHttpRequest;v.open("GET",f),v.responseType=p,v.timeout=e.contentFetchTimeout,v.onload=function(w){v.status>=200&&v.status<300?g(v.response):m({status:v.status,message:v.statusText})},v.onerror=function(w){m(w)},v.ontimeout=function(w){m(w)},v.send()}function u(p){try{for(var f=atob(p),g=new Uint8Array(f.length),m=0;m1&&console.error("SepiaVoiceRecorder.decodeAudioFileToInt16Mono - Channels > 1 not supported. Result will only contain data of channel 0."),g||(g=console.log),m||(m=console.error),SepiaFW.webAudio.decodeAudioFileToInt16Mono(d,p,g,m)},n.addAudioElementToPage=function(d,p,f){return SepiaFW.webAudio.addAudioElementToPage(d,p,f)},window.SepiaVoiceRecorder=n})();class iye{constructor(e,t){it(this,"volumeThresholds",[.05,10]);it(this,"gain",1);it(this,"isLoading",!1);it(this,"isRecording",!1);it(this,"isWaitingForFinalResult",!1);it(this,"waitingForFinalResultTimer");it(this,"waitingForFinalResultDelay",4e3);it(this,"asrStreaming",!1);it(this,"sourceInfo","-?-");if(window.SepiaFW&&(SepiaFW.webAudio.defaultProcessorOptions.moduleFolder="lib"),!window.SepiaVoiceRecorder)SepiaVoiceRecorder={notSupported:!0},console.error("SEPIA Web Audio Library not found or not supported (IE11?)!");else{this.sepiaSpeechRecognition=e,this.sepiaSpeechRecognitionConfig=t;const r=this;SepiaVoiceRecorder.onProcessorReady=function(i){console.log("SepiaVoiceRecorder - onProcessorReady",i),this.sourceInfo="Sample-rate: "+i.targetSampleRate+"Hz (factor: "+i.inputSampleRate/i.targetSampleRate+`) Device Label: -`+(i.sourceInfo?i.sourceInfo.label:""),console.log(this.sourceInfo),r.isLoading=!1,r.isRecording=!1,r.isWaitingForFinalResult=!1,SepiaVoiceRecorder.start()},SepiaVoiceRecorder.onConnected=function(i){i&&i.model&&(console.log("INFO - connected - ASR active model: "+i.model),e._dispatchEvent(new Event("start")))},SepiaVoiceRecorder.onDisconnected=function(){e._dispatchEvent(new Event("end"))},SepiaVoiceRecorder.onProcessorInitError=function(i){r.onMicError();const s=new Uh;switch(s.message=i.message,i.name){case"NotAllowedError":s.error=eg.NOTALLOWED,s._dispatch(e);break;default:console.log(i);break}location.protocol=="http:"&&!location.origin.indexOf("http://localhost")==0&&console.error("Init. ERROR - Likely because of insecure origin (no HTTPS or localhost)")},SepiaVoiceRecorder.onProcessorError=function(i){console.error("SepiaVoiceRecorder - onProcessorError",i),r.onMicError(),console.log("ERROR - onProcessorError: "+i.name)},SepiaVoiceRecorder.onAudioStart=function(i){e._dispatchEvent(new Event("audiostart")),r.isRecording=!0},SepiaVoiceRecorder.onAudioEnd=function(i){e._dispatchEvent(new Event("audioend")),r.isRecording=!1,r.isWaitingForFinalResult&&(clearTimeout(r.waitingForFinalResultTimer),r.waitingForFinalResultTimer=setTimeout(function(){r.isWaitingForFinalResult=!1},r.waitingForFinalResultDelay)),console.log("Microphone is CLOSED")},SepiaVoiceRecorder.onProcessorRelease=function(i){console.log("SepiaVoiceRecorder - onProcessorRelease"),r.isRecording=!1,r.isLoading=!1,r.isWaitingForFinalResult=!1},SepiaVoiceRecorder.onDebugLog=function(i){},SepiaVoiceRecorder.onResamplerData=function(i){},SepiaVoiceRecorder.onSpeechRecognitionStateChange=function(i){i.state=="onStreamStart"?(r.asrStreaming,r.asrStreaming=!0):i.state=="onStreamEnd"&&(r.asrStreaming&&(i.bufferOrTimeLimit===!0&&console.log("Speech Recognition - Stopped streaming due to buffer- or time-limit"),r.isRecording?SepiaVoiceRecorder.stop():r.isWaitingForFinalResult&&(clearTimeout(r.waitingForFinalResultTimer),r.waitingForFinalResultTimer=setTimeout(function(){r.isWaitingForFinalResult=!1},r.waitingForFinalResultDelay))),r.asrStreaming=!1)},SepiaVoiceRecorder.onSpeechRecognitionEvent=function(i){if(i.type=="result"){if(!r.isRecording&&!r.isWaitingForFinalResult)return;const s=new Kve;s.transcript=i.transcript,s.confidence=i.confidence;const o=new $ve([s]);if(i.isFinal){r.isWaitingForFinalResult&&!r.isRecording&&clearTimeout(r.waitingForFinalResultTimer),o.isFinal=!0;const a=new Q_([o]),l=new iC(a);if(i.transcript)l._dispatch(e,"result");else{const A=new Uh;A.error=eg.NOSPEECH,A.message="No speech was detected.",A._dispatch(e)}r.isWaitingForFinalResult=!1}else{o.isFinal=!1;const a=new Q_([o]),l=new iC(a);i.transcript?l._dispatch(e,"result"):l._dispatch(e,"nomatch"),r.isWaitingForFinalResult=!0}}else if(i.type=="error"){const s=new Uh;if(s.message=i.message,i.name&&i.message)switch(i.name){case"SocketConnectionError":s.error=eg.NETWORK,s._dispatch(e);break;case"Error":i.message==="ChunkProcessorError failed to load."&&(s.error=eg.SERVICENOTALLOWED,s.message="You are likely unauthorized to access this SEPIA STT server.",s._dispatch(e));break;default:console.log(i);break}else console.error("Speech Recognition Error:",i)}else console.log("Speech Recognition - Event: "+i.type)},SepiaVoiceRecorder.onWaveEncoderAudioData=function(i){},SepiaVoiceRecorder.onVadStateChange=function(i,s){switch(i){case"vaup":e._dispatchEvent(new Event("soundstart"));break;case"vadown":e._dispatchEvent(new Event("soundend"));break;case"speechstart":e._dispatchEvent(new Event("speechstart"));break;case"speechend":e._dispatchEvent(new Event("speechend"));break}}}}toggleMic(){const e=this.sepiaSpeechRecognition.lang.split("-")[0];if(BA.language!=this.sepiaSpeechRecognition.lang&&BA.language!=e){const r=new Uh;r.error=eg.LANGUAGENOTSUPPORTED,r.message="The specified SEPIA STT server does not support the language specified by the user agent.",r._dispatch(this.sepiaSpeechRecognition);return}const t=this;!this.isLoading&&!this.isRecording&&!this.isWaitingForFinalResult?(this.isLoading=!0,SepiaVoiceRecorder.stopAndReleaseIfActive(function(){SepiaFW.webAudio.tryNativeStreamResampling=!1;const r={language:t.sepiaSpeechRecognition.lang,continuous:t.sepiaSpeechRecognition.continuous,messageFormat:"default"};var i=Object.assign(t.sepiaSpeechRecognitionConfig,r);console.log(i),SepiaVoiceRecorder.create({gain:t.gain,asr:i,vad:!0})})):this.isRecording?SepiaVoiceRecorder.stop():(this.isLoading||this.isWaitingForFinalResult)&&SepiaVoiceRecorder.stopAndReleaseIfActive(function(){t.isLoading=!1,t.isRecording=!1,t.isWaitingForFinalResult=!1})}releaseMic(e){SepiaVoiceRecorder.stopAndReleaseIfActive(function(){this.isLoading=!1,this.isRecording=!1,this.isWaitingForFinalResult=!1,e&&e()})}onMicError(){this.isRecording=!1,this.isWaitingForFinalResult=!1,this.isLoading=!1}}class DL{constructor(){it(this,"src","");it(this,"weight",1)}}var ru,wC,WH;class sye{constructor(){Xu(this,wC);Xu(this,ru,[]);it(this,"length",0);it(this,"addFromURI",(e,t=1)=>{const r=new DL;fetch(e).then(i=>{i.text().then(s=>{r.src=s,r.weight=t,Fs(this,ru).push(r)})}).catch(i=>{console.log("Failed to add SpeechGrammar from URI: ",i)})});it(this,"addFromString",(e,t=1)=>{const r=new DL;r.src=e,r.weight=t,Fs(this,ru).push(r)});return new Proxy(this,{get:(e,t)=>{var r;if(t==="addFromString"||t==="addFromURI")return function(){return e[t].apply(e,arguments)};if(typeof+t=="number")return pR(r=e,wC,WH).call(r,t);if(t==="length")return Fs(e,ru).length}})}}ru=new WeakMap,wC=new WeakSet,WH=function(e){return Fs(this,ru)[e]};let GH={};const oye=n=>(GH=n,aye);var ef;class aye{constructor(){Xu(this,ef,new iye(this,GH));it(this,"grammars",new sye);it(this,"lang",document.documentElement.lang||navigator.language);it(this,"continuous",!1);it(this,"interimResults",!1);it(this,"maxAlternatives",1);it(this,"start",()=>{Fs(this,ef).toggleMic()});it(this,"stop",()=>{Fs(this,ef).toggleMic()});it(this,"abort",()=>{Fs(this,ef).toggleMic()});it(this,"onaudiostart",e=>{});it(this,"onsoundstart",e=>{});it(this,"onspeechstart",e=>{});it(this,"onspeechend",e=>{});it(this,"onsoundend",e=>{});it(this,"onaudioend",e=>{});it(this,"onresult",e=>{});it(this,"onnomatch",e=>{});it(this,"onerror",e=>{});it(this,"onstart",e=>{});it(this,"onend",e=>{});it(this,"_eventCallbacks",new Map);it(this,"_dispatchEvent",e=>{const t=this._eventCallbacks.get(e.type);t&&t.forEach(r=>r(e)),this[`on${e.type}`](e)});it(this,"addEventListener",(e,t)=>{this._eventCallbacks.has(e)?this._eventCallbacks.get(e).push(t):this._eventCallbacks.set(e,[t])});it(this,"removeEventListener",(e,t)=>{if(this._eventCallbacks.has(e)){const r=this._eventCallbacks.get(e);r.includes(t)&&r.splice(r.indexOf(t),1)}});jve()}}ef=new WeakMap;class lye{constructor(){it(this,"serverUrl","http://localhost:20741");it(this,"clientId","any");it(this,"accessToken","test1234");it(this,"task","assistant");it(this,"model","");it(this,"optimizeFinalResult",!0);it(this,"engineOptions",{})}}const Aye=2e4;async function cye(n){let e=0;const t=[];for(let r=n.length-1;r>=0;r--){const i=n[r],s=`${i==null?void 0:i.name}: ${i==null?void 0:i.message}`;if(e+=s.length,e{const{timestamp:e,name:t,message:r,type:i,color:s,err:o}=n;let a=new Date(e);const l=a.getHours()<10?"0"+a.getHours():a.getHours(),A=a.getMinutes()<10?"0"+a.getMinutes():a.getMinutes(),c=`${l}:${A}`;return L.jsxs("div",{className:`${tg.message} ${i&&tg.speaker}`,children:[L.jsxs("div",{className:tg.name,style:i?{}:{color:s},children:[t,", ",L.jsx("span",{children:c})]}),L.jsxs("div",{className:tg["chat-bubble"],style:o?{color:"#7a7a7a"}:{},children:[L.jsx("div",{className:tg.colorBg,style:i?{}:{backgroundColor:s}}),r+(o?" ( Not sent )":"")]})]})},gye=De.sessionId??Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);De.sessionId=gye;const mye=new lye,vye="Speaker",yye=window.webkitSpeechRecognition||oye(mye),wye=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Bye=["January","February","March","April","May","June","July","August","September","October","November","December"];function Cye({templateInfo:n,micEnabled:e,setMicEnabled:t,speechRecognition:r,setSpeechRecognition:i}){const[s,o]=X.useState(!1),{t:a}=Be.useContext(xs),[l]=X.useState(De[`${n.id}_fulBio`]),[A]=X.useState(De[`${n.id}_fulBio`].colorKey?MI[De[`${n.id}_fulBio`].colorKey].fontColor:MI[Object.keys(MI)[0]].fontColor),[c,u]=X.useState(De.speaker||vye);Be.useEffect(()=>{De.speaker=c},[c]);const[h,d]=X.useState(""),[p,f]=X.useState([]),g=async b=>{b.preventDefault(),d(b.target.value)};X.useEffect(()=>{const b=document.querySelector("#msgscroll");b.scrollTo(0,b.scrollHeight)},[p]),Be.useEffect(()=>{const b=F=>{F.ctrlKey&&F.key==="c"&&f([])};return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b)}},[]);const m=()=>{r.start(),t(!0)},v=()=>{r.stop(),t(!1)};Be.useEffect(()=>{s||document.getElementById("messageInput").focus()},[s]);const w=async b=>{if(b.preventDefault&&b.preventDefault(),v(),!s){const x=b.target.elements.message.value;B(x)}},B=async b=>{if(b&&b!==""&&!s){o(!0);const F=l.name;d("");const x={name:c,message:b,timestamp:Date.now(),type:1};f(M=>[...M,x]);const _=await cye(p);if(_.push(`${c}: ${b}`),b.replaceAll(" ","")===""){const M=pfe(ffe(Dve)),Y={name:F,message:M,timestamp:Date.now(),type:0};f(O=>[...O,Y]),o(!1)}else try{const M=new Date,Y=`${wye[M.getDay()]}, ${Bye[M.getMonth()]} ${M.getDate()}, ${1900+M.getYear()}`,O=`${M.getHours()}:${M.getMinutes()} `,U="https://upstreet.webaverse.com/api/ai",I={prompt:`The following is part of a conversation between ${c} and ${F}. ${F} is descriptive and helpful, and is honest when it doesn't know an answer. Included is a context which acts a short-term memory, used to guide the conversation and track topics. +`+(i.sourceInfo?i.sourceInfo.label:""),console.log(this.sourceInfo),r.isLoading=!1,r.isRecording=!1,r.isWaitingForFinalResult=!1,SepiaVoiceRecorder.start()},SepiaVoiceRecorder.onConnected=function(i){i&&i.model&&(console.log("INFO - connected - ASR active model: "+i.model),e._dispatchEvent(new Event("start")))},SepiaVoiceRecorder.onDisconnected=function(){e._dispatchEvent(new Event("end"))},SepiaVoiceRecorder.onProcessorInitError=function(i){r.onMicError();const s=new Uh;switch(s.message=i.message,i.name){case"NotAllowedError":s.error=eg.NOTALLOWED,s._dispatch(e);break;default:console.log(i);break}location.protocol=="http:"&&!location.origin.indexOf("http://localhost")==0&&console.error("Init. ERROR - Likely because of insecure origin (no HTTPS or localhost)")},SepiaVoiceRecorder.onProcessorError=function(i){console.error("SepiaVoiceRecorder - onProcessorError",i),r.onMicError(),console.log("ERROR - onProcessorError: "+i.name)},SepiaVoiceRecorder.onAudioStart=function(i){e._dispatchEvent(new Event("audiostart")),r.isRecording=!0},SepiaVoiceRecorder.onAudioEnd=function(i){e._dispatchEvent(new Event("audioend")),r.isRecording=!1,r.isWaitingForFinalResult&&(clearTimeout(r.waitingForFinalResultTimer),r.waitingForFinalResultTimer=setTimeout(function(){r.isWaitingForFinalResult=!1},r.waitingForFinalResultDelay)),console.log("Microphone is CLOSED")},SepiaVoiceRecorder.onProcessorRelease=function(i){console.log("SepiaVoiceRecorder - onProcessorRelease"),r.isRecording=!1,r.isLoading=!1,r.isWaitingForFinalResult=!1},SepiaVoiceRecorder.onDebugLog=function(i){},SepiaVoiceRecorder.onResamplerData=function(i){},SepiaVoiceRecorder.onSpeechRecognitionStateChange=function(i){i.state=="onStreamStart"?(r.asrStreaming,r.asrStreaming=!0):i.state=="onStreamEnd"&&(r.asrStreaming&&(i.bufferOrTimeLimit===!0&&console.log("Speech Recognition - Stopped streaming due to buffer- or time-limit"),r.isRecording?SepiaVoiceRecorder.stop():r.isWaitingForFinalResult&&(clearTimeout(r.waitingForFinalResultTimer),r.waitingForFinalResultTimer=setTimeout(function(){r.isWaitingForFinalResult=!1},r.waitingForFinalResultDelay))),r.asrStreaming=!1)},SepiaVoiceRecorder.onSpeechRecognitionEvent=function(i){if(i.type=="result"){if(!r.isRecording&&!r.isWaitingForFinalResult)return;const s=new Kve;s.transcript=i.transcript,s.confidence=i.confidence;const o=new $ve([s]);if(i.isFinal){r.isWaitingForFinalResult&&!r.isRecording&&clearTimeout(r.waitingForFinalResultTimer),o.isFinal=!0;const a=new Q_([o]),l=new iC(a);if(i.transcript)l._dispatch(e,"result");else{const A=new Uh;A.error=eg.NOSPEECH,A.message="No speech was detected.",A._dispatch(e)}r.isWaitingForFinalResult=!1}else{o.isFinal=!1;const a=new Q_([o]),l=new iC(a);i.transcript?l._dispatch(e,"result"):l._dispatch(e,"nomatch"),r.isWaitingForFinalResult=!0}}else if(i.type=="error"){const s=new Uh;if(s.message=i.message,i.name&&i.message)switch(i.name){case"SocketConnectionError":s.error=eg.NETWORK,s._dispatch(e);break;case"Error":i.message==="ChunkProcessorError failed to load."&&(s.error=eg.SERVICENOTALLOWED,s.message="You are likely unauthorized to access this SEPIA STT server.",s._dispatch(e));break;default:console.log(i);break}else console.error("Speech Recognition Error:",i)}else console.log("Speech Recognition - Event: "+i.type)},SepiaVoiceRecorder.onWaveEncoderAudioData=function(i){},SepiaVoiceRecorder.onVadStateChange=function(i,s){switch(i){case"vaup":e._dispatchEvent(new Event("soundstart"));break;case"vadown":e._dispatchEvent(new Event("soundend"));break;case"speechstart":e._dispatchEvent(new Event("speechstart"));break;case"speechend":e._dispatchEvent(new Event("speechend"));break}}}}toggleMic(){const e=this.sepiaSpeechRecognition.lang.split("-")[0];if(BA.language!=this.sepiaSpeechRecognition.lang&&BA.language!=e){const r=new Uh;r.error=eg.LANGUAGENOTSUPPORTED,r.message="The specified SEPIA STT server does not support the language specified by the user agent.",r._dispatch(this.sepiaSpeechRecognition);return}const t=this;!this.isLoading&&!this.isRecording&&!this.isWaitingForFinalResult?(this.isLoading=!0,SepiaVoiceRecorder.stopAndReleaseIfActive(function(){SepiaFW.webAudio.tryNativeStreamResampling=!1;const r={language:t.sepiaSpeechRecognition.lang,continuous:t.sepiaSpeechRecognition.continuous,messageFormat:"default"};var i=Object.assign(t.sepiaSpeechRecognitionConfig,r);console.log(i),SepiaVoiceRecorder.create({gain:t.gain,asr:i,vad:!0})})):this.isRecording?SepiaVoiceRecorder.stop():(this.isLoading||this.isWaitingForFinalResult)&&SepiaVoiceRecorder.stopAndReleaseIfActive(function(){t.isLoading=!1,t.isRecording=!1,t.isWaitingForFinalResult=!1})}releaseMic(e){SepiaVoiceRecorder.stopAndReleaseIfActive(function(){this.isLoading=!1,this.isRecording=!1,this.isWaitingForFinalResult=!1,e&&e()})}onMicError(){this.isRecording=!1,this.isWaitingForFinalResult=!1,this.isLoading=!1}}class DL{constructor(){it(this,"src","");it(this,"weight",1)}}var ru,wC,WH;class sye{constructor(){Xu(this,wC);Xu(this,ru,[]);it(this,"length",0);it(this,"addFromURI",(e,t=1)=>{const r=new DL;fetch(e).then(i=>{i.text().then(s=>{r.src=s,r.weight=t,Fs(this,ru).push(r)})}).catch(i=>{console.log("Failed to add SpeechGrammar from URI: ",i)})});it(this,"addFromString",(e,t=1)=>{const r=new DL;r.src=e,r.weight=t,Fs(this,ru).push(r)});return new Proxy(this,{get:(e,t)=>{var r;if(t==="addFromString"||t==="addFromURI")return function(){return e[t].apply(e,arguments)};if(typeof+t=="number")return pR(r=e,wC,WH).call(r,t);if(t==="length")return Fs(e,ru).length}})}}ru=new WeakMap,wC=new WeakSet,WH=function(e){return Fs(this,ru)[e]};let GH={};const oye=n=>(GH=n,aye);var ef;class aye{constructor(){Xu(this,ef,new iye(this,GH));it(this,"grammars",new sye);it(this,"lang",document.documentElement.lang||navigator.language);it(this,"continuous",!1);it(this,"interimResults",!1);it(this,"maxAlternatives",1);it(this,"start",()=>{Fs(this,ef).toggleMic()});it(this,"stop",()=>{Fs(this,ef).toggleMic()});it(this,"abort",()=>{Fs(this,ef).toggleMic()});it(this,"onaudiostart",e=>{});it(this,"onsoundstart",e=>{});it(this,"onspeechstart",e=>{});it(this,"onspeechend",e=>{});it(this,"onsoundend",e=>{});it(this,"onaudioend",e=>{});it(this,"onresult",e=>{});it(this,"onnomatch",e=>{});it(this,"onerror",e=>{});it(this,"onstart",e=>{});it(this,"onend",e=>{});it(this,"_eventCallbacks",new Map);it(this,"_dispatchEvent",e=>{const t=this._eventCallbacks.get(e.type);t&&t.forEach(r=>r(e)),this[`on${e.type}`](e)});it(this,"addEventListener",(e,t)=>{this._eventCallbacks.has(e)?this._eventCallbacks.get(e).push(t):this._eventCallbacks.set(e,[t])});it(this,"removeEventListener",(e,t)=>{if(this._eventCallbacks.has(e)){const r=this._eventCallbacks.get(e);r.includes(t)&&r.splice(r.indexOf(t),1)}});jve()}}ef=new WeakMap;class lye{constructor(){it(this,"serverUrl","http://localhost:20741");it(this,"clientId","any");it(this,"accessToken","test1234");it(this,"task","assistant");it(this,"model","");it(this,"optimizeFinalResult",!0);it(this,"engineOptions",{})}}const Aye=2e4;async function cye(n){let e=0;const t=[];for(let r=n.length-1;r>=0;r--){const i=n[r],s=`${i==null?void 0:i.name}: ${i==null?void 0:i.message}`;if(e+=s.length,e{const{timestamp:e,name:t,message:r,type:i,color:s,err:o}=n;let a=new Date(e);const l=a.getHours()<10?"0"+a.getHours():a.getHours(),A=a.getMinutes()<10?"0"+a.getMinutes():a.getMinutes(),c=`${l}:${A}`;return V.jsxs("div",{className:`${tg.message} ${i&&tg.speaker}`,children:[V.jsxs("div",{className:tg.name,style:i?{}:{color:s},children:[t,", ",V.jsx("span",{children:c})]}),V.jsxs("div",{className:tg["chat-bubble"],style:o?{color:"#7a7a7a"}:{},children:[V.jsx("div",{className:tg.colorBg,style:i?{}:{backgroundColor:s}}),r+(o?" ( Not sent )":"")]})]})},gye=De.sessionId??Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);De.sessionId=gye;const mye=new lye,vye="Speaker",yye=window.webkitSpeechRecognition||oye(mye),wye=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Bye=["January","February","March","April","May","June","July","August","September","October","November","December"];function Cye({templateInfo:n,micEnabled:e,setMicEnabled:t,speechRecognition:r,setSpeechRecognition:i}){const[s,o]=X.useState(!1),{t:a}=Be.useContext(xs),[l]=X.useState(De[`${n.id}_fulBio`]),[A]=X.useState(De[`${n.id}_fulBio`].colorKey?MI[De[`${n.id}_fulBio`].colorKey].fontColor:MI[Object.keys(MI)[0]].fontColor),[c,u]=X.useState(De.speaker||vye);Be.useEffect(()=>{De.speaker=c},[c]);const[h,d]=X.useState(""),[p,f]=X.useState([]),g=async b=>{b.preventDefault(),d(b.target.value)};X.useEffect(()=>{const b=document.querySelector("#msgscroll");b.scrollTo(0,b.scrollHeight)},[p]),Be.useEffect(()=>{const b=F=>{F.ctrlKey&&F.key==="c"&&f([])};return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b)}},[]);const m=()=>{r.start(),t(!0)},v=()=>{r.stop(),t(!1)};Be.useEffect(()=>{s||document.getElementById("messageInput").focus()},[s]);const w=async b=>{if(b.preventDefault&&b.preventDefault(),v(),!s){const x=b.target.elements.message.value;B(x)}},B=async b=>{if(b&&b!==""&&!s){o(!0);const F=l.name;d("");const x={name:c,message:b,timestamp:Date.now(),type:1};f(M=>[...M,x]);const _=await cye(p);if(_.push(`${c}: ${b}`),b.replaceAll(" ","")===""){const M=pfe(ffe(Dve)),Y={name:F,message:M,timestamp:Date.now(),type:0};f(O=>[...O,Y]),o(!1)}else try{const M=new Date,Y=`${wye[M.getDay()]}, ${Bye[M.getMonth()]} ${M.getDate()}, ${1900+M.getYear()}`,O=`${M.getHours()}:${M.getMinutes()} `,U="https://upstreet.webaverse.com/api/ai",I={prompt:`The following is part of a conversation between ${c} and ${F}. ${F} is descriptive and helpful, and is honest when it doesn't know an answer. Included is a context which acts a short-term memory, used to guide the conversation and track topics. CONTEXT: Current Day: ${Y} @@ -4996,8 +4996,8 @@ MOST RECENT MESSAGES: ${_.join(` `)} -${F}:`,max_tokens:250,temperature:.9,top_p:1,frequency_penalty:0,presence_penalty:.6,stop:[c+":",F+":","\\n"]};PH.post(U,I).then(R=>{const N=R.data.choices[0].text,k={name:F,message:N,timestamp:Date.now(),type:0};f(V=>[...V,k]),o(!1)}).catch(R=>{x.error=!0,o(!1),console.error(R)})}catch(M){o(!1),console.error(M)}}};let C=!1;return Be.useEffect(()=>{if(!s){if(r||C)return;C=!0;const b=new yye({});i(b),b.onerror=F=>console.error(F.error,F.message),b.onresult=F=>{const x=F.resultIndex;F.results[x].isFinal&&(B(`${F.results[x][0].transcript}`),o(!0))},b.interimResults=!0,b.continuous=!0}},[]),L.jsxs("div",{className:Ko.chatBox,children:[L.jsxs("div",{className:Ko.speaker,children:[L.jsx("p",{className:Ko.warning,children:a("text.apiUnderMaintnance")}),L.jsx("label",{htmlFor:"speaker",children:a("labels.yourName")}),L.jsx("input",{type:"text",name:"speaker",defaultValue:c,onChange:b=>u(b.target.value)})]}),L.jsx("label",{children:a("labels.conversation")}),L.jsx("div",{className:Ko.messages,children:L.jsx("div",{className:Ko.scrollBox,id:"msgscroll",children:p.map((b,F)=>{if(b.timestamp)return L.jsx(pye,{name:b.name,timestamp:b.timestamp,message:b.message,type:b.type,color:A,err:b.error},F)})})}),L.jsxs("form",{className:Ko.send,style:{opacity:s?"0.4":"1"},onSubmit:w,children:[L.jsx(sn,{type:"icon",theme:"light",icon:"microphone",className:Ko.mic,size:32,active:!!e,onClick:()=>e?v():m()}),L.jsx("input",{autoComplete:"off",type:"text",name:"message",id:"messageInput",value:h,onInput:g,onChange:g,disabled:s}),L.jsx(sn,{theme:"light",text:a("callToAction.send"),size:14,onSubmit:w,className:Ko.sendButton,type:"submit"})]}),L.jsxs("p",{className:`${Ko.isTyping} ${s&&Ko.show}`,children:[L.jsx("span",{style:{color:A},children:l.name})," is typing..."]})]})}function bye(){const{setViewMode:n}=X.useContext(Ci),[e,t]=X.useState(!1),[r,i]=X.useState(!1),{playSound:s}=X.useContext(bs),{isMute:o}=X.useContext(Bs),a=()=>{n(ot.SAVE),!o&&s("backNextButton"),r&&r.stop(),t(!1)},{t:l}=Be.useContext(xs);return L.jsxs("div",{className:Nc.container,children:[L.jsx("div",{className:"sectionTitle",children:l("pageTitles.chat")}),L.jsxs("div",{className:Nc.chatContainer,children:[L.jsx("div",{className:Nc.topLine}),L.jsx("div",{className:Nc.bottomLine}),L.jsx("div",{className:Nc.scrollContainer,children:L.jsx(Cye,{micEnabled:e,setMicEnabled:t,speechRecognition:r,setSpeechRecognition:i})})]}),L.jsx("div",{className:Nc.buttonContainer,children:L.jsx(sn,{theme:"light",text:l("callToAction.back"),size:14,className:Nc.buttonLeft,onClick:a})})]})}const xye="_buttonContainer_1fd4o_1",Iye="_buttonLeft_1fd4o_10",Fye="_buttonRight_1fd4o_14",Eye="_buttonCenter_1fd4o_18",Fy={buttonContainer:xye,buttonLeft:Iye,buttonRight:Fye,buttonCenter:Eye},_ye="_button_13dfi_1",LL={button:_ye},Sye="Anon",Uye=()=>{Be.useContext(xs);const[n]=X.useState(localStorage.getItem("name")||Sye),{model:e,characterManager:t}=Be.useContext(lr),r=()=>{const o=De.mergeOptions_sel_option||0;return{createTextureAtlas:De.mergeOptions_create_atlas==null?!0:De.mergeOptions_create_atlas,mToonAtlasSize:Cn(De.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Cn(De.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Cn(De.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Cn(De.mergeOptions_atlas_std_transp_size||6),ktxCompression:De.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:De.mergeOptions_two_sided_mat||!1}},i=()=>{const o=r();t.downloadVRM(n,o)},s=()=>{const o=r();t.downloadGLB(n,o)};return L.jsxs(X.Fragment,{children:[L.jsx(sn,{theme:"light",text:"GLB",icon:"download",size:14,className:LL.button,onClick:()=>{s()}}),L.jsx(sn,{theme:"light",text:"VRM",icon:"download",size:14,className:LL.button,onClick:i})]})},Qye="_InformationContainerPos_b0msk_1",Rye="_traitInfoTitle_b0msk_13",Mye="_traitInfoText_b0msk_22",Tye="_flexSelect_b0msk_33",Nye="_scrollContainer_b0msk_68",kye="_checked_b0msk_93",Dye="_checkmark_b0msk_97",Lye="_checkboxHolder_b0msk_110",ct={InformationContainerPos:Qye,traitInfoTitle:Rye,traitInfoText:Mye,flexSelect:Tye,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:Nye,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:kye,checkmark:Dye,checkboxHolder:Lye},Vye="_mainTitleWrap_4fb0s_1",Pye="_mainTitle_4fb0s_1",Oye="_topLine_4fb0s_18",NI={mainTitleWrap:Vye,mainTitle:Pye,topLine:Oye};function ka({title:n,width:e,left:t,right:r}){const i={width:e?`${e}px`:null,left:t?`${t}px`:null,right:r?`${r}px`:null};return n&&L.jsxs("div",{className:NI.mainTitleWrap,style:i,children:[L.jsx("div",{className:NI.topLine}),L.jsx("div",{className:NI.mainTitle,children:n})]})}const Wye="_slider_1y6nx_1",Gye="_infoContainer_1y6nx_13",Ey={"slider-container":"_slider-container_1y6nx_1",slider:Wye,infoContainer:Gye,"input-box":"_input-box_1y6nx_18"};function Qh({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:Ey.infoContainer,children:[n,o&&L.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Ey["input-box"],step:o})]}),L.jsx("div",{className:Ey["slider-container"],children:L.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Ey.slider,step:s})})]})}function Ib({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=Be.useState(De.mergeOptions_atlas_std_size||6),[s,o]=Be.useState(De.mergeOptions_atlas_std_transp_size||6),[a,l]=Be.useState(De.mergeOptions_atlas_mtoon_size||6),[A,c]=Be.useState(De.mergeOptions_atlas_mtoon_transp_size||6),[u,h]=Be.useState(De.mergeOptions_sel_option||0),[d,p]=Be.useState(De.mergeOptions_two_sided_mat||!1),[f]=Be.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,m]=Be.useState(De.mergeOptions_download_vrm==null?!0:De.mergeOptions_download_vrm),[v,w]=Be.useState(De.mergeOptions_download_vrm_preview==null?!0:De.mergeOptions_download_vrm_preview),[B,C]=Be.useState(De.mergeOptions_drop_download||!1),[b,F]=Be.useState(De.merge_options_ktx_compression||!1),[x,_]=Be.useState(De.mergeOptions_create_atlas==null?!0:De.mergeOptions_create_atlas),[M,Y]=Be.useState(De.mergeOptions_download_lora==null?!0:De.mergeOptions_download_lora),[O,U]=Be.useState(De.mergeOptions_download_sprites==null?!0:De.mergeOptions_download_sprites),y=T=>{C(T.target.checked),De.mergeOptions_drop_download=T.target.checked},I=T=>{p(T.target.checked),De.mergeOptions_two_sided_mat=T.target.checked},R=T=>{F(T.target.checked),De.merge_options_ktx_compression=T.target.checked},N=T=>{_(T.target.checked),De.mergeOptions_create_atlas=T.target.checked},k=T=>{m(T.target.checked),De.mergeOptions_download_vrm=T.target.checked},V=T=>{w(T.target.checked),De.mergeOptions_download_vrm_preview=T.target.checked},G=T=>{Y(T.target.checked),De.mergeOptions_download_lora=T.target.checked},D=T=>{U(T.target.checked),De.mergeOptions_download_sprites=T.target.checked},E=()=>{let T=u;u<=0?T=f.length-1:T-=1,h(T),De.mergeOptions_sel_option=T},z=()=>{let T=u;u>=f.length-1?T=0:T+=1,h(T),De.mergeOptions_sel_option=T},re=async(T,ee)=>{let pe=parseInt(T.target.value);pe>8?pe=8:pe<0&&(pe=0),(Ae=>{switch(ee){case"standard opaque":i(Ae),De.mergeOptions_atlas_std_size=Ae;break;case"standard transparent":o(Ae),De.mergeOptions_atlas_std_transp_size=Ae;break;case"mtoon opaque":l(Ae),De.mergeOptions_atlas_mtoon_size=Ae;break;case"mtoon transparent":c(Ae),De.mergeOptions_atlas_mtoon_transp_size=Ae;break}})(pe)};return L.jsxs("div",{className:ct.InformationContainerPos,children:[L.jsx(ka,{title:t,width:180,left:20}),L.jsxs("div",{className:ct.scrollContainer,children:[L.jsx("div",{className:ct.traitInfoTitle,children:"Download Options"}),L.jsx(L.Fragment,{children:L.jsx("div",{className:ct.traitInfoText,children:L.jsxs("div",{className:ct.checkboxHolder,children:[L.jsx("div",{}),L.jsxs("label",{className:ct["custom-checkbox"],children:[L.jsx("input",{type:"checkbox",checked:g,onChange:k}),L.jsx("div",{className:ct["checkbox-container"]})]}),L.jsx("div",{}),L.jsx("div",{}),"Download VRM"]})})}),L.jsx(L.Fragment,{children:L.jsx("div",{className:ct.traitInfoText,children:L.jsxs("div",{className:ct.checkboxHolder,children:[L.jsx("div",{}),L.jsxs("label",{className:ct["custom-checkbox"],children:[L.jsx("input",{type:"checkbox",checked:v,onChange:V}),L.jsx("div",{className:ct["checkbox-container"]})]}),L.jsx("div",{}),L.jsx("div",{}),"Download VRM Preview"]})})}),L.jsx(L.Fragment,{children:L.jsx("div",{className:ct.traitInfoText,children:L.jsxs("div",{className:ct.checkboxHolder,children:[L.jsx("div",{}),L.jsxs("label",{className:ct["custom-checkbox"],children:[L.jsx("input",{type:"checkbox",checked:M,onChange:G}),L.jsx("div",{className:ct["checkbox-container"]})]}),L.jsx("div",{}),L.jsx("div",{}),"Download Lora Data"]})})}),L.jsx(L.Fragment,{children:L.jsx("div",{className:ct.traitInfoText,children:L.jsxs("div",{className:ct.checkboxHolder,children:[L.jsx("div",{}),L.jsxs("label",{className:ct["custom-checkbox"],children:[L.jsx("input",{type:"checkbox",checked:O,onChange:D}),L.jsx("div",{className:ct["checkbox-container"]})]}),L.jsx("div",{}),L.jsx("div",{}),"Download Sprites Data"]})})}),g&&L.jsxs(L.Fragment,{children:[e&&L.jsx(L.Fragment,{children:L.jsx("div",{className:ct.traitInfoText,children:L.jsxs("div",{className:ct.checkboxHolder,children:[L.jsx("div",{}),L.jsxs("label",{className:ct["custom-checkbox"],children:[L.jsx("input",{type:"checkbox",checked:x,onChange:N}),L.jsx("div",{className:ct["checkbox-container"]})]}),L.jsx("div",{}),L.jsx("div",{}),"Create Atlas"]})})}),(e==!1||x)&&L.jsxs(L.Fragment,{children:[L.jsx("br",{}),L.jsx("div",{className:ct.traitInfoTitle,children:"Merge Atlas Type"}),L.jsx("br",{}),L.jsxs("div",{className:ct.flexSelect,children:[L.jsx("div",{className:`${ct["arrow-button"]} ${ct["left-button"]}`,onClick:E}),L.jsx("div",{className:ct.traitInfoText,style:{marginBottom:"0"},children:f[u]}),L.jsx("div",{className:`${ct["arrow-button"]} ${ct["right-button"]}`,onClick:z})]}),L.jsx("br",{}),L.jsx("br",{}),(u===0||u==2)&&L.jsxs(L.Fragment,{children:[L.jsx("div",{className:ct.traitInfoTitle,children:"Standard Atlas Size"}),L.jsx("br",{}),L.jsxs("div",{className:ct.traitInfoText,children:["Opaque: ",Cn(r)+" x "+Cn(r)]}),L.jsx(Qh,{value:r,onChange:T=>re(T,"standard opaque"),min:1,max:8,step:1}),L.jsx("br",{}),L.jsxs("div",{className:ct.traitInfoText,children:["Transparent: ",Cn(s)+" x "+Cn(s)]}),L.jsx(Qh,{value:s,onChange:T=>re(T,"standard transparent"),min:1,max:8,step:1}),L.jsx("br",{})," ",L.jsx("br",{})]}),(u===1||u==2)&&L.jsxs(L.Fragment,{children:[L.jsx("div",{className:ct.traitInfoTitle,children:"MToon Atlas Size"}),L.jsx("br",{}),L.jsxs("div",{className:ct.traitInfoText,children:["Opaque: ",Cn(a)+" x "+Cn(a)]}),L.jsx(Qh,{value:a,onChange:T=>re(T,"mtoon opaque"),min:1,max:8,step:1}),L.jsx("br",{}),L.jsxs("div",{className:ct.traitInfoText,children:["Transparent: ",Cn(A)+" x "+Cn(A)]}),L.jsx(Qh,{value:A,onChange:T=>re(T,"mtoon transparent"),min:1,max:8,step:1}),L.jsx("br",{})," ",L.jsx("br",{})]}),L.jsx("div",{className:ct.traitInfoTitle,children:"Options"}),L.jsx("div",{className:ct.traitInfoText,children:L.jsxs("div",{className:ct.checkboxHolder,children:[L.jsx("div",{}),L.jsxs("label",{className:ct["custom-checkbox"],children:[L.jsx("input",{type:"checkbox",checked:d,onChange:I}),L.jsx("div",{className:ct["checkbox-container"]})]}),L.jsx("div",{}),L.jsx("div",{}),"Two Sided Material"]})}),n&&L.jsx(L.Fragment,{children:L.jsx("div",{className:ct.traitInfoText,children:L.jsxs("div",{className:ct.checkboxHolder,children:[L.jsx("div",{}),L.jsxs("label",{className:ct["custom-checkbox"],children:[L.jsx("input",{type:"checkbox",checked:B,onChange:y}),L.jsx("div",{className:ct["checkbox-container"]})]}),L.jsx("div",{}),L.jsx("div",{}),"Drag Drop - Download"]})})}),L.jsx(L.Fragment,{children:L.jsx("div",{className:ct.traitInfoText,children:L.jsxs("div",{className:ct.checkboxHolder,children:[L.jsx("div",{}),L.jsxs("label",{className:ct["custom-checkbox"],children:[L.jsx("input",{type:"checkbox",checked:b,onChange:R}),L.jsx("div",{className:ct["checkbox-container"]})]}),L.jsx("div",{}),L.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}const Zye="_dropArea_1a0z4_1",Jye={dropArea:Zye};function F0({onFilesDrop:n}){const[e,t]=Be.useState(!1),[r,i]=X.useState(null);Be.useEffect(()=>{const o=l=>{l.preventDefault(),t(!1);const A=l.dataTransfer.files;n&&i(A)},a=l=>{l.preventDefault(),t(!0)};return window.addEventListener("drop",o),window.addEventListener("dragover",a),()=>{window.removeEventListener("drop",o),window.removeEventListener("dragover",a)}},[]),Be.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return L.jsx("div",{onDragLeave:s,className:Jye.dropArea,style:{display:e?"flex":"none"}})}function Hye(){const{t:n}=Be.useContext(xs),{playSound:e}=X.useContext(bs),{isMute:t}=X.useContext(Bs),{setViewMode:r}=X.useContext(Ci),i=()=>{r(ot.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(ot.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return L.jsxs("div",{className:Fy.container,children:[L.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),L.jsxs("div",{className:Fy.buttonContainer,children:[L.jsx(F0,{onFilesDrop:o}),L.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:Fy.buttonLeft,onClick:i}),L.jsx(Ib,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),L.jsx(Uye,{}),L.jsx(sn,{theme:"light",text:"mint",size:14,className:Fy.buttonRight,onClick:s})]})]})}const kc={},E0="abi/5.7.0",Lt=new we(E0),Fu={};let VL={calldata:!0,memory:!0,storage:!0},zye={calldata:!0,memory:!0};function _y(n,e){if(n==="bytes"||n==="string"){if(VL[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&zye[e])return!0;return(VL[e]||e==="payable")&&Lt.throwArgumentError("invalid modifier","name",e),!1}function Yye(n,e){let t=n;function r(a){Lt.throwArgumentError(`unexpected character at position ${a}`,"param",n)}n=n.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(r)}let t="";return this.baseType==="array"?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Jt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Jt.full?", ":",")+")"):t+=this.type,e!==Jt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Jt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?xr.fromString(e,t):xr.fromObject(e)}static fromObject(e){return xr.isParamType(e)?e:new xr(Fu,{name:e.name||null,type:Od(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(xr.fromObject):null})}static fromString(e,t){function r(i){return xr.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(Yye(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function Ym(n,e){return Kye(n).map(t=>xr.fromString(t,e))}class Il{constructor(e,t){e!==Fu&&Lt.throwError("use a static from method",we.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Fw(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Il.isFragment(e)?e:typeof e=="string"?Il.fromString(e):Il.fromObject(e)}static fromObject(e){if(Il.isFragment(e))return e;switch(e.type){case"function":return fa.fromObject(e);case"event":return vl.fromObject(e);case"constructor":return ha.fromObject(e);case"error":return EA.fromObject(e);case"fallback":case"receive":return null}return Lt.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?vl.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?fa.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?ha.fromString(e.trim()):e.split(" ")[0]==="error"?EA.fromString(e.substring(5).trim()):Lt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class vl extends Il{format(e){if(e||(e=Jt.sighash),Jt[e]||Lt.throwArgumentError("invalid format type","format",e),e===Jt.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Jt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Jt.full?", ":",")+") ",e!==Jt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?vl.fromString(e):vl.fromObject(e)}static fromObject(e){if(vl.isEventFragment(e))return e;e.type!=="event"&&Lt.throwArgumentError("invalid event object","value",e);const t={name:Xm(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(xr.fromObject):[],type:"event"};return new vl(Fu,t)}static fromString(e){let t=e.match(jm);t||Lt.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":r=!0;break;case"":break;default:Lt.warn("unknown modifier: "+i)}}),vl.fromObject({name:t[1].trim(),anonymous:r,inputs:Ym(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function ZH(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&Lt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||Lt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ge.from(t[1]),t[0]):n}function JH(n,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",n.split(" ").forEach(t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}})}function HH(n){let e={constant:!1,payable:!0,stateMutability:"payable"};return n.stateMutability!=null?(e.stateMutability=n.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",n.constant!=null&&!!n.constant!==e.constant&&Lt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&Lt.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",n)):n.payable!=null?(e.payable=!!n.payable,n.constant==null&&!e.payable&&n.type!=="constructor"&&Lt.throwArgumentError("unable to determine stateMutability","value",n),e.constant=!!n.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Lt.throwArgumentError("cannot have constant payable function","value",n)):n.constant!=null?(e.constant=!!n.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):n.type!=="constructor"&&Lt.throwArgumentError("unable to determine stateMutability","value",n),e}class ha extends Il{format(e){if(e||(e=Jt.sighash),Jt[e]||Lt.throwArgumentError("invalid format type","format",e),e===Jt.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});e===Jt.sighash&&Lt.throwError("cannot format a constructor for sighash",we.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Jt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?ha.fromString(e):ha.fromObject(e)}static fromObject(e){if(ha.isConstructorFragment(e))return e;e.type!=="constructor"&&Lt.throwArgumentError("invalid constructor object","value",e);let t=HH(e);t.constant&&Lt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(xr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new ha(Fu,r)}static fromString(e){let t={type:"constructor"};e=ZH(e,t);let r=e.match(jm);return(!r||r[1].trim()!=="constructor")&&Lt.throwArgumentError("invalid constructor string","value",e),t.inputs=Ym(r[2].trim(),!1),JH(r[3].trim(),t),ha.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class fa extends ha{format(e){if(e||(e=Jt.sighash),Jt[e]||Lt.throwArgumentError("invalid format type","format",e),e===Jt.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e))),outputs:this.outputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Jt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Jt.full?", ":",")+") ",e!==Jt.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(r=>r.format(e)).join(", ")+") "),this.gas!=null&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return typeof e=="string"?fa.fromString(e):fa.fromObject(e)}static fromObject(e){if(fa.isFunctionFragment(e))return e;e.type!=="function"&&Lt.throwArgumentError("invalid function object","value",e);let t=HH(e);const r={type:e.type,name:Xm(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(xr.fromObject):[],outputs:e.outputs?e.outputs.map(xr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new fa(Fu,r)}static fromString(e){let t={type:"function"};e=ZH(e,t);let r=e.split(" returns ");r.length>2&&Lt.throwArgumentError("invalid function string","value",e);let i=r[0].match(jm);if(i||Lt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&Xm(t.name),t.inputs=Ym(i[2],!1),JH(i[3].trim(),t),r.length>1){let s=r[1].match(jm);(s[1].trim()!=""||s[3].trim()!="")&&Lt.throwArgumentError("unexpected tokens","value",e),t.outputs=Ym(s[2],!1)}else t.outputs=[];return fa.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function PL(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Lt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class EA extends Il{format(e){if(e||(e=Jt.sighash),Jt[e]||Lt.throwArgumentError("invalid format type","format",e),e===Jt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Jt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Jt.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?EA.fromString(e):EA.fromObject(e)}static fromObject(e){if(EA.isErrorFragment(e))return e;e.type!=="error"&&Lt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Xm(e.name),inputs:e.inputs?e.inputs.map(xr.fromObject):[]};return PL(new EA(Fu,t))}static fromString(e){let t={type:"error"},r=e.match(jm);return r||Lt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Xm(t.name),t.inputs=Ym(r[2],!1),PL(EA.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Od(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const jye=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Xm(n){return(!n||!n.match(jye))&&Lt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const jm=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Kye(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&mQ.throwError("value out-of-bounds",we.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=is([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class sC{constructor(e,t,r,i){Me(this,"_data",At(e)),Me(this,"wordSize",t||32),Me(this,"_coerceFunc",r),Me(this,"allowLoose",i),this._offset=0}get data(){return nt(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):sC.coerce(e,t)}_peekBytes(e,t,r){let i=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?i=t:mQ.throwError("data out-of-bounds",we.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new sC(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return Ge.from(this.readBytes(this.wordSize))}}class qye extends Yl{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Vr(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return Vr(Pn(e.readValue().toHexString(),20))}}class ewe extends Yl{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const Rh=new we(E0);function zH(n,e,t){let r=null;if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(A=>{const c=A.localName;return c||Rh.throwError("cannot encode object for signature with missing names",we.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]&&Rh.throwError("cannot encode object for signature with duplicate names",we.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]=!0,t[c]})}else Rh.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Rh.throwArgumentError("types/value length mismatch","tuple",t);let i=new R_(n.wordSize),s=new R_(n.wordSize),o=[];e.forEach((l,A)=>{let c=r[A];if(l.dynamic){let u=s.length;l.encode(s,c);let h=i.writeUpdatableValue();o.push(d=>{h(d+u)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function YH(n,e){let t=[],r=n.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=n.readValue(),l=r.subReader(a.toNumber());try{o=s.decode(l)}catch(A){if(A.code===we.errors.BUFFER_OVERRUN)throw A;o=A,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(a.code===we.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&t.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),t[a]!=null))return;const l=t[o];l instanceof Error?Object.defineProperty(t,a,{enumerable:!0,get:()=>{throw l}}):t[a]=l});for(let s=0;s{throw o}})}return Object.freeze(t)}class twe extends Yl{constructor(e,t,r){const i=e.type+"["+(t>=0?t:"")+"]",s=t===-1||e.dynamic;super("array",i,r,s),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&Rh.throwError("insufficient data length",we.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let i=0;i{o.dynamic&&(r=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach(r=>{e.push(r.defaultValue())});const t=this.coders.reduce((r,i)=>{const s=i.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,i)=>{let s=r.localName;!s||t[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,t){return zH(e,this.coders,t)}decode(e){return e.coerce(this.name,YH(e,this.coders))}}const Uy=new we(E0),lwe=new RegExp(/^bytes([0-9]*)$/),Awe=new RegExp(/^(u?int)([0-9]*)$/);class cwe{constructor(e){Me(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new qye(e.name);case"bool":return new nwe(e.name);case"string":return new awe(e.name);case"bytes":return new rwe(e.name);case"array":return new twe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Sy((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new swe(e.name)}let t=e.type.match(Awe);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Uy.throwArgumentError("invalid "+t[1]+" bit length","param",e),new owe(r/8,t[1]==="int",e.name)}if(t=e.type.match(lwe),t){let r=parseInt(t[1]);return(r===0||r>32)&&Uy.throwArgumentError("invalid bytes length","param",e),new iwe(r,e.name)}return Uy.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new sC(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new R_(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(xr.from(i)));return new Sy(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Uy.throwError("types/values length mismatch",we.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(xr.from(o))),i=new Sy(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(xr.from(o)));return new Sy(i,"_").decode(this._getReader(At(t),r))}}const uwe=new cwe,Fn=new we(E0);class dwe extends t0{}class hwe extends t0{}class fwe extends t0{}class M_ extends t0{static isIndexed(e){return!!(e&&e._isIndexed)}}const pwe={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function OL(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class WL{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Me(this,"fragments",t.map(r=>Il.from(r)).filter(r=>r!=null)),Me(this,"_abiCoder",ss(new.target,"getAbiCoder")()),Me(this,"functions",{}),Me(this,"errors",{}),Me(this,"events",{}),Me(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){Fn.warn("duplicate definition - constructor");return}Me(this,"deploy",r);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=r.format();if(i[s]){Fn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Me(this,"deploy",ha.from({payable:!1,type:"constructor"})),Me(this,"_isInterface",!0)}format(e){e||(e=Jt.full),e===Jt.sighash&&Fn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Jt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return uwe}static getAddress(e){return Vr(e)}static getSighash(e){return zr(sh(e.format()),0,4)}static getEventTopic(e){return sh(e.format())}getFunction(e){if(Ft(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];Fn.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===r);return i.length===0?Fn.throwArgumentError("no matching function","name",r):i.length>1&&Fn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[fa.fromString(e).format()];return t||Fn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Ft(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];Fn.throwArgumentError("no matching event","topichash",r)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===r);return i.length===0?Fn.throwArgumentError("no matching event","name",r):i.length>1&&Fn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[vl.fromString(e).format()];return t||Fn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Ft(e)){const r=ss(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}Fn.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===r);return i.length===0?Fn.throwArgumentError("no matching error","name",r):i.length>1&&Fn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[fa.fromString(e).format()];return t||Fn.throwArgumentError("no matching error","signature",e),t}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch{throw t}}return ss(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),ss(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){typeof e=="string"&&(e=this.getError(e));const r=At(t);return nt(r.slice(0,4))!==this.getSighash(e)&&Fn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",nt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return typeof e=="string"&&(e=this.getError(e)),nt(is([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){typeof e=="string"&&(e=this.getFunction(e));const r=At(t);return nt(r.slice(0,4))!==this.getSighash(e)&&Fn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",nt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return typeof e=="string"&&(e=this.getFunction(e)),nt(is([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){typeof e=="string"&&(e=this.getFunction(e));let r=At(t),i=null,s="",o=null,a=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch{}break;case 4:{const A=nt(r.slice(0,4)),c=pwe[A];if(c)o=this._abiCoder.decode(c.inputs,r.slice(4)),a=c.name,l=c.signature,c.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const u=this.getError(A);o=this._abiCoder.decode(u.inputs,r.slice(4)),a=u.name,l=u.format()}catch{}break}}return Fn.throwError("call revert exception"+s,we.errors.CALL_EXCEPTION,{method:e.format(),data:nt(t),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,t){return typeof e=="string"&&(e=this.getFunction(e)),nt(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){typeof e=="string"&&(e=this.getEvent(e)),t.length>e.inputs.length&&Fn.throwError("too many arguments for "+e.format(),we.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?sh(o):s.type==="bytes"?ir(nt(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=Ge.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),Pn(nt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&Fn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?Fn.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?r.push(s.map(l=>i(a,l))):r.push(i(a,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,t){typeof e=="string"&&(e=this.getEvent(e));const r=[],i=[],s=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Fn.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(sh(l));else if(o.type==="bytes")r.push(ir(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:r}}decodeEventLog(e,t,r){if(typeof e=="string"&&(e=this.getEvent(e)),r!=null&&!e.anonymous){let h=this.getEventTopic(e);(!Ft(r[0],32)||r[0].toLowerCase()!==h)&&Fn.throwError("fragment/topic mismatch",we.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:h,value:r[0]}),r=r.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((h,d)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(i.push(xr.fromObject({type:"bytes32",name:h.name})),o.push(!0)):(i.push(h),o.push(!1)):(s.push(h),o.push(!1))});let a=r!=null?this._abiCoder.decode(i,is(r)):null,l=this._abiCoder.decode(s,t,!0),A=[],c=0,u=0;e.inputs.forEach((h,d)=>{if(h.indexed)if(a==null)A[d]=new M_({_isIndexed:!0,hash:null});else if(o[d])A[d]=new M_({_isIndexed:!0,hash:a[u++]});else try{A[d]=a[u++]}catch(p){A[d]=p}else try{A[d]=l[c++]}catch(p){A[d]=p}if(h.name&&A[h.name]==null){const p=A[d];p instanceof Error?Object.defineProperty(A,h.name,{enumerable:!0,get:()=>{throw OL(`property ${JSON.stringify(h.name)}`,p)}}):A[h.name]=p}});for(let h=0;h{throw OL(`index ${h}`,d)}})}return Object.freeze(A)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new hwe({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Ge.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new dwe({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=nt(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new fwe({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const gwe="contracts/5.7.0";var Eu=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Hn=new we(gwe);function oC(n,e){return Eu(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&Hn.throwArgumentError("invalid address or ENS name","name",t);try{return Vr(t)}catch{}n||Hn.throwError("a provider or signer is needed to resolve ENS names",we.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&Hn.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function Ew(n,e,t){return Eu(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>Ew(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield oC(n,e):t.type==="tuple"?yield Ew(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>Ew(n,r,t.arrayChildren))):Promise.reject(Hn.makeError("invalid value for array",we.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fb(n,e,t){return Eu(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=xn(t.pop())),Hn.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=qn({override:oC(n.signer,r.from),signer:n.signer.getAddress()}).then(A=>Eu(this,void 0,void 0,function*(){return Vr(A.signer)!==A.override&&Hn.throwError("Contract with a Signer cannot override from",we.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),A.override})):r.from=n.signer.getAddress():r.from&&(r.from=oC(n.provider,r.from));const i=yield qn({args:Ew(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:qn(r)||{}}),s=n.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=Ge.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=Ge.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=Ge.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=Ge.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=Ge.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=Uu(a.accessList)),o.gasLimit==null&&e.gas!=null){let A=21e3;const c=At(s);for(let u=0;ur[A]!=null);return l.length&&Hn.throwError(`cannot override ${l.map(A=>JSON.stringify(A)).join(",")}`,we.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function mwe(n,e){return function(...t){return Fb(n,e,t)}}function vwe(n,e){const t=n.signer||n.provider;return function(...r){return Eu(this,void 0,void 0,function*(){t||Hn.throwError("estimate require a provider or signer",we.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fb(n,e,r);return yield t.estimateGas(i)})}}function ywe(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=ls(s),a=null;try{a=n.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,A)=>n.interface.decodeEventLog(a.eventFragment,l,A),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>n.provider,o.getBlock=()=>n.provider.getBlock(i.blockHash),o.getTransaction=()=>n.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function jH(n,e,t){const r=n.signer||n.provider;return function(...i){return Eu(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=xn(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}n.deployTransaction!=null&&(yield n._deployed(s));const o=yield Fb(n,e,i),a=yield r.call(o,s);try{let l=n.interface.decodeFunctionResult(e,a);return t&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===we.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function wwe(n,e){return function(...t){return Eu(this,void 0,void 0,function*(){n.signer||Hn.throwError("sending a transaction requires a signer",we.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield Fb(n,e,t),i=yield n.signer.sendTransaction(r);return ywe(n,i),i})}}function GL(n,e,t){return e.constant?jH(n,e,t):wwe(n,e)}function KH(n){return n.address&&(n.topics==null||n.topics.length===0)?"*":(n.address||"*")+"@"+(n.topics?n.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class Km{constructor(e,t){Me(this,"tag",e),Me(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(r=>t||r.listener!==e?!0:(t=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter(r=>{const i=e.slice();return setTimeout(()=>{r.listener.apply(this,i)},0),!r.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class Bwe extends Km{constructor(){super("error",null)}}class ZL extends Km{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&Hn.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(KH(s),s),Me(this,"address",e),Me(this,"interface",t),Me(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(t,r)=>this.interface.decodeEventLog(this.fragment,t,r);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=$ye(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class JL extends Km{constructor(e,t){super("*",{address:e}),Me(this,"address",e),Me(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(r,i)=>this.interface.decodeEventLog(t.eventFragment,r,i),e.args=t.args}catch{}}}class Cwe{constructor(e,t,r){Me(this,"interface",ss(new.target,"getInterface")(t)),r==null?(Me(this,"provider",null),Me(this,"signer",null)):s0.isSigner(r)?(Me(this,"provider",r.provider||null),Me(this,"signer",r)):n0.isProvider(r)?(Me(this,"provider",r),Me(this,"signer",null)):Hn.throwArgumentError("invalid signer or provider","signerOrProvider",r),Me(this,"callStatic",{}),Me(this,"estimateGas",{}),Me(this,"functions",{}),Me(this,"populateTransaction",{}),Me(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Me(this.filters,a,(...A)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,A)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?Me(this.filters,a,this.filters[l[0]]):Hn.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Me(this,"_runningEvents",{}),Me(this,"_wrappedEmits",{}),e==null&&Hn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Me(this,"address",e),this.provider)Me(this,"resolvedAddress",oC(this.provider,e));else try{Me(this,"resolvedAddress",Promise.resolve(Vr(e)))}catch{Hn.throwError("provider is required to use ENS name as contract address",we.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){Hn.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&Me(this,o,GL(this,a,!0)),this.functions[o]==null&&Me(this.functions,o,GL(this,a,!1)),this.callStatic[o]==null&&Me(this.callStatic,o,jH(this,a,!0)),this.populateTransaction[o]==null&&Me(this.populateTransaction,o,mwe(this,a)),this.estimateGas[o]==null&&Me(this.estimateGas,o,vwe(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&Me(this,o,this[l])}catch{}this.functions[o]==null&&Me(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Me(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Me(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Me(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return uP(e)}static getInterface(e){return WL.isInterface(e)?e:new WL(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(t=>(t==="0x"&&Hn.throwError("contract not deployed",we.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||Hn.throwError("sending a transactions require a signer",we.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=xn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&Hn.throwError("cannot override "+r,we.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new aS(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Me(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return M_.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new Bwe);if(e==="event")return this._normalizeRunningEvent(new Km("event",null));if(e==="*")return this._normalizeRunningEvent(new JL(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new ZL(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const r=e.topics[0];if(typeof r!="string")throw new Error("invalid topic");const i=this.interface.getEvent(r);return this._normalizeRunningEvent(new ZL(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Km(KH(t),t))}return this._normalizeRunningEvent(new JL(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const i=ls(t);return i.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(t.blockHash),i.getTransaction=()=>this.provider.getTransaction(t.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(i),i}_addEventListener(e,t,r){if(this.provider||Hn.throwError("events require a provider or a signer with a provider",we.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,t);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,t,r){const i=this._getRunningEvent(e),s=xn(i.filter);return typeof t=="string"&&Ft(t,32)?(r!=null&&Hn.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),s.blockHash=t):(s.fromBlock=t??0,s.toBlock=r??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),i=r.run(t)>0;return this._checkRunningEvents(r),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((t,r)=>t+this._runningEvents[r].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const t=[];for(let r in this._runningEvents)this._runningEvents[r].listeners().forEach(i=>{t.push(i)});return t}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const r in this._runningEvents){const i=this._runningEvents[r];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class Eb extends Cwe{}var vQ={exports:{}},Kh=typeof Reflect=="object"?Reflect:null,HL=Kh&&typeof Kh.apply=="function"?Kh.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},_w;Kh&&typeof Kh.ownKeys=="function"?_w=Kh.ownKeys:Object.getOwnPropertySymbols?_w=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:_w=function(e){return Object.getOwnPropertyNames(e)};function bwe(n){console&&console.warn&&console.warn(n)}var $H=Number.isNaN||function(e){return e!==e};function on(){on.init.call(this)}vQ.exports=on;vQ.exports.once=Ewe;on.EventEmitter=on;on.prototype._events=void 0;on.prototype._eventsCount=0;on.prototype._maxListeners=void 0;var zL=10;function _b(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(on,"defaultMaxListeners",{enumerable:!0,get:function(){return zL},set:function(n){if(typeof n!="number"||n<0||$H(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");zL=n}});on.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};on.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||$H(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function qH(n){return n._maxListeners===void 0?on.defaultMaxListeners:n._maxListeners}on.prototype.getMaxListeners=function(){return qH(this)};on.prototype.emit=function(e){for(var t=[],r=1;r0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")HL(l,this,t);else for(var A=l.length,c=i5(l,A),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,bwe(a)}return n}on.prototype.addListener=function(e,t){return e5(this,e,t,!1)};on.prototype.on=on.prototype.addListener;on.prototype.prependListener=function(e,t){return e5(this,e,t,!0)};function xwe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function t5(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=xwe.bind(r);return i.listener=t,r.wrapFn=i,i}on.prototype.once=function(e,t){return _b(t),this.on(e,t5(this,e,t)),this};on.prototype.prependOnceListener=function(e,t){return _b(t),this.prependListener(e,t5(this,e,t)),this};on.prototype.removeListener=function(e,t){var r,i,s,o,a;if(_b(t),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,s=o;break}if(s<0)return this;s===0?r.shift():Iwe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};on.prototype.off=on.prototype.removeListener;on.prototype.removeAllListeners=function(e){var t,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s=Object.keys(r),o;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this};function n5(n,e,t){var r=n._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?Fwe(i):i5(i,i.length)}on.prototype.listeners=function(e){return n5(this,e,!0)};on.prototype.rawListeners=function(e){return n5(this,e,!1)};on.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):r5.call(n,e)};on.prototype.listenerCount=r5;function r5(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}on.prototype.eventNames=function(){return this._eventsCount>0?_w(this._events):[]};function i5(n,e){for(var t=new Array(e),r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Sw(n,e,t){return Rwe()?Sw=Reflect.construct:Sw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&aC(A,o.prototype),A},Sw.apply(null,arguments)}function Mwe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function lC(n){var e=typeof Map=="function"?new Map:void 0;return lC=function(r){if(r===null||!Mwe(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return Sw(r,arguments,N_(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),aC(i,r)},lC(n)}function Qy(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function Md(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function $o(n){return n.hasOwnProperty("result")?n.result:n}var kI=function(n){yQ(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="No Ethereum provider was found on window.ethereum.",t}return e}(lC(Error)),Twe=function(n){yQ(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="The user rejected the request.",t}return e}(lC(Error)),Nwe=function(n){yQ(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Qy(i)),i.handleChainChanged=i.handleChainChanged.bind(Qy(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Qy(i)),i.handleClose=i.handleClose.bind(Qy(i)),i}var t=e.prototype;return t.handleChainChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.handleAccountsChanged=function(i){i.length===0?this.emitDeactivate():this.emitUpdate({account:i[0]})},t.handleClose=function(i,s){this.emitDeactivate()},t.handleNetworkChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.activate=function(){try{var i=function(c){if(s)return c;function u(){return T_({provider:window.ethereum},a?{account:a}:{})}var h=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(d){return d&&$o(d)[0]})).then(function(d){a=d})}();return h&&h.then?h.then(u):u(h)},s=!1,o=this;if(!window.ethereum)throw new kI;window.ethereum.on&&(window.ethereum.on("chainChanged",o.handleChainChanged),window.ethereum.on("accountsChanged",o.handleAccountsChanged),window.ethereum.on("close",o.handleClose),window.ethereum.on("networkChanged",o.handleNetworkChanged)),window.ethereum.isMetaMask&&(window.ethereum.autoRefreshOnNetworkChange=!1);var a,l=Md(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(A){return $o(A)[0]})).then(function(A){a=A})},function(A){if(A.code===4001)throw new Twe});return Promise.resolve(l&&l.then?l.then(i):i(l))}catch(A){return Promise.reject(A)}},t.getProvider=function(){try{return Promise.resolve(window.ethereum)}catch(i){return Promise.reject(i)}},t.getChainId=function(){try{var i=function(){function l(){if(!s)try{s=$o(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=$o(window.ethereum.cachedResults.net_version):s=window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),s}var A=function(){if(!s){var c=Md(function(){return Promise.resolve(window.ethereum.send("net_version").then($o)).then(function(u){s=u})},function(){});if(c&&c.then)return c.then(function(){})}}();return A&&A.then?A.then(l):l(A)};if(!window.ethereum)throw new kI;var s,o=Md(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then($o)).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.getAccount=function(){try{var i=function(){function l(){return s||(s=$o(window.ethereum.send({method:"eth_accounts"}))[0]),s}var A=function(){if(!s){var c=Md(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return $o(u)[0]})).then(function(u){s=u})},function(){});if(c&&c.then)return c.then(function(){})}}();return A&&A.then?A.then(l):l(A)};if(!window.ethereum)throw new kI;var s,o=Md(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return $o(a)[0]})).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.deactivate=function(){window.ethereum&&window.ethereum.removeListener&&(window.ethereum.removeListener("chainChanged",this.handleChainChanged),window.ethereum.removeListener("accountsChanged",this.handleAccountsChanged),window.ethereum.removeListener("close",this.handleClose),window.ethereum.removeListener("networkChanged",this.handleNetworkChanged))},t.isAuthorized=function(){try{return window.ethereum?Promise.resolve(Md(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return $o(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(Qwe);function kwe(){const{account:n,library:e,activate:t}=m8(),[r,i]=Be.useState([]),{setViewMode:s}=X.useContext(Ci),{playSound:o}=X.useContext(bs),{isMute:a}=X.useContext(Bs),l=new Nwe({supportedChainIds:[137,1,3,4,5,42,97]});Be.useEffect(()=>{if(n&&e){const h="0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",d=["function balanceOf(address owner) external view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function tokenURI(uint256 tokenId) external view returns (string)"],p=new Eb(h,d,e);p.balanceOf(n).then(f=>{const g=[];for(let m=0;m{const v=m.map(w=>p.tokenURI(w));Promise.all(v).then(w=>{i(w)})})})}},[n,e]);const A=()=>{t(l)},c=h=>{!a&&o("backNextButton"),s(ot.APPEARANCE)},u=()=>{s(ot.LANDING),!a&&o("backNextButton")};return L.jsxs("div",{className:kc.container,children:[!n&&L.jsxs("div",{className:kc.message,children:["Please connect your wallet to load your characters",L.jsx("button",{className:kc.button,onClick:()=>A(),children:"Connect"})]}),L.jsxs("div",{className:kc.characterContainer,children:[L.jsx("div",{className:kc.title,children:"Load Character"}),r.map((h,d)=>L.jsx("div",{className:kc.character,onClick:()=>{c()},children:JSON.stringify(h)},d))]}),L.jsx("button",{className:kc.button,onClick:()=>u(),children:"Back"})]})}const Dwe="_container_q73cc_1",Lwe="_mintContainer_q73cc_6",Vwe="_mainTitleWrap_q73cc_33",Pwe="_mainTitle_q73cc_33",Owe="_mintButtonContainer_q73cc_49",Wwe="_mintButton_q73cc_49",Gwe="_genesisText_q73cc_60",Zwe="_required_q73cc_64",Jwe="_divider_q73cc_68",Hwe="_bottomContainer_q73cc_75",zwe="_mintInfo_q73cc_85",Ywe="_topLine_q73cc_91",Xwe="_bottomLine_q73cc_104",ai={container:Dwe,mintContainer:Lwe,mainTitleWrap:Vwe,mainTitle:Pwe,mintButtonContainer:Owe,mintButton:Wwe,genesisText:Gwe,required:Zwe,divider:Jwe,bottomContainer:Hwe,mintInfo:zwe,topLine:Ywe,bottomLine:Xwe},jwe="0x543D43F390b7d681513045e8a85707438c463d80",AC={owner:"0x634B0510C5062CFf8009eAAc2435eB93bc4764ad",address:"0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",abi:[{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tokenPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"numberOfTokens",type:"uint256"},{internalType:"string",name:"_tokenURI",type:"string"}],name:"mintToken",outputs:[],stateMutability:"payable",type:"function"}]},YL={address:"0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F",abi:[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AddressMismatch",type:"error"},{inputs:[],name:"AlreadyProxied",type:"error"},{inputs:[],name:"ColdAddressCannotBeTheSameAsHot",type:"error"},{inputs:[],name:"ColdIsAddressZero",type:"error"},{inputs:[],name:"ColdWalletCannotInteractUseHot",type:"error"},{inputs:[],name:"DeliveryCannotBeTheZeroAddress",type:"error"},{inputs:[],name:"DeliveryIsAddressZero",type:"error"},{inputs:[],name:"EthWithdrawFailed",type:"error"},{inputs:[],name:"IncorrectProxyRegisterFee",type:"error"},{inputs:[],name:"MigrationIsAllowedOnceOnly",type:"error"},{inputs:[],name:"NoPaymentPendingForAddress",type:"error"},{inputs:[],name:"NoRecordFoundForAddress",type:"error"},{inputs:[],name:"OnlyHotAddressCanChangeAddress",type:"error"},{inputs:[],name:"ProxyRegisterFeeRequired",type:"error"},{inputs:[],name:"RegisterAddressLocked",type:"error"},{inputs:[],name:"RewardRateIsLocked",type:"error"},{inputs:[],name:"UnknownAmount",type:"error"},{inputs:[],name:"UnrecognisedEPSAPIAmount",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!0,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"address",name:"oldDelivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"DeliveryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"ensReverseRegistrarAddress",type:"address"}],name:"ENSReverseRegistrarSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"erc20",type:"address"},{indexed:!1,internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"ERC20FeeUpdated",type:"event"},{anonymous:!1,inputs:[],name:"MigrationComplete",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"NominationAccepted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"NominationMade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"ProxyRecordLive",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"enum IEPSProxyRegister.Participant",name:"initiator",type:"uint8"},{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"RecordDeleted",type:"event"},{anonymous:!1,inputs:[],name:"RewardRateLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint96",name:"rewardRate",type:"uint96"}],name:"RewardRateUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newToken",type:"address"}],name:"RewardTokenUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"acceptNomination",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"activeEthAddresses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"bool",name:"checkingHot_",type:"bool"}],name:"addressIsAvailable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"beneficiaryBalance",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"id_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf1155",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf20",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryOf",outputs:[{internalType:"address",name:"beneficiary_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"coldToHot",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"provider_",type:"uint256"}],name:"deleteRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deletionNominalEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ensReverseRegistrar",outputs:[{internalType:"contract ENSReverseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epsAPIBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegister",outputs:[{internalType:"contract IERC1155DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegister",outputs:[{internalType:"contract IERC20DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"erc20PerTransactionFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegister",outputs:[{internalType:"contract IERC721DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses1155",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses20",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses721",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAllAddresses",outputs:[{internalType:"address[]",name:"erc721Addresses_",type:"address[]"},{internalType:"address[]",name:"erc1155Addresses_",type:"address[]"},{internalType:"address[]",name:"erc20Addresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_receivedAddress",type:"address"}],name:"getColdAndDeliveryAddresses",outputs:[{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"bool",name:"isProxied",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"getProxyRecordForAddress",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"getProxyRecordForCold",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"getProxyRecordForHot",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"hotToRecord",outputs:[{internalType:"uint64",name:"provider",type:"uint64"},{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"bool",name:"feePaid",type:"bool"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"}],name:"isValidAddresses",outputs:[],stateMutability:"pure",type:"function"},{inputs:[],name:"lockERC1155DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC20DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC721DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],internalType:"struct EPSRegister.MigratedRecord[]",name:"migratedRecords_",type:"tuple[]"}],name:"migration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"migrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"nominate",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sender_",type:"address"},{internalType:"uint256",name:"erc20Value_",type:"uint256"},{internalType:"bytes",name:"data_",type:"bytes"}],name:"onTokenTransfer",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxyRegisterFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC1155",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"rescueERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC721",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC721",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rewardRate",outputs:[{internalType:"uint88",name:"",type:"uint88"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardRateLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardToken",outputs:[{internalType:"contract IOAT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"deleteNominalEth_",type:"uint256"}],name:"setDeletionNominalEth",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"ensName_",type:"string"}],name:"setENSName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ensReverseRegistrar_",type:"address"}],name:"setENSReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc1155DelegationRegister_",type:"address"}],name:"setERC1155DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20DelegationRegister_",type:"address"}],name:"setERC20DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20_",type:"address"},{internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"setERC20Fee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc721DelegationRegister_",type:"address"}],name:"setERC721DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count_",type:"uint256"},{internalType:"uint256",name:"air_",type:"uint256"}],name:"setNNumberOfEthAddressesAndAirdropAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"registerFee_",type:"uint256"}],name:"setRegisterFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint88",name:"rewardRate_",type:"uint88"}],name:"setRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"rewardToken_",type:"address"}],name:"setRewardToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"treasuryAddress_",type:"address"}],name:"setTreasuryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint256",name:"provider_",type:"uint256"}],name:"updateDeliveryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawETH",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]},Kwe={}.VITE_OPENSEA_KEY,$we={}.VITE_PINATA_API_KEY,qwe={}.VITE_PINATA_API_SECRET,DI="0x89";let Ry;async function eBe(){if(Ry!=null)return Ry;const n=new zP("https://polygon-rpc.com/"),t=await new Eb(AC.address,AC.abi,n).tokenPrice();return Ry=Ge.from(t).mul(1),Ry}function tBe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":Kwe}};return console.log(t),new Promise((r,i)=>{fetch("https://api.opensea.io/api/v2/chain/ethereum/account/"+n+"/nfts?collection="+e,t).then(s=>{if(s.ok)return s.json();i("Failed to fetch data from Opensea API")}).then(s=>{r(s)}).catch(s=>{i(s)})})}async function wQ(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(DI,16)){const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}else try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:DI}]});const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}catch(e){console.log("polygon not find:",e);try{await window.ethereum.request({method:"wallet_addEthereumChain",params:[{chainId:"0x89",chainName:"Polygon Mainnet",rpcUrls:["https://polygon-rpc.com"],nativeCurrency:{name:"Matic",symbol:"MATIC",decimals:18},blockExplorerUrls:["https://polygonscan.com/"]}]}),await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:DI}]});const t=await window.ethereum.request({method:"eth_requestAccounts"});return t.length>0?t[0]:""}catch(t){console.log("Adding polygon chain failed",t)}}}catch{return""}else return""}async function LI(n,e){if(!n)return console.warn("Error saving to pinata: No file data");const t="https://api.pinata.cloud/pinning/pinFileToIPFS";let r=new FormData;return r.append("file",n,e),(await PH.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:$we,pinata_secret_api_key:qwe}})).data}const nBe=n=>{let e=[];return Object.keys(n).map(t=>{Object.keys(n[t]).length!==0&&e.push({trait_type:t,value:n[t].name})}),e};async function rBe(n,e,t,r,i){if(!n)throw new Error("No avatar was provided");if(!e)throw new Error("No screenshot was provided");if(!t)throw new Error("No model was provided");const s=await wQ();if(s=="")return"Please Connect Wallet";if(!i||await iBe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let v=0;v<10;v++)try{return await LI(e,a).catch(B=>{console.error(v,"---",B)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const A=await ype(t,n,4096);let c;if(A){let v="AvatarGlb_"+Date.now()+".glb";c=await(async()=>{for(let w=0;w<10;w++)try{return await LI(A,v).catch(C=>(console.error(w,"---",C),"Couldn't save glb to pinata"))}catch(B){return console.warn(B),"Couldn't save glb to pinata"}return"Failed to upload glb"})()}else return"Unable to get glb";const u={name:r||"Avatars",description:"Character Studio Avatars.",image:`ipfs://${l.IpfsHash}`,animation_url:`ipfs://${c.IpfsHash}`,attributes:nBe(n)},h=JSON.stringify(u),p=`ipfs://${(await LI(new Blob([h]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let f=await eBe();const g=new AS(window.ethereum).getSigner(),m=new Eb(AC.address,AC.abi,g);try{const v={value:f,from:s};if((await(await m.mintToken(1,p,v)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const iBe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=l8("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new Eb(YL.address,YL.abi,t).beneficiaryBalanceOf(e,jwe,1);return parseInt(i)>0?!0:(console.log(`Currently in alpha. You need a genesis pass to mint. - Will be public soon!`),!1)}else return console.log("Please connect your wallet"),!1};function sBe(){const{model:n,avatar:e}=X.useContext(lr),{setViewMode:t}=X.useContext(Ci),{playSound:r}=X.useContext(bs),{isMute:i}=X.useContext(Bs),[s,o]=X.useState(""),[a,l]=X.useState(!1),A=()=>{t(ot.SAVE),!i&&r("backNextButton")},c=()=>{t(ot.CHAT),!i&&r("backNextButton")};function u(){return L.jsxs("div",{className:ai.mainTitleWrap,children:[L.jsx("div",{className:ai.topLine}),L.jsx("div",{className:ai.mainTitle,children:"Mint"})]})}async function h(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const f=await rBe(e,null,n,{name:"XXXRestore"}.name);o(f),l(!1),console.log(f)}return L.jsxs("div",{className:ai.container,children:[L.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),L.jsxs("div",{className:ai.mintContainer,children:[L.jsx(u,{}),L.jsxs("div",{className:ai.mintButtonContainer,children:[L.jsx(sn,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:ai.mintButton,disabled:a,onClick:h,minWidth:220}),L.jsx("div",{className:ai.divider}),L.jsx(sn,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:ai.mintButton,disabled:!0,minWidth:220}),L.jsxs("span",{className:ai.genesisText,children:["(",L.jsx("span",{className:ai.required,children:"Coming Soon!"}),")"]})]}),L.jsxs("span",{className:ai.mintInfo,children:[s," "]})]}),L.jsxs("div",{className:ai.bottomContainer,children:[L.jsx(sn,{theme:"light",text:"Back",size:14,className:ai.buttonLeft,onClick:A}),L.jsx(sn,{theme:"light",text:"Chat",size:14,className:ai.buttonRight,onClick:c})]})]})}const oBe="_classdisabled_ecnty_1",aBe="_container_ecnty_6",lBe="_classContainer_ecnty_14",ABe="_icon_ecnty_40",cBe="_name_ecnty_71",uBe="_description_ecnty_80",dBe="_classFrame_ecnty_85",hBe="_frameContainer_ecnty_107",fBe="_frame_ecnty_107",pBe="_image_ecnty_117",gBe="_lockedContainer_ecnty_123",mBe="_locked_ecnty_123",vBe="_buttonContainer_ecnty_137",yBe="_buttonLeft_ecnty_146",wBe="_buttonRight_ecnty_150",BBe="_buttonCenter_ecnty_154",CBe="_topLine_ecnty_168",bBe="_bottomLine_ecnty_194",at={classdisabled:oBe,container:aBe,classContainer:lBe,class:"_class_ecnty_1",icon:ABe,name:cBe,description:uBe,classFrame:dBe,frameContainer:hBe,frame:fBe,image:pBe,lockedContainer:gBe,locked:mBe,buttonContainer:vBe,buttonLeft:yBe,buttonRight:wBe,buttonCenter:BBe,topLine:CBe,bottomLine:bBe};function xBe(){const{t:n}=Be.useContext(xs),{setViewMode:e,setIsLoading:t,isLoading:r}=X.useContext(Ci),{playSound:i}=X.useContext(bs),{isMute:s}=X.useContext(Bs),{manifest:o,characterManager:a}=X.useContext(lr),[l,A]=Be.useState([]);Be.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const d=o.characters.map(p=>({name:p.name,image:p.portrait,description:p.description,manifest:p.manifest,icon:p.icon,format:p.format,disabled:!1}));A(d)}},[o]);const c=()=>{e(ot.LANDING),!s&&i("backNextButton")},u=async d=>{t(!0),a.loadManifest(o.characters[d].manifest).then(()=>{e(ot.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{!s&&i("classMouseOver")};return L.jsxs("div",{className:`${at.container} horizontalScroll`,children:[L.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),L.jsx("div",{className:at.vrmOptimizerButton}),L.jsx("div",{className:at.topLine}),L.jsx("div",{className:at.classContainer,children:l.map((d,p)=>L.jsxs("div",{className:d.disabled?at.classdisabled:at.class,onClick:d.disabled?null:()=>u(p),onMouseOver:d.disabled?null:()=>h(),children:[L.jsxs("div",{className:at.classFrame,style:{backgroundImage:`url(${d.image})`},children:[L.jsx("div",{className:at.frameContainer,children:L.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:at.frame})}),L.jsx("div",{className:at.lockedContainer,children:d.disabled&&L.jsx("img",{src:"./assets/icons/locked.svg",className:at.locked})})]}),L.jsx("div",{className:at.name,children:d.name}),L.jsx("div",{className:at.description,children:d.description})]},p))}),L.jsx("div",{className:at.bottomLine}),L.jsx("div",{className:at.buttonContainer,children:L.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:at.buttonLeft,onClick:c})})]})}function IBe(){const{t:n}=Be.useContext(xs),{setViewMode:e,setIsLoading:t,isLoading:r}=X.useContext(Ci),{playSound:i}=X.useContext(bs),{isMute:s}=X.useContext(Bs),{manifest:o,characterManager:a}=X.useContext(lr),[l,A]=Be.useState([]);Be.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const p=o.characters.map(f=>({name:f.name,image:f.portrait,description:f.description,manifest:f.manifest,icon:f.icon,format:f.format,disabled:!1}));A(p)}},[o]);const c=()=>{e(ot.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(ot.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{e(ot.BATCHMANIFEST)},d=()=>{!s&&i("classMouseOver")};return L.jsxs("div",{className:`${at.container} horizontalScroll`,children:[L.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),L.jsx("div",{className:at.vrmOptimizerButton}),L.jsx("div",{className:at.topLine}),L.jsxs("div",{className:at.classContainer,children:[l.map((p,f)=>L.jsxs("div",{className:p.disabled?at.classdisabled:at.class,onClick:p.disabled?null:()=>u(f),onMouseOver:p.disabled?null:()=>d(),children:[L.jsxs("div",{className:at.classFrame,style:{backgroundImage:`url(${p.image})`},children:[L.jsx("div",{className:at.frameContainer,children:L.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:at.frame})}),L.jsx("div",{className:at.lockedContainer,children:p.disabled&&L.jsx("img",{src:"./assets/icons/locked.svg",className:at.locked})})]}),L.jsx("div",{className:at.icon,children:L.jsx("img",{src:p.icon,alt:p.name})}),L.jsx("div",{className:at.name,children:p.name}),L.jsx("div",{className:at.description,children:p.description})]},f)),L.jsxs("div",{className:at.class,onClick:()=>h(),onMouseOver:()=>d(),children:[L.jsx("div",{className:at.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:L.jsx("div",{className:at.frameContainer,children:L.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:at.frame})})}),L.jsx("div",{className:at.icon,children:L.jsx("img",{src:"./assets/icons/class-neural-hacker.svg",alt:"manifest icons"})}),L.jsx("div",{className:at.name,children:"Manifest"}),L.jsx("div",{className:at.description,children:"Load by manifest"})]},"manifest-load")]}),L.jsx("div",{className:at.bottomLine}),L.jsx("div",{className:at.buttonContainer,children:L.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:at.buttonLeft,onClick:c})})]})}const FBe="_buttonContainer_1ueuk_1",EBe="_button_1ueuk_1",Td={buttonContainer:FBe,button:EBe},XL={}.VITE_OPENSEA_KEY;function _Be(){const{setViewMode:n}=X.useContext(Ci),{playSound:e}=X.useContext(bs),{isMute:t}=X.useContext(Bs),{characterManager:r}=X.useContext(lr),i=()=>{n(ot.CREATE),!t&&e("backNextButton")},s=()=>{n(ot.CLAIM),!t&&e("backNextButton")},o=()=>{n(ot.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await wQ()!=""&&n(ot.WALLET),!t&&e("backNextButton")};return L.jsx("div",{className:Td.container,children:L.jsxs("div",{className:Td.buttonContainer,children:[L.jsx("button",{className:Td.button,onClick:i,children:L.jsx("img",{src:"./assets/media/btn_create_character.png"})}),L.jsx("button",{className:Td.button,onClick:s,children:L.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),L.jsx("button",{className:Td.button,onClick:o,children:L.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),XL&&XL!=""&&L.jsx("button",{className:Td.button,onClick:a,children:L.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const SBe="_buttonContainer_19n2w_1",UBe="_buttonLeft_19n2w_10",QBe="_buttonRight_19n2w_14",RBe="_buttonCenter_19n2w_18",MBe="_sideMenu_19n2w_33",TBe="_scrollContainer_19n2w_44",NBe="_scrollContainerOptions_19n2w_52",kBe="_bottomLine_19n2w_60",DBe="_editorButton_19n2w_94",LBe="_editorText_19n2w_102",VBe="_selectorContainerPos_19n2w_112",PBe="_selectorButton_19n2w_129",OBe="_selectorColorPickerUI_19n2w_138",WBe="_selectorColorPickerButton_19n2w_144",GBe="_selectorColorPickerImg_19n2w_157",ZBe="_uploadContainer_19n2w_163",JBe="_uploadButton_19n2w_176",Tn={buttonContainer:SBe,buttonLeft:UBe,buttonRight:QBe,buttonCenter:RBe,sideMenu:MBe,scrollContainer:TBe,scrollContainerOptions:NBe,bottomLine:kBe,"editor-container":"_editor-container_19n2w_87",editorButton:DBe,editorText:LBe,selectorContainerPos:VBe,"selector-container":"_selector-container_19n2w_123",selectorButton:PBe,selectorColorPickerUI:OBe,selectorColorPickerButton:WBe,selectorColorPickerImg:GBe,uploadContainer:ZBe,uploadButton:JBe},HBe="_ContainerPositionTop_v15ql_2",zBe="_ContainerPosition_v15ql_2",YBe="_Container_v15ql_2",XBe="_topLine_v15ql_68",jBe="_traitInfoTitle_v15ql_96",KBe="_flexSelect_v15ql_105",$Be="_flexButtons_v15ql_114",qBe="_flexButtonsTop_v15ql_122",eCe="_optionButtons_v15ql_131",tCe="_optionButtonsSmall_v15ql_143",Kn={ContainerPositionTop:HBe,ContainerPosition:zBe,Container:YBe,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:XBe,traitInfoTitle:jBe,flexSelect:KBe,flexButtons:$Be,flexButtonsTop:qBe,optionButtons:eCe,optionButtonsSmall:tCe},nCe="/CharacterStudio/assets/randomize-green-4388c12b.png",rCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNiOTBlZjU3LTIwOWItYzQ0Zi05OWNjLTkwYjYxM2Q0MWJiOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjY1ZDdmMmJiLWMxYjctYjc0My1hYmIzLTFmM2VjNjMxYjE0NCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozYjkwZWY1Ny0yMDliLWM0NGYtOTljYy05MGI2MTNkNDFiYjgiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6bbHqfAAAFoklEQVR42u2duWtWQRTFo5hGRNAETKFiIQqCSxGto4iCqSLon6BoQJJCEcEFLASbD7QRRcTKNbihoLgUWhj/AItUCi7gVmjikubzPphAiOYts9659xQHAnl5M2/u73vnzHwvbzra7XaHNg1cPrKadJs0bnSHtEbjWGgr/HxSi9SeRWeLYwCAzOIPmk97u0ITpAMAQE7h+0ivaxR+psZIWwBAvoVfSXpsUfiZelZkBgAgx+dtJTIfaPV5W4nLB9p93lZi8oEEn39iWcRPpK2kzaSPlud4mns+0Ojzk6QTpM5p5+skHSP90ZYPtPn8DVJ3ybkXk65oygdafH6UtKlBW72klxrygfT5/BfSLoe2B0xWELt+oMbnHfoxj3RUaj6Q6vNdAfq0SGI+UOvzDn0UlQ/U+7z2fACfV54P4PPK8wF8Xnk+gM8rzwfweeX5AD6vPB/A55XnA/i88nwAn1eeD+DzyvMBfF55PoDPK88H8Hnl+aBup/aQflp26HrZc3hQaT64Zjnmv0h7nQEwT8u24PNJQdjokA9aVXfdqsaH4fNsQNhJ+mxRj2EXAO41bGw/ihUchH0Na3LXBYC7DRs7T1qOQgUr/lLSuZgA3LL0nkukhSiat8IvIF2wrMWtFABMJdHDpLkoolPxD5mxbOcGwJTekfpRzMaF305662H8kwMwpRekDShuZeHXkp57HHc2ACAfhPP5JAB8MB3+jXyQzOeLJfaLpPcpAPhmjlnmcMtSnQ8cfb6w1BXmPF9TAFB8N9Az7dhtpDfIB8F9vvjQ7Jh2rp6K72mCArDkP39z0GHaIjofOPr8lG3OmXHOJawAmHah57F+4G0+P+sHgyUAHm91/fD5cmtkDYDmfODT57MHQFM+COHzYgCQng9C+bwoACTmg9A+LxIACfkgls+LBiDHfBDb51UAkEs+SOHzagDgnA9S+rw6ADjlAw4+rxaAlPmAk8+rByB2PuDm8wAgUj7g6vMAIHA+4O7zACDc7fqk+a/lbJel1QPgIR9k/cUUAAj7SDX7r6YBgP98wM7nAUCa9YOo83kAwC8f5PIACgDwnA+yegQNADQfsGdlb9rK8HoAQMMBK3vryT0AIB+ARyXX9AgAyAfgYck1PQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlALQAwCSX0+y18V/L/a3BQDJr2cx6UcKAMZz3BRaIADdphZJNo16ldsG0ZIAoP721thY2gmAulvH3iB1AYCot/0rMbaObbJ59KR53UonAAjW907ScTPWUfYOHpK2fXyuADhsHz/kAkBBXMvy5QqjHPNBbgBQnzbW8PnZ1Kq6I9ftxJ6KuWaZrnOaLeQCQDHFJl1zeLPJ3jrtNOnQfIe7AZt8wB0A6sM80lHSH8uxPlPUqm57Nh1cSXps2bnk+YAzANT+AOmT5dg+Ja1q2qZLZ/tIry07m2z9gCMAjj4/Rtpi27aPzg9WrERVrR90awXAzOevWo7dBOmAax98XUg2+YADAGZ2dSyWzwcHIKd8kBoAM5+P6vPRAMghH6QCIKXPRweAcz6IDQAHn08GAMd8EAsATj6fFABu+SAGANx8ngUAXPJBSAC4+jwrADzlg5u2+SAEANx9niUAqfKBTwBy8Xm2AHjKB19Ju2MDkJPPswcgZj5wBSBHn88GgBj5wBaAnH0+OwBC5oOmAEjw+SwBCJUPmrwuXorPZw2Ax3yw3pxnpOS4EXPMOkk+LwKAGflgwrI4p0kPSn5/n3RKms+LAsBDPggh1j4vDgBP+cCHsvB5sQB4ygfifV48AJ7WD8T6vBoAAueDbH1eFQAB8kH2Pq8SAA/5QIzPqwbAIh+I83kAUD8fiPR5APAvCKtJt80dYdz8vEbjWPwFnWtJD/nY2zYAAAAASUVORK5CYII=",iCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM2NDY5Y2JiLWFkMzUtYmQ0Ny04M2Q1LWU0NGQ0MTI2YmYwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjIyNTIzNmU1LWZhMWItZTM0NS04ZDM2LTE5YmQyYTRiZjM1MSIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjNjQ2OWNiYi1hZDM1LWJkNDctODNkNS1lNDRkNDEyNmJmMDYiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6qPgTwAAAEeUlEQVR42u2dX4tNURiH58KfwR1K0USSj6BoIpdydcY0TUMmIy58BPdK/uTCLReaG7kwooQoH4FQyneQMNw53t2cqdOJPfusvfZa77ve5+JX1DlnOns9PM+cqT0T/X5/wtt6D64ekj2W/ZKtDv582OO18Hbwk7I7sv5/dle2DQDKPPzLsp81h7++6n+EKwBQzsGfkH1ucPCj+yI7CQB2D/6A7GXAwY/utewgAJTj+dAV2QdePR+64vrAu+dDV0wf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5532A5533AZ533gd43nkf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5530wzsHvkr3hQqvfW9nuLgDYKXvGBVa/F50AMATCHtkKF1rdqn+ce1NG4BHZOy589n2QHc35beBZ2VcOIvm+yRa1fBC0SXZN9oeDSbLrss0aPwqmDxR6PggA+ULnZRfpA9uel+ddkJ0LAWB56AOG/fSBLc/L86ZkrwavsxwCwOgPd6q/T9IHuj0vz9kquzl6djEAqPZDdok+0Ol5ed6S7Ps/XjMaAOurfgh0nD5Q4/lp2aea144OwPDHjvRBXs8/b/A1OgOAPtDj+awA0Af5PZ8dAPogr+fVAEAf5PG8OgDog7SeVwuA1z5I7XnVAHjqg1yeNwFAyX2Q2/OmACitDzR43iQA1vtAk+fNAmCxDzR63jwAFvpAs+eLAUBrH2j3fHEAaOkDK54vEoCcfWDN80UDkLIPrHreBQBd94Flz7sCIEYfPCnM8+4AiNEHZ2RzhXjeLQCt+6AQz7sHoFUfFOB5AIjRB4Y9DwAx+8Cg5wEgVh8Y9TwANNjt6rOADT4nuFHg+waAoc3WvOfZQt8zAAxtruY9zwFA+QDM1LznGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANsA3AeAYnYvBIBTsvcAYH4fZaeDf328PHmxt3bzRACwteqWNkvBvz5+5MJs6a3dRBEAbOxWdVOrJmc77j1z9smeAoDaVbe1mRrnTENvnnSst3YzZQDQsepGVtMhZ9n29mkW+6AkABp5vjMAjPZBKQA09nynABjsA+sAjO35JAAY6gOrAAR7PikABvrAGgCtPZ8FAMV9YAmAKJ7PBoDSPrAAQFTPZwdAWR9oBqATz6sBQEkfaASgU8+rAyBzH2gDoHPPqwQgYx9oASCZ51UDkKEPcgOQ3PMmAEjYB7kAyOZ5UwAk6IMcAGT1vDkAOu6DlACo8LxZADrqgxQAqPK8eQAi90GXAKj0fDEAROqDrgBQ6/miAIjQB7EBUO/5IgFo0QexADDj+aIBCOiDtgCY87wLAMbogzYAmPS8GwAa9kEIAKY97w6ADfpgHACK8LxbAEb6YHVwqPM1j5sfPOZ3SZ53D8DgcLfLHsoWah6zIHsk2+HluvwF92zupxEV3NQAAAAASUVORK5CYII=",sCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmY3YWFkYzZiLWM2ZmEtNjE0OC05YWZkLTgxN2Q1OWRkZTI0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc2NTFhZmQyLWU5YTctOTc0Zi1hZWFkLTdiMWMyODQ2YWEzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmN2FhZGM2Yi1jNmZhLTYxNDgtOWFmZC04MTdkNTlkZGUyNDIiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6TWt7cAAAFm0lEQVR42u2dT2xURQCHSTXpQTH0oIJpgfZKi1ETiSK1MV7FbORQNcG0Hmg3oQVjjKARrhDBBDEYMSEYS6kWkxoVAheDiBc9kHBBuaGgMSo1KgTF+pt0JLq6dOe93X3z5zt8SbPdvtmZ37fvvc7Mm5k3MzMzD9KFRkAAGgEBAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABPKO0f3OrWCxWiTViROwQ+8QBcchywL62w77HvLdPdJpjIEAYYd8sHhDPiD3iuLggfhczGblqj/GJ2Cs2il5xCwL4EfoK8bw4LH7MEbQrF8UR8aK4T7QgQPNC77On6jNNDHwuzopXzGdDgMaEvlRsEqc8Cr0ap+2ZoRMB8gdvrulviT8CCP7/7h/GxIMI4B78Q+KjAEOvhrlHeRgB5g7e3FB9GFHwlZi6rUSA/wZ/m3g94uAreVMsRIDZ8J8S3yUU/t98L55OVgDby3Y4weArMf0JXUkJoAo/Ln4i/GtMiyeTEEAV3U3gVXktWgFUuXbxKSHPyWeiIyoBVKG7xXnCrRnTVvdEIYAqsjrniFwjGteciabEuGXKvnbes57ER4MWQBVY60FD/ioOiiHRfb3xfTt/oNu+1/zNLx58/rVBCqAPPlxww52x4/e356jDrfYYXxZcl+GgBCg4/Gk7KaSljvVpsSJcLLBe5SAEMB+04L72JQ08qy0ueKyi7LUABYe/pYn/0r4UiwSxhD9UQIfWuhgkiOGav67A8YzgJeC0n7/+W0KWIOTwj3o0keVoqBKEGv5vYoFHAiwQl0KUIMTwDSM5wuoQg3Ya90HLTvtaR47jjhbcJuWmCOBB+OcyBrTcPgJ25TrHvmKFuDNjGedCkyC08DN9+20vnms5GwM8CzhLEFr45jo73zGUbTnK2+5Y1nxxOSQJQgrf8G4B38gRxzInPWmrcl0E8Ch8w4BDEF11LLfLodwBj9qrnEsAz8I3LHMI4r06ljvpUO4yz9qsnEkA/WG/ZxX5VtxQYwh3NKD8RTWWfaOHzzn0OwmgP2izU5J8qsQJh2/hYMGXnxMePqja5iLAdg8nSk45BPBqA8rf5VD+lIftt81FgC88rMC4QwDvNKD8CYfyxz1sv88RAAG4BHAJSOMmcICbwBw3gRH8G7ioAeUvTObfwEg6giYL6gjqjqIjiK7gzF3Bg6VYuoIjGAwaYTAoruHgywwHFzAc7JkEoxkmamwQfzIhJI4pYd9knK7VU+OUMNOJszxjGV9HPSXMIwlGc0zebLf9BDsrJoWa19pzHHdDEpNCPZHgUrWOjYKmhbclNS3cEwmOeSTAseQeDPFEgq08GsbDoUMFhj+U/MOhnpwJhgmfBSK2ctpniRizx8DSBga/hCVi/JfgZ/FsrUPHjotETbNIVDjLxH1lVwtjmTgWitw8YYXsqWGhyB773gkWiqyPBI/M0f/ebC7YZWHf/0dXsPn5pP2dL5/TLK+7OpbFou8ygzgsAl37gJdpM5aLT5OTeQalQtgwYhchV2V3KlvG9LNlzL8waxA/kdqmUWY7WDaNmm2DtDaNYtu4a9vGDbJxZJobR75RYuPIqlvHfhBx8GYc4X62jk1v82hTFzaPzrh9/H7PNp2qFbPl/duil+3j6zMMu0mcCiD40+IF0RlC2wYhQIUMveJluymUL6GftWsP94XWnsEJUCHDveI5e439oYmBm06sI/abvqKeG1QhQHYZbhIr7fj9HvFxaXYjyDz3D1ftMY6LvfbYq1yfT0SA4qRotcvDm5vJNfZpYXP52CfGxCHLmH3N/G69eMyczkuzW9y3xtxGUQsACAAIAAgACAAIAAgACAAIAAgACAAIAAiAADQCAgACAAIAAgACAAIAAgACAAIAAgACAAIAAkCc/AWkhfX2hx9ZaQAAAABJRU5ErkJggg==",oCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAATr2AAE69gE6sVc6AAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PslPja4AAAbiSURBVHja7Z17iFVFHMc1K80ybc3SP9K21YrubtLDiIJqK5WMpbYt1MpSKiKkba0gtU0rCCpoyxRXSKrNiJIwCmtD0u2JEWFuSC/t2sueghDU2svbd2D+uFzce89rzvxm5vvHB2TX5Zw758PMufN7zJBSqTSEhAsHgQJwECgAoQCEAhAKQCgAoQCEAhAKQCgAoQCEAhAKQCgAoQDVaO1ZOgWsB7+CAbALLAPDOdCeC4CH3AJKg/AlGM/B9lQAPNxG8HcVARS7wQQOuJ8CPFvj4VMCXwXAAx0BfowoACXwUIA68EcMASiBh0vApzEFoASeCdCZQABK4JEAw0A/JQh7H2A8KFKCsHcCxUugX1qnghlgLrgBzNP/bgXTwTRwAjiEAsQf4AkpJChmJYF+0M1gIegGm8Dn4M+I9/If+B68B3rAneBiMIoCCJwJ8DejwZVgBfgQ7E94/Vqor7ybwVJwOgWwKAH+z3HgJrDR4AOvxU7wIDiFAuQoAX7XZumBV0MtF20UID8JnhMoQUlvjXeAw5kQYl6CVUIlUOwD7WBo8BlBhiVYK1gCxU/giuBTwgxL8IJwCRTvg/qgcwINS/CKAxIolgSdFGpYgjcdkeATMDHYrGDDErzriASK+cGmhZuSAD8/DHzskARrg60LMCjBkQkTVWwuCccGWRhiUIIx4DOHJNgLCkFWBhmUYJzer3dFAhWFnOXjRtAosA6cb0ECFaL+xiEJFAt8E6BXf7Cfq22GGJRgIvjBMQlu9yUWsOUgW6M2JGgAvzgmQYfr0cA3quyPm5KgWEWCaXpLVhWtXqVp11k/6uffCpRgoav5AC9GCJvWS0svw99NVhs0OtHkgBAJ5rmWEbQiRqSs3saOYcTPcTzoAv8KkGCGKzmBnQnCpbkvBwlE2GRZAJXQ2ig9K3hOipi52Jmg7D7aLUvwXdbp81k+/DPAPykTJ1yQYKbld4MPJFYGHZPi4bgowaWWZ4I10gTYmHEKlQsS3GxZgtukFIfeayiPzgUJnrYswVm2G0Q0G06mFC2BCuHq7W1bAmxPW8OYNsBjOtJmUoKvwaQMJOiwPAussiVAXoUZJiVQJWW/gR3gSdXrMME4jIzZJ8kEl+UqgC7EzDu33pQElSxPMB6PWRZANeU8KhcBdJKFDeNNxg4q6Yk5JhcJ2CpemZcA6yxX2YibCVQdoIBlQHGhUQHUWiOk+PLEnCRoTJD0YpM+0wJIybS9xmCnknK6YozNGiFjM8eIAAJ2vsqjYlEaSGQxE2yLMT4PCBmfreBkEwK8JuQDfhTjnpsySNUeGfFaiwVlEd1hQoBXhXy4vpjf0femvF6TYzOAMQGkLAHbY763bEt5vWLEJadb0BIwxeeXQJXZOyLGPT+ewTVrSqDi9EIEmO3718DI07K+50JG16xVlfywgHHpzWMj6CkBH/SWmPe8PCcJHrU4JurUltPyEODoDDdakvJ8gvvuyejaRaES3JVnMMj2UvA7GJvgvu/zdCbYYiMc/IRlCRYlvO8GHfrdoY+42+/4TPBXkqk/q4wgm504dsf5NlDlM0zS4VQTM8Ej0nMD0w5ewWKf3kSxews9i0xK8LKEpND5lpeCMx2QwMRyoFLaxkhJC++yKIBay48IcCY4T1pl0GaLErzuSAu7rGaCzJpHZCnAOD0AtiTYEIgEqyUXhxYSHCSZaahYlal5LME7LpSHTxewSdTioQS7TPQSNNUgYoGAeMFbWdTTm+xPEEMCVbvQ4FqLmEVCIodv62PhRjs6E6iS+7NdbRJ1j6AsmQEtw0r1Fg2uBVdrHtJNoqYKlKDZ9TZxSxxqy2atIHWQfYLLfWkUeTcliC3BTN+OjLmVEkSSQEUqr/f1yJgWQb33vGhS4eKRMY36aw0lECCBrfbwdQ6d6uG1BLbPCeimBHYlkHBYxNyU/QUpgScnhmylBPlLIOoUS71Dd4ASBCpAWW1/LyUIVICyQbxE+IFPXkgg/nx7DMSNQvrveCmBeAEqRJA4I+wD57oqgTMCVHTqlvaO0GcrnyA4ASpeFhdn0AAiKTt1HF8dRHWozaSSIAWoGNyTdM/eDQbjDOq0jvX61JCmFPsdoiTwQoCDNG08R7e0Wa1zA7/SGUFRBnqP3pRSp57dD9rAqWBohjOX1TOQvBagysCP1V3DLgCz9IOdDa4DrarSRjWgBMNcPSuZArglpAgJ+DDclaA/i9mKD8JtCTopQNgS9FOAsCVQdZh1FCBcCfakbZPDgXdbgme4BIQrgWoMWaAA/kqgTiz/oooALdwH8F+C4WCZDjwN6L6GL4HJ3AkkFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIByGD8DzQJyO8fOgE8AAAAAElFTkSuQmCC",aCe="/CharacterStudio/assets/play-de4238c5.png",lCe="/CharacterStudio/assets/reverse-e35421b8.png",ACe="/CharacterStudio/assets/pause-b6381fd4.png",cCe="/CharacterStudio/assets/fast-forward-0d3ffae5.png",uCe="/CharacterStudio/assets/fast-backward-1f713448.png";function Sb({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=Be.useContext(lr),[a,l]=Be.useState(s.userActivated),[A,c]=X.useState((o==null?void 0:o.getCurrentAnimationName())||"");Be.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&c(n)},[n]);const u=()=>{r()},h=m=>{m?o.play():o.pause(),o.setSpeed(1)},d=m=>{o.play(),o.setSpeed(m)},p=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},f=async()=>{console.log("play next"),await o.loadNextAnimation(),c(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),c(o.getCurrentAnimationName())};return L.jsxs("div",{className:Kn.Container,children:[L.jsx("div",{className:Kn.ContainerPositionTop,children:L.jsxs("div",{className:Kn.flexButtonsTop,children:[L.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{d(-2)},children:L.jsx("img",{src:uCe})}),L.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{d(-1)},children:L.jsx("img",{src:lCe})}),L.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{h(!1)},children:L.jsx("img",{src:ACe})}),L.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{h(!0)},children:L.jsx("img",{src:aCe})}),L.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{d(2)},children:L.jsx("img",{src:cCe})})]})}),L.jsxs("div",{className:Kn.ContainerPosition,children:[L.jsx("div",{className:Kn.topLine}),L.jsxs("div",{className:Kn.flexSelect,children:[L.jsx("div",{className:`${Kn["arrow-button"]} ${Kn["left-button"]}`,onClick:g}),L.jsx("div",{className:Kn.traitInfoTitle,style:{marginBottom:"10px"},children:A}),L.jsx("div",{className:`${Kn["arrow-button"]} ${Kn["right-button"]}`,onClick:f})]}),L.jsxs("div",{className:Kn.flexButtons,children:[e&&L.jsx("div",{className:`${Kn.optionButtons}`,onClick:e,children:L.jsx("img",{src:nCe})}),L.jsx("div",{className:`${Kn.optionButtons}`,onClick:p,children:L.jsx("img",{src:a?oCe:sCe})}),L.jsx("div",{className:`${Kn.optionButtons}`,onClick:u,children:L.jsx("img",{src:i?iCe:rCe})})]})]})]})}const dCe="_tokenBoxWrap_q4pvo_1",hCe="_mask_q4pvo_7",fCe="_timer_q4pvo_31",pCe="_level_q4pvo_42",gCe="_mythic_q4pvo_55",mCe="_epic_q4pvo_60",vCe="_rare_q4pvo_65",yCe="_uncommon_q4pvo_70",wCe="_common_q4pvo_75",BCe="_none_q4pvo_80",CCe="_value_q4pvo_85",bCe="_frame_q4pvo_95",xCe="_emptyIcon_q4pvo_111",ICe="_badge_q4pvo_123",FCe="_frameActive_q4pvo_131",pA={tokenBoxWrap:dCe,mask:hCe,timer:fCe,level:pCe,mythic:gCe,epic:mCe,rare:vCe,uncommon:yCe,common:wCe,none:BCe,value:CCe,frame:bCe,emptyIcon:xCe,badge:ICe,frameActive:FCe,default:"_default_q4pvo_159"},ECe="/CharacterStudio/assets/magic-box-cd45f027.png",LA=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,A]=X.useState(!1),c=()=>{A(!0)};return L.jsxs("div",{className:pA.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&L.jsx("div",{className:jh(pA.frame,pA.frameActive)}),L.jsx("div",{className:jh(pA.frame,o&&pA[o])}),L.jsx("img",{src:l?ECe:s,className:pA.emptyIcon,style:a,onError:c}),i&&L.jsxs("div",{className:jh(pA.level,o&&pA[o]),children:["Lv.",i]})]})},_Ce="_InformationContainerPos_72ckd_2",SCe="_scrollContainer_72ckd_15",UCe="_traitInfoTitle_72ckd_27",QCe="_traitInfoText_72ckd_35",RCe="_flexSelect_72ckd_62",MCe="_checked_72ckd_119",TCe="_checkmark_72ckd_123",NCe="_checkboxHolder_72ckd_136",qo={InformationContainerPos:_Ce,scrollContainer:SCe,traitInfoTitle:UCe,traitInfoText:QCe,"input-box":"_input-box_72ckd_43",flexSelect:RCe,"arrow-button":"_arrow-button_72ckd_70","left-button":"_left-button_72ckd_86","right-button":"_right-button_72ckd_93","anim-button":"_anim-button_72ckd_100","custom-checkbox":"_custom-checkbox_72ckd_105","checkbox-container":"_checkbox-container_72ckd_110",checked:MCe,checkmark:TCe,checkboxHolder:NCe};function BQ({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=X.useContext(Ci),{characterManager:i}=Be.useContext(lr),[s,o]=Be.useState(0),[a,l]=X.useState({}),[A,c]=X.useState([]),u=f=>{i.setManifest(f),i.loadInitialTraits().then(()=>{r(!1)})};Be.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),c(Object.keys(i.getAvatarSelection())))},[t]);const h=f=>{i.loadTraitsFromNFTObject(f).then(()=>{r(!1)})},d=async()=>{if(!t)if(r(!0),s>=n.length-1)e?u(n[0]):h(n[0]),o(0);else{const f=s+1;e?u(n[f]):h(n[f]),o(f)}},p=async()=>{if(!t)if(r(!0),s<=0)e?u(n[n.length-1]):h(n[n.length-1]),o(n.length-1);else{const f=s-1;e?u(n[f]):h(n[f]),o(f)}};return(n==null?void 0:n.length)>0?L.jsxs("div",{className:qo.InformationContainerPos,children:[L.jsx(ka,{title:"Trait Selection",width:180,right:20}),L.jsxs("div",{className:qo.scrollContainer,children:[L.jsxs("div",{className:qo.flexSelect,children:[(n==null?void 0:n.length)>1?L.jsx("div",{className:`${qo["arrow-button"]} ${qo["left-button"]}`,onClick:p}):L.jsx(L.Fragment,{}),(n[s].name||n[s].manifestName)&&L.jsx("div",{style:{textAlign:"center",flex:1},children:L.jsx("div",{className:qo.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?L.jsx("div",{className:`${qo["arrow-button"]} ${qo["right-button"]}`,onClick:d}):L.jsx(L.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&L.jsx("img",{src:n[s].thumb||n[s].thumbnail,alt:"Selection Thumbnail",style:{width:"280px",height:"460px",display:"block",margin:"20px auto 20px"}}),n[s].attributes&&n[s].attributes.map(f=>L.jsx("div",{children:L.jsx("div",{className:qo.traitInfoText,children:`${f.trait_type} : ${f.value}`})},`json:${f.trait_type}_${f.value}`)),e&&A.map(f=>L.jsx("div",{children:L.jsx("div",{className:qo.traitInfoText,children:`${f} : ${a[f].id}`})},`val:${f}`))]})]}):L.jsx(L.Fragment,{})}const jL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAXASURBVHgB7ZzNchNHEMd7ZiWf5WtSCSIfVa5cLN+MTRXrEFPcWJwHwNxys/0Etm+5YZ4Ac0pOIG4EU2WlCgffIm4+pIhS8ADKEQlt07OSKKGdlVdSz64K9++kmhlpR3+Pe3qmuwUgCIIgCIIgCIIgCIIgCIIgCIIgXHAUzCDLflDWRfCVgkVA5aOCkgqhRLMt9cdQW0MhNEBhHRFehW2ondaqDZgxZkZg3w9KrTm9RdJtknBlmAwjeLXTgvuzInbuAi//FPieUrv00gdW1GGnHe7nLXRuAkdmoKDvKYUBOCVfoT3IgSvrP295Gn4nG1sB91S0p4Kvvl34/83rszpkTOYrePXGxj1A3E41GKGGCl/Rq7oXQpM2tma/q0PC0R+orFAt0rfwU32eUgcnzx7tQIZkJrDZxNpFdUwvR6/arqgP59pQrdWqTUj52a0iBCT2nRRi14ttXEv72dOSicCpxCVhFeD+i+fVGkzB8s2g7HVgj77anRHDMhO5ABkwUlzjz4Z4d1ph+5w+jTazzZX1oEYmYTfB5av05rQEjtHgmMjmJoiLqKrFFi5xiTtEPTqcJFPpzc0pTk0EraJNBeqBrU9hZA72wAH03ArZ4+PBk18Socadl39UD8ARzgTuHnfVMT2gPNw3K+L2aHbauOTKT3ZmIrwi7NrENWYhR3Ftm1pJz2lnpsKJwGb10jrdjHXQhhYWQid+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q9YrqX8ujDk+OHt0FZtKKO9i2un7buGj+8Fha4fPcvjH7CtYeWI/BHS/cB2YmEbffbhvfKkC6I/wY8JsIrW7F2uiUxm0aJhXX0PO7a7H3qJGnv4lgFdiYB6vnQHcLwMg04n6cE1jnVF75ceMSMMIqsAnz2NrNxQ0wwSHu6DmFa8AIr4kILUdiMg9cGweXuIbenGqxDo/3jppVYKXpbnaI3n3u1HCK+3FuYXxuZIevASOsApNdK8faMO7Yj4sLcSM0xCMcmPqInfIRjNDFTnm4jWJSU4VpnIlr5hbaj87AiPPrymlwKa6hrS6wwK7FzQpegTG+Ijp6/BXxuYhr4N3kFMYEVu/HEzhLcZU90tIARrg3ubhNG8OvzHrlWuN1OMMCk1/553Abib6Y5r15mAWXfnsfXhusrS6Zb8L2o96Wh7i9OfmWrqncymFYBQ49y9GTaGkIkt6T14ZmElVs7UnfYVJYBTZXknSaawy3K89+DZint6BsiSkUTuK+VuX3gxFs14D+cMwrT3G7McO4eUDEJ8AMu8Bz7+HA1j4Y88rbz02KGZJ5YM+PcJIXkRTzIuHWQjqe5inuletBoLV6HO9xEzN0clROinnRKn6Qp7hRxEUraw6Ei5ihwYnAJuZlEkwsXeU8j79RRj3YkgHVoYt0guiZ4IgowQQhVSQjC3FXbmzsWssVyHNwtXoNzkoI3v5z1vz6m4V3FCK4OWpcZuIi7tn6yK3cefnMSXZnhNMajTevz04vXV6YJ5GXrQPM6mnDztvGGUvMbhhzWvviux9+U4C/gPXxeP/kqPorOCSTDHfyKv6G5Ox2czjZ/+uoegiMmPIwbTZVSKy5q58cPXaegJ1JhrtJ1x+R5V42OcSr6xvXOMqtUtbdRSUEkAGzVwRDoXSTFDJREUz3+OufM/zzK4IZ5Or14AC12ko5vGZqkcMQ/sOBWy5FURK6yy31apkrtFNV0iRcG5v74qi6DRmSS6WnKS0YUaDigiZdNOyfPHdXKpBELpWepuLyy+8XnmiEefobp454TII58IQFvE2u2FPIgfyLwdPVtY0PU93dtMzMzxkYoXUHtsl03JrUdJCdbmjEhwW60ctqEzuP2fxBjq7YPph6ZFSLaGqSP/VnmyQm3cqZ+uUoDlif1R/kEARBEARBEARBEARBEARBEARBEC48HwDC3eeu0ZVWOQAAAABJRU5ErkJggg==",kCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wMlQxMTo0OTozNy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBiNWViMTliLTkxMmEtMmI0NS1iOTZlLTliNDUxOGUzZDU4NyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjg4ODliZDlkLTAxZjItMTQ0Ni04NDE4LWYyYzNjNjQ1ODNlOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODg4OWJkOWQtMDFmMi0xNDQ2LTg0MTgtZjJjM2M2NDU4M2U4IiBzdEV2dDp3aGVuPSIyMDI0LTAxLTAyVDExOjQ5OjM3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wMlQxMTo1MjoyMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv0y+4AAAASPSURBVHja7ZxrSBVBFMctyqIgC0ujJ5UFaQpZRC/7YoUVQYUUkZQYQoVfJBF62PtBlhlJoJWSUQRSEYUFUVRiSEWRiokVgZqRWUEv7W3/oQkul53Ze+/OXWfyfPh98e6cPfNjnZ2ZPbshnZ2dIUTwIAkkmAQTJJgEk2CCBJNgEkyQYBKsgFnzlsaCanARZICFIJwEqxN8CXR68R08479lgxVgDAkOTPATC8EiXoLbYB9YDeJJsFzucPDLD8FWvABlIBcsAeNBKAn+K3i+Q7ki3oNycAys4eP8gO4oeH2QBFvxFVSAYj6uR3cHwWdcFGzFG1AF8sBakOBkeNFR8AMbAY/BedDqovQPoA6UgghjBbMxkXfGqpMfwUyv4w90wRV+1GTBCyQdmy5oc8hlwQdMFrxF0KlzkjbDwA8XBSebLPikv1cNfusBml0UHGWy4BpBp0olbYaAjgBlselZHBgNloNGm+PbQF8jBfsgKlrQbnuActMtYoWCBkmb68ZO09hNzEbIUzDCq82GAOXekuSRJGl3xGTBmT6IYXsU10Ahn5cGOo5ukeQxCLQL2q0zWXCBizeq7TZD1XdBu1iTBVe4KPieJI9kQZtPYKCRgpF4P/DW5QVDnkUeUVyk1fH3jd2L4Pu1KqSxMfohH6cbfbmS+eqRTdX22ixYck0WnKZAbguY5BV3o8IrPsVkwWUKBMQIYmcpEjzdZMF3eCfaA4C1OxGkld4/WgPdE9ZBLttLGMwJD4AI0F8SvycfPpwIvkuFJ2LBQyXzWl8pck0wmwuCcWCUZrCcwizy3aZg/E13RTBONMXjpL81g+W0wyvf/YpucHPdEpzbxQ8k7djlkesmRTHbnZRt+Ss4T3PBOz1y3aooZq1rj+1xsoMGCd6sKOYFEhxcwRm6Cf4JvmksuIUXlrz2MeZknQTv5k95e4HZvCM6CU73c5O/w2ldskrBqTbL4K4WnCbIL0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+KyJYFZsPdUrvzmSWM9dL8D2YZpWw4tBlrEyTz4n1mmaxvK5DvLBTY9NIitKdBT8P63k1pPg4ApOMllwBX+9agZYKamqdCI4x0Ec9vg+0lTBhYLYVxQLznYQp65L3jJSILhN9G4a/j5RseAefBW5gy00/PwvuWSq4GKb+PWqBAviR/Ay2UxeTV8pqObJMlVwiU38hmAKlizl4/iCqIjXIS8yeYgIE8SOUTlEGPkyuKKb3FlB7FskWN00jX1sIxVM4/uxTaqnad1dcNAXGiSYBGsjuJoXvJTy95VJsEJWeZ2/N7hBghWXQXnl0Ae8IsHOGSfJ4zAJdv59HVlR9SYS7JxESR4XSbBzLgtyiKebnDqugrEe248pkveISbAD3oEvtNCglRwJ1l1wvuaC95gueJ/mgnNMFxzFH6m84V841YVW/nZ9DH0/mD4xTpBgEkyQYBJMggkSTIJJMEGCteYPxO/zzCRZDV4AAAAASUVORK5CYII=",DCe="/CharacterStudio/assets/color-palette-71a7a2d4.png";var Ws={},_0={},LCe=typeof pa=="object"&&pa&&pa.Object===Object&&pa,o5=LCe,VCe=o5,PCe=typeof self=="object"&&self&&self.Object===Object&&self,OCe=VCe||PCe||Function("return this")(),Ga=OCe,WCe=Ga,GCe=WCe.Symbol,S0=GCe,KL=S0,a5=Object.prototype,ZCe=a5.hasOwnProperty,JCe=a5.toString,ng=KL?KL.toStringTag:void 0;function HCe(n){var e=ZCe.call(n,ng),t=n[ng];try{n[ng]=void 0;var r=!0}catch{}var i=JCe.call(n);return r&&(e?n[ng]=t:delete n[ng]),i}var zCe=HCe,YCe=Object.prototype,XCe=YCe.toString;function jCe(n){return XCe.call(n)}var KCe=jCe,$L=S0,$Ce=zCe,qCe=KCe,ebe="[object Null]",tbe="[object Undefined]",qL=$L?$L.toStringTag:void 0;function nbe(n){return n==null?n===void 0?tbe:ebe:qL&&qL in Object(n)?$Ce(n):qCe(n)}var Wu=nbe,rbe=Array.isArray,Po=rbe;function ibe(n){return n!=null&&typeof n=="object"}var Xl=ibe,sbe=Wu,obe=Po,abe=Xl,lbe="[object String]";function Abe(n){return typeof n=="string"||!obe(n)&&abe(n)&&sbe(n)==lbe}var cbe=Abe;function ube(n){return function(e,t,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[n?a:++i];if(t(s[l],l,s)===!1)break}return e}}var dbe=ube,hbe=dbe,fbe=hbe(),pbe=fbe;function gbe(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=Rbe}var bQ=Mbe,Tbe=Wu,Nbe=bQ,kbe=Xl,Dbe="[object Arguments]",Lbe="[object Array]",Vbe="[object Boolean]",Pbe="[object Date]",Obe="[object Error]",Wbe="[object Function]",Gbe="[object Map]",Zbe="[object Number]",Jbe="[object Object]",Hbe="[object RegExp]",zbe="[object Set]",Ybe="[object String]",Xbe="[object WeakMap]",jbe="[object ArrayBuffer]",Kbe="[object DataView]",$be="[object Float32Array]",qbe="[object Float64Array]",exe="[object Int8Array]",txe="[object Int16Array]",nxe="[object Int32Array]",rxe="[object Uint8Array]",ixe="[object Uint8ClampedArray]",sxe="[object Uint16Array]",oxe="[object Uint32Array]",pn={};pn[$be]=pn[qbe]=pn[exe]=pn[txe]=pn[nxe]=pn[rxe]=pn[ixe]=pn[sxe]=pn[oxe]=!0;pn[Dbe]=pn[Lbe]=pn[jbe]=pn[Vbe]=pn[Kbe]=pn[Pbe]=pn[Obe]=pn[Wbe]=pn[Gbe]=pn[Zbe]=pn[Jbe]=pn[Hbe]=pn[zbe]=pn[Ybe]=pn[Xbe]=!1;function axe(n){return kbe(n)&&Nbe(n.length)&&!!pn[Tbe(n)]}var lxe=axe;function Axe(n){return function(e){return n(e)}}var xQ=Axe,uC={exports:{}};uC.exports;(function(n,e){var t=o5,r=e&&!e.nodeType&&e,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&t.process,a=function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a})(uC,uC.exports);var IQ=uC.exports,cxe=lxe,uxe=xQ,t3=IQ,n3=t3&&t3.isTypedArray,dxe=n3?uxe(n3):cxe,u5=dxe,hxe=mbe,fxe=A5,pxe=Po,gxe=CQ,mxe=c5,vxe=u5,yxe=Object.prototype,wxe=yxe.hasOwnProperty;function Bxe(n,e){var t=pxe(n),r=!t&&fxe(n),i=!t&&!r&&gxe(n),s=!t&&!r&&!i&&vxe(n),o=t||r||i||s,a=o?hxe(n.length,String):[],l=a.length;for(var A in n)(e||wxe.call(n,A))&&!(o&&(A=="length"||i&&(A=="offset"||A=="parent")||s&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||mxe(A,l)))&&a.push(A);return a}var d5=Bxe,Cxe=Object.prototype;function bxe(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Cxe;return n===t}var FQ=bxe;function xxe(n,e){return function(t){return n(e(t))}}var h5=xxe,Ixe=h5,Fxe=Ixe(Object.keys,Object),Exe=Fxe,_xe=FQ,Sxe=Exe,Uxe=Object.prototype,Qxe=Uxe.hasOwnProperty;function Rxe(n){if(!_xe(n))return Sxe(n);var e=[];for(var t in Object(n))Qxe.call(n,t)&&t!="constructor"&&e.push(t);return e}var Mxe=Rxe;function Txe(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var np=Txe,Nxe=Wu,kxe=np,Dxe="[object AsyncFunction]",Lxe="[object Function]",Vxe="[object GeneratorFunction]",Pxe="[object Proxy]";function Oxe(n){if(!kxe(n))return!1;var e=Nxe(n);return e==Lxe||e==Vxe||e==Dxe||e==Pxe}var f5=Oxe,Wxe=f5,Gxe=bQ;function Zxe(n){return n!=null&&Gxe(n.length)&&!Wxe(n)}var Ub=Zxe,Jxe=d5,Hxe=Mxe,zxe=Ub;function Yxe(n){return zxe(n)?Jxe(n):Hxe(n)}var U0=Yxe,Xxe=pbe,jxe=U0;function Kxe(n,e){return n&&Xxe(n,e,jxe)}var p5=Kxe;function $xe(n){return n}var g5=$xe,qxe=g5;function e1e(n){return typeof n=="function"?n:qxe}var t1e=e1e,n1e=p5,r1e=t1e;function i1e(n,e){return n&&n1e(n,r1e(e))}var EQ=i1e,s1e=h5,o1e=s1e(Object.getPrototypeOf,Object),_Q=o1e,a1e=Wu,l1e=_Q,A1e=Xl,c1e="[object Object]",u1e=Function.prototype,d1e=Object.prototype,m5=u1e.toString,h1e=d1e.hasOwnProperty,f1e=m5.call(Object);function p1e(n){if(!A1e(n)||a1e(n)!=c1e)return!1;var e=l1e(n);if(e===null)return!0;var t=h1e.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&m5.call(t)==f1e}var g1e=p1e;function m1e(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var M1e=R1e,T1e=Qb;function N1e(n,e){var t=this.__data__,r=T1e(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var k1e=N1e,D1e=y1e,L1e=E1e,V1e=U1e,P1e=M1e,O1e=k1e;function rp(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,h=!0,d=t&qFe?new XFe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,GUe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,OUe.default)(r)?(0,VUe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,DUe.default)(r)&&t.push(r)}),t};_0.default=ZUe;var Q0={};function JUe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,uMe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,AMe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=dMe({},r[a],s[a])}),i}),r};Q0.default=hMe;var R0={};Object.defineProperty(R0,"__esModule",{value:!0});R0.autoprefix=void 0;var fMe=EQ,k3=gMe(fMe),pMe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){bMe(i,r);function i(){var s,o,a,l;CMe(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){SMe(i,r);function i(){var s,o,a,l;_Me(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:!0;r[o]=a};return e===0&&i("first-child"),e===t-1&&i("last-child"),(e===0||e%2===0)&&i("even"),Math.abs(e%2)===1&&i("odd"),i("nth-child",e),r};VQ.default=QMe;Object.defineProperty(Ws,"__esModule",{value:!0});Ws.ReactCSS=Ws.loop=Ws.handleActive=PQ=Ws.handleHover=Ws.hover=void 0;var RMe=_0,MMe=lp(RMe),TMe=Q0,NMe=lp(TMe),kMe=R0,DMe=lp(kMe),LMe=M0,W5=lp(LMe),VMe=T0,PMe=lp(VMe),OMe=VQ,WMe=lp(OMe);function lp(n){return n&&n.__esModule?n:{default:n}}Ws.hover=W5.default;var PQ=Ws.handleHover=W5.default;Ws.handleActive=PMe.default;Ws.loop=WMe.default;var GMe=Ws.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?h=1:h=Math.round(u*100/a)/100,t.a!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}else{var d=void 0;if(c<0?d=0:c>o?d=1:d=Math.round(c*100/o)/100,i!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}return null},ZI={},JMe=function(e,t,r,i){if(typeof document>"u"&&!i)return null;var s=i?new i:document.createElement("canvas");s.width=r*2,s.height=r*2;var o=s.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,s.width,s.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),s.toDataURL()):null},HMe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(ZI[s])return ZI[s];var o=JMe(e,t,r,i);return ZI[s]=o,o},V3=Object.assign||function(n){for(var e=1;e{const N=R.data.choices[0].text,k={name:F,message:N,timestamp:Date.now(),type:0};f(L=>[...L,k]),o(!1)}).catch(R=>{x.error=!0,o(!1),console.error(R)})}catch(M){o(!1),console.error(M)}}};let C=!1;return Be.useEffect(()=>{if(!s){if(r||C)return;C=!0;const b=new yye({});i(b),b.onerror=F=>console.error(F.error,F.message),b.onresult=F=>{const x=F.resultIndex;F.results[x].isFinal&&(B(`${F.results[x][0].transcript}`),o(!0))},b.interimResults=!0,b.continuous=!0}},[]),V.jsxs("div",{className:Ko.chatBox,children:[V.jsxs("div",{className:Ko.speaker,children:[V.jsx("p",{className:Ko.warning,children:a("text.apiUnderMaintnance")}),V.jsx("label",{htmlFor:"speaker",children:a("labels.yourName")}),V.jsx("input",{type:"text",name:"speaker",defaultValue:c,onChange:b=>u(b.target.value)})]}),V.jsx("label",{children:a("labels.conversation")}),V.jsx("div",{className:Ko.messages,children:V.jsx("div",{className:Ko.scrollBox,id:"msgscroll",children:p.map((b,F)=>{if(b.timestamp)return V.jsx(pye,{name:b.name,timestamp:b.timestamp,message:b.message,type:b.type,color:A,err:b.error},F)})})}),V.jsxs("form",{className:Ko.send,style:{opacity:s?"0.4":"1"},onSubmit:w,children:[V.jsx(sn,{type:"icon",theme:"light",icon:"microphone",className:Ko.mic,size:32,active:!!e,onClick:()=>e?v():m()}),V.jsx("input",{autoComplete:"off",type:"text",name:"message",id:"messageInput",value:h,onInput:g,onChange:g,disabled:s}),V.jsx(sn,{theme:"light",text:a("callToAction.send"),size:14,onSubmit:w,className:Ko.sendButton,type:"submit"})]}),V.jsxs("p",{className:`${Ko.isTyping} ${s&&Ko.show}`,children:[V.jsx("span",{style:{color:A},children:l.name})," is typing..."]})]})}function bye(){const{setViewMode:n}=X.useContext(Ci),[e,t]=X.useState(!1),[r,i]=X.useState(!1),{playSound:s}=X.useContext(bs),{isMute:o}=X.useContext(Bs),a=()=>{n(ot.SAVE),!o&&s("backNextButton"),r&&r.stop(),t(!1)},{t:l}=Be.useContext(xs);return V.jsxs("div",{className:Nc.container,children:[V.jsx("div",{className:"sectionTitle",children:l("pageTitles.chat")}),V.jsxs("div",{className:Nc.chatContainer,children:[V.jsx("div",{className:Nc.topLine}),V.jsx("div",{className:Nc.bottomLine}),V.jsx("div",{className:Nc.scrollContainer,children:V.jsx(Cye,{micEnabled:e,setMicEnabled:t,speechRecognition:r,setSpeechRecognition:i})})]}),V.jsx("div",{className:Nc.buttonContainer,children:V.jsx(sn,{theme:"light",text:l("callToAction.back"),size:14,className:Nc.buttonLeft,onClick:a})})]})}const xye="_buttonContainer_1fd4o_1",Iye="_buttonLeft_1fd4o_10",Fye="_buttonRight_1fd4o_14",Eye="_buttonCenter_1fd4o_18",Fy={buttonContainer:xye,buttonLeft:Iye,buttonRight:Fye,buttonCenter:Eye},_ye="_button_13dfi_1",LL={button:_ye},Sye="Anon",Uye=()=>{Be.useContext(xs);const[n]=X.useState(localStorage.getItem("name")||Sye),{model:e,characterManager:t}=Be.useContext(lr),r=()=>{const o=De.mergeOptions_sel_option||0;return{createTextureAtlas:De.mergeOptions_create_atlas==null?!0:De.mergeOptions_create_atlas,mToonAtlasSize:Cn(De.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Cn(De.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Cn(De.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Cn(De.mergeOptions_atlas_std_transp_size||6),ktxCompression:De.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:De.mergeOptions_two_sided_mat||!1}},i=()=>{const o=r();t.downloadVRM(n,o)},s=()=>{const o=r();t.downloadGLB(n,o)};return V.jsxs(X.Fragment,{children:[V.jsx(sn,{theme:"light",text:"GLB",icon:"download",size:14,className:LL.button,onClick:()=>{s()}}),V.jsx(sn,{theme:"light",text:"VRM",icon:"download",size:14,className:LL.button,onClick:i})]})},Qye="_InformationContainerPos_b0msk_1",Rye="_traitInfoTitle_b0msk_13",Mye="_traitInfoText_b0msk_22",Tye="_flexSelect_b0msk_33",Nye="_scrollContainer_b0msk_68",kye="_checked_b0msk_93",Dye="_checkmark_b0msk_97",Lye="_checkboxHolder_b0msk_110",ct={InformationContainerPos:Qye,traitInfoTitle:Rye,traitInfoText:Mye,flexSelect:Tye,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:Nye,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:kye,checkmark:Dye,checkboxHolder:Lye},Vye="_mainTitleWrap_4fb0s_1",Pye="_mainTitle_4fb0s_1",Oye="_topLine_4fb0s_18",NI={mainTitleWrap:Vye,mainTitle:Pye,topLine:Oye};function ka({title:n,width:e,left:t,right:r}){const i={width:e?`${e}px`:null,left:t?`${t}px`:null,right:r?`${r}px`:null};return n&&V.jsxs("div",{className:NI.mainTitleWrap,style:i,children:[V.jsx("div",{className:NI.topLine}),V.jsx("div",{className:NI.mainTitle,children:n})]})}const Wye="_slider_1y6nx_1",Gye="_infoContainer_1y6nx_13",Ey={"slider-container":"_slider-container_1y6nx_1",slider:Wye,infoContainer:Gye,"input-box":"_input-box_1y6nx_18"};function Qh({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return V.jsxs(V.Fragment,{children:[V.jsxs("div",{className:Ey.infoContainer,children:[n,o&&V.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Ey["input-box"],step:o})]}),V.jsx("div",{className:Ey["slider-container"],children:V.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Ey.slider,step:s})})]})}function Ib({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=Be.useState(De.mergeOptions_atlas_std_size||6),[s,o]=Be.useState(De.mergeOptions_atlas_std_transp_size||6),[a,l]=Be.useState(De.mergeOptions_atlas_mtoon_size||6),[A,c]=Be.useState(De.mergeOptions_atlas_mtoon_transp_size||6),[u,h]=Be.useState(De.mergeOptions_sel_option||0),[d,p]=Be.useState(De.mergeOptions_two_sided_mat||!1),[f]=Be.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,m]=Be.useState(De.mergeOptions_download_vrm==null?!0:De.mergeOptions_download_vrm),[v,w]=Be.useState(De.mergeOptions_download_vrm_preview==null?!0:De.mergeOptions_download_vrm_preview),[B,C]=Be.useState(De.mergeOptions_drop_download||!1),[b,F]=Be.useState(De.merge_options_ktx_compression||!1),[x,_]=Be.useState(De.mergeOptions_create_atlas==null?!0:De.mergeOptions_create_atlas),[M,Y]=Be.useState(De.mergeOptions_download_lora==null?!0:De.mergeOptions_download_lora),[O,U]=Be.useState(De.mergeOptions_download_sprites==null?!0:De.mergeOptions_download_sprites),y=T=>{C(T.target.checked),De.mergeOptions_drop_download=T.target.checked},I=T=>{p(T.target.checked),De.mergeOptions_two_sided_mat=T.target.checked},R=T=>{F(T.target.checked),De.merge_options_ktx_compression=T.target.checked},N=T=>{_(T.target.checked),De.mergeOptions_create_atlas=T.target.checked},k=T=>{m(T.target.checked),De.mergeOptions_download_vrm=T.target.checked},L=T=>{w(T.target.checked),De.mergeOptions_download_vrm_preview=T.target.checked},G=T=>{Y(T.target.checked),De.mergeOptions_download_lora=T.target.checked},D=T=>{U(T.target.checked),De.mergeOptions_download_sprites=T.target.checked},E=()=>{let T=u;u<=0?T=f.length-1:T-=1,h(T),De.mergeOptions_sel_option=T},z=()=>{let T=u;u>=f.length-1?T=0:T+=1,h(T),De.mergeOptions_sel_option=T},re=async(T,ee)=>{let pe=parseInt(T.target.value);pe>8?pe=8:pe<0&&(pe=0),(Ae=>{switch(ee){case"standard opaque":i(Ae),De.mergeOptions_atlas_std_size=Ae;break;case"standard transparent":o(Ae),De.mergeOptions_atlas_std_transp_size=Ae;break;case"mtoon opaque":l(Ae),De.mergeOptions_atlas_mtoon_size=Ae;break;case"mtoon transparent":c(Ae),De.mergeOptions_atlas_mtoon_transp_size=Ae;break}})(pe)};return V.jsxs("div",{className:ct.InformationContainerPos,children:[V.jsx(ka,{title:t,width:180,left:20}),V.jsxs("div",{className:ct.scrollContainer,children:[V.jsx("div",{className:ct.traitInfoTitle,children:"Download Options"}),V.jsx(V.Fragment,{children:V.jsx("div",{className:ct.traitInfoText,children:V.jsxs("div",{className:ct.checkboxHolder,children:[V.jsx("div",{}),V.jsxs("label",{className:ct["custom-checkbox"],children:[V.jsx("input",{type:"checkbox",checked:g,onChange:k}),V.jsx("div",{className:ct["checkbox-container"]})]}),V.jsx("div",{}),V.jsx("div",{}),"Download VRM"]})})}),V.jsx(V.Fragment,{children:V.jsx("div",{className:ct.traitInfoText,children:V.jsxs("div",{className:ct.checkboxHolder,children:[V.jsx("div",{}),V.jsxs("label",{className:ct["custom-checkbox"],children:[V.jsx("input",{type:"checkbox",checked:v,onChange:L}),V.jsx("div",{className:ct["checkbox-container"]})]}),V.jsx("div",{}),V.jsx("div",{}),"Download VRM Preview"]})})}),V.jsx(V.Fragment,{children:V.jsx("div",{className:ct.traitInfoText,children:V.jsxs("div",{className:ct.checkboxHolder,children:[V.jsx("div",{}),V.jsxs("label",{className:ct["custom-checkbox"],children:[V.jsx("input",{type:"checkbox",checked:M,onChange:G}),V.jsx("div",{className:ct["checkbox-container"]})]}),V.jsx("div",{}),V.jsx("div",{}),"Download Lora Data"]})})}),V.jsx(V.Fragment,{children:V.jsx("div",{className:ct.traitInfoText,children:V.jsxs("div",{className:ct.checkboxHolder,children:[V.jsx("div",{}),V.jsxs("label",{className:ct["custom-checkbox"],children:[V.jsx("input",{type:"checkbox",checked:O,onChange:D}),V.jsx("div",{className:ct["checkbox-container"]})]}),V.jsx("div",{}),V.jsx("div",{}),"Download Sprites Data"]})})}),g&&V.jsxs(V.Fragment,{children:[e&&V.jsx(V.Fragment,{children:V.jsx("div",{className:ct.traitInfoText,children:V.jsxs("div",{className:ct.checkboxHolder,children:[V.jsx("div",{}),V.jsxs("label",{className:ct["custom-checkbox"],children:[V.jsx("input",{type:"checkbox",checked:x,onChange:N}),V.jsx("div",{className:ct["checkbox-container"]})]}),V.jsx("div",{}),V.jsx("div",{}),"Create Atlas"]})})}),(e==!1||x)&&V.jsxs(V.Fragment,{children:[V.jsx("br",{}),V.jsx("div",{className:ct.traitInfoTitle,children:"Merge Atlas Type"}),V.jsx("br",{}),V.jsxs("div",{className:ct.flexSelect,children:[V.jsx("div",{className:`${ct["arrow-button"]} ${ct["left-button"]}`,onClick:E}),V.jsx("div",{className:ct.traitInfoText,style:{marginBottom:"0"},children:f[u]}),V.jsx("div",{className:`${ct["arrow-button"]} ${ct["right-button"]}`,onClick:z})]}),V.jsx("br",{}),V.jsx("br",{}),(u===0||u==2)&&V.jsxs(V.Fragment,{children:[V.jsx("div",{className:ct.traitInfoTitle,children:"Standard Atlas Size"}),V.jsx("br",{}),V.jsxs("div",{className:ct.traitInfoText,children:["Opaque: ",Cn(r)+" x "+Cn(r)]}),V.jsx(Qh,{value:r,onChange:T=>re(T,"standard opaque"),min:1,max:8,step:1}),V.jsx("br",{}),V.jsxs("div",{className:ct.traitInfoText,children:["Transparent: ",Cn(s)+" x "+Cn(s)]}),V.jsx(Qh,{value:s,onChange:T=>re(T,"standard transparent"),min:1,max:8,step:1}),V.jsx("br",{})," ",V.jsx("br",{})]}),(u===1||u==2)&&V.jsxs(V.Fragment,{children:[V.jsx("div",{className:ct.traitInfoTitle,children:"MToon Atlas Size"}),V.jsx("br",{}),V.jsxs("div",{className:ct.traitInfoText,children:["Opaque: ",Cn(a)+" x "+Cn(a)]}),V.jsx(Qh,{value:a,onChange:T=>re(T,"mtoon opaque"),min:1,max:8,step:1}),V.jsx("br",{}),V.jsxs("div",{className:ct.traitInfoText,children:["Transparent: ",Cn(A)+" x "+Cn(A)]}),V.jsx(Qh,{value:A,onChange:T=>re(T,"mtoon transparent"),min:1,max:8,step:1}),V.jsx("br",{})," ",V.jsx("br",{})]}),V.jsx("div",{className:ct.traitInfoTitle,children:"Options"}),V.jsx("div",{className:ct.traitInfoText,children:V.jsxs("div",{className:ct.checkboxHolder,children:[V.jsx("div",{}),V.jsxs("label",{className:ct["custom-checkbox"],children:[V.jsx("input",{type:"checkbox",checked:d,onChange:I}),V.jsx("div",{className:ct["checkbox-container"]})]}),V.jsx("div",{}),V.jsx("div",{}),"Two Sided Material"]})}),n&&V.jsx(V.Fragment,{children:V.jsx("div",{className:ct.traitInfoText,children:V.jsxs("div",{className:ct.checkboxHolder,children:[V.jsx("div",{}),V.jsxs("label",{className:ct["custom-checkbox"],children:[V.jsx("input",{type:"checkbox",checked:B,onChange:y}),V.jsx("div",{className:ct["checkbox-container"]})]}),V.jsx("div",{}),V.jsx("div",{}),"Drag Drop - Download"]})})}),V.jsx(V.Fragment,{children:V.jsx("div",{className:ct.traitInfoText,children:V.jsxs("div",{className:ct.checkboxHolder,children:[V.jsx("div",{}),V.jsxs("label",{className:ct["custom-checkbox"],children:[V.jsx("input",{type:"checkbox",checked:b,onChange:R}),V.jsx("div",{className:ct["checkbox-container"]})]}),V.jsx("div",{}),V.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}const Zye="_dropArea_1a0z4_1",Jye={dropArea:Zye};function F0({onFilesDrop:n}){const[e,t]=Be.useState(!1),[r,i]=X.useState(null);Be.useEffect(()=>{const o=l=>{l.preventDefault(),t(!1);const A=l.dataTransfer.files;n&&i(A)},a=l=>{l.preventDefault(),t(!0)};return window.addEventListener("drop",o),window.addEventListener("dragover",a),()=>{window.removeEventListener("drop",o),window.removeEventListener("dragover",a)}},[]),Be.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return V.jsx("div",{onDragLeave:s,className:Jye.dropArea,style:{display:e?"flex":"none"}})}function Hye(){const{t:n}=Be.useContext(xs),{playSound:e}=X.useContext(bs),{isMute:t}=X.useContext(Bs),{setViewMode:r}=X.useContext(Ci),i=()=>{r(ot.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(ot.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return V.jsxs("div",{className:Fy.container,children:[V.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),V.jsxs("div",{className:Fy.buttonContainer,children:[V.jsx(F0,{onFilesDrop:o}),V.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:Fy.buttonLeft,onClick:i}),V.jsx(Ib,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),V.jsx(Uye,{}),V.jsx(sn,{theme:"light",text:"mint",size:14,className:Fy.buttonRight,onClick:s})]})]})}const kc={},E0="abi/5.7.0",Lt=new we(E0),Fu={};let VL={calldata:!0,memory:!0,storage:!0},zye={calldata:!0,memory:!0};function _y(n,e){if(n==="bytes"||n==="string"){if(VL[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&zye[e])return!0;return(VL[e]||e==="payable")&&Lt.throwArgumentError("invalid modifier","name",e),!1}function Yye(n,e){let t=n;function r(a){Lt.throwArgumentError(`unexpected character at position ${a}`,"param",n)}n=n.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(r)}let t="";return this.baseType==="array"?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Jt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Jt.full?", ":",")+")"):t+=this.type,e!==Jt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Jt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?xr.fromString(e,t):xr.fromObject(e)}static fromObject(e){return xr.isParamType(e)?e:new xr(Fu,{name:e.name||null,type:Od(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(xr.fromObject):null})}static fromString(e,t){function r(i){return xr.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(Yye(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function Ym(n,e){return Kye(n).map(t=>xr.fromString(t,e))}class Il{constructor(e,t){e!==Fu&&Lt.throwError("use a static from method",we.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Fw(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Il.isFragment(e)?e:typeof e=="string"?Il.fromString(e):Il.fromObject(e)}static fromObject(e){if(Il.isFragment(e))return e;switch(e.type){case"function":return fa.fromObject(e);case"event":return vl.fromObject(e);case"constructor":return ha.fromObject(e);case"error":return EA.fromObject(e);case"fallback":case"receive":return null}return Lt.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?vl.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?fa.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?ha.fromString(e.trim()):e.split(" ")[0]==="error"?EA.fromString(e.substring(5).trim()):Lt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class vl extends Il{format(e){if(e||(e=Jt.sighash),Jt[e]||Lt.throwArgumentError("invalid format type","format",e),e===Jt.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Jt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Jt.full?", ":",")+") ",e!==Jt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?vl.fromString(e):vl.fromObject(e)}static fromObject(e){if(vl.isEventFragment(e))return e;e.type!=="event"&&Lt.throwArgumentError("invalid event object","value",e);const t={name:Xm(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(xr.fromObject):[],type:"event"};return new vl(Fu,t)}static fromString(e){let t=e.match(jm);t||Lt.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":r=!0;break;case"":break;default:Lt.warn("unknown modifier: "+i)}}),vl.fromObject({name:t[1].trim(),anonymous:r,inputs:Ym(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function ZH(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&Lt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||Lt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ge.from(t[1]),t[0]):n}function JH(n,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",n.split(" ").forEach(t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}})}function HH(n){let e={constant:!1,payable:!0,stateMutability:"payable"};return n.stateMutability!=null?(e.stateMutability=n.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",n.constant!=null&&!!n.constant!==e.constant&&Lt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&Lt.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",n)):n.payable!=null?(e.payable=!!n.payable,n.constant==null&&!e.payable&&n.type!=="constructor"&&Lt.throwArgumentError("unable to determine stateMutability","value",n),e.constant=!!n.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Lt.throwArgumentError("cannot have constant payable function","value",n)):n.constant!=null?(e.constant=!!n.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):n.type!=="constructor"&&Lt.throwArgumentError("unable to determine stateMutability","value",n),e}class ha extends Il{format(e){if(e||(e=Jt.sighash),Jt[e]||Lt.throwArgumentError("invalid format type","format",e),e===Jt.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});e===Jt.sighash&&Lt.throwError("cannot format a constructor for sighash",we.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Jt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?ha.fromString(e):ha.fromObject(e)}static fromObject(e){if(ha.isConstructorFragment(e))return e;e.type!=="constructor"&&Lt.throwArgumentError("invalid constructor object","value",e);let t=HH(e);t.constant&&Lt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(xr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new ha(Fu,r)}static fromString(e){let t={type:"constructor"};e=ZH(e,t);let r=e.match(jm);return(!r||r[1].trim()!=="constructor")&&Lt.throwArgumentError("invalid constructor string","value",e),t.inputs=Ym(r[2].trim(),!1),JH(r[3].trim(),t),ha.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class fa extends ha{format(e){if(e||(e=Jt.sighash),Jt[e]||Lt.throwArgumentError("invalid format type","format",e),e===Jt.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e))),outputs:this.outputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Jt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Jt.full?", ":",")+") ",e!==Jt.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(r=>r.format(e)).join(", ")+") "),this.gas!=null&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return typeof e=="string"?fa.fromString(e):fa.fromObject(e)}static fromObject(e){if(fa.isFunctionFragment(e))return e;e.type!=="function"&&Lt.throwArgumentError("invalid function object","value",e);let t=HH(e);const r={type:e.type,name:Xm(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(xr.fromObject):[],outputs:e.outputs?e.outputs.map(xr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new fa(Fu,r)}static fromString(e){let t={type:"function"};e=ZH(e,t);let r=e.split(" returns ");r.length>2&&Lt.throwArgumentError("invalid function string","value",e);let i=r[0].match(jm);if(i||Lt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&Xm(t.name),t.inputs=Ym(i[2],!1),JH(i[3].trim(),t),r.length>1){let s=r[1].match(jm);(s[1].trim()!=""||s[3].trim()!="")&&Lt.throwArgumentError("unexpected tokens","value",e),t.outputs=Ym(s[2],!1)}else t.outputs=[];return fa.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function PL(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Lt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class EA extends Il{format(e){if(e||(e=Jt.sighash),Jt[e]||Lt.throwArgumentError("invalid format type","format",e),e===Jt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Jt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Jt.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?EA.fromString(e):EA.fromObject(e)}static fromObject(e){if(EA.isErrorFragment(e))return e;e.type!=="error"&&Lt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Xm(e.name),inputs:e.inputs?e.inputs.map(xr.fromObject):[]};return PL(new EA(Fu,t))}static fromString(e){let t={type:"error"},r=e.match(jm);return r||Lt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Xm(t.name),t.inputs=Ym(r[2],!1),PL(EA.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Od(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const jye=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Xm(n){return(!n||!n.match(jye))&&Lt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const jm=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Kye(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&mQ.throwError("value out-of-bounds",we.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=is([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class sC{constructor(e,t,r,i){Me(this,"_data",At(e)),Me(this,"wordSize",t||32),Me(this,"_coerceFunc",r),Me(this,"allowLoose",i),this._offset=0}get data(){return nt(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):sC.coerce(e,t)}_peekBytes(e,t,r){let i=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?i=t:mQ.throwError("data out-of-bounds",we.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new sC(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return Ge.from(this.readBytes(this.wordSize))}}class qye extends Yl{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Vr(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return Vr(Pn(e.readValue().toHexString(),20))}}class ewe extends Yl{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const Rh=new we(E0);function zH(n,e,t){let r=null;if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(A=>{const c=A.localName;return c||Rh.throwError("cannot encode object for signature with missing names",we.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]&&Rh.throwError("cannot encode object for signature with duplicate names",we.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]=!0,t[c]})}else Rh.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Rh.throwArgumentError("types/value length mismatch","tuple",t);let i=new R_(n.wordSize),s=new R_(n.wordSize),o=[];e.forEach((l,A)=>{let c=r[A];if(l.dynamic){let u=s.length;l.encode(s,c);let h=i.writeUpdatableValue();o.push(d=>{h(d+u)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function YH(n,e){let t=[],r=n.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=n.readValue(),l=r.subReader(a.toNumber());try{o=s.decode(l)}catch(A){if(A.code===we.errors.BUFFER_OVERRUN)throw A;o=A,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(a.code===we.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&t.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),t[a]!=null))return;const l=t[o];l instanceof Error?Object.defineProperty(t,a,{enumerable:!0,get:()=>{throw l}}):t[a]=l});for(let s=0;s{throw o}})}return Object.freeze(t)}class twe extends Yl{constructor(e,t,r){const i=e.type+"["+(t>=0?t:"")+"]",s=t===-1||e.dynamic;super("array",i,r,s),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&Rh.throwError("insufficient data length",we.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let i=0;i{o.dynamic&&(r=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach(r=>{e.push(r.defaultValue())});const t=this.coders.reduce((r,i)=>{const s=i.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,i)=>{let s=r.localName;!s||t[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,t){return zH(e,this.coders,t)}decode(e){return e.coerce(this.name,YH(e,this.coders))}}const Uy=new we(E0),lwe=new RegExp(/^bytes([0-9]*)$/),Awe=new RegExp(/^(u?int)([0-9]*)$/);class cwe{constructor(e){Me(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new qye(e.name);case"bool":return new nwe(e.name);case"string":return new awe(e.name);case"bytes":return new rwe(e.name);case"array":return new twe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Sy((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new swe(e.name)}let t=e.type.match(Awe);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Uy.throwArgumentError("invalid "+t[1]+" bit length","param",e),new owe(r/8,t[1]==="int",e.name)}if(t=e.type.match(lwe),t){let r=parseInt(t[1]);return(r===0||r>32)&&Uy.throwArgumentError("invalid bytes length","param",e),new iwe(r,e.name)}return Uy.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new sC(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new R_(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(xr.from(i)));return new Sy(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Uy.throwError("types/values length mismatch",we.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(xr.from(o))),i=new Sy(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(xr.from(o)));return new Sy(i,"_").decode(this._getReader(At(t),r))}}const uwe=new cwe,Fn=new we(E0);class dwe extends t0{}class hwe extends t0{}class fwe extends t0{}class M_ extends t0{static isIndexed(e){return!!(e&&e._isIndexed)}}const pwe={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function OL(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class WL{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Me(this,"fragments",t.map(r=>Il.from(r)).filter(r=>r!=null)),Me(this,"_abiCoder",ss(new.target,"getAbiCoder")()),Me(this,"functions",{}),Me(this,"errors",{}),Me(this,"events",{}),Me(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){Fn.warn("duplicate definition - constructor");return}Me(this,"deploy",r);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=r.format();if(i[s]){Fn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Me(this,"deploy",ha.from({payable:!1,type:"constructor"})),Me(this,"_isInterface",!0)}format(e){e||(e=Jt.full),e===Jt.sighash&&Fn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Jt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return uwe}static getAddress(e){return Vr(e)}static getSighash(e){return zr(sh(e.format()),0,4)}static getEventTopic(e){return sh(e.format())}getFunction(e){if(Ft(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];Fn.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===r);return i.length===0?Fn.throwArgumentError("no matching function","name",r):i.length>1&&Fn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[fa.fromString(e).format()];return t||Fn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Ft(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];Fn.throwArgumentError("no matching event","topichash",r)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===r);return i.length===0?Fn.throwArgumentError("no matching event","name",r):i.length>1&&Fn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[vl.fromString(e).format()];return t||Fn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Ft(e)){const r=ss(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}Fn.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===r);return i.length===0?Fn.throwArgumentError("no matching error","name",r):i.length>1&&Fn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[fa.fromString(e).format()];return t||Fn.throwArgumentError("no matching error","signature",e),t}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch{throw t}}return ss(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),ss(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){typeof e=="string"&&(e=this.getError(e));const r=At(t);return nt(r.slice(0,4))!==this.getSighash(e)&&Fn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",nt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return typeof e=="string"&&(e=this.getError(e)),nt(is([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){typeof e=="string"&&(e=this.getFunction(e));const r=At(t);return nt(r.slice(0,4))!==this.getSighash(e)&&Fn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",nt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return typeof e=="string"&&(e=this.getFunction(e)),nt(is([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){typeof e=="string"&&(e=this.getFunction(e));let r=At(t),i=null,s="",o=null,a=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch{}break;case 4:{const A=nt(r.slice(0,4)),c=pwe[A];if(c)o=this._abiCoder.decode(c.inputs,r.slice(4)),a=c.name,l=c.signature,c.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const u=this.getError(A);o=this._abiCoder.decode(u.inputs,r.slice(4)),a=u.name,l=u.format()}catch{}break}}return Fn.throwError("call revert exception"+s,we.errors.CALL_EXCEPTION,{method:e.format(),data:nt(t),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,t){return typeof e=="string"&&(e=this.getFunction(e)),nt(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){typeof e=="string"&&(e=this.getEvent(e)),t.length>e.inputs.length&&Fn.throwError("too many arguments for "+e.format(),we.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?sh(o):s.type==="bytes"?ir(nt(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=Ge.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),Pn(nt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&Fn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?Fn.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?r.push(s.map(l=>i(a,l))):r.push(i(a,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,t){typeof e=="string"&&(e=this.getEvent(e));const r=[],i=[],s=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Fn.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(sh(l));else if(o.type==="bytes")r.push(ir(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:r}}decodeEventLog(e,t,r){if(typeof e=="string"&&(e=this.getEvent(e)),r!=null&&!e.anonymous){let h=this.getEventTopic(e);(!Ft(r[0],32)||r[0].toLowerCase()!==h)&&Fn.throwError("fragment/topic mismatch",we.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:h,value:r[0]}),r=r.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((h,d)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(i.push(xr.fromObject({type:"bytes32",name:h.name})),o.push(!0)):(i.push(h),o.push(!1)):(s.push(h),o.push(!1))});let a=r!=null?this._abiCoder.decode(i,is(r)):null,l=this._abiCoder.decode(s,t,!0),A=[],c=0,u=0;e.inputs.forEach((h,d)=>{if(h.indexed)if(a==null)A[d]=new M_({_isIndexed:!0,hash:null});else if(o[d])A[d]=new M_({_isIndexed:!0,hash:a[u++]});else try{A[d]=a[u++]}catch(p){A[d]=p}else try{A[d]=l[c++]}catch(p){A[d]=p}if(h.name&&A[h.name]==null){const p=A[d];p instanceof Error?Object.defineProperty(A,h.name,{enumerable:!0,get:()=>{throw OL(`property ${JSON.stringify(h.name)}`,p)}}):A[h.name]=p}});for(let h=0;h{throw OL(`index ${h}`,d)}})}return Object.freeze(A)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new hwe({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Ge.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new dwe({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=nt(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new fwe({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const gwe="contracts/5.7.0";var Eu=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Hn=new we(gwe);function oC(n,e){return Eu(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&Hn.throwArgumentError("invalid address or ENS name","name",t);try{return Vr(t)}catch{}n||Hn.throwError("a provider or signer is needed to resolve ENS names",we.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&Hn.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function Ew(n,e,t){return Eu(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>Ew(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield oC(n,e):t.type==="tuple"?yield Ew(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>Ew(n,r,t.arrayChildren))):Promise.reject(Hn.makeError("invalid value for array",we.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fb(n,e,t){return Eu(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=xn(t.pop())),Hn.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=qn({override:oC(n.signer,r.from),signer:n.signer.getAddress()}).then(A=>Eu(this,void 0,void 0,function*(){return Vr(A.signer)!==A.override&&Hn.throwError("Contract with a Signer cannot override from",we.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),A.override})):r.from=n.signer.getAddress():r.from&&(r.from=oC(n.provider,r.from));const i=yield qn({args:Ew(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:qn(r)||{}}),s=n.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=Ge.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=Ge.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=Ge.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=Ge.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=Ge.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=Uu(a.accessList)),o.gasLimit==null&&e.gas!=null){let A=21e3;const c=At(s);for(let u=0;ur[A]!=null);return l.length&&Hn.throwError(`cannot override ${l.map(A=>JSON.stringify(A)).join(",")}`,we.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function mwe(n,e){return function(...t){return Fb(n,e,t)}}function vwe(n,e){const t=n.signer||n.provider;return function(...r){return Eu(this,void 0,void 0,function*(){t||Hn.throwError("estimate require a provider or signer",we.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fb(n,e,r);return yield t.estimateGas(i)})}}function ywe(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=ls(s),a=null;try{a=n.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,A)=>n.interface.decodeEventLog(a.eventFragment,l,A),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>n.provider,o.getBlock=()=>n.provider.getBlock(i.blockHash),o.getTransaction=()=>n.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function jH(n,e,t){const r=n.signer||n.provider;return function(...i){return Eu(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=xn(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}n.deployTransaction!=null&&(yield n._deployed(s));const o=yield Fb(n,e,i),a=yield r.call(o,s);try{let l=n.interface.decodeFunctionResult(e,a);return t&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===we.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function wwe(n,e){return function(...t){return Eu(this,void 0,void 0,function*(){n.signer||Hn.throwError("sending a transaction requires a signer",we.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield Fb(n,e,t),i=yield n.signer.sendTransaction(r);return ywe(n,i),i})}}function GL(n,e,t){return e.constant?jH(n,e,t):wwe(n,e)}function KH(n){return n.address&&(n.topics==null||n.topics.length===0)?"*":(n.address||"*")+"@"+(n.topics?n.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class Km{constructor(e,t){Me(this,"tag",e),Me(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(r=>t||r.listener!==e?!0:(t=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter(r=>{const i=e.slice();return setTimeout(()=>{r.listener.apply(this,i)},0),!r.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class Bwe extends Km{constructor(){super("error",null)}}class ZL extends Km{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&Hn.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(KH(s),s),Me(this,"address",e),Me(this,"interface",t),Me(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(t,r)=>this.interface.decodeEventLog(this.fragment,t,r);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=$ye(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class JL extends Km{constructor(e,t){super("*",{address:e}),Me(this,"address",e),Me(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(r,i)=>this.interface.decodeEventLog(t.eventFragment,r,i),e.args=t.args}catch{}}}class Cwe{constructor(e,t,r){Me(this,"interface",ss(new.target,"getInterface")(t)),r==null?(Me(this,"provider",null),Me(this,"signer",null)):s0.isSigner(r)?(Me(this,"provider",r.provider||null),Me(this,"signer",r)):n0.isProvider(r)?(Me(this,"provider",r),Me(this,"signer",null)):Hn.throwArgumentError("invalid signer or provider","signerOrProvider",r),Me(this,"callStatic",{}),Me(this,"estimateGas",{}),Me(this,"functions",{}),Me(this,"populateTransaction",{}),Me(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Me(this.filters,a,(...A)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,A)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?Me(this.filters,a,this.filters[l[0]]):Hn.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Me(this,"_runningEvents",{}),Me(this,"_wrappedEmits",{}),e==null&&Hn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Me(this,"address",e),this.provider)Me(this,"resolvedAddress",oC(this.provider,e));else try{Me(this,"resolvedAddress",Promise.resolve(Vr(e)))}catch{Hn.throwError("provider is required to use ENS name as contract address",we.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){Hn.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&Me(this,o,GL(this,a,!0)),this.functions[o]==null&&Me(this.functions,o,GL(this,a,!1)),this.callStatic[o]==null&&Me(this.callStatic,o,jH(this,a,!0)),this.populateTransaction[o]==null&&Me(this.populateTransaction,o,mwe(this,a)),this.estimateGas[o]==null&&Me(this.estimateGas,o,vwe(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&Me(this,o,this[l])}catch{}this.functions[o]==null&&Me(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Me(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Me(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Me(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return uP(e)}static getInterface(e){return WL.isInterface(e)?e:new WL(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(t=>(t==="0x"&&Hn.throwError("contract not deployed",we.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||Hn.throwError("sending a transactions require a signer",we.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=xn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&Hn.throwError("cannot override "+r,we.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new aS(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Me(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return M_.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new Bwe);if(e==="event")return this._normalizeRunningEvent(new Km("event",null));if(e==="*")return this._normalizeRunningEvent(new JL(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new ZL(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const r=e.topics[0];if(typeof r!="string")throw new Error("invalid topic");const i=this.interface.getEvent(r);return this._normalizeRunningEvent(new ZL(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Km(KH(t),t))}return this._normalizeRunningEvent(new JL(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const i=ls(t);return i.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(t.blockHash),i.getTransaction=()=>this.provider.getTransaction(t.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(i),i}_addEventListener(e,t,r){if(this.provider||Hn.throwError("events require a provider or a signer with a provider",we.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,t);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,t,r){const i=this._getRunningEvent(e),s=xn(i.filter);return typeof t=="string"&&Ft(t,32)?(r!=null&&Hn.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),s.blockHash=t):(s.fromBlock=t??0,s.toBlock=r??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),i=r.run(t)>0;return this._checkRunningEvents(r),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((t,r)=>t+this._runningEvents[r].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const t=[];for(let r in this._runningEvents)this._runningEvents[r].listeners().forEach(i=>{t.push(i)});return t}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const r in this._runningEvents){const i=this._runningEvents[r];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class Eb extends Cwe{}var vQ={exports:{}},Kh=typeof Reflect=="object"?Reflect:null,HL=Kh&&typeof Kh.apply=="function"?Kh.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},_w;Kh&&typeof Kh.ownKeys=="function"?_w=Kh.ownKeys:Object.getOwnPropertySymbols?_w=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:_w=function(e){return Object.getOwnPropertyNames(e)};function bwe(n){console&&console.warn&&console.warn(n)}var $H=Number.isNaN||function(e){return e!==e};function on(){on.init.call(this)}vQ.exports=on;vQ.exports.once=Ewe;on.EventEmitter=on;on.prototype._events=void 0;on.prototype._eventsCount=0;on.prototype._maxListeners=void 0;var zL=10;function _b(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(on,"defaultMaxListeners",{enumerable:!0,get:function(){return zL},set:function(n){if(typeof n!="number"||n<0||$H(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");zL=n}});on.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};on.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||$H(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function qH(n){return n._maxListeners===void 0?on.defaultMaxListeners:n._maxListeners}on.prototype.getMaxListeners=function(){return qH(this)};on.prototype.emit=function(e){for(var t=[],r=1;r0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")HL(l,this,t);else for(var A=l.length,c=i5(l,A),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,bwe(a)}return n}on.prototype.addListener=function(e,t){return e5(this,e,t,!1)};on.prototype.on=on.prototype.addListener;on.prototype.prependListener=function(e,t){return e5(this,e,t,!0)};function xwe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function t5(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=xwe.bind(r);return i.listener=t,r.wrapFn=i,i}on.prototype.once=function(e,t){return _b(t),this.on(e,t5(this,e,t)),this};on.prototype.prependOnceListener=function(e,t){return _b(t),this.prependListener(e,t5(this,e,t)),this};on.prototype.removeListener=function(e,t){var r,i,s,o,a;if(_b(t),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,s=o;break}if(s<0)return this;s===0?r.shift():Iwe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};on.prototype.off=on.prototype.removeListener;on.prototype.removeAllListeners=function(e){var t,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s=Object.keys(r),o;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this};function n5(n,e,t){var r=n._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?Fwe(i):i5(i,i.length)}on.prototype.listeners=function(e){return n5(this,e,!0)};on.prototype.rawListeners=function(e){return n5(this,e,!1)};on.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):r5.call(n,e)};on.prototype.listenerCount=r5;function r5(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}on.prototype.eventNames=function(){return this._eventsCount>0?_w(this._events):[]};function i5(n,e){for(var t=new Array(e),r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Sw(n,e,t){return Rwe()?Sw=Reflect.construct:Sw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&aC(A,o.prototype),A},Sw.apply(null,arguments)}function Mwe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function lC(n){var e=typeof Map=="function"?new Map:void 0;return lC=function(r){if(r===null||!Mwe(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return Sw(r,arguments,N_(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),aC(i,r)},lC(n)}function Qy(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function Md(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function $o(n){return n.hasOwnProperty("result")?n.result:n}var kI=function(n){yQ(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="No Ethereum provider was found on window.ethereum.",t}return e}(lC(Error)),Twe=function(n){yQ(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="The user rejected the request.",t}return e}(lC(Error)),Nwe=function(n){yQ(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Qy(i)),i.handleChainChanged=i.handleChainChanged.bind(Qy(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Qy(i)),i.handleClose=i.handleClose.bind(Qy(i)),i}var t=e.prototype;return t.handleChainChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.handleAccountsChanged=function(i){i.length===0?this.emitDeactivate():this.emitUpdate({account:i[0]})},t.handleClose=function(i,s){this.emitDeactivate()},t.handleNetworkChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.activate=function(){try{var i=function(c){if(s)return c;function u(){return T_({provider:window.ethereum},a?{account:a}:{})}var h=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(d){return d&&$o(d)[0]})).then(function(d){a=d})}();return h&&h.then?h.then(u):u(h)},s=!1,o=this;if(!window.ethereum)throw new kI;window.ethereum.on&&(window.ethereum.on("chainChanged",o.handleChainChanged),window.ethereum.on("accountsChanged",o.handleAccountsChanged),window.ethereum.on("close",o.handleClose),window.ethereum.on("networkChanged",o.handleNetworkChanged)),window.ethereum.isMetaMask&&(window.ethereum.autoRefreshOnNetworkChange=!1);var a,l=Md(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(A){return $o(A)[0]})).then(function(A){a=A})},function(A){if(A.code===4001)throw new Twe});return Promise.resolve(l&&l.then?l.then(i):i(l))}catch(A){return Promise.reject(A)}},t.getProvider=function(){try{return Promise.resolve(window.ethereum)}catch(i){return Promise.reject(i)}},t.getChainId=function(){try{var i=function(){function l(){if(!s)try{s=$o(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=$o(window.ethereum.cachedResults.net_version):s=window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),s}var A=function(){if(!s){var c=Md(function(){return Promise.resolve(window.ethereum.send("net_version").then($o)).then(function(u){s=u})},function(){});if(c&&c.then)return c.then(function(){})}}();return A&&A.then?A.then(l):l(A)};if(!window.ethereum)throw new kI;var s,o=Md(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then($o)).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.getAccount=function(){try{var i=function(){function l(){return s||(s=$o(window.ethereum.send({method:"eth_accounts"}))[0]),s}var A=function(){if(!s){var c=Md(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return $o(u)[0]})).then(function(u){s=u})},function(){});if(c&&c.then)return c.then(function(){})}}();return A&&A.then?A.then(l):l(A)};if(!window.ethereum)throw new kI;var s,o=Md(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return $o(a)[0]})).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.deactivate=function(){window.ethereum&&window.ethereum.removeListener&&(window.ethereum.removeListener("chainChanged",this.handleChainChanged),window.ethereum.removeListener("accountsChanged",this.handleAccountsChanged),window.ethereum.removeListener("close",this.handleClose),window.ethereum.removeListener("networkChanged",this.handleNetworkChanged))},t.isAuthorized=function(){try{return window.ethereum?Promise.resolve(Md(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return $o(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(Qwe);function kwe(){const{account:n,library:e,activate:t}=m8(),[r,i]=Be.useState([]),{setViewMode:s}=X.useContext(Ci),{playSound:o}=X.useContext(bs),{isMute:a}=X.useContext(Bs),l=new Nwe({supportedChainIds:[137,1,3,4,5,42,97]});Be.useEffect(()=>{if(n&&e){const h="0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",d=["function balanceOf(address owner) external view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function tokenURI(uint256 tokenId) external view returns (string)"],p=new Eb(h,d,e);p.balanceOf(n).then(f=>{const g=[];for(let m=0;m{const v=m.map(w=>p.tokenURI(w));Promise.all(v).then(w=>{i(w)})})})}},[n,e]);const A=()=>{t(l)},c=h=>{!a&&o("backNextButton"),s(ot.APPEARANCE)},u=()=>{s(ot.LANDING),!a&&o("backNextButton")};return V.jsxs("div",{className:kc.container,children:[!n&&V.jsxs("div",{className:kc.message,children:["Please connect your wallet to load your characters",V.jsx("button",{className:kc.button,onClick:()=>A(),children:"Connect"})]}),V.jsxs("div",{className:kc.characterContainer,children:[V.jsx("div",{className:kc.title,children:"Load Character"}),r.map((h,d)=>V.jsx("div",{className:kc.character,onClick:()=>{c()},children:JSON.stringify(h)},d))]}),V.jsx("button",{className:kc.button,onClick:()=>u(),children:"Back"})]})}const Dwe="_container_q73cc_1",Lwe="_mintContainer_q73cc_6",Vwe="_mainTitleWrap_q73cc_33",Pwe="_mainTitle_q73cc_33",Owe="_mintButtonContainer_q73cc_49",Wwe="_mintButton_q73cc_49",Gwe="_genesisText_q73cc_60",Zwe="_required_q73cc_64",Jwe="_divider_q73cc_68",Hwe="_bottomContainer_q73cc_75",zwe="_mintInfo_q73cc_85",Ywe="_topLine_q73cc_91",Xwe="_bottomLine_q73cc_104",ai={container:Dwe,mintContainer:Lwe,mainTitleWrap:Vwe,mainTitle:Pwe,mintButtonContainer:Owe,mintButton:Wwe,genesisText:Gwe,required:Zwe,divider:Jwe,bottomContainer:Hwe,mintInfo:zwe,topLine:Ywe,bottomLine:Xwe},jwe="0x543D43F390b7d681513045e8a85707438c463d80",AC={owner:"0x634B0510C5062CFf8009eAAc2435eB93bc4764ad",address:"0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",abi:[{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tokenPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"numberOfTokens",type:"uint256"},{internalType:"string",name:"_tokenURI",type:"string"}],name:"mintToken",outputs:[],stateMutability:"payable",type:"function"}]},YL={address:"0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F",abi:[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AddressMismatch",type:"error"},{inputs:[],name:"AlreadyProxied",type:"error"},{inputs:[],name:"ColdAddressCannotBeTheSameAsHot",type:"error"},{inputs:[],name:"ColdIsAddressZero",type:"error"},{inputs:[],name:"ColdWalletCannotInteractUseHot",type:"error"},{inputs:[],name:"DeliveryCannotBeTheZeroAddress",type:"error"},{inputs:[],name:"DeliveryIsAddressZero",type:"error"},{inputs:[],name:"EthWithdrawFailed",type:"error"},{inputs:[],name:"IncorrectProxyRegisterFee",type:"error"},{inputs:[],name:"MigrationIsAllowedOnceOnly",type:"error"},{inputs:[],name:"NoPaymentPendingForAddress",type:"error"},{inputs:[],name:"NoRecordFoundForAddress",type:"error"},{inputs:[],name:"OnlyHotAddressCanChangeAddress",type:"error"},{inputs:[],name:"ProxyRegisterFeeRequired",type:"error"},{inputs:[],name:"RegisterAddressLocked",type:"error"},{inputs:[],name:"RewardRateIsLocked",type:"error"},{inputs:[],name:"UnknownAmount",type:"error"},{inputs:[],name:"UnrecognisedEPSAPIAmount",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!0,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"address",name:"oldDelivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"DeliveryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"ensReverseRegistrarAddress",type:"address"}],name:"ENSReverseRegistrarSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"erc20",type:"address"},{indexed:!1,internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"ERC20FeeUpdated",type:"event"},{anonymous:!1,inputs:[],name:"MigrationComplete",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"NominationAccepted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"NominationMade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"ProxyRecordLive",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"enum IEPSProxyRegister.Participant",name:"initiator",type:"uint8"},{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"RecordDeleted",type:"event"},{anonymous:!1,inputs:[],name:"RewardRateLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint96",name:"rewardRate",type:"uint96"}],name:"RewardRateUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newToken",type:"address"}],name:"RewardTokenUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"acceptNomination",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"activeEthAddresses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"bool",name:"checkingHot_",type:"bool"}],name:"addressIsAvailable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"beneficiaryBalance",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"id_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf1155",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf20",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryOf",outputs:[{internalType:"address",name:"beneficiary_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"coldToHot",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"provider_",type:"uint256"}],name:"deleteRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deletionNominalEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ensReverseRegistrar",outputs:[{internalType:"contract ENSReverseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epsAPIBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegister",outputs:[{internalType:"contract IERC1155DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegister",outputs:[{internalType:"contract IERC20DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"erc20PerTransactionFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegister",outputs:[{internalType:"contract IERC721DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses1155",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses20",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses721",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAllAddresses",outputs:[{internalType:"address[]",name:"erc721Addresses_",type:"address[]"},{internalType:"address[]",name:"erc1155Addresses_",type:"address[]"},{internalType:"address[]",name:"erc20Addresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_receivedAddress",type:"address"}],name:"getColdAndDeliveryAddresses",outputs:[{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"bool",name:"isProxied",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"getProxyRecordForAddress",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"getProxyRecordForCold",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"getProxyRecordForHot",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"hotToRecord",outputs:[{internalType:"uint64",name:"provider",type:"uint64"},{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"bool",name:"feePaid",type:"bool"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"}],name:"isValidAddresses",outputs:[],stateMutability:"pure",type:"function"},{inputs:[],name:"lockERC1155DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC20DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC721DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],internalType:"struct EPSRegister.MigratedRecord[]",name:"migratedRecords_",type:"tuple[]"}],name:"migration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"migrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"nominate",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sender_",type:"address"},{internalType:"uint256",name:"erc20Value_",type:"uint256"},{internalType:"bytes",name:"data_",type:"bytes"}],name:"onTokenTransfer",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxyRegisterFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC1155",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"rescueERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC721",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC721",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rewardRate",outputs:[{internalType:"uint88",name:"",type:"uint88"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardRateLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardToken",outputs:[{internalType:"contract IOAT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"deleteNominalEth_",type:"uint256"}],name:"setDeletionNominalEth",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"ensName_",type:"string"}],name:"setENSName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ensReverseRegistrar_",type:"address"}],name:"setENSReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc1155DelegationRegister_",type:"address"}],name:"setERC1155DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20DelegationRegister_",type:"address"}],name:"setERC20DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20_",type:"address"},{internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"setERC20Fee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc721DelegationRegister_",type:"address"}],name:"setERC721DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count_",type:"uint256"},{internalType:"uint256",name:"air_",type:"uint256"}],name:"setNNumberOfEthAddressesAndAirdropAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"registerFee_",type:"uint256"}],name:"setRegisterFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint88",name:"rewardRate_",type:"uint88"}],name:"setRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"rewardToken_",type:"address"}],name:"setRewardToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"treasuryAddress_",type:"address"}],name:"setTreasuryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint256",name:"provider_",type:"uint256"}],name:"updateDeliveryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawETH",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]},Kwe={}.VITE_OPENSEA_KEY,$we={}.VITE_PINATA_API_KEY,qwe={}.VITE_PINATA_API_SECRET,DI="0x89";let Ry;async function eBe(){if(Ry!=null)return Ry;const n=new zP("https://polygon-rpc.com/"),t=await new Eb(AC.address,AC.abi,n).tokenPrice();return Ry=Ge.from(t).mul(1),Ry}function tBe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":Kwe}};return console.log(t),new Promise((r,i)=>{fetch("https://api.opensea.io/api/v2/chain/ethereum/account/"+n+"/nfts?collection="+e,t).then(s=>{if(s.ok)return s.json();i("Failed to fetch data from Opensea API")}).then(s=>{r(s)}).catch(s=>{i(s)})})}async function wQ(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(DI,16)){const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}else try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:DI}]});const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}catch(e){console.log("polygon not find:",e);try{await window.ethereum.request({method:"wallet_addEthereumChain",params:[{chainId:"0x89",chainName:"Polygon Mainnet",rpcUrls:["https://polygon-rpc.com"],nativeCurrency:{name:"Matic",symbol:"MATIC",decimals:18},blockExplorerUrls:["https://polygonscan.com/"]}]}),await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:DI}]});const t=await window.ethereum.request({method:"eth_requestAccounts"});return t.length>0?t[0]:""}catch(t){console.log("Adding polygon chain failed",t)}}}catch{return""}else return""}async function LI(n,e){if(!n)return console.warn("Error saving to pinata: No file data");const t="https://api.pinata.cloud/pinning/pinFileToIPFS";let r=new FormData;return r.append("file",n,e),(await PH.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:$we,pinata_secret_api_key:qwe}})).data}const nBe=n=>{let e=[];return Object.keys(n).map(t=>{Object.keys(n[t]).length!==0&&e.push({trait_type:t,value:n[t].name})}),e};async function rBe(n,e,t,r,i){if(!n)throw new Error("No avatar was provided");if(!e)throw new Error("No screenshot was provided");if(!t)throw new Error("No model was provided");const s=await wQ();if(s=="")return"Please Connect Wallet";if(!i||await iBe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let v=0;v<10;v++)try{return await LI(e,a).catch(B=>{console.error(v,"---",B)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const A=await ype(t,n,4096);let c;if(A){let v="AvatarGlb_"+Date.now()+".glb";c=await(async()=>{for(let w=0;w<10;w++)try{return await LI(A,v).catch(C=>(console.error(w,"---",C),"Couldn't save glb to pinata"))}catch(B){return console.warn(B),"Couldn't save glb to pinata"}return"Failed to upload glb"})()}else return"Unable to get glb";const u={name:r||"Avatars",description:"Character Studio Avatars.",image:`ipfs://${l.IpfsHash}`,animation_url:`ipfs://${c.IpfsHash}`,attributes:nBe(n)},h=JSON.stringify(u),p=`ipfs://${(await LI(new Blob([h]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let f=await eBe();const g=new AS(window.ethereum).getSigner(),m=new Eb(AC.address,AC.abi,g);try{const v={value:f,from:s};if((await(await m.mintToken(1,p,v)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const iBe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=l8("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new Eb(YL.address,YL.abi,t).beneficiaryBalanceOf(e,jwe,1);return parseInt(i)>0?!0:(console.log(`Currently in alpha. You need a genesis pass to mint. + Will be public soon!`),!1)}else return console.log("Please connect your wallet"),!1};function sBe(){const{model:n,avatar:e}=X.useContext(lr),{setViewMode:t}=X.useContext(Ci),{playSound:r}=X.useContext(bs),{isMute:i}=X.useContext(Bs),[s,o]=X.useState(""),[a,l]=X.useState(!1),A=()=>{t(ot.SAVE),!i&&r("backNextButton")},c=()=>{t(ot.CHAT),!i&&r("backNextButton")};function u(){return V.jsxs("div",{className:ai.mainTitleWrap,children:[V.jsx("div",{className:ai.topLine}),V.jsx("div",{className:ai.mainTitle,children:"Mint"})]})}async function h(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const f=await rBe(e,null,n,{name:"XXXRestore"}.name);o(f),l(!1),console.log(f)}return V.jsxs("div",{className:ai.container,children:[V.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),V.jsxs("div",{className:ai.mintContainer,children:[V.jsx(u,{}),V.jsxs("div",{className:ai.mintButtonContainer,children:[V.jsx(sn,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:ai.mintButton,disabled:a,onClick:h,minWidth:220}),V.jsx("div",{className:ai.divider}),V.jsx(sn,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:ai.mintButton,disabled:!0,minWidth:220}),V.jsxs("span",{className:ai.genesisText,children:["(",V.jsx("span",{className:ai.required,children:"Coming Soon!"}),")"]})]}),V.jsxs("span",{className:ai.mintInfo,children:[s," "]})]}),V.jsxs("div",{className:ai.bottomContainer,children:[V.jsx(sn,{theme:"light",text:"Back",size:14,className:ai.buttonLeft,onClick:A}),V.jsx(sn,{theme:"light",text:"Chat",size:14,className:ai.buttonRight,onClick:c})]})]})}const oBe="_classdisabled_ecnty_1",aBe="_container_ecnty_6",lBe="_classContainer_ecnty_14",ABe="_icon_ecnty_40",cBe="_name_ecnty_71",uBe="_description_ecnty_80",dBe="_classFrame_ecnty_85",hBe="_frameContainer_ecnty_107",fBe="_frame_ecnty_107",pBe="_image_ecnty_117",gBe="_lockedContainer_ecnty_123",mBe="_locked_ecnty_123",vBe="_buttonContainer_ecnty_137",yBe="_buttonLeft_ecnty_146",wBe="_buttonRight_ecnty_150",BBe="_buttonCenter_ecnty_154",CBe="_topLine_ecnty_168",bBe="_bottomLine_ecnty_194",lt={classdisabled:oBe,container:aBe,classContainer:lBe,class:"_class_ecnty_1",icon:ABe,name:cBe,description:uBe,classFrame:dBe,frameContainer:hBe,frame:fBe,image:pBe,lockedContainer:gBe,locked:mBe,buttonContainer:vBe,buttonLeft:yBe,buttonRight:wBe,buttonCenter:BBe,topLine:CBe,bottomLine:bBe};function xBe(){const{t:n}=Be.useContext(xs),{setViewMode:e,setIsLoading:t,isLoading:r}=X.useContext(Ci),{playSound:i}=X.useContext(bs),{isMute:s}=X.useContext(Bs),{manifest:o,characterManager:a}=X.useContext(lr),[l,A]=Be.useState([]);Be.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const d=o.characters.map(p=>({name:p.name,image:p.portrait,description:p.description,manifest:p.manifest,icon:p.icon,format:p.format,disabled:!1}));A(d)}},[o]);const c=()=>{e(ot.LANDING),!s&&i("backNextButton")},u=async d=>{t(!0),a.loadManifest(o.characters[d].manifest).then(()=>{e(ot.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{!s&&i("classMouseOver")};return V.jsxs("div",{className:`${lt.container} horizontalScroll`,children:[V.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),V.jsx("div",{className:lt.vrmOptimizerButton}),V.jsx("div",{className:lt.topLine}),V.jsx("div",{className:lt.classContainer,children:l.map((d,p)=>V.jsxs("div",{className:d.disabled?lt.classdisabled:lt.class,onClick:d.disabled?null:()=>u(p),onMouseOver:d.disabled?null:()=>h(),children:[V.jsxs("div",{className:lt.classFrame,style:{backgroundImage:`url(${d.image})`},children:[V.jsx("div",{className:lt.frameContainer,children:V.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:lt.frame})}),V.jsx("div",{className:lt.lockedContainer,children:d.disabled&&V.jsx("img",{src:"./assets/icons/locked.svg",className:lt.locked})})]}),V.jsx("div",{className:lt.name,children:d.name}),V.jsx("div",{className:lt.description,children:d.description})]},p))}),V.jsx("div",{className:lt.bottomLine}),V.jsx("div",{className:lt.buttonContainer,children:V.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:lt.buttonLeft,onClick:c})})]})}function IBe(){const{t:n}=Be.useContext(xs),{setViewMode:e,setIsLoading:t,isLoading:r}=X.useContext(Ci),{playSound:i}=X.useContext(bs),{isMute:s}=X.useContext(Bs),{manifest:o,characterManager:a}=X.useContext(lr),[l,A]=Be.useState([]);Be.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const p=o.characters.map(f=>({name:f.name,image:f.portrait,description:f.description,manifest:f.manifest,icon:f.icon,format:f.format,disabled:!1}));A(p)}},[o]);const c=()=>{e(ot.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(ot.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{e(ot.BATCHMANIFEST)},d=()=>{!s&&i("classMouseOver")};return V.jsxs("div",{className:`${lt.container} horizontalScroll`,children:[V.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),V.jsx("div",{className:lt.vrmOptimizerButton}),V.jsx("div",{className:lt.topLine}),V.jsxs("div",{className:lt.classContainer,children:[l.map((p,f)=>V.jsxs("div",{className:p.disabled?lt.classdisabled:lt.class,onClick:p.disabled?null:()=>u(f),onMouseOver:p.disabled?null:()=>d(),children:[V.jsxs("div",{className:lt.classFrame,style:{backgroundImage:`url(${p.image})`},children:[V.jsx("div",{className:lt.frameContainer,children:V.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:lt.frame})}),V.jsx("div",{className:lt.lockedContainer,children:p.disabled&&V.jsx("img",{src:"./assets/icons/locked.svg",className:lt.locked})})]}),V.jsx("div",{className:lt.name,children:p.name}),V.jsx("div",{className:lt.description,children:p.description})]},f)),V.jsxs("div",{className:lt.class,onClick:()=>h(),onMouseOver:()=>d(),children:[V.jsx("div",{className:lt.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:V.jsx("div",{className:lt.frameContainer,children:V.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:lt.frame})})}),V.jsx("div",{className:lt.name,children:"Manifest"}),V.jsx("div",{className:lt.description,children:"Load by manifest"})]},"manifest-load")]}),V.jsx("div",{className:lt.bottomLine}),V.jsx("div",{className:lt.buttonContainer,children:V.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:lt.buttonLeft,onClick:c})})]})}const FBe="_buttonContainer_1ueuk_1",EBe="_button_1ueuk_1",Td={buttonContainer:FBe,button:EBe},XL={}.VITE_OPENSEA_KEY;function _Be(){const{setViewMode:n}=X.useContext(Ci),{playSound:e}=X.useContext(bs),{isMute:t}=X.useContext(Bs),{characterManager:r}=X.useContext(lr),i=()=>{n(ot.CREATE),!t&&e("backNextButton")},s=()=>{n(ot.CLAIM),!t&&e("backNextButton")},o=()=>{n(ot.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await wQ()!=""&&n(ot.WALLET),!t&&e("backNextButton")};return V.jsx("div",{className:Td.container,children:V.jsxs("div",{className:Td.buttonContainer,children:[V.jsx("button",{className:Td.button,onClick:i,children:V.jsx("img",{src:"./assets/media/btn_create_character.png"})}),V.jsx("button",{className:Td.button,onClick:s,children:V.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),V.jsx("button",{className:Td.button,onClick:o,children:V.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),XL&&XL!=""&&V.jsx("button",{className:Td.button,onClick:a,children:V.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const SBe="_buttonContainer_19n2w_1",UBe="_buttonLeft_19n2w_10",QBe="_buttonRight_19n2w_14",RBe="_buttonCenter_19n2w_18",MBe="_sideMenu_19n2w_33",TBe="_scrollContainer_19n2w_44",NBe="_scrollContainerOptions_19n2w_52",kBe="_bottomLine_19n2w_60",DBe="_editorButton_19n2w_94",LBe="_editorText_19n2w_102",VBe="_selectorContainerPos_19n2w_112",PBe="_selectorButton_19n2w_129",OBe="_selectorColorPickerUI_19n2w_138",WBe="_selectorColorPickerButton_19n2w_144",GBe="_selectorColorPickerImg_19n2w_157",ZBe="_uploadContainer_19n2w_163",JBe="_uploadButton_19n2w_176",Tn={buttonContainer:SBe,buttonLeft:UBe,buttonRight:QBe,buttonCenter:RBe,sideMenu:MBe,scrollContainer:TBe,scrollContainerOptions:NBe,bottomLine:kBe,"editor-container":"_editor-container_19n2w_87",editorButton:DBe,editorText:LBe,selectorContainerPos:VBe,"selector-container":"_selector-container_19n2w_123",selectorButton:PBe,selectorColorPickerUI:OBe,selectorColorPickerButton:WBe,selectorColorPickerImg:GBe,uploadContainer:ZBe,uploadButton:JBe},HBe="_ContainerPositionTop_v15ql_2",zBe="_ContainerPosition_v15ql_2",YBe="_Container_v15ql_2",XBe="_topLine_v15ql_68",jBe="_traitInfoTitle_v15ql_96",KBe="_flexSelect_v15ql_105",$Be="_flexButtons_v15ql_114",qBe="_flexButtonsTop_v15ql_122",eCe="_optionButtons_v15ql_131",tCe="_optionButtonsSmall_v15ql_143",Kn={ContainerPositionTop:HBe,ContainerPosition:zBe,Container:YBe,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:XBe,traitInfoTitle:jBe,flexSelect:KBe,flexButtons:$Be,flexButtonsTop:qBe,optionButtons:eCe,optionButtonsSmall:tCe},nCe="/CharacterStudio/assets/randomize-green-4388c12b.png",rCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNiOTBlZjU3LTIwOWItYzQ0Zi05OWNjLTkwYjYxM2Q0MWJiOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjY1ZDdmMmJiLWMxYjctYjc0My1hYmIzLTFmM2VjNjMxYjE0NCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozYjkwZWY1Ny0yMDliLWM0NGYtOTljYy05MGI2MTNkNDFiYjgiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6bbHqfAAAFoklEQVR42u2duWtWQRTFo5hGRNAETKFiIQqCSxGto4iCqSLon6BoQJJCEcEFLASbD7QRRcTKNbihoLgUWhj/AItUCi7gVmjikubzPphAiOYts9659xQHAnl5M2/u73vnzHwvbzra7XaHNg1cPrKadJs0bnSHtEbjWGgr/HxSi9SeRWeLYwCAzOIPmk97u0ITpAMAQE7h+0ivaxR+psZIWwBAvoVfSXpsUfiZelZkBgAgx+dtJTIfaPV5W4nLB9p93lZi8oEEn39iWcRPpK2kzaSPlud4mns+0Ojzk6QTpM5p5+skHSP90ZYPtPn8DVJ3ybkXk65oygdafH6UtKlBW72klxrygfT5/BfSLoe2B0xWELt+oMbnHfoxj3RUaj6Q6vNdAfq0SGI+UOvzDn0UlQ/U+7z2fACfV54P4PPK8wF8Xnk+gM8rzwfweeX5AD6vPB/A55XnA/i88nwAn1eeD+DzyvMBfF55PoDPK88H8Hnl+aBup/aQflp26HrZc3hQaT64Zjnmv0h7nQEwT8u24PNJQdjokA9aVXfdqsaH4fNsQNhJ+mxRj2EXAO41bGw/ihUchH0Na3LXBYC7DRs7T1qOQgUr/lLSuZgA3LL0nkukhSiat8IvIF2wrMWtFABMJdHDpLkoolPxD5mxbOcGwJTekfpRzMaF305662H8kwMwpRekDShuZeHXkp57HHc2ACAfhPP5JAB8MB3+jXyQzOeLJfaLpPcpAPhmjlnmcMtSnQ8cfb6w1BXmPF9TAFB8N9Az7dhtpDfIB8F9vvjQ7Jh2rp6K72mCArDkP39z0GHaIjofOPr8lG3OmXHOJawAmHah57F+4G0+P+sHgyUAHm91/fD5cmtkDYDmfODT57MHQFM+COHzYgCQng9C+bwoACTmg9A+LxIACfkgls+LBiDHfBDb51UAkEs+SOHzagDgnA9S+rw6ADjlAw4+rxaAlPmAk8+rByB2PuDm8wAgUj7g6vMAIHA+4O7zACDc7fqk+a/lbJel1QPgIR9k/cUUAAj7SDX7r6YBgP98wM7nAUCa9YOo83kAwC8f5PIACgDwnA+yegQNADQfsGdlb9rK8HoAQMMBK3vryT0AIB+ARyXX9AgAyAfgYck1PQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlALQAwCSX0+y18V/L/a3BQDJr2cx6UcKAMZz3BRaIADdphZJNo16ldsG0ZIAoP721thY2gmAulvH3iB1AYCot/0rMbaObbJ59KR53UonAAjW907ScTPWUfYOHpK2fXyuADhsHz/kAkBBXMvy5QqjHPNBbgBQnzbW8PnZ1Kq6I9ftxJ6KuWaZrnOaLeQCQDHFJl1zeLPJ3jrtNOnQfIe7AZt8wB0A6sM80lHSH8uxPlPUqm57Nh1cSXps2bnk+YAzANT+AOmT5dg+Ja1q2qZLZ/tIry07m2z9gCMAjj4/Rtpi27aPzg9WrERVrR90awXAzOevWo7dBOmAax98XUg2+YADAGZ2dSyWzwcHIKd8kBoAM5+P6vPRAMghH6QCIKXPRweAcz6IDQAHn08GAMd8EAsATj6fFABu+SAGANx8ngUAXPJBSAC4+jwrADzlg5u2+SAEANx9niUAqfKBTwBy8Xm2AHjKB19Ju2MDkJPPswcgZj5wBSBHn88GgBj5wBaAnH0+OwBC5oOmAEjw+SwBCJUPmrwuXorPZw2Ax3yw3pxnpOS4EXPMOkk+LwKAGflgwrI4p0kPSn5/n3RKms+LAsBDPggh1j4vDgBP+cCHsvB5sQB4ygfifV48AJ7WD8T6vBoAAueDbH1eFQAB8kH2Pq8SAA/5QIzPqwbAIh+I83kAUD8fiPR5APAvCKtJt80dYdz8vEbjWPwFnWtJD/nY2zYAAAAASUVORK5CYII=",iCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM2NDY5Y2JiLWFkMzUtYmQ0Ny04M2Q1LWU0NGQ0MTI2YmYwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjIyNTIzNmU1LWZhMWItZTM0NS04ZDM2LTE5YmQyYTRiZjM1MSIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjNjQ2OWNiYi1hZDM1LWJkNDctODNkNS1lNDRkNDEyNmJmMDYiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6qPgTwAAAEeUlEQVR42u2dX4tNURiH58KfwR1K0USSj6BoIpdydcY0TUMmIy58BPdK/uTCLReaG7kwooQoH4FQyneQMNw53t2cqdOJPfusvfZa77ve5+JX1DlnOns9PM+cqT0T/X5/wtt6D64ekj2W/ZKtDv582OO18Hbwk7I7sv5/dle2DQDKPPzLsp81h7++6n+EKwBQzsGfkH1ucPCj+yI7CQB2D/6A7GXAwY/utewgAJTj+dAV2QdePR+64vrAu+dDV0wf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5532A5533AZ533gd43nkf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5530wzsHvkr3hQqvfW9nuLgDYKXvGBVa/F50AMATCHtkKF1rdqn+ce1NG4BHZOy589n2QHc35beBZ2VcOIvm+yRa1fBC0SXZN9oeDSbLrss0aPwqmDxR6PggA+ULnZRfpA9uel+ddkJ0LAWB56AOG/fSBLc/L86ZkrwavsxwCwOgPd6q/T9IHuj0vz9kquzl6djEAqPZDdok+0Ol5ed6S7Ps/XjMaAOurfgh0nD5Q4/lp2aea144OwPDHjvRBXs8/b/A1OgOAPtDj+awA0Af5PZ8dAPogr+fVAEAf5PG8OgDog7SeVwuA1z5I7XnVAHjqg1yeNwFAyX2Q2/OmACitDzR43iQA1vtAk+fNAmCxDzR63jwAFvpAs+eLAUBrH2j3fHEAaOkDK54vEoCcfWDN80UDkLIPrHreBQBd94Flz7sCIEYfPCnM8+4AiNEHZ2RzhXjeLQCt+6AQz7sHoFUfFOB5AIjRB4Y9DwAx+8Cg5wEgVh8Y9TwANNjt6rOADT4nuFHg+waAoc3WvOfZQt8zAAxtruY9zwFA+QDM1LznGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANsA3AeAYnYvBIBTsvcAYH4fZaeDf328PHmxt3bzRACwteqWNkvBvz5+5MJs6a3dRBEAbOxWdVOrJmc77j1z9smeAoDaVbe1mRrnTENvnnSst3YzZQDQsepGVtMhZ9n29mkW+6AkABp5vjMAjPZBKQA09nynABjsA+sAjO35JAAY6gOrAAR7PikABvrAGgCtPZ8FAMV9YAmAKJ7PBoDSPrAAQFTPZwdAWR9oBqATz6sBQEkfaASgU8+rAyBzH2gDoHPPqwQgYx9oASCZ51UDkKEPcgOQ3PMmAEjYB7kAyOZ5UwAk6IMcAGT1vDkAOu6DlACo8LxZADrqgxQAqPK8eQAi90GXAKj0fDEAROqDrgBQ6/miAIjQB7EBUO/5IgFo0QexADDj+aIBCOiDtgCY87wLAMbogzYAmPS8GwAa9kEIAKY97w6ADfpgHACK8LxbAEb6YHVwqPM1j5sfPOZ3SZ53D8DgcLfLHsoWah6zIHsk2+HluvwF92zupxEV3NQAAAAASUVORK5CYII=",sCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmY3YWFkYzZiLWM2ZmEtNjE0OC05YWZkLTgxN2Q1OWRkZTI0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc2NTFhZmQyLWU5YTctOTc0Zi1hZWFkLTdiMWMyODQ2YWEzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmN2FhZGM2Yi1jNmZhLTYxNDgtOWFmZC04MTdkNTlkZGUyNDIiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6TWt7cAAAFm0lEQVR42u2dT2xURQCHSTXpQTH0oIJpgfZKi1ETiSK1MV7FbORQNcG0Hmg3oQVjjKARrhDBBDEYMSEYS6kWkxoVAheDiBc9kHBBuaGgMSo1KgTF+pt0JLq6dOe93X3z5zt8SbPdvtmZ37fvvc7Mm5k3MzMzD9KFRkAAGgEBAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABPKO0f3OrWCxWiTViROwQ+8QBcchywL62w77HvLdPdJpjIEAYYd8sHhDPiD3iuLggfhczGblqj/GJ2Cs2il5xCwL4EfoK8bw4LH7MEbQrF8UR8aK4T7QgQPNC77On6jNNDHwuzopXzGdDgMaEvlRsEqc8Cr0ap+2ZoRMB8gdvrulviT8CCP7/7h/GxIMI4B78Q+KjAEOvhrlHeRgB5g7e3FB9GFHwlZi6rUSA/wZ/m3g94uAreVMsRIDZ8J8S3yUU/t98L55OVgDby3Y4weArMf0JXUkJoAo/Ln4i/GtMiyeTEEAV3U3gVXktWgFUuXbxKSHPyWeiIyoBVKG7xXnCrRnTVvdEIYAqsjrniFwjGteciabEuGXKvnbes57ER4MWQBVY60FD/ioOiiHRfb3xfTt/oNu+1/zNLx58/rVBCqAPPlxww52x4/e356jDrfYYXxZcl+GgBCg4/Gk7KaSljvVpsSJcLLBe5SAEMB+04L72JQ08qy0ueKyi7LUABYe/pYn/0r4UiwSxhD9UQIfWuhgkiOGav67A8YzgJeC0n7/+W0KWIOTwj3o0keVoqBKEGv5vYoFHAiwQl0KUIMTwDSM5wuoQg3Ya90HLTvtaR47jjhbcJuWmCOBB+OcyBrTcPgJ25TrHvmKFuDNjGedCkyC08DN9+20vnms5GwM8CzhLEFr45jo73zGUbTnK2+5Y1nxxOSQJQgrf8G4B38gRxzInPWmrcl0E8Ch8w4BDEF11LLfLodwBj9qrnEsAz8I3LHMI4r06ljvpUO4yz9qsnEkA/WG/ZxX5VtxQYwh3NKD8RTWWfaOHzzn0OwmgP2izU5J8qsQJh2/hYMGXnxMePqja5iLAdg8nSk45BPBqA8rf5VD+lIftt81FgC88rMC4QwDvNKD8CYfyxz1sv88RAAG4BHAJSOMmcICbwBw3gRH8G7ioAeUvTObfwEg6giYL6gjqjqIjiK7gzF3Bg6VYuoIjGAwaYTAoruHgywwHFzAc7JkEoxkmamwQfzIhJI4pYd9knK7VU+OUMNOJszxjGV9HPSXMIwlGc0zebLf9BDsrJoWa19pzHHdDEpNCPZHgUrWOjYKmhbclNS3cEwmOeSTAseQeDPFEgq08GsbDoUMFhj+U/MOhnpwJhgmfBSK2ctpniRizx8DSBga/hCVi/JfgZ/FsrUPHjotETbNIVDjLxH1lVwtjmTgWitw8YYXsqWGhyB773gkWiqyPBI/M0f/ebC7YZWHf/0dXsPn5pP2dL5/TLK+7OpbFou8ygzgsAl37gJdpM5aLT5OTeQalQtgwYhchV2V3KlvG9LNlzL8waxA/kdqmUWY7WDaNmm2DtDaNYtu4a9vGDbJxZJobR75RYuPIqlvHfhBx8GYc4X62jk1v82hTFzaPzrh9/H7PNp2qFbPl/duil+3j6zMMu0mcCiD40+IF0RlC2wYhQIUMveJluymUL6GftWsP94XWnsEJUCHDveI5e439oYmBm06sI/abvqKeG1QhQHYZbhIr7fj9HvFxaXYjyDz3D1ftMY6LvfbYq1yfT0SA4qRotcvDm5vJNfZpYXP52CfGxCHLmH3N/G69eMyczkuzW9y3xtxGUQsACAAIAAgACAAIAAgACAAIAAgACAAIAAiAADQCAgACAAIAAgACAAIAAgACAAIAAgACAAIAAkCc/AWkhfX2hx9ZaQAAAABJRU5ErkJggg==",oCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAATr2AAE69gE6sVc6AAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PslPja4AAAbiSURBVHja7Z17iFVFHMc1K80ybc3SP9K21YrubtLDiIJqK5WMpbYt1MpSKiKkba0gtU0rCCpoyxRXSKrNiJIwCmtD0u2JEWFuSC/t2sueghDU2svbd2D+uFzce89rzvxm5vvHB2TX5Zw758PMufN7zJBSqTSEhAsHgQJwECgAoQCEAhAKQCgAoQCEAhAKQCgAoQCEAhAKQCgAoQDVaO1ZOgWsB7+CAbALLAPDOdCeC4CH3AJKg/AlGM/B9lQAPNxG8HcVARS7wQQOuJ8CPFvj4VMCXwXAAx0BfowoACXwUIA68EcMASiBh0vApzEFoASeCdCZQABK4JEAw0A/JQh7H2A8KFKCsHcCxUugX1qnghlgLrgBzNP/bgXTwTRwAjiEAsQf4AkpJChmJYF+0M1gIegGm8Dn4M+I9/If+B68B3rAneBiMIoCCJwJ8DejwZVgBfgQ7E94/Vqor7ybwVJwOgWwKAH+z3HgJrDR4AOvxU7wIDiFAuQoAX7XZumBV0MtF20UID8JnhMoQUlvjXeAw5kQYl6CVUIlUOwD7WBo8BlBhiVYK1gCxU/giuBTwgxL8IJwCRTvg/qgcwINS/CKAxIolgSdFGpYgjcdkeATMDHYrGDDErzriASK+cGmhZuSAD8/DHzskARrg60LMCjBkQkTVWwuCccGWRhiUIIx4DOHJNgLCkFWBhmUYJzer3dFAhWFnOXjRtAosA6cb0ECFaL+xiEJFAt8E6BXf7Cfq22GGJRgIvjBMQlu9yUWsOUgW6M2JGgAvzgmQYfr0cA3quyPm5KgWEWCaXpLVhWtXqVp11k/6uffCpRgoav5AC9GCJvWS0svw99NVhs0OtHkgBAJ5rmWEbQiRqSs3saOYcTPcTzoAv8KkGCGKzmBnQnCpbkvBwlE2GRZAJXQ2ig9K3hOipi52Jmg7D7aLUvwXdbp81k+/DPAPykTJ1yQYKbld4MPJFYGHZPi4bgowaWWZ4I10gTYmHEKlQsS3GxZgtukFIfeayiPzgUJnrYswVm2G0Q0G06mFC2BCuHq7W1bAmxPW8OYNsBjOtJmUoKvwaQMJOiwPAussiVAXoUZJiVQJWW/gR3gSdXrMME4jIzZJ8kEl+UqgC7EzDu33pQElSxPMB6PWRZANeU8KhcBdJKFDeNNxg4q6Yk5JhcJ2CpemZcA6yxX2YibCVQdoIBlQHGhUQHUWiOk+PLEnCRoTJD0YpM+0wJIybS9xmCnknK6YozNGiFjM8eIAAJ2vsqjYlEaSGQxE2yLMT4PCBmfreBkEwK8JuQDfhTjnpsySNUeGfFaiwVlEd1hQoBXhXy4vpjf0femvF6TYzOAMQGkLAHbY763bEt5vWLEJadb0BIwxeeXQJXZOyLGPT+ewTVrSqDi9EIEmO3718DI07K+50JG16xVlfywgHHpzWMj6CkBH/SWmPe8PCcJHrU4JurUltPyEODoDDdakvJ8gvvuyejaRaES3JVnMMj2UvA7GJvgvu/zdCbYYiMc/IRlCRYlvO8GHfrdoY+42+/4TPBXkqk/q4wgm504dsf5NlDlM0zS4VQTM8Ej0nMD0w5ewWKf3kSxews9i0xK8LKEpND5lpeCMx2QwMRyoFLaxkhJC++yKIBay48IcCY4T1pl0GaLErzuSAu7rGaCzJpHZCnAOD0AtiTYEIgEqyUXhxYSHCSZaahYlal5LME7LpSHTxewSdTioQS7TPQSNNUgYoGAeMFbWdTTm+xPEEMCVbvQ4FqLmEVCIodv62PhRjs6E6iS+7NdbRJ1j6AsmQEtw0r1Fg2uBVdrHtJNoqYKlKDZ9TZxSxxqy2atIHWQfYLLfWkUeTcliC3BTN+OjLmVEkSSQEUqr/f1yJgWQb33vGhS4eKRMY36aw0lECCBrfbwdQ6d6uG1BLbPCeimBHYlkHBYxNyU/QUpgScnhmylBPlLIOoUS71Dd4ASBCpAWW1/LyUIVICyQbxE+IFPXkgg/nx7DMSNQvrveCmBeAEqRJA4I+wD57oqgTMCVHTqlvaO0GcrnyA4ASpeFhdn0AAiKTt1HF8dRHWozaSSIAWoGNyTdM/eDQbjDOq0jvX61JCmFPsdoiTwQoCDNG08R7e0Wa1zA7/SGUFRBnqP3pRSp57dD9rAqWBohjOX1TOQvBagysCP1V3DLgCz9IOdDa4DrarSRjWgBMNcPSuZArglpAgJ+DDclaA/i9mKD8JtCTopQNgS9FOAsCVQdZh1FCBcCfakbZPDgXdbgme4BIQrgWoMWaAA/kqgTiz/oooALdwH8F+C4WCZDjwN6L6GL4HJ3AkkFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIByGD8DzQJyO8fOgE8AAAAAElFTkSuQmCC",aCe="/CharacterStudio/assets/play-de4238c5.png",lCe="/CharacterStudio/assets/reverse-e35421b8.png",ACe="/CharacterStudio/assets/pause-b6381fd4.png",cCe="/CharacterStudio/assets/fast-forward-0d3ffae5.png",uCe="/CharacterStudio/assets/fast-backward-1f713448.png";function Sb({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=Be.useContext(lr),[a,l]=Be.useState(s.userActivated),[A,c]=X.useState((o==null?void 0:o.getCurrentAnimationName())||"");Be.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&c(n)},[n]);const u=()=>{r()},h=m=>{m?o.play():o.pause(),o.setSpeed(1)},d=m=>{o.play(),o.setSpeed(m)},p=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},f=async()=>{console.log("play next"),await o.loadNextAnimation(),c(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),c(o.getCurrentAnimationName())};return V.jsxs("div",{className:Kn.Container,children:[V.jsx("div",{className:Kn.ContainerPositionTop,children:V.jsxs("div",{className:Kn.flexButtonsTop,children:[V.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{d(-2)},children:V.jsx("img",{src:uCe})}),V.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{d(-1)},children:V.jsx("img",{src:lCe})}),V.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{h(!1)},children:V.jsx("img",{src:ACe})}),V.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{h(!0)},children:V.jsx("img",{src:aCe})}),V.jsx("div",{className:`${Kn.optionButtonsSmall}`,onClick:()=>{d(2)},children:V.jsx("img",{src:cCe})})]})}),V.jsxs("div",{className:Kn.ContainerPosition,children:[V.jsx("div",{className:Kn.topLine}),V.jsxs("div",{className:Kn.flexSelect,children:[V.jsx("div",{className:`${Kn["arrow-button"]} ${Kn["left-button"]}`,onClick:g}),V.jsx("div",{className:Kn.traitInfoTitle,style:{marginBottom:"10px"},children:A}),V.jsx("div",{className:`${Kn["arrow-button"]} ${Kn["right-button"]}`,onClick:f})]}),V.jsxs("div",{className:Kn.flexButtons,children:[e&&V.jsx("div",{className:`${Kn.optionButtons}`,onClick:e,children:V.jsx("img",{src:nCe})}),V.jsx("div",{className:`${Kn.optionButtons}`,onClick:p,children:V.jsx("img",{src:a?oCe:sCe})}),V.jsx("div",{className:`${Kn.optionButtons}`,onClick:u,children:V.jsx("img",{src:i?iCe:rCe})})]})]})]})}const dCe="_tokenBoxWrap_q4pvo_1",hCe="_mask_q4pvo_7",fCe="_timer_q4pvo_31",pCe="_level_q4pvo_42",gCe="_mythic_q4pvo_55",mCe="_epic_q4pvo_60",vCe="_rare_q4pvo_65",yCe="_uncommon_q4pvo_70",wCe="_common_q4pvo_75",BCe="_none_q4pvo_80",CCe="_value_q4pvo_85",bCe="_frame_q4pvo_95",xCe="_emptyIcon_q4pvo_111",ICe="_badge_q4pvo_123",FCe="_frameActive_q4pvo_131",pA={tokenBoxWrap:dCe,mask:hCe,timer:fCe,level:pCe,mythic:gCe,epic:mCe,rare:vCe,uncommon:yCe,common:wCe,none:BCe,value:CCe,frame:bCe,emptyIcon:xCe,badge:ICe,frameActive:FCe,default:"_default_q4pvo_159"},ECe="/CharacterStudio/assets/magic-box-cd45f027.png",LA=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,A]=X.useState(!1),c=()=>{A(!0)};return V.jsxs("div",{className:pA.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&V.jsx("div",{className:jh(pA.frame,pA.frameActive)}),V.jsx("div",{className:jh(pA.frame,o&&pA[o])}),V.jsx("img",{src:l?ECe:s,className:pA.emptyIcon,style:a,onError:c}),i&&V.jsxs("div",{className:jh(pA.level,o&&pA[o]),children:["Lv.",i]})]})},_Ce="_InformationContainerPos_72ckd_2",SCe="_scrollContainer_72ckd_15",UCe="_traitInfoTitle_72ckd_27",QCe="_traitInfoText_72ckd_35",RCe="_flexSelect_72ckd_62",MCe="_checked_72ckd_119",TCe="_checkmark_72ckd_123",NCe="_checkboxHolder_72ckd_136",qo={InformationContainerPos:_Ce,scrollContainer:SCe,traitInfoTitle:UCe,traitInfoText:QCe,"input-box":"_input-box_72ckd_43",flexSelect:RCe,"arrow-button":"_arrow-button_72ckd_70","left-button":"_left-button_72ckd_86","right-button":"_right-button_72ckd_93","anim-button":"_anim-button_72ckd_100","custom-checkbox":"_custom-checkbox_72ckd_105","checkbox-container":"_checkbox-container_72ckd_110",checked:MCe,checkmark:TCe,checkboxHolder:NCe};function BQ({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=X.useContext(Ci),{characterManager:i}=Be.useContext(lr),[s,o]=Be.useState(0),[a,l]=X.useState({}),[A,c]=X.useState([]),u=f=>{i.setManifest(f),i.loadInitialTraits().then(()=>{r(!1)})};Be.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),c(Object.keys(i.getAvatarSelection())))},[t]);const h=f=>{i.loadTraitsFromNFTObject(f).then(()=>{r(!1)})},d=async()=>{if(!t)if(r(!0),s>=n.length-1)e?u(n[0]):h(n[0]),o(0);else{const f=s+1;e?u(n[f]):h(n[f]),o(f)}},p=async()=>{if(!t)if(r(!0),s<=0)e?u(n[n.length-1]):h(n[n.length-1]),o(n.length-1);else{const f=s-1;e?u(n[f]):h(n[f]),o(f)}};return(n==null?void 0:n.length)>0?V.jsxs("div",{className:qo.InformationContainerPos,children:[V.jsx(ka,{title:"Trait Selection",width:180,right:20}),V.jsxs("div",{className:qo.scrollContainer,children:[V.jsxs("div",{className:qo.flexSelect,children:[(n==null?void 0:n.length)>1?V.jsx("div",{className:`${qo["arrow-button"]} ${qo["left-button"]}`,onClick:p}):V.jsx(V.Fragment,{}),(n[s].name||n[s].manifestName)&&V.jsx("div",{style:{textAlign:"center",flex:1},children:V.jsx("div",{className:qo.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?V.jsx("div",{className:`${qo["arrow-button"]} ${qo["right-button"]}`,onClick:d}):V.jsx(V.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&V.jsx("img",{src:n[s].thumb||n[s].thumbnail,alt:"Selection Thumbnail",style:{width:"280px",height:"460px",display:"block",margin:"20px auto 20px"}}),n[s].attributes&&n[s].attributes.map(f=>V.jsx("div",{children:V.jsx("div",{className:qo.traitInfoText,children:`${f.trait_type} : ${f.value}`})},`json:${f.trait_type}_${f.value}`)),e&&A.map(f=>V.jsx("div",{children:V.jsx("div",{className:qo.traitInfoText,children:`${f} : ${a[f].id}`})},`val:${f}`))]})]}):V.jsx(V.Fragment,{})}const jL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAXASURBVHgB7ZzNchNHEMd7ZiWf5WtSCSIfVa5cLN+MTRXrEFPcWJwHwNxys/0Etm+5YZ4Ac0pOIG4EU2WlCgffIm4+pIhS8ADKEQlt07OSKKGdlVdSz64K9++kmhlpR3+Pe3qmuwUgCIIgCIIgCIIgCIIgCIIgCIIgXHAUzCDLflDWRfCVgkVA5aOCkgqhRLMt9cdQW0MhNEBhHRFehW2ondaqDZgxZkZg3w9KrTm9RdJtknBlmAwjeLXTgvuzInbuAi//FPieUrv00gdW1GGnHe7nLXRuAkdmoKDvKYUBOCVfoT3IgSvrP295Gn4nG1sB91S0p4Kvvl34/83rszpkTOYrePXGxj1A3E41GKGGCl/Rq7oXQpM2tma/q0PC0R+orFAt0rfwU32eUgcnzx7tQIZkJrDZxNpFdUwvR6/arqgP59pQrdWqTUj52a0iBCT2nRRi14ttXEv72dOSicCpxCVhFeD+i+fVGkzB8s2g7HVgj77anRHDMhO5ABkwUlzjz4Z4d1ph+5w+jTazzZX1oEYmYTfB5av05rQEjtHgmMjmJoiLqKrFFi5xiTtEPTqcJFPpzc0pTk0EraJNBeqBrU9hZA72wAH03ArZ4+PBk18Socadl39UD8ARzgTuHnfVMT2gPNw3K+L2aHbauOTKT3ZmIrwi7NrENWYhR3Ftm1pJz2lnpsKJwGb10jrdjHXQhhYWQid+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q9YrqX8ujDk+OHt0FZtKKO9i2un7buGj+8Fha4fPcvjH7CtYeWI/BHS/cB2YmEbffbhvfKkC6I/wY8JsIrW7F2uiUxm0aJhXX0PO7a7H3qJGnv4lgFdiYB6vnQHcLwMg04n6cE1jnVF75ceMSMMIqsAnz2NrNxQ0wwSHu6DmFa8AIr4kILUdiMg9cGweXuIbenGqxDo/3jppVYKXpbnaI3n3u1HCK+3FuYXxuZIevASOsApNdK8faMO7Yj4sLcSM0xCMcmPqInfIRjNDFTnm4jWJSU4VpnIlr5hbaj87AiPPrymlwKa6hrS6wwK7FzQpegTG+Ijp6/BXxuYhr4N3kFMYEVu/HEzhLcZU90tIARrg3ubhNG8OvzHrlWuN1OMMCk1/553Abib6Y5r15mAWXfnsfXhusrS6Zb8L2o96Wh7i9OfmWrqncymFYBQ49y9GTaGkIkt6T14ZmElVs7UnfYVJYBTZXknSaawy3K89+DZint6BsiSkUTuK+VuX3gxFs14D+cMwrT3G7McO4eUDEJ8AMu8Bz7+HA1j4Y88rbz02KGZJ5YM+PcJIXkRTzIuHWQjqe5inuletBoLV6HO9xEzN0clROinnRKn6Qp7hRxEUraw6Ei5ihwYnAJuZlEkwsXeU8j79RRj3YkgHVoYt0guiZ4IgowQQhVSQjC3FXbmzsWssVyHNwtXoNzkoI3v5z1vz6m4V3FCK4OWpcZuIi7tn6yK3cefnMSXZnhNMajTevz04vXV6YJ5GXrQPM6mnDztvGGUvMbhhzWvviux9+U4C/gPXxeP/kqPorOCSTDHfyKv6G5Ox2czjZ/+uoegiMmPIwbTZVSKy5q58cPXaegJ1JhrtJ1x+R5V42OcSr6xvXOMqtUtbdRSUEkAGzVwRDoXSTFDJREUz3+OufM/zzK4IZ5Or14AC12ko5vGZqkcMQ/sOBWy5FURK6yy31apkrtFNV0iRcG5v74qi6DRmSS6WnKS0YUaDigiZdNOyfPHdXKpBELpWepuLyy+8XnmiEefobp454TII58IQFvE2u2FPIgfyLwdPVtY0PU93dtMzMzxkYoXUHtsl03JrUdJCdbmjEhwW60ctqEzuP2fxBjq7YPph6ZFSLaGqSP/VnmyQm3cqZ+uUoDlif1R/kEARBEARBEARBEARBEARBEARBEC48HwDC3eeu0ZVWOQAAAABJRU5ErkJggg==",kCe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wMlQxMTo0OTozNy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBiNWViMTliLTkxMmEtMmI0NS1iOTZlLTliNDUxOGUzZDU4NyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjg4ODliZDlkLTAxZjItMTQ0Ni04NDE4LWYyYzNjNjQ1ODNlOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODg4OWJkOWQtMDFmMi0xNDQ2LTg0MTgtZjJjM2M2NDU4M2U4IiBzdEV2dDp3aGVuPSIyMDI0LTAxLTAyVDExOjQ5OjM3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wMlQxMTo1MjoyMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv0y+4AAAASPSURBVHja7ZxrSBVBFMctyqIgC0ujJ5UFaQpZRC/7YoUVQYUUkZQYQoVfJBF62PtBlhlJoJWSUQRSEYUFUVRiSEWRiokVgZqRWUEv7W3/oQkul53Ze+/OXWfyfPh98e6cPfNjnZ2ZPbshnZ2dIUTwIAkkmAQTJJgEk2CCBJNgEkyQYBKsgFnzlsaCanARZICFIJwEqxN8CXR68R08479lgxVgDAkOTPATC8EiXoLbYB9YDeJJsFzucPDLD8FWvABlIBcsAeNBKAn+K3i+Q7ki3oNycAys4eP8gO4oeH2QBFvxFVSAYj6uR3cHwWdcFGzFG1AF8sBakOBkeNFR8AMbAY/BedDqovQPoA6UgghjBbMxkXfGqpMfwUyv4w90wRV+1GTBCyQdmy5oc8hlwQdMFrxF0KlzkjbDwA8XBSebLPikv1cNfusBml0UHGWy4BpBp0olbYaAjgBlselZHBgNloNGm+PbQF8jBfsgKlrQbnuActMtYoWCBkmb68ZO09hNzEbIUzDCq82GAOXekuSRJGl3xGTBmT6IYXsU10Ahn5cGOo5ukeQxCLQL2q0zWXCBizeq7TZD1XdBu1iTBVe4KPieJI9kQZtPYKCRgpF4P/DW5QVDnkUeUVyk1fH3jd2L4Pu1KqSxMfohH6cbfbmS+eqRTdX22ixYck0WnKZAbguY5BV3o8IrPsVkwWUKBMQIYmcpEjzdZMF3eCfaA4C1OxGkld4/WgPdE9ZBLttLGMwJD4AI0F8SvycfPpwIvkuFJ2LBQyXzWl8pck0wmwuCcWCUZrCcwizy3aZg/E13RTBONMXjpL81g+W0wyvf/YpucHPdEpzbxQ8k7djlkesmRTHbnZRt+Ss4T3PBOz1y3aooZq1rj+1xsoMGCd6sKOYFEhxcwRm6Cf4JvmksuIUXlrz2MeZknQTv5k95e4HZvCM6CU73c5O/w2ldskrBqTbL4K4WnCbIL0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+KyJYFZsPdUrvzmSWM9dL8D2YZpWw4tBlrEyTz4n1mmaxvK5DvLBTY9NIitKdBT8P63k1pPg4ApOMllwBX+9agZYKamqdCI4x0Ec9vg+0lTBhYLYVxQLznYQp65L3jJSILhN9G4a/j5RseAefBW5gy00/PwvuWSq4GKb+PWqBAviR/Ay2UxeTV8pqObJMlVwiU38hmAKlizl4/iCqIjXIS8yeYgIE8SOUTlEGPkyuKKb3FlB7FskWN00jX1sIxVM4/uxTaqnad1dcNAXGiSYBGsjuJoXvJTy95VJsEJWeZ2/N7hBghWXQXnl0Ae8IsHOGSfJ4zAJdv59HVlR9SYS7JxESR4XSbBzLgtyiKebnDqugrEe248pkveISbAD3oEvtNCglRwJ1l1wvuaC95gueJ/mgnNMFxzFH6m84V841YVW/nZ9DH0/mD4xTpBgEkyQYBJMggkSTIJJMEGCteYPxO/zzCRZDV4AAAAASUVORK5CYII=",DCe="/CharacterStudio/assets/color-palette-71a7a2d4.png";var Ws={},_0={},LCe=typeof pa=="object"&&pa&&pa.Object===Object&&pa,o5=LCe,VCe=o5,PCe=typeof self=="object"&&self&&self.Object===Object&&self,OCe=VCe||PCe||Function("return this")(),Ga=OCe,WCe=Ga,GCe=WCe.Symbol,S0=GCe,KL=S0,a5=Object.prototype,ZCe=a5.hasOwnProperty,JCe=a5.toString,ng=KL?KL.toStringTag:void 0;function HCe(n){var e=ZCe.call(n,ng),t=n[ng];try{n[ng]=void 0;var r=!0}catch{}var i=JCe.call(n);return r&&(e?n[ng]=t:delete n[ng]),i}var zCe=HCe,YCe=Object.prototype,XCe=YCe.toString;function jCe(n){return XCe.call(n)}var KCe=jCe,$L=S0,$Ce=zCe,qCe=KCe,ebe="[object Null]",tbe="[object Undefined]",qL=$L?$L.toStringTag:void 0;function nbe(n){return n==null?n===void 0?tbe:ebe:qL&&qL in Object(n)?$Ce(n):qCe(n)}var Wu=nbe,rbe=Array.isArray,Po=rbe;function ibe(n){return n!=null&&typeof n=="object"}var Xl=ibe,sbe=Wu,obe=Po,abe=Xl,lbe="[object String]";function Abe(n){return typeof n=="string"||!obe(n)&&abe(n)&&sbe(n)==lbe}var cbe=Abe;function ube(n){return function(e,t,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[n?a:++i];if(t(s[l],l,s)===!1)break}return e}}var dbe=ube,hbe=dbe,fbe=hbe(),pbe=fbe;function gbe(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=Rbe}var bQ=Mbe,Tbe=Wu,Nbe=bQ,kbe=Xl,Dbe="[object Arguments]",Lbe="[object Array]",Vbe="[object Boolean]",Pbe="[object Date]",Obe="[object Error]",Wbe="[object Function]",Gbe="[object Map]",Zbe="[object Number]",Jbe="[object Object]",Hbe="[object RegExp]",zbe="[object Set]",Ybe="[object String]",Xbe="[object WeakMap]",jbe="[object ArrayBuffer]",Kbe="[object DataView]",$be="[object Float32Array]",qbe="[object Float64Array]",exe="[object Int8Array]",txe="[object Int16Array]",nxe="[object Int32Array]",rxe="[object Uint8Array]",ixe="[object Uint8ClampedArray]",sxe="[object Uint16Array]",oxe="[object Uint32Array]",pn={};pn[$be]=pn[qbe]=pn[exe]=pn[txe]=pn[nxe]=pn[rxe]=pn[ixe]=pn[sxe]=pn[oxe]=!0;pn[Dbe]=pn[Lbe]=pn[jbe]=pn[Vbe]=pn[Kbe]=pn[Pbe]=pn[Obe]=pn[Wbe]=pn[Gbe]=pn[Zbe]=pn[Jbe]=pn[Hbe]=pn[zbe]=pn[Ybe]=pn[Xbe]=!1;function axe(n){return kbe(n)&&Nbe(n.length)&&!!pn[Tbe(n)]}var lxe=axe;function Axe(n){return function(e){return n(e)}}var xQ=Axe,uC={exports:{}};uC.exports;(function(n,e){var t=o5,r=e&&!e.nodeType&&e,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&t.process,a=function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a})(uC,uC.exports);var IQ=uC.exports,cxe=lxe,uxe=xQ,t3=IQ,n3=t3&&t3.isTypedArray,dxe=n3?uxe(n3):cxe,u5=dxe,hxe=mbe,fxe=A5,pxe=Po,gxe=CQ,mxe=c5,vxe=u5,yxe=Object.prototype,wxe=yxe.hasOwnProperty;function Bxe(n,e){var t=pxe(n),r=!t&&fxe(n),i=!t&&!r&&gxe(n),s=!t&&!r&&!i&&vxe(n),o=t||r||i||s,a=o?hxe(n.length,String):[],l=a.length;for(var A in n)(e||wxe.call(n,A))&&!(o&&(A=="length"||i&&(A=="offset"||A=="parent")||s&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||mxe(A,l)))&&a.push(A);return a}var d5=Bxe,Cxe=Object.prototype;function bxe(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Cxe;return n===t}var FQ=bxe;function xxe(n,e){return function(t){return n(e(t))}}var h5=xxe,Ixe=h5,Fxe=Ixe(Object.keys,Object),Exe=Fxe,_xe=FQ,Sxe=Exe,Uxe=Object.prototype,Qxe=Uxe.hasOwnProperty;function Rxe(n){if(!_xe(n))return Sxe(n);var e=[];for(var t in Object(n))Qxe.call(n,t)&&t!="constructor"&&e.push(t);return e}var Mxe=Rxe;function Txe(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var np=Txe,Nxe=Wu,kxe=np,Dxe="[object AsyncFunction]",Lxe="[object Function]",Vxe="[object GeneratorFunction]",Pxe="[object Proxy]";function Oxe(n){if(!kxe(n))return!1;var e=Nxe(n);return e==Lxe||e==Vxe||e==Dxe||e==Pxe}var f5=Oxe,Wxe=f5,Gxe=bQ;function Zxe(n){return n!=null&&Gxe(n.length)&&!Wxe(n)}var Ub=Zxe,Jxe=d5,Hxe=Mxe,zxe=Ub;function Yxe(n){return zxe(n)?Jxe(n):Hxe(n)}var U0=Yxe,Xxe=pbe,jxe=U0;function Kxe(n,e){return n&&Xxe(n,e,jxe)}var p5=Kxe;function $xe(n){return n}var g5=$xe,qxe=g5;function e1e(n){return typeof n=="function"?n:qxe}var t1e=e1e,n1e=p5,r1e=t1e;function i1e(n,e){return n&&n1e(n,r1e(e))}var EQ=i1e,s1e=h5,o1e=s1e(Object.getPrototypeOf,Object),_Q=o1e,a1e=Wu,l1e=_Q,A1e=Xl,c1e="[object Object]",u1e=Function.prototype,d1e=Object.prototype,m5=u1e.toString,h1e=d1e.hasOwnProperty,f1e=m5.call(Object);function p1e(n){if(!A1e(n)||a1e(n)!=c1e)return!1;var e=l1e(n);if(e===null)return!0;var t=h1e.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&m5.call(t)==f1e}var g1e=p1e;function m1e(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var M1e=R1e,T1e=Qb;function N1e(n,e){var t=this.__data__,r=T1e(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var k1e=N1e,D1e=y1e,L1e=E1e,V1e=U1e,P1e=M1e,O1e=k1e;function rp(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,h=!0,d=t&qFe?new XFe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,GUe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,OUe.default)(r)?(0,VUe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,DUe.default)(r)&&t.push(r)}),t};_0.default=ZUe;var Q0={};function JUe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,uMe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,AMe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=dMe({},r[a],s[a])}),i}),r};Q0.default=hMe;var R0={};Object.defineProperty(R0,"__esModule",{value:!0});R0.autoprefix=void 0;var fMe=EQ,k3=gMe(fMe),pMe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){bMe(i,r);function i(){var s,o,a,l;CMe(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){SMe(i,r);function i(){var s,o,a,l;_Me(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:!0;r[o]=a};return e===0&&i("first-child"),e===t-1&&i("last-child"),(e===0||e%2===0)&&i("even"),Math.abs(e%2)===1&&i("odd"),i("nth-child",e),r};VQ.default=QMe;Object.defineProperty(Ws,"__esModule",{value:!0});Ws.ReactCSS=Ws.loop=Ws.handleActive=PQ=Ws.handleHover=Ws.hover=void 0;var RMe=_0,MMe=lp(RMe),TMe=Q0,NMe=lp(TMe),kMe=R0,DMe=lp(kMe),LMe=M0,W5=lp(LMe),VMe=T0,PMe=lp(VMe),OMe=VQ,WMe=lp(OMe);function lp(n){return n&&n.__esModule?n:{default:n}}Ws.hover=W5.default;var PQ=Ws.handleHover=W5.default;Ws.handleActive=PMe.default;Ws.loop=WMe.default;var GMe=Ws.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?h=1:h=Math.round(u*100/a)/100,t.a!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}else{var d=void 0;if(c<0?d=0:c>o?d=1:d=Math.round(c*100/o)/100,i!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}return null},ZI={},JMe=function(e,t,r,i){if(typeof document>"u"&&!i)return null;var s=i?new i:document.createElement("canvas");s.width=r*2,s.height=r*2;var o=s.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,s.width,s.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),s.toDataURL()):null},HMe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(ZI[s])return ZI[s];var o=JMe(e,t,r,i);return ZI[s]=o,o},V3=Object.assign||function(n){for(var e=1;e-1},oTe=function(e){return Number(String(e).replace(/%/g,""))},aTe=1,kt=function(n){tTe(e,n);function e(t){qMe(this,e);var r=eTe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(i){r.setUpdatedValue(i.target.value,i)},r.handleKeyDown=function(i){var s=oTe(i.target.value);if(!isNaN(s)&&sTe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===G5?s+o:s-o;r.setUpdatedValue(a,i)}},r.handleDrag=function(i){if(r.props.dragLabel){var s=Math.round(r.props.value+i.movementX);s>=0&&s<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(s),i)}},r.handleMouseDown=function(i){r.props.dragLabel&&(i.preventDefault(),r.handleDrag(i),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},r.inputId="rc-editable-input-"+aTe++,r}return KMe(e,[{key:"componentDidUpdate",value:function(r,i){this.props.value!==this.state.value&&(r.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return $Me({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||nTe}},{key:"setUpdatedValue",value:function(r,i){var s=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(s,i),this.setState({value:r})}},{key:"render",value:function(){var r=this,i=ft({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return X.createElement("div",{style:i.wrap},X.createElement("input",{id:this.inputId,style:i.input,ref:function(o){return r.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?X.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(Be.PureComponent||Be.Component),lTe=function(e,t,r,i){var s=i.clientWidth,o=i.clientHeight,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,A=a-(i.getBoundingClientRect().left+window.pageXOffset),c=l-(i.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(c<0)u=359;else if(c>o)u=0;else{var h=-(c*100/o)+100;u=360*h/100}if(r.h!==u)return{h:u,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var d=void 0;if(A<0)d=0;else if(A>s)d=359;else{var p=A*100/s;d=360*p/100}if(r.h!==d)return{h:d,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},ATe=function(){function n(e,t){for(var r=0;r=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return tt(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(zDe,arguments)},brighten:function(){return this._applyModification(YDe,arguments)},darken:function(){return this._applyModification(XDe,arguments)},desaturate:function(){return this._applyModification(ZDe,arguments)},saturate:function(){return this._applyModification(JDe,arguments)},greyscale:function(){return this._applyModification(HDe,arguments)},spin:function(){return this._applyModification(jDe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(qDe,arguments)},complement:function(){return this._applyCombination(KDe,arguments)},monochromatic:function(){return this._applyCombination(eLe,arguments)},splitcomplement:function(){return this._applyCombination($De,arguments)},triad:function(){return this._applyCombination(oV,[3])},tetrad:function(){return this._applyCombination(oV,[4])}};tt.fromRatio=function(n,e){if(vC(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=_g(n[r]));n=t}return tt(n,e)};function VDe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=sLe(n)),vC(n)=="object"&&(il(n.r)&&il(n.g)&&il(n.b)?(e=PDe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):il(n.h)&&il(n.s)&&il(n.v)?(r=_g(n.s),i=_g(n.v),e=WDe(n.h,r,i),o=!0,a="hsv"):il(n.h)&&il(n.s)&&il(n.l)&&(r=_g(n.s),s=_g(n.l),e=ODe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=lz(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function PDe(n,e,t){return{r:Bn(n,255)*255,g:Bn(e,255)*255,b:Bn(t,255)*255}}function nV(n,e,t){n=Bn(n,255),e=Bn(e,255),t=Bn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(u-=1),u<1/6?A+(c-A)*6*u:u<1/2?c:u<2/3?A+(c-A)*(2/3-u)*6:A}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function rV(n,e,t){n=Bn(n,255),e=Bn(e,255),t=Bn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(tt(r));return s}function eLe(n,e){e=e||6;for(var t=tt(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(tt({h:r,s:i,v:s})),s=(s+a)%1;return o}tt.mix=function(n,e,t){t=t===0?0:t||50;var r=tt(n).toRgb(),i=tt(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return tt(o)};tt.readability=function(n,e){var t=tt(n),r=tt(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};tt.isReadable=function(n,e,t){var r=tt.readability(n,e),i,s;switch(s=!1,i=oLe(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};tt.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var A=0;Ai&&(i=s,r=tt(e[A]));return tt.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,tt.mostReadable(n,["#fff","#000"],t))};var G_=tt.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",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:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",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:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",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:"f00",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:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},tLe=tt.hexNames=nLe(G_);function nLe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function lz(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function Bn(n,e){rLe(n)&&(n="100%");var t=iLe(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function Zb(n){return Math.min(1,Math.max(0,n))}function Yi(n){return parseInt(n,16)}function rLe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function iLe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function Qo(n){return n.length==1?"0"+n:""+n}function _g(n){return n<=1&&(n=n*100+"%"),n}function Az(n){return Math.round(parseFloat(n)*255).toString(16)}function aV(n){return Yi(n)/255}var bo=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function il(n){return!!bo.CSS_UNIT.exec(n)}function sLe(n){n=n.replace(DDe,"").replace(LDe,"").toLowerCase();var e=!1;if(G_[n])n=G_[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=bo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=bo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=bo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=bo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=bo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=bo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=bo.hex8.exec(n))?{r:Yi(t[1]),g:Yi(t[2]),b:Yi(t[3]),a:aV(t[4]),format:e?"name":"hex8"}:(t=bo.hex6.exec(n))?{r:Yi(t[1]),g:Yi(t[2]),b:Yi(t[3]),format:e?"name":"hex"}:(t=bo.hex4.exec(n))?{r:Yi(t[1]+""+t[1]),g:Yi(t[2]+""+t[2]),b:Yi(t[3]+""+t[3]),a:aV(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=bo.hex3.exec(n))?{r:Yi(t[1]+""+t[1]),g:Yi(t[2]+""+t[2]),b:Yi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function oLe(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var lV=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return kDe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},Sg=function(e,t){var r=e.hex?tt(e.hex):tt(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},Cc=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&tt(e).isValid()},XQ=function(e){if(!e)return"#fff";var t=Sg(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},YI=function(e,t){var r=e.replace("°","");return tt(t+" ("+r+")")._ok},ig=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){fLe(i,r);function i(){var s,o,a,l;hLe(this,i);for(var A=arguments.length,c=Array(A),u=0;ua))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,h=!0,d=t&FLe?new yC:void 0;for(s.set(n,e),s.set(e,n);++u=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Ny=24,Y3e=yz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Ny:r,s=n.height,o=s===void 0?Ny:s,a=n.style,l=a===void 0?{}:a,A=z3e(n,["fill","width","height","style"]);return EV.default.createElement("svg",FV({viewBox:"0 0 "+Ny+" "+Ny,style:FV({fill:t,width:i,height:o},l)},A),EV.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},X3e=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(IV(i.s)?r.props.hsl.s:i.s),l:Number(IV(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return X3e(e,[{key:"render",value:function(){var r=this,i=ft({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=X.createElement("div",{style:i.fields,className:"flexbox-fix"},X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=X.createElement("div",{style:i.fields,className:"flexbox-fix"},X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),X.createElement("div",{style:i.alpha},X.createElement(kt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=X.createElement("div",{style:i.fields,className:"flexbox-fix"},X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),X.createElement("div",{style:i.alpha},X.createElement(kt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),X.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,X.createElement("div",{style:i.toggle},X.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},X.createElement(Y3e,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(X.Component);wz.defaultProps={view:"hex"};var _V=function(){var e=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return X.createElement("div",{style:e.picker})},q3e=function(){var e=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return X.createElement("div",{style:e.picker})},tR=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,A=e.renderers,c=e.styles,u=c===void 0?{}:c,h=e.className,d=h===void 0?"":h,p=e.defaultView,f=ft(Oi({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:i});return X.createElement("div",{style:f.picker,className:"chrome-picker "+d},X.createElement("div",{style:f.saturation},X.createElement(Gb,{style:f.Saturation,hsl:o,hsv:a,pointer:q3e,onChange:r})),X.createElement("div",{style:f.body},X.createElement("div",{style:f.controls,className:"flexbox-fix"},X.createElement("div",{style:f.color},X.createElement("div",{style:f.swatch},X.createElement("div",{style:f.active}),X.createElement(Ap,{renderers:A}))),X.createElement("div",{style:f.toggles},X.createElement("div",{style:f.hue},X.createElement(cp,{style:f.Hue,hsl:o,pointer:_V,onChange:r})),X.createElement("div",{style:f.alpha},X.createElement(OQ,{style:f.Alpha,rgb:s,hsl:o,pointer:_V,renderers:A,onChange:r})))),X.createElement(wz,{rgb:s,hsl:o,hex:l,view:p,onChange:r,disableAlpha:i})))};tR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),disableAlpha:Oe.bool,styles:Oe.object,defaultView:Oe.oneOf(["hex","rgb","hsl"])};tR.defaultProps={width:225,disableAlpha:!1,styles:{}};const eVe=Wi(tR);var tVe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=ft({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:XQ(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return X.createElement(zu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},X.createElement("div",{style:a.dot}))},nVe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=ft({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,A){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},A):i({hex:l.hex,source:"hex"},A)};return X.createElement("div",{style:s.fields,className:"flexbox-fix"},X.createElement("div",{style:s.active}),X.createElement(kt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),X.createElement(kt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),X.createElement(kt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),X.createElement(kt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},nR=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,A=e.className,c=A===void 0?"":A,u=ft(Oi({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),h=function(p,f){p.hex?Cc(p.hex)&&t({hex:p.hex,source:"hex"},f):t(p,f)};return X.createElement(k0,{style:u.Compact,styles:l},X.createElement("div",{style:u.compact,className:"compact-picker "+c},X.createElement("div",null,Yu(i,function(d){return X.createElement(tVe,{key:d,color:d,active:d.toLowerCase()===s,onClick:h,onSwatchHover:r})}),X.createElement("div",{style:u.clear})),X.createElement(nVe,{hex:s,rgb:o,onChange:h})))};nR.propTypes={colors:Oe.arrayOf(Oe.string),styles:Oe.object};nR.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};Wi(nR);var rVe=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=ft({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return X.createElement("div",{style:a.swatch},X.createElement(zu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const iVe=PQ(rVe);var rR=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,A=e.className,c=A===void 0?"":A,u=ft(Oi({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),h=function(p,f){return i({hex:p,source:"hex"},f)};return X.createElement("div",{style:u.card,className:"github-picker "+c},X.createElement("div",{style:u.triangleShadow}),X.createElement("div",{style:u.triangle}),Yu(r,function(d){return X.createElement(iVe,{color:d,key:d,onClick:h,onSwatchHover:s})}))};rR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),colors:Oe.arrayOf(Oe.string),triangle:Oe.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Oe.object};rR.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Wi(rR);var sVe=function(e){var t=e.direction,r=ft({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return X.createElement("div",{style:r.picker})},oVe=Object.assign||function(n){for(var e=1;e.5});return X.createElement("div",{style:r.picker})},cVe=function(){var e=ft({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return X.createElement("div",{style:e.pointer},X.createElement("div",{style:e.left},X.createElement("div",{style:e.leftInside})),X.createElement("div",{style:e.right},X.createElement("div",{style:e.rightInside})))},SV=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=ft({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return X.createElement("div",{style:o.button,onClick:t},r||i)},uVe=function(e){var t=e.rgb,r=e.currentColor,i=ft({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return X.createElement("div",null,X.createElement("div",{style:i.label},"new"),X.createElement("div",{style:i.swatches},X.createElement("div",{style:i.new}),X.createElement("div",{style:i.current})),X.createElement("div",{style:i.label},"current"))},dVe=function(){function n(e,t){for(var r=0;r100&&(c.a=100),c.a/=100,t({h:i.h,s:i.s,l:i.l,a:c.a,source:"rgb"},u))};return X.createElement("div",{style:a.fields,className:"flexbox-fix"},X.createElement("div",{style:a.double},X.createElement(kt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),X.createElement("div",{style:a.single},X.createElement(kt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),X.createElement("div",{style:a.single},X.createElement(kt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),X.createElement("div",{style:a.single},X.createElement(kt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),X.createElement("div",{style:a.alpha},X.createElement(kt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},mVe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var ky=24,xVe=Cz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?ky:r,s=n.height,o=s===void 0?ky:s,a=n.style,l=a===void 0?{}:a,A=bVe(n,["fill","width","height","style"]);return QV.default.createElement("svg",UV({viewBox:"0 0 "+ky+" "+ky,style:UV({fill:t,width:i,height:o},l)},A),QV.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},IVe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,A=ft({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:XQ(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return X.createElement(zu,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},X.createElement("div",{style:A.check},X.createElement(xVe,null)))},FVe=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=ft({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return X.createElement("div",{style:o.group},Yu(i,function(a,l){return X.createElement(IVe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},lR=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,h=ft(Oi({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},A)),d=function(f,g){return i({hex:f,source:"hex"},g)};return X.createElement("div",{style:h.picker,className:"swatches-picker "+u},X.createElement(k0,null,X.createElement("div",{style:h.overflow},X.createElement("div",{style:h.body},Yu(o,function(p){return X.createElement(FVe,{key:p.toString(),group:p,active:a,onClick:d,onSwatchHover:s})}),X.createElement("div",{style:h.clear})))))};lR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),height:Oe.oneOfType([Oe.string,Oe.number]),colors:Oe.arrayOf(Oe.arrayOf(Oe.string)),styles:Oe.object};lR.defaultProps={width:320,height:240,colors:[[Wd[900],Wd[700],Wd[500],Wd[300],Wd[100]],[Gd[900],Gd[700],Gd[500],Gd[300],Gd[100]],[Zd[900],Zd[700],Zd[500],Zd[300],Zd[100]],[Jd[900],Jd[700],Jd[500],Jd[300],Jd[100]],[Hd[900],Hd[700],Hd[500],Hd[300],Hd[100]],[zd[900],zd[700],zd[500],zd[300],zd[100]],[Yd[900],Yd[700],Yd[500],Yd[300],Yd[100]],[Xd[900],Xd[700],Xd[500],Xd[300],Xd[100]],[jd[900],jd[700],jd[500],jd[300],jd[100]],["#194D33",Ug[700],Ug[500],Ug[300],Ug[100]],[Kd[900],Kd[700],Kd[500],Kd[300],Kd[100]],[$d[900],$d[700],$d[500],$d[300],$d[100]],[qd[900],qd[700],qd[500],qd[300],qd[100]],[eh[900],eh[700],eh[500],eh[300],eh[100]],[th[900],th[700],th[500],th[300],th[100]],[nh[900],nh[700],nh[500],nh[300],nh[100]],[rh[900],rh[700],rh[500],rh[300],rh[100]],[ih[900],ih[700],ih[500],ih[300],ih[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Wi(lR);var AR=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,h=ft(Oi({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},A),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),d=function(f,g){Cc(f)&&t({hex:f,source:"hex"},g)};return X.createElement("div",{style:h.card,className:"twitter-picker "+u},X.createElement("div",{style:h.triangleShadow}),X.createElement("div",{style:h.triangle}),X.createElement("div",{style:h.body},Yu(s,function(p,f){return X.createElement(zu,{key:f,color:p,hex:p,style:h.swatch,onClick:d,onHover:r,focusStyle:{boxShadow:"0 0 4px "+p}})}),X.createElement("div",{style:h.hash},"#"),X.createElement(kt,{label:null,style:{input:h.input},value:i.replace("#",""),onChange:d}),X.createElement("div",{style:h.clear})))};AR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),triangle:Oe.oneOf(["hide","top-left","top-right"]),colors:Oe.arrayOf(Oe.string),styles:Oe.object};AR.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Wi(AR);var cR=function(e){var t=ft({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return X.createElement("div",{style:t.picker})};cR.propTypes={hsl:Oe.shape({h:Oe.number,s:Oe.number,l:Oe.number,a:Oe.number})};cR.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var uR=function(e){var t=ft({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return X.createElement("div",{style:t.picker})};uR.propTypes={hsl:Oe.shape({h:Oe.number,s:Oe.number,l:Oe.number,a:Oe.number})};uR.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var EVe=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(d,p){if(d.hex)Cc(d.hex)&&t({hex:d.hex,source:"hex"},p);else if(d.rgb){var f=d.rgb.split(",");YI(d.rgb,"rgb")&&t({r:f[0],g:f[1],b:f[2],a:1,source:"rgb"},p)}else if(d.hsv){var g=d.hsv.split(",");YI(d.hsv,"hsv")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),g[1]==1?g[1]=.01:g[2]==1&&(g[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsv"},p))}else if(d.hsl){var m=d.hsl.split(",");YI(d.hsl,"hsl")&&(m[2]=m[2].replace("%",""),m[1]=m[1].replace("%",""),m[0]=m[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(m[0]),s:Number(m[1]),v:Number(m[2]),source:"hsl"},p))}},l=ft({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),A=r.r+", "+r.g+", "+r.b,c=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return X.createElement("div",{style:l.wrap,className:"flexbox-fix"},X.createElement("div",{style:l.fields},X.createElement("div",{style:l.double},X.createElement(kt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),X.createElement("div",{style:l.column},X.createElement("div",{style:l.single},X.createElement(kt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),X.createElement("div",{style:l.single},X.createElement(kt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),X.createElement("div",{style:l.single},X.createElement(kt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},dR=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,A=e.styles,c=A===void 0?{}:A,u=e.className,h=u===void 0?"":u,d=ft(Oi({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},c));return X.createElement("div",{style:d.picker,className:"google-picker "+h},X.createElement("div",{style:d.head},l),X.createElement("div",{style:d.swatch}),X.createElement("div",{style:d.saturation},X.createElement(Gb,{hsl:s,hsv:o,pointer:cR,onChange:r})),X.createElement("div",{style:d.body},X.createElement("div",{style:d.controls,className:"flexbox-fix"},X.createElement("div",{style:d.hue},X.createElement(cp,{style:d.Hue,hsl:s,radius:"4px",pointer:uR,onChange:r}))),X.createElement(EVe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};dR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),styles:Oe.object,header:Oe.string};dR.defaultProps={width:652,styles:{},header:"Color picker"};Wi(dR);const _Ve="_InformationContainerPos_1yd4c_2",SVe="_scrollContainer_1yd4c_15",jI={InformationContainerPos:_Ve,scrollContainer:SVe,"options-container":"_options-container_1yd4c_24"},UVe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmU1ZTg4ZDczLWQ3YmItNjg0NS1iNDkxLWYxZTU0YmRhZDE1MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFhMDRkN2Y4LWVjNjQtZTg0ZC1iMjQzLWQ4ZjRhMjVlN2YzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozNzgwNzA3Yy0zNDg5LTAzNDctYmEwNy1kOTFhY2ZkYmUwODYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MjQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ZTVlODhkNzMtZDdiYi02ODQ1LWI0OTEtZjFlNTRiZGFkMTUyIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjQ3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+okruHwAAA6NJREFUeNrt279LG2EYwHG1CCqKPwKOJQU3cXYqXZ0KofgPuBWcUmsgoouCFArS0UXaWUpTFxHcUnE4cO6fULoUbWnTFk2ftz4p19BoLve+d33vvsN3KWre97lPUvPm7Gs2m32U3xgCABgCAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABABnlV5VR6QH0mOpIq229VSacPj4E/oY7Y9b0TWZtY0AwO7Qp6WH0q70XrqSmh1qSLMO1zKrj9Hp8a90jbu65mkAxBv4svRR+nHD0MOZr5t3uJ75iGsxa18GQPRBl6Sgy0GHu5QWHa5rUR8j6rrMXkoAuH3Ag9KLHgYcbsfh+nZirs3sbRAA/x5uQXrb4zMs3AdpyMH6hvRnx1nbpe6xAIC/hzssHcUcbrjnUr/F9fXrz7S1PrPXYQBcD3dKemdxuKZP0pzFNc7pz7S5RrPnqVwDkAGMSTXLg211auNtmL4NPXW0RrP3sVwC0EOVwNFgW9XjPMv01anueI2By8Or/xKAbHhSeuN4sK3OpPvSQIT1Dej3nCW0RjOLyVwA0Jf9IKHBhk8IX0vFLtZX1K9tJLzGII3/DtJ4q1dLeLDhvkjH0jNpSXqkLem/HevXpLW+WtJvEZP+IKee4nB9qZ7kB0pJPvOPuLiRzgkKmQCgz/xDLmrkDpN4JUjikOeEi9lzJ64Pi1wDOOAixu7AZwBVLmDsqr7/DrAhfeVCRs7MbCMr7wLWuKCRW8vaOYC5cfIbF/bWzIwqWT0J3LRww0eWM7PZzPpnAeUUztl9yMyknJdPA7el71z0P5lZbOftfgDzSvCTi/97BuW83hG0lfNfDM3et/J+T+BKjgGscFfwNYL1DodF+yl/Pm/j/oP9Doc869wVfPNh0Z50Vzr3GMC57mEvjUMeH/8yqKJvh15Ko9I96cJjABe6h1HdUyPJQx4fAdyRFtruz/MdQDG0nwWzRwB0DyJTAPjjUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAhgDMSJ89BmDWPgOA3gGMS0+kVU8zax8HAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIACQlX4BjeT0VuSSEBUAAAAASUVORK5CYII=",QVe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4MDc2OWJhLTIwNzQtMjU0Zi1iNjM5LWJiZjEyMTFlMjljNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmMxMzRkOGNhLTVlMWUtYzM0Yy05ZmM0LTNlZTgyNGQ1YTVhYyIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NzUzMzYxZC05NmIzLTgwNDctYTA0ZC0wODcxYmNiNzY4MDAiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6Mjk6NTctMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDgwNzY5YmEtMjA3NC0yNTRmLWI2MzktYmJmMTIxMWUyOWM1IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjE4LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Yrc/VQAAAzxJREFUeNrt3b9LFnEcwHE3IW1oiUCF/gCXcgibmhyaDEqnWhoCaRXqUQhByKVVXAqsMbQyGgIHA6GhSdpNc7E/IBehp8/h94ErRLzoOc671/Ce7/O572t4/PHc9bTb7R41NzcBADcBAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAinVrudUfPY92o+0ut5uu1Q9AtQCsRe2SWgMAAAAAAAAAAEo/7KHoWnQl12i0USKAjXTN/AzZTEMAdB/AQvQjfRrvtBMdlAjgIF0zP0M20wIA3QewVOJBF20JAAAAAACAbgJYrDCARQD+30EPRjei66nsU/fVaLXCAFbTjKO5ubMdBgEoDuBR9Cv6+VeHFQZweMy82Q6PACgOYLbCB120WQCKA5ipEYAZAAAAoCCAxzUC8BiAk3+3fzeajCZSN6OXNQLwMu3U2W8y7TwEwNENaTe0CQCWW7cbDOA2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcWQB3GgzgDgDLrbHoa/Ql1+foe40O+nvaKb9jtvMYAMutc9Hl9C3hTgPR0xoBeJp2yu+Y7XzO8wE8IAIAAAAAAABPCQPgTwD3ok/Req6P0V6FD3ovzZifOdvhHgD/9hKI7JPzpVwXoxcVBvAizZifeaDKL5fwsGgPiwYAAAAAAACAswJgKnqf3tzV6W20X+JB76dr5mfIZpoCoPsAeqPz6aeETheiDyUC+JCumZ8hm6kXAO8NBAAAAAAAoFQAfdG7EgFk1+oDoLuHOhI9jB6covvRVokAttI1TzNbtsMIAMUBPKnRXwOfAOD/AQAAAAAAACj04si6APDiyBMOejh6Fs3naqX/pqkLgPW0U37HbOdhAI7eoNXUbwZNAuC7gQAAAAAADQYw3mAA440BkD7svYlWotepV9FmgwFspnvQuR8r6R5N1hHAfIMPumjzdQQw52BP3RwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA2QQwHe1E36JtHdu3dI+mfTVMAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAAV7DcOsgfgT8DmTAAAAABJRU5ErkJggg==",RVe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjJkMTY5MDdlLWQyY2EtZDA0Mi05MWRjLTliZTMyYzYyYjlmOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNmQ1YTFjLWM5NjAtMDE0OS04OWQwLTQ3NDQ0MzAzZDI1ZCIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2N2JiZmQ0OC0yMGMzLTI0NDktODQyNS1kNWJmOTBlNzMwYjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MTQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MmQxNjkwN2UtZDJjYS1kMDQyLTkxZGMtOWJlMzJjNjJiOWY5IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMzOjExLTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Q6I0lAAAAs1JREFUeNrt3TtrFFEYgOFE2HjFXgv9AyIYsbATMaAWQtqAYBPQ0ibCgoSA/yGbwsJ/o6Ag3gMWEkurTeGlcfwGzoIs7LKT3TXOOU/xFlnYkNnvIRNOZs4sVFW1oHLzIQDgQwBAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAiVt91l2OXkRVi3oTXQVg+uHfjX60bPiDfkUPADj48C+2ePh/dx2AgwF4ncHw695HHQCaA6gy6hYAZQPYAqBsANsAlA1gBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAogDE14tRt359RL3ocbQSLQGQH4Aj0bsJ31tfF3EDgPwAvGzw/t/ROgDlAhhcY7gMQLkABpeXnQSgXAB1mwCUDeAjAGUD6ANQNoB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCQ6wFQNoAnQ8fWiXYBKAfAnaFjOxXtATAewIdMhv85Ojp0bGfqq3sBGA/gcrodKrt9guO11Sm+XxkA0gd1P90Y2dbhb4w4rm8ATI5gpYVbx+8On/eHHoJRAdAMwVJ9j3zaNKE3ZmOFw6z+uTaj29HxEcdxLvoKQIHVd/XW9/XN4LcLAC0c/vno04xOLwC0bPj3oi8z/PsCgIYDWExLr/+iTlrkORutTbHYA8AMAXTTuvu8e5XO8XtTLPIAMAcATzNbVgagIYAdAAAAAAAAAAAAAADKA7CdGYA+AM0AbGUG4C0AzQDczAzABgDNAHTSHrs5DL9ebTwGQHME1zIY/vfoQjG7hc8BwXr0s8XDXyvqeQFzQnClhZeXPY8uFffEkDkiOB09ShDq/9rt/4f10/n+YXSiyGcGqfCnhgkAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBp+gMB5Yr6zMTlPAAAAABJRU5ErkJggg==",MVe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmFmYmE3YzFhLWI0MTMtMGQ0MS05YmRkLTE2ZGY2MTllOTgyMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjkxMWMyNDQ0LTUzYzgtYjU0OC1iZjBmLTczZWE4ZmU5NWYzZSIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjZhMzQ1Ni02ODczLWQ5NDYtOTRkMy1mZTYwZjQ5NzliNjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6NDQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YWZiYTdjMWEtYjQxMy0wZDQxLTliZGQtMTZkZjYxOWU5ODIxIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjI2LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+F7DBkwAABCVJREFUeNrt3TtMFEEYwHHuAiYkNjRg74mJpSYUkCiGAhKxsLKXggQ6yi2wQUh8RMCGRJulEgotjgLwVaCVDYYeHzQaKU5FCRo4vwnfRdQgHvu4mZ1/8W/Iec7c/u7gdmd368rlch35Gy8CAHgRAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAJLpUhjkpW5pQfoolaRPjlXSsZs59Jg5AeDgDZ+T2qRFaUcqZyQzl0c6txwA9n/X9+m7ppzR1nWOeQD8DaBD+pzhjV/JzLEDAL9v/JPSmgcbv5KZaysAfv3ev+PRxq80acPfAzYAKEgrHgIwcy4AIAwGpS8eAjBzHgBAGEx7uPErhQAIg6LHAIoACIM5jwHMAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIuA3pjbYBgOwDMOvyNqUZ6azUuGcMjfqz+/qYHQBkC8BXaUI6/p/rE8b13wAgAwB+SOel+irGVC91St8B4DYAs8K4J8LYehJepQyAhAEMVfPO3+eTYAgAbgJYinGMSwBwC8A36VyMY+zU5wSAIwCWpeYYx9gsvQKAOwAe7P2eH8MYzX6ChwBwB8DtOE+60PMWxwHgDoCRBMY5AgB3AIzHeQaufgJMAIC/AQDg8beAZQC4A2Argf0AWwBwa0/gc+lIDONr0OdiT6CjxwJyEcaW41iA2wDeS70RxnZBnwMADq8HMOfhXzzEuHpTuG4BAFJaEWQO5IxKp/61f0C/75vHXEvo4A8Aarwm8J00K13WpV9HtYL+bFYfw5pAT5aFb2osC+e8AABkFcBOxADgGIBt6YU0pUfwhqWrh2xYn2NKn3MbAHYDeCId0713ed2RE0d5fc4W6TEA7APwVuqPsgK4ypXC/XpKGQAsAPBB6qrBuLti2EsIgIgAzFk/fTUce5+OAQA1AjCTxsf+Ab8OZgBQGwDmtiynLRj/mQj3OQBABAAv41z1E2H8LToWAKQMwOy3b7Bg/A06FgCkDOCmRbe7uQWA9AGMWgRgFADpAxizCMAYAAAAAAAAgL8BAJAagOsWAbgBgPQBPJWaLBh/k/QMAOkDMIsz7lkw/rsRFooAIIbDweY27avS65Rb1f+bw8EsCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCCAoscAigAIg2mPAYQACIPBFC7GZGNmzgMA2L0+z4qHAMycCwDYPf9+0kMAk3He08BZAIqgVVrzaOObuZ6w4bW3AoAiaI9wkqVLmTm22/K62wTA/Cq4kvCNGmvdul5TIA+A/RG0SQspXqwxrYtULurccja95lYB+OOSrd3SvH4ilPR6AC5V0rHP6y1o8za+1lYCIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",TVe="_InformationContainerPos_1m76y_2",NVe="_scrollContainer_1m76y_15",kVe="_centerAlign_1m76y_25",DVe="_traitInfoTitle_1m76y_28",LVe="_dropdownFlex_1m76y_38",VVe="_checkboxFlex_1m76y_44",PVe="_simpleFlex_1m76y_49",OVe="_traitInfoText_1m76y_55",WVe="_dropdownBase_1m76y_64",GVe="_dropdownControl_1m76y_74",ZVe="_dropdownControlSmall_1m76y_80",JVe="_flexSelect_1m76y_106",HVe="_checked_1m76y_163",zVe="_checkmark_1m76y_167",YVe="_checkboxHolder_1m76y_180",XVe="_actionButton_1m76y_189",jVe="_tabHolder_1m76y_209",KVe="_tabButton_1m76y_215",$Ve="_tabButtonSelected_1m76y_235",Ze={InformationContainerPos:TVe,scrollContainer:NVe,centerAlign:kVe,traitInfoTitle:DVe,dropdownFlex:LVe,checkboxFlex:VVe,simpleFlex:PVe,traitInfoText:OVe,dropdownBase:WVe,dropdownControl:GVe,dropdownControlSmall:ZVe,"input-box":"_input-box_1m76y_87",flexSelect:JVe,"arrow-button":"_arrow-button_1m76y_114","left-button":"_left-button_1m76y_130","right-button":"_right-button_1m76y_137","anim-button":"_anim-button_1m76y_144","custom-checkbox":"_custom-checkbox_1m76y_149","checkbox-container":"_checkbox-container_1m76y_154",checked:HVe,checkmark:zVe,checkboxHolder:YVe,actionButton:XVe,tabHolder:jVe,tabButton:KVe,tabButtonSelected:$Ve};function qVe({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=Be.useContext(lr),[i,s]=Be.useState(0),[o,a]=Be.useState(0),[l,A]=Be.useState(0);Be.useEffect(()=>{var p,f,g;e!=null&&(A((p=e.data)==null?void 0:p.cullingLayer),s(((f=e.data)==null?void 0:f.cullingDistance[0])||0),a(((g=e.data)==null?void 0:g.cullingDistance[1])||0))},[e]);const c=p=>{s(p.target.value),e!=null&&e.data&&(e.data.cullingDistance[0]=p.target.value)},u=p=>{a(p.target.value),e!=null&&e.data&&(e.data.cullingDistance[1]=p.target.value)},h=p=>{e!=null&&e.data&&(A(p.target.value),e.data.cullingLayer=p.target.value)},d=()=>{r.updateCullHiddenMeshes()};return L.jsx("div",{children:L.jsxs("div",{className:Ze.InformationContainerPos,children:[L.jsx(ka,{title:"Trait Information",width:180,right:20}),L.jsx("div",{className:Ze.scrollContainer,children:n!=null?L.jsxs(L.Fragment,{children:[L.jsx("div",{className:Ze.traitInfoTitle,children:"Trait ID"}),L.jsx("div",{className:Ze.traitInfoText,children:n==null?void 0:n.id}),L.jsx("div",{className:Ze.traitInfoTitle,children:"Trait Name"}),L.jsx("div",{className:Ze.traitInfoText,children:n==null?void 0:n.name}),L.jsx("div",{className:Ze.traitInfoTitle,children:"Description"}),L.jsx("div",{className:Ze.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),L.jsx("div",{className:Ze.traitInfoTitle,children:"Culling Options"}),L.jsx("br",{}),L.jsxs("div",{className:Ze.traitInfoText,children:["Culling Layer",L.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:h,className:Ze["input-box"],step:1}),L.jsx("br",{}),L.jsx("br",{}),L.jsx(Qh,{title:"Out Distance",value:i,onChange:c,min:0,max:1,step:.001,stepBox:.01}),L.jsx("br",{}),L.jsx(Qh,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),L.jsx("div",{className:Ze.actionButton,onClick:d,children:L.jsx("div",{children:"Update Culling "})})]})]}):L.jsx(L.Fragment,{children:L.jsx("div",{className:Ze.traitInfoTitle,children:"No Trait Selected"})})})]})})}var bz={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(Be),t=r(vH);function r(b){return b&&b.__esModule?b:{default:b}}function i(){if(typeof WeakMap!="function")return null;var b=new WeakMap;return i=function(){return b},b}function s(b){if(b&&b.__esModule)return b;if(b===null||o(b)!=="object"&&typeof b!="function")return{default:b};var F=i();if(F&&F.has(b))return F.get(b);var x={},_=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var M in b)if(Object.prototype.hasOwnProperty.call(b,M)){var Y=_?Object.getOwnPropertyDescriptor(b,M):null;Y&&(Y.get||Y.set)?Object.defineProperty(x,M,Y):x[M]=b[M]}return x.default=b,F&&F.set(b,x),x}function o(b){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(x){return typeof x}:o=function(x){return x&&typeof Symbol=="function"&&x.constructor===Symbol&&x!==Symbol.prototype?"symbol":typeof x},o(b)}function a(){return a=Object.assign||function(b){for(var F=1;F"u"?w:x.placeholder,value:""},isOpen:!1},_.dropdownRef=(0,e.createRef)(),_.mounted=!0,_.handleDocumentClick=_.handleDocumentClick.bind(g(_)),_.fireChangeEvent=_.fireChangeEvent.bind(g(_)),_}return d(F,[{key:"componentDidUpdate",value:function(_){if(this.props.value!==_.value)if(this.props.value){var M=this.parseValue(this.props.value,this.props.options);M!==this.state.selected&&this.setState({selected:M})}else this.setState({selected:{label:typeof this.props.placeholder>"u"?w:this.props.placeholder,value:""}})}},{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,!1)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,!1)}},{key:"handleMouseDown",value:function(_){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(_.type==="mousedown"&&_.button!==0)&&(_.stopPropagation(),_.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(_,M){var Y;if(typeof _=="string")for(var O=0,U=M.length;O"u"&&(Y=_.label||_);var O=_.label||_.value||_,U=Y===this.state.selected.value||Y===this.state.selected,y=(M={},c(M,"".concat(this.props.baseClassName,"-option"),!0),c(M,_.className,!!_.className),c(M,"is-selected",U),M),I=(0,t.default)(y),R=Object.keys(_.data||{}).reduce(function(N,k){return A({},N,c({},"data-".concat(k),_.data[k]))},{});return e.default.createElement("div",a({key:Y,className:I,onMouseDown:this.setValue.bind(this,Y,O),onClick:this.setValue.bind(this,Y,O),role:"option","aria-selected":U?"true":"false"},R),O)}},{key:"buildMenu",value:function(){var _=this,M=this.props,Y=M.options,O=M.baseClassName,U=Y.map(function(y){if(y.type==="group"){var I=e.default.createElement("div",{className:"".concat(O,"-title")},y.name),R=y.items.map(function(N){return _.renderOption(N)});return e.default.createElement("div",{className:"".concat(O,"-group"),key:y.name,role:"listbox",tabIndex:"-1"},I,R)}else return _.renderOption(y)});return U.length?U:e.default.createElement("div",{className:"".concat(O,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(_){this.mounted&&(this.dropdownRef.current.contains(_.target)||this.state.isOpen&&this.setState({isOpen:!1}))}},{key:"isValueSelected",value:function(){return typeof this.state.selected=="string"||this.state.selected.value!==""}},{key:"render",value:function(){var _,M,Y,O,U,y=this.props,I=y.baseClassName,R=y.controlClassName,N=y.placeholderClassName,k=y.menuClassName,V=y.arrowClassName,G=y.arrowClosed,D=y.arrowOpen,E=y.className,z=this.props.disabled?"Dropdown-disabled":"",re=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,T=(0,t.default)((_={},c(_,"".concat(I,"-root"),!0),c(_,E,!!E),c(_,"is-open",this.state.isOpen),_)),ee=(0,t.default)((M={},c(M,"".concat(I,"-control"),!0),c(M,R,!!R),c(M,z,!!z),M)),pe=(0,t.default)((Y={},c(Y,"".concat(I,"-placeholder"),!0),c(Y,N,!!N),c(Y,"is-selected",this.isValueSelected()),Y)),de=(0,t.default)((O={},c(O,"".concat(I,"-menu"),!0),c(O,k,!!k),O)),Ae=(0,t.default)((U={},c(U,"".concat(I,"-arrow"),!0),c(U,V,!!V),U)),$=e.default.createElement("div",{className:pe},re),ce=this.state.isOpen?e.default.createElement("div",{className:de,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:T},e.default.createElement("div",{className:ee,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},$,e.default.createElement("div",{className:"".concat(I,"-arrow-wrapper")},D&&G?this.state.isOpen?D:G:e.default.createElement("span",{className:Ae}))),ce)}}]),F}(e.Component);B.defaultProps={baseClassName:"Dropdown"};var C=B;n.default=C})(bz);const CA=Zl(bz);function ePe({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=X.useContext(lr),[s,o]=Be.useState([]),[a,l]=Be.useState(null),A=u=>{(t==null?void 0:t.loras)!=null&&(l(t.loras[u.value]),console.log(t.loras[u.value]))},c=async()=>{const u=i.parent;u.remove(i),await r.createLoraData(a),u.add(i)};return Be.useEffect(()=>{if((t==null?void 0:t.loras)!=null){const u=t.loras.map((h,d)=>({value:d,label:h.name,description:h.description,manifest:h.manifest}));o(u)}},[t]),L.jsx("div",{children:L.jsxs("div",{className:Ze.InformationContainerPos,children:[L.jsx(ka,{title:"Lora Creation",width:180,right:20}),L.jsxs("div",{className:Ze.scrollContainer,children:[L.jsx("div",{className:Ze.traitInfoTitle,children:"Lora Manifests"}),L.jsx(CA,{className:Ze.dropdownControl,options:s,onChange:A,placeholder:"Select an option"}),";",L.jsx("div",{className:Ze.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&L.jsx("div",{className:Ze.actionButton,onClick:c,children:L.jsx("div",{children:" Create Lora Data "})})]})]})})}function tPe({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=X.useContext(lr),[s,o]=Be.useState([]),[a,l]=Be.useState(""),[A,c]=Be.useState(null),u=d=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[d.value].description),c(t.sprites[d.value]))},h=async()=>{const d=i.parent;d.remove(i),await r.createSpriteAtlas(A),d.add(i)};return Be.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const d=t.sprites.map((p,f)=>({value:f,label:p.name,description:p.description,manifest:p.manifest}));o(d)}},[t]),L.jsx("div",{children:L.jsxs("div",{className:Ze.InformationContainerPos,children:[L.jsx(ka,{title:"Sprite Creation",width:180,right:20}),L.jsxs("div",{className:Ze.scrollContainer,children:[L.jsx("div",{className:Ze.traitInfoTitle,children:"Sprite Manifests"}),L.jsx(CA,{className:Ze.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",L.jsx("div",{className:Ze.traitInfoText,children:a||""}),A!=null&&L.jsx("div",{className:Ze.actionButton,onClick:h,children:L.jsx("div",{children:" Create Sprite Data "})})]})]})})}const RV=4096;function nPe({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=X.useContext(lr),[o,a]=Be.useState([]),[l,A]=Be.useState(""),[c,u]=Be.useState(""),[h,d]=Be.useState(""),[p,f]=Be.useState(!1),[g,m]=Be.useState(512),[v,w]=Be.useState(512),[B,C]=Be.useState(.1),[b,F]=Be.useState(.1),[x,_]=Be.useState("center"),[M,Y]=Be.useState("center"),[O,U]=Be.useState("center"),[y,I]=Be.useState("head"),[R,N]=Be.useState("chest"),[k,V]=Be.useState(!0),[G,D]=Be.useState(!1),E=[{label:"center"},{label:"left"},{label:"right"}],z=[{label:"center"},{label:"top"},{label:"bottom"}],re=[{label:"center"},{label:"front"},{label:"back"}],T=[{label:"head"},{label:"neck"},{label:"chest"},{label:"spine"},{label:"hips"},{label:"upperLeg"},{label:"lowerLeg"},{label:"foot"}],ee=ue=>{(t==null?void 0:t.thumbnails)!=null&&(A(t.thumbnails[ue.value].description),d(t.thumbnails[ue.value].manifest),u(t.thumbnails[ue.value].name))},pe=(ue,q,K,oe)=>isNaN(ue)?oe:ue>K?K:ue{const q=parseInt(ue.target.value);m(pe(q,1,RV,512))},Ae=ue=>{const q=parseInt(ue.target.value);w(pe(q,1,RV,512))},$=ue=>{const q=parseFloat(ue.target.value);C(pe(q,0,1,.1))},ce=ue=>{const q=parseFloat(ue.target.value);F(pe(q,0,1,.1))},ge=ue=>{f(ue)},Fe=async()=>{const ue=i.parent;ue.remove(i),await r.createThumbnails(t.thumbnails[0]),ue.add(i)},P=(ue=!0)=>({topFrameOffset:b,bottomFrameOffset:B,thumbnailsWidth:g,thumbnailsHeight:v,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:M+"-"+O+"-"+x,topBoneName:y==="upperLeg"||y==="lowerLeg"||y==="foot"?"left"+y[0].toUpperCase()+y.slice(1):y,topBoneMaxVertex:k,bottomBoneName:R==="upperLeg"||R==="lowerLeg"||y==="foot"?"left"+R[0].toUpperCase()+R.slice(1):R,bottomBoneMaxVertex:G,saveOnlyIDs:ue?null:n.id}]}),fe=async(ue=!1)=>{s.storeCurrentAvatar();const q=i.parent;q.remove(i),ue?await r.createThumbnailsWithObjectData(P(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(P(!1),!1),q.add(i),s.loadStoredAvatar()};return Be.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const ue=t.thumbnails.map((q,K)=>({value:K,label:q.name,description:q.description,manifest:q.manifest}));a(ue)}},[t]),L.jsx("div",{children:L.jsxs("div",{className:Ze.InformationContainerPos,children:[L.jsx(ka,{title:"Thumbnail Creation",width:180,right:20}),L.jsxs("div",{className:Ze.scrollContainer,children:[L.jsxs("div",{className:Ze.tabHolder,children:[L.jsx("div",{className:Ze.tabButton+(p?"":" "+Ze.tabButtonSelected),onClick:()=>{ge(!1)},children:L.jsxs("div",{children:[" ","Custom"," "]})}),L.jsx("div",{className:Ze.tabButton+(p?" "+Ze.tabButtonSelected:""),onClick:()=>{ge(!0)},children:L.jsxs("div",{children:[" ","Manifest"," "]})})]}),L.jsx("br",{}),p?L.jsxs(L.Fragment,{children:[L.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,children:"Thumbnail Manifests"}),L.jsx(CA,{className:Ze.dropdownControl,options:o,value:c,onChange:ee,placeholder:"Select an option"}),";",L.jsx("div",{className:Ze.traitInfoText,children:l||""}),h!=""&&L.jsx("div",{className:Ze.actionButton,onClick:Fe,children:L.jsx("div",{children:" Create Thumbnails "})})]}):L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:Ze.traitInfoText,children:[L.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",L.jsx("input",{value:g,className:Ze["input-box"],step:1,onChange:ue=>{m(ue.target.value)},onBlur:de}),L.jsx("br",{}),"Height ",L.jsx("input",{value:v,className:Ze["input-box"],step:1,onChange:ue=>{w(ue.target.value)},onBlur:Ae}),L.jsx("br",{}),"Top Spacing ",L.jsx("input",{value:B,className:Ze["input-box"],step:.1,onChange:ue=>{C(ue.target.value)},onBlur:$}),L.jsx("br",{}),"Bottom Spacing ",L.jsx("input",{value:b,className:Ze["input-box"],step:.1,onChange:ue=>{F(ue.target.value)},onBlur:ce}),L.jsx("br",{}),L.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),L.jsxs("div",{className:Ze.dropdownFlex,children:[L.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"X"}),L.jsx(CA,{className:Ze.dropdownControlSmall,options:E,onChange:ue=>{Y(ue.label)},value:M})]}),L.jsxs("div",{className:Ze.dropdownFlex,children:[L.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"Y"}),L.jsx(CA,{className:Ze.dropdownControlSmall,options:z,onChange:ue=>{U(ue.label)},value:O})]}),L.jsxs("div",{className:Ze.dropdownFlex,children:[L.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"Z"}),L.jsx(CA,{className:Ze.dropdownControlSmall,options:re,onChange:ue=>{_(ue.label)},value:x})]}),L.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),L.jsxs("div",{className:Ze.dropdownFlex,style:{justifyContent:"space-between"},children:[L.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"Top"}),L.jsx(CA,{className:Ze.dropdownControlSmall,options:T,onChange:ue=>{I(ue.label)},value:y})]}),L.jsxs("div",{className:Ze.dropdownFlex,style:{justifyContent:"space-between"},children:[L.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),L.jsx(CA,{className:Ze.dropdownControlSmall,options:T,onChange:ue=>{N(ue.label)},value:R})]}),L.jsxs("div",{style:{textAlign:"left"},children:[L.jsxs("div",{className:Ze.checkboxFlex,style:{marginTop:"20px"},children:[L.jsx("input",{type:"checkbox",checked:k,onChange:ue=>{V(ue.target.checked)}}),L.jsx("div",{className:Ze.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${k?"uses Top":"uses Low"} Vertex`})]}),L.jsxs("div",{className:Ze.checkboxFlex,style:{marginTop:"10px"},children:[L.jsx("input",{type:"checkbox",checked:G,onChange:ue=>{D(ue.target.checked)}}),L.jsx("div",{className:Ze.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${G?"uses Top":"uses Low"} Vertex`})]})]}),e==""?L.jsx("div",{className:Ze.traitInfoText+" "+Ze.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):L.jsxs(L.Fragment,{children:[L.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,style:{marginTop:"20px"},children:"Generate"}),L.jsx("div",{className:Ze.traitInfoText+" "+Ze.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),L.jsxs("div",{className:Ze.simpleFlex,style:{marginTop:"0px"},children:[L.jsx("div",{className:Ze.actionButton,style:{margin:"0px"},onClick:()=>{fe(!1)},children:L.jsx("div",{children:" Current "})}),L.jsx("div",{className:Ze.actionButton,style:{margin:"0px"},onClick:()=>{fe(!0)},children:L.jsx("div",{children:" All "})})]})]})]})]})]})})}function rPe({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=X.useState(""),s=o=>{o!=r?i(o):i("")};return L.jsxs("div",{children:[r=="Information"&&L.jsx(qVe,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&L.jsx(ePe,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&L.jsx(tPe,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&L.jsx(nPe,{selectedTrait:n,traitGroupName:t}),L.jsxs("div",{className:jI.InformationContainerPos,children:[L.jsx(ka,{title:"Tools",width:90,right:0}),L.jsx("div",{className:jI.scrollContainer,children:L.jsxs("div",{className:jI.optionsContainer,children:[L.jsx("div",{onClick:()=>{s("Information")},children:L.jsx(LA,{size:56,icon:UVe,rarity:r=="Information"?"mythic":"none"})},"Information"),L.jsx("div",{onClick:()=>{s("LoraCreation")},children:L.jsx(LA,{size:56,icon:RVe,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),L.jsx("div",{onClick:()=>{s("SpriteCreation")},children:L.jsx(LA,{size:56,icon:QVe,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),L.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:L.jsx(LA,{size:56,icon:MVe,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}function iPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=X.useContext(Ci),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:A,sceneElements:c}=X.useContext(lr),{playSound:u}=X.useContext(bs),{isMute:h}=X.useContext(Bs),{t:d}=Be.useContext(xs),p=()=>{!h&&u("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(ot.CREATE),r(!1)},[f,g]=X.useState(null),[m,v]=X.useState(null),[w,B]=X.useState(""),[C,b]=X.useState(null),[F,x]=X.useState(null),[_,M]=X.useState(""),[Y,O]=X.useState(!1),[U,y]=X.useState({background:"#ffffff"}),I=()=>{!h&&u("backNextButton"),e(ot.SAVE),r(!1)},R=()=>{t(!0),g(null),i.loadRandomTraits().then(()=>{console.log("success"),w!=""&&b(i.getCurrentTraitData(w)),t(!1)}).catch(Ae=>{t(!1),console.error("Error loading random traits:",Ae.message)})},N=Ae=>{y({background:Ae.hex})},k=Ae=>{y({background:Ae.hex}),i.setTraitColor(w,Ae.hex)},V=async Ae=>{const $=Ul(Ae.name),ce=URL.createObjectURL(Ae);await s.loadAnimation(ce,!1,0,!0,"",$),M(s.getCurrentAnimationName())},G=Ae=>{if(O(!1),w!=""){t(!0);const $=URL.createObjectURL(Ae);i.loadCustomTexture(w,$).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},D=Ae=>{if(O(!1),w!=""){t(!0);const $=URL.createObjectURL(Ae);i.loadCustomTrait(w,$).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},E=Ae=>{O(!1),t(!0),i.loadTrait(Ae.traitGroup.trait,Ae.id).then(()=>{t(!1),b(Ae)})},z=Ae=>{O(!1),i.removeTrait(Ae),b(null)},re=Ae=>{O(!1),t(!0),i.loadRandomTrait(Ae).then(()=>{t(!1),b(i.getCurrentTraitData(Ae))})},T=Ae=>{O(!1);const $=Array.from(Ae),ce=[],ge=Fe=>new Promise((P,fe)=>{var ue;if(Fe&&Fe.name.toLowerCase().endsWith(".json")){const q=new FileReader,K=`${(ue=i.manifestData)==null?void 0:ue.getAssetsDirectory()}/anata/_thumbnails/t_${Fe.name.split("_")[0]}.jpg`;console.log(K),q.onload=function(oe){try{const ye=JSON.parse(oe.target.result);ye.thumb=K,ce.push(ye),P()}catch(ye){console.error("Error parsing the JSON file:",ye),fe(ye)}},q.readAsText(Fe)}});Promise.all($.map(ge)).then(()=>{ce.length>0&&(g(ce),t(!0),i.loadTraitsFromNFTObject(ce[0]).then(()=>{t(!1)}))}).catch(Fe=>{console.error("Error processing files:",Fe)})},ee=async Ae=>{const $=Ae[0];$&&$.name.toLowerCase().endsWith(".fbx")&&V($),$&&($.name.toLowerCase().endsWith(".png")||$.name.toLowerCase().endsWith(".jpg"))&&G($),$&&$.name.toLowerCase().endsWith(".vrm")&&D($),$&&$.name.toLowerCase().endsWith(".json")&&T(Ae)},pe=Ae=>{!h&&u("optionClick"),O(!1),w!==Ae.trait?(v(i.getTraits(Ae.trait)),B(Ae.trait),b(i.getCurrentTraitData(Ae.trait)),x(i.getCurrentTraitVRM(Ae.trait)),o({targetY:Ae.cameraTarget.height,distance:Ae.cameraTarget.distance})):(v(null),B(""),b(null),o({targetY:.8,distance:3.2}))},de=()=>{O(!1);var Ae=document.createElement("input");Ae.type="file",Ae.accept=".vrm",Ae.onchange=$=>{var ce=$.target.files[0];if(ce.name.endsWith(".vrm")){const ge=URL.createObjectURL(ce);t(!0),i.loadCustomTrait(w,ge).then(()=>{t(!1)})}},Ae.click()};return L.jsxs("div",{className:Tn.container,children:[L.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:L.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),L.jsx("div",{className:"sectionTitle",children:d("pageTitles.chooseAppearance")}),L.jsx(F0,{onFilesDrop:ee}),L.jsxs("div",{className:Tn.sideMenu,children:[L.jsx(ka,{title:"Appearance",left:20}),L.jsx("div",{className:Tn.bottomLine}),L.jsx("div",{className:Tn.scrollContainer,children:L.jsx("div",{className:Tn["editor-container"],children:i.getGroupTraits().map((Ae,$)=>L.jsxs("div",{className:Tn.editorButton,onClick:()=>{pe(Ae)},children:[L.jsx(LA,{size:56,icon:Ae.fullIconSvg,rarity:w!==Ae.trait?"none":"mythic"}),L.jsx("div",{className:Tn.editorText,children:Ae.name})]},"options_"+$))})})]}),!!m&&L.jsxs("div",{className:Tn.selectorContainerPos,children:[L.jsx(ka,{title:w,width:130,left:20}),C&&L.jsx("div",{className:Tn.selectorColorPickerButton,onClick:()=>{O(!Y)},children:L.jsx("img",{className:Tn.selectorColorPickerImg,src:DCe})}),!!Y&&L.jsx("div",{draggable:!1,className:Tn.selectorColorPickerUI,children:L.jsx(eVe,{draggable:!1,width:"200px",color:U.background,onChange:N,onChangeComplete:k})}),L.jsx("div",{className:Tn.bottomLine}),L.jsx("div",{className:Tn.scrollContainerOptions,children:L.jsxs("div",{className:Tn["selector-container"],children:[L.jsx("div",{className:`${Tn.selectorButton}`,onClick:()=>{re(w)},children:L.jsx(LA,{size:56,icon:kCe,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(w)?L.jsx(L.Fragment,{}):L.jsx("div",{className:`${Tn.selectorButton}`,icon:jL,onClick:()=>{z(w)},children:L.jsx(LA,{size:56,icon:jL,rarity:C==null?"mythic":"none"})},"no-trait"),m.map(Ae=>{let $=Ae.id===(C==null?void 0:C.id);return L.jsx("div",{className:`${Tn.selectorButton}`,onClick:()=>{E(Ae)},children:L.jsx(LA,{size:56,icon:Ae.fullThumbnail,rarity:$?"mythic":"none"})},Ae.id)})]})}),L.jsx("div",{className:Tn.uploadContainer,children:L.jsx("div",{className:Tn.uploadButton,onClick:de,children:L.jsx("div",{children:"Upload "})})})]}),L.jsx(BQ,{jsonSelectionArray:f}),L.jsx(rPe,{selectedTrait:C,selectedVRM:F,traitGroupName:w}),L.jsx(Sb,{loadedAnimationName:_,randomize:R}),L.jsxs("div",{className:Tn.buttonContainer,children:[L.jsx(sn,{theme:"light",text:d("callToAction.back"),size:14,className:Tn.buttonLeft,onClick:p}),i.canDownload()&&L.jsx(sn,{theme:"light",text:d("callToAction.next"),size:14,className:Tn.buttonRight,onClick:I})]})]})}const sPe="_InformationContainerPos_rgqwy_1",oPe="_traitInfoTitle_rgqwy_13",aPe="_traitInfoText_rgqwy_21",lPe="_flexSelect_rgqwy_30",APe="_scrollContainer_rgqwy_65",cPe="_checked_rgqwy_90",uPe="_checkmark_rgqwy_94",dPe="_checkboxHolder_rgqwy_107",hPe="_buttonContainer_rgqwy_114",fPe="_buttonLeft_rgqwy_123",pPe="_buttonRight_rgqwy_127",gPe="_buttonCenter_rgqwy_131",gi={InformationContainerPos:sPe,traitInfoTitle:oPe,traitInfoText:aPe,flexSelect:lPe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:APe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:cPe,checkmark:uPe,checkboxHolder:dPe,buttonContainer:hPe,buttonLeft:fPe,buttonRight:pPe,buttonCenter:gPe},mPe="_InformationContainerPos_11mqa_2",vPe="_scrollContainer_11mqa_16",yPe="_traitInfoTitle_11mqa_28",wPe="_traitInfoText_11mqa_38",BPe="_flexSelect_11mqa_66",CPe="_checked_11mqa_124",bPe="_checkmark_11mqa_128",xPe="_checkboxHolder_11mqa_141",Gn={InformationContainerPos:mPe,scrollContainer:vPe,traitInfoTitle:yPe,traitInfoText:wPe,"input-box":"_input-box_11mqa_47",flexSelect:BPe,"arrow-button":"_arrow-button_11mqa_76","left-button":"_left-button_11mqa_91","right-button":"_right-button_11mqa_98","anim-button":"_anim-button_11mqa_105","custom-checkbox":"_custom-checkbox_11mqa_110","checkbox-container":"_checkbox-container_11mqa_115",checked:CPe,checkmark:bPe,checkboxHolder:xPe};function hR({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=X.useContext(lr),[a,l]=Be.useState(0),[A,c]=Be.useState(0),[u,h]=Be.useState(0),[d,p]=Be.useState(0),[f,g]=Be.useState(0),[m,v]=Be.useState(0),[w,B]=Be.useState(0),[C,b]=Be.useState(0),[F,x]=Be.useState(0),[_,M]=Be.useState(0);return Be.useEffect(()=>{if(n!=null){const Y=Sf(n,"Mesh"),O=Sf(n,"SkinnedMesh");l(Y.length),c(O.length);const U=Y.concat(O),{stdMats:y,stdCutoutpMats:I,stdTranspMats:R,mToonMats:N,mToonCutoutMats:k,mToonTranspMats:V}=mfe(U);h(y.length),p(R.length),g(I.length),v(N.length),B(V.length),b(k.length);const{triangles:G,bones:D}=o.getBoneTriangleCount();x(G),M(D)}},[n]),n!=null?L.jsx("div",{children:L.jsxs("div",{className:Gn.InformationContainerPos,children:[L.jsx(ka,{title:"Model Information",width:180,right:20}),L.jsxs("div",{className:Gn.scrollContainer,children:[L.jsxs("div",{className:Gn.flexSelect,children:[(t==null?void 0:t.length)>1?L.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["left-button"]}`,onClick:s}):L.jsx(L.Fragment,{}),e&&L.jsx("div",{style:{textAlign:"center"},children:L.jsx("div",{className:Gn.traitInfoTitle,style:{margin:"auto",fontSize:"14px",width:"200px",textAlign:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:e})}),(t==null?void 0:t.length)>1?L.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["right-button"]}`,onClick:i}):L.jsx(L.Fragment,{})]}),L.jsx("div",{className:Gn.traitInfoTitle,children:"Geometry info:"}),L.jsxs("div",{className:Gn.traitInfoText,children:["Meshes: ",a]}),L.jsxs("div",{className:Gn.traitInfoText,children:["SkinnedMeshes: ",A]}),L.jsxs("div",{className:Gn.traitInfoText,children:["Triangles: ",F]}),L.jsxs("div",{className:Gn.traitInfoText,children:["Bones: ",_]}),L.jsx("div",{className:Gn.traitInfoTitle,children:"Standard Material Count:"}),L.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",u]}),L.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",f]}),L.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",d]}),L.jsx("div",{className:Gn.traitInfoTitle,children:"MToon Material Count:"}),L.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",m]}),L.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",C]}),L.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",w]})]})]})}):L.jsx(L.Fragment,{})}function IPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=X.useContext(Ci),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=X.useContext(lr),[c,u]=Be.useState(null),[h,d]=Be.useState(""),[p,f]=X.useState(""),{playSound:g}=X.useContext(bs),{isMute:m}=X.useContext(Bs),[v,w]=X.useState(null),B=()=>{!m&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(ot.LANDING)},C=()=>{const U=De.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Cn(De.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Cn(De.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Cn(De.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Cn(De.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:U===0||U==2,exportMtoonAtlas:U===1||U==2,ktxCompression:De.merge_options_ktx_compression||!1,twoSidedMaterial:De.mergeOptions_two_sided_mat||!1}},b=(U,y=!1)=>{console.log(y),(async()=>{await s.loadTraitsFromNFTObject(v[U]),(De.mergeOptions_download_vrm==null?!0:De.mergeOptions_download_vrm)&&await s.downloadVRM(v[U].name,C());const N=new ep,k=A.parent;k.remove(A);const V=De.mergeOptions_download_lora==null?!0:De.mergeOptions_download_lora;if(V===!0){const D=r.loras.map(async E=>a.createLoraData(E,N));await Promise.all(D)}const G=De.mergeOptions_download_sprites==null?!0:De.mergeOptions_download_sprites;if(G===!0){const D=r.sprites.map(async E=>l.createSpriteAtlas(E,N));await Promise.all(D)}(V===!0||G===!0)&&N.saveZip(v[U].name),k.add(A),U{t(!0),b(0,!0)},{t:x}=Be.useContext(xs),_=async U=>{if(s.getCurrentCharacterModel()){const I=Ul(U.name),R=URL.createObjectURL(U);await o.loadAnimation(R,!1,0,!0,"",I),f(o.getCurrentAnimationName()),URL.revokeObjectURL(R)}else console.warn("Please load a vrm model to test animations.")},M=async U=>{const y=URL.createObjectURL(U);await s.loadOptimizerCharacter(y),URL.revokeObjectURL(y);const I=Ul(U.name);d(I),u(s.getCurrentCharacterModel())},Y=U=>{const y=Array.from(U),I=[],R=N=>new Promise((k,V)=>{var G;if(N&&N.name.toLowerCase().endsWith(".json")){const D=new FileReader,E=`${(G=s.manifestData)==null?void 0:G.getAssetsDirectory()}/anata/_thumbnails/t_${N.name.split("_")[0]}.jpg`;D.onload=function(z){try{const re=JSON.parse(z.target.result);re.thumb=E,I.push(re),k()}catch(re){console.error("Error parsing the JSON file:",re),V(re)}},D.readAsText(N)}});Promise.all(y.map(R)).then(()=>{I.length>0&&(w(I),t(!0),s.loadTraitsFromNFTObject(I[0]).then(()=>{t(!1)}))}).catch(N=>{console.error("Error processing files:",N)})},O=async U=>{const y=U[0];console.log("anim"),y&&y.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),_(y)),y&&y.name.toLowerCase().endsWith(".vrm")&&M(y),y&&y.name.toLowerCase().endsWith(".json")&&Y(U)};return L.jsxs("div",{className:gi.container,children:[L.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:L.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),L.jsx("div",{className:"sectionTitle",children:"Batch Download"}),L.jsx(F0,{onFilesDrop:O}),L.jsx(Ib,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),L.jsx(hR,{model:c}),L.jsx(BQ,{jsonSelectionArray:v}),L.jsx(Sb,{loadedAnimationName:p}),L.jsxs("div",{className:gi.buttonContainer,children:[L.jsx(sn,{theme:"light",text:x("callToAction.back"),size:14,className:gi.buttonLeft,onClick:B}),(v==null?void 0:v.length)==1&&L.jsx(sn,{theme:"light",text:"Download",size:14,className:gi.buttonRight,onClick:F}),(v==null?void 0:v.length)>1&&L.jsx(sn,{theme:"light",text:"Download All",size:14,className:gi.buttonRight,onClick:F})]})]})}function FPe(){const{isLoading:n,setViewMode:e}=X.useContext(Ci),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=X.useContext(lr),{playSound:l}=X.useContext(bs),{isMute:A}=X.useContext(Bs),[c,u]=Be.useState(null),[h,d]=Be.useState(""),[p,f]=Be.useState([]),[g,m]=Be.useState(0),[v,w]=X.useState("T-Pose"),B=()=>{!A&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(ot.LANDING)},C=()=>{const I=De.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Cn(De.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Cn(De.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Cn(De.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Cn(De.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:I===0||I==2,exportMtoonAtlas:I===1||I==2,ktxCompression:De.merge_options_ktx_compression||!1,twoSidedMaterial:De.mergeOptions_two_sided_mat||!1}},b=async()=>{for(let I=0;I{typeof I!="string"&&(I=h),await(async()=>{var z;(De.mergeOptions_download_vrm_preview==null?!0:De.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(I+"_portrait",512,1024,1.5,-.1),(De.mergeOptions_download_vrm==null?!0:De.mergeOptions_download_vrm)&&await r.downloadVRM(I+"_merged",C());const V=new ep,G=s.parent;G.remove(s),(z=r.getCurrentOptimizerCharacterModel().data)==null||z.isVRM0;const D=De.mergeOptions_download_lora==null?!0:De.mergeOptions_download_lora;if(D===!0){const re=t.loras.map(async T=>o.createLoraData(T,V));await Promise.all(re)}const E=De.mergeOptions_download_sprites==null?!0:De.mergeOptions_download_sprites;if(E===!0){const re=t.sprites.map(async T=>a.createSpriteAtlas(T,V));await Promise.all(re)}(D===!0||E===!0)&&V.saveZip(I),G.add(s)})()},{t:x}=Be.useContext(xs),_=async I=>{if(r.getCurrentOptimizerCharacterModel()){const N=Ul(I.name),k=URL.createObjectURL(I);await i.loadAnimation(k,!1,0,!0,"",N),w(i.getCurrentAnimationName()),URL.revokeObjectURL(k)}else console.warn("Please load a vrm model to test animations.")},M=()=>{if(g===0)O(p[p.length-1]),m(p.length-1);else{const I=g-1;O(p[I]),m(I)}},Y=()=>{if(g>=p.length-1)O(p[0]),m(0);else{const I=g+1;O(p[I]),m(I)}},O=async I=>{const R=URL.createObjectURL(I);await r.loadOptimizerCharacter(R),URL.revokeObjectURL(R);const N=Ul(I.name);d(N),u({...r.getCurrentCharacterModel()})},U=async I=>{O(I[0]);const R=[];for(let N=0;N{const R=I[0];R&&R.name.toLowerCase().endsWith(".fbx")&&_(R),R&&R.name.toLowerCase().endsWith(".vrm")&&U(I)};return L.jsxs("div",{className:gi.container,children:[L.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:L.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),L.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),L.jsx(F0,{onFilesDrop:y}),L.jsx(Ib,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),L.jsx(hR,{model:c,name:h,files:p,index:g,nextVrm:Y,previousVrm:M}),L.jsx(Sb,{loadedAnimationName:v}),L.jsxs("div",{className:gi.buttonContainer,children:[L.jsx(sn,{theme:"light",text:x("callToAction.back"),size:14,className:gi.buttonLeft,onClick:B}),(p==null?void 0:p.length)>1!=""&&L.jsx(sn,{theme:"light",text:"Download All",size:14,className:gi.buttonRight,onClick:b}),c!=""&&L.jsx(sn,{theme:"light",text:"Download",size:14,className:gi.buttonRight,onClick:F})]})]})}function EPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=X.useContext(Ci),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=X.useContext(lr),[c,u]=Be.useState(null),[h,d]=Be.useState(""),{playSound:p}=X.useContext(bs),{isMute:f}=X.useContext(Bs);X.useState(null);const[g,m]=X.useState(null),[v,w]=X.useState(""),B=()=>{!f&&p("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(ot.LANDING)},C=()=>{const y=De.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Cn(De.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Cn(De.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Cn(De.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Cn(De.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:y===0||y==2,exportMtoonAtlas:y===1||y==2,ktxCompression:De.merge_options_ktx_compression||!1,twoSidedMaterial:De.mergeOptions_two_sided_mat||!1}},b=y=>{const I=g[y].manifestName;(async()=>{(De.mergeOptions_download_vrm_preview==null?!0:De.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(I,512,1024,1.5,-.1),(De.mergeOptions_download_vrm==null?!0:De.mergeOptions_download_vrm)&&await i.downloadVRM(I,C());const V=new ep,G=A.parent;G.remove(A);const D=De.mergeOptions_download_lora==null?!0:De.mergeOptions_download_lora;if(D===!0){const z=r.loras.map(async re=>a.createLoraData(re,V));await Promise.all(z)}const E=De.mergeOptions_download_sprites==null?!0:De.mergeOptions_download_sprites;if(E===!0){const z=r.sprites.map(async re=>l.createSpriteAtlas(re,V));await Promise.all(z)}(D===!0||E===!0)&&V.saveZip(g[y].manifestName),G.add(A),y{y==0?(console.log(r.loras[0]),b(y)):(await i.setManifest(g[y]),t(!0),i.loadInitialTraits().then(async()=>{await(R=>new Promise(N=>setTimeout(N,R)))(1),b(y)}))},x=()=>{t(!0),F(0)},{t:_}=Be.useContext(xs),M=async y=>{if(i.getCurrentCharacterModel()){const R=Ul(y.name),N=URL.createObjectURL(y);await s.loadAnimation(N,!1,0,!0,"",R),w(s.getCurrentAnimationName()),URL.revokeObjectURL(N)}else console.warn("Please load a vrm model to test animations.")},Y=async y=>{const I=URL.createObjectURL(y);await i.loadOptimizerCharacter(I),URL.revokeObjectURL(I);const R=Ul(y.name);d(R),u(i.getCurrentCharacterModel())},O=y=>{const I=Array.from(y),R=[],N=k=>new Promise((V,G)=>{if(k&&k.name.toLowerCase().endsWith(".json")){const D=new FileReader,E=k.name.replace(/\.[^/.]+$/,"");D.onload=function(z){try{const re=JSON.parse(z.target.result),T=re.thumbnail;re.manifestName=E,R.push(re),V()}catch(re){console.error("Error parsing the JSON file:",re),G(re)}},D.readAsText(k)}});Promise.all(I.map(N)).then(()=>{R.length>0&&(m(R),i.setManifest(R[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(k=>{console.error("Error processing files:",k)})},U=async y=>{const I=y[0];I&&I.name.toLowerCase().endsWith(".fbx")&&M(I),I&&I.name.toLowerCase().endsWith(".vrm")&&Y(I),I&&I.name.toLowerCase().endsWith(".json")&&O(y)};return L.jsxs("div",{className:gi.container,children:[L.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:L.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),L.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),L.jsx(F0,{onFilesDrop:U}),L.jsx(Ib,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),L.jsx(hR,{model:c}),L.jsx(BQ,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&L.jsx(Sb,{loadedAnimationName:v}),L.jsxs("div",{className:gi.buttonContainer,children:[L.jsx(sn,{theme:"light",text:_("callToAction.back"),size:14,className:gi.buttonLeft,onClick:B}),(g==null?void 0:g.length)==1&&L.jsx(sn,{theme:"light",text:"Download",size:14,className:gi.buttonRight,onClick:x}),(g==null?void 0:g.length)>1&&L.jsx(sn,{theme:"light",text:"Download All",size:14,className:gi.buttonRight,onClick:x})]})]})}function _Pe(){const{t:n}=Be.useContext(xs),{setViewMode:e,setIsLoading:t,isLoading:r}=X.useContext(Ci),{playSound:i}=X.useContext(bs),{isMute:s}=X.useContext(Bs),{manifest:o,characterManager:a}=X.useContext(lr);Be.useState([]);const[l,A]=Be.useState([]);Be.useEffect(()=>{c()},[]);const c=async()=>{const f=await wQ();tBe(f,"the-anata-nft").then(g=>{A(g.nfts),console.log(g.nfts)})},u=()=>{e(ot.LANDING),!s&&i("backNextButton")},h=async f=>{t(!0),a.loadManifest(o[f].manifest).then(()=>{e(ot.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},d=()=>{console.log("ttt"),a.loadManifest(o[0].manifest).then(()=>{a.loadAppendManifest(o[1].manifest,!0).then(()=>{console.log(a.manifestData)})})},p=()=>{!s&&i("classMouseOver")};return L.jsxs("div",{className:`${at.container} horizontalScroll`,children:[L.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),L.jsx("div",{className:at.vrmOptimizerButton}),L.jsx("div",{className:at.topLine}),L.jsx("div",{className:at.classContainer,children:l.map((f,g)=>L.jsxs("div",{className:at.class,onClick:()=>h(g),onMouseOver:()=>p(),children:[L.jsx("div",{className:at.classFrame,style:{backgroundImage:`url(${f.image_url})`},children:L.jsx("div",{className:at.frameContainer,children:L.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:at.frame})})}),L.jsx("div",{className:at.name,children:f.name})]},g))}),L.jsx("div",{className:at.bottomLine}),L.jsxs("div",{className:at.buttonContainer,children:[L.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:at.buttonLeft,onClick:u}),L.jsx(sn,{theme:"light",text:"test",size:14,className:at.buttonLeft,onClick:d})]})]})}const SPe="https://beta.anata.dev/character-assets/manifest.json";let KI;const $I=new j,Dy=new j;let qI,eF;const UPe=1.4,QPe=new j(0,1.25,0),xz=new j(-.9786403788721187,1.4036900759197288,.9892635490125085),RPe=xz.length(),MPe=.35,MV=6,TV=new j(0,.8,0),Iz=new j(-2.2367993753934425,1.1512971720174363,2.2612065299409223),TPe=Iz.length(),NPe=.5,Nd=new j,Ji=new Dt,kPe=new Dt,DPe=new j(1,0,0),LPe=new j(0,1,0);async function VPe(n){try{const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch manifest. Status: ${e.status}`);return await e.json()}catch(e){return console.error(`Error fetching manifest: ${e.message}`),[]}}async function PPe(){const n=await VPe(SPe),e=new Pme;return{initialManifest:n,effectManager:e}}const OPe=()=>{let n,e;const r=PPe().then(i=>{n="success",e=i},i=>{n="error",e=i});return{read(){if(n==="error")throw e;if(n==="success")return e;throw r}}},WPe=OPe();function GPe(){const{initialManifest:n,effectManager:e}=WPe.read(),[t,r]=Be.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=Be.useContext(lr),{viewMode:u}=Be.useContext(Ci);e.camera=i,e.scene=o;const h=()=>{if(e.camera){if([ot.BIO,ot.CHAT].includes(u)){u===ot.CHAT?(KI=UPe,$I.copy(QPe),Dy.copy(xz),qI=RPe,eF=MPe):(KI=MV,$I.copy(TV),Dy.copy(Iz),qI=TPe,eF=NPe),Ji.set(0,0,qI,1).applyMatrix4(e.camera.projectionMatrix),Ji.x/=Ji.w,Ji.y/=Ji.w,Ji.z/=Ji.w;const b=kPe.set(eF*Ji.w,Ji.y*Ji.w,Ji.z*Ji.w,Ji.w).applyMatrix4(e.camera.projectionMatrixInverse).x,F=Nd.set(Dy.x,0,Dy.z).angleTo(DPe);Nd.set(b,0,0).applyAxisAngle(LPe,F),Nd.add($I),a({targetX:Nd.x,targetY:Nd.y,targetZ:Nd.z,distance:KI})}else a({targetX:0,targetY:TV.y,targetZ:0,distance:MV});s&&([ot.APPEARANCE,ot.SAVE,ot.OPTIMIZER,ot.BATCHDOWNLOAD,ot.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1)}},[d,p]=Be.useState(!1),[f,g]=Be.useState(""),[m,v]=Be.useState([]),w=(b,F)=>{g(b),p(!0),v([F])},B={[ot.LANDING]:L.jsx(_Be,{}),[ot.APPEARANCE]:L.jsx(iPe,{confirmDialog:w}),[ot.OPTIMIZER]:L.jsx(FPe,{}),[ot.CREATE]:L.jsx(xBe,{}),[ot.WALLET]:L.jsx(_Pe,{}),[ot.CLAIM]:L.jsx(IBe,{}),[ot.BATCHMANIFEST]:L.jsx(EPe,{}),[ot.BATCHDOWNLOAD]:L.jsx(IPe,{}),[ot.LOAD]:L.jsx(kwe,{}),[ot.MINT]:L.jsx(sBe,{}),[ot.SAVE]:L.jsx(Hye,{}),[ot.CHAT]:L.jsx(bye,{})};let C=0;return Be.useEffect(()=>{const b=F=>{const x=new Date().getTime(),_=x-C;_<300&&_>10&&F.target.id=="editor-scene"&&r(!t),C=x};return window.addEventListener("touchend",b),window.addEventListener("click",b),()=>{window.removeEventListener("touchend",b),window.removeEventListener("click",b)}},[t]),Be.useEffect(()=>{if(A!=null)return h(),[ot.BIO,ot.MINT,ot.CHAT].includes(u)?A.enabled=!1:A.enabled=!0,[ot.LANDING,ot.CREATE,ot.CLAIM,ot.LOAD,ot.CLAIM,ot.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",h),()=>{window.removeEventListener("resize",h)}},[u,A]),Be.useEffect(()=>{l(n)},[n]),Be.useContext(xs),L.jsxs(Be.Fragment,{children:[L.jsx("div",{className:"generalTitle",children:"Character Studio"}),L.jsx(i0e,{confirmDialogText:f,confirmDialogCallback:m,confirmDialogWindow:d,setConfirmDialogWindow:p}),L.jsx(u0e,{}),B[u]]})}const ZPe=n=>{const e=new AS(n);return e.pollingInterval=12e3,e};uF.createRoot(document.getElementById("root")).render(L.jsx(X.StrictMode,{children:L.jsx(p8,{getLibrary:ZPe,children:L.jsx(IK,{children:L.jsx(vme,{children:L.jsx(bK,{children:L.jsx(jpe,{children:L.jsx(Ype,{children:L.jsx(sge,{children:L.jsx(Be.Suspense,{children:L.jsx(GPe,{})})})})})})})})})}));export{pa as c,Zl as g}; + `),X.createElement("div",{style:c.white,className:"saturation-white"},X.createElement("div",{style:c.black,className:"saturation-black"}),X.createElement("div",{style:c.pointer},this.props.pointer?X.createElement(this.props.pointer,this.props):X.createElement("div",{style:c.circle}))))}}]),e}(Be.PureComponent||Be.Component);function FDe(n,e){for(var t=-1,r=n==null?0:n.length;++t=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return tt(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(zDe,arguments)},brighten:function(){return this._applyModification(YDe,arguments)},darken:function(){return this._applyModification(XDe,arguments)},desaturate:function(){return this._applyModification(ZDe,arguments)},saturate:function(){return this._applyModification(JDe,arguments)},greyscale:function(){return this._applyModification(HDe,arguments)},spin:function(){return this._applyModification(jDe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(qDe,arguments)},complement:function(){return this._applyCombination(KDe,arguments)},monochromatic:function(){return this._applyCombination(eLe,arguments)},splitcomplement:function(){return this._applyCombination($De,arguments)},triad:function(){return this._applyCombination(oV,[3])},tetrad:function(){return this._applyCombination(oV,[4])}};tt.fromRatio=function(n,e){if(vC(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=_g(n[r]));n=t}return tt(n,e)};function VDe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=sLe(n)),vC(n)=="object"&&(il(n.r)&&il(n.g)&&il(n.b)?(e=PDe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):il(n.h)&&il(n.s)&&il(n.v)?(r=_g(n.s),i=_g(n.v),e=WDe(n.h,r,i),o=!0,a="hsv"):il(n.h)&&il(n.s)&&il(n.l)&&(r=_g(n.s),s=_g(n.l),e=ODe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=lz(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function PDe(n,e,t){return{r:Bn(n,255)*255,g:Bn(e,255)*255,b:Bn(t,255)*255}}function nV(n,e,t){n=Bn(n,255),e=Bn(e,255),t=Bn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(u-=1),u<1/6?A+(c-A)*6*u:u<1/2?c:u<2/3?A+(c-A)*(2/3-u)*6:A}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function rV(n,e,t){n=Bn(n,255),e=Bn(e,255),t=Bn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(tt(r));return s}function eLe(n,e){e=e||6;for(var t=tt(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(tt({h:r,s:i,v:s})),s=(s+a)%1;return o}tt.mix=function(n,e,t){t=t===0?0:t||50;var r=tt(n).toRgb(),i=tt(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return tt(o)};tt.readability=function(n,e){var t=tt(n),r=tt(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};tt.isReadable=function(n,e,t){var r=tt.readability(n,e),i,s;switch(s=!1,i=oLe(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};tt.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var A=0;Ai&&(i=s,r=tt(e[A]));return tt.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,tt.mostReadable(n,["#fff","#000"],t))};var G_=tt.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",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:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",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:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",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:"f00",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:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},tLe=tt.hexNames=nLe(G_);function nLe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function lz(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function Bn(n,e){rLe(n)&&(n="100%");var t=iLe(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function Zb(n){return Math.min(1,Math.max(0,n))}function Yi(n){return parseInt(n,16)}function rLe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function iLe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function Qo(n){return n.length==1?"0"+n:""+n}function _g(n){return n<=1&&(n=n*100+"%"),n}function Az(n){return Math.round(parseFloat(n)*255).toString(16)}function aV(n){return Yi(n)/255}var bo=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function il(n){return!!bo.CSS_UNIT.exec(n)}function sLe(n){n=n.replace(DDe,"").replace(LDe,"").toLowerCase();var e=!1;if(G_[n])n=G_[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=bo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=bo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=bo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=bo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=bo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=bo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=bo.hex8.exec(n))?{r:Yi(t[1]),g:Yi(t[2]),b:Yi(t[3]),a:aV(t[4]),format:e?"name":"hex8"}:(t=bo.hex6.exec(n))?{r:Yi(t[1]),g:Yi(t[2]),b:Yi(t[3]),format:e?"name":"hex"}:(t=bo.hex4.exec(n))?{r:Yi(t[1]+""+t[1]),g:Yi(t[2]+""+t[2]),b:Yi(t[3]+""+t[3]),a:aV(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=bo.hex3.exec(n))?{r:Yi(t[1]+""+t[1]),g:Yi(t[2]+""+t[2]),b:Yi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function oLe(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var lV=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return kDe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},Sg=function(e,t){var r=e.hex?tt(e.hex):tt(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},Cc=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&tt(e).isValid()},XQ=function(e){if(!e)return"#fff";var t=Sg(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},YI=function(e,t){var r=e.replace("°","");return tt(t+" ("+r+")")._ok},ig=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){fLe(i,r);function i(){var s,o,a,l;hLe(this,i);for(var A=arguments.length,c=Array(A),u=0;ua))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,h=!0,d=t&FLe?new yC:void 0;for(s.set(n,e),s.set(e,n);++u=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Ny=24,Y3e=yz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Ny:r,s=n.height,o=s===void 0?Ny:s,a=n.style,l=a===void 0?{}:a,A=z3e(n,["fill","width","height","style"]);return EV.default.createElement("svg",FV({viewBox:"0 0 "+Ny+" "+Ny,style:FV({fill:t,width:i,height:o},l)},A),EV.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},X3e=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(IV(i.s)?r.props.hsl.s:i.s),l:Number(IV(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return X3e(e,[{key:"render",value:function(){var r=this,i=ft({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=X.createElement("div",{style:i.fields,className:"flexbox-fix"},X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=X.createElement("div",{style:i.fields,className:"flexbox-fix"},X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),X.createElement("div",{style:i.alpha},X.createElement(kt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=X.createElement("div",{style:i.fields,className:"flexbox-fix"},X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),X.createElement("div",{style:i.field},X.createElement(kt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),X.createElement("div",{style:i.alpha},X.createElement(kt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),X.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,X.createElement("div",{style:i.toggle},X.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},X.createElement(Y3e,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(X.Component);wz.defaultProps={view:"hex"};var _V=function(){var e=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return X.createElement("div",{style:e.picker})},q3e=function(){var e=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return X.createElement("div",{style:e.picker})},tR=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,A=e.renderers,c=e.styles,u=c===void 0?{}:c,h=e.className,d=h===void 0?"":h,p=e.defaultView,f=ft(Oi({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:i});return X.createElement("div",{style:f.picker,className:"chrome-picker "+d},X.createElement("div",{style:f.saturation},X.createElement(Gb,{style:f.Saturation,hsl:o,hsv:a,pointer:q3e,onChange:r})),X.createElement("div",{style:f.body},X.createElement("div",{style:f.controls,className:"flexbox-fix"},X.createElement("div",{style:f.color},X.createElement("div",{style:f.swatch},X.createElement("div",{style:f.active}),X.createElement(Ap,{renderers:A}))),X.createElement("div",{style:f.toggles},X.createElement("div",{style:f.hue},X.createElement(cp,{style:f.Hue,hsl:o,pointer:_V,onChange:r})),X.createElement("div",{style:f.alpha},X.createElement(OQ,{style:f.Alpha,rgb:s,hsl:o,pointer:_V,renderers:A,onChange:r})))),X.createElement(wz,{rgb:s,hsl:o,hex:l,view:p,onChange:r,disableAlpha:i})))};tR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),disableAlpha:Oe.bool,styles:Oe.object,defaultView:Oe.oneOf(["hex","rgb","hsl"])};tR.defaultProps={width:225,disableAlpha:!1,styles:{}};const eVe=Wi(tR);var tVe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=ft({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:XQ(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return X.createElement(zu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},X.createElement("div",{style:a.dot}))},nVe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=ft({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,A){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},A):i({hex:l.hex,source:"hex"},A)};return X.createElement("div",{style:s.fields,className:"flexbox-fix"},X.createElement("div",{style:s.active}),X.createElement(kt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),X.createElement(kt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),X.createElement(kt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),X.createElement(kt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},nR=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,A=e.className,c=A===void 0?"":A,u=ft(Oi({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),h=function(p,f){p.hex?Cc(p.hex)&&t({hex:p.hex,source:"hex"},f):t(p,f)};return X.createElement(k0,{style:u.Compact,styles:l},X.createElement("div",{style:u.compact,className:"compact-picker "+c},X.createElement("div",null,Yu(i,function(d){return X.createElement(tVe,{key:d,color:d,active:d.toLowerCase()===s,onClick:h,onSwatchHover:r})}),X.createElement("div",{style:u.clear})),X.createElement(nVe,{hex:s,rgb:o,onChange:h})))};nR.propTypes={colors:Oe.arrayOf(Oe.string),styles:Oe.object};nR.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};Wi(nR);var rVe=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=ft({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return X.createElement("div",{style:a.swatch},X.createElement(zu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const iVe=PQ(rVe);var rR=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,A=e.className,c=A===void 0?"":A,u=ft(Oi({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),h=function(p,f){return i({hex:p,source:"hex"},f)};return X.createElement("div",{style:u.card,className:"github-picker "+c},X.createElement("div",{style:u.triangleShadow}),X.createElement("div",{style:u.triangle}),Yu(r,function(d){return X.createElement(iVe,{color:d,key:d,onClick:h,onSwatchHover:s})}))};rR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),colors:Oe.arrayOf(Oe.string),triangle:Oe.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Oe.object};rR.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Wi(rR);var sVe=function(e){var t=e.direction,r=ft({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return X.createElement("div",{style:r.picker})},oVe=Object.assign||function(n){for(var e=1;e.5});return X.createElement("div",{style:r.picker})},cVe=function(){var e=ft({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return X.createElement("div",{style:e.pointer},X.createElement("div",{style:e.left},X.createElement("div",{style:e.leftInside})),X.createElement("div",{style:e.right},X.createElement("div",{style:e.rightInside})))},SV=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=ft({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return X.createElement("div",{style:o.button,onClick:t},r||i)},uVe=function(e){var t=e.rgb,r=e.currentColor,i=ft({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return X.createElement("div",null,X.createElement("div",{style:i.label},"new"),X.createElement("div",{style:i.swatches},X.createElement("div",{style:i.new}),X.createElement("div",{style:i.current})),X.createElement("div",{style:i.label},"current"))},dVe=function(){function n(e,t){for(var r=0;r100&&(c.a=100),c.a/=100,t({h:i.h,s:i.s,l:i.l,a:c.a,source:"rgb"},u))};return X.createElement("div",{style:a.fields,className:"flexbox-fix"},X.createElement("div",{style:a.double},X.createElement(kt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),X.createElement("div",{style:a.single},X.createElement(kt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),X.createElement("div",{style:a.single},X.createElement(kt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),X.createElement("div",{style:a.single},X.createElement(kt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),X.createElement("div",{style:a.alpha},X.createElement(kt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},mVe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var ky=24,xVe=Cz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?ky:r,s=n.height,o=s===void 0?ky:s,a=n.style,l=a===void 0?{}:a,A=bVe(n,["fill","width","height","style"]);return QV.default.createElement("svg",UV({viewBox:"0 0 "+ky+" "+ky,style:UV({fill:t,width:i,height:o},l)},A),QV.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},IVe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,A=ft({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:XQ(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return X.createElement(zu,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},X.createElement("div",{style:A.check},X.createElement(xVe,null)))},FVe=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=ft({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return X.createElement("div",{style:o.group},Yu(i,function(a,l){return X.createElement(IVe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},lR=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,h=ft(Oi({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},A)),d=function(f,g){return i({hex:f,source:"hex"},g)};return X.createElement("div",{style:h.picker,className:"swatches-picker "+u},X.createElement(k0,null,X.createElement("div",{style:h.overflow},X.createElement("div",{style:h.body},Yu(o,function(p){return X.createElement(FVe,{key:p.toString(),group:p,active:a,onClick:d,onSwatchHover:s})}),X.createElement("div",{style:h.clear})))))};lR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),height:Oe.oneOfType([Oe.string,Oe.number]),colors:Oe.arrayOf(Oe.arrayOf(Oe.string)),styles:Oe.object};lR.defaultProps={width:320,height:240,colors:[[Wd[900],Wd[700],Wd[500],Wd[300],Wd[100]],[Gd[900],Gd[700],Gd[500],Gd[300],Gd[100]],[Zd[900],Zd[700],Zd[500],Zd[300],Zd[100]],[Jd[900],Jd[700],Jd[500],Jd[300],Jd[100]],[Hd[900],Hd[700],Hd[500],Hd[300],Hd[100]],[zd[900],zd[700],zd[500],zd[300],zd[100]],[Yd[900],Yd[700],Yd[500],Yd[300],Yd[100]],[Xd[900],Xd[700],Xd[500],Xd[300],Xd[100]],[jd[900],jd[700],jd[500],jd[300],jd[100]],["#194D33",Ug[700],Ug[500],Ug[300],Ug[100]],[Kd[900],Kd[700],Kd[500],Kd[300],Kd[100]],[$d[900],$d[700],$d[500],$d[300],$d[100]],[qd[900],qd[700],qd[500],qd[300],qd[100]],[eh[900],eh[700],eh[500],eh[300],eh[100]],[th[900],th[700],th[500],th[300],th[100]],[nh[900],nh[700],nh[500],nh[300],nh[100]],[rh[900],rh[700],rh[500],rh[300],rh[100]],[ih[900],ih[700],ih[500],ih[300],ih[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Wi(lR);var AR=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,h=ft(Oi({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},A),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),d=function(f,g){Cc(f)&&t({hex:f,source:"hex"},g)};return X.createElement("div",{style:h.card,className:"twitter-picker "+u},X.createElement("div",{style:h.triangleShadow}),X.createElement("div",{style:h.triangle}),X.createElement("div",{style:h.body},Yu(s,function(p,f){return X.createElement(zu,{key:f,color:p,hex:p,style:h.swatch,onClick:d,onHover:r,focusStyle:{boxShadow:"0 0 4px "+p}})}),X.createElement("div",{style:h.hash},"#"),X.createElement(kt,{label:null,style:{input:h.input},value:i.replace("#",""),onChange:d}),X.createElement("div",{style:h.clear})))};AR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),triangle:Oe.oneOf(["hide","top-left","top-right"]),colors:Oe.arrayOf(Oe.string),styles:Oe.object};AR.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Wi(AR);var cR=function(e){var t=ft({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return X.createElement("div",{style:t.picker})};cR.propTypes={hsl:Oe.shape({h:Oe.number,s:Oe.number,l:Oe.number,a:Oe.number})};cR.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var uR=function(e){var t=ft({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return X.createElement("div",{style:t.picker})};uR.propTypes={hsl:Oe.shape({h:Oe.number,s:Oe.number,l:Oe.number,a:Oe.number})};uR.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var EVe=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(d,p){if(d.hex)Cc(d.hex)&&t({hex:d.hex,source:"hex"},p);else if(d.rgb){var f=d.rgb.split(",");YI(d.rgb,"rgb")&&t({r:f[0],g:f[1],b:f[2],a:1,source:"rgb"},p)}else if(d.hsv){var g=d.hsv.split(",");YI(d.hsv,"hsv")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),g[1]==1?g[1]=.01:g[2]==1&&(g[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsv"},p))}else if(d.hsl){var m=d.hsl.split(",");YI(d.hsl,"hsl")&&(m[2]=m[2].replace("%",""),m[1]=m[1].replace("%",""),m[0]=m[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(m[0]),s:Number(m[1]),v:Number(m[2]),source:"hsl"},p))}},l=ft({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),A=r.r+", "+r.g+", "+r.b,c=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return X.createElement("div",{style:l.wrap,className:"flexbox-fix"},X.createElement("div",{style:l.fields},X.createElement("div",{style:l.double},X.createElement(kt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),X.createElement("div",{style:l.column},X.createElement("div",{style:l.single},X.createElement(kt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),X.createElement("div",{style:l.single},X.createElement(kt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),X.createElement("div",{style:l.single},X.createElement(kt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},dR=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,A=e.styles,c=A===void 0?{}:A,u=e.className,h=u===void 0?"":u,d=ft(Oi({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},c));return X.createElement("div",{style:d.picker,className:"google-picker "+h},X.createElement("div",{style:d.head},l),X.createElement("div",{style:d.swatch}),X.createElement("div",{style:d.saturation},X.createElement(Gb,{hsl:s,hsv:o,pointer:cR,onChange:r})),X.createElement("div",{style:d.body},X.createElement("div",{style:d.controls,className:"flexbox-fix"},X.createElement("div",{style:d.hue},X.createElement(cp,{style:d.Hue,hsl:s,radius:"4px",pointer:uR,onChange:r}))),X.createElement(EVe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};dR.propTypes={width:Oe.oneOfType([Oe.string,Oe.number]),styles:Oe.object,header:Oe.string};dR.defaultProps={width:652,styles:{},header:"Color picker"};Wi(dR);const _Ve="_InformationContainerPos_1yd4c_2",SVe="_scrollContainer_1yd4c_15",jI={InformationContainerPos:_Ve,scrollContainer:SVe,"options-container":"_options-container_1yd4c_24"},UVe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmU1ZTg4ZDczLWQ3YmItNjg0NS1iNDkxLWYxZTU0YmRhZDE1MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFhMDRkN2Y4LWVjNjQtZTg0ZC1iMjQzLWQ4ZjRhMjVlN2YzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozNzgwNzA3Yy0zNDg5LTAzNDctYmEwNy1kOTFhY2ZkYmUwODYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MjQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ZTVlODhkNzMtZDdiYi02ODQ1LWI0OTEtZjFlNTRiZGFkMTUyIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjQ3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+okruHwAAA6NJREFUeNrt279LG2EYwHG1CCqKPwKOJQU3cXYqXZ0KofgPuBWcUmsgoouCFArS0UXaWUpTFxHcUnE4cO6fULoUbWnTFk2ftz4p19BoLve+d33vvsN3KWre97lPUvPm7Gs2m32U3xgCABgCAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABABnlV5VR6QH0mOpIq229VSacPj4E/oY7Y9b0TWZtY0AwO7Qp6WH0q70XrqSmh1qSLMO1zKrj9Hp8a90jbu65mkAxBv4svRR+nHD0MOZr5t3uJ75iGsxa18GQPRBl6Sgy0GHu5QWHa5rUR8j6rrMXkoAuH3Ag9KLHgYcbsfh+nZirs3sbRAA/x5uQXrb4zMs3AdpyMH6hvRnx1nbpe6xAIC/hzssHcUcbrjnUr/F9fXrz7S1PrPXYQBcD3dKemdxuKZP0pzFNc7pz7S5RrPnqVwDkAGMSTXLg211auNtmL4NPXW0RrP3sVwC0EOVwNFgW9XjPMv01anueI2By8Or/xKAbHhSeuN4sK3OpPvSQIT1Dej3nCW0RjOLyVwA0Jf9IKHBhk8IX0vFLtZX1K9tJLzGII3/DtJ4q1dLeLDhvkjH0jNpSXqkLem/HevXpLW+WtJvEZP+IKee4nB9qZ7kB0pJPvOPuLiRzgkKmQCgz/xDLmrkDpN4JUjikOeEi9lzJ64Pi1wDOOAixu7AZwBVLmDsqr7/DrAhfeVCRs7MbCMr7wLWuKCRW8vaOYC5cfIbF/bWzIwqWT0J3LRww0eWM7PZzPpnAeUUztl9yMyknJdPA7el71z0P5lZbOftfgDzSvCTi/97BuW83hG0lfNfDM3et/J+T+BKjgGscFfwNYL1DodF+yl/Pm/j/oP9Doc869wVfPNh0Z50Vzr3GMC57mEvjUMeH/8yqKJvh15Ko9I96cJjABe6h1HdUyPJQx4fAdyRFtruz/MdQDG0nwWzRwB0DyJTAPjjUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAhgDMSJ89BmDWPgOA3gGMS0+kVU8zax8HAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIACQlX4BjeT0VuSSEBUAAAAASUVORK5CYII=",QVe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4MDc2OWJhLTIwNzQtMjU0Zi1iNjM5LWJiZjEyMTFlMjljNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmMxMzRkOGNhLTVlMWUtYzM0Yy05ZmM0LTNlZTgyNGQ1YTVhYyIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NzUzMzYxZC05NmIzLTgwNDctYTA0ZC0wODcxYmNiNzY4MDAiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6Mjk6NTctMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDgwNzY5YmEtMjA3NC0yNTRmLWI2MzktYmJmMTIxMWUyOWM1IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjE4LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Yrc/VQAAAzxJREFUeNrt3b9LFnEcwHE3IW1oiUCF/gCXcgibmhyaDEqnWhoCaRXqUQhByKVVXAqsMbQyGgIHA6GhSdpNc7E/IBehp8/h94ErRLzoOc671/Ce7/O572t4/PHc9bTb7R41NzcBADcBAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAinVrudUfPY92o+0ut5uu1Q9AtQCsRe2SWgMAAAAAAAAAAEo/7KHoWnQl12i0USKAjXTN/AzZTEMAdB/AQvQjfRrvtBMdlAjgIF0zP0M20wIA3QewVOJBF20JAAAAAACAbgJYrDCARQD+30EPRjei66nsU/fVaLXCAFbTjKO5ubMdBgEoDuBR9Cv6+VeHFQZweMy82Q6PACgOYLbCB120WQCKA5ipEYAZAAAAoCCAxzUC8BiAk3+3fzeajCZSN6OXNQLwMu3U2W8y7TwEwNENaTe0CQCWW7cbDOA2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcWQB3GgzgDgDLrbHoa/Ql1+foe40O+nvaKb9jtvMYAMutc9Hl9C3hTgPR0xoBeJp2yu+Y7XzO8wE8IAIAAAAAAABPCQPgTwD3ok/Req6P0V6FD3ovzZifOdvhHgD/9hKI7JPzpVwXoxcVBvAizZifeaDKL5fwsGgPiwYAAAAAAACAswJgKnqf3tzV6W20X+JB76dr5mfIZpoCoPsAeqPz6aeETheiDyUC+JCumZ8hm6kXAO8NBAAAAAAAoFQAfdG7EgFk1+oDoLuHOhI9jB6covvRVokAttI1TzNbtsMIAMUBPKnRXwOfAOD/AQAAAAAAACj04si6APDiyBMOejh6Fs3naqX/pqkLgPW0U37HbOdhAI7eoNXUbwZNAuC7gQAAAAAADQYw3mAA440BkD7svYlWotepV9FmgwFspnvQuR8r6R5N1hHAfIMPumjzdQQw52BP3RwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA2QQwHe1E36JtHdu3dI+mfTVMAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAAV7DcOsgfgT8DmTAAAAABJRU5ErkJggg==",RVe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjJkMTY5MDdlLWQyY2EtZDA0Mi05MWRjLTliZTMyYzYyYjlmOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNmQ1YTFjLWM5NjAtMDE0OS04OWQwLTQ3NDQ0MzAzZDI1ZCIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2N2JiZmQ0OC0yMGMzLTI0NDktODQyNS1kNWJmOTBlNzMwYjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MTQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MmQxNjkwN2UtZDJjYS1kMDQyLTkxZGMtOWJlMzJjNjJiOWY5IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMzOjExLTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Q6I0lAAAAs1JREFUeNrt3TtrFFEYgOFE2HjFXgv9AyIYsbATMaAWQtqAYBPQ0ibCgoSA/yGbwsJ/o6Ag3gMWEkurTeGlcfwGzoIs7LKT3TXOOU/xFlnYkNnvIRNOZs4sVFW1oHLzIQDgQwBAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAiVt91l2OXkRVi3oTXQVg+uHfjX60bPiDfkUPADj48C+2ePh/dx2AgwF4ncHw695HHQCaA6gy6hYAZQPYAqBsANsAlA1gBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAogDE14tRt359RL3ocbQSLQGQH4Aj0bsJ31tfF3EDgPwAvGzw/t/ROgDlAhhcY7gMQLkABpeXnQSgXAB1mwCUDeAjAGUD6ANQNoB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCQ6wFQNoAnQ8fWiXYBKAfAnaFjOxXtATAewIdMhv85Ojp0bGfqq3sBGA/gcrodKrt9guO11Sm+XxkA0gd1P90Y2dbhb4w4rm8ATI5gpYVbx+8On/eHHoJRAdAMwVJ9j3zaNKE3ZmOFw6z+uTaj29HxEcdxLvoKQIHVd/XW9/XN4LcLAC0c/vno04xOLwC0bPj3oi8z/PsCgIYDWExLr/+iTlrkORutTbHYA8AMAXTTuvu8e5XO8XtTLPIAMAcATzNbVgagIYAdAAAAAAAAAAAAAADKA7CdGYA+AM0AbGUG4C0AzQDczAzABgDNAHTSHrs5DL9ebTwGQHME1zIY/vfoQjG7hc8BwXr0s8XDXyvqeQFzQnClhZeXPY8uFffEkDkiOB09ShDq/9rt/4f10/n+YXSiyGcGqfCnhgkAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBp+gMB5Yr6zMTlPAAAAABJRU5ErkJggg==",MVe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmFmYmE3YzFhLWI0MTMtMGQ0MS05YmRkLTE2ZGY2MTllOTgyMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjkxMWMyNDQ0LTUzYzgtYjU0OC1iZjBmLTczZWE4ZmU5NWYzZSIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjZhMzQ1Ni02ODczLWQ5NDYtOTRkMy1mZTYwZjQ5NzliNjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6NDQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YWZiYTdjMWEtYjQxMy0wZDQxLTliZGQtMTZkZjYxOWU5ODIxIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjI2LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+F7DBkwAABCVJREFUeNrt3TtMFEEYwHHuAiYkNjRg74mJpSYUkCiGAhKxsLKXggQ6yi2wQUh8RMCGRJulEgotjgLwVaCVDYYeHzQaKU5FCRo4vwnfRdQgHvu4mZ1/8W/Iec7c/u7gdmd368rlch35Gy8CAHgRAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAJLpUhjkpW5pQfoolaRPjlXSsZs59Jg5AeDgDZ+T2qRFaUcqZyQzl0c6txwA9n/X9+m7ppzR1nWOeQD8DaBD+pzhjV/JzLEDAL9v/JPSmgcbv5KZaysAfv3ev+PRxq80acPfAzYAKEgrHgIwcy4AIAwGpS8eAjBzHgBAGEx7uPErhQAIg6LHAIoACIM5jwHMAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIuA3pjbYBgOwDMOvyNqUZ6azUuGcMjfqz+/qYHQBkC8BXaUI6/p/rE8b13wAgAwB+SOel+irGVC91St8B4DYAs8K4J8LYehJepQyAhAEMVfPO3+eTYAgAbgJYinGMSwBwC8A36VyMY+zU5wSAIwCWpeYYx9gsvQKAOwAe7P2eH8MYzX6ChwBwB8DtOE+60PMWxwHgDoCRBMY5AgB3AIzHeQaufgJMAIC/AQDg8beAZQC4A2Argf0AWwBwa0/gc+lIDONr0OdiT6CjxwJyEcaW41iA2wDeS70RxnZBnwMADq8HMOfhXzzEuHpTuG4BAFJaEWQO5IxKp/61f0C/75vHXEvo4A8Aarwm8J00K13WpV9HtYL+bFYfw5pAT5aFb2osC+e8AABkFcBOxADgGIBt6YU0pUfwhqWrh2xYn2NKn3MbAHYDeCId0713ed2RE0d5fc4W6TEA7APwVuqPsgK4ypXC/XpKGQAsAPBB6qrBuLti2EsIgIgAzFk/fTUce5+OAQA1AjCTxsf+Ab8OZgBQGwDmtiynLRj/mQj3OQBABAAv41z1E2H8LToWAKQMwOy3b7Bg/A06FgCkDOCmRbe7uQWA9AGMWgRgFADpAxizCMAYAAAAAAAAgL8BAJAagOsWAbgBgPQBPJWaLBh/k/QMAOkDMIsz7lkw/rsRFooAIIbDweY27avS65Rb1f+bw8EsCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCCAoscAigAIg2mPAYQACIPBFC7GZGNmzgMA2L0+z4qHAMycCwDYPf9+0kMAk3He08BZAIqgVVrzaOObuZ6w4bW3AoAiaI9wkqVLmTm22/K62wTA/Cq4kvCNGmvdul5TIA+A/RG0SQspXqwxrYtULurccja95lYB+OOSrd3SvH4ilPR6AC5V0rHP6y1o8za+1lYCIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",TVe="_InformationContainerPos_1m76y_2",NVe="_scrollContainer_1m76y_15",kVe="_centerAlign_1m76y_25",DVe="_traitInfoTitle_1m76y_28",LVe="_dropdownFlex_1m76y_38",VVe="_checkboxFlex_1m76y_44",PVe="_simpleFlex_1m76y_49",OVe="_traitInfoText_1m76y_55",WVe="_dropdownBase_1m76y_64",GVe="_dropdownControl_1m76y_74",ZVe="_dropdownControlSmall_1m76y_80",JVe="_flexSelect_1m76y_106",HVe="_checked_1m76y_163",zVe="_checkmark_1m76y_167",YVe="_checkboxHolder_1m76y_180",XVe="_actionButton_1m76y_189",jVe="_tabHolder_1m76y_209",KVe="_tabButton_1m76y_215",$Ve="_tabButtonSelected_1m76y_235",Ze={InformationContainerPos:TVe,scrollContainer:NVe,centerAlign:kVe,traitInfoTitle:DVe,dropdownFlex:LVe,checkboxFlex:VVe,simpleFlex:PVe,traitInfoText:OVe,dropdownBase:WVe,dropdownControl:GVe,dropdownControlSmall:ZVe,"input-box":"_input-box_1m76y_87",flexSelect:JVe,"arrow-button":"_arrow-button_1m76y_114","left-button":"_left-button_1m76y_130","right-button":"_right-button_1m76y_137","anim-button":"_anim-button_1m76y_144","custom-checkbox":"_custom-checkbox_1m76y_149","checkbox-container":"_checkbox-container_1m76y_154",checked:HVe,checkmark:zVe,checkboxHolder:YVe,actionButton:XVe,tabHolder:jVe,tabButton:KVe,tabButtonSelected:$Ve};function qVe({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=Be.useContext(lr),[i,s]=Be.useState(0),[o,a]=Be.useState(0),[l,A]=Be.useState(0);Be.useEffect(()=>{var p,f,g;e!=null&&(A((p=e.data)==null?void 0:p.cullingLayer),s(((f=e.data)==null?void 0:f.cullingDistance[0])||0),a(((g=e.data)==null?void 0:g.cullingDistance[1])||0))},[e]);const c=p=>{s(p.target.value),e!=null&&e.data&&(e.data.cullingDistance[0]=p.target.value)},u=p=>{a(p.target.value),e!=null&&e.data&&(e.data.cullingDistance[1]=p.target.value)},h=p=>{e!=null&&e.data&&(A(p.target.value),e.data.cullingLayer=p.target.value)},d=()=>{r.updateCullHiddenMeshes()};return V.jsx("div",{children:V.jsxs("div",{className:Ze.InformationContainerPos,children:[V.jsx(ka,{title:"Trait Information",width:180,right:20}),V.jsx("div",{className:Ze.scrollContainer,children:n!=null?V.jsxs(V.Fragment,{children:[V.jsx("div",{className:Ze.traitInfoTitle,children:"Trait ID"}),V.jsx("div",{className:Ze.traitInfoText,children:n==null?void 0:n.id}),V.jsx("div",{className:Ze.traitInfoTitle,children:"Trait Name"}),V.jsx("div",{className:Ze.traitInfoText,children:n==null?void 0:n.name}),V.jsx("div",{className:Ze.traitInfoTitle,children:"Description"}),V.jsx("div",{className:Ze.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),V.jsx("div",{className:Ze.traitInfoTitle,children:"Culling Options"}),V.jsx("br",{}),V.jsxs("div",{className:Ze.traitInfoText,children:["Culling Layer",V.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:h,className:Ze["input-box"],step:1}),V.jsx("br",{}),V.jsx("br",{}),V.jsx(Qh,{title:"Out Distance",value:i,onChange:c,min:0,max:1,step:.001,stepBox:.01}),V.jsx("br",{}),V.jsx(Qh,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),V.jsx("div",{className:Ze.actionButton,onClick:d,children:V.jsx("div",{children:"Update Culling "})})]})]}):V.jsx(V.Fragment,{children:V.jsx("div",{className:Ze.traitInfoTitle,children:"No Trait Selected"})})})]})})}var bz={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(Be),t=r(vH);function r(b){return b&&b.__esModule?b:{default:b}}function i(){if(typeof WeakMap!="function")return null;var b=new WeakMap;return i=function(){return b},b}function s(b){if(b&&b.__esModule)return b;if(b===null||o(b)!=="object"&&typeof b!="function")return{default:b};var F=i();if(F&&F.has(b))return F.get(b);var x={},_=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var M in b)if(Object.prototype.hasOwnProperty.call(b,M)){var Y=_?Object.getOwnPropertyDescriptor(b,M):null;Y&&(Y.get||Y.set)?Object.defineProperty(x,M,Y):x[M]=b[M]}return x.default=b,F&&F.set(b,x),x}function o(b){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(x){return typeof x}:o=function(x){return x&&typeof Symbol=="function"&&x.constructor===Symbol&&x!==Symbol.prototype?"symbol":typeof x},o(b)}function a(){return a=Object.assign||function(b){for(var F=1;F"u"?w:x.placeholder,value:""},isOpen:!1},_.dropdownRef=(0,e.createRef)(),_.mounted=!0,_.handleDocumentClick=_.handleDocumentClick.bind(g(_)),_.fireChangeEvent=_.fireChangeEvent.bind(g(_)),_}return d(F,[{key:"componentDidUpdate",value:function(_){if(this.props.value!==_.value)if(this.props.value){var M=this.parseValue(this.props.value,this.props.options);M!==this.state.selected&&this.setState({selected:M})}else this.setState({selected:{label:typeof this.props.placeholder>"u"?w:this.props.placeholder,value:""}})}},{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,!1)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,!1)}},{key:"handleMouseDown",value:function(_){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(_.type==="mousedown"&&_.button!==0)&&(_.stopPropagation(),_.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(_,M){var Y;if(typeof _=="string")for(var O=0,U=M.length;O"u"&&(Y=_.label||_);var O=_.label||_.value||_,U=Y===this.state.selected.value||Y===this.state.selected,y=(M={},c(M,"".concat(this.props.baseClassName,"-option"),!0),c(M,_.className,!!_.className),c(M,"is-selected",U),M),I=(0,t.default)(y),R=Object.keys(_.data||{}).reduce(function(N,k){return A({},N,c({},"data-".concat(k),_.data[k]))},{});return e.default.createElement("div",a({key:Y,className:I,onMouseDown:this.setValue.bind(this,Y,O),onClick:this.setValue.bind(this,Y,O),role:"option","aria-selected":U?"true":"false"},R),O)}},{key:"buildMenu",value:function(){var _=this,M=this.props,Y=M.options,O=M.baseClassName,U=Y.map(function(y){if(y.type==="group"){var I=e.default.createElement("div",{className:"".concat(O,"-title")},y.name),R=y.items.map(function(N){return _.renderOption(N)});return e.default.createElement("div",{className:"".concat(O,"-group"),key:y.name,role:"listbox",tabIndex:"-1"},I,R)}else return _.renderOption(y)});return U.length?U:e.default.createElement("div",{className:"".concat(O,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(_){this.mounted&&(this.dropdownRef.current.contains(_.target)||this.state.isOpen&&this.setState({isOpen:!1}))}},{key:"isValueSelected",value:function(){return typeof this.state.selected=="string"||this.state.selected.value!==""}},{key:"render",value:function(){var _,M,Y,O,U,y=this.props,I=y.baseClassName,R=y.controlClassName,N=y.placeholderClassName,k=y.menuClassName,L=y.arrowClassName,G=y.arrowClosed,D=y.arrowOpen,E=y.className,z=this.props.disabled?"Dropdown-disabled":"",re=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,T=(0,t.default)((_={},c(_,"".concat(I,"-root"),!0),c(_,E,!!E),c(_,"is-open",this.state.isOpen),_)),ee=(0,t.default)((M={},c(M,"".concat(I,"-control"),!0),c(M,R,!!R),c(M,z,!!z),M)),pe=(0,t.default)((Y={},c(Y,"".concat(I,"-placeholder"),!0),c(Y,N,!!N),c(Y,"is-selected",this.isValueSelected()),Y)),de=(0,t.default)((O={},c(O,"".concat(I,"-menu"),!0),c(O,k,!!k),O)),Ae=(0,t.default)((U={},c(U,"".concat(I,"-arrow"),!0),c(U,L,!!L),U)),$=e.default.createElement("div",{className:pe},re),ce=this.state.isOpen?e.default.createElement("div",{className:de,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:T},e.default.createElement("div",{className:ee,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},$,e.default.createElement("div",{className:"".concat(I,"-arrow-wrapper")},D&&G?this.state.isOpen?D:G:e.default.createElement("span",{className:Ae}))),ce)}}]),F}(e.Component);B.defaultProps={baseClassName:"Dropdown"};var C=B;n.default=C})(bz);const CA=Zl(bz);function ePe({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=X.useContext(lr),[s,o]=Be.useState([]),[a,l]=Be.useState(null),A=u=>{(t==null?void 0:t.loras)!=null&&(l(t.loras[u.value]),console.log(t.loras[u.value]))},c=async()=>{const u=i.parent;u.remove(i),await r.createLoraData(a),u.add(i)};return Be.useEffect(()=>{if((t==null?void 0:t.loras)!=null){const u=t.loras.map((h,d)=>({value:d,label:h.name,description:h.description,manifest:h.manifest}));o(u)}},[t]),V.jsx("div",{children:V.jsxs("div",{className:Ze.InformationContainerPos,children:[V.jsx(ka,{title:"Lora Creation",width:180,right:20}),V.jsxs("div",{className:Ze.scrollContainer,children:[V.jsx("div",{className:Ze.traitInfoTitle,children:"Lora Manifests"}),V.jsx(CA,{className:Ze.dropdownControl,options:s,onChange:A,placeholder:"Select an option"}),";",V.jsx("div",{className:Ze.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&V.jsx("div",{className:Ze.actionButton,onClick:c,children:V.jsx("div",{children:" Create Lora Data "})})]})]})})}function tPe({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=X.useContext(lr),[s,o]=Be.useState([]),[a,l]=Be.useState(""),[A,c]=Be.useState(null),u=d=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[d.value].description),c(t.sprites[d.value]))},h=async()=>{const d=i.parent;d.remove(i),await r.createSpriteAtlas(A),d.add(i)};return Be.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const d=t.sprites.map((p,f)=>({value:f,label:p.name,description:p.description,manifest:p.manifest}));o(d)}},[t]),V.jsx("div",{children:V.jsxs("div",{className:Ze.InformationContainerPos,children:[V.jsx(ka,{title:"Sprite Creation",width:180,right:20}),V.jsxs("div",{className:Ze.scrollContainer,children:[V.jsx("div",{className:Ze.traitInfoTitle,children:"Sprite Manifests"}),V.jsx(CA,{className:Ze.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",V.jsx("div",{className:Ze.traitInfoText,children:a||""}),A!=null&&V.jsx("div",{className:Ze.actionButton,onClick:h,children:V.jsx("div",{children:" Create Sprite Data "})})]})]})})}const RV=4096;function nPe({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=X.useContext(lr),[o,a]=Be.useState([]),[l,A]=Be.useState(""),[c,u]=Be.useState(""),[h,d]=Be.useState(""),[p,f]=Be.useState(!1),[g,m]=Be.useState(512),[v,w]=Be.useState(512),[B,C]=Be.useState(.1),[b,F]=Be.useState(.1),[x,_]=Be.useState("center"),[M,Y]=Be.useState("center"),[O,U]=Be.useState("center"),[y,I]=Be.useState("head"),[R,N]=Be.useState("chest"),[k,L]=Be.useState(!0),[G,D]=Be.useState(!1),E=[{label:"center"},{label:"left"},{label:"right"}],z=[{label:"center"},{label:"top"},{label:"bottom"}],re=[{label:"center"},{label:"front"},{label:"back"}],T=[{label:"head"},{label:"neck"},{label:"chest"},{label:"spine"},{label:"hips"},{label:"upperLeg"},{label:"lowerLeg"},{label:"foot"}],ee=ue=>{(t==null?void 0:t.thumbnails)!=null&&(A(t.thumbnails[ue.value].description),d(t.thumbnails[ue.value].manifest),u(t.thumbnails[ue.value].name))},pe=(ue,q,K,oe)=>isNaN(ue)?oe:ue>K?K:ue{const q=parseInt(ue.target.value);m(pe(q,1,RV,512))},Ae=ue=>{const q=parseInt(ue.target.value);w(pe(q,1,RV,512))},$=ue=>{const q=parseFloat(ue.target.value);C(pe(q,0,1,.1))},ce=ue=>{const q=parseFloat(ue.target.value);F(pe(q,0,1,.1))},ge=ue=>{f(ue)},Fe=async()=>{const ue=i.parent;ue.remove(i),await r.createThumbnails(t.thumbnails[0]),ue.add(i)},P=(ue=!0)=>({topFrameOffset:b,bottomFrameOffset:B,thumbnailsWidth:g,thumbnailsHeight:v,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:M+"-"+O+"-"+x,topBoneName:y==="upperLeg"||y==="lowerLeg"||y==="foot"?"left"+y[0].toUpperCase()+y.slice(1):y,topBoneMaxVertex:k,bottomBoneName:R==="upperLeg"||R==="lowerLeg"||y==="foot"?"left"+R[0].toUpperCase()+R.slice(1):R,bottomBoneMaxVertex:G,saveOnlyIDs:ue?null:n.id}]}),fe=async(ue=!1)=>{s.storeCurrentAvatar();const q=i.parent;q.remove(i),ue?await r.createThumbnailsWithObjectData(P(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(P(!1),!1),q.add(i),s.loadStoredAvatar()};return Be.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const ue=t.thumbnails.map((q,K)=>({value:K,label:q.name,description:q.description,manifest:q.manifest}));a(ue)}},[t]),V.jsx("div",{children:V.jsxs("div",{className:Ze.InformationContainerPos,children:[V.jsx(ka,{title:"Thumbnail Creation",width:180,right:20}),V.jsxs("div",{className:Ze.scrollContainer,children:[V.jsxs("div",{className:Ze.tabHolder,children:[V.jsx("div",{className:Ze.tabButton+(p?"":" "+Ze.tabButtonSelected),onClick:()=>{ge(!1)},children:V.jsxs("div",{children:[" ","Custom"," "]})}),V.jsx("div",{className:Ze.tabButton+(p?" "+Ze.tabButtonSelected:""),onClick:()=>{ge(!0)},children:V.jsxs("div",{children:[" ","Manifest"," "]})})]}),V.jsx("br",{}),p?V.jsxs(V.Fragment,{children:[V.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,children:"Thumbnail Manifests"}),V.jsx(CA,{className:Ze.dropdownControl,options:o,value:c,onChange:ee,placeholder:"Select an option"}),";",V.jsx("div",{className:Ze.traitInfoText,children:l||""}),h!=""&&V.jsx("div",{className:Ze.actionButton,onClick:Fe,children:V.jsx("div",{children:" Create Thumbnails "})})]}):V.jsxs(V.Fragment,{children:[V.jsxs("div",{className:Ze.traitInfoText,children:[V.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",V.jsx("input",{value:g,className:Ze["input-box"],step:1,onChange:ue=>{m(ue.target.value)},onBlur:de}),V.jsx("br",{}),"Height ",V.jsx("input",{value:v,className:Ze["input-box"],step:1,onChange:ue=>{w(ue.target.value)},onBlur:Ae}),V.jsx("br",{}),"Top Spacing ",V.jsx("input",{value:B,className:Ze["input-box"],step:.1,onChange:ue=>{C(ue.target.value)},onBlur:$}),V.jsx("br",{}),"Bottom Spacing ",V.jsx("input",{value:b,className:Ze["input-box"],step:.1,onChange:ue=>{F(ue.target.value)},onBlur:ce}),V.jsx("br",{}),V.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),V.jsxs("div",{className:Ze.dropdownFlex,children:[V.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"X"}),V.jsx(CA,{className:Ze.dropdownControlSmall,options:E,onChange:ue=>{Y(ue.label)},value:M})]}),V.jsxs("div",{className:Ze.dropdownFlex,children:[V.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"Y"}),V.jsx(CA,{className:Ze.dropdownControlSmall,options:z,onChange:ue=>{U(ue.label)},value:O})]}),V.jsxs("div",{className:Ze.dropdownFlex,children:[V.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"Z"}),V.jsx(CA,{className:Ze.dropdownControlSmall,options:re,onChange:ue=>{_(ue.label)},value:x})]}),V.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),V.jsxs("div",{className:Ze.dropdownFlex,style:{justifyContent:"space-between"},children:[V.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"Top"}),V.jsx(CA,{className:Ze.dropdownControlSmall,options:T,onChange:ue=>{I(ue.label)},value:y})]}),V.jsxs("div",{className:Ze.dropdownFlex,style:{justifyContent:"space-between"},children:[V.jsx("div",{className:Ze.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),V.jsx(CA,{className:Ze.dropdownControlSmall,options:T,onChange:ue=>{N(ue.label)},value:R})]}),V.jsxs("div",{style:{textAlign:"left"},children:[V.jsxs("div",{className:Ze.checkboxFlex,style:{marginTop:"20px"},children:[V.jsx("input",{type:"checkbox",checked:k,onChange:ue=>{L(ue.target.checked)}}),V.jsx("div",{className:Ze.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${k?"uses Top":"uses Low"} Vertex`})]}),V.jsxs("div",{className:Ze.checkboxFlex,style:{marginTop:"10px"},children:[V.jsx("input",{type:"checkbox",checked:G,onChange:ue=>{D(ue.target.checked)}}),V.jsx("div",{className:Ze.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${G?"uses Top":"uses Low"} Vertex`})]})]}),e==""?V.jsx("div",{className:Ze.traitInfoText+" "+Ze.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):V.jsxs(V.Fragment,{children:[V.jsx("div",{className:Ze.traitInfoTitle+" "+Ze.centerAlign,style:{marginTop:"20px"},children:"Generate"}),V.jsx("div",{className:Ze.traitInfoText+" "+Ze.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),V.jsxs("div",{className:Ze.simpleFlex,style:{marginTop:"0px"},children:[V.jsx("div",{className:Ze.actionButton,style:{margin:"0px"},onClick:()=>{fe(!1)},children:V.jsx("div",{children:" Current "})}),V.jsx("div",{className:Ze.actionButton,style:{margin:"0px"},onClick:()=>{fe(!0)},children:V.jsx("div",{children:" All "})})]})]})]})]})]})})}function rPe({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=X.useState(""),s=o=>{o!=r?i(o):i("")};return V.jsxs("div",{children:[r=="Information"&&V.jsx(qVe,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&V.jsx(ePe,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&V.jsx(tPe,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&V.jsx(nPe,{selectedTrait:n,traitGroupName:t}),V.jsxs("div",{className:jI.InformationContainerPos,children:[V.jsx(ka,{title:"Tools",width:90,right:0}),V.jsx("div",{className:jI.scrollContainer,children:V.jsxs("div",{className:jI.optionsContainer,children:[V.jsx("div",{onClick:()=>{s("Information")},children:V.jsx(LA,{size:56,icon:UVe,rarity:r=="Information"?"mythic":"none"})},"Information"),V.jsx("div",{onClick:()=>{s("LoraCreation")},children:V.jsx(LA,{size:56,icon:RVe,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),V.jsx("div",{onClick:()=>{s("SpriteCreation")},children:V.jsx(LA,{size:56,icon:QVe,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),V.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:V.jsx(LA,{size:56,icon:MVe,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}function iPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=X.useContext(Ci),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:A,sceneElements:c}=X.useContext(lr),{playSound:u}=X.useContext(bs),{isMute:h}=X.useContext(Bs),{t:d}=Be.useContext(xs),p=()=>{!h&&u("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(ot.CREATE),r(!1)},[f,g]=X.useState(null),[m,v]=X.useState(null),[w,B]=X.useState(""),[C,b]=X.useState(null),[F,x]=X.useState(null),[_,M]=X.useState(""),[Y,O]=X.useState(!1),[U,y]=X.useState({background:"#ffffff"}),I=()=>{!h&&u("backNextButton"),e(ot.SAVE),r(!1)},R=()=>{t(!0),g(null),i.loadRandomTraits().then(()=>{console.log("success"),w!=""&&b(i.getCurrentTraitData(w)),t(!1)}).catch(Ae=>{t(!1),console.error("Error loading random traits:",Ae.message)})},N=Ae=>{y({background:Ae.hex})},k=Ae=>{y({background:Ae.hex}),i.setTraitColor(w,Ae.hex)},L=async Ae=>{const $=Ul(Ae.name),ce=URL.createObjectURL(Ae);await s.loadAnimation(ce,!1,0,!0,"",$),M(s.getCurrentAnimationName())},G=Ae=>{if(O(!1),w!=""){t(!0);const $=URL.createObjectURL(Ae);i.loadCustomTexture(w,$).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},D=Ae=>{if(O(!1),w!=""){t(!0);const $=URL.createObjectURL(Ae);i.loadCustomTrait(w,$).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},E=Ae=>{O(!1),t(!0),i.loadTrait(Ae.traitGroup.trait,Ae.id).then(()=>{t(!1),b(Ae)})},z=Ae=>{O(!1),i.removeTrait(Ae),b(null)},re=Ae=>{O(!1),t(!0),i.loadRandomTrait(Ae).then(()=>{t(!1),b(i.getCurrentTraitData(Ae))})},T=Ae=>{O(!1);const $=Array.from(Ae),ce=[],ge=Fe=>new Promise((P,fe)=>{var ue;if(Fe&&Fe.name.toLowerCase().endsWith(".json")){const q=new FileReader,K=`${(ue=i.manifestData)==null?void 0:ue.getAssetsDirectory()}/anata/_thumbnails/t_${Fe.name.split("_")[0]}.jpg`;console.log(K),q.onload=function(oe){try{const ye=JSON.parse(oe.target.result);ye.thumb=K,ce.push(ye),P()}catch(ye){console.error("Error parsing the JSON file:",ye),fe(ye)}},q.readAsText(Fe)}});Promise.all($.map(ge)).then(()=>{ce.length>0&&(g(ce),t(!0),i.loadTraitsFromNFTObject(ce[0]).then(()=>{t(!1)}))}).catch(Fe=>{console.error("Error processing files:",Fe)})},ee=async Ae=>{const $=Ae[0];$&&$.name.toLowerCase().endsWith(".fbx")&&L($),$&&($.name.toLowerCase().endsWith(".png")||$.name.toLowerCase().endsWith(".jpg"))&&G($),$&&$.name.toLowerCase().endsWith(".vrm")&&D($),$&&$.name.toLowerCase().endsWith(".json")&&T(Ae)},pe=Ae=>{!h&&u("optionClick"),O(!1),w!==Ae.trait?(v(i.getTraits(Ae.trait)),B(Ae.trait),b(i.getCurrentTraitData(Ae.trait)),x(i.getCurrentTraitVRM(Ae.trait)),o({targetY:Ae.cameraTarget.height,distance:Ae.cameraTarget.distance})):(v(null),B(""),b(null),o({targetY:.8,distance:3.2}))},de=()=>{O(!1);var Ae=document.createElement("input");Ae.type="file",Ae.accept=".vrm",Ae.onchange=$=>{var ce=$.target.files[0];if(ce.name.endsWith(".vrm")){const ge=URL.createObjectURL(ce);t(!0),i.loadCustomTrait(w,ge).then(()=>{t(!1)})}},Ae.click()};return V.jsxs("div",{className:Tn.container,children:[V.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:V.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),V.jsx("div",{className:"sectionTitle",children:d("pageTitles.chooseAppearance")}),V.jsx(F0,{onFilesDrop:ee}),V.jsxs("div",{className:Tn.sideMenu,children:[V.jsx(ka,{title:"Appearance",left:20}),V.jsx("div",{className:Tn.bottomLine}),V.jsx("div",{className:Tn.scrollContainer,children:V.jsx("div",{className:Tn["editor-container"],children:i.getGroupTraits().map((Ae,$)=>V.jsxs("div",{className:Tn.editorButton,onClick:()=>{pe(Ae)},children:[V.jsx(LA,{size:56,icon:Ae.fullIconSvg,rarity:w!==Ae.trait?"none":"mythic"}),V.jsx("div",{className:Tn.editorText,children:Ae.name})]},"options_"+$))})})]}),!!m&&V.jsxs("div",{className:Tn.selectorContainerPos,children:[V.jsx(ka,{title:w,width:130,left:20}),C&&V.jsx("div",{className:Tn.selectorColorPickerButton,onClick:()=>{O(!Y)},children:V.jsx("img",{className:Tn.selectorColorPickerImg,src:DCe})}),!!Y&&V.jsx("div",{draggable:!1,className:Tn.selectorColorPickerUI,children:V.jsx(eVe,{draggable:!1,width:"200px",color:U.background,onChange:N,onChangeComplete:k})}),V.jsx("div",{className:Tn.bottomLine}),V.jsx("div",{className:Tn.scrollContainerOptions,children:V.jsxs("div",{className:Tn["selector-container"],children:[V.jsx("div",{className:`${Tn.selectorButton}`,onClick:()=>{re(w)},children:V.jsx(LA,{size:56,icon:kCe,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(w)?V.jsx(V.Fragment,{}):V.jsx("div",{className:`${Tn.selectorButton}`,icon:jL,onClick:()=>{z(w)},children:V.jsx(LA,{size:56,icon:jL,rarity:C==null?"mythic":"none"})},"no-trait"),m.map(Ae=>{let $=Ae.id===(C==null?void 0:C.id);return V.jsx("div",{className:`${Tn.selectorButton}`,onClick:()=>{E(Ae)},children:V.jsx(LA,{size:56,icon:Ae.fullThumbnail,rarity:$?"mythic":"none"})},Ae.id)})]})}),V.jsx("div",{className:Tn.uploadContainer,children:V.jsx("div",{className:Tn.uploadButton,onClick:de,children:V.jsx("div",{children:"Upload "})})})]}),V.jsx(BQ,{jsonSelectionArray:f}),V.jsx(rPe,{selectedTrait:C,selectedVRM:F,traitGroupName:w}),V.jsx(Sb,{loadedAnimationName:_,randomize:R}),V.jsxs("div",{className:Tn.buttonContainer,children:[V.jsx(sn,{theme:"light",text:d("callToAction.back"),size:14,className:Tn.buttonLeft,onClick:p}),i.canDownload()&&V.jsx(sn,{theme:"light",text:d("callToAction.next"),size:14,className:Tn.buttonRight,onClick:I})]})]})}const sPe="_InformationContainerPos_rgqwy_1",oPe="_traitInfoTitle_rgqwy_13",aPe="_traitInfoText_rgqwy_21",lPe="_flexSelect_rgqwy_30",APe="_scrollContainer_rgqwy_65",cPe="_checked_rgqwy_90",uPe="_checkmark_rgqwy_94",dPe="_checkboxHolder_rgqwy_107",hPe="_buttonContainer_rgqwy_114",fPe="_buttonLeft_rgqwy_123",pPe="_buttonRight_rgqwy_127",gPe="_buttonCenter_rgqwy_131",gi={InformationContainerPos:sPe,traitInfoTitle:oPe,traitInfoText:aPe,flexSelect:lPe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:APe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:cPe,checkmark:uPe,checkboxHolder:dPe,buttonContainer:hPe,buttonLeft:fPe,buttonRight:pPe,buttonCenter:gPe},mPe="_InformationContainerPos_11mqa_2",vPe="_scrollContainer_11mqa_16",yPe="_traitInfoTitle_11mqa_28",wPe="_traitInfoText_11mqa_38",BPe="_flexSelect_11mqa_66",CPe="_checked_11mqa_124",bPe="_checkmark_11mqa_128",xPe="_checkboxHolder_11mqa_141",Gn={InformationContainerPos:mPe,scrollContainer:vPe,traitInfoTitle:yPe,traitInfoText:wPe,"input-box":"_input-box_11mqa_47",flexSelect:BPe,"arrow-button":"_arrow-button_11mqa_76","left-button":"_left-button_11mqa_91","right-button":"_right-button_11mqa_98","anim-button":"_anim-button_11mqa_105","custom-checkbox":"_custom-checkbox_11mqa_110","checkbox-container":"_checkbox-container_11mqa_115",checked:CPe,checkmark:bPe,checkboxHolder:xPe};function hR({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=X.useContext(lr),[a,l]=Be.useState(0),[A,c]=Be.useState(0),[u,h]=Be.useState(0),[d,p]=Be.useState(0),[f,g]=Be.useState(0),[m,v]=Be.useState(0),[w,B]=Be.useState(0),[C,b]=Be.useState(0),[F,x]=Be.useState(0),[_,M]=Be.useState(0);return Be.useEffect(()=>{if(n!=null){const Y=Sf(n,"Mesh"),O=Sf(n,"SkinnedMesh");l(Y.length),c(O.length);const U=Y.concat(O),{stdMats:y,stdCutoutpMats:I,stdTranspMats:R,mToonMats:N,mToonCutoutMats:k,mToonTranspMats:L}=mfe(U);h(y.length),p(R.length),g(I.length),v(N.length),B(L.length),b(k.length);const{triangles:G,bones:D}=o.getBoneTriangleCount();x(G),M(D)}},[n]),n!=null?V.jsx("div",{children:V.jsxs("div",{className:Gn.InformationContainerPos,children:[V.jsx(ka,{title:"Model Information",width:180,right:20}),V.jsxs("div",{className:Gn.scrollContainer,children:[V.jsxs("div",{className:Gn.flexSelect,children:[(t==null?void 0:t.length)>1?V.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["left-button"]}`,onClick:s}):V.jsx(V.Fragment,{}),e&&V.jsx("div",{style:{textAlign:"center"},children:V.jsx("div",{className:Gn.traitInfoTitle,style:{margin:"auto",fontSize:"14px",width:"200px",textAlign:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:e})}),(t==null?void 0:t.length)>1?V.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["right-button"]}`,onClick:i}):V.jsx(V.Fragment,{})]}),V.jsx("div",{className:Gn.traitInfoTitle,children:"Geometry info:"}),V.jsxs("div",{className:Gn.traitInfoText,children:["Meshes: ",a]}),V.jsxs("div",{className:Gn.traitInfoText,children:["SkinnedMeshes: ",A]}),V.jsxs("div",{className:Gn.traitInfoText,children:["Triangles: ",F]}),V.jsxs("div",{className:Gn.traitInfoText,children:["Bones: ",_]}),V.jsx("div",{className:Gn.traitInfoTitle,children:"Standard Material Count:"}),V.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",u]}),V.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",f]}),V.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",d]}),V.jsx("div",{className:Gn.traitInfoTitle,children:"MToon Material Count:"}),V.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",m]}),V.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",C]}),V.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",w]})]})]})}):V.jsx(V.Fragment,{})}function IPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=X.useContext(Ci),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=X.useContext(lr),[c,u]=Be.useState(null),[h,d]=Be.useState(""),[p,f]=X.useState(""),{playSound:g}=X.useContext(bs),{isMute:m}=X.useContext(Bs),[v,w]=X.useState(null),B=()=>{!m&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(ot.LANDING)},C=()=>{const U=De.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Cn(De.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Cn(De.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Cn(De.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Cn(De.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:U===0||U==2,exportMtoonAtlas:U===1||U==2,ktxCompression:De.merge_options_ktx_compression||!1,twoSidedMaterial:De.mergeOptions_two_sided_mat||!1}},b=(U,y=!1)=>{console.log(y),(async()=>{await s.loadTraitsFromNFTObject(v[U]),(De.mergeOptions_download_vrm==null?!0:De.mergeOptions_download_vrm)&&await s.downloadVRM(v[U].name,C());const N=new ep,k=A.parent;k.remove(A);const L=De.mergeOptions_download_lora==null?!0:De.mergeOptions_download_lora;if(L===!0){const D=r.loras.map(async E=>a.createLoraData(E,N));await Promise.all(D)}const G=De.mergeOptions_download_sprites==null?!0:De.mergeOptions_download_sprites;if(G===!0){const D=r.sprites.map(async E=>l.createSpriteAtlas(E,N));await Promise.all(D)}(L===!0||G===!0)&&N.saveZip(v[U].name),k.add(A),U{t(!0),b(0,!0)},{t:x}=Be.useContext(xs),_=async U=>{if(s.getCurrentCharacterModel()){const I=Ul(U.name),R=URL.createObjectURL(U);await o.loadAnimation(R,!1,0,!0,"",I),f(o.getCurrentAnimationName()),URL.revokeObjectURL(R)}else console.warn("Please load a vrm model to test animations.")},M=async U=>{const y=URL.createObjectURL(U);await s.loadOptimizerCharacter(y),URL.revokeObjectURL(y);const I=Ul(U.name);d(I),u(s.getCurrentCharacterModel())},Y=U=>{const y=Array.from(U),I=[],R=N=>new Promise((k,L)=>{var G;if(N&&N.name.toLowerCase().endsWith(".json")){const D=new FileReader,E=`${(G=s.manifestData)==null?void 0:G.getAssetsDirectory()}/anata/_thumbnails/t_${N.name.split("_")[0]}.jpg`;D.onload=function(z){try{const re=JSON.parse(z.target.result);re.thumb=E,I.push(re),k()}catch(re){console.error("Error parsing the JSON file:",re),L(re)}},D.readAsText(N)}});Promise.all(y.map(R)).then(()=>{I.length>0&&(w(I),t(!0),s.loadTraitsFromNFTObject(I[0]).then(()=>{t(!1)}))}).catch(N=>{console.error("Error processing files:",N)})},O=async U=>{const y=U[0];console.log("anim"),y&&y.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),_(y)),y&&y.name.toLowerCase().endsWith(".vrm")&&M(y),y&&y.name.toLowerCase().endsWith(".json")&&Y(U)};return V.jsxs("div",{className:gi.container,children:[V.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:V.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),V.jsx("div",{className:"sectionTitle",children:"Batch Download"}),V.jsx(F0,{onFilesDrop:O}),V.jsx(Ib,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),V.jsx(hR,{model:c}),V.jsx(BQ,{jsonSelectionArray:v}),V.jsx(Sb,{loadedAnimationName:p}),V.jsxs("div",{className:gi.buttonContainer,children:[V.jsx(sn,{theme:"light",text:x("callToAction.back"),size:14,className:gi.buttonLeft,onClick:B}),(v==null?void 0:v.length)==1&&V.jsx(sn,{theme:"light",text:"Download",size:14,className:gi.buttonRight,onClick:F}),(v==null?void 0:v.length)>1&&V.jsx(sn,{theme:"light",text:"Download All",size:14,className:gi.buttonRight,onClick:F})]})]})}function FPe(){const{isLoading:n,setViewMode:e}=X.useContext(Ci),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=X.useContext(lr),{playSound:l}=X.useContext(bs),{isMute:A}=X.useContext(Bs),[c,u]=Be.useState(null),[h,d]=Be.useState(""),[p,f]=Be.useState([]),[g,m]=Be.useState(0),[v,w]=X.useState("T-Pose"),B=()=>{!A&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(ot.LANDING)},C=()=>{const I=De.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Cn(De.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Cn(De.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Cn(De.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Cn(De.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:I===0||I==2,exportMtoonAtlas:I===1||I==2,ktxCompression:De.merge_options_ktx_compression||!1,twoSidedMaterial:De.mergeOptions_two_sided_mat||!1}},b=async()=>{for(let I=0;I{typeof I!="string"&&(I=h),await(async()=>{var z;(De.mergeOptions_download_vrm_preview==null?!0:De.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(I+"_portrait",512,1024,1.5,-.1),(De.mergeOptions_download_vrm==null?!0:De.mergeOptions_download_vrm)&&await r.downloadVRM(I+"_merged",C());const L=new ep,G=s.parent;G.remove(s),(z=r.getCurrentOptimizerCharacterModel().data)==null||z.isVRM0;const D=De.mergeOptions_download_lora==null?!0:De.mergeOptions_download_lora;if(D===!0){const re=t.loras.map(async T=>o.createLoraData(T,L));await Promise.all(re)}const E=De.mergeOptions_download_sprites==null?!0:De.mergeOptions_download_sprites;if(E===!0){const re=t.sprites.map(async T=>a.createSpriteAtlas(T,L));await Promise.all(re)}(D===!0||E===!0)&&L.saveZip(I),G.add(s)})()},{t:x}=Be.useContext(xs),_=async I=>{if(r.getCurrentOptimizerCharacterModel()){const N=Ul(I.name),k=URL.createObjectURL(I);await i.loadAnimation(k,!1,0,!0,"",N),w(i.getCurrentAnimationName()),URL.revokeObjectURL(k)}else console.warn("Please load a vrm model to test animations.")},M=()=>{if(g===0)O(p[p.length-1]),m(p.length-1);else{const I=g-1;O(p[I]),m(I)}},Y=()=>{if(g>=p.length-1)O(p[0]),m(0);else{const I=g+1;O(p[I]),m(I)}},O=async I=>{const R=URL.createObjectURL(I);await r.loadOptimizerCharacter(R),URL.revokeObjectURL(R);const N=Ul(I.name);d(N),u({...r.getCurrentCharacterModel()})},U=async I=>{O(I[0]);const R=[];for(let N=0;N{const R=I[0];R&&R.name.toLowerCase().endsWith(".fbx")&&_(R),R&&R.name.toLowerCase().endsWith(".vrm")&&U(I)};return V.jsxs("div",{className:gi.container,children:[V.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:V.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),V.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),V.jsx(F0,{onFilesDrop:y}),V.jsx(Ib,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),V.jsx(hR,{model:c,name:h,files:p,index:g,nextVrm:Y,previousVrm:M}),V.jsx(Sb,{loadedAnimationName:v}),V.jsxs("div",{className:gi.buttonContainer,children:[V.jsx(sn,{theme:"light",text:x("callToAction.back"),size:14,className:gi.buttonLeft,onClick:B}),(p==null?void 0:p.length)>1!=""&&V.jsx(sn,{theme:"light",text:"Download All",size:14,className:gi.buttonRight,onClick:b}),c!=""&&V.jsx(sn,{theme:"light",text:"Download",size:14,className:gi.buttonRight,onClick:F})]})]})}function EPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=X.useContext(Ci),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=X.useContext(lr),[c,u]=Be.useState(null),[h,d]=Be.useState(""),{playSound:p}=X.useContext(bs),{isMute:f}=X.useContext(Bs);X.useState(null);const[g,m]=X.useState(null),[v,w]=X.useState(""),B=()=>{!f&&p("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(ot.LANDING)},C=()=>{const y=De.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Cn(De.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Cn(De.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Cn(De.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Cn(De.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:y===0||y==2,exportMtoonAtlas:y===1||y==2,ktxCompression:De.merge_options_ktx_compression||!1,twoSidedMaterial:De.mergeOptions_two_sided_mat||!1}},b=y=>{const I=g[y].manifestName;(async()=>{(De.mergeOptions_download_vrm_preview==null?!0:De.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(I,512,1024,1.5,-.1),(De.mergeOptions_download_vrm==null?!0:De.mergeOptions_download_vrm)&&await i.downloadVRM(I,C());const L=new ep,G=A.parent;G.remove(A);const D=De.mergeOptions_download_lora==null?!0:De.mergeOptions_download_lora;if(D===!0){const z=r.loras.map(async re=>a.createLoraData(re,L));await Promise.all(z)}const E=De.mergeOptions_download_sprites==null?!0:De.mergeOptions_download_sprites;if(E===!0){const z=r.sprites.map(async re=>l.createSpriteAtlas(re,L));await Promise.all(z)}(D===!0||E===!0)&&L.saveZip(g[y].manifestName),G.add(A),y{y==0?(console.log(r.loras[0]),b(y)):(await i.setManifest(g[y]),t(!0),i.loadInitialTraits().then(async()=>{await(R=>new Promise(N=>setTimeout(N,R)))(1),b(y)}))},x=()=>{t(!0),F(0)},{t:_}=Be.useContext(xs),M=async y=>{if(i.getCurrentCharacterModel()){const R=Ul(y.name),N=URL.createObjectURL(y);await s.loadAnimation(N,!1,0,!0,"",R),w(s.getCurrentAnimationName()),URL.revokeObjectURL(N)}else console.warn("Please load a vrm model to test animations.")},Y=async y=>{const I=URL.createObjectURL(y);await i.loadOptimizerCharacter(I),URL.revokeObjectURL(I);const R=Ul(y.name);d(R),u(i.getCurrentCharacterModel())},O=y=>{const I=Array.from(y),R=[],N=k=>new Promise((L,G)=>{if(k&&k.name.toLowerCase().endsWith(".json")){const D=new FileReader,E=k.name.replace(/\.[^/.]+$/,"");D.onload=function(z){try{const re=JSON.parse(z.target.result),T=re.thumbnail;re.manifestName=E,R.push(re),L()}catch(re){console.error("Error parsing the JSON file:",re),G(re)}},D.readAsText(k)}});Promise.all(I.map(N)).then(()=>{R.length>0&&(m(R),i.setManifest(R[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(k=>{console.error("Error processing files:",k)})},U=async y=>{const I=y[0];I&&I.name.toLowerCase().endsWith(".fbx")&&M(I),I&&I.name.toLowerCase().endsWith(".vrm")&&Y(I),I&&I.name.toLowerCase().endsWith(".json")&&O(y)};return V.jsxs("div",{className:gi.container,children:[V.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:V.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),V.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),V.jsx(F0,{onFilesDrop:U}),V.jsx(Ib,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),V.jsx(hR,{model:c}),V.jsx(BQ,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&V.jsx(Sb,{loadedAnimationName:v}),V.jsxs("div",{className:gi.buttonContainer,children:[V.jsx(sn,{theme:"light",text:_("callToAction.back"),size:14,className:gi.buttonLeft,onClick:B}),(g==null?void 0:g.length)==1&&V.jsx(sn,{theme:"light",text:"Download",size:14,className:gi.buttonRight,onClick:x}),(g==null?void 0:g.length)>1&&V.jsx(sn,{theme:"light",text:"Download All",size:14,className:gi.buttonRight,onClick:x})]})]})}function _Pe(){const{t:n}=Be.useContext(xs),{setViewMode:e,setIsLoading:t,isLoading:r}=X.useContext(Ci),{playSound:i}=X.useContext(bs),{isMute:s}=X.useContext(Bs),{manifest:o,characterManager:a}=X.useContext(lr);Be.useState([]);const[l,A]=Be.useState([]);Be.useEffect(()=>{c()},[]);const c=async()=>{const f=await wQ();tBe(f,"the-anata-nft").then(g=>{A(g.nfts),console.log(g.nfts)})},u=()=>{e(ot.LANDING),!s&&i("backNextButton")},h=async f=>{t(!0),a.loadManifest(o[f].manifest).then(()=>{e(ot.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},d=()=>{console.log("ttt"),a.loadManifest(o[0].manifest).then(()=>{a.loadAppendManifest(o[1].manifest,!0).then(()=>{console.log(a.manifestData)})})},p=()=>{!s&&i("classMouseOver")};return V.jsxs("div",{className:`${lt.container} horizontalScroll`,children:[V.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),V.jsx("div",{className:lt.vrmOptimizerButton}),V.jsx("div",{className:lt.topLine}),V.jsx("div",{className:lt.classContainer,children:l.map((f,g)=>V.jsxs("div",{className:lt.class,onClick:()=>h(g),onMouseOver:()=>p(),children:[V.jsx("div",{className:lt.classFrame,style:{backgroundImage:`url(${f.image_url})`},children:V.jsx("div",{className:lt.frameContainer,children:V.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:lt.frame})})}),V.jsx("div",{className:lt.name,children:f.name})]},g))}),V.jsx("div",{className:lt.bottomLine}),V.jsxs("div",{className:lt.buttonContainer,children:[V.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:lt.buttonLeft,onClick:u}),V.jsx(sn,{theme:"light",text:"test",size:14,className:lt.buttonLeft,onClick:d})]})]})}const SPe="https://beta.anata.dev/character-assets/manifest.json";let KI;const $I=new j,Dy=new j;let qI,eF;const UPe=1.4,QPe=new j(0,1.25,0),xz=new j(-.9786403788721187,1.4036900759197288,.9892635490125085),RPe=xz.length(),MPe=.35,MV=6,TV=new j(0,.8,0),Iz=new j(-2.2367993753934425,1.1512971720174363,2.2612065299409223),TPe=Iz.length(),NPe=.5,Nd=new j,Ji=new Dt,kPe=new Dt,DPe=new j(1,0,0),LPe=new j(0,1,0);async function VPe(n){try{const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch manifest. Status: ${e.status}`);return await e.json()}catch(e){return console.error(`Error fetching manifest: ${e.message}`),[]}}async function PPe(){const n=await VPe(SPe),e=new Pme;return{initialManifest:n,effectManager:e}}const OPe=()=>{let n,e;const r=PPe().then(i=>{n="success",e=i},i=>{n="error",e=i});return{read(){if(n==="error")throw e;if(n==="success")return e;throw r}}},WPe=OPe();function GPe(){const{initialManifest:n,effectManager:e}=WPe.read(),[t,r]=Be.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=Be.useContext(lr),{viewMode:u}=Be.useContext(Ci);e.camera=i,e.scene=o;const h=()=>{if(e.camera){if([ot.BIO,ot.CHAT].includes(u)){u===ot.CHAT?(KI=UPe,$I.copy(QPe),Dy.copy(xz),qI=RPe,eF=MPe):(KI=MV,$I.copy(TV),Dy.copy(Iz),qI=TPe,eF=NPe),Ji.set(0,0,qI,1).applyMatrix4(e.camera.projectionMatrix),Ji.x/=Ji.w,Ji.y/=Ji.w,Ji.z/=Ji.w;const b=kPe.set(eF*Ji.w,Ji.y*Ji.w,Ji.z*Ji.w,Ji.w).applyMatrix4(e.camera.projectionMatrixInverse).x,F=Nd.set(Dy.x,0,Dy.z).angleTo(DPe);Nd.set(b,0,0).applyAxisAngle(LPe,F),Nd.add($I),a({targetX:Nd.x,targetY:Nd.y,targetZ:Nd.z,distance:KI})}else a({targetX:0,targetY:TV.y,targetZ:0,distance:MV});s&&([ot.APPEARANCE,ot.SAVE,ot.OPTIMIZER,ot.BATCHDOWNLOAD,ot.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1)}},[d,p]=Be.useState(!1),[f,g]=Be.useState(""),[m,v]=Be.useState([]),w=(b,F)=>{g(b),p(!0),v([F])},B={[ot.LANDING]:V.jsx(_Be,{}),[ot.APPEARANCE]:V.jsx(iPe,{confirmDialog:w}),[ot.OPTIMIZER]:V.jsx(FPe,{}),[ot.CREATE]:V.jsx(xBe,{}),[ot.WALLET]:V.jsx(_Pe,{}),[ot.CLAIM]:V.jsx(IBe,{}),[ot.BATCHMANIFEST]:V.jsx(EPe,{}),[ot.BATCHDOWNLOAD]:V.jsx(IPe,{}),[ot.LOAD]:V.jsx(kwe,{}),[ot.MINT]:V.jsx(sBe,{}),[ot.SAVE]:V.jsx(Hye,{}),[ot.CHAT]:V.jsx(bye,{})};let C=0;return Be.useEffect(()=>{const b=F=>{const x=new Date().getTime(),_=x-C;_<300&&_>10&&F.target.id=="editor-scene"&&r(!t),C=x};return window.addEventListener("touchend",b),window.addEventListener("click",b),()=>{window.removeEventListener("touchend",b),window.removeEventListener("click",b)}},[t]),Be.useEffect(()=>{if(A!=null)return h(),[ot.BIO,ot.MINT,ot.CHAT].includes(u)?A.enabled=!1:A.enabled=!0,[ot.LANDING,ot.CREATE,ot.CLAIM,ot.LOAD,ot.CLAIM,ot.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",h),()=>{window.removeEventListener("resize",h)}},[u,A]),Be.useEffect(()=>{l(n)},[n]),Be.useContext(xs),V.jsxs(Be.Fragment,{children:[V.jsx("div",{className:"generalTitle",children:"Character Studio"}),V.jsx(i0e,{confirmDialogText:f,confirmDialogCallback:m,confirmDialogWindow:d,setConfirmDialogWindow:p}),V.jsx(u0e,{}),B[u]]})}const ZPe=n=>{const e=new AS(n);return e.pollingInterval=12e3,e};uF.createRoot(document.getElementById("root")).render(V.jsx(X.StrictMode,{children:V.jsx(p8,{getLibrary:ZPe,children:V.jsx(IK,{children:V.jsx(vme,{children:V.jsx(bK,{children:V.jsx(jpe,{children:V.jsx(Ype,{children:V.jsx(sge,{children:V.jsx(Be.Suspense,{children:V.jsx(GPe,{})})})})})})})})})}));export{pa as c,Zl as g}; diff --git a/index.html b/index.html index a957160a..1a6860f6 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Character Studio - +