From 7409b4d2cbae3d829ec52186d6c30272d399b15f Mon Sep 17 00:00:00 2001 From: lalalune Date: Mon, 7 Oct 2024 03:45:26 +0000 Subject: [PATCH] deploy: 601d9eb81e457183b4689ff744ac307f7495c4be --- .../{howler-6a61fa22.js => howler-6efb6bd7.js} | 2 +- assets/{index-235c089b.js => index-927f05c7.js} | 16 ++++++++-------- index.html | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) rename assets/{howler-6a61fa22.js => howler-6efb6bd7.js} (99%) rename assets/{index-235c089b.js => index-927f05c7.js} (97%) diff --git a/assets/howler-6a61fa22.js b/assets/howler-6efb6bd7.js similarity index 99% rename from assets/howler-6a61fa22.js rename to assets/howler-6efb6bd7.js index 4c76db9e..f23b4ed9 100644 --- a/assets/howler-6a61fa22.js +++ b/assets/howler-6efb6bd7.js @@ -1,4 +1,4 @@ -import{g as L,c as S}from"./index-235c089b.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-927f05c7.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-235c089b.js b/assets/index-927f05c7.js similarity index 97% rename from assets/index-235c089b.js rename to assets/index-927f05c7.js index ea696962..22872a0b 100644 --- a/assets/index-235c089b.js +++ b/assets/index-927f05c7.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,ot=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,ot)|0,E=E+Math.imul(ee,Et)|0,z=z+Math.imul(ee,ot)|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,ot)|0,E=E+Math.imul(Ae,Et)|0,z=z+Math.imul(Ae,ot)|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,ot)|0,E=E+Math.imul(ge,Et)|0,z=z+Math.imul(ge,ot)|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,ot)|0,E=E+Math.imul(fe,Et)|0,z=z+Math.imul(fe,ot)|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,ot)|0,E=E+Math.imul(K,Et)|0,z=z+Math.imul(K,ot)|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,ot)|0,E=E+Math.imul(be,Et)|0,z=z+Math.imul(be,ot)|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,ot)|0,E=E+Math.imul(ie,Et)|0,z=z+Math.imul(ie,ot)|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,ot)|0,E=E+Math.imul(J,Et)|0,z=z+Math.imul(J,ot)|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,ot)|0,E=E+Math.imul(Z,Et)|0,z=z+Math.imul(Z,ot)|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,ot),E=E+Math.imul(se,Et)|0,z=Math.imul(se,ot),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)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&&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,ot,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,ot=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&ot,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^~ot&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]=ot^~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+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaA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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,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+BAFC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eYEsE7vUZm3mqdGJuKh2w9/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 * @@ -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&&ot(Ie,ve,xe),We.length>0&&ot(We,ve,xe),lt.length>0&&ot(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,ot(ne,ve,xe),f.toneMapping=We,Fe.updateMultisampleRenderTarget(G),Fe.updateRenderTargetMipmap(G),f.setRenderTarget(Ie)}function ot(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 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;B{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 ot=(E=e.textureProperties)===null||E===void 0?void 0:E._OutlineWidthTexture,Ar=ot!=null?{index:ot,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,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)})}}/*! * @pixiv/three-vrm-node-constraint v1.0.9 * Node constraint module for @pixiv/three-vrm * @@ -4225,7 +4225,7 @@ 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"},at={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(at.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-6a61fa22.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);t=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=` uniform vec3 cameraDir; uniform vec3 eye; @@ -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(at.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(at.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(at.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(at.APPEARANCE)},u=()=>{s(at.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(at.SAVE),!i&&r("backNextButton")},c=()=>{t(at.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",st={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(at.LANDING),!s&&i("backNextButton")},u=async d=>{t(!0),a.loadManifest(o.characters[d].manifest).then(()=>{e(at.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{!s&&i("classMouseOver")};return L.jsxs("div",{className:`${st.container} horizontalScroll`,children:[L.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),L.jsx("div",{className:st.vrmOptimizerButton}),L.jsx("div",{className:st.topLine}),L.jsx("div",{className:st.classContainer,children:l.map((d,p)=>L.jsxs("div",{className:d.disabled?st.classdisabled:st.class,onClick:d.disabled?null:()=>u(p),onMouseOver:d.disabled?null:()=>h(),children:[L.jsxs("div",{className:st.classFrame,style:{backgroundImage:`url(${d.image})`},children:[L.jsx("div",{className:st.frameContainer,children:L.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:st.frame})}),L.jsx("div",{className:st.lockedContainer,children:d.disabled&&L.jsx("img",{src:"./assets/icons/locked.svg",className:st.locked})})]}),L.jsx("div",{className:st.icon,children:L.jsx("img",{src:d.icon,alt:d.name})}),L.jsx("div",{className:st.name,children:d.name}),L.jsx("div",{className:st.description,children:d.description})]},p))}),L.jsx("div",{className:st.bottomLine}),L.jsx("div",{className:st.buttonContainer,children:L.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:st.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(at.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(at.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{e(at.BATCHMANIFEST)},d=()=>{!s&&i("classMouseOver")};return L.jsxs("div",{className:`${st.container} horizontalScroll`,children:[L.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),L.jsx("div",{className:st.vrmOptimizerButton}),L.jsx("div",{className:st.topLine}),L.jsxs("div",{className:st.classContainer,children:[l.map((p,f)=>L.jsxs("div",{className:p.disabled?st.classdisabled:st.class,onClick:p.disabled?null:()=>u(f),onMouseOver:p.disabled?null:()=>d(),children:[L.jsxs("div",{className:st.classFrame,style:{backgroundImage:`url(${p.image})`},children:[L.jsx("div",{className:st.frameContainer,children:L.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:st.frame})}),L.jsx("div",{className:st.lockedContainer,children:p.disabled&&L.jsx("img",{src:"./assets/icons/locked.svg",className:st.locked})})]}),L.jsx("div",{className:st.icon,children:L.jsx("img",{src:p.icon,alt:p.name})}),L.jsx("div",{className:st.name,children:p.name}),L.jsx("div",{className:st.description,children:p.description})]},f)),L.jsxs("div",{className:st.class,onClick:()=>h(),onMouseOver:()=>d(),children:[L.jsx("div",{className:st.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:L.jsx("div",{className:st.frameContainer,children:L.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:st.frame})})}),L.jsx("div",{className:st.icon,children:L.jsx("img",{src:"./assets/icons/class-neural-hacker.svg",alt:"manifest icons"})}),L.jsx("div",{className:st.name,children:"Manifest"}),L.jsx("div",{className:st.description,children:"Load by manifest"})]},"manifest-load")]}),L.jsx("div",{className:st.bottomLine}),L.jsx("div",{className:st.buttonContainer,children:L.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:st.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(at.CREATE),!t&&e("backNextButton")},s=()=>{n(at.CLAIM),!t&&e("backNextButton")},o=()=>{n(at.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await wQ()!=""&&n(at.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,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxA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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+OHt0FZtKKO9i2un7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CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+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(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,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAAD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RYlvO8GHfrdoY+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+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q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L0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+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,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZ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ACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",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(at.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(at.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(at.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(at.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(at.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(at.LANDING),!s&&i("backNextButton")},h=async f=>{t(!0),a.loadManifest(o[f].manifest).then(()=>{e(at.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:`${st.container} horizontalScroll`,children:[L.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),L.jsx("div",{className:st.vrmOptimizerButton}),L.jsx("div",{className:st.topLine}),L.jsx("div",{className:st.classContainer,children:l.map((f,g)=>L.jsxs("div",{className:st.class,onClick:()=>h(g),onMouseOver:()=>p(),children:[L.jsx("div",{className:st.classFrame,style:{backgroundImage:`url(${f.image_url})`},children:L.jsx("div",{className:st.frameContainer,children:L.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:st.frame})})}),L.jsx("div",{className:st.name,children:f.name})]},g))}),L.jsx("div",{className:st.bottomLine}),L.jsxs("div",{className:st.buttonContainer,children:[L.jsx(sn,{theme:"light",text:n("callToAction.back"),size:14,className:st.buttonLeft,onClick:u}),L.jsx(sn,{theme:"light",text:"test",size:14,className:st.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([at.BIO,at.CHAT].includes(u)){u===at.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&&([at.APPEARANCE,at.SAVE,at.OPTIMIZER,at.BATCHDOWNLOAD,at.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={[at.LANDING]:L.jsx(_Be,{}),[at.APPEARANCE]:L.jsx(iPe,{confirmDialog:w}),[at.OPTIMIZER]:L.jsx(FPe,{}),[at.CREATE]:L.jsx(xBe,{}),[at.WALLET]:L.jsx(_Pe,{}),[at.CLAIM]:L.jsx(IBe,{}),[at.BATCHMANIFEST]:L.jsx(EPe,{}),[at.BATCHDOWNLOAD]:L.jsx(IPe,{}),[at.LOAD]:L.jsx(kwe,{}),[at.MINT]:L.jsx(sBe,{}),[at.SAVE]:L.jsx(Hye,{}),[at.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(),[at.BIO,at.MINT,at.CHAT].includes(u)?A.enabled=!1:A.enabled=!0,[at.LANDING,at.CREATE,at.CLAIM,at.LOAD,at.CLAIM,at.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,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREY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QspXqwxrYtULurccja95lYB+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}; diff --git a/index.html b/index.html index e1638cfd..a957160a 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Character Studio - +