From 0d4ba395858eb2ab95ec0ea50c758af87f23cdde Mon Sep 17 00:00:00 2001 From: memelotsqui Date: Tue, 15 Oct 2024 20:55:52 +0000 Subject: [PATCH] deploy: ac568c338665cf3b34dbc5ef6f962293949d8f01 --- CNAME | 1 + ...{howler-46877a76.js => howler-1d21b928.js} | 2 +- .../{index-4a292a47.js => index-ffc117e4.js} | 56 +++++++++---------- index.html | 2 +- 4 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 CNAME rename assets/{howler-46877a76.js => howler-1d21b928.js} (99%) rename assets/{index-4a292a47.js => index-ffc117e4.js} (95%) diff --git a/CNAME b/CNAME new file mode 100644 index 00000000..2c19b6d8 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +studio.m3org.com diff --git a/assets/howler-46877a76.js b/assets/howler-1d21b928.js similarity index 99% rename from assets/howler-46877a76.js rename to assets/howler-1d21b928.js index 3ddb6806..f10120b7 100644 --- a/assets/howler-46877a76.js +++ b/assets/howler-1d21b928.js @@ -1,4 +1,4 @@ -import{g as L,c as S}from"./index-4a292a47.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-ffc117e4.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-4a292a47.js b/assets/index-ffc117e4.js similarity index 95% rename from assets/index-4a292a47.js rename to assets/index-ffc117e4.js index 2b30050b..8e67188a 100644 --- a/assets/index-4a292a47.js +++ b/assets/index-ffc117e4.js @@ -14,14 +14,14 @@ var Jz=Object.defineProperty;var qz=(n,e,t)=>e in n?Jz(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 mG=ye,gG=Symbol.for("react.element"),vG=Symbol.for("react.fragment"),yG=Object.prototype.hasOwnProperty,wG=mG.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,xG={key:!0,ref:!0,__self:!0,__source:!0};function $O(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)yG.call(e,r)&&!xG.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:gG,type:n,key:s,ref:o,props:i,_owner:wG.current}}lx.Fragment=vG;lx.jsx=$O;lx.jsxs=$O;kO.exports=lx;var k=kO.exports,MS={exports:{}};const _G={},bG=Object.freeze(Object.defineProperty({__proto__:null,default:_G},Symbol.toStringTag,{value:"Module"})),BG=eG(bG);MS.exports;(function(n){(function(e,t){function r(I,v){if(!I)throw new Error(v||"Assertion failed")}function i(I,v){I.super_=v;var E=function(){};E.prototype=v.prototype,I.prototype=new E,I.prototype.constructor=I}function s(I,v,E){if(s.isBN(I))return I;this.negative=0,this.words=null,this.length=0,this.red=null,I!==null&&((v==="le"||v==="be")&&(E=v,v=10),this._init(I||0,v||10,E||"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=BG.Buffer}catch{}s.isBN=function(v){return v instanceof s?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===s.wordSize&&Array.isArray(v.words)},s.max=function(v,E){return v.cmp(E)>0?v:E},s.min=function(v,E){return v.cmp(E)<0?v:E},s.prototype._init=function(v,E,U){if(typeof v=="number")return this._initNumber(v,E,U);if(typeof v=="object")return this._initArray(v,E,U);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),v=v.toString().replace(/\s+/g,"");var P=0;v[0]==="-"&&(P++,this.negative=1),P=0;P-=3)z=v[P]|v[P-1]<<8|v[P-2]<<16,this.words[L]|=z<>>26-K&67108863,K+=24,K>=26&&(K-=26,L++);else if(U==="le")for(P=0,L=0;P>>26-K&67108863,K+=24,K>=26&&(K-=26,L++);return this._strip()};function a(I,v){var E=I.charCodeAt(v);if(E>=48&&E<=57)return E-48;if(E>=65&&E<=70)return E-55;if(E>=97&&E<=102)return E-87;r(!1,"Invalid character in "+I)}function l(I,v,E){var U=a(I,E);return E-1>=v&&(U|=a(I,E-1)<<4),U}s.prototype._parseHex=function(v,E,U){this.length=Math.ceil((v.length-E)/6),this.words=new Array(this.length);for(var P=0;P=E;P-=2)K=l(v,E,P)<=18?(L-=18,z+=1,this.words[z]|=K>>>26):L+=8;else{var O=v.length-E;for(P=O%2===0?E+1:E;P=18?(L-=18,z+=1,this.words[z]|=K>>>26):L+=8}this._strip()};function A(I,v,E,U){for(var P=0,L=0,z=Math.min(I.length,E),K=v;K=49?L=O-49+10:O>=17?L=O-17+10:L=O,r(O>=0&&L1&&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 f=["","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"],h=[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(v,E){v=v||10,E=E|0||1;var U;if(v===16||v==="hex"){U="";for(var P=0,L=0,z=0;z>>24-P&16777215,P+=2,P>=26&&(P-=26,z--),L!==0||z!==this.length-1?U=f[6-O.length]+O+U:U=O+U}for(L!==0&&(U=L.toString(16)+U);U.length%E!==0;)U="0"+U;return this.negative!==0&&(U="-"+U),U}if(v===(v|0)&&v>=2&&v<=36){var B=h[v],W=p[v];U="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var F=ee.modrn(W).toString(v);ee=ee.idivn(W),ee.isZero()?U=F+U:U=f[B-F.length]+F+U}for(this.isZero()&&(U="0"+U);U.length%E!==0;)U="0"+U;return this.negative!==0&&(U="-"+U),U}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,E){return this.toArrayLike(o,v,E)}),s.prototype.toArray=function(v,E){return this.toArrayLike(Array,v,E)};var d=function(v,E){return v.allocUnsafe?v.allocUnsafe(E):new v(E)};s.prototype.toArrayLike=function(v,E,U){this._strip();var P=this.byteLength(),L=U||Math.max(1,P);r(P<=L,"byte array longer than desired length"),r(L>0,"Requested array length <= 0");var z=d(v,L),K=E==="le"?"LE":"BE";return this["_toArrayLike"+K](z,P),z},s.prototype._toArrayLikeLE=function(v,E){for(var U=0,P=0,L=0,z=0;L>8&255),U>16&255),z===6?(U>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(U=0&&(v[U--]=K>>8&255),U>=0&&(v[U--]=K>>16&255),z===6?(U>=0&&(v[U--]=K>>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(U>=0)for(v[U--]=P;U>=0;)v[U--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var E=v,U=0;return E>=4096&&(U+=13,E>>>=13),E>=64&&(U+=7,E>>>=7),E>=8&&(U+=4,E>>>=4),E>=2&&(U+=2,E>>>=2),U+E},s.prototype._zeroBits=function(v){if(v===0)return 26;var E=v,U=0;return E&8191||(U+=13,E>>>=13),E&127||(U+=7,E>>>=7),E&15||(U+=4,E>>>=4),E&3||(U+=2,E>>>=2),E&1||U++,U},s.prototype.bitLength=function(){var v=this.words[this.length-1],E=this._countBits(v);return(this.length-1)*26+E};function g(I){for(var v=new Array(I.bitLength()),E=0;E>>P&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,E=0;Ev.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var E;this.length>v.length?E=v:E=this;for(var U=0;Uv.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var E,U;this.length>v.length?(E=this,U=v):(E=v,U=this);for(var P=0;Pv.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){r(typeof v=="number"&&v>=0);var E=Math.ceil(v/26)|0,U=v%26;this._expand(E),U>0&&E--;for(var P=0;P0&&(this.words[P]=~this.words[P]&67108863>>26-U),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,E){r(typeof v=="number"&&v>=0);var U=v/26|0,P=v%26;return this._expand(U+1),E?this.words[U]=this.words[U]|1<v.length?(U=this,P=v):(U=v,P=this);for(var L=0,z=0;z>>26;for(;L!==0&&z>>26;if(this.length=U.length,L!==0)this.words[this.length]=L,this.length++;else if(U!==this)for(;zv.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var E=this.iadd(v);return v.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var U=this.cmp(v);if(U===0)return this.negative=0,this.length=1,this.words[0]=0,this;var P,L;U>0?(P=this,L=v):(P=v,L=this);for(var z=0,K=0;K>26,this.words[K]=E&67108863;for(;z!==0&&K>26,this.words[K]=E&67108863;if(z===0&&K>>26,ee=O&67108863,F=Math.min(B,v.length-1),X=Math.max(0,B-I.length+1);X<=F;X++){var ue=B-X|0;P=I.words[ue]|0,L=v.words[X]|0,z=P*L+ee,W+=z/67108864|0,ee=z&67108863}E.words[B]=ee|0,O=W|0}return O!==0?E.words[B]=O|0:E.length--,E._strip()}var y=function(v,E,U){var P=v.words,L=E.words,z=U.words,K=0,O,B,W,ee=P[0]|0,F=ee&8191,X=ee>>>13,ue=P[1]|0,le=ue&8191,oe=ue>>>13,re=P[2]|0,pe=re&8191,_e=re>>>13,Re=P[3]|0,Q=Re&8191,de=Re>>>13,Ae=P[4]|0,q=Ae&8191,J=Ae>>>13,ce=P[5]|0,xe=ce&8191,be=ce>>>13,N=P[6]|0,j=N&8191,se=N>>>13,he=P[7]|0,me=he&8191,G=he>>>13,R=P[8]|0,T=R&8191,V=R>>>13,te=P[9]|0,ae=te&8191,ie=te>>>13,Te=L[0]|0,Me=Te&8191,Le=Te>>>13,ke=L[1]|0,De=ke&8191,fe=ke>>>13,Ce=L[2]|0,Se=Ce&8191,Fe=Ce>>>13,We=L[3]|0,qe=We&8191,ct=We>>>13,sn=L[4]|0,Ct=sn&8191,it=sn>>>13,ar=L[5]|0,wt=ar&8191,Yt=ar>>>13,Js=L[6]|0,Vt=Js&8191,Xt=Js>>>13,ne=L[7]|0,ge=ne&8191,Be=ne>>>13,we=L[8]|0,Ee=we&8191,ze=we>>>13,st=L[9]|0,Ze=st&8191,Je=st>>>13;U.negative=v.negative^E.negative,U.length=19,O=Math.imul(F,Me),B=Math.imul(F,Le),B=B+Math.imul(X,Me)|0,W=Math.imul(X,Le);var yt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(yt>>>26)|0,yt&=67108863,O=Math.imul(le,Me),B=Math.imul(le,Le),B=B+Math.imul(oe,Me)|0,W=Math.imul(oe,Le),O=O+Math.imul(F,De)|0,B=B+Math.imul(F,fe)|0,B=B+Math.imul(X,De)|0,W=W+Math.imul(X,fe)|0;var mt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(mt>>>26)|0,mt&=67108863,O=Math.imul(pe,Me),B=Math.imul(pe,Le),B=B+Math.imul(_e,Me)|0,W=Math.imul(_e,Le),O=O+Math.imul(le,De)|0,B=B+Math.imul(le,fe)|0,B=B+Math.imul(oe,De)|0,W=W+Math.imul(oe,fe)|0,O=O+Math.imul(F,Se)|0,B=B+Math.imul(F,Fe)|0,B=B+Math.imul(X,Se)|0,W=W+Math.imul(X,Fe)|0;var gt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(gt>>>26)|0,gt&=67108863,O=Math.imul(Q,Me),B=Math.imul(Q,Le),B=B+Math.imul(de,Me)|0,W=Math.imul(de,Le),O=O+Math.imul(pe,De)|0,B=B+Math.imul(pe,fe)|0,B=B+Math.imul(_e,De)|0,W=W+Math.imul(_e,fe)|0,O=O+Math.imul(le,Se)|0,B=B+Math.imul(le,Fe)|0,B=B+Math.imul(oe,Se)|0,W=W+Math.imul(oe,Fe)|0,O=O+Math.imul(F,qe)|0,B=B+Math.imul(F,ct)|0,B=B+Math.imul(X,qe)|0,W=W+Math.imul(X,ct)|0;var Zt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,O=Math.imul(q,Me),B=Math.imul(q,Le),B=B+Math.imul(J,Me)|0,W=Math.imul(J,Le),O=O+Math.imul(Q,De)|0,B=B+Math.imul(Q,fe)|0,B=B+Math.imul(de,De)|0,W=W+Math.imul(de,fe)|0,O=O+Math.imul(pe,Se)|0,B=B+Math.imul(pe,Fe)|0,B=B+Math.imul(_e,Se)|0,W=W+Math.imul(_e,Fe)|0,O=O+Math.imul(le,qe)|0,B=B+Math.imul(le,ct)|0,B=B+Math.imul(oe,qe)|0,W=W+Math.imul(oe,ct)|0,O=O+Math.imul(F,Ct)|0,B=B+Math.imul(F,it)|0,B=B+Math.imul(X,Ct)|0,W=W+Math.imul(X,it)|0;var Rn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,O=Math.imul(xe,Me),B=Math.imul(xe,Le),B=B+Math.imul(be,Me)|0,W=Math.imul(be,Le),O=O+Math.imul(q,De)|0,B=B+Math.imul(q,fe)|0,B=B+Math.imul(J,De)|0,W=W+Math.imul(J,fe)|0,O=O+Math.imul(Q,Se)|0,B=B+Math.imul(Q,Fe)|0,B=B+Math.imul(de,Se)|0,W=W+Math.imul(de,Fe)|0,O=O+Math.imul(pe,qe)|0,B=B+Math.imul(pe,ct)|0,B=B+Math.imul(_e,qe)|0,W=W+Math.imul(_e,ct)|0,O=O+Math.imul(le,Ct)|0,B=B+Math.imul(le,it)|0,B=B+Math.imul(oe,Ct)|0,W=W+Math.imul(oe,it)|0,O=O+Math.imul(F,wt)|0,B=B+Math.imul(F,Yt)|0,B=B+Math.imul(X,wt)|0,W=W+Math.imul(X,Yt)|0;var Di=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Di>>>26)|0,Di&=67108863,O=Math.imul(j,Me),B=Math.imul(j,Le),B=B+Math.imul(se,Me)|0,W=Math.imul(se,Le),O=O+Math.imul(xe,De)|0,B=B+Math.imul(xe,fe)|0,B=B+Math.imul(be,De)|0,W=W+Math.imul(be,fe)|0,O=O+Math.imul(q,Se)|0,B=B+Math.imul(q,Fe)|0,B=B+Math.imul(J,Se)|0,W=W+Math.imul(J,Fe)|0,O=O+Math.imul(Q,qe)|0,B=B+Math.imul(Q,ct)|0,B=B+Math.imul(de,qe)|0,W=W+Math.imul(de,ct)|0,O=O+Math.imul(pe,Ct)|0,B=B+Math.imul(pe,it)|0,B=B+Math.imul(_e,Ct)|0,W=W+Math.imul(_e,it)|0,O=O+Math.imul(le,wt)|0,B=B+Math.imul(le,Yt)|0,B=B+Math.imul(oe,wt)|0,W=W+Math.imul(oe,Yt)|0,O=O+Math.imul(F,Vt)|0,B=B+Math.imul(F,Xt)|0,B=B+Math.imul(X,Vt)|0,W=W+Math.imul(X,Xt)|0;var qs=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(qs>>>26)|0,qs&=67108863,O=Math.imul(me,Me),B=Math.imul(me,Le),B=B+Math.imul(G,Me)|0,W=Math.imul(G,Le),O=O+Math.imul(j,De)|0,B=B+Math.imul(j,fe)|0,B=B+Math.imul(se,De)|0,W=W+Math.imul(se,fe)|0,O=O+Math.imul(xe,Se)|0,B=B+Math.imul(xe,Fe)|0,B=B+Math.imul(be,Se)|0,W=W+Math.imul(be,Fe)|0,O=O+Math.imul(q,qe)|0,B=B+Math.imul(q,ct)|0,B=B+Math.imul(J,qe)|0,W=W+Math.imul(J,ct)|0,O=O+Math.imul(Q,Ct)|0,B=B+Math.imul(Q,it)|0,B=B+Math.imul(de,Ct)|0,W=W+Math.imul(de,it)|0,O=O+Math.imul(pe,wt)|0,B=B+Math.imul(pe,Yt)|0,B=B+Math.imul(_e,wt)|0,W=W+Math.imul(_e,Yt)|0,O=O+Math.imul(le,Vt)|0,B=B+Math.imul(le,Xt)|0,B=B+Math.imul(oe,Vt)|0,W=W+Math.imul(oe,Xt)|0,O=O+Math.imul(F,ge)|0,B=B+Math.imul(F,Be)|0,B=B+Math.imul(X,ge)|0,W=W+Math.imul(X,Be)|0;var pn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(pn>>>26)|0,pn&=67108863,O=Math.imul(T,Me),B=Math.imul(T,Le),B=B+Math.imul(V,Me)|0,W=Math.imul(V,Le),O=O+Math.imul(me,De)|0,B=B+Math.imul(me,fe)|0,B=B+Math.imul(G,De)|0,W=W+Math.imul(G,fe)|0,O=O+Math.imul(j,Se)|0,B=B+Math.imul(j,Fe)|0,B=B+Math.imul(se,Se)|0,W=W+Math.imul(se,Fe)|0,O=O+Math.imul(xe,qe)|0,B=B+Math.imul(xe,ct)|0,B=B+Math.imul(be,qe)|0,W=W+Math.imul(be,ct)|0,O=O+Math.imul(q,Ct)|0,B=B+Math.imul(q,it)|0,B=B+Math.imul(J,Ct)|0,W=W+Math.imul(J,it)|0,O=O+Math.imul(Q,wt)|0,B=B+Math.imul(Q,Yt)|0,B=B+Math.imul(de,wt)|0,W=W+Math.imul(de,Yt)|0,O=O+Math.imul(pe,Vt)|0,B=B+Math.imul(pe,Xt)|0,B=B+Math.imul(_e,Vt)|0,W=W+Math.imul(_e,Xt)|0,O=O+Math.imul(le,ge)|0,B=B+Math.imul(le,Be)|0,B=B+Math.imul(oe,ge)|0,W=W+Math.imul(oe,Be)|0,O=O+Math.imul(F,Ee)|0,B=B+Math.imul(F,ze)|0,B=B+Math.imul(X,Ee)|0,W=W+Math.imul(X,ze)|0;var bt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(bt>>>26)|0,bt&=67108863,O=Math.imul(ae,Me),B=Math.imul(ae,Le),B=B+Math.imul(ie,Me)|0,W=Math.imul(ie,Le),O=O+Math.imul(T,De)|0,B=B+Math.imul(T,fe)|0,B=B+Math.imul(V,De)|0,W=W+Math.imul(V,fe)|0,O=O+Math.imul(me,Se)|0,B=B+Math.imul(me,Fe)|0,B=B+Math.imul(G,Se)|0,W=W+Math.imul(G,Fe)|0,O=O+Math.imul(j,qe)|0,B=B+Math.imul(j,ct)|0,B=B+Math.imul(se,qe)|0,W=W+Math.imul(se,ct)|0,O=O+Math.imul(xe,Ct)|0,B=B+Math.imul(xe,it)|0,B=B+Math.imul(be,Ct)|0,W=W+Math.imul(be,it)|0,O=O+Math.imul(q,wt)|0,B=B+Math.imul(q,Yt)|0,B=B+Math.imul(J,wt)|0,W=W+Math.imul(J,Yt)|0,O=O+Math.imul(Q,Vt)|0,B=B+Math.imul(Q,Xt)|0,B=B+Math.imul(de,Vt)|0,W=W+Math.imul(de,Xt)|0,O=O+Math.imul(pe,ge)|0,B=B+Math.imul(pe,Be)|0,B=B+Math.imul(_e,ge)|0,W=W+Math.imul(_e,Be)|0,O=O+Math.imul(le,Ee)|0,B=B+Math.imul(le,ze)|0,B=B+Math.imul(oe,Ee)|0,W=W+Math.imul(oe,ze)|0,O=O+Math.imul(F,Ze)|0,B=B+Math.imul(F,Je)|0,B=B+Math.imul(X,Ze)|0,W=W+Math.imul(X,Je)|0;var JA=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(JA>>>26)|0,JA&=67108863,O=Math.imul(ae,De),B=Math.imul(ae,fe),B=B+Math.imul(ie,De)|0,W=Math.imul(ie,fe),O=O+Math.imul(T,Se)|0,B=B+Math.imul(T,Fe)|0,B=B+Math.imul(V,Se)|0,W=W+Math.imul(V,Fe)|0,O=O+Math.imul(me,qe)|0,B=B+Math.imul(me,ct)|0,B=B+Math.imul(G,qe)|0,W=W+Math.imul(G,ct)|0,O=O+Math.imul(j,Ct)|0,B=B+Math.imul(j,it)|0,B=B+Math.imul(se,Ct)|0,W=W+Math.imul(se,it)|0,O=O+Math.imul(xe,wt)|0,B=B+Math.imul(xe,Yt)|0,B=B+Math.imul(be,wt)|0,W=W+Math.imul(be,Yt)|0,O=O+Math.imul(q,Vt)|0,B=B+Math.imul(q,Xt)|0,B=B+Math.imul(J,Vt)|0,W=W+Math.imul(J,Xt)|0,O=O+Math.imul(Q,ge)|0,B=B+Math.imul(Q,Be)|0,B=B+Math.imul(de,ge)|0,W=W+Math.imul(de,Be)|0,O=O+Math.imul(pe,Ee)|0,B=B+Math.imul(pe,ze)|0,B=B+Math.imul(_e,Ee)|0,W=W+Math.imul(_e,ze)|0,O=O+Math.imul(le,Ze)|0,B=B+Math.imul(le,Je)|0,B=B+Math.imul(oe,Ze)|0,W=W+Math.imul(oe,Je)|0;var Fn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,O=Math.imul(ae,Se),B=Math.imul(ae,Fe),B=B+Math.imul(ie,Se)|0,W=Math.imul(ie,Fe),O=O+Math.imul(T,qe)|0,B=B+Math.imul(T,ct)|0,B=B+Math.imul(V,qe)|0,W=W+Math.imul(V,ct)|0,O=O+Math.imul(me,Ct)|0,B=B+Math.imul(me,it)|0,B=B+Math.imul(G,Ct)|0,W=W+Math.imul(G,it)|0,O=O+Math.imul(j,wt)|0,B=B+Math.imul(j,Yt)|0,B=B+Math.imul(se,wt)|0,W=W+Math.imul(se,Yt)|0,O=O+Math.imul(xe,Vt)|0,B=B+Math.imul(xe,Xt)|0,B=B+Math.imul(be,Vt)|0,W=W+Math.imul(be,Xt)|0,O=O+Math.imul(q,ge)|0,B=B+Math.imul(q,Be)|0,B=B+Math.imul(J,ge)|0,W=W+Math.imul(J,Be)|0,O=O+Math.imul(Q,Ee)|0,B=B+Math.imul(Q,ze)|0,B=B+Math.imul(de,Ee)|0,W=W+Math.imul(de,ze)|0,O=O+Math.imul(pe,Ze)|0,B=B+Math.imul(pe,Je)|0,B=B+Math.imul(_e,Ze)|0,W=W+Math.imul(_e,Je)|0;var eo=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(eo>>>26)|0,eo&=67108863,O=Math.imul(ae,qe),B=Math.imul(ae,ct),B=B+Math.imul(ie,qe)|0,W=Math.imul(ie,ct),O=O+Math.imul(T,Ct)|0,B=B+Math.imul(T,it)|0,B=B+Math.imul(V,Ct)|0,W=W+Math.imul(V,it)|0,O=O+Math.imul(me,wt)|0,B=B+Math.imul(me,Yt)|0,B=B+Math.imul(G,wt)|0,W=W+Math.imul(G,Yt)|0,O=O+Math.imul(j,Vt)|0,B=B+Math.imul(j,Xt)|0,B=B+Math.imul(se,Vt)|0,W=W+Math.imul(se,Xt)|0,O=O+Math.imul(xe,ge)|0,B=B+Math.imul(xe,Be)|0,B=B+Math.imul(be,ge)|0,W=W+Math.imul(be,Be)|0,O=O+Math.imul(q,Ee)|0,B=B+Math.imul(q,ze)|0,B=B+Math.imul(J,Ee)|0,W=W+Math.imul(J,ze)|0,O=O+Math.imul(Q,Ze)|0,B=B+Math.imul(Q,Je)|0,B=B+Math.imul(de,Ze)|0,W=W+Math.imul(de,Je)|0;var mu=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(mu>>>26)|0,mu&=67108863,O=Math.imul(ae,Ct),B=Math.imul(ae,it),B=B+Math.imul(ie,Ct)|0,W=Math.imul(ie,it),O=O+Math.imul(T,wt)|0,B=B+Math.imul(T,Yt)|0,B=B+Math.imul(V,wt)|0,W=W+Math.imul(V,Yt)|0,O=O+Math.imul(me,Vt)|0,B=B+Math.imul(me,Xt)|0,B=B+Math.imul(G,Vt)|0,W=W+Math.imul(G,Xt)|0,O=O+Math.imul(j,ge)|0,B=B+Math.imul(j,Be)|0,B=B+Math.imul(se,ge)|0,W=W+Math.imul(se,Be)|0,O=O+Math.imul(xe,Ee)|0,B=B+Math.imul(xe,ze)|0,B=B+Math.imul(be,Ee)|0,W=W+Math.imul(be,ze)|0,O=O+Math.imul(q,Ze)|0,B=B+Math.imul(q,Je)|0,B=B+Math.imul(J,Ze)|0,W=W+Math.imul(J,Je)|0;var Ma=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Ma>>>26)|0,Ma&=67108863,O=Math.imul(ae,wt),B=Math.imul(ae,Yt),B=B+Math.imul(ie,wt)|0,W=Math.imul(ie,Yt),O=O+Math.imul(T,Vt)|0,B=B+Math.imul(T,Xt)|0,B=B+Math.imul(V,Vt)|0,W=W+Math.imul(V,Xt)|0,O=O+Math.imul(me,ge)|0,B=B+Math.imul(me,Be)|0,B=B+Math.imul(G,ge)|0,W=W+Math.imul(G,Be)|0,O=O+Math.imul(j,Ee)|0,B=B+Math.imul(j,ze)|0,B=B+Math.imul(se,Ee)|0,W=W+Math.imul(se,ze)|0,O=O+Math.imul(xe,Ze)|0,B=B+Math.imul(xe,Je)|0,B=B+Math.imul(be,Ze)|0,W=W+Math.imul(be,Je)|0;var qA=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(qA>>>26)|0,qA&=67108863,O=Math.imul(ae,Vt),B=Math.imul(ae,Xt),B=B+Math.imul(ie,Vt)|0,W=Math.imul(ie,Xt),O=O+Math.imul(T,ge)|0,B=B+Math.imul(T,Be)|0,B=B+Math.imul(V,ge)|0,W=W+Math.imul(V,Be)|0,O=O+Math.imul(me,Ee)|0,B=B+Math.imul(me,ze)|0,B=B+Math.imul(G,Ee)|0,W=W+Math.imul(G,ze)|0,O=O+Math.imul(j,Ze)|0,B=B+Math.imul(j,Je)|0,B=B+Math.imul(se,Ze)|0,W=W+Math.imul(se,Je)|0;var lr=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(lr>>>26)|0,lr&=67108863,O=Math.imul(ae,ge),B=Math.imul(ae,Be),B=B+Math.imul(ie,ge)|0,W=Math.imul(ie,Be),O=O+Math.imul(T,Ee)|0,B=B+Math.imul(T,ze)|0,B=B+Math.imul(V,Ee)|0,W=W+Math.imul(V,ze)|0,O=O+Math.imul(me,Ze)|0,B=B+Math.imul(me,Je)|0,B=B+Math.imul(G,Ze)|0,W=W+Math.imul(G,Je)|0;var to=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(to>>>26)|0,to&=67108863,O=Math.imul(ae,Ee),B=Math.imul(ae,ze),B=B+Math.imul(ie,Ee)|0,W=Math.imul(ie,ze),O=O+Math.imul(T,Ze)|0,B=B+Math.imul(T,Je)|0,B=B+Math.imul(V,Ze)|0,W=W+Math.imul(V,Je)|0;var ec=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(ec>>>26)|0,ec&=67108863,O=Math.imul(ae,Ze),B=Math.imul(ae,Je),B=B+Math.imul(ie,Ze)|0,W=Math.imul(ie,Je);var Mr=(K+O|0)+((B&8191)<<13)|0;return K=(W+(B>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,z[0]=yt,z[1]=mt,z[2]=gt,z[3]=Zt,z[4]=Rn,z[5]=Di,z[6]=qs,z[7]=pn,z[8]=bt,z[9]=JA,z[10]=Fn,z[11]=eo,z[12]=mu,z[13]=Ma,z[14]=qA,z[15]=lr,z[16]=to,z[17]=ec,z[18]=Mr,K!==0&&(z[19]=K,U.length++),U};Math.imul||(y=m);function w(I,v,E){E.negative=v.negative^I.negative,E.length=I.length+v.length;for(var U=0,P=0,L=0;L>>26)|0,P+=z>>>26,z&=67108863}E.words[L]=K,U=z,z=P}return U!==0?E.words[L]=U:E.length--,E._strip()}function x(I,v,E){return w(I,v,E)}s.prototype.mulTo=function(v,E){var U,P=this.length+v.length;return this.length===10&&v.length===10?U=y(this,v,E):P<63?U=m(this,v,E):P<1024?U=w(this,v,E):U=x(this,v,E),U},s.prototype.mul=function(v){var E=new s(null);return E.words=new Array(this.length+v.length),this.mulTo(v,E)},s.prototype.mulf=function(v){var E=new s(null);return E.words=new Array(this.length+v.length),x(this,v,E)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var E=v<0;E&&(v=-v),r(typeof v=="number"),r(v<67108864);for(var U=0,P=0;P>=26,U+=L/67108864|0,U+=z>>>26,this.words[P]=z&67108863}return U!==0&&(this.words[P]=U,this.length++),E?this.ineg():this},s.prototype.muln=function(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var E=g(v);if(E.length===0)return new s(1);for(var U=this,P=0;P=0);var E=v%26,U=(v-E)/26,P=67108863>>>26-E<<26-E,L;if(E!==0){var z=0;for(L=0;L>>26-E}z&&(this.words[L]=z,this.length++)}if(U!==0){for(L=this.length-1;L>=0;L--)this.words[L+U]=this.words[L];for(L=0;L=0);var P;E?P=(E-E%26)/26:P=0;var L=v%26,z=Math.min((v-L)/26,this.length),K=67108863^67108863>>>L<z)for(this.length-=z,B=0;B=0&&(W!==0||B>=P);B--){var ee=this.words[B]|0;this.words[B]=W<<26-L|ee>>>L,W=ee&K}return O&&W!==0&&(O.words[O.length++]=W),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,E,U){return r(this.negative===0),this.iushrn(v,E,U)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){r(typeof v=="number"&&v>=0);var E=v%26,U=(v-E)/26,P=1<=0);var E=v%26,U=(v-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=U)return this;if(E!==0&&U++,this.length=Math.min(U,this.length),E!==0){var P=67108863^67108863>>>E<=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},s.prototype.isubn=function(v){if(r(typeof v=="number"),r(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E>26)-(O/67108864|0),this.words[L+U]=z&67108863}for(;L>26,this.words[L+U]=z&67108863;if(K===0)return this._strip();for(r(K===-1),K=0,L=0;L>26,this.words[L]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,E){var U=this.length-v.length,P=this.clone(),L=v,z=L.words[L.length-1]|0,K=this._countBits(z);U=26-K,U!==0&&(L=L.ushln(U),P.iushln(U),z=L.words[L.length-1]|0);var O=P.length-L.length,B;if(E!=="mod"){B=new s(null),B.length=O+1,B.words=new Array(B.length);for(var W=0;W=0;F--){var X=(P.words[L.length+F]|0)*67108864+(P.words[L.length+F-1]|0);for(X=Math.min(X/z|0,67108863),P._ishlnsubmul(L,X,F);P.negative!==0;)X--,P.negative=0,P._ishlnsubmul(L,1,F),P.isZero()||(P.negative^=1);B&&(B.words[F]=X)}return B&&B._strip(),P._strip(),E!=="div"&&U!==0&&P.iushrn(U),{div:B||null,mod:P}},s.prototype.divmod=function(v,E,U){if(r(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var P,L,z;return this.negative!==0&&v.negative===0?(z=this.neg().divmod(v,E),E!=="mod"&&(P=z.div.neg()),E!=="div"&&(L=z.mod.neg(),U&&L.negative!==0&&L.iadd(v)),{div:P,mod:L}):this.negative===0&&v.negative!==0?(z=this.divmod(v.neg(),E),E!=="mod"&&(P=z.div.neg()),{div:P,mod:z.mod}):this.negative&v.negative?(z=this.neg().divmod(v.neg(),E),E!=="div"&&(L=z.mod.neg(),U&&L.negative!==0&&L.isub(v)),{div:z.div,mod:L}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?E==="div"?{div:this.divn(v.words[0]),mod:null}:E==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,E)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var E=this.divmod(v);if(E.mod.isZero())return E.div;var U=E.div.negative!==0?E.mod.isub(v):E.mod,P=v.ushrn(1),L=v.andln(1),z=U.cmp(P);return z<0||L===1&&z===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},s.prototype.modrn=function(v){var E=v<0;E&&(v=-v),r(v<=67108863);for(var U=(1<<26)%v,P=0,L=this.length-1;L>=0;L--)P=(U*P+(this.words[L]|0))%v;return E?-P:P},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var E=v<0;E&&(v=-v),r(v<=67108863);for(var U=0,P=this.length-1;P>=0;P--){var L=(this.words[P]|0)+U*67108864;this.words[P]=L/v|0,U=L%v}return this._strip(),E?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){r(v.negative===0),r(!v.isZero());var E=this,U=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var P=new s(1),L=new s(0),z=new s(0),K=new s(1),O=0;E.isEven()&&U.isEven();)E.iushrn(1),U.iushrn(1),++O;for(var B=U.clone(),W=E.clone();!E.isZero();){for(var ee=0,F=1;!(E.words[0]&F)&&ee<26;++ee,F<<=1);if(ee>0)for(E.iushrn(ee);ee-- >0;)(P.isOdd()||L.isOdd())&&(P.iadd(B),L.isub(W)),P.iushrn(1),L.iushrn(1);for(var X=0,ue=1;!(U.words[0]&ue)&&X<26;++X,ue<<=1);if(X>0)for(U.iushrn(X);X-- >0;)(z.isOdd()||K.isOdd())&&(z.iadd(B),K.isub(W)),z.iushrn(1),K.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(z),L.isub(K)):(U.isub(E),z.isub(P),K.isub(L))}return{a:z,b:K,gcd:U.iushln(O)}},s.prototype._invmp=function(v){r(v.negative===0),r(!v.isZero());var E=this,U=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var P=new s(1),L=new s(0),z=U.clone();E.cmpn(1)>0&&U.cmpn(1)>0;){for(var K=0,O=1;!(E.words[0]&O)&&K<26;++K,O<<=1);if(K>0)for(E.iushrn(K);K-- >0;)P.isOdd()&&P.iadd(z),P.iushrn(1);for(var B=0,W=1;!(U.words[0]&W)&&B<26;++B,W<<=1);if(B>0)for(U.iushrn(B);B-- >0;)L.isOdd()&&L.iadd(z),L.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(L)):(U.isub(E),L.isub(P))}var ee;return E.cmpn(1)===0?ee=P:ee=L,ee.cmpn(0)<0&&ee.iadd(v),ee},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var E=this.clone(),U=v.clone();E.negative=0,U.negative=0;for(var P=0;E.isEven()&&U.isEven();P++)E.iushrn(1),U.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;U.isEven();)U.iushrn(1);var L=E.cmp(U);if(L<0){var z=E;E=U,U=z}else if(L===0||U.cmpn(1)===0)break;E.isub(U)}while(!0);return U.iushln(P)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){r(typeof v=="number");var E=v%26,U=(v-E)/26,P=1<>>26,K&=67108863,this.words[z]=K}return L!==0&&(this.words[z]=L,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var E=v<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this._strip();var U;if(this.length>1)U=1;else{E&&(v=-v),r(v<=67108863,"Number is too big");var P=this.words[0]|0;U=P===v?0:Pv.length)return 1;if(this.length=0;U--){var P=this.words[U]|0,L=v.words[U]|0;if(P!==L){PL&&(E=1);break}}return E},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new $(v)},s.prototype.toRed=function(v){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return r(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},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(v){return r(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var _={k256:null,p224:null,p192:null,p25519:null};function C(I,v){this.name=I,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}C.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},C.prototype.ireduce=function(v){var E=v,U;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),U=E.bitLength();while(U>this.n);var P=U0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},C.prototype.split=function(v,E){v.iushrn(this.n,0,E)},C.prototype.imulK=function(v){return v.imul(this.k)};function S(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(S,C),S.prototype.split=function(v,E){for(var U=4194303,P=Math.min(v.length,9),L=0;L>>22,z=K}z>>>=22,v.words[L-10]=z,z===0&&v.length>10?v.length-=10:v.length-=9},S.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var E=0,U=0;U>>=26,v.words[U]=L,E=P}return E!==0&&(v.words[v.length++]=E),v},s._prime=function(v){if(_[v])return _[v];var E;if(v==="k256")E=new S;else if(v==="p224")E=new b;else if(v==="p192")E=new M;else if(v==="p25519")E=new D;else throw new Error("Unknown prime "+v);return _[v]=E,E};function $(I){if(typeof I=="string"){var v=s._prime(I);this.m=v.p,this.prime=v}else r(I.gtn(1),"modulus must be greater than 1"),this.m=I,this.prime=null}$.prototype._verify1=function(v){r(v.negative===0,"red works only with positives"),r(v.red,"red works only with red numbers")},$.prototype._verify2=function(v,E){r((v.negative|E.negative)===0,"red works only with positives"),r(v.red&&v.red===E.red,"red works only with red numbers")},$.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(c(v,v.umod(this.m)._forceRed(this)),v)},$.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},$.prototype.add=function(v,E){this._verify2(v,E);var U=v.add(E);return U.cmp(this.m)>=0&&U.isub(this.m),U._forceRed(this)},$.prototype.iadd=function(v,E){this._verify2(v,E);var U=v.iadd(E);return U.cmp(this.m)>=0&&U.isub(this.m),U},$.prototype.sub=function(v,E){this._verify2(v,E);var U=v.sub(E);return U.cmpn(0)<0&&U.iadd(this.m),U._forceRed(this)},$.prototype.isub=function(v,E){this._verify2(v,E);var U=v.isub(E);return U.cmpn(0)<0&&U.iadd(this.m),U},$.prototype.shl=function(v,E){return this._verify1(v),this.imod(v.ushln(E))},$.prototype.imul=function(v,E){return this._verify2(v,E),this.imod(v.imul(E))},$.prototype.mul=function(v,E){return this._verify2(v,E),this.imod(v.mul(E))},$.prototype.isqr=function(v){return this.imul(v,v.clone())},$.prototype.sqr=function(v){return this.mul(v,v)},$.prototype.sqrt=function(v){if(v.isZero())return v.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var U=this.m.add(new s(1)).iushrn(2);return this.pow(v,U)}for(var P=this.m.subn(1),L=0;!P.isZero()&&P.andln(1)===0;)L++,P.iushrn(1);r(!P.isZero());var z=new s(1).toRed(this),K=z.redNeg(),O=this.m.subn(1).iushrn(1),B=this.m.bitLength();for(B=new s(2*B*B).toRed(this);this.pow(B,O).cmp(K)!==0;)B.redIAdd(K);for(var W=this.pow(B,P),ee=this.pow(v,P.addn(1).iushrn(1)),F=this.pow(v,P),X=L;F.cmp(z)!==0;){for(var ue=F,le=0;ue.cmp(z)!==0;le++)ue=ue.redSqr();r(le=0;L--){for(var W=E.words[L],ee=B-1;ee>=0;ee--){var F=W>>ee&1;if(z!==P[0]&&(z=this.sqr(z)),F===0&&K===0){O=0;continue}K<<=1,K|=F,O++,!(O!==U&&(L!==0||ee!==0))&&(z=this.mul(z,P[K]),O=0,K=0)}B=26}return z},$.prototype.convertTo=function(v){var E=v.umod(this.m);return E===v?E.clone():E},$.prototype.convertFrom=function(v){var E=v.clone();return E.red=null,E},s.mont=function(v){return new H(v)};function H(I){$.call(this,I),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(H,$),H.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},H.prototype.convertFrom=function(v){var E=this.imod(v.mul(this.rinv));return E.red=null,E},H.prototype.imul=function(v,E){if(v.isZero()||E.isZero())return v.words[0]=0,v.length=1,v;var U=v.imul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=U.isub(P).iushrn(this.shift),z=L;return L.cmp(this.m)>=0?z=L.isub(this.m):L.cmpn(0)<0&&(z=L.iadd(this.m)),z._forceRed(this)},H.prototype.mul=function(v,E){if(v.isZero()||E.isZero())return new s(0)._forceRed(this);var U=v.mul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=U.isub(P).iushrn(this.shift),z=L;return L.cmp(this.m)>=0?z=L.isub(this.m):L.cmpn(0)<0&&(z=L.iadd(this.m)),z._forceRed(this)},H.prototype.invm=function(v){var E=this.imod(v._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(n,ta)})(MS);var EG=MS.exports;const vt=bl(EG),CG="logger/5.7.0";let L2=!1,P2=!1;const kv={debug:1,default:2,info:2,warning:3,error:4,off:5};let D2=kv.default,D_=null;function SG(){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 O2=SG();var OB;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(OB||(OB={}));var po;(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"})(po||(po={}));const N2="0123456789abcdef";let ve=class cr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();kv[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(D2>kv[r])&&console.log.apply(console,t)}debug(...e){this._log(cr.levels.DEBUG,e)}info(...e){this._log(cr.levels.INFO,e)}warn(...e){this._log(cr.levels.WARNING,e)}makeError(e,t,r){if(P2)return this.makeError("censored error",t,{});t||(t=cr.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+=N2[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 po.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 po.CALL_EXCEPTION:case po.INSUFFICIENT_FUNDS:case po.MISSING_NEW:case po.NONCE_EXPIRED:case po.REPLACEMENT_UNDERPRICED:case po.TRANSACTION_REPLACED:case po.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,cr.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){O2&&this.throwError("platform missing String.prototype.normalize",cr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:O2})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,cr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,cr.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,cr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",cr.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",cr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",cr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return D_||(D_=new cr(CG)),D_}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",cr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),L2){if(!e)return;this.globalLogger().throwError("error censorship permanent",cr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}P2=!!e,L2=!!t}static setLogLevel(e){const t=kv[e.toLowerCase()];if(t==null){cr.globalLogger().warn("invalid log level - "+e);return}D2=t}static from(e){return new cr(e)}};ve.errors=po;ve.levels=OB;const MG="bytes/5.7.0",Pn=new ve(MG);function YO(n){return!!n.toHexString}function Xf(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return Xf(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function TS(n){return Et(n)&&!(n.length%2)||Ax(n)}function k2(n){return typeof n=="number"&&n==n&&n%1===0}function Ax(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!k2(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"){Pn.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),Xf(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),YO(n)&&(n=n.toHexString()),Et(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Pn.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),Xf(r)}function mh(n){let e=at(n);if(e.length===0)return e;let t=0;for(;te&&Pn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),Xf(t)}function Et(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const O_="0123456789abcdef";function nt(n,e){if(e||(e={}),typeof n=="number"){Pn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=O_[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),YO(n))return n.toHexString();if(Et(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Pn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(Ax(n)){let t="0x";for(let r=0;r>4]+O_[i&15]}return t}return Pn.throwArgumentError("invalid hexlify value","value",n)}function kc(n){if(typeof n!="string")n=nt(n);else if(!Et(n)||n.length%2)return null;return(n.length-2)/2}function zr(n,e,t){return typeof n!="string"?n=nt(n):(!Et(n)||n.length%2)&&Pn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function _i(n){let e="0x";return n.forEach(t=>{e+=nt(t).substring(2)}),e}function cx(n){const e=IG(nt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function IG(n){typeof n!="string"&&(n=nt(n)),Et(n)||Pn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Pn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function ux(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(TS(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]):Pn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Pn.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=TG(at(e._vs),32);e._vs=nt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Pn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=nt(i);e.s==null?e.s=o:e.s!==o&&Pn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Pn.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&&Pn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Et(e.r)?Pn.throwArgumentError("signature missing or invalid r","signature",n):e.r=kn(e.r,32),e.s==null||!Et(e.s)?Pn.throwArgumentError("signature missing or invalid s","signature",n):e.s=kn(e.s,32);const t=at(e.s);t[0]>=128&&Pn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=nt(t);e._vs&&(Et(e._vs)||Pn.throwArgumentError("signature invalid _vs","signature",n),e._vs=kn(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Pn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const RG="bignumber/5.7.0";var Sy=vt.BN;const ja=new ve(RG),N_={},Q2=9007199254740991;let H2=!1;class Ge{constructor(e,t){e!==N_&&ja.throwError("cannot call constructor directly; use BigNumber.from",ve.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return mi(Mt(this).fromTwos(e))}toTwos(e){return mi(Mt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ge.from(this._hex.substring(1)):this}add(e){return mi(Mt(this).add(Mt(e)))}sub(e){return mi(Mt(this).sub(Mt(e)))}div(e){return Ge.from(e).isZero()&&ms("division-by-zero","div"),mi(Mt(this).div(Mt(e)))}mul(e){return mi(Mt(this).mul(Mt(e)))}mod(e){const t=Mt(e);return t.isNeg()&&ms("division-by-zero","mod"),mi(Mt(this).umod(t))}pow(e){const t=Mt(e);return t.isNeg()&&ms("negative-power","pow"),mi(Mt(this).pow(t))}and(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","and"),mi(Mt(this).and(t))}or(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","or"),mi(Mt(this).or(t))}xor(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","xor"),mi(Mt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ms("negative-width","mask"),mi(Mt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ms("negative-width","shl"),mi(Mt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ms("negative-width","shr"),mi(Mt(this).shrn(e))}eq(e){return Mt(this).eq(Mt(e))}lt(e){return Mt(this).lt(Mt(e))}lte(e){return Mt(this).lte(Mt(e))}gt(e){return Mt(this).gt(Mt(e))}gte(e){return Mt(this).gte(Mt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Mt(this).isZero()}toNumber(){try{return Mt(this).toNumber()}catch{ms("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ja.throwError("this platform does not support BigInt",ve.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?H2||(H2=!0,ja.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ja.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ve.errors.UNEXPECTED_ARGUMENT,{}):ja.throwError("BigNumber.toString does not accept parameters",ve.errors.UNEXPECTED_ARGUMENT,{})),Mt(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(N_,lm(e)):e.match(/^-?[0-9]+$/)?new Ge(N_,lm(new Sy(e))):ja.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&ms("underflow","BigNumber.from",e),(e>=Q2||e<=-Q2)&&ms("overflow","BigNumber.from",e),Ge.from(String(e));const t=e;if(typeof t=="bigint")return Ge.from(t.toString());if(Ax(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"&&(Et(r)||r[0]==="-"&&Et(r.substring(1))))return Ge.from(r)}return ja.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function lm(n){if(typeof n!="string")return lm(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&ja.throwArgumentError("invalid hex","value",n),n=lm(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 mi(n){return Ge.from(lm(n))}function Mt(n){const e=Ge.from(n).toHexString();return e[0]==="-"?new Sy("-"+e.substring(3),16):new Sy(e.substring(2),16)}function ms(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),ja.throwError(n,ve.errors.NUMERIC_FAULT,r)}function FG(n){return new Sy(n,36).toString(16)}const UG="properties/5.7.0";var LG=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 My=new ve(UG);function Ue(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function Ji(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 LG(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 PG(n,e){(!n||typeof n!="object")&&My.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||My.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function wn(n){const e={};for(const t in n)e[t]=n[t];return e}const DG={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function XO(n){if(n==null||DG[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;tts(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Ue(e,t,ts(r))}return e}return My.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function ts(n){return OG(n)}class og{constructor(e){for(const t in e)this[t]=ts(e[t])}}const NG="abstract-provider/5.7.0";var kG=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 QG=new ve(NG);class HG extends og{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class ag{constructor(){QG.checkAbstract(new.target,ag),Ue(this,"_isProvider",!0)}getFeeData(){return kG(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 zG="networks/5.7.1",z2=new ve(zG);function GG(n){return n&&typeof n.renetwork=="function"}function Ya(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 Ya(t)},e}function Ty(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return Ty(n,r)},t}const G2={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Ya("homestead")},V2={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Ya("ropsten")},j2={chainId:63,name:"classicMordor",_defaultProvider:Ty("https://www.ethercluster.com/mordor","classicMordor")},Qg={unspecified:{chainId:0,name:"unspecified"},homestead:G2,mainnet:G2,morden:{chainId:2,name:"morden"},ropsten:V2,testnet:V2,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Ya("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Ya("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Ya("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Ya("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Ty("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:j2,classicTestnet:j2,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Ty("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Ya("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Ya("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 ZO(n){if(n==null)return null;if(typeof n=="number"){for(const r in Qg){const i=Qg[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=Qg[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=Qg[n.name];if(!e)return typeof n.chainId!="number"&&z2.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&z2.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(GG(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 JO(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?v:E},s.min=function(v,E){return v.cmp(E)<0?v:E},s.prototype._init=function(v,E,U){if(typeof v=="number")return this._initNumber(v,E,U);if(typeof v=="object")return this._initArray(v,E,U);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),v=v.toString().replace(/\s+/g,"");var P=0;v[0]==="-"&&(P++,this.negative=1),P=0;P-=3)z=v[P]|v[P-1]<<8|v[P-2]<<16,this.words[L]|=z<>>26-K&67108863,K+=24,K>=26&&(K-=26,L++);else if(U==="le")for(P=0,L=0;P>>26-K&67108863,K+=24,K>=26&&(K-=26,L++);return this._strip()};function a(I,v){var E=I.charCodeAt(v);if(E>=48&&E<=57)return E-48;if(E>=65&&E<=70)return E-55;if(E>=97&&E<=102)return E-87;r(!1,"Invalid character in "+I)}function l(I,v,E){var U=a(I,E);return E-1>=v&&(U|=a(I,E-1)<<4),U}s.prototype._parseHex=function(v,E,U){this.length=Math.ceil((v.length-E)/6),this.words=new Array(this.length);for(var P=0;P=E;P-=2)K=l(v,E,P)<=18?(L-=18,z+=1,this.words[z]|=K>>>26):L+=8;else{var O=v.length-E;for(P=O%2===0?E+1:E;P=18?(L-=18,z+=1,this.words[z]|=K>>>26):L+=8}this._strip()};function A(I,v,E,U){for(var P=0,L=0,z=Math.min(I.length,E),K=v;K=49?L=O-49+10:O>=17?L=O-17+10:L=O,r(O>=0&&L1&&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 f=["","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"],h=[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(v,E){v=v||10,E=E|0||1;var U;if(v===16||v==="hex"){U="";for(var P=0,L=0,z=0;z>>24-P&16777215,P+=2,P>=26&&(P-=26,z--),L!==0||z!==this.length-1?U=f[6-O.length]+O+U:U=O+U}for(L!==0&&(U=L.toString(16)+U);U.length%E!==0;)U="0"+U;return this.negative!==0&&(U="-"+U),U}if(v===(v|0)&&v>=2&&v<=36){var B=h[v],W=p[v];U="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var F=ee.modrn(W).toString(v);ee=ee.idivn(W),ee.isZero()?U=F+U:U=f[B-F.length]+F+U}for(this.isZero()&&(U="0"+U);U.length%E!==0;)U="0"+U;return this.negative!==0&&(U="-"+U),U}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,E){return this.toArrayLike(o,v,E)}),s.prototype.toArray=function(v,E){return this.toArrayLike(Array,v,E)};var d=function(v,E){return v.allocUnsafe?v.allocUnsafe(E):new v(E)};s.prototype.toArrayLike=function(v,E,U){this._strip();var P=this.byteLength(),L=U||Math.max(1,P);r(P<=L,"byte array longer than desired length"),r(L>0,"Requested array length <= 0");var z=d(v,L),K=E==="le"?"LE":"BE";return this["_toArrayLike"+K](z,P),z},s.prototype._toArrayLikeLE=function(v,E){for(var U=0,P=0,L=0,z=0;L>8&255),U>16&255),z===6?(U>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(U=0&&(v[U--]=K>>8&255),U>=0&&(v[U--]=K>>16&255),z===6?(U>=0&&(v[U--]=K>>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(U>=0)for(v[U--]=P;U>=0;)v[U--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var E=v,U=0;return E>=4096&&(U+=13,E>>>=13),E>=64&&(U+=7,E>>>=7),E>=8&&(U+=4,E>>>=4),E>=2&&(U+=2,E>>>=2),U+E},s.prototype._zeroBits=function(v){if(v===0)return 26;var E=v,U=0;return E&8191||(U+=13,E>>>=13),E&127||(U+=7,E>>>=7),E&15||(U+=4,E>>>=4),E&3||(U+=2,E>>>=2),E&1||U++,U},s.prototype.bitLength=function(){var v=this.words[this.length-1],E=this._countBits(v);return(this.length-1)*26+E};function g(I){for(var v=new Array(I.bitLength()),E=0;E>>P&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,E=0;Ev.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var E;this.length>v.length?E=v:E=this;for(var U=0;Uv.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var E,U;this.length>v.length?(E=this,U=v):(E=v,U=this);for(var P=0;Pv.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){r(typeof v=="number"&&v>=0);var E=Math.ceil(v/26)|0,U=v%26;this._expand(E),U>0&&E--;for(var P=0;P0&&(this.words[P]=~this.words[P]&67108863>>26-U),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,E){r(typeof v=="number"&&v>=0);var U=v/26|0,P=v%26;return this._expand(U+1),E?this.words[U]=this.words[U]|1<v.length?(U=this,P=v):(U=v,P=this);for(var L=0,z=0;z>>26;for(;L!==0&&z>>26;if(this.length=U.length,L!==0)this.words[this.length]=L,this.length++;else if(U!==this)for(;zv.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var E=this.iadd(v);return v.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var U=this.cmp(v);if(U===0)return this.negative=0,this.length=1,this.words[0]=0,this;var P,L;U>0?(P=this,L=v):(P=v,L=this);for(var z=0,K=0;K>26,this.words[K]=E&67108863;for(;z!==0&&K>26,this.words[K]=E&67108863;if(z===0&&K>>26,ee=O&67108863,F=Math.min(B,v.length-1),X=Math.max(0,B-I.length+1);X<=F;X++){var ue=B-X|0;P=I.words[ue]|0,L=v.words[X]|0,z=P*L+ee,W+=z/67108864|0,ee=z&67108863}E.words[B]=ee|0,O=W|0}return O!==0?E.words[B]=O|0:E.length--,E._strip()}var y=function(v,E,U){var P=v.words,L=E.words,z=U.words,K=0,O,B,W,ee=P[0]|0,F=ee&8191,X=ee>>>13,ue=P[1]|0,le=ue&8191,oe=ue>>>13,re=P[2]|0,pe=re&8191,_e=re>>>13,Re=P[3]|0,Q=Re&8191,de=Re>>>13,Ae=P[4]|0,q=Ae&8191,J=Ae>>>13,ce=P[5]|0,xe=ce&8191,be=ce>>>13,N=P[6]|0,j=N&8191,se=N>>>13,he=P[7]|0,me=he&8191,G=he>>>13,R=P[8]|0,T=R&8191,V=R>>>13,te=P[9]|0,ae=te&8191,ie=te>>>13,Te=L[0]|0,Me=Te&8191,Le=Te>>>13,ke=L[1]|0,De=ke&8191,fe=ke>>>13,Ce=L[2]|0,Se=Ce&8191,Fe=Ce>>>13,We=L[3]|0,qe=We&8191,ut=We>>>13,sn=L[4]|0,Ct=sn&8191,it=sn>>>13,ar=L[5]|0,wt=ar&8191,Yt=ar>>>13,Js=L[6]|0,Vt=Js&8191,Xt=Js>>>13,ne=L[7]|0,ge=ne&8191,Be=ne>>>13,we=L[8]|0,Ee=we&8191,ze=we>>>13,st=L[9]|0,Ze=st&8191,Je=st>>>13;U.negative=v.negative^E.negative,U.length=19,O=Math.imul(F,Me),B=Math.imul(F,Le),B=B+Math.imul(X,Me)|0,W=Math.imul(X,Le);var yt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(yt>>>26)|0,yt&=67108863,O=Math.imul(le,Me),B=Math.imul(le,Le),B=B+Math.imul(oe,Me)|0,W=Math.imul(oe,Le),O=O+Math.imul(F,De)|0,B=B+Math.imul(F,fe)|0,B=B+Math.imul(X,De)|0,W=W+Math.imul(X,fe)|0;var mt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(mt>>>26)|0,mt&=67108863,O=Math.imul(pe,Me),B=Math.imul(pe,Le),B=B+Math.imul(_e,Me)|0,W=Math.imul(_e,Le),O=O+Math.imul(le,De)|0,B=B+Math.imul(le,fe)|0,B=B+Math.imul(oe,De)|0,W=W+Math.imul(oe,fe)|0,O=O+Math.imul(F,Se)|0,B=B+Math.imul(F,Fe)|0,B=B+Math.imul(X,Se)|0,W=W+Math.imul(X,Fe)|0;var gt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(gt>>>26)|0,gt&=67108863,O=Math.imul(Q,Me),B=Math.imul(Q,Le),B=B+Math.imul(de,Me)|0,W=Math.imul(de,Le),O=O+Math.imul(pe,De)|0,B=B+Math.imul(pe,fe)|0,B=B+Math.imul(_e,De)|0,W=W+Math.imul(_e,fe)|0,O=O+Math.imul(le,Se)|0,B=B+Math.imul(le,Fe)|0,B=B+Math.imul(oe,Se)|0,W=W+Math.imul(oe,Fe)|0,O=O+Math.imul(F,qe)|0,B=B+Math.imul(F,ut)|0,B=B+Math.imul(X,qe)|0,W=W+Math.imul(X,ut)|0;var Zt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,O=Math.imul(q,Me),B=Math.imul(q,Le),B=B+Math.imul(J,Me)|0,W=Math.imul(J,Le),O=O+Math.imul(Q,De)|0,B=B+Math.imul(Q,fe)|0,B=B+Math.imul(de,De)|0,W=W+Math.imul(de,fe)|0,O=O+Math.imul(pe,Se)|0,B=B+Math.imul(pe,Fe)|0,B=B+Math.imul(_e,Se)|0,W=W+Math.imul(_e,Fe)|0,O=O+Math.imul(le,qe)|0,B=B+Math.imul(le,ut)|0,B=B+Math.imul(oe,qe)|0,W=W+Math.imul(oe,ut)|0,O=O+Math.imul(F,Ct)|0,B=B+Math.imul(F,it)|0,B=B+Math.imul(X,Ct)|0,W=W+Math.imul(X,it)|0;var Rn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,O=Math.imul(xe,Me),B=Math.imul(xe,Le),B=B+Math.imul(be,Me)|0,W=Math.imul(be,Le),O=O+Math.imul(q,De)|0,B=B+Math.imul(q,fe)|0,B=B+Math.imul(J,De)|0,W=W+Math.imul(J,fe)|0,O=O+Math.imul(Q,Se)|0,B=B+Math.imul(Q,Fe)|0,B=B+Math.imul(de,Se)|0,W=W+Math.imul(de,Fe)|0,O=O+Math.imul(pe,qe)|0,B=B+Math.imul(pe,ut)|0,B=B+Math.imul(_e,qe)|0,W=W+Math.imul(_e,ut)|0,O=O+Math.imul(le,Ct)|0,B=B+Math.imul(le,it)|0,B=B+Math.imul(oe,Ct)|0,W=W+Math.imul(oe,it)|0,O=O+Math.imul(F,wt)|0,B=B+Math.imul(F,Yt)|0,B=B+Math.imul(X,wt)|0,W=W+Math.imul(X,Yt)|0;var Di=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Di>>>26)|0,Di&=67108863,O=Math.imul(j,Me),B=Math.imul(j,Le),B=B+Math.imul(se,Me)|0,W=Math.imul(se,Le),O=O+Math.imul(xe,De)|0,B=B+Math.imul(xe,fe)|0,B=B+Math.imul(be,De)|0,W=W+Math.imul(be,fe)|0,O=O+Math.imul(q,Se)|0,B=B+Math.imul(q,Fe)|0,B=B+Math.imul(J,Se)|0,W=W+Math.imul(J,Fe)|0,O=O+Math.imul(Q,qe)|0,B=B+Math.imul(Q,ut)|0,B=B+Math.imul(de,qe)|0,W=W+Math.imul(de,ut)|0,O=O+Math.imul(pe,Ct)|0,B=B+Math.imul(pe,it)|0,B=B+Math.imul(_e,Ct)|0,W=W+Math.imul(_e,it)|0,O=O+Math.imul(le,wt)|0,B=B+Math.imul(le,Yt)|0,B=B+Math.imul(oe,wt)|0,W=W+Math.imul(oe,Yt)|0,O=O+Math.imul(F,Vt)|0,B=B+Math.imul(F,Xt)|0,B=B+Math.imul(X,Vt)|0,W=W+Math.imul(X,Xt)|0;var qs=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(qs>>>26)|0,qs&=67108863,O=Math.imul(me,Me),B=Math.imul(me,Le),B=B+Math.imul(G,Me)|0,W=Math.imul(G,Le),O=O+Math.imul(j,De)|0,B=B+Math.imul(j,fe)|0,B=B+Math.imul(se,De)|0,W=W+Math.imul(se,fe)|0,O=O+Math.imul(xe,Se)|0,B=B+Math.imul(xe,Fe)|0,B=B+Math.imul(be,Se)|0,W=W+Math.imul(be,Fe)|0,O=O+Math.imul(q,qe)|0,B=B+Math.imul(q,ut)|0,B=B+Math.imul(J,qe)|0,W=W+Math.imul(J,ut)|0,O=O+Math.imul(Q,Ct)|0,B=B+Math.imul(Q,it)|0,B=B+Math.imul(de,Ct)|0,W=W+Math.imul(de,it)|0,O=O+Math.imul(pe,wt)|0,B=B+Math.imul(pe,Yt)|0,B=B+Math.imul(_e,wt)|0,W=W+Math.imul(_e,Yt)|0,O=O+Math.imul(le,Vt)|0,B=B+Math.imul(le,Xt)|0,B=B+Math.imul(oe,Vt)|0,W=W+Math.imul(oe,Xt)|0,O=O+Math.imul(F,ge)|0,B=B+Math.imul(F,Be)|0,B=B+Math.imul(X,ge)|0,W=W+Math.imul(X,Be)|0;var pn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(pn>>>26)|0,pn&=67108863,O=Math.imul(T,Me),B=Math.imul(T,Le),B=B+Math.imul(V,Me)|0,W=Math.imul(V,Le),O=O+Math.imul(me,De)|0,B=B+Math.imul(me,fe)|0,B=B+Math.imul(G,De)|0,W=W+Math.imul(G,fe)|0,O=O+Math.imul(j,Se)|0,B=B+Math.imul(j,Fe)|0,B=B+Math.imul(se,Se)|0,W=W+Math.imul(se,Fe)|0,O=O+Math.imul(xe,qe)|0,B=B+Math.imul(xe,ut)|0,B=B+Math.imul(be,qe)|0,W=W+Math.imul(be,ut)|0,O=O+Math.imul(q,Ct)|0,B=B+Math.imul(q,it)|0,B=B+Math.imul(J,Ct)|0,W=W+Math.imul(J,it)|0,O=O+Math.imul(Q,wt)|0,B=B+Math.imul(Q,Yt)|0,B=B+Math.imul(de,wt)|0,W=W+Math.imul(de,Yt)|0,O=O+Math.imul(pe,Vt)|0,B=B+Math.imul(pe,Xt)|0,B=B+Math.imul(_e,Vt)|0,W=W+Math.imul(_e,Xt)|0,O=O+Math.imul(le,ge)|0,B=B+Math.imul(le,Be)|0,B=B+Math.imul(oe,ge)|0,W=W+Math.imul(oe,Be)|0,O=O+Math.imul(F,Ee)|0,B=B+Math.imul(F,ze)|0,B=B+Math.imul(X,Ee)|0,W=W+Math.imul(X,ze)|0;var bt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(bt>>>26)|0,bt&=67108863,O=Math.imul(ae,Me),B=Math.imul(ae,Le),B=B+Math.imul(ie,Me)|0,W=Math.imul(ie,Le),O=O+Math.imul(T,De)|0,B=B+Math.imul(T,fe)|0,B=B+Math.imul(V,De)|0,W=W+Math.imul(V,fe)|0,O=O+Math.imul(me,Se)|0,B=B+Math.imul(me,Fe)|0,B=B+Math.imul(G,Se)|0,W=W+Math.imul(G,Fe)|0,O=O+Math.imul(j,qe)|0,B=B+Math.imul(j,ut)|0,B=B+Math.imul(se,qe)|0,W=W+Math.imul(se,ut)|0,O=O+Math.imul(xe,Ct)|0,B=B+Math.imul(xe,it)|0,B=B+Math.imul(be,Ct)|0,W=W+Math.imul(be,it)|0,O=O+Math.imul(q,wt)|0,B=B+Math.imul(q,Yt)|0,B=B+Math.imul(J,wt)|0,W=W+Math.imul(J,Yt)|0,O=O+Math.imul(Q,Vt)|0,B=B+Math.imul(Q,Xt)|0,B=B+Math.imul(de,Vt)|0,W=W+Math.imul(de,Xt)|0,O=O+Math.imul(pe,ge)|0,B=B+Math.imul(pe,Be)|0,B=B+Math.imul(_e,ge)|0,W=W+Math.imul(_e,Be)|0,O=O+Math.imul(le,Ee)|0,B=B+Math.imul(le,ze)|0,B=B+Math.imul(oe,Ee)|0,W=W+Math.imul(oe,ze)|0,O=O+Math.imul(F,Ze)|0,B=B+Math.imul(F,Je)|0,B=B+Math.imul(X,Ze)|0,W=W+Math.imul(X,Je)|0;var JA=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(JA>>>26)|0,JA&=67108863,O=Math.imul(ae,De),B=Math.imul(ae,fe),B=B+Math.imul(ie,De)|0,W=Math.imul(ie,fe),O=O+Math.imul(T,Se)|0,B=B+Math.imul(T,Fe)|0,B=B+Math.imul(V,Se)|0,W=W+Math.imul(V,Fe)|0,O=O+Math.imul(me,qe)|0,B=B+Math.imul(me,ut)|0,B=B+Math.imul(G,qe)|0,W=W+Math.imul(G,ut)|0,O=O+Math.imul(j,Ct)|0,B=B+Math.imul(j,it)|0,B=B+Math.imul(se,Ct)|0,W=W+Math.imul(se,it)|0,O=O+Math.imul(xe,wt)|0,B=B+Math.imul(xe,Yt)|0,B=B+Math.imul(be,wt)|0,W=W+Math.imul(be,Yt)|0,O=O+Math.imul(q,Vt)|0,B=B+Math.imul(q,Xt)|0,B=B+Math.imul(J,Vt)|0,W=W+Math.imul(J,Xt)|0,O=O+Math.imul(Q,ge)|0,B=B+Math.imul(Q,Be)|0,B=B+Math.imul(de,ge)|0,W=W+Math.imul(de,Be)|0,O=O+Math.imul(pe,Ee)|0,B=B+Math.imul(pe,ze)|0,B=B+Math.imul(_e,Ee)|0,W=W+Math.imul(_e,ze)|0,O=O+Math.imul(le,Ze)|0,B=B+Math.imul(le,Je)|0,B=B+Math.imul(oe,Ze)|0,W=W+Math.imul(oe,Je)|0;var Fn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,O=Math.imul(ae,Se),B=Math.imul(ae,Fe),B=B+Math.imul(ie,Se)|0,W=Math.imul(ie,Fe),O=O+Math.imul(T,qe)|0,B=B+Math.imul(T,ut)|0,B=B+Math.imul(V,qe)|0,W=W+Math.imul(V,ut)|0,O=O+Math.imul(me,Ct)|0,B=B+Math.imul(me,it)|0,B=B+Math.imul(G,Ct)|0,W=W+Math.imul(G,it)|0,O=O+Math.imul(j,wt)|0,B=B+Math.imul(j,Yt)|0,B=B+Math.imul(se,wt)|0,W=W+Math.imul(se,Yt)|0,O=O+Math.imul(xe,Vt)|0,B=B+Math.imul(xe,Xt)|0,B=B+Math.imul(be,Vt)|0,W=W+Math.imul(be,Xt)|0,O=O+Math.imul(q,ge)|0,B=B+Math.imul(q,Be)|0,B=B+Math.imul(J,ge)|0,W=W+Math.imul(J,Be)|0,O=O+Math.imul(Q,Ee)|0,B=B+Math.imul(Q,ze)|0,B=B+Math.imul(de,Ee)|0,W=W+Math.imul(de,ze)|0,O=O+Math.imul(pe,Ze)|0,B=B+Math.imul(pe,Je)|0,B=B+Math.imul(_e,Ze)|0,W=W+Math.imul(_e,Je)|0;var eo=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(eo>>>26)|0,eo&=67108863,O=Math.imul(ae,qe),B=Math.imul(ae,ut),B=B+Math.imul(ie,qe)|0,W=Math.imul(ie,ut),O=O+Math.imul(T,Ct)|0,B=B+Math.imul(T,it)|0,B=B+Math.imul(V,Ct)|0,W=W+Math.imul(V,it)|0,O=O+Math.imul(me,wt)|0,B=B+Math.imul(me,Yt)|0,B=B+Math.imul(G,wt)|0,W=W+Math.imul(G,Yt)|0,O=O+Math.imul(j,Vt)|0,B=B+Math.imul(j,Xt)|0,B=B+Math.imul(se,Vt)|0,W=W+Math.imul(se,Xt)|0,O=O+Math.imul(xe,ge)|0,B=B+Math.imul(xe,Be)|0,B=B+Math.imul(be,ge)|0,W=W+Math.imul(be,Be)|0,O=O+Math.imul(q,Ee)|0,B=B+Math.imul(q,ze)|0,B=B+Math.imul(J,Ee)|0,W=W+Math.imul(J,ze)|0,O=O+Math.imul(Q,Ze)|0,B=B+Math.imul(Q,Je)|0,B=B+Math.imul(de,Ze)|0,W=W+Math.imul(de,Je)|0;var mu=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(mu>>>26)|0,mu&=67108863,O=Math.imul(ae,Ct),B=Math.imul(ae,it),B=B+Math.imul(ie,Ct)|0,W=Math.imul(ie,it),O=O+Math.imul(T,wt)|0,B=B+Math.imul(T,Yt)|0,B=B+Math.imul(V,wt)|0,W=W+Math.imul(V,Yt)|0,O=O+Math.imul(me,Vt)|0,B=B+Math.imul(me,Xt)|0,B=B+Math.imul(G,Vt)|0,W=W+Math.imul(G,Xt)|0,O=O+Math.imul(j,ge)|0,B=B+Math.imul(j,Be)|0,B=B+Math.imul(se,ge)|0,W=W+Math.imul(se,Be)|0,O=O+Math.imul(xe,Ee)|0,B=B+Math.imul(xe,ze)|0,B=B+Math.imul(be,Ee)|0,W=W+Math.imul(be,ze)|0,O=O+Math.imul(q,Ze)|0,B=B+Math.imul(q,Je)|0,B=B+Math.imul(J,Ze)|0,W=W+Math.imul(J,Je)|0;var Ma=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Ma>>>26)|0,Ma&=67108863,O=Math.imul(ae,wt),B=Math.imul(ae,Yt),B=B+Math.imul(ie,wt)|0,W=Math.imul(ie,Yt),O=O+Math.imul(T,Vt)|0,B=B+Math.imul(T,Xt)|0,B=B+Math.imul(V,Vt)|0,W=W+Math.imul(V,Xt)|0,O=O+Math.imul(me,ge)|0,B=B+Math.imul(me,Be)|0,B=B+Math.imul(G,ge)|0,W=W+Math.imul(G,Be)|0,O=O+Math.imul(j,Ee)|0,B=B+Math.imul(j,ze)|0,B=B+Math.imul(se,Ee)|0,W=W+Math.imul(se,ze)|0,O=O+Math.imul(xe,Ze)|0,B=B+Math.imul(xe,Je)|0,B=B+Math.imul(be,Ze)|0,W=W+Math.imul(be,Je)|0;var qA=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(qA>>>26)|0,qA&=67108863,O=Math.imul(ae,Vt),B=Math.imul(ae,Xt),B=B+Math.imul(ie,Vt)|0,W=Math.imul(ie,Xt),O=O+Math.imul(T,ge)|0,B=B+Math.imul(T,Be)|0,B=B+Math.imul(V,ge)|0,W=W+Math.imul(V,Be)|0,O=O+Math.imul(me,Ee)|0,B=B+Math.imul(me,ze)|0,B=B+Math.imul(G,Ee)|0,W=W+Math.imul(G,ze)|0,O=O+Math.imul(j,Ze)|0,B=B+Math.imul(j,Je)|0,B=B+Math.imul(se,Ze)|0,W=W+Math.imul(se,Je)|0;var lr=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(lr>>>26)|0,lr&=67108863,O=Math.imul(ae,ge),B=Math.imul(ae,Be),B=B+Math.imul(ie,ge)|0,W=Math.imul(ie,Be),O=O+Math.imul(T,Ee)|0,B=B+Math.imul(T,ze)|0,B=B+Math.imul(V,Ee)|0,W=W+Math.imul(V,ze)|0,O=O+Math.imul(me,Ze)|0,B=B+Math.imul(me,Je)|0,B=B+Math.imul(G,Ze)|0,W=W+Math.imul(G,Je)|0;var to=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(to>>>26)|0,to&=67108863,O=Math.imul(ae,Ee),B=Math.imul(ae,ze),B=B+Math.imul(ie,Ee)|0,W=Math.imul(ie,ze),O=O+Math.imul(T,Ze)|0,B=B+Math.imul(T,Je)|0,B=B+Math.imul(V,Ze)|0,W=W+Math.imul(V,Je)|0;var ec=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(ec>>>26)|0,ec&=67108863,O=Math.imul(ae,Ze),B=Math.imul(ae,Je),B=B+Math.imul(ie,Ze)|0,W=Math.imul(ie,Je);var Mr=(K+O|0)+((B&8191)<<13)|0;return K=(W+(B>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,z[0]=yt,z[1]=mt,z[2]=gt,z[3]=Zt,z[4]=Rn,z[5]=Di,z[6]=qs,z[7]=pn,z[8]=bt,z[9]=JA,z[10]=Fn,z[11]=eo,z[12]=mu,z[13]=Ma,z[14]=qA,z[15]=lr,z[16]=to,z[17]=ec,z[18]=Mr,K!==0&&(z[19]=K,U.length++),U};Math.imul||(y=m);function w(I,v,E){E.negative=v.negative^I.negative,E.length=I.length+v.length;for(var U=0,P=0,L=0;L>>26)|0,P+=z>>>26,z&=67108863}E.words[L]=K,U=z,z=P}return U!==0?E.words[L]=U:E.length--,E._strip()}function x(I,v,E){return w(I,v,E)}s.prototype.mulTo=function(v,E){var U,P=this.length+v.length;return this.length===10&&v.length===10?U=y(this,v,E):P<63?U=m(this,v,E):P<1024?U=w(this,v,E):U=x(this,v,E),U},s.prototype.mul=function(v){var E=new s(null);return E.words=new Array(this.length+v.length),this.mulTo(v,E)},s.prototype.mulf=function(v){var E=new s(null);return E.words=new Array(this.length+v.length),x(this,v,E)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var E=v<0;E&&(v=-v),r(typeof v=="number"),r(v<67108864);for(var U=0,P=0;P>=26,U+=L/67108864|0,U+=z>>>26,this.words[P]=z&67108863}return U!==0&&(this.words[P]=U,this.length++),E?this.ineg():this},s.prototype.muln=function(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var E=g(v);if(E.length===0)return new s(1);for(var U=this,P=0;P=0);var E=v%26,U=(v-E)/26,P=67108863>>>26-E<<26-E,L;if(E!==0){var z=0;for(L=0;L>>26-E}z&&(this.words[L]=z,this.length++)}if(U!==0){for(L=this.length-1;L>=0;L--)this.words[L+U]=this.words[L];for(L=0;L=0);var P;E?P=(E-E%26)/26:P=0;var L=v%26,z=Math.min((v-L)/26,this.length),K=67108863^67108863>>>L<z)for(this.length-=z,B=0;B=0&&(W!==0||B>=P);B--){var ee=this.words[B]|0;this.words[B]=W<<26-L|ee>>>L,W=ee&K}return O&&W!==0&&(O.words[O.length++]=W),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,E,U){return r(this.negative===0),this.iushrn(v,E,U)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){r(typeof v=="number"&&v>=0);var E=v%26,U=(v-E)/26,P=1<=0);var E=v%26,U=(v-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=U)return this;if(E!==0&&U++,this.length=Math.min(U,this.length),E!==0){var P=67108863^67108863>>>E<=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},s.prototype.isubn=function(v){if(r(typeof v=="number"),r(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E>26)-(O/67108864|0),this.words[L+U]=z&67108863}for(;L>26,this.words[L+U]=z&67108863;if(K===0)return this._strip();for(r(K===-1),K=0,L=0;L>26,this.words[L]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,E){var U=this.length-v.length,P=this.clone(),L=v,z=L.words[L.length-1]|0,K=this._countBits(z);U=26-K,U!==0&&(L=L.ushln(U),P.iushln(U),z=L.words[L.length-1]|0);var O=P.length-L.length,B;if(E!=="mod"){B=new s(null),B.length=O+1,B.words=new Array(B.length);for(var W=0;W=0;F--){var X=(P.words[L.length+F]|0)*67108864+(P.words[L.length+F-1]|0);for(X=Math.min(X/z|0,67108863),P._ishlnsubmul(L,X,F);P.negative!==0;)X--,P.negative=0,P._ishlnsubmul(L,1,F),P.isZero()||(P.negative^=1);B&&(B.words[F]=X)}return B&&B._strip(),P._strip(),E!=="div"&&U!==0&&P.iushrn(U),{div:B||null,mod:P}},s.prototype.divmod=function(v,E,U){if(r(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var P,L,z;return this.negative!==0&&v.negative===0?(z=this.neg().divmod(v,E),E!=="mod"&&(P=z.div.neg()),E!=="div"&&(L=z.mod.neg(),U&&L.negative!==0&&L.iadd(v)),{div:P,mod:L}):this.negative===0&&v.negative!==0?(z=this.divmod(v.neg(),E),E!=="mod"&&(P=z.div.neg()),{div:P,mod:z.mod}):this.negative&v.negative?(z=this.neg().divmod(v.neg(),E),E!=="div"&&(L=z.mod.neg(),U&&L.negative!==0&&L.isub(v)),{div:z.div,mod:L}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?E==="div"?{div:this.divn(v.words[0]),mod:null}:E==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,E)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var E=this.divmod(v);if(E.mod.isZero())return E.div;var U=E.div.negative!==0?E.mod.isub(v):E.mod,P=v.ushrn(1),L=v.andln(1),z=U.cmp(P);return z<0||L===1&&z===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},s.prototype.modrn=function(v){var E=v<0;E&&(v=-v),r(v<=67108863);for(var U=(1<<26)%v,P=0,L=this.length-1;L>=0;L--)P=(U*P+(this.words[L]|0))%v;return E?-P:P},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var E=v<0;E&&(v=-v),r(v<=67108863);for(var U=0,P=this.length-1;P>=0;P--){var L=(this.words[P]|0)+U*67108864;this.words[P]=L/v|0,U=L%v}return this._strip(),E?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){r(v.negative===0),r(!v.isZero());var E=this,U=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var P=new s(1),L=new s(0),z=new s(0),K=new s(1),O=0;E.isEven()&&U.isEven();)E.iushrn(1),U.iushrn(1),++O;for(var B=U.clone(),W=E.clone();!E.isZero();){for(var ee=0,F=1;!(E.words[0]&F)&&ee<26;++ee,F<<=1);if(ee>0)for(E.iushrn(ee);ee-- >0;)(P.isOdd()||L.isOdd())&&(P.iadd(B),L.isub(W)),P.iushrn(1),L.iushrn(1);for(var X=0,ue=1;!(U.words[0]&ue)&&X<26;++X,ue<<=1);if(X>0)for(U.iushrn(X);X-- >0;)(z.isOdd()||K.isOdd())&&(z.iadd(B),K.isub(W)),z.iushrn(1),K.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(z),L.isub(K)):(U.isub(E),z.isub(P),K.isub(L))}return{a:z,b:K,gcd:U.iushln(O)}},s.prototype._invmp=function(v){r(v.negative===0),r(!v.isZero());var E=this,U=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var P=new s(1),L=new s(0),z=U.clone();E.cmpn(1)>0&&U.cmpn(1)>0;){for(var K=0,O=1;!(E.words[0]&O)&&K<26;++K,O<<=1);if(K>0)for(E.iushrn(K);K-- >0;)P.isOdd()&&P.iadd(z),P.iushrn(1);for(var B=0,W=1;!(U.words[0]&W)&&B<26;++B,W<<=1);if(B>0)for(U.iushrn(B);B-- >0;)L.isOdd()&&L.iadd(z),L.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(L)):(U.isub(E),L.isub(P))}var ee;return E.cmpn(1)===0?ee=P:ee=L,ee.cmpn(0)<0&&ee.iadd(v),ee},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var E=this.clone(),U=v.clone();E.negative=0,U.negative=0;for(var P=0;E.isEven()&&U.isEven();P++)E.iushrn(1),U.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;U.isEven();)U.iushrn(1);var L=E.cmp(U);if(L<0){var z=E;E=U,U=z}else if(L===0||U.cmpn(1)===0)break;E.isub(U)}while(!0);return U.iushln(P)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){r(typeof v=="number");var E=v%26,U=(v-E)/26,P=1<>>26,K&=67108863,this.words[z]=K}return L!==0&&(this.words[z]=L,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var E=v<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this._strip();var U;if(this.length>1)U=1;else{E&&(v=-v),r(v<=67108863,"Number is too big");var P=this.words[0]|0;U=P===v?0:Pv.length)return 1;if(this.length=0;U--){var P=this.words[U]|0,L=v.words[U]|0;if(P!==L){PL&&(E=1);break}}return E},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new $(v)},s.prototype.toRed=function(v){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return r(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},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(v){return r(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var _={k256:null,p224:null,p192:null,p25519:null};function C(I,v){this.name=I,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}C.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},C.prototype.ireduce=function(v){var E=v,U;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),U=E.bitLength();while(U>this.n);var P=U0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},C.prototype.split=function(v,E){v.iushrn(this.n,0,E)},C.prototype.imulK=function(v){return v.imul(this.k)};function S(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(S,C),S.prototype.split=function(v,E){for(var U=4194303,P=Math.min(v.length,9),L=0;L>>22,z=K}z>>>=22,v.words[L-10]=z,z===0&&v.length>10?v.length-=10:v.length-=9},S.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var E=0,U=0;U>>=26,v.words[U]=L,E=P}return E!==0&&(v.words[v.length++]=E),v},s._prime=function(v){if(_[v])return _[v];var E;if(v==="k256")E=new S;else if(v==="p224")E=new b;else if(v==="p192")E=new M;else if(v==="p25519")E=new D;else throw new Error("Unknown prime "+v);return _[v]=E,E};function $(I){if(typeof I=="string"){var v=s._prime(I);this.m=v.p,this.prime=v}else r(I.gtn(1),"modulus must be greater than 1"),this.m=I,this.prime=null}$.prototype._verify1=function(v){r(v.negative===0,"red works only with positives"),r(v.red,"red works only with red numbers")},$.prototype._verify2=function(v,E){r((v.negative|E.negative)===0,"red works only with positives"),r(v.red&&v.red===E.red,"red works only with red numbers")},$.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(c(v,v.umod(this.m)._forceRed(this)),v)},$.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},$.prototype.add=function(v,E){this._verify2(v,E);var U=v.add(E);return U.cmp(this.m)>=0&&U.isub(this.m),U._forceRed(this)},$.prototype.iadd=function(v,E){this._verify2(v,E);var U=v.iadd(E);return U.cmp(this.m)>=0&&U.isub(this.m),U},$.prototype.sub=function(v,E){this._verify2(v,E);var U=v.sub(E);return U.cmpn(0)<0&&U.iadd(this.m),U._forceRed(this)},$.prototype.isub=function(v,E){this._verify2(v,E);var U=v.isub(E);return U.cmpn(0)<0&&U.iadd(this.m),U},$.prototype.shl=function(v,E){return this._verify1(v),this.imod(v.ushln(E))},$.prototype.imul=function(v,E){return this._verify2(v,E),this.imod(v.imul(E))},$.prototype.mul=function(v,E){return this._verify2(v,E),this.imod(v.mul(E))},$.prototype.isqr=function(v){return this.imul(v,v.clone())},$.prototype.sqr=function(v){return this.mul(v,v)},$.prototype.sqrt=function(v){if(v.isZero())return v.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var U=this.m.add(new s(1)).iushrn(2);return this.pow(v,U)}for(var P=this.m.subn(1),L=0;!P.isZero()&&P.andln(1)===0;)L++,P.iushrn(1);r(!P.isZero());var z=new s(1).toRed(this),K=z.redNeg(),O=this.m.subn(1).iushrn(1),B=this.m.bitLength();for(B=new s(2*B*B).toRed(this);this.pow(B,O).cmp(K)!==0;)B.redIAdd(K);for(var W=this.pow(B,P),ee=this.pow(v,P.addn(1).iushrn(1)),F=this.pow(v,P),X=L;F.cmp(z)!==0;){for(var ue=F,le=0;ue.cmp(z)!==0;le++)ue=ue.redSqr();r(le=0;L--){for(var W=E.words[L],ee=B-1;ee>=0;ee--){var F=W>>ee&1;if(z!==P[0]&&(z=this.sqr(z)),F===0&&K===0){O=0;continue}K<<=1,K|=F,O++,!(O!==U&&(L!==0||ee!==0))&&(z=this.mul(z,P[K]),O=0,K=0)}B=26}return z},$.prototype.convertTo=function(v){var E=v.umod(this.m);return E===v?E.clone():E},$.prototype.convertFrom=function(v){var E=v.clone();return E.red=null,E},s.mont=function(v){return new H(v)};function H(I){$.call(this,I),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(H,$),H.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},H.prototype.convertFrom=function(v){var E=this.imod(v.mul(this.rinv));return E.red=null,E},H.prototype.imul=function(v,E){if(v.isZero()||E.isZero())return v.words[0]=0,v.length=1,v;var U=v.imul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=U.isub(P).iushrn(this.shift),z=L;return L.cmp(this.m)>=0?z=L.isub(this.m):L.cmpn(0)<0&&(z=L.iadd(this.m)),z._forceRed(this)},H.prototype.mul=function(v,E){if(v.isZero()||E.isZero())return new s(0)._forceRed(this);var U=v.mul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=U.isub(P).iushrn(this.shift),z=L;return L.cmp(this.m)>=0?z=L.isub(this.m):L.cmpn(0)<0&&(z=L.iadd(this.m)),z._forceRed(this)},H.prototype.invm=function(v){var E=this.imod(v._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(n,ta)})(MS);var EG=MS.exports;const vt=bl(EG),CG="logger/5.7.0";let L2=!1,P2=!1;const kv={debug:1,default:2,info:2,warning:3,error:4,off:5};let D2=kv.default,D_=null;function SG(){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 O2=SG();var OB;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(OB||(OB={}));var po;(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"})(po||(po={}));const N2="0123456789abcdef";let ve=class cr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();kv[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(D2>kv[r])&&console.log.apply(console,t)}debug(...e){this._log(cr.levels.DEBUG,e)}info(...e){this._log(cr.levels.INFO,e)}warn(...e){this._log(cr.levels.WARNING,e)}makeError(e,t,r){if(P2)return this.makeError("censored error",t,{});t||(t=cr.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+=N2[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 po.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 po.CALL_EXCEPTION:case po.INSUFFICIENT_FUNDS:case po.MISSING_NEW:case po.NONCE_EXPIRED:case po.REPLACEMENT_UNDERPRICED:case po.TRANSACTION_REPLACED:case po.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,cr.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){O2&&this.throwError("platform missing String.prototype.normalize",cr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:O2})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,cr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,cr.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,cr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",cr.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",cr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",cr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return D_||(D_=new cr(CG)),D_}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",cr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),L2){if(!e)return;this.globalLogger().throwError("error censorship permanent",cr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}P2=!!e,L2=!!t}static setLogLevel(e){const t=kv[e.toLowerCase()];if(t==null){cr.globalLogger().warn("invalid log level - "+e);return}D2=t}static from(e){return new cr(e)}};ve.errors=po;ve.levels=OB;const MG="bytes/5.7.0",Pn=new ve(MG);function YO(n){return!!n.toHexString}function Xf(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return Xf(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function TS(n){return Et(n)&&!(n.length%2)||Ax(n)}function k2(n){return typeof n=="number"&&n==n&&n%1===0}function Ax(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!k2(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"){Pn.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),Xf(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),YO(n)&&(n=n.toHexString()),Et(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Pn.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),Xf(r)}function mh(n){let e=at(n);if(e.length===0)return e;let t=0;for(;te&&Pn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),Xf(t)}function Et(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const O_="0123456789abcdef";function nt(n,e){if(e||(e={}),typeof n=="number"){Pn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=O_[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),YO(n))return n.toHexString();if(Et(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Pn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(Ax(n)){let t="0x";for(let r=0;r>4]+O_[i&15]}return t}return Pn.throwArgumentError("invalid hexlify value","value",n)}function kc(n){if(typeof n!="string")n=nt(n);else if(!Et(n)||n.length%2)return null;return(n.length-2)/2}function zr(n,e,t){return typeof n!="string"?n=nt(n):(!Et(n)||n.length%2)&&Pn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function _i(n){let e="0x";return n.forEach(t=>{e+=nt(t).substring(2)}),e}function cx(n){const e=IG(nt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function IG(n){typeof n!="string"&&(n=nt(n)),Et(n)||Pn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Pn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function ux(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(TS(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]):Pn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Pn.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=TG(at(e._vs),32);e._vs=nt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Pn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=nt(i);e.s==null?e.s=o:e.s!==o&&Pn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Pn.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&&Pn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Et(e.r)?Pn.throwArgumentError("signature missing or invalid r","signature",n):e.r=kn(e.r,32),e.s==null||!Et(e.s)?Pn.throwArgumentError("signature missing or invalid s","signature",n):e.s=kn(e.s,32);const t=at(e.s);t[0]>=128&&Pn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=nt(t);e._vs&&(Et(e._vs)||Pn.throwArgumentError("signature invalid _vs","signature",n),e._vs=kn(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Pn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const RG="bignumber/5.7.0";var Sy=vt.BN;const ja=new ve(RG),N_={},Q2=9007199254740991;let H2=!1;class Ge{constructor(e,t){e!==N_&&ja.throwError("cannot call constructor directly; use BigNumber.from",ve.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return mi(Mt(this).fromTwos(e))}toTwos(e){return mi(Mt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ge.from(this._hex.substring(1)):this}add(e){return mi(Mt(this).add(Mt(e)))}sub(e){return mi(Mt(this).sub(Mt(e)))}div(e){return Ge.from(e).isZero()&&ms("division-by-zero","div"),mi(Mt(this).div(Mt(e)))}mul(e){return mi(Mt(this).mul(Mt(e)))}mod(e){const t=Mt(e);return t.isNeg()&&ms("division-by-zero","mod"),mi(Mt(this).umod(t))}pow(e){const t=Mt(e);return t.isNeg()&&ms("negative-power","pow"),mi(Mt(this).pow(t))}and(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","and"),mi(Mt(this).and(t))}or(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","or"),mi(Mt(this).or(t))}xor(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","xor"),mi(Mt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ms("negative-width","mask"),mi(Mt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ms("negative-width","shl"),mi(Mt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ms("negative-width","shr"),mi(Mt(this).shrn(e))}eq(e){return Mt(this).eq(Mt(e))}lt(e){return Mt(this).lt(Mt(e))}lte(e){return Mt(this).lte(Mt(e))}gt(e){return Mt(this).gt(Mt(e))}gte(e){return Mt(this).gte(Mt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Mt(this).isZero()}toNumber(){try{return Mt(this).toNumber()}catch{ms("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ja.throwError("this platform does not support BigInt",ve.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?H2||(H2=!0,ja.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ja.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ve.errors.UNEXPECTED_ARGUMENT,{}):ja.throwError("BigNumber.toString does not accept parameters",ve.errors.UNEXPECTED_ARGUMENT,{})),Mt(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(N_,lm(e)):e.match(/^-?[0-9]+$/)?new Ge(N_,lm(new Sy(e))):ja.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&ms("underflow","BigNumber.from",e),(e>=Q2||e<=-Q2)&&ms("overflow","BigNumber.from",e),Ge.from(String(e));const t=e;if(typeof t=="bigint")return Ge.from(t.toString());if(Ax(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"&&(Et(r)||r[0]==="-"&&Et(r.substring(1))))return Ge.from(r)}return ja.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function lm(n){if(typeof n!="string")return lm(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&ja.throwArgumentError("invalid hex","value",n),n=lm(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 mi(n){return Ge.from(lm(n))}function Mt(n){const e=Ge.from(n).toHexString();return e[0]==="-"?new Sy("-"+e.substring(3),16):new Sy(e.substring(2),16)}function ms(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),ja.throwError(n,ve.errors.NUMERIC_FAULT,r)}function FG(n){return new Sy(n,36).toString(16)}const UG="properties/5.7.0";var LG=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 My=new ve(UG);function Ue(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function Ji(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 LG(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 PG(n,e){(!n||typeof n!="object")&&My.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||My.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function wn(n){const e={};for(const t in n)e[t]=n[t];return e}const DG={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function XO(n){if(n==null||DG[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;tts(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Ue(e,t,ts(r))}return e}return My.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function ts(n){return OG(n)}class og{constructor(e){for(const t in e)this[t]=ts(e[t])}}const NG="abstract-provider/5.7.0";var kG=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 QG=new ve(NG);class HG extends og{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class ag{constructor(){QG.checkAbstract(new.target,ag),Ue(this,"_isProvider",!0)}getFeeData(){return kG(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 zG="networks/5.7.1",z2=new ve(zG);function GG(n){return n&&typeof n.renetwork=="function"}function Ya(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 Ya(t)},e}function Ty(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return Ty(n,r)},t}const G2={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Ya("homestead")},V2={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Ya("ropsten")},j2={chainId:63,name:"classicMordor",_defaultProvider:Ty("https://www.ethercluster.com/mordor","classicMordor")},Qg={unspecified:{chainId:0,name:"unspecified"},homestead:G2,mainnet:G2,morden:{chainId:2,name:"morden"},ropsten:V2,testnet:V2,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Ya("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Ya("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Ya("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Ya("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Ty("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:j2,classicTestnet:j2,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Ty("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Ya("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Ya("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 ZO(n){if(n==null)return null;if(typeof n=="number"){for(const r in Qg){const i=Qg[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=Qg[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=Qg[n.name];if(!e)return typeof n.chainId!="number"&&z2.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&z2.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(GG(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 JO(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=ue>>5,this.extraBytes=(ue&31)>>3;for(var le=0;le<50;++le)this.s[le]=0}B.prototype.update=function(F){if(this.finalized)throw new Error(t);var X,ue=typeof F;if(ue!=="string"){if(ue==="object"){if(F===null)throw new Error(e);if(l&&F.constructor===ArrayBuffer)F=new Uint8Array(F);else if(!Array.isArray(F)&&(!l||!ArrayBuffer.isView(F)))throw new Error(e)}else throw new Error(e);X=!0}for(var le=this.blocks,oe=this.byteCount,re=F.length,pe=this.blockCount,_e=0,Re=this.s,Q,de;_e>2]|=F[_e]<>2]|=de<>2]|=(192|de>>6)<>2]|=(128|de&63)<=57344?(le[Q>>2]|=(224|de>>12)<>2]|=(128|de>>6&63)<>2]|=(128|de&63)<>2]|=(240|de>>18)<>2]|=(128|de>>12&63)<>2]|=(128|de>>6&63)<>2]|=(128|de&63)<=oe){for(this.start=Q-oe,this.block=le[pe],Q=0;Q>8,ue=F&255;ue>0;)oe.unshift(ue),F=F>>8,ue=F&255,++le;return X?oe.push(le):oe.unshift(le),this.update(oe),oe.length},B.prototype.encodeString=function(F){var X,ue=typeof F;if(ue!=="string"){if(ue==="object"){if(F===null)throw new Error(e);if(l&&F.constructor===ArrayBuffer)F=new Uint8Array(F);else if(!Array.isArray(F)&&(!l||!ArrayBuffer.isView(F)))throw new Error(e)}else throw new Error(e);X=!0}var le=0,oe=F.length;if(X)le=oe;else for(var re=0;re=57344?le+=3:(pe=65536+((pe&1023)<<10|F.charCodeAt(++re)&1023),le+=4)}return le+=this.encode(le*8),this.update(F),le},B.prototype.bytepad=function(F,X){for(var ue=this.encode(X),le=0;le>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(F[0]=F[ue],X=1;X>4&15]+A[_e&15]+A[_e>>12&15]+A[_e>>8&15]+A[_e>>20&15]+A[_e>>16&15]+A[_e>>28&15]+A[_e>>24&15];re%F===0&&(ee(X),oe=0)}return le&&(_e=X[oe],pe+=A[_e>>4&15]+A[_e&15],le>1&&(pe+=A[_e>>12&15]+A[_e>>8&15]),le>2&&(pe+=A[_e>>20&15]+A[_e>>16&15])),pe},B.prototype.arrayBuffer=function(){this.finalize();var F=this.blockCount,X=this.s,ue=this.outputBlocks,le=this.extraBytes,oe=0,re=0,pe=this.outputBits>>3,_e;le?_e=new ArrayBuffer(ue+1<<2):_e=new ArrayBuffer(pe);for(var Re=new Uint32Array(_e);re>8&255,pe[_e+2]=Re>>16&255,pe[_e+3]=Re>>24&255;re%F===0&&ee(X)}return le&&(_e=re<<2,Re=X[oe],pe[_e]=Re&255,le>1&&(pe[_e+1]=Re>>8&255),le>2&&(pe[_e+2]=Re>>16&255)),pe};function W(F,X,ue){B.call(this,F,X,ue)}W.prototype=new B,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),B.prototype.finalize.call(this)};var ee=function(F){var X,ue,le,oe,re,pe,_e,Re,Q,de,Ae,q,J,ce,xe,be,N,j,se,he,me,G,R,T,V,te,ae,ie,Te,Me,Le,ke,De,fe,Ce,Se,Fe,We,qe,ct,sn,Ct,it,ar,wt,Yt,Js,Vt,Xt,ne,ge,Be,we,Ee,ze,st,Ze,Je,yt,mt,gt,Zt,Rn;for(le=0;le<48;le+=2)oe=F[0]^F[10]^F[20]^F[30]^F[40],re=F[1]^F[11]^F[21]^F[31]^F[41],pe=F[2]^F[12]^F[22]^F[32]^F[42],_e=F[3]^F[13]^F[23]^F[33]^F[43],Re=F[4]^F[14]^F[24]^F[34]^F[44],Q=F[5]^F[15]^F[25]^F[35]^F[45],de=F[6]^F[16]^F[26]^F[36]^F[46],Ae=F[7]^F[17]^F[27]^F[37]^F[47],q=F[8]^F[18]^F[28]^F[38]^F[48],J=F[9]^F[19]^F[29]^F[39]^F[49],X=q^(pe<<1|_e>>>31),ue=J^(_e<<1|pe>>>31),F[0]^=X,F[1]^=ue,F[10]^=X,F[11]^=ue,F[20]^=X,F[21]^=ue,F[30]^=X,F[31]^=ue,F[40]^=X,F[41]^=ue,X=oe^(Re<<1|Q>>>31),ue=re^(Q<<1|Re>>>31),F[2]^=X,F[3]^=ue,F[12]^=X,F[13]^=ue,F[22]^=X,F[23]^=ue,F[32]^=X,F[33]^=ue,F[42]^=X,F[43]^=ue,X=pe^(de<<1|Ae>>>31),ue=_e^(Ae<<1|de>>>31),F[4]^=X,F[5]^=ue,F[14]^=X,F[15]^=ue,F[24]^=X,F[25]^=ue,F[34]^=X,F[35]^=ue,F[44]^=X,F[45]^=ue,X=Re^(q<<1|J>>>31),ue=Q^(J<<1|q>>>31),F[6]^=X,F[7]^=ue,F[16]^=X,F[17]^=ue,F[26]^=X,F[27]^=ue,F[36]^=X,F[37]^=ue,F[46]^=X,F[47]^=ue,X=de^(oe<<1|re>>>31),ue=Ae^(re<<1|oe>>>31),F[8]^=X,F[9]^=ue,F[18]^=X,F[19]^=ue,F[28]^=X,F[29]^=ue,F[38]^=X,F[39]^=ue,F[48]^=X,F[49]^=ue,ce=F[0],xe=F[1],Yt=F[11]<<4|F[10]>>>28,Js=F[10]<<4|F[11]>>>28,ie=F[20]<<3|F[21]>>>29,Te=F[21]<<3|F[20]>>>29,mt=F[31]<<9|F[30]>>>23,gt=F[30]<<9|F[31]>>>23,Ct=F[40]<<18|F[41]>>>14,it=F[41]<<18|F[40]>>>14,fe=F[2]<<1|F[3]>>>31,Ce=F[3]<<1|F[2]>>>31,be=F[13]<<12|F[12]>>>20,N=F[12]<<12|F[13]>>>20,Vt=F[22]<<10|F[23]>>>22,Xt=F[23]<<10|F[22]>>>22,Me=F[33]<<13|F[32]>>>19,Le=F[32]<<13|F[33]>>>19,Zt=F[42]<<2|F[43]>>>30,Rn=F[43]<<2|F[42]>>>30,Ee=F[5]<<30|F[4]>>>2,ze=F[4]<<30|F[5]>>>2,Se=F[14]<<6|F[15]>>>26,Fe=F[15]<<6|F[14]>>>26,j=F[25]<<11|F[24]>>>21,se=F[24]<<11|F[25]>>>21,ne=F[34]<<15|F[35]>>>17,ge=F[35]<<15|F[34]>>>17,ke=F[45]<<29|F[44]>>>3,De=F[44]<<29|F[45]>>>3,T=F[6]<<28|F[7]>>>4,V=F[7]<<28|F[6]>>>4,st=F[17]<<23|F[16]>>>9,Ze=F[16]<<23|F[17]>>>9,We=F[26]<<25|F[27]>>>7,qe=F[27]<<25|F[26]>>>7,he=F[36]<<21|F[37]>>>11,me=F[37]<<21|F[36]>>>11,Be=F[47]<<24|F[46]>>>8,we=F[46]<<24|F[47]>>>8,ar=F[8]<<27|F[9]>>>5,wt=F[9]<<27|F[8]>>>5,te=F[18]<<20|F[19]>>>12,ae=F[19]<<20|F[18]>>>12,Je=F[29]<<7|F[28]>>>25,yt=F[28]<<7|F[29]>>>25,ct=F[38]<<8|F[39]>>>24,sn=F[39]<<8|F[38]>>>24,G=F[48]<<14|F[49]>>>18,R=F[49]<<14|F[48]>>>18,F[0]=ce^~be&j,F[1]=xe^~N&se,F[10]=T^~te&ie,F[11]=V^~ae&Te,F[20]=fe^~Se&We,F[21]=Ce^~Fe&qe,F[30]=ar^~Yt&Vt,F[31]=wt^~Js&Xt,F[40]=Ee^~st&Je,F[41]=ze^~Ze&yt,F[2]=be^~j&he,F[3]=N^~se&me,F[12]=te^~ie&Me,F[13]=ae^~Te&Le,F[22]=Se^~We&ct,F[23]=Fe^~qe&sn,F[32]=Yt^~Vt&ne,F[33]=Js^~Xt&ge,F[42]=st^~Je&mt,F[43]=Ze^~yt>,F[4]=j^~he&G,F[5]=se^~me&R,F[14]=ie^~Me&ke,F[15]=Te^~Le&De,F[24]=We^~ct&Ct,F[25]=qe^~sn&it,F[34]=Vt^~ne&Be,F[35]=Xt^~ge&we,F[44]=Je^~mt&Zt,F[45]=yt^~gt&Rn,F[6]=he^~G&ce,F[7]=me^~R&xe,F[16]=Me^~ke&T,F[17]=Le^~De&V,F[26]=ct^~Ct&fe,F[27]=sn^~it&Ce,F[36]=ne^~Be&ar,F[37]=ge^~we&wt,F[46]=mt^~Zt&Ee,F[47]=gt^~Rn&ze,F[8]=G^~ce&be,F[9]=R^~xe&N,F[18]=ke^~T&te,F[19]=De^~V&ae,F[28]=Ct^~fe&Se,F[29]=it^~Ce&Fe,F[38]=Be^~ar&Yt,F[39]=we^~wt&Js,F[48]=Zt^~Ee&st,F[49]=Rn^~ze&Ze,F[0]^=d[le],F[1]^=d[le+1]};if(a)n.exports=v;else for(U=0;U>6===2;o++)s++;return s}return n===Wi.OVERRUN?t.length-e-1:0}function qG(n,e,t,r,i){return n===Wi.OVERLONG?(r.push(i),0):(r.push(65533),iN(n,e,t))}const eV=Object.freeze({error:JG,ignore:iN,replace:qG});function sN(n,e){e==null&&(e=eV.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(Wi.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(Wi.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(Wi.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(Wi.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(Wi.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(Wi.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function ua(n,e=Am.current){e!=Am.current&&(rN.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 tV(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function lg(n,e){return tV(sN(n,e))}function nV(n,e=Am.current){return sN(ua(n,e))}function bf(n){return rr(ua(n))}const oN="hash/5.7.0";function aN(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 rV(n){const e={};for(let t=0;t>--l&1}const u=31,f=Math.pow(2,u),h=f>>>1,p=h>>1,d=f-1;let g=0;for(let _=0;_1;){let D=C+S>>>1;_>>1|c(),b=b<<1^h,M=(M^h)<<1|h|1;y=b,w=1+M-b}let x=r-4;return m.map(_=>{switch(_-x){case 3:return x+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return x+256+(n[a++]<<8|n[a++]);case 1:return x+n[a++];default:return _-1}})}function sV(n){let e=0;return()=>n[e++]}function oV(n){return sV(iV(n))}function aV(n){return n&1?~n>>1:n>>1}function lV(n,e){let t=Array(n);for(let r=0;re[o]):t}function cV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(fV(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(hV(t,n))}return rV(aN(e))}function uV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function lN(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function fV(n,e){let t=1+e(),r=e(),i=uV(e),s=lN(i.length,1+n,e);return aN(s.map((o,a)=>{const l=o[0],A=o.slice(1);return Array(i[a]).fill(void 0).map((c,u)=>{let f=u*r;return[l+u*t,A.map(h=>h+f)]})}))}function hV(n,e){let t=1+e();return lN(t,1+n,e).map(i=>[i[0],i.slice(1)])}function dV(n){let e=Iy(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let A=Iy(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 pV(){return oV(JO("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const fx=pV(),mV=new Set(Iy(fx)),gV=new Set(Iy(fx)),vV=cV(fx),yV=dV(fx),K2=45,$2=95;function AN(n){return nV(n)}function wV(n){return n.filter(e=>e!=65039)}function cN(n){for(let e of n.split(".")){let t=AN(e);try{for(let r=t.lastIndexOf($2)-1;r>=0;r--)if(t[r]!==$2)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===K2&&t[3]===K2)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function xV(n){return cN(_V(n,wV))}function _V(n,e){let t=AN(n).reverse(),r=[];for(;t.length;){let i=BV(t);if(i){r.push(...e(i));continue}let s=t.pop();if(mV.has(s)){r.push(s);continue}if(gV.has(s))continue;let o=vV[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return cN(bV(String.fromCodePoint(...r)))}function bV(n){return n.normalize("NFC")}function BV(n,e){var t;let r=yV,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 EV=new ve(oN),uN=new Uint8Array(32);uN.fill(0);function Y2(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function fN(n){const e=ua(xV(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(Y2(e.slice(r))),t}function Qv(n){typeof n!="string"&&EV.throwArgumentError("invalid ENS name; not a string","name",n);let e=uN;const t=fN(n);for(;t.length;)e=rr(Zi([e,rr(t.pop())]));return nt(e)}function CV(n){return nt(Zi(fN(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 SV="rlp/5.7.0",Go=new ve(SV);function X2(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function Z2(n,e,t){let r=0;for(let i=0;ie+1+r&&Go.throwError("child data too short",ve.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function dN(n,e){if(n.length===0&&Go.throwError("data too short",ve.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Go.throwError("data short segment too short",ve.errors.BUFFER_OVERRUN,{});const r=Z2(n,e+1,t);return e+1+t+r>n.length&&Go.throwError("data long segment too short",ve.errors.BUFFER_OVERRUN,{}),J2(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&Go.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{}),J2(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&Go.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{});const r=Z2(n,e+1,t);e+1+t+r>n.length&&Go.throwError("data array too short",ve.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&&Go.throwError("data too short",ve.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 IS(n){const e=at(n),t=dN(e,0);return t.consumed!==e.length&&Go.throwArgumentError("invalid rlp data","data",n),t.result}const MV="address/5.7.0",Bf=new ve(MV);function q2(n){Et(n,20)||Bf.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(rr(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 TV=9007199254740991;function IV(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const RS={};for(let n=0;n<10;n++)RS[String(n)]=String(n);for(let n=0;n<26;n++)RS[String.fromCharCode(65+n)]=String(10+n);const eI=Math.floor(IV(TV));function RV(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>RS[r]).join("");for(;e.length>=eI;){let r=e.substring(0,eI);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 Dr(n){let e=null;if(typeof n!="string"&&Bf.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=q2(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&Bf.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)!==RV(n)&&Bf.throwArgumentError("bad icap checksum","address",n),e=FG(n.substring(4));e.length<40;)e="0"+e;e=q2("0x"+e)}else Bf.throwArgumentError("invalid address","address",n);return e}function pN(n){let e=null;try{e=Dr(n.from)}catch{Bf.throwArgumentError("missing from address","transaction",n)}const t=mh(at(Ge.from(n.nonce).toHexString()));return Dr(zr(rr(hx([e,t])),12))}var FV=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 Bn=new ve(oN),mN=new Uint8Array(32);mN.fill(0);const UV=Ge.from(-1),gN=Ge.from(0),vN=Ge.from(1),LV=Ge.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function PV(n){const e=at(n),t=e.length%32;return t?_i([e,mN.slice(t)]):nt(e)}const DV=kn(vN.toHexString(),32),OV=kn(gN.toHexString(),32),tI={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},k_=["name","version","chainId","verifyingContract","salt"];function nI(n){return function(e){return typeof e!="string"&&Bn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const NV={name:nI("name"),version:nI("version"),chainId:function(n){try{return Ge.from(n).toString()}catch{}return Bn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return Dr(n).toLowerCase()}catch{}return Bn.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 Bn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function Q_(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))&&Bn.throwArgumentError("invalid numeric width","type",n);const i=LV.mask(t?r-1:r),s=t?i.add(vN).mul(UV):gN;return function(o){const a=Ge.from(o);return(a.lt(s)||a.gt(i))&&Bn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),kn(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))&&Bn.throwArgumentError("invalid bytes width","type",n),function(r){return at(r).length!==t&&Bn.throwArgumentError(`invalid length for ${n}`,"value",r),PV(r)}}}switch(n){case"address":return function(e){return kn(Dr(e),32)};case"bool":return function(e){return e?DV:OV};case"bytes":return function(e){return rr(e)};case"string":return function(e){return bf(e)}}return null}function rI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class Gi{constructor(e){Ue(this,"types",Object.freeze(ts(e))),Ue(this,"_encoderCache",{}),Ue(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]&&Bn.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&&Bn.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!Q_(c)&&(r[c]||Bn.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?Bn.throwArgumentError("missing primary type","types",e):s.length>1&&Bn.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Ue(this,"primaryType",s[0]);function o(a,l){l[a]&&Bn.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]=rI(a,e[a])+l.map(A=>rI(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=Q_(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&&Bn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(rr)),rr(_i(l))}}const r=this.types[e];if(r){const i=bf(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const A=this.getEncoder(l)(s[a]);return this._types[l]?rr(A):A});return o.unshift(i),_i(o)}}return Bn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Bn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return rr(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(Q_(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&&Bn.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),{}):Bn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Gi(e)}static getPrimaryType(e){return Gi.from(e).primaryType}static hashStruct(e,t,r){return Gi.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=tI[r];i||Bn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>k_.indexOf(r.name)-k_.indexOf(i.name)),Gi.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return _i(["0x1901",Gi.hashDomain(e),Gi.from(t).hash(r)])}static hash(e,t,r){return rr(Gi.encode(e,t,r))}static resolveNames(e,t,r,i){return FV(this,void 0,void 0,function*(){e=wn(e);const s={};e.verifyingContract&&!Et(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=Gi.from(t);o.visit(r,(a,l)=>(a==="address"&&!Et(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){Gi.hashDomain(e);const i={},s=[];k_.forEach(l=>{const A=e[l];A!=null&&(i[l]=NV[l](A),s.push({name:l,type:tI[l]}))});const o=Gi.from(t),a=wn(t);return a.EIP712Domain?Bn.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"&&Bn.throwArgumentError("invalid string","value",A),A}return Bn.throwArgumentError("unsupported type","type",l)})}}}var yN={},Ft={},Ag=wN;function wN(n,e){if(!n)throw new Error(e||"Assertion failed")}wN.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var kB={exports:{}};typeof Object.create=="function"?kB.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:kB.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 kV=kB.exports,QV=Ag,HV=kV;Ft.inherits=HV;function zV(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function GV(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):zV(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}Ft.htonl=xN;function jV(n,e){for(var t="",r=0;r>>0}return s}Ft.join32=WV;function KV(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}Ft.split32=KV;function $V(n,e){return n>>>e|n<<32-e}Ft.rotr32=$V;function YV(n,e){return n<>>32-e}Ft.rotl32=YV;function XV(n,e){return n+e>>>0}Ft.sum32=XV;function ZV(n,e,t){return n+e+t>>>0}Ft.sum32_3=ZV;function JV(n,e,t,r){return n+e+t+r>>>0}Ft.sum32_4=JV;function qV(n,e,t,r,i){return n+e+t+r+i>>>0}Ft.sum32_5=qV;function ej(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}Ft.sum64=ej;function tj(n,e,t,r){var i=e+r>>>0,s=(i>>0}Ft.sum64_hi=tj;function nj(n,e,t,r){var i=e+r;return i>>>0}Ft.sum64_lo=nj;function rj(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}Ft.sum64_4_hi=rj;function ij(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Ft.sum64_4_lo=ij;function sj(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}Ft.sum64_5_hi=sj;function oj(n,e,t,r,i,s,o,a,l,A){var c=e+r+s+a+A;return c>>>0}Ft.sum64_5_lo=oj;function aj(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Ft.rotr64_hi=aj;function lj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.rotr64_lo=lj;function Aj(n,e,t){return n>>>t}Ft.shr64_hi=Aj;function cj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.shr64_lo=cj;var jh={},iI=Ft,uj=Ag;function dx(){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}jh.BlockHash=dx;dx.prototype.update=function(e,t){if(e=iI.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=iI.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}xa.g0_256=mj;function gj(n){return ia(n,17)^ia(n,19)^n>>>10}xa.g1_256=gj;var gh=Ft,vj=jh,yj=xa,H_=gh.rotl32,yd=gh.sum32,wj=gh.sum32_5,xj=yj.ft_1,SN=vj.BlockHash,_j=[1518500249,1859775393,2400959708,3395469782];function fa(){if(!(this instanceof fa))return new fa;SN.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}gh.inherits(fa,SN);var bj=fa;fa.blockSize=512;fa.outSize=160;fa.hmacStrength=80;fa.padLength=64;fa.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()),cW(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 pW=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 co=new ve(fW);function AI(n){return new Promise(e=>{setTimeout(e,n)})}function Fl(n,e){if(n==null)return null;if(typeof n=="string")return n;if(TS(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return lg(n)}catch{}return nt(n)}return n}function mW(n){return ua(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function gW(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;co.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;co.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)&&co.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&&co.throwError("basic authentication requires a secure https url",ve.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const m=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+qO(ua(m))}}n.skipFetchSetup!=null&&(A.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(A.fetchOptions=wn(n.fetchOptions))}const f=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(f):null;if(h)try{const m={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?JO(h[3]):mW(h[3])};let y=m.body;return t&&(y=t(m.body,m)),Promise.resolve(y)}catch(m){co.throwError("processing response error",ve.errors.SERVER_ERROR,{body:Fl(h[1],h[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 y=a[m];p[y.key]=y.value}),A.headers=p;const d=function(){let m=null;return{promise:new Promise(function(x,_){u&&(m=setTimeout(()=>{m!=null&&(m=null,_(co.makeError("timeout",ve.errors.TIMEOUT,{requestBody:Fl(A.body,p["content-type"]),requestMethod:A.method,timeout:u,url:l})))},u))}),cancel:function(){m!=null&&(clearTimeout(m),m=null)}}}(),g=function(){return pW(this,void 0,void 0,function*(){for(let m=0;m=300)&&(d.cancel(),co.throwError("bad response",ve.errors.SERVER_ERROR,{status:y.statusCode,headers:y.headers,body:Fl(w,y.headers?y.headers["content-type"]:null),requestBody:Fl(A.body,p["content-type"]),requestMethod:A.method,url:l})),t)try{const x=yield t(w,y);return d.cancel(),x}catch(x){if(x.throttleRetry&&m{let a=null;if(s!=null)try{a=JSON.parse(lg(s))}catch(l){co.throwError("invalid JSON",ve.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=ua(e);const s=typeof n=="string"?{url:n}:wn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=wn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return gW(n,i,r)}function Ef(n,e){return e||(e={}),e=wn(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 Ry="qpzry9x8gf2tvdw0s3jn54khce6mua7l",zB={};for(var zg=0;zg>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 NN(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Zf(e)^r>>5}for(e=Zf(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=NN(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=Zf(r)^o,i+=Ry.charAt(o)}for(s=0;s<6;++s)r=Zf(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Ry.charAt(a)}return i}function kN(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=NN(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 yW(){var n=kN.apply(null,arguments);if(typeof n=="object")return n}function wW(n){var e=kN.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function mx(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,f=c&255;u?l.push(u,f):l.push(f)}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(f>>1)-1?d=(f>>1)-g:d=g,h.isubn(d)):d=0,u[p]=d,h.iushrn(1)}return u}t.getNAF=r;function i(l,A){var c=[[],[]];l=l.clone(),A=A.clone();for(var u=0,f=0,h;l.cmpn(-u)>0||A.cmpn(-f)>0;){var p=l.andln(3)+u&3,d=A.andln(3)+f&3;p===3&&(p=-1),d===3&&(d=-1);var g;p&1?(h=l.andln(7)+u&7,(h===3||h===5)&&d===2?g=-p:g=p):g=0,c[0].push(g);var m;d&1?(h=A.andln(7)+f&7,(h===3||h===5)&&p===2?m=-d:m=d):m=0,c[1].push(m),2*u===g+1&&(u=1-u),2*f===m+1&&(f=1-f),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}),Fy=fs.getNAF,SW=fs.getJSF,Uy=fs.assert;function GA(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 eu=GA;GA.prototype.point=function(){throw new Error("Not implemented")};GA.prototype.validate=function(){throw new Error("Not implemented")};GA.prototype._fixedNafMul=function(e,t){Uy(e.precomputed);var r=e._getDoubles(),i=Fy(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),f=s;f>0;f--){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];Uy(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};GA.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,A=0,c,u,f;for(c=0;c=1;c-=2){var p=c-1,d=c;if(o[p]!==1||o[d]!==1){l[p]=Fy(r[p],o[p],this._bitLength),l[d]=Fy(r[d],o[d],this._bitLength),A=Math.max(l[p].length,A),A=Math.max(l[d].length,A);continue}var g=[t[p],null,null,t[d]];t[p].y.cmp(t[d].y)===0?(g[1]=t[p].add(t[d]),g[2]=t[p].toJ().mixedAdd(t[d].neg())):t[p].y.cmp(t[d].y.redNeg())===0?(g[1]=t[p].toJ().mixedAdd(t[d]),g[2]=t[p].add(t[d].neg())):(g[1]=t[p].toJ().mixedAdd(t[d]),g[2]=t[p].toJ().mixedAdd(t[d].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=SW(r[p],r[d]);for(A=Math.max(y[0].length,A),l[p]=new Array(A),l[d]=new Array(A),u=0;u=0;c--){for(var S=0;c>=0;){var b=!0;for(u=0;u=0&&S++,_=_.dblp(S),c<0)break;for(u=0;u0?f=a[u][M-1>>1]:M<0&&(f=a[u][-M-1>>1].neg()),f.type==="affine"?_=_.mixedAdd(f):_=_.add(f))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step):!1};Ws.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&&(h=A,p=c),u.negative&&(u=u.neg(),f=f.neg()),h.negative&&(h=h.neg(),p=p.neg()),[{a:u,b:f},{a:h,b:p}]};Ks.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),f=A.add(c).neg();return{k1:u,k2:f}};Ks.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)};Ks.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};Ks.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Sr.prototype.isInfinity=function(){return this.inf};Sr.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)};Sr.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)};Sr.prototype.getX=function(){return this.x.fromRed()};Sr.prototype.getY=function(){return this.y.fromRed()};Sr.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)};Sr.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)};Sr.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)};Sr.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)};Sr.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};Sr.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 Nr(n,e,t,r){eu.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}US(Nr,eu.BasePoint);Ks.prototype.jpoint=function(e,t,r){return new Nr(this,e,t,r)};Nr.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)};Nr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Nr.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),f=i.redMul(c),h=A.redSqr().redIAdd(u).redISub(f).redISub(f),p=A.redMul(f.redISub(h)).redISub(o.redMul(u)),d=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,p,d)};Nr.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),f=l.redSqr().redIAdd(c).redISub(u).redISub(u),h=l.redMul(u.redISub(f)).redISub(s.redMul(c)),p=this.z.redMul(a);return this.curve.jpoint(f,h,p)};Nr.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}};Nr.prototype.inspect=function(){return this.isInfinity()?"":""};Nr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Hv=$h(function(n,e){var t=e;t.base=eu,t.short=TW,t.mont=null,t.edwards=null}),zv=$h(function(n,e){var t=e,r=fs.assert;function i(a){a.type==="short"?this.curve=new Hv.short(a):a.type==="edwards"?this.curve=new Hv.edwards(a):this.curve=new Hv.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function RA(n){if(!(this instanceof RA))return new RA(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=wo.toArray(n.entropy,n.entropyEnc||"hex"),t=wo.toArray(n.nonce,n.nonceEnc||"hex"),r=wo.toArray(n.pers,n.persEnc||"hex");FS(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var HN=RA;RA.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};RA.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=wo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var IW=fs.assert;function gx(n,e){if(n instanceof gx)return n;this._importDER(n,e)||(IW(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 vx=gx;function RW(){this.place=0}function j_(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 uI(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)}gx.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=uI(t),r=uI(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];W_(i,t.length),i=i.concat(t),i.push(2),W_(i,r.length);var s=i.concat(r),o=[48];return W_(o,s.length),o=o.concat(s),fs.encode(o,e)};var FW=function(){throw new Error("unsupported")},zN=fs.assert;function Hs(n){if(!(this instanceof Hs))return new Hs(n);typeof n=="string"&&(zN(Object.prototype.hasOwnProperty.call(zv,n),"Unknown curve "+n),n=zv[n]),n instanceof zv.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 UW=Hs;Hs.prototype.keyPair=function(e){return new LS(this,e)};Hs.prototype.keyFromPrivate=function(e,t){return LS.fromPrivate(this,e,t)};Hs.prototype.keyFromPublic=function(e,t){return LS.fromPublic(this,e,t)};Hs.prototype.genKeyPair=function(e){e||(e={});for(var t=new HN({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||FW(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)}};Hs.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};Hs.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 HN({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 f=this.g.mul(u);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(p.cmpn(0)!==0){var d=u.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(d=d.umod(this.n),d.cmpn(0)!==0){var g=(f.getY().isOdd()?1:0)|(h.cmp(p)!==0?2:0);return i.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),g^=1),new vx({r:p,s:d,recoveryParam:g})}}}}}};Hs.prototype.verify=function(e,t,r,i){e=this._truncateToN(new vt(e,16)),r=this.keyFromPublic(r,i),t=new vx(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)};Hs.prototype.recoverPubKey=function(n,e,t,r){zN((3&t)===t,"The recovery param is more than two bits"),e=new vx(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),f=a.mul(c).umod(i);return this.g.mulAdd(u,o,f)};Hs.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new vx(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 LW=$h(function(n,e){var t=e;t.version="6.5.4",t.utils=fs,t.rand=function(){throw new Error("unsupported")},t.curve=Hv,t.curves=zv,t.ec=UW,t.eddsa=null}),PW=LW.ec;const DW="signing-key/5.7.0",VB=new ve(DW);let K_=null;function jo(){return K_||(K_=new PW("secp256k1")),K_}class OW{constructor(e){Ue(this,"curve","secp256k1"),Ue(this,"privateKey",nt(e)),kc(this.privateKey)!==32&&VB.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=jo().keyFromPrivate(at(this.privateKey));Ue(this,"publicKey","0x"+t.getPublic(!1,"hex")),Ue(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Ue(this,"_isSigningKey",!0)}_addPoint(e){const t=jo().keyFromPublic(at(this.publicKey)),r=jo().keyFromPublic(at(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=jo().keyFromPrivate(at(this.privateKey)),r=at(e);r.length!==32&&VB.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return ux({recoveryParam:i.recoveryParam,r:kn("0x"+i.r.toString(16),32),s:kn("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=jo().keyFromPrivate(at(this.privateKey)),r=jo().keyFromPublic(at(GN(e)));return kn("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function NW(n,e){const t=ux(e),r={r:at(t.r),s:at(t.s)};return"0x"+jo().recoverPubKey(at(n),r,t.recoveryParam).encode("hex",!1)}function GN(n,e){const t=at(n);if(t.length===32){const r=new OW(t);return e?"0x"+jo().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?nt(t):"0x"+jo().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+jo().keyFromPublic(t).getPublic(!0,"hex"):nt(t)}return VB.throwArgumentError("invalid public or private key","key","[REDACTED]")}const kW="transactions/5.7.0",Bl=new ve(kW);var fI;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(fI||(fI={}));function PS(n){return n==="0x"?null:Dr(n)}function Vr(n){return n==="0x"?tN:Ge.from(n)}function QW(n){const e=GN(n);return Dr(zr(rr(zr(e,1)),12))}function VN(n,e){return QW(NW(at(n),e))}function Ki(n,e){const t=mh(Ge.from(n).toHexString());return t.length>32&&Bl.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function $_(n,e){return{address:Dr(n),storageKeys:(e||[]).map((t,r)=>(kc(t)!==32&&Bl.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function tu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&Bl.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),$_(t[0],t[1])):$_(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return $_(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function jN(n){return tu(n).map(e=>[e.address,e.storageKeys])}function HW(n,e){if(n.gasPrice!=null){const r=Ge.from(n.gasPrice),i=Ge.from(n.maxFeePerGas||0);r.eq(i)||Bl.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[Ki(n.chainId||0,"chainId"),Ki(n.nonce||0,"nonce"),Ki(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ki(n.maxFeePerGas||0,"maxFeePerGas"),Ki(n.gasLimit||0,"gasLimit"),n.to!=null?Dr(n.to):"0x",Ki(n.value||0,"value"),n.data||"0x",jN(n.accessList||[])];if(e){const r=ux(e);t.push(Ki(r.recoveryParam,"recoveryParam")),t.push(mh(r.r)),t.push(mh(r.s))}return _i(["0x02",hx(t)])}function zW(n,e){const t=[Ki(n.chainId||0,"chainId"),Ki(n.nonce||0,"nonce"),Ki(n.gasPrice||0,"gasPrice"),Ki(n.gasLimit||0,"gasLimit"),n.to!=null?Dr(n.to):"0x",Ki(n.value||0,"value"),n.data||"0x",jN(n.accessList||[])];if(e){const r=ux(e);t.push(Ki(r.recoveryParam,"recoveryParam")),t.push(mh(r.r)),t.push(mh(r.s))}return _i(["0x01",hx(t)])}function WN(n,e,t){try{const r=Vr(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{Bl.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=kn(e[1],32),n.s=kn(e[2],32);try{const r=rr(t(n));n.from=VN(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function GW(n){const e=IS(n.slice(1));e.length!==9&&e.length!==12&&Bl.throwArgumentError("invalid component count for transaction type: 2","payload",nt(n));const t=Vr(e[2]),r=Vr(e[3]),i={type:2,chainId:Vr(e[0]).toNumber(),nonce:Vr(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:Vr(e[4]),to:PS(e[5]),value:Vr(e[6]),data:e[7],accessList:tu(e[8])};return e.length===9||(i.hash=rr(n),WN(i,e.slice(9),HW)),i}function VW(n){const e=IS(n.slice(1));e.length!==8&&e.length!==11&&Bl.throwArgumentError("invalid component count for transaction type: 1","payload",nt(n));const t={type:1,chainId:Vr(e[0]).toNumber(),nonce:Vr(e[1]).toNumber(),gasPrice:Vr(e[2]),gasLimit:Vr(e[3]),to:PS(e[4]),value:Vr(e[5]),data:e[6],accessList:tu(e[7])};return e.length===8||(t.hash=rr(n),WN(t,e.slice(8),zW)),t}function jW(n){const e=IS(n);e.length!==9&&e.length!==6&&Bl.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:Vr(e[0]).toNumber(),gasPrice:Vr(e[1]),gasLimit:Vr(e[2]),to:PS(e[3]),value:Vr(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=kn(e[7],32),t.s=kn(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=rr(hx(i));try{t.from=VN(s,{r:nt(t.r),s:nt(t.s),recoveryParam:r})}catch{}t.hash=rr(n)}return t.type=null,t}function WW(n){const e=at(n);if(e[0]>127)return jW(e);switch(e[0]){case 1:return VW(e);case 2:return GW(e)}return Bl.throwError(`unsupported transaction type: ${e[0]}`,ve.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const xd=new ve(Jr);let hI=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=wn(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 tu(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),Et(e))?e.toLowerCase():xd.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 Dr(e)}callAddress(e){if(!Et(e,32))return null;const t=Dr(zr(e,12));return t===VG?null:t}contractAddress(e){return pN(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"||Et(e))return cx(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return kc(r)!==32?xd.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(!Et(e))throw new Error("invalid uint256");return kn(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;Et(r)&&(r=Ge.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),Et(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 WW(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&&xd.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):xd.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&xd.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 KW(n){return n&&typeof n.isCommunityResource=="function"}function dI(n){return KW(n)&&n.isCommunityResource()}let pI=!1;function yx(){pI||(pI=!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 ht=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 Bt=new ve(Jr),$W=10;function mI(n){return n==null?"null":(kc(n)!==32&&Bt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function gI(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[mI(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return mI(e)}).join("&")}function YW(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 gu(n){if(typeof n=="string"){if(n=n.toLowerCase(),kc(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+gI(n);if(HG.isForkEvent(n))throw Bt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+gI(n.topics||[])}throw new Error("invalid event - "+n)}function _d(){return new Date().getTime()}function vI(n){return new Promise(e=>{setTimeout(e,n)})}const XW=["block","network","pending","poll"];let ZW=class{constructor(e,t,r){Ue(this,"tag",e),Ue(this,"listener",t),Ue(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=YW(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||XW.indexOf(this.tag)>=0}};const JW={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 Y_(n){return kn(Ge.from(n).toHexString(),32)}function yI(n){return NB.encode(Zi([n,zr(lI(lI(n)),0,4)]))}const KN=new RegExp("^(ipfs)://(.*)$","i"),wI=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),KN,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Gv(n,e){try{return lg(cm(n,e))}catch{}return null}function cm(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 X_(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):Bt.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function xI(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 qW(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function $N(n){const e=[];let t=0;for(let r=0;rGe.from(e).eq(1)).catch(e=>{if(e.code===ve.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return ht(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:_i([e,Qv(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=_i(["0x9061b923",$N([CV(this.name),r.data])]));try{let s=yield this.provider.call(r);return at(s).length%32===4&&Bt.throwError("resolver threw error",ve.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=cm(s,0)),s}catch(s){if(s.code===ve.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return ht(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?cm(r,0):null})}_getAddress(e,t){const r=JW[String(e)];if(r==null&&Bt.throwError(`unsupported coin type: ${e}`,ve.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 yI(Zi([[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 yI(Zi([[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=cI.toWords(i.slice(2));return a.unshift(o),cI.encode(r.prefix,a)}}return null}getAddress(e){return ht(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===$G?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===ve.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Y_(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Bt.throwError("invalid or unsupported coin data",ve.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return ht(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 Bt.throwError("invalid or unsupported content hash data",ve.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ht(this,void 0,void 0,function*(){let t=ua(e);t=Zi([Y_(64),Y_(t.length),t]),t.length%32!==0&&(t=Zi([t,kn("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nt(t));return r==null||r==="0x"?null:lg(r)})}}let Z_=null,e9=1;class DS extends ag{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Ue(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=Ji(new.target,"getNetwork")(e);t?(Ue(this,"_network",t),this.emit("network",t,null)):Bt.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ht(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||Bt.throwError("no network detected",ve.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Ue(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Ef(()=>this._ready().then(e=>e,e=>{if(!(e.code===ve.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Z_==null&&(Z_=new hI),Z_}static getNetwork(e){return ZO(e??"homestead")}ccipReadFetch(e,t,r){return ht(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 px({url:A,errorPassThrough:!0},c,(h,p)=>(h.status=p.statusCode,h));if(u.data)return u.data;const f=u.message||"unknown error";if(u.status>=400&&u.status<500)return Bt.throwError(`response not found during CCIP fetch: ${f}`,ve.errors.SERVER_ERROR,{url:l,errorMessage:f});o.push(f)}return Bt.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,ve.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return ht(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(_d()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=_d(),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=_d();return i=Ge.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return ht(this,void 0,void 0,function*(){const e=e9++,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)Bt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Bt.makeError("network block skew detected",ve.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 ht(this,void 0,void 0,function*(){return Bt.throwError("provider does not support network detection",ve.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ht(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 vI(0),this._network;const r=Bt.makeError("underlying network changed",ve.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=_d();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 ht(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return ht(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(f=>{f()}),!1)},u=f=>{f.confirmations{this.removeListener(e,u)}),i){let f=i.startBlock,h=null;const p=d=>ht(this,void 0,void 0,function*(){A||(yield vI(1e3),this.getTransactionCount(i.from).then(g=>ht(this,void 0,void 0,function*(){if(!A){if(g<=i.nonce)f=d;else{{const m=yield this.getTransaction(e);if(m&&m.blockNumber!=null)return}for(h==null&&(h=f-3,h{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 f=setTimeout(()=>{c()||a(Bt.makeError("timeout exceeded",ve.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return ht(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ge.from(e)}catch(t){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return ht(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 Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return ht(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 Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return ht(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 Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return ht(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=>cx(o))}),s=yield this.perform("getStorageAt",i);try{return nt(s)}catch(o){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&kc(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&Bt.throwError("Transaction hash mismatch from Provider.sendTransaction.",ve.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>ht(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&&Bt.throwError("transaction failed",ve.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return ht(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 ht(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 ht(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 ht(this,void 0,void 0,function*(){r>=$W&&Bt.throwError("CCIP read exceeded maximum redirections",ve.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"&&kc(s)%32===4)try{const o=zr(s,4),a=zr(o,0,32);Ge.from(a).eq(i)||Bt.throwError("CCIP Read sender did not match",ve.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;mht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Ef(()=>ht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Ef(()=>ht(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 ht(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)}),hI.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return ht(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ht(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Bt.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 ht(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 _I(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return ht(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Bt.throwError("network does not support ENS",ve.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Qv(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ht(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(Et(e))throw r}typeof e!="string"&&Bt.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return ht(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=Gv(yield this.call({to:r,data:"0x691f3431"+Qv(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ht(this,void 0,void 0,function*(){let t=null;if(Et(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new _I(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==ve.errors.CALL_EXCEPTION)throw a}try{const a=Gv(yield this.call({to:o,data:"0x691f3431"+Qv(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==ve.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 Bt.throwError(e+" not implemented",ve.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 ZW(gu(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=gu(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=gu(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=gu(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=gu(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=gu(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const t9="abstract-signer/5.7.0";var ro=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 ys=new ve(t9),n9=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],r9=[ve.errors.INSUFFICIENT_FUNDS,ve.errors.NONCE_EXPIRED,ve.errors.REPLACEMENT_UNDERPRICED];class cg{constructor(){ys.checkAbstract(new.target,cg),Ue(this,"_isSigner",!0)}getBalance(e){return ro(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return ro(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return ro(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 ro(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 ro(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 ro(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return ro(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return ro(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return ro(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)n9.indexOf(r)===-1&&ys.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=wn(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()&&ys.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return ro(this,void 0,void 0,function*(){const t=yield qn(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>ro(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&ys.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)?ys.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&ys.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&&ys.throwError("network does not support EIP-1559",ve.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):ys.throwError("failed to get consistent fee data",ve.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(r9.indexOf(i.code)>=0)throw i;return ys.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.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]&&ys.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield qn(t)})}_checkProvider(e){this.provider||ys.throwError("missing provider",ve.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class OS extends cg{constructor(e,t){super(),Ue(this,"address",e),Ue(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{ys.throwError(e,ve.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 OS(this.address,e)}}var Wa=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 ve(Jr),i9=["call","estimateGas"];function kp(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=Et(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=kp(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return kp(JSON.parse(n),e)}catch{}return null}function YN(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=kp(e,!0);if(s)return s.data;er.throwError("missing revert data in call exception; Transaction reverted without a reason string",ve.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=kp(e.body,!1);s==null&&(s=kp(e,!1)),s&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===ve.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",ve.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&er.throwError("nonce has already been used",ve.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",ve.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&er.throwError("legacy pre-eip-155 transactions not supported",ve.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),i9.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",ve.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function bI(n){return new Promise(function(e){setTimeout(e,n)})}function s9(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 bd(n){return n&&n.toLowerCase()}const jB={};class XN extends cg{constructor(e,t,r){if(super(),e!==jB)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Ue(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Ue(this,"_address",this.provider.formatter.address(r)),Ue(this,"_index",null)):typeof r=="number"?(Ue(this,"_index",r),Ue(this,"_address",null)):er.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return er.throwError("cannot alter JSON-RPC Signer connection",ve.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new o9(jB,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,ve.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=wn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=wn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Wa(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",ve.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),YN("sendTransaction",o,s)))})}signTransaction(e){return er.throwError("signing transactions is unsupported",ve.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Wa(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 Ef(()=>Wa(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 Wa(this,void 0,void 0,function*(){const t=typeof e=="string"?ua(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",ve.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Wa(this,void 0,void 0,function*(){const t=typeof e=="string"?ua(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",ve.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Wa(this,void 0,void 0,function*(){const i=yield Gi.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(Gi.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&er.throwError("user rejected signing",ve.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Wa(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class o9 extends XN{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 a9={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class um extends DS{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=Ji(this.constructor,"defaultUrl")()),typeof e=="string"?Ue(this,"connection",Object.freeze({url:e})):Ue(this,"connection",Object.freeze(wn(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 Wa(this,void 0,void 0,function*(){yield bI(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=Ji(this.constructor,"getNetwork");try{return t(Ge.from(e).toNumber())}catch(r){return er.throwError("could not detect network",ve.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return er.throwError("could not detect network",ve.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new XN(jB,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:ts(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=px(this.connection,JSON.stringify(r),s9).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",[bd(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[bd(t.address),t.blockTag]];case"getCode":return["eth_getCode",[bd(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[bd(t.address),kn(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",[Ji(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Ji(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=bd(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Wa(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=wn(t),t.transaction=wn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&er.throwError(e+" not implemented",ve.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return YN(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 bI(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=wn(a9);if(t)for(const s in t)t[s]&&(r[s]=!0);PG(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=cx(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=tu(e.accessList)),i}}let Qp=null;try{if(Qp=WebSocket,Qp==null)throw new Error("inject please")}catch{const e=new ve(Jr);Qp=function(){e.throwError("WebSockets not supported in this environment",ve.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var J_=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 Gg=new ve(Jr);let l9=1;class NS extends um{constructor(e,t){t==="any"&&Gg.throwError("WebSocketProvider does not support 'any' network yet",ve.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Ue(this,"_websocket",new Qp(this.connection.url)):Ue(this,"_websocket",e),Ue(this,"_requests",{}),Ue(this,"_subs",{}),Ue(this,"_subIds",{}),Ue(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"),Ue(A,"code",o.error.code||null),Ue(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){Gg.throwError("cannot reset events block on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Gg.throwError("cannot set polling interval on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return J_(this,void 0,void 0,function*(){return null})}set polling(e){e&&Gg.throwError("cannot set polling on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=l9++;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 J_(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 J_(this,void 0,void 0,function*(){this.websocket.readyState===Qp.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}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 dp=new ve(Jr);class ZN extends um{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return A9(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||dp.throwError("no network detected",ve.errors.UNKNOWN_ERROR,{}),this._network==null&&(Ue(this,"_network",t),this.emit("network",t,null))),t})}}class VA extends ZN{constructor(e,t){dp.checkAbstract(new.target,VA),e=Ji(new.target,"getNetwork")(e),t=Ji(new.target,"getApiKey")(t);const r=Ji(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Ue(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Ue(this,i,t[i])})}_startPending(){dp.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return dp.throwError("API provider does not support signing",ve.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return dp.throwError("not implemented; sub-classes must override getUrl",ve.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const BI=new ve(Jr),Vv="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class c9 extends NS{constructor(e,t){const r=new JN(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Ue(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===Vv}}class JN extends VA{static getWebSocketProvider(e,t){return new c9(e,t)}static getApiKey(e){return e==null?Vv:(e&&typeof e!="string"&&BI.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:BI.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===Vv&&yx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Vv}}const u9=new ve(Jr),Vg="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function f9(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 u9.throwArgumentError("unsupported network","name",n)}class h9 extends VA{isCommunityResource(){return this.apiKey===Vg}static getApiKey(e){return e??Vg}static getUrl(e,t){t==null&&(t=Vg);const r={allowGzip:!0,url:"https://"+f9(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===Vg&&yx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var d9=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 EI=new ve(Jr);class p9 extends VA{static getApiKey(e){return e!=null&&EI.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:EI.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return d9(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 jg=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 ql=new ve(Jr);function CI(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=cx(nt(r)):t==="accessList"?r="["+tu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=nt(r),e[t]=r)}return e}function m9(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 SI(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 MI(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function q_(n,e,t){if(n==="call"&&e.code===ve.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,"")),Et(s))return s;ql.throwError("missing revert data in call exception",ve.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===ve.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/)&&ql.throwError("insufficient funds for intrinsic transaction cost",ve.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ql.throwError("nonce has already been used",ve.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&ql.throwError("replacement fee too low",ve.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&ql.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class g9 extends DS{constructor(e,t){super(e),Ue(this,"baseUrl",this.getBaseUrl()),Ue(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 ql.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 jg(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"?SI:m9;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,u)=>(this.isCommunityResource()&&yx(),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 px(a,l,o||SI);return this.emit("debug",{action:"response",request:i,response:ts(A),provider:this}),A})}detectNetwork(){return jg(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return jg(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=>q_("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=CI(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return q_("call",s,t.transaction)}}case"estimateGas":{const i=CI(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return q_("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=MI(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=MI(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&ql.throwError("unsupported topic count",ve.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&ql.throwError("unsupported topic format",ve.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 v9(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 Ly=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 vc=new ve(Jr);function Wg(){return new Date().getTime()}function TI(n){let e=null;for(let t=0;te?null:(r+i)/2}function Cf(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=>Cf(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=Cf(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let y9=1;function RI(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 w9=[ve.errors.CALL_EXCEPTION,ve.errors.INSUFFICIENT_FUNDS,ve.errors.NONCE_EXPIRED,ve.errors.REPLACEMENT_UNDERPRICED,ve.errors.UNPREDICTABLE_GAS_LIMIT],x9=["address","args","errorArgs","errorSignature","method","transaction"];function Kg(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 _9(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 b9(n,e,t){let r=Cf;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=II(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 II(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=wn(i),i.confirmations=-1,Cf(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=wn(i),i.transactions=i.transactions.map(s=>(s=wn(s),s.confirmations=-1,s)),Cf(i))}:r=function(i){return i==null?null:Cf(i)};break;default:throw new Error("unknown method: "+e)}return _9(r,n.quorum)}function Bd(n,e){return Ly(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:Ef(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function B9(n,e,t,r){return Ly(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&&Et(r.blockTag)&&(i=yield Bd(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(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&&Et(s.fromBlock)||s.toBlock&&Et(s.toBlock))&&(i=yield Bd(n,e)),i.getLogs(s)}}return vc.throwError("unknown method error",ve.errors.UNKNOWN_ERROR,{method:t,params:r})})}class E9 extends DS{constructor(e,t){e.length===0&&vc.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(ag.isProvider(o)){const c=dI(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=wn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=dI(o)?2e3:750),l.weight==null&&(l.weight=1);const A=l.weight;return(A%1||A>512||A<1)&&vc.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&&vc.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=TI(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Ue(this,"providerConfigs",Object.freeze(r)),Ue(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return Ly(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return TI(e)})}perform(e,t){return Ly(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=Wg();let A=i.filter(h=>h.runner&&l-h.starth+p.weight,0);for(;A{h.staller=null}),h.runner=B9(h,s,e,t).then(d=>{h.done=!0,h.result=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,Wg()),request:{method:e,params:ts(t)},provider:this})},d=>{h.done=!0,h.error=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,Wg()),request:{method:e,params:ts(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,null),request:{method:e,params:ts(t)},provider:this}),A+=h.weight}const c=[];i.forEach(h=>{h.done||!h.runner||(c.push(h.runner),h.staller&&c.push(h.staller.getPromise()))}),c.length&&(yield Promise.race(c));const u=i.filter(h=>h.done&&h.error==null);if(u.length>=this.quorum){const h=r(u);if(h!==void 0)return i.forEach(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),h;a||(yield RI(100).getPromise()),a=!1}const f=i.reduce((h,p)=>{if(!p.done||p.error==null)return h;const d=p.error.code;return w9.indexOf(d)>=0&&(h[d]||(h[d]={error:p.error,weight:0}),h[d].weight+=p.weight),h},{});if(Object.keys(f).forEach(h=>{const p=f[h];if(p.weight{m.staller&&m.staller.cancel(),m.cancelled=!0});const d=p.error,g={};x9.forEach(m=>{d[m]!=null&&(g[m]=d[m])}),vc.throwError(d.reason||d.message,h,g)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),vc.throwError("failed to meet quorum",ve.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>Kg(l)),provider:this})})}}const C9=null,jv=new ve(Jr),pp="84842078b09946638c03157f83405213";class S9 extends NS{constructor(e,t){const r=new qN(e,t),i=r.connection;i.password&&jv.throwError("INFURA WebSocket project secrets unsupported",ve.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Ue(this,"apiKey",r.projectId),Ue(this,"projectId",r.projectId),Ue(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===pp}}class qN extends VA{static getWebSocketProvider(e,t){return new S9(e,t)}static getApiKey(e){const t={apiKey:pp,projectId:pp,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(jv.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),jv.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:jv.throwError("unsupported network",ve.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===pp&&yx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===pp}}const e1=new ve(Jr),M9="ETHERS_JS_SHARED";class T9 extends VA{static getApiKey(e){return e&&typeof e!="string"&&e1.throwArgumentError("invalid apiKey","apiKey",e),e||M9}static getUrl(e,t){e1.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:e1.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const FI=new ve(Jr),UI="62e1ad51b37b8e00394bda3b";class I9 extends VA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=UI:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:FI.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:FI.throwError("unsupported network",ve.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===UI}}const LI=new ve(Jr);let R9=1;function PI(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:R9++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:ts(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 F9(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:ts(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 kS extends um{constructor(e,t){e==null&&LI.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=F9(e)):e.sendAsync?i=PI(e,e.sendAsync.bind(e)):e.send?i=PI(e,e.send.bind(e)):LI.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Ue(this,"jsonRpcFetchFunc",i),Ue(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const DI=new ve(Jr);function U9(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 um(n);case"ws":case"wss":return new NS(n);default:DI.throwArgumentError("unsupported URL scheme","network",n)}}const t=ZO(n);return(!t||!t._defaultProvider)&&DI.throwError("unsupported getDefaultProvider network",ve.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:E9,AlchemyProvider:JN,AnkrProvider:h9,CloudflareProvider:p9,EtherscanProvider:g9,InfuraProvider:qN,JsonRpcProvider:um,NodesmithProvider:T9,PocketProvider:I9,Web3Provider:kS,IpcProvider:C9},e)}var L9=!0,t1="Invariant failed";function tl(n,e){if(!n){if(L9)throw new Error(t1);var t=typeof e=="function"?e():e,r=t?"".concat(t1,": ").concat(t):t1;throw new Error(r)}}var vo;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(vo||(vo={}));function fm(){return fm=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 Wv(n,e,t){return P9()?Wv=Reflect.construct:Wv=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&hm(A,o.prototype),A},Wv.apply(null,arguments)}function D9(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Py(n){var e=typeof Map=="function"?new Map:void 0;return Py=function(r){if(r===null||!D9(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 Wv(r,arguments,WB(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),hm(i,r)},Py(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function OI(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function tk(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)&&tl(!1),e}else return Number.isInteger(n)||tl(!1),n}function nk(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||tl(!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(rr(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&&tl(!1),a}var NI=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=tk(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(c))throw new rk(c,e.supportedChainIds);var u=A===null?A:nk(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)}},$g=function(n){ek(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Py(Error)),rk=function(n){ek(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}(Py(Error)),wr;(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"})(wr||(wr={}));function O9(n,e){var t=e.type,r=e.payload;switch(t){case wr.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 wr.UPDATE:{var A=r.provider,c=r.chainId,u=r.account;return fm({},n,A===void 0?{}:{provider:A},c===void 0?{}:{chainId:c},u===void 0?{}:{account:u})}case wr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,p=r.account;return fm({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},p===void 0?{}:{account:p},{error:void 0})}case wr.ERROR:{var d=r.error,g=n.connector,m=n.onError;return{connector:g,error:d,onError:m}}case wr.ERROR_FROM_ACTIVATION:{var y=r.connector,w=r.error;return{connector:y,error:w}}case wr.DEACTIVATE_CONNECTOR:return{}}}function N9(){var n=ye.useReducer(O9,{}),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=ye.useRef(-1);A.current+=1;var c=ye.useCallback(function(g,m,y){y===void 0&&(y=!1);try{var w=A.current,x=!1;return Promise.resolve(OI(function(){return Promise.resolve(g.activate().then(function(_){return x=!0,_})).then(function(_){return Promise.resolve(NI(g,_)).then(function(C){if(A.current>w)throw new $g;t({type:wr.ACTIVATE_CONNECTOR,payload:fm({connector:g},C,{onError:m})})})})},function(_){if(_ instanceof $g)x&&g.deactivate();else{if(y)throw x&&g.deactivate(),_;m?(x&&g.deactivate(),m(_)):t({type:wr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:_}})}}))}catch(_){return Promise.reject(_)}},[]),u=ye.useCallback(function(g){t({type:wr.ERROR,payload:{error:g}})},[]),f=ye.useCallback(function(){t({type:wr.DEACTIVATE_CONNECTOR})},[]),h=ye.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 OI(function(){return Promise.resolve(NI(r,g)).then(function(_){if(A.current>m)throw new $g;t({type:wr.UPDATE_FROM_ERROR,payload:_})})},function(_){_ instanceof $g||(a?a(_):t({type:wr.ERROR,payload:{error:_}}))});var y=g.chainId===void 0?void 0:tk(g.chainId);if(y!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(y)){var w=new rk(y,r.supportedChainIds);a?a(w):t({type:wr.ERROR,payload:{error:w}})}else{var x=typeof g.account=="string"?nk(g.account):g.account;t({type:wr.UPDATE,payload:{provider:g.provider,chainId:y,account:x}})}}())}catch(y){return Promise.reject(y)}},[r,l,a]),p=ye.useCallback(function(g){a?a(g):t({type:wr.ERROR,payload:{error:g}})},[a]),d=ye.useCallback(function(){t({type:wr.DEACTIVATE_CONNECTOR})},[]);return ye.useEffect(function(){return function(){r&&r.deactivate()}},[r]),ye.useEffect(function(){return r&&r.on(vo.Update,h).on(vo.Error,p).on(vo.Deactivate,d),function(){r&&r.off(vo.Update,h).off(vo.Error,p).off(vo.Deactivate,d)}},[r,h,p,d]),{connector:r,provider:i,chainId:s,account:o,activate:c,setError:u,deactivate:f,error:l}}var ik="primary",Sf={};function k9(n){Sf[n]&&tl(!1),Sf[n]=ye.createContext({activate:function(){try{return tl(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){tl(!1)},deactivate:function(){tl(!1)},active:!1}),Sf[n].displayName="Web3ReactContext - "+n;var e=Sf[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=N9(),a=o.connector,l=o.provider,A=o.chainId,c=o.account,u=o.activate,f=o.setError,h=o.deactivate,p=o.error,d=a!==void 0&&A!==void 0&&c!==void 0&&!p,g=ye.useMemo(function(){return d&&A!==void 0&&Number.isInteger(A)&&a?i(l,a):void 0},[d,i,l,a,A]),m={connector:a,library:g,chainId:A,account:c,activate:u,setError:f,deactivate:h,active:d,error:p};return Y.createElement(e,{value:m},s)}}var Q9=k9(ik);function H9(n){return n===void 0&&(n=ik),Object.keys(Sf).includes(n)||tl(!1),Sf[n]}function z9(n){return ye.useContext(H9(n))}var KB={},sk={exports:{}},hs={},ok={exports:{}},ak={};/** + */(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=ta: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],f=[1,256,65536,16777216],h=[6,1536,393216,100663296],p=[0,8,16,24],d=[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],y=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(F){return Object.prototype.toString.call(F)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(F){return typeof F=="object"&&F.buffer&&F.buffer.constructor===ArrayBuffer});for(var x=function(F,X,ue){return function(le){return new B(F,X,F).update(le)[ue]()}},_=function(F,X,ue){return function(le,oe){return new B(F,X,oe).update(le)[ue]()}},C=function(F,X,ue){return function(le,oe,re,pe){return v["cshake"+F].update(le,oe,re,pe)[ue]()}},S=function(F,X,ue){return function(le,oe,re,pe){return v["kmac"+F].update(le,oe,re,pe)[ue]()}},b=function(F,X,ue,le){for(var oe=0;oe>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ue>>5,this.extraBytes=(ue&31)>>3;for(var le=0;le<50;++le)this.s[le]=0}B.prototype.update=function(F){if(this.finalized)throw new Error(t);var X,ue=typeof F;if(ue!=="string"){if(ue==="object"){if(F===null)throw new Error(e);if(l&&F.constructor===ArrayBuffer)F=new Uint8Array(F);else if(!Array.isArray(F)&&(!l||!ArrayBuffer.isView(F)))throw new Error(e)}else throw new Error(e);X=!0}for(var le=this.blocks,oe=this.byteCount,re=F.length,pe=this.blockCount,_e=0,Re=this.s,Q,de;_e>2]|=F[_e]<>2]|=de<>2]|=(192|de>>6)<>2]|=(128|de&63)<=57344?(le[Q>>2]|=(224|de>>12)<>2]|=(128|de>>6&63)<>2]|=(128|de&63)<>2]|=(240|de>>18)<>2]|=(128|de>>12&63)<>2]|=(128|de>>6&63)<>2]|=(128|de&63)<=oe){for(this.start=Q-oe,this.block=le[pe],Q=0;Q>8,ue=F&255;ue>0;)oe.unshift(ue),F=F>>8,ue=F&255,++le;return X?oe.push(le):oe.unshift(le),this.update(oe),oe.length},B.prototype.encodeString=function(F){var X,ue=typeof F;if(ue!=="string"){if(ue==="object"){if(F===null)throw new Error(e);if(l&&F.constructor===ArrayBuffer)F=new Uint8Array(F);else if(!Array.isArray(F)&&(!l||!ArrayBuffer.isView(F)))throw new Error(e)}else throw new Error(e);X=!0}var le=0,oe=F.length;if(X)le=oe;else for(var re=0;re=57344?le+=3:(pe=65536+((pe&1023)<<10|F.charCodeAt(++re)&1023),le+=4)}return le+=this.encode(le*8),this.update(F),le},B.prototype.bytepad=function(F,X){for(var ue=this.encode(X),le=0;le>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(F[0]=F[ue],X=1;X>4&15]+A[_e&15]+A[_e>>12&15]+A[_e>>8&15]+A[_e>>20&15]+A[_e>>16&15]+A[_e>>28&15]+A[_e>>24&15];re%F===0&&(ee(X),oe=0)}return le&&(_e=X[oe],pe+=A[_e>>4&15]+A[_e&15],le>1&&(pe+=A[_e>>12&15]+A[_e>>8&15]),le>2&&(pe+=A[_e>>20&15]+A[_e>>16&15])),pe},B.prototype.arrayBuffer=function(){this.finalize();var F=this.blockCount,X=this.s,ue=this.outputBlocks,le=this.extraBytes,oe=0,re=0,pe=this.outputBits>>3,_e;le?_e=new ArrayBuffer(ue+1<<2):_e=new ArrayBuffer(pe);for(var Re=new Uint32Array(_e);re>8&255,pe[_e+2]=Re>>16&255,pe[_e+3]=Re>>24&255;re%F===0&&ee(X)}return le&&(_e=re<<2,Re=X[oe],pe[_e]=Re&255,le>1&&(pe[_e+1]=Re>>8&255),le>2&&(pe[_e+2]=Re>>16&255)),pe};function W(F,X,ue){B.call(this,F,X,ue)}W.prototype=new B,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),B.prototype.finalize.call(this)};var ee=function(F){var X,ue,le,oe,re,pe,_e,Re,Q,de,Ae,q,J,ce,xe,be,N,j,se,he,me,G,R,T,V,te,ae,ie,Te,Me,Le,ke,De,fe,Ce,Se,Fe,We,qe,ut,sn,Ct,it,ar,wt,Yt,Js,Vt,Xt,ne,ge,Be,we,Ee,ze,st,Ze,Je,yt,mt,gt,Zt,Rn;for(le=0;le<48;le+=2)oe=F[0]^F[10]^F[20]^F[30]^F[40],re=F[1]^F[11]^F[21]^F[31]^F[41],pe=F[2]^F[12]^F[22]^F[32]^F[42],_e=F[3]^F[13]^F[23]^F[33]^F[43],Re=F[4]^F[14]^F[24]^F[34]^F[44],Q=F[5]^F[15]^F[25]^F[35]^F[45],de=F[6]^F[16]^F[26]^F[36]^F[46],Ae=F[7]^F[17]^F[27]^F[37]^F[47],q=F[8]^F[18]^F[28]^F[38]^F[48],J=F[9]^F[19]^F[29]^F[39]^F[49],X=q^(pe<<1|_e>>>31),ue=J^(_e<<1|pe>>>31),F[0]^=X,F[1]^=ue,F[10]^=X,F[11]^=ue,F[20]^=X,F[21]^=ue,F[30]^=X,F[31]^=ue,F[40]^=X,F[41]^=ue,X=oe^(Re<<1|Q>>>31),ue=re^(Q<<1|Re>>>31),F[2]^=X,F[3]^=ue,F[12]^=X,F[13]^=ue,F[22]^=X,F[23]^=ue,F[32]^=X,F[33]^=ue,F[42]^=X,F[43]^=ue,X=pe^(de<<1|Ae>>>31),ue=_e^(Ae<<1|de>>>31),F[4]^=X,F[5]^=ue,F[14]^=X,F[15]^=ue,F[24]^=X,F[25]^=ue,F[34]^=X,F[35]^=ue,F[44]^=X,F[45]^=ue,X=Re^(q<<1|J>>>31),ue=Q^(J<<1|q>>>31),F[6]^=X,F[7]^=ue,F[16]^=X,F[17]^=ue,F[26]^=X,F[27]^=ue,F[36]^=X,F[37]^=ue,F[46]^=X,F[47]^=ue,X=de^(oe<<1|re>>>31),ue=Ae^(re<<1|oe>>>31),F[8]^=X,F[9]^=ue,F[18]^=X,F[19]^=ue,F[28]^=X,F[29]^=ue,F[38]^=X,F[39]^=ue,F[48]^=X,F[49]^=ue,ce=F[0],xe=F[1],Yt=F[11]<<4|F[10]>>>28,Js=F[10]<<4|F[11]>>>28,ie=F[20]<<3|F[21]>>>29,Te=F[21]<<3|F[20]>>>29,mt=F[31]<<9|F[30]>>>23,gt=F[30]<<9|F[31]>>>23,Ct=F[40]<<18|F[41]>>>14,it=F[41]<<18|F[40]>>>14,fe=F[2]<<1|F[3]>>>31,Ce=F[3]<<1|F[2]>>>31,be=F[13]<<12|F[12]>>>20,N=F[12]<<12|F[13]>>>20,Vt=F[22]<<10|F[23]>>>22,Xt=F[23]<<10|F[22]>>>22,Me=F[33]<<13|F[32]>>>19,Le=F[32]<<13|F[33]>>>19,Zt=F[42]<<2|F[43]>>>30,Rn=F[43]<<2|F[42]>>>30,Ee=F[5]<<30|F[4]>>>2,ze=F[4]<<30|F[5]>>>2,Se=F[14]<<6|F[15]>>>26,Fe=F[15]<<6|F[14]>>>26,j=F[25]<<11|F[24]>>>21,se=F[24]<<11|F[25]>>>21,ne=F[34]<<15|F[35]>>>17,ge=F[35]<<15|F[34]>>>17,ke=F[45]<<29|F[44]>>>3,De=F[44]<<29|F[45]>>>3,T=F[6]<<28|F[7]>>>4,V=F[7]<<28|F[6]>>>4,st=F[17]<<23|F[16]>>>9,Ze=F[16]<<23|F[17]>>>9,We=F[26]<<25|F[27]>>>7,qe=F[27]<<25|F[26]>>>7,he=F[36]<<21|F[37]>>>11,me=F[37]<<21|F[36]>>>11,Be=F[47]<<24|F[46]>>>8,we=F[46]<<24|F[47]>>>8,ar=F[8]<<27|F[9]>>>5,wt=F[9]<<27|F[8]>>>5,te=F[18]<<20|F[19]>>>12,ae=F[19]<<20|F[18]>>>12,Je=F[29]<<7|F[28]>>>25,yt=F[28]<<7|F[29]>>>25,ut=F[38]<<8|F[39]>>>24,sn=F[39]<<8|F[38]>>>24,G=F[48]<<14|F[49]>>>18,R=F[49]<<14|F[48]>>>18,F[0]=ce^~be&j,F[1]=xe^~N&se,F[10]=T^~te&ie,F[11]=V^~ae&Te,F[20]=fe^~Se&We,F[21]=Ce^~Fe&qe,F[30]=ar^~Yt&Vt,F[31]=wt^~Js&Xt,F[40]=Ee^~st&Je,F[41]=ze^~Ze&yt,F[2]=be^~j&he,F[3]=N^~se&me,F[12]=te^~ie&Me,F[13]=ae^~Te&Le,F[22]=Se^~We&ut,F[23]=Fe^~qe&sn,F[32]=Yt^~Vt&ne,F[33]=Js^~Xt&ge,F[42]=st^~Je&mt,F[43]=Ze^~yt>,F[4]=j^~he&G,F[5]=se^~me&R,F[14]=ie^~Me&ke,F[15]=Te^~Le&De,F[24]=We^~ut&Ct,F[25]=qe^~sn&it,F[34]=Vt^~ne&Be,F[35]=Xt^~ge&we,F[44]=Je^~mt&Zt,F[45]=yt^~gt&Rn,F[6]=he^~G&ce,F[7]=me^~R&xe,F[16]=Me^~ke&T,F[17]=Le^~De&V,F[26]=ut^~Ct&fe,F[27]=sn^~it&Ce,F[36]=ne^~Be&ar,F[37]=ge^~we&wt,F[46]=mt^~Zt&Ee,F[47]=gt^~Rn&ze,F[8]=G^~ce&be,F[9]=R^~xe&N,F[18]=ke^~T&te,F[19]=De^~V&ae,F[28]=Ct^~fe&Se,F[29]=it^~Ce&Fe,F[38]=Be^~ar&Yt,F[39]=we^~wt&Js,F[48]=Zt^~Ee&st,F[49]=Rn^~ze&Ze,F[0]^=d[le],F[1]^=d[le+1]};if(a)n.exports=v;else for(U=0;U>6===2;o++)s++;return s}return n===Wi.OVERRUN?t.length-e-1:0}function qG(n,e,t,r,i){return n===Wi.OVERLONG?(r.push(i),0):(r.push(65533),iN(n,e,t))}const eV=Object.freeze({error:JG,ignore:iN,replace:qG});function sN(n,e){e==null&&(e=eV.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(Wi.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(Wi.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(Wi.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(Wi.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(Wi.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(Wi.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function ua(n,e=Am.current){e!=Am.current&&(rN.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 tV(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function lg(n,e){return tV(sN(n,e))}function nV(n,e=Am.current){return sN(ua(n,e))}function bf(n){return rr(ua(n))}const oN="hash/5.7.0";function aN(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 rV(n){const e={};for(let t=0;t>--l&1}const u=31,f=Math.pow(2,u),h=f>>>1,p=h>>1,d=f-1;let g=0;for(let _=0;_1;){let D=C+S>>>1;_>>1|c(),b=b<<1^h,M=(M^h)<<1|h|1;y=b,w=1+M-b}let x=r-4;return m.map(_=>{switch(_-x){case 3:return x+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return x+256+(n[a++]<<8|n[a++]);case 1:return x+n[a++];default:return _-1}})}function sV(n){let e=0;return()=>n[e++]}function oV(n){return sV(iV(n))}function aV(n){return n&1?~n>>1:n>>1}function lV(n,e){let t=Array(n);for(let r=0;re[o]):t}function cV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(fV(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(hV(t,n))}return rV(aN(e))}function uV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function lN(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function fV(n,e){let t=1+e(),r=e(),i=uV(e),s=lN(i.length,1+n,e);return aN(s.map((o,a)=>{const l=o[0],A=o.slice(1);return Array(i[a]).fill(void 0).map((c,u)=>{let f=u*r;return[l+u*t,A.map(h=>h+f)]})}))}function hV(n,e){let t=1+e();return lN(t,1+n,e).map(i=>[i[0],i.slice(1)])}function dV(n){let e=Iy(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let A=Iy(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 pV(){return oV(JO("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const fx=pV(),mV=new Set(Iy(fx)),gV=new Set(Iy(fx)),vV=cV(fx),yV=dV(fx),K2=45,$2=95;function AN(n){return nV(n)}function wV(n){return n.filter(e=>e!=65039)}function cN(n){for(let e of n.split(".")){let t=AN(e);try{for(let r=t.lastIndexOf($2)-1;r>=0;r--)if(t[r]!==$2)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===K2&&t[3]===K2)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function xV(n){return cN(_V(n,wV))}function _V(n,e){let t=AN(n).reverse(),r=[];for(;t.length;){let i=BV(t);if(i){r.push(...e(i));continue}let s=t.pop();if(mV.has(s)){r.push(s);continue}if(gV.has(s))continue;let o=vV[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return cN(bV(String.fromCodePoint(...r)))}function bV(n){return n.normalize("NFC")}function BV(n,e){var t;let r=yV,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 EV=new ve(oN),uN=new Uint8Array(32);uN.fill(0);function Y2(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function fN(n){const e=ua(xV(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(Y2(e.slice(r))),t}function Qv(n){typeof n!="string"&&EV.throwArgumentError("invalid ENS name; not a string","name",n);let e=uN;const t=fN(n);for(;t.length;)e=rr(Zi([e,rr(t.pop())]));return nt(e)}function CV(n){return nt(Zi(fN(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 SV="rlp/5.7.0",Go=new ve(SV);function X2(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function Z2(n,e,t){let r=0;for(let i=0;ie+1+r&&Go.throwError("child data too short",ve.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function dN(n,e){if(n.length===0&&Go.throwError("data too short",ve.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Go.throwError("data short segment too short",ve.errors.BUFFER_OVERRUN,{});const r=Z2(n,e+1,t);return e+1+t+r>n.length&&Go.throwError("data long segment too short",ve.errors.BUFFER_OVERRUN,{}),J2(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&Go.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{}),J2(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&Go.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{});const r=Z2(n,e+1,t);e+1+t+r>n.length&&Go.throwError("data array too short",ve.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&&Go.throwError("data too short",ve.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 IS(n){const e=at(n),t=dN(e,0);return t.consumed!==e.length&&Go.throwArgumentError("invalid rlp data","data",n),t.result}const MV="address/5.7.0",Bf=new ve(MV);function q2(n){Et(n,20)||Bf.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(rr(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 TV=9007199254740991;function IV(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const RS={};for(let n=0;n<10;n++)RS[String(n)]=String(n);for(let n=0;n<26;n++)RS[String.fromCharCode(65+n)]=String(10+n);const eI=Math.floor(IV(TV));function RV(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>RS[r]).join("");for(;e.length>=eI;){let r=e.substring(0,eI);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 Dr(n){let e=null;if(typeof n!="string"&&Bf.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=q2(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&Bf.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)!==RV(n)&&Bf.throwArgumentError("bad icap checksum","address",n),e=FG(n.substring(4));e.length<40;)e="0"+e;e=q2("0x"+e)}else Bf.throwArgumentError("invalid address","address",n);return e}function pN(n){let e=null;try{e=Dr(n.from)}catch{Bf.throwArgumentError("missing from address","transaction",n)}const t=mh(at(Ge.from(n.nonce).toHexString()));return Dr(zr(rr(hx([e,t])),12))}var FV=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 Bn=new ve(oN),mN=new Uint8Array(32);mN.fill(0);const UV=Ge.from(-1),gN=Ge.from(0),vN=Ge.from(1),LV=Ge.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function PV(n){const e=at(n),t=e.length%32;return t?_i([e,mN.slice(t)]):nt(e)}const DV=kn(vN.toHexString(),32),OV=kn(gN.toHexString(),32),tI={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},k_=["name","version","chainId","verifyingContract","salt"];function nI(n){return function(e){return typeof e!="string"&&Bn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const NV={name:nI("name"),version:nI("version"),chainId:function(n){try{return Ge.from(n).toString()}catch{}return Bn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return Dr(n).toLowerCase()}catch{}return Bn.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 Bn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function Q_(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))&&Bn.throwArgumentError("invalid numeric width","type",n);const i=LV.mask(t?r-1:r),s=t?i.add(vN).mul(UV):gN;return function(o){const a=Ge.from(o);return(a.lt(s)||a.gt(i))&&Bn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),kn(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))&&Bn.throwArgumentError("invalid bytes width","type",n),function(r){return at(r).length!==t&&Bn.throwArgumentError(`invalid length for ${n}`,"value",r),PV(r)}}}switch(n){case"address":return function(e){return kn(Dr(e),32)};case"bool":return function(e){return e?DV:OV};case"bytes":return function(e){return rr(e)};case"string":return function(e){return bf(e)}}return null}function rI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class Gi{constructor(e){Ue(this,"types",Object.freeze(ts(e))),Ue(this,"_encoderCache",{}),Ue(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]&&Bn.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&&Bn.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!Q_(c)&&(r[c]||Bn.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?Bn.throwArgumentError("missing primary type","types",e):s.length>1&&Bn.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Ue(this,"primaryType",s[0]);function o(a,l){l[a]&&Bn.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]=rI(a,e[a])+l.map(A=>rI(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=Q_(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&&Bn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(rr)),rr(_i(l))}}const r=this.types[e];if(r){const i=bf(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const A=this.getEncoder(l)(s[a]);return this._types[l]?rr(A):A});return o.unshift(i),_i(o)}}return Bn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Bn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return rr(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(Q_(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&&Bn.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),{}):Bn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Gi(e)}static getPrimaryType(e){return Gi.from(e).primaryType}static hashStruct(e,t,r){return Gi.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=tI[r];i||Bn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>k_.indexOf(r.name)-k_.indexOf(i.name)),Gi.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return _i(["0x1901",Gi.hashDomain(e),Gi.from(t).hash(r)])}static hash(e,t,r){return rr(Gi.encode(e,t,r))}static resolveNames(e,t,r,i){return FV(this,void 0,void 0,function*(){e=wn(e);const s={};e.verifyingContract&&!Et(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=Gi.from(t);o.visit(r,(a,l)=>(a==="address"&&!Et(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){Gi.hashDomain(e);const i={},s=[];k_.forEach(l=>{const A=e[l];A!=null&&(i[l]=NV[l](A),s.push({name:l,type:tI[l]}))});const o=Gi.from(t),a=wn(t);return a.EIP712Domain?Bn.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"&&Bn.throwArgumentError("invalid string","value",A),A}return Bn.throwArgumentError("unsupported type","type",l)})}}}var yN={},Ft={},Ag=wN;function wN(n,e){if(!n)throw new Error(e||"Assertion failed")}wN.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var kB={exports:{}};typeof Object.create=="function"?kB.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:kB.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 kV=kB.exports,QV=Ag,HV=kV;Ft.inherits=HV;function zV(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function GV(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):zV(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}Ft.htonl=xN;function jV(n,e){for(var t="",r=0;r>>0}return s}Ft.join32=WV;function KV(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}Ft.split32=KV;function $V(n,e){return n>>>e|n<<32-e}Ft.rotr32=$V;function YV(n,e){return n<>>32-e}Ft.rotl32=YV;function XV(n,e){return n+e>>>0}Ft.sum32=XV;function ZV(n,e,t){return n+e+t>>>0}Ft.sum32_3=ZV;function JV(n,e,t,r){return n+e+t+r>>>0}Ft.sum32_4=JV;function qV(n,e,t,r,i){return n+e+t+r+i>>>0}Ft.sum32_5=qV;function ej(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}Ft.sum64=ej;function tj(n,e,t,r){var i=e+r>>>0,s=(i>>0}Ft.sum64_hi=tj;function nj(n,e,t,r){var i=e+r;return i>>>0}Ft.sum64_lo=nj;function rj(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}Ft.sum64_4_hi=rj;function ij(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Ft.sum64_4_lo=ij;function sj(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}Ft.sum64_5_hi=sj;function oj(n,e,t,r,i,s,o,a,l,A){var c=e+r+s+a+A;return c>>>0}Ft.sum64_5_lo=oj;function aj(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Ft.rotr64_hi=aj;function lj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.rotr64_lo=lj;function Aj(n,e,t){return n>>>t}Ft.shr64_hi=Aj;function cj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.shr64_lo=cj;var jh={},iI=Ft,uj=Ag;function dx(){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}jh.BlockHash=dx;dx.prototype.update=function(e,t){if(e=iI.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=iI.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}xa.g0_256=mj;function gj(n){return ia(n,17)^ia(n,19)^n>>>10}xa.g1_256=gj;var gh=Ft,vj=jh,yj=xa,H_=gh.rotl32,yd=gh.sum32,wj=gh.sum32_5,xj=yj.ft_1,SN=vj.BlockHash,_j=[1518500249,1859775393,2400959708,3395469782];function fa(){if(!(this instanceof fa))return new fa;SN.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}gh.inherits(fa,SN);var bj=fa;fa.blockSize=512;fa.outSize=160;fa.hmacStrength=80;fa.padLength=64;fa.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()),cW(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 pW=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 co=new ve(fW);function AI(n){return new Promise(e=>{setTimeout(e,n)})}function Fl(n,e){if(n==null)return null;if(typeof n=="string")return n;if(TS(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return lg(n)}catch{}return nt(n)}return n}function mW(n){return ua(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function gW(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;co.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;co.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)&&co.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&&co.throwError("basic authentication requires a secure https url",ve.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const m=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+qO(ua(m))}}n.skipFetchSetup!=null&&(A.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(A.fetchOptions=wn(n.fetchOptions))}const f=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(f):null;if(h)try{const m={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?JO(h[3]):mW(h[3])};let y=m.body;return t&&(y=t(m.body,m)),Promise.resolve(y)}catch(m){co.throwError("processing response error",ve.errors.SERVER_ERROR,{body:Fl(h[1],h[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 y=a[m];p[y.key]=y.value}),A.headers=p;const d=function(){let m=null;return{promise:new Promise(function(x,_){u&&(m=setTimeout(()=>{m!=null&&(m=null,_(co.makeError("timeout",ve.errors.TIMEOUT,{requestBody:Fl(A.body,p["content-type"]),requestMethod:A.method,timeout:u,url:l})))},u))}),cancel:function(){m!=null&&(clearTimeout(m),m=null)}}}(),g=function(){return pW(this,void 0,void 0,function*(){for(let m=0;m=300)&&(d.cancel(),co.throwError("bad response",ve.errors.SERVER_ERROR,{status:y.statusCode,headers:y.headers,body:Fl(w,y.headers?y.headers["content-type"]:null),requestBody:Fl(A.body,p["content-type"]),requestMethod:A.method,url:l})),t)try{const x=yield t(w,y);return d.cancel(),x}catch(x){if(x.throttleRetry&&m{let a=null;if(s!=null)try{a=JSON.parse(lg(s))}catch(l){co.throwError("invalid JSON",ve.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=ua(e);const s=typeof n=="string"?{url:n}:wn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=wn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return gW(n,i,r)}function Ef(n,e){return e||(e={}),e=wn(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 Ry="qpzry9x8gf2tvdw0s3jn54khce6mua7l",zB={};for(var zg=0;zg>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 NN(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Zf(e)^r>>5}for(e=Zf(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=NN(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=Zf(r)^o,i+=Ry.charAt(o)}for(s=0;s<6;++s)r=Zf(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Ry.charAt(a)}return i}function kN(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=NN(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 yW(){var n=kN.apply(null,arguments);if(typeof n=="object")return n}function wW(n){var e=kN.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function mx(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,f=c&255;u?l.push(u,f):l.push(f)}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(f>>1)-1?d=(f>>1)-g:d=g,h.isubn(d)):d=0,u[p]=d,h.iushrn(1)}return u}t.getNAF=r;function i(l,A){var c=[[],[]];l=l.clone(),A=A.clone();for(var u=0,f=0,h;l.cmpn(-u)>0||A.cmpn(-f)>0;){var p=l.andln(3)+u&3,d=A.andln(3)+f&3;p===3&&(p=-1),d===3&&(d=-1);var g;p&1?(h=l.andln(7)+u&7,(h===3||h===5)&&d===2?g=-p:g=p):g=0,c[0].push(g);var m;d&1?(h=A.andln(7)+f&7,(h===3||h===5)&&p===2?m=-d:m=d):m=0,c[1].push(m),2*u===g+1&&(u=1-u),2*f===m+1&&(f=1-f),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}),Fy=fs.getNAF,SW=fs.getJSF,Uy=fs.assert;function GA(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 eu=GA;GA.prototype.point=function(){throw new Error("Not implemented")};GA.prototype.validate=function(){throw new Error("Not implemented")};GA.prototype._fixedNafMul=function(e,t){Uy(e.precomputed);var r=e._getDoubles(),i=Fy(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),f=s;f>0;f--){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];Uy(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};GA.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,A=0,c,u,f;for(c=0;c=1;c-=2){var p=c-1,d=c;if(o[p]!==1||o[d]!==1){l[p]=Fy(r[p],o[p],this._bitLength),l[d]=Fy(r[d],o[d],this._bitLength),A=Math.max(l[p].length,A),A=Math.max(l[d].length,A);continue}var g=[t[p],null,null,t[d]];t[p].y.cmp(t[d].y)===0?(g[1]=t[p].add(t[d]),g[2]=t[p].toJ().mixedAdd(t[d].neg())):t[p].y.cmp(t[d].y.redNeg())===0?(g[1]=t[p].toJ().mixedAdd(t[d]),g[2]=t[p].add(t[d].neg())):(g[1]=t[p].toJ().mixedAdd(t[d]),g[2]=t[p].toJ().mixedAdd(t[d].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=SW(r[p],r[d]);for(A=Math.max(y[0].length,A),l[p]=new Array(A),l[d]=new Array(A),u=0;u=0;c--){for(var S=0;c>=0;){var b=!0;for(u=0;u=0&&S++,_=_.dblp(S),c<0)break;for(u=0;u0?f=a[u][M-1>>1]:M<0&&(f=a[u][-M-1>>1].neg()),f.type==="affine"?_=_.mixedAdd(f):_=_.add(f))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step):!1};Ws.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&&(h=A,p=c),u.negative&&(u=u.neg(),f=f.neg()),h.negative&&(h=h.neg(),p=p.neg()),[{a:u,b:f},{a:h,b:p}]};Ks.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),f=A.add(c).neg();return{k1:u,k2:f}};Ks.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)};Ks.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};Ks.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Sr.prototype.isInfinity=function(){return this.inf};Sr.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)};Sr.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)};Sr.prototype.getX=function(){return this.x.fromRed()};Sr.prototype.getY=function(){return this.y.fromRed()};Sr.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)};Sr.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)};Sr.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)};Sr.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)};Sr.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};Sr.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 Nr(n,e,t,r){eu.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}US(Nr,eu.BasePoint);Ks.prototype.jpoint=function(e,t,r){return new Nr(this,e,t,r)};Nr.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)};Nr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Nr.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),f=i.redMul(c),h=A.redSqr().redIAdd(u).redISub(f).redISub(f),p=A.redMul(f.redISub(h)).redISub(o.redMul(u)),d=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,p,d)};Nr.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),f=l.redSqr().redIAdd(c).redISub(u).redISub(u),h=l.redMul(u.redISub(f)).redISub(s.redMul(c)),p=this.z.redMul(a);return this.curve.jpoint(f,h,p)};Nr.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}};Nr.prototype.inspect=function(){return this.isInfinity()?"":""};Nr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Hv=$h(function(n,e){var t=e;t.base=eu,t.short=TW,t.mont=null,t.edwards=null}),zv=$h(function(n,e){var t=e,r=fs.assert;function i(a){a.type==="short"?this.curve=new Hv.short(a):a.type==="edwards"?this.curve=new Hv.edwards(a):this.curve=new Hv.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function RA(n){if(!(this instanceof RA))return new RA(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=wo.toArray(n.entropy,n.entropyEnc||"hex"),t=wo.toArray(n.nonce,n.nonceEnc||"hex"),r=wo.toArray(n.pers,n.persEnc||"hex");FS(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var HN=RA;RA.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};RA.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=wo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var IW=fs.assert;function gx(n,e){if(n instanceof gx)return n;this._importDER(n,e)||(IW(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 vx=gx;function RW(){this.place=0}function j_(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 uI(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)}gx.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=uI(t),r=uI(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];W_(i,t.length),i=i.concat(t),i.push(2),W_(i,r.length);var s=i.concat(r),o=[48];return W_(o,s.length),o=o.concat(s),fs.encode(o,e)};var FW=function(){throw new Error("unsupported")},zN=fs.assert;function Hs(n){if(!(this instanceof Hs))return new Hs(n);typeof n=="string"&&(zN(Object.prototype.hasOwnProperty.call(zv,n),"Unknown curve "+n),n=zv[n]),n instanceof zv.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 UW=Hs;Hs.prototype.keyPair=function(e){return new LS(this,e)};Hs.prototype.keyFromPrivate=function(e,t){return LS.fromPrivate(this,e,t)};Hs.prototype.keyFromPublic=function(e,t){return LS.fromPublic(this,e,t)};Hs.prototype.genKeyPair=function(e){e||(e={});for(var t=new HN({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||FW(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)}};Hs.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};Hs.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 HN({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 f=this.g.mul(u);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(p.cmpn(0)!==0){var d=u.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(d=d.umod(this.n),d.cmpn(0)!==0){var g=(f.getY().isOdd()?1:0)|(h.cmp(p)!==0?2:0);return i.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),g^=1),new vx({r:p,s:d,recoveryParam:g})}}}}}};Hs.prototype.verify=function(e,t,r,i){e=this._truncateToN(new vt(e,16)),r=this.keyFromPublic(r,i),t=new vx(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)};Hs.prototype.recoverPubKey=function(n,e,t,r){zN((3&t)===t,"The recovery param is more than two bits"),e=new vx(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),f=a.mul(c).umod(i);return this.g.mulAdd(u,o,f)};Hs.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new vx(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 LW=$h(function(n,e){var t=e;t.version="6.5.4",t.utils=fs,t.rand=function(){throw new Error("unsupported")},t.curve=Hv,t.curves=zv,t.ec=UW,t.eddsa=null}),PW=LW.ec;const DW="signing-key/5.7.0",VB=new ve(DW);let K_=null;function jo(){return K_||(K_=new PW("secp256k1")),K_}class OW{constructor(e){Ue(this,"curve","secp256k1"),Ue(this,"privateKey",nt(e)),kc(this.privateKey)!==32&&VB.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=jo().keyFromPrivate(at(this.privateKey));Ue(this,"publicKey","0x"+t.getPublic(!1,"hex")),Ue(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Ue(this,"_isSigningKey",!0)}_addPoint(e){const t=jo().keyFromPublic(at(this.publicKey)),r=jo().keyFromPublic(at(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=jo().keyFromPrivate(at(this.privateKey)),r=at(e);r.length!==32&&VB.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return ux({recoveryParam:i.recoveryParam,r:kn("0x"+i.r.toString(16),32),s:kn("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=jo().keyFromPrivate(at(this.privateKey)),r=jo().keyFromPublic(at(GN(e)));return kn("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function NW(n,e){const t=ux(e),r={r:at(t.r),s:at(t.s)};return"0x"+jo().recoverPubKey(at(n),r,t.recoveryParam).encode("hex",!1)}function GN(n,e){const t=at(n);if(t.length===32){const r=new OW(t);return e?"0x"+jo().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?nt(t):"0x"+jo().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+jo().keyFromPublic(t).getPublic(!0,"hex"):nt(t)}return VB.throwArgumentError("invalid public or private key","key","[REDACTED]")}const kW="transactions/5.7.0",Bl=new ve(kW);var fI;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(fI||(fI={}));function PS(n){return n==="0x"?null:Dr(n)}function Vr(n){return n==="0x"?tN:Ge.from(n)}function QW(n){const e=GN(n);return Dr(zr(rr(zr(e,1)),12))}function VN(n,e){return QW(NW(at(n),e))}function Ki(n,e){const t=mh(Ge.from(n).toHexString());return t.length>32&&Bl.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function $_(n,e){return{address:Dr(n),storageKeys:(e||[]).map((t,r)=>(kc(t)!==32&&Bl.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function tu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&Bl.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),$_(t[0],t[1])):$_(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return $_(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function jN(n){return tu(n).map(e=>[e.address,e.storageKeys])}function HW(n,e){if(n.gasPrice!=null){const r=Ge.from(n.gasPrice),i=Ge.from(n.maxFeePerGas||0);r.eq(i)||Bl.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[Ki(n.chainId||0,"chainId"),Ki(n.nonce||0,"nonce"),Ki(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ki(n.maxFeePerGas||0,"maxFeePerGas"),Ki(n.gasLimit||0,"gasLimit"),n.to!=null?Dr(n.to):"0x",Ki(n.value||0,"value"),n.data||"0x",jN(n.accessList||[])];if(e){const r=ux(e);t.push(Ki(r.recoveryParam,"recoveryParam")),t.push(mh(r.r)),t.push(mh(r.s))}return _i(["0x02",hx(t)])}function zW(n,e){const t=[Ki(n.chainId||0,"chainId"),Ki(n.nonce||0,"nonce"),Ki(n.gasPrice||0,"gasPrice"),Ki(n.gasLimit||0,"gasLimit"),n.to!=null?Dr(n.to):"0x",Ki(n.value||0,"value"),n.data||"0x",jN(n.accessList||[])];if(e){const r=ux(e);t.push(Ki(r.recoveryParam,"recoveryParam")),t.push(mh(r.r)),t.push(mh(r.s))}return _i(["0x01",hx(t)])}function WN(n,e,t){try{const r=Vr(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{Bl.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=kn(e[1],32),n.s=kn(e[2],32);try{const r=rr(t(n));n.from=VN(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function GW(n){const e=IS(n.slice(1));e.length!==9&&e.length!==12&&Bl.throwArgumentError("invalid component count for transaction type: 2","payload",nt(n));const t=Vr(e[2]),r=Vr(e[3]),i={type:2,chainId:Vr(e[0]).toNumber(),nonce:Vr(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:Vr(e[4]),to:PS(e[5]),value:Vr(e[6]),data:e[7],accessList:tu(e[8])};return e.length===9||(i.hash=rr(n),WN(i,e.slice(9),HW)),i}function VW(n){const e=IS(n.slice(1));e.length!==8&&e.length!==11&&Bl.throwArgumentError("invalid component count for transaction type: 1","payload",nt(n));const t={type:1,chainId:Vr(e[0]).toNumber(),nonce:Vr(e[1]).toNumber(),gasPrice:Vr(e[2]),gasLimit:Vr(e[3]),to:PS(e[4]),value:Vr(e[5]),data:e[6],accessList:tu(e[7])};return e.length===8||(t.hash=rr(n),WN(t,e.slice(8),zW)),t}function jW(n){const e=IS(n);e.length!==9&&e.length!==6&&Bl.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:Vr(e[0]).toNumber(),gasPrice:Vr(e[1]),gasLimit:Vr(e[2]),to:PS(e[3]),value:Vr(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=kn(e[7],32),t.s=kn(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=rr(hx(i));try{t.from=VN(s,{r:nt(t.r),s:nt(t.s),recoveryParam:r})}catch{}t.hash=rr(n)}return t.type=null,t}function WW(n){const e=at(n);if(e[0]>127)return jW(e);switch(e[0]){case 1:return VW(e);case 2:return GW(e)}return Bl.throwError(`unsupported transaction type: ${e[0]}`,ve.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const xd=new ve(Jr);let hI=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=wn(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 tu(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),Et(e))?e.toLowerCase():xd.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 Dr(e)}callAddress(e){if(!Et(e,32))return null;const t=Dr(zr(e,12));return t===VG?null:t}contractAddress(e){return pN(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"||Et(e))return cx(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return kc(r)!==32?xd.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(!Et(e))throw new Error("invalid uint256");return kn(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;Et(r)&&(r=Ge.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),Et(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 WW(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&&xd.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):xd.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&xd.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 KW(n){return n&&typeof n.isCommunityResource=="function"}function dI(n){return KW(n)&&n.isCommunityResource()}let pI=!1;function yx(){pI||(pI=!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 ht=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 Bt=new ve(Jr),$W=10;function mI(n){return n==null?"null":(kc(n)!==32&&Bt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function gI(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[mI(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return mI(e)}).join("&")}function YW(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 gu(n){if(typeof n=="string"){if(n=n.toLowerCase(),kc(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+gI(n);if(HG.isForkEvent(n))throw Bt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+gI(n.topics||[])}throw new Error("invalid event - "+n)}function _d(){return new Date().getTime()}function vI(n){return new Promise(e=>{setTimeout(e,n)})}const XW=["block","network","pending","poll"];let ZW=class{constructor(e,t,r){Ue(this,"tag",e),Ue(this,"listener",t),Ue(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=YW(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||XW.indexOf(this.tag)>=0}};const JW={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 Y_(n){return kn(Ge.from(n).toHexString(),32)}function yI(n){return NB.encode(Zi([n,zr(lI(lI(n)),0,4)]))}const KN=new RegExp("^(ipfs)://(.*)$","i"),wI=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),KN,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Gv(n,e){try{return lg(cm(n,e))}catch{}return null}function cm(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 X_(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):Bt.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function xI(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 qW(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function $N(n){const e=[];let t=0;for(let r=0;rGe.from(e).eq(1)).catch(e=>{if(e.code===ve.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return ht(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:_i([e,Qv(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=_i(["0x9061b923",$N([CV(this.name),r.data])]));try{let s=yield this.provider.call(r);return at(s).length%32===4&&Bt.throwError("resolver threw error",ve.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=cm(s,0)),s}catch(s){if(s.code===ve.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return ht(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?cm(r,0):null})}_getAddress(e,t){const r=JW[String(e)];if(r==null&&Bt.throwError(`unsupported coin type: ${e}`,ve.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 yI(Zi([[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 yI(Zi([[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=cI.toWords(i.slice(2));return a.unshift(o),cI.encode(r.prefix,a)}}return null}getAddress(e){return ht(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===$G?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===ve.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Y_(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Bt.throwError("invalid or unsupported coin data",ve.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return ht(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 Bt.throwError("invalid or unsupported content hash data",ve.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ht(this,void 0,void 0,function*(){let t=ua(e);t=Zi([Y_(64),Y_(t.length),t]),t.length%32!==0&&(t=Zi([t,kn("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nt(t));return r==null||r==="0x"?null:lg(r)})}}let Z_=null,e9=1;class DS extends ag{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Ue(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=Ji(new.target,"getNetwork")(e);t?(Ue(this,"_network",t),this.emit("network",t,null)):Bt.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ht(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||Bt.throwError("no network detected",ve.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Ue(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Ef(()=>this._ready().then(e=>e,e=>{if(!(e.code===ve.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Z_==null&&(Z_=new hI),Z_}static getNetwork(e){return ZO(e??"homestead")}ccipReadFetch(e,t,r){return ht(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 px({url:A,errorPassThrough:!0},c,(h,p)=>(h.status=p.statusCode,h));if(u.data)return u.data;const f=u.message||"unknown error";if(u.status>=400&&u.status<500)return Bt.throwError(`response not found during CCIP fetch: ${f}`,ve.errors.SERVER_ERROR,{url:l,errorMessage:f});o.push(f)}return Bt.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,ve.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return ht(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(_d()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=_d(),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=_d();return i=Ge.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return ht(this,void 0,void 0,function*(){const e=e9++,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)Bt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Bt.makeError("network block skew detected",ve.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 ht(this,void 0,void 0,function*(){return Bt.throwError("provider does not support network detection",ve.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ht(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 vI(0),this._network;const r=Bt.makeError("underlying network changed",ve.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=_d();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 ht(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return ht(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(f=>{f()}),!1)},u=f=>{f.confirmations{this.removeListener(e,u)}),i){let f=i.startBlock,h=null;const p=d=>ht(this,void 0,void 0,function*(){A||(yield vI(1e3),this.getTransactionCount(i.from).then(g=>ht(this,void 0,void 0,function*(){if(!A){if(g<=i.nonce)f=d;else{{const m=yield this.getTransaction(e);if(m&&m.blockNumber!=null)return}for(h==null&&(h=f-3,h{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 f=setTimeout(()=>{c()||a(Bt.makeError("timeout exceeded",ve.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return ht(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ge.from(e)}catch(t){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return ht(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 Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return ht(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 Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return ht(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 Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return ht(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=>cx(o))}),s=yield this.perform("getStorageAt",i);try{return nt(s)}catch(o){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&kc(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&Bt.throwError("Transaction hash mismatch from Provider.sendTransaction.",ve.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>ht(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&&Bt.throwError("transaction failed",ve.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return ht(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 ht(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 ht(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 ht(this,void 0,void 0,function*(){r>=$W&&Bt.throwError("CCIP read exceeded maximum redirections",ve.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"&&kc(s)%32===4)try{const o=zr(s,4),a=zr(o,0,32);Ge.from(a).eq(i)||Bt.throwError("CCIP Read sender did not match",ve.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;mht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Ef(()=>ht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Ef(()=>ht(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 ht(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)}),hI.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return ht(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ht(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Bt.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 ht(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 _I(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return ht(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Bt.throwError("network does not support ENS",ve.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Qv(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ht(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(Et(e))throw r}typeof e!="string"&&Bt.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return ht(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=Gv(yield this.call({to:r,data:"0x691f3431"+Qv(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ht(this,void 0,void 0,function*(){let t=null;if(Et(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new _I(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==ve.errors.CALL_EXCEPTION)throw a}try{const a=Gv(yield this.call({to:o,data:"0x691f3431"+Qv(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==ve.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 Bt.throwError(e+" not implemented",ve.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 ZW(gu(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=gu(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=gu(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=gu(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=gu(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=gu(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const t9="abstract-signer/5.7.0";var ro=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 ys=new ve(t9),n9=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],r9=[ve.errors.INSUFFICIENT_FUNDS,ve.errors.NONCE_EXPIRED,ve.errors.REPLACEMENT_UNDERPRICED];class cg{constructor(){ys.checkAbstract(new.target,cg),Ue(this,"_isSigner",!0)}getBalance(e){return ro(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return ro(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return ro(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 ro(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 ro(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 ro(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return ro(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return ro(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return ro(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)n9.indexOf(r)===-1&&ys.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=wn(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()&&ys.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return ro(this,void 0,void 0,function*(){const t=yield qn(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>ro(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&ys.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)?ys.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&ys.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&&ys.throwError("network does not support EIP-1559",ve.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):ys.throwError("failed to get consistent fee data",ve.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(r9.indexOf(i.code)>=0)throw i;return ys.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.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]&&ys.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield qn(t)})}_checkProvider(e){this.provider||ys.throwError("missing provider",ve.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class OS extends cg{constructor(e,t){super(),Ue(this,"address",e),Ue(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{ys.throwError(e,ve.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 OS(this.address,e)}}var Wa=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 ve(Jr),i9=["call","estimateGas"];function kp(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=Et(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=kp(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return kp(JSON.parse(n),e)}catch{}return null}function YN(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=kp(e,!0);if(s)return s.data;er.throwError("missing revert data in call exception; Transaction reverted without a reason string",ve.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=kp(e.body,!1);s==null&&(s=kp(e,!1)),s&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===ve.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",ve.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&er.throwError("nonce has already been used",ve.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",ve.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&er.throwError("legacy pre-eip-155 transactions not supported",ve.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),i9.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",ve.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function bI(n){return new Promise(function(e){setTimeout(e,n)})}function s9(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 bd(n){return n&&n.toLowerCase()}const jB={};class XN extends cg{constructor(e,t,r){if(super(),e!==jB)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Ue(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Ue(this,"_address",this.provider.formatter.address(r)),Ue(this,"_index",null)):typeof r=="number"?(Ue(this,"_index",r),Ue(this,"_address",null)):er.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return er.throwError("cannot alter JSON-RPC Signer connection",ve.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new o9(jB,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,ve.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=wn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=wn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Wa(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",ve.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),YN("sendTransaction",o,s)))})}signTransaction(e){return er.throwError("signing transactions is unsupported",ve.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Wa(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 Ef(()=>Wa(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 Wa(this,void 0,void 0,function*(){const t=typeof e=="string"?ua(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",ve.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Wa(this,void 0,void 0,function*(){const t=typeof e=="string"?ua(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",ve.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Wa(this,void 0,void 0,function*(){const i=yield Gi.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(Gi.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&er.throwError("user rejected signing",ve.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Wa(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class o9 extends XN{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 a9={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class um extends DS{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=Ji(this.constructor,"defaultUrl")()),typeof e=="string"?Ue(this,"connection",Object.freeze({url:e})):Ue(this,"connection",Object.freeze(wn(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 Wa(this,void 0,void 0,function*(){yield bI(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=Ji(this.constructor,"getNetwork");try{return t(Ge.from(e).toNumber())}catch(r){return er.throwError("could not detect network",ve.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return er.throwError("could not detect network",ve.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new XN(jB,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:ts(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=px(this.connection,JSON.stringify(r),s9).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",[bd(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[bd(t.address),t.blockTag]];case"getCode":return["eth_getCode",[bd(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[bd(t.address),kn(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",[Ji(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Ji(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=bd(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Wa(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=wn(t),t.transaction=wn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&er.throwError(e+" not implemented",ve.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return YN(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 bI(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=wn(a9);if(t)for(const s in t)t[s]&&(r[s]=!0);PG(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=cx(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=tu(e.accessList)),i}}let Qp=null;try{if(Qp=WebSocket,Qp==null)throw new Error("inject please")}catch{const e=new ve(Jr);Qp=function(){e.throwError("WebSockets not supported in this environment",ve.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var J_=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 Gg=new ve(Jr);let l9=1;class NS extends um{constructor(e,t){t==="any"&&Gg.throwError("WebSocketProvider does not support 'any' network yet",ve.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Ue(this,"_websocket",new Qp(this.connection.url)):Ue(this,"_websocket",e),Ue(this,"_requests",{}),Ue(this,"_subs",{}),Ue(this,"_subIds",{}),Ue(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"),Ue(A,"code",o.error.code||null),Ue(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){Gg.throwError("cannot reset events block on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Gg.throwError("cannot set polling interval on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return J_(this,void 0,void 0,function*(){return null})}set polling(e){e&&Gg.throwError("cannot set polling on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=l9++;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 J_(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 J_(this,void 0,void 0,function*(){this.websocket.readyState===Qp.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}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 dp=new ve(Jr);class ZN extends um{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return A9(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||dp.throwError("no network detected",ve.errors.UNKNOWN_ERROR,{}),this._network==null&&(Ue(this,"_network",t),this.emit("network",t,null))),t})}}class VA extends ZN{constructor(e,t){dp.checkAbstract(new.target,VA),e=Ji(new.target,"getNetwork")(e),t=Ji(new.target,"getApiKey")(t);const r=Ji(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Ue(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Ue(this,i,t[i])})}_startPending(){dp.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return dp.throwError("API provider does not support signing",ve.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return dp.throwError("not implemented; sub-classes must override getUrl",ve.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const BI=new ve(Jr),Vv="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class c9 extends NS{constructor(e,t){const r=new JN(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Ue(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===Vv}}class JN extends VA{static getWebSocketProvider(e,t){return new c9(e,t)}static getApiKey(e){return e==null?Vv:(e&&typeof e!="string"&&BI.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:BI.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===Vv&&yx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Vv}}const u9=new ve(Jr),Vg="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function f9(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 u9.throwArgumentError("unsupported network","name",n)}class h9 extends VA{isCommunityResource(){return this.apiKey===Vg}static getApiKey(e){return e??Vg}static getUrl(e,t){t==null&&(t=Vg);const r={allowGzip:!0,url:"https://"+f9(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===Vg&&yx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var d9=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 EI=new ve(Jr);class p9 extends VA{static getApiKey(e){return e!=null&&EI.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:EI.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return d9(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 jg=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 ql=new ve(Jr);function CI(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=cx(nt(r)):t==="accessList"?r="["+tu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=nt(r),e[t]=r)}return e}function m9(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 SI(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 MI(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function q_(n,e,t){if(n==="call"&&e.code===ve.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,"")),Et(s))return s;ql.throwError("missing revert data in call exception",ve.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===ve.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/)&&ql.throwError("insufficient funds for intrinsic transaction cost",ve.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ql.throwError("nonce has already been used",ve.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&ql.throwError("replacement fee too low",ve.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&ql.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class g9 extends DS{constructor(e,t){super(e),Ue(this,"baseUrl",this.getBaseUrl()),Ue(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 ql.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 jg(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"?SI:m9;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,u)=>(this.isCommunityResource()&&yx(),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 px(a,l,o||SI);return this.emit("debug",{action:"response",request:i,response:ts(A),provider:this}),A})}detectNetwork(){return jg(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return jg(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=>q_("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=CI(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return q_("call",s,t.transaction)}}case"estimateGas":{const i=CI(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return q_("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=MI(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=MI(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&ql.throwError("unsupported topic count",ve.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&ql.throwError("unsupported topic format",ve.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 v9(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 Ly=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 vc=new ve(Jr);function Wg(){return new Date().getTime()}function TI(n){let e=null;for(let t=0;te?null:(r+i)/2}function Cf(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=>Cf(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=Cf(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let y9=1;function RI(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 w9=[ve.errors.CALL_EXCEPTION,ve.errors.INSUFFICIENT_FUNDS,ve.errors.NONCE_EXPIRED,ve.errors.REPLACEMENT_UNDERPRICED,ve.errors.UNPREDICTABLE_GAS_LIMIT],x9=["address","args","errorArgs","errorSignature","method","transaction"];function Kg(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 _9(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 b9(n,e,t){let r=Cf;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=II(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 II(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=wn(i),i.confirmations=-1,Cf(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=wn(i),i.transactions=i.transactions.map(s=>(s=wn(s),s.confirmations=-1,s)),Cf(i))}:r=function(i){return i==null?null:Cf(i)};break;default:throw new Error("unknown method: "+e)}return _9(r,n.quorum)}function Bd(n,e){return Ly(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:Ef(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function B9(n,e,t,r){return Ly(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&&Et(r.blockTag)&&(i=yield Bd(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(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&&Et(s.fromBlock)||s.toBlock&&Et(s.toBlock))&&(i=yield Bd(n,e)),i.getLogs(s)}}return vc.throwError("unknown method error",ve.errors.UNKNOWN_ERROR,{method:t,params:r})})}class E9 extends DS{constructor(e,t){e.length===0&&vc.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(ag.isProvider(o)){const c=dI(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=wn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=dI(o)?2e3:750),l.weight==null&&(l.weight=1);const A=l.weight;return(A%1||A>512||A<1)&&vc.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&&vc.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=TI(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Ue(this,"providerConfigs",Object.freeze(r)),Ue(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return Ly(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return TI(e)})}perform(e,t){return Ly(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=Wg();let A=i.filter(h=>h.runner&&l-h.starth+p.weight,0);for(;A{h.staller=null}),h.runner=B9(h,s,e,t).then(d=>{h.done=!0,h.result=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,Wg()),request:{method:e,params:ts(t)},provider:this})},d=>{h.done=!0,h.error=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,Wg()),request:{method:e,params:ts(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,null),request:{method:e,params:ts(t)},provider:this}),A+=h.weight}const c=[];i.forEach(h=>{h.done||!h.runner||(c.push(h.runner),h.staller&&c.push(h.staller.getPromise()))}),c.length&&(yield Promise.race(c));const u=i.filter(h=>h.done&&h.error==null);if(u.length>=this.quorum){const h=r(u);if(h!==void 0)return i.forEach(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),h;a||(yield RI(100).getPromise()),a=!1}const f=i.reduce((h,p)=>{if(!p.done||p.error==null)return h;const d=p.error.code;return w9.indexOf(d)>=0&&(h[d]||(h[d]={error:p.error,weight:0}),h[d].weight+=p.weight),h},{});if(Object.keys(f).forEach(h=>{const p=f[h];if(p.weight{m.staller&&m.staller.cancel(),m.cancelled=!0});const d=p.error,g={};x9.forEach(m=>{d[m]!=null&&(g[m]=d[m])}),vc.throwError(d.reason||d.message,h,g)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),vc.throwError("failed to meet quorum",ve.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>Kg(l)),provider:this})})}}const C9=null,jv=new ve(Jr),pp="84842078b09946638c03157f83405213";class S9 extends NS{constructor(e,t){const r=new qN(e,t),i=r.connection;i.password&&jv.throwError("INFURA WebSocket project secrets unsupported",ve.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Ue(this,"apiKey",r.projectId),Ue(this,"projectId",r.projectId),Ue(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===pp}}class qN extends VA{static getWebSocketProvider(e,t){return new S9(e,t)}static getApiKey(e){const t={apiKey:pp,projectId:pp,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(jv.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),jv.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:jv.throwError("unsupported network",ve.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===pp&&yx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===pp}}const e1=new ve(Jr),M9="ETHERS_JS_SHARED";class T9 extends VA{static getApiKey(e){return e&&typeof e!="string"&&e1.throwArgumentError("invalid apiKey","apiKey",e),e||M9}static getUrl(e,t){e1.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:e1.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const FI=new ve(Jr),UI="62e1ad51b37b8e00394bda3b";class I9 extends VA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=UI:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:FI.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:FI.throwError("unsupported network",ve.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===UI}}const LI=new ve(Jr);let R9=1;function PI(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:R9++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:ts(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 F9(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:ts(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 kS extends um{constructor(e,t){e==null&&LI.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=F9(e)):e.sendAsync?i=PI(e,e.sendAsync.bind(e)):e.send?i=PI(e,e.send.bind(e)):LI.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Ue(this,"jsonRpcFetchFunc",i),Ue(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const DI=new ve(Jr);function U9(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 um(n);case"ws":case"wss":return new NS(n);default:DI.throwArgumentError("unsupported URL scheme","network",n)}}const t=ZO(n);return(!t||!t._defaultProvider)&&DI.throwError("unsupported getDefaultProvider network",ve.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:E9,AlchemyProvider:JN,AnkrProvider:h9,CloudflareProvider:p9,EtherscanProvider:g9,InfuraProvider:qN,JsonRpcProvider:um,NodesmithProvider:T9,PocketProvider:I9,Web3Provider:kS,IpcProvider:C9},e)}var L9=!0,t1="Invariant failed";function tl(n,e){if(!n){if(L9)throw new Error(t1);var t=typeof e=="function"?e():e,r=t?"".concat(t1,": ").concat(t):t1;throw new Error(r)}}var vo;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(vo||(vo={}));function fm(){return fm=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 Wv(n,e,t){return P9()?Wv=Reflect.construct:Wv=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&hm(A,o.prototype),A},Wv.apply(null,arguments)}function D9(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Py(n){var e=typeof Map=="function"?new Map:void 0;return Py=function(r){if(r===null||!D9(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 Wv(r,arguments,WB(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),hm(i,r)},Py(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function OI(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function tk(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)&&tl(!1),e}else return Number.isInteger(n)||tl(!1),n}function nk(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||tl(!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(rr(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&&tl(!1),a}var NI=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=tk(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(c))throw new rk(c,e.supportedChainIds);var u=A===null?A:nk(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)}},$g=function(n){ek(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Py(Error)),rk=function(n){ek(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}(Py(Error)),wr;(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"})(wr||(wr={}));function O9(n,e){var t=e.type,r=e.payload;switch(t){case wr.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 wr.UPDATE:{var A=r.provider,c=r.chainId,u=r.account;return fm({},n,A===void 0?{}:{provider:A},c===void 0?{}:{chainId:c},u===void 0?{}:{account:u})}case wr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,p=r.account;return fm({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},p===void 0?{}:{account:p},{error:void 0})}case wr.ERROR:{var d=r.error,g=n.connector,m=n.onError;return{connector:g,error:d,onError:m}}case wr.ERROR_FROM_ACTIVATION:{var y=r.connector,w=r.error;return{connector:y,error:w}}case wr.DEACTIVATE_CONNECTOR:return{}}}function N9(){var n=ye.useReducer(O9,{}),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=ye.useRef(-1);A.current+=1;var c=ye.useCallback(function(g,m,y){y===void 0&&(y=!1);try{var w=A.current,x=!1;return Promise.resolve(OI(function(){return Promise.resolve(g.activate().then(function(_){return x=!0,_})).then(function(_){return Promise.resolve(NI(g,_)).then(function(C){if(A.current>w)throw new $g;t({type:wr.ACTIVATE_CONNECTOR,payload:fm({connector:g},C,{onError:m})})})})},function(_){if(_ instanceof $g)x&&g.deactivate();else{if(y)throw x&&g.deactivate(),_;m?(x&&g.deactivate(),m(_)):t({type:wr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:_}})}}))}catch(_){return Promise.reject(_)}},[]),u=ye.useCallback(function(g){t({type:wr.ERROR,payload:{error:g}})},[]),f=ye.useCallback(function(){t({type:wr.DEACTIVATE_CONNECTOR})},[]),h=ye.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 OI(function(){return Promise.resolve(NI(r,g)).then(function(_){if(A.current>m)throw new $g;t({type:wr.UPDATE_FROM_ERROR,payload:_})})},function(_){_ instanceof $g||(a?a(_):t({type:wr.ERROR,payload:{error:_}}))});var y=g.chainId===void 0?void 0:tk(g.chainId);if(y!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(y)){var w=new rk(y,r.supportedChainIds);a?a(w):t({type:wr.ERROR,payload:{error:w}})}else{var x=typeof g.account=="string"?nk(g.account):g.account;t({type:wr.UPDATE,payload:{provider:g.provider,chainId:y,account:x}})}}())}catch(y){return Promise.reject(y)}},[r,l,a]),p=ye.useCallback(function(g){a?a(g):t({type:wr.ERROR,payload:{error:g}})},[a]),d=ye.useCallback(function(){t({type:wr.DEACTIVATE_CONNECTOR})},[]);return ye.useEffect(function(){return function(){r&&r.deactivate()}},[r]),ye.useEffect(function(){return r&&r.on(vo.Update,h).on(vo.Error,p).on(vo.Deactivate,d),function(){r&&r.off(vo.Update,h).off(vo.Error,p).off(vo.Deactivate,d)}},[r,h,p,d]),{connector:r,provider:i,chainId:s,account:o,activate:c,setError:u,deactivate:f,error:l}}var ik="primary",Sf={};function k9(n){Sf[n]&&tl(!1),Sf[n]=ye.createContext({activate:function(){try{return tl(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){tl(!1)},deactivate:function(){tl(!1)},active:!1}),Sf[n].displayName="Web3ReactContext - "+n;var e=Sf[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=N9(),a=o.connector,l=o.provider,A=o.chainId,c=o.account,u=o.activate,f=o.setError,h=o.deactivate,p=o.error,d=a!==void 0&&A!==void 0&&c!==void 0&&!p,g=ye.useMemo(function(){return d&&A!==void 0&&Number.isInteger(A)&&a?i(l,a):void 0},[d,i,l,a,A]),m={connector:a,library:g,chainId:A,account:c,activate:u,setError:f,deactivate:h,active:d,error:p};return Y.createElement(e,{value:m},s)}}var Q9=k9(ik);function H9(n){return n===void 0&&(n=ik),Object.keys(Sf).includes(n)||tl(!1),Sf[n]}function z9(n){return ye.useContext(H9(n))}var KB={},sk={exports:{}},hs={},ok={exports:{}},ak={};/** * @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 dte(n,e,t){let r=new JM;const i=new $e,s=new $e,o=new Qt,a=new cte({depthPacking:cX}),l=new ute,A={},c=t.maxTextureSize,u={[ls]:Xr,[Xr]:ls,[ui]:ui},f=new Cr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new $e},radius:{value:4}},vertexShader:fte,fragmentShader:hte}),h=f.clone();h.defines.HORIZONTAL_PASS=1;const p=new $t;p.setAttribute("position",new At(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const d=new xn(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=oH,this.render=function(x,_,C){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||x.length===0)return;const S=n.getRenderTarget(),b=n.getActiveCubeFace(),M=n.getActiveMipmapLevel(),D=n.state;D.setBlending(CA),D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);for(let $=0,H=x.length;$c||i.y>c)&&(i.x>c&&(s.x=Math.floor(c/E.x),i.x=s.x*E.x,v.mapSize.x=s.x),i.y>c&&(s.y=Math.floor(c/E.y),i.y=s.y*E.y,v.mapSize.y=s.y)),v.map===null){const P=this.type!==_p?{minFilter:$n,magFilter:$n}:{};v.map=new ma(i.x,i.y,P),v.map.texture.name=I.name+".shadowMap",v.camera.updateProjectionMatrix()}n.setRenderTarget(v.map),n.clear();const U=v.getViewportCount();for(let P=0;P0||_.map&&_.alphaTest>0){const H=D.uuid,I=_.uuid;let v=A[H];v===void 0&&(v={},A[H]=v);let E=v[I];E===void 0&&(E=D.clone(),v[I]=E),D=E}return D.visible=_.visible,D.wireframe=_.wireframe,M===_p?D.side=_.shadowSide!==null?_.shadowSide:_.side:D.side=_.shadowSide!==null?_.shadowSide:u[_.side],D.alphaMap=_.alphaMap,D.alphaTest=_.alphaTest,D.map=_.map,D.clipShadows=_.clipShadows,D.clippingPlanes=_.clippingPlanes,D.clipIntersection=_.clipIntersection,D.displacementMap=_.displacementMap,D.displacementScale=_.displacementScale,D.displacementBias=_.displacementBias,D.wireframeLinewidth=_.wireframeLinewidth,D.linewidth=_.linewidth,C.isPointLight===!0&&D.isMeshDistanceMaterial===!0&&(D.referencePosition.setFromMatrixPosition(C.matrixWorld),D.nearDistance=S,D.farDistance=b),D}function w(x,_,C,S,b){if(x.visible===!1)return;if(x.layers.test(_.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&b===_p)&&(!x.frustumCulled||r.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,x.matrixWorld);const $=e.update(x),H=x.material;if(Array.isArray(H)){const I=$.groups;for(let v=0,E=I.length;v=1):L.indexOf("OpenGL ES")!==-1&&(P=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),U=P>=2);let z=null,K={};const O=n.getParameter(3088),B=n.getParameter(2978),W=new Qt().fromArray(O),ee=new Qt().fromArray(B);function F(fe,Ce,Se){const Fe=new Uint8Array(4),We=n.createTexture();n.bindTexture(fe,We),n.texParameteri(fe,10241,9728),n.texParameteri(fe,10240,9728);for(let qe=0;qe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap;let d;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(N,j){return m?new OffscreenCanvas(N,j):Hm("canvas")}function w(N,j,se,he){let me=1;if((N.width>he||N.height>he)&&(me=he/Math.max(N.width,N.height)),me<1||j===!0)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap){const G=j?gw:Math.floor,R=G(me*N.width),T=G(me*N.height);d===void 0&&(d=y(R,T));const V=se?y(R,T):d;return V.width=R,V.height=T,V.getContext("2d").drawImage(N,0,0,R,T),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+N.width+"x"+N.height+") to ("+R+"x"+T+")."),V}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+N.width+"x"+N.height+")."),N;return N}function x(N){return aC(N.width)&&aC(N.height)}function _(N){return a?!1:N.wrapS!==Ai||N.wrapT!==Ai||N.minFilter!==$n&&N.minFilter!==si}function C(N,j){return N.generateMipmaps&&j&&N.minFilter!==$n&&N.minFilter!==si}function S(N){n.generateMipmap(N)}function b(N,j,se,he,me=!1){if(a===!1)return j;if(N!==null){if(n[N]!==void 0)return n[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let G=j;return j===6403&&(se===5126&&(G=33326),se===5131&&(G=33325),se===5121&&(G=33321)),j===33319&&(se===5126&&(G=33328),se===5131&&(G=33327),se===5121&&(G=33323)),j===6408&&(se===5126&&(G=34836),se===5131&&(G=34842),se===5121&&(G=he===pt&&me===!1?35907:32856),se===32819&&(G=32854),se===32820&&(G=32855)),(G===33325||G===33326||G===33327||G===33328||G===34842||G===34836)&&e.get("EXT_color_buffer_float"),G}function M(N,j,se){return C(N,se)===!0||N.isFramebufferTexture&&N.minFilter!==$n&&N.minFilter!==si?Math.log2(Math.max(j.width,j.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?j.mipmaps.length:1}function D(N){return N===$n||N===pw||N===qp?9728:9729}function $(N){const j=N.target;j.removeEventListener("dispose",$),I(j),j.isVideoTexture&&p.delete(j)}function H(N){const j=N.target;j.removeEventListener("dispose",H),E(j)}function I(N){const j=r.get(N);if(j.__webglInit===void 0)return;const se=N.source,he=g.get(se);if(he){const me=he[j.__cacheKey];me.usedTimes--,me.usedTimes===0&&v(N),Object.keys(he).length===0&&g.delete(se)}r.remove(N)}function v(N){const j=r.get(N);n.deleteTexture(j.__webglTexture);const se=N.source,he=g.get(se);delete he[j.__cacheKey],o.memory.textures--}function E(N){const j=N.texture,se=r.get(N),he=r.get(j);if(he.__webglTexture!==void 0&&(n.deleteTexture(he.__webglTexture),o.memory.textures--),N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let me=0;me<6;me++)n.deleteFramebuffer(se.__webglFramebuffer[me]),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer[me]);else{if(n.deleteFramebuffer(se.__webglFramebuffer),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer),se.__webglMultisampledFramebuffer&&n.deleteFramebuffer(se.__webglMultisampledFramebuffer),se.__webglColorRenderbuffer)for(let me=0;me=l&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+l),U+=1,N}function z(N){const j=[];return j.push(N.wrapS),j.push(N.wrapT),j.push(N.wrapR||0),j.push(N.magFilter),j.push(N.minFilter),j.push(N.anisotropy),j.push(N.internalFormat),j.push(N.format),j.push(N.type),j.push(N.generateMipmaps),j.push(N.premultiplyAlpha),j.push(N.flipY),j.push(N.unpackAlignment),j.push(N.encoding),j.join()}function K(N,j){const se=r.get(N);if(N.isVideoTexture&&xe(N),N.isRenderTargetTexture===!1&&N.version>0&&se.__version!==N.version){const he=N.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{le(se,N,j);return}}t.bindTexture(3553,se.__webglTexture,33984+j)}function O(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){le(se,N,j);return}t.bindTexture(35866,se.__webglTexture,33984+j)}function B(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){le(se,N,j);return}t.bindTexture(32879,se.__webglTexture,33984+j)}function W(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){oe(se,N,j);return}t.bindTexture(34067,se.__webglTexture,33984+j)}const ee={[As]:10497,[Ai]:33071,[Om]:33648},F={[$n]:9728,[pw]:9984,[qp]:9986,[si]:9729,[WM]:9985,[DA]:9987};function X(N,j,se){if(se?(n.texParameteri(N,10242,ee[j.wrapS]),n.texParameteri(N,10243,ee[j.wrapT]),(N===32879||N===35866)&&n.texParameteri(N,32882,ee[j.wrapR]),n.texParameteri(N,10240,F[j.magFilter]),n.texParameteri(N,10241,F[j.minFilter])):(n.texParameteri(N,10242,33071),n.texParameteri(N,10243,33071),(N===32879||N===35866)&&n.texParameteri(N,32882,33071),(j.wrapS!==Ai||j.wrapT!==Ai)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(N,10240,D(j.magFilter)),n.texParameteri(N,10241,D(j.minFilter)),j.minFilter!==$n&&j.minFilter!==si&&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 he=e.get("EXT_texture_filter_anisotropic");if(j.magFilter===$n||j.minFilter!==qp&&j.minFilter!==DA||j.type===AA&&e.has("OES_texture_float_linear")===!1||a===!1&&j.type===Nm&&e.has("OES_texture_half_float_linear")===!1)return;(j.anisotropy>1||r.get(j).__currentAnisotropy)&&(n.texParameterf(N,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(j.anisotropy,i.getMaxAnisotropy())),r.get(j).__currentAnisotropy=j.anisotropy)}}function ue(N,j){let se=!1;N.__webglInit===void 0&&(N.__webglInit=!0,j.addEventListener("dispose",$));const he=j.source;let me=g.get(he);me===void 0&&(me={},g.set(he,me));const G=z(j);if(G!==N.__cacheKey){me[G]===void 0&&(me[G]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,se=!0),me[G].usedTimes++;const R=me[N.__cacheKey];R!==void 0&&(me[N.__cacheKey].usedTimes--,R.usedTimes===0&&v(j)),N.__cacheKey=G,N.__webglTexture=me[G].texture}return se}function le(N,j,se){let he=3553;(j.isDataArrayTexture||j.isCompressedArrayTexture)&&(he=35866),j.isData3DTexture&&(he=32879);const me=ue(N,j),G=j.source;t.bindTexture(he,N.__webglTexture,33984+se);const R=r.get(G);if(G.version!==R.__version||me===!0){t.activeTexture(33984+se),n.pixelStorei(37440,j.flipY),n.pixelStorei(37441,j.premultiplyAlpha),n.pixelStorei(3317,j.unpackAlignment),n.pixelStorei(37443,0);const T=_(j)&&x(j.image)===!1;let V=w(j.image,T,!1,c);V=be(j,V);const te=x(V)||a,ae=s.convert(j.format,j.encoding);let ie=s.convert(j.type),Te=b(j.internalFormat,ae,ie,j.encoding,j.isVideoTexture);X(he,j,te);let Me;const Le=j.mipmaps,ke=a&&j.isVideoTexture!==!0,De=R.__version===void 0||me===!0,fe=M(j,V,te);if(j.isDepthTexture)Te=6402,a?j.type===AA?Te=36012:j.type===Ec?Te=33190:j.type===lh?Te=35056:Te=33189:j.type===AA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),j.format===Pc&&Te===6402&&j.type!==cH&&j.type!==Ec&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),j.type=Ec,ie=s.convert(j.type)),j.format===Dh&&Te===6402&&(Te=34041,j.type!==lh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),j.type=lh,ie=s.convert(j.type))),De&&(ke?t.texStorage2D(3553,1,Te,V.width,V.height):t.texImage2D(3553,0,Te,V.width,V.height,0,ae,ie,null));else if(j.isDataTexture)if(Le.length>0&&te){ke&&De&&t.texStorage2D(3553,fe,Te,Le[0].width,Le[0].height);for(let Ce=0,Se=Le.length;Ce>=1,Se>>=1}}else if(Le.length>0&&te){ke&&De&&t.texStorage2D(3553,fe,Te,Le[0].width,Le[0].height);for(let Ce=0,Se=Le.length;Ce0&&De++,t.texStorage2D(34067,De,Me,V[0].width,V[0].height));for(let Ce=0;Ce<6;Ce++)if(T){Le?t.texSubImage2D(34069+Ce,0,0,0,V[Ce].width,V[Ce].height,ie,Te,V[Ce].data):t.texImage2D(34069+Ce,0,Me,V[Ce].width,V[Ce].height,0,ie,Te,V[Ce].data);for(let Se=0;Se=34069&&me<=34074)&&n.framebufferTexture2D(36160,he,me,r.get(se).__webglTexture,0),t.bindFramebuffer(36160,null)}function pe(N,j,se){if(n.bindRenderbuffer(36161,N),j.depthBuffer&&!j.stencilBuffer){let he=33189;if(se||ce(j)){const me=j.depthTexture;me&&me.isDepthTexture&&(me.type===AA?he=36012:me.type===Ec&&(he=33190));const G=J(j);ce(j)?f.renderbufferStorageMultisampleEXT(36161,G,he,j.width,j.height):n.renderbufferStorageMultisample(36161,G,he,j.width,j.height)}else n.renderbufferStorage(36161,he,j.width,j.height);n.framebufferRenderbuffer(36160,36096,36161,N)}else if(j.depthBuffer&&j.stencilBuffer){const he=J(j);se&&ce(j)===!1?n.renderbufferStorageMultisample(36161,he,35056,j.width,j.height):ce(j)?f.renderbufferStorageMultisampleEXT(36161,he,35056,j.width,j.height):n.renderbufferStorage(36161,34041,j.width,j.height),n.framebufferRenderbuffer(36160,33306,36161,N)}else{const he=j.isWebGLMultipleRenderTargets===!0?j.texture:[j.texture];for(let me=0;me0&&ce(N)===!1){const T=G?j:[j];se.__webglMultisampledFramebuffer=n.createFramebuffer(),se.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,se.__webglMultisampledFramebuffer);for(let V=0;V0&&ce(N)===!1){const j=N.isWebGLMultipleRenderTargets?N.texture:[N.texture],se=N.width,he=N.height;let me=16384;const G=[],R=N.stencilBuffer?33306:36096,T=r.get(N),V=N.isWebGLMultipleRenderTargets===!0;if(V)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&j.__useRenderToTexture!==!1}function xe(N){const j=o.render.frame;p.get(N)!==j&&(p.set(N,j),N.update())}function be(N,j){const se=N.encoding,he=N.format,me=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||N.format===oC||se!==cs&&(se===pt?a===!1?e.has("EXT_sRGB")===!0&&he===br?(N.format=oC,N.minFilter=si,N.generateMipmaps=!1):j=pH.sRGBToLinear(j):(he!==br||me!==OA)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",se)),j}this.allocateTextureUnit=L,this.resetTextureUnits=P,this.setTexture2D=K,this.setTexture2DArray=O,this.setTexture3D=B,this.setTextureCube=W,this.rebindTextures=Q,this.setupRenderTarget=de,this.updateRenderTargetMipmap=Ae,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=re,this.useMultisampledRTT=ce}function gte(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===OA)return 5121;if(s===WY)return 32819;if(s===KY)return 32820;if(s===GY)return 5120;if(s===VY)return 5122;if(s===cH)return 5123;if(s===jY)return 5124;if(s===Ec)return 5125;if(s===AA)return 5126;if(s===Nm)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===$Y)return 6406;if(s===br)return 6408;if(s===YY)return 6409;if(s===XY)return 6410;if(s===Pc)return 6402;if(s===Dh)return 34041;if(s===oC)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ZY)return 6403;if(s===JY)return 36244;if(s===qY)return 33319;if(s===eX)return 33320;if(s===tX)return 36249;if(s===D1||s===O1||s===N1||s===k1)if(o===pt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===D1)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===O1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===N1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===k1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===D1)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===O1)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===N1)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===k1)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===fF||s===hF||s===dF||s===pF)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===fF)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===hF)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===dF)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===pF)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===nX)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===mF||s===gF)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===mF)return o===pt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===gF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===vF||s===yF||s===wF||s===xF||s===_F||s===bF||s===BF||s===EF||s===CF||s===SF||s===MF||s===TF||s===IF||s===RF)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===vF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===yF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===wF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===xF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===_F)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===bF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===BF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===EF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===CF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===SF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===MF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===TF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===IF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===RF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Q1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Q1)return o===pt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===rX||s===FF||s===UF||s===LF)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Q1)return a.COMPRESSED_RED_RGTC1_EXT;if(s===FF)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===UF)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===LF)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===lh?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 vte extends Fr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ur extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const yte={type:"move"};class fb{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ur,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 Ur,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ur,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),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}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data: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 d of e.hand.values()){const g=t.getJointPose(d,r),m=this._getHandJoint(A,d);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"],f=c.position.distanceTo(u.position),h=.02,p=.005;A.inputState.pinching&&f>h+p?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!A.inputState.pinching&&f<=h-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(yte)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),A!==null&&(A.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Ur;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class CH extends Qn{constructor(e,t,r,i,s,o,a,l,A,c){if(c=c!==void 0?c:Pc,c!==Pc&&c!==Dh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&c===Pc&&(r=Ec),r===void 0&&c===Dh&&(r=lh),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:$n,this.minFilter=l!==void 0?l:$n,this.flipY=!1,this.generateMipmaps=!1}}class wte extends YA{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,A=null,c=null,u=null,f=null,h=null,p=null;const d=t.getContextAttributes();let g=null,m=null;const y=[],w=[],x=new Set,_=new Map,C=new Fr;C.layers.enable(1),C.viewport=new Qt;const S=new Fr;S.layers.enable(2),S.viewport=new Qt;const b=[C,S],M=new vte;M.layers.enable(1),M.layers.enable(2);let D=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getTargetRaySpace()},this.getControllerGrip=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getGripSpace()},this.getHand=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getHandSpace()};function H(B){const W=w.indexOf(B.inputSource);if(W===-1)return;const ee=y[W];ee!==void 0&&ee.dispatchEvent({type:B.type,data:B.inputSource})}function I(){i.removeEventListener("select",H),i.removeEventListener("selectstart",H),i.removeEventListener("selectend",H),i.removeEventListener("squeeze",H),i.removeEventListener("squeezestart",H),i.removeEventListener("squeezeend",H),i.removeEventListener("end",I),i.removeEventListener("inputsourceschange",v);for(let B=0;B=0&&(w[F]=null,y[F].disconnect(ee))}for(let W=0;W=w.length){w.push(ee),F=ue;break}else if(w[ue]===null){w[ue]=ee,F=ue;break}if(F===-1)break}const X=y[F];X&&X.connect(ee)}}const E=new Z,U=new Z;function P(B,W,ee){E.setFromMatrixPosition(W.matrixWorld),U.setFromMatrixPosition(ee.matrixWorld);const F=E.distanceTo(U),X=W.projectionMatrix.elements,ue=ee.projectionMatrix.elements,le=X[14]/(X[10]-1),oe=X[14]/(X[10]+1),re=(X[9]+1)/X[5],pe=(X[9]-1)/X[5],_e=(X[8]-1)/X[0],Re=(ue[8]+1)/ue[0],Q=le*_e,de=le*Re,Ae=F/(-_e+Re),q=Ae*-_e;W.matrixWorld.decompose(B.position,B.quaternion,B.scale),B.translateX(q),B.translateZ(Ae),B.matrixWorld.compose(B.position,B.quaternion,B.scale),B.matrixWorldInverse.copy(B.matrixWorld).invert();const J=le+Ae,ce=oe+Ae,xe=Q-q,be=de+(F-q),N=re*oe/ce*J,j=pe*oe/ce*J;B.projectionMatrix.makePerspective(xe,be,N,j,J,ce)}function L(B,W){W===null?B.matrixWorld.copy(B.matrix):B.matrixWorld.multiplyMatrices(W.matrixWorld,B.matrix),B.matrixWorldInverse.copy(B.matrixWorld).invert()}this.updateCamera=function(B){if(i===null)return;M.near=S.near=C.near=B.near,M.far=S.far=C.far=B.far,(D!==M.near||$!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),D=M.near,$=M.far);const W=B.parent,ee=M.cameras;L(M,W);for(let X=0;XX&&(_.set(F,F.lastChangedTime),r.dispatchEvent({type:"planechanged",data:F}))}}p=null}const O=new xH;O.setAnimationLoop(K),this.setAnimationLoop=function(B){z=B},this.dispose=function(){}}}function xte(n,e){function t(d,g){g.color.getRGB(d.fogColor.value,vH(n)),g.isFog?(d.fogNear.value=g.near,d.fogFar.value=g.far):g.isFogExp2&&(d.fogDensity.value=g.density)}function r(d,g,m,y,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?i(d,g):g.isMeshToonMaterial?(i(d,g),c(d,g)):g.isMeshPhongMaterial?(i(d,g),A(d,g)):g.isMeshStandardMaterial?(i(d,g),u(d,g),g.isMeshPhysicalMaterial&&f(d,g,w)):g.isMeshMatcapMaterial?(i(d,g),h(d,g)):g.isMeshDepthMaterial?i(d,g):g.isMeshDistanceMaterial?(i(d,g),p(d,g)):g.isMeshNormalMaterial?i(d,g):g.isLineBasicMaterial?(s(d,g),g.isLineDashedMaterial&&o(d,g)):g.isPointsMaterial?a(d,g,m,y):g.isSpriteMaterial?l(d,g):g.isShadowMaterial?(d.color.value.copy(g.color),d.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function i(d,g){d.opacity.value=g.opacity,g.color&&d.diffuse.value.copy(g.color),g.emissive&&d.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.bumpMap&&(d.bumpMap.value=g.bumpMap,d.bumpScale.value=g.bumpScale,g.side===Xr&&(d.bumpScale.value*=-1)),g.displacementMap&&(d.displacementMap.value=g.displacementMap,d.displacementScale.value=g.displacementScale,d.displacementBias.value=g.displacementBias),g.emissiveMap&&(d.emissiveMap.value=g.emissiveMap),g.normalMap&&(d.normalMap.value=g.normalMap,d.normalScale.value.copy(g.normalScale),g.side===Xr&&d.normalScale.value.negate()),g.specularMap&&(d.specularMap.value=g.specularMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);const m=e.get(g).envMap;if(m&&(d.envMap.value=m,d.flipEnvMap.value=m.isCubeTexture&&m.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=g.reflectivity,d.ior.value=g.ior,d.refractionRatio.value=g.refractionRatio),g.lightMap){d.lightMap.value=g.lightMap;const x=n.physicallyCorrectLights!==!0?Math.PI:1;d.lightMapIntensity.value=g.lightMapIntensity*x}g.aoMap&&(d.aoMap.value=g.aoMap,d.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.iridescenceMap?y=g.iridescenceMap:g.iridescenceThicknessMap?y=g.iridescenceThicknessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),d.uvTransform.value.copy(y.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(),d.uv2Transform.value.copy(w.matrix))}function s(d,g){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity}function o(d,g){d.dashSize.value=g.dashSize,d.totalSize.value=g.dashSize+g.gapSize,d.scale.value=g.scale}function a(d,g,m,y){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity,d.size.value=g.size*m,d.scale.value=y*.5,g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),d.uvTransform.value.copy(w.matrix))}function l(d,g){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity,d.rotation.value=g.rotation,g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);let m;g.map?m=g.map:g.alphaMap&&(m=g.alphaMap),m!==void 0&&(m.matrixAutoUpdate===!0&&m.updateMatrix(),d.uvTransform.value.copy(m.matrix))}function A(d,g){d.specular.value.copy(g.specular),d.shininess.value=Math.max(g.shininess,1e-4)}function c(d,g){g.gradientMap&&(d.gradientMap.value=g.gradientMap)}function u(d,g){d.roughness.value=g.roughness,d.metalness.value=g.metalness,g.roughnessMap&&(d.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(d.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(d.envMapIntensity.value=g.envMapIntensity)}function f(d,g,m){d.ior.value=g.ior,g.sheen>0&&(d.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),d.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(d.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(d.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(d.clearcoat.value=g.clearcoat,d.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(d.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(d.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),d.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Xr&&d.clearcoatNormalScale.value.negate())),g.iridescence>0&&(d.iridescence.value=g.iridescence,d.iridescenceIOR.value=g.iridescenceIOR,d.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(d.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(d.transmission.value=g.transmission,d.transmissionSamplerMap.value=m.texture,d.transmissionSamplerSize.value.set(m.width,m.height),g.transmissionMap&&(d.transmissionMap.value=g.transmissionMap),d.thickness.value=g.thickness,g.thicknessMap&&(d.thicknessMap.value=g.thicknessMap),d.attenuationDistance.value=g.attenuationDistance,d.attenuationColor.value.copy(g.attenuationColor)),d.specularIntensity.value=g.specularIntensity,d.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(d.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(d.specularColorMap.value=g.specularColorMap)}function h(d,g){g.matcap&&(d.matcap.value=g.matcap)}function p(d,g){d.referencePosition.value.copy(g.referencePosition),d.nearDistance.value=g.nearDistance,d.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function _te(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(y,w){const x=w.program;r.uniformBlockBinding(y,x)}function A(y,w){let x=i[y.id];x===void 0&&(p(y),x=c(y),i[y.id]=x,y.addEventListener("dispose",g));const _=w.program;r.updateUBOMapping(y,_);const C=e.render.frame;s[y.id]!==C&&(f(y),s[y.id]=C)}function c(y){const w=u();y.__bindingPointIndex=w;const x=n.createBuffer(),_=y.__size,C=y.usage;return n.bindBuffer(35345,x),n.bufferData(35345,_,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,w,x),x}function u(){for(let y=0;y0){C=x%_;const H=_-C;C!==0&&H-D.boundary<0&&(x+=_-C,M.__offset=x)}x+=D.storage}return C=x%_,C>0&&(x+=_-C),y.__size=x,y.__cache={},this}function d(y){const w={boundary:0,storage:0};return typeof y=="number"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),w}function g(y){const w=y.target;w.removeEventListener("dispose",g);const x=o.indexOf(w.__bindingPointIndex);o.splice(x,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function m(){for(const y in i)n.deleteBuffer(i[y]);o=[],i={},s={}}return{bind:l,update:A,dispose:m}}function bte(){const n=Hm("canvas");return n.style.display="block",n}function vg(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:bte(),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,f=null;const h=[],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=cs,this.physicallyCorrectLights=!1,this.toneMapping=ll,this.toneMappingExposure=1;const d=this;let g=!1,m=0,y=0,w=null,x=-1,_=null;const C=new Qt,S=new Qt;let b=null,M=e.width,D=e.height,$=1,H=null,I=null;const v=new Qt(0,0,M,D),E=new Qt(0,0,M,D);let U=!1;const P=new JM;let L=!1,z=!1,K=null;const O=new je,B=new $e,W=new Z,ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function F(){return w===null?$:1}let X=t;function ue(ne,ge){for(let Be=0;Be0?f=p[p.length-1]:f=null,h.pop(),h.length>0?u=h[h.length-1]:u=null};function ct(ne,ge,Be,we){if(ne.visible===!1)return;if(ne.layers.test(ge.layers)){if(ne.isGroup)Be=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(ge);else if(ne.isLight)f.pushLight(ne),ne.castShadow&&f.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||P.intersectsSprite(ne)){we&&W.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(O);const st=J.update(ne),Ze=ne.material;Ze.visible&&u.push(ne,st,Ze,Be,W.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(ne.isSkinnedMesh&&ne.skeleton.frame!==pe.render.frame&&(ne.skeleton.update(),ne.skeleton.frame=pe.render.frame),!ne.frustumCulled||P.intersectsObject(ne))){we&&W.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(O);const st=J.update(ne),Ze=ne.material;if(Array.isArray(Ze)){const Je=st.groups;for(let yt=0,mt=Je.length;yt0&&Ct(Ee,ge,Be),we&&re.viewport(C.copy(we)),Ee.length>0&&it(Ee,ge,Be),ze.length>0&&it(ze,ge,Be),st.length>0&&it(st,ge,Be),re.buffers.depth.setTest(!0),re.buffers.depth.setMask(!0),re.buffers.color.setMask(!0),re.setPolygonOffset(!1)}function Ct(ne,ge,Be){const we=oe.isWebGL2;K===null&&(K=new ma(1,1,{generateMipmaps:!0,type:le.has("EXT_color_buffer_half_float")?Nm:OA,minFilter:DA,samples:we&&s===!0?4:0})),d.getDrawingBufferSize(B),we?K.setSize(B.x,B.y):K.setSize(gw(B.x),gw(B.y));const Ee=d.getRenderTarget();d.setRenderTarget(K),d.clear();const ze=d.toneMapping;d.toneMapping=ll,it(ne,ge,Be),d.toneMapping=ze,Re.updateMultisampleRenderTarget(K),Re.updateRenderTargetMipmap(K),d.setRenderTarget(Ee)}function it(ne,ge,Be){const we=ge.isScene===!0?ge.overrideMaterial:null;for(let Ee=0,ze=ne.length;Ee0&&Re.useMultisampledRTT(ne)===!1?Ee=_e.get(ne).__webglMultisampledFramebuffer:Ee=mt,C.copy(ne.viewport),S.copy(ne.scissor),b=ne.scissorTest}else C.copy(v).multiplyScalar($).floor(),S.copy(E).multiplyScalar($).floor(),b=U;if(re.bindFramebuffer(36160,Ee)&&oe.drawBuffers&&we&&re.drawBuffers(ne,Ee),re.viewport(C),re.scissor(S),re.setScissorTest(b),ze){const Je=_e.get(ne.texture);X.framebufferTexture2D(36160,36064,34069+ge,Je.__webglTexture,Be)}else if(st){const Je=_e.get(ne.texture),yt=ge||0;X.framebufferTextureLayer(36160,36064,Je.__webglTexture,Be||0,yt)}x=-1},this.readRenderTargetPixels=function(ne,ge,Be,we,Ee,ze,st){if(!(ne&&ne.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ze=_e.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&st!==void 0&&(Ze=Ze[st]),Ze){re.bindFramebuffer(36160,Ze);try{const Je=ne.texture,yt=Je.format,mt=Je.type;if(yt!==br&&T.convert(yt)!==X.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const gt=mt===Nm&&(le.has("EXT_color_buffer_half_float")||oe.isWebGL2&&le.has("EXT_color_buffer_float"));if(mt!==OA&&T.convert(mt)!==X.getParameter(35738)&&!(mt===AA&&(oe.isWebGL2||le.has("OES_texture_float")||le.has("WEBGL_color_buffer_float")))&&!gt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ge>=0&&ge<=ne.width-we&&Be>=0&&Be<=ne.height-Ee&&X.readPixels(ge,Be,we,Ee,T.convert(yt),T.convert(mt),ze)}finally{const Je=w!==null?_e.get(w).__webglFramebuffer:null;re.bindFramebuffer(36160,Je)}}},this.copyFramebufferToTexture=function(ne,ge,Be=0){const we=Math.pow(2,-Be),Ee=Math.floor(ge.image.width*we),ze=Math.floor(ge.image.height*we);Re.setTexture2D(ge,0),X.copyTexSubImage2D(3553,Be,0,0,ne.x,ne.y,Ee,ze),re.unbindTexture()},this.copyTextureToTexture=function(ne,ge,Be,we=0){const Ee=ge.image.width,ze=ge.image.height,st=T.convert(Be.format),Ze=T.convert(Be.type);Re.setTexture2D(Be,0),X.pixelStorei(37440,Be.flipY),X.pixelStorei(37441,Be.premultiplyAlpha),X.pixelStorei(3317,Be.unpackAlignment),ge.isDataTexture?X.texSubImage2D(3553,we,ne.x,ne.y,Ee,ze,st,Ze,ge.image.data):ge.isCompressedTexture?X.compressedTexSubImage2D(3553,we,ne.x,ne.y,ge.mipmaps[0].width,ge.mipmaps[0].height,st,ge.mipmaps[0].data):X.texSubImage2D(3553,we,ne.x,ne.y,st,Ze,ge.image),we===0&&Be.generateMipmaps&&X.generateMipmap(3553),re.unbindTexture()},this.copyTextureToTexture3D=function(ne,ge,Be,we,Ee=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ze=ne.max.x-ne.min.x+1,st=ne.max.y-ne.min.y+1,Ze=ne.max.z-ne.min.z+1,Je=T.convert(we.format),yt=T.convert(we.type);let mt;if(we.isData3DTexture)Re.setTexture3D(we,0),mt=32879;else if(we.isDataArrayTexture)Re.setTexture2DArray(we,0),mt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}X.pixelStorei(37440,we.flipY),X.pixelStorei(37441,we.premultiplyAlpha),X.pixelStorei(3317,we.unpackAlignment);const gt=X.getParameter(3314),Zt=X.getParameter(32878),Rn=X.getParameter(3316),Di=X.getParameter(3315),qs=X.getParameter(32877),pn=Be.isCompressedTexture?Be.mipmaps[0]:Be.image;X.pixelStorei(3314,pn.width),X.pixelStorei(32878,pn.height),X.pixelStorei(3316,ne.min.x),X.pixelStorei(3315,ne.min.y),X.pixelStorei(32877,ne.min.z),Be.isDataTexture||Be.isData3DTexture?X.texSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,yt,pn.data):Be.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),X.compressedTexSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,pn.data)):X.texSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,yt,pn),X.pixelStorei(3314,gt),X.pixelStorei(32878,Zt),X.pixelStorei(3316,Rn),X.pixelStorei(3315,Di),X.pixelStorei(32877,qs),Ee===0&&we.generateMipmaps&&X.generateMipmap(mt),re.unbindTexture()},this.initTexture=function(ne){ne.isCubeTexture?Re.setTextureCube(ne,0):ne.isData3DTexture?Re.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Re.setTexture2DArray(ne,0):Re.setTexture2D(ne,0),re.unbindTexture()},this.resetState=function(){m=0,y=0,w=null,re.reset(),V.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Bte extends vg{}Bte.prototype.isWebGL1Renderer=!0;class vw extends It{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,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,this.backgroundIntensity=e.backgroundIntensity,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.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),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 Ete{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=sC,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Eo()}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;f.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(f);be.far||t.push({distance:b,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let w=m,x=y-1;wl)continue;f.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(f);Ce.far||t.push({distance:C,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 Rte{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],f=r[i+1]-c,h=(o-c)/f;return(i+h)/(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 $e:new Z);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 Z,i=[],s=[],o=[],a=new Z,l=new je;for(let h=0;h<=e;h++){const p=h/e;i[h]=this.getTangentAt(p,new Z)}s[0]=new Z,o[0]=new Z;let A=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);c<=A&&(A=c,r.set(1,0,0)),u<=A&&(A=u,r.set(0,1,0)),f<=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 h=1;h<=e;h++){if(s[h]=s[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(i[h-1],i[h]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(hr(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,p))}o[h].crossVectors(i[h],s[h])}if(t===!0){let h=Math.acos(hr(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],h*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 Gx extends $t{constructor(e=1,t=1,r=1,i=32,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=[],f=[],h=[];let p=0;const d=[],g=r/2;let m=0;y(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(c),this.setAttribute("position",new an(u,3)),this.setAttribute("normal",new an(f,3)),this.setAttribute("uv",new an(h,2));function y(){const x=new Z,_=new Z;let C=0;const S=(t-e)/r;for(let b=0;b<=s;b++){const M=[],D=b/s,$=D*(t-e)+e;for(let H=0;H<=i;H++){const I=H/i,v=I*l+a,E=Math.sin(v),U=Math.cos(v);_.x=$*E,_.y=-D*r+g,_.z=$*U,u.push(_.x,_.y,_.z),x.set(E,S,U).normalize(),f.push(x.x,x.y,x.z),h.push(I,1-D),M.push(p++)}d.push(M)}for(let b=0;b0)&&h.push(w,x,C),(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 db extends is{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Qe(16777215),this.specular=new Qe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Nx,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 Fte extends is{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(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 Ute extends is{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Qe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Nx,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 Nl(n,e,t){return TH(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function L0(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 TH(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Lte(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 TU(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 IH(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 wg{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=Nl(r,s,o),this.values=Nl(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&&TH(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=Nl(this.times),t=Nl(this.values),r=this.getValueSize(),i=this.getInterpolation()===H1,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=Nl(e,0,o),this.values=Nl(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=Nl(this.times,0),t=Nl(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}_a.prototype.TimeBufferType=Float32Array;_a.prototype.ValueBufferType=Float32Array;_a.prototype.DefaultInterpolation=$c;class nd extends _a{}nd.prototype.ValueTypeName="bool";nd.prototype.ValueBufferType=Array;nd.prototype.DefaultInterpolation=Oh;nd.prototype.InterpolantFactoryMethodLinear=void 0;nd.prototype.InterpolantFactoryMethodSmooth=void 0;class FH extends _a{}FH.prototype.ValueTypeName="color";class Qh extends _a{}Qh.prototype.ValueTypeName="number";class Ote extends wg{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 ga extends _a{InterpolantFactoryMethodLinear(e){return new Ote(this.times,this.values,this.getValueSize(),e)}}ga.prototype.ValueTypeName="quaternion";ga.prototype.DefaultInterpolation=$c;ga.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends _a{}rd.prototype.ValueTypeName="string";rd.prototype.ValueBufferType=Array;rd.prototype.DefaultInterpolation=Oh;rd.prototype.InterpolantFactoryMethodLinear=void 0;rd.prototype.InterpolantFactoryMethodSmooth=void 0;class NA extends _a{}NA.prototype.ValueTypeName="vector";class Yc{constructor(e,t=-1,r,i=KM){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Eo(),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(kte(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(_a.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 f=i[u];f||(i[u]=f=[]),f.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,f,h,p,d){if(h.length!==0){const g=[],m=[];IH(h,g,m,p),g.length!==0&&d.push(new u(f,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(La[e]!==void 0){La[e].push({onLoad:t,onProgress:r,onError:i});return}La[e]=[],La[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=La[e],u=A.body.getReader(),f=A.headers.get("Content-Length")||A.headers.get("X-File-Size"),h=f?parseInt(f):0,p=h!==0;let d=0;const g=new ReadableStream({start(m){y();function y(){u.read().then(({done:w,value:x})=>{if(w)m.close();else{d+=x.byteLength;const _=new ProgressEvent("progress",{lengthComputable:p,loaded:d,total:h});for(let C=0,S=c.length;C{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),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return A.arrayBuffer().then(p=>h.decode(p))}}}).then(A=>{Hh.add(e,A);const c=La[e];delete La[e];for(let u=0,f=c.length;u{const c=La[e];if(c===void 0)throw this.manager.itemError(e),A;delete La[e];for(let u=0,f=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 LH extends id{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=Hh.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Hm("img");function l(){c(),Hh.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 lu extends id{constructor(e){super(e)}load(e,t,r,i){const s=new Qn,o=new LH(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 Vx extends It{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Qe(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 pb=new je,IU=new Z,RU=new Z;class rT{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new $e(512,512),this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new JM,this._frameExtents=new $e(1,1),this._viewportCount=1,this._viewports=[new Qt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;IU.setFromMatrixPosition(e.matrixWorld),t.position.copy(IU),RU.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(RU),t.updateMatrixWorld(),pb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pb),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(pb)}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 zte extends rT{constructor(){super(new Fr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Qm*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 PH extends Vx{constructor(e,t,r=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new zte}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 FU=new je,zd=new Z,mb=new Z;class Gte extends rT{constructor(){super(new Fr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new $e(4,2),this._viewportCount=6,this._viewports=[new Qt(2,1,1,1),new Qt(0,1,1,1),new Qt(3,1,1,1),new Qt(1,1,1,1),new Qt(3,0,1,1),new Qt(1,0,1,1)],this._cubeDirections=[new Z(1,0,0),new Z(-1,0,0),new Z(0,0,1),new Z(0,0,-1),new Z(0,1,0),new Z(0,-1,0)],this._cubeUps=[new Z(0,1,0),new Z(0,1,0),new Z(0,1,0),new Z(0,1,0),new Z(0,0,1),new Z(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()),zd.setFromMatrixPosition(e.matrixWorld),r.position.copy(zd),mb.copy(r.position),mb.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(mb),r.updateMatrixWorld(),i.makeTranslation(-zd.x,-zd.y,-zd.z),FU.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(FU)}}class cC extends Vx{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new Gte}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 Vte extends rT{constructor(){super(new qh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class iT extends Vx{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.shadow=new Vte}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class DH extends Vx{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class xw{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=Hh.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){Hh.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 OH{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=UU(),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=UU();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function UU(){return(typeof performance>"u"?Date:performance).now()}class Wte{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 sT="\\[\\]\\.:\\/",Kte=new RegExp("["+sT+"]","g"),oT="[^"+sT+"]",$te="[^"+sT.replace("\\.","")+"]",Yte=/((?:WC+[\/:])*)/.source.replace("WC",oT),Xte=/(WCOD+)?/.source.replace("WCOD",$te),Zte=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oT),Jte=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oT),qte=new RegExp("^"+Yte+Xte+Zte+Jte+"$"),ene=["material","materials","bones","map"];class tne{constructor(e,t,r){const i=r||_t.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 _t{constructor(e,t,r){this.path=t,this.parsedPath=r||_t.parseTrackName(t),this.node=_t.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 _t.Composite(e,t,r):new _t(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Kte,"")}static parseTrackName(e){const t=qte.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);ene.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 aX:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulateAdditive(a);break;case KM: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===oX;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===iX){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=Gf,i.endingEnd=Gf):(e?i.endingStart=this.zeroSlopeAtStart?Gf:zf:i.endingStart=mw,t?i.endingEnd=this.zeroSlopeAtEnd?Gf:zf:i.endingEnd=mw)}_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 rne=new Float32Array(1);class ine extends YA{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 f=i[u],h=f.name;let p=c[h];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,h));continue}const d=t&&t._propertyBindings[u].binding.parsedPath;p=new Wte(_t.create(r,h,d),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,h),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&&(ke-=Te),De<-Math.PI?De+=Te:De>Math.PI&&(De-=Te),ke<=De?a.theta=Math.max(ke,Math.min(De,a.theta)):a.theta=a.theta>(ke+De)/2?Math.max(ke,a.theta):Math.min(De,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),T.setFromSpherical(a),T.applyQuaternion(te),Le.copy(r.target).add(T),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||ae.distanceToSquared(r.object.position)>o||8*(1-ie.dot(r.object.quaternion))>o?(r.dispatchEvent(NU),ae.copy(r.object.position),ie.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",se),r.domElement.removeEventListener("pointerdown",Q),r.domElement.removeEventListener("pointercancel",q),r.domElement.removeEventListener("wheel",xe),r.domElement.removeEventListener("pointermove",de),r.domElement.removeEventListener("pointerup",Ae),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 DU,l=new DU;let A=1;const c=new Z;let u=!1;const f=new $e,h=new $e,p=new $e,d=new $e,g=new $e,m=new $e,y=new $e,w=new $e,x=new $e,_=[],C={};function S(){return 2*Math.PI/60/60*r.autoRotateSpeed}function b(){return Math.pow(.95,r.zoomSpeed)}function M(T){l.theta-=T}function D(T){l.phi-=T}const $=function(){const T=new Z;return function(te,ae){T.setFromMatrixColumn(ae,0),T.multiplyScalar(-te),c.add(T)}}(),H=function(){const T=new Z;return function(te,ae){r.screenSpacePanning===!0?T.setFromMatrixColumn(ae,1):(T.setFromMatrixColumn(ae,0),T.crossVectors(r.object.up,T)),T.multiplyScalar(te),c.add(T)}}(),I=function(){const T=new Z;return function(te,ae){const ie=r.domElement;if(r.object.isPerspectiveCamera){const Te=r.object.position;T.copy(Te).sub(r.target);let Me=T.length();Me*=Math.tan(r.object.fov/2*Math.PI/180),$(2*te*Me/ie.clientHeight,r.object.matrix),H(2*ae*Me/ie.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?($(te*(r.object.right-r.object.left)/r.object.zoom/ie.clientWidth,r.object.matrix),H(ae*(r.object.top-r.object.bottom)/r.object.zoom/ie.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function v(T){r.object.isPerspectiveCamera?A/=T:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*T)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function E(T){r.object.isPerspectiveCamera?A*=T:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/T)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function U(T){f.set(T.clientX,T.clientY)}function P(T){y.set(T.clientX,T.clientY)}function L(T){d.set(T.clientX,T.clientY)}function z(T){h.set(T.clientX,T.clientY),p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),D(2*Math.PI*p.y/V.clientHeight),f.copy(h),r.update()}function K(T){w.set(T.clientX,T.clientY),x.subVectors(w,y),x.y>0?v(b()):x.y<0&&E(b()),y.copy(w),r.update()}function O(T){g.set(T.clientX,T.clientY),m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g),r.update()}function B(T){T.deltaY<0?E(b()):T.deltaY>0&&v(b()),r.update()}function W(T){let V=!1;switch(T.code){case r.keys.UP:T.ctrlKey||T.metaKey||T.shiftKey?D(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,r.keyPanSpeed),V=!0;break;case r.keys.BOTTOM:T.ctrlKey||T.metaKey||T.shiftKey?D(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,-r.keyPanSpeed),V=!0;break;case r.keys.LEFT:T.ctrlKey||T.metaKey||T.shiftKey?M(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(r.keyPanSpeed,0),V=!0;break;case r.keys.RIGHT:T.ctrlKey||T.metaKey||T.shiftKey?M(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(-r.keyPanSpeed,0),V=!0;break}V&&(T.preventDefault(),r.update())}function ee(){if(_.length===1)f.set(_[0].pageX,_[0].pageY);else{const T=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);f.set(T,V)}}function F(){if(_.length===1)d.set(_[0].pageX,_[0].pageY);else{const T=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);d.set(T,V)}}function X(){const T=_[0].pageX-_[1].pageX,V=_[0].pageY-_[1].pageY,te=Math.sqrt(T*T+V*V);y.set(0,te)}function ue(){r.enableZoom&&X(),r.enablePan&&F()}function le(){r.enableZoom&&X(),r.enableRotate&&ee()}function oe(T){if(_.length==1)h.set(T.pageX,T.pageY);else{const te=R(T),ae=.5*(T.pageX+te.x),ie=.5*(T.pageY+te.y);h.set(ae,ie)}p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),D(2*Math.PI*p.y/V.clientHeight),f.copy(h)}function re(T){if(_.length===1)g.set(T.pageX,T.pageY);else{const V=R(T),te=.5*(T.pageX+V.x),ae=.5*(T.pageY+V.y);g.set(te,ae)}m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g)}function pe(T){const V=R(T),te=T.pageX-V.x,ae=T.pageY-V.y,ie=Math.sqrt(te*te+ae*ae);w.set(0,ie),x.set(0,Math.pow(w.y/y.y,r.zoomSpeed)),v(x.y),y.copy(w)}function _e(T){r.enableZoom&&pe(T),r.enablePan&&re(T)}function Re(T){r.enableZoom&&pe(T),r.enableRotate&&oe(T)}function Q(T){r.enabled!==!1&&(_.length===0&&(r.domElement.setPointerCapture(T.pointerId),r.domElement.addEventListener("pointermove",de),r.domElement.addEventListener("pointerup",Ae)),he(T),T.pointerType==="touch"?N(T):J(T))}function de(T){r.enabled!==!1&&(T.pointerType==="touch"?j(T):ce(T))}function Ae(T){me(T),_.length===0&&(r.domElement.releasePointerCapture(T.pointerId),r.domElement.removeEventListener("pointermove",de),r.domElement.removeEventListener("pointerup",Ae)),r.dispatchEvent(kU),s=i.NONE}function q(T){me(T)}function J(T){let V;switch(T.button){case 0:V=r.mouseButtons.LEFT;break;case 1:V=r.mouseButtons.MIDDLE;break;case 2:V=r.mouseButtons.RIGHT;break;default:V=-1}switch(V){case wu.DOLLY:if(r.enableZoom===!1)return;P(T),s=i.DOLLY;break;case wu.ROTATE:if(T.ctrlKey||T.metaKey||T.shiftKey){if(r.enablePan===!1)return;L(T),s=i.PAN}else{if(r.enableRotate===!1)return;U(T),s=i.ROTATE}break;case wu.PAN:if(T.ctrlKey||T.metaKey||T.shiftKey){if(r.enableRotate===!1)return;U(T),s=i.ROTATE}else{if(r.enablePan===!1)return;L(T),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(gb)}function ce(T){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;z(T);break;case i.DOLLY:if(r.enableZoom===!1)return;K(T);break;case i.PAN:if(r.enablePan===!1)return;O(T);break}}function xe(T){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(T.preventDefault(),r.dispatchEvent(gb),B(T),r.dispatchEvent(kU))}function be(T){r.enabled===!1||r.enablePan===!1||W(T)}function N(T){switch(G(T),_.length){case 1:switch(r.touches.ONE){case xu.ROTATE:if(r.enableRotate===!1)return;ee(),s=i.TOUCH_ROTATE;break;case xu.PAN:if(r.enablePan===!1)return;F(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case xu.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ue(),s=i.TOUCH_DOLLY_PAN;break;case xu.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;le(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(gb)}function j(T){switch(G(T),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;oe(T),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;re(T),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;_e(T),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Re(T),r.update();break;default:s=i.NONE}}function se(T){r.enabled!==!1&&T.preventDefault()}function he(T){_.push(T)}function me(T){delete C[T.pointerId];for(let V=0;V<_.length;V++)if(_[V].pointerId==T.pointerId){_.splice(V,1);return}}function G(T){let V=C[T.pointerId];V===void 0&&(V=new $e,C[T.pointerId]=V),V.set(T.pageX,T.pageY)}function R(T){const V=T.pointerId===_[0].pointerId?_[1]:_[0];return C[V.pointerId]}r.domElement.addEventListener("contextmenu",se),r.domElement.addEventListener("pointerdown",Q),r.domElement.addEventListener("pointercancel",q),r.domElement.addEventListener("wheel",xe,{passive:!1}),this.update()}}function kH(n){let e,t,r,i=0;for(let a=0;a=2.0 are supported."));return}const A=new Pne(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});A.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}A.setExtensions(o),A.setPlugins(a),A.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function ane(){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 kt={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_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 lne{constructor(e){this.parser=e,this.name=kt.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 yne{constructor(e){this.parser=e,this.name=kt.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 wne{constructor(e){this.name=kt.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,f=new Uint8Array(a,l,A);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(c,u,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(c*u);return o.decodeGltfBuffer(new Uint8Array(h),c,u,f,i.mode,i.filter),h})})}else return null}}class xne{constructor(e){this.name=kt.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!==bs.TRIANGLES&&A.mode!==bs.TRIANGLE_STRIP&&A.mode!==bs.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],f=A[0].count,h=[];for(const p of u){const d=new je,g=new Z,m=new rt,y=new Z(1,1,1),w=new zx(p.geometry,p.material,f);for(let x=0;x0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Lne=new je;class Pne{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ane,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=!1,s=-1;typeof navigator<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||i&&s<98?this.textureLoader=new lu(this.options.manager):this.textureLoader=new jte(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new nT(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};Vd(s,a,i),Xl(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[A,c]of o.children.entries())s(c,a.children[A])};return s(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&g.setY(M,C[S*l+1]),l>=3&&g.setZ(M,C[S*l+2]),l>=4&&g.setW(M,C[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,r){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const A=this.loadImageSource(t,r).then(function(c){c.flipY=!1,c.name=o.name||a.name||"";const f=(s.samplers||{})[o.sampler]||{};return c.magFilter=zU[f.magFilter]||si,c.minFilter=zU[f.minFilter]||DA,c.wrapS=GU[f.wrapS]||As,c.wrapT=GU[f.wrapT]||As,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=A,A}loadImageSource(e,t){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",A=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(u){A=!0;const f=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(u){return new Promise(function(f,h){let p=f;t.isImageBitmapLoader===!0&&(p=function(d){const g=new Qn(d);g.needsUpdate=!0,f(g)}),t.load(xw.resolveURL(u,s.path),p,void 0,h)})}).then(function(u){return A===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||Une(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=c,c}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord!=0&&!(t==="aoMap"&&r.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),s.extensions[kt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[kt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[kt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.encoding=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new MH,is.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Cl,is.prototype.copy.call(l,r),l.color.copy(r.color),this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}r.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=r}getMaterialType(){return kh}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},A=[];if(l[kt.KHR_MATERIALS_UNLIT]){const u=i[kt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),A.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new Qe(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.fromArray(f),a.opacity=f[3]}u.baseColorTexture!==void 0&&A.push(t.assignTexture(a,"map",u.baseColorTexture,pt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(A.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),A.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),A.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ui);const c=s.alphaMode||yb.OPAQUE;if(c===yb.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===yb.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Ei&&(A.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new $e(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}return s.occlusionTexture!==void 0&&o!==Ei&&(A.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Ei&&(a.emissive=new Qe().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Ei&&A.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,pt)),Promise.all(A).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Xl(u,s),t.associations.set(u,{materials:e}),s.extensions&&Vd(i,u,s),u})}createUniqueName(e){const t=_t.sanitizeNodeName(e||"");let r=t;for(let i=1;this.nodeNamesUsed[r];++i)r=t+"_"+i;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[kt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return jU(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Rne(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),Xl(m,s),g.extensions&&Vd(i,m,g),t.assignFinalMaterial(m),u.push(m)}for(let h=0,p=u.length;h1?u=new Ur:l.length===1?u=l[0]:u=new It,u!==l[0])for(let f=0,h=l.length;f{const u=new Map;for(const[f,h]of i.associations)(f instanceof is||f instanceof Qn)&&u.set(f,h);return c.traverse(f=>{const h=i.associations.get(f);h!=null&&u.set(f,h)}),u};return i.associations=A(s),s})}}function Dne(n,e,t){const r=e.attributes,i=new ps;if(r.POSITION!==void 0){const a=t.json.accessors[r.POSITION],l=a.min,A=a.max;if(l!==void 0&&A!==void 0){if(i.set(new Z(l[0],l[1],l[2]),new Z(A[0],A[1],A[2])),a.normalized){const c=hC(Ah[a.componentType]);i.min.multiplyScalar(c),i.max.multiplyScalar(c)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new Z,l=new Z;for(let A=0,c=s.length;Ac||i.y>c)&&(i.x>c&&(s.x=Math.floor(c/E.x),i.x=s.x*E.x,v.mapSize.x=s.x),i.y>c&&(s.y=Math.floor(c/E.y),i.y=s.y*E.y,v.mapSize.y=s.y)),v.map===null){const P=this.type!==_p?{minFilter:$n,magFilter:$n}:{};v.map=new ma(i.x,i.y,P),v.map.texture.name=I.name+".shadowMap",v.camera.updateProjectionMatrix()}n.setRenderTarget(v.map),n.clear();const U=v.getViewportCount();for(let P=0;P0||_.map&&_.alphaTest>0){const H=D.uuid,I=_.uuid;let v=A[H];v===void 0&&(v={},A[H]=v);let E=v[I];E===void 0&&(E=D.clone(),v[I]=E),D=E}return D.visible=_.visible,D.wireframe=_.wireframe,M===_p?D.side=_.shadowSide!==null?_.shadowSide:_.side:D.side=_.shadowSide!==null?_.shadowSide:u[_.side],D.alphaMap=_.alphaMap,D.alphaTest=_.alphaTest,D.map=_.map,D.clipShadows=_.clipShadows,D.clippingPlanes=_.clippingPlanes,D.clipIntersection=_.clipIntersection,D.displacementMap=_.displacementMap,D.displacementScale=_.displacementScale,D.displacementBias=_.displacementBias,D.wireframeLinewidth=_.wireframeLinewidth,D.linewidth=_.linewidth,C.isPointLight===!0&&D.isMeshDistanceMaterial===!0&&(D.referencePosition.setFromMatrixPosition(C.matrixWorld),D.nearDistance=S,D.farDistance=b),D}function w(x,_,C,S,b){if(x.visible===!1)return;if(x.layers.test(_.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&b===_p)&&(!x.frustumCulled||r.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,x.matrixWorld);const $=e.update(x),H=x.material;if(Array.isArray(H)){const I=$.groups;for(let v=0,E=I.length;v=1):L.indexOf("OpenGL ES")!==-1&&(P=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),U=P>=2);let z=null,K={};const O=n.getParameter(3088),B=n.getParameter(2978),W=new Qt().fromArray(O),ee=new Qt().fromArray(B);function F(fe,Ce,Se){const Fe=new Uint8Array(4),We=n.createTexture();n.bindTexture(fe,We),n.texParameteri(fe,10241,9728),n.texParameteri(fe,10240,9728);for(let qe=0;qe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap;let d;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(N,j){return m?new OffscreenCanvas(N,j):Hm("canvas")}function w(N,j,se,he){let me=1;if((N.width>he||N.height>he)&&(me=he/Math.max(N.width,N.height)),me<1||j===!0)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap){const G=j?gw:Math.floor,R=G(me*N.width),T=G(me*N.height);d===void 0&&(d=y(R,T));const V=se?y(R,T):d;return V.width=R,V.height=T,V.getContext("2d").drawImage(N,0,0,R,T),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+N.width+"x"+N.height+") to ("+R+"x"+T+")."),V}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+N.width+"x"+N.height+")."),N;return N}function x(N){return aC(N.width)&&aC(N.height)}function _(N){return a?!1:N.wrapS!==Ai||N.wrapT!==Ai||N.minFilter!==$n&&N.minFilter!==si}function C(N,j){return N.generateMipmaps&&j&&N.minFilter!==$n&&N.minFilter!==si}function S(N){n.generateMipmap(N)}function b(N,j,se,he,me=!1){if(a===!1)return j;if(N!==null){if(n[N]!==void 0)return n[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let G=j;return j===6403&&(se===5126&&(G=33326),se===5131&&(G=33325),se===5121&&(G=33321)),j===33319&&(se===5126&&(G=33328),se===5131&&(G=33327),se===5121&&(G=33323)),j===6408&&(se===5126&&(G=34836),se===5131&&(G=34842),se===5121&&(G=he===pt&&me===!1?35907:32856),se===32819&&(G=32854),se===32820&&(G=32855)),(G===33325||G===33326||G===33327||G===33328||G===34842||G===34836)&&e.get("EXT_color_buffer_float"),G}function M(N,j,se){return C(N,se)===!0||N.isFramebufferTexture&&N.minFilter!==$n&&N.minFilter!==si?Math.log2(Math.max(j.width,j.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?j.mipmaps.length:1}function D(N){return N===$n||N===pw||N===qp?9728:9729}function $(N){const j=N.target;j.removeEventListener("dispose",$),I(j),j.isVideoTexture&&p.delete(j)}function H(N){const j=N.target;j.removeEventListener("dispose",H),E(j)}function I(N){const j=r.get(N);if(j.__webglInit===void 0)return;const se=N.source,he=g.get(se);if(he){const me=he[j.__cacheKey];me.usedTimes--,me.usedTimes===0&&v(N),Object.keys(he).length===0&&g.delete(se)}r.remove(N)}function v(N){const j=r.get(N);n.deleteTexture(j.__webglTexture);const se=N.source,he=g.get(se);delete he[j.__cacheKey],o.memory.textures--}function E(N){const j=N.texture,se=r.get(N),he=r.get(j);if(he.__webglTexture!==void 0&&(n.deleteTexture(he.__webglTexture),o.memory.textures--),N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let me=0;me<6;me++)n.deleteFramebuffer(se.__webglFramebuffer[me]),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer[me]);else{if(n.deleteFramebuffer(se.__webglFramebuffer),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer),se.__webglMultisampledFramebuffer&&n.deleteFramebuffer(se.__webglMultisampledFramebuffer),se.__webglColorRenderbuffer)for(let me=0;me=l&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+l),U+=1,N}function z(N){const j=[];return j.push(N.wrapS),j.push(N.wrapT),j.push(N.wrapR||0),j.push(N.magFilter),j.push(N.minFilter),j.push(N.anisotropy),j.push(N.internalFormat),j.push(N.format),j.push(N.type),j.push(N.generateMipmaps),j.push(N.premultiplyAlpha),j.push(N.flipY),j.push(N.unpackAlignment),j.push(N.encoding),j.join()}function K(N,j){const se=r.get(N);if(N.isVideoTexture&&xe(N),N.isRenderTargetTexture===!1&&N.version>0&&se.__version!==N.version){const he=N.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{le(se,N,j);return}}t.bindTexture(3553,se.__webglTexture,33984+j)}function O(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){le(se,N,j);return}t.bindTexture(35866,se.__webglTexture,33984+j)}function B(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){le(se,N,j);return}t.bindTexture(32879,se.__webglTexture,33984+j)}function W(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){oe(se,N,j);return}t.bindTexture(34067,se.__webglTexture,33984+j)}const ee={[As]:10497,[Ai]:33071,[Om]:33648},F={[$n]:9728,[pw]:9984,[qp]:9986,[si]:9729,[WM]:9985,[DA]:9987};function X(N,j,se){if(se?(n.texParameteri(N,10242,ee[j.wrapS]),n.texParameteri(N,10243,ee[j.wrapT]),(N===32879||N===35866)&&n.texParameteri(N,32882,ee[j.wrapR]),n.texParameteri(N,10240,F[j.magFilter]),n.texParameteri(N,10241,F[j.minFilter])):(n.texParameteri(N,10242,33071),n.texParameteri(N,10243,33071),(N===32879||N===35866)&&n.texParameteri(N,32882,33071),(j.wrapS!==Ai||j.wrapT!==Ai)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(N,10240,D(j.magFilter)),n.texParameteri(N,10241,D(j.minFilter)),j.minFilter!==$n&&j.minFilter!==si&&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 he=e.get("EXT_texture_filter_anisotropic");if(j.magFilter===$n||j.minFilter!==qp&&j.minFilter!==DA||j.type===AA&&e.has("OES_texture_float_linear")===!1||a===!1&&j.type===Nm&&e.has("OES_texture_half_float_linear")===!1)return;(j.anisotropy>1||r.get(j).__currentAnisotropy)&&(n.texParameterf(N,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(j.anisotropy,i.getMaxAnisotropy())),r.get(j).__currentAnisotropy=j.anisotropy)}}function ue(N,j){let se=!1;N.__webglInit===void 0&&(N.__webglInit=!0,j.addEventListener("dispose",$));const he=j.source;let me=g.get(he);me===void 0&&(me={},g.set(he,me));const G=z(j);if(G!==N.__cacheKey){me[G]===void 0&&(me[G]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,se=!0),me[G].usedTimes++;const R=me[N.__cacheKey];R!==void 0&&(me[N.__cacheKey].usedTimes--,R.usedTimes===0&&v(j)),N.__cacheKey=G,N.__webglTexture=me[G].texture}return se}function le(N,j,se){let he=3553;(j.isDataArrayTexture||j.isCompressedArrayTexture)&&(he=35866),j.isData3DTexture&&(he=32879);const me=ue(N,j),G=j.source;t.bindTexture(he,N.__webglTexture,33984+se);const R=r.get(G);if(G.version!==R.__version||me===!0){t.activeTexture(33984+se),n.pixelStorei(37440,j.flipY),n.pixelStorei(37441,j.premultiplyAlpha),n.pixelStorei(3317,j.unpackAlignment),n.pixelStorei(37443,0);const T=_(j)&&x(j.image)===!1;let V=w(j.image,T,!1,c);V=be(j,V);const te=x(V)||a,ae=s.convert(j.format,j.encoding);let ie=s.convert(j.type),Te=b(j.internalFormat,ae,ie,j.encoding,j.isVideoTexture);X(he,j,te);let Me;const Le=j.mipmaps,ke=a&&j.isVideoTexture!==!0,De=R.__version===void 0||me===!0,fe=M(j,V,te);if(j.isDepthTexture)Te=6402,a?j.type===AA?Te=36012:j.type===Ec?Te=33190:j.type===lh?Te=35056:Te=33189:j.type===AA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),j.format===Pc&&Te===6402&&j.type!==cH&&j.type!==Ec&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),j.type=Ec,ie=s.convert(j.type)),j.format===Dh&&Te===6402&&(Te=34041,j.type!==lh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),j.type=lh,ie=s.convert(j.type))),De&&(ke?t.texStorage2D(3553,1,Te,V.width,V.height):t.texImage2D(3553,0,Te,V.width,V.height,0,ae,ie,null));else if(j.isDataTexture)if(Le.length>0&&te){ke&&De&&t.texStorage2D(3553,fe,Te,Le[0].width,Le[0].height);for(let Ce=0,Se=Le.length;Ce>=1,Se>>=1}}else if(Le.length>0&&te){ke&&De&&t.texStorage2D(3553,fe,Te,Le[0].width,Le[0].height);for(let Ce=0,Se=Le.length;Ce0&&De++,t.texStorage2D(34067,De,Me,V[0].width,V[0].height));for(let Ce=0;Ce<6;Ce++)if(T){Le?t.texSubImage2D(34069+Ce,0,0,0,V[Ce].width,V[Ce].height,ie,Te,V[Ce].data):t.texImage2D(34069+Ce,0,Me,V[Ce].width,V[Ce].height,0,ie,Te,V[Ce].data);for(let Se=0;Se=34069&&me<=34074)&&n.framebufferTexture2D(36160,he,me,r.get(se).__webglTexture,0),t.bindFramebuffer(36160,null)}function pe(N,j,se){if(n.bindRenderbuffer(36161,N),j.depthBuffer&&!j.stencilBuffer){let he=33189;if(se||ce(j)){const me=j.depthTexture;me&&me.isDepthTexture&&(me.type===AA?he=36012:me.type===Ec&&(he=33190));const G=J(j);ce(j)?f.renderbufferStorageMultisampleEXT(36161,G,he,j.width,j.height):n.renderbufferStorageMultisample(36161,G,he,j.width,j.height)}else n.renderbufferStorage(36161,he,j.width,j.height);n.framebufferRenderbuffer(36160,36096,36161,N)}else if(j.depthBuffer&&j.stencilBuffer){const he=J(j);se&&ce(j)===!1?n.renderbufferStorageMultisample(36161,he,35056,j.width,j.height):ce(j)?f.renderbufferStorageMultisampleEXT(36161,he,35056,j.width,j.height):n.renderbufferStorage(36161,34041,j.width,j.height),n.framebufferRenderbuffer(36160,33306,36161,N)}else{const he=j.isWebGLMultipleRenderTargets===!0?j.texture:[j.texture];for(let me=0;me0&&ce(N)===!1){const T=G?j:[j];se.__webglMultisampledFramebuffer=n.createFramebuffer(),se.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,se.__webglMultisampledFramebuffer);for(let V=0;V0&&ce(N)===!1){const j=N.isWebGLMultipleRenderTargets?N.texture:[N.texture],se=N.width,he=N.height;let me=16384;const G=[],R=N.stencilBuffer?33306:36096,T=r.get(N),V=N.isWebGLMultipleRenderTargets===!0;if(V)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&j.__useRenderToTexture!==!1}function xe(N){const j=o.render.frame;p.get(N)!==j&&(p.set(N,j),N.update())}function be(N,j){const se=N.encoding,he=N.format,me=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||N.format===oC||se!==cs&&(se===pt?a===!1?e.has("EXT_sRGB")===!0&&he===br?(N.format=oC,N.minFilter=si,N.generateMipmaps=!1):j=pH.sRGBToLinear(j):(he!==br||me!==OA)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",se)),j}this.allocateTextureUnit=L,this.resetTextureUnits=P,this.setTexture2D=K,this.setTexture2DArray=O,this.setTexture3D=B,this.setTextureCube=W,this.rebindTextures=Q,this.setupRenderTarget=de,this.updateRenderTargetMipmap=Ae,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=re,this.useMultisampledRTT=ce}function gte(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===OA)return 5121;if(s===WY)return 32819;if(s===KY)return 32820;if(s===GY)return 5120;if(s===VY)return 5122;if(s===cH)return 5123;if(s===jY)return 5124;if(s===Ec)return 5125;if(s===AA)return 5126;if(s===Nm)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===$Y)return 6406;if(s===br)return 6408;if(s===YY)return 6409;if(s===XY)return 6410;if(s===Pc)return 6402;if(s===Dh)return 34041;if(s===oC)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ZY)return 6403;if(s===JY)return 36244;if(s===qY)return 33319;if(s===eX)return 33320;if(s===tX)return 36249;if(s===D1||s===O1||s===N1||s===k1)if(o===pt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===D1)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===O1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===N1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===k1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===D1)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===O1)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===N1)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===k1)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===fF||s===hF||s===dF||s===pF)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===fF)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===hF)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===dF)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===pF)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===nX)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===mF||s===gF)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===mF)return o===pt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===gF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===vF||s===yF||s===wF||s===xF||s===_F||s===bF||s===BF||s===EF||s===CF||s===SF||s===MF||s===TF||s===IF||s===RF)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===vF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===yF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===wF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===xF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===_F)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===bF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===BF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===EF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===CF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===SF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===MF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===TF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===IF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===RF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Q1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Q1)return o===pt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===rX||s===FF||s===UF||s===LF)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Q1)return a.COMPRESSED_RED_RGTC1_EXT;if(s===FF)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===UF)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===LF)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===lh?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 vte extends Fr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ur extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const yte={type:"move"};class fb{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ur,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 Ur,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ur,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),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}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data: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 d of e.hand.values()){const g=t.getJointPose(d,r),m=this._getHandJoint(A,d);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"],f=c.position.distanceTo(u.position),h=.02,p=.005;A.inputState.pinching&&f>h+p?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!A.inputState.pinching&&f<=h-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(yte)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),A!==null&&(A.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Ur;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class CH extends Qn{constructor(e,t,r,i,s,o,a,l,A,c){if(c=c!==void 0?c:Pc,c!==Pc&&c!==Dh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&c===Pc&&(r=Ec),r===void 0&&c===Dh&&(r=lh),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:$n,this.minFilter=l!==void 0?l:$n,this.flipY=!1,this.generateMipmaps=!1}}class wte extends YA{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,A=null,c=null,u=null,f=null,h=null,p=null;const d=t.getContextAttributes();let g=null,m=null;const y=[],w=[],x=new Set,_=new Map,C=new Fr;C.layers.enable(1),C.viewport=new Qt;const S=new Fr;S.layers.enable(2),S.viewport=new Qt;const b=[C,S],M=new vte;M.layers.enable(1),M.layers.enable(2);let D=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getTargetRaySpace()},this.getControllerGrip=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getGripSpace()},this.getHand=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getHandSpace()};function H(B){const W=w.indexOf(B.inputSource);if(W===-1)return;const ee=y[W];ee!==void 0&&ee.dispatchEvent({type:B.type,data:B.inputSource})}function I(){i.removeEventListener("select",H),i.removeEventListener("selectstart",H),i.removeEventListener("selectend",H),i.removeEventListener("squeeze",H),i.removeEventListener("squeezestart",H),i.removeEventListener("squeezeend",H),i.removeEventListener("end",I),i.removeEventListener("inputsourceschange",v);for(let B=0;B=0&&(w[F]=null,y[F].disconnect(ee))}for(let W=0;W=w.length){w.push(ee),F=ue;break}else if(w[ue]===null){w[ue]=ee,F=ue;break}if(F===-1)break}const X=y[F];X&&X.connect(ee)}}const E=new Z,U=new Z;function P(B,W,ee){E.setFromMatrixPosition(W.matrixWorld),U.setFromMatrixPosition(ee.matrixWorld);const F=E.distanceTo(U),X=W.projectionMatrix.elements,ue=ee.projectionMatrix.elements,le=X[14]/(X[10]-1),oe=X[14]/(X[10]+1),re=(X[9]+1)/X[5],pe=(X[9]-1)/X[5],_e=(X[8]-1)/X[0],Re=(ue[8]+1)/ue[0],Q=le*_e,de=le*Re,Ae=F/(-_e+Re),q=Ae*-_e;W.matrixWorld.decompose(B.position,B.quaternion,B.scale),B.translateX(q),B.translateZ(Ae),B.matrixWorld.compose(B.position,B.quaternion,B.scale),B.matrixWorldInverse.copy(B.matrixWorld).invert();const J=le+Ae,ce=oe+Ae,xe=Q-q,be=de+(F-q),N=re*oe/ce*J,j=pe*oe/ce*J;B.projectionMatrix.makePerspective(xe,be,N,j,J,ce)}function L(B,W){W===null?B.matrixWorld.copy(B.matrix):B.matrixWorld.multiplyMatrices(W.matrixWorld,B.matrix),B.matrixWorldInverse.copy(B.matrixWorld).invert()}this.updateCamera=function(B){if(i===null)return;M.near=S.near=C.near=B.near,M.far=S.far=C.far=B.far,(D!==M.near||$!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),D=M.near,$=M.far);const W=B.parent,ee=M.cameras;L(M,W);for(let X=0;XX&&(_.set(F,F.lastChangedTime),r.dispatchEvent({type:"planechanged",data:F}))}}p=null}const O=new xH;O.setAnimationLoop(K),this.setAnimationLoop=function(B){z=B},this.dispose=function(){}}}function xte(n,e){function t(d,g){g.color.getRGB(d.fogColor.value,vH(n)),g.isFog?(d.fogNear.value=g.near,d.fogFar.value=g.far):g.isFogExp2&&(d.fogDensity.value=g.density)}function r(d,g,m,y,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?i(d,g):g.isMeshToonMaterial?(i(d,g),c(d,g)):g.isMeshPhongMaterial?(i(d,g),A(d,g)):g.isMeshStandardMaterial?(i(d,g),u(d,g),g.isMeshPhysicalMaterial&&f(d,g,w)):g.isMeshMatcapMaterial?(i(d,g),h(d,g)):g.isMeshDepthMaterial?i(d,g):g.isMeshDistanceMaterial?(i(d,g),p(d,g)):g.isMeshNormalMaterial?i(d,g):g.isLineBasicMaterial?(s(d,g),g.isLineDashedMaterial&&o(d,g)):g.isPointsMaterial?a(d,g,m,y):g.isSpriteMaterial?l(d,g):g.isShadowMaterial?(d.color.value.copy(g.color),d.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function i(d,g){d.opacity.value=g.opacity,g.color&&d.diffuse.value.copy(g.color),g.emissive&&d.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.bumpMap&&(d.bumpMap.value=g.bumpMap,d.bumpScale.value=g.bumpScale,g.side===Xr&&(d.bumpScale.value*=-1)),g.displacementMap&&(d.displacementMap.value=g.displacementMap,d.displacementScale.value=g.displacementScale,d.displacementBias.value=g.displacementBias),g.emissiveMap&&(d.emissiveMap.value=g.emissiveMap),g.normalMap&&(d.normalMap.value=g.normalMap,d.normalScale.value.copy(g.normalScale),g.side===Xr&&d.normalScale.value.negate()),g.specularMap&&(d.specularMap.value=g.specularMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);const m=e.get(g).envMap;if(m&&(d.envMap.value=m,d.flipEnvMap.value=m.isCubeTexture&&m.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=g.reflectivity,d.ior.value=g.ior,d.refractionRatio.value=g.refractionRatio),g.lightMap){d.lightMap.value=g.lightMap;const x=n.physicallyCorrectLights!==!0?Math.PI:1;d.lightMapIntensity.value=g.lightMapIntensity*x}g.aoMap&&(d.aoMap.value=g.aoMap,d.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.iridescenceMap?y=g.iridescenceMap:g.iridescenceThicknessMap?y=g.iridescenceThicknessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),d.uvTransform.value.copy(y.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(),d.uv2Transform.value.copy(w.matrix))}function s(d,g){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity}function o(d,g){d.dashSize.value=g.dashSize,d.totalSize.value=g.dashSize+g.gapSize,d.scale.value=g.scale}function a(d,g,m,y){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity,d.size.value=g.size*m,d.scale.value=y*.5,g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),d.uvTransform.value.copy(w.matrix))}function l(d,g){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity,d.rotation.value=g.rotation,g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);let m;g.map?m=g.map:g.alphaMap&&(m=g.alphaMap),m!==void 0&&(m.matrixAutoUpdate===!0&&m.updateMatrix(),d.uvTransform.value.copy(m.matrix))}function A(d,g){d.specular.value.copy(g.specular),d.shininess.value=Math.max(g.shininess,1e-4)}function c(d,g){g.gradientMap&&(d.gradientMap.value=g.gradientMap)}function u(d,g){d.roughness.value=g.roughness,d.metalness.value=g.metalness,g.roughnessMap&&(d.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(d.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(d.envMapIntensity.value=g.envMapIntensity)}function f(d,g,m){d.ior.value=g.ior,g.sheen>0&&(d.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),d.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(d.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(d.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(d.clearcoat.value=g.clearcoat,d.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(d.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(d.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),d.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Xr&&d.clearcoatNormalScale.value.negate())),g.iridescence>0&&(d.iridescence.value=g.iridescence,d.iridescenceIOR.value=g.iridescenceIOR,d.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(d.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(d.transmission.value=g.transmission,d.transmissionSamplerMap.value=m.texture,d.transmissionSamplerSize.value.set(m.width,m.height),g.transmissionMap&&(d.transmissionMap.value=g.transmissionMap),d.thickness.value=g.thickness,g.thicknessMap&&(d.thicknessMap.value=g.thicknessMap),d.attenuationDistance.value=g.attenuationDistance,d.attenuationColor.value.copy(g.attenuationColor)),d.specularIntensity.value=g.specularIntensity,d.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(d.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(d.specularColorMap.value=g.specularColorMap)}function h(d,g){g.matcap&&(d.matcap.value=g.matcap)}function p(d,g){d.referencePosition.value.copy(g.referencePosition),d.nearDistance.value=g.nearDistance,d.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function _te(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(y,w){const x=w.program;r.uniformBlockBinding(y,x)}function A(y,w){let x=i[y.id];x===void 0&&(p(y),x=c(y),i[y.id]=x,y.addEventListener("dispose",g));const _=w.program;r.updateUBOMapping(y,_);const C=e.render.frame;s[y.id]!==C&&(f(y),s[y.id]=C)}function c(y){const w=u();y.__bindingPointIndex=w;const x=n.createBuffer(),_=y.__size,C=y.usage;return n.bindBuffer(35345,x),n.bufferData(35345,_,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,w,x),x}function u(){for(let y=0;y0){C=x%_;const H=_-C;C!==0&&H-D.boundary<0&&(x+=_-C,M.__offset=x)}x+=D.storage}return C=x%_,C>0&&(x+=_-C),y.__size=x,y.__cache={},this}function d(y){const w={boundary:0,storage:0};return typeof y=="number"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),w}function g(y){const w=y.target;w.removeEventListener("dispose",g);const x=o.indexOf(w.__bindingPointIndex);o.splice(x,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function m(){for(const y in i)n.deleteBuffer(i[y]);o=[],i={},s={}}return{bind:l,update:A,dispose:m}}function bte(){const n=Hm("canvas");return n.style.display="block",n}function vg(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:bte(),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,f=null;const h=[],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=cs,this.physicallyCorrectLights=!1,this.toneMapping=ll,this.toneMappingExposure=1;const d=this;let g=!1,m=0,y=0,w=null,x=-1,_=null;const C=new Qt,S=new Qt;let b=null,M=e.width,D=e.height,$=1,H=null,I=null;const v=new Qt(0,0,M,D),E=new Qt(0,0,M,D);let U=!1;const P=new JM;let L=!1,z=!1,K=null;const O=new je,B=new $e,W=new Z,ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function F(){return w===null?$:1}let X=t;function ue(ne,ge){for(let Be=0;Be0?f=p[p.length-1]:f=null,h.pop(),h.length>0?u=h[h.length-1]:u=null};function ut(ne,ge,Be,we){if(ne.visible===!1)return;if(ne.layers.test(ge.layers)){if(ne.isGroup)Be=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(ge);else if(ne.isLight)f.pushLight(ne),ne.castShadow&&f.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||P.intersectsSprite(ne)){we&&W.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(O);const st=J.update(ne),Ze=ne.material;Ze.visible&&u.push(ne,st,Ze,Be,W.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(ne.isSkinnedMesh&&ne.skeleton.frame!==pe.render.frame&&(ne.skeleton.update(),ne.skeleton.frame=pe.render.frame),!ne.frustumCulled||P.intersectsObject(ne))){we&&W.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(O);const st=J.update(ne),Ze=ne.material;if(Array.isArray(Ze)){const Je=st.groups;for(let yt=0,mt=Je.length;yt0&&Ct(Ee,ge,Be),we&&re.viewport(C.copy(we)),Ee.length>0&&it(Ee,ge,Be),ze.length>0&&it(ze,ge,Be),st.length>0&&it(st,ge,Be),re.buffers.depth.setTest(!0),re.buffers.depth.setMask(!0),re.buffers.color.setMask(!0),re.setPolygonOffset(!1)}function Ct(ne,ge,Be){const we=oe.isWebGL2;K===null&&(K=new ma(1,1,{generateMipmaps:!0,type:le.has("EXT_color_buffer_half_float")?Nm:OA,minFilter:DA,samples:we&&s===!0?4:0})),d.getDrawingBufferSize(B),we?K.setSize(B.x,B.y):K.setSize(gw(B.x),gw(B.y));const Ee=d.getRenderTarget();d.setRenderTarget(K),d.clear();const ze=d.toneMapping;d.toneMapping=ll,it(ne,ge,Be),d.toneMapping=ze,Re.updateMultisampleRenderTarget(K),Re.updateRenderTargetMipmap(K),d.setRenderTarget(Ee)}function it(ne,ge,Be){const we=ge.isScene===!0?ge.overrideMaterial:null;for(let Ee=0,ze=ne.length;Ee0&&Re.useMultisampledRTT(ne)===!1?Ee=_e.get(ne).__webglMultisampledFramebuffer:Ee=mt,C.copy(ne.viewport),S.copy(ne.scissor),b=ne.scissorTest}else C.copy(v).multiplyScalar($).floor(),S.copy(E).multiplyScalar($).floor(),b=U;if(re.bindFramebuffer(36160,Ee)&&oe.drawBuffers&&we&&re.drawBuffers(ne,Ee),re.viewport(C),re.scissor(S),re.setScissorTest(b),ze){const Je=_e.get(ne.texture);X.framebufferTexture2D(36160,36064,34069+ge,Je.__webglTexture,Be)}else if(st){const Je=_e.get(ne.texture),yt=ge||0;X.framebufferTextureLayer(36160,36064,Je.__webglTexture,Be||0,yt)}x=-1},this.readRenderTargetPixels=function(ne,ge,Be,we,Ee,ze,st){if(!(ne&&ne.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ze=_e.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&st!==void 0&&(Ze=Ze[st]),Ze){re.bindFramebuffer(36160,Ze);try{const Je=ne.texture,yt=Je.format,mt=Je.type;if(yt!==br&&T.convert(yt)!==X.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const gt=mt===Nm&&(le.has("EXT_color_buffer_half_float")||oe.isWebGL2&&le.has("EXT_color_buffer_float"));if(mt!==OA&&T.convert(mt)!==X.getParameter(35738)&&!(mt===AA&&(oe.isWebGL2||le.has("OES_texture_float")||le.has("WEBGL_color_buffer_float")))&&!gt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ge>=0&&ge<=ne.width-we&&Be>=0&&Be<=ne.height-Ee&&X.readPixels(ge,Be,we,Ee,T.convert(yt),T.convert(mt),ze)}finally{const Je=w!==null?_e.get(w).__webglFramebuffer:null;re.bindFramebuffer(36160,Je)}}},this.copyFramebufferToTexture=function(ne,ge,Be=0){const we=Math.pow(2,-Be),Ee=Math.floor(ge.image.width*we),ze=Math.floor(ge.image.height*we);Re.setTexture2D(ge,0),X.copyTexSubImage2D(3553,Be,0,0,ne.x,ne.y,Ee,ze),re.unbindTexture()},this.copyTextureToTexture=function(ne,ge,Be,we=0){const Ee=ge.image.width,ze=ge.image.height,st=T.convert(Be.format),Ze=T.convert(Be.type);Re.setTexture2D(Be,0),X.pixelStorei(37440,Be.flipY),X.pixelStorei(37441,Be.premultiplyAlpha),X.pixelStorei(3317,Be.unpackAlignment),ge.isDataTexture?X.texSubImage2D(3553,we,ne.x,ne.y,Ee,ze,st,Ze,ge.image.data):ge.isCompressedTexture?X.compressedTexSubImage2D(3553,we,ne.x,ne.y,ge.mipmaps[0].width,ge.mipmaps[0].height,st,ge.mipmaps[0].data):X.texSubImage2D(3553,we,ne.x,ne.y,st,Ze,ge.image),we===0&&Be.generateMipmaps&&X.generateMipmap(3553),re.unbindTexture()},this.copyTextureToTexture3D=function(ne,ge,Be,we,Ee=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ze=ne.max.x-ne.min.x+1,st=ne.max.y-ne.min.y+1,Ze=ne.max.z-ne.min.z+1,Je=T.convert(we.format),yt=T.convert(we.type);let mt;if(we.isData3DTexture)Re.setTexture3D(we,0),mt=32879;else if(we.isDataArrayTexture)Re.setTexture2DArray(we,0),mt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}X.pixelStorei(37440,we.flipY),X.pixelStorei(37441,we.premultiplyAlpha),X.pixelStorei(3317,we.unpackAlignment);const gt=X.getParameter(3314),Zt=X.getParameter(32878),Rn=X.getParameter(3316),Di=X.getParameter(3315),qs=X.getParameter(32877),pn=Be.isCompressedTexture?Be.mipmaps[0]:Be.image;X.pixelStorei(3314,pn.width),X.pixelStorei(32878,pn.height),X.pixelStorei(3316,ne.min.x),X.pixelStorei(3315,ne.min.y),X.pixelStorei(32877,ne.min.z),Be.isDataTexture||Be.isData3DTexture?X.texSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,yt,pn.data):Be.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),X.compressedTexSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,pn.data)):X.texSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,yt,pn),X.pixelStorei(3314,gt),X.pixelStorei(32878,Zt),X.pixelStorei(3316,Rn),X.pixelStorei(3315,Di),X.pixelStorei(32877,qs),Ee===0&&we.generateMipmaps&&X.generateMipmap(mt),re.unbindTexture()},this.initTexture=function(ne){ne.isCubeTexture?Re.setTextureCube(ne,0):ne.isData3DTexture?Re.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Re.setTexture2DArray(ne,0):Re.setTexture2D(ne,0),re.unbindTexture()},this.resetState=function(){m=0,y=0,w=null,re.reset(),V.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Bte extends vg{}Bte.prototype.isWebGL1Renderer=!0;class vw extends It{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,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,this.backgroundIntensity=e.backgroundIntensity,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.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),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 Ete{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=sC,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Eo()}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;f.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(f);be.far||t.push({distance:b,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let w=m,x=y-1;wl)continue;f.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(f);Ce.far||t.push({distance:C,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 Rte{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],f=r[i+1]-c,h=(o-c)/f;return(i+h)/(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 $e:new Z);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 Z,i=[],s=[],o=[],a=new Z,l=new je;for(let h=0;h<=e;h++){const p=h/e;i[h]=this.getTangentAt(p,new Z)}s[0]=new Z,o[0]=new Z;let A=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);c<=A&&(A=c,r.set(1,0,0)),u<=A&&(A=u,r.set(0,1,0)),f<=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 h=1;h<=e;h++){if(s[h]=s[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(i[h-1],i[h]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(hr(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,p))}o[h].crossVectors(i[h],s[h])}if(t===!0){let h=Math.acos(hr(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],h*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 Gx extends $t{constructor(e=1,t=1,r=1,i=32,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=[],f=[],h=[];let p=0;const d=[],g=r/2;let m=0;y(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(c),this.setAttribute("position",new an(u,3)),this.setAttribute("normal",new an(f,3)),this.setAttribute("uv",new an(h,2));function y(){const x=new Z,_=new Z;let C=0;const S=(t-e)/r;for(let b=0;b<=s;b++){const M=[],D=b/s,$=D*(t-e)+e;for(let H=0;H<=i;H++){const I=H/i,v=I*l+a,E=Math.sin(v),U=Math.cos(v);_.x=$*E,_.y=-D*r+g,_.z=$*U,u.push(_.x,_.y,_.z),x.set(E,S,U).normalize(),f.push(x.x,x.y,x.z),h.push(I,1-D),M.push(p++)}d.push(M)}for(let b=0;b0)&&h.push(w,x,C),(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 db extends is{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Qe(16777215),this.specular=new Qe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Nx,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 Fte extends is{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(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 Ute extends is{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Qe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Nx,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 Nl(n,e,t){return TH(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function L0(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 TH(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Lte(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 TU(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 IH(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 wg{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=Nl(r,s,o),this.values=Nl(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&&TH(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=Nl(this.times),t=Nl(this.values),r=this.getValueSize(),i=this.getInterpolation()===H1,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=Nl(e,0,o),this.values=Nl(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=Nl(this.times,0),t=Nl(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}_a.prototype.TimeBufferType=Float32Array;_a.prototype.ValueBufferType=Float32Array;_a.prototype.DefaultInterpolation=$c;class nd extends _a{}nd.prototype.ValueTypeName="bool";nd.prototype.ValueBufferType=Array;nd.prototype.DefaultInterpolation=Oh;nd.prototype.InterpolantFactoryMethodLinear=void 0;nd.prototype.InterpolantFactoryMethodSmooth=void 0;class FH extends _a{}FH.prototype.ValueTypeName="color";class Qh extends _a{}Qh.prototype.ValueTypeName="number";class Ote extends wg{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 ga extends _a{InterpolantFactoryMethodLinear(e){return new Ote(this.times,this.values,this.getValueSize(),e)}}ga.prototype.ValueTypeName="quaternion";ga.prototype.DefaultInterpolation=$c;ga.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends _a{}rd.prototype.ValueTypeName="string";rd.prototype.ValueBufferType=Array;rd.prototype.DefaultInterpolation=Oh;rd.prototype.InterpolantFactoryMethodLinear=void 0;rd.prototype.InterpolantFactoryMethodSmooth=void 0;class NA extends _a{}NA.prototype.ValueTypeName="vector";class Yc{constructor(e,t=-1,r,i=KM){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Eo(),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(kte(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(_a.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 f=i[u];f||(i[u]=f=[]),f.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,f,h,p,d){if(h.length!==0){const g=[],m=[];IH(h,g,m,p),g.length!==0&&d.push(new u(f,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(La[e]!==void 0){La[e].push({onLoad:t,onProgress:r,onError:i});return}La[e]=[],La[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=La[e],u=A.body.getReader(),f=A.headers.get("Content-Length")||A.headers.get("X-File-Size"),h=f?parseInt(f):0,p=h!==0;let d=0;const g=new ReadableStream({start(m){y();function y(){u.read().then(({done:w,value:x})=>{if(w)m.close();else{d+=x.byteLength;const _=new ProgressEvent("progress",{lengthComputable:p,loaded:d,total:h});for(let C=0,S=c.length;C{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),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return A.arrayBuffer().then(p=>h.decode(p))}}}).then(A=>{Hh.add(e,A);const c=La[e];delete La[e];for(let u=0,f=c.length;u{const c=La[e];if(c===void 0)throw this.manager.itemError(e),A;delete La[e];for(let u=0,f=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 LH extends id{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=Hh.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Hm("img");function l(){c(),Hh.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 lu extends id{constructor(e){super(e)}load(e,t,r,i){const s=new Qn,o=new LH(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 Vx extends It{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Qe(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 pb=new je,IU=new Z,RU=new Z;class rT{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new $e(512,512),this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new JM,this._frameExtents=new $e(1,1),this._viewportCount=1,this._viewports=[new Qt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;IU.setFromMatrixPosition(e.matrixWorld),t.position.copy(IU),RU.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(RU),t.updateMatrixWorld(),pb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pb),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(pb)}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 zte extends rT{constructor(){super(new Fr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Qm*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 PH extends Vx{constructor(e,t,r=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new zte}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 FU=new je,zd=new Z,mb=new Z;class Gte extends rT{constructor(){super(new Fr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new $e(4,2),this._viewportCount=6,this._viewports=[new Qt(2,1,1,1),new Qt(0,1,1,1),new Qt(3,1,1,1),new Qt(1,1,1,1),new Qt(3,0,1,1),new Qt(1,0,1,1)],this._cubeDirections=[new Z(1,0,0),new Z(-1,0,0),new Z(0,0,1),new Z(0,0,-1),new Z(0,1,0),new Z(0,-1,0)],this._cubeUps=[new Z(0,1,0),new Z(0,1,0),new Z(0,1,0),new Z(0,1,0),new Z(0,0,1),new Z(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()),zd.setFromMatrixPosition(e.matrixWorld),r.position.copy(zd),mb.copy(r.position),mb.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(mb),r.updateMatrixWorld(),i.makeTranslation(-zd.x,-zd.y,-zd.z),FU.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(FU)}}class cC extends Vx{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new Gte}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 Vte extends rT{constructor(){super(new qh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class iT extends Vx{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.shadow=new Vte}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class DH extends Vx{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class xw{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=Hh.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){Hh.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 OH{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=UU(),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=UU();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function UU(){return(typeof performance>"u"?Date:performance).now()}class Wte{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 sT="\\[\\]\\.:\\/",Kte=new RegExp("["+sT+"]","g"),oT="[^"+sT+"]",$te="[^"+sT.replace("\\.","")+"]",Yte=/((?:WC+[\/:])*)/.source.replace("WC",oT),Xte=/(WCOD+)?/.source.replace("WCOD",$te),Zte=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oT),Jte=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oT),qte=new RegExp("^"+Yte+Xte+Zte+Jte+"$"),ene=["material","materials","bones","map"];class tne{constructor(e,t,r){const i=r||_t.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 _t{constructor(e,t,r){this.path=t,this.parsedPath=r||_t.parseTrackName(t),this.node=_t.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 _t.Composite(e,t,r):new _t(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Kte,"")}static parseTrackName(e){const t=qte.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);ene.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 aX:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulateAdditive(a);break;case KM: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===oX;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===iX){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=Gf,i.endingEnd=Gf):(e?i.endingStart=this.zeroSlopeAtStart?Gf:zf:i.endingStart=mw,t?i.endingEnd=this.zeroSlopeAtEnd?Gf:zf:i.endingEnd=mw)}_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 rne=new Float32Array(1);class ine extends YA{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 f=i[u],h=f.name;let p=c[h];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,h));continue}const d=t&&t._propertyBindings[u].binding.parsedPath;p=new Wte(_t.create(r,h,d),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,h),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&&(ke-=Te),De<-Math.PI?De+=Te:De>Math.PI&&(De-=Te),ke<=De?a.theta=Math.max(ke,Math.min(De,a.theta)):a.theta=a.theta>(ke+De)/2?Math.max(ke,a.theta):Math.min(De,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),T.setFromSpherical(a),T.applyQuaternion(te),Le.copy(r.target).add(T),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||ae.distanceToSquared(r.object.position)>o||8*(1-ie.dot(r.object.quaternion))>o?(r.dispatchEvent(NU),ae.copy(r.object.position),ie.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",se),r.domElement.removeEventListener("pointerdown",Q),r.domElement.removeEventListener("pointercancel",q),r.domElement.removeEventListener("wheel",xe),r.domElement.removeEventListener("pointermove",de),r.domElement.removeEventListener("pointerup",Ae),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 DU,l=new DU;let A=1;const c=new Z;let u=!1;const f=new $e,h=new $e,p=new $e,d=new $e,g=new $e,m=new $e,y=new $e,w=new $e,x=new $e,_=[],C={};function S(){return 2*Math.PI/60/60*r.autoRotateSpeed}function b(){return Math.pow(.95,r.zoomSpeed)}function M(T){l.theta-=T}function D(T){l.phi-=T}const $=function(){const T=new Z;return function(te,ae){T.setFromMatrixColumn(ae,0),T.multiplyScalar(-te),c.add(T)}}(),H=function(){const T=new Z;return function(te,ae){r.screenSpacePanning===!0?T.setFromMatrixColumn(ae,1):(T.setFromMatrixColumn(ae,0),T.crossVectors(r.object.up,T)),T.multiplyScalar(te),c.add(T)}}(),I=function(){const T=new Z;return function(te,ae){const ie=r.domElement;if(r.object.isPerspectiveCamera){const Te=r.object.position;T.copy(Te).sub(r.target);let Me=T.length();Me*=Math.tan(r.object.fov/2*Math.PI/180),$(2*te*Me/ie.clientHeight,r.object.matrix),H(2*ae*Me/ie.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?($(te*(r.object.right-r.object.left)/r.object.zoom/ie.clientWidth,r.object.matrix),H(ae*(r.object.top-r.object.bottom)/r.object.zoom/ie.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function v(T){r.object.isPerspectiveCamera?A/=T:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*T)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function E(T){r.object.isPerspectiveCamera?A*=T:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/T)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function U(T){f.set(T.clientX,T.clientY)}function P(T){y.set(T.clientX,T.clientY)}function L(T){d.set(T.clientX,T.clientY)}function z(T){h.set(T.clientX,T.clientY),p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),D(2*Math.PI*p.y/V.clientHeight),f.copy(h),r.update()}function K(T){w.set(T.clientX,T.clientY),x.subVectors(w,y),x.y>0?v(b()):x.y<0&&E(b()),y.copy(w),r.update()}function O(T){g.set(T.clientX,T.clientY),m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g),r.update()}function B(T){T.deltaY<0?E(b()):T.deltaY>0&&v(b()),r.update()}function W(T){let V=!1;switch(T.code){case r.keys.UP:T.ctrlKey||T.metaKey||T.shiftKey?D(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,r.keyPanSpeed),V=!0;break;case r.keys.BOTTOM:T.ctrlKey||T.metaKey||T.shiftKey?D(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,-r.keyPanSpeed),V=!0;break;case r.keys.LEFT:T.ctrlKey||T.metaKey||T.shiftKey?M(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(r.keyPanSpeed,0),V=!0;break;case r.keys.RIGHT:T.ctrlKey||T.metaKey||T.shiftKey?M(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(-r.keyPanSpeed,0),V=!0;break}V&&(T.preventDefault(),r.update())}function ee(){if(_.length===1)f.set(_[0].pageX,_[0].pageY);else{const T=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);f.set(T,V)}}function F(){if(_.length===1)d.set(_[0].pageX,_[0].pageY);else{const T=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);d.set(T,V)}}function X(){const T=_[0].pageX-_[1].pageX,V=_[0].pageY-_[1].pageY,te=Math.sqrt(T*T+V*V);y.set(0,te)}function ue(){r.enableZoom&&X(),r.enablePan&&F()}function le(){r.enableZoom&&X(),r.enableRotate&&ee()}function oe(T){if(_.length==1)h.set(T.pageX,T.pageY);else{const te=R(T),ae=.5*(T.pageX+te.x),ie=.5*(T.pageY+te.y);h.set(ae,ie)}p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),D(2*Math.PI*p.y/V.clientHeight),f.copy(h)}function re(T){if(_.length===1)g.set(T.pageX,T.pageY);else{const V=R(T),te=.5*(T.pageX+V.x),ae=.5*(T.pageY+V.y);g.set(te,ae)}m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g)}function pe(T){const V=R(T),te=T.pageX-V.x,ae=T.pageY-V.y,ie=Math.sqrt(te*te+ae*ae);w.set(0,ie),x.set(0,Math.pow(w.y/y.y,r.zoomSpeed)),v(x.y),y.copy(w)}function _e(T){r.enableZoom&&pe(T),r.enablePan&&re(T)}function Re(T){r.enableZoom&&pe(T),r.enableRotate&&oe(T)}function Q(T){r.enabled!==!1&&(_.length===0&&(r.domElement.setPointerCapture(T.pointerId),r.domElement.addEventListener("pointermove",de),r.domElement.addEventListener("pointerup",Ae)),he(T),T.pointerType==="touch"?N(T):J(T))}function de(T){r.enabled!==!1&&(T.pointerType==="touch"?j(T):ce(T))}function Ae(T){me(T),_.length===0&&(r.domElement.releasePointerCapture(T.pointerId),r.domElement.removeEventListener("pointermove",de),r.domElement.removeEventListener("pointerup",Ae)),r.dispatchEvent(kU),s=i.NONE}function q(T){me(T)}function J(T){let V;switch(T.button){case 0:V=r.mouseButtons.LEFT;break;case 1:V=r.mouseButtons.MIDDLE;break;case 2:V=r.mouseButtons.RIGHT;break;default:V=-1}switch(V){case wu.DOLLY:if(r.enableZoom===!1)return;P(T),s=i.DOLLY;break;case wu.ROTATE:if(T.ctrlKey||T.metaKey||T.shiftKey){if(r.enablePan===!1)return;L(T),s=i.PAN}else{if(r.enableRotate===!1)return;U(T),s=i.ROTATE}break;case wu.PAN:if(T.ctrlKey||T.metaKey||T.shiftKey){if(r.enableRotate===!1)return;U(T),s=i.ROTATE}else{if(r.enablePan===!1)return;L(T),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(gb)}function ce(T){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;z(T);break;case i.DOLLY:if(r.enableZoom===!1)return;K(T);break;case i.PAN:if(r.enablePan===!1)return;O(T);break}}function xe(T){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(T.preventDefault(),r.dispatchEvent(gb),B(T),r.dispatchEvent(kU))}function be(T){r.enabled===!1||r.enablePan===!1||W(T)}function N(T){switch(G(T),_.length){case 1:switch(r.touches.ONE){case xu.ROTATE:if(r.enableRotate===!1)return;ee(),s=i.TOUCH_ROTATE;break;case xu.PAN:if(r.enablePan===!1)return;F(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case xu.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ue(),s=i.TOUCH_DOLLY_PAN;break;case xu.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;le(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(gb)}function j(T){switch(G(T),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;oe(T),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;re(T),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;_e(T),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Re(T),r.update();break;default:s=i.NONE}}function se(T){r.enabled!==!1&&T.preventDefault()}function he(T){_.push(T)}function me(T){delete C[T.pointerId];for(let V=0;V<_.length;V++)if(_[V].pointerId==T.pointerId){_.splice(V,1);return}}function G(T){let V=C[T.pointerId];V===void 0&&(V=new $e,C[T.pointerId]=V),V.set(T.pageX,T.pageY)}function R(T){const V=T.pointerId===_[0].pointerId?_[1]:_[0];return C[V.pointerId]}r.domElement.addEventListener("contextmenu",se),r.domElement.addEventListener("pointerdown",Q),r.domElement.addEventListener("pointercancel",q),r.domElement.addEventListener("wheel",xe,{passive:!1}),this.update()}}function kH(n){let e,t,r,i=0;for(let a=0;a=2.0 are supported."));return}const A=new Pne(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});A.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}A.setExtensions(o),A.setPlugins(a),A.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function ane(){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 kt={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_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 lne{constructor(e){this.parser=e,this.name=kt.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 yne{constructor(e){this.parser=e,this.name=kt.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 wne{constructor(e){this.name=kt.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,f=new Uint8Array(a,l,A);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(c,u,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(c*u);return o.decodeGltfBuffer(new Uint8Array(h),c,u,f,i.mode,i.filter),h})})}else return null}}class xne{constructor(e){this.name=kt.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!==bs.TRIANGLES&&A.mode!==bs.TRIANGLE_STRIP&&A.mode!==bs.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],f=A[0].count,h=[];for(const p of u){const d=new je,g=new Z,m=new rt,y=new Z(1,1,1),w=new zx(p.geometry,p.material,f);for(let x=0;x0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Lne=new je;class Pne{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ane,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=!1,s=-1;typeof navigator<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||i&&s<98?this.textureLoader=new lu(this.options.manager):this.textureLoader=new jte(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new nT(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};Vd(s,a,i),Xl(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[A,c]of o.children.entries())s(c,a.children[A])};return s(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&g.setY(M,C[S*l+1]),l>=3&&g.setZ(M,C[S*l+2]),l>=4&&g.setW(M,C[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,r){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const A=this.loadImageSource(t,r).then(function(c){c.flipY=!1,c.name=o.name||a.name||"";const f=(s.samplers||{})[o.sampler]||{};return c.magFilter=zU[f.magFilter]||si,c.minFilter=zU[f.minFilter]||DA,c.wrapS=GU[f.wrapS]||As,c.wrapT=GU[f.wrapT]||As,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=A,A}loadImageSource(e,t){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",A=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(u){A=!0;const f=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(u){return new Promise(function(f,h){let p=f;t.isImageBitmapLoader===!0&&(p=function(d){const g=new Qn(d);g.needsUpdate=!0,f(g)}),t.load(xw.resolveURL(u,s.path),p,void 0,h)})}).then(function(u){return A===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||Une(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=c,c}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord!=0&&!(t==="aoMap"&&r.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),s.extensions[kt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[kt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[kt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.encoding=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new MH,is.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Cl,is.prototype.copy.call(l,r),l.color.copy(r.color),this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}r.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=r}getMaterialType(){return kh}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},A=[];if(l[kt.KHR_MATERIALS_UNLIT]){const u=i[kt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),A.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new Qe(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.fromArray(f),a.opacity=f[3]}u.baseColorTexture!==void 0&&A.push(t.assignTexture(a,"map",u.baseColorTexture,pt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(A.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),A.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),A.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ui);const c=s.alphaMode||yb.OPAQUE;if(c===yb.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===yb.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Ei&&(A.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new $e(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}return s.occlusionTexture!==void 0&&o!==Ei&&(A.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Ei&&(a.emissive=new Qe().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Ei&&A.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,pt)),Promise.all(A).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Xl(u,s),t.associations.set(u,{materials:e}),s.extensions&&Vd(i,u,s),u})}createUniqueName(e){const t=_t.sanitizeNodeName(e||"");let r=t;for(let i=1;this.nodeNamesUsed[r];++i)r=t+"_"+i;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[kt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return jU(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Rne(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),Xl(m,s),g.extensions&&Vd(i,m,g),t.assignFinalMaterial(m),u.push(m)}for(let h=0,p=u.length;h1?u=new Ur:l.length===1?u=l[0]:u=new It,u!==l[0])for(let f=0,h=l.length;f{const u=new Map;for(const[f,h]of i.associations)(f instanceof is||f instanceof Qn)&&u.set(f,h);return c.traverse(f=>{const h=i.associations.get(f);h!=null&&u.set(f,h)}),u};return i.associations=A(s),s})}}function Dne(n,e,t){const r=e.attributes,i=new ps;if(r.POSITION!==void 0){const a=t.json.accessors[r.POSITION],l=a.min,A=a.max;if(l!==void 0&&A!==void 0){if(i.set(new Z(l[0],l[1],l[2]),new Z(A[0],A[1],A[2])),a.normalized){const c=hC(Ah[a.componentType]);i.min.multiplyScalar(c),i.max.multiplyScalar(c)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new Z,l=new Z;for(let A=0,c=s.length;A Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE @@ -4085,7 +4085,7 @@ void main() { * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-materials-v0compat is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */function FAe(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 ju(n){return Math.pow(n,2.2)}class UAe{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 FAe(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,f,h,p,d,g,m,y,w,x,_,C,S,b,M,D,$,H,I,v,E,U,P,L,z,K,O,B,W,ee,F,X,ue,le,oe,re;const pe=(i=(r=e.keywordMap)===null||r===void 0?void 0:r._ALPHABLEND_ON)!==null&&i!==void 0?i:!1,Re=((s=e.floatProperties)===null||s===void 0?void 0:s._ZWrite)===1&&pe,Q=this._v0ParseRenderQueue(e),de=(a=(o=e.keywordMap)===null||o===void 0?void 0:o._ALPHATEST_ON)!==null&&a!==void 0?a:!1,Ae=pe?"BLEND":de?"MASK":"OPAQUE",q=de?(l=e.floatProperties)===null||l===void 0?void 0:l._Cutoff:void 0,ce=((c=(A=e.floatProperties)===null||A===void 0?void 0:A._CullMode)!==null&&c!==void 0?c:2)===0,xe=this._portTextureTransform(e),be=(f=(u=e.vectorProperties)===null||u===void 0?void 0:u._Color)===null||f===void 0?void 0:f.map((Ee,ze)=>ze===3?Ee:ju(Ee)),N=(h=e.textureProperties)===null||h===void 0?void 0:h._MainTex,j=N!=null?{index:N,extensions:Object.assign({},xe)}:void 0,se=(p=e.floatProperties)===null||p===void 0?void 0:p._BumpScale,he=(d=e.textureProperties)===null||d===void 0?void 0:d._BumpMap,me=he!=null?{index:he,scale:se,extensions:Object.assign({},xe)}:void 0,G=(m=(g=e.vectorProperties)===null||g===void 0?void 0:g._EmissionColor)===null||m===void 0?void 0:m.map(ju),R=(y=e.textureProperties)===null||y===void 0?void 0:y._EmissionMap,T=R!=null?{index:R,extensions:Object.assign({},xe)}:void 0,V=(x=(w=e.vectorProperties)===null||w===void 0?void 0:w._ShadeColor)===null||x===void 0?void 0:x.map(ju),te=(_=e.textureProperties)===null||_===void 0?void 0:_._ShadeTexture,ae=te!=null?{index:te,extensions:Object.assign({},xe)}:void 0;let ie=(S=(C=e.floatProperties)===null||C===void 0?void 0:C._ShadeShift)!==null&&S!==void 0?S:0,Te=(M=(b=e.floatProperties)===null||b===void 0?void 0:b._ShadeToony)!==null&&M!==void 0?M:.9;Te=Lt.lerp(Te,1,.5+.5*ie),ie=-ie-(1-Te);const Me=(D=e.floatProperties)===null||D===void 0?void 0:D._IndirectLightIntensity,Le=Me?1-Me:void 0,ke=($=e.textureProperties)===null||$===void 0?void 0:$._SphereAdd,De=ke!=null?[1,1,1]:void 0,fe=ke!=null?{index:ke}:void 0,Ce=(H=e.floatProperties)===null||H===void 0?void 0:H._RimLightingMix,Se=(I=e.textureProperties)===null||I===void 0?void 0:I._RimTexture,Fe=Se!=null?{index:Se,extensions:Object.assign({},xe)}:void 0,We=(E=(v=e.vectorProperties)===null||v===void 0?void 0:v._RimColor)===null||E===void 0?void 0:E.map(ju),qe=(U=e.floatProperties)===null||U===void 0?void 0:U._RimFresnelPower,ct=(P=e.floatProperties)===null||P===void 0?void 0:P._RimLift,sn=["none","worldCoordinates","screenCoordinates"][(z=(L=e.floatProperties)===null||L===void 0?void 0:L._OutlineWidthMode)!==null&&z!==void 0?z:0];let Ct=(O=(K=e.floatProperties)===null||K===void 0?void 0:K._OutlineWidth)!==null&&O!==void 0?O:0;Ct=.01*Ct;const it=(B=e.textureProperties)===null||B===void 0?void 0:B._OutlineWidthTexture,ar=it!=null?{index:it,extensions:Object.assign({},xe)}:void 0,wt=(ee=(W=e.vectorProperties)===null||W===void 0?void 0:W._OutlineColor)===null||ee===void 0?void 0:ee.map(ju),Js=((F=e.floatProperties)===null||F===void 0?void 0:F._OutlineColorMode)===1?(X=e.floatProperties)===null||X===void 0?void 0:X._OutlineLightingMix:0,Vt=(ue=e.textureProperties)===null||ue===void 0?void 0:ue._UvAnimMaskTexture,Xt=Vt!=null?{index:Vt,extensions:Object.assign({},xe)}:void 0,ne=(le=e.floatProperties)===null||le===void 0?void 0:le._UvAnimScrollX;let ge=(oe=e.floatProperties)===null||oe===void 0?void 0:oe._UvAnimScrollY;ge!=null&&(ge=-ge);const Be=(re=e.floatProperties)===null||re===void 0?void 0:re._UvAnimRotation,we={specVersion:"1.0",transparentWithZWrite:Re,renderQueueOffsetNumber:Q,shadeColorFactor:V,shadeMultiplyTexture:ae,shadingShiftFactor:ie,shadingToonyFactor:Te,giEqualizationFactor:Le,matcapFactor:De,matcapTexture:fe,rimLightingMixFactor:Ce,rimMultiplyTexture:Fe,parametricRimColorFactor:We,parametricRimFresnelPowerFactor:qe,parametricRimLiftFactor:ct,outlineWidthMode:sn,outlineWidthFactor:Ct,outlineWidthMultiplyTexture:ar,outlineColorFactor:wt,outlineLightingMixFactor:Js,uvAnimationMaskTexture:Xt,uvAnimationScrollXSpeedFactor:ne,uvAnimationScrollYSpeedFactor:ge,uvAnimationRotationSpeedFactor:Be};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:be,baseColorTexture:j},normalTexture:me,emissiveTexture:T,emissiveFactor:G,alphaMode:Ae,alphaCutoff:q,doubleSided:ce,extensions:{VRMC_materials_mtoon:we}})}_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",f=c?(r=e.floatProperties)===null||r===void 0?void 0:r._Cutoff:void 0,h=this._portTextureTransform(e),p=(s=(i=e.vectorProperties)===null||i===void 0?void 0:i._Color)===null||s===void 0?void 0:s.map(ju),d=(o=e.textureProperties)===null||o===void 0?void 0:o._MainTex,g=d!=null?{index:d,extensions:Object.assign({},h)}: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:f,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 FAe(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 ju(n){return Math.pow(n,2.2)}class UAe{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 FAe(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,f,h,p,d,g,m,y,w,x,_,C,S,b,M,D,$,H,I,v,E,U,P,L,z,K,O,B,W,ee,F,X,ue,le,oe,re;const pe=(i=(r=e.keywordMap)===null||r===void 0?void 0:r._ALPHABLEND_ON)!==null&&i!==void 0?i:!1,Re=((s=e.floatProperties)===null||s===void 0?void 0:s._ZWrite)===1&&pe,Q=this._v0ParseRenderQueue(e),de=(a=(o=e.keywordMap)===null||o===void 0?void 0:o._ALPHATEST_ON)!==null&&a!==void 0?a:!1,Ae=pe?"BLEND":de?"MASK":"OPAQUE",q=de?(l=e.floatProperties)===null||l===void 0?void 0:l._Cutoff:void 0,ce=((c=(A=e.floatProperties)===null||A===void 0?void 0:A._CullMode)!==null&&c!==void 0?c:2)===0,xe=this._portTextureTransform(e),be=(f=(u=e.vectorProperties)===null||u===void 0?void 0:u._Color)===null||f===void 0?void 0:f.map((Ee,ze)=>ze===3?Ee:ju(Ee)),N=(h=e.textureProperties)===null||h===void 0?void 0:h._MainTex,j=N!=null?{index:N,extensions:Object.assign({},xe)}:void 0,se=(p=e.floatProperties)===null||p===void 0?void 0:p._BumpScale,he=(d=e.textureProperties)===null||d===void 0?void 0:d._BumpMap,me=he!=null?{index:he,scale:se,extensions:Object.assign({},xe)}:void 0,G=(m=(g=e.vectorProperties)===null||g===void 0?void 0:g._EmissionColor)===null||m===void 0?void 0:m.map(ju),R=(y=e.textureProperties)===null||y===void 0?void 0:y._EmissionMap,T=R!=null?{index:R,extensions:Object.assign({},xe)}:void 0,V=(x=(w=e.vectorProperties)===null||w===void 0?void 0:w._ShadeColor)===null||x===void 0?void 0:x.map(ju),te=(_=e.textureProperties)===null||_===void 0?void 0:_._ShadeTexture,ae=te!=null?{index:te,extensions:Object.assign({},xe)}:void 0;let ie=(S=(C=e.floatProperties)===null||C===void 0?void 0:C._ShadeShift)!==null&&S!==void 0?S:0,Te=(M=(b=e.floatProperties)===null||b===void 0?void 0:b._ShadeToony)!==null&&M!==void 0?M:.9;Te=Lt.lerp(Te,1,.5+.5*ie),ie=-ie-(1-Te);const Me=(D=e.floatProperties)===null||D===void 0?void 0:D._IndirectLightIntensity,Le=Me?1-Me:void 0,ke=($=e.textureProperties)===null||$===void 0?void 0:$._SphereAdd,De=ke!=null?[1,1,1]:void 0,fe=ke!=null?{index:ke}:void 0,Ce=(H=e.floatProperties)===null||H===void 0?void 0:H._RimLightingMix,Se=(I=e.textureProperties)===null||I===void 0?void 0:I._RimTexture,Fe=Se!=null?{index:Se,extensions:Object.assign({},xe)}:void 0,We=(E=(v=e.vectorProperties)===null||v===void 0?void 0:v._RimColor)===null||E===void 0?void 0:E.map(ju),qe=(U=e.floatProperties)===null||U===void 0?void 0:U._RimFresnelPower,ut=(P=e.floatProperties)===null||P===void 0?void 0:P._RimLift,sn=["none","worldCoordinates","screenCoordinates"][(z=(L=e.floatProperties)===null||L===void 0?void 0:L._OutlineWidthMode)!==null&&z!==void 0?z:0];let Ct=(O=(K=e.floatProperties)===null||K===void 0?void 0:K._OutlineWidth)!==null&&O!==void 0?O:0;Ct=.01*Ct;const it=(B=e.textureProperties)===null||B===void 0?void 0:B._OutlineWidthTexture,ar=it!=null?{index:it,extensions:Object.assign({},xe)}:void 0,wt=(ee=(W=e.vectorProperties)===null||W===void 0?void 0:W._OutlineColor)===null||ee===void 0?void 0:ee.map(ju),Js=((F=e.floatProperties)===null||F===void 0?void 0:F._OutlineColorMode)===1?(X=e.floatProperties)===null||X===void 0?void 0:X._OutlineLightingMix:0,Vt=(ue=e.textureProperties)===null||ue===void 0?void 0:ue._UvAnimMaskTexture,Xt=Vt!=null?{index:Vt,extensions:Object.assign({},xe)}:void 0,ne=(le=e.floatProperties)===null||le===void 0?void 0:le._UvAnimScrollX;let ge=(oe=e.floatProperties)===null||oe===void 0?void 0:oe._UvAnimScrollY;ge!=null&&(ge=-ge);const Be=(re=e.floatProperties)===null||re===void 0?void 0:re._UvAnimRotation,we={specVersion:"1.0",transparentWithZWrite:Re,renderQueueOffsetNumber:Q,shadeColorFactor:V,shadeMultiplyTexture:ae,shadingShiftFactor:ie,shadingToonyFactor:Te,giEqualizationFactor:Le,matcapFactor:De,matcapTexture:fe,rimLightingMixFactor:Ce,rimMultiplyTexture:Fe,parametricRimColorFactor:We,parametricRimFresnelPowerFactor:qe,parametricRimLiftFactor:ut,outlineWidthMode:sn,outlineWidthFactor:Ct,outlineWidthMultiplyTexture:ar,outlineColorFactor:wt,outlineLightingMixFactor:Js,uvAnimationMaskTexture:Xt,uvAnimationScrollXSpeedFactor:ne,uvAnimationScrollYSpeedFactor:ge,uvAnimationRotationSpeedFactor:Be};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:be,baseColorTexture:j},normalTexture:me,emissiveTexture:T,emissiveFactor:G,alphaMode:Ae,alphaCutoff:q,doubleSided:ce,extensions:{VRMC_materials_mtoon:we}})}_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",f=c?(r=e.floatProperties)===null||r===void 0?void 0:r._Cutoff:void 0,h=this._portTextureTransform(e),p=(s=(i=e.vectorProperties)===null||i===void 0?void 0:i._Color)===null||s===void 0?void 0:s.map(ju),d=(o=e.textureProperties)===null||o===void 0?void 0:o._MainTex,g=d!=null?{index:d,extensions:Object.assign({},h)}: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:f,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 * @@ -4099,7 +4099,7 @@ void main() { * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */class i5{}const Zb=new Z,Ac=new Z;class s5 extends i5{constructor(e){var t,r,i;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new Z(0,0,0),this.tail=(r=e==null?void 0:e.tail)!==null&&r!==void 0?r:new Z(0,0,0),this.radius=(i=e==null?void 0:e.radius)!==null&&i!==void 0?i:0}get type(){return"capsule"}calculateCollision(e,t,r,i){Zb.copy(this.offset).applyMatrix4(e),Ac.copy(this.tail).applyMatrix4(e),Ac.sub(Zb);const s=Ac.lengthSq();i.copy(t).sub(Zb);const o=Ac.dot(i);o<=0||(s<=o||Ac.multiplyScalar(o/s),i.sub(Ac));const a=r+this.radius,l=i.length()-a;return i.normalize(),l}}class o5 extends i5{constructor(e){var t,r;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new Z(0,0,0),this.radius=(r=e==null?void 0:e.radius)!==null&&r!==void 0?r:0}get type(){return"sphere"}calculateCollision(e,t,r,i){i.copy(this.offset).applyMatrix4(e),i.negate().add(t);const s=r+this.radius,o=i.length()-s;return i.normalize(),o}}const Po=new Z;class ece extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._currentTail=new Z,this._shape=e,this._attrPos=new At(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);const r=Po.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(r)>1e-10&&(this._currentTail.copy(r),e=!0),e&&this._buildPosition()}_buildPosition(){Po.copy(this._currentTail).sub(this._currentOffset);const e=Po.length()/this._currentRadius;for(let i=0;i<=16;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+i,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+i,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+i,e+Math.sin(s),0,Math.cos(s))}for(let i=0;i<32;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(s),Math.cos(s)),this._attrPos.setXYZ(100+i,e,Math.sin(s),Math.cos(s))}const t=Math.atan2(Po.y,Math.sqrt(Po.x*Po.x+Po.z*Po.z)),r=-Math.atan2(Po.z,Po.x);this.rotateZ(t),this.rotateY(r),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(68+e*2,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+t),this._attrIndex.setXY(200+e*2,100+e,100+t)}this._attrIndex.needsUpdate=!0}}class tce extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._shape=e,this._attrPos=new At(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.needsUpdate=!0}}const nce=new Z;class m3 extends Ur{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof o5)this._geometry=new tce(this.collider.shape);else if(this.collider.shape instanceof s5)this._geometry=new ece(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new Cl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new yg(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=nce.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class rce extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new Z,this._springBone=e,this._attrPos=new At(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const ice=new Z;class sce extends Ur{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new rce(this.springBone);const t=new Cl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new yg(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=ice.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class g3 extends It{constructor(e){super(),this.shape=e}}const oce=new je;function a5(n){return n.invert?n.invert():n.getInverse(oce.copy(n)),n}class ace{constructor(e){this._inverseCache=new je,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(r,i,s)=>(this._shouldUpdateInverse=!0,r[i]=s,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),a5(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const lce=new je,Oa=new Z,Zd=new Z,Ace=new Z,Wu=new Z,v3=new Z,Jd=new Z,y3=new rt,Ku=new je,cce=new je;class uce{constructor(e,t,r={},i=[]){var s,o,a,l,A,c;this._currentTail=new Z,this._prevTail=new Z,this._boneAxis=new Z,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new je,this._initialLocalRotation=new rt,this._initialLocalChildPosition=new Z,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(s=r.hitRadius)!==null&&s!==void 0?s:0,stiffness:(o=r.stiffness)!==null&&o!==void 0?o:1,gravityPower:(a=r.gravityPower)!==null&&a!==void 0?a:0,gravityDir:(A=(l=r.gravityDir)===null||l===void 0?void 0:l.clone())!==null&&A!==void 0?A:new Z(0,-1,0),dragForce:(c=r.dragForce)!==null&&c!==void 0?c:.4},this.colliderGroups=i}get center(){return this._center}set center(e){var t;!((t=this._center)===null||t===void 0)&&t.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new ace(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:lce}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const e=this._getMatrixWorldToCenter(Ku);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const e=this._getMatrixWorldToCenter(Ku);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength(),Wu.setFromMatrixPosition(this.bone.matrixWorld);let t=this._getMatrixWorldToCenter(Ku);v3.copy(Wu).applyMatrix4(t);const r=y3.setFromRotationMatrix(t),i=cce.copy(t).multiply(this._parentMatrixWorld),s=Zd.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(v3).normalize(),o=Ace.copy(this.settings.gravityDir).applyQuaternion(r).normalize(),a=this._getMatrixCenterToWorld(Ku);Jd.copy(this._currentTail).add(Oa.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Oa.copy(s).multiplyScalar(this.settings.stiffness*e)).add(Oa.copy(o).multiplyScalar(this.settings.gravityPower*e)).applyMatrix4(a),Jd.sub(Wu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Wu),this._collision(Jd),t=this._getMatrixWorldToCenter(Ku),this._prevTail.copy(this._currentTail),this._currentTail.copy(Oa.copy(Jd).applyMatrix4(t));const l=a5(Ku.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),A=y3.setFromUnitVectors(this._boneAxis,Oa.copy(Jd).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(A),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{const i=r.shape.calculateCollision(r.matrixWorld,e,this.settings.hitRadius,Oa);i<0&&(e.add(Oa.multiplyScalar(-i)),e.sub(Wu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Wu))})})}_calcWorldSpaceBoneLength(){Oa.setFromMatrixPosition(this.bone.matrixWorld),this.child?Zd.setFromMatrixPosition(this.child.matrixWorld):(Zd.copy(this._initialLocalChildPosition),Zd.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Oa.sub(Zd).length()}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}}function av(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 fce(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function l5(n,e){n.children.forEach(t=>{e(t)||l5(t,e)})}class w3{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(r=>{e.add(r)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{e.add(r)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e)}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e),this._objectSpringBonesMap.get(e.bone).delete(e)}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.setInitState())}reset(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.reset())}update(e){const t=new Set,r=new Set,i=new Set;for(const s of this._joints)this._processSpringBone(s,t,r,i,o=>o.update(e)),l5(s.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(e,t,r,i,s){if(r.has(e))return;if(t.has(e))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");t.add(e);const o=this._getDependencies(e);for(const a of o)fce(a,l=>{const A=this._objectSpringBonesMap.get(l);if(A)for(const c of A)this._processSpringBone(c,t,r,i,s);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),s(e),i.add(e.bone),r.add(e)}_getDependencies(e){const t=new Set,r=e.bone.parent;return r&&t.add(r),e.colliderGroups.forEach(i=>{i.colliders.forEach(s=>{t.add(s)})}),t}}const hce=new Set(["1.0","1.0-beta"]);class Tc{constructor(e,t){this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot}get name(){return Tc.EXTENSION_NAME}afterRoot(e){return av(this,void 0,void 0,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return av(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i,s,o;return av(this,void 0,void 0,function*(){const a=e.parser.json;if(!(((t=a.extensionsUsed)===null||t===void 0?void 0:t.indexOf(Tc.EXTENSION_NAME))!==-1))return null;const A=new w3,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)===null||r===void 0?void 0:r[Tc.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!hce.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Tc.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)===null||i===void 0?void 0:i.map((d,g)=>{var m,y,w,x,_;const C=c[d.node],S=d.shape;if(S.sphere)return this._importSphereCollider(C,{offset:new Z().fromArray((m=S.sphere.offset)!==null&&m!==void 0?m:[0,0,0]),radius:(y=S.sphere.radius)!==null&&y!==void 0?y:0});if(S.capsule)return this._importCapsuleCollider(C,{offset:new Z().fromArray((w=S.capsule.offset)!==null&&w!==void 0?w:[0,0,0]),radius:(x=S.capsule.radius)!==null&&x!==void 0?x:0,tail:new Z().fromArray((_=S.capsule.tail)!==null&&_!==void 0?_:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),p=(s=u.colliderGroups)===null||s===void 0?void 0:s.map((d,g)=>{var m;return{colliders:((m=d.colliders)!==null&&m!==void 0?m:[]).map(w=>{const x=h==null?void 0:h[w];if(x==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return x}),name:d.name}});return(o=u.springs)===null||o===void 0||o.forEach((d,g)=>{var m;const y=d.joints,w=(m=d.colliderGroups)===null||m===void 0?void 0:m.map(C=>{const S=p==null?void 0:p[C];if(S==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${C} but not found`);return S}),x=d.center!=null?c[d.center]:void 0;let _;y.forEach(C=>{if(_){const S=_.node,b=c[S],M=C.node,D=c[M],$={hitRadius:_.hitRadius,dragForce:_.dragForce,gravityPower:_.gravityPower,stiffness:_.stiffness,gravityDir:_.gravityDir!=null?new Z().fromArray(_.gravityDir):void 0},H=this._importJoint(b,D,$,w);x&&(H.center=x),A.addJoint(H)}_=C})}),A.setInitState(),A})}_v0Import(e){var t,r,i;return av(this,void 0,void 0,function*(){const s=e.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new w3,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)===null||i===void 0?void 0:i.map(h=>{var p;const d=u[h.node];return{colliders:((p=h.colliders)!==null&&p!==void 0?p:[]).map((m,y)=>{var w,x,_;const C=new Z(0,0,0);return m.offset&&C.set((w=m.offset.x)!==null&&w!==void 0?w:0,(x=m.offset.y)!==null&&x!==void 0?x:0,m.offset.z?-m.offset.z:0),this._importSphereCollider(d,{offset:C,radius:(_=m.radius)!==null&&_!==void 0?_:0})})}});return A==null||A.forEach((h,p)=>{const d=h.bones;d&&d.forEach(g=>{var m,y,w,x;const _=u[g],C=new Z;h.gravityDir?C.set((m=h.gravityDir.x)!==null&&m!==void 0?m:0,(y=h.gravityDir.y)!==null&&y!==void 0?y:0,(w=h.gravityDir.z)!==null&&w!==void 0?w:0):C.set(0,-1,0);const S=h.center!=null?u[h.center]:void 0,b={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:C},M=(x=h.colliderGroups)===null||x===void 0?void 0:x.map(D=>{const $=f==null?void 0:f[D];if($==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${D} but not found`);return $});_.traverse(D=>{var $;const H=($=D.children[0])!==null&&$!==void 0?$:null,I=this._importJoint(D,H,b,M);S&&(I.center=S),c.addJoint(I)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new uce(e,t,r,i);if(this.jointHelperRoot){const o=new sce(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const{offset:r,radius:i}=t,s=new o5({offset:r,radius:i}),o=new g3(s);if(e.add(o),this.colliderHelperRoot){const a=new m3(o);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(e,t){const{offset:r,radius:i,tail:s}=t,o=new s5({offset:r,radius:i,tail:s}),a=new g3(o);if(e.add(a),this.colliderHelperRoot){const l=new m3(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}}Tc.EXTENSION_NAME="VRMC_springBone";class dce{constructor(e,t){var r,i,s,o,a,l,A,c,u,f;this.parser=e;const h=t==null?void 0:t.helperRoot,p=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(r=t==null?void 0:t.expressionPlugin)!==null&&r!==void 0?r:new r_(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!==null&&i!==void 0?i:new Wle(e),this.humanoidPlugin=(s=t==null?void 0:t.humanoidPlugin)!==null&&s!==void 0?s:new eAe(e,{helperRoot:h,autoUpdateHumanBones:p}),this.lookAtPlugin=(o=t==null?void 0:t.lookAtPlugin)!==null&&o!==void 0?o:new dAe(e,{helperRoot:h}),this.metaPlugin=(a=t==null?void 0:t.metaPlugin)!==null&&a!==void 0?a:new gAe(e),this.mtoonMaterialPlugin=(l=t==null?void 0:t.mtoonMaterialPlugin)!==null&&l!==void 0?l:new fh(e),this.materialsHDREmissiveMultiplierPlugin=(A=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!==null&&A!==void 0?A:new $m(e),this.materialsV0CompatPlugin=(c=t==null?void 0:t.materialsV0CompatPlugin)!==null&&c!==void 0?c:new UAe(e),this.springBonePlugin=(u=t==null?void 0:t.springBonePlugin)!==null&&u!==void 0?u:new Tc(e,{colliderHelperRoot:h,jointHelperRoot:h}),this.nodeConstraintPlugin=(f=t==null?void 0:t.nodeConstraintPlugin)!==null&&f!==void 0?f:new Mc(e,{helperRoot:h})}get name(){return"VRMLoaderPlugin"}beforeRoot(){return ov(this,void 0,void 0,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return ov(this,void 0,void 0,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return t??null}extendMaterialParams(e,t){return ov(this,void 0,void 0,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return ov(this,void 0,void 0,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){const i=new yAe({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=i}})}}function x3(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function pce(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>x3(i)):r&&x3(r))}function mce(n){n.traverse(pce)}function gce(n){const e=new Map;n.traverse(t=>{if(t.type!=="SkinnedMesh")return;const r=t,s=r.geometry.getAttribute("skinIndex");let o=e.get(s);if(!o){const a=[],l=[],A={},c=s.array;for(let u=0;u{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,A=l.index;if(A==null)return;const c=e.get(l);if(c!=null){a.geometry=c;return}const u=new $t;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(d=>{u.addGroup(d.start,d.count,d.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)===null||r===void 0?void 0:r.clone())!==null&&i!==void 0?i:null,u.boundingSphere=(o=(s=l.boundingSphere)===null||s===void 0?void 0:s.clone())!==null&&o!==void 0?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const d=A.array,g=new d.constructor(d.length);let m=0;for(let y=0;y{const g=l.attributes[d];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const m=g.array,{itemSize:y,normalized:w}=g,x=new m.constructor(h.length*y);h.forEach((_,C)=>{for(let S=0;S{u.morphAttributes[d]=[];const g=l.morphAttributes[d];for(let m=0;m{for(let M=0;MS===0),u.morphAttributes[d][m]=new At(C,x,_)}}),p&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function yce(n){var e;((e=n.meta)===null||e===void 0?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}class Bg{constructor(){}}Bg.deepDispose=mce;Bg.removeUnnecessaryJoints=gce;Bg.removeUnnecessaryVertices=vce;Bg.rotateVRM0=yce;var Jn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Jn||(Jn={}));const Lw="blend_",_3="vrmColliderSphere";class wce{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},A={},c={},u=e.lookAt,f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=a.filter((re,pe,_e)=>_e.findIndex(Re=>Re.name===re.name.replace(" (Outline)",""))===pe).map(re=>re),p=h.map(re=>re.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(re=>re.map).map(re=>{if(!re.map)throw new Error(re.name+" map is null");return{name:re.name,imageBitmap:re.map.image}}),m=h.filter(re=>re.userData.shadeTexture).map(re=>{if(!re.userData.shadeTexture)throw new Error(re.userData.shadeTexture+" map is null");return{name:re.name+"_shade",imageBitmap:re.userData.shadeTexture.image}}),y=g.concat(m),w=Ece(y,d),x=Cce(w),_=Sce(w),C=Bce(h,y),S=t.children.filter(re=>re.children.length>0&&re.children[0].type===ai.Bone)[0],b=A5(S).filter(re=>re.name!==_3),M=b.map(re=>re.name),D=b.map(re=>({children:re.children.filter(pe=>pe.name!==_3).map(pe=>M.indexOf(pe.name)),name:re.name,rotation:[re.quaternion.x,re.quaternion.y,re.quaternion.z,re.quaternion.w],scale:[re.scale.x,re.scale.y,re.scale.z],translation:[re.position.x,re.position.y,re.position.z]})),$=[],H=t.children.filter(re=>re.type===ai.Group||re.type===ai.SkinnedMesh),I=[];H.forEach(re=>{const pe=re.type===ai.Group?re.children[0]:re,_e=pe.geometry.attributes;I.push(new Na(_e.position,Jn.FLOAT,Wt.POSITION,ho.VEC3,pe.name,void 0)),I.push(new Na(_e.normal,Jn.FLOAT,Wt.NORMAL,ho.VEC3,pe.name,void 0)),I.push(new Na(_e.uv,Jn.FLOAT,Wt.UV,ho.VEC2,pe.name,void 0)),I.push(new Na(_e.skinWeight,Jn.FLOAT,Wt.SKIN_WEIGHT,ho.VEC4,pe.name,void 0)),I.push(new Na(_e.skinIndex,Jn.UNSIGNED_SHORT,Wt.SKIN_INDEX,ho.VEC4,pe.name,void 0)),(re.type===ai.Group?re.children.map(Q=>Q):[re]).forEach(Q=>{if(!Q.geometry.index)throw new Error(Q.name+" geometry.index is null");I.push(new Na(Q.geometry.index,Jn.UNSIGNED_INT,Wt.INDEX,ho.SCALAR,pe.name,Q.name))}),pe.morphTargetDictionary||(pe.morphTargetDictionary={},pe.morphTargetInfluences=[],pe.geometry.morphAttributes={},pe.updateMorphTargets()),pe.geometry.userData.targetNames=[];for(const Q in e.expressionManager.expressionMap){const de=e.expressionManager.expressionMap[Q],Ae=de._binds.map(J=>({node:b.length,index:J.index,weight:J.weight}));let q=!1;for(const J in oi)if(Q.toLowerCase()===oi[J].toLowerCase()){l[oi[J]]={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth},q=!0;break}!q&&Q.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth},q=!0),q===!1&&(A[Q]={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth})}for(const Q in pe.morphTargetDictionary){pe.geometry.userData.targetNames.push(Q);const de=pe.morphTargetDictionary[Q],Ae=pe.geometry.morphAttributes;I.push(new Na(Ae.position[de],Jn.FLOAT,Wt.BLEND_POSITION,ho.VEC3,pe.name,Lw+Q)),I.push(new Na(Ae.normal[de],Jn.FLOAT,Wt.BLEND_NORMAL,ho.VEC3,pe.name,Lw+Q))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),H.forEach(re=>{const pe=re.type===ai.Group?re.children[0]:re,_e=new Float32Array(pe.skeleton.boneInverses.map(Re=>Re.elements).flat());I.push(new Na(new At(_e,16),Jn.FLOAT,Wt.BIND_MATRIX,ho.MAT4,pe.name,pe.name))}),$.push(...I.map(re=>({bufferView:-1,byteOffset:0,componentType:re.valueType,count:re.attribute.count,max:re.max,min:re.min,normalized:!1,type:re.accessorsType})));const v=_ce(H,I,p);H.forEach((re,pe)=>{D.push({mesh:pe,name:re.name,rotation:[re.quaternion.x,re.quaternion.y,re.quaternion.z,re.quaternion.w],scale:[re.scale.x,re.scale.y,re.scale.z],skin:pe,translation:[re.position.x,re.position.y,re.position.z]})});const E=bce(H,I,M),U={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},P={humanBones:{}};for(const re in s.humanBones)P.humanBones[re]={node:M.indexOf(s.humanBones[re].node.name)};const L=o,z=[];z.push(...y.map(re=>({buffer:b3(re.imageBitmap),type:Wt.IMAGE}))),z.push(...I.map(re=>({buffer:re.buffer,type:re.type}))),d&&z.push({buffer:b3(d.imageBitmap),type:Wt.IMAGE});let K=0,O=0,B=0;const W=z.map((re,pe)=>{const _e={buffer:0,byteLength:re.buffer.byteLength,byteOffset:K,target:re.type===Wt.IMAGE||re.type===Wt.BIND_MATRIX?void 0:re.type===Wt.INDEX?Jn.ELEMENT_ARRAY_BUFFER:Jn.ARRAY_BUFFER};return K+=re.buffer.byteLength,re.type===Wt.IMAGE?w[O++].bufferView=pe:$[B++].bufferView=pe,_e}),ee=Mce(t,D),F={accessors:$,asset:f,buffers:[{byteLength:K}],bufferViews:W,extensions:{VRMC_vrm:{expressions:c,humanoid:P,lookAt:U,meta:L,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:C,meshes:v,nodes:D,samplers:x,avatar:0,scenes:ee,skins:E,textures:_},X=new B3(DC(JSON.stringify(F,void 0,2)),"JSON"),ue=new B3(Fp(z.map(re=>re.buffer)),"BIN\0"),le=Fp([X.buffer,ue.buffer]),oe=Fp([DC("glTF"),PC(2,4),PC(le.byteLength+12,4)]);i(Fp([oe,le]))}}function A5(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>A5(e)).flat())}function b3(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Jn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Jn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let B3=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Fp([PC(r.byteLength,4),DC(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===Wt.POSITION||r===Wt.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var jf;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(jf||(jf={}));var ho;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(ho||(ho={}));var Wt;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(Wt||(Wt={}));var ai;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(ai||(ai={}));const _ce=(n,e,t)=>n.map(r=>{const i=r.type===ai.Group?r.children[0]:r,s=r.type===ai.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Wt.SKIN_INDEX),NORMAL:a.indexOf(Wt.NORMAL),POSITION:a.indexOf(Wt.POSITION),TEXCOORD_0:a.indexOf(Wt.UV),WEIGHTS_0:a.indexOf(Wt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Wt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>({NORMAL:e.map(c=>c.type===Wt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(Lw+A),POSITION:e.map(c=>c.type===Wt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(Lw+A)})):void 0}})}}),bce=(n,e,t)=>n.map(r=>{const i=r.type===ai.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Wt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Bce=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(c=>c.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const A=t;r=A.color?[A.color.r,A.color.g,A.color.b,1]:void 0}let s=-1;t.map?s=e.map(A=>A.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(A=>A.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case jf.MeshStandardMaterial:return t.metalness;case jf.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case jf.MeshStandardMaterial:return t.roughness;case jf.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),Ece=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Cce=n=>n.map(()=>({magFilter:Jn.LINEAR,minFilter:Jn.LINEAR,wrapS:Jn.REPEAT,wrapT:Jn.REPEAT})),Sce=n=>n.map((e,t)=>({sampler:0,source:t})),Mce=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===ai.Object3D||r.type===ai.SkinnedMesh||r.type===ai.Group||r.type===ai.Bone).map(r=>t.indexOf(r.name))}]},c5=0,Tce=1,u5=2,E3=2,Jb=1.25,C3=1,dy=6*4+4+4,OC=65535,Ice=Math.pow(2,-24);class lv{constructor(){}}function Jo(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function S3(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function M3(n,e){e.set(n)}function T3(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function Av(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function qd(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}function Rce(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let i;t>65535?i=new Uint32Array(new r(4*t)):i=new Uint16Array(new r(2*t)),n.setIndex(new At(i,1));for(let s=0;si-s);for(let i=0;il&&(l=S),m&&xp&&(p=x);const b=n[y+2],M=n[y+3],D=b-M,$=b+M;DA&&(A=$),m&&bd&&(d=b);const H=n[y+4],I=n[y+5],v=H-I,E=H+I;vc&&(c=E),m&&Hg&&(g=H)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=A,r[5]=c,m&&(i[0]=u,i[1]=f,i[2]=h,i[3]=p,i[4]=d,i[5]=g)}function Uce(n,e,t,r){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,A=-1/0;for(let c=e*6,u=(e+t)*6;ca&&(a=f);const h=n[c+2];hl&&(l=h);const p=n[c+4];pA&&(A=p)}r[0]=i,r[1]=s,r[2]=o,r[3]=a,r[4]=l,r[5]=A}function Lce(n,e,t,r,i){let s=t,o=t+r-1;const a=i.pos,l=i.axis*2;for(;;){for(;s<=o&&e[s*6+l]=a;)o--;if(sn.candidate-e.candidate,zl=new Array(Ga).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),cv=new Float32Array(6);function Dce(n,e,t,r,i,s){let o=-1,a=0;if(s===c5)o=S3(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Tce)o=S3(n),o!==-1&&(a=Oce(t,r,i,o));else if(s===u5){const l=qd(n);let A=Jb*i;const c=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const h=e[f],g=(e[f+3]-h)/Ga;if(i=S.candidate?Av(x,t,S.rightCacheBounds):(Av(x,t,S.leftCacheBounds),S.count++)}}for(let x=0;x=Ga&&(C=Ga-1);const S=zl[C];S.count++,Av(w,t,S.bounds)}const m=zl[Ga-1];M3(m.bounds,m.rightCacheBounds);for(let w=Ga-2;w>=0;w--){const x=zl[w],_=zl[w+1];T3(x.bounds,_.rightCacheBounds,x.rightCacheBounds)}let y=0;for(let w=0;wC&&(C=w),x>C&&(C=x);const S=(C-_)/2,b=m*2;s[h+b+0]=_+S,s[h+b+1]=S+(Math.abs(_)+S)*Ice,_e[m+3]&&(e[m+3]=C)}}return s}function kce(n,e){function t(m){f&&f(m/h)}function r(m,y,w,x=null,_=0){if(!p&&_>=l&&(p=!0,A&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(n))),w<=c||_>=l)return t(y+w),m.offset=y,m.count=w,m;const C=Dce(m.boundingData,x,o,y,w,u);if(C.axis===-1)return t(y+w),m.offset=y,m.count=w,m;const S=Lce(a,o,y,w,C);if(S===y||S===y+w)t(y+w),m.offset=y,m.count=w;else{m.splitAxis=C.axis;const b=new lv,M=y,D=S-y;m.left=b,b.boundingData=new Float32Array(6),qb(o,M,D,b.boundingData,s),r(b,M,D,s,_+1);const $=new lv,H=S,I=w-D;m.right=$,$.boundingData=new Float32Array(6),qb(o,H,I,$.boundingData,s),r($,H,I,s,_+1)}return m}Rce(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=Nce(n,i),a=n.index.array,l=e.maxDepth,A=e.verbose,c=e.maxLeafTris,u=e.strategy,f=e.onProgress,h=n.index.count/3;let p=!1;const d=[],g=Fce(n);if(g.length===1){const m=g[0],y=new lv;y.boundingData=i,Uce(o,m.offset,m.count,s),r(y,m.offset,m.count,s),d.push(y)}else for(let m of g){const y=new lv;y.boundingData=new Float32Array(6),qb(o,m.offset,m.count,y.boundingData,s),r(y,m.offset,m.count,s),d.push(y)}return d}function Qce(n,e){const t=kce(n,e);let r,i,s;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[f+6]=w/4,w=A(w,m),i[f+7]=y,w}}}class xl{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}xl.prototype.setFromBox=function(){const n=new Z;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let A=0;A<=1;A++)for(let c=0;c<=1;c++){n.x=i.x*l+s.x*(1-l),n.y=i.y*A+s.y*(1-A),n.z=i.z*c+s.z*(1-c);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Hce=function(){const n=new Z,e=new Z,t=new Z;return function(i,s,o){const a=i.start,l=n,A=s.start,c=e;t.subVectors(a,A),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(c),f=c.dot(l),h=c.dot(c),p=t.dot(l),g=l.dot(l)*h-f*f;let m,y;g!==0?m=(u*f-p*h)/g:m=0,y=(u+m*f)/h,o.x=m,o.y=y}}(),vT=function(){const n=new $e,e=new Z,t=new Z;return function(i,s,o,a){Hce(i,s,n);let l=n.x,A=n.y;if(l>=0&&l<=1&&A>=0&&A<=1){i.at(l,o),s.at(A,a);return}else if(l>=0&&l<=1){A<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(A>=0&&A<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let c;l<0?c=i.start:c=i.end;let u;A<0?u=s.start:u=s.end;const f=e,h=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(c,!0,t),f.distanceToSquared(u)<=h.distanceToSquared(c)){o.copy(f),a.copy(u);return}else{o.copy(c),a.copy(h);return}}}}(),zce=function(){const n=new Z,e=new Z,t=new Ja,r=new cl;return function(s,o){const{radius:a,center:l}=s,{a:A,b:c,c:u}=o;if(r.start=A,r.end=c,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const d=o.getPlane(t);if(Math.abs(d.distanceToPoint(l))<=a){const m=d.projectPoint(l,e);if(o.containsPoint(m))return!0}return!1}}(),Gce=1e-15;function $u(n){return Math.abs(n)new Z),this.satBounds=new Array(4).fill().map(()=>new xl),this.points=[this.a,this.b,this.c],this.sphere=new su,this.plane=new Ja,this.needsUpdate=!0}intersectsSphere(e){return zce(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const A=s[1],c=o[1];A.subVectors(e,t),c.setFromPoints(A,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const h=s[3],p=o[3];h.subVectors(r,e),p.setFromPoints(h,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}_l.prototype.closestPointToSegment=function(){const n=new Z,e=new Z,t=new cl;return function(i,s=null,o=null){const{start:a,end:l}=i,A=this.points;let c,u=1/0;for(let f=0;f<3;f++){const h=(f+1)%3;t.start.copy(A[f]),t.end.copy(A[h]),vT(t,i,n,e),c=n.distanceToSquared(e),c1-1e-10){const y=this.satBounds,w=this.satAxes;t[0]=h.a,t[1]=h.b,t[2]=h.c;for(let C=0;C<4;C++){const S=y[C],b=w[C];if(r.setFromPoints(b,t),S.isSeparated(r))return!1}const x=h.satBounds,_=h.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let C=0;C<4;C++){const S=x[C],b=_[C];if(r.setFromPoints(b,e),S.isSeparated(r))return!1}for(let C=0;C<4;C++){const S=w[C];for(let b=0;b<4;b++){const M=_[b];if(s.crossVectors(S,M),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(d||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const y=this.points;let w=!1,x=0;for(let v=0;v<3;v++){const E=y[v],U=y[(v+1)%3];A.start.copy(E),A.end.copy(U),A.delta(o);const P=w?c.start:c.end,L=$u(m.distanceToPoint(E));if($u(m.normal.dot(o))&&L){c.copy(A),x=2;break}if((m.intersectLine(A,P)||L)&&!$u(P.distanceTo(U))){if(x++,w)break;w=!0}}if(x===1&&h.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(x!==2)return!1;const _=h.points;let C=!1,S=0;for(let v=0;v<3;v++){const E=_[v],U=_[(v+1)%3];A.start.copy(E),A.end.copy(U),A.delta(a);const P=C?u.start:u.end,L=$u(g.distanceToPoint(E));if($u(g.normal.dot(a))&&L){u.copy(A),S=2;break}if((g.intersectLine(A,P)||L)&&!$u(P.distanceTo(U))){if(S++,C)break;C=!0}}if(S===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(S!==2)return!1;if(c.delta(o),u.delta(a),o.dot(a)<0){let v=u.start;u.start=u.end,u.end=v}const b=c.start.dot(o),M=c.end.dot(o),D=u.start.dot(o),$=u.end.dot(o),H=M0?p.start.copy(c.start):p.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(o)<0?p.end.copy(c.end):p.end.copy(u.end)),!0)}}}();_l.prototype.distanceToPoint=function(){const n=new Z;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();_l.prototype.distanceToTriangle=function(){const n=new Z,e=new Z,t=["a","b","c"],r=new cl,i=new cl;return function(o,a=null,l=null){const A=a||l?r:null;if(this.intersectsTriangle(o,A))return(a||l)&&(a&&A.getCenter(a),l&&A.getCenter(l)),0;let c=1/0;for(let u=0;u<3;u++){let f;const h=t[u],p=o[h];this.closestPointToPoint(p,n),f=p.distanceToSquared(n),fnew Z),this.satAxes=new Array(3).fill().map(()=>new Z),this.satBounds=new Array(3).fill().map(()=>new xl),this.alignedSatBounds=new Array(3).fill().map(()=>new xl),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}va.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let A=0;A<=1;A++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){const f=1*A|2*c|4*u,h=i[f];h.x=A?r.x:t.x,h.y=c?r.y:t.y,h.z=u?r.z:t.z,h.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let A=0;A<3;A++){const c=o[A],u=s[A],f=1<new cl),t=new Array(12).fill().map(()=>new cl),r=new Z,i=new Z;return function(o,a=0,l=null,A=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||A)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),A&&A.copy(i)),0;const c=a*a,u=o.min,f=o.max,h=this.points;let p=1/0;for(let g=0;g<8;g++){const m=h[g];i.copy(m).clamp(u,f);const y=m.distanceToSquared(i);if(yt.far)?null:n}function Ko(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,A=e+2;t&&(a=t.getX(e),l=t.getX(e+1),A=t.getX(e+2)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(A),o.y=r.getY(A),o.z=r.getZ(A)}function P3(n,e,t,r,i,s,o){const a=t.index,l=t.attributes.position;for(let A=n,c=e+n;A=0;let h,p;f?(h=Xm(n),p=Zm(n,a)):(h=Zm(n,a),p=Xm(n));const g=Dw(h,s,r,Pw)?kC(h,e,t,r):null;if(g){const w=g.point[c];if(f?w<=s[p+A]:w>=s[p+A+3])return g}const y=Dw(p,s,r,Pw)?kC(p,e,t,r):null;return g&&y?g.distance<=y.distance?g:y:g||y||null}}const Xce=function(){let n,e;const t=[],r=new h5(()=>new ps);return function(...o){n=r.getPrimitive(),e=r.getPrimitive(),t.push(n,e);const a=i(...o);r.releasePrimitive(n),r.releasePrimitive(e),t.pop(),t.pop();const l=t.length;return l>0&&(e=t[l-1],n=t[l-2]),a};function i(s,o,a,l,A=null,c=0,u=0){function f(w){let x=w*2,_=MA,C=TA;for(;!nA(x,_);)w=Xm(w),x=w*2;return hh(w,C)}function h(w){let x=w*2,_=MA,C=TA;for(;!nA(x,_);)w=Zm(w,C),x=w*2;return hh(w,C)+Ym(x,_)}let p=s*2,d=sd,g=MA,m=TA;if(nA(p,g)){const w=hh(s,m),x=Ym(p,g);return Jo(s,d,n),l(w,x,!1,u,c+s,n)}else{const w=Xm(s),x=Zm(s,m);let _=w,C=x,S,b,M,D;if(A&&(M=n,D=e,Jo(_,d,M),Jo(C,d,D),S=A(M),b=A(D),bi.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(A),b.b.applyMatrix4(A),b.c.applyMatrix4(A),b.needsUpdate=!0;for(let M=_*3,D=(C+_)*3;Mnew _l);class om{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),om.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};const r=e.geometry,i=e._roots,s=r.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:s.array.slice()}:o={roots:i,index:s.array},o}static deserialize(e,t,r={}){if(typeof r=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),om.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});r={setIndex:!0,...r};const{index:i,roots:s}=e,o=new om(t,{...r,[eB]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new At(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:c5,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[eB]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[eB]||(this._roots=Qce(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new ps))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=this.geometry,r=t.index.array,i=t.attributes.position;let s,o,a,l,A=0;const c=this._roots;for(let f=0,h=c.length;fC&&(C=H),IS&&(S=I),v<_&&(_=v),v>b&&(b=v)}return l[f+0]!==w||l[f+1]!==x||l[f+2]!==_||l[f+3]!==C||l[f+4]!==S||l[f+5]!==b?(l[f+0]=w,l[f+1]=x,l[f+2]=_,l[f+3]=C,l[f+4]=S,l[f+5]=b,!0):!1}else{const m=f+8,y=o[f+6],w=m+h,x=y+h;let _=p,C=!1,S=!1;e?_||(C=e.has(w),S=e.has(x),_=!C&&!S):(C=!0,S=!0);const b=_||C,M=_||S;let D=!1;b&&(D=u(m,h,_));let $=!1;M&&($=u(y,h,_));const H=D||$;if(H)for(let I=0;I<3;I++){const v=m+I,E=y+I,U=l[v],P=l[v+3],L=l[E],z=l[E+3];l[f+I]=Uz?P:z}return H}}}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const A=a*2,c=s[A+15]===OC;if(c){const u=i[a+6],f=s[A+14];e(l,c,new Float32Array(r,a*4,6),u,f)}else{const u=a+dy/4,f=i[a+6],h=i[a+7];e(l,c,new Float32Array(r,a*4,6),h)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=ls){const r=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,A=o?t.side:t;for(let c=0,u=r.length;c{const m=p*3;return f(h,m,m+1,m+2,d,g)}}e={boundsTraverseOrder:r,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const s=Do.getPrimitive();let{boundsTraverseOrder:o,intersectsBounds:a,intersectsRange:l,intersectsTriangle:A}=e;if(l&&A){const f=l;l=(h,p,d,g,m)=>f(h,p,d,g,m)?!0:P3(h,p,i,A,d,g,s)}else l||(A?l=(f,h,p,d)=>P3(f,h,i,A,p,d,s):l=(f,h,p)=>p);let c=!1,u=0;for(const f of this._roots){if(Up(f),c=Xce(0,i,a,l,o,u),dv(),c)break;u+=f.byteLength}return Do.releasePrimitive(s),c}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:s}=r;const o=this.geometry.index,a=this.geometry.attributes.position,l=e.geometry.index,A=e.geometry.attributes.position;Yu.copy(t).invert();const c=Do.getPrimitive(),u=Do.getPrimitive();if(s){let h=function(p,d,g,m,y,w,x,_){for(let C=g,S=g+m;CnB.intersectsBox(h),intersectsRange:(h,p,d,g,m,y)=>(tB.copy(y),tB.applyMatrix4(Yu),e.shapecast({intersectsBounds:w=>tB.intersectsBox(w),intersectsRange:(w,x,_,C,S)=>i(h,p,w,x,g,m,C,S)}))});return Do.releasePrimitive(c),Do.releasePrimitive(u),f}intersectsBox(e,t){return cc.set(e.min,e.max,t),cc.needsUpdate=!0,this.shapecast({intersectsBounds:r=>cc.intersectsBox(r),intersectsTriangle:r=>cc.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){e.boundingBox||e.computeBoundingBox(),cc.set(e.boundingBox.min,e.boundingBox.max,t),cc.needsUpdate=!0;const a=this.geometry,l=a.attributes.position,A=a.index,c=e.attributes.position,u=e.index,f=Do.getPrimitive(),h=Do.getPrimitive();let p=pv,d=Jce,g=null,m=null;i&&(g=qce,m=eue);let y=1/0,w=null,x=null;return Yu.copy(t).invert(),ep.matrix.copy(Yu),this.shapecast({boundsTraverseOrder:_=>cc.distanceToBox(_),intersectsBounds:(_,C,S)=>S{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:S=>ep.distanceToBox(S),intersectsBounds:(S,b,M)=>M{for(let M=S*3,D=(S+b)*3;M(tp.copy(e).clamp(c.min,c.max),tp.distanceToSquared(e)),intersectsBounds:(c,u,f)=>f{c.closestPointToPoint(e,tp);const f=e.distanceToSquared(tp);return f{Jo(0,new Float32Array(r),D3),e.union(D3)}),e}}const rB=new mg,O3=new je,tue=xn.prototype.raycast;function nue(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;O3.copy(this.matrixWorld).invert(),rB.copy(n.ray).applyMatrix4(O3);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=L3(t.raycastFirst(rB,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(rB,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new Xi,i=new Z,s=new Z,o=new Z,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&my(n.userData.cancelMesh))},d5=n=>{var e,t;n.userData.cullingClone&&(my(n.userData.cullingClone),n.userData.cullingClone=null,my(n.userData.cullingCloneP),n.userData.cullingCloneP=null,my(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},uue=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Lp=n[0].parent,Lp.lines!=null&&(Lp.lines.forEach(i=>{i.visible=!1}),Lp.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=cue(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=aue,a.userData.cancelMesh=o,a.material=lue,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},fue=n=>{let e=sue,t=oue;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},hue=(n,e,t,r,i,s,o=!1)=>{const a=[],l=fue(s);let A=l[0],c=l[1];mv.far=A+c;for(let f=0;f=0;y--)A-m[y].distance>=m[y].object.userData.maxCullDistance&&m.splice(y,1);if(m.length===0){for(let y=0;y<3;y++)a.push(n[h+y]);break}else{const y=m.map(w=>w.object);for(let w=0;ww).length===0){for(let w=0;w<3;w++)a.push(n[h+w]);break}if(d===0)p=m.map(w=>w.object);else if(p=m.map(w=>{if(p.indexOf(w.object)!==-1)return w.object}),p=p.filter(w=>w),d===2&&p.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[h+w]);o&&due(iB,np.clone().multiplyScalar(-1),mv.far,16711680,Lp)}}}const u=new Uint32Array(a);return new At(u,1,!1)};function due(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new Z;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new $t().setFromPoints(o),l=[];l.push(new Qe(0)),l.push(new Qe(16777215));let A=new Cl({color:r});var c=new td(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}let sB,ka,gv,vv,yv,zi,Xu;function pue(){zi!=null&&zi.clear(!0,!0)}function mue(n,e,t){const r=e*t,i=new Uint8Array(4*r),s=Math.floor(n.r*255),o=Math.floor(n.g*255),a=Math.floor(n.b*255);for(let A=0;Atypeof window>"u"?await wue({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await xue({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o}),wue=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(S=>{const b=S.material;let M=a.find(D=>D.material===b);if(!M)a.push({material:b,mesh:S});else{const{dest:D}=yT({meshes:[M.mesh,S]});M.mesh.geometry=D}});const l=Object.fromEntries(o.map(S=>[S,p5({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((S,b)=>{const M=new $e(b%A,Math.floor(b/A)).multiplyScalar(1/A),D=new $e(M.x+1/A,M.y+1/A);return[S.mesh,{min:M,max:D}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},h=[],p=[];a.forEach(S=>{const{min:b,max:M}=u.get(S.mesh);p.push(M),h.push(b)});const d=new $e(Math.max(...p.map(S=>S.x)),Math.max(...p.map(S=>S.y))),g=new $e(Math.min(...h.map(S=>S.x)),Math.min(...h.map(S=>S.y))),m=1/(d.x-g.x),y=1/(d.y-g.y),w=c*m,x=c*y,_=new Map(a.map(S=>{let{min:b,max:M}=u.get(S.mesh);return b.x=b.x*m,b.y=b.y*y,M.x=M.x*m,M.y=M.y*y,[S.mesh,{min:b,max:M}]}));a.forEach(S=>{const{material:b,mesh:M}=S,{min:D,max:$}=_.get(M);o.forEach(E=>{const U=l[E];U.globalCompositeOperation="source-over";let P=HC(b,f[E].find(L=>HC(b,L)));if(P!==""&&P!==void 0)try{const L=new Uint8ClampedArray(P.data),z=new ImageData(L,w,x),K=document.createElement("canvas");K.width=w,K.height=x;const O=K.getContext("2d");O.putImageData(z,0,0),O.save(),U.drawImage(K,D.x*s,D.y*s,w,x)}catch(L){console.error("error",L)}else U.fillStyle=E==="diffuse"?`#${b.color.clone().getHexString()}`:E==="normal"?"#8080ff":E==="orm"?`#${new Qe(b.aoMapIntensity,b.roughness,b.metalness).getHexString()}`:"#7F7F7F",U.fillRect(D.x*s,D.y*s,w,x)});const H=M.geometry,I=H.attributes.uv;if(I)for(let E=0;E{const b=new Qn(l[S].canvas);return b.flipY=!1,[S,b]})));return{bakeObjects:a,textures:C,uvs:_}},xue=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o})=>{pue();const a=t,l=r?["diffuse"]:["diffuse","orm","normal"],A=[];let c=null;e.forEach(v=>{v=v.clone();const E=v.material.length==null?v.material:v.material[0];r&&c==null&&E.type=="ShaderMaterial"&&(c=E.clone());let U=A.find(P=>{P.material});if(!U)A.push({material:E,mesh:v});else{const{dest:P}=yT({meshes:[U.mesh,v]});U.mesh.geometry=P}});const u=Object.fromEntries(l.map(v=>[v,p5({width:a,height:a,transparent:s&&v=="diffuse"})])),f=Math.floor(Math.sqrt(e.length)+1),h=a/f,p=new Map(A.map((v,E)=>{const U=new $e(E%f,Math.floor(E/f)).multiplyScalar(1/f),P=new $e(U.x+1/f,U.y+1/f);return[v.mesh,{min:U,max:P}]})),d={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},g=[],m=[];A.forEach(v=>{const{min:E,max:U}=p.get(v.mesh);m.push(U),g.push(E)});const y=new $e(Math.max(...m.map(v=>v.x)),Math.max(...m.map(v=>v.y))),w=new $e(Math.min(...g.map(v=>v.x)),Math.min(...g.map(v=>v.y))),x=1/(y.x-w.x),_=1/(y.y-w.y),C=h*x,S=h*_,b=new Map(A.map(v=>{let{min:E,max:U}=p.get(v.mesh);return E.x=E.x*x,E.y=E.y*_,U.x=U.x*x,U.y=U.y*_,[v.mesh,{min:E,max:U}]}));let M=!1;A.forEach(v=>{const{material:E,mesh:U}=v,{min:P,max:L}=b.get(U);l.forEach(B=>{var le;const W=u[B];W.globalCompositeOperation="source-over";let ee,F=new Qe(1,1,1);switch(B){case"diffuse":ee=E.color||n,(le=E.uniforms)!=null&&le.litFactor?F=E.uniforms.litFactor.value:F=E.color;break;case"normal":ee=new Qe(8421631);break;case"orm":ee=new Qe(0,E.roughness,E.metalness);break;default:ee=new Qe(1,1,1);break}let X=vue(E,d[B].find(oe=>HC(E,oe)));M==!1&&B=="normal"&&X!=null&&(M=!0);const ue=gue(X,F,ee,a,a,B=="diffuse"&&s,B!="normal");createImageBitmap(ue).then(oe=>W.drawImage(oe,P.x*a,P.y*a,C,S))});const z=U.geometry.clone();U.geometry=z;const K=z.attributes.uv.clone();if(z.attributes.uv=K,K)for(let B=0;B{const E=new Qn(u[v].canvas);return E.flipY=!1,[v,E]}))),$=o?ui:ls;let H;const I=i?"transparent":"opaque";return r?(H=new kh({map:D.diffuse,transparent:i,side:$}),c==null&&(c=new hy),c.side=$,c.uniforms.map=D.diffuse,c.uniforms.shadeMultiplyTexture=D.diffuse,c.transparent=i,s&&!i&&(H.alphaTest=.5,c.alphaTest=.5),H.userData.vrmMaterial=c,H.userData.shadeTexture=D.uniformColor,H.name="mToon_"+I,H.map.name=H.name):(H=new kh({map:D.diffuse,roughnessMap:D.orm,metalnessMap:D.orm,normalMap:M?D.normal:null,transparent:i,side:$}),s&&!i&&(H.alphaTest=.5),H.name="standard_"+I,H.roughnessMap!=null&&(H.roughnessMap.name=H.name+"_orm"),H.normalMap!=null&&(H.normalMap.name=H.name+"_normal")),{bakeObjects:A,material:H}};function m5(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new XA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function g5(n,e){const t=new Map;new Z(-1,1,-1),new je,new Z;let r=0;n.forEach(l=>{if(l.skeleton){var A=m5(l);const c=A.bones;A.bones.forEach((u,f)=>{var h;if(c.indexOf(u)!==-1){const p=t.get(u.name);if(p==null){const d={index:r,boneInverses:A.boneInverses[f],bone:u.clone(!1),parentName:((h=u.parent)==null?void 0:h.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,d)}else u.userData.VRMcolliders!=null&&(p.bone.userData.VRMcolliders==null?p.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=p.bone.userData.VRMcollidersID&&(p.bone.userData.VRMcolliders=[...p.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var A;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const c=(A=t.get(l.parentName))==null?void 0:A.bone;c&&c.add(l.bone)}});const a=new XA(i,s);return a.bones.forEach(l=>{var c;const A=(c=l.userData)==null?void 0:c.vrm0RestPosition;A&&l.position.set(-A.x,A.y,-A.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function _ue(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(c=>c.name===o.name),A=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,A)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function bue(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function Ow(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function Cue(n,e){const{scale:t,isVrm0:r}=e,i=[],s=[];zh(n,"SkinnedMesh").forEach(A=>{const c=A.clone();i.push(c),Array.isArray(A.material)?s.push(...A.material):s.push(A.material)});const a=g5(i,t),l=new It;return l.name="AvatarRoot",i.forEach(A=>{var C;const c=new $t,u={};for(const S in A.geometry.attributes){const b=A.geometry.attributes[S];u[S]=b.clone()}if((C=A.userData)!=null&&C.isVRM0)for(let S=0;S[S,S.geometry.morphAttributes])),p=new Map([A].map(S=>[S,S.morphTargetDictionary||{}]));if(f.morphAttributes=y5({meshes:[A],sourceMorphAttributes:h,sourceMorphTargetDictionaries:p,destMorphTargetDictionary:f.morphTargetDictionary,scale:t},r),r)for(let S=0;Sh.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new Z(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],A=[],c=t.geometry.attributes.position.array,u=new Z,f=e.userData.isVRM0?-1:1;for(let h=0;h0){const{bakeObjects:D,material:$}=await yue({transparentColor:t,atlasSize:b.size,meshes:M,mtoon:b.isMtoon,transparentMaterial:b.transparentMaterial,transparentTexture:w,twoSidedMaterial:u}),H=D.map(L=>L.mesh),I=[];H.forEach(L=>{L.type=="Mesh"&&(L=Mue(_,L)),I.push(L);const z=L.geometry,K=z.index.array,O=v5(L.geometry.index.array),B=[];for(let F=0;F{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function Rue({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=kH(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function Fue({sourceMorphTargetDictionaries:n}){const e=new Set;Array.from(n.values()).forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map((i,s)=>{r[i]=s}),r}function y5({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i},s=!1){const o=new Set;Array.from(t.values()).forEach(u=>{Object.keys(u).forEach(f=>o.add(f))});const l=Array.from(o),A={};l.forEach(u=>{A[u]=[],Object.entries(r).forEach(([f,h])=>{A[u][h]=[],n.forEach(p=>{let d;const g=e.get(p);if(g.hasOwnProperty(f)&&p.geometry.morphAttributes[u]){const m=g[f];d=p.geometry.morphAttributes[u][m]}else{const m=p.geometry.attributes[u],y=new m.array.constructor(new Array(m.array.length).fill(0));d=new At(y,m.itemSize,m.normalized)}A[u][h].push(d)})})});const c={};return l.forEach(u=>{c[u]=[];for(let f=0;f{const i=r.geometry.index;for(var s=0;s{var l;if(r+=a.geometry.attributes.uv.count,(l=a.userData)!=null&&l.isVRM0)for(let A=0;A[a,a.geometry.attributes])),morphAttributes:new Map(n.map(a=>[a,a.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(a=>[a,a.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(a=>[a,a.morphTargetInfluences||[]]))},s={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};s.attributes=Rue({sourceAttributes:i.attributes});const o=Fue({sourceMorphTargetDictionaries:i.morphTargetDictionaries});return s.morphTargetDictionary=o,s.morphAttributes=y5({meshes:n,sourceMorphAttributes:i.morphAttributes,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o,scale:e},t),s.morphTargetInfluences=Iue({meshes:n,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o}),s.index=Uue({meshes:n}),s.animations={},{source:i,dest:s}}function ut(n){return n==null?[]:Array.isArray(n)?n:[n]}function Lue(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function Pue(n,e){const r=await new lu().load(e);r.encoding=pt,r.flipY=!1,n.traverse(i=>{if(i instanceof xn){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}uue(e)};function Due(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=ut(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((A=l.uniforms.alphaTest)==null?void 0:A.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function Oue(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ut(a.material).forEach(A=>{A.type=="ShaderMaterial"?A.transparent==!0?o.push(A):A.uniforms.alphaTest.value!=0?s.push(A):i.push(A):A.transparent==!0?r.push(A):A.alphaTest!=0?t.push(A):e.push(A)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function k3(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function Nue(n,e){if(n.data!=null)return n.data[e]}function kue(n){const e=Nue(n,"cullingMeshes");e&&(e.forEach(t=>{d5(t)}),n.data.cullingMeshes=null)}function vn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function Que(n){const e=n.scene;kue(n),e.traverse(t=>{t.material&&zC(t.material),t.geometry&&(d5(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),Bg.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&zC(i.material)})})});for(const t in n)n[t]=null}const zC=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{let e,t,r=0;return Array.isArray(n)?(e=n[0]||0,t=n[1]||0,r=n[2]||0):(typeof n=="string"||n instanceof String)&&n.split("-").forEach(s=>{switch(s=s.toLowerCase(),s){case"left":e=-1;break;case"right":e=1;break;case"bottom":case"down":t=-1;break;case"top":case"up":t=1;break;case"back":case"backward":r=-1;break;case"front":case"forward":r=1;break;default:console.warn("unkown cameraPosition name: "+s+" in: "+n+". Please use left, right, bottom, top, back or front");break}}),new Z(e,t,r)},w5=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},Hue=n=>{var t,r,i,s,o,a,l,A,c,u,f;const e=n.humanoid.humanBones;e.hips.node.parent.name="rootBone",e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:e.upperChest!=null&&(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((A=e.spine)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((c=e.neck)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let h in Km)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function x5({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),x5({candidates:n,predicate:e}))}function _5(n,e){return x5({candidates:[n],predicate:t=>t.name===e})}function b5({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),b5({candidates:n,predicate:e,results:t})}function zh(n,e){return b5({candidates:[n],predicate:t=>ut(e).includes(t.type)})}const zue={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function B5(n,e,t){var d;const r=Yc.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new rt,o=new rt,a=new rt,l=new Z,A=e.getObjectByName("mixamorigHips").position.y,c=(d=t.humanoid)==null?void 0:d.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,h=Math.abs(c-u)/A;return r.tracks.forEach(g=>{const m=g.clone(),y=m.name.split("."),w=y[0],_=zue[w],C=e.getObjectByName(w);if(_!=null){const S=y[1];if(C.getWorldQuaternion(s).invert(),C.parent.getWorldQuaternion(o),m instanceof ga){for(let b=0;b{m.values[$+b]=D})}i.push(new ga(`${_}.${S}`,m.times,m.values.map((b,M)=>{var D;return((D=t.meta)==null?void 0:D.metaVersion)==="0"&&M%2===0?-b:b})))}else if(m instanceof NA){const b=m.values.map((M,D)=>{var $;return((($=t.meta)==null?void 0:$.metaVersion)==="0"&&D%3!==1?-M:M)*h});i.push(new NA(`${_}.${S}`,m.times,b))}}}),new Yc("vrmAnimation",r.duration,i)}const Gue=new sre,Vue=new QH,aB=.2,jue=n=>Math.floor(Math.random()*n);class Q3{constructor(e,t,r,i,s,o,a){var l,A,c,u;this.mixer=new ine(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(A=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:A.neck,this.spineBone=(u=(c=r==null?void 0:r.humanoid)==null?void 0:c.humanBones)==null?void 0:u.spine,this.timeScale=1,i&&(this.setAnimations(i,null,null,a),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play())}setTimeScale(e){this.timeScale=e,this.actions.forEach(t=>{t.timeScale=e})}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t=null,r=null,i=!1){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const s=B5(e,t,this.vrm);s&&(e=[s],this.mixamoModel=t)}}else{const s=[];e.forEach(o=>{s.push(o.clone())}),e=s}if(r&&e[0].tracks.map((s,o)=>{(s.name==="neck.quaternion"||s.name==="spine.quaternion")&&e[0].tracks.splice(o,1)}),i){this.actions.forEach(s=>{s.weight=0,s.stop()}),this.actions=[],this.newAnimationWeight=1;for(let s=0;s{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}setTime(e){this.mixer.setTime(e)}getTime(){return this.mixer.time}dispose(){this.animationManager.disposeAnimation(this)}}class Wue{constructor(){this.animationPaths=[],this.defaultAnimations=[],this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.paused=!1,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,this.currentClip=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t,r=0,i=!0,s="",o=""){const a=s+(s!=""?"/":"")+ut(e)[0];o=o==""?ul(a):o,this.currentAnimationName=o;const A=await(i?Gue:Vue).loadAsync(a);A.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(A.animations);const c=Yc.findByName(A.animations,"mixamo.com");c!=null?(this.mixamoModel=A.clone(),this.mixamoAnimations=A.animations,this.currentClip=c):(this.mixamoModel=null,this.animations=A.animations,this.currentClip=A.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new Q3(this,A,null,A.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(A.animations,this.mixamoModel,this.mouseLookEnabled,t)}),this.setTime(r),t?this.pause():this.play()}getCurrentClip(){return this.currentClip}getCurrentClipDuration(){return this.currentClip?this.currentClip.duration:0}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=this.defaultAnimations,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t,r=!0){const i=ut(e);r?this.animationPaths=[...this.defaultAnimations,...i.map(s=>`${t}/${s}`)]:this.animationPaths=i.map(s=>t!=""?`${t}/${s}`:s)}storeDefaultAnimationPaths(e,t){const r=ut(e);this.defaultAnimations=r.map(i=>t!=""?`${t}/${i}`:i),this.animationPaths=this.defaultAnimations}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=jue(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-aB)},e*1e3)}pause(){this.paused=!0}play(){this.paused=!1}isPaused(){return this.paused}setTime(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTime(e)})}setFrame(e){this.setTime(e*30)}setSpeed(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTimeScale(e)})}update(e=!1){(this.mainControl&&!this.paused||e)&&(this.animationControls.forEach(t=>{t.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*aB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*aB):this.weightOut=0)}}const Kue={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + */class i5{}const Zb=new Z,Ac=new Z;class s5 extends i5{constructor(e){var t,r,i;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new Z(0,0,0),this.tail=(r=e==null?void 0:e.tail)!==null&&r!==void 0?r:new Z(0,0,0),this.radius=(i=e==null?void 0:e.radius)!==null&&i!==void 0?i:0}get type(){return"capsule"}calculateCollision(e,t,r,i){Zb.copy(this.offset).applyMatrix4(e),Ac.copy(this.tail).applyMatrix4(e),Ac.sub(Zb);const s=Ac.lengthSq();i.copy(t).sub(Zb);const o=Ac.dot(i);o<=0||(s<=o||Ac.multiplyScalar(o/s),i.sub(Ac));const a=r+this.radius,l=i.length()-a;return i.normalize(),l}}class o5 extends i5{constructor(e){var t,r;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new Z(0,0,0),this.radius=(r=e==null?void 0:e.radius)!==null&&r!==void 0?r:0}get type(){return"sphere"}calculateCollision(e,t,r,i){i.copy(this.offset).applyMatrix4(e),i.negate().add(t);const s=r+this.radius,o=i.length()-s;return i.normalize(),o}}const Po=new Z;class ece extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._currentTail=new Z,this._shape=e,this._attrPos=new At(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);const r=Po.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(r)>1e-10&&(this._currentTail.copy(r),e=!0),e&&this._buildPosition()}_buildPosition(){Po.copy(this._currentTail).sub(this._currentOffset);const e=Po.length()/this._currentRadius;for(let i=0;i<=16;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+i,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+i,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+i,e+Math.sin(s),0,Math.cos(s))}for(let i=0;i<32;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(s),Math.cos(s)),this._attrPos.setXYZ(100+i,e,Math.sin(s),Math.cos(s))}const t=Math.atan2(Po.y,Math.sqrt(Po.x*Po.x+Po.z*Po.z)),r=-Math.atan2(Po.z,Po.x);this.rotateZ(t),this.rotateY(r),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(68+e*2,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+t),this._attrIndex.setXY(200+e*2,100+e,100+t)}this._attrIndex.needsUpdate=!0}}class tce extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._shape=e,this._attrPos=new At(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.needsUpdate=!0}}const nce=new Z;class m3 extends Ur{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof o5)this._geometry=new tce(this.collider.shape);else if(this.collider.shape instanceof s5)this._geometry=new ece(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new Cl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new yg(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=nce.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class rce extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new Z,this._springBone=e,this._attrPos=new At(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const ice=new Z;class sce extends Ur{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new rce(this.springBone);const t=new Cl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new yg(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=ice.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class g3 extends It{constructor(e){super(),this.shape=e}}const oce=new je;function a5(n){return n.invert?n.invert():n.getInverse(oce.copy(n)),n}class ace{constructor(e){this._inverseCache=new je,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(r,i,s)=>(this._shouldUpdateInverse=!0,r[i]=s,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),a5(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const lce=new je,Oa=new Z,Zd=new Z,Ace=new Z,Wu=new Z,v3=new Z,Jd=new Z,y3=new rt,Ku=new je,cce=new je;class uce{constructor(e,t,r={},i=[]){var s,o,a,l,A,c;this._currentTail=new Z,this._prevTail=new Z,this._boneAxis=new Z,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new je,this._initialLocalRotation=new rt,this._initialLocalChildPosition=new Z,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(s=r.hitRadius)!==null&&s!==void 0?s:0,stiffness:(o=r.stiffness)!==null&&o!==void 0?o:1,gravityPower:(a=r.gravityPower)!==null&&a!==void 0?a:0,gravityDir:(A=(l=r.gravityDir)===null||l===void 0?void 0:l.clone())!==null&&A!==void 0?A:new Z(0,-1,0),dragForce:(c=r.dragForce)!==null&&c!==void 0?c:.4},this.colliderGroups=i}get center(){return this._center}set center(e){var t;!((t=this._center)===null||t===void 0)&&t.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new ace(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:lce}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const e=this._getMatrixWorldToCenter(Ku);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const e=this._getMatrixWorldToCenter(Ku);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength(),Wu.setFromMatrixPosition(this.bone.matrixWorld);let t=this._getMatrixWorldToCenter(Ku);v3.copy(Wu).applyMatrix4(t);const r=y3.setFromRotationMatrix(t),i=cce.copy(t).multiply(this._parentMatrixWorld),s=Zd.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(v3).normalize(),o=Ace.copy(this.settings.gravityDir).applyQuaternion(r).normalize(),a=this._getMatrixCenterToWorld(Ku);Jd.copy(this._currentTail).add(Oa.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Oa.copy(s).multiplyScalar(this.settings.stiffness*e)).add(Oa.copy(o).multiplyScalar(this.settings.gravityPower*e)).applyMatrix4(a),Jd.sub(Wu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Wu),this._collision(Jd),t=this._getMatrixWorldToCenter(Ku),this._prevTail.copy(this._currentTail),this._currentTail.copy(Oa.copy(Jd).applyMatrix4(t));const l=a5(Ku.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),A=y3.setFromUnitVectors(this._boneAxis,Oa.copy(Jd).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(A),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{const i=r.shape.calculateCollision(r.matrixWorld,e,this.settings.hitRadius,Oa);i<0&&(e.add(Oa.multiplyScalar(-i)),e.sub(Wu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Wu))})})}_calcWorldSpaceBoneLength(){Oa.setFromMatrixPosition(this.bone.matrixWorld),this.child?Zd.setFromMatrixPosition(this.child.matrixWorld):(Zd.copy(this._initialLocalChildPosition),Zd.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Oa.sub(Zd).length()}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}}function av(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 fce(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function l5(n,e){n.children.forEach(t=>{e(t)||l5(t,e)})}class w3{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(r=>{e.add(r)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{e.add(r)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e)}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e),this._objectSpringBonesMap.get(e.bone).delete(e)}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.setInitState())}reset(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.reset())}update(e){const t=new Set,r=new Set,i=new Set;for(const s of this._joints)this._processSpringBone(s,t,r,i,o=>o.update(e)),l5(s.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(e,t,r,i,s){if(r.has(e))return;if(t.has(e))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");t.add(e);const o=this._getDependencies(e);for(const a of o)fce(a,l=>{const A=this._objectSpringBonesMap.get(l);if(A)for(const c of A)this._processSpringBone(c,t,r,i,s);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),s(e),i.add(e.bone),r.add(e)}_getDependencies(e){const t=new Set,r=e.bone.parent;return r&&t.add(r),e.colliderGroups.forEach(i=>{i.colliders.forEach(s=>{t.add(s)})}),t}}const hce=new Set(["1.0","1.0-beta"]);class Tc{constructor(e,t){this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot}get name(){return Tc.EXTENSION_NAME}afterRoot(e){return av(this,void 0,void 0,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return av(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i,s,o;return av(this,void 0,void 0,function*(){const a=e.parser.json;if(!(((t=a.extensionsUsed)===null||t===void 0?void 0:t.indexOf(Tc.EXTENSION_NAME))!==-1))return null;const A=new w3,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)===null||r===void 0?void 0:r[Tc.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!hce.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Tc.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)===null||i===void 0?void 0:i.map((d,g)=>{var m,y,w,x,_;const C=c[d.node],S=d.shape;if(S.sphere)return this._importSphereCollider(C,{offset:new Z().fromArray((m=S.sphere.offset)!==null&&m!==void 0?m:[0,0,0]),radius:(y=S.sphere.radius)!==null&&y!==void 0?y:0});if(S.capsule)return this._importCapsuleCollider(C,{offset:new Z().fromArray((w=S.capsule.offset)!==null&&w!==void 0?w:[0,0,0]),radius:(x=S.capsule.radius)!==null&&x!==void 0?x:0,tail:new Z().fromArray((_=S.capsule.tail)!==null&&_!==void 0?_:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),p=(s=u.colliderGroups)===null||s===void 0?void 0:s.map((d,g)=>{var m;return{colliders:((m=d.colliders)!==null&&m!==void 0?m:[]).map(w=>{const x=h==null?void 0:h[w];if(x==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return x}),name:d.name}});return(o=u.springs)===null||o===void 0||o.forEach((d,g)=>{var m;const y=d.joints,w=(m=d.colliderGroups)===null||m===void 0?void 0:m.map(C=>{const S=p==null?void 0:p[C];if(S==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${C} but not found`);return S}),x=d.center!=null?c[d.center]:void 0;let _;y.forEach(C=>{if(_){const S=_.node,b=c[S],M=C.node,D=c[M],$={hitRadius:_.hitRadius,dragForce:_.dragForce,gravityPower:_.gravityPower,stiffness:_.stiffness,gravityDir:_.gravityDir!=null?new Z().fromArray(_.gravityDir):void 0},H=this._importJoint(b,D,$,w);x&&(H.center=x),A.addJoint(H)}_=C})}),A.setInitState(),A})}_v0Import(e){var t,r,i;return av(this,void 0,void 0,function*(){const s=e.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new w3,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)===null||i===void 0?void 0:i.map(h=>{var p;const d=u[h.node];return{colliders:((p=h.colliders)!==null&&p!==void 0?p:[]).map((m,y)=>{var w,x,_;const C=new Z(0,0,0);return m.offset&&C.set((w=m.offset.x)!==null&&w!==void 0?w:0,(x=m.offset.y)!==null&&x!==void 0?x:0,m.offset.z?-m.offset.z:0),this._importSphereCollider(d,{offset:C,radius:(_=m.radius)!==null&&_!==void 0?_:0})})}});return A==null||A.forEach((h,p)=>{const d=h.bones;d&&d.forEach(g=>{var m,y,w,x;const _=u[g],C=new Z;h.gravityDir?C.set((m=h.gravityDir.x)!==null&&m!==void 0?m:0,(y=h.gravityDir.y)!==null&&y!==void 0?y:0,(w=h.gravityDir.z)!==null&&w!==void 0?w:0):C.set(0,-1,0);const S=h.center!=null?u[h.center]:void 0,b={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:C},M=(x=h.colliderGroups)===null||x===void 0?void 0:x.map(D=>{const $=f==null?void 0:f[D];if($==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${D} but not found`);return $});_.traverse(D=>{var $;const H=($=D.children[0])!==null&&$!==void 0?$:null,I=this._importJoint(D,H,b,M);S&&(I.center=S),c.addJoint(I)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new uce(e,t,r,i);if(this.jointHelperRoot){const o=new sce(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const{offset:r,radius:i}=t,s=new o5({offset:r,radius:i}),o=new g3(s);if(e.add(o),this.colliderHelperRoot){const a=new m3(o);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(e,t){const{offset:r,radius:i,tail:s}=t,o=new s5({offset:r,radius:i,tail:s}),a=new g3(o);if(e.add(a),this.colliderHelperRoot){const l=new m3(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}}Tc.EXTENSION_NAME="VRMC_springBone";class dce{constructor(e,t){var r,i,s,o,a,l,A,c,u,f;this.parser=e;const h=t==null?void 0:t.helperRoot,p=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(r=t==null?void 0:t.expressionPlugin)!==null&&r!==void 0?r:new r_(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!==null&&i!==void 0?i:new Wle(e),this.humanoidPlugin=(s=t==null?void 0:t.humanoidPlugin)!==null&&s!==void 0?s:new eAe(e,{helperRoot:h,autoUpdateHumanBones:p}),this.lookAtPlugin=(o=t==null?void 0:t.lookAtPlugin)!==null&&o!==void 0?o:new dAe(e,{helperRoot:h}),this.metaPlugin=(a=t==null?void 0:t.metaPlugin)!==null&&a!==void 0?a:new gAe(e),this.mtoonMaterialPlugin=(l=t==null?void 0:t.mtoonMaterialPlugin)!==null&&l!==void 0?l:new fh(e),this.materialsHDREmissiveMultiplierPlugin=(A=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!==null&&A!==void 0?A:new $m(e),this.materialsV0CompatPlugin=(c=t==null?void 0:t.materialsV0CompatPlugin)!==null&&c!==void 0?c:new UAe(e),this.springBonePlugin=(u=t==null?void 0:t.springBonePlugin)!==null&&u!==void 0?u:new Tc(e,{colliderHelperRoot:h,jointHelperRoot:h}),this.nodeConstraintPlugin=(f=t==null?void 0:t.nodeConstraintPlugin)!==null&&f!==void 0?f:new Mc(e,{helperRoot:h})}get name(){return"VRMLoaderPlugin"}beforeRoot(){return ov(this,void 0,void 0,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return ov(this,void 0,void 0,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return t??null}extendMaterialParams(e,t){return ov(this,void 0,void 0,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return ov(this,void 0,void 0,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){const i=new yAe({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=i}})}}function x3(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function pce(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>x3(i)):r&&x3(r))}function mce(n){n.traverse(pce)}function gce(n){const e=new Map;n.traverse(t=>{if(t.type!=="SkinnedMesh")return;const r=t,s=r.geometry.getAttribute("skinIndex");let o=e.get(s);if(!o){const a=[],l=[],A={},c=s.array;for(let u=0;u{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,A=l.index;if(A==null)return;const c=e.get(l);if(c!=null){a.geometry=c;return}const u=new $t;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(d=>{u.addGroup(d.start,d.count,d.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)===null||r===void 0?void 0:r.clone())!==null&&i!==void 0?i:null,u.boundingSphere=(o=(s=l.boundingSphere)===null||s===void 0?void 0:s.clone())!==null&&o!==void 0?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const d=A.array,g=new d.constructor(d.length);let m=0;for(let y=0;y{const g=l.attributes[d];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const m=g.array,{itemSize:y,normalized:w}=g,x=new m.constructor(h.length*y);h.forEach((_,C)=>{for(let S=0;S{u.morphAttributes[d]=[];const g=l.morphAttributes[d];for(let m=0;m{for(let M=0;MS===0),u.morphAttributes[d][m]=new At(C,x,_)}}),p&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function yce(n){var e;((e=n.meta)===null||e===void 0?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}class Bg{constructor(){}}Bg.deepDispose=mce;Bg.removeUnnecessaryJoints=gce;Bg.removeUnnecessaryVertices=vce;Bg.rotateVRM0=yce;var Jn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Jn||(Jn={}));const Lw="blend_",_3="vrmColliderSphere";class wce{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},A={},c={},u=e.lookAt,f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=a.filter((re,pe,_e)=>_e.findIndex(Re=>Re.name===re.name.replace(" (Outline)",""))===pe).map(re=>re),p=h.map(re=>re.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(re=>re.map).map(re=>{if(!re.map)throw new Error(re.name+" map is null");return{name:re.name,imageBitmap:re.map.image}}),m=h.filter(re=>re.userData.shadeTexture).map(re=>{if(!re.userData.shadeTexture)throw new Error(re.userData.shadeTexture+" map is null");return{name:re.name+"_shade",imageBitmap:re.userData.shadeTexture.image}}),y=g.concat(m),w=Ece(y,d),x=Cce(w),_=Sce(w),C=Bce(h,y),S=t.children.filter(re=>re.children.length>0&&re.children[0].type===ai.Bone)[0],b=A5(S).filter(re=>re.name!==_3),M=b.map(re=>re.name),D=b.map(re=>({children:re.children.filter(pe=>pe.name!==_3).map(pe=>M.indexOf(pe.name)),name:re.name,rotation:[re.quaternion.x,re.quaternion.y,re.quaternion.z,re.quaternion.w],scale:[re.scale.x,re.scale.y,re.scale.z],translation:[re.position.x,re.position.y,re.position.z]})),$=[],H=t.children.filter(re=>re.type===ai.Group||re.type===ai.SkinnedMesh),I=[];H.forEach(re=>{const pe=re.type===ai.Group?re.children[0]:re,_e=pe.geometry.attributes;I.push(new Na(_e.position,Jn.FLOAT,Wt.POSITION,ho.VEC3,pe.name,void 0)),I.push(new Na(_e.normal,Jn.FLOAT,Wt.NORMAL,ho.VEC3,pe.name,void 0)),I.push(new Na(_e.uv,Jn.FLOAT,Wt.UV,ho.VEC2,pe.name,void 0)),I.push(new Na(_e.skinWeight,Jn.FLOAT,Wt.SKIN_WEIGHT,ho.VEC4,pe.name,void 0)),I.push(new Na(_e.skinIndex,Jn.UNSIGNED_SHORT,Wt.SKIN_INDEX,ho.VEC4,pe.name,void 0)),(re.type===ai.Group?re.children.map(Q=>Q):[re]).forEach(Q=>{if(!Q.geometry.index)throw new Error(Q.name+" geometry.index is null");I.push(new Na(Q.geometry.index,Jn.UNSIGNED_INT,Wt.INDEX,ho.SCALAR,pe.name,Q.name))}),pe.morphTargetDictionary||(pe.morphTargetDictionary={},pe.morphTargetInfluences=[],pe.geometry.morphAttributes={},pe.updateMorphTargets()),pe.geometry.userData.targetNames=[];for(const Q in e.expressionManager.expressionMap){const de=e.expressionManager.expressionMap[Q],Ae=de._binds.map(J=>({node:b.length,index:J.index,weight:J.weight}));let q=!1;for(const J in oi)if(Q.toLowerCase()===oi[J].toLowerCase()){l[oi[J]]={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth},q=!0;break}!q&&Q.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth},q=!0),q===!1&&(A[Q]={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth})}for(const Q in pe.morphTargetDictionary){pe.geometry.userData.targetNames.push(Q);const de=pe.morphTargetDictionary[Q],Ae=pe.geometry.morphAttributes;I.push(new Na(Ae.position[de],Jn.FLOAT,Wt.BLEND_POSITION,ho.VEC3,pe.name,Lw+Q)),I.push(new Na(Ae.normal[de],Jn.FLOAT,Wt.BLEND_NORMAL,ho.VEC3,pe.name,Lw+Q))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),H.forEach(re=>{const pe=re.type===ai.Group?re.children[0]:re,_e=new Float32Array(pe.skeleton.boneInverses.map(Re=>Re.elements).flat());I.push(new Na(new At(_e,16),Jn.FLOAT,Wt.BIND_MATRIX,ho.MAT4,pe.name,pe.name))}),$.push(...I.map(re=>({bufferView:-1,byteOffset:0,componentType:re.valueType,count:re.attribute.count,max:re.max,min:re.min,normalized:!1,type:re.accessorsType})));const v=_ce(H,I,p);H.forEach((re,pe)=>{D.push({mesh:pe,name:re.name,rotation:[re.quaternion.x,re.quaternion.y,re.quaternion.z,re.quaternion.w],scale:[re.scale.x,re.scale.y,re.scale.z],skin:pe,translation:[re.position.x,re.position.y,re.position.z]})});const E=bce(H,I,M),U={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},P={humanBones:{}};for(const re in s.humanBones)P.humanBones[re]={node:M.indexOf(s.humanBones[re].node.name)};const L=o,z=[];z.push(...y.map(re=>({buffer:b3(re.imageBitmap),type:Wt.IMAGE}))),z.push(...I.map(re=>({buffer:re.buffer,type:re.type}))),d&&z.push({buffer:b3(d.imageBitmap),type:Wt.IMAGE});let K=0,O=0,B=0;const W=z.map((re,pe)=>{const _e={buffer:0,byteLength:re.buffer.byteLength,byteOffset:K,target:re.type===Wt.IMAGE||re.type===Wt.BIND_MATRIX?void 0:re.type===Wt.INDEX?Jn.ELEMENT_ARRAY_BUFFER:Jn.ARRAY_BUFFER};return K+=re.buffer.byteLength,re.type===Wt.IMAGE?w[O++].bufferView=pe:$[B++].bufferView=pe,_e}),ee=Mce(t,D),F={accessors:$,asset:f,buffers:[{byteLength:K}],bufferViews:W,extensions:{VRMC_vrm:{expressions:c,humanoid:P,lookAt:U,meta:L,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:C,meshes:v,nodes:D,samplers:x,avatar:0,scenes:ee,skins:E,textures:_},X=new B3(DC(JSON.stringify(F,void 0,2)),"JSON"),ue=new B3(Fp(z.map(re=>re.buffer)),"BIN\0"),le=Fp([X.buffer,ue.buffer]),oe=Fp([DC("glTF"),PC(2,4),PC(le.byteLength+12,4)]);i(Fp([oe,le]))}}function A5(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>A5(e)).flat())}function b3(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Jn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Jn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let B3=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Fp([PC(r.byteLength,4),DC(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===Wt.POSITION||r===Wt.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var jf;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(jf||(jf={}));var ho;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(ho||(ho={}));var Wt;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(Wt||(Wt={}));var ai;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(ai||(ai={}));const _ce=(n,e,t)=>n.map(r=>{const i=r.type===ai.Group?r.children[0]:r,s=r.type===ai.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Wt.SKIN_INDEX),NORMAL:a.indexOf(Wt.NORMAL),POSITION:a.indexOf(Wt.POSITION),TEXCOORD_0:a.indexOf(Wt.UV),WEIGHTS_0:a.indexOf(Wt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Wt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>({NORMAL:e.map(c=>c.type===Wt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(Lw+A),POSITION:e.map(c=>c.type===Wt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(Lw+A)})):void 0}})}}),bce=(n,e,t)=>n.map(r=>{const i=r.type===ai.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Wt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Bce=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(c=>c.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const A=t;r=A.color?[A.color.r,A.color.g,A.color.b,1]:void 0}let s=-1;t.map?s=e.map(A=>A.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(A=>A.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case jf.MeshStandardMaterial:return t.metalness;case jf.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case jf.MeshStandardMaterial:return t.roughness;case jf.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),Ece=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Cce=n=>n.map(()=>({magFilter:Jn.LINEAR,minFilter:Jn.LINEAR,wrapS:Jn.REPEAT,wrapT:Jn.REPEAT})),Sce=n=>n.map((e,t)=>({sampler:0,source:t})),Mce=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===ai.Object3D||r.type===ai.SkinnedMesh||r.type===ai.Group||r.type===ai.Bone).map(r=>t.indexOf(r.name))}]},c5=0,Tce=1,u5=2,E3=2,Jb=1.25,C3=1,dy=6*4+4+4,OC=65535,Ice=Math.pow(2,-24);class lv{constructor(){}}function Jo(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function S3(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function M3(n,e){e.set(n)}function T3(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function Av(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function qd(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}function Rce(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let i;t>65535?i=new Uint32Array(new r(4*t)):i=new Uint16Array(new r(2*t)),n.setIndex(new At(i,1));for(let s=0;si-s);for(let i=0;il&&(l=S),m&&xp&&(p=x);const b=n[y+2],M=n[y+3],D=b-M,$=b+M;DA&&(A=$),m&&bd&&(d=b);const H=n[y+4],I=n[y+5],v=H-I,E=H+I;vc&&(c=E),m&&Hg&&(g=H)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=A,r[5]=c,m&&(i[0]=u,i[1]=f,i[2]=h,i[3]=p,i[4]=d,i[5]=g)}function Uce(n,e,t,r){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,A=-1/0;for(let c=e*6,u=(e+t)*6;ca&&(a=f);const h=n[c+2];hl&&(l=h);const p=n[c+4];pA&&(A=p)}r[0]=i,r[1]=s,r[2]=o,r[3]=a,r[4]=l,r[5]=A}function Lce(n,e,t,r,i){let s=t,o=t+r-1;const a=i.pos,l=i.axis*2;for(;;){for(;s<=o&&e[s*6+l]=a;)o--;if(sn.candidate-e.candidate,zl=new Array(Ga).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),cv=new Float32Array(6);function Dce(n,e,t,r,i,s){let o=-1,a=0;if(s===c5)o=S3(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Tce)o=S3(n),o!==-1&&(a=Oce(t,r,i,o));else if(s===u5){const l=qd(n);let A=Jb*i;const c=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const h=e[f],g=(e[f+3]-h)/Ga;if(i=S.candidate?Av(x,t,S.rightCacheBounds):(Av(x,t,S.leftCacheBounds),S.count++)}}for(let x=0;x=Ga&&(C=Ga-1);const S=zl[C];S.count++,Av(w,t,S.bounds)}const m=zl[Ga-1];M3(m.bounds,m.rightCacheBounds);for(let w=Ga-2;w>=0;w--){const x=zl[w],_=zl[w+1];T3(x.bounds,_.rightCacheBounds,x.rightCacheBounds)}let y=0;for(let w=0;wC&&(C=w),x>C&&(C=x);const S=(C-_)/2,b=m*2;s[h+b+0]=_+S,s[h+b+1]=S+(Math.abs(_)+S)*Ice,_e[m+3]&&(e[m+3]=C)}}return s}function kce(n,e){function t(m){f&&f(m/h)}function r(m,y,w,x=null,_=0){if(!p&&_>=l&&(p=!0,A&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(n))),w<=c||_>=l)return t(y+w),m.offset=y,m.count=w,m;const C=Dce(m.boundingData,x,o,y,w,u);if(C.axis===-1)return t(y+w),m.offset=y,m.count=w,m;const S=Lce(a,o,y,w,C);if(S===y||S===y+w)t(y+w),m.offset=y,m.count=w;else{m.splitAxis=C.axis;const b=new lv,M=y,D=S-y;m.left=b,b.boundingData=new Float32Array(6),qb(o,M,D,b.boundingData,s),r(b,M,D,s,_+1);const $=new lv,H=S,I=w-D;m.right=$,$.boundingData=new Float32Array(6),qb(o,H,I,$.boundingData,s),r($,H,I,s,_+1)}return m}Rce(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=Nce(n,i),a=n.index.array,l=e.maxDepth,A=e.verbose,c=e.maxLeafTris,u=e.strategy,f=e.onProgress,h=n.index.count/3;let p=!1;const d=[],g=Fce(n);if(g.length===1){const m=g[0],y=new lv;y.boundingData=i,Uce(o,m.offset,m.count,s),r(y,m.offset,m.count,s),d.push(y)}else for(let m of g){const y=new lv;y.boundingData=new Float32Array(6),qb(o,m.offset,m.count,y.boundingData,s),r(y,m.offset,m.count,s),d.push(y)}return d}function Qce(n,e){const t=kce(n,e);let r,i,s;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[f+6]=w/4,w=A(w,m),i[f+7]=y,w}}}class xl{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}xl.prototype.setFromBox=function(){const n=new Z;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let A=0;A<=1;A++)for(let c=0;c<=1;c++){n.x=i.x*l+s.x*(1-l),n.y=i.y*A+s.y*(1-A),n.z=i.z*c+s.z*(1-c);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Hce=function(){const n=new Z,e=new Z,t=new Z;return function(i,s,o){const a=i.start,l=n,A=s.start,c=e;t.subVectors(a,A),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(c),f=c.dot(l),h=c.dot(c),p=t.dot(l),g=l.dot(l)*h-f*f;let m,y;g!==0?m=(u*f-p*h)/g:m=0,y=(u+m*f)/h,o.x=m,o.y=y}}(),vT=function(){const n=new $e,e=new Z,t=new Z;return function(i,s,o,a){Hce(i,s,n);let l=n.x,A=n.y;if(l>=0&&l<=1&&A>=0&&A<=1){i.at(l,o),s.at(A,a);return}else if(l>=0&&l<=1){A<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(A>=0&&A<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let c;l<0?c=i.start:c=i.end;let u;A<0?u=s.start:u=s.end;const f=e,h=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(c,!0,t),f.distanceToSquared(u)<=h.distanceToSquared(c)){o.copy(f),a.copy(u);return}else{o.copy(c),a.copy(h);return}}}}(),zce=function(){const n=new Z,e=new Z,t=new Ja,r=new cl;return function(s,o){const{radius:a,center:l}=s,{a:A,b:c,c:u}=o;if(r.start=A,r.end=c,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const d=o.getPlane(t);if(Math.abs(d.distanceToPoint(l))<=a){const m=d.projectPoint(l,e);if(o.containsPoint(m))return!0}return!1}}(),Gce=1e-15;function $u(n){return Math.abs(n)new Z),this.satBounds=new Array(4).fill().map(()=>new xl),this.points=[this.a,this.b,this.c],this.sphere=new su,this.plane=new Ja,this.needsUpdate=!0}intersectsSphere(e){return zce(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const A=s[1],c=o[1];A.subVectors(e,t),c.setFromPoints(A,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const h=s[3],p=o[3];h.subVectors(r,e),p.setFromPoints(h,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}_l.prototype.closestPointToSegment=function(){const n=new Z,e=new Z,t=new cl;return function(i,s=null,o=null){const{start:a,end:l}=i,A=this.points;let c,u=1/0;for(let f=0;f<3;f++){const h=(f+1)%3;t.start.copy(A[f]),t.end.copy(A[h]),vT(t,i,n,e),c=n.distanceToSquared(e),c1-1e-10){const y=this.satBounds,w=this.satAxes;t[0]=h.a,t[1]=h.b,t[2]=h.c;for(let C=0;C<4;C++){const S=y[C],b=w[C];if(r.setFromPoints(b,t),S.isSeparated(r))return!1}const x=h.satBounds,_=h.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let C=0;C<4;C++){const S=x[C],b=_[C];if(r.setFromPoints(b,e),S.isSeparated(r))return!1}for(let C=0;C<4;C++){const S=w[C];for(let b=0;b<4;b++){const M=_[b];if(s.crossVectors(S,M),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(d||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const y=this.points;let w=!1,x=0;for(let v=0;v<3;v++){const E=y[v],U=y[(v+1)%3];A.start.copy(E),A.end.copy(U),A.delta(o);const P=w?c.start:c.end,L=$u(m.distanceToPoint(E));if($u(m.normal.dot(o))&&L){c.copy(A),x=2;break}if((m.intersectLine(A,P)||L)&&!$u(P.distanceTo(U))){if(x++,w)break;w=!0}}if(x===1&&h.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(x!==2)return!1;const _=h.points;let C=!1,S=0;for(let v=0;v<3;v++){const E=_[v],U=_[(v+1)%3];A.start.copy(E),A.end.copy(U),A.delta(a);const P=C?u.start:u.end,L=$u(g.distanceToPoint(E));if($u(g.normal.dot(a))&&L){u.copy(A),S=2;break}if((g.intersectLine(A,P)||L)&&!$u(P.distanceTo(U))){if(S++,C)break;C=!0}}if(S===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(S!==2)return!1;if(c.delta(o),u.delta(a),o.dot(a)<0){let v=u.start;u.start=u.end,u.end=v}const b=c.start.dot(o),M=c.end.dot(o),D=u.start.dot(o),$=u.end.dot(o),H=M0?p.start.copy(c.start):p.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(o)<0?p.end.copy(c.end):p.end.copy(u.end)),!0)}}}();_l.prototype.distanceToPoint=function(){const n=new Z;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();_l.prototype.distanceToTriangle=function(){const n=new Z,e=new Z,t=["a","b","c"],r=new cl,i=new cl;return function(o,a=null,l=null){const A=a||l?r:null;if(this.intersectsTriangle(o,A))return(a||l)&&(a&&A.getCenter(a),l&&A.getCenter(l)),0;let c=1/0;for(let u=0;u<3;u++){let f;const h=t[u],p=o[h];this.closestPointToPoint(p,n),f=p.distanceToSquared(n),fnew Z),this.satAxes=new Array(3).fill().map(()=>new Z),this.satBounds=new Array(3).fill().map(()=>new xl),this.alignedSatBounds=new Array(3).fill().map(()=>new xl),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}va.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let A=0;A<=1;A++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){const f=1*A|2*c|4*u,h=i[f];h.x=A?r.x:t.x,h.y=c?r.y:t.y,h.z=u?r.z:t.z,h.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let A=0;A<3;A++){const c=o[A],u=s[A],f=1<new cl),t=new Array(12).fill().map(()=>new cl),r=new Z,i=new Z;return function(o,a=0,l=null,A=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||A)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),A&&A.copy(i)),0;const c=a*a,u=o.min,f=o.max,h=this.points;let p=1/0;for(let g=0;g<8;g++){const m=h[g];i.copy(m).clamp(u,f);const y=m.distanceToSquared(i);if(yt.far)?null:n}function Ko(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,A=e+2;t&&(a=t.getX(e),l=t.getX(e+1),A=t.getX(e+2)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(A),o.y=r.getY(A),o.z=r.getZ(A)}function P3(n,e,t,r,i,s,o){const a=t.index,l=t.attributes.position;for(let A=n,c=e+n;A=0;let h,p;f?(h=Xm(n),p=Zm(n,a)):(h=Zm(n,a),p=Xm(n));const g=Dw(h,s,r,Pw)?kC(h,e,t,r):null;if(g){const w=g.point[c];if(f?w<=s[p+A]:w>=s[p+A+3])return g}const y=Dw(p,s,r,Pw)?kC(p,e,t,r):null;return g&&y?g.distance<=y.distance?g:y:g||y||null}}const Xce=function(){let n,e;const t=[],r=new h5(()=>new ps);return function(...o){n=r.getPrimitive(),e=r.getPrimitive(),t.push(n,e);const a=i(...o);r.releasePrimitive(n),r.releasePrimitive(e),t.pop(),t.pop();const l=t.length;return l>0&&(e=t[l-1],n=t[l-2]),a};function i(s,o,a,l,A=null,c=0,u=0){function f(w){let x=w*2,_=MA,C=TA;for(;!nA(x,_);)w=Xm(w),x=w*2;return hh(w,C)}function h(w){let x=w*2,_=MA,C=TA;for(;!nA(x,_);)w=Zm(w,C),x=w*2;return hh(w,C)+Ym(x,_)}let p=s*2,d=sd,g=MA,m=TA;if(nA(p,g)){const w=hh(s,m),x=Ym(p,g);return Jo(s,d,n),l(w,x,!1,u,c+s,n)}else{const w=Xm(s),x=Zm(s,m);let _=w,C=x,S,b,M,D;if(A&&(M=n,D=e,Jo(_,d,M),Jo(C,d,D),S=A(M),b=A(D),bi.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(A),b.b.applyMatrix4(A),b.c.applyMatrix4(A),b.needsUpdate=!0;for(let M=_*3,D=(C+_)*3;Mnew _l);class om{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),om.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};const r=e.geometry,i=e._roots,s=r.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:s.array.slice()}:o={roots:i,index:s.array},o}static deserialize(e,t,r={}){if(typeof r=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),om.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});r={setIndex:!0,...r};const{index:i,roots:s}=e,o=new om(t,{...r,[eB]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new At(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:c5,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[eB]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[eB]||(this._roots=Qce(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new ps))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=this.geometry,r=t.index.array,i=t.attributes.position;let s,o,a,l,A=0;const c=this._roots;for(let f=0,h=c.length;fC&&(C=H),IS&&(S=I),v<_&&(_=v),v>b&&(b=v)}return l[f+0]!==w||l[f+1]!==x||l[f+2]!==_||l[f+3]!==C||l[f+4]!==S||l[f+5]!==b?(l[f+0]=w,l[f+1]=x,l[f+2]=_,l[f+3]=C,l[f+4]=S,l[f+5]=b,!0):!1}else{const m=f+8,y=o[f+6],w=m+h,x=y+h;let _=p,C=!1,S=!1;e?_||(C=e.has(w),S=e.has(x),_=!C&&!S):(C=!0,S=!0);const b=_||C,M=_||S;let D=!1;b&&(D=u(m,h,_));let $=!1;M&&($=u(y,h,_));const H=D||$;if(H)for(let I=0;I<3;I++){const v=m+I,E=y+I,U=l[v],P=l[v+3],L=l[E],z=l[E+3];l[f+I]=Uz?P:z}return H}}}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const A=a*2,c=s[A+15]===OC;if(c){const u=i[a+6],f=s[A+14];e(l,c,new Float32Array(r,a*4,6),u,f)}else{const u=a+dy/4,f=i[a+6],h=i[a+7];e(l,c,new Float32Array(r,a*4,6),h)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=ls){const r=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,A=o?t.side:t;for(let c=0,u=r.length;c{const m=p*3;return f(h,m,m+1,m+2,d,g)}}e={boundsTraverseOrder:r,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const s=Do.getPrimitive();let{boundsTraverseOrder:o,intersectsBounds:a,intersectsRange:l,intersectsTriangle:A}=e;if(l&&A){const f=l;l=(h,p,d,g,m)=>f(h,p,d,g,m)?!0:P3(h,p,i,A,d,g,s)}else l||(A?l=(f,h,p,d)=>P3(f,h,i,A,p,d,s):l=(f,h,p)=>p);let c=!1,u=0;for(const f of this._roots){if(Up(f),c=Xce(0,i,a,l,o,u),dv(),c)break;u+=f.byteLength}return Do.releasePrimitive(s),c}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:s}=r;const o=this.geometry.index,a=this.geometry.attributes.position,l=e.geometry.index,A=e.geometry.attributes.position;Yu.copy(t).invert();const c=Do.getPrimitive(),u=Do.getPrimitive();if(s){let h=function(p,d,g,m,y,w,x,_){for(let C=g,S=g+m;CnB.intersectsBox(h),intersectsRange:(h,p,d,g,m,y)=>(tB.copy(y),tB.applyMatrix4(Yu),e.shapecast({intersectsBounds:w=>tB.intersectsBox(w),intersectsRange:(w,x,_,C,S)=>i(h,p,w,x,g,m,C,S)}))});return Do.releasePrimitive(c),Do.releasePrimitive(u),f}intersectsBox(e,t){return cc.set(e.min,e.max,t),cc.needsUpdate=!0,this.shapecast({intersectsBounds:r=>cc.intersectsBox(r),intersectsTriangle:r=>cc.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){e.boundingBox||e.computeBoundingBox(),cc.set(e.boundingBox.min,e.boundingBox.max,t),cc.needsUpdate=!0;const a=this.geometry,l=a.attributes.position,A=a.index,c=e.attributes.position,u=e.index,f=Do.getPrimitive(),h=Do.getPrimitive();let p=pv,d=Jce,g=null,m=null;i&&(g=qce,m=eue);let y=1/0,w=null,x=null;return Yu.copy(t).invert(),ep.matrix.copy(Yu),this.shapecast({boundsTraverseOrder:_=>cc.distanceToBox(_),intersectsBounds:(_,C,S)=>S{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:S=>ep.distanceToBox(S),intersectsBounds:(S,b,M)=>M{for(let M=S*3,D=(S+b)*3;M(tp.copy(e).clamp(c.min,c.max),tp.distanceToSquared(e)),intersectsBounds:(c,u,f)=>f{c.closestPointToPoint(e,tp);const f=e.distanceToSquared(tp);return f{Jo(0,new Float32Array(r),D3),e.union(D3)}),e}}const rB=new mg,O3=new je,tue=xn.prototype.raycast;function nue(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;O3.copy(this.matrixWorld).invert(),rB.copy(n.ray).applyMatrix4(O3);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=L3(t.raycastFirst(rB,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(rB,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new Xi,i=new Z,s=new Z,o=new Z,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&my(n.userData.cancelMesh))},d5=n=>{var e,t;n.userData.cullingClone&&(my(n.userData.cullingClone),n.userData.cullingClone=null,my(n.userData.cullingCloneP),n.userData.cullingCloneP=null,my(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},uue=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Lp=n[0].parent,Lp.lines!=null&&(Lp.lines.forEach(i=>{i.visible=!1}),Lp.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=cue(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=aue,a.userData.cancelMesh=o,a.material=lue,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},fue=n=>{let e=sue,t=oue;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},hue=(n,e,t,r,i,s,o=!1)=>{const a=[],l=fue(s);let A=l[0],c=l[1];mv.far=A+c;for(let f=0;f=0;y--)A-m[y].distance>=m[y].object.userData.maxCullDistance&&m.splice(y,1);if(m.length===0){for(let y=0;y<3;y++)a.push(n[h+y]);break}else{const y=m.map(w=>w.object);for(let w=0;ww).length===0){for(let w=0;w<3;w++)a.push(n[h+w]);break}if(d===0)p=m.map(w=>w.object);else if(p=m.map(w=>{if(p.indexOf(w.object)!==-1)return w.object}),p=p.filter(w=>w),d===2&&p.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[h+w]);o&&due(iB,np.clone().multiplyScalar(-1),mv.far,16711680,Lp)}}}const u=new Uint32Array(a);return new At(u,1,!1)};function due(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new Z;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new $t().setFromPoints(o),l=[];l.push(new Qe(0)),l.push(new Qe(16777215));let A=new Cl({color:r});var c=new td(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}let sB,ka,gv,vv,yv,zi,Xu;function pue(){zi!=null&&zi.clear(!0,!0)}function mue(n,e,t){const r=e*t,i=new Uint8Array(4*r),s=Math.floor(n.r*255),o=Math.floor(n.g*255),a=Math.floor(n.b*255);for(let A=0;Atypeof window>"u"?await wue({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await xue({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o}),wue=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(S=>{const b=S.material;let M=a.find(D=>D.material===b);if(!M)a.push({material:b,mesh:S});else{const{dest:D}=yT({meshes:[M.mesh,S]});M.mesh.geometry=D}});const l=Object.fromEntries(o.map(S=>[S,p5({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((S,b)=>{const M=new $e(b%A,Math.floor(b/A)).multiplyScalar(1/A),D=new $e(M.x+1/A,M.y+1/A);return[S.mesh,{min:M,max:D}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},h=[],p=[];a.forEach(S=>{const{min:b,max:M}=u.get(S.mesh);p.push(M),h.push(b)});const d=new $e(Math.max(...p.map(S=>S.x)),Math.max(...p.map(S=>S.y))),g=new $e(Math.min(...h.map(S=>S.x)),Math.min(...h.map(S=>S.y))),m=1/(d.x-g.x),y=1/(d.y-g.y),w=c*m,x=c*y,_=new Map(a.map(S=>{let{min:b,max:M}=u.get(S.mesh);return b.x=b.x*m,b.y=b.y*y,M.x=M.x*m,M.y=M.y*y,[S.mesh,{min:b,max:M}]}));a.forEach(S=>{const{material:b,mesh:M}=S,{min:D,max:$}=_.get(M);o.forEach(E=>{const U=l[E];U.globalCompositeOperation="source-over";let P=HC(b,f[E].find(L=>HC(b,L)));if(P!==""&&P!==void 0)try{const L=new Uint8ClampedArray(P.data),z=new ImageData(L,w,x),K=document.createElement("canvas");K.width=w,K.height=x;const O=K.getContext("2d");O.putImageData(z,0,0),O.save(),U.drawImage(K,D.x*s,D.y*s,w,x)}catch(L){console.error("error",L)}else U.fillStyle=E==="diffuse"?`#${b.color.clone().getHexString()}`:E==="normal"?"#8080ff":E==="orm"?`#${new Qe(b.aoMapIntensity,b.roughness,b.metalness).getHexString()}`:"#7F7F7F",U.fillRect(D.x*s,D.y*s,w,x)});const H=M.geometry,I=H.attributes.uv;if(I)for(let E=0;E{const b=new Qn(l[S].canvas);return b.flipY=!1,[S,b]})));return{bakeObjects:a,textures:C,uvs:_}},xue=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o})=>{pue();const a=t,l=r?["diffuse"]:["diffuse","orm","normal"],A=[];let c=null;e.forEach(v=>{v=v.clone();const E=v.material.length==null?v.material:v.material[0];r&&c==null&&E.type=="ShaderMaterial"&&(c=E.clone());let U=A.find(P=>{P.material});if(!U)A.push({material:E,mesh:v});else{const{dest:P}=yT({meshes:[U.mesh,v]});U.mesh.geometry=P}});const u=Object.fromEntries(l.map(v=>[v,p5({width:a,height:a,transparent:s&&v=="diffuse"})])),f=Math.floor(Math.sqrt(e.length)+1),h=a/f,p=new Map(A.map((v,E)=>{const U=new $e(E%f,Math.floor(E/f)).multiplyScalar(1/f),P=new $e(U.x+1/f,U.y+1/f);return[v.mesh,{min:U,max:P}]})),d={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},g=[],m=[];A.forEach(v=>{const{min:E,max:U}=p.get(v.mesh);m.push(U),g.push(E)});const y=new $e(Math.max(...m.map(v=>v.x)),Math.max(...m.map(v=>v.y))),w=new $e(Math.min(...g.map(v=>v.x)),Math.min(...g.map(v=>v.y))),x=1/(y.x-w.x),_=1/(y.y-w.y),C=h*x,S=h*_,b=new Map(A.map(v=>{let{min:E,max:U}=p.get(v.mesh);return E.x=E.x*x,E.y=E.y*_,U.x=U.x*x,U.y=U.y*_,[v.mesh,{min:E,max:U}]}));let M=!1;A.forEach(v=>{const{material:E,mesh:U}=v,{min:P,max:L}=b.get(U);l.forEach(B=>{var le;const W=u[B];W.globalCompositeOperation="source-over";let ee,F=new Qe(1,1,1);switch(B){case"diffuse":ee=E.color||n,(le=E.uniforms)!=null&&le.litFactor?F=E.uniforms.litFactor.value:F=E.color;break;case"normal":ee=new Qe(8421631);break;case"orm":ee=new Qe(0,E.roughness,E.metalness);break;default:ee=new Qe(1,1,1);break}let X=vue(E,d[B].find(oe=>HC(E,oe)));M==!1&&B=="normal"&&X!=null&&(M=!0);const ue=gue(X,F,ee,a,a,B=="diffuse"&&s,B!="normal");createImageBitmap(ue).then(oe=>W.drawImage(oe,P.x*a,P.y*a,C,S))});const z=U.geometry.clone();U.geometry=z;const K=z.attributes.uv.clone();if(z.attributes.uv=K,K)for(let B=0;B{const E=new Qn(u[v].canvas);return E.flipY=!1,[v,E]}))),$=o?ui:ls;let H;const I=i?"transparent":"opaque";return r?(H=new kh({map:D.diffuse,transparent:i,side:$}),c==null&&(c=new hy),c.side=$,c.uniforms.map=D.diffuse,c.uniforms.shadeMultiplyTexture=D.diffuse,c.transparent=i,s&&!i&&(H.alphaTest=.5,c.alphaTest=.5),H.userData.vrmMaterial=c,H.userData.shadeTexture=D.uniformColor,H.name="mToon_"+I,H.map.name=H.name):(H=new kh({map:D.diffuse,roughnessMap:D.orm,metalnessMap:D.orm,normalMap:M?D.normal:null,transparent:i,side:$}),s&&!i&&(H.alphaTest=.5),H.name="standard_"+I,H.roughnessMap!=null&&(H.roughnessMap.name=H.name+"_orm"),H.normalMap!=null&&(H.normalMap.name=H.name+"_normal")),{bakeObjects:A,material:H}};function m5(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new XA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function g5(n,e){const t=new Map;new Z(-1,1,-1),new je,new Z;let r=0;n.forEach(l=>{if(l.skeleton){var A=m5(l);const c=A.bones;A.bones.forEach((u,f)=>{var h;if(c.indexOf(u)!==-1){const p=t.get(u.name);if(p==null){const d={index:r,boneInverses:A.boneInverses[f],bone:u.clone(!1),parentName:((h=u.parent)==null?void 0:h.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,d)}else u.userData.VRMcolliders!=null&&(p.bone.userData.VRMcolliders==null?p.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=p.bone.userData.VRMcollidersID&&(p.bone.userData.VRMcolliders=[...p.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var A;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const c=(A=t.get(l.parentName))==null?void 0:A.bone;c&&c.add(l.bone)}});const a=new XA(i,s);return a.bones.forEach(l=>{var c;const A=(c=l.userData)==null?void 0:c.vrm0RestPosition;A&&l.position.set(-A.x,A.y,-A.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function _ue(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(c=>c.name===o.name),A=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,A)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function bue(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function Ow(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function Cue(n,e){const{scale:t,isVrm0:r}=e,i=[],s=[];zh(n,"SkinnedMesh").forEach(A=>{const c=A.clone();i.push(c),Array.isArray(A.material)?s.push(...A.material):s.push(A.material)});const a=g5(i,t),l=new It;return l.name="AvatarRoot",i.forEach(A=>{var C;const c=new $t,u={};for(const S in A.geometry.attributes){const b=A.geometry.attributes[S];u[S]=b.clone()}if((C=A.userData)!=null&&C.isVRM0)for(let S=0;S[S,S.geometry.morphAttributes])),p=new Map([A].map(S=>[S,S.morphTargetDictionary||{}]));if(f.morphAttributes=y5({meshes:[A],sourceMorphAttributes:h,sourceMorphTargetDictionaries:p,destMorphTargetDictionary:f.morphTargetDictionary,scale:t},r),r)for(let S=0;Sh.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new Z(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],A=[],c=t.geometry.attributes.position.array,u=new Z,f=e.userData.isVRM0?-1:1;for(let h=0;h0){const{bakeObjects:D,material:$}=await yue({transparentColor:t,atlasSize:b.size,meshes:M,mtoon:b.isMtoon,transparentMaterial:b.transparentMaterial,transparentTexture:w,twoSidedMaterial:u}),H=D.map(L=>L.mesh),I=[];H.forEach(L=>{L.type=="Mesh"&&(L=Mue(_,L)),I.push(L);const z=L.geometry,K=z.index.array,O=v5(L.geometry.index.array),B=[];for(let F=0;F{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function Rue({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=kH(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function Fue({sourceMorphTargetDictionaries:n}){const e=new Set;Array.from(n.values()).forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map((i,s)=>{r[i]=s}),r}function y5({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i},s=!1){const o=new Set;Array.from(t.values()).forEach(u=>{Object.keys(u).forEach(f=>o.add(f))});const l=Array.from(o),A={};l.forEach(u=>{A[u]=[],Object.entries(r).forEach(([f,h])=>{A[u][h]=[],n.forEach(p=>{let d;const g=e.get(p);if(g.hasOwnProperty(f)&&p.geometry.morphAttributes[u]){const m=g[f];d=p.geometry.morphAttributes[u][m]}else{const m=p.geometry.attributes[u],y=new m.array.constructor(new Array(m.array.length).fill(0));d=new At(y,m.itemSize,m.normalized)}A[u][h].push(d)})})});const c={};return l.forEach(u=>{c[u]=[];for(let f=0;f{const i=r.geometry.index;for(var s=0;s{var l;if(r+=a.geometry.attributes.uv.count,(l=a.userData)!=null&&l.isVRM0)for(let A=0;A[a,a.geometry.attributes])),morphAttributes:new Map(n.map(a=>[a,a.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(a=>[a,a.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(a=>[a,a.morphTargetInfluences||[]]))},s={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};s.attributes=Rue({sourceAttributes:i.attributes});const o=Fue({sourceMorphTargetDictionaries:i.morphTargetDictionaries});return s.morphTargetDictionary=o,s.morphAttributes=y5({meshes:n,sourceMorphAttributes:i.morphAttributes,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o,scale:e},t),s.morphTargetInfluences=Iue({meshes:n,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o}),s.index=Uue({meshes:n}),s.animations={},{source:i,dest:s}}function ct(n){return n==null?[]:Array.isArray(n)?n:[n]}function Lue(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function Pue(n,e){const r=await new lu().load(e);r.encoding=pt,r.flipY=!1,n.traverse(i=>{if(i instanceof xn){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}uue(e)};function Due(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=ct(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((A=l.uniforms.alphaTest)==null?void 0:A.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function Oue(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ct(a.material).forEach(A=>{A.type=="ShaderMaterial"?A.transparent==!0?o.push(A):A.uniforms.alphaTest.value!=0?s.push(A):i.push(A):A.transparent==!0?r.push(A):A.alphaTest!=0?t.push(A):e.push(A)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function k3(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function Nue(n,e){if(n.data!=null)return n.data[e]}function kue(n){const e=Nue(n,"cullingMeshes");e&&(e.forEach(t=>{d5(t)}),n.data.cullingMeshes=null)}function vn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function Que(n){const e=n.scene;kue(n),e.traverse(t=>{t.material&&zC(t.material),t.geometry&&(d5(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),Bg.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&zC(i.material)})})});for(const t in n)n[t]=null}const zC=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{let e,t,r=0;return Array.isArray(n)?(e=n[0]||0,t=n[1]||0,r=n[2]||0):(typeof n=="string"||n instanceof String)&&n.split("-").forEach(s=>{switch(s=s.toLowerCase(),s){case"left":e=-1;break;case"right":e=1;break;case"bottom":case"down":t=-1;break;case"top":case"up":t=1;break;case"back":case"backward":r=-1;break;case"front":case"forward":r=1;break;default:console.warn("unkown cameraPosition name: "+s+" in: "+n+". Please use left, right, bottom, top, back or front");break}}),new Z(e,t,r)},w5=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},Hue=n=>{var t,r,i,s,o,a,l,A,c,u,f;const e=n.humanoid.humanBones;e.hips.node.parent.name="rootBone",e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:e.upperChest!=null&&(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((A=e.spine)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((c=e.neck)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let h in Km)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function x5({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),x5({candidates:n,predicate:e}))}function _5(n,e){return x5({candidates:[n],predicate:t=>t.name===e})}function b5({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),b5({candidates:n,predicate:e,results:t})}function zh(n,e){return b5({candidates:[n],predicate:t=>ct(e).includes(t.type)})}const zue={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function B5(n,e,t){var d;const r=Yc.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new rt,o=new rt,a=new rt,l=new Z,A=e.getObjectByName("mixamorigHips").position.y,c=(d=t.humanoid)==null?void 0:d.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,h=Math.abs(c-u)/A;return r.tracks.forEach(g=>{const m=g.clone(),y=m.name.split("."),w=y[0],_=zue[w],C=e.getObjectByName(w);if(_!=null){const S=y[1];if(C.getWorldQuaternion(s).invert(),C.parent.getWorldQuaternion(o),m instanceof ga){for(let b=0;b{m.values[$+b]=D})}i.push(new ga(`${_}.${S}`,m.times,m.values.map((b,M)=>{var D;return((D=t.meta)==null?void 0:D.metaVersion)==="0"&&M%2===0?-b:b})))}else if(m instanceof NA){const b=m.values.map((M,D)=>{var $;return((($=t.meta)==null?void 0:$.metaVersion)==="0"&&D%3!==1?-M:M)*h});i.push(new NA(`${_}.${S}`,m.times,b))}}}),new Yc("vrmAnimation",r.duration,i)}const Gue=new sre,Vue=new QH,aB=.2,jue=n=>Math.floor(Math.random()*n);class Q3{constructor(e,t,r,i,s,o,a){var l,A,c,u;this.mixer=new ine(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(A=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:A.neck,this.spineBone=(u=(c=r==null?void 0:r.humanoid)==null?void 0:c.humanBones)==null?void 0:u.spine,this.timeScale=1,i&&(this.setAnimations(i,null,null,a),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play())}setTimeScale(e){this.timeScale=e,this.actions.forEach(t=>{t.timeScale=e})}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t=null,r=null,i=!1){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const s=B5(e,t,this.vrm);s&&(e=[s],this.mixamoModel=t)}}else{const s=[];e.forEach(o=>{s.push(o.clone())}),e=s}if(r&&e[0].tracks.map((s,o)=>{(s.name==="neck.quaternion"||s.name==="spine.quaternion")&&e[0].tracks.splice(o,1)}),i){this.actions.forEach(s=>{s.weight=0,s.stop()}),this.actions=[],this.newAnimationWeight=1;for(let s=0;s{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}setTime(e){this.mixer.setTime(e)}getTime(){return this.mixer.time}dispose(){this.animationManager.disposeAnimation(this)}}class Wue{constructor(){this.animationPaths=[],this.defaultAnimations=[],this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.paused=!1,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,this.currentClip=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t,r=0,i=!0,s="",o=""){const a=s+(s!=""?"/":"")+ct(e)[0];o=o==""?ul(a):o,this.currentAnimationName=o;const A=await(i?Gue:Vue).loadAsync(a);A.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(A.animations);const c=Yc.findByName(A.animations,"mixamo.com");c!=null?(this.mixamoModel=A.clone(),this.mixamoAnimations=A.animations,this.currentClip=c):(this.mixamoModel=null,this.animations=A.animations,this.currentClip=A.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new Q3(this,A,null,A.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(A.animations,this.mixamoModel,this.mouseLookEnabled,t)}),this.setTime(r),t?this.pause():this.play()}getCurrentClip(){return this.currentClip}getCurrentClipDuration(){return this.currentClip?this.currentClip.duration:0}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=this.defaultAnimations,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t,r=!0){const i=ct(e);r?this.animationPaths=[...this.defaultAnimations,...i.map(s=>`${t}/${s}`)]:this.animationPaths=i.map(s=>t!=""?`${t}/${s}`:s)}storeDefaultAnimationPaths(e,t){const r=ct(e);this.defaultAnimations=r.map(i=>t!=""?`${t}/${i}`:i),this.animationPaths=this.defaultAnimations}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=jue(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-aB)},e*1e3)}pause(){this.paused=!0}play(){this.paused=!1}isPaused(){return this.paused}setTime(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTime(e)})}setFrame(e){this.setTime(e*30)}setSpeed(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTimeScale(e)})}update(e=!1){(this.mainControl&&!this.paused||e)&&(this.animationControls.forEach(t=>{t.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*aB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*aB):this.weightOut=0)}}const Kue={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -4209,7 +4209,7 @@ void main() { texel.rgb = pow(texel.rgb, vec3(1.0 / 2.2)); gl_FragColor = texel; } - `})}}const Nw=4096,rp=new Z;class tfe{constructor(e,t,r){const i=new vg({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new $e(Nw,Nw);i.setClearColor(0,0),i.outputEncoding=cs,i.setSize(s.x,s.y),i.setPixelRatio(window.devicePixelRatio);let o=s.clone().divideScalar(r);o.x|=0,o.y|=0;const a=new Zue(i);a.addPass(new Jue(e,t)),this._renderPixelPass=new que(o,e,t),this._pixelPass=new efe(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new $e(e,t).clone().divideScalar(this.pixelSize);i.x|=0,i.y|=0,this.renderer.setSize(e,t),this._renderPixelPass.setResolution(i),this._pixelPass.setResolution(i)}setPixelSize(e){this.pixelSize=e}render(){this.composer.render()}}class nfe{constructor(e,t){this.renderer=new vg({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputEncoding=pt,this.renderer.setSize(Nw,Nw),this.camera=new Fr(30,1,.1,1e3),this.textureLoader=new lu,this.sceneBackground=new Qe(.1,.1,.1),this.sceneBackgroundAlpha=1,this.frameOffset={min:.2,max:.2},this.usesBackgroundImage=!1,this.backgroundMaterial=new Ei({color:16777215,transparent:!0,opacity:.5});const r=new ou(1e3,1e3),i=new xn(r,this.backgroundMaterial);i.renderOrder=-1,this.backgroundPlane=i,this.pixelRenderer=new tfe(t,this.camera,20),this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setScene(e){this.scene=e}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=r}_getCharacterMinMax(){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY;return this.characterManager.characterModel.traverse(r=>{r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(r.geometry.boundingBox.applyMatrix4(r.matrixWorld),r.geometry.boundingBox.min.yt&&(t=r.geometry.boundingBox.max.y)))}),{minY:e,maxY:t}}frameCloseupShot(){this.frameShot("head","head")}frameMediumShot(){this.frameShot("chest","head")}frameCowboyShot(){this.frameShot("hips","head")}frameFullShot(){this.frameShot("leftFoot","head")}frameShot(e,t,r=null,i=!1,s=!0){const o=this._getBoneWorldPositionWithOffset(e,i),a=this._getBoneWorldPositionWithOffset(t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new Z(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}async calculateBoneOffsets(e){for(const t in this.boneOffsets){const r=await this._getMinMaxOffsetByBone(this.characterManager.characterModel,t,e);this.boneOffsets[t]=r}}_getBoneWorldPositionWithOffset(e,t){const r=this._getFirstBoneWithName(e);if(!r||!this.boneOffsets[e])return new Z;const i=new Z;r.getWorldPosition(i);const s=t?this.boneOffsets[e].max:this.boneOffsets[e].min;return i.y+=s.y,i}_getBoneWorldPosition(e){const t=this._getFirstBoneWithName(e);return t!=null?new Z().setFromMatrixPosition(t.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new Z(0,0,0))}_getFirstBoneWithName(e){let t=null;return this.characterManager.characterModel.traverse(r=>{if(r instanceof Al){if(!r.geometry){console.error("Invalid skinned mesh found in children.");return}const i=r.skeleton.bones.findIndex(s=>s.name===e);if(i!==-1){t=r.skeleton.bones[i];return}}}),t}setCameraFrameWithName(e,t){switch(e.toLowerCase()){case"fullshot":this.frameShot("leftFoot","head",t);break;case"cowboyshot":this.frameShot("hips","head",t);break;case"mediumshot":this.frameShot("chest","head",t);break;case"mediumcloseup":case"mediumcloseupshot":this.frameShot("chest","head",t,!0);break;case"closeup":case"closeupshot":this.frameShot("head","head",t);break;default:console.warn("unkown cameraFrame: "+e+". Please use fullShot, cowboyShot, mediumShot, mediumCloseup or closeup"),this.frameShot("leftFoot","head",t);break}}async _getMinMaxOffsetByBone(e,t,r){return new Promise(async(i,s)=>{(!e||!e.traverse)&&(console.error("Invalid parent object provided."),s(null));const o=new Z(1/0,1/0,1/0),a=new Z(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof Al&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let A=0;await(u=>new Promise(f=>setTimeout(f,u)))(10),e.traverse(u=>{if(u instanceof Al){if(!u.geometry){console.error("Invalid skinned mesh found in children.");return}const f=u.skeleton.bones.findIndex(g=>g.name===t);if(f===-1){console.error(`Bone with name '${t}' not found in one of the skinned meshes.`);return}const h=u.geometry.getAttribute("position"),p=u.geometry.getAttribute("skinWeight"),d=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const x=u.skeleton.bones[f],_=new Z().setFromMatrixPosition(x.matrixWorld),C=m.clone().sub(_);o.min(C),a.max(C)}}this._restoreSavedPose(l[A],u.skeleton),A++}}),i({min:o,max:a})})}_saveBonesPos(e){let t=[];return e.bones.forEach(r=>{t.push({position:r.position.clone(),rotation:r.rotation.clone(),scale:r.scale.clone()})}),t}_restoreSavedPose(e,t){e&&t.bones.forEach((r,i)=>{r.position.copy(e[i].position),r.rotation.copy(e[i].rotation),r.scale.copy(e[i].scale)})}positionCameraBetweenPoints(e,t,r,i=30){const s=new ps;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new Z).length()/(2*Math.tan(o/2));s.getCenter(rp),this.camera.position.copy(rp),r.y*=.5,this.camera.lookAt(rp.clone().sub(r));const A=new Z;this.camera.getWorldDirection(A),this.camera.position.addScaledVector(A,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,rp.set(0,0,-1),this.cameraDir=rp.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setBackground(e){if(Array.isArray(e)){const t=e[3]==null?1:e[3];this.setBackgroundColor(e[0],e[1],e[2],t)}else this.setBackgroundImage(e)}setBackgroundColor(e,t,r,i){const s=new Qe(e,t,r,i);this.sceneBackground=s,i==null&&(i=1),i>1&&(i=1),i<0&&(i=0),this.sceneBackgroundAlpha=i,this.backgroundMaterial.color=s,this.usesBackgroundImage=!1}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=As,this.sceneBackground=i,this.usesBackgroundImage=!0,this.sceneBackgroundAlpha=1,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}_setBackground(){if(this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1)if(this.sceneBackgroundAlpha==0)this.scene.background=null;else{this.scene.background=null,this.scene.add(this.backgroundPlane),this.backgroundPlane.position.copy(this.camera.position);var e=new Z(0,0,-1);e.applyQuaternion(this.camera.quaternion);var t=100;this.backgroundPlane.position.addScaledVector(e,t),this.backgroundPlane.lookAt(this.camera.position)}else this.scene.background=this.sceneBackground}_restoreBackground(){this.scene.background=null,this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1&&this.scene.remove(this.backgroundPlane)}getImageData(e,t,r=null){return this._createImage(e,t,r).split("base64,")[1]}_createImage(e,t,r=null){const i=e/t;typeof r=="number"&&this.pixelRenderer.setPixelSize(r),this.renderer.setSize(e,t),this.pixelRenderer.setSize(e,t);const s="image/png";this.camera.aspect=i,this.camera.updateProjectionMatrix();const o=typeof r=="number"?this.pixelRenderer:this.renderer;try{this._setBackground(),o.render(this.scene,this.camera);let a=o.domElement.toDataURL(s);return this._restoreBackground(),a}catch(a){return console.error(a),null}}savePixelScreenshot(e,t,r,i){this.pixelRenderer.setPixelSize(i),this.pixelRenderer.setSize(t,r);const s=this._createImage(t,r,!0),o="image/octet-stream",a="image/png";this.saveFile(s.replace(a,o),e+".png")}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new Qn(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=t6.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const rfe=2;class ife{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new OH,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=rfe,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(oi.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function E5(){return(E5=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let h=[],p=new DataView(new ArrayBuffer(24*n.levels.length)),d=(f||u+s.byteLength)+t.byteLength;for(let y=0;y0?f:0),!0),m.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(sp([new Uint8Array(Tr).buffer,g,p.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var VC,jC,ufe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},WC=new OffscreenCanvas(128,128),j3=WC.getContext("2d",{willReadFrequently:!0}),C5=typeof document>"u";function ffe(n){return createImageBitmap(n).then(function(e){return WC.width=e.width,WC.height=e.height,j3.drawImage(e,0,0),j3.getImageData(0,0,e.width,e.height)})}function hfe(n,e){return e===void 0&&(e={}),pfe().then(function(t){var r=new t.BasisEncoder;return dfe(e,r),r.setTexType(VC.cBASISTexType2D),ofe(n,ArrayBuffer)&&(n=new Blob([n])),ffe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,jC.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=lfe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=cfe(l,{keepWriter:!0})}return a})})}function dfe(n,e){n===void 0&&(n={}),(n=sfe({},ufe,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var lB=null;function pfe(){return lB||(lB=new Promise(function(n,e){C5?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),lB}C5&&self.addEventListener("message",function(n){hfe(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class mfe{constructor(e,t){if(this.gl=e,this.libktx=null,e!==void 0)if(t===void 0&&LIBKTX!==void 0&&(t=LIBKTX),t!==void 0)this.initializied=this.init(e,t);else{console.error("Failed to initalize KTXDecoder: ktx library undefined");return}else{console.error("Failed to initalize KTXDecoder: WebGL context undefined");return}}async init(e,t){this.libktx=await t({preinitializedWebGLContext:e}),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(e.canvas,{majorVersion:2}))}stringToUastcFlags(e){return e==="FASTER"?this.libktx.UastcFlags.LEVEL_FASTER.value:e==="FASTEST"?this.libktx.UastcFlags.LEVEL_FASTEST.value:e==="SLOWER"?this.libktx.UastcFlags.LEVEL_SLOWER.value:e==="SLOWEST"?this.libktx.UastcFlags.LEVEL_VERYSLOW.value:this.libktx.UastcFlags.LEVEL_DEFAULT.value}stringToSupercmpScheme(e){return e==="Zstd"?this.libktx.SupercmpScheme.ZSTD:e==="Zlib"?this.libktx.SupercmpScheme.ZLIB:e==="BasisLZ"?this.libktx.SupercmpScheme.BASIS_LZ:this.libktx.SupercmpScheme.NONE}transcodeRGBA(e){if(!e.needsTranscoding)return;const t=this.libktx.TranscodeTarget.RGBA8888;e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}transcode(e){if(e.gpuFormat="RGBA8888",e.needsTranscoding){let t,r=!1,i=!1,s=!1,o=!1,a=!1;r=!!this.gl.getExtension("WEBGL_compressed_texture_astc"),i=!!this.gl.getExtension("WEBGL_compressed_texture_etc1"),s=!!this.gl.getExtension("WEBGL_compressed_texture_s3tc"),o=!!this.gl.getExtension("EXT_texture_compression_bptc"),a=!!this.gl.getExtension("WEBGL_compressed_texture_pvrtc")||!!this.gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),r?(t=this.libktx.TranscodeTarget.ASTC_4x4_RGBA,e.gpuFormat="ASTC_4x4_RGBA"):o?(t=this.libktx.TranscodeTarget.BC7_RGBA,e.gpuFormat="BC7_RGBA"):s?(t=this.libktx.TranscodeTarget.BC1_OR_3,e.gpuFormat="BC1_OR_3"):a?(t=this.libktx.TranscodeTarget.PVRTC1_4_RGBA,e.gpuFormat="PVRTC1_4_RGBA"):i?(t=this.libktx.TranscodeTarget.ETC,e.gpuFormat="ETC"):(t=this.libktx.TranscodeTarget.RGBA8888,e.gpuFormat="RGBA8888"),e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}}async loadKtxFromUri(e){await this.initializied;const t=await fetch(e),r=new Uint8Array(await t.arrayBuffer()),i=new this.libktx.ktxTexture(r);this.transcode(i);let s=i.glUpload();if(s.texture==null){console.error("Could not load KTX data");return}return s.texture.levels=Math.log2(i.baseWidth),s.texture.width=i.baseWidth,s.texture.height=i.baseHeight,s.texture.gpuSize=i.dataSize,s.texture.gpuFormat=i.gpuFormat,s.texture.isSRGB=i.isSRGB,s.texture}async loadKtxFromBuffer(e){await this.initializied;const t=new this.libktx.ktxTexture(e);this.transcode(t);const r=t.glUpload();if(r.texture==null){console.error("Could not load KTX data");return}return r.texture.levels=Math.log2(t.baseWidth),r.texture.width=t.baseWidth,r.texture.height=t.baseHeight,r.texture.gpuSize=t.dataSize,r.texture.gpuFormat=t.gpuFormat,r.texture.isSRGB=t.isSRGB,r.texture}async compress(e,t,r,i,s={}){const o=new this.libktx.ktxTexture(e,t,r,i,s.srgb);if(!s.hasOwnProperty("basisu_options")){const A=new this.libktx.ktxBasisParams;A.uastc=!1,A.noSSE=!0,A.verbose=!1,A.qualityLevel=100,A.compressionLevel=2,s.basisu_options=A}s.hasOwnProperty("compression_level")||(s.compression_level=18),s.hasOwnProperty("supercmp_scheme")||(s.supercmp_scheme=this.libktx.SupercmpScheme.NONE),console.log(s);const a=o.compressBasisU(s.basisu_options,s.supercmp_scheme,s.compression_level);return Uint8ClampedArray.from(a)}}class gfe{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new mfe(t,window.LIBKTX);await r.init(t,window.LIBKTX),this.ktxEncoder=r,this.libktx=r.libktx}async compress(e,t,r,i,s={}){const o=await new this.libktx.ktxBasisParams,a=s;return o.uastc=a.uastc!==void 0?a.uastc:!1,o.noSSE=a.noSSE!==void 0?a.noSSE:!1,o.verbose=a.verbose!==void 0?a.verbose:!1,o.normalMap=a.normalMap!==void 0?a.normalMap:!1,o.compressionLevel=a.compressionLevel!==void 0?a.compressionLevel:1,o.qualityLevel=a.qualityLevel!==void 0?a.qualityLevel:60,o.maxEndpoints=a.ETC1SmaxEndpoints!==void 0?a.ETC1SmaxEndpoints:0,o.endpointRDOThreshold=a.ETC1SEndpointRdoThreshold!==void 0?a.ETC1SEndpointRdoThreshold:1.25,o.maxSelectors=a.ETC1SMaxSelectors!==void 0?a.ETC1SMaxSelectors:0,o.selectorRDOThreshold=a.ETC1SSelectorRdoThreshold!==void 0?a.ETC1SSelectorRdoThreshold:1.25,o.noEndpointRDO=a.ETC1SNoEndpointRdo!==void 0?a.ETC1SNoEndpointRdo:!1,o.noSelectorRDO=a.ETC1SNoSelectorRdo!==void 0?a.ETC1SNoSelectorRdo:!1,o.uastcFlags=this.ktxEncoder.stringToUastcFlags(a.uastcFlags),o.uastcRDO=o.uastcRDO!==void 0?o.uastcRDO:!1,o.uastcRDOQualityScalar=a.uastcRDOQualityScalar!==void 0?a.uastcRDOQualityScalar:1,o.uastcRDODictSize=a.uastcRDODictSize!==void 0?a.uastcRDOQualityScalar:4096,o.uastcRDOMaxSmoothBlockErrorScale=a.uastcRDOMaxSmoothBlockErrorScale!==void 0?a.uastcRDOMaxSmoothBlockErrorScale:10,o.uastcRDOMaxSmoothBlockStdDev=a.uastcRDOMaxSmoothBlockStdDev!==void 0?a.uastcRDOMaxSmoothBlockStdDev:18,o.uastcRDODontFavorSimplerModes=a.uastcRDODontFavorSimplerModes!==void 0?a.uastcRDODontFavorSimplerModes:!1,s.basisu_options=o,s.hasOwnProperty("supercmp_scheme")?s.supercmp_scheme=this.ktxEncoder.stringToSupercmpScheme(s.supercmp_scheme):s.supercmp_scheme=this.libktx.SupercmpScheme.NONE,await this.ktxEncoder.compress(e,t,r,i,s)}}var Dn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Dn||(Dn={}));const KC="blend_",W3="vrmColliderSphere";function vfe(n){var e;return{title:n.name,version:"v0",author:((e=n.authors)==null?void 0:e.length)>0?n.authors.join(", "):"",reference:n.references!=null?n.references.join(", "):"",contactInformation:n.contactInformation!=null?n.contactInformation:"",otherPermissionUrl:n.otherPermissionUrl,allowedUserName:n.avatarPermission!=null?n.avatarPermission:"",violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:n.commercialUsage=="personalProfit"||n.commercialUsage=="corporation"?"Allow":"Disallow",licenseName:n.copyrightInformation,otherLicenseUrl:n.otherLicenseUrl,metaVersion:"0"}}function yfe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function wfe(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function xfe(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class _fe{async parse(e,t,r,i,s,o,a){var be;const l=vfe(e.meta),A=yfe(e.humanoid),c=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(A)if(l){if(!c)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=c.filter((N,j,se)=>se.findIndex(he=>he.name===N.name.replace(" (Outline)",""))===j).map(N=>N),p=h.map(N=>N.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(N=>N.map).map(N=>{if(!N.map)throw new Error(N.name+" map is null");return{name:N.name,imageBitmap:N.map.image}}),m=h.filter(N=>N.userData.shadeTexture).map(N=>{if(!N.userData.shadeTexture)throw new Error(N.userData.shadeTexture+" map is null");return{name:N.name+"_shade",imageBitmap:N.userData.shadeTexture.image}}),y=h.filter(N=>N.roughnessMap).map(N=>N.roughnessMap?{name:N.name+"_orm",imageBitmap:N.roughnessMap.image}:null),w=h.filter(N=>N.roughnessMap).map(N=>N.normalMap?{name:N.name+"_normal",imageBitmap:N.normalMap.image}:null),x=[...g,...m,...y,...w].filter(N=>N!==null),_=Mfe(x,d,s?"image/ktx2":"image/png"),C=Tfe(_),S=Ife(_,s),b=Sfe(h,x),M=t.children.filter(N=>N.children.length>0&&N.children[0].type===li.Bone)[0],D=S5(M).filter(N=>N.name!==W3),$=D.map(N=>N.name),H=D.map(N=>{const j=N.children.filter(se=>se.name!==W3).map(se=>$.indexOf(se.name));return{name:N.name,rotation:[N.quaternion.x,N.quaternion.y,N.quaternion.z,N.quaternion.w],scale:[N.scale.x,N.scale.y,N.scale.z],translation:[N.position.x,N.position.y,N.position.z],children:j.length>0?j:void 0}}),I=[],v=t.children.filter(N=>N.type===li.Group||N.type===li.SkinnedMesh),E=[];v.forEach((N,j)=>{const se=N.type===li.Group?N.children[0]:N,he=se.geometry.attributes,me=new Gl(he.position,Dn.FLOAT,Kt.POSITION,zo.VEC3,se.name,void 0);E.push(me);const G=E.length-1,R=he.normal.array,T=new Float32Array(R.length);for(let ie=0;ieie):[N]).forEach(ie=>{if(!ie.geometry.index)throw new Error(ie.name+" geometry.index is null");E.push(new Gl(ie.geometry.index,Dn.UNSIGNED_INT,Kt.INDEX,zo.SCALAR,se.name,ie.name))}),se.morphTargetDictionary||(se.morphTargetDictionary={},se.morphTargetInfluences=[],se.geometry.morphAttributes={},se.updateMorphTargets()),se.geometry.userData.targetNames=[];const ae=(ie,Te,Me,Le)=>{const ke=[],De=[];for(let fe=0;fe0){const fe=[...ke].sort((Fe,We)=>Fe-We),Ce=[];for(let Fe=0;Fe({mesh:0,index:he.index,weight:he.weight*100}));if(se.length>0){let he=!1;for(const me in oi)if(N===oi[me]&&N!=="surprised"){u.push({name:N,presetName:wfe(N),binds:se,isBinary:j.isBinary}),he=!0;break}he===!1&&u.push({name:N,presetName:"unknown",binds:se,isBinary:j.isBinary})}}v.forEach(N=>{const j=N.type===li.Group?N.children[0]:N,se=new Float32Array(j.skeleton.boneInverses.map(he=>he.elements).flat());E.push(new Gl(new At(se,16),Dn.FLOAT,Kt.BIND_MATRIX,zo.MAT4,j.name,j.name))}),I.push(...E.map(N=>({componentType:N.valueType,count:N.attribute.count,max:N.max,min:N.min,normalized:!1,type:N.accessorsType})));const U=Efe(v,E,p);v.forEach((N,j)=>{H.push({mesh:j,name:N.name,rotation:[N.quaternion.x,N.quaternion.y,N.quaternion.z,N.quaternion.w],scale:[N.scale.x,N.scale.y,N.scale.z],skin:j,translation:[N.position.x,N.position.y,N.position.z]})});const P=Cfe(v,E,$),L={humanBones:[]};A.humanBones.forEach(N=>{$.indexOf(N.node.name)!=-1&&L.humanBones.push({bone:xfe(N.bone),node:$.indexOf(N.node.name),useDefaultValues:!0})});const z={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},K={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},O=[];h.forEach(N=>{N.type=="ShaderMaterial"?O.push(Object.assign({},z)):O.push(Object.assign({},K))});const B=l;i.forEach(N=>{for(let j=0;jN.isSkinnedMesh))==null?void 0:be.skeleton)||null;for(let N=0;N{const me=he.sphere;se.colliders.push({radius:me.radius*o,offset:{x:me.offset[0]*o,y:me.offset[1]*o,z:me.offset[2]*o}})}),W.push(se)}}console.log("COLLIDER GROUPS",W);const F=N=>{for(let j=0;j{var G;const j=F(N.name);if(j===-1){console.warn("Spring bone "+N.name+" was removed during cleanup process. Skipping.");return}const se=[];N.colliderGroups.forEach(R=>{const T=R.colliders[0];if(T!=null){const V=T.parent,te=W.findIndex(ae=>ae.name===V.name);te!=-1&&(se.includes(te)||se.push(te))}});let he=F((G=N.center)==null?void 0:G.name);he==-1&&console.warn("no center bone for spring bone "+N.name);const me=N.settings;X.push({bones:[j],center:he,colliderGroups:se,dragForce:me.dragForce,gravityDir:{x:me.gravityDir.x,y:me.gravityDir.y,z:me.gravityDir.z},gravityPower:me.gravityPower,hitRadius:me.hitRadius,stiffiness:me.stiffness})});const ue={boneGroups:X,colliderGroups:W};console.log(ue),B.texture=d?_.length-1:void 0;const le=await Promise.all(x.map(async N=>({buffer:s?await K3(N.imageBitmap):$3(N.imageBitmap),type:Kt.IMAGE})));E.forEach((N,j)=>{N.buffer?le.push({buffer:N.buffer,typeString:"",type:N.type}):N.sparse&&(le.push({buffer:N.sparse.indices,typeString:"indices",type:N.type,count:N.sparse.count}),le.push({buffer:N.sparse.values,typeString:"values",type:N.type})),le.length-1}),d&&le.push({buffer:s?await K3(d.imageBitmap):$3(d.imageBitmap),type:Kt.IMAGE});let oe=0,re=0,pe=0,_e=0;const Re=le.map(N=>{const j={buffer:0,byteLength:N.buffer.byteLength,byteOffset:oe,target:N.type===Kt.IMAGE||N.type===Kt.BIND_MATRIX||N.typeString==="indices"||N.typeString==="values"?void 0:N.type===Kt.INDEX?Dn.ELEMENT_ARRAY_BUFFER:Dn.ARRAY_BUFFER};return oe+=N.buffer.byteLength,N.type===Kt.IMAGE?(_[re++].bufferView=_e,_e++):E[pe].sparse?(I[pe].sparse==null&&(I[pe].sparse={}),N.typeString==="indices"&&(I[pe].sparse.count=N.count,I[pe].sparse[N.typeString]={bufferView:_e,byteOffset:0,componentType:Dn.UNSIGNED_INT}),N.typeString==="values"&&(I[pe].sparse[N.typeString]={bufferView:_e,byteOffset:0}),N.typeString==="values"&&pe++,_e++):(E[pe].bufferIndex=_e,I[pe].bufferView=_e,pe++,_e++),j}),Q=Rfe(t,H);bfe(B);const de=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&de.push("KHR_texture_basisu");const Ae={accessors:I,asset:f,buffers:[{byteLength:oe}],bufferViews:Re,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new Z,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:O,humanoid:L,meta:B,secondaryAnimation:ue,specVersion:"0.0"}},extensionsUsed:de,images:_,materials:b,meshes:U,nodes:H,samplers:C,scenes:Q,skins:P,textures:S};console.log("output",Ae);const q=new Y3(YC(JSON.stringify(Ae,void 0,2)),"JSON"),J=new Y3(Pp(le.map(N=>N.buffer)),"BIN\0"),ce=Pp([q.buffer,J.buffer]),xe=Pp([YC("glTF"),$C(2,4),$C(ce.byteLength+12,4)]);a(Pp([xe,ce]))}}function bfe(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function S5(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>S5(e)).flat())}const Bfe=new gfe;async function K3(n){const e=await createImageBitmap(n),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0);const i=r.getImageData(0,0,t.width,t.height),s=new Uint8Array(i.data.buffer);return await Bfe.compress(s,t.width,t.height,4,{normalMap:!1,uastc:!1,qualityLevel:50,compressionLevel:2,uastcFlags:"DEFAULT",compressionUASTC_Rdo_Level:18,uastcRDO:!1,uastcRDOQualityScalar:1,uastcRDODictSize:4096,uastcRDOMaxSmoothBlockErrorScale:10,uastcRDOMaxSmoothBlockStdDev:18,uastcRDODontFavorSimplerModes:!1,ETC1SQualityLevel:128,ETC1SmaxEndpoints:0,ETC1SEndpointRdoThreshold:1.25,ETC1SMaxSelectors:0,ETC1SSelectorRdoThreshold:1.25,ETC1SNoEndpointRdo:!1,ETC1SNoSelectorRdo:!1,supercmp_scheme:"Zstd"})}function $3(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Dn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Dn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class Y3{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Pp([$C(r.byteLength,4),YC(this.type),r])}padBuffer(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),new Uint8Array(i).fill(t,e.byteLength),i}}const X3=n=>{const e=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],t=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;rn.map(r=>{const i=r.type===li.Group?r.children[0]:r,s=r.type===li.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Kt.SKIN_INDEX),NORMAL:a.indexOf(Kt.NORMAL),POSITION:a.indexOf(Kt.POSITION),TEXCOORD_0:a.indexOf(Kt.UV),WEIGHTS_0:a.indexOf(Kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>{const c=e.map(h=>h.type===Kt.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(KC+A),u=e.map(h=>h.type===Kt.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(KC+A),f={};return u!==-1&&(f.POSITION=u),c!==-1&&(f.NORMAL=c),f}):void 0}})}}),Cfe=(n,e,t)=>n.map(r=>{const i=r.type===li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Kt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Sfe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(p=>p.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const h=t;r=h.color?[h.color.r,h.color.g,h.color.b,1]:void 0}let s=-1;t.map?s=e.map(h=>h.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(h=>h.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(h=>h.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(h=>h.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,A={baseColorFactor:r,baseColorTexture:l},c=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(c)A.metallicRoughnessTexture=c;else{const h=(()=>{switch(t.type){case Kf.MeshStandardMaterial:return t.metalness;case Kf.MeshBasicMaterial:return 0;default:return 0}})(),p=(()=>{switch(t.type){case Kf.MeshStandardMaterial:return t.roughness;case Kf.MeshBasicMaterial:return .9;default:return .9}})();A.metallicFactor=h,A.roughnessFactor=p}const f={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{}}:void 0,name:t.name,pbrMetallicRoughness:A};return u&&(f.normalTexture=u),f}),Mfe=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),Tfe=n=>n.map(()=>({magFilter:Dn.LINEAR,minFilter:Dn.LINEAR,wrapS:Dn.REPEAT,wrapT:Dn.REPEAT})),Ife=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),Rfe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===li.Object3D||r.type===li.SkinnedMesh||r.type===li.Group||r.type===li.Bone).map(r=>t.indexOf(r.name))}]};function Ffe(n,e,t){var a,l;const r=[],i=[];for(const A in n)((l=(a=n[A])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[A].vrm.meta.authors!=null?i.push(n[A].vrm.meta):r.push(n[A].vrm.meta));r.length+i.length==1&&(r.length==1?r[0].title!=null&&(t=r[0].title):i[0].name!=null&&(t=i[0].name)),e!=null&&(e.authors!=null?i.push(e):r.push(e));const s=Lfe(r),o=Ufe(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function Ufe(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:A="",avatarPermission:c=void 0,otherPermissionUrl:u=[]}=n,f,h,p,d="unnecessary",g,m=[];e.forEach(b=>{t=t.concat(ut(b.authors)),r=r.concat(ut(b.otherLicenseUrl)),i=i.concat(ut(b.contactInformation)),s=s.concat(ut(b.references)),u=u.concat(ut(b.otherPermissionUrl)),b.allowExcessivelyViolentUsage===!1&&(o=!1),b.allowExcessivelySexualUsage===!1&&(a=!1),l=qa(Ofe,l,b.commercialUsage),A=qa(M5,A,b.copyrightInformation),c=qa(Nfe,c,b.avatarPermission),b.allowAntisocialOrHateUsage===!1&&(f=f=!1),b.allowPoliticalOrReligiousUsage===!1&&(h=h=!1),b.allowRedistribution===!1&&(p=p=!1),b.creditNotation==="required"&&(d="required"),m=m.concat(ut(b.thirdPartyLicenses)),g=qa(Dfe,g,b.modification)});const y=[...new Set(t)].filter(b=>b!=""&&b!=null&&b!="undefined"),w=[...new Set(r)].filter(b=>b!=""&&b!=null&&b!="undefined"),x=[...new Set(i)].filter(b=>b!=""&&b!=null&&b!="undefined"),_=[...new Set(s)].filter(b=>b!=""&&b!=null&&b!="undefined"),C=[...new Set(u)].filter(b=>b!=""&&b!=null&&b!="undefined"),S=[...new Set(m)].filter(b=>b!=""&&b!=null&&b!="undefined");return{authors:y,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:x.length==0?"":x.join(", "),references:_,otherPermissionUrl:C.length==0?"":C.join(", "),thirdPartyLicenses:S.length==0?"":S.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:A,avatarPermission:c,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:p,creditNotation:d,modification:g}}function Lfe(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,A,c;n.forEach(g=>{e=e.concat(ut(g.author)),t=t.concat(ut(g.contactInformation)),r=r.concat(ut(g.reference)),i=i.concat(ut(g.otherPermissionUrl)),s=s.concat(ut(g.otherLicenseUrl)),o=qa(kfe,o,g.allowedUsername),a=qa(cB,a,g.violentUssageName),l=qa(cB,l,g.sexualUssageName),A=qa(cB,A,g.commercialUssageName),c=qa(M5,c,g.licenseName)});const u=[...new Set(e)].filter(g=>g!=""&&g!=null&&g!="undefined"),f=[...new Set(t)].filter(g=>g!=""&&g!=null&&g!="undefined"),h=[...new Set(r)].filter(g=>g!=""&&g!=null&&g!="undefined"),p=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:d,contactInformation:f,references:h,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:A==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:c,avatarPermission:Pfe(o),otherPermissionUrl:p}}function Pfe(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const Dfe={prohibited:0,allowModification:1,allowModificationRedistribution:2},Ofe={personalNonProfit:0,personalProfit:1,corporation:2},Nfe={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},kfe={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},cB={Disallow:0,Allow:1},M5={Redistribution_Prohibited:0,Other:1,CC_BY_NC_ND:2,CC_BY_ND:3,CC_BY_NC_SA:4,CC_BY_SA:5,CC_BY_NC:6,CC_BY:7,CC0:8};function qa(n,e,t){return e===void 0?t:t==null||!(t in n)||n[e]{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function Qfe(n){const e=T5(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=m5(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new kh,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new Ur;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function Hfe(n,e,t){const r=await bT(n,t),i=await I5(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function zfe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;Gfe(n,e,r).then(a=>{F5(a,`${o}.vrm`),i()})})}async function Gfe(n,e,t){const r=await bT(n,t);return I5(r,e,t)}function bT(n,e){const t=T5(n),{createTextureAtlas:r=!0}=e;return r?Tue(t,e):(console.log("no atlas"),Cue(t,e))}async function Vfe(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await bT(n,t):Qfe(n);jfe(s).then(o=>{if(o instanceof ArrayBuffer)F5(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);Xfe(a,`${r}.gltf`)}})}function jfe(n){return new Promise(e=>new aT().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function Wfe(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(A=>A.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in Km)if(s.bone.parent.name==Km[o]){t.push(s);break}}),t}function Kfe(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Km)if(Km[r]===t.name){e[t.name]={node:t};break}}),e}function $fe(n,e){const t=zh(n,"SkinnedMesh");return{humanBones:Kfe(t[0]),materials:n.userData.atlasMaterial,meta:Yfe(e)}}function Yfe(n){return n=n||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:"CharacterCreator",licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...n}}function I5(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=Ffe(e,s,a);return new Promise(async A=>{const c=i?new _fe:new wce,u={...Jfe(e),...$fe(n,l)};let f;n.traverse(d=>{d.isSkinnedMesh&&(f=d)}),(()=>{for(let d=0;d{d.updateMatrix(),d.updateMatrixWorld()}),f.skeleton.calculateInverses(),f.skeleton.computeBoneTexture(),f.skeleton.update()})(),f.skeleton.bones.filter(d=>d.name==="head")[0];const p=Wfe(e);c.parse(u,n,r,p,t.ktxCompression,o,d=>{A(d)})})}function R5(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function Xfe(n,e){R5(new Blob([n],{type:"text/plain"}),e)}function F5(n,e){R5(Zfe(n),e)}function Zfe(n){return new Blob([n],{type:"application/octet-stream"})}function Jfe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}const qfe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?ehe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?the(n):console.warn("No valid vrm file was provided")},ehe=n=>{var a,l,A;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:A.colliderGroups,s=[],o=r.map(c=>U5(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],f=_5(t,u);if(f!=null){const h=c.colliders;f.userData.VRMcolliders=h.map(p=>({sphere:{radius:p.radius,offset:[p.offset.x,p.offset.y,p.offset.z]}}))}f.userData.VRMcollidersID=w5()})},the=n=>{var l,A,c,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:A.colliderGroups,s=(u=(c=e.extensions)==null?void 0:c.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>U5(f.name,o));i!=null&&i.forEach(f=>{const h=ut(f.colliders);let p=-1,d=null;h.forEach(g=>{if(p!=s[g].node){p=s[g].node;const m=a[p];d=_5(t,m),d.userData.VRMcolliders=[]}if(d!=null){const m=s[g].shape;for(const y in m){const w=m[y];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}d.userData.VRMcollidersID=w5(),d.userData.VRMcolliders.push(m)}else console.error("no node with name "+a[p]+" was found")})})},U5=(n,e)=>{const t=_t.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},kw=[0,400,560,2400,4800],Qw=[0,500,700,3e3,6e3],XC=[],Va=[],BT=1024,L5=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=Hw.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=BT,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=Hw.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(oi.Oh,0),this.vrm.expressionManager.setValue(oi.Ah,0),this.vrm.expressionManager.setValue(oi.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(oi.Oh,i),this.vrm.expressionManager.setValue(oi.Ah,r),this.vrm.expressionManager.setValue(oi.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(A){const u=new Float32Array(A.length);for(let f=0;f0&&(i[A]+=r[c]);i[A]/=Va[A+1]-Va[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=Va[A+1]-Va[A],s[A]=s[A]/(XC[A+1]-XC[A])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let A=0;A=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const uB=new Z;class nhe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new $e,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,A,c={x:window.innerWidth,y:window.innerHeight};return e<=c.x/2&&(o=c.x/2-e,a=o/(c.x/2)*100,i=r.maxx*a/100*-1),e>=c.x/2&&(o=e-c.x/2,a=o/(c.x/2)*100,i=r.minx*a/100),t<=c.y/2&&(l=c.y/2-t,A=l/(c.y/2)*100,s=r.maxy*.5*A/100*-1),t>=c.y/2&&(l=t-c.y/2,A=l/(c.y/2)*100,s=r.miny*A/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Lt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Lt.degToRad(s.y*r),e.rotation.x,o)}}update(){uB.set(0,0,1),uB.applyQuaternion(this.camera.quaternion);const e=uB.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class fB{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:A,requiredTraits:c,randomTraits:u,colliderTraits:f,lipSyncTraits:h,blinkerTraits:p,typeRestrictions:d,defaultCullingLayer:g,defaultCullingDistance:m,offset:y,vrmMeta:w,traits:x,textureCollections:_,colorCollections:C,canDownload:S=!0,downloadOptions:b={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ut(o),this.requiredTraits=ut(c),this.randomTraits=ut(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ut(f),this.lipSyncTraits=ut(h),this.blinkerTraits=ut(p),this.typeRestrictions=d,this.defaultCullingLayer=g,this.defaultCullingDistance=m,this.offset=y,this.canDownload=S,this.downloadOptions=b;const M=()=>{const H=[];for(const I in x)H.push(x[I].trait);return H};this.allTraits=M(),M(),(()=>{if(this.typeRestrictions)for(const H in this.typeRestrictions)ut(this.typeRestrictions[H]).forEach(v=>{this.typeRestrictions[v]==null&&(this.typeRestrictions[v]=[]),this.typeRestrictions[v].indexOf(H)==-1&&this.typeRestrictions[v].push(H)})})(),(()=>{b.vrmMeta=b.vrmMeta||w,b.scale=b.scale||a||1,b.mToonAtlasSize=b.mToonAtlasSize||2048,b.mToonAtlasSizeTransp=b.mToonAtlasSizeTransp||1024,b.stdAtlasSize=b.stdAtlasSize||2048,b.stdAtlasSizeTransp=b.stdAtlasSizeTransp||1024,b.exportStdAtlas=b.exportStdAtlas||!1,b.exportMtoonAtlas=b.exportMtoonAtlas||!0,b.screenshotFaceDistance=b.screenshotFaceDistance||1,b.screenshotFaceOffset=b.screenshotFaceOffset||[0,0,0],b.screenshotResolution=b.screenshotResolution||[512,512],b.screenshotBackground=b.screenshotBackground||[.1,.1,.1],b.screenshotFOV=b.screenshotFOV||75,!b.exportStdAtlas&&!b.exportMtoonAtlas&&(b.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(_),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(C),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(x)}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=ut(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new hB(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new hB(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new hB(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]),ut(e).forEach(r=>{this.modelTraits.push(new rhe(this,r))}),this.modelTraitsMap=new Map(this.modelTraits.map(r=>[r.trait,r])),this.modelTraits.forEach(r=>{r.restrictedTraits.forEach(i=>{const s=this.getModelGroup(i);console.log(s),s&&s.addTraitRestriction(r.trait)})})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),ut(e).forEach(r=>{this.textureTraits.push(new ihe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ut(e).forEach(r=>{this.colorTraits.push(new she(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class rhe{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:A,restrictedTraits:c=[],restrictedTypes:u=[]}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.restrictedTraits=c,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(A)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}addTraitRestriction(e){this.restrictedTraits.indexOf(e)==-1&&this.restrictedTraits.push(e)}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new Z3(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new Z3(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class ihe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new ohe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class she{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new ahe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class Z3{constructor(e,t){const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,colorCollection:u,fullDirectory:f,fullThumbnail:h}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,f)this.fullDirectory=f;else if(Array.isArray(i)){this.fullDirectory=[];for(let p=0;p0&&this.manifestData.restrictedTypes>0){haveCommonValue=(i,s)=>{if(i==null||s==null)return!1;for(let o=0;ohaveCommonValue(r[i],traitTypes))}return!1}}class ohe{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(Qa)}),Qa.z+=.3,Qa.y+=s,this.screenshotManager.setCamera(Qa,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&(A.userData.clippedIndexGeometry=A.geometry.index.clone(),A.geometry.setIndex(A.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&A.geometry.setIndex(A.userData.clippedIndexGeometry)})},o=(A,c)=>{for(let u=0;u{var d,g;const u=A.object,f=A.face,h=[f.a,f.b,f.c],p=(g=(d=u.userData)==null?void 0:d.clippedIndexGeometry)==null?void 0:g.array;if(p!=null){const m=o(p,h),y=Array.from(p);if(m==-1&&!c){const w=[...y,...h];u.userData.clippedIndexGeometry=new At(new Uint32Array(w),1,!1)}m!=1&&c&&(y.splice(m,3),u.userData.clippedIndexGeometry=new At(new Uint32Array(y),1,!1))}};dB.x=e,dB.y=t,i(),J3.setFromCamera(dB,this.renderCamera);const l=J3.intersectObjects(this.characterModel.children);if(l.length>0){const A=l[0];a(A,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new gy({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.isVrm0=!0,o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await zfe(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};Vfe(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(ut(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadTrait(e,t,r=!1){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getTraitOption(e,t);o&&(await this._loadTraits(ut(o),r),i())}catch(o){console.error("Error loading specific trait:",o.message),s(new Error("Failed to load specific trait."))}else{const o="No manifest was loaded, specific trait cannot be loaded.";console.error(o),s(new Error(o))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(ut(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await Pue(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new Qe(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new Qe(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new gy({traitGroupID:e,traitModel:null});this._addLoadedData(i),oB(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){oB(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new fB(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new fB(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new fB(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async soloTargetGroupTrait(e){const t=ut(e),r=[];for(const i in this.avatar)t.includes(i)&&r.push(this.manifestData.getTraitOption(i,this.avatar[i].traitInfo.id));await this._loadTraits(r,!0)}storeCurrentAvatar(){this.storedAvatar={...this.avatar}}async loadStoredAvatar(){const e=[];for(const t in this.storedAvatar)e.push(this.manifestData.getTraitOption(t,this.storedAvatar[t].traitInfo.id));console.log(e),this._loadTraits(e,!0)}async _loadTraits(e,t=!1){console.log("laoded traits:",e),await this.traitLoadManager.loadTraitOptions(ut(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new gy({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),oB(this.avatar)})}async _animationManagerSetup(e,t,r){const i=ut(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,!1,0,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(h=>h.name==="head")[0].getWorldPosition(Qa)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];Qa.x+=s[0],Qa.y+=s[1],Qa.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.setCamera(Qa,i,a);const c=e?this.screenshotManager.getScreenshotBlob(l,A):this.screenshotManager.getScreenshotTexture(l,A);return this.blinkManager.disableScreenshot(),c}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new Qe(o,a,l)},r=new Ei({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;if(e.userData.vrm==null)return console.error("No valid VRM was provided for "+r+" trait, skipping file."),null;if(k3(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&qfe(e),Hue(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new Hw(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"){if(o.humanoid.humanBones.hips.node.parent==o.scene){const A=new It;A.name="newRootNode",Lue(o.scene,A),A.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(A=>{var c;if(A.isSkinnedMesh){const u={},f=ut((c=A.geometry.userData)==null?void 0:c.targetNames);for(let h=0;h{const f=e.scene.getObjectByName(u);f!=null&&f.isMesh&&o.push(f)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const A=this.manifest,c=this.manifestData.getModelGroup(r);k3(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:c.cullingLayer!=null?c.cullingLayer:A.defaultCullingLayer!=null?A.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:c.cullingDistance!=null?c.cullingDistance:A.defaultCullingDistance!=null?A.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const h=i[f]||i[0];h!=null&&(u.material.type==="MeshStandardMaterial"?Array.isArray(u.material)?u.material.forEach(p=>{p.map=h}):u.material.map=h:console.warn("XXX set material texture to shader material",u.material))}if(s){const h=s[f]||s[0];h!=null&&(u.material[0].uniforms.litFactor.value=h,u.material[0].uniforms.shadeColorFactor.value=new Qe(h.r*.8,h.g*.8,h.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),Que(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),this.avatar[t]={});return}let A=null;o.map(c=>{c!=null&&(A=this._VRMBaseSetup(c,r,t,a,l))}),A!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(A),this._displayModel(A),this._applyManagers(A),console.log(this.characterModel),this.avatar[t]={traitInfo:r,textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class Ahe{constructor(){const e=new UH;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new QH(e);t.crossOrigin="anonymous",t.register(i=>new dce(i,{autoUpdateHumanBones:!0}));const r=new lu(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var c,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(ut((c=s==null?void 0:s.traitModel)==null?void 0:c.fullDirectory).map(async h=>{try{return await this.gltfLoader.loadAsync(h)}catch(p){return console.error(`Error loading modelsss ${h}:`,p),null}})),l=await Promise.all(ut((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(h=>new Promise(p=>{this.textureLoader.load(h,d=>{d.flipY=!1,d.encoding=pt,p(d)},null,d=>{console.error("error loading texture: ",d),p(null)})}))),A=ut((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new Qe(h));r[o]=new gy({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:A})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class gy{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function che(n){const e=new vw,t=new DH(16777215,.5);e.add(t);const r=new iT(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new It;e.add(i);const s=new Fr(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new lhe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new vg({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new one(s,l.domElement);A.minDistance=1,A.maxDistance=4,A.maxPolarAngle=Math.PI/2,A.enablePan=!0,A.target=new Z(0,1,0),A.enableDamping=!0,A.dampingFactor=.1;const c=new Z(-.5,0,-.5),u=new Z(.5,1.5,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputEncoding=pt;const h=()=>{requestAnimationFrame(h),A.target.clamp(c,u),A==null||A.update(),o.update(),l.render(e,s)};h();const p=g=>{const m=g.ctrlKey,y=a.getBoundingClientRect(),w=(g.clientX-y.left)/y.width*2-1,x=-((g.clientY-y.top)/y.height)*2+1;o.cameraRaycastCulling(w,x,m)};async function d(){}return d(),a.addEventListener("click",p),{scene:e,camera:s,controls:A,characterManager:o,sceneElements:i}}function xv(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var P5={exports:{}};/*! + `})}}const Nw=4096,rp=new Z;class tfe{constructor(e,t,r){const i=new vg({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new $e(Nw,Nw);i.setClearColor(0,0),i.outputEncoding=cs,i.setSize(s.x,s.y),i.setPixelRatio(window.devicePixelRatio);let o=s.clone().divideScalar(r);o.x|=0,o.y|=0;const a=new Zue(i);a.addPass(new Jue(e,t)),this._renderPixelPass=new que(o,e,t),this._pixelPass=new efe(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new $e(e,t).clone().divideScalar(this.pixelSize);i.x|=0,i.y|=0,this.renderer.setSize(e,t),this._renderPixelPass.setResolution(i),this._pixelPass.setResolution(i)}setPixelSize(e){this.pixelSize=e}render(){this.composer.render()}}class nfe{constructor(e,t){this.renderer=new vg({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputEncoding=pt,this.renderer.setSize(Nw,Nw),this.camera=new Fr(30,1,.1,1e3),this.textureLoader=new lu,this.sceneBackground=new Qe(.1,.1,.1),this.sceneBackgroundAlpha=1,this.frameOffset={min:.2,max:.2},this.usesBackgroundImage=!1,this.backgroundMaterial=new Ei({color:16777215,transparent:!0,opacity:.5});const r=new ou(1e3,1e3),i=new xn(r,this.backgroundMaterial);i.renderOrder=-1,this.backgroundPlane=i,this.pixelRenderer=new tfe(t,this.camera,20),this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setScene(e){this.scene=e}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=r}_getCharacterMinMax(){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY;return this.characterManager.characterModel.traverse(r=>{r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(r.geometry.boundingBox.applyMatrix4(r.matrixWorld),r.geometry.boundingBox.min.yt&&(t=r.geometry.boundingBox.max.y)))}),{minY:e,maxY:t}}frameCloseupShot(){this.frameShot("head","head")}frameMediumShot(){this.frameShot("chest","head")}frameCowboyShot(){this.frameShot("hips","head")}frameFullShot(){this.frameShot("leftFoot","head")}frameShot(e,t,r=null,i=!1,s=!0){const o=this._getBoneWorldPositionWithOffset(e,i),a=this._getBoneWorldPositionWithOffset(t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new Z(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}async calculateBoneOffsets(e){for(const t in this.boneOffsets){const r=await this._getMinMaxOffsetByBone(this.characterManager.characterModel,t,e);this.boneOffsets[t]=r}}_getBoneWorldPositionWithOffset(e,t){const r=this._getFirstBoneWithName(e);if(!r||!this.boneOffsets[e])return new Z;const i=new Z;r.getWorldPosition(i);const s=t?this.boneOffsets[e].max:this.boneOffsets[e].min;return i.y+=s.y,i}_getBoneWorldPosition(e){const t=this._getFirstBoneWithName(e);return t!=null?new Z().setFromMatrixPosition(t.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new Z(0,0,0))}_getFirstBoneWithName(e){let t=null;return this.characterManager.characterModel.traverse(r=>{if(r instanceof Al){if(!r.geometry){console.error("Invalid skinned mesh found in children.");return}const i=r.skeleton.bones.findIndex(s=>s.name===e);if(i!==-1){t=r.skeleton.bones[i];return}}}),t}setCameraFrameWithName(e,t){switch(e.toLowerCase()){case"fullshot":this.frameShot("leftFoot","head",t);break;case"cowboyshot":this.frameShot("hips","head",t);break;case"mediumshot":this.frameShot("chest","head",t);break;case"mediumcloseup":case"mediumcloseupshot":this.frameShot("chest","head",t,!0);break;case"closeup":case"closeupshot":this.frameShot("head","head",t);break;default:console.warn("unkown cameraFrame: "+e+". Please use fullShot, cowboyShot, mediumShot, mediumCloseup or closeup"),this.frameShot("leftFoot","head",t);break}}async _getMinMaxOffsetByBone(e,t,r){return new Promise(async(i,s)=>{(!e||!e.traverse)&&(console.error("Invalid parent object provided."),s(null));const o=new Z(1/0,1/0,1/0),a=new Z(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof Al&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let A=0;await(u=>new Promise(f=>setTimeout(f,u)))(10),e.traverse(u=>{if(u instanceof Al){if(!u.geometry){console.error("Invalid skinned mesh found in children.");return}const f=u.skeleton.bones.findIndex(g=>g.name===t);if(f===-1){console.error(`Bone with name '${t}' not found in one of the skinned meshes.`);return}const h=u.geometry.getAttribute("position"),p=u.geometry.getAttribute("skinWeight"),d=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const x=u.skeleton.bones[f],_=new Z().setFromMatrixPosition(x.matrixWorld),C=m.clone().sub(_);o.min(C),a.max(C)}}this._restoreSavedPose(l[A],u.skeleton),A++}}),i({min:o,max:a})})}_saveBonesPos(e){let t=[];return e.bones.forEach(r=>{t.push({position:r.position.clone(),rotation:r.rotation.clone(),scale:r.scale.clone()})}),t}_restoreSavedPose(e,t){e&&t.bones.forEach((r,i)=>{r.position.copy(e[i].position),r.rotation.copy(e[i].rotation),r.scale.copy(e[i].scale)})}positionCameraBetweenPoints(e,t,r,i=30){const s=new ps;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new Z).length()/(2*Math.tan(o/2));s.getCenter(rp),this.camera.position.copy(rp),r.y*=.5,this.camera.lookAt(rp.clone().sub(r));const A=new Z;this.camera.getWorldDirection(A),this.camera.position.addScaledVector(A,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,rp.set(0,0,-1),this.cameraDir=rp.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setBackground(e){if(Array.isArray(e)){const t=e[3]==null?1:e[3];this.setBackgroundColor(e[0],e[1],e[2],t)}else this.setBackgroundImage(e)}setBackgroundColor(e,t,r,i){const s=new Qe(e,t,r,i);this.sceneBackground=s,i==null&&(i=1),i>1&&(i=1),i<0&&(i=0),this.sceneBackgroundAlpha=i,this.backgroundMaterial.color=s,this.usesBackgroundImage=!1}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=As,this.sceneBackground=i,this.usesBackgroundImage=!0,this.sceneBackgroundAlpha=1,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}_setBackground(){if(this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1)if(this.sceneBackgroundAlpha==0)this.scene.background=null;else{this.scene.background=null,this.scene.add(this.backgroundPlane),this.backgroundPlane.position.copy(this.camera.position);var e=new Z(0,0,-1);e.applyQuaternion(this.camera.quaternion);var t=100;this.backgroundPlane.position.addScaledVector(e,t),this.backgroundPlane.lookAt(this.camera.position)}else this.scene.background=this.sceneBackground}_restoreBackground(){this.scene.background=null,this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1&&this.scene.remove(this.backgroundPlane)}getImageData(e,t,r=null){return this._createImage(e,t,r).split("base64,")[1]}_createImage(e,t,r=null){const i=e/t;typeof r=="number"&&this.pixelRenderer.setPixelSize(r),this.renderer.setSize(e,t),this.pixelRenderer.setSize(e,t);const s="image/png";this.camera.aspect=i,this.camera.updateProjectionMatrix();const o=typeof r=="number"?this.pixelRenderer:this.renderer;try{this._setBackground(),o.render(this.scene,this.camera);let a=o.domElement.toDataURL(s);return this._restoreBackground(),a}catch(a){return console.error(a),null}}savePixelScreenshot(e,t,r,i){this.pixelRenderer.setPixelSize(i),this.pixelRenderer.setSize(t,r);const s=this._createImage(t,r,!0),o="image/octet-stream",a="image/png";this.saveFile(s.replace(a,o),e+".png")}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new Qn(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=t6.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const rfe=2;class ife{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new OH,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=rfe,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(oi.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function E5(){return(E5=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let h=[],p=new DataView(new ArrayBuffer(24*n.levels.length)),d=(f||u+s.byteLength)+t.byteLength;for(let y=0;y0?f:0),!0),m.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(sp([new Uint8Array(Tr).buffer,g,p.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var VC,jC,ufe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},WC=new OffscreenCanvas(128,128),j3=WC.getContext("2d",{willReadFrequently:!0}),C5=typeof document>"u";function ffe(n){return createImageBitmap(n).then(function(e){return WC.width=e.width,WC.height=e.height,j3.drawImage(e,0,0),j3.getImageData(0,0,e.width,e.height)})}function hfe(n,e){return e===void 0&&(e={}),pfe().then(function(t){var r=new t.BasisEncoder;return dfe(e,r),r.setTexType(VC.cBASISTexType2D),ofe(n,ArrayBuffer)&&(n=new Blob([n])),ffe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,jC.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=lfe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=cfe(l,{keepWriter:!0})}return a})})}function dfe(n,e){n===void 0&&(n={}),(n=sfe({},ufe,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var lB=null;function pfe(){return lB||(lB=new Promise(function(n,e){C5?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),lB}C5&&self.addEventListener("message",function(n){hfe(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class mfe{constructor(e,t){if(this.gl=e,this.libktx=null,e!==void 0)if(t===void 0&&LIBKTX!==void 0&&(t=LIBKTX),t!==void 0)this.initializied=this.init(e,t);else{console.error("Failed to initalize KTXDecoder: ktx library undefined");return}else{console.error("Failed to initalize KTXDecoder: WebGL context undefined");return}}async init(e,t){this.libktx=await t({preinitializedWebGLContext:e}),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(e.canvas,{majorVersion:2}))}stringToUastcFlags(e){return e==="FASTER"?this.libktx.UastcFlags.LEVEL_FASTER.value:e==="FASTEST"?this.libktx.UastcFlags.LEVEL_FASTEST.value:e==="SLOWER"?this.libktx.UastcFlags.LEVEL_SLOWER.value:e==="SLOWEST"?this.libktx.UastcFlags.LEVEL_VERYSLOW.value:this.libktx.UastcFlags.LEVEL_DEFAULT.value}stringToSupercmpScheme(e){return e==="Zstd"?this.libktx.SupercmpScheme.ZSTD:e==="Zlib"?this.libktx.SupercmpScheme.ZLIB:e==="BasisLZ"?this.libktx.SupercmpScheme.BASIS_LZ:this.libktx.SupercmpScheme.NONE}transcodeRGBA(e){if(!e.needsTranscoding)return;const t=this.libktx.TranscodeTarget.RGBA8888;e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}transcode(e){if(e.gpuFormat="RGBA8888",e.needsTranscoding){let t,r=!1,i=!1,s=!1,o=!1,a=!1;r=!!this.gl.getExtension("WEBGL_compressed_texture_astc"),i=!!this.gl.getExtension("WEBGL_compressed_texture_etc1"),s=!!this.gl.getExtension("WEBGL_compressed_texture_s3tc"),o=!!this.gl.getExtension("EXT_texture_compression_bptc"),a=!!this.gl.getExtension("WEBGL_compressed_texture_pvrtc")||!!this.gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),r?(t=this.libktx.TranscodeTarget.ASTC_4x4_RGBA,e.gpuFormat="ASTC_4x4_RGBA"):o?(t=this.libktx.TranscodeTarget.BC7_RGBA,e.gpuFormat="BC7_RGBA"):s?(t=this.libktx.TranscodeTarget.BC1_OR_3,e.gpuFormat="BC1_OR_3"):a?(t=this.libktx.TranscodeTarget.PVRTC1_4_RGBA,e.gpuFormat="PVRTC1_4_RGBA"):i?(t=this.libktx.TranscodeTarget.ETC,e.gpuFormat="ETC"):(t=this.libktx.TranscodeTarget.RGBA8888,e.gpuFormat="RGBA8888"),e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}}async loadKtxFromUri(e){await this.initializied;const t=await fetch(e),r=new Uint8Array(await t.arrayBuffer()),i=new this.libktx.ktxTexture(r);this.transcode(i);let s=i.glUpload();if(s.texture==null){console.error("Could not load KTX data");return}return s.texture.levels=Math.log2(i.baseWidth),s.texture.width=i.baseWidth,s.texture.height=i.baseHeight,s.texture.gpuSize=i.dataSize,s.texture.gpuFormat=i.gpuFormat,s.texture.isSRGB=i.isSRGB,s.texture}async loadKtxFromBuffer(e){await this.initializied;const t=new this.libktx.ktxTexture(e);this.transcode(t);const r=t.glUpload();if(r.texture==null){console.error("Could not load KTX data");return}return r.texture.levels=Math.log2(t.baseWidth),r.texture.width=t.baseWidth,r.texture.height=t.baseHeight,r.texture.gpuSize=t.dataSize,r.texture.gpuFormat=t.gpuFormat,r.texture.isSRGB=t.isSRGB,r.texture}async compress(e,t,r,i,s={}){const o=new this.libktx.ktxTexture(e,t,r,i,s.srgb);if(!s.hasOwnProperty("basisu_options")){const A=new this.libktx.ktxBasisParams;A.uastc=!1,A.noSSE=!0,A.verbose=!1,A.qualityLevel=100,A.compressionLevel=2,s.basisu_options=A}s.hasOwnProperty("compression_level")||(s.compression_level=18),s.hasOwnProperty("supercmp_scheme")||(s.supercmp_scheme=this.libktx.SupercmpScheme.NONE),console.log(s);const a=o.compressBasisU(s.basisu_options,s.supercmp_scheme,s.compression_level);return Uint8ClampedArray.from(a)}}class gfe{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new mfe(t,window.LIBKTX);await r.init(t,window.LIBKTX),this.ktxEncoder=r,this.libktx=r.libktx}async compress(e,t,r,i,s={}){const o=await new this.libktx.ktxBasisParams,a=s;return o.uastc=a.uastc!==void 0?a.uastc:!1,o.noSSE=a.noSSE!==void 0?a.noSSE:!1,o.verbose=a.verbose!==void 0?a.verbose:!1,o.normalMap=a.normalMap!==void 0?a.normalMap:!1,o.compressionLevel=a.compressionLevel!==void 0?a.compressionLevel:1,o.qualityLevel=a.qualityLevel!==void 0?a.qualityLevel:60,o.maxEndpoints=a.ETC1SmaxEndpoints!==void 0?a.ETC1SmaxEndpoints:0,o.endpointRDOThreshold=a.ETC1SEndpointRdoThreshold!==void 0?a.ETC1SEndpointRdoThreshold:1.25,o.maxSelectors=a.ETC1SMaxSelectors!==void 0?a.ETC1SMaxSelectors:0,o.selectorRDOThreshold=a.ETC1SSelectorRdoThreshold!==void 0?a.ETC1SSelectorRdoThreshold:1.25,o.noEndpointRDO=a.ETC1SNoEndpointRdo!==void 0?a.ETC1SNoEndpointRdo:!1,o.noSelectorRDO=a.ETC1SNoSelectorRdo!==void 0?a.ETC1SNoSelectorRdo:!1,o.uastcFlags=this.ktxEncoder.stringToUastcFlags(a.uastcFlags),o.uastcRDO=o.uastcRDO!==void 0?o.uastcRDO:!1,o.uastcRDOQualityScalar=a.uastcRDOQualityScalar!==void 0?a.uastcRDOQualityScalar:1,o.uastcRDODictSize=a.uastcRDODictSize!==void 0?a.uastcRDOQualityScalar:4096,o.uastcRDOMaxSmoothBlockErrorScale=a.uastcRDOMaxSmoothBlockErrorScale!==void 0?a.uastcRDOMaxSmoothBlockErrorScale:10,o.uastcRDOMaxSmoothBlockStdDev=a.uastcRDOMaxSmoothBlockStdDev!==void 0?a.uastcRDOMaxSmoothBlockStdDev:18,o.uastcRDODontFavorSimplerModes=a.uastcRDODontFavorSimplerModes!==void 0?a.uastcRDODontFavorSimplerModes:!1,s.basisu_options=o,s.hasOwnProperty("supercmp_scheme")?s.supercmp_scheme=this.ktxEncoder.stringToSupercmpScheme(s.supercmp_scheme):s.supercmp_scheme=this.libktx.SupercmpScheme.NONE,await this.ktxEncoder.compress(e,t,r,i,s)}}var Dn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Dn||(Dn={}));const KC="blend_",W3="vrmColliderSphere";function vfe(n){var e;return{title:n.name,version:"v0",author:((e=n.authors)==null?void 0:e.length)>0?n.authors.join(", "):"",reference:n.references!=null?n.references.join(", "):"",contactInformation:n.contactInformation!=null?n.contactInformation:"",otherPermissionUrl:n.otherPermissionUrl,allowedUserName:n.avatarPermission!=null?n.avatarPermission:"",violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:n.commercialUsage=="personalProfit"||n.commercialUsage=="corporation"?"Allow":"Disallow",licenseName:n.copyrightInformation,otherLicenseUrl:n.otherLicenseUrl,metaVersion:"0"}}function yfe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function wfe(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function xfe(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class _fe{async parse(e,t,r,i,s,o,a){var be;const l=vfe(e.meta),A=yfe(e.humanoid),c=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(A)if(l){if(!c)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=c.filter((N,j,se)=>se.findIndex(he=>he.name===N.name.replace(" (Outline)",""))===j).map(N=>N),p=h.map(N=>N.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(N=>N.map).map(N=>{if(!N.map)throw new Error(N.name+" map is null");return{name:N.name,imageBitmap:N.map.image}}),m=h.filter(N=>N.userData.shadeTexture).map(N=>{if(!N.userData.shadeTexture)throw new Error(N.userData.shadeTexture+" map is null");return{name:N.name+"_shade",imageBitmap:N.userData.shadeTexture.image}}),y=h.filter(N=>N.roughnessMap).map(N=>N.roughnessMap?{name:N.name+"_orm",imageBitmap:N.roughnessMap.image}:null),w=h.filter(N=>N.roughnessMap).map(N=>N.normalMap?{name:N.name+"_normal",imageBitmap:N.normalMap.image}:null),x=[...g,...m,...y,...w].filter(N=>N!==null),_=Mfe(x,d,s?"image/ktx2":"image/png"),C=Tfe(_),S=Ife(_,s),b=Sfe(h,x),M=t.children.filter(N=>N.children.length>0&&N.children[0].type===li.Bone)[0],D=S5(M).filter(N=>N.name!==W3),$=D.map(N=>N.name),H=D.map(N=>{const j=N.children.filter(se=>se.name!==W3).map(se=>$.indexOf(se.name));return{name:N.name,rotation:[N.quaternion.x,N.quaternion.y,N.quaternion.z,N.quaternion.w],scale:[N.scale.x,N.scale.y,N.scale.z],translation:[N.position.x,N.position.y,N.position.z],children:j.length>0?j:void 0}}),I=[],v=t.children.filter(N=>N.type===li.Group||N.type===li.SkinnedMesh),E=[];v.forEach((N,j)=>{const se=N.type===li.Group?N.children[0]:N,he=se.geometry.attributes,me=new Gl(he.position,Dn.FLOAT,Kt.POSITION,zo.VEC3,se.name,void 0);E.push(me);const G=E.length-1,R=he.normal.array,T=new Float32Array(R.length);for(let ie=0;ieie):[N]).forEach(ie=>{if(!ie.geometry.index)throw new Error(ie.name+" geometry.index is null");E.push(new Gl(ie.geometry.index,Dn.UNSIGNED_INT,Kt.INDEX,zo.SCALAR,se.name,ie.name))}),se.morphTargetDictionary||(se.morphTargetDictionary={},se.morphTargetInfluences=[],se.geometry.morphAttributes={},se.updateMorphTargets()),se.geometry.userData.targetNames=[];const ae=(ie,Te,Me,Le)=>{const ke=[],De=[];for(let fe=0;fe0){const fe=[...ke].sort((Fe,We)=>Fe-We),Ce=[];for(let Fe=0;Fe({mesh:0,index:he.index,weight:he.weight*100}));if(se.length>0){let he=!1;for(const me in oi)if(N===oi[me]&&N!=="surprised"){u.push({name:N,presetName:wfe(N),binds:se,isBinary:j.isBinary}),he=!0;break}he===!1&&u.push({name:N,presetName:"unknown",binds:se,isBinary:j.isBinary})}}v.forEach(N=>{const j=N.type===li.Group?N.children[0]:N,se=new Float32Array(j.skeleton.boneInverses.map(he=>he.elements).flat());E.push(new Gl(new At(se,16),Dn.FLOAT,Kt.BIND_MATRIX,zo.MAT4,j.name,j.name))}),I.push(...E.map(N=>({componentType:N.valueType,count:N.attribute.count,max:N.max,min:N.min,normalized:!1,type:N.accessorsType})));const U=Efe(v,E,p);v.forEach((N,j)=>{H.push({mesh:j,name:N.name,rotation:[N.quaternion.x,N.quaternion.y,N.quaternion.z,N.quaternion.w],scale:[N.scale.x,N.scale.y,N.scale.z],skin:j,translation:[N.position.x,N.position.y,N.position.z]})});const P=Cfe(v,E,$),L={humanBones:[]};A.humanBones.forEach(N=>{$.indexOf(N.node.name)!=-1&&L.humanBones.push({bone:xfe(N.bone),node:$.indexOf(N.node.name),useDefaultValues:!0})});const z={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},K={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},O=[];h.forEach(N=>{N.type=="ShaderMaterial"?O.push(Object.assign({},z)):O.push(Object.assign({},K))});const B=l;i.forEach(N=>{for(let j=0;jN.isSkinnedMesh))==null?void 0:be.skeleton)||null;for(let N=0;N{const me=he.sphere;se.colliders.push({radius:me.radius*o,offset:{x:me.offset[0]*o,y:me.offset[1]*o,z:me.offset[2]*o}})}),W.push(se)}}console.log("COLLIDER GROUPS",W);const F=N=>{for(let j=0;j{var G;const j=F(N.name);if(j===-1){console.warn("Spring bone "+N.name+" was removed during cleanup process. Skipping.");return}const se=[];N.colliderGroups.forEach(R=>{const T=R.colliders[0];if(T!=null){const V=T.parent,te=W.findIndex(ae=>ae.name===V.name);te!=-1&&(se.includes(te)||se.push(te))}});let he=F((G=N.center)==null?void 0:G.name);he==-1&&console.warn("no center bone for spring bone "+N.name);const me=N.settings;X.push({bones:[j],center:he,colliderGroups:se,dragForce:me.dragForce,gravityDir:{x:me.gravityDir.x,y:me.gravityDir.y,z:me.gravityDir.z},gravityPower:me.gravityPower,hitRadius:me.hitRadius,stiffiness:me.stiffness})});const ue={boneGroups:X,colliderGroups:W};console.log(ue),B.texture=d?_.length-1:void 0;const le=await Promise.all(x.map(async N=>({buffer:s?await K3(N.imageBitmap):$3(N.imageBitmap),type:Kt.IMAGE})));E.forEach((N,j)=>{N.buffer?le.push({buffer:N.buffer,typeString:"",type:N.type}):N.sparse&&(le.push({buffer:N.sparse.indices,typeString:"indices",type:N.type,count:N.sparse.count}),le.push({buffer:N.sparse.values,typeString:"values",type:N.type})),le.length-1}),d&&le.push({buffer:s?await K3(d.imageBitmap):$3(d.imageBitmap),type:Kt.IMAGE});let oe=0,re=0,pe=0,_e=0;const Re=le.map(N=>{const j={buffer:0,byteLength:N.buffer.byteLength,byteOffset:oe,target:N.type===Kt.IMAGE||N.type===Kt.BIND_MATRIX||N.typeString==="indices"||N.typeString==="values"?void 0:N.type===Kt.INDEX?Dn.ELEMENT_ARRAY_BUFFER:Dn.ARRAY_BUFFER};return oe+=N.buffer.byteLength,N.type===Kt.IMAGE?(_[re++].bufferView=_e,_e++):E[pe].sparse?(I[pe].sparse==null&&(I[pe].sparse={}),N.typeString==="indices"&&(I[pe].sparse.count=N.count,I[pe].sparse[N.typeString]={bufferView:_e,byteOffset:0,componentType:Dn.UNSIGNED_INT}),N.typeString==="values"&&(I[pe].sparse[N.typeString]={bufferView:_e,byteOffset:0}),N.typeString==="values"&&pe++,_e++):(E[pe].bufferIndex=_e,I[pe].bufferView=_e,pe++,_e++),j}),Q=Rfe(t,H);bfe(B);const de=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&de.push("KHR_texture_basisu");const Ae={accessors:I,asset:f,buffers:[{byteLength:oe}],bufferViews:Re,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new Z,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:O,humanoid:L,meta:B,secondaryAnimation:ue,specVersion:"0.0"}},extensionsUsed:de,images:_,materials:b,meshes:U,nodes:H,samplers:C,scenes:Q,skins:P,textures:S};console.log("output",Ae);const q=new Y3(YC(JSON.stringify(Ae,void 0,2)),"JSON"),J=new Y3(Pp(le.map(N=>N.buffer)),"BIN\0"),ce=Pp([q.buffer,J.buffer]),xe=Pp([YC("glTF"),$C(2,4),$C(ce.byteLength+12,4)]);a(Pp([xe,ce]))}}function bfe(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function S5(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>S5(e)).flat())}const Bfe=new gfe;async function K3(n){const e=await createImageBitmap(n),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0);const i=r.getImageData(0,0,t.width,t.height),s=new Uint8Array(i.data.buffer);return await Bfe.compress(s,t.width,t.height,4,{normalMap:!1,uastc:!1,qualityLevel:50,compressionLevel:2,uastcFlags:"DEFAULT",compressionUASTC_Rdo_Level:18,uastcRDO:!1,uastcRDOQualityScalar:1,uastcRDODictSize:4096,uastcRDOMaxSmoothBlockErrorScale:10,uastcRDOMaxSmoothBlockStdDev:18,uastcRDODontFavorSimplerModes:!1,ETC1SQualityLevel:128,ETC1SmaxEndpoints:0,ETC1SEndpointRdoThreshold:1.25,ETC1SMaxSelectors:0,ETC1SSelectorRdoThreshold:1.25,ETC1SNoEndpointRdo:!1,ETC1SNoSelectorRdo:!1,supercmp_scheme:"Zstd"})}function $3(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Dn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Dn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class Y3{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Pp([$C(r.byteLength,4),YC(this.type),r])}padBuffer(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),new Uint8Array(i).fill(t,e.byteLength),i}}const X3=n=>{const e=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],t=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;rn.map(r=>{const i=r.type===li.Group?r.children[0]:r,s=r.type===li.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Kt.SKIN_INDEX),NORMAL:a.indexOf(Kt.NORMAL),POSITION:a.indexOf(Kt.POSITION),TEXCOORD_0:a.indexOf(Kt.UV),WEIGHTS_0:a.indexOf(Kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>{const c=e.map(h=>h.type===Kt.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(KC+A),u=e.map(h=>h.type===Kt.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(KC+A),f={};return u!==-1&&(f.POSITION=u),c!==-1&&(f.NORMAL=c),f}):void 0}})}}),Cfe=(n,e,t)=>n.map(r=>{const i=r.type===li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Kt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Sfe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(p=>p.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const h=t;r=h.color?[h.color.r,h.color.g,h.color.b,1]:void 0}let s=-1;t.map?s=e.map(h=>h.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(h=>h.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(h=>h.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(h=>h.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,A={baseColorFactor:r,baseColorTexture:l},c=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(c)A.metallicRoughnessTexture=c;else{const h=(()=>{switch(t.type){case Kf.MeshStandardMaterial:return t.metalness;case Kf.MeshBasicMaterial:return 0;default:return 0}})(),p=(()=>{switch(t.type){case Kf.MeshStandardMaterial:return t.roughness;case Kf.MeshBasicMaterial:return .9;default:return .9}})();A.metallicFactor=h,A.roughnessFactor=p}const f={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{}}:void 0,name:t.name,pbrMetallicRoughness:A};return u&&(f.normalTexture=u),f}),Mfe=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),Tfe=n=>n.map(()=>({magFilter:Dn.LINEAR,minFilter:Dn.LINEAR,wrapS:Dn.REPEAT,wrapT:Dn.REPEAT})),Ife=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),Rfe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===li.Object3D||r.type===li.SkinnedMesh||r.type===li.Group||r.type===li.Bone).map(r=>t.indexOf(r.name))}]};function Ffe(n,e,t){var a,l;const r=[],i=[];for(const A in n)((l=(a=n[A])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[A].vrm.meta.authors!=null?i.push(n[A].vrm.meta):r.push(n[A].vrm.meta));r.length+i.length==1&&(r.length==1?r[0].title!=null&&(t=r[0].title):i[0].name!=null&&(t=i[0].name)),e!=null&&(e.authors!=null?i.push(e):r.push(e));const s=Lfe(r),o=Ufe(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function Ufe(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:A="",avatarPermission:c=void 0,otherPermissionUrl:u=[]}=n,f,h,p,d="unnecessary",g,m=[];e.forEach(b=>{t=t.concat(ct(b.authors)),r=r.concat(ct(b.otherLicenseUrl)),i=i.concat(ct(b.contactInformation)),s=s.concat(ct(b.references)),u=u.concat(ct(b.otherPermissionUrl)),b.allowExcessivelyViolentUsage===!1&&(o=!1),b.allowExcessivelySexualUsage===!1&&(a=!1),l=qa(Ofe,l,b.commercialUsage),A=qa(M5,A,b.copyrightInformation),c=qa(Nfe,c,b.avatarPermission),b.allowAntisocialOrHateUsage===!1&&(f=f=!1),b.allowPoliticalOrReligiousUsage===!1&&(h=h=!1),b.allowRedistribution===!1&&(p=p=!1),b.creditNotation==="required"&&(d="required"),m=m.concat(ct(b.thirdPartyLicenses)),g=qa(Dfe,g,b.modification)});const y=[...new Set(t)].filter(b=>b!=""&&b!=null&&b!="undefined"),w=[...new Set(r)].filter(b=>b!=""&&b!=null&&b!="undefined"),x=[...new Set(i)].filter(b=>b!=""&&b!=null&&b!="undefined"),_=[...new Set(s)].filter(b=>b!=""&&b!=null&&b!="undefined"),C=[...new Set(u)].filter(b=>b!=""&&b!=null&&b!="undefined"),S=[...new Set(m)].filter(b=>b!=""&&b!=null&&b!="undefined");return{authors:y,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:x.length==0?"":x.join(", "),references:_,otherPermissionUrl:C.length==0?"":C.join(", "),thirdPartyLicenses:S.length==0?"":S.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:A,avatarPermission:c,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:p,creditNotation:d,modification:g}}function Lfe(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,A,c;n.forEach(g=>{e=e.concat(ct(g.author)),t=t.concat(ct(g.contactInformation)),r=r.concat(ct(g.reference)),i=i.concat(ct(g.otherPermissionUrl)),s=s.concat(ct(g.otherLicenseUrl)),o=qa(kfe,o,g.allowedUsername),a=qa(cB,a,g.violentUssageName),l=qa(cB,l,g.sexualUssageName),A=qa(cB,A,g.commercialUssageName),c=qa(M5,c,g.licenseName)});const u=[...new Set(e)].filter(g=>g!=""&&g!=null&&g!="undefined"),f=[...new Set(t)].filter(g=>g!=""&&g!=null&&g!="undefined"),h=[...new Set(r)].filter(g=>g!=""&&g!=null&&g!="undefined"),p=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:d,contactInformation:f,references:h,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:A==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:c,avatarPermission:Pfe(o),otherPermissionUrl:p}}function Pfe(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const Dfe={prohibited:0,allowModification:1,allowModificationRedistribution:2},Ofe={personalNonProfit:0,personalProfit:1,corporation:2},Nfe={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},kfe={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},cB={Disallow:0,Allow:1},M5={Redistribution_Prohibited:0,Other:1,CC_BY_NC_ND:2,CC_BY_ND:3,CC_BY_NC_SA:4,CC_BY_SA:5,CC_BY_NC:6,CC_BY:7,CC0:8};function qa(n,e,t){return e===void 0?t:t==null||!(t in n)||n[e]{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function Qfe(n){const e=T5(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=m5(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new kh,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new Ur;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function Hfe(n,e,t){const r=await bT(n,t),i=await I5(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function zfe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;Gfe(n,e,r).then(a=>{F5(a,`${o}.vrm`),i()})})}async function Gfe(n,e,t){const r=await bT(n,t);return I5(r,e,t)}function bT(n,e){const t=T5(n),{createTextureAtlas:r=!0}=e;return r?Tue(t,e):(console.log("no atlas"),Cue(t,e))}async function Vfe(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await bT(n,t):Qfe(n);jfe(s).then(o=>{if(o instanceof ArrayBuffer)F5(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);Xfe(a,`${r}.gltf`)}})}function jfe(n){return new Promise(e=>new aT().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function Wfe(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(A=>A.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in Km)if(s.bone.parent.name==Km[o]){t.push(s);break}}),t}function Kfe(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Km)if(Km[r]===t.name){e[t.name]={node:t};break}}),e}function $fe(n,e){const t=zh(n,"SkinnedMesh");return{humanBones:Kfe(t[0]),materials:n.userData.atlasMaterial,meta:Yfe(e)}}function Yfe(n){return n=n||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:"CharacterCreator",licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...n}}function I5(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=Ffe(e,s,a);return new Promise(async A=>{const c=i?new _fe:new wce,u={...Jfe(e),...$fe(n,l)};let f;n.traverse(d=>{d.isSkinnedMesh&&(f=d)}),(()=>{for(let d=0;d{d.updateMatrix(),d.updateMatrixWorld()}),f.skeleton.calculateInverses(),f.skeleton.computeBoneTexture(),f.skeleton.update()})(),f.skeleton.bones.filter(d=>d.name==="head")[0];const p=Wfe(e);c.parse(u,n,r,p,t.ktxCompression,o,d=>{A(d)})})}function R5(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function Xfe(n,e){R5(new Blob([n],{type:"text/plain"}),e)}function F5(n,e){R5(Zfe(n),e)}function Zfe(n){return new Blob([n],{type:"application/octet-stream"})}function Jfe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}const qfe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?ehe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?the(n):console.warn("No valid vrm file was provided")},ehe=n=>{var a,l,A;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:A.colliderGroups,s=[],o=r.map(c=>U5(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],f=_5(t,u);if(f!=null){const h=c.colliders;f.userData.VRMcolliders=h.map(p=>({sphere:{radius:p.radius,offset:[p.offset.x,p.offset.y,p.offset.z]}}))}f.userData.VRMcollidersID=w5()})},the=n=>{var l,A,c,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:A.colliderGroups,s=(u=(c=e.extensions)==null?void 0:c.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>U5(f.name,o));i!=null&&i.forEach(f=>{const h=ct(f.colliders);let p=-1,d=null;h.forEach(g=>{if(p!=s[g].node){p=s[g].node;const m=a[p];d=_5(t,m),d.userData.VRMcolliders=[]}if(d!=null){const m=s[g].shape;for(const y in m){const w=m[y];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}d.userData.VRMcollidersID=w5(),d.userData.VRMcolliders.push(m)}else console.error("no node with name "+a[p]+" was found")})})},U5=(n,e)=>{const t=_t.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},kw=[0,400,560,2400,4800],Qw=[0,500,700,3e3,6e3],XC=[],Va=[],BT=1024,L5=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=Hw.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=BT,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=Hw.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(oi.Oh,0),this.vrm.expressionManager.setValue(oi.Ah,0),this.vrm.expressionManager.setValue(oi.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(oi.Oh,i),this.vrm.expressionManager.setValue(oi.Ah,r),this.vrm.expressionManager.setValue(oi.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(A){const u=new Float32Array(A.length);for(let f=0;f0&&(i[A]+=r[c]);i[A]/=Va[A+1]-Va[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=Va[A+1]-Va[A],s[A]=s[A]/(XC[A+1]-XC[A])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let A=0;A=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const uB=new Z;class nhe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new $e,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,A,c={x:window.innerWidth,y:window.innerHeight};return e<=c.x/2&&(o=c.x/2-e,a=o/(c.x/2)*100,i=r.maxx*a/100*-1),e>=c.x/2&&(o=e-c.x/2,a=o/(c.x/2)*100,i=r.minx*a/100),t<=c.y/2&&(l=c.y/2-t,A=l/(c.y/2)*100,s=r.maxy*.5*A/100*-1),t>=c.y/2&&(l=t-c.y/2,A=l/(c.y/2)*100,s=r.miny*A/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Lt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Lt.degToRad(s.y*r),e.rotation.x,o)}}update(){uB.set(0,0,1),uB.applyQuaternion(this.camera.quaternion);const e=uB.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class fB{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:A,requiredTraits:c,randomTraits:u,colliderTraits:f,lipSyncTraits:h,blinkerTraits:p,typeRestrictions:d,defaultCullingLayer:g,defaultCullingDistance:m,offset:y,vrmMeta:w,traits:x,textureCollections:_,colorCollections:C,canDownload:S=!0,downloadOptions:b={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ct(o),this.requiredTraits=ct(c),this.randomTraits=ct(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ct(f),this.lipSyncTraits=ct(h),this.blinkerTraits=ct(p),this.typeRestrictions=d,this.defaultCullingLayer=g,this.defaultCullingDistance=m,this.offset=y,this.canDownload=S,this.downloadOptions=b;const M=()=>{const H=[];for(const I in x)H.push(x[I].trait);return H};this.allTraits=M(),M(),(()=>{if(this.typeRestrictions)for(const H in this.typeRestrictions)ct(this.typeRestrictions[H]).forEach(v=>{this.typeRestrictions[v]==null&&(this.typeRestrictions[v]=[]),this.typeRestrictions[v].indexOf(H)==-1&&this.typeRestrictions[v].push(H)})})(),(()=>{b.vrmMeta=b.vrmMeta||w,b.scale=b.scale||a||1,b.mToonAtlasSize=b.mToonAtlasSize||2048,b.mToonAtlasSizeTransp=b.mToonAtlasSizeTransp||1024,b.stdAtlasSize=b.stdAtlasSize||2048,b.stdAtlasSizeTransp=b.stdAtlasSizeTransp||1024,b.exportStdAtlas=b.exportStdAtlas||!1,b.exportMtoonAtlas=b.exportMtoonAtlas||!0,b.screenshotFaceDistance=b.screenshotFaceDistance||1,b.screenshotFaceOffset=b.screenshotFaceOffset||[0,0,0],b.screenshotResolution=b.screenshotResolution||[512,512],b.screenshotBackground=b.screenshotBackground||[.1,.1,.1],b.screenshotFOV=b.screenshotFOV||75,!b.exportStdAtlas&&!b.exportMtoonAtlas&&(b.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(_),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(C),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(x)}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=ct(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new hB(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new hB(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new hB(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]),ct(e).forEach(r=>{this.modelTraits.push(new rhe(this,r))}),this.modelTraitsMap=new Map(this.modelTraits.map(r=>[r.trait,r])),this.modelTraits.forEach(r=>{r.restrictedTraits.forEach(i=>{const s=this.getModelGroup(i);console.log(s),s&&s.addTraitRestriction(r.trait)})})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),ct(e).forEach(r=>{this.textureTraits.push(new ihe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ct(e).forEach(r=>{this.colorTraits.push(new she(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class rhe{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:A,restrictedTraits:c=[],restrictedTypes:u=[]}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.restrictedTraits=c,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(A)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}addTraitRestriction(e){this.restrictedTraits.indexOf(e)==-1&&this.restrictedTraits.push(e)}createCollection(e,t=!1){t&&(this.collection=[]),ct(e).forEach(r=>{this.collection.push(new Z3(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new Z3(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class ihe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ct(e).forEach(r=>{this.collection.push(new ohe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class she{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ct(e).forEach(r=>{this.collection.push(new ahe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class Z3{constructor(e,t){const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,colorCollection:u,fullDirectory:f,fullThumbnail:h}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,f)this.fullDirectory=f;else if(Array.isArray(i)){this.fullDirectory=[];for(let p=0;p0&&this.manifestData.restrictedTypes>0){haveCommonValue=(i,s)=>{if(i==null||s==null)return!1;for(let o=0;ohaveCommonValue(r[i],traitTypes))}return!1}}class ohe{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(Qa)}),Qa.z+=.3,Qa.y+=s,this.screenshotManager.setCamera(Qa,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&(A.userData.clippedIndexGeometry=A.geometry.index.clone(),A.geometry.setIndex(A.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&A.geometry.setIndex(A.userData.clippedIndexGeometry)})},o=(A,c)=>{for(let u=0;u{var d,g;const u=A.object,f=A.face,h=[f.a,f.b,f.c],p=(g=(d=u.userData)==null?void 0:d.clippedIndexGeometry)==null?void 0:g.array;if(p!=null){const m=o(p,h),y=Array.from(p);if(m==-1&&!c){const w=[...y,...h];u.userData.clippedIndexGeometry=new At(new Uint32Array(w),1,!1)}m!=1&&c&&(y.splice(m,3),u.userData.clippedIndexGeometry=new At(new Uint32Array(y),1,!1))}};dB.x=e,dB.y=t,i(),J3.setFromCamera(dB,this.renderCamera);const l=J3.intersectObjects(this.characterModel.children);if(l.length>0){const A=l[0];a(A,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new gy({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.isVrm0=!0,o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await zfe(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};Vfe(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(ct(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadTrait(e,t,r=!1){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getTraitOption(e,t);o&&(await this._loadTraits(ct(o),r),i())}catch(o){console.error("Error loading specific trait:",o.message),s(new Error("Failed to load specific trait."))}else{const o="No manifest was loaded, specific trait cannot be loaded.";console.error(o),s(new Error(o))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(ct(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await Pue(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new Qe(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new Qe(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new gy({traitGroupID:e,traitModel:null});this._addLoadedData(i),oB(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){oB(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new fB(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new fB(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new fB(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async soloTargetGroupTrait(e){const t=ct(e),r=[];for(const i in this.avatar)t.includes(i)&&r.push(this.manifestData.getTraitOption(i,this.avatar[i].traitInfo.id));await this._loadTraits(r,!0)}storeCurrentAvatar(){this.storedAvatar={...this.avatar}}async loadStoredAvatar(){const e=[];for(const t in this.storedAvatar)e.push(this.manifestData.getTraitOption(t,this.storedAvatar[t].traitInfo.id));console.log(e),this._loadTraits(e,!0)}async _loadTraits(e,t=!1){console.log("laoded traits:",e),await this.traitLoadManager.loadTraitOptions(ct(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new gy({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),oB(this.avatar)})}async _animationManagerSetup(e,t,r){const i=ct(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,!1,0,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(h=>h.name==="head")[0].getWorldPosition(Qa)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];Qa.x+=s[0],Qa.y+=s[1],Qa.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.setCamera(Qa,i,a);const c=e?this.screenshotManager.getScreenshotBlob(l,A):this.screenshotManager.getScreenshotTexture(l,A);return this.blinkManager.disableScreenshot(),c}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new Qe(o,a,l)},r=new Ei({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;if(e.userData.vrm==null)return console.error("No valid VRM was provided for "+r+" trait, skipping file."),null;if(k3(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&qfe(e),Hue(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new Hw(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"){if(o.humanoid.humanBones.hips.node.parent==o.scene){const A=new It;A.name="newRootNode",Lue(o.scene,A),A.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(A=>{var c;if(A.isSkinnedMesh){const u={},f=ct((c=A.geometry.userData)==null?void 0:c.targetNames);for(let h=0;h{const f=e.scene.getObjectByName(u);f!=null&&f.isMesh&&o.push(f)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const A=this.manifest,c=this.manifestData.getModelGroup(r);k3(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:c.cullingLayer!=null?c.cullingLayer:A.defaultCullingLayer!=null?A.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:c.cullingDistance!=null?c.cullingDistance:A.defaultCullingDistance!=null?A.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const h=i[f]||i[0];h!=null&&ct(u.material).map(p=>{che(p,h)})}if(s){const h=s[f]||s[0];h!=null&&(u.material[0].uniforms.litFactor.value=h,u.material[0].uniforms.shadeColorFactor.value=new Qe(h.r*.8,h.g*.8,h.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),Que(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),this.avatar[t]={});return}let A=null;o.map(c=>{c!=null&&(A=this._VRMBaseSetup(c,r,t,a,l))}),A!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(A),this._displayModel(A),this._applyManagers(A),console.log(this.characterModel),this.avatar[t]={traitInfo:r,textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class Ahe{constructor(){const e=new UH;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new QH(e);t.crossOrigin="anonymous",t.register(i=>new dce(i,{autoUpdateHumanBones:!0}));const r=new lu(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var c,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(ct((c=s==null?void 0:s.traitModel)==null?void 0:c.fullDirectory).map(async h=>{try{return await this.gltfLoader.loadAsync(h)}catch(p){return console.error(`Error loading modelsss ${h}:`,p),null}})),l=await Promise.all(ct((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(h=>new Promise(p=>{this.textureLoader.load(h,d=>{d.flipY=!1,d.encoding=pt,p(d)},null,d=>{console.error("error loading texture: ",d),p(null)})}))),A=ct((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new Qe(h));r[o]=new gy({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:A})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class gy{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function che(n,e){if(n.type==="Shadermaterial"&&!n.isMToonMaterial){console.warn("XXX set material texture to shader material",n);return}n.map=e,n.needsUpdate=!0}function uhe(n){const e=new vw,t=new DH(16777215,.5);e.add(t);const r=new iT(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new It;e.add(i);const s=new Fr(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new lhe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new vg({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new one(s,l.domElement);A.minDistance=1,A.maxDistance=4,A.maxPolarAngle=Math.PI/2,A.enablePan=!0,A.target=new Z(0,1,0),A.enableDamping=!0,A.dampingFactor=.1;const c=new Z(-.5,0,-.5),u=new Z(.5,1.5,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputEncoding=pt;const h=()=>{requestAnimationFrame(h),A.target.clamp(c,u),A==null||A.update(),o.update(),l.render(e,s)};h();const p=g=>{const m=g.ctrlKey,y=a.getBoundingClientRect(),w=(g.clientX-y.left)/y.width*2-1,x=-((g.clientY-y.top)/y.height)*2+1;o.cameraRaycastCulling(w,x,m)};async function d(){}return d(),a.addEventListener("click",p),{scene:e,camera:s,controls:A,characterManager:o,sceneElements:i}}function xv(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var P5={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -4220,8 +4220,8 @@ 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 xv=="function"&&xv;if(!c&&u)return u(A,!0);if(a)return a(A,!0);var f=new Error("Cannot find module '"+A+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[A]={exports:{}};r[A][0].call(h.exports,function(p){var d=r[A][1][p];return o(d||p)},h,h.exports,t,r,i,s)}return i[A].exports}for(var a=typeof xv=="function"&&xv,l=0;l>2,h=(3&A)<<4|c>>4,p=1>6:64,d=2>4,c=(15&f)<<4|(h=a.indexOf(l.charAt(d++)))>>2,u=(3&h)<<6|(p=a.indexOf(l.charAt(d++))),y[g++]=A,h!==64&&(y[g++]=c),p!==64&&(y[g++]=u);return y}},{"./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,f,h,p){this.compressedSize=c,this.uncompressedSize=u,this.crc32=f,this.compression=h,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,f){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).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,f){var h=o,p=f+u;A^=-1;for(var d=f;d>>8^h[255&(A^c[d])];return-1^A}(0|l,a,a.length,0):function(A,c,u,f){var h=o,p=f+u;A^=-1;for(var d=f;d>>8^h[255&(A^c.charCodeAt(d))];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,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,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(f){u.push({data:f,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(h,p){var d,g="";for(d=0;d>>=8;return g}function o(h,p,d,g,m,y){var w,x,_=h.file,C=h.compression,S=y!==A.utf8encode,b=a.transformTo("string",y(_.name)),M=a.transformTo("string",A.utf8encode(_.name)),D=_.comment,$=a.transformTo("string",y(D)),H=a.transformTo("string",A.utf8encode(D)),I=M.length!==_.name.length,v=H.length!==D.length,E="",U="",P="",L=_.dir,z=_.date,K={crc32:0,compressedSize:0,uncompressedSize:0};p&&!d||(K.crc32=h.crc32,K.compressedSize=h.compressedSize,K.uncompressedSize=h.uncompressedSize);var O=0;p&&(O|=8),S||!I&&!v||(O|=2048);var B=0,W=0;L&&(B|=16),m==="UNIX"?(W=798,B|=function(F,X){var ue=F;return F||(ue=X?16893:33204),(65535&ue)<<16}(_.unixPermissions,L)):(W=20,B|=function(F){return 63&(F||0)}(_.dosPermissions)),w=z.getUTCHours(),w<<=6,w|=z.getUTCMinutes(),w<<=5,w|=z.getUTCSeconds()/2,x=z.getUTCFullYear()-1980,x<<=4,x|=z.getUTCMonth()+1,x<<=5,x|=z.getUTCDate(),I&&(U=s(1,1)+s(c(b),4)+M,E+="up"+s(U.length,2)+U),v&&(P=s(1,1)+s(c($),4)+H,E+="uc"+s(P.length,2)+P);var ee="";return ee+=` -\0`,ee+=s(O,2),ee+=C.magic,ee+=s(w,2),ee+=s(x,2),ee+=s(K.crc32,4),ee+=s(K.compressedSize,4),ee+=s(K.uncompressedSize,4),ee+=s(b.length,2),ee+=s(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ee+b+E,dirRecord:u.CENTRAL_FILE_HEADER+s(W,2)+ee+s($.length,2)+"\0\0\0\0"+s(B,4)+s(g,4)+b+E+$}}var a=t("../utils"),l=t("../stream/GenericWorker"),A=t("../utf8"),c=t("../crc32"),u=t("../signature");function f(h,p,d,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=d,this.encodeFileName=g,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(h){var p=h.meta.percent||0,d=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:d?(p+100*(d-g-1))/d:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var p=this.streamFiles&&!h.file.dir;if(p){var d=o(h,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var p=this.streamFiles&&!h.file.dir,d=o(h,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),p)this.push({data:function(g){return u.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=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 f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="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 f(p,d){return new c.Promise(function(g,m){var y=[],w=p._internalType,x=p._outputType,_=p._mimeType;p.on("data",function(C,S){y.push(C),d&&d(S)}).on("error",function(C){y=[],m(C)}).on("end",function(){try{var C=function(S,b,M){switch(S){case"blob":return s.newBlob(s.transformTo("arraybuffer",b),M);case"base64":return l.encode(b);default:return s.transformTo(S,b)}}(x,function(S,b){var M,D=0,$=null,H=0;for(M=0;M"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 f(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return o.nodebuffer?a.newBufferFrom(h,"utf-8"):function(p){var d,g,m,y,w,x=p.length,_=0;for(y=0;y>>6:(g<65536?d[w++]=224|g>>>12:(d[w++]=240|g>>>18,d[w++]=128|g>>>12&63),d[w++]=128|g>>>6&63),d[w++]=128|63&g);return d}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(p){var d,g,m,y,w=p.length,x=new Array(2*w);for(d=g=0;d>10&1023,x[g++]=56320|1023&m)}return x.length!==g&&(x.subarray?x=x.subarray(0,g):x.length=g),s.applyFromCharCode(x)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(u,l),u.prototype.processChunk=function(h){var p=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var d=p;(p=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),p.set(d,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=function(y,w){var x;for((w=w||y.length)>y.length&&(w=y.length),x=w-1;0<=x&&(192&y[x])==128;)x--;return x<0||x===0?w:x+A[y[x]]>w?x: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:h.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(f,l),f.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=f},{"./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(d){return d}function c(d,g){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var p,d,g,m=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?f[g++]=224|h>>>12:(f[g++]=240|h>>>18,f[g++]=128|h>>>12&63),f[g++]=128|h>>>6&63),f[g++]=128|63&h);return f},i.buf2binstring=function(u){return c(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),h=0,p=f.length;h>10&1023,y[p++]=56320|1023&d)}return c(y,p)},i.utf8border=function(u,f){var h;for((f=f||u.length)>u.length&&(f=u.length),h=f-1;0<=h&&(192&u[h])==128;)h--;return h<0||h===0?f:h+l[u[h]]>f?h:f}},{"./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 f=A;f>>8^c[255&(o^a[f])];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,f=4,h=0,p=-2,d=-1,g=4,m=2,y=8,w=9,x=286,_=30,C=19,S=2*x+1,b=15,M=3,D=258,$=D+M+1,H=42,I=113,v=1,E=2,U=3,P=4;function L(Q,de){return Q.msg=c[de],de}function z(Q){return(Q<<1)-(4Q.avail_out&&(Ae=Q.avail_out),Ae!==0&&(o.arraySet(Q.output,de.pending_buf,de.pending_out,Ae,Q.next_out),Q.next_out+=Ae,de.pending_out+=Ae,Q.total_out+=Ae,Q.avail_out-=Ae,de.pending-=Ae,de.pending===0&&(de.pending_out=0))}function B(Q,de){a._tr_flush_block(Q,0<=Q.block_start?Q.block_start:-1,Q.strstart-Q.block_start,de),Q.block_start=Q.strstart,O(Q.strm)}function W(Q,de){Q.pending_buf[Q.pending++]=de}function ee(Q,de){Q.pending_buf[Q.pending++]=de>>>8&255,Q.pending_buf[Q.pending++]=255&de}function F(Q,de){var Ae,q,J=Q.max_chain_length,ce=Q.strstart,xe=Q.prev_length,be=Q.nice_match,N=Q.strstart>Q.w_size-$?Q.strstart-(Q.w_size-$):0,j=Q.window,se=Q.w_mask,he=Q.prev,me=Q.strstart+D,G=j[ce+xe-1],R=j[ce+xe];Q.prev_length>=Q.good_match&&(J>>=2),be>Q.lookahead&&(be=Q.lookahead);do if(j[(Ae=de)+xe]===R&&j[Ae+xe-1]===G&&j[Ae]===j[ce]&&j[++Ae]===j[ce+1]){ce+=2,Ae++;do;while(j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&ceN&&--J!=0);return xe<=Q.lookahead?xe:Q.lookahead}function X(Q){var de,Ae,q,J,ce,xe,be,N,j,se,he=Q.w_size;do{if(J=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=he+(he-$)){for(o.arraySet(Q.window,Q.window,he,he,0),Q.match_start-=he,Q.strstart-=he,Q.block_start-=he,de=Ae=Q.hash_size;q=Q.head[--de],Q.head[de]=he<=q?q-he:0,--Ae;);for(de=Ae=he;q=Q.prev[--de],Q.prev[de]=he<=q?q-he:0,--Ae;);J+=he}if(Q.strm.avail_in===0)break;if(xe=Q.strm,be=Q.window,N=Q.strstart+Q.lookahead,j=J,se=void 0,se=xe.avail_in,j=M)for(ce=Q.strstart-Q.insert,Q.ins_h=Q.window[ce],Q.ins_h=(Q.ins_h<=M&&(Q.ins_h=(Q.ins_h<=M)if(q=a._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-M),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=M){for(Q.match_length--;Q.strstart++,Q.ins_h=(Q.ins_h<=M&&(Q.ins_h=(Q.ins_h<=M&&Q.match_length<=Q.prev_length){for(J=Q.strstart+Q.lookahead-M,q=a._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-M),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;++Q.strstart<=J&&(Q.ins_h=(Q.ins_h<Q.pending_buf_size-5&&(Ae=Q.pending_buf_size-5);;){if(Q.lookahead<=1){if(X(Q),Q.lookahead===0&&de===u)return v;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var q=Q.block_start+Ae;if((Q.strstart===0||Q.strstart>=q)&&(Q.lookahead=Q.strstart-q,Q.strstart=q,B(Q,!1),Q.strm.avail_out===0)||Q.strstart-Q.block_start>=Q.w_size-$&&(B(Q,!1),Q.strm.avail_out===0))return v}return Q.insert=0,de===f?(B(Q,!0),Q.strm.avail_out===0?U:P):(Q.strstart>Q.block_start&&(B(Q,!1),Q.strm.avail_out),v)}),new oe(4,4,8,4,ue),new oe(4,5,16,8,ue),new oe(4,6,32,32,ue),new oe(4,4,16,16,le),new oe(8,16,32,32,le),new oe(8,16,128,128,le),new oe(8,32,128,256,le),new oe(32,128,258,1024,le),new oe(32,258,258,4096,le)],i.deflateInit=function(Q,de){return Re(Q,de,y,15,8,0)},i.deflateInit2=Re,i.deflateReset=_e,i.deflateResetKeep=pe,i.deflateSetHeader=function(Q,de){return Q&&Q.state?Q.state.wrap!==2?p:(Q.state.gzhead=de,h):p},i.deflate=function(Q,de){var Ae,q,J,ce;if(!Q||!Q.state||5>8&255),W(q,q.gzhead.time>>16&255),W(q,q.gzhead.time>>24&255),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(W(q,255&q.gzhead.extra.length),W(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(Q.adler=A(Q.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(W(q,0),W(q,0),W(q,0),W(q,0),W(q,0),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,3),q.status=I);else{var xe=y+(q.w_bits-8<<4)<<8;xe|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(xe|=32),xe+=31-xe%31,q.status=I,ee(q,xe),q.strstart!==0&&(ee(q,Q.adler>>>16),ee(q,65535&Q.adler)),Q.adler=1}if(q.status===69)if(q.gzhead.extra){for(J=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending!==q.pending_buf_size));)W(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){J=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),ce===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){J=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),ce===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&O(Q),q.pending+2<=q.pending_buf_size&&(W(q,255&Q.adler),W(q,Q.adler>>8&255),Q.adler=0,q.status=I)):q.status=I),q.pending!==0){if(O(Q),Q.avail_out===0)return q.last_flush=-1,h}else if(Q.avail_in===0&&z(de)<=z(Ae)&&de!==f)return L(Q,-5);if(q.status===666&&Q.avail_in!==0)return L(Q,-5);if(Q.avail_in!==0||q.lookahead!==0||de!==u&&q.status!==666){var be=q.strategy===2?function(N,j){for(var se;;){if(N.lookahead===0&&(X(N),N.lookahead===0)){if(j===u)return v;break}if(N.match_length=0,se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,se&&(B(N,!1),N.strm.avail_out===0))return v}return N.insert=0,j===f?(B(N,!0),N.strm.avail_out===0?U:P):N.last_lit&&(B(N,!1),N.strm.avail_out===0)?v:E}(q,de):q.strategy===3?function(N,j){for(var se,he,me,G,R=N.window;;){if(N.lookahead<=D){if(X(N),N.lookahead<=D&&j===u)return v;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=M&&0N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=M?(se=a._tr_tally(N,1,N.match_length-M),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),se&&(B(N,!1),N.strm.avail_out===0))return v}return N.insert=0,j===f?(B(N,!0),N.strm.avail_out===0?U:P):N.last_lit&&(B(N,!1),N.strm.avail_out===0)?v:E}(q,de):s[q.level].func(q,de);if(be!==U&&be!==P||(q.status=666),be===v||be===U)return Q.avail_out===0&&(q.last_flush=-1),h;if(be===E&&(de===1?a._tr_align(q):de!==5&&(a._tr_stored_block(q,0,0,!1),de===3&&(K(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),O(Q),Q.avail_out===0))return q.last_flush=-1,h}return de!==f?h:q.wrap<=0?1:(q.wrap===2?(W(q,255&Q.adler),W(q,Q.adler>>8&255),W(q,Q.adler>>16&255),W(q,Q.adler>>24&255),W(q,255&Q.total_in),W(q,Q.total_in>>8&255),W(q,Q.total_in>>16&255),W(q,Q.total_in>>24&255)):(ee(q,Q.adler>>>16),ee(q,65535&Q.adler)),O(Q),0=Ae.w_size&&(ce===0&&(K(Ae.head),Ae.strstart=0,Ae.block_start=0,Ae.insert=0),j=new o.Buf8(Ae.w_size),o.arraySet(j,de,se-Ae.w_size,Ae.w_size,0),de=j,se=Ae.w_size),xe=Q.avail_in,be=Q.next_in,N=Q.input,Q.avail_in=se,Q.next_in=0,Q.input=de,X(Ae);Ae.lookahead>=M;){for(q=Ae.strstart,J=Ae.lookahead-(M-1);Ae.ins_h=(Ae.ins_h<>>=M=b>>>24,w-=M,(M=b>>>16&255)===0)E[c++]=65535&b;else{if(!(16&M)){if(!(64&M)){b=x[(65535&b)+(y&(1<>>=M,w-=M),w<15&&(y+=v[l++]<>>=M=b>>>24,w-=M,!(16&(M=b>>>16&255))){if(!(64&M)){b=_[(65535&b)+(y&(1<>>=M,w-=M,(M=c-u)<$){if(d<(M=$-M)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(I=m,(H=0)===g){if(H+=p-M,M>3,y&=(1<<(w-=D<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(H>>>8&65280)+((65280&H)<<8)+((255&H)<<24)}function y(){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(H){var I;return H&&H.state?(I=H.state,H.total_in=H.total_out=I.total=0,H.msg="",I.wrap&&(H.adler=1&I.wrap),I.mode=p,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new s.Buf32(d),I.distcode=I.distdyn=new s.Buf32(g),I.sane=1,I.back=-1,f):h}function x(H){var I;return H&&H.state?((I=H.state).wsize=0,I.whave=0,I.wnext=0,w(H)):h}function _(H,I){var v,E;return H&&H.state?(E=H.state,I<0?(v=0,I=-I):(v=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15=P.wsize?(s.arraySet(P.window,I,v-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(E<(U=P.wsize-P.wnext)&&(U=E),s.arraySet(P.window,I,v-E,U,P.wnext),(E-=U)?(s.arraySet(P.window,I,v-E,E,0),P.wnext=E,P.whave=P.wsize):(P.wnext+=U,P.wnext===P.wsize&&(P.wnext=0),P.whave>>8&255,v.check=a(v.check,ce,2,0),B=O=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&O)<<8)+(O>>8))%31){H.msg="incorrect header check",v.mode=30;break}if((15&O)!=8){H.msg="unknown compression method",v.mode=30;break}if(B-=4,Q=8+(15&(O>>>=4)),v.wbits===0)v.wbits=Q;else if(Q>v.wbits){H.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(ce[0]=255&O,ce[1]=O>>>8&255,v.check=a(v.check,ce,2,0)),B=O=0,v.mode=3;case 3:for(;B<32;){if(z===0)break e;z--,O+=E[P++]<>>8&255,ce[2]=O>>>16&255,ce[3]=O>>>24&255,v.check=a(v.check,ce,4,0)),B=O=0,v.mode=4;case 4:for(;B<16;){if(z===0)break e;z--,O+=E[P++]<>8),512&v.flags&&(ce[0]=255&O,ce[1]=O>>>8&255,v.check=a(v.check,ce,2,0)),B=O=0,v.mode=5;case 5:if(1024&v.flags){for(;B<16;){if(z===0)break e;z--,O+=E[P++]<>>8&255,v.check=a(v.check,ce,2,0)),B=O=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(z<(F=v.length)&&(F=z),F&&(v.head&&(Q=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,E,P,F,Q)),512&v.flags&&(v.check=a(v.check,E,F,P)),z-=F,P+=F,v.length-=F),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(z===0)break e;for(F=0;Q=E[P+F++],v.head&&Q&&v.length<65536&&(v.head.name+=String.fromCharCode(Q)),Q&&F>9&1,v.head.done=!0),H.adler=v.check=0,v.mode=12;break;case 10:for(;B<32;){if(z===0)break e;z--,O+=E[P++]<>>=7&B,B-=7&B,v.mode=27;break}for(;B<3;){if(z===0)break e;z--,O+=E[P++]<>>=1)){case 0:v.mode=14;break;case 1:if(D(v),v.mode=20,I!==6)break;O>>>=2,B-=2;break e;case 2:v.mode=17;break;case 3:H.msg="invalid block type",v.mode=30}O>>>=2,B-=2;break;case 14:for(O>>>=7&B,B-=7&B;B<32;){if(z===0)break e;z--,O+=E[P++]<>>16^65535)){H.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&O,B=O=0,v.mode=15,I===6)break e;case 15:v.mode=16;case 16:if(F=v.length){if(z>>=5,B-=5,v.ndist=1+(31&O),O>>>=5,B-=5,v.ncode=4+(15&O),O>>>=4,B-=4,286>>=3,B-=3}for(;v.have<19;)v.lens[xe[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,Ae={bits:v.lenbits},de=A(0,v.lens,0,19,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,de){H.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=le,B-=le,v.lens[v.have++]=re;else{if(re===16){for(q=le+2;B>>=le,B-=le,v.have===0){H.msg="invalid bit length repeat",v.mode=30;break}Q=v.lens[v.have-1],F=3+(3&O),O>>>=2,B-=2}else if(re===17){for(q=le+3;B>>=le)),O>>>=3,B-=3}else{for(q=le+7;B>>=le)),O>>>=7,B-=7}if(v.have+F>v.nlen+v.ndist){H.msg="invalid bit length repeat",v.mode=30;break}for(;F--;)v.lens[v.have++]=Q}}if(v.mode===30)break;if(v.lens[256]===0){H.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,Ae={bits:v.lenbits},de=A(c,v.lens,0,v.nlen,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,de){H.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,Ae={bits:v.distbits},de=A(u,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,Ae),v.distbits=Ae.bits,de){H.msg="invalid distances set",v.mode=30;break}if(v.mode=20,I===6)break e;case 20:v.mode=21;case 21:if(6<=z&&258<=K){H.next_out=L,H.avail_out=K,H.next_in=P,H.avail_in=z,v.hold=O,v.bits=B,l(H,ee),L=H.next_out,U=H.output,K=H.avail_out,P=H.next_in,E=H.input,z=H.avail_in,O=v.hold,B=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;oe=(J=v.lencode[O&(1<>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>pe)])>>>16&255,re=65535&J,!(pe+(le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=pe,B-=pe,v.back+=pe}if(O>>>=le,B-=le,v.back+=le,v.length=re,oe===0){v.mode=26;break}if(32&oe){v.back=-1,v.mode=12;break}if(64&oe){H.msg="invalid literal/length code",v.mode=30;break}v.extra=15&oe,v.mode=22;case 22:if(v.extra){for(q=v.extra;B>>=v.extra,B-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;oe=(J=v.distcode[O&(1<>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>pe)])>>>16&255,re=65535&J,!(pe+(le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=pe,B-=pe,v.back+=pe}if(O>>>=le,B-=le,v.back+=le,64&oe){H.msg="invalid distance code",v.mode=30;break}v.offset=re,v.extra=15&oe,v.mode=24;case 24:if(v.extra){for(q=v.extra;B>>=v.extra,B-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){H.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(K===0)break e;if(F=ee-K,v.offset>F){if((F=v.offset-F)>v.whave&&v.sane){H.msg="invalid distance too far back",v.mode=30;break}X=F>v.wnext?(F-=v.wnext,v.wsize-F):v.wnext-F,F>v.length&&(F=v.length),ue=v.window}else ue=U,X=L-v.offset,F=v.length;for(KS?(M=X[ue+g[I]],B[W+g[I]]):(M=96,0),y=1<>L)+(w-=y)]=b<<24|M<<16|D|0,w!==0;);for(y=1<>=1;if(y!==0?(O&=y-1,O+=y):O=0,I++,--ee[H]==0){if(H===E)break;H=u[f+g[I]]}if(U>>7)]}function W(J,ce){J.pending_buf[J.pending++]=255&ce,J.pending_buf[J.pending++]=ce>>>8&255}function ee(J,ce,xe){J.bi_valid>m-xe?(J.bi_buf|=ce<>m-J.bi_valid,J.bi_valid+=xe-m):(J.bi_buf|=ce<>>=1,xe<<=1,0<--ce;);return xe>>>1}function ue(J,ce,xe){var be,N,j=new Array(g+1),se=0;for(be=1;be<=g;be++)j[be]=se=se+xe[be-1]<<1;for(N=0;N<=ce;N++){var he=J[2*N+1];he!==0&&(J[2*N]=X(j[he]++,he))}}function le(J){var ce;for(ce=0;ce>1;1<=xe;xe--)pe(J,j,xe);for(N=me;xe=J.heap[1],J.heap[1]=J.heap[J.heap_len--],pe(J,j,1),be=J.heap[1],J.heap[--J.heap_max]=xe,J.heap[--J.heap_max]=be,j[2*N]=j[2*xe]+j[2*be],J.depth[N]=(J.depth[xe]>=J.depth[be]?J.depth[xe]:J.depth[be])+1,j[2*xe+1]=j[2*be+1]=N,J.heap[1]=N++,pe(J,j,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(R,T){var V,te,ae,ie,Te,Me,Le=T.dyn_tree,ke=T.max_code,De=T.stat_desc.static_tree,fe=T.stat_desc.has_stree,Ce=T.stat_desc.extra_bits,Se=T.stat_desc.extra_base,Fe=T.stat_desc.max_length,We=0;for(ie=0;ie<=g;ie++)R.bl_count[ie]=0;for(Le[2*R.heap[R.heap_max]+1]=0,V=R.heap_max+1;V>=7;N>>=1)if(1&G&&he.dyn_ltree[2*me]!==0)return o;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(j=J.static_len+3+7>>>3)<=N&&(N=j)):N=j=xe+5,xe+4<=N&&ce!==-1?q(J,ce,xe,be):J.strategy===4||j===N?(ee(J,2+(be?1:0),3),_e(J,$,H)):(ee(J,4+(be?1:0),3),function(he,me,G,R){var T;for(ee(he,me-257,5),ee(he,G-1,5),ee(he,R-4,4),T=0;T>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&ce,J.pending_buf[J.l_buf+J.last_lit]=255&xe,J.last_lit++,ce===0?J.dyn_ltree[2*xe]++:(J.matches++,ce--,J.dyn_ltree[2*(v[xe]+u+1)]++,J.dyn_dtree[2*B(ce)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){ee(J,2,3),F(J,w,$),function(ce){ce.bi_valid===16?(W(ce,ce.bi_buf),ce.bi_buf=0,ce.bi_valid=0):8<=ce.bi_valid&&(ce.pending_buf[ce.pending++]=255&ce.bi_buf,ce.bi_buf>>=8,ce.bi_valid-=8)}(J)}},{"../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,f=1,h={},p=!1,d=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(x){process.nextTick(function(){y(x)})}:function(){if(o.postMessage&&!o.importScripts){var x=!0,_=o.onmessage;return o.onmessage=function(){x=!1},o.postMessage("","*"),o.onmessage=_,x}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(x){o.postMessage(u+x,"*")}):o.MessageChannel?((c=new MessageChannel).port1.onmessage=function(x){y(x.data)},function(x){c.port2.postMessage(x)}):d&&"onreadystatechange"in d.createElement("script")?(A=d.documentElement,function(x){var _=d.createElement("script");_.onreadystatechange=function(){y(x),_.onreadystatechange=null,A.removeChild(_),_=null},A.appendChild(_)}):function(x){setTimeout(y,0,x)},g.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var _=new Array(arguments.length-1),C=0;C<_.length;C++)_[C]=arguments[C+1];var S={callback:x,args:_};return h[f]=S,l(f),f++},g.clearImmediate=m}function m(x){delete h[x]}function y(x){if(p)setTimeout(y,0,x);else{var _=h[x];if(_){p=!0;try{(function(C){var S=C.callback,b=C.args;switch(b.length){case 0:S();break;case 1:S(b[0]);break;case 2:S(b[0],b[1]);break;case 3:S(b[0],b[1],b[2]);break;default:S.apply(a,b)}})(_)}finally{m(x),p=!1}}}}function w(x){x.source===o&&typeof x.data=="string"&&x.data.indexOf(u)===0&&y(+x.data.slice(u.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof ta<"u"?ta:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(P5);var uhe=P5.exports;const fhe=bl(uhe);class ad{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 fhe;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 Z;class hhe{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:f=64,backgroundDescription:h="",width:p=512,height:d=512,dataCollection:g}=a,m=l+A+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.calculateBoneOffsets(.2);let y=0;const w=this;if(Array.isArray(g)){const x=t??new ad;await(async()=>{if(Array.isArray(g))for(let C=0;C{const K=[];return ut(U).forEach(B=>{K.push({id:B})}),K},L=U==null?y.characterManager.getTraits(S):P();if(L==null){console.log("SKipping Thumbnail Generation for trait group "+S+", its not present in the character manifest.");continue}const z=wT(b);E?y.screenshotManager.setCameraFrameWithName(E,z):y.screenshotManager.frameShot(M,$,z,D,H);for(let K=0;K{const[e,t]=ye.useState(null),[r,i]=ye.useState(null),[s,o]=ye.useState(null),[a,l]=ye.useState(null),[A,c]=ye.useState(null),[u,f]=ye.useState(null),[h,p]=ye.useState(null),[d,g]=ye.useState(null),[m,y]=ye.useState(null),[w,x]=ye.useState(null),[_,C]=ye.useState(null),[S,b]=ye.useState(!1);let M=!1,[D,$]=ye.useState(!1);ye.useEffect(()=>{if(M||D)return;$(!0),M=!0;const{scene:E,camera:U,controls:P,characterManager:L,sceneElements:z}=che("editor-scene");y(U),g(E),t(L),c(z),f(L.animationManager),p(L.lookAtManager),x(P),i(new hhe(L)),o(new dhe(L)),l(new phe(L))},[]);const H=E=>{E==null&&(E=!S),b(E),d.traverse(U=>{U.isMesh&&U.setDebugMode&&U.setDebugMode(E)})};ye.useEffect(()=>{if(_!=null&&_.defaultAnimations){const E=_.defaultAnimations.map(U=>U.location);u.storeDefaultAnimationPaths(E,"")}},[_]);const I=E=>{E?d.add(A):d.remove(A)},v=E=>{w&&(tC.to(w.target,{x:E.targetX??0,y:E.targetY??0,z:E.targetZ??0,duration:1}),tC.fromTo(w,{maxDistance:w.getDistance(),minDistance:w.getDistance(),minPolarAngle:w.getPolarAngle(),maxPolarAngle:w.getPolarAngle(),minAzimuthAngle:w.getAzimuthalAngle(),maxAzimuthAngle:w.getAzimuthalAngle()},{maxDistance:E.distance,minDistance:E.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 k.jsx(or.Provider,{value:{manifest:_,setManifest:C,scene:d,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:I,debugMode:S,toggleDebugMode:H,animationManager:u,lookAtManager:h,camera:m,moveCamera:v,controls:w,sceneElements:A},children:n.children})},ghe={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},dt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},Ui=Y.createContext(),vhe=n=>{const[e,t]=Y.useState(ghe.NORMAL),[r,i]=Y.useState(dt.LANDING),[s,o]=Y.useState(!1),[a,l]=Y.useState(!1);return k.jsx(Ui.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},yhe="modulepreload",whe=function(n){return"/CharacterStudio/"+n},q3={},xhe=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=whe(s),s in q3)return;q3[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":yhe,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 zw(){return zw=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function bhe(n){ye.useEffect(n,[])}function Bhe(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,f=_he(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),h=Y.useRef(null),p=Y.useRef(!1),d=Y.useState(null),g=d[0],m=d[1],y=Y.useState(null),w=y[0],x=y[1],_=function(){typeof u=="function"&&u.call(this),p.current&&m(this.duration()*1e3),x(this)};bhe(function(){return xhe(()=>import("./howler-46877a76.js").then(D=>D.h),[]).then(function(D){if(!p.current){var $;h.current=($=D.Howl)!==null&&$!==void 0?$:D.default.Howl,p.current=!0,new h.current(zw({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:_},f))}}),function(){p.current=!1}}),Y.useEffect(function(){h.current&&w&&x(new h.current(zw({src:Array.isArray(n)?n:[n],volume:i,onload:_},f)))},[JSON.stringify(n)]),Y.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var C=Y.useCallback(function(D){typeof D>"u"&&(D={}),!(!w||!l&&!D.forceSoundEnabled)&&(c&&w.stop(),D.playbackRate&&w.rate(D.playbackRate),w.play(D.id))},[w,l,c]),S=Y.useCallback(function(D){w&&w.stop(D)},[w]),b=Y.useCallback(function(D){w&&w.pause(D)},[w]),M=[C,{sound:w,stop:S,pause:b,duration:g}];return M}const Ehe=[{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}],Che="/CharacterStudio/assets/sounds-3322d50e.mp3",Ys=ye.createContext(),She=n=>{const e=i=>Ehe.find(s=>i.test(s.name)),[t]=Bhe(Che,{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 k.jsx(Ys.Provider,{value:{playSound:r},children:n.children})};function ks(n){"@babel/helpers - typeof";return ks=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},ks(n)}function Xs(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Mhe(n,e){if(ks(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function D5(n){var e=Mhe(n,"string");return ks(e)=="symbol"?e:e+""}function eP(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]:{};Xs(this,n),this.init(e,t)}return Zs(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||Rhe,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 sP(n,e,t){var r=ET(n,e,Object),i=r.obj,s=r.k;i[s]=t}function Lhe(n,e,t,r){var i=ET(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 Gw(n,e){var t=ET(n,e),r=t.obj,i=t.k;if(r)return r[i]}function oP(n,e,t){var r=Gw(n,t);return r!==void 0?r:Gw(e,t)}function Q5(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]):Q5(n[r],e[r],t):n[r]=e[r]);return n}function Zu(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Phe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Dhe(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return Phe[e]}):n}var o_=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Ohe=[" ",",","?","!",";"];function Nhe(n,e,t){e=e||"",t=t||"";var r=Ohe.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 aP(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 _v(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 H5(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?H5(l,A,t):void 0}i=i[r[s]]}return i}}var Hhe=function(n){s_(t,n);var e=khe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Xs(this,t),i=e.call(this),o_&&QA.call(IA(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 Zs(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=Gw(this.data,c);return u||!A||typeof o!="string"?u:H5(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),sP(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=Gw(this.data,c)||{};a?Q5(u,o,l):u=_v(_v({},u),o),sP(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"?_v(_v({},{}),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}(QA),z5={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 lP(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 ni(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 AP={},cP=function(n){s_(t,n);var e=zhe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Xs(this,t),i=e.call(this),o_&&QA.call(IA(i)),Uhe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,IA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=na.create("translator"),i}return Zs(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&&!Nhe(i,o,a);if(A&&!c){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var f=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(f[0])>-1)&&(l=f.shift()),i=f.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if(ks(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,f=c.namespaces,h=f[f.length-1],p=s.lng||this.language,d=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(d){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(h).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h}:"".concat(h).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h}:u}var m=this.resolve(i,s),y=m&&m.res,w=m&&m.usedKey||u,x=m&&m.exactUsedKey||u,_=Object.prototype.toString.apply(y),C=["[object Number]","[object Function]","[object RegExp]"],S=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,M=typeof y!="string"&&typeof y!="boolean"&&typeof y!="number";if(b&&y&&M&&C.indexOf(_)<0&&!(typeof S=="string"&&_==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var D=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,y,ni(ni({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(m.res=D,m):D}if(A){var $=_==="[object Array]",H=$?[]:{},I=$?x:w;for(var v in y)if(Object.prototype.hasOwnProperty.call(y,v)){var E="".concat(I).concat(A).concat(v);H[v]=this.translate(E,ni(ni({},s),{joinArrays:!1,ns:f})),H[v]===E&&(H[v]=y[v])}y=H}}else if(b&&typeof S=="string"&&_==="[object Array]")y=y.join(S),y&&(y=this.extendTranslation(y,i,s,o));else{var U=!1,P=!1,L=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),K=L?this.pluralResolver.getSuffix(p,s.count,s):"",O=s["defaultValue".concat(K)]||s.defaultValue;!this.isValidLookup(y)&&z&&(U=!0,y=O),this.isValidLookup(y)||(P=!0,y=u);var B=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,W=B&&P?void 0:y,ee=z&&O!==y&&this.options.updateMissing;if(P||U||ee){if(this.logger.log(ee?"updateKey":"missingKey",p,h,u,ee?O:y),A){var F=this.resolve(u,ni(ni({},s),{},{keySeparator:!1}));F&&F.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 X=[],ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(var le=0;le1&&arguments[1]!==void 0?arguments[1]:{},a,l,A,c,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var h=s.extractFromKey(f,o),p=h.key;l=p;var d=h.namespaces;s.options.fallbackNS&&(d=d.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",m=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),y=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);d.forEach(function(x){s.isValidLookup(a)||(u=x,!AP["".concat(w[0],"-").concat(x)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(AP["".concat(w[0],"-").concat(x)]=!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(_){if(!s.isValidLookup(a)){c=_;var C=[p];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(C,p,_,x,o);else{var S;g&&(S=s.pluralResolver.getSuffix(_,o.count,o));var b="".concat(s.options.pluralSeparator,"zero");if(g&&(C.push(p+S),m&&C.push(p+b)),y){var M="".concat(p).concat(s.options.contextSeparator).concat(o.context);C.push(M),g&&(C.push(M+S),m&&C.push(M+b))}}for(var D;D=C.pop();)s.isValidLookup(a)||(A=D,a=s.getResource(_,x,D,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}(QA);function pB(n){return n.charAt(0).toUpperCase()+n.slice(1)}var uP=function(){function n(e){Xs(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=na.create("languageUtils")}return Zs(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]=pB(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]=pB(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=pB(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}(),Vhe=[{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}],jhe={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}},Whe=["v1","v2","v3"],fP={zero:0,one:1,two:2,few:3,many:4,other:5};function Khe(){var n={};return Vhe.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:jhe[e.fc]}})}),n}var $he=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xs(this,n),this.languageUtils=e,this.options=t,this.logger=na.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=Khe()}return Zs(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 fP[o]-fP[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!Whe.includes(this.options.compatibilityJSON)}}]),n}();function hP(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 Ao(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Xs(this,n),this.logger=na.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Zs(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:Dhe,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Zu(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Zu(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?Zu(r.nestingPrefix):r.nestingPrefixEscaped||Zu("$t("),this.nestingSuffix=r.nestingSuffix?Zu(r.nestingSuffix):r.nestingSuffixEscaped||Zu(")"),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 f=function(m){if(m.indexOf(o.formatSeparator)<0){var y=oP(r,c,m);return o.alwaysFormat?o.format(y,void 0,i,Ao(Ao(Ao({},s),r),{},{interpolationkey:m})):y}var w=m.split(o.formatSeparator),x=w.shift().trim(),_=w.join(o.formatSeparator).trim();return o.format(oP(r,c,x),_,i,Ao(Ao(Ao({},s),r),{},{interpolationkey:x}))};this.resetRegExp();var h=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,p=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,d=[{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 d.forEach(function(g){for(A=0;a=g.regex.exec(t);){var m=a[1].trim();if(l=f(m),l===void 0)if(typeof h=="function"){var y=h(t,a,s);l=typeof y=="string"?y:""}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=iP(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(h,p){var d=this.nestingOptionsSeparator;if(h.indexOf(d)<0)return h;var g=h.split(new RegExp("".concat(d,"[ ]*{"))),m="{".concat(g[1]);h=g[0],m=this.interpolate(m,l);var y=m.match(/'/g),w=m.match(/"/g);(y&&y.length%2===0&&!w||w.length%2!==0)&&(m=m.replace(/'/g,'"'));try{l=JSON.parse(m),p&&(l=Ao(Ao({},p),l))}catch(x){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),x),"".concat(h).concat(d).concat(m)}return delete l.defaultValue,h}for(;o=this.nestingRegexp.exec(t);){var c=[];l=Ao({},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 f=o[1].split(this.formatSeparator).map(function(h){return h.trim()});o[1]=f.shift(),c=f,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=iP(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=c.reduce(function(h,p){return i.format(h,p,s.lng,Ao(Ao({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function dP(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 Ha(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=Ihe(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 Ju(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 Zhe=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xs(this,n),this.logger=na.create("formatter"),this.options=e,this.formats={number:Ju(function(t,r){var i=new Intl.NumberFormat(t,Ha({},r));return function(s){return i.format(s)}}),currency:Ju(function(t,r){var i=new Intl.NumberFormat(t,Ha(Ha({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Ju(function(t,r){var i=new Intl.DateTimeFormat(t,Ha({},r));return function(s){return i.format(s)}}),relativetime:Ju(function(t,r){var i=new Intl.RelativeTimeFormat(t,Ha({},r));return function(s){return i.format(s,r.range||"day")}}),list:Ju(function(t,r){var i=new Intl.ListFormat(t,Ha({},r));return function(s){return i.format(s)}})},this.init(e)}return Zs(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()]=Ju(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=Xhe(c),f=u.formatName,h=u.formatOptions;if(s.formats[f]){var p=A;try{var d=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=d.locale||d.lng||o.locale||o.lng||i;p=s.formats[f](A,g,Ha(Ha(Ha({},h),o),d))}catch(m){s.logger.warn(m)}return p}else s.logger.warn("there was no format function for ".concat(f));return A},t);return l}}]),n}();function pP(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 mP(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 ede(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var tde=function(n){s_(t,n);var e=Jhe(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Xs(this,t),o=e.call(this),o_&&QA.call(IA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=na.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 Zs(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,A={},c={},u={},f={};return i.forEach(function(h){var p=!0;s.forEach(function(d){var g="".concat(h,"|").concat(d);!o.reload&&l.store.hasResourceBundle(h,d)?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),f[d]===void 0&&(f[d]=!0)))}),p||(u[h]=!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(f)}}},{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){Lhe(u.loaded,[l],A),ede(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){c[f]||(c[f]={});var h=u.loaded[f];h.length&&h.forEach(function(p){c[f][p]===void 0&&(c[f][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(d,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(d&&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=mP(mP({},A),{},{isUpdate:l}),f=this.backend.create.bind(this.backend);if(f.length<6)try{var h;f.length===5?h=f(i,s,o,a,u):h=f(i,s,o,a),h&&typeof h.then=="function"?h.then(function(p){return c(null,p)}).catch(c):c(null,h)}catch(p){c(p)}else f(i,s,o,a,c,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(QA);function gP(){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(ks(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),ks(e[2])==="object"||ks(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 vP(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 yP(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 Oo(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 bv(){}function ide(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var Vw=function(n){s_(t,n);var e=nde(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(Xs(this,t),r=e.call(this),o_&&QA.call(IA(r)),r.options=vP(i),r.services={},r.logger=na,r.modules={external:[]},ide(IA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),Eg(r,IA(r));setTimeout(function(){r.init(i,s)},0)}return r}return Zs(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=gP();this.options=Oo(Oo(Oo({},a),this.options),vP(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Oo(Oo({},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?na.init(l(this.modules.logger),this.options):na.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=Zhe);var c=new uP(this.options);this.store=new Hhe(this.options.resources,this.options);var u=this.services;u.logger=na,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new $he(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 Yhe(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new tde(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(m){for(var y=arguments.length,w=new Array(y>1?y-1:0),x=1;x1?y-1:0),x=1;x0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var h=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];h.forEach(function(m){i[m]=function(){var y;return(y=i.store)[m].apply(y,arguments)}});var p=["addResource","addResources","addResourceBundle","removeResourceBundle"];p.forEach(function(m){i[m]=function(){var y;return(y=i.store)[m].apply(y,arguments),i}});var d=op(),g=function(){var y=function(x,_){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),d.resolve(_),o(x,_)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return y(null,i.t.bind(i));i.changeLanguage(i.options.lng,y)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),d}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bv,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(h){if(h){var p=s.services.languageUtils.toResolveHierarchy(h);p.forEach(function(d){A.indexOf(d)<0&&A.push(d)})}};if(l)c(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return c(f)})}this.options.preload&&this.options.preload.forEach(function(f){return c(f)}),this.services.backendConnector.load(A,this.options.ns,function(f){!f&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(f)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=op();return i||(i=this.languages),s||(s=this.options.ns),o||(o=bv),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"&&z5.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=op();this.emit("languageChanging",i);var l=function(f){o.language=f,o.languages=o.services.languageUtils.toResolveHierarchy(f),o.resolvedLanguage=void 0,o.setResolvedLanguage(f)},A=function(f,h){h?(l(h),o.translator.changeLanguage(h),o.isLanguageChangingTo=void 0,o.emit("languageChanged",h),o.logger.log("languageChanged",h)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(f,function(){return o.t.apply(o,arguments)})},c=function(f){!i&&!f&&o.services.languageDetector&&(f=[]);var h=typeof f=="string"?f:o.services.languageUtils.getBestMatchFromCodes(f);h&&(o.language||l(h),o.translator.language||o.translator.changeLanguage(h),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(h)),o.loadResources(h,function(p){A(p,h)})};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 f;if(ks(u)!=="object"){for(var h=arguments.length,p=new Array(h>2?h-2:0),d=2;d1&&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(h,p){var d=s.services.backendConnector.state["".concat(h,"|").concat(p)];return d===-1||d===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=op();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=op();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 uP(gP());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]:bv,a=Oo(Oo(Oo({},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=Oo({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new cP(l.services,l.options),l.translator.on("*",function(c){for(var u=arguments.length,f=new Array(u>1?u-1:0),h=1;h0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new Vw(n,e)});var qr=Vw.createInstance();qr.createInstance=Vw.createInstance;qr.createInstance;qr.dir;qr.init;qr.loadResources;qr.reloadResources;qr.use;qr.changeLanguage;qr.getFixedT;qr.t;qr.exists;qr.setDefaultNamespace;qr.hasLoadedNamespace;qr.loadNamespaces;qr.loadLanguages;function sde(){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 ade(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return JC("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}}):ode(n,e,t)}var lde=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ade={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},cde=function(e){return Ade[e]},ude=function(e){return e.replace(lde,cde)};function _P(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 bP(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};qC=bP(bP({},qC),n)}function hde(){return qC}var G5;function dde(n){G5=n}function pde(){return G5}var mde={type:"3rdParty",init:function(e){fde(e.options.react),dde(e)}},gde=ye.createContext(),vde=function(){function n(){Xs(this,n),this.usedNamespaces={}}return Zs(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 yde(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 wde(n,e){return O5(n)||yde(n,e)||N5(n,e)||k5()}function BP(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 mB(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=ye.useContext(gde)||{},i=r.i18n,s=r.defaultNS,o=t||i||pde();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new vde),!o){JC("You will need to pass in an i18next instance by using initReactI18next");var a=function(M,D){return typeof D=="string"?D:D&&ks(D)==="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(M)?M[M.length-1]:M},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&JC("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=mB(mB(mB({},hde()),o.options.react),e),c=A.useSuspense,u=A.keyPrefix,f=n||s||o.options&&o.options.defaultNS;f=typeof f=="string"?[f]:f||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(f);var h=(o.isInitialized||o.initializedStoreOnce)&&f.every(function(b){return ade(b,o,A)});function p(){return o.getFixedT(null,A.nsMode==="fallback"?f:f[0],u)}var d=ye.useState(p),g=wde(d,2),m=g[0],y=g[1],w=f.join(),x=xde(w),_=ye.useRef(!0);ye.useEffect(function(){var b=A.bindI18n,M=A.bindI18nStore;_.current=!0,!h&&!c&&xP(o,f,function(){_.current&&y(p)}),h&&x&&x!==w&&_.current&&y(p);function D(){_.current&&y(p)}return b&&o&&o.on(b,D),M&&o&&o.store.on(M,D),function(){_.current=!1,b&&o&&b.split(" ").forEach(function($){return o.off($,D)}),M&&o&&M.split(" ").forEach(function($){return o.store.off($,D)})}},[o,w]);var C=ye.useRef(!0);ye.useEffect(function(){_.current&&!C.current&&y(p),C.current=!1},[o,u]);var S=[m,o,h];if(S.t=m,S.i18n=o,S.ready=h,h||!h&&!c)return S;throw new Promise(function(b){xP(o,f,function(){b()})})}var V5=[],bde=V5.forEach,Bde=V5.slice;function Ede(n){return bde.call(Bde.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var EP=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Cde=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(!EP.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!EP.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},CP={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=Cde(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}},ap=null,SP=function(){if(ap!==null)return ap;try{ap=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{ap=!1}return ap},Tde={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&SP()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&SP()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},lp=null,MP=function(){if(lp!==null)return lp;try{lp=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{lp=!1}return lp},Ide={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&MP()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&MP()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Rde={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},Fde={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}},Ude={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}},Lde={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 Pde(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var j5=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xs(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Zs(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=Ede(r,this.options||{},Pde()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(Sde),this.addDetector(Mde),this.addDetector(Tde),this.addDetector(Ide),this.addDetector(Rde),this.addDetector(Fde),this.addDetector(Ude),this.addDetector(Lde)}},{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}();j5.type="languageDetector";const Dde={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",saveCharacter:"Save Your Character"},callToAction:{next:"Next",back:"Back",randomize:"Randomize",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",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},Ode={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",saveCharacter:"Сохранить Персонажа"},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},Nde={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",saveCharacter:"保存角色"},callToAction:{next:"下一步",back:"返回",randomize:"随机",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},kde={en:Dde,ru:Ode,zh:Nde};qr.use(j5).use(mde).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:kde});const To=ye.createContext(),Qde=n=>{const{t:e}=_de();return k.jsx(To.Provider,{value:{t:e},children:n.children})},Hde=` +\0`,ee+=s(O,2),ee+=C.magic,ee+=s(w,2),ee+=s(x,2),ee+=s(K.crc32,4),ee+=s(K.compressedSize,4),ee+=s(K.uncompressedSize,4),ee+=s(b.length,2),ee+=s(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ee+b+E,dirRecord:u.CENTRAL_FILE_HEADER+s(W,2)+ee+s($.length,2)+"\0\0\0\0"+s(B,4)+s(g,4)+b+E+$}}var a=t("../utils"),l=t("../stream/GenericWorker"),A=t("../utf8"),c=t("../crc32"),u=t("../signature");function f(h,p,d,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=d,this.encodeFileName=g,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(h){var p=h.meta.percent||0,d=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:d?(p+100*(d-g-1))/d:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var p=this.streamFiles&&!h.file.dir;if(p){var d=o(h,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var p=this.streamFiles&&!h.file.dir,d=o(h,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),p)this.push({data:function(g){return u.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=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 f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="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 f(p,d){return new c.Promise(function(g,m){var y=[],w=p._internalType,x=p._outputType,_=p._mimeType;p.on("data",function(C,S){y.push(C),d&&d(S)}).on("error",function(C){y=[],m(C)}).on("end",function(){try{var C=function(S,b,M){switch(S){case"blob":return s.newBlob(s.transformTo("arraybuffer",b),M);case"base64":return l.encode(b);default:return s.transformTo(S,b)}}(x,function(S,b){var M,D=0,$=null,H=0;for(M=0;M"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 f(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return o.nodebuffer?a.newBufferFrom(h,"utf-8"):function(p){var d,g,m,y,w,x=p.length,_=0;for(y=0;y>>6:(g<65536?d[w++]=224|g>>>12:(d[w++]=240|g>>>18,d[w++]=128|g>>>12&63),d[w++]=128|g>>>6&63),d[w++]=128|63&g);return d}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(p){var d,g,m,y,w=p.length,x=new Array(2*w);for(d=g=0;d>10&1023,x[g++]=56320|1023&m)}return x.length!==g&&(x.subarray?x=x.subarray(0,g):x.length=g),s.applyFromCharCode(x)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(u,l),u.prototype.processChunk=function(h){var p=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var d=p;(p=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),p.set(d,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=function(y,w){var x;for((w=w||y.length)>y.length&&(w=y.length),x=w-1;0<=x&&(192&y[x])==128;)x--;return x<0||x===0?w:x+A[y[x]]>w?x: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:h.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(f,l),f.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=f},{"./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(d){return d}function c(d,g){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var p,d,g,m=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?f[g++]=224|h>>>12:(f[g++]=240|h>>>18,f[g++]=128|h>>>12&63),f[g++]=128|h>>>6&63),f[g++]=128|63&h);return f},i.buf2binstring=function(u){return c(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),h=0,p=f.length;h>10&1023,y[p++]=56320|1023&d)}return c(y,p)},i.utf8border=function(u,f){var h;for((f=f||u.length)>u.length&&(f=u.length),h=f-1;0<=h&&(192&u[h])==128;)h--;return h<0||h===0?f:h+l[u[h]]>f?h:f}},{"./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 f=A;f>>8^c[255&(o^a[f])];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,f=4,h=0,p=-2,d=-1,g=4,m=2,y=8,w=9,x=286,_=30,C=19,S=2*x+1,b=15,M=3,D=258,$=D+M+1,H=42,I=113,v=1,E=2,U=3,P=4;function L(Q,de){return Q.msg=c[de],de}function z(Q){return(Q<<1)-(4Q.avail_out&&(Ae=Q.avail_out),Ae!==0&&(o.arraySet(Q.output,de.pending_buf,de.pending_out,Ae,Q.next_out),Q.next_out+=Ae,de.pending_out+=Ae,Q.total_out+=Ae,Q.avail_out-=Ae,de.pending-=Ae,de.pending===0&&(de.pending_out=0))}function B(Q,de){a._tr_flush_block(Q,0<=Q.block_start?Q.block_start:-1,Q.strstart-Q.block_start,de),Q.block_start=Q.strstart,O(Q.strm)}function W(Q,de){Q.pending_buf[Q.pending++]=de}function ee(Q,de){Q.pending_buf[Q.pending++]=de>>>8&255,Q.pending_buf[Q.pending++]=255&de}function F(Q,de){var Ae,q,J=Q.max_chain_length,ce=Q.strstart,xe=Q.prev_length,be=Q.nice_match,N=Q.strstart>Q.w_size-$?Q.strstart-(Q.w_size-$):0,j=Q.window,se=Q.w_mask,he=Q.prev,me=Q.strstart+D,G=j[ce+xe-1],R=j[ce+xe];Q.prev_length>=Q.good_match&&(J>>=2),be>Q.lookahead&&(be=Q.lookahead);do if(j[(Ae=de)+xe]===R&&j[Ae+xe-1]===G&&j[Ae]===j[ce]&&j[++Ae]===j[ce+1]){ce+=2,Ae++;do;while(j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&ceN&&--J!=0);return xe<=Q.lookahead?xe:Q.lookahead}function X(Q){var de,Ae,q,J,ce,xe,be,N,j,se,he=Q.w_size;do{if(J=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=he+(he-$)){for(o.arraySet(Q.window,Q.window,he,he,0),Q.match_start-=he,Q.strstart-=he,Q.block_start-=he,de=Ae=Q.hash_size;q=Q.head[--de],Q.head[de]=he<=q?q-he:0,--Ae;);for(de=Ae=he;q=Q.prev[--de],Q.prev[de]=he<=q?q-he:0,--Ae;);J+=he}if(Q.strm.avail_in===0)break;if(xe=Q.strm,be=Q.window,N=Q.strstart+Q.lookahead,j=J,se=void 0,se=xe.avail_in,j=M)for(ce=Q.strstart-Q.insert,Q.ins_h=Q.window[ce],Q.ins_h=(Q.ins_h<=M&&(Q.ins_h=(Q.ins_h<=M)if(q=a._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-M),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=M){for(Q.match_length--;Q.strstart++,Q.ins_h=(Q.ins_h<=M&&(Q.ins_h=(Q.ins_h<=M&&Q.match_length<=Q.prev_length){for(J=Q.strstart+Q.lookahead-M,q=a._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-M),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;++Q.strstart<=J&&(Q.ins_h=(Q.ins_h<Q.pending_buf_size-5&&(Ae=Q.pending_buf_size-5);;){if(Q.lookahead<=1){if(X(Q),Q.lookahead===0&&de===u)return v;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var q=Q.block_start+Ae;if((Q.strstart===0||Q.strstart>=q)&&(Q.lookahead=Q.strstart-q,Q.strstart=q,B(Q,!1),Q.strm.avail_out===0)||Q.strstart-Q.block_start>=Q.w_size-$&&(B(Q,!1),Q.strm.avail_out===0))return v}return Q.insert=0,de===f?(B(Q,!0),Q.strm.avail_out===0?U:P):(Q.strstart>Q.block_start&&(B(Q,!1),Q.strm.avail_out),v)}),new oe(4,4,8,4,ue),new oe(4,5,16,8,ue),new oe(4,6,32,32,ue),new oe(4,4,16,16,le),new oe(8,16,32,32,le),new oe(8,16,128,128,le),new oe(8,32,128,256,le),new oe(32,128,258,1024,le),new oe(32,258,258,4096,le)],i.deflateInit=function(Q,de){return Re(Q,de,y,15,8,0)},i.deflateInit2=Re,i.deflateReset=_e,i.deflateResetKeep=pe,i.deflateSetHeader=function(Q,de){return Q&&Q.state?Q.state.wrap!==2?p:(Q.state.gzhead=de,h):p},i.deflate=function(Q,de){var Ae,q,J,ce;if(!Q||!Q.state||5>8&255),W(q,q.gzhead.time>>16&255),W(q,q.gzhead.time>>24&255),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(W(q,255&q.gzhead.extra.length),W(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(Q.adler=A(Q.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(W(q,0),W(q,0),W(q,0),W(q,0),W(q,0),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,3),q.status=I);else{var xe=y+(q.w_bits-8<<4)<<8;xe|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(xe|=32),xe+=31-xe%31,q.status=I,ee(q,xe),q.strstart!==0&&(ee(q,Q.adler>>>16),ee(q,65535&Q.adler)),Q.adler=1}if(q.status===69)if(q.gzhead.extra){for(J=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending!==q.pending_buf_size));)W(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){J=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),ce===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){J=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),ce===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&O(Q),q.pending+2<=q.pending_buf_size&&(W(q,255&Q.adler),W(q,Q.adler>>8&255),Q.adler=0,q.status=I)):q.status=I),q.pending!==0){if(O(Q),Q.avail_out===0)return q.last_flush=-1,h}else if(Q.avail_in===0&&z(de)<=z(Ae)&&de!==f)return L(Q,-5);if(q.status===666&&Q.avail_in!==0)return L(Q,-5);if(Q.avail_in!==0||q.lookahead!==0||de!==u&&q.status!==666){var be=q.strategy===2?function(N,j){for(var se;;){if(N.lookahead===0&&(X(N),N.lookahead===0)){if(j===u)return v;break}if(N.match_length=0,se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,se&&(B(N,!1),N.strm.avail_out===0))return v}return N.insert=0,j===f?(B(N,!0),N.strm.avail_out===0?U:P):N.last_lit&&(B(N,!1),N.strm.avail_out===0)?v:E}(q,de):q.strategy===3?function(N,j){for(var se,he,me,G,R=N.window;;){if(N.lookahead<=D){if(X(N),N.lookahead<=D&&j===u)return v;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=M&&0N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=M?(se=a._tr_tally(N,1,N.match_length-M),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),se&&(B(N,!1),N.strm.avail_out===0))return v}return N.insert=0,j===f?(B(N,!0),N.strm.avail_out===0?U:P):N.last_lit&&(B(N,!1),N.strm.avail_out===0)?v:E}(q,de):s[q.level].func(q,de);if(be!==U&&be!==P||(q.status=666),be===v||be===U)return Q.avail_out===0&&(q.last_flush=-1),h;if(be===E&&(de===1?a._tr_align(q):de!==5&&(a._tr_stored_block(q,0,0,!1),de===3&&(K(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),O(Q),Q.avail_out===0))return q.last_flush=-1,h}return de!==f?h:q.wrap<=0?1:(q.wrap===2?(W(q,255&Q.adler),W(q,Q.adler>>8&255),W(q,Q.adler>>16&255),W(q,Q.adler>>24&255),W(q,255&Q.total_in),W(q,Q.total_in>>8&255),W(q,Q.total_in>>16&255),W(q,Q.total_in>>24&255)):(ee(q,Q.adler>>>16),ee(q,65535&Q.adler)),O(Q),0=Ae.w_size&&(ce===0&&(K(Ae.head),Ae.strstart=0,Ae.block_start=0,Ae.insert=0),j=new o.Buf8(Ae.w_size),o.arraySet(j,de,se-Ae.w_size,Ae.w_size,0),de=j,se=Ae.w_size),xe=Q.avail_in,be=Q.next_in,N=Q.input,Q.avail_in=se,Q.next_in=0,Q.input=de,X(Ae);Ae.lookahead>=M;){for(q=Ae.strstart,J=Ae.lookahead-(M-1);Ae.ins_h=(Ae.ins_h<>>=M=b>>>24,w-=M,(M=b>>>16&255)===0)E[c++]=65535&b;else{if(!(16&M)){if(!(64&M)){b=x[(65535&b)+(y&(1<>>=M,w-=M),w<15&&(y+=v[l++]<>>=M=b>>>24,w-=M,!(16&(M=b>>>16&255))){if(!(64&M)){b=_[(65535&b)+(y&(1<>>=M,w-=M,(M=c-u)<$){if(d<(M=$-M)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(I=m,(H=0)===g){if(H+=p-M,M>3,y&=(1<<(w-=D<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(H>>>8&65280)+((65280&H)<<8)+((255&H)<<24)}function y(){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(H){var I;return H&&H.state?(I=H.state,H.total_in=H.total_out=I.total=0,H.msg="",I.wrap&&(H.adler=1&I.wrap),I.mode=p,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new s.Buf32(d),I.distcode=I.distdyn=new s.Buf32(g),I.sane=1,I.back=-1,f):h}function x(H){var I;return H&&H.state?((I=H.state).wsize=0,I.whave=0,I.wnext=0,w(H)):h}function _(H,I){var v,E;return H&&H.state?(E=H.state,I<0?(v=0,I=-I):(v=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15=P.wsize?(s.arraySet(P.window,I,v-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(E<(U=P.wsize-P.wnext)&&(U=E),s.arraySet(P.window,I,v-E,U,P.wnext),(E-=U)?(s.arraySet(P.window,I,v-E,E,0),P.wnext=E,P.whave=P.wsize):(P.wnext+=U,P.wnext===P.wsize&&(P.wnext=0),P.whave>>8&255,v.check=a(v.check,ce,2,0),B=O=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&O)<<8)+(O>>8))%31){H.msg="incorrect header check",v.mode=30;break}if((15&O)!=8){H.msg="unknown compression method",v.mode=30;break}if(B-=4,Q=8+(15&(O>>>=4)),v.wbits===0)v.wbits=Q;else if(Q>v.wbits){H.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(ce[0]=255&O,ce[1]=O>>>8&255,v.check=a(v.check,ce,2,0)),B=O=0,v.mode=3;case 3:for(;B<32;){if(z===0)break e;z--,O+=E[P++]<>>8&255,ce[2]=O>>>16&255,ce[3]=O>>>24&255,v.check=a(v.check,ce,4,0)),B=O=0,v.mode=4;case 4:for(;B<16;){if(z===0)break e;z--,O+=E[P++]<>8),512&v.flags&&(ce[0]=255&O,ce[1]=O>>>8&255,v.check=a(v.check,ce,2,0)),B=O=0,v.mode=5;case 5:if(1024&v.flags){for(;B<16;){if(z===0)break e;z--,O+=E[P++]<>>8&255,v.check=a(v.check,ce,2,0)),B=O=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(z<(F=v.length)&&(F=z),F&&(v.head&&(Q=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,E,P,F,Q)),512&v.flags&&(v.check=a(v.check,E,F,P)),z-=F,P+=F,v.length-=F),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(z===0)break e;for(F=0;Q=E[P+F++],v.head&&Q&&v.length<65536&&(v.head.name+=String.fromCharCode(Q)),Q&&F>9&1,v.head.done=!0),H.adler=v.check=0,v.mode=12;break;case 10:for(;B<32;){if(z===0)break e;z--,O+=E[P++]<>>=7&B,B-=7&B,v.mode=27;break}for(;B<3;){if(z===0)break e;z--,O+=E[P++]<>>=1)){case 0:v.mode=14;break;case 1:if(D(v),v.mode=20,I!==6)break;O>>>=2,B-=2;break e;case 2:v.mode=17;break;case 3:H.msg="invalid block type",v.mode=30}O>>>=2,B-=2;break;case 14:for(O>>>=7&B,B-=7&B;B<32;){if(z===0)break e;z--,O+=E[P++]<>>16^65535)){H.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&O,B=O=0,v.mode=15,I===6)break e;case 15:v.mode=16;case 16:if(F=v.length){if(z>>=5,B-=5,v.ndist=1+(31&O),O>>>=5,B-=5,v.ncode=4+(15&O),O>>>=4,B-=4,286>>=3,B-=3}for(;v.have<19;)v.lens[xe[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,Ae={bits:v.lenbits},de=A(0,v.lens,0,19,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,de){H.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=le,B-=le,v.lens[v.have++]=re;else{if(re===16){for(q=le+2;B>>=le,B-=le,v.have===0){H.msg="invalid bit length repeat",v.mode=30;break}Q=v.lens[v.have-1],F=3+(3&O),O>>>=2,B-=2}else if(re===17){for(q=le+3;B>>=le)),O>>>=3,B-=3}else{for(q=le+7;B>>=le)),O>>>=7,B-=7}if(v.have+F>v.nlen+v.ndist){H.msg="invalid bit length repeat",v.mode=30;break}for(;F--;)v.lens[v.have++]=Q}}if(v.mode===30)break;if(v.lens[256]===0){H.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,Ae={bits:v.lenbits},de=A(c,v.lens,0,v.nlen,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,de){H.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,Ae={bits:v.distbits},de=A(u,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,Ae),v.distbits=Ae.bits,de){H.msg="invalid distances set",v.mode=30;break}if(v.mode=20,I===6)break e;case 20:v.mode=21;case 21:if(6<=z&&258<=K){H.next_out=L,H.avail_out=K,H.next_in=P,H.avail_in=z,v.hold=O,v.bits=B,l(H,ee),L=H.next_out,U=H.output,K=H.avail_out,P=H.next_in,E=H.input,z=H.avail_in,O=v.hold,B=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;oe=(J=v.lencode[O&(1<>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>pe)])>>>16&255,re=65535&J,!(pe+(le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=pe,B-=pe,v.back+=pe}if(O>>>=le,B-=le,v.back+=le,v.length=re,oe===0){v.mode=26;break}if(32&oe){v.back=-1,v.mode=12;break}if(64&oe){H.msg="invalid literal/length code",v.mode=30;break}v.extra=15&oe,v.mode=22;case 22:if(v.extra){for(q=v.extra;B>>=v.extra,B-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;oe=(J=v.distcode[O&(1<>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>pe)])>>>16&255,re=65535&J,!(pe+(le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=pe,B-=pe,v.back+=pe}if(O>>>=le,B-=le,v.back+=le,64&oe){H.msg="invalid distance code",v.mode=30;break}v.offset=re,v.extra=15&oe,v.mode=24;case 24:if(v.extra){for(q=v.extra;B>>=v.extra,B-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){H.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(K===0)break e;if(F=ee-K,v.offset>F){if((F=v.offset-F)>v.whave&&v.sane){H.msg="invalid distance too far back",v.mode=30;break}X=F>v.wnext?(F-=v.wnext,v.wsize-F):v.wnext-F,F>v.length&&(F=v.length),ue=v.window}else ue=U,X=L-v.offset,F=v.length;for(KS?(M=X[ue+g[I]],B[W+g[I]]):(M=96,0),y=1<>L)+(w-=y)]=b<<24|M<<16|D|0,w!==0;);for(y=1<>=1;if(y!==0?(O&=y-1,O+=y):O=0,I++,--ee[H]==0){if(H===E)break;H=u[f+g[I]]}if(U>>7)]}function W(J,ce){J.pending_buf[J.pending++]=255&ce,J.pending_buf[J.pending++]=ce>>>8&255}function ee(J,ce,xe){J.bi_valid>m-xe?(J.bi_buf|=ce<>m-J.bi_valid,J.bi_valid+=xe-m):(J.bi_buf|=ce<>>=1,xe<<=1,0<--ce;);return xe>>>1}function ue(J,ce,xe){var be,N,j=new Array(g+1),se=0;for(be=1;be<=g;be++)j[be]=se=se+xe[be-1]<<1;for(N=0;N<=ce;N++){var he=J[2*N+1];he!==0&&(J[2*N]=X(j[he]++,he))}}function le(J){var ce;for(ce=0;ce>1;1<=xe;xe--)pe(J,j,xe);for(N=me;xe=J.heap[1],J.heap[1]=J.heap[J.heap_len--],pe(J,j,1),be=J.heap[1],J.heap[--J.heap_max]=xe,J.heap[--J.heap_max]=be,j[2*N]=j[2*xe]+j[2*be],J.depth[N]=(J.depth[xe]>=J.depth[be]?J.depth[xe]:J.depth[be])+1,j[2*xe+1]=j[2*be+1]=N,J.heap[1]=N++,pe(J,j,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(R,T){var V,te,ae,ie,Te,Me,Le=T.dyn_tree,ke=T.max_code,De=T.stat_desc.static_tree,fe=T.stat_desc.has_stree,Ce=T.stat_desc.extra_bits,Se=T.stat_desc.extra_base,Fe=T.stat_desc.max_length,We=0;for(ie=0;ie<=g;ie++)R.bl_count[ie]=0;for(Le[2*R.heap[R.heap_max]+1]=0,V=R.heap_max+1;V>=7;N>>=1)if(1&G&&he.dyn_ltree[2*me]!==0)return o;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(j=J.static_len+3+7>>>3)<=N&&(N=j)):N=j=xe+5,xe+4<=N&&ce!==-1?q(J,ce,xe,be):J.strategy===4||j===N?(ee(J,2+(be?1:0),3),_e(J,$,H)):(ee(J,4+(be?1:0),3),function(he,me,G,R){var T;for(ee(he,me-257,5),ee(he,G-1,5),ee(he,R-4,4),T=0;T>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&ce,J.pending_buf[J.l_buf+J.last_lit]=255&xe,J.last_lit++,ce===0?J.dyn_ltree[2*xe]++:(J.matches++,ce--,J.dyn_ltree[2*(v[xe]+u+1)]++,J.dyn_dtree[2*B(ce)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){ee(J,2,3),F(J,w,$),function(ce){ce.bi_valid===16?(W(ce,ce.bi_buf),ce.bi_buf=0,ce.bi_valid=0):8<=ce.bi_valid&&(ce.pending_buf[ce.pending++]=255&ce.bi_buf,ce.bi_buf>>=8,ce.bi_valid-=8)}(J)}},{"../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,f=1,h={},p=!1,d=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(x){process.nextTick(function(){y(x)})}:function(){if(o.postMessage&&!o.importScripts){var x=!0,_=o.onmessage;return o.onmessage=function(){x=!1},o.postMessage("","*"),o.onmessage=_,x}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(x){o.postMessage(u+x,"*")}):o.MessageChannel?((c=new MessageChannel).port1.onmessage=function(x){y(x.data)},function(x){c.port2.postMessage(x)}):d&&"onreadystatechange"in d.createElement("script")?(A=d.documentElement,function(x){var _=d.createElement("script");_.onreadystatechange=function(){y(x),_.onreadystatechange=null,A.removeChild(_),_=null},A.appendChild(_)}):function(x){setTimeout(y,0,x)},g.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var _=new Array(arguments.length-1),C=0;C<_.length;C++)_[C]=arguments[C+1];var S={callback:x,args:_};return h[f]=S,l(f),f++},g.clearImmediate=m}function m(x){delete h[x]}function y(x){if(p)setTimeout(y,0,x);else{var _=h[x];if(_){p=!0;try{(function(C){var S=C.callback,b=C.args;switch(b.length){case 0:S();break;case 1:S(b[0]);break;case 2:S(b[0],b[1]);break;case 3:S(b[0],b[1],b[2]);break;default:S.apply(a,b)}})(_)}finally{m(x),p=!1}}}}function w(x){x.source===o&&typeof x.data=="string"&&x.data.indexOf(u)===0&&y(+x.data.slice(u.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof ta<"u"?ta:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(P5);var fhe=P5.exports;const hhe=bl(fhe);class ad{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 hhe;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 Z;class dhe{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:f=64,backgroundDescription:h="",width:p=512,height:d=512,dataCollection:g}=a,m=l+A+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.calculateBoneOffsets(.2);let y=0;const w=this;if(Array.isArray(g)){const x=t??new ad;await(async()=>{if(Array.isArray(g))for(let C=0;C{const K=[];return ct(U).forEach(B=>{K.push({id:B})}),K},L=U==null?y.characterManager.getTraits(S):P();if(L==null){console.log("SKipping Thumbnail Generation for trait group "+S+", its not present in the character manifest.");continue}const z=wT(b);E?y.screenshotManager.setCameraFrameWithName(E,z):y.screenshotManager.frameShot(M,$,z,D,H);for(let K=0;K{const[e,t]=ye.useState(null),[r,i]=ye.useState(null),[s,o]=ye.useState(null),[a,l]=ye.useState(null),[A,c]=ye.useState(null),[u,f]=ye.useState(null),[h,p]=ye.useState(null),[d,g]=ye.useState(null),[m,y]=ye.useState(null),[w,x]=ye.useState(null),[_,C]=ye.useState(null),[S,b]=ye.useState(!1);let M=!1,[D,$]=ye.useState(!1);ye.useEffect(()=>{if(M||D)return;$(!0),M=!0;const{scene:E,camera:U,controls:P,characterManager:L,sceneElements:z}=uhe("editor-scene");y(U),g(E),t(L),c(z),f(L.animationManager),p(L.lookAtManager),x(P),i(new dhe(L)),o(new phe(L)),l(new mhe(L))},[]);const H=E=>{E==null&&(E=!S),b(E),d.traverse(U=>{U.isMesh&&U.setDebugMode&&U.setDebugMode(E)})};ye.useEffect(()=>{if(_!=null&&_.defaultAnimations){const E=_.defaultAnimations.map(U=>U.location);u.storeDefaultAnimationPaths(E,"")}},[_]);const I=E=>{E?d.add(A):d.remove(A)},v=E=>{w&&(tC.to(w.target,{x:E.targetX??0,y:E.targetY??0,z:E.targetZ??0,duration:1}),tC.fromTo(w,{maxDistance:w.getDistance(),minDistance:w.getDistance(),minPolarAngle:w.getPolarAngle(),maxPolarAngle:w.getPolarAngle(),minAzimuthAngle:w.getAzimuthalAngle(),maxAzimuthAngle:w.getAzimuthalAngle()},{maxDistance:E.distance,minDistance:E.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 k.jsx(or.Provider,{value:{manifest:_,setManifest:C,scene:d,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:I,debugMode:S,toggleDebugMode:H,animationManager:u,lookAtManager:h,camera:m,moveCamera:v,controls:w,sceneElements:A},children:n.children})},vhe={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},dt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},Ui=Y.createContext(),yhe=n=>{const[e,t]=Y.useState(vhe.NORMAL),[r,i]=Y.useState(dt.LANDING),[s,o]=Y.useState(!1),[a,l]=Y.useState(!1);return k.jsx(Ui.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},whe="modulepreload",xhe=function(n){return"/CharacterStudio/"+n},q3={},_he=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=xhe(s),s in q3)return;q3[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":whe,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 zw(){return zw=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function Bhe(n){ye.useEffect(n,[])}function Ehe(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,f=bhe(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),h=Y.useRef(null),p=Y.useRef(!1),d=Y.useState(null),g=d[0],m=d[1],y=Y.useState(null),w=y[0],x=y[1],_=function(){typeof u=="function"&&u.call(this),p.current&&m(this.duration()*1e3),x(this)};Bhe(function(){return _he(()=>import("./howler-1d21b928.js").then(D=>D.h),[]).then(function(D){if(!p.current){var $;h.current=($=D.Howl)!==null&&$!==void 0?$:D.default.Howl,p.current=!0,new h.current(zw({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:_},f))}}),function(){p.current=!1}}),Y.useEffect(function(){h.current&&w&&x(new h.current(zw({src:Array.isArray(n)?n:[n],volume:i,onload:_},f)))},[JSON.stringify(n)]),Y.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var C=Y.useCallback(function(D){typeof D>"u"&&(D={}),!(!w||!l&&!D.forceSoundEnabled)&&(c&&w.stop(),D.playbackRate&&w.rate(D.playbackRate),w.play(D.id))},[w,l,c]),S=Y.useCallback(function(D){w&&w.stop(D)},[w]),b=Y.useCallback(function(D){w&&w.pause(D)},[w]),M=[C,{sound:w,stop:S,pause:b,duration:g}];return M}const Che=[{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}],She="/CharacterStudio/assets/sounds-3322d50e.mp3",Ys=ye.createContext(),Mhe=n=>{const e=i=>Che.find(s=>i.test(s.name)),[t]=Ehe(She,{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 k.jsx(Ys.Provider,{value:{playSound:r},children:n.children})};function ks(n){"@babel/helpers - typeof";return ks=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},ks(n)}function Xs(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function The(n,e){if(ks(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function D5(n){var e=The(n,"string");return ks(e)=="symbol"?e:e+""}function eP(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]:{};Xs(this,n),this.init(e,t)}return Zs(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||Fhe,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 sP(n,e,t){var r=ET(n,e,Object),i=r.obj,s=r.k;i[s]=t}function Phe(n,e,t,r){var i=ET(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 Gw(n,e){var t=ET(n,e),r=t.obj,i=t.k;if(r)return r[i]}function oP(n,e,t){var r=Gw(n,t);return r!==void 0?r:Gw(e,t)}function Q5(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]):Q5(n[r],e[r],t):n[r]=e[r]);return n}function Zu(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Dhe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Ohe(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return Dhe[e]}):n}var o_=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Nhe=[" ",",","?","!",";"];function khe(n,e,t){e=e||"",t=t||"";var r=Nhe.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 aP(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 _v(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 H5(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?H5(l,A,t):void 0}i=i[r[s]]}return i}}var zhe=function(n){s_(t,n);var e=Qhe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Xs(this,t),i=e.call(this),o_&&QA.call(IA(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 Zs(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=Gw(this.data,c);return u||!A||typeof o!="string"?u:H5(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),sP(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=Gw(this.data,c)||{};a?Q5(u,o,l):u=_v(_v({},u),o),sP(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"?_v(_v({},{}),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}(QA),z5={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 lP(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 ni(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 AP={},cP=function(n){s_(t,n);var e=Ghe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Xs(this,t),i=e.call(this),o_&&QA.call(IA(i)),Lhe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,IA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=na.create("translator"),i}return Zs(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&&!khe(i,o,a);if(A&&!c){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var f=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(f[0])>-1)&&(l=f.shift()),i=f.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if(ks(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,f=c.namespaces,h=f[f.length-1],p=s.lng||this.language,d=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(d){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(h).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h}:"".concat(h).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h}:u}var m=this.resolve(i,s),y=m&&m.res,w=m&&m.usedKey||u,x=m&&m.exactUsedKey||u,_=Object.prototype.toString.apply(y),C=["[object Number]","[object Function]","[object RegExp]"],S=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,M=typeof y!="string"&&typeof y!="boolean"&&typeof y!="number";if(b&&y&&M&&C.indexOf(_)<0&&!(typeof S=="string"&&_==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var D=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,y,ni(ni({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(m.res=D,m):D}if(A){var $=_==="[object Array]",H=$?[]:{},I=$?x:w;for(var v in y)if(Object.prototype.hasOwnProperty.call(y,v)){var E="".concat(I).concat(A).concat(v);H[v]=this.translate(E,ni(ni({},s),{joinArrays:!1,ns:f})),H[v]===E&&(H[v]=y[v])}y=H}}else if(b&&typeof S=="string"&&_==="[object Array]")y=y.join(S),y&&(y=this.extendTranslation(y,i,s,o));else{var U=!1,P=!1,L=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),K=L?this.pluralResolver.getSuffix(p,s.count,s):"",O=s["defaultValue".concat(K)]||s.defaultValue;!this.isValidLookup(y)&&z&&(U=!0,y=O),this.isValidLookup(y)||(P=!0,y=u);var B=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,W=B&&P?void 0:y,ee=z&&O!==y&&this.options.updateMissing;if(P||U||ee){if(this.logger.log(ee?"updateKey":"missingKey",p,h,u,ee?O:y),A){var F=this.resolve(u,ni(ni({},s),{},{keySeparator:!1}));F&&F.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 X=[],ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(var le=0;le1&&arguments[1]!==void 0?arguments[1]:{},a,l,A,c,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var h=s.extractFromKey(f,o),p=h.key;l=p;var d=h.namespaces;s.options.fallbackNS&&(d=d.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",m=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),y=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);d.forEach(function(x){s.isValidLookup(a)||(u=x,!AP["".concat(w[0],"-").concat(x)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(AP["".concat(w[0],"-").concat(x)]=!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(_){if(!s.isValidLookup(a)){c=_;var C=[p];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(C,p,_,x,o);else{var S;g&&(S=s.pluralResolver.getSuffix(_,o.count,o));var b="".concat(s.options.pluralSeparator,"zero");if(g&&(C.push(p+S),m&&C.push(p+b)),y){var M="".concat(p).concat(s.options.contextSeparator).concat(o.context);C.push(M),g&&(C.push(M+S),m&&C.push(M+b))}}for(var D;D=C.pop();)s.isValidLookup(a)||(A=D,a=s.getResource(_,x,D,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}(QA);function pB(n){return n.charAt(0).toUpperCase()+n.slice(1)}var uP=function(){function n(e){Xs(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=na.create("languageUtils")}return Zs(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]=pB(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]=pB(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=pB(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}(),jhe=[{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}],Whe={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}},Khe=["v1","v2","v3"],fP={zero:0,one:1,two:2,few:3,many:4,other:5};function $he(){var n={};return jhe.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Whe[e.fc]}})}),n}var Yhe=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xs(this,n),this.languageUtils=e,this.options=t,this.logger=na.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=$he()}return Zs(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 fP[o]-fP[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!Khe.includes(this.options.compatibilityJSON)}}]),n}();function hP(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 Ao(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Xs(this,n),this.logger=na.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Zs(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:Ohe,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Zu(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Zu(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?Zu(r.nestingPrefix):r.nestingPrefixEscaped||Zu("$t("),this.nestingSuffix=r.nestingSuffix?Zu(r.nestingSuffix):r.nestingSuffixEscaped||Zu(")"),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 f=function(m){if(m.indexOf(o.formatSeparator)<0){var y=oP(r,c,m);return o.alwaysFormat?o.format(y,void 0,i,Ao(Ao(Ao({},s),r),{},{interpolationkey:m})):y}var w=m.split(o.formatSeparator),x=w.shift().trim(),_=w.join(o.formatSeparator).trim();return o.format(oP(r,c,x),_,i,Ao(Ao(Ao({},s),r),{},{interpolationkey:x}))};this.resetRegExp();var h=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,p=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,d=[{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 d.forEach(function(g){for(A=0;a=g.regex.exec(t);){var m=a[1].trim();if(l=f(m),l===void 0)if(typeof h=="function"){var y=h(t,a,s);l=typeof y=="string"?y:""}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=iP(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(h,p){var d=this.nestingOptionsSeparator;if(h.indexOf(d)<0)return h;var g=h.split(new RegExp("".concat(d,"[ ]*{"))),m="{".concat(g[1]);h=g[0],m=this.interpolate(m,l);var y=m.match(/'/g),w=m.match(/"/g);(y&&y.length%2===0&&!w||w.length%2!==0)&&(m=m.replace(/'/g,'"'));try{l=JSON.parse(m),p&&(l=Ao(Ao({},p),l))}catch(x){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),x),"".concat(h).concat(d).concat(m)}return delete l.defaultValue,h}for(;o=this.nestingRegexp.exec(t);){var c=[];l=Ao({},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 f=o[1].split(this.formatSeparator).map(function(h){return h.trim()});o[1]=f.shift(),c=f,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=iP(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=c.reduce(function(h,p){return i.format(h,p,s.lng,Ao(Ao({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function dP(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 Ha(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=Rhe(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 Ju(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 Jhe=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xs(this,n),this.logger=na.create("formatter"),this.options=e,this.formats={number:Ju(function(t,r){var i=new Intl.NumberFormat(t,Ha({},r));return function(s){return i.format(s)}}),currency:Ju(function(t,r){var i=new Intl.NumberFormat(t,Ha(Ha({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Ju(function(t,r){var i=new Intl.DateTimeFormat(t,Ha({},r));return function(s){return i.format(s)}}),relativetime:Ju(function(t,r){var i=new Intl.RelativeTimeFormat(t,Ha({},r));return function(s){return i.format(s,r.range||"day")}}),list:Ju(function(t,r){var i=new Intl.ListFormat(t,Ha({},r));return function(s){return i.format(s)}})},this.init(e)}return Zs(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()]=Ju(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=Zhe(c),f=u.formatName,h=u.formatOptions;if(s.formats[f]){var p=A;try{var d=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=d.locale||d.lng||o.locale||o.lng||i;p=s.formats[f](A,g,Ha(Ha(Ha({},h),o),d))}catch(m){s.logger.warn(m)}return p}else s.logger.warn("there was no format function for ".concat(f));return A},t);return l}}]),n}();function pP(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 mP(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 tde(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var nde=function(n){s_(t,n);var e=qhe(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Xs(this,t),o=e.call(this),o_&&QA.call(IA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=na.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 Zs(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,A={},c={},u={},f={};return i.forEach(function(h){var p=!0;s.forEach(function(d){var g="".concat(h,"|").concat(d);!o.reload&&l.store.hasResourceBundle(h,d)?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),f[d]===void 0&&(f[d]=!0)))}),p||(u[h]=!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(f)}}},{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){Phe(u.loaded,[l],A),tde(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){c[f]||(c[f]={});var h=u.loaded[f];h.length&&h.forEach(function(p){c[f][p]===void 0&&(c[f][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(d,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(d&&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=mP(mP({},A),{},{isUpdate:l}),f=this.backend.create.bind(this.backend);if(f.length<6)try{var h;f.length===5?h=f(i,s,o,a,u):h=f(i,s,o,a),h&&typeof h.then=="function"?h.then(function(p){return c(null,p)}).catch(c):c(null,h)}catch(p){c(p)}else f(i,s,o,a,c,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(QA);function gP(){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(ks(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),ks(e[2])==="object"||ks(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 vP(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 yP(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 Oo(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 bv(){}function sde(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var Vw=function(n){s_(t,n);var e=rde(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(Xs(this,t),r=e.call(this),o_&&QA.call(IA(r)),r.options=vP(i),r.services={},r.logger=na,r.modules={external:[]},sde(IA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),Eg(r,IA(r));setTimeout(function(){r.init(i,s)},0)}return r}return Zs(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=gP();this.options=Oo(Oo(Oo({},a),this.options),vP(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Oo(Oo({},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?na.init(l(this.modules.logger),this.options):na.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=Jhe);var c=new uP(this.options);this.store=new zhe(this.options.resources,this.options);var u=this.services;u.logger=na,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new Yhe(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 Xhe(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new nde(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(m){for(var y=arguments.length,w=new Array(y>1?y-1:0),x=1;x1?y-1:0),x=1;x0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var h=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];h.forEach(function(m){i[m]=function(){var y;return(y=i.store)[m].apply(y,arguments)}});var p=["addResource","addResources","addResourceBundle","removeResourceBundle"];p.forEach(function(m){i[m]=function(){var y;return(y=i.store)[m].apply(y,arguments),i}});var d=op(),g=function(){var y=function(x,_){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),d.resolve(_),o(x,_)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return y(null,i.t.bind(i));i.changeLanguage(i.options.lng,y)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),d}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bv,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(h){if(h){var p=s.services.languageUtils.toResolveHierarchy(h);p.forEach(function(d){A.indexOf(d)<0&&A.push(d)})}};if(l)c(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return c(f)})}this.options.preload&&this.options.preload.forEach(function(f){return c(f)}),this.services.backendConnector.load(A,this.options.ns,function(f){!f&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(f)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=op();return i||(i=this.languages),s||(s=this.options.ns),o||(o=bv),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"&&z5.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=op();this.emit("languageChanging",i);var l=function(f){o.language=f,o.languages=o.services.languageUtils.toResolveHierarchy(f),o.resolvedLanguage=void 0,o.setResolvedLanguage(f)},A=function(f,h){h?(l(h),o.translator.changeLanguage(h),o.isLanguageChangingTo=void 0,o.emit("languageChanged",h),o.logger.log("languageChanged",h)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(f,function(){return o.t.apply(o,arguments)})},c=function(f){!i&&!f&&o.services.languageDetector&&(f=[]);var h=typeof f=="string"?f:o.services.languageUtils.getBestMatchFromCodes(f);h&&(o.language||l(h),o.translator.language||o.translator.changeLanguage(h),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(h)),o.loadResources(h,function(p){A(p,h)})};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 f;if(ks(u)!=="object"){for(var h=arguments.length,p=new Array(h>2?h-2:0),d=2;d1&&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(h,p){var d=s.services.backendConnector.state["".concat(h,"|").concat(p)];return d===-1||d===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=op();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=op();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 uP(gP());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]:bv,a=Oo(Oo(Oo({},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=Oo({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new cP(l.services,l.options),l.translator.on("*",function(c){for(var u=arguments.length,f=new Array(u>1?u-1:0),h=1;h0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new Vw(n,e)});var qr=Vw.createInstance();qr.createInstance=Vw.createInstance;qr.createInstance;qr.dir;qr.init;qr.loadResources;qr.reloadResources;qr.use;qr.changeLanguage;qr.getFixedT;qr.t;qr.exists;qr.setDefaultNamespace;qr.hasLoadedNamespace;qr.loadNamespaces;qr.loadLanguages;function ode(){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 lde(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return JC("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}}):ade(n,e,t)}var Ade=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,cde={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},ude=function(e){return cde[e]},fde=function(e){return e.replace(Ade,ude)};function _P(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 bP(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};qC=bP(bP({},qC),n)}function dde(){return qC}var G5;function pde(n){G5=n}function mde(){return G5}var gde={type:"3rdParty",init:function(e){hde(e.options.react),pde(e)}},vde=ye.createContext(),yde=function(){function n(){Xs(this,n),this.usedNamespaces={}}return Zs(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 wde(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 xde(n,e){return O5(n)||wde(n,e)||N5(n,e)||k5()}function BP(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 mB(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=ye.useContext(vde)||{},i=r.i18n,s=r.defaultNS,o=t||i||mde();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new yde),!o){JC("You will need to pass in an i18next instance by using initReactI18next");var a=function(M,D){return typeof D=="string"?D:D&&ks(D)==="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(M)?M[M.length-1]:M},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&JC("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=mB(mB(mB({},dde()),o.options.react),e),c=A.useSuspense,u=A.keyPrefix,f=n||s||o.options&&o.options.defaultNS;f=typeof f=="string"?[f]:f||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(f);var h=(o.isInitialized||o.initializedStoreOnce)&&f.every(function(b){return lde(b,o,A)});function p(){return o.getFixedT(null,A.nsMode==="fallback"?f:f[0],u)}var d=ye.useState(p),g=xde(d,2),m=g[0],y=g[1],w=f.join(),x=_de(w),_=ye.useRef(!0);ye.useEffect(function(){var b=A.bindI18n,M=A.bindI18nStore;_.current=!0,!h&&!c&&xP(o,f,function(){_.current&&y(p)}),h&&x&&x!==w&&_.current&&y(p);function D(){_.current&&y(p)}return b&&o&&o.on(b,D),M&&o&&o.store.on(M,D),function(){_.current=!1,b&&o&&b.split(" ").forEach(function($){return o.off($,D)}),M&&o&&M.split(" ").forEach(function($){return o.store.off($,D)})}},[o,w]);var C=ye.useRef(!0);ye.useEffect(function(){_.current&&!C.current&&y(p),C.current=!1},[o,u]);var S=[m,o,h];if(S.t=m,S.i18n=o,S.ready=h,h||!h&&!c)return S;throw new Promise(function(b){xP(o,f,function(){b()})})}var V5=[],Bde=V5.forEach,Ede=V5.slice;function Cde(n){return Bde.call(Ede.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var EP=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Sde=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(!EP.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!EP.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},CP={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=Sde(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}},ap=null,SP=function(){if(ap!==null)return ap;try{ap=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{ap=!1}return ap},Ide={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&SP()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&SP()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},lp=null,MP=function(){if(lp!==null)return lp;try{lp=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{lp=!1}return lp},Rde={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&MP()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&MP()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Fde={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},Ude={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}},Lde={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}},Pde={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 Dde(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var j5=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xs(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Zs(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=Cde(r,this.options||{},Dde()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(Mde),this.addDetector(Tde),this.addDetector(Ide),this.addDetector(Rde),this.addDetector(Fde),this.addDetector(Ude),this.addDetector(Lde),this.addDetector(Pde)}},{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}();j5.type="languageDetector";const Ode={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",saveCharacter:"Save Your Character"},callToAction:{next:"Next",back:"Back",randomize:"Randomize",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",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},Nde={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",saveCharacter:"Сохранить Персонажа"},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},kde={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",saveCharacter:"保存角色"},callToAction:{next:"下一步",back:"返回",randomize:"随机",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},Qde={en:Ode,ru:Nde,zh:kde};qr.use(j5).use(gde).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:Qde});const To=ye.createContext(),Hde=n=>{const{t:e}=bde();return k.jsx(To.Provider,{value:{t:e},children:n.children})},zde=` uniform vec3 cameraDir; uniform vec3 eye; @@ -4237,7 +4237,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vWorldPosition = (modelMatrix * vec4( pos, 1.0 )).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 ); } -`,zde=` +`,Gde=` uniform float switchItemDuration; uniform float switchItemTime; uniform vec3 cameraDir; @@ -4275,7 +4275,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a *= (switchItemDuration - switchItemTime); gl_FragColor *= aura; } -`,Gde=` +`,Vde=` uniform vec4 cameraBillboardQuaternion; attribute vec2 scales; @@ -4306,7 +4306,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Vde=` +`,jde=` varying vec2 vUv; varying float vOpacity; varying vec3 vWorldPosition; @@ -4329,7 +4329,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor.a *= vOpacity; } -`,jde=` +`,Wde=` attribute vec2 scales; attribute float opacity; attribute vec3 positions; @@ -4355,7 +4355,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Wde=` +`,Kde=` uniform float radius; varying vec2 vUv; @@ -4378,7 +4378,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a = smoothstep(0.3, 0.8, gl_FragColor.a); gl_FragColor.a *= vOpacity; } -`,Kde=` +`,$de=` uniform vec4 cameraBillboardQuaternion; varying vec2 vUv; @@ -4399,7 +4399,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,$de=` +`,Yde=` varying vec2 vUv; varying vec3 vWorldPosition; @@ -4409,7 +4409,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a = col; gl_FragColor.a *= clamp(vWorldPosition.y * 10., 0.0, 1.0); } -`,Yde=` +`,Xde=` varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -4422,7 +4422,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vWorldPosition = (modelMatrix * vec4( pos, 1.0 )).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 ); } -`,Xde=` +`,Zde=` uniform vec3 cameraDir; uniform vec3 eye; @@ -4444,7 +4444,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor *= pow(1. - vUv.y, 3.0); gl_FragColor *= opacity; } -`,CT=(n,e,t)=>{const r=new $t;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new ww(i,3);r.setAttribute("positions",s);for(const o of e){const{name:a,itemSize:l}=o,A=new Float32Array(t*l);r.setAttribute(a,new ww(A,l))}return r},Zde=n=>{const r=new Gx(.45,.45,5,50,50,!0),i=new Cr({uniforms:{auraTexture:{value:null}},vertexShader:Hde,fragmentShader:zde,transparent:!0,blending:Kc});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new xn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},Jde=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new ou(t,t),i=CT(r,e,20),s=new Cr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Gde,fragmentShader:Vde,depthWrite:!1,blending:Kc}),o=new zx(i,s,20);return o.info={particleCount:20,velocity:[20]},o},qde=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new tT(r,32,32),s=CT(i,t,10),o=new Cr({uniforms:{radius:{value:r}},vertexShader:jde,fragmentShader:Wde,depthWrite:!1,blending:Kc});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new zx(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},epe=n=>{const t=new ou(1,1),r=new Cr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Kde,fragmentShader:$de,depthWrite:!1,blending:Kc});return new xn(t,r)},tpe=n=>{const t=[],s=new Gx(.645,.43,2.5,50,50,!0),o=CT(s,t,2),a=new Cr({uniforms:{opacity:{value:0}},vertexShader:Yde,fragmentShader:Xde,transparent:!0,blending:Kc});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new zx(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},TP=100,npe=0,jw=1.5,rpe=.1,vy=0,IP=1,RP=.05,eS=0,ipe=1,spe=.015,yi={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},ope=new lu,W5=ope.load("./textures/beam2.png");W5.wrapS=As;class ape{constructor(e,t,r){this.scene=e,this.camera=t,this.globalUniforms=r,this.eye=new Z,this.cameraDir=new Z,this.beamMesh=null,this.initBeam(),this.pixelMesh=null,this.initPixel(),this.ringMesh=null,this.initRing(),this.teleportMesh=null,this.initTeleport(),this.spotLight=null,this.initSpotLight()}emitBeam(){this.beamMesh.visible=!0}emitPixel(){this.stopUpdatePixelMesh=!1;const e=this.pixelMesh.geometry.getAttribute("scales"),t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount,s=.25;for(let o=0;ol+e||i.getX(a)<=0)&&(r.setXYZ(o,0,l,0),t.setXY(o,1,.06),i.setX(o,1),this.ringMesh.info.velocity[o]=.1,this.ringMesh.info.currentIndex++,this.ringMesh.info.currentIndex>=s&&(this.ringMesh.info.currentIndex=0)),t.needsUpdate=!0,r.needsUpdate=!0,i.needsUpdate=!0}emitTeleport(){this.teleportMesh.visible=!0}emitSpotLight(){this.spotLight.visible=!0,this.spotLight.fadeIn=!0}removeSpotLight(){this.spotLight.fadeIn=!1}update(){this.beamMesh.visible&&this.beamMesh.update(),!this.stopUpdatePixelMesh&&this.pixelMesh.update(),this.ringMesh.visible&&this.ringMesh.update(),this.teleportMesh.visible&&this.teleportMesh.update(),this.spotLight.visible&&this.spotLight.update()}initBeam(){this.beamMesh=Zde(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=W5,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=Jde(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=qde(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=epe(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=tpe(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==yi.switchItem&&(this.beamMesh.visible=!1)}updatePixel(){if(this.pixelMesh){let e=0;const t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount;for(let s=0;s.01?(t.setY(s,t.getY(s)+this.pixelMesh.info.velocity[s]),r.setX(s,r.getX(s)/1.3)):(r.setX(s,0),e++);e>=i&&(this.stopUpdatePixelMesh=!0),t.needsUpdate=!0,r.needsUpdate=!0,this.pixelMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateRing(){if(this.ringMesh){const e=this.ringMesh.geometry.getAttribute("positions"),t=this.ringMesh.geometry.getAttribute("opacity"),r=this.ringMesh.info.particleCount;for(let i=0;i.01?(e.setY(i,e.getY(i)+this.ringMesh.info.velocity[i]),t.setX(i,t.getX(i)/1.27)):t.setX(i,0);e.needsUpdate=!0,t.needsUpdate=!0,this.globalUniforms.transitionEffectType.value!==yi.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===yi.fadeOutAvatar){const e=this.globalUniforms.fadeOutAvatarTime.value,t=.2;if(e0?(this.teleportMesh.scale.x=this.teleportMesh.scale.x-.2,this.teleportMesh.scale.z=this.teleportMesh.scale.z-.2):this.teleportMesh.visible=!1}else this.teleportMesh.visible=!1;this.teleportMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateSpotLight(){this.spotLight&&(this.spotLight.fadeIn?this.spotLight.material.uniforms.opacity.value<1&&(this.spotLight.material.uniforms.opacity.value=1):this.spotLight.material.uniforms.opacity.value>0?this.spotLight.material.uniforms.opacity.value-=.025:(this.spotLight.material.uniforms.opacity.value=0,this.spotLight.visible=!1))}}const K5=new lu,tS=K5.load("./textures/pixel9.png");tS.wrapS=tS.wrapT=As;const nS=K5.load("./textures/noise3.jpg");nS.wrapS=nS.wrapT=As;const Ut={switchItemDuration:{value:jw},switchItemTime:{value:jw},eye:{value:new Z},cameraDir:{value:new Z},fadeOutAvatarTime:{value:vy},fadeInAvatarTime:{value:eS},transitionEffectType:{value:yi.normal}},FP={pixelTexture:{value:tS},noiseTexture:{value:nS}};class lpe extends EventTarget{constructor(){super();L_(this,"setTransitionEffect",t=>{this.transitionEffectType=t});L_(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new Z,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=TP,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` +`,CT=(n,e,t)=>{const r=new $t;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new ww(i,3);r.setAttribute("positions",s);for(const o of e){const{name:a,itemSize:l}=o,A=new Float32Array(t*l);r.setAttribute(a,new ww(A,l))}return r},Jde=n=>{const r=new Gx(.45,.45,5,50,50,!0),i=new Cr({uniforms:{auraTexture:{value:null}},vertexShader:zde,fragmentShader:Gde,transparent:!0,blending:Kc});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new xn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},qde=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new ou(t,t),i=CT(r,e,20),s=new Cr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Vde,fragmentShader:jde,depthWrite:!1,blending:Kc}),o=new zx(i,s,20);return o.info={particleCount:20,velocity:[20]},o},epe=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new tT(r,32,32),s=CT(i,t,10),o=new Cr({uniforms:{radius:{value:r}},vertexShader:Wde,fragmentShader:Kde,depthWrite:!1,blending:Kc});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new zx(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},tpe=n=>{const t=new ou(1,1),r=new Cr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:$de,fragmentShader:Yde,depthWrite:!1,blending:Kc});return new xn(t,r)},npe=n=>{const t=[],s=new Gx(.645,.43,2.5,50,50,!0),o=CT(s,t,2),a=new Cr({uniforms:{opacity:{value:0}},vertexShader:Xde,fragmentShader:Zde,transparent:!0,blending:Kc});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new zx(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},TP=100,rpe=0,jw=1.5,ipe=.1,vy=0,IP=1,RP=.05,eS=0,spe=1,ope=.015,yi={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},ape=new lu,W5=ape.load("./textures/beam2.png");W5.wrapS=As;class lpe{constructor(e,t,r){this.scene=e,this.camera=t,this.globalUniforms=r,this.eye=new Z,this.cameraDir=new Z,this.beamMesh=null,this.initBeam(),this.pixelMesh=null,this.initPixel(),this.ringMesh=null,this.initRing(),this.teleportMesh=null,this.initTeleport(),this.spotLight=null,this.initSpotLight()}emitBeam(){this.beamMesh.visible=!0}emitPixel(){this.stopUpdatePixelMesh=!1;const e=this.pixelMesh.geometry.getAttribute("scales"),t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount,s=.25;for(let o=0;ol+e||i.getX(a)<=0)&&(r.setXYZ(o,0,l,0),t.setXY(o,1,.06),i.setX(o,1),this.ringMesh.info.velocity[o]=.1,this.ringMesh.info.currentIndex++,this.ringMesh.info.currentIndex>=s&&(this.ringMesh.info.currentIndex=0)),t.needsUpdate=!0,r.needsUpdate=!0,i.needsUpdate=!0}emitTeleport(){this.teleportMesh.visible=!0}emitSpotLight(){this.spotLight.visible=!0,this.spotLight.fadeIn=!0}removeSpotLight(){this.spotLight.fadeIn=!1}update(){this.beamMesh.visible&&this.beamMesh.update(),!this.stopUpdatePixelMesh&&this.pixelMesh.update(),this.ringMesh.visible&&this.ringMesh.update(),this.teleportMesh.visible&&this.teleportMesh.update(),this.spotLight.visible&&this.spotLight.update()}initBeam(){this.beamMesh=Jde(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=W5,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=qde(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=epe(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=tpe(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=npe(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==yi.switchItem&&(this.beamMesh.visible=!1)}updatePixel(){if(this.pixelMesh){let e=0;const t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount;for(let s=0;s.01?(t.setY(s,t.getY(s)+this.pixelMesh.info.velocity[s]),r.setX(s,r.getX(s)/1.3)):(r.setX(s,0),e++);e>=i&&(this.stopUpdatePixelMesh=!0),t.needsUpdate=!0,r.needsUpdate=!0,this.pixelMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateRing(){if(this.ringMesh){const e=this.ringMesh.geometry.getAttribute("positions"),t=this.ringMesh.geometry.getAttribute("opacity"),r=this.ringMesh.info.particleCount;for(let i=0;i.01?(e.setY(i,e.getY(i)+this.ringMesh.info.velocity[i]),t.setX(i,t.getX(i)/1.27)):t.setX(i,0);e.needsUpdate=!0,t.needsUpdate=!0,this.globalUniforms.transitionEffectType.value!==yi.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===yi.fadeOutAvatar){const e=this.globalUniforms.fadeOutAvatarTime.value,t=.2;if(e0?(this.teleportMesh.scale.x=this.teleportMesh.scale.x-.2,this.teleportMesh.scale.z=this.teleportMesh.scale.z-.2):this.teleportMesh.visible=!1}else this.teleportMesh.visible=!1;this.teleportMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateSpotLight(){this.spotLight&&(this.spotLight.fadeIn?this.spotLight.material.uniforms.opacity.value<1&&(this.spotLight.material.uniforms.opacity.value=1):this.spotLight.material.uniforms.opacity.value>0?this.spotLight.material.uniforms.opacity.value-=.025:(this.spotLight.material.uniforms.opacity.value=0,this.spotLight.visible=!1))}}const K5=new lu,tS=K5.load("./textures/pixel9.png");tS.wrapS=tS.wrapT=As;const nS=K5.load("./textures/noise3.jpg");nS.wrapS=nS.wrapT=As;const Ut={switchItemDuration:{value:jw},switchItemTime:{value:jw},eye:{value:new Z},cameraDir:{value:new Z},fadeOutAvatarTime:{value:vy},fadeInAvatarTime:{value:eS},transitionEffectType:{value:yi.normal}},FP={pixelTexture:{value:tS},noiseTexture:{value:nS}};class Ape extends EventTarget{constructor(){super();L_(this,"setTransitionEffect",t=>{this.transitionEffectType=t});L_(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new Z,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=TP,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` varying vec3 vViewPosition; varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -4601,13 +4601,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor = vec4( col, diffuseColor.a ); - `),t.uniforms.pixelTexture=FP.pixelTexture,t.uniforms.noiseTexture=FP.noiseTexture,t.uniforms.cameraDir=Ut.cameraDir,t.uniforms.eye=Ut.eye,t.uniforms.switchItemTime=Ut.switchItemTime,t.uniforms.switchItemDuration=Ut.switchItemDuration,t.uniforms.transitionEffectType=Ut.transitionEffectType,t.uniforms.fadeInAvatarTime=Ut.fadeInAvatarTime)}playFadeOutEffect(){Ut.transitionEffectType.value=yi.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((IP-vy)/RP),this.initialFadeOutTimer()}playFadeInEffect(){Ut.transitionEffectType.value=yi.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ut.switchItemTime.value=npe,Ut.transitionEffectType.value=yi.switchItem,this.transitionTime=TP}setParticle(t,r){this.particleEffect=new ape(t,r,Ut)}initialFadeOutTimer(){Ut.fadeOutAvatarTime.value=vy}initialFadeInTimer(){Ut.fadeInAvatarTime.value=eS}update(){setInterval(()=>{this.scene&&this.camera&&!this.initParticle&&(this.setParticle(this.scene,this.camera),this.initParticle=!0),this.initParticle&&this.particleEffect.update(),Ut.transitionEffectType.value===yi.switchItem?Ut.switchItemTime.valueIP&&(Ut.fadeOutAvatarTime.value=vy,Ut.transitionEffectType.value=yi.loadingAvatar)):Ut.transitionEffectType.value===yi.loadingAvatar||Ut.transitionEffectType.value===yi.fadeInAvatar&&(Ut.fadeInAvatarTime.value>.1&&Ut.fadeInAvatarTime.value<.5&&(this.particleEffect.emitRing(.5*(1-Ut.fadeInAvatarTime.value)),this.particleEffect.emitRespawnPixel()),Ut.fadeInAvatarTime.value>=.5&&this.particleEffect.removeSpotLight(),Ut.fadeInAvatarTime.value+=spe,Ut.fadeInAvatarTime.value>ipe&&(Ut.fadeInAvatarTime.value=eS,Ut.transitionEffectType.value=yi.normal,this.setTransitionEffect("normal"),this.dispatchEvent(new Event("fadeinavatarend")))),this.camera&&(this.cameraDir.set(0,0,-1),this.cameraDir.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),Ut.cameraDir.value.copy(this.cameraDir),Ut.eye.value.copy(this.camera.position))},this.frameRate)}}const Ape="_container_1fjfz_1",cpe="_messageWindow_1fjfz_11",upe="_messageTitle_1fjfz_25",fpe="_buttonContainer_1fjfz_36",Bv={container:Ape,messageWindow:cpe,messageTitle:upe,buttonContainer:fpe};var $5={exports:{}};/*! + `),t.uniforms.pixelTexture=FP.pixelTexture,t.uniforms.noiseTexture=FP.noiseTexture,t.uniforms.cameraDir=Ut.cameraDir,t.uniforms.eye=Ut.eye,t.uniforms.switchItemTime=Ut.switchItemTime,t.uniforms.switchItemDuration=Ut.switchItemDuration,t.uniforms.transitionEffectType=Ut.transitionEffectType,t.uniforms.fadeInAvatarTime=Ut.fadeInAvatarTime)}playFadeOutEffect(){Ut.transitionEffectType.value=yi.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((IP-vy)/RP),this.initialFadeOutTimer()}playFadeInEffect(){Ut.transitionEffectType.value=yi.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ut.switchItemTime.value=rpe,Ut.transitionEffectType.value=yi.switchItem,this.transitionTime=TP}setParticle(t,r){this.particleEffect=new lpe(t,r,Ut)}initialFadeOutTimer(){Ut.fadeOutAvatarTime.value=vy}initialFadeInTimer(){Ut.fadeInAvatarTime.value=eS}update(){setInterval(()=>{this.scene&&this.camera&&!this.initParticle&&(this.setParticle(this.scene,this.camera),this.initParticle=!0),this.initParticle&&this.particleEffect.update(),Ut.transitionEffectType.value===yi.switchItem?Ut.switchItemTime.valueIP&&(Ut.fadeOutAvatarTime.value=vy,Ut.transitionEffectType.value=yi.loadingAvatar)):Ut.transitionEffectType.value===yi.loadingAvatar||Ut.transitionEffectType.value===yi.fadeInAvatar&&(Ut.fadeInAvatarTime.value>.1&&Ut.fadeInAvatarTime.value<.5&&(this.particleEffect.emitRing(.5*(1-Ut.fadeInAvatarTime.value)),this.particleEffect.emitRespawnPixel()),Ut.fadeInAvatarTime.value>=.5&&this.particleEffect.removeSpotLight(),Ut.fadeInAvatarTime.value+=ope,Ut.fadeInAvatarTime.value>spe&&(Ut.fadeInAvatarTime.value=eS,Ut.transitionEffectType.value=yi.normal,this.setTransitionEffect("normal"),this.dispatchEvent(new Event("fadeinavatarend")))),this.camera&&(this.cameraDir.set(0,0,-1),this.cameraDir.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),Ut.cameraDir.value.copy(this.cameraDir),Ut.eye.value.copy(this.camera.position))},this.frameRate)}}const cpe="_container_1fjfz_1",upe="_messageWindow_1fjfz_11",fpe="_messageTitle_1fjfz_25",hpe="_buttonContainer_1fjfz_36",Bv={container:cpe,messageWindow:upe,messageTitle:fpe,buttonContainer:hpe};var $5={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var r=[],i=0;it.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function _n(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:A,onSubmit:c,minWidth:u,disabled:f}=n,h=ye.useRef(null);return ye.useEffect(()=>{t&&Epe(t).then(p=>{h.current&&(h.current.innerHTML="",p&&(p.classList.add(Un.icon),h.current.append(p)))})},[t]),o&&o==="login"?k.jsxs("div",{className:dh(r,Un.iconButtonWrap,s&&s==="dark"?Un.dark:Un.light,A&&Un.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Un.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Un.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),k.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Un.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Un.iconWrap})]}):o&&o==="icon"?k.jsxs("div",{className:dh(r,Un.iconButtonWrap,s&&s==="dark"?Un.dark:Un.light,A&&Un.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{className:Un.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M5 2H2.85562L3.00485 4.13918L6.7903 58.4048L6.9201 60.2656H8.78545H62.6772H64.6178L64.6763 58.3259L66.3135 4.06031L66.3756 2H64.3144H5Z",fill:"#efefef",className:Un.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),k.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Un.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Un.iconWrap})]}):k.jsx("button",{className:dh(r,Un.buttonWrap,s&&s==="dark"?Un.dark:Un.light),onClick:i,onMouseEnter:l,onSubmit:c,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:k.jsxs("div",{className:Un.innerWrap,style:{fontSize:e},children:[t&&k.jsx("span",{ref:h,className:Un.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function Cpe(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?k.jsx("div",{className:Bv.container,children:k.jsxs("div",{className:Bv.messageWindow,children:[k.jsx("div",{className:Bv.messageTitle,children:t}),k.jsxs("div",{className:Bv.buttonContainer,children:[e&&k.jsx(_n,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),k.jsx(_n,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):k.jsx("div",{})}const Spe="_backgroundImg_1yy0g_1",Mpe="_darkBackground_1yy0g_16",Tpe="_logo_1yy0g_29",Ev={backgroundImg:Spe,darkBackground:Mpe,logo:Tpe};function Ipe(){const{debugMode:n}=Y.useContext(or);return k.jsxs("div",{className:n?Ev.darkBackground:Ev.backgroundImg,children:[k.jsx("div",{className:Ev.backgroundBlur}),k.jsx("div",{className:Ev.Background})]})}const Rpe="_buttonContainer_19n2w_1",Fpe="_buttonLeft_19n2w_10",Upe="_buttonRight_19n2w_14",Lpe="_buttonCenter_19n2w_18",Ppe="_sideMenu_19n2w_33",Dpe="_scrollContainer_19n2w_44",Ope="_scrollContainerOptions_19n2w_52",Npe="_bottomLine_19n2w_60",kpe="_editorButton_19n2w_94",Qpe="_editorText_19n2w_102",Hpe="_selectorContainerPos_19n2w_112",zpe="_selectorButton_19n2w_129",Gpe="_selectorColorPickerUI_19n2w_138",Vpe="_selectorColorPickerButton_19n2w_144",jpe="_selectorColorPickerImg_19n2w_157",Wpe="_uploadContainer_19n2w_163",Kpe="_uploadButton_19n2w_176",Ln={buttonContainer:Rpe,buttonLeft:Fpe,buttonRight:Upe,buttonCenter:Lpe,sideMenu:Ppe,scrollContainer:Dpe,scrollContainerOptions:Ope,bottomLine:Npe,"editor-container":"_editor-container_19n2w_87",editorButton:kpe,editorText:Qpe,selectorContainerPos:Hpe,"selector-container":"_selector-container_19n2w_123",selectorButton:zpe,selectorColorPickerUI:Gpe,selectorColorPickerButton:Vpe,selectorColorPickerImg:jpe,uploadContainer:Wpe,uploadButton:Kpe},$pe="_dropArea_1a0z4_1",Ype={dropArea:$pe};function Cg({onFilesDrop:n}){const[e,t]=ye.useState(!1),[r,i]=Y.useState(null);ye.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)}},[]),ye.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return k.jsx("div",{onDragLeave:s,className:Ype.dropArea,style:{display:e?"flex":"none"}})}const Xpe="_mainTitleWrap_4fb0s_1",Zpe="_mainTitle_4fb0s_1",Jpe="_topLine_4fb0s_18",gB={mainTitleWrap:Xpe,mainTitle:Zpe,topLine:Jpe};function wa({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&&k.jsxs("div",{className:gB.mainTitleWrap,style:i,children:[k.jsx("div",{className:gB.topLine}),k.jsx("div",{className:gB.mainTitle,children:n})]})}const qpe="_ContainerPositionTop_v15ql_2",eme="_ContainerPosition_v15ql_2",tme="_Container_v15ql_2",nme="_topLine_v15ql_68",rme="_traitInfoTitle_v15ql_96",ime="_flexSelect_v15ql_105",sme="_flexButtons_v15ql_114",ome="_flexButtonsTop_v15ql_122",ame="_optionButtons_v15ql_131",lme="_optionButtonsSmall_v15ql_143",Zn={ContainerPositionTop:qpe,ContainerPosition:eme,Container:tme,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:nme,traitInfoTitle:rme,flexSelect:ime,flexButtons:sme,flexButtonsTop:ome,optionButtons:ame,optionButtonsSmall:lme},Ame="/CharacterStudio/assets/randomize-green-4388c12b.png",cme="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNiOTBlZjU3LTIwOWItYzQ0Zi05OWNjLTkwYjYxM2Q0MWJiOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjY1ZDdmMmJiLWMxYjctYjc0My1hYmIzLTFmM2VjNjMxYjE0NCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozYjkwZWY1Ny0yMDliLWM0NGYtOTljYy05MGI2MTNkNDFiYjgiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6bbHqfAAAFoklEQVR42u2duWtWQRTFo5hGRNAETKFiIQqCSxGto4iCqSLon6BoQJJCEcEFLASbD7QRRcTKNbihoLgUWhj/AItUCi7gVmjikubzPphAiOYts9659xQHAnl5M2/u73vnzHwvbzra7XaHNg1cPrKadJs0bnSHtEbjWGgr/HxSi9SeRWeLYwCAzOIPmk97u0ITpAMAQE7h+0ivaxR+psZIWwBAvoVfSXpsUfiZelZkBgAgx+dtJTIfaPV5W4nLB9p93lZi8oEEn39iWcRPpK2kzaSPlud4mns+0Ojzk6QTpM5p5+skHSP90ZYPtPn8DVJ3ybkXk65oygdafH6UtKlBW72klxrygfT5/BfSLoe2B0xWELt+oMbnHfoxj3RUaj6Q6vNdAfq0SGI+UOvzDn0UlQ/U+7z2fACfV54P4PPK8wF8Xnk+gM8rzwfweeX5AD6vPB/A55XnA/i88nwAn1eeD+DzyvMBfF55PoDPK88H8Hnl+aBup/aQflp26HrZc3hQaT64Zjnmv0h7nQEwT8u24PNJQdjokA9aVXfdqsaH4fNsQNhJ+mxRj2EXAO41bGw/ihUchH0Na3LXBYC7DRs7T1qOQgUr/lLSuZgA3LL0nkukhSiat8IvIF2wrMWtFABMJdHDpLkoolPxD5mxbOcGwJTekfpRzMaF305662H8kwMwpRekDShuZeHXkp57HHc2ACAfhPP5JAB8MB3+jXyQzOeLJfaLpPcpAPhmjlnmcMtSnQ8cfb6w1BXmPF9TAFB8N9Az7dhtpDfIB8F9vvjQ7Jh2rp6K72mCArDkP39z0GHaIjofOPr8lG3OmXHOJawAmHah57F+4G0+P+sHgyUAHm91/fD5cmtkDYDmfODT57MHQFM+COHzYgCQng9C+bwoACTmg9A+LxIACfkgls+LBiDHfBDb51UAkEs+SOHzagDgnA9S+rw6ADjlAw4+rxaAlPmAk8+rByB2PuDm8wAgUj7g6vMAIHA+4O7zACDc7fqk+a/lbJel1QPgIR9k/cUUAAj7SDX7r6YBgP98wM7nAUCa9YOo83kAwC8f5PIACgDwnA+yegQNADQfsGdlb9rK8HoAQMMBK3vryT0AIB+ARyXX9AgAyAfgYck1PQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlALQAwCSX0+y18V/L/a3BQDJr2cx6UcKAMZz3BRaIADdphZJNo16ldsG0ZIAoP721thY2gmAulvH3iB1AYCot/0rMbaObbJ59KR53UonAAjW907ScTPWUfYOHpK2fXyuADhsHz/kAkBBXMvy5QqjHPNBbgBQnzbW8PnZ1Kq6I9ftxJ6KuWaZrnOaLeQCQDHFJl1zeLPJ3jrtNOnQfIe7AZt8wB0A6sM80lHSH8uxPlPUqm57Nh1cSXps2bnk+YAzANT+AOmT5dg+Ja1q2qZLZ/tIry07m2z9gCMAjj4/Rtpi27aPzg9WrERVrR90awXAzOevWo7dBOmAax98XUg2+YADAGZ2dSyWzwcHIKd8kBoAM5+P6vPRAMghH6QCIKXPRweAcz6IDQAHn08GAMd8EAsATj6fFABu+SAGANx8ngUAXPJBSAC4+jwrADzlg5u2+SAEANx9niUAqfKBTwBy8Xm2AHjKB19Ju2MDkJPPswcgZj5wBSBHn88GgBj5wBaAnH0+OwBC5oOmAEjw+SwBCJUPmrwuXorPZw2Ax3yw3pxnpOS4EXPMOkk+LwKAGflgwrI4p0kPSn5/n3RKms+LAsBDPggh1j4vDgBP+cCHsvB5sQB4ygfifV48AJ7WD8T6vBoAAueDbH1eFQAB8kH2Pq8SAA/5QIzPqwbAIh+I83kAUD8fiPR5APAvCKtJt80dYdz8vEbjWPwFnWtJD/nY2zYAAAAASUVORK5CYII=",ume="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM2NDY5Y2JiLWFkMzUtYmQ0Ny04M2Q1LWU0NGQ0MTI2YmYwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjIyNTIzNmU1LWZhMWItZTM0NS04ZDM2LTE5YmQyYTRiZjM1MSIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjNjQ2OWNiYi1hZDM1LWJkNDctODNkNS1lNDRkNDEyNmJmMDYiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6qPgTwAAAEeUlEQVR42u2dX4tNURiH58KfwR1K0USSj6BoIpdydcY0TUMmIy58BPdK/uTCLReaG7kwooQoH4FQyneQMNw53t2cqdOJPfusvfZa77ve5+JX1DlnOns9PM+cqT0T/X5/wtt6D64ekj2W/ZKtDv582OO18Hbwk7I7sv5/dle2DQDKPPzLsp81h7++6n+EKwBQzsGfkH1ucPCj+yI7CQB2D/6A7GXAwY/utewgAJTj+dAV2QdePR+64vrAu+dDV0wf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5532A5533AZ533gd43nkf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5530wzsHvkr3hQqvfW9nuLgDYKXvGBVa/F50AMATCHtkKF1rdqn+ce1NG4BHZOy589n2QHc35beBZ2VcOIvm+yRa1fBC0SXZN9oeDSbLrss0aPwqmDxR6PggA+ULnZRfpA9uel+ddkJ0LAWB56AOG/fSBLc/L86ZkrwavsxwCwOgPd6q/T9IHuj0vz9kquzl6djEAqPZDdok+0Ol5ed6S7Ps/XjMaAOurfgh0nD5Q4/lp2aea144OwPDHjvRBXs8/b/A1OgOAPtDj+awA0Af5PZ8dAPogr+fVAEAf5PG8OgDog7SeVwuA1z5I7XnVAHjqg1yeNwFAyX2Q2/OmACitDzR43iQA1vtAk+fNAmCxDzR63jwAFvpAs+eLAUBrH2j3fHEAaOkDK54vEoCcfWDN80UDkLIPrHreBQBd94Flz7sCIEYfPCnM8+4AiNEHZ2RzhXjeLQCt+6AQz7sHoFUfFOB5AIjRB4Y9DwAx+8Cg5wEgVh8Y9TwANNjt6rOADT4nuFHg+waAoc3WvOfZQt8zAAxtruY9zwFA+QDM1LznGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANsA3AeAYnYvBIBTsvcAYH4fZaeDf328PHmxt3bzRACwteqWNkvBvz5+5MJs6a3dRBEAbOxWdVOrJmc77j1z9smeAoDaVbe1mRrnTENvnnSst3YzZQDQsepGVtMhZ9n29mkW+6AkABp5vjMAjPZBKQA09nynABjsA+sAjO35JAAY6gOrAAR7PikABvrAGgCtPZ8FAMV9YAmAKJ7PBoDSPrAAQFTPZwdAWR9oBqATz6sBQEkfaASgU8+rAyBzH2gDoHPPqwQgYx9oASCZ51UDkKEPcgOQ3PMmAEjYB7kAyOZ5UwAk6IMcAGT1vDkAOu6DlACo8LxZADrqgxQAqPK8eQAi90GXAKj0fDEAROqDrgBQ6/miAIjQB7EBUO/5IgFo0QexADDj+aIBCOiDtgCY87wLAMbogzYAmPS8GwAa9kEIAKY97w6ADfpgHACK8LxbAEb6YHVwqPM1j5sfPOZ3SZ53D8DgcLfLHsoWah6zIHsk2+HluvwF92zupxEV3NQAAAAASUVORK5CYII=",fme="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmY3YWFkYzZiLWM2ZmEtNjE0OC05YWZkLTgxN2Q1OWRkZTI0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc2NTFhZmQyLWU5YTctOTc0Zi1hZWFkLTdiMWMyODQ2YWEzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmN2FhZGM2Yi1jNmZhLTYxNDgtOWFmZC04MTdkNTlkZGUyNDIiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6TWt7cAAAFm0lEQVR42u2dT2xURQCHSTXpQTH0oIJpgfZKi1ETiSK1MV7FbORQNcG0Hmg3oQVjjKARrhDBBDEYMSEYS6kWkxoVAheDiBc9kHBBuaGgMSo1KgTF+pt0JLq6dOe93X3z5zt8SbPdvtmZ37fvvc7Mm5k3MzMzD9KFRkAAGgEBAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABPKO0f3OrWCxWiTViROwQ+8QBcchywL62w77HvLdPdJpjIEAYYd8sHhDPiD3iuLggfhczGblqj/GJ2Cs2il5xCwL4EfoK8bw4LH7MEbQrF8UR8aK4T7QgQPNC77On6jNNDHwuzopXzGdDgMaEvlRsEqc8Cr0ap+2ZoRMB8gdvrulviT8CCP7/7h/GxIMI4B78Q+KjAEOvhrlHeRgB5g7e3FB9GFHwlZi6rUSA/wZ/m3g94uAreVMsRIDZ8J8S3yUU/t98L55OVgDby3Y4weArMf0JXUkJoAo/Ln4i/GtMiyeTEEAV3U3gVXktWgFUuXbxKSHPyWeiIyoBVKG7xXnCrRnTVvdEIYAqsjrniFwjGteciabEuGXKvnbes57ER4MWQBVY60FD/ioOiiHRfb3xfTt/oNu+1/zNLx58/rVBCqAPPlxww52x4/e356jDrfYYXxZcl+GgBCg4/Gk7KaSljvVpsSJcLLBe5SAEMB+04L72JQ08qy0ueKyi7LUABYe/pYn/0r4UiwSxhD9UQIfWuhgkiOGav67A8YzgJeC0n7/+W0KWIOTwj3o0keVoqBKEGv5vYoFHAiwQl0KUIMTwDSM5wuoQg3Ya90HLTvtaR47jjhbcJuWmCOBB+OcyBrTcPgJ25TrHvmKFuDNjGedCkyC08DN9+20vnms5GwM8CzhLEFr45jo73zGUbTnK2+5Y1nxxOSQJQgrf8G4B38gRxzInPWmrcl0E8Ch8w4BDEF11LLfLodwBj9qrnEsAz8I3LHMI4r06ljvpUO4yz9qsnEkA/WG/ZxX5VtxQYwh3NKD8RTWWfaOHzzn0OwmgP2izU5J8qsQJh2/hYMGXnxMePqja5iLAdg8nSk45BPBqA8rf5VD+lIftt81FgC88rMC4QwDvNKD8CYfyxz1sv88RAAG4BHAJSOMmcICbwBw3gRH8G7ioAeUvTObfwEg6giYL6gjqjqIjiK7gzF3Bg6VYuoIjGAwaYTAoruHgywwHFzAc7JkEoxkmamwQfzIhJI4pYd9knK7VU+OUMNOJszxjGV9HPSXMIwlGc0zebLf9BDsrJoWa19pzHHdDEpNCPZHgUrWOjYKmhbclNS3cEwmOeSTAseQeDPFEgq08GsbDoUMFhj+U/MOhnpwJhgmfBSK2ctpniRizx8DSBga/hCVi/JfgZ/FsrUPHjotETbNIVDjLxH1lVwtjmTgWitw8YYXsqWGhyB773gkWiqyPBI/M0f/ebC7YZWHf/0dXsPn5pP2dL5/TLK+7OpbFou8ygzgsAl37gJdpM5aLT5OTeQalQtgwYhchV2V3KlvG9LNlzL8waxA/kdqmUWY7WDaNmm2DtDaNYtu4a9vGDbJxZJobR75RYuPIqlvHfhBx8GYc4X62jk1v82hTFzaPzrh9/H7PNp2qFbPl/duil+3j6zMMu0mcCiD40+IF0RlC2wYhQIUMveJluymUL6GftWsP94XWnsEJUCHDveI5e439oYmBm06sI/abvqKeG1QhQHYZbhIr7fj9HvFxaXYjyDz3D1ftMY6LvfbYq1yfT0SA4qRotcvDm5vJNfZpYXP52CfGxCHLmH3N/G69eMyczkuzW9y3xtxGUQsACAAIAAgACAAIAAgACAAIAAgACAAIAAiAADQCAgACAAIAAgACAAIAAgACAAIAAgACAAIAAkCc/AWkhfX2hx9ZaQAAAABJRU5ErkJggg==",hme="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAATr2AAE69gE6sVc6AAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PslPja4AAAbiSURBVHja7Z17iFVFHMc1K80ybc3SP9K21YrubtLDiIJqK5WMpbYt1MpSKiKkba0gtU0rCCpoyxRXSKrNiJIwCmtD0u2JEWFuSC/t2sueghDU2svbd2D+uFzce89rzvxm5vvHB2TX5Zw758PMufN7zJBSqTSEhAsHgQJwECgAoQCEAhAKQCgAoQCEAhAKQCgAoQCEAhAKQCgAoQDVaO1ZOgWsB7+CAbALLAPDOdCeC4CH3AJKg/AlGM/B9lQAPNxG8HcVARS7wQQOuJ8CPFvj4VMCXwXAAx0BfowoACXwUIA68EcMASiBh0vApzEFoASeCdCZQABK4JEAw0A/JQh7H2A8KFKCsHcCxUugX1qnghlgLrgBzNP/bgXTwTRwAjiEAsQf4AkpJChmJYF+0M1gIegGm8Dn4M+I9/If+B68B3rAneBiMIoCCJwJ8DejwZVgBfgQ7E94/Vqor7ybwVJwOgWwKAH+z3HgJrDR4AOvxU7wIDiFAuQoAX7XZumBV0MtF20UID8JnhMoQUlvjXeAw5kQYl6CVUIlUOwD7WBo8BlBhiVYK1gCxU/giuBTwgxL8IJwCRTvg/qgcwINS/CKAxIolgSdFGpYgjcdkeATMDHYrGDDErzriASK+cGmhZuSAD8/DHzskARrg60LMCjBkQkTVWwuCccGWRhiUIIx4DOHJNgLCkFWBhmUYJzer3dFAhWFnOXjRtAosA6cb0ECFaL+xiEJFAt8E6BXf7Cfq22GGJRgIvjBMQlu9yUWsOUgW6M2JGgAvzgmQYfr0cA3quyPm5KgWEWCaXpLVhWtXqVp11k/6uffCpRgoav5AC9GCJvWS0svw99NVhs0OtHkgBAJ5rmWEbQiRqSs3saOYcTPcTzoAv8KkGCGKzmBnQnCpbkvBwlE2GRZAJXQ2ig9K3hOipi52Jmg7D7aLUvwXdbp81k+/DPAPykTJ1yQYKbld4MPJFYGHZPi4bgowaWWZ4I10gTYmHEKlQsS3GxZgtukFIfeayiPzgUJnrYswVm2G0Q0G06mFC2BCuHq7W1bAmxPW8OYNsBjOtJmUoKvwaQMJOiwPAussiVAXoUZJiVQJWW/gR3gSdXrMME4jIzZJ8kEl+UqgC7EzDu33pQElSxPMB6PWRZANeU8KhcBdJKFDeNNxg4q6Yk5JhcJ2CpemZcA6yxX2YibCVQdoIBlQHGhUQHUWiOk+PLEnCRoTJD0YpM+0wJIybS9xmCnknK6YozNGiFjM8eIAAJ2vsqjYlEaSGQxE2yLMT4PCBmfreBkEwK8JuQDfhTjnpsySNUeGfFaiwVlEd1hQoBXhXy4vpjf0femvF6TYzOAMQGkLAHbY763bEt5vWLEJadb0BIwxeeXQJXZOyLGPT+ewTVrSqDi9EIEmO3718DI07K+50JG16xVlfywgHHpzWMj6CkBH/SWmPe8PCcJHrU4JurUltPyEODoDDdakvJ8gvvuyejaRaES3JVnMMj2UvA7GJvgvu/zdCbYYiMc/IRlCRYlvO8GHfrdoY+42+/4TPBXkqk/q4wgm504dsf5NlDlM0zS4VQTM8Ej0nMD0w5ewWKf3kSxews9i0xK8LKEpND5lpeCMx2QwMRyoFLaxkhJC++yKIBay48IcCY4T1pl0GaLErzuSAu7rGaCzJpHZCnAOD0AtiTYEIgEqyUXhxYSHCSZaahYlal5LME7LpSHTxewSdTioQS7TPQSNNUgYoGAeMFbWdTTm+xPEEMCVbvQ4FqLmEVCIodv62PhRjs6E6iS+7NdbRJ1j6AsmQEtw0r1Fg2uBVdrHtJNoqYKlKDZ9TZxSxxqy2atIHWQfYLLfWkUeTcliC3BTN+OjLmVEkSSQEUqr/f1yJgWQb33vGhS4eKRMY36aw0lECCBrfbwdQ6d6uG1BLbPCeimBHYlkHBYxNyU/QUpgScnhmylBPlLIOoUS71Dd4ASBCpAWW1/LyUIVICyQbxE+IFPXkgg/nx7DMSNQvrveCmBeAEqRJA4I+wD57oqgTMCVHTqlvaO0GcrnyA4ASpeFhdn0AAiKTt1HF8dRHWozaSSIAWoGNyTdM/eDQbjDOq0jvX61JCmFPsdoiTwQoCDNG08R7e0Wa1zA7/SGUFRBnqP3pRSp57dD9rAqWBohjOX1TOQvBagysCP1V3DLgCz9IOdDa4DrarSRjWgBMNcPSuZArglpAgJ+DDclaA/i9mKD8JtCTopQNgS9FOAsCVQdZh1FCBcCfakbZPDgXdbgme4BIQrgWoMWaAA/kqgTiz/oooALdwH8F+C4WCZDjwN6L6GL4HJ3AkkFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIByGD8DzQJyO8fOgE8AAAAAElFTkSuQmCC",dme="/CharacterStudio/assets/play-de4238c5.png",pme="/CharacterStudio/assets/reverse-e35421b8.png",mme="/CharacterStudio/assets/pause-b6381fd4.png",gme="/CharacterStudio/assets/fast-forward-0d3ffae5.png",vme="/CharacterStudio/assets/fast-backward-1f713448.png";function a_({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=ye.useContext(or),[a,l]=ye.useState(s.userActivated),[A,c]=Y.useState((o==null?void 0:o.getCurrentAnimationName())||"");ye.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&c(n)},[n]);const u=()=>{r()},f=m=>{m?o.play():o.pause(),o.setSpeed(1)},h=m=>{o.play(),o.setSpeed(m)},p=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},d=async()=>{console.log("play next"),await o.loadNextAnimation(),c(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),c(o.getCurrentAnimationName())};return k.jsxs("div",{className:Zn.Container,children:[k.jsx("div",{className:Zn.ContainerPositionTop,children:k.jsxs("div",{className:Zn.flexButtonsTop,children:[k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(-2)},children:k.jsx("img",{src:vme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(-1)},children:k.jsx("img",{src:pme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{f(!1)},children:k.jsx("img",{src:mme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{f(!0)},children:k.jsx("img",{src:dme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(2)},children:k.jsx("img",{src:gme})})]})}),k.jsxs("div",{className:Zn.ContainerPosition,children:[k.jsx("div",{className:Zn.topLine}),k.jsxs("div",{className:Zn.flexSelect,children:[k.jsx("div",{className:`${Zn["arrow-button"]} ${Zn["left-button"]}`,onClick:g}),k.jsx("div",{className:Zn.traitInfoTitle,style:{marginBottom:"10px"},children:A}),k.jsx("div",{className:`${Zn["arrow-button"]} ${Zn["right-button"]}`,onClick:d})]}),k.jsxs("div",{className:Zn.flexButtons,children:[e&&k.jsx("div",{className:`${Zn.optionButtons}`,onClick:e,children:k.jsx("img",{src:Ame})}),k.jsx("div",{className:`${Zn.optionButtons}`,onClick:p,children:k.jsx("img",{src:a?hme:fme})}),k.jsx("div",{className:`${Zn.optionButtons}`,onClick:u,children:k.jsx("img",{src:i?ume:cme})})]})]})]})}const yme="_tokenBoxWrap_q4pvo_1",wme="_mask_q4pvo_7",xme="_timer_q4pvo_31",_me="_level_q4pvo_42",bme="_mythic_q4pvo_55",Bme="_epic_q4pvo_60",Eme="_rare_q4pvo_65",Cme="_uncommon_q4pvo_70",Sme="_common_q4pvo_75",Mme="_none_q4pvo_80",Tme="_value_q4pvo_85",Ime="_frame_q4pvo_95",Rme="_emptyIcon_q4pvo_111",Fme="_badge_q4pvo_123",Ume="_frameActive_q4pvo_131",Vl={tokenBoxWrap:yme,mask:wme,timer:xme,level:_me,mythic:bme,epic:Bme,rare:Eme,uncommon:Cme,common:Sme,none:Mme,value:Tme,frame:Ime,emptyIcon:Rme,badge:Fme,frameActive:Ume,default:"_default_q4pvo_159"},Lme="/CharacterStudio/assets/magic-box-cd45f027.png",pA=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,A]=Y.useState(!1),c=()=>{A(!0)};return k.jsxs("div",{className:Vl.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&k.jsx("div",{className:dh(Vl.frame,Vl.frameActive)}),k.jsx("div",{className:dh(Vl.frame,o&&Vl[o])}),k.jsx("img",{src:l?Lme:s,className:Vl.emptyIcon,style:a,onError:c}),i&&k.jsxs("div",{className:dh(Vl.level,o&&Vl[o]),children:["Lv.",i]})]})},Pme="_InformationContainerPos_72ckd_2",Dme="_scrollContainer_72ckd_15",Ome="_traitInfoTitle_72ckd_27",Nme="_traitInfoText_72ckd_35",kme="_flexSelect_72ckd_62",Qme="_checked_72ckd_119",Hme="_checkmark_72ckd_123",zme="_checkboxHolder_72ckd_136",No={InformationContainerPos:Pme,scrollContainer:Dme,traitInfoTitle:Ome,traitInfoText:Nme,"input-box":"_input-box_72ckd_43",flexSelect:kme,"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:Qme,checkmark:Hme,checkboxHolder:zme};function ST({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=Y.useContext(Ui),{characterManager:i}=ye.useContext(or),[s,o]=ye.useState(0),[a,l]=Y.useState({}),[A,c]=Y.useState([]),u=d=>{i.setManifest(d),i.loadInitialTraits().then(()=>{r(!1)})};ye.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),c(Object.keys(i.getAvatarSelection())))},[t]);const f=d=>{i.loadTraitsFromNFTObject(d).then(()=>{r(!1)})},h=async()=>{if(!t)if(r(!0),s>=n.length-1)e?u(n[0]):f(n[0]),o(0);else{const d=s+1;e?u(n[d]):f(n[d]),o(d)}},p=async()=>{if(!t)if(r(!0),s<=0)e?u(n[n.length-1]):f(n[n.length-1]),o(n.length-1);else{const d=s-1;e?u(n[d]):f(n[d]),o(d)}};return(n==null?void 0:n.length)>0?k.jsxs("div",{className:No.InformationContainerPos,children:[k.jsx(wa,{title:"Trait Selection",width:180,right:20}),k.jsxs("div",{className:No.scrollContainer,children:[k.jsxs("div",{className:No.flexSelect,children:[(n==null?void 0:n.length)>1?k.jsx("div",{className:`${No["arrow-button"]} ${No["left-button"]}`,onClick:p}):k.jsx(k.Fragment,{}),(n[s].name||n[s].manifestName)&&k.jsx("div",{style:{textAlign:"center",flex:1},children:k.jsx("div",{className:No.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?k.jsx("div",{className:`${No["arrow-button"]} ${No["right-button"]}`,onClick:h}):k.jsx(k.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&k.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(d=>k.jsx("div",{children:k.jsx("div",{className:No.traitInfoText,children:`${d.trait_type} : ${d.value}`})},`json:${d.trait_type}_${d.value}`)),e&&A.map(d=>k.jsx("div",{children:k.jsx("div",{className:No.traitInfoText,children:`${d} : ${a[d].id}`})},`val:${d}`))]})]}):k.jsx(k.Fragment,{})}const UP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAXASURBVHgB7ZzNchNHEMd7ZiWf5WtSCSIfVa5cLN+MTRXrEFPcWJwHwNxys/0Etm+5YZ4Ac0pOIG4EU2WlCgffIm4+pIhS8ADKEQlt07OSKKGdlVdSz64K9++kmhlpR3+Pe3qmuwUgCIIgCIIgCIIgCIIgCIIgCIIgXHAUzCDLflDWRfCVgkVA5aOCkgqhRLMt9cdQW0MhNEBhHRFehW2ondaqDZgxZkZg3w9KrTm9RdJtknBlmAwjeLXTgvuzInbuAi//FPieUrv00gdW1GGnHe7nLXRuAkdmoKDvKYUBOCVfoT3IgSvrP295Gn4nG1sB91S0p4Kvvl34/83rszpkTOYrePXGxj1A3E41GKGGCl/Rq7oXQpM2tma/q0PC0R+orFAt0rfwU32eUgcnzx7tQIZkJrDZxNpFdUwvR6/arqgP59pQrdWqTUj52a0iBCT2nRRi14ttXEv72dOSicCpxCVhFeD+i+fVGkzB8s2g7HVgj77anRHDMhO5ABkwUlzjz4Z4d1ph+5w+jTazzZX1oEYmYTfB5av05rQEjtHgmMjmJoiLqKrFFi5xiTtEPTqcJFPpzc0pTk0EraJNBeqBrU9hZA72wAH03ArZ4+PBk18Socadl39UD8ARzgTuHnfVMT2gPNw3K+L2aHbauOTKT3ZmIrwi7NrENWYhR3Ftm1pJz2lnpsKJwGb10jrdjHXQhhYWQid+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q9YrqX8ujDk+OHt0FZtKKO9i2un7buGj+8Fha4fPcvjH7CtYeWI/BHS/cB2YmEbffbhvfKkC6I/wY8JsIrW7F2uiUxm0aJhXX0PO7a7H3qJGnv4lgFdiYB6vnQHcLwMg04n6cE1jnVF75ceMSMMIqsAnz2NrNxQ0wwSHu6DmFa8AIr4kILUdiMg9cGweXuIbenGqxDo/3jppVYKXpbnaI3n3u1HCK+3FuYXxuZIevASOsApNdK8faMO7Yj4sLcSM0xCMcmPqInfIRjNDFTnm4jWJSU4VpnIlr5hbaj87AiPPrymlwKa6hrS6wwK7FzQpegTG+Ijp6/BXxuYhr4N3kFMYEVu/HEzhLcZU90tIARrg3ubhNG8OvzHrlWuN1OMMCk1/553Abib6Y5r15mAWXfnsfXhusrS6Zb8L2o96Wh7i9OfmWrqncymFYBQ49y9GTaGkIkt6T14ZmElVs7UnfYVJYBTZXknSaawy3K89+DZint6BsiSkUTuK+VuX3gxFs14D+cMwrT3G7McO4eUDEJ8AMu8Bz7+HA1j4Y88rbz02KGZJ5YM+PcJIXkRTzIuHWQjqe5inuletBoLV6HO9xEzN0clROinnRKn6Qp7hRxEUraw6Ei5ihwYnAJuZlEkwsXeU8j79RRj3YkgHVoYt0guiZ4IgowQQhVSQjC3FXbmzsWssVyHNwtXoNzkoI3v5z1vz6m4V3FCK4OWpcZuIi7tn6yK3cefnMSXZnhNMajTevz04vXV6YJ5GXrQPM6mnDztvGGUvMbhhzWvviux9+U4C/gPXxeP/kqPorOCSTDHfyKv6G5Ox2czjZ/+uoegiMmPIwbTZVSKy5q58cPXaegJ1JhrtJ1x+R5V42OcSr6xvXOMqtUtbdRSUEkAGzVwRDoXSTFDJREUz3+OufM/zzK4IZ5Or14AC12ko5vGZqkcMQ/sOBWy5FURK6yy31apkrtFNV0iRcG5v74qi6DRmSS6WnKS0YUaDigiZdNOyfPHdXKpBELpWepuLyy+8XnmiEefobp454TII58IQFvE2u2FPIgfyLwdPVtY0PU93dtMzMzxkYoXUHtsl03JrUdJCdbmjEhwW60ctqEzuP2fxBjq7YPph6ZFSLaGqSP/VnmyQm3cqZ+uUoDlif1R/kEARBEARBEARBEARBEARBEARBEC48HwDC3eeu0ZVWOQAAAABJRU5ErkJggg==",Gme="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wMlQxMTo0OTozNy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBiNWViMTliLTkxMmEtMmI0NS1iOTZlLTliNDUxOGUzZDU4NyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjg4ODliZDlkLTAxZjItMTQ0Ni04NDE4LWYyYzNjNjQ1ODNlOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODg4OWJkOWQtMDFmMi0xNDQ2LTg0MTgtZjJjM2M2NDU4M2U4IiBzdEV2dDp3aGVuPSIyMDI0LTAxLTAyVDExOjQ5OjM3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wMlQxMTo1MjoyMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv0y+4AAAASPSURBVHja7ZxrSBVBFMctyqIgC0ujJ5UFaQpZRC/7YoUVQYUUkZQYQoVfJBF62PtBlhlJoJWSUQRSEYUFUVRiSEWRiokVgZqRWUEv7W3/oQkul53Ze+/OXWfyfPh98e6cPfNjnZ2ZPbshnZ2dIUTwIAkkmAQTJJgEk2CCBJNgEkyQYBKsgFnzlsaCanARZICFIJwEqxN8CXR68R08479lgxVgDAkOTPATC8EiXoLbYB9YDeJJsFzucPDLD8FWvABlIBcsAeNBKAn+K3i+Q7ki3oNycAys4eP8gO4oeH2QBFvxFVSAYj6uR3cHwWdcFGzFG1AF8sBakOBkeNFR8AMbAY/BedDqovQPoA6UgghjBbMxkXfGqpMfwUyv4w90wRV+1GTBCyQdmy5oc8hlwQdMFrxF0KlzkjbDwA8XBSebLPikv1cNfusBml0UHGWy4BpBp0olbYaAjgBlselZHBgNloNGm+PbQF8jBfsgKlrQbnuActMtYoWCBkmb68ZO09hNzEbIUzDCq82GAOXekuSRJGl3xGTBmT6IYXsU10Ahn5cGOo5ukeQxCLQL2q0zWXCBizeq7TZD1XdBu1iTBVe4KPieJI9kQZtPYKCRgpF4P/DW5QVDnkUeUVyk1fH3jd2L4Pu1KqSxMfohH6cbfbmS+eqRTdX22ixYck0WnKZAbguY5BV3o8IrPsVkwWUKBMQIYmcpEjzdZMF3eCfaA4C1OxGkld4/WgPdE9ZBLttLGMwJD4AI0F8SvycfPpwIvkuFJ2LBQyXzWl8pck0wmwuCcWCUZrCcwizy3aZg/E13RTBONMXjpL81g+W0wyvf/YpucHPdEpzbxQ8k7djlkesmRTHbnZRt+Ss4T3PBOz1y3aooZq1rj+1xsoMGCd6sKOYFEhxcwRm6Cf4JvmksuIUXlrz2MeZknQTv5k95e4HZvCM6CU73c5O/w2ldskrBqTbL4K4WnCbIL0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+KyJYFZsPdUrvzmSWM9dL8D2YZpWw4tBlrEyTz4n1mmaxvK5DvLBTY9NIitKdBT8P63k1pPg4ApOMllwBX+9agZYKamqdCI4x0Ec9vg+0lTBhYLYVxQLznYQp65L3jJSILhN9G4a/j5RseAefBW5gy00/PwvuWSq4GKb+PWqBAviR/Ay2UxeTV8pqObJMlVwiU38hmAKlizl4/iCqIjXIS8yeYgIE8SOUTlEGPkyuKKb3FlB7FskWN00jX1sIxVM4/uxTaqnad1dcNAXGiSYBGsjuJoXvJTy95VJsEJWeZ2/N7hBghWXQXnl0Ae8IsHOGSfJ4zAJdv59HVlR9SYS7JxESR4XSbBzLgtyiKebnDqugrEe248pkveISbAD3oEvtNCglRwJ1l1wvuaC95gueJ/mgnNMFxzFH6m84V841YVW/nZ9DH0/mD4xTpBgEkyQYBJMggkSTIJJMEGCteYPxO/zzCRZDV4AAAAASUVORK5CYII=",Vme="/CharacterStudio/assets/color-palette-71a7a2d4.png";var Rs={},Sg={},jme=typeof ta=="object"&&ta&&ta.Object===Object&&ta,X5=jme,Wme=X5,Kme=typeof self=="object"&&self&&self.Object===Object&&self,$me=Wme||Kme||Function("return this")(),Ca=$me,Yme=Ca,Xme=Yme.Symbol,Mg=Xme,LP=Mg,Z5=Object.prototype,Zme=Z5.hasOwnProperty,Jme=Z5.toString,Ap=LP?LP.toStringTag:void 0;function qme(n){var e=Zme.call(n,Ap),t=n[Ap];try{n[Ap]=void 0;var r=!0}catch{}var i=Jme.call(n);return r&&(e?n[Ap]=t:delete n[Ap]),i}var ege=qme,tge=Object.prototype,nge=tge.toString;function rge(n){return nge.call(n)}var ige=rge,PP=Mg,sge=ege,oge=ige,age="[object Null]",lge="[object Undefined]",DP=PP?PP.toStringTag:void 0;function Age(n){return n==null?n===void 0?lge:age:DP&&DP in Object(n)?sge(n):oge(n)}var Au=Age,cge=Array.isArray,Io=cge;function uge(n){return n!=null&&typeof n=="object"}var Sl=uge,fge=Au,hge=Io,dge=Sl,pge="[object String]";function mge(n){return typeof n=="string"||!hge(n)&&dge(n)&&fge(n)==pge}var gge=mge;function vge(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 yge=vge,wge=yge,xge=wge(),_ge=xge;function bge(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=kge}var TT=Qge,Hge=Au,zge=TT,Gge=Sl,Vge="[object Arguments]",jge="[object Array]",Wge="[object Boolean]",Kge="[object Date]",$ge="[object Error]",Yge="[object Function]",Xge="[object Map]",Zge="[object Number]",Jge="[object Object]",qge="[object RegExp]",e0e="[object Set]",t0e="[object String]",n0e="[object WeakMap]",r0e="[object ArrayBuffer]",i0e="[object DataView]",s0e="[object Float32Array]",o0e="[object Float64Array]",a0e="[object Int8Array]",l0e="[object Int16Array]",A0e="[object Int32Array]",c0e="[object Uint8Array]",u0e="[object Uint8ClampedArray]",f0e="[object Uint16Array]",h0e="[object Uint32Array]",un={};un[s0e]=un[o0e]=un[a0e]=un[l0e]=un[A0e]=un[c0e]=un[u0e]=un[f0e]=un[h0e]=!0;un[Vge]=un[jge]=un[r0e]=un[Wge]=un[i0e]=un[Kge]=un[$ge]=un[Yge]=un[Xge]=un[Zge]=un[Jge]=un[qge]=un[e0e]=un[t0e]=un[n0e]=!1;function d0e(n){return Gge(n)&&zge(n.length)&&!!un[Hge(n)]}var p0e=d0e;function m0e(n){return function(e){return n(e)}}var IT=m0e,Kw={exports:{}};Kw.exports;(function(n,e){var t=X5,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})(Kw,Kw.exports);var RT=Kw.exports,g0e=p0e,v0e=IT,NP=RT,kP=NP&&NP.isTypedArray,y0e=kP?v0e(kP):g0e,t8=y0e,w0e=Bge,x0e=q5,_0e=Io,b0e=MT,B0e=e8,E0e=t8,C0e=Object.prototype,S0e=C0e.hasOwnProperty;function M0e(n,e){var t=_0e(n),r=!t&&x0e(n),i=!t&&!r&&b0e(n),s=!t&&!r&&!i&&E0e(n),o=t||r||i||s,a=o?w0e(n.length,String):[],l=a.length;for(var A in n)(e||S0e.call(n,A))&&!(o&&(A=="length"||i&&(A=="offset"||A=="parent")||s&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||B0e(A,l)))&&a.push(A);return a}var n8=M0e,T0e=Object.prototype;function I0e(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||T0e;return n===t}var FT=I0e;function R0e(n,e){return function(t){return n(e(t))}}var r8=R0e,F0e=r8,U0e=F0e(Object.keys,Object),L0e=U0e,P0e=FT,D0e=L0e,O0e=Object.prototype,N0e=O0e.hasOwnProperty;function k0e(n){if(!P0e(n))return D0e(n);var e=[];for(var t in Object(n))N0e.call(n,t)&&t!="constructor"&&e.push(t);return e}var Q0e=k0e;function H0e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var ld=H0e,z0e=Au,G0e=ld,V0e="[object AsyncFunction]",j0e="[object Function]",W0e="[object GeneratorFunction]",K0e="[object Proxy]";function $0e(n){if(!G0e(n))return!1;var e=z0e(n);return e==j0e||e==W0e||e==V0e||e==K0e}var i8=$0e,Y0e=i8,X0e=TT;function Z0e(n){return n!=null&&X0e(n.length)&&!Y0e(n)}var l_=Z0e,J0e=n8,q0e=Q0e,eve=l_;function tve(n){return eve(n)?J0e(n):q0e(n)}var Tg=tve,nve=_ge,rve=Tg;function ive(n,e){return n&&nve(n,e,rve)}var s8=ive;function sve(n){return n}var o8=sve,ove=o8;function ave(n){return typeof n=="function"?n:ove}var lve=ave,Ave=s8,cve=lve;function uve(n,e){return n&&Ave(n,cve(e))}var UT=uve,fve=r8,hve=fve(Object.getPrototypeOf,Object),LT=hve,dve=Au,pve=LT,mve=Sl,gve="[object Object]",vve=Function.prototype,yve=Object.prototype,a8=vve.toString,wve=yve.hasOwnProperty,xve=a8.call(Object);function _ve(n){if(!mve(n)||dve(n)!=gve)return!1;var e=pve(n);if(e===null)return!0;var t=wve.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&a8.call(t)==xve}var bve=_ve;function Bve(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var Qve=kve,Hve=A_;function zve(n,e){var t=this.__data__,r=Hve(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var Gve=zve,Vve=Cve,jve=Lve,Wve=Ove,Kve=Qve,$ve=Gve;function Ad(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,f=!0,h=t&oxe?new nxe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,Xbe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,$be.default)(r)?(0,Wbe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,Vbe.default)(r)&&t.push(r)}),t};Sg.default=Zbe;var Ig={};function Jbe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,vSe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,mSe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=ySe({},r[a],s[a])}),i}),r};Ig.default=wSe;var Rg={};Object.defineProperty(Rg,"__esModule",{value:!0});Rg.autoprefix=void 0;var xSe=UT,yD=bSe(xSe),_Se=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){ISe(i,r);function i(){var s,o,a,l;TSe(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){DSe(i,r);function i(){var s,o,a,l;PSe(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};jT.default=NSe;Object.defineProperty(Rs,"__esModule",{value:!0});Rs.ReactCSS=Rs.loop=Rs.handleActive=WT=Rs.handleHover=Rs.hover=void 0;var kSe=Sg,QSe=dd(kSe),HSe=Ig,zSe=dd(HSe),GSe=Rg,VSe=dd(GSe),jSe=Fg,F8=dd(jSe),WSe=Ug,KSe=dd(WSe),$Se=jT,YSe=dd($Se);function dd(n){return n&&n.__esModule?n:{default:n}}Rs.hover=F8.default;var WT=Rs.handleHover=F8.default;Rs.handleActive=KSe.default;Rs.loop=YSe.default;var XSe=Rs.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?f=1:f=Math.round(u*100/a)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var h=void 0;if(c<0?h=0:c>o?h=1:h=Math.round(c*100/o)/100,i!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},bB={},JSe=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},qSe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(bB[s])return bB[s];var o=JSe(e,t,r,i);return bB[s]=o,o},_D=Object.assign||function(n){for(var e=1;et.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function _n(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:A,onSubmit:c,minWidth:u,disabled:f}=n,h=ye.useRef(null);return ye.useEffect(()=>{t&&Cpe(t).then(p=>{h.current&&(h.current.innerHTML="",p&&(p.classList.add(Un.icon),h.current.append(p)))})},[t]),o&&o==="login"?k.jsxs("div",{className:dh(r,Un.iconButtonWrap,s&&s==="dark"?Un.dark:Un.light,A&&Un.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Un.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Un.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),k.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Un.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Un.iconWrap})]}):o&&o==="icon"?k.jsxs("div",{className:dh(r,Un.iconButtonWrap,s&&s==="dark"?Un.dark:Un.light,A&&Un.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{className:Un.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M5 2H2.85562L3.00485 4.13918L6.7903 58.4048L6.9201 60.2656H8.78545H62.6772H64.6178L64.6763 58.3259L66.3135 4.06031L66.3756 2H64.3144H5Z",fill:"#efefef",className:Un.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),k.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Un.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Un.iconWrap})]}):k.jsx("button",{className:dh(r,Un.buttonWrap,s&&s==="dark"?Un.dark:Un.light),onClick:i,onMouseEnter:l,onSubmit:c,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:k.jsxs("div",{className:Un.innerWrap,style:{fontSize:e},children:[t&&k.jsx("span",{ref:h,className:Un.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function Spe(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?k.jsx("div",{className:Bv.container,children:k.jsxs("div",{className:Bv.messageWindow,children:[k.jsx("div",{className:Bv.messageTitle,children:t}),k.jsxs("div",{className:Bv.buttonContainer,children:[e&&k.jsx(_n,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),k.jsx(_n,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):k.jsx("div",{})}const Mpe="_backgroundImg_1yy0g_1",Tpe="_darkBackground_1yy0g_16",Ipe="_logo_1yy0g_29",Ev={backgroundImg:Mpe,darkBackground:Tpe,logo:Ipe};function Rpe(){const{debugMode:n}=Y.useContext(or);return k.jsxs("div",{className:n?Ev.darkBackground:Ev.backgroundImg,children:[k.jsx("div",{className:Ev.backgroundBlur}),k.jsx("div",{className:Ev.Background})]})}const Fpe="_buttonContainer_19n2w_1",Upe="_buttonLeft_19n2w_10",Lpe="_buttonRight_19n2w_14",Ppe="_buttonCenter_19n2w_18",Dpe="_sideMenu_19n2w_33",Ope="_scrollContainer_19n2w_44",Npe="_scrollContainerOptions_19n2w_52",kpe="_bottomLine_19n2w_60",Qpe="_editorButton_19n2w_94",Hpe="_editorText_19n2w_102",zpe="_selectorContainerPos_19n2w_112",Gpe="_selectorButton_19n2w_129",Vpe="_selectorColorPickerUI_19n2w_138",jpe="_selectorColorPickerButton_19n2w_144",Wpe="_selectorColorPickerImg_19n2w_157",Kpe="_uploadContainer_19n2w_163",$pe="_uploadButton_19n2w_176",Ln={buttonContainer:Fpe,buttonLeft:Upe,buttonRight:Lpe,buttonCenter:Ppe,sideMenu:Dpe,scrollContainer:Ope,scrollContainerOptions:Npe,bottomLine:kpe,"editor-container":"_editor-container_19n2w_87",editorButton:Qpe,editorText:Hpe,selectorContainerPos:zpe,"selector-container":"_selector-container_19n2w_123",selectorButton:Gpe,selectorColorPickerUI:Vpe,selectorColorPickerButton:jpe,selectorColorPickerImg:Wpe,uploadContainer:Kpe,uploadButton:$pe},Ype="_dropArea_1a0z4_1",Xpe={dropArea:Ype};function Cg({onFilesDrop:n}){const[e,t]=ye.useState(!1),[r,i]=Y.useState(null);ye.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)}},[]),ye.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return k.jsx("div",{onDragLeave:s,className:Xpe.dropArea,style:{display:e?"flex":"none"}})}const Zpe="_mainTitleWrap_4fb0s_1",Jpe="_mainTitle_4fb0s_1",qpe="_topLine_4fb0s_18",gB={mainTitleWrap:Zpe,mainTitle:Jpe,topLine:qpe};function wa({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&&k.jsxs("div",{className:gB.mainTitleWrap,style:i,children:[k.jsx("div",{className:gB.topLine}),k.jsx("div",{className:gB.mainTitle,children:n})]})}const eme="_ContainerPositionTop_v15ql_2",tme="_ContainerPosition_v15ql_2",nme="_Container_v15ql_2",rme="_topLine_v15ql_68",ime="_traitInfoTitle_v15ql_96",sme="_flexSelect_v15ql_105",ome="_flexButtons_v15ql_114",ame="_flexButtonsTop_v15ql_122",lme="_optionButtons_v15ql_131",Ame="_optionButtonsSmall_v15ql_143",Zn={ContainerPositionTop:eme,ContainerPosition:tme,Container:nme,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:rme,traitInfoTitle:ime,flexSelect:sme,flexButtons:ome,flexButtonsTop:ame,optionButtons:lme,optionButtonsSmall:Ame},cme="/CharacterStudio/assets/randomize-green-4388c12b.png",ume="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNiOTBlZjU3LTIwOWItYzQ0Zi05OWNjLTkwYjYxM2Q0MWJiOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjY1ZDdmMmJiLWMxYjctYjc0My1hYmIzLTFmM2VjNjMxYjE0NCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozYjkwZWY1Ny0yMDliLWM0NGYtOTljYy05MGI2MTNkNDFiYjgiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6bbHqfAAAFoklEQVR42u2duWtWQRTFo5hGRNAETKFiIQqCSxGto4iCqSLon6BoQJJCEcEFLASbD7QRRcTKNbihoLgUWhj/AItUCi7gVmjikubzPphAiOYts9659xQHAnl5M2/u73vnzHwvbzra7XaHNg1cPrKadJs0bnSHtEbjWGgr/HxSi9SeRWeLYwCAzOIPmk97u0ITpAMAQE7h+0ivaxR+psZIWwBAvoVfSXpsUfiZelZkBgAgx+dtJTIfaPV5W4nLB9p93lZi8oEEn39iWcRPpK2kzaSPlud4mns+0Ojzk6QTpM5p5+skHSP90ZYPtPn8DVJ3ybkXk65oygdafH6UtKlBW72klxrygfT5/BfSLoe2B0xWELt+oMbnHfoxj3RUaj6Q6vNdAfq0SGI+UOvzDn0UlQ/U+7z2fACfV54P4PPK8wF8Xnk+gM8rzwfweeX5AD6vPB/A55XnA/i88nwAn1eeD+DzyvMBfF55PoDPK88H8Hnl+aBup/aQflp26HrZc3hQaT64Zjnmv0h7nQEwT8u24PNJQdjokA9aVXfdqsaH4fNsQNhJ+mxRj2EXAO41bGw/ihUchH0Na3LXBYC7DRs7T1qOQgUr/lLSuZgA3LL0nkukhSiat8IvIF2wrMWtFABMJdHDpLkoolPxD5mxbOcGwJTekfpRzMaF305662H8kwMwpRekDShuZeHXkp57HHc2ACAfhPP5JAB8MB3+jXyQzOeLJfaLpPcpAPhmjlnmcMtSnQ8cfb6w1BXmPF9TAFB8N9Az7dhtpDfIB8F9vvjQ7Jh2rp6K72mCArDkP39z0GHaIjofOPr8lG3OmXHOJawAmHah57F+4G0+P+sHgyUAHm91/fD5cmtkDYDmfODT57MHQFM+COHzYgCQng9C+bwoACTmg9A+LxIACfkgls+LBiDHfBDb51UAkEs+SOHzagDgnA9S+rw6ADjlAw4+rxaAlPmAk8+rByB2PuDm8wAgUj7g6vMAIHA+4O7zACDc7fqk+a/lbJel1QPgIR9k/cUUAAj7SDX7r6YBgP98wM7nAUCa9YOo83kAwC8f5PIACgDwnA+yegQNADQfsGdlb9rK8HoAQMMBK3vryT0AIB+ARyXX9AgAyAfgYck1PQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlALQAwCSX0+y18V/L/a3BQDJr2cx6UcKAMZz3BRaIADdphZJNo16ldsG0ZIAoP721thY2gmAulvH3iB1AYCot/0rMbaObbJ59KR53UonAAjW907ScTPWUfYOHpK2fXyuADhsHz/kAkBBXMvy5QqjHPNBbgBQnzbW8PnZ1Kq6I9ftxJ6KuWaZrnOaLeQCQDHFJl1zeLPJ3jrtNOnQfIe7AZt8wB0A6sM80lHSH8uxPlPUqm57Nh1cSXps2bnk+YAzANT+AOmT5dg+Ja1q2qZLZ/tIry07m2z9gCMAjj4/Rtpi27aPzg9WrERVrR90awXAzOevWo7dBOmAax98XUg2+YADAGZ2dSyWzwcHIKd8kBoAM5+P6vPRAMghH6QCIKXPRweAcz6IDQAHn08GAMd8EAsATj6fFABu+SAGANx8ngUAXPJBSAC4+jwrADzlg5u2+SAEANx9niUAqfKBTwBy8Xm2AHjKB19Ju2MDkJPPswcgZj5wBSBHn88GgBj5wBaAnH0+OwBC5oOmAEjw+SwBCJUPmrwuXorPZw2Ax3yw3pxnpOS4EXPMOkk+LwKAGflgwrI4p0kPSn5/n3RKms+LAsBDPggh1j4vDgBP+cCHsvB5sQB4ygfifV48AJ7WD8T6vBoAAueDbH1eFQAB8kH2Pq8SAA/5QIzPqwbAIh+I83kAUD8fiPR5APAvCKtJt80dYdz8vEbjWPwFnWtJD/nY2zYAAAAASUVORK5CYII=",fme="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM2NDY5Y2JiLWFkMzUtYmQ0Ny04M2Q1LWU0NGQ0MTI2YmYwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjIyNTIzNmU1LWZhMWItZTM0NS04ZDM2LTE5YmQyYTRiZjM1MSIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjNjQ2OWNiYi1hZDM1LWJkNDctODNkNS1lNDRkNDEyNmJmMDYiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6qPgTwAAAEeUlEQVR42u2dX4tNURiH58KfwR1K0USSj6BoIpdydcY0TUMmIy58BPdK/uTCLReaG7kwooQoH4FQyneQMNw53t2cqdOJPfusvfZa77ve5+JX1DlnOns9PM+cqT0T/X5/wtt6D64ekj2W/ZKtDv582OO18Hbwk7I7sv5/dle2DQDKPPzLsp81h7++6n+EKwBQzsGfkH1ucPCj+yI7CQB2D/6A7GXAwY/utewgAJTj+dAV2QdePR+64vrAu+dDV0wf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5532A5533AZ533gd43nkf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5530wzsHvkr3hQqvfW9nuLgDYKXvGBVa/F50AMATCHtkKF1rdqn+ce1NG4BHZOy589n2QHc35beBZ2VcOIvm+yRa1fBC0SXZN9oeDSbLrss0aPwqmDxR6PggA+ULnZRfpA9uel+ddkJ0LAWB56AOG/fSBLc/L86ZkrwavsxwCwOgPd6q/T9IHuj0vz9kquzl6djEAqPZDdok+0Ol5ed6S7Ps/XjMaAOurfgh0nD5Q4/lp2aea144OwPDHjvRBXs8/b/A1OgOAPtDj+awA0Af5PZ8dAPogr+fVAEAf5PG8OgDog7SeVwuA1z5I7XnVAHjqg1yeNwFAyX2Q2/OmACitDzR43iQA1vtAk+fNAmCxDzR63jwAFvpAs+eLAUBrH2j3fHEAaOkDK54vEoCcfWDN80UDkLIPrHreBQBd94Flz7sCIEYfPCnM8+4AiNEHZ2RzhXjeLQCt+6AQz7sHoFUfFOB5AIjRB4Y9DwAx+8Cg5wEgVh8Y9TwANNjt6rOADT4nuFHg+waAoc3WvOfZQt8zAAxtruY9zwFA+QDM1LznGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANsA3AeAYnYvBIBTsvcAYH4fZaeDf328PHmxt3bzRACwteqWNkvBvz5+5MJs6a3dRBEAbOxWdVOrJmc77j1z9smeAoDaVbe1mRrnTENvnnSst3YzZQDQsepGVtMhZ9n29mkW+6AkABp5vjMAjPZBKQA09nynABjsA+sAjO35JAAY6gOrAAR7PikABvrAGgCtPZ8FAMV9YAmAKJ7PBoDSPrAAQFTPZwdAWR9oBqATz6sBQEkfaASgU8+rAyBzH2gDoHPPqwQgYx9oASCZ51UDkKEPcgOQ3PMmAEjYB7kAyOZ5UwAk6IMcAGT1vDkAOu6DlACo8LxZADrqgxQAqPK8eQAi90GXAKj0fDEAROqDrgBQ6/miAIjQB7EBUO/5IgFo0QexADDj+aIBCOiDtgCY87wLAMbogzYAmPS8GwAa9kEIAKY97w6ADfpgHACK8LxbAEb6YHVwqPM1j5sfPOZ3SZ53D8DgcLfLHsoWah6zIHsk2+HluvwF92zupxEV3NQAAAAASUVORK5CYII=",hme="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmY3YWFkYzZiLWM2ZmEtNjE0OC05YWZkLTgxN2Q1OWRkZTI0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc2NTFhZmQyLWU5YTctOTc0Zi1hZWFkLTdiMWMyODQ2YWEzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmN2FhZGM2Yi1jNmZhLTYxNDgtOWFmZC04MTdkNTlkZGUyNDIiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6TWt7cAAAFm0lEQVR42u2dT2xURQCHSTXpQTH0oIJpgfZKi1ETiSK1MV7FbORQNcG0Hmg3oQVjjKARrhDBBDEYMSEYS6kWkxoVAheDiBc9kHBBuaGgMSo1KgTF+pt0JLq6dOe93X3z5zt8SbPdvtmZ37fvvc7Mm5k3MzMzD9KFRkAAGgEBAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABPKO0f3OrWCxWiTViROwQ+8QBcchywL62w77HvLdPdJpjIEAYYd8sHhDPiD3iuLggfhczGblqj/GJ2Cs2il5xCwL4EfoK8bw4LH7MEbQrF8UR8aK4T7QgQPNC77On6jNNDHwuzopXzGdDgMaEvlRsEqc8Cr0ap+2ZoRMB8gdvrulviT8CCP7/7h/GxIMI4B78Q+KjAEOvhrlHeRgB5g7e3FB9GFHwlZi6rUSA/wZ/m3g94uAreVMsRIDZ8J8S3yUU/t98L55OVgDby3Y4weArMf0JXUkJoAo/Ln4i/GtMiyeTEEAV3U3gVXktWgFUuXbxKSHPyWeiIyoBVKG7xXnCrRnTVvdEIYAqsjrniFwjGteciabEuGXKvnbes57ER4MWQBVY60FD/ioOiiHRfb3xfTt/oNu+1/zNLx58/rVBCqAPPlxww52x4/e356jDrfYYXxZcl+GgBCg4/Gk7KaSljvVpsSJcLLBe5SAEMB+04L72JQ08qy0ueKyi7LUABYe/pYn/0r4UiwSxhD9UQIfWuhgkiOGav67A8YzgJeC0n7/+W0KWIOTwj3o0keVoqBKEGv5vYoFHAiwQl0KUIMTwDSM5wuoQg3Ya90HLTvtaR47jjhbcJuWmCOBB+OcyBrTcPgJ25TrHvmKFuDNjGedCkyC08DN9+20vnms5GwM8CzhLEFr45jo73zGUbTnK2+5Y1nxxOSQJQgrf8G4B38gRxzInPWmrcl0E8Ch8w4BDEF11LLfLodwBj9qrnEsAz8I3LHMI4r06ljvpUO4yz9qsnEkA/WG/ZxX5VtxQYwh3NKD8RTWWfaOHzzn0OwmgP2izU5J8qsQJh2/hYMGXnxMePqja5iLAdg8nSk45BPBqA8rf5VD+lIftt81FgC88rMC4QwDvNKD8CYfyxz1sv88RAAG4BHAJSOMmcICbwBw3gRH8G7ioAeUvTObfwEg6giYL6gjqjqIjiK7gzF3Bg6VYuoIjGAwaYTAoruHgywwHFzAc7JkEoxkmamwQfzIhJI4pYd9knK7VU+OUMNOJszxjGV9HPSXMIwlGc0zebLf9BDsrJoWa19pzHHdDEpNCPZHgUrWOjYKmhbclNS3cEwmOeSTAseQeDPFEgq08GsbDoUMFhj+U/MOhnpwJhgmfBSK2ctpniRizx8DSBga/hCVi/JfgZ/FsrUPHjotETbNIVDjLxH1lVwtjmTgWitw8YYXsqWGhyB773gkWiqyPBI/M0f/ebC7YZWHf/0dXsPn5pP2dL5/TLK+7OpbFou8ygzgsAl37gJdpM5aLT5OTeQalQtgwYhchV2V3KlvG9LNlzL8waxA/kdqmUWY7WDaNmm2DtDaNYtu4a9vGDbJxZJobR75RYuPIqlvHfhBx8GYc4X62jk1v82hTFzaPzrh9/H7PNp2qFbPl/duil+3j6zMMu0mcCiD40+IF0RlC2wYhQIUMveJluymUL6GftWsP94XWnsEJUCHDveI5e439oYmBm06sI/abvqKeG1QhQHYZbhIr7fj9HvFxaXYjyDz3D1ftMY6LvfbYq1yfT0SA4qRotcvDm5vJNfZpYXP52CfGxCHLmH3N/G69eMyczkuzW9y3xtxGUQsACAAIAAgACAAIAAgACAAIAAgACAAIAAiAADQCAgACAAIAAgACAAIAAgACAAIAAgACAAIAAkCc/AWkhfX2hx9ZaQAAAABJRU5ErkJggg==",dme="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAATr2AAE69gE6sVc6AAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PslPja4AAAbiSURBVHja7Z17iFVFHMc1K80ybc3SP9K21YrubtLDiIJqK5WMpbYt1MpSKiKkba0gtU0rCCpoyxRXSKrNiJIwCmtD0u2JEWFuSC/t2sueghDU2svbd2D+uFzce89rzvxm5vvHB2TX5Zw758PMufN7zJBSqTSEhAsHgQJwECgAoQCEAhAKQCgAoQCEAhAKQCgAoQCEAhAKQCgAoQDVaO1ZOgWsB7+CAbALLAPDOdCeC4CH3AJKg/AlGM/B9lQAPNxG8HcVARS7wQQOuJ8CPFvj4VMCXwXAAx0BfowoACXwUIA68EcMASiBh0vApzEFoASeCdCZQABK4JEAw0A/JQh7H2A8KFKCsHcCxUugX1qnghlgLrgBzNP/bgXTwTRwAjiEAsQf4AkpJChmJYF+0M1gIegGm8Dn4M+I9/If+B68B3rAneBiMIoCCJwJ8DejwZVgBfgQ7E94/Vqor7ybwVJwOgWwKAH+z3HgJrDR4AOvxU7wIDiFAuQoAX7XZumBV0MtF20UID8JnhMoQUlvjXeAw5kQYl6CVUIlUOwD7WBo8BlBhiVYK1gCxU/giuBTwgxL8IJwCRTvg/qgcwINS/CKAxIolgSdFGpYgjcdkeATMDHYrGDDErzriASK+cGmhZuSAD8/DHzskARrg60LMCjBkQkTVWwuCccGWRhiUIIx4DOHJNgLCkFWBhmUYJzer3dFAhWFnOXjRtAosA6cb0ECFaL+xiEJFAt8E6BXf7Cfq22GGJRgIvjBMQlu9yUWsOUgW6M2JGgAvzgmQYfr0cA3quyPm5KgWEWCaXpLVhWtXqVp11k/6uffCpRgoav5AC9GCJvWS0svw99NVhs0OtHkgBAJ5rmWEbQiRqSs3saOYcTPcTzoAv8KkGCGKzmBnQnCpbkvBwlE2GRZAJXQ2ig9K3hOipi52Jmg7D7aLUvwXdbp81k+/DPAPykTJ1yQYKbld4MPJFYGHZPi4bgowaWWZ4I10gTYmHEKlQsS3GxZgtukFIfeayiPzgUJnrYswVm2G0Q0G06mFC2BCuHq7W1bAmxPW8OYNsBjOtJmUoKvwaQMJOiwPAussiVAXoUZJiVQJWW/gR3gSdXrMME4jIzZJ8kEl+UqgC7EzDu33pQElSxPMB6PWRZANeU8KhcBdJKFDeNNxg4q6Yk5JhcJ2CpemZcA6yxX2YibCVQdoIBlQHGhUQHUWiOk+PLEnCRoTJD0YpM+0wJIybS9xmCnknK6YozNGiFjM8eIAAJ2vsqjYlEaSGQxE2yLMT4PCBmfreBkEwK8JuQDfhTjnpsySNUeGfFaiwVlEd1hQoBXhXy4vpjf0femvF6TYzOAMQGkLAHbY763bEt5vWLEJadb0BIwxeeXQJXZOyLGPT+ewTVrSqDi9EIEmO3718DI07K+50JG16xVlfywgHHpzWMj6CkBH/SWmPe8PCcJHrU4JurUltPyEODoDDdakvJ8gvvuyejaRaES3JVnMMj2UvA7GJvgvu/zdCbYYiMc/IRlCRYlvO8GHfrdoY+42+/4TPBXkqk/q4wgm504dsf5NlDlM0zS4VQTM8Ej0nMD0w5ewWKf3kSxews9i0xK8LKEpND5lpeCMx2QwMRyoFLaxkhJC++yKIBay48IcCY4T1pl0GaLErzuSAu7rGaCzJpHZCnAOD0AtiTYEIgEqyUXhxYSHCSZaahYlal5LME7LpSHTxewSdTioQS7TPQSNNUgYoGAeMFbWdTTm+xPEEMCVbvQ4FqLmEVCIodv62PhRjs6E6iS+7NdbRJ1j6AsmQEtw0r1Fg2uBVdrHtJNoqYKlKDZ9TZxSxxqy2atIHWQfYLLfWkUeTcliC3BTN+OjLmVEkSSQEUqr/f1yJgWQb33vGhS4eKRMY36aw0lECCBrfbwdQ6d6uG1BLbPCeimBHYlkHBYxNyU/QUpgScnhmylBPlLIOoUS71Dd4ASBCpAWW1/LyUIVICyQbxE+IFPXkgg/nx7DMSNQvrveCmBeAEqRJA4I+wD57oqgTMCVHTqlvaO0GcrnyA4ASpeFhdn0AAiKTt1HF8dRHWozaSSIAWoGNyTdM/eDQbjDOq0jvX61JCmFPsdoiTwQoCDNG08R7e0Wa1zA7/SGUFRBnqP3pRSp57dD9rAqWBohjOX1TOQvBagysCP1V3DLgCz9IOdDa4DrarSRjWgBMNcPSuZArglpAgJ+DDclaA/i9mKD8JtCTopQNgS9FOAsCVQdZh1FCBcCfakbZPDgXdbgme4BIQrgWoMWaAA/kqgTiz/oooALdwH8F+C4WCZDjwN6L6GL4HJ3AkkFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIByGD8DzQJyO8fOgE8AAAAAElFTkSuQmCC",pme="/CharacterStudio/assets/play-de4238c5.png",mme="/CharacterStudio/assets/reverse-e35421b8.png",gme="/CharacterStudio/assets/pause-b6381fd4.png",vme="/CharacterStudio/assets/fast-forward-0d3ffae5.png",yme="/CharacterStudio/assets/fast-backward-1f713448.png";function a_({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=ye.useContext(or),[a,l]=ye.useState(s.userActivated),[A,c]=Y.useState((o==null?void 0:o.getCurrentAnimationName())||"");ye.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&c(n)},[n]);const u=()=>{r()},f=m=>{m?o.play():o.pause(),o.setSpeed(1)},h=m=>{o.play(),o.setSpeed(m)},p=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},d=async()=>{console.log("play next"),await o.loadNextAnimation(),c(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),c(o.getCurrentAnimationName())};return k.jsxs("div",{className:Zn.Container,children:[k.jsx("div",{className:Zn.ContainerPositionTop,children:k.jsxs("div",{className:Zn.flexButtonsTop,children:[k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(-2)},children:k.jsx("img",{src:yme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(-1)},children:k.jsx("img",{src:mme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{f(!1)},children:k.jsx("img",{src:gme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{f(!0)},children:k.jsx("img",{src:pme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(2)},children:k.jsx("img",{src:vme})})]})}),k.jsxs("div",{className:Zn.ContainerPosition,children:[k.jsx("div",{className:Zn.topLine}),k.jsxs("div",{className:Zn.flexSelect,children:[k.jsx("div",{className:`${Zn["arrow-button"]} ${Zn["left-button"]}`,onClick:g}),k.jsx("div",{className:Zn.traitInfoTitle,style:{marginBottom:"10px"},children:A}),k.jsx("div",{className:`${Zn["arrow-button"]} ${Zn["right-button"]}`,onClick:d})]}),k.jsxs("div",{className:Zn.flexButtons,children:[e&&k.jsx("div",{className:`${Zn.optionButtons}`,onClick:e,children:k.jsx("img",{src:cme})}),k.jsx("div",{className:`${Zn.optionButtons}`,onClick:p,children:k.jsx("img",{src:a?dme:hme})}),k.jsx("div",{className:`${Zn.optionButtons}`,onClick:u,children:k.jsx("img",{src:i?fme:ume})})]})]})]})}const wme="_tokenBoxWrap_q4pvo_1",xme="_mask_q4pvo_7",_me="_timer_q4pvo_31",bme="_level_q4pvo_42",Bme="_mythic_q4pvo_55",Eme="_epic_q4pvo_60",Cme="_rare_q4pvo_65",Sme="_uncommon_q4pvo_70",Mme="_common_q4pvo_75",Tme="_none_q4pvo_80",Ime="_value_q4pvo_85",Rme="_frame_q4pvo_95",Fme="_emptyIcon_q4pvo_111",Ume="_badge_q4pvo_123",Lme="_frameActive_q4pvo_131",Vl={tokenBoxWrap:wme,mask:xme,timer:_me,level:bme,mythic:Bme,epic:Eme,rare:Cme,uncommon:Sme,common:Mme,none:Tme,value:Ime,frame:Rme,emptyIcon:Fme,badge:Ume,frameActive:Lme,default:"_default_q4pvo_159"},Pme="/CharacterStudio/assets/magic-box-cd45f027.png",pA=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,A]=Y.useState(!1),c=()=>{A(!0)};return k.jsxs("div",{className:Vl.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&k.jsx("div",{className:dh(Vl.frame,Vl.frameActive)}),k.jsx("div",{className:dh(Vl.frame,o&&Vl[o])}),k.jsx("img",{src:l?Pme:s,className:Vl.emptyIcon,style:a,onError:c}),i&&k.jsxs("div",{className:dh(Vl.level,o&&Vl[o]),children:["Lv.",i]})]})},Dme="_InformationContainerPos_72ckd_2",Ome="_scrollContainer_72ckd_15",Nme="_traitInfoTitle_72ckd_27",kme="_traitInfoText_72ckd_35",Qme="_flexSelect_72ckd_62",Hme="_checked_72ckd_119",zme="_checkmark_72ckd_123",Gme="_checkboxHolder_72ckd_136",No={InformationContainerPos:Dme,scrollContainer:Ome,traitInfoTitle:Nme,traitInfoText:kme,"input-box":"_input-box_72ckd_43",flexSelect:Qme,"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:Hme,checkmark:zme,checkboxHolder:Gme};function ST({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=Y.useContext(Ui),{characterManager:i}=ye.useContext(or),[s,o]=ye.useState(0),[a,l]=Y.useState({}),[A,c]=Y.useState([]),u=d=>{i.setManifest(d),i.loadInitialTraits().then(()=>{r(!1)})};ye.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),c(Object.keys(i.getAvatarSelection())))},[t]);const f=d=>{i.loadTraitsFromNFTObject(d).then(()=>{r(!1)})},h=async()=>{if(!t)if(r(!0),s>=n.length-1)e?u(n[0]):f(n[0]),o(0);else{const d=s+1;e?u(n[d]):f(n[d]),o(d)}},p=async()=>{if(!t)if(r(!0),s<=0)e?u(n[n.length-1]):f(n[n.length-1]),o(n.length-1);else{const d=s-1;e?u(n[d]):f(n[d]),o(d)}};return(n==null?void 0:n.length)>0?k.jsxs("div",{className:No.InformationContainerPos,children:[k.jsx(wa,{title:"Trait Selection",width:180,right:20}),k.jsxs("div",{className:No.scrollContainer,children:[k.jsxs("div",{className:No.flexSelect,children:[(n==null?void 0:n.length)>1?k.jsx("div",{className:`${No["arrow-button"]} ${No["left-button"]}`,onClick:p}):k.jsx(k.Fragment,{}),(n[s].name||n[s].manifestName)&&k.jsx("div",{style:{textAlign:"center",flex:1},children:k.jsx("div",{className:No.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?k.jsx("div",{className:`${No["arrow-button"]} ${No["right-button"]}`,onClick:h}):k.jsx(k.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&k.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(d=>k.jsx("div",{children:k.jsx("div",{className:No.traitInfoText,children:`${d.trait_type} : ${d.value}`})},`json:${d.trait_type}_${d.value}`)),e&&A.map(d=>k.jsx("div",{children:k.jsx("div",{className:No.traitInfoText,children:`${d} : ${a[d].id}`})},`val:${d}`))]})]}):k.jsx(k.Fragment,{})}const UP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAXASURBVHgB7ZzNchNHEMd7ZiWf5WtSCSIfVa5cLN+MTRXrEFPcWJwHwNxys/0Etm+5YZ4Ac0pOIG4EU2WlCgffIm4+pIhS8ADKEQlt07OSKKGdlVdSz64K9++kmhlpR3+Pe3qmuwUgCIIgCIIgCIIgCIIgCIIgCIIgXHAUzCDLflDWRfCVgkVA5aOCkgqhRLMt9cdQW0MhNEBhHRFehW2ondaqDZgxZkZg3w9KrTm9RdJtknBlmAwjeLXTgvuzInbuAi//FPieUrv00gdW1GGnHe7nLXRuAkdmoKDvKYUBOCVfoT3IgSvrP295Gn4nG1sB91S0p4Kvvl34/83rszpkTOYrePXGxj1A3E41GKGGCl/Rq7oXQpM2tma/q0PC0R+orFAt0rfwU32eUgcnzx7tQIZkJrDZxNpFdUwvR6/arqgP59pQrdWqTUj52a0iBCT2nRRi14ttXEv72dOSicCpxCVhFeD+i+fVGkzB8s2g7HVgj77anRHDMhO5ABkwUlzjz4Z4d1ph+5w+jTazzZX1oEYmYTfB5av05rQEjtHgmMjmJoiLqKrFFi5xiTtEPTqcJFPpzc0pTk0EraJNBeqBrU9hZA72wAH03ArZ4+PBk18Socadl39UD8ARzgTuHnfVMT2gPNw3K+L2aHbauOTKT3ZmIrwi7NrENWYhR3Ftm1pJz2lnpsKJwGb10jrdjHXQhhYWQid+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q9YrqX8ujDk+OHt0FZtKKO9i2un7buGj+8Fha4fPcvjH7CtYeWI/BHS/cB2YmEbffbhvfKkC6I/wY8JsIrW7F2uiUxm0aJhXX0PO7a7H3qJGnv4lgFdiYB6vnQHcLwMg04n6cE1jnVF75ceMSMMIqsAnz2NrNxQ0wwSHu6DmFa8AIr4kILUdiMg9cGweXuIbenGqxDo/3jppVYKXpbnaI3n3u1HCK+3FuYXxuZIevASOsApNdK8faMO7Yj4sLcSM0xCMcmPqInfIRjNDFTnm4jWJSU4VpnIlr5hbaj87AiPPrymlwKa6hrS6wwK7FzQpegTG+Ijp6/BXxuYhr4N3kFMYEVu/HEzhLcZU90tIARrg3ubhNG8OvzHrlWuN1OMMCk1/553Abib6Y5r15mAWXfnsfXhusrS6Zb8L2o96Wh7i9OfmWrqncymFYBQ49y9GTaGkIkt6T14ZmElVs7UnfYVJYBTZXknSaawy3K89+DZint6BsiSkUTuK+VuX3gxFs14D+cMwrT3G7McO4eUDEJ8AMu8Bz7+HA1j4Y88rbz02KGZJ5YM+PcJIXkRTzIuHWQjqe5inuletBoLV6HO9xEzN0clROinnRKn6Qp7hRxEUraw6Ei5ihwYnAJuZlEkwsXeU8j79RRj3YkgHVoYt0guiZ4IgowQQhVSQjC3FXbmzsWssVyHNwtXoNzkoI3v5z1vz6m4V3FCK4OWpcZuIi7tn6yK3cefnMSXZnhNMajTevz04vXV6YJ5GXrQPM6mnDztvGGUvMbhhzWvviux9+U4C/gPXxeP/kqPorOCSTDHfyKv6G5Ox2czjZ/+uoegiMmPIwbTZVSKy5q58cPXaegJ1JhrtJ1x+R5V42OcSr6xvXOMqtUtbdRSUEkAGzVwRDoXSTFDJREUz3+OufM/zzK4IZ5Or14AC12ko5vGZqkcMQ/sOBWy5FURK6yy31apkrtFNV0iRcG5v74qi6DRmSS6WnKS0YUaDigiZdNOyfPHdXKpBELpWepuLyy+8XnmiEefobp454TII58IQFvE2u2FPIgfyLwdPVtY0PU93dtMzMzxkYoXUHtsl03JrUdJCdbmjEhwW60ctqEzuP2fxBjq7YPph6ZFSLaGqSP/VnmyQm3cqZ+uUoDlif1R/kEARBEARBEARBEARBEARBEARBEC48HwDC3eeu0ZVWOQAAAABJRU5ErkJggg==",Vme="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wMlQxMTo0OTozNy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBiNWViMTliLTkxMmEtMmI0NS1iOTZlLTliNDUxOGUzZDU4NyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjg4ODliZDlkLTAxZjItMTQ0Ni04NDE4LWYyYzNjNjQ1ODNlOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODg4OWJkOWQtMDFmMi0xNDQ2LTg0MTgtZjJjM2M2NDU4M2U4IiBzdEV2dDp3aGVuPSIyMDI0LTAxLTAyVDExOjQ5OjM3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wMlQxMTo1MjoyMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv0y+4AAAASPSURBVHja7ZxrSBVBFMctyqIgC0ujJ5UFaQpZRC/7YoUVQYUUkZQYQoVfJBF62PtBlhlJoJWSUQRSEYUFUVRiSEWRiokVgZqRWUEv7W3/oQkul53Ze+/OXWfyfPh98e6cPfNjnZ2ZPbshnZ2dIUTwIAkkmAQTJJgEk2CCBJNgEkyQYBKsgFnzlsaCanARZICFIJwEqxN8CXR68R08479lgxVgDAkOTPATC8EiXoLbYB9YDeJJsFzucPDLD8FWvABlIBcsAeNBKAn+K3i+Q7ki3oNycAys4eP8gO4oeH2QBFvxFVSAYj6uR3cHwWdcFGzFG1AF8sBakOBkeNFR8AMbAY/BedDqovQPoA6UgghjBbMxkXfGqpMfwUyv4w90wRV+1GTBCyQdmy5oc8hlwQdMFrxF0KlzkjbDwA8XBSebLPikv1cNfusBml0UHGWy4BpBp0olbYaAjgBlselZHBgNloNGm+PbQF8jBfsgKlrQbnuActMtYoWCBkmb68ZO09hNzEbIUzDCq82GAOXekuSRJGl3xGTBmT6IYXsU10Ahn5cGOo5ukeQxCLQL2q0zWXCBizeq7TZD1XdBu1iTBVe4KPieJI9kQZtPYKCRgpF4P/DW5QVDnkUeUVyk1fH3jd2L4Pu1KqSxMfohH6cbfbmS+eqRTdX22ixYck0WnKZAbguY5BV3o8IrPsVkwWUKBMQIYmcpEjzdZMF3eCfaA4C1OxGkld4/WgPdE9ZBLttLGMwJD4AI0F8SvycfPpwIvkuFJ2LBQyXzWl8pck0wmwuCcWCUZrCcwizy3aZg/E13RTBONMXjpL81g+W0wyvf/YpucHPdEpzbxQ8k7djlkesmRTHbnZRt+Ss4T3PBOz1y3aooZq1rj+1xsoMGCd6sKOYFEhxcwRm6Cf4JvmksuIUXlrz2MeZknQTv5k95e4HZvCM6CU73c5O/w2ldskrBqTbL4K4WnCbIL0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+KyJYFZsPdUrvzmSWM9dL8D2YZpWw4tBlrEyTz4n1mmaxvK5DvLBTY9NIitKdBT8P63k1pPg4ApOMllwBX+9agZYKamqdCI4x0Ec9vg+0lTBhYLYVxQLznYQp65L3jJSILhN9G4a/j5RseAefBW5gy00/PwvuWSq4GKb+PWqBAviR/Ay2UxeTV8pqObJMlVwiU38hmAKlizl4/iCqIjXIS8yeYgIE8SOUTlEGPkyuKKb3FlB7FskWN00jX1sIxVM4/uxTaqnad1dcNAXGiSYBGsjuJoXvJTy95VJsEJWeZ2/N7hBghWXQXnl0Ae8IsHOGSfJ4zAJdv59HVlR9SYS7JxESR4XSbBzLgtyiKebnDqugrEe248pkveISbAD3oEvtNCglRwJ1l1wvuaC95gueJ/mgnNMFxzFH6m84V841YVW/nZ9DH0/mD4xTpBgEkyQYBJMggkSTIJJMEGCteYPxO/zzCRZDV4AAAAASUVORK5CYII=",jme="/CharacterStudio/assets/color-palette-71a7a2d4.png";var Rs={},Sg={},Wme=typeof ta=="object"&&ta&&ta.Object===Object&&ta,X5=Wme,Kme=X5,$me=typeof self=="object"&&self&&self.Object===Object&&self,Yme=Kme||$me||Function("return this")(),Ca=Yme,Xme=Ca,Zme=Xme.Symbol,Mg=Zme,LP=Mg,Z5=Object.prototype,Jme=Z5.hasOwnProperty,qme=Z5.toString,Ap=LP?LP.toStringTag:void 0;function ege(n){var e=Jme.call(n,Ap),t=n[Ap];try{n[Ap]=void 0;var r=!0}catch{}var i=qme.call(n);return r&&(e?n[Ap]=t:delete n[Ap]),i}var tge=ege,nge=Object.prototype,rge=nge.toString;function ige(n){return rge.call(n)}var sge=ige,PP=Mg,oge=tge,age=sge,lge="[object Null]",Age="[object Undefined]",DP=PP?PP.toStringTag:void 0;function cge(n){return n==null?n===void 0?Age:lge:DP&&DP in Object(n)?oge(n):age(n)}var Au=cge,uge=Array.isArray,Io=uge;function fge(n){return n!=null&&typeof n=="object"}var Sl=fge,hge=Au,dge=Io,pge=Sl,mge="[object String]";function gge(n){return typeof n=="string"||!dge(n)&&pge(n)&&hge(n)==mge}var vge=gge;function yge(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 wge=yge,xge=wge,_ge=xge(),bge=_ge;function Bge(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=Qge}var TT=Hge,zge=Au,Gge=TT,Vge=Sl,jge="[object Arguments]",Wge="[object Array]",Kge="[object Boolean]",$ge="[object Date]",Yge="[object Error]",Xge="[object Function]",Zge="[object Map]",Jge="[object Number]",qge="[object Object]",e0e="[object RegExp]",t0e="[object Set]",n0e="[object String]",r0e="[object WeakMap]",i0e="[object ArrayBuffer]",s0e="[object DataView]",o0e="[object Float32Array]",a0e="[object Float64Array]",l0e="[object Int8Array]",A0e="[object Int16Array]",c0e="[object Int32Array]",u0e="[object Uint8Array]",f0e="[object Uint8ClampedArray]",h0e="[object Uint16Array]",d0e="[object Uint32Array]",un={};un[o0e]=un[a0e]=un[l0e]=un[A0e]=un[c0e]=un[u0e]=un[f0e]=un[h0e]=un[d0e]=!0;un[jge]=un[Wge]=un[i0e]=un[Kge]=un[s0e]=un[$ge]=un[Yge]=un[Xge]=un[Zge]=un[Jge]=un[qge]=un[e0e]=un[t0e]=un[n0e]=un[r0e]=!1;function p0e(n){return Vge(n)&&Gge(n.length)&&!!un[zge(n)]}var m0e=p0e;function g0e(n){return function(e){return n(e)}}var IT=g0e,Kw={exports:{}};Kw.exports;(function(n,e){var t=X5,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})(Kw,Kw.exports);var RT=Kw.exports,v0e=m0e,y0e=IT,NP=RT,kP=NP&&NP.isTypedArray,w0e=kP?y0e(kP):v0e,t8=w0e,x0e=Ege,_0e=q5,b0e=Io,B0e=MT,E0e=e8,C0e=t8,S0e=Object.prototype,M0e=S0e.hasOwnProperty;function T0e(n,e){var t=b0e(n),r=!t&&_0e(n),i=!t&&!r&&B0e(n),s=!t&&!r&&!i&&C0e(n),o=t||r||i||s,a=o?x0e(n.length,String):[],l=a.length;for(var A in n)(e||M0e.call(n,A))&&!(o&&(A=="length"||i&&(A=="offset"||A=="parent")||s&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||E0e(A,l)))&&a.push(A);return a}var n8=T0e,I0e=Object.prototype;function R0e(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||I0e;return n===t}var FT=R0e;function F0e(n,e){return function(t){return n(e(t))}}var r8=F0e,U0e=r8,L0e=U0e(Object.keys,Object),P0e=L0e,D0e=FT,O0e=P0e,N0e=Object.prototype,k0e=N0e.hasOwnProperty;function Q0e(n){if(!D0e(n))return O0e(n);var e=[];for(var t in Object(n))k0e.call(n,t)&&t!="constructor"&&e.push(t);return e}var H0e=Q0e;function z0e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var ld=z0e,G0e=Au,V0e=ld,j0e="[object AsyncFunction]",W0e="[object Function]",K0e="[object GeneratorFunction]",$0e="[object Proxy]";function Y0e(n){if(!V0e(n))return!1;var e=G0e(n);return e==W0e||e==K0e||e==j0e||e==$0e}var i8=Y0e,X0e=i8,Z0e=TT;function J0e(n){return n!=null&&Z0e(n.length)&&!X0e(n)}var l_=J0e,q0e=n8,eve=H0e,tve=l_;function nve(n){return tve(n)?q0e(n):eve(n)}var Tg=nve,rve=bge,ive=Tg;function sve(n,e){return n&&rve(n,e,ive)}var s8=sve;function ove(n){return n}var o8=ove,ave=o8;function lve(n){return typeof n=="function"?n:ave}var Ave=lve,cve=s8,uve=Ave;function fve(n,e){return n&&cve(n,uve(e))}var UT=fve,hve=r8,dve=hve(Object.getPrototypeOf,Object),LT=dve,pve=Au,mve=LT,gve=Sl,vve="[object Object]",yve=Function.prototype,wve=Object.prototype,a8=yve.toString,xve=wve.hasOwnProperty,_ve=a8.call(Object);function bve(n){if(!gve(n)||pve(n)!=vve)return!1;var e=mve(n);if(e===null)return!0;var t=xve.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&a8.call(t)==_ve}var Bve=bve;function Eve(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var Hve=Qve,zve=A_;function Gve(n,e){var t=this.__data__,r=zve(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var Vve=Gve,jve=Sve,Wve=Pve,Kve=Nve,$ve=Hve,Yve=Vve;function Ad(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,f=!0,h=t&axe?new rxe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,Zbe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,Ybe.default)(r)?(0,Kbe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,jbe.default)(r)&&t.push(r)}),t};Sg.default=Jbe;var Ig={};function qbe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,ySe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,gSe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=wSe({},r[a],s[a])}),i}),r};Ig.default=xSe;var Rg={};Object.defineProperty(Rg,"__esModule",{value:!0});Rg.autoprefix=void 0;var _Se=UT,yD=BSe(_Se),bSe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){RSe(i,r);function i(){var s,o,a,l;ISe(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){OSe(i,r);function i(){var s,o,a,l;DSe(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};jT.default=kSe;Object.defineProperty(Rs,"__esModule",{value:!0});Rs.ReactCSS=Rs.loop=Rs.handleActive=WT=Rs.handleHover=Rs.hover=void 0;var QSe=Sg,HSe=dd(QSe),zSe=Ig,GSe=dd(zSe),VSe=Rg,jSe=dd(VSe),WSe=Fg,F8=dd(WSe),KSe=Ug,$Se=dd(KSe),YSe=jT,XSe=dd(YSe);function dd(n){return n&&n.__esModule?n:{default:n}}Rs.hover=F8.default;var WT=Rs.handleHover=F8.default;Rs.handleActive=$Se.default;Rs.loop=XSe.default;var ZSe=Rs.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?f=1:f=Math.round(u*100/a)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var h=void 0;if(c<0?h=0:c>o?h=1:h=Math.round(c*100/o)/100,i!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},bB={},qSe=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},eMe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(bB[s])return bB[s];var o=qSe(e,t,r,i);return bB[s]=o,o},_D=Object.assign||function(n){for(var e=1;e-1},hMe=function(e){return Number(String(e).replace(/%/g,""))},dMe=1,Pt=function(n){lMe(e,n);function e(t){oMe(this,e);var r=aMe(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=hMe(i.target.value);if(!isNaN(s)&&fMe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===U8?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-"+dMe++,r}return iMe(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 sMe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||AMe}},{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 Y.createElement("div",{style:i.wrap},Y.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?Y.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(ye.PureComponent||ye.Component),pMe=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 f=-(c*100/o)+100;u=360*f/100}if(r.h!==u)return{h:u,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var h=void 0;if(A<0)h=0;else if(A>s)h=359;else{var p=A*100/s;h=360*p/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},mMe=function(){function n(e,t){for(var r=0;r-1},dMe=function(e){return Number(String(e).replace(/%/g,""))},pMe=1,Pt=function(n){AMe(e,n);function e(t){aMe(this,e);var r=lMe(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=dMe(i.target.value);if(!isNaN(s)&&hMe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===U8?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-"+pMe++,r}return sMe(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 oMe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||cMe}},{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 Y.createElement("div",{style:i.wrap},Y.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?Y.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(ye.PureComponent||ye.Component),mMe=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 f=-(c*100/o)+100;u=360*f/100}if(r.h!==u)return{h:u,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var h=void 0;if(A<0)h=0;else if(A>s)h=359;else{var p=A*100/s;h=360*p/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},gMe=function(){function n(e,t){for(var r=0;r-1}function IMe(n,e){var t=this.__data__,r=g_(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Ml(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=XTe}function gd(n){return n!=null&&ZT(n.length)&&!$T(n)}function ZTe(n){return zA(n)&&gd(n)}function JTe(){return!1}var V8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,FD=V8&&typeof module=="object"&&module&&!module.nodeType&&module,qTe=FD&&FD.exports===V8,UD=qTe?Ro.Buffer:void 0,e2e=UD?UD.isBuffer:void 0,t2e=e2e||JTe;const qw=t2e;var n2e="[object Object]",r2e=Function.prototype,i2e=Object.prototype,j8=r2e.toString,s2e=i2e.hasOwnProperty,o2e=j8.call(Object);function a2e(n){if(!zA(n)||uu(n)!=n2e)return!1;var e=z8(n);if(e===null)return!0;var t=s2e.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&j8.call(t)==o2e}var l2e="[object Arguments]",A2e="[object Array]",c2e="[object Boolean]",u2e="[object Date]",f2e="[object Error]",h2e="[object Function]",d2e="[object Map]",p2e="[object Number]",m2e="[object Object]",g2e="[object RegExp]",v2e="[object Set]",y2e="[object String]",w2e="[object WeakMap]",x2e="[object ArrayBuffer]",_2e="[object DataView]",b2e="[object Float32Array]",B2e="[object Float64Array]",E2e="[object Int8Array]",C2e="[object Int16Array]",S2e="[object Int32Array]",M2e="[object Uint8Array]",T2e="[object Uint8ClampedArray]",I2e="[object Uint16Array]",R2e="[object Uint32Array]",fn={};fn[b2e]=fn[B2e]=fn[E2e]=fn[C2e]=fn[S2e]=fn[M2e]=fn[T2e]=fn[I2e]=fn[R2e]=!0;fn[l2e]=fn[A2e]=fn[x2e]=fn[c2e]=fn[_2e]=fn[u2e]=fn[f2e]=fn[h2e]=fn[d2e]=fn[p2e]=fn[m2e]=fn[g2e]=fn[v2e]=fn[y2e]=fn[w2e]=!1;function F2e(n){return zA(n)&&ZT(n.length)&&!!fn[uu(n)]}function U2e(n){return function(e){return n(e)}}var W8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,am=W8&&typeof module=="object"&&module&&!module.nodeType&&module,L2e=am&&am.exports===W8,EB=L2e&&O8.process,P2e=function(){try{var n=am&&am.require&&am.require("util").types;return n||EB&&EB.binding&&EB.binding("util")}catch{}}();const LD=P2e;var PD=LD&&LD.isTypedArray,D2e=PD?U2e(PD):F2e;const JT=D2e;function AS(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var O2e=Object.prototype,N2e=O2e.hasOwnProperty;function k2e(n,e,t){var r=n[e];(!(N2e.call(n,e)&&Lg(r,t))||t===void 0&&!(e in n))&&YT(n,e,t)}function Q2e(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=rIe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var aIe=oIe(nIe);const lIe=aIe;function AIe(n,e){return lIe(q2e(n,e,y_),n+"")}function cIe(n,e,t){if(!js(t))return!1;var r=typeof e;return(r=="number"?gd(t)&&qT(e,t.length):r=="string"&&e in t)?Lg(t[e],n):!1}function uIe(n){return AIe(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&cIe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||S<0||u&&b>=s}function m(){var C=CB();if(g(C))return y(C);a=setTimeout(m,d(C))}function y(C){return a=void 0,f&&r?h(C):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),A=0,r=l=i=a=void 0}function x(){return a===void 0?o:y(CB())}function _(){var C=CB(),S=g(C);if(r=arguments,i=this,l=C,S){if(a===void 0)return p(l);if(u)return clearTimeout(a),a=setTimeout(m,e),h(l)}return a===void 0&&(a=setTimeout(m,e)),o}return _.cancel=w,_.flush=x,_}var CIe="Expected a function";function SIe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(CIe);return js(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),X8(n,e,{leading:r,maxWait:e,trailing:i})}var MIe=function(e,t,r){var i=r.getBoundingClientRect(),s=i.width,o=i.height,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,A=a-(r.getBoundingClientRect().left+window.pageXOffset),c=l-(r.getBoundingClientRect().top+window.pageYOffset);A<0?A=0:A>s&&(A=s),c<0?c=0:c>o&&(c=o);var u=A/s,f=1-c/o;return{h:t.h,s:u,v:f,a:t.a,source:"hsv"}},TIe=function(){function n(e,t){for(var r=0;r-1}function RMe(n,e){var t=this.__data__,r=g_(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Ml(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=ZTe}function gd(n){return n!=null&&ZT(n.length)&&!$T(n)}function JTe(n){return zA(n)&&gd(n)}function qTe(){return!1}var V8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,FD=V8&&typeof module=="object"&&module&&!module.nodeType&&module,e2e=FD&&FD.exports===V8,UD=e2e?Ro.Buffer:void 0,t2e=UD?UD.isBuffer:void 0,n2e=t2e||qTe;const qw=n2e;var r2e="[object Object]",i2e=Function.prototype,s2e=Object.prototype,j8=i2e.toString,o2e=s2e.hasOwnProperty,a2e=j8.call(Object);function l2e(n){if(!zA(n)||uu(n)!=r2e)return!1;var e=z8(n);if(e===null)return!0;var t=o2e.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&j8.call(t)==a2e}var A2e="[object Arguments]",c2e="[object Array]",u2e="[object Boolean]",f2e="[object Date]",h2e="[object Error]",d2e="[object Function]",p2e="[object Map]",m2e="[object Number]",g2e="[object Object]",v2e="[object RegExp]",y2e="[object Set]",w2e="[object String]",x2e="[object WeakMap]",_2e="[object ArrayBuffer]",b2e="[object DataView]",B2e="[object Float32Array]",E2e="[object Float64Array]",C2e="[object Int8Array]",S2e="[object Int16Array]",M2e="[object Int32Array]",T2e="[object Uint8Array]",I2e="[object Uint8ClampedArray]",R2e="[object Uint16Array]",F2e="[object Uint32Array]",fn={};fn[B2e]=fn[E2e]=fn[C2e]=fn[S2e]=fn[M2e]=fn[T2e]=fn[I2e]=fn[R2e]=fn[F2e]=!0;fn[A2e]=fn[c2e]=fn[_2e]=fn[u2e]=fn[b2e]=fn[f2e]=fn[h2e]=fn[d2e]=fn[p2e]=fn[m2e]=fn[g2e]=fn[v2e]=fn[y2e]=fn[w2e]=fn[x2e]=!1;function U2e(n){return zA(n)&&ZT(n.length)&&!!fn[uu(n)]}function L2e(n){return function(e){return n(e)}}var W8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,am=W8&&typeof module=="object"&&module&&!module.nodeType&&module,P2e=am&&am.exports===W8,EB=P2e&&O8.process,D2e=function(){try{var n=am&&am.require&&am.require("util").types;return n||EB&&EB.binding&&EB.binding("util")}catch{}}();const LD=D2e;var PD=LD&&LD.isTypedArray,O2e=PD?L2e(PD):U2e;const JT=O2e;function AS(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var N2e=Object.prototype,k2e=N2e.hasOwnProperty;function Q2e(n,e,t){var r=n[e];(!(k2e.call(n,e)&&Lg(r,t))||t===void 0&&!(e in n))&&YT(n,e,t)}function H2e(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=iIe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var lIe=aIe(rIe);const AIe=lIe;function cIe(n,e){return AIe(eIe(n,e,y_),n+"")}function uIe(n,e,t){if(!js(t))return!1;var r=typeof e;return(r=="number"?gd(t)&&qT(e,t.length):r=="string"&&e in t)?Lg(t[e],n):!1}function fIe(n){return cIe(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&uIe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||S<0||u&&b>=s}function m(){var C=CB();if(g(C))return y(C);a=setTimeout(m,d(C))}function y(C){return a=void 0,f&&r?h(C):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),A=0,r=l=i=a=void 0}function x(){return a===void 0?o:y(CB())}function _(){var C=CB(),S=g(C);if(r=arguments,i=this,l=C,S){if(a===void 0)return p(l);if(u)return clearTimeout(a),a=setTimeout(m,e),h(l)}return a===void 0&&(a=setTimeout(m,e)),o}return _.cancel=w,_.flush=x,_}var SIe="Expected a function";function MIe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(SIe);return js(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),X8(n,e,{leading:r,maxWait:e,trailing:i})}var TIe=function(e,t,r){var i=r.getBoundingClientRect(),s=i.width,o=i.height,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,A=a-(r.getBoundingClientRect().left+window.pageXOffset),c=l-(r.getBoundingClientRect().top+window.pageYOffset);A<0?A=0:A>s&&(A=s),c<0?c=0:c>o&&(c=o);var u=A/s,f=1-c/o;return{h:t.h,s:u,v:f,a:t.a,source:"hsv"}},IIe=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(eRe,arguments)},brighten:function(){return this._applyModification(tRe,arguments)},darken:function(){return this._applyModification(nRe,arguments)},desaturate:function(){return this._applyModification(ZIe,arguments)},saturate:function(){return this._applyModification(JIe,arguments)},greyscale:function(){return this._applyModification(qIe,arguments)},spin:function(){return this._applyModification(rRe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(oRe,arguments)},complement:function(){return this._applyCombination(iRe,arguments)},monochromatic:function(){return this._applyCombination(aRe,arguments)},splitcomplement:function(){return this._applyCombination(sRe,arguments)},triad:function(){return this._applyCombination(GD,[3])},tetrad:function(){return this._applyCombination(GD,[4])}};tt.fromRatio=function(n,e){if(ex(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Dp(n[r]));n=t}return tt(n,e)};function WIe(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=fRe(n)),ex(n)=="object"&&(za(n.r)&&za(n.g)&&za(n.b)?(e=KIe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):za(n.h)&&za(n.s)&&za(n.v)?(r=Dp(n.s),i=Dp(n.v),e=YIe(n.h,r,i),o=!0,a="hsv"):za(n.h)&&za(n.s)&&za(n.l)&&(r=Dp(n.s),s=Dp(n.l),e=$Ie(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=J8(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 KIe(n,e,t){return{r:gn(n,255)*255,g:gn(e,255)*255,b:gn(t,255)*255}}function kD(n,e,t){n=gn(n,255),e=gn(e,255),t=gn(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 QD(n,e,t){n=gn(n,255),e=gn(e,255),t=gn(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 aRe(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=hRe(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 cS=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"},lRe=tt.hexNames=ARe(cS);function ARe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function J8(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function gn(n,e){cRe(n)&&(n="100%");var t=uRe(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 __(n){return Math.min(1,Math.max(0,n))}function Hi(n){return parseInt(n,16)}function cRe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function uRe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function xo(n){return n.length==1?"0"+n:""+n}function Dp(n){return n<=1&&(n=n*100+"%"),n}function q8(n){return Math.round(parseFloat(n)*255).toString(16)}function VD(n){return Hi(n)/255}var fo=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 za(n){return!!fo.CSS_UNIT.exec(n)}function fRe(n){n=n.replace(VIe,"").replace(jIe,"").toLowerCase();var e=!1;if(cS[n])n=cS[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=fo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=fo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=fo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=fo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=fo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=fo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=fo.hex8.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),a:VD(t[4]),format:e?"name":"hex8"}:(t=fo.hex6.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),format:e?"name":"hex"}:(t=fo.hex4.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),a:VD(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=fo.hex3.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function hRe(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 jD=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return GIe(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},Op=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}},ZA=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()},t2=function(e){if(!e)return"#fff";var t=Op(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"},SB=function(e,t){var r=e.replace("°","");return tt(t+" ("+r+")")._ok},up=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){xRe(i,r);function i(){var s,o,a,l;wRe(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,f=!0,h=t&URe?new tx: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 Mv=24,tUe=Az.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Mv:r,s=n.height,o=s===void 0?Mv:s,a=n.style,l=a===void 0?{}:a,A=eUe(n,["fill","width","height","style"]);return cO.default.createElement("svg",AO({viewBox:"0 0 "+Mv+" "+Mv,style:AO({fill:t,width:i,height:o},l)},A),cO.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"}))},nUe=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(lO(i.s)?r.props.hsl.s:i.s),l:Number(lO(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 nUe(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=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),Y.createElement("div",{style:i.alpha},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),Y.createElement("div",{style:i.alpha},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),Y.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,Y.createElement("div",{style:i.toggle},Y.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},Y.createElement(tUe,{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}(Y.Component);cz.defaultProps={view:"hex"};var uO=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 Y.createElement("div",{style:e.picker})},oUe=function(){var e=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return Y.createElement("div",{style:e.picker})},a2=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,f=e.className,h=f===void 0?"":f,p=e.defaultView,d=ft(Li({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 Y.createElement("div",{style:d.picker,className:"chrome-picker "+h},Y.createElement("div",{style:d.saturation},Y.createElement(x_,{style:d.Saturation,hsl:o,hsv:a,pointer:oUe,onChange:r})),Y.createElement("div",{style:d.body},Y.createElement("div",{style:d.controls,className:"flexbox-fix"},Y.createElement("div",{style:d.color},Y.createElement("div",{style:d.swatch},Y.createElement("div",{style:d.active}),Y.createElement(pd,{renderers:A}))),Y.createElement("div",{style:d.toggles},Y.createElement("div",{style:d.hue},Y.createElement(md,{style:d.Hue,hsl:o,pointer:uO,onChange:r})),Y.createElement("div",{style:d.alpha},Y.createElement(KT,{style:d.Alpha,rgb:s,hsl:o,pointer:uO,renderers:A,onChange:r})))),Y.createElement(cz,{rgb:s,hsl:o,hex:l,view:p,onChange:r,disableAlpha:i})))};a2.propTypes={width:He.oneOfType([He.string,He.number]),disableAlpha:He.bool,styles:He.object,defaultView:He.oneOf(["hex","rgb","hsl"])};a2.defaultProps={width:225,disableAlpha:!1,styles:{}};const aUe=Pi(a2);var lUe=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:t2(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 Y.createElement(du,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Y.createElement("div",{style:a.dot}))},AUe=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 Y.createElement("div",{style:s.fields,className:"flexbox-fix"},Y.createElement("div",{style:s.active}),Y.createElement(Pt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},l2=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(Li({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(p,d){p.hex?ZA(p.hex)&&t({hex:p.hex,source:"hex"},d):t(p,d)};return Y.createElement(Pg,{style:u.Compact,styles:l},Y.createElement("div",{style:u.compact,className:"compact-picker "+c},Y.createElement("div",null,pu(i,function(h){return Y.createElement(lUe,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),Y.createElement("div",{style:u.clear})),Y.createElement(AUe,{hex:s,rgb:o,onChange:f})))};l2.propTypes={colors:He.arrayOf(He.string),styles:He.object};l2.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:{}};Pi(l2);var cUe=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 Y.createElement("div",{style:a.swatch},Y.createElement(du,{color:r,onClick:i,onHover:s,focusStyle:o}))};const uUe=WT(cUe);var A2=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(Li({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"}),f=function(p,d){return i({hex:p,source:"hex"},d)};return Y.createElement("div",{style:u.card,className:"github-picker "+c},Y.createElement("div",{style:u.triangleShadow}),Y.createElement("div",{style:u.triangle}),pu(r,function(h){return Y.createElement(uUe,{color:h,key:h,onClick:f,onSwatchHover:s})}))};A2.propTypes={width:He.oneOfType([He.string,He.number]),colors:He.arrayOf(He.string),triangle:He.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:He.object};A2.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Pi(A2);var fUe=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 Y.createElement("div",{style:r.picker})},hUe=Object.assign||function(n){for(var e=1;e.5});return Y.createElement("div",{style:r.picker})},gUe=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 Y.createElement("div",{style:e.pointer},Y.createElement("div",{style:e.left},Y.createElement("div",{style:e.leftInside})),Y.createElement("div",{style:e.right},Y.createElement("div",{style:e.rightInside})))},fO=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 Y.createElement("div",{style:o.button,onClick:t},r||i)},vUe=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 Y.createElement("div",null,Y.createElement("div",{style:i.label},"new"),Y.createElement("div",{style:i.swatches},Y.createElement("div",{style:i.new}),Y.createElement("div",{style:i.current})),Y.createElement("div",{style:i.label},"current"))},yUe=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 Y.createElement("div",{style:a.fields,className:"flexbox-fix"},Y.createElement("div",{style:a.double},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.alpha},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},BUe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Tv=24,RUe=fz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Tv:r,s=n.height,o=s===void 0?Tv:s,a=n.style,l=a===void 0?{}:a,A=IUe(n,["fill","width","height","style"]);return dO.default.createElement("svg",hO({viewBox:"0 0 "+Tv+" "+Tv,style:hO({fill:t,width:i,height:o},l)},A),dO.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},FUe=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:t2(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 Y.createElement(du,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Y.createElement("div",{style:A.check},Y.createElement(RUe,null)))},UUe=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 Y.createElement("div",{style:o.group},pu(i,function(a,l){return Y.createElement(FUe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},d2=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,f=ft(Li({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},A)),h=function(d,g){return i({hex:d,source:"hex"},g)};return Y.createElement("div",{style:f.picker,className:"swatches-picker "+u},Y.createElement(Pg,null,Y.createElement("div",{style:f.overflow},Y.createElement("div",{style:f.body},pu(o,function(p){return Y.createElement(UUe,{key:p.toString(),group:p,active:a,onClick:h,onSwatchHover:s})}),Y.createElement("div",{style:f.clear})))))};d2.propTypes={width:He.oneOfType([He.string,He.number]),height:He.oneOfType([He.string,He.number]),colors:He.arrayOf(He.arrayOf(He.string)),styles:He.object};d2.defaultProps={width:320,height:240,colors:[[sf[900],sf[700],sf[500],sf[300],sf[100]],[of[900],of[700],of[500],of[300],of[100]],[af[900],af[700],af[500],af[300],af[100]],[lf[900],lf[700],lf[500],lf[300],lf[100]],[Af[900],Af[700],Af[500],Af[300],Af[100]],[cf[900],cf[700],cf[500],cf[300],cf[100]],[uf[900],uf[700],uf[500],uf[300],uf[100]],[ff[900],ff[700],ff[500],ff[300],ff[100]],[hf[900],hf[700],hf[500],hf[300],hf[100]],["#194D33",Np[700],Np[500],Np[300],Np[100]],[df[900],df[700],df[500],df[300],df[100]],[pf[900],pf[700],pf[500],pf[300],pf[100]],[mf[900],mf[700],mf[500],mf[300],mf[100]],[gf[900],gf[700],gf[500],gf[300],gf[100]],[vf[900],vf[700],vf[500],vf[300],vf[100]],[yf[900],yf[700],yf[500],yf[300],yf[100]],[wf[900],wf[700],wf[500],wf[300],wf[100]],[xf[900],xf[700],xf[500],xf[300],xf[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Pi(d2);var p2=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,f=ft(Li({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"}),h=function(d,g){ZA(d)&&t({hex:d,source:"hex"},g)};return Y.createElement("div",{style:f.card,className:"twitter-picker "+u},Y.createElement("div",{style:f.triangleShadow}),Y.createElement("div",{style:f.triangle}),Y.createElement("div",{style:f.body},pu(s,function(p,d){return Y.createElement(du,{key:d,color:p,hex:p,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+p}})}),Y.createElement("div",{style:f.hash},"#"),Y.createElement(Pt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),Y.createElement("div",{style:f.clear})))};p2.propTypes={width:He.oneOfType([He.string,He.number]),triangle:He.oneOf(["hide","top-left","top-right"]),colors:He.arrayOf(He.string),styles:He.object};p2.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Pi(p2);var m2=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 Y.createElement("div",{style:t.picker})};m2.propTypes={hsl:He.shape({h:He.number,s:He.number,l:He.number,a:He.number})};m2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var g2=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 Y.createElement("div",{style:t.picker})};g2.propTypes={hsl:He.shape({h:He.number,s:He.number,l:He.number,a:He.number})};g2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var LUe=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(h,p){if(h.hex)ZA(h.hex)&&t({hex:h.hex,source:"hex"},p);else if(h.rgb){var d=h.rgb.split(",");SB(h.rgb,"rgb")&&t({r:d[0],g:d[1],b:d[2],a:1,source:"rgb"},p)}else if(h.hsv){var g=h.hsv.split(",");SB(h.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(h.hsl){var m=h.hsl.split(",");SB(h.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 Y.createElement("div",{style:l.wrap,className:"flexbox-fix"},Y.createElement("div",{style:l.fields},Y.createElement("div",{style:l.double},Y.createElement(Pt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),Y.createElement("div",{style:l.column},Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},v2=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,f=u===void 0?"":u,h=ft(Li({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 Y.createElement("div",{style:h.picker,className:"google-picker "+f},Y.createElement("div",{style:h.head},l),Y.createElement("div",{style:h.swatch}),Y.createElement("div",{style:h.saturation},Y.createElement(x_,{hsl:s,hsv:o,pointer:m2,onChange:r})),Y.createElement("div",{style:h.body},Y.createElement("div",{style:h.controls,className:"flexbox-fix"},Y.createElement("div",{style:h.hue},Y.createElement(md,{style:h.Hue,hsl:s,radius:"4px",pointer:g2,onChange:r}))),Y.createElement(LUe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};v2.propTypes={width:He.oneOfType([He.string,He.number]),styles:He.object,header:He.string};v2.defaultProps={width:652,styles:{},header:"Color picker"};Pi(v2);const PUe="_InformationContainerPos_1yd4c_2",DUe="_scrollContainer_1yd4c_15",TB={InformationContainerPos:PUe,scrollContainer:DUe,"options-container":"_options-container_1yd4c_24"},OUe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmU1ZTg4ZDczLWQ3YmItNjg0NS1iNDkxLWYxZTU0YmRhZDE1MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFhMDRkN2Y4LWVjNjQtZTg0ZC1iMjQzLWQ4ZjRhMjVlN2YzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozNzgwNzA3Yy0zNDg5LTAzNDctYmEwNy1kOTFhY2ZkYmUwODYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MjQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ZTVlODhkNzMtZDdiYi02ODQ1LWI0OTEtZjFlNTRiZGFkMTUyIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjQ3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+okruHwAAA6NJREFUeNrt279LG2EYwHG1CCqKPwKOJQU3cXYqXZ0KofgPuBWcUmsgoouCFArS0UXaWUpTFxHcUnE4cO6fULoUbWnTFk2ftz4p19BoLve+d33vvsN3KWre97lPUvPm7Gs2m32U3xgCABgCAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABABnlV5VR6QH0mOpIq229VSacPj4E/oY7Y9b0TWZtY0AwO7Qp6WH0q70XrqSmh1qSLMO1zKrj9Hp8a90jbu65mkAxBv4svRR+nHD0MOZr5t3uJ75iGsxa18GQPRBl6Sgy0GHu5QWHa5rUR8j6rrMXkoAuH3Ag9KLHgYcbsfh+nZirs3sbRAA/x5uQXrb4zMs3AdpyMH6hvRnx1nbpe6xAIC/hzssHcUcbrjnUr/F9fXrz7S1PrPXYQBcD3dKemdxuKZP0pzFNc7pz7S5RrPnqVwDkAGMSTXLg211auNtmL4NPXW0RrP3sVwC0EOVwNFgW9XjPMv01anueI2By8Or/xKAbHhSeuN4sK3OpPvSQIT1Dej3nCW0RjOLyVwA0Jf9IKHBhk8IX0vFLtZX1K9tJLzGII3/DtJ4q1dLeLDhvkjH0jNpSXqkLem/HevXpLW+WtJvEZP+IKee4nB9qZ7kB0pJPvOPuLiRzgkKmQCgz/xDLmrkDpN4JUjikOeEi9lzJ64Pi1wDOOAixu7AZwBVLmDsqr7/DrAhfeVCRs7MbCMr7wLWuKCRW8vaOYC5cfIbF/bWzIwqWT0J3LRww0eWM7PZzPpnAeUUztl9yMyknJdPA7el71z0P5lZbOftfgDzSvCTi/97BuW83hG0lfNfDM3et/J+T+BKjgGscFfwNYL1DodF+yl/Pm/j/oP9Doc869wVfPNh0Z50Vzr3GMC57mEvjUMeH/8yqKJvh15Ko9I96cJjABe6h1HdUyPJQx4fAdyRFtruz/MdQDG0nwWzRwB0DyJTAPjjUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAhgDMSJ89BmDWPgOA3gGMS0+kVU8zax8HAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIACQlX4BjeT0VuSSEBUAAAAASUVORK5CYII=",NUe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4MDc2OWJhLTIwNzQtMjU0Zi1iNjM5LWJiZjEyMTFlMjljNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmMxMzRkOGNhLTVlMWUtYzM0Yy05ZmM0LTNlZTgyNGQ1YTVhYyIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NzUzMzYxZC05NmIzLTgwNDctYTA0ZC0wODcxYmNiNzY4MDAiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6Mjk6NTctMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDgwNzY5YmEtMjA3NC0yNTRmLWI2MzktYmJmMTIxMWUyOWM1IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjE4LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Yrc/VQAAAzxJREFUeNrt3b9LFnEcwHE3IW1oiUCF/gCXcgibmhyaDEqnWhoCaRXqUQhByKVVXAqsMbQyGgIHA6GhSdpNc7E/IBehp8/h94ErRLzoOc671/Ce7/O572t4/PHc9bTb7R41NzcBADcBAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAinVrudUfPY92o+0ut5uu1Q9AtQCsRe2SWgMAAAAAAAAAAEo/7KHoWnQl12i0USKAjXTN/AzZTEMAdB/AQvQjfRrvtBMdlAjgIF0zP0M20wIA3QewVOJBF20JAAAAAACAbgJYrDCARQD+30EPRjei66nsU/fVaLXCAFbTjKO5ubMdBgEoDuBR9Cv6+VeHFQZweMy82Q6PACgOYLbCB120WQCKA5ipEYAZAAAAoCCAxzUC8BiAk3+3fzeajCZSN6OXNQLwMu3U2W8y7TwEwNENaTe0CQCWW7cbDOA2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcWQB3GgzgDgDLrbHoa/Ql1+foe40O+nvaKb9jtvMYAMutc9Hl9C3hTgPR0xoBeJp2yu+Y7XzO8wE8IAIAAAAAAABPCQPgTwD3ok/Req6P0V6FD3ovzZifOdvhHgD/9hKI7JPzpVwXoxcVBvAizZifeaDKL5fwsGgPiwYAAAAAAACAswJgKnqf3tzV6W20X+JB76dr5mfIZpoCoPsAeqPz6aeETheiDyUC+JCumZ8hm6kXAO8NBAAAAAAAoFQAfdG7EgFk1+oDoLuHOhI9jB6covvRVokAttI1TzNbtsMIAMUBPKnRXwOfAOD/AQAAAAAAACj04si6APDiyBMOejh6Fs3naqX/pqkLgPW0U37HbOdhAI7eoNXUbwZNAuC7gQAAAAAADQYw3mAA440BkD7svYlWotepV9FmgwFspnvQuR8r6R5N1hHAfIMPumjzdQQw52BP3RwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA2QQwHe1E36JtHdu3dI+mfTVMAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAAV7DcOsgfgT8DmTAAAAABJRU5ErkJggg==",kUe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjJkMTY5MDdlLWQyY2EtZDA0Mi05MWRjLTliZTMyYzYyYjlmOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNmQ1YTFjLWM5NjAtMDE0OS04OWQwLTQ3NDQ0MzAzZDI1ZCIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2N2JiZmQ0OC0yMGMzLTI0NDktODQyNS1kNWJmOTBlNzMwYjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MTQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MmQxNjkwN2UtZDJjYS1kMDQyLTkxZGMtOWJlMzJjNjJiOWY5IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMzOjExLTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Q6I0lAAAAs1JREFUeNrt3TtrFFEYgOFE2HjFXgv9AyIYsbATMaAWQtqAYBPQ0ibCgoSA/yGbwsJ/o6Ag3gMWEkurTeGlcfwGzoIs7LKT3TXOOU/xFlnYkNnvIRNOZs4sVFW1oHLzIQDgQwBAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAiVt91l2OXkRVi3oTXQVg+uHfjX60bPiDfkUPADj48C+2ePh/dx2AgwF4ncHw695HHQCaA6gy6hYAZQPYAqBsANsAlA1gBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAogDE14tRt359RL3ocbQSLQGQH4Aj0bsJ31tfF3EDgPwAvGzw/t/ROgDlAhhcY7gMQLkABpeXnQSgXAB1mwCUDeAjAGUD6ANQNoB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCQ6wFQNoAnQ8fWiXYBKAfAnaFjOxXtATAewIdMhv85Ojp0bGfqq3sBGA/gcrodKrt9guO11Sm+XxkA0gd1P90Y2dbhb4w4rm8ATI5gpYVbx+8On/eHHoJRAdAMwVJ9j3zaNKE3ZmOFw6z+uTaj29HxEcdxLvoKQIHVd/XW9/XN4LcLAC0c/vno04xOLwC0bPj3oi8z/PsCgIYDWExLr/+iTlrkORutTbHYA8AMAXTTuvu8e5XO8XtTLPIAMAcATzNbVgagIYAdAAAAAAAAAAAAAADKA7CdGYA+AM0AbGUG4C0AzQDczAzABgDNAHTSHrs5DL9ebTwGQHME1zIY/vfoQjG7hc8BwXr0s8XDXyvqeQFzQnClhZeXPY8uFffEkDkiOB09ShDq/9rt/4f10/n+YXSiyGcGqfCnhgkAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBp+gMB5Yr6zMTlPAAAAABJRU5ErkJggg==",QUe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmFmYmE3YzFhLWI0MTMtMGQ0MS05YmRkLTE2ZGY2MTllOTgyMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjkxMWMyNDQ0LTUzYzgtYjU0OC1iZjBmLTczZWE4ZmU5NWYzZSIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjZhMzQ1Ni02ODczLWQ5NDYtOTRkMy1mZTYwZjQ5NzliNjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6NDQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YWZiYTdjMWEtYjQxMy0wZDQxLTliZGQtMTZkZjYxOWU5ODIxIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjI2LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+F7DBkwAABCVJREFUeNrt3TtMFEEYwHHuAiYkNjRg74mJpSYUkCiGAhKxsLKXggQ6yi2wQUh8RMCGRJulEgotjgLwVaCVDYYeHzQaKU5FCRo4vwnfRdQgHvu4mZ1/8W/Iec7c/u7gdmd368rlch35Gy8CAHgRAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAJLpUhjkpW5pQfoolaRPjlXSsZs59Jg5AeDgDZ+T2qRFaUcqZyQzl0c6txwA9n/X9+m7ppzR1nWOeQD8DaBD+pzhjV/JzLEDAL9v/JPSmgcbv5KZaysAfv3ev+PRxq80acPfAzYAKEgrHgIwcy4AIAwGpS8eAjBzHgBAGEx7uPErhQAIg6LHAIoACIM5jwHMAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIuA3pjbYBgOwDMOvyNqUZ6azUuGcMjfqz+/qYHQBkC8BXaUI6/p/rE8b13wAgAwB+SOel+irGVC91St8B4DYAs8K4J8LYehJepQyAhAEMVfPO3+eTYAgAbgJYinGMSwBwC8A36VyMY+zU5wSAIwCWpeYYx9gsvQKAOwAe7P2eH8MYzX6ChwBwB8DtOE+60PMWxwHgDoCRBMY5AgB3AIzHeQaufgJMAIC/AQDg8beAZQC4A2Argf0AWwBwa0/gc+lIDONr0OdiT6CjxwJyEcaW41iA2wDeS70RxnZBnwMADq8HMOfhXzzEuHpTuG4BAFJaEWQO5IxKp/61f0C/75vHXEvo4A8Aarwm8J00K13WpV9HtYL+bFYfw5pAT5aFb2osC+e8AABkFcBOxADgGIBt6YU0pUfwhqWrh2xYn2NKn3MbAHYDeCId0713ed2RE0d5fc4W6TEA7APwVuqPsgK4ypXC/XpKGQAsAPBB6qrBuLti2EsIgIgAzFk/fTUce5+OAQA1AjCTxsf+Ab8OZgBQGwDmtiynLRj/mQj3OQBABAAv41z1E2H8LToWAKQMwOy3b7Bg/A06FgCkDOCmRbe7uQWA9AGMWgRgFADpAxizCMAYAAAAAAAAgL8BAJAagOsWAbgBgPQBPJWaLBh/k/QMAOkDMIsz7lkw/rsRFooAIIbDweY27avS65Rb1f+bw8EsCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCCAoscAigAIg2mPAYQACIPBFC7GZGNmzgMA2L0+z4qHAMycCwDYPf9+0kMAk3He08BZAIqgVVrzaOObuZ6w4bW3AoAiaI9wkqVLmTm22/K62wTA/Cq4kvCNGmvdul5TIA+A/RG0SQspXqwxrYtULurccja95lYB+OOSrd3SvH4ilPR6AC5V0rHP6y1o8za+1lYCIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",HUe="_InformationContainerPos_1m76y_2",zUe="_scrollContainer_1m76y_15",GUe="_centerAlign_1m76y_25",VUe="_traitInfoTitle_1m76y_28",jUe="_dropdownFlex_1m76y_38",WUe="_checkboxFlex_1m76y_44",KUe="_simpleFlex_1m76y_49",$Ue="_traitInfoText_1m76y_55",YUe="_dropdownBase_1m76y_64",XUe="_dropdownControl_1m76y_74",ZUe="_dropdownControlSmall_1m76y_80",JUe="_flexSelect_1m76y_106",qUe="_checked_1m76y_163",eLe="_checkmark_1m76y_167",tLe="_checkboxHolder_1m76y_180",nLe="_actionButton_1m76y_189",rLe="_tabHolder_1m76y_209",iLe="_tabButton_1m76y_215",sLe="_tabButtonSelected_1m76y_235",Ve={InformationContainerPos:HUe,scrollContainer:zUe,centerAlign:GUe,traitInfoTitle:VUe,dropdownFlex:jUe,checkboxFlex:WUe,simpleFlex:KUe,traitInfoText:$Ue,dropdownBase:YUe,dropdownControl:XUe,dropdownControlSmall:ZUe,"input-box":"_input-box_1m76y_87",flexSelect:JUe,"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:qUe,checkmark:eLe,checkboxHolder:tLe,actionButton:nLe,tabHolder:rLe,tabButton:iLe,tabButtonSelected:sLe},oLe="_slider_1y6nx_1",aLe="_infoContainer_1y6nx_13",Iv={"slider-container":"_slider-container_1y6nx_1",slider:oLe,infoContainer:aLe,"input-box":"_input-box_1y6nx_18"};function $f({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Iv.infoContainer,children:[n,o&&k.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Iv["input-box"],step:o})]}),k.jsx("div",{className:Iv["slider-container"],children:k.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Iv.slider,step:s})})]})}function lLe({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=ye.useContext(or),[i,s]=ye.useState(0),[o,a]=ye.useState(0),[l,A]=ye.useState(0);ye.useEffect(()=>{var p,d,g;e!=null&&(A((p=e.data)==null?void 0:p.cullingLayer),s(((d=e.data)==null?void 0:d.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)},f=p=>{e!=null&&e.data&&(A(p.target.value),e.data.cullingLayer=p.target.value)},h=()=>{r.updateCullHiddenMeshes()};return k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Trait Information",width:180,right:20}),k.jsx("div",{className:Ve.scrollContainer,children:n!=null?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Trait ID"}),k.jsx("div",{className:Ve.traitInfoText,children:n==null?void 0:n.id}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Trait Name"}),k.jsx("div",{className:Ve.traitInfoText,children:n==null?void 0:n.name}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Description"}),k.jsx("div",{className:Ve.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Culling Options"}),k.jsx("br",{}),k.jsxs("div",{className:Ve.traitInfoText,children:["Culling Layer",k.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:Ve["input-box"],step:1}),k.jsx("br",{}),k.jsx("br",{}),k.jsx($f,{title:"Out Distance",value:i,onChange:c,min:0,max:1,step:.001,stepBox:.01}),k.jsx("br",{}),k.jsx($f,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),k.jsx("div",{className:Ve.actionButton,onClick:h,children:k.jsx("div",{children:"Update Culling "})})]})]}):k.jsx(k.Fragment,{children:k.jsx("div",{className:Ve.traitInfoTitle,children:"No Trait Selected"})})})]})})}var hz={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(ye),t=r(Y5);function r(C){return C&&C.__esModule?C:{default:C}}function i(){if(typeof WeakMap!="function")return null;var C=new WeakMap;return i=function(){return C},C}function s(C){if(C&&C.__esModule)return C;if(C===null||o(C)!=="object"&&typeof C!="function")return{default:C};var S=i();if(S&&S.has(C))return S.get(C);var b={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var D in C)if(Object.prototype.hasOwnProperty.call(C,D)){var $=M?Object.getOwnPropertyDescriptor(C,D):null;$&&($.get||$.set)?Object.defineProperty(b,D,$):b[D]=C[D]}return b.default=C,S&&S.set(C,b),b}function o(C){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(b){return typeof b}:o=function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},o(C)}function a(){return a=Object.assign||function(C){for(var S=1;S"u"?w:b.placeholder,value:""},isOpen:!1},M.dropdownRef=(0,e.createRef)(),M.mounted=!0,M.handleDocumentClick=M.handleDocumentClick.bind(g(M)),M.fireChangeEvent=M.fireChangeEvent.bind(g(M)),M}return h(S,[{key:"componentDidUpdate",value:function(M){if(this.props.value!==M.value)if(this.props.value){var D=this.parseValue(this.props.value,this.props.options);D!==this.state.selected&&this.setState({selected:D})}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(M){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(M.type==="mousedown"&&M.button!==0)&&(M.stopPropagation(),M.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(M,D){var $;if(typeof M=="string")for(var H=0,I=D.length;H"u"&&($=M.label||M);var H=M.label||M.value||M,I=$===this.state.selected.value||$===this.state.selected,v=(D={},c(D,"".concat(this.props.baseClassName,"-option"),!0),c(D,M.className,!!M.className),c(D,"is-selected",I),D),E=(0,t.default)(v),U=Object.keys(M.data||{}).reduce(function(P,L){return A({},P,c({},"data-".concat(L),M.data[L]))},{});return e.default.createElement("div",a({key:$,className:E,onMouseDown:this.setValue.bind(this,$,H),onClick:this.setValue.bind(this,$,H),role:"option","aria-selected":I?"true":"false"},U),H)}},{key:"buildMenu",value:function(){var M=this,D=this.props,$=D.options,H=D.baseClassName,I=$.map(function(v){if(v.type==="group"){var E=e.default.createElement("div",{className:"".concat(H,"-title")},v.name),U=v.items.map(function(P){return M.renderOption(P)});return e.default.createElement("div",{className:"".concat(H,"-group"),key:v.name,role:"listbox",tabIndex:"-1"},E,U)}else return M.renderOption(v)});return I.length?I:e.default.createElement("div",{className:"".concat(H,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(M){this.mounted&&(this.dropdownRef.current.contains(M.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,D,$,H,I,v=this.props,E=v.baseClassName,U=v.controlClassName,P=v.placeholderClassName,L=v.menuClassName,z=v.arrowClassName,K=v.arrowClosed,O=v.arrowOpen,B=v.className,W=this.props.disabled?"Dropdown-disabled":"",ee=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,F=(0,t.default)((M={},c(M,"".concat(E,"-root"),!0),c(M,B,!!B),c(M,"is-open",this.state.isOpen),M)),X=(0,t.default)((D={},c(D,"".concat(E,"-control"),!0),c(D,U,!!U),c(D,W,!!W),D)),ue=(0,t.default)(($={},c($,"".concat(E,"-placeholder"),!0),c($,P,!!P),c($,"is-selected",this.isValueSelected()),$)),le=(0,t.default)((H={},c(H,"".concat(E,"-menu"),!0),c(H,L,!!L),H)),oe=(0,t.default)((I={},c(I,"".concat(E,"-arrow"),!0),c(I,z,!!z),I)),re=e.default.createElement("div",{className:ue},ee),pe=this.state.isOpen?e.default.createElement("div",{className:le,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:F},e.default.createElement("div",{className:X,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},re,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},O&&K?this.state.isOpen?O:K:e.default.createElement("span",{className:oe}))),pe)}}]),S}(e.Component);x.defaultProps={baseClassName:"Dropdown"};var _=x;n.default=_})(hz);const Jl=bl(hz);function ALe({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=Y.useContext(or),[s,o]=ye.useState([]),[a,l]=ye.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 ye.useEffect(()=>{if((t==null?void 0:t.loras)!=null){const u=t.loras.map((f,h)=>({value:h,label:f.name,description:f.description,manifest:f.manifest}));o(u)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Lora Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Lora Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:s,onChange:A,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&k.jsx("div",{className:Ve.actionButton,onClick:c,children:k.jsx("div",{children:" Create Lora Data "})})]})]})})}function cLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=Y.useContext(or),[s,o]=ye.useState([]),[a,l]=ye.useState(""),[A,c]=ye.useState(null),u=h=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[h.value].description),c(t.sprites[h.value]))},f=async()=>{const h=i.parent;h.remove(i),await r.createSpriteAtlas(A),h.add(i)};return ye.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const h=t.sprites.map((p,d)=>({value:d,label:p.name,description:p.description,manifest:p.manifest}));o(h)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Sprite Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Sprite Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:a||""}),A!=null&&k.jsx("div",{className:Ve.actionButton,onClick:f,children:k.jsx("div",{children:" Create Sprite Data "})})]})]})})}const pO=4096;function uLe({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=Y.useContext(or),[o,a]=ye.useState([]),[l,A]=ye.useState(""),[c,u]=ye.useState(""),[f,h]=ye.useState(""),[p,d]=ye.useState(!1),[g,m]=ye.useState(512),[y,w]=ye.useState(512),[x,_]=ye.useState(.1),[C,S]=ye.useState(.1),[b,M]=ye.useState("center"),[D,$]=ye.useState("center"),[H,I]=ye.useState("center"),[v,E]=ye.useState("head"),[U,P]=ye.useState("chest"),[L,z]=ye.useState(!0),[K,O]=ye.useState(!1),B=[{label:"center"},{label:"left"},{label:"right"}],W=[{label:"center"},{label:"top"},{label:"bottom"}],ee=[{label:"center"},{label:"front"},{label:"back"}],F=[{label:"head"},{label:"neck"},{label:"chest"},{label:"spine"},{label:"hips"},{label:"upperLeg"},{label:"lowerLeg"},{label:"foot"}],X=Ae=>{(t==null?void 0:t.thumbnails)!=null&&(A(t.thumbnails[Ae.value].description),h(t.thumbnails[Ae.value].manifest),u(t.thumbnails[Ae.value].name))},ue=(Ae,q,J,ce)=>isNaN(Ae)?ce:Ae>J?J:Ae{const q=parseInt(Ae.target.value);m(ue(q,1,pO,512))},oe=Ae=>{const q=parseInt(Ae.target.value);w(ue(q,1,pO,512))},re=Ae=>{const q=parseFloat(Ae.target.value);_(ue(q,0,1,.1))},pe=Ae=>{const q=parseFloat(Ae.target.value);S(ue(q,0,1,.1))},_e=Ae=>{d(Ae)},Re=async()=>{const Ae=i.parent;Ae.remove(i),await r.createThumbnails(t.thumbnails[0]),Ae.add(i)},Q=(Ae=!0)=>({topFrameOffset:C,bottomFrameOffset:x,thumbnailsWidth:g,thumbnailsHeight:y,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:D+"-"+H+"-"+b,topBoneName:v==="upperLeg"||v==="lowerLeg"||v==="foot"?"left"+v[0].toUpperCase()+v.slice(1):v,topBoneMaxVertex:L,bottomBoneName:U==="upperLeg"||U==="lowerLeg"||v==="foot"?"left"+U[0].toUpperCase()+U.slice(1):U,bottomBoneMaxVertex:K,saveOnlyIDs:Ae?null:n.id}]}),de=async(Ae=!1)=>{s.storeCurrentAvatar();const q=i.parent;q.remove(i),Ae?await r.createThumbnailsWithObjectData(Q(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(Q(!1),!1),q.add(i),s.loadStoredAvatar()};return ye.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const Ae=t.thumbnails.map((q,J)=>({value:J,label:q.name,description:q.description,manifest:q.manifest}));a(Ae)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Thumbnail Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsxs("div",{className:Ve.tabHolder,children:[k.jsx("div",{className:Ve.tabButton+(p?"":" "+Ve.tabButtonSelected),onClick:()=>{_e(!1)},children:k.jsxs("div",{children:[" ","Custom"," "]})}),k.jsx("div",{className:Ve.tabButton+(p?" "+Ve.tabButtonSelected:""),onClick:()=>{_e(!0)},children:k.jsxs("div",{children:[" ","Manifest"," "]})})]}),k.jsx("br",{}),p?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,children:"Thumbnail Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:o,value:c,onChange:X,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:l||""}),f!=""&&k.jsx("div",{className:Ve.actionButton,onClick:Re,children:k.jsx("div",{children:" Create Thumbnails "})})]}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Ve.traitInfoText,children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",k.jsx("input",{value:g,className:Ve["input-box"],step:1,onChange:Ae=>{m(Ae.target.value)},onBlur:le}),k.jsx("br",{}),"Height ",k.jsx("input",{value:y,className:Ve["input-box"],step:1,onChange:Ae=>{w(Ae.target.value)},onBlur:oe}),k.jsx("br",{}),"Top Spacing ",k.jsx("input",{value:x,className:Ve["input-box"],step:.1,onChange:Ae=>{_(Ae.target.value)},onBlur:re}),k.jsx("br",{}),"Bottom Spacing ",k.jsx("input",{value:C,className:Ve["input-box"],step:.1,onChange:Ae=>{S(Ae.target.value)},onBlur:pe}),k.jsx("br",{}),k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"X"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:B,onChange:Ae=>{$(Ae.label)},value:D})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Y"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:W,onChange:Ae=>{I(Ae.label)},value:H})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Z"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:ee,onChange:Ae=>{M(Ae.label)},value:b})]}),k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),k.jsxs("div",{className:Ve.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Top"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:F,onChange:Ae=>{E(Ae.label)},value:v})]}),k.jsxs("div",{className:Ve.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:F,onChange:Ae=>{P(Ae.label)},value:U})]}),k.jsxs("div",{style:{textAlign:"left"},children:[k.jsxs("div",{className:Ve.checkboxFlex,style:{marginTop:"20px"},children:[k.jsx("input",{type:"checkbox",checked:L,onChange:Ae=>{z(Ae.target.checked)}}),k.jsx("div",{className:Ve.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${L?"uses Top":"uses Low"} Vertex`})]}),k.jsxs("div",{className:Ve.checkboxFlex,style:{marginTop:"10px"},children:[k.jsx("input",{type:"checkbox",checked:K,onChange:Ae=>{O(Ae.target.checked)}}),k.jsx("div",{className:Ve.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${K?"uses Top":"uses Low"} Vertex`})]})]}),e==""?k.jsx("div",{className:Ve.traitInfoText+" "+Ve.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{marginTop:"20px"},children:"Generate"}),k.jsx("div",{className:Ve.traitInfoText+" "+Ve.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),k.jsxs("div",{className:Ve.simpleFlex,style:{marginTop:"0px"},children:[k.jsx("div",{className:Ve.actionButton,style:{margin:"0px"},onClick:()=>{de(!1)},children:k.jsx("div",{children:" Current "})}),k.jsx("div",{className:Ve.actionButton,style:{margin:"0px"},onClick:()=>{de(!0)},children:k.jsx("div",{children:" All "})})]})]})]})]})]})})}function fLe({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=Y.useState(""),s=o=>{o!=r?i(o):i("")};return k.jsxs("div",{children:[r=="Information"&&k.jsx(lLe,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&k.jsx(ALe,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&k.jsx(cLe,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&k.jsx(uLe,{selectedTrait:n,traitGroupName:t}),k.jsxs("div",{className:TB.InformationContainerPos,children:[k.jsx(wa,{title:"Tools",width:90,right:0}),k.jsx("div",{className:TB.scrollContainer,children:k.jsxs("div",{className:TB.optionsContainer,children:[k.jsx("div",{onClick:()=>{s("Information")},children:k.jsx(pA,{size:56,icon:OUe,rarity:r=="Information"?"mythic":"none"})},"Information"),k.jsx("div",{onClick:()=>{s("LoraCreation")},children:k.jsx(pA,{size:56,icon:kUe,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),k.jsx("div",{onClick:()=>{s("SpriteCreation")},children:k.jsx(pA,{size:56,icon:NUe,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),k.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:k.jsx(pA,{size:56,icon:QUe,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}function hLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:A,sceneElements:c}=Y.useContext(or),{playSound:u}=Y.useContext(Ys),{isMute:f}=Y.useContext($s),{t:h}=ye.useContext(To),p=()=>{!f&&u("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(dt.CREATE),r(!1)},[d,g]=Y.useState(null),[m,y]=Y.useState(null),[w,x]=Y.useState(""),[_,C]=Y.useState(null),[S,b]=Y.useState(null),[M,D]=Y.useState(""),[$,H]=Y.useState(!1),[I,v]=Y.useState({background:"#ffffff"}),E=()=>{!f&&u("backNextButton"),e(dt.SAVE),r(!1)},U=()=>{t(!0),g(null),i.loadRandomTraits().then(()=>{console.log("success"),w!=""&&C(i.getCurrentTraitData(w)),t(!1)}).catch(oe=>{t(!1),console.error("Error loading random traits:",oe.message)})},P=oe=>{v({background:oe.hex})},L=oe=>{v({background:oe.hex}),i.setTraitColor(w,oe.hex)},z=async oe=>{const re=ul(oe.name),pe=URL.createObjectURL(oe);await s.loadAnimation(pe,!1,0,!0,"",re),D(s.getCurrentAnimationName())},K=oe=>{if(H(!1),w!=""){t(!0);const re=URL.createObjectURL(oe);i.loadCustomTexture(w,re).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},O=oe=>{if(H(!1),w!=""){t(!0);const re=URL.createObjectURL(oe);i.loadCustomTrait(w,re).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},B=oe=>{H(!1),t(!0),i.loadTrait(oe.traitGroup.trait,oe.id).then(()=>{t(!1),C(oe)})},W=oe=>{H(!1),i.removeTrait(oe),C(null)},ee=oe=>{H(!1),t(!0),i.loadRandomTrait(oe).then(()=>{t(!1),C(i.getCurrentTraitData(oe))})},F=oe=>{H(!1);const re=Array.from(oe),pe=[],_e=Re=>new Promise((Q,de)=>{var Ae;if(Re&&Re.name.toLowerCase().endsWith(".json")){const q=new FileReader,J=`${(Ae=i.manifestData)==null?void 0:Ae.getAssetsDirectory()}/anata/_thumbnails/t_${Re.name.split("_")[0]}.jpg`;console.log(J),q.onload=function(ce){try{const xe=JSON.parse(ce.target.result);xe.thumb=J,pe.push(xe),Q()}catch(xe){console.error("Error parsing the JSON file:",xe),de(xe)}},q.readAsText(Re)}});Promise.all(re.map(_e)).then(()=>{pe.length>0&&(g(pe),t(!0),i.loadTraitsFromNFTObject(pe[0]).then(()=>{t(!1)}))}).catch(Re=>{console.error("Error processing files:",Re)})},X=async oe=>{const re=oe[0];re&&re.name.toLowerCase().endsWith(".fbx")&&z(re),re&&(re.name.toLowerCase().endsWith(".png")||re.name.toLowerCase().endsWith(".jpg"))&&K(re),re&&re.name.toLowerCase().endsWith(".vrm")&&O(re),re&&re.name.toLowerCase().endsWith(".json")&&F(oe)},ue=oe=>{!f&&u("optionClick"),H(!1),w!==oe.trait?(y(i.getTraits(oe.trait)),x(oe.trait),C(i.getCurrentTraitData(oe.trait)),b(i.getCurrentTraitVRM(oe.trait)),o({targetY:oe.cameraTarget.height,distance:oe.cameraTarget.distance})):(y(null),x(""),C(null),o({targetY:.8,distance:3.2}))},le=()=>{H(!1);var oe=document.createElement("input");oe.type="file",oe.accept=".vrm",oe.onchange=re=>{var pe=re.target.files[0];if(pe.name.endsWith(".vrm")){const _e=URL.createObjectURL(pe);t(!0),i.loadCustomTrait(w,_e).then(()=>{t(!1)})}},oe.click()};return k.jsxs("div",{className:Ln.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:h("pageTitles.chooseAppearance")}),k.jsx(Cg,{onFilesDrop:X}),k.jsxs("div",{className:Ln.sideMenu,children:[k.jsx(wa,{title:"Appearance",left:20}),k.jsx("div",{className:Ln.bottomLine}),k.jsx("div",{className:Ln.scrollContainer,children:k.jsx("div",{className:Ln["editor-container"],children:i.getGroupTraits().map((oe,re)=>k.jsxs("div",{className:Ln.editorButton,onClick:()=>{ue(oe)},children:[k.jsx(pA,{size:56,icon:oe.fullIconSvg,rarity:w!==oe.trait?"none":"mythic"}),k.jsx("div",{className:Ln.editorText,children:oe.name})]},"options_"+re))})})]}),!!m&&k.jsxs("div",{className:Ln.selectorContainerPos,children:[k.jsx(wa,{title:w,width:130,left:20}),_&&k.jsx("div",{className:Ln.selectorColorPickerButton,onClick:()=>{H(!$)},children:k.jsx("img",{className:Ln.selectorColorPickerImg,src:Vme})}),!!$&&k.jsx("div",{draggable:!1,className:Ln.selectorColorPickerUI,children:k.jsx(aUe,{draggable:!1,width:"200px",color:I.background,onChange:P,onChangeComplete:L})}),k.jsx("div",{className:Ln.bottomLine}),k.jsx("div",{className:Ln.scrollContainerOptions,children:k.jsxs("div",{className:Ln["selector-container"],children:[k.jsx("div",{className:`${Ln.selectorButton}`,onClick:()=>{ee(w)},children:k.jsx(pA,{size:56,icon:Gme,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(w)?k.jsx(k.Fragment,{}):k.jsx("div",{className:`${Ln.selectorButton}`,icon:UP,onClick:()=>{W(w)},children:k.jsx(pA,{size:56,icon:UP,rarity:_==null?"mythic":"none"})},"no-trait"),m.map(oe=>{let re=oe.id===(_==null?void 0:_.id);return k.jsx("div",{className:`${Ln.selectorButton}`,onClick:()=>{B(oe)},children:k.jsx(pA,{size:56,icon:oe.fullThumbnail,rarity:re?"mythic":"none"})},oe.id)})]})}),k.jsx("div",{className:Ln.uploadContainer,children:k.jsx("div",{className:Ln.uploadButton,onClick:le,children:k.jsx("div",{children:"Upload "})})})]}),k.jsx(ST,{jsonSelectionArray:d}),k.jsx(fLe,{selectedTrait:_,selectedVRM:S,traitGroupName:w}),k.jsx(a_,{loadedAnimationName:M,randomize:U}),k.jsxs("div",{className:Ln.buttonContainer,children:[k.jsx(_n,{theme:"light",text:h("callToAction.back"),size:14,className:Ln.buttonLeft,onClick:p}),i.canDownload()&&k.jsx(_n,{theme:"light",text:h("callToAction.next"),size:14,className:Ln.buttonRight,onClick:E})]})]})}const dLe="_InformationContainerPos_rgqwy_1",pLe="_traitInfoTitle_rgqwy_13",mLe="_traitInfoText_rgqwy_21",gLe="_flexSelect_rgqwy_30",vLe="_scrollContainer_rgqwy_65",yLe="_checked_rgqwy_90",wLe="_checkmark_rgqwy_94",xLe="_checkboxHolder_rgqwy_107",_Le="_buttonContainer_rgqwy_114",bLe="_buttonLeft_rgqwy_123",BLe="_buttonRight_rgqwy_127",ELe="_buttonCenter_rgqwy_131",ci={InformationContainerPos:dLe,traitInfoTitle:pLe,traitInfoText:mLe,flexSelect:gLe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:vLe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:yLe,checkmark:wLe,checkboxHolder:xLe,buttonContainer:_Le,buttonLeft:bLe,buttonRight:BLe,buttonCenter:ELe},CLe="_InformationContainerPos_11mqa_2",SLe="_scrollContainer_11mqa_16",MLe="_traitInfoTitle_11mqa_28",TLe="_traitInfoText_11mqa_38",ILe="_flexSelect_11mqa_66",RLe="_checked_11mqa_124",FLe="_checkmark_11mqa_128",ULe="_checkboxHolder_11mqa_141",Gn={InformationContainerPos:CLe,scrollContainer:SLe,traitInfoTitle:MLe,traitInfoText:TLe,"input-box":"_input-box_11mqa_47",flexSelect:ILe,"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:RLe,checkmark:FLe,checkboxHolder:ULe};function y2({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=Y.useContext(or),[a,l]=ye.useState(0),[A,c]=ye.useState(0),[u,f]=ye.useState(0),[h,p]=ye.useState(0),[d,g]=ye.useState(0),[m,y]=ye.useState(0),[w,x]=ye.useState(0),[_,C]=ye.useState(0),[S,b]=ye.useState(0),[M,D]=ye.useState(0);return ye.useEffect(()=>{if(n!=null){const $=zh(n,"Mesh"),H=zh(n,"SkinnedMesh");l($.length),c(H.length);const I=$.concat(H),{stdMats:v,stdCutoutpMats:E,stdTranspMats:U,mToonMats:P,mToonCutoutMats:L,mToonTranspMats:z}=Oue(I);f(v.length),p(U.length),g(E.length),y(P.length),x(z.length),C(L.length);const{triangles:K,bones:O}=o.getBoneTriangleCount();b(K),D(O)}},[n]),n!=null?k.jsx("div",{children:k.jsxs("div",{className:Gn.InformationContainerPos,children:[k.jsx(wa,{title:"Model Information",width:180,right:20}),k.jsxs("div",{className:Gn.scrollContainer,children:[k.jsxs("div",{className:Gn.flexSelect,children:[(t==null?void 0:t.length)>1?k.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["left-button"]}`,onClick:s}):k.jsx(k.Fragment,{}),e&&k.jsx("div",{style:{textAlign:"center"},children:k.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?k.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["right-button"]}`,onClick:i}):k.jsx(k.Fragment,{})]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"Geometry info:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["Meshes: ",a]}),k.jsxs("div",{className:Gn.traitInfoText,children:["SkinnedMeshes: ",A]}),k.jsxs("div",{className:Gn.traitInfoText,children:["Triangles: ",S]}),k.jsxs("div",{className:Gn.traitInfoText,children:["Bones: ",M]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"Standard Material Count:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",u]}),k.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",d]}),k.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",h]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"MToon Material Count:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",m]}),k.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",_]}),k.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",w]})]})]})}):k.jsx(k.Fragment,{})}const LLe="_InformationContainerPos_b0msk_1",PLe="_traitInfoTitle_b0msk_13",DLe="_traitInfoText_b0msk_22",OLe="_flexSelect_b0msk_33",NLe="_scrollContainer_b0msk_68",kLe="_checked_b0msk_93",QLe="_checkmark_b0msk_97",HLe="_checkboxHolder_b0msk_110",lt={InformationContainerPos:LLe,traitInfoTitle:PLe,traitInfoText:DLe,flexSelect:OLe,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:NLe,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:kLe,checkmark:QLe,checkboxHolder:HLe};function B_({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=ye.useState(Oe.mergeOptions_atlas_std_size||6),[s,o]=ye.useState(Oe.mergeOptions_atlas_std_transp_size||6),[a,l]=ye.useState(Oe.mergeOptions_atlas_mtoon_size||6),[A,c]=ye.useState(Oe.mergeOptions_atlas_mtoon_transp_size||6),[u,f]=ye.useState(Oe.mergeOptions_sel_option||0),[h,p]=ye.useState(Oe.mergeOptions_two_sided_mat||!1),[d]=ye.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,m]=ye.useState(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm),[y,w]=ye.useState(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview),[x,_]=ye.useState(Oe.mergeOptions_drop_download||!1),[C,S]=ye.useState(Oe.merge_options_ktx_compression||!1),[b,M]=ye.useState(Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas),[D,$]=ye.useState(Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora),[H,I]=ye.useState(Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites),v=F=>{_(F.target.checked),Oe.mergeOptions_drop_download=F.target.checked},E=F=>{p(F.target.checked),Oe.mergeOptions_two_sided_mat=F.target.checked},U=F=>{S(F.target.checked),Oe.merge_options_ktx_compression=F.target.checked},P=F=>{M(F.target.checked),Oe.mergeOptions_create_atlas=F.target.checked},L=F=>{m(F.target.checked),Oe.mergeOptions_download_vrm=F.target.checked},z=F=>{w(F.target.checked),Oe.mergeOptions_download_vrm_preview=F.target.checked},K=F=>{$(F.target.checked),Oe.mergeOptions_download_lora=F.target.checked},O=F=>{I(F.target.checked),Oe.mergeOptions_download_sprites=F.target.checked},B=()=>{let F=u;u<=0?F=d.length-1:F-=1,f(F),Oe.mergeOptions_sel_option=F},W=()=>{let F=u;u>=d.length-1?F=0:F+=1,f(F),Oe.mergeOptions_sel_option=F},ee=async(F,X)=>{let ue=parseInt(F.target.value);ue>8?ue=8:ue<0&&(ue=0),(oe=>{switch(X){case"standard opaque":i(oe),Oe.mergeOptions_atlas_std_size=oe;break;case"standard transparent":o(oe),Oe.mergeOptions_atlas_std_transp_size=oe;break;case"mtoon opaque":l(oe),Oe.mergeOptions_atlas_mtoon_size=oe;break;case"mtoon transparent":c(oe),Oe.mergeOptions_atlas_mtoon_transp_size=oe;break}})(ue)};return k.jsxs("div",{className:lt.InformationContainerPos,children:[k.jsx(wa,{title:t,width:180,left:20}),k.jsxs("div",{className:lt.scrollContainer,children:[k.jsx("div",{className:lt.traitInfoTitle,children:"Download Options"}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:g,onChange:L}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:y,onChange:z}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM Preview"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:D,onChange:K}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Lora Data"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:H,onChange:O}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Sprites Data"]})})}),g&&k.jsxs(k.Fragment,{children:[e&&k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:b,onChange:P}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Create Atlas"]})})}),(e==!1||b)&&k.jsxs(k.Fragment,{children:[k.jsx("br",{}),k.jsx("div",{className:lt.traitInfoTitle,children:"Merge Atlas Type"}),k.jsx("br",{}),k.jsxs("div",{className:lt.flexSelect,children:[k.jsx("div",{className:`${lt["arrow-button"]} ${lt["left-button"]}`,onClick:B}),k.jsx("div",{className:lt.traitInfoText,style:{marginBottom:"0"},children:d[u]}),k.jsx("div",{className:`${lt["arrow-button"]} ${lt["right-button"]}`,onClick:W})]}),k.jsx("br",{}),k.jsx("br",{}),(u===0||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:lt.traitInfoTitle,children:"Standard Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Opaque: ",vn(r)+" x "+vn(r)]}),k.jsx($f,{value:r,onChange:F=>ee(F,"standard opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Transparent: ",vn(s)+" x "+vn(s)]}),k.jsx($f,{value:s,onChange:F=>ee(F,"standard transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),(u===1||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:lt.traitInfoTitle,children:"MToon Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Opaque: ",vn(a)+" x "+vn(a)]}),k.jsx($f,{value:a,onChange:F=>ee(F,"mtoon opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Transparent: ",vn(A)+" x "+vn(A)]}),k.jsx($f,{value:A,onChange:F=>ee(F,"mtoon transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),k.jsx("div",{className:lt.traitInfoTitle,children:"Options"}),k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:h,onChange:E}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Two Sided Material"]})}),n&&k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:x,onChange:v}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Drag Drop - Download"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:C,onChange:U}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function zLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=Y.useContext(or),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=Y.useState(""),{playSound:g}=Y.useContext(Ys),{isMute:m}=Y.useContext($s),[y,w]=Y.useState(null),x=()=>{!m&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(dt.LANDING)},_=()=>{const I=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:I===0||I==2,exportMtoonAtlas:I===1||I==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=(I,v=!1)=>{console.log(v),(async()=>{await s.loadTraitsFromNFTObject(y[I]),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await s.downloadVRM(y[I].name,_());const P=new ad,L=A.parent;L.remove(A);const z=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(z===!0){const O=r.loras.map(async B=>a.createLoraData(B,P));await Promise.all(O)}const K=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(K===!0){const O=r.sprites.map(async B=>l.createSpriteAtlas(B,P));await Promise.all(O)}(z===!0||K===!0)&&P.saveZip(y[I].name),L.add(A),I{t(!0),C(0,!0)},{t:b}=ye.useContext(To),M=async I=>{if(s.getCurrentCharacterModel()){const E=ul(I.name),U=URL.createObjectURL(I);await o.loadAnimation(U,!1,0,!0,"",E),d(o.getCurrentAnimationName()),URL.revokeObjectURL(U)}else console.warn("Please load a vrm model to test animations.")},D=async I=>{const v=URL.createObjectURL(I);await s.loadOptimizerCharacter(v),URL.revokeObjectURL(v);const E=ul(I.name);h(E),u(s.getCurrentCharacterModel())},$=I=>{const v=Array.from(I),E=[],U=P=>new Promise((L,z)=>{var K;if(P&&P.name.toLowerCase().endsWith(".json")){const O=new FileReader,B=`${(K=s.manifestData)==null?void 0:K.getAssetsDirectory()}/anata/_thumbnails/t_${P.name.split("_")[0]}.jpg`;O.onload=function(W){try{const ee=JSON.parse(W.target.result);ee.thumb=B,E.push(ee),L()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},O.readAsText(P)}});Promise.all(v.map(U)).then(()=>{E.length>0&&(w(E),t(!0),s.loadTraitsFromNFTObject(E[0]).then(()=>{t(!1)}))}).catch(P=>{console.error("Error processing files:",P)})},H=async I=>{const v=I[0];console.log("anim"),v&&v.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),M(v)),v&&v.name.toLowerCase().endsWith(".vrm")&&D(v),v&&v.name.toLowerCase().endsWith(".json")&&$(I)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Batch Download"}),k.jsx(Cg,{onFilesDrop:H}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(y2,{model:c}),k.jsx(ST,{jsonSelectionArray:y}),k.jsx(a_,{loadedAnimationName:p}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:b("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(y==null?void 0:y.length)==1&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:S}),(y==null?void 0:y.length)>1&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:S})]})]})}const Dg="abi/5.7.0",Dt=new ve(Dg),Jc={};let mO={calldata:!0,memory:!0,storage:!0},GLe={calldata:!0,memory:!0};function Rv(n,e){if(n==="bytes"||n==="string"){if(mO[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&GLe[e])return!0;return(mO[e]||e==="payable")&&Dt.throwArgumentError("invalid modifier","name",e),!1}function VLe(n,e){let t=n;function r(a){Dt.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!==Gt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Gt.full?", ":",")+")"):t+=this.type,e!==Gt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Gt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?_r.fromString(e,t):_r.fromObject(e)}static fromObject(e){return _r.isParamType(e)?e:new _r(Jc,{name:e.name||null,type:_f(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(_r.fromObject):null})}static fromString(e,t){function r(i){return _r.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(VLe(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function eg(n,e){return KLe(n).map(t=>_r.fromString(t,e))}class ol{constructor(e,t){e!==Jc&&Dt.throwError("use a static from method",ve.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),wy(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return ol.isFragment(e)?e:typeof e=="string"?ol.fromString(e):ol.fromObject(e)}static fromObject(e){if(ol.isFragment(e))return e;switch(e.type){case"function":return ea.fromObject(e);case"event":return el.fromObject(e);case"constructor":return qo.fromObject(e);case"error":return rA.fromObject(e);case"fallback":case"receive":return null}return Dt.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"?el.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?ea.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?qo.fromString(e.trim()):e.split(" ")[0]==="error"?rA.fromString(e.substring(5).trim()):Dt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class el extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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!==Gt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",e!==Gt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?el.fromString(e):el.fromObject(e)}static fromObject(e){if(el.isEventFragment(e))return e;e.type!=="event"&&Dt.throwArgumentError("invalid event object","value",e);const t={name:tg(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(_r.fromObject):[],type:"event"};return new el(Jc,t)}static fromString(e){let t=e.match(ng);t||Dt.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:Dt.warn("unknown modifier: "+i)}}),el.fromObject({name:t[1].trim(),anonymous:r,inputs:eg(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function dz(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&Dt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||Dt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ge.from(t[1]),t[0]):n}function pz(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 mz(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&&Dt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&Dt.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"&&Dt.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&&Dt.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"&&Dt.throwArgumentError("unable to determine stateMutability","value",n),e}class qo extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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===Gt.sighash&&Dt.throwError("cannot format a constructor for sighash",ve.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?qo.fromString(e):qo.fromObject(e)}static fromObject(e){if(qo.isConstructorFragment(e))return e;e.type!=="constructor"&&Dt.throwArgumentError("invalid constructor object","value",e);let t=mz(e);t.constant&&Dt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(_r.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new qo(Jc,r)}static fromString(e){let t={type:"constructor"};e=dz(e,t);let r=e.match(ng);return(!r||r[1].trim()!=="constructor")&&Dt.throwArgumentError("invalid constructor string","value",e),t.inputs=eg(r[2].trim(),!1),pz(r[3].trim(),t),qo.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class ea extends qo{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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!==Gt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",e!==Gt.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"?ea.fromString(e):ea.fromObject(e)}static fromObject(e){if(ea.isFunctionFragment(e))return e;e.type!=="function"&&Dt.throwArgumentError("invalid function object","value",e);let t=mz(e);const r={type:e.type,name:tg(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(_r.fromObject):[],outputs:e.outputs?e.outputs.map(_r.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new ea(Jc,r)}static fromString(e){let t={type:"function"};e=dz(e,t);let r=e.split(" returns ");r.length>2&&Dt.throwArgumentError("invalid function string","value",e);let i=r[0].match(ng);if(i||Dt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&tg(t.name),t.inputs=eg(i[2],!1),pz(i[3].trim(),t),r.length>1){let s=r[1].match(ng);(s[1].trim()!=""||s[3].trim()!="")&&Dt.throwArgumentError("unexpected tokens","value",e),t.outputs=eg(s[2],!1)}else t.outputs=[];return ea.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function gO(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Dt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class rA extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Gt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?rA.fromString(e):rA.fromObject(e)}static fromObject(e){if(rA.isErrorFragment(e))return e;e.type!=="error"&&Dt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:tg(e.name),inputs:e.inputs?e.inputs.map(_r.fromObject):[]};return gO(new rA(Jc,t))}static fromString(e){let t={type:"error"},r=e.match(ng);return r||Dt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&tg(t.name),t.inputs=eg(r[2],!1),gO(rA.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function _f(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const WLe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tg(n){return(!n||!n.match(WLe))&&Dt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const ng=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function KLe(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&w2.throwError("value out-of-bounds",ve.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Zi([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 nx{constructor(e,t,r,i){Ue(this,"_data",at(e)),Ue(this,"wordSize",t||32),Ue(this,"_coerceFunc",r),Ue(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):nx.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:w2.throwError("data out-of-bounds",ve.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new nx(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 YLe extends Il{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Dr(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return Dr(kn(e.readValue().toHexString(),20))}}class XLe extends Il{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 Yf=new ve(Dg);function gz(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||Yf.throwError("cannot encode object for signature with missing names",ve.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]&&Yf.throwError("cannot encode object for signature with duplicate names",ve.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]=!0,t[c]})}else Yf.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Yf.throwArgumentError("types/value length mismatch","tuple",t);let i=new pS(n.wordSize),s=new pS(n.wordSize),o=[];e.forEach((l,A)=>{let c=r[A];if(l.dynamic){let u=s.length;l.encode(s,c);let f=i.writeUpdatableValue();o.push(h=>{f(h+u)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function vz(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===ve.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===ve.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 ZLe extends Il{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&&Yf.throwError("insufficient data length",ve.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 gz(e,this.coders,t)}decode(e){return e.coerce(this.name,vz(e,this.coders))}}const Uv=new ve(Dg),i3e=new RegExp(/^bytes([0-9]*)$/),s3e=new RegExp(/^(u?int)([0-9]*)$/);class o3e{constructor(e){Ue(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new YLe(e.name);case"bool":return new JLe(e.name);case"string":return new r3e(e.name);case"bytes":return new qLe(e.name);case"array":return new ZLe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Fv((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new t3e(e.name)}let t=e.type.match(s3e);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Uv.throwArgumentError("invalid "+t[1]+" bit length","param",e),new n3e(r/8,t[1]==="int",e.name)}if(t=e.type.match(i3e),t){let r=parseInt(t[1]);return(r===0||r>32)&&Uv.throwArgumentError("invalid bytes length","param",e),new e3e(r,e.name)}return Uv.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new nx(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new pS(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(_r.from(i)));return new Fv(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Uv.throwError("types/values length mismatch",ve.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(_r.from(o))),i=new Fv(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(_r.from(o)));return new Fv(i,"_").decode(this._getReader(at(t),r))}}const a3e=new o3e,bn=new ve(Dg);class l3e extends og{}class A3e extends og{}class c3e extends og{}class mS extends og{static isIndexed(e){return!!(e&&e._isIndexed)}}const u3e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function vO(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class yO{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Ue(this,"fragments",t.map(r=>ol.from(r)).filter(r=>r!=null)),Ue(this,"_abiCoder",Ji(new.target,"getAbiCoder")()),Ue(this,"functions",{}),Ue(this,"errors",{}),Ue(this,"events",{}),Ue(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){bn.warn("duplicate definition - constructor");return}Ue(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]){bn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Ue(this,"deploy",qo.from({payable:!1,type:"constructor"})),Ue(this,"_isInterface",!0)}format(e){e||(e=Gt.full),e===Gt.sighash&&bn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Gt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return a3e}static getAddress(e){return Dr(e)}static getSighash(e){return zr(bf(e.format()),0,4)}static getEventTopic(e){return bf(e.format())}getFunction(e){if(Et(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];bn.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?bn.throwArgumentError("no matching function","name",r):i.length>1&&bn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[ea.fromString(e).format()];return t||bn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Et(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];bn.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?bn.throwArgumentError("no matching event","name",r):i.length>1&&bn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[el.fromString(e).format()];return t||bn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Et(e)){const r=Ji(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}bn.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?bn.throwArgumentError("no matching error","name",r):i.length>1&&bn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[ea.fromString(e).format()];return t||bn.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 Ji(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),Ji(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)&&bn.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(Zi([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)&&bn.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(Zi([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=u3e[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 bn.throwError("call revert exception"+s,ve.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&&bn.throwError("too many arguments for "+e.format(),ve.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?bf(o):s.type==="bytes"?rr(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]),kn(nt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&bn.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"?bn.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&&bn.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(bf(l));else if(o.type==="bytes")r.push(rr(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 f=this.getEventTopic(e);(!Et(r[0],32)||r[0].toLowerCase()!==f)&&bn.throwError("fragment/topic mismatch",ve.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:f,value:r[0]}),r=r.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((f,h)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(i.push(_r.fromObject({type:"bytes32",name:f.name})),o.push(!0)):(i.push(f),o.push(!1)):(s.push(f),o.push(!1))});let a=r!=null?this._abiCoder.decode(i,Zi(r)):null,l=this._abiCoder.decode(s,t,!0),A=[],c=0,u=0;e.inputs.forEach((f,h)=>{if(f.indexed)if(a==null)A[h]=new mS({_isIndexed:!0,hash:null});else if(o[h])A[h]=new mS({_isIndexed:!0,hash:a[u++]});else try{A[h]=a[u++]}catch(p){A[h]=p}else try{A[h]=l[c++]}catch(p){A[h]=p}if(f.name&&A[f.name]==null){const p=A[h];p instanceof Error?Object.defineProperty(A,f.name,{enumerable:!0,get:()=>{throw vO(`property ${JSON.stringify(f.name)}`,p)}}):A[f.name]=p}});for(let f=0;f{throw vO(`index ${f}`,h)}})}return Object.freeze(A)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new A3e({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 l3e({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 c3e({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 f3e="contracts/5.7.0";var qc=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 Wn=new ve(f3e);function rx(n,e){return qc(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&Wn.throwArgumentError("invalid address or ENS name","name",t);try{return Dr(t)}catch{}n||Wn.throwError("a provider or signer is needed to resolve ENS names",ve.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&Wn.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function xy(n,e,t){return qc(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>xy(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield rx(n,e):t.type==="tuple"?yield xy(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>xy(n,r,t.arrayChildren))):Promise.reject(Wn.makeError("invalid value for array",ve.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function E_(n,e,t){return qc(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=wn(t.pop())),Wn.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=qn({override:rx(n.signer,r.from),signer:n.signer.getAddress()}).then(A=>qc(this,void 0,void 0,function*(){return Dr(A.signer)!==A.override&&Wn.throwError("Contract with a Signer cannot override from",ve.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),A.override})):r.from=n.signer.getAddress():r.from&&(r.from=rx(n.provider,r.from));const i=yield qn({args:xy(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=tu(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&&Wn.throwError(`cannot override ${l.map(A=>JSON.stringify(A)).join(",")}`,ve.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function h3e(n,e){return function(...t){return E_(n,e,t)}}function d3e(n,e){const t=n.signer||n.provider;return function(...r){return qc(this,void 0,void 0,function*(){t||Wn.throwError("estimate require a provider or signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield E_(n,e,r);return yield t.estimateGas(i)})}}function p3e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=ts(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 wz(n,e,t){const r=n.signer||n.provider;return function(...i){return qc(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=wn(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 E_(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===ve.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function m3e(n,e){return function(...t){return qc(this,void 0,void 0,function*(){n.signer||Wn.throwError("sending a transaction requires a signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield E_(n,e,t),i=yield n.signer.sendTransaction(r);return p3e(n,i),i})}}function wO(n,e,t){return e.constant?wz(n,e,t):m3e(n,e)}function xz(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 rg{constructor(e,t){Ue(this,"tag",e),Ue(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 g3e extends rg{constructor(){super("error",null)}}class xO extends rg{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&Wn.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(xz(s),s),Ue(this,"address",e),Ue(this,"interface",t),Ue(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=$Le(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class _O extends rg{constructor(e,t){super("*",{address:e}),Ue(this,"address",e),Ue(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 v3e{constructor(e,t,r){Ue(this,"interface",Ji(new.target,"getInterface")(t)),r==null?(Ue(this,"provider",null),Ue(this,"signer",null)):cg.isSigner(r)?(Ue(this,"provider",r.provider||null),Ue(this,"signer",r)):ag.isProvider(r)?(Ue(this,"provider",r),Ue(this,"signer",null)):Wn.throwArgumentError("invalid signer or provider","signerOrProvider",r),Ue(this,"callStatic",{}),Ue(this,"estimateGas",{}),Ue(this,"functions",{}),Ue(this,"populateTransaction",{}),Ue(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Ue(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?Ue(this.filters,a,this.filters[l[0]]):Wn.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Ue(this,"_runningEvents",{}),Ue(this,"_wrappedEmits",{}),e==null&&Wn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ue(this,"address",e),this.provider)Ue(this,"resolvedAddress",rx(this.provider,e));else try{Ue(this,"resolvedAddress",Promise.resolve(Dr(e)))}catch{Wn.throwError("provider is required to use ENS name as contract address",ve.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]){Wn.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&&Ue(this,o,wO(this,a,!0)),this.functions[o]==null&&Ue(this.functions,o,wO(this,a,!1)),this.callStatic[o]==null&&Ue(this.callStatic,o,wz(this,a,!0)),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,h3e(this,a)),this.estimateGas[o]==null&&Ue(this.estimateGas,o,d3e(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&&Ue(this,o,this[l])}catch{}this.functions[o]==null&&Ue(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Ue(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Ue(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return pN(e)}static getInterface(e){return yO.isInterface(e)?e:new yO(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"&&Wn.throwError("contract not deployed",ve.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||Wn.throwError("sending a transactions require a signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=wn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&Wn.throwError("cannot override "+r,ve.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new OS(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Ue(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return mS.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 g3e);if(e==="event")return this._normalizeRunningEvent(new rg("event",null));if(e==="*")return this._normalizeRunningEvent(new _O(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new xO(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 xO(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new rg(xz(t),t))}return this._normalizeRunningEvent(new _O(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=ts(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||Wn.throwError("events require a provider or a signer with a provider",ve.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=wn(i.filter);return typeof t=="string"&&Et(t,32)?(r!=null&&Wn.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 C_ extends v3e{}const y3e="0x543D43F390b7d681513045e8a85707438c463d80",ix={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"}]},bO={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"}]};function _z(n,e){return function(){return n.apply(e,arguments)}}const{toString:w3e}=Object.prototype,{getPrototypeOf:x2}=Object,S_=(n=>e=>{const t=w3e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Sa=n=>(n=n.toLowerCase(),e=>S_(e)===n),M_=n=>e=>typeof e===n,{isArray:vd}=Array,ig=M_("undefined");function x3e(n){return n!==null&&!ig(n)&&n.constructor!==null&&!ig(n.constructor)&&Qs(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const bz=Sa("ArrayBuffer");function _3e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&bz(n.buffer),e}const b3e=M_("string"),Qs=M_("function"),Bz=M_("number"),T_=n=>n!==null&&typeof n=="object",B3e=n=>n===!0||n===!1,_y=n=>{if(S_(n)!=="object")return!1;const e=x2(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},E3e=Sa("Date"),C3e=Sa("File"),S3e=Sa("Blob"),M3e=Sa("FileList"),T3e=n=>T_(n)&&Qs(n.pipe),I3e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Qs(n.append)&&((e=S_(n))==="formdata"||e==="object"&&Qs(n.toString)&&n.toString()==="[object FormData]"))},R3e=Sa("URLSearchParams"),F3e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Og(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),vd(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const Cz=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Sz=n=>!ig(n)&&n!==Cz;function gS(){const{caseless:n}=Sz(this)&&this||{},e={},t=(r,i)=>{const s=n&&Ez(e,i)||i;_y(e[s])&&_y(r)?e[s]=gS(e[s],r):_y(r)?e[s]=gS({},r):vd(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(Og(e,(i,s)=>{t&&Qs(i)?n[s]=_z(i,t):n[s]=i},{allOwnKeys:r}),n),L3e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),P3e=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},D3e=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&x2(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},O3e=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},N3e=n=>{if(!n)return null;if(vd(n))return n;let e=n.length;if(!Bz(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},k3e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&x2(Uint8Array)),Q3e=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},H3e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},z3e=Sa("HTMLFormElement"),G3e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),BO=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),V3e=Sa("RegExp"),Mz=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};Og(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},j3e=n=>{Mz(n,(e,t)=>{if(Qs(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Qs(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},W3e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return vd(n)?r(n):r(String(n).split(e)),t},K3e=()=>{},$3e=(n,e)=>(n=+n,Number.isFinite(n)?n:e),IB="abcdefghijklmnopqrstuvwxyz",EO="0123456789",Tz={DIGIT:EO,ALPHA:IB,ALPHA_DIGIT:IB+IB.toUpperCase()+EO},Y3e=(n=16,e=Tz.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function X3e(n){return!!(n&&Qs(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Z3e=n=>{const e=new Array(10),t=(r,i)=>{if(T_(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=vd(r)?[]:{};return Og(r,(o,a)=>{const l=t(o,i+1);!ig(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},J3e=Sa("AsyncFunction"),q3e=n=>n&&(T_(n)||Qs(n))&&Qs(n.then)&&Qs(n.catch),Ie={isArray:vd,isArrayBuffer:bz,isBuffer:x3e,isFormData:I3e,isArrayBufferView:_3e,isString:b3e,isNumber:Bz,isBoolean:B3e,isObject:T_,isPlainObject:_y,isUndefined:ig,isDate:E3e,isFile:C3e,isBlob:S3e,isRegExp:V3e,isFunction:Qs,isStream:T3e,isURLSearchParams:R3e,isTypedArray:k3e,isFileList:M3e,forEach:Og,merge:gS,extend:U3e,trim:F3e,stripBOM:L3e,inherits:P3e,toFlatObject:D3e,kindOf:S_,kindOfTest:Sa,endsWith:O3e,toArray:N3e,forEachEntry:Q3e,matchAll:H3e,isHTMLForm:z3e,hasOwnProperty:BO,hasOwnProp:BO,reduceDescriptors:Mz,freezeMethods:j3e,toObjectSet:W3e,toCamelCase:G3e,noop:K3e,toFiniteNumber:$3e,findKey:Ez,global:Cz,isContextDefined:Sz,ALPHABET:Tz,generateString:Y3e,isSpecCompliantForm:X3e,toJSONObject:Z3e,isAsyncFn:J3e,isThenable:q3e};function Nt(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i)}Ie.inherits(Nt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ie.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Iz=Nt.prototype,Rz={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{Rz[n]={value:n}});Object.defineProperties(Nt,Rz);Object.defineProperty(Iz,"isAxiosError",{value:!0});Nt.from=(n,e,t,r,i,s)=>{const o=Object.create(Iz);return Ie.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Nt.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const ePe=null;function vS(n){return Ie.isPlainObject(n)||Ie.isArray(n)}function Fz(n){return Ie.endsWith(n,"[]")?n.slice(0,-2):n}function CO(n,e,t){return n?n.concat(e).map(function(i,s){return i=Fz(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function tPe(n){return Ie.isArray(n)&&!n.some(vS)}const nPe=Ie.toFlatObject(Ie,{},null,function(e){return/^is[A-Z]/.test(e)});function I_(n,e,t){if(!Ie.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Ie.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,g){return!Ie.isUndefined(g[d])});const r=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Ie.isSpecCompliantForm(e);if(!Ie.isFunction(i))throw new TypeError("visitor must be a function");function A(p){if(p===null)return"";if(Ie.isDate(p))return p.toISOString();if(!l&&Ie.isBlob(p))throw new Nt("Blob is not supported. Use a Buffer instead.");return Ie.isArrayBuffer(p)||Ie.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,d,g){let m=p;if(p&&!g&&typeof p=="object"){if(Ie.endsWith(d,"{}"))d=r?d:d.slice(0,-2),p=JSON.stringify(p);else if(Ie.isArray(p)&&tPe(p)||(Ie.isFileList(p)||Ie.endsWith(d,"[]"))&&(m=Ie.toArray(p)))return d=Fz(d),m.forEach(function(w,x){!(Ie.isUndefined(w)||w===null)&&e.append(o===!0?CO([d],x,s):o===null?d:d+"[]",A(w))}),!1}return vS(p)?!0:(e.append(CO(g,d,s),A(p)),!1)}const u=[],f=Object.assign(nPe,{defaultVisitor:c,convertValue:A,isVisitable:vS});function h(p,d){if(!Ie.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(p),Ie.forEach(p,function(m,y){(!(Ie.isUndefined(m)||m===null)&&i.call(e,m,Ie.isString(y)?y.trim():y,d,f))===!0&&h(m,d?d.concat(y):[y])}),u.pop()}}if(!Ie.isObject(n))throw new TypeError("data must be an object");return h(n),e}function SO(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function _2(n,e){this._pairs=[],n&&I_(n,this,e)}const Uz=_2.prototype;Uz.append=function(e,t){this._pairs.push([e,t])};Uz.toString=function(e){const t=e?function(r){return e.call(this,r,SO)}:SO;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function rPe(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lz(n,e,t){if(!e)return n;const r=t&&t.encode||rPe,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Ie.isURLSearchParams(e)?e.toString():new _2(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class iPe{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ie.forEach(this.handlers,function(r){r!==null&&e(r)})}}const MO=iPe,Pz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},sPe=typeof URLSearchParams<"u"?URLSearchParams:_2,oPe=typeof FormData<"u"?FormData:null,aPe=typeof Blob<"u"?Blob:null,lPe={isBrowser:!0,classes:{URLSearchParams:sPe,FormData:oPe,Blob:aPe},protocols:["http","https","file","blob","url","data"]},Dz=typeof window<"u"&&typeof document<"u",APe=(n=>Dz&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),cPe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),uPe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Dz,hasStandardBrowserEnv:APe,hasStandardBrowserWebWorkerEnv:cPe},Symbol.toStringTag,{value:"Module"})),ra={...uPe,...lPe};function fPe(n,e){return I_(n,new ra.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ra.isNode&&Ie.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function hPe(n){return Ie.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function dPe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Ie.isArray(i)?i.length:o,l?(Ie.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Ie.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Ie.isArray(i[o])&&(i[o]=dPe(i[o])),!a)}if(Ie.isFormData(n)&&Ie.isFunction(n.entries)){const t={};return Ie.forEachEntry(n,(r,i)=>{e(hPe(r),i,t,0)}),t}return null}function pPe(n,e,t){if(Ie.isString(n))try{return(e||JSON.parse)(n),Ie.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const b2={transitional:Pz,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Ie.isObject(e);if(s&&Ie.isHTMLForm(e)&&(e=new FormData(e)),Ie.isFormData(e))return i?JSON.stringify(Oz(e)):e;if(Ie.isArrayBuffer(e)||Ie.isBuffer(e)||Ie.isStream(e)||Ie.isFile(e)||Ie.isBlob(e))return e;if(Ie.isArrayBufferView(e))return e.buffer;if(Ie.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return fPe(e,this.formSerializer).toString();if((a=Ie.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return I_(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),pPe(e)):e}],transformResponse:[function(e){const t=this.transitional||b2.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Ie.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Nt.from(a,Nt.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ra.classes.FormData,Blob:ra.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ie.forEach(["delete","get","head","post","put","patch"],n=>{b2.headers[n]={}});const B2=b2,mPe=Ie.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),gPe=n=>{const e={};let t,r,i;return n&&n.split(` -`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&mPe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},TO=Symbol("internals");function hp(n){return n&&String(n).trim().toLowerCase()}function by(n){return n===!1||n==null?n:Ie.isArray(n)?n.map(by):String(n)}function vPe(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const yPe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function RB(n,e,t,r,i){if(Ie.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Ie.isString(e)){if(Ie.isString(r))return e.indexOf(r)!==-1;if(Ie.isRegExp(r))return r.test(e)}}function wPe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function xPe(n,e){const t=Ie.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class R_{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,A){const c=hp(l);if(!c)throw new Error("header name must be a non-empty string");const u=Ie.findKey(i,c);(!u||i[u]===void 0||A===!0||A===void 0&&i[u]!==!1)&&(i[u||l]=by(a))}const o=(a,l)=>Ie.forEach(a,(A,c)=>s(A,c,l));return Ie.isPlainObject(e)||e instanceof this.constructor?o(e,t):Ie.isString(e)&&(e=e.trim())&&!yPe(e)?o(gPe(e),t):e!=null&&s(t,e,r),this}get(e,t){if(e=hp(e),e){const r=Ie.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return vPe(i);if(Ie.isFunction(t))return t.call(this,i,r);if(Ie.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=hp(e),e){const r=Ie.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||RB(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=hp(o),o){const a=Ie.findKey(r,o);a&&(!t||RB(r,r[a],a,t))&&(delete r[a],i=!0)}}return Ie.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||RB(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Ie.forEach(this,(i,s)=>{const o=Ie.findKey(r,s);if(o){t[o]=by(i),delete t[s];return}const a=e?wPe(s):String(s).trim();a!==s&&delete t[s],t[a]=by(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Ie.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[TO]=this[TO]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=hp(o);r[a]||(xPe(i,o),r[a]=!0)}return Ie.isArray(e)?e.forEach(s):s(e),this}}R_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(R_.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Ie.freezeMethods(R_);const fl=R_;function FB(n,e){const t=this||B2,r=e||t,i=fl.from(r.headers);let s=r.data;return Ie.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Nz(n){return!!(n&&n.__CANCEL__)}function Ng(n,e,t){Nt.call(this,n??"canceled",Nt.ERR_CANCELED,e,t),this.name="CanceledError"}Ie.inherits(Ng,Nt,{__CANCEL__:!0});function _Pe(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new Nt("Request failed with status code "+t.status,[Nt.ERR_BAD_REQUEST,Nt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const bPe=ra.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Ie.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ie.isString(r)&&o.push("path="+r),Ie.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function BPe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function EPe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function kz(n,e){return n&&!BPe(e)?EPe(n,e):e}const CPe=ra.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(o){const a=Ie.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function SPe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function MPe(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const A=Date.now(),c=r[s];o||(o=A),t[i]=l,r[i]=A;let u=s,f=0;for(;u!==i;)f+=t[u++],u=u%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),A-o{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-t,l=r(a),A=s<=o;t=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&A?(o-s)/l:void 0,event:i};c[e?"download":"upload"]=!0,n(c)}}const TPe=typeof XMLHttpRequest<"u",IPe=TPe&&function(n){return new Promise(function(t,r){let i=n.data;const s=fl.from(n.headers).normalize();let{responseType:o,withXSRFToken:a}=n,l;function A(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let c;if(Ie.isFormData(i)){if(ra.hasStandardBrowserEnv||ra.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((c=s.getContentType())!==!1){const[d,...g]=c?c.split(";").map(m=>m.trim()).filter(Boolean):[];s.setContentType([d||"multipart/form-data",...g].join("; "))}}let u=new XMLHttpRequest;if(n.auth){const d=n.auth.username||"",g=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(d+":"+g))}const f=kz(n.baseURL,n.url);u.open(n.method.toUpperCase(),Lz(f,n.params,n.paramsSerializer),!0),u.timeout=n.timeout;function h(){if(!u)return;const d=fl.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!o||o==="text"||o==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:d,config:n,request:u};_Pe(function(w){t(w),A()},function(w){r(w),A()},m),u=null}if("onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(h)},u.onabort=function(){u&&(r(new Nt("Request aborted",Nt.ECONNABORTED,n,u)),u=null)},u.onerror=function(){r(new Nt("Network Error",Nt.ERR_NETWORK,n,u)),u=null},u.ontimeout=function(){let g=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const m=n.transitional||Pz;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),r(new Nt(g,m.clarifyTimeoutError?Nt.ETIMEDOUT:Nt.ECONNABORTED,n,u)),u=null},ra.hasStandardBrowserEnv&&(a&&Ie.isFunction(a)&&(a=a(n)),a||a!==!1&&CPe(f))){const d=n.xsrfHeaderName&&n.xsrfCookieName&&bPe.read(n.xsrfCookieName);d&&s.set(n.xsrfHeaderName,d)}i===void 0&&s.setContentType(null),"setRequestHeader"in u&&Ie.forEach(s.toJSON(),function(g,m){u.setRequestHeader(m,g)}),Ie.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),o&&o!=="json"&&(u.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&u.addEventListener("progress",IO(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",IO(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=d=>{u&&(r(!d||d.type?new Ng(null,n,u):d),u.abort(),u=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const p=SPe(f);if(p&&ra.protocols.indexOf(p)===-1){r(new Nt("Unsupported protocol "+p+":",Nt.ERR_BAD_REQUEST,n));return}u.send(i||null)})},yS={http:ePe,xhr:IPe};Ie.forEach(yS,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const RO=n=>`- ${n}`,RPe=n=>Ie.isFunction(n)||n===null||n===!1,Qz={getAdapter:n=>{n=Ie.isArray(n)?n:[n];const{length:e}=n;let t,r;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : + `),Y.createElement("div",{style:c.white,className:"saturation-white"},Y.createElement("div",{style:c.black,className:"saturation-black"}),Y.createElement("div",{style:c.pointer},this.props.pointer?Y.createElement(this.props.pointer,this.props):Y.createElement("div",{style:c.circle}))))}}]),e}(ye.PureComponent||ye.Component);function LIe(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(tRe,arguments)},brighten:function(){return this._applyModification(nRe,arguments)},darken:function(){return this._applyModification(rRe,arguments)},desaturate:function(){return this._applyModification(JIe,arguments)},saturate:function(){return this._applyModification(qIe,arguments)},greyscale:function(){return this._applyModification(eRe,arguments)},spin:function(){return this._applyModification(iRe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(aRe,arguments)},complement:function(){return this._applyCombination(sRe,arguments)},monochromatic:function(){return this._applyCombination(lRe,arguments)},splitcomplement:function(){return this._applyCombination(oRe,arguments)},triad:function(){return this._applyCombination(GD,[3])},tetrad:function(){return this._applyCombination(GD,[4])}};tt.fromRatio=function(n,e){if(ex(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Dp(n[r]));n=t}return tt(n,e)};function KIe(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=hRe(n)),ex(n)=="object"&&(za(n.r)&&za(n.g)&&za(n.b)?(e=$Ie(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):za(n.h)&&za(n.s)&&za(n.v)?(r=Dp(n.s),i=Dp(n.v),e=XIe(n.h,r,i),o=!0,a="hsv"):za(n.h)&&za(n.s)&&za(n.l)&&(r=Dp(n.s),s=Dp(n.l),e=YIe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=J8(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 $Ie(n,e,t){return{r:gn(n,255)*255,g:gn(e,255)*255,b:gn(t,255)*255}}function kD(n,e,t){n=gn(n,255),e=gn(e,255),t=gn(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 QD(n,e,t){n=gn(n,255),e=gn(e,255),t=gn(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 lRe(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=dRe(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 cS=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"},ARe=tt.hexNames=cRe(cS);function cRe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function J8(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function gn(n,e){uRe(n)&&(n="100%");var t=fRe(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 __(n){return Math.min(1,Math.max(0,n))}function Hi(n){return parseInt(n,16)}function uRe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function fRe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function xo(n){return n.length==1?"0"+n:""+n}function Dp(n){return n<=1&&(n=n*100+"%"),n}function q8(n){return Math.round(parseFloat(n)*255).toString(16)}function VD(n){return Hi(n)/255}var fo=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 za(n){return!!fo.CSS_UNIT.exec(n)}function hRe(n){n=n.replace(jIe,"").replace(WIe,"").toLowerCase();var e=!1;if(cS[n])n=cS[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=fo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=fo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=fo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=fo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=fo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=fo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=fo.hex8.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),a:VD(t[4]),format:e?"name":"hex8"}:(t=fo.hex6.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),format:e?"name":"hex"}:(t=fo.hex4.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),a:VD(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=fo.hex3.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function dRe(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 jD=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return VIe(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},Op=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}},ZA=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()},t2=function(e){if(!e)return"#fff";var t=Op(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"},SB=function(e,t){var r=e.replace("°","");return tt(t+" ("+r+")")._ok},up=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){_Re(i,r);function i(){var s,o,a,l;xRe(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,f=!0,h=t&LRe?new tx: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 Mv=24,nUe=Az.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Mv:r,s=n.height,o=s===void 0?Mv:s,a=n.style,l=a===void 0?{}:a,A=tUe(n,["fill","width","height","style"]);return cO.default.createElement("svg",AO({viewBox:"0 0 "+Mv+" "+Mv,style:AO({fill:t,width:i,height:o},l)},A),cO.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"}))},rUe=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(lO(i.s)?r.props.hsl.s:i.s),l:Number(lO(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 rUe(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=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),Y.createElement("div",{style:i.alpha},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),Y.createElement("div",{style:i.alpha},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),Y.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,Y.createElement("div",{style:i.toggle},Y.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},Y.createElement(nUe,{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}(Y.Component);cz.defaultProps={view:"hex"};var uO=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 Y.createElement("div",{style:e.picker})},aUe=function(){var e=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return Y.createElement("div",{style:e.picker})},a2=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,f=e.className,h=f===void 0?"":f,p=e.defaultView,d=ft(Li({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 Y.createElement("div",{style:d.picker,className:"chrome-picker "+h},Y.createElement("div",{style:d.saturation},Y.createElement(x_,{style:d.Saturation,hsl:o,hsv:a,pointer:aUe,onChange:r})),Y.createElement("div",{style:d.body},Y.createElement("div",{style:d.controls,className:"flexbox-fix"},Y.createElement("div",{style:d.color},Y.createElement("div",{style:d.swatch},Y.createElement("div",{style:d.active}),Y.createElement(pd,{renderers:A}))),Y.createElement("div",{style:d.toggles},Y.createElement("div",{style:d.hue},Y.createElement(md,{style:d.Hue,hsl:o,pointer:uO,onChange:r})),Y.createElement("div",{style:d.alpha},Y.createElement(KT,{style:d.Alpha,rgb:s,hsl:o,pointer:uO,renderers:A,onChange:r})))),Y.createElement(cz,{rgb:s,hsl:o,hex:l,view:p,onChange:r,disableAlpha:i})))};a2.propTypes={width:He.oneOfType([He.string,He.number]),disableAlpha:He.bool,styles:He.object,defaultView:He.oneOf(["hex","rgb","hsl"])};a2.defaultProps={width:225,disableAlpha:!1,styles:{}};const lUe=Pi(a2);var AUe=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:t2(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 Y.createElement(du,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Y.createElement("div",{style:a.dot}))},cUe=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 Y.createElement("div",{style:s.fields,className:"flexbox-fix"},Y.createElement("div",{style:s.active}),Y.createElement(Pt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},l2=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(Li({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(p,d){p.hex?ZA(p.hex)&&t({hex:p.hex,source:"hex"},d):t(p,d)};return Y.createElement(Pg,{style:u.Compact,styles:l},Y.createElement("div",{style:u.compact,className:"compact-picker "+c},Y.createElement("div",null,pu(i,function(h){return Y.createElement(AUe,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),Y.createElement("div",{style:u.clear})),Y.createElement(cUe,{hex:s,rgb:o,onChange:f})))};l2.propTypes={colors:He.arrayOf(He.string),styles:He.object};l2.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:{}};Pi(l2);var uUe=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 Y.createElement("div",{style:a.swatch},Y.createElement(du,{color:r,onClick:i,onHover:s,focusStyle:o}))};const fUe=WT(uUe);var A2=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(Li({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"}),f=function(p,d){return i({hex:p,source:"hex"},d)};return Y.createElement("div",{style:u.card,className:"github-picker "+c},Y.createElement("div",{style:u.triangleShadow}),Y.createElement("div",{style:u.triangle}),pu(r,function(h){return Y.createElement(fUe,{color:h,key:h,onClick:f,onSwatchHover:s})}))};A2.propTypes={width:He.oneOfType([He.string,He.number]),colors:He.arrayOf(He.string),triangle:He.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:He.object};A2.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Pi(A2);var hUe=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 Y.createElement("div",{style:r.picker})},dUe=Object.assign||function(n){for(var e=1;e.5});return Y.createElement("div",{style:r.picker})},vUe=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 Y.createElement("div",{style:e.pointer},Y.createElement("div",{style:e.left},Y.createElement("div",{style:e.leftInside})),Y.createElement("div",{style:e.right},Y.createElement("div",{style:e.rightInside})))},fO=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 Y.createElement("div",{style:o.button,onClick:t},r||i)},yUe=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 Y.createElement("div",null,Y.createElement("div",{style:i.label},"new"),Y.createElement("div",{style:i.swatches},Y.createElement("div",{style:i.new}),Y.createElement("div",{style:i.current})),Y.createElement("div",{style:i.label},"current"))},wUe=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 Y.createElement("div",{style:a.fields,className:"flexbox-fix"},Y.createElement("div",{style:a.double},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.alpha},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},EUe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Tv=24,FUe=fz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Tv:r,s=n.height,o=s===void 0?Tv:s,a=n.style,l=a===void 0?{}:a,A=RUe(n,["fill","width","height","style"]);return dO.default.createElement("svg",hO({viewBox:"0 0 "+Tv+" "+Tv,style:hO({fill:t,width:i,height:o},l)},A),dO.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},UUe=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:t2(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 Y.createElement(du,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Y.createElement("div",{style:A.check},Y.createElement(FUe,null)))},LUe=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 Y.createElement("div",{style:o.group},pu(i,function(a,l){return Y.createElement(UUe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},d2=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,f=ft(Li({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},A)),h=function(d,g){return i({hex:d,source:"hex"},g)};return Y.createElement("div",{style:f.picker,className:"swatches-picker "+u},Y.createElement(Pg,null,Y.createElement("div",{style:f.overflow},Y.createElement("div",{style:f.body},pu(o,function(p){return Y.createElement(LUe,{key:p.toString(),group:p,active:a,onClick:h,onSwatchHover:s})}),Y.createElement("div",{style:f.clear})))))};d2.propTypes={width:He.oneOfType([He.string,He.number]),height:He.oneOfType([He.string,He.number]),colors:He.arrayOf(He.arrayOf(He.string)),styles:He.object};d2.defaultProps={width:320,height:240,colors:[[sf[900],sf[700],sf[500],sf[300],sf[100]],[of[900],of[700],of[500],of[300],of[100]],[af[900],af[700],af[500],af[300],af[100]],[lf[900],lf[700],lf[500],lf[300],lf[100]],[Af[900],Af[700],Af[500],Af[300],Af[100]],[cf[900],cf[700],cf[500],cf[300],cf[100]],[uf[900],uf[700],uf[500],uf[300],uf[100]],[ff[900],ff[700],ff[500],ff[300],ff[100]],[hf[900],hf[700],hf[500],hf[300],hf[100]],["#194D33",Np[700],Np[500],Np[300],Np[100]],[df[900],df[700],df[500],df[300],df[100]],[pf[900],pf[700],pf[500],pf[300],pf[100]],[mf[900],mf[700],mf[500],mf[300],mf[100]],[gf[900],gf[700],gf[500],gf[300],gf[100]],[vf[900],vf[700],vf[500],vf[300],vf[100]],[yf[900],yf[700],yf[500],yf[300],yf[100]],[wf[900],wf[700],wf[500],wf[300],wf[100]],[xf[900],xf[700],xf[500],xf[300],xf[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Pi(d2);var p2=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,f=ft(Li({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"}),h=function(d,g){ZA(d)&&t({hex:d,source:"hex"},g)};return Y.createElement("div",{style:f.card,className:"twitter-picker "+u},Y.createElement("div",{style:f.triangleShadow}),Y.createElement("div",{style:f.triangle}),Y.createElement("div",{style:f.body},pu(s,function(p,d){return Y.createElement(du,{key:d,color:p,hex:p,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+p}})}),Y.createElement("div",{style:f.hash},"#"),Y.createElement(Pt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),Y.createElement("div",{style:f.clear})))};p2.propTypes={width:He.oneOfType([He.string,He.number]),triangle:He.oneOf(["hide","top-left","top-right"]),colors:He.arrayOf(He.string),styles:He.object};p2.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Pi(p2);var m2=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 Y.createElement("div",{style:t.picker})};m2.propTypes={hsl:He.shape({h:He.number,s:He.number,l:He.number,a:He.number})};m2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var g2=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 Y.createElement("div",{style:t.picker})};g2.propTypes={hsl:He.shape({h:He.number,s:He.number,l:He.number,a:He.number})};g2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var PUe=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(h,p){if(h.hex)ZA(h.hex)&&t({hex:h.hex,source:"hex"},p);else if(h.rgb){var d=h.rgb.split(",");SB(h.rgb,"rgb")&&t({r:d[0],g:d[1],b:d[2],a:1,source:"rgb"},p)}else if(h.hsv){var g=h.hsv.split(",");SB(h.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(h.hsl){var m=h.hsl.split(",");SB(h.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 Y.createElement("div",{style:l.wrap,className:"flexbox-fix"},Y.createElement("div",{style:l.fields},Y.createElement("div",{style:l.double},Y.createElement(Pt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),Y.createElement("div",{style:l.column},Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},v2=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,f=u===void 0?"":u,h=ft(Li({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 Y.createElement("div",{style:h.picker,className:"google-picker "+f},Y.createElement("div",{style:h.head},l),Y.createElement("div",{style:h.swatch}),Y.createElement("div",{style:h.saturation},Y.createElement(x_,{hsl:s,hsv:o,pointer:m2,onChange:r})),Y.createElement("div",{style:h.body},Y.createElement("div",{style:h.controls,className:"flexbox-fix"},Y.createElement("div",{style:h.hue},Y.createElement(md,{style:h.Hue,hsl:s,radius:"4px",pointer:g2,onChange:r}))),Y.createElement(PUe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};v2.propTypes={width:He.oneOfType([He.string,He.number]),styles:He.object,header:He.string};v2.defaultProps={width:652,styles:{},header:"Color picker"};Pi(v2);const DUe="_InformationContainerPos_1yd4c_2",OUe="_scrollContainer_1yd4c_15",TB={InformationContainerPos:DUe,scrollContainer:OUe,"options-container":"_options-container_1yd4c_24"},NUe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmU1ZTg4ZDczLWQ3YmItNjg0NS1iNDkxLWYxZTU0YmRhZDE1MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFhMDRkN2Y4LWVjNjQtZTg0ZC1iMjQzLWQ4ZjRhMjVlN2YzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozNzgwNzA3Yy0zNDg5LTAzNDctYmEwNy1kOTFhY2ZkYmUwODYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MjQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ZTVlODhkNzMtZDdiYi02ODQ1LWI0OTEtZjFlNTRiZGFkMTUyIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjQ3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+okruHwAAA6NJREFUeNrt279LG2EYwHG1CCqKPwKOJQU3cXYqXZ0KofgPuBWcUmsgoouCFArS0UXaWUpTFxHcUnE4cO6fULoUbWnTFk2ftz4p19BoLve+d33vvsN3KWre97lPUvPm7Gs2m32U3xgCABgCAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABABnlV5VR6QH0mOpIq229VSacPj4E/oY7Y9b0TWZtY0AwO7Qp6WH0q70XrqSmh1qSLMO1zKrj9Hp8a90jbu65mkAxBv4svRR+nHD0MOZr5t3uJ75iGsxa18GQPRBl6Sgy0GHu5QWHa5rUR8j6rrMXkoAuH3Ag9KLHgYcbsfh+nZirs3sbRAA/x5uQXrb4zMs3AdpyMH6hvRnx1nbpe6xAIC/hzssHcUcbrjnUr/F9fXrz7S1PrPXYQBcD3dKemdxuKZP0pzFNc7pz7S5RrPnqVwDkAGMSTXLg211auNtmL4NPXW0RrP3sVwC0EOVwNFgW9XjPMv01anueI2By8Or/xKAbHhSeuN4sK3OpPvSQIT1Dej3nCW0RjOLyVwA0Jf9IKHBhk8IX0vFLtZX1K9tJLzGII3/DtJ4q1dLeLDhvkjH0jNpSXqkLem/HevXpLW+WtJvEZP+IKee4nB9qZ7kB0pJPvOPuLiRzgkKmQCgz/xDLmrkDpN4JUjikOeEi9lzJ64Pi1wDOOAixu7AZwBVLmDsqr7/DrAhfeVCRs7MbCMr7wLWuKCRW8vaOYC5cfIbF/bWzIwqWT0J3LRww0eWM7PZzPpnAeUUztl9yMyknJdPA7el71z0P5lZbOftfgDzSvCTi/97BuW83hG0lfNfDM3et/J+T+BKjgGscFfwNYL1DodF+yl/Pm/j/oP9Doc869wVfPNh0Z50Vzr3GMC57mEvjUMeH/8yqKJvh15Ko9I96cJjABe6h1HdUyPJQx4fAdyRFtruz/MdQDG0nwWzRwB0DyJTAPjjUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAhgDMSJ89BmDWPgOA3gGMS0+kVU8zax8HAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIACQlX4BjeT0VuSSEBUAAAAASUVORK5CYII=",kUe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4MDc2OWJhLTIwNzQtMjU0Zi1iNjM5LWJiZjEyMTFlMjljNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmMxMzRkOGNhLTVlMWUtYzM0Yy05ZmM0LTNlZTgyNGQ1YTVhYyIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NzUzMzYxZC05NmIzLTgwNDctYTA0ZC0wODcxYmNiNzY4MDAiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6Mjk6NTctMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDgwNzY5YmEtMjA3NC0yNTRmLWI2MzktYmJmMTIxMWUyOWM1IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjE4LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Yrc/VQAAAzxJREFUeNrt3b9LFnEcwHE3IW1oiUCF/gCXcgibmhyaDEqnWhoCaRXqUQhByKVVXAqsMbQyGgIHA6GhSdpNc7E/IBehp8/h94ErRLzoOc671/Ce7/O572t4/PHc9bTb7R41NzcBADcBAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAinVrudUfPY92o+0ut5uu1Q9AtQCsRe2SWgMAAAAAAAAAAEo/7KHoWnQl12i0USKAjXTN/AzZTEMAdB/AQvQjfRrvtBMdlAjgIF0zP0M20wIA3QewVOJBF20JAAAAAACAbgJYrDCARQD+30EPRjei66nsU/fVaLXCAFbTjKO5ubMdBgEoDuBR9Cv6+VeHFQZweMy82Q6PACgOYLbCB120WQCKA5ipEYAZAAAAoCCAxzUC8BiAk3+3fzeajCZSN6OXNQLwMu3U2W8y7TwEwNENaTe0CQCWW7cbDOA2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcWQB3GgzgDgDLrbHoa/Ql1+foe40O+nvaKb9jtvMYAMutc9Hl9C3hTgPR0xoBeJp2yu+Y7XzO8wE8IAIAAAAAAABPCQPgTwD3ok/Req6P0V6FD3ovzZifOdvhHgD/9hKI7JPzpVwXoxcVBvAizZifeaDKL5fwsGgPiwYAAAAAAACAswJgKnqf3tzV6W20X+JB76dr5mfIZpoCoPsAeqPz6aeETheiDyUC+JCumZ8hm6kXAO8NBAAAAAAAoFQAfdG7EgFk1+oDoLuHOhI9jB6covvRVokAttI1TzNbtsMIAMUBPKnRXwOfAOD/AQAAAAAAACj04si6APDiyBMOejh6Fs3naqX/pqkLgPW0U37HbOdhAI7eoNXUbwZNAuC7gQAAAAAADQYw3mAA440BkD7svYlWotepV9FmgwFspnvQuR8r6R5N1hHAfIMPumjzdQQw52BP3RwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA2QQwHe1E36JtHdu3dI+mfTVMAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAAV7DcOsgfgT8DmTAAAAABJRU5ErkJggg==",QUe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjJkMTY5MDdlLWQyY2EtZDA0Mi05MWRjLTliZTMyYzYyYjlmOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNmQ1YTFjLWM5NjAtMDE0OS04OWQwLTQ3NDQ0MzAzZDI1ZCIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2N2JiZmQ0OC0yMGMzLTI0NDktODQyNS1kNWJmOTBlNzMwYjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MTQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MmQxNjkwN2UtZDJjYS1kMDQyLTkxZGMtOWJlMzJjNjJiOWY5IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMzOjExLTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Q6I0lAAAAs1JREFUeNrt3TtrFFEYgOFE2HjFXgv9AyIYsbATMaAWQtqAYBPQ0ibCgoSA/yGbwsJ/o6Ag3gMWEkurTeGlcfwGzoIs7LKT3TXOOU/xFlnYkNnvIRNOZs4sVFW1oHLzIQDgQwBAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAiVt91l2OXkRVi3oTXQVg+uHfjX60bPiDfkUPADj48C+2ePh/dx2AgwF4ncHw695HHQCaA6gy6hYAZQPYAqBsANsAlA1gBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAogDE14tRt359RL3ocbQSLQGQH4Aj0bsJ31tfF3EDgPwAvGzw/t/ROgDlAhhcY7gMQLkABpeXnQSgXAB1mwCUDeAjAGUD6ANQNoB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCQ6wFQNoAnQ8fWiXYBKAfAnaFjOxXtATAewIdMhv85Ojp0bGfqq3sBGA/gcrodKrt9guO11Sm+XxkA0gd1P90Y2dbhb4w4rm8ATI5gpYVbx+8On/eHHoJRAdAMwVJ9j3zaNKE3ZmOFw6z+uTaj29HxEcdxLvoKQIHVd/XW9/XN4LcLAC0c/vno04xOLwC0bPj3oi8z/PsCgIYDWExLr/+iTlrkORutTbHYA8AMAXTTuvu8e5XO8XtTLPIAMAcATzNbVgagIYAdAAAAAAAAAAAAAADKA7CdGYA+AM0AbGUG4C0AzQDczAzABgDNAHTSHrs5DL9ebTwGQHME1zIY/vfoQjG7hc8BwXr0s8XDXyvqeQFzQnClhZeXPY8uFffEkDkiOB09ShDq/9rt/4f10/n+YXSiyGcGqfCnhgkAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBp+gMB5Yr6zMTlPAAAAABJRU5ErkJggg==",HUe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmFmYmE3YzFhLWI0MTMtMGQ0MS05YmRkLTE2ZGY2MTllOTgyMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjkxMWMyNDQ0LTUzYzgtYjU0OC1iZjBmLTczZWE4ZmU5NWYzZSIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjZhMzQ1Ni02ODczLWQ5NDYtOTRkMy1mZTYwZjQ5NzliNjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6NDQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YWZiYTdjMWEtYjQxMy0wZDQxLTliZGQtMTZkZjYxOWU5ODIxIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjI2LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+F7DBkwAABCVJREFUeNrt3TtMFEEYwHHuAiYkNjRg74mJpSYUkCiGAhKxsLKXggQ6yi2wQUh8RMCGRJulEgotjgLwVaCVDYYeHzQaKU5FCRo4vwnfRdQgHvu4mZ1/8W/Iec7c/u7gdmd368rlch35Gy8CAHgRAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAJLpUhjkpW5pQfoolaRPjlXSsZs59Jg5AeDgDZ+T2qRFaUcqZyQzl0c6txwA9n/X9+m7ppzR1nWOeQD8DaBD+pzhjV/JzLEDAL9v/JPSmgcbv5KZaysAfv3ev+PRxq80acPfAzYAKEgrHgIwcy4AIAwGpS8eAjBzHgBAGEx7uPErhQAIg6LHAIoACIM5jwHMAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIuA3pjbYBgOwDMOvyNqUZ6azUuGcMjfqz+/qYHQBkC8BXaUI6/p/rE8b13wAgAwB+SOel+irGVC91St8B4DYAs8K4J8LYehJepQyAhAEMVfPO3+eTYAgAbgJYinGMSwBwC8A36VyMY+zU5wSAIwCWpeYYx9gsvQKAOwAe7P2eH8MYzX6ChwBwB8DtOE+60PMWxwHgDoCRBMY5AgB3AIzHeQaufgJMAIC/AQDg8beAZQC4A2Argf0AWwBwa0/gc+lIDONr0OdiT6CjxwJyEcaW41iA2wDeS70RxnZBnwMADq8HMOfhXzzEuHpTuG4BAFJaEWQO5IxKp/61f0C/75vHXEvo4A8Aarwm8J00K13WpV9HtYL+bFYfw5pAT5aFb2osC+e8AABkFcBOxADgGIBt6YU0pUfwhqWrh2xYn2NKn3MbAHYDeCId0713ed2RE0d5fc4W6TEA7APwVuqPsgK4ypXC/XpKGQAsAPBB6qrBuLti2EsIgIgAzFk/fTUce5+OAQA1AjCTxsf+Ab8OZgBQGwDmtiynLRj/mQj3OQBABAAv41z1E2H8LToWAKQMwOy3b7Bg/A06FgCkDOCmRbe7uQWA9AGMWgRgFADpAxizCMAYAAAAAAAAgL8BAJAagOsWAbgBgPQBPJWaLBh/k/QMAOkDMIsz7lkw/rsRFooAIIbDweY27avS65Rb1f+bw8EsCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCCAoscAigAIg2mPAYQACIPBFC7GZGNmzgMA2L0+z4qHAMycCwDYPf9+0kMAk3He08BZAIqgVVrzaOObuZ6w4bW3AoAiaI9wkqVLmTm22/K62wTA/Cq4kvCNGmvdul5TIA+A/RG0SQspXqwxrYtULurccja95lYB+OOSrd3SvH4ilPR6AC5V0rHP6y1o8za+1lYCIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",zUe="_InformationContainerPos_1m76y_2",GUe="_scrollContainer_1m76y_15",VUe="_centerAlign_1m76y_25",jUe="_traitInfoTitle_1m76y_28",WUe="_dropdownFlex_1m76y_38",KUe="_checkboxFlex_1m76y_44",$Ue="_simpleFlex_1m76y_49",YUe="_traitInfoText_1m76y_55",XUe="_dropdownBase_1m76y_64",ZUe="_dropdownControl_1m76y_74",JUe="_dropdownControlSmall_1m76y_80",qUe="_flexSelect_1m76y_106",eLe="_checked_1m76y_163",tLe="_checkmark_1m76y_167",nLe="_checkboxHolder_1m76y_180",rLe="_actionButton_1m76y_189",iLe="_tabHolder_1m76y_209",sLe="_tabButton_1m76y_215",oLe="_tabButtonSelected_1m76y_235",Ve={InformationContainerPos:zUe,scrollContainer:GUe,centerAlign:VUe,traitInfoTitle:jUe,dropdownFlex:WUe,checkboxFlex:KUe,simpleFlex:$Ue,traitInfoText:YUe,dropdownBase:XUe,dropdownControl:ZUe,dropdownControlSmall:JUe,"input-box":"_input-box_1m76y_87",flexSelect:qUe,"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:eLe,checkmark:tLe,checkboxHolder:nLe,actionButton:rLe,tabHolder:iLe,tabButton:sLe,tabButtonSelected:oLe},aLe="_slider_1y6nx_1",lLe="_infoContainer_1y6nx_13",Iv={"slider-container":"_slider-container_1y6nx_1",slider:aLe,infoContainer:lLe,"input-box":"_input-box_1y6nx_18"};function $f({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Iv.infoContainer,children:[n,o&&k.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Iv["input-box"],step:o})]}),k.jsx("div",{className:Iv["slider-container"],children:k.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Iv.slider,step:s})})]})}function ALe({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=ye.useContext(or),[i,s]=ye.useState(0),[o,a]=ye.useState(0),[l,A]=ye.useState(0);ye.useEffect(()=>{var p,d,g;e!=null&&(A((p=e.data)==null?void 0:p.cullingLayer),s(((d=e.data)==null?void 0:d.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)},f=p=>{e!=null&&e.data&&(A(p.target.value),e.data.cullingLayer=p.target.value)},h=()=>{r.updateCullHiddenMeshes()};return k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Trait Information",width:180,right:20}),k.jsx("div",{className:Ve.scrollContainer,children:n!=null?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Trait ID"}),k.jsx("div",{className:Ve.traitInfoText,children:n==null?void 0:n.id}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Trait Name"}),k.jsx("div",{className:Ve.traitInfoText,children:n==null?void 0:n.name}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Description"}),k.jsx("div",{className:Ve.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Culling Options"}),k.jsx("br",{}),k.jsxs("div",{className:Ve.traitInfoText,children:["Culling Layer",k.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:Ve["input-box"],step:1}),k.jsx("br",{}),k.jsx("br",{}),k.jsx($f,{title:"Out Distance",value:i,onChange:c,min:0,max:1,step:.001,stepBox:.01}),k.jsx("br",{}),k.jsx($f,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),k.jsx("div",{className:Ve.actionButton,onClick:h,children:k.jsx("div",{children:"Update Culling "})})]})]}):k.jsx(k.Fragment,{children:k.jsx("div",{className:Ve.traitInfoTitle,children:"No Trait Selected"})})})]})})}var hz={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(ye),t=r(Y5);function r(C){return C&&C.__esModule?C:{default:C}}function i(){if(typeof WeakMap!="function")return null;var C=new WeakMap;return i=function(){return C},C}function s(C){if(C&&C.__esModule)return C;if(C===null||o(C)!=="object"&&typeof C!="function")return{default:C};var S=i();if(S&&S.has(C))return S.get(C);var b={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var D in C)if(Object.prototype.hasOwnProperty.call(C,D)){var $=M?Object.getOwnPropertyDescriptor(C,D):null;$&&($.get||$.set)?Object.defineProperty(b,D,$):b[D]=C[D]}return b.default=C,S&&S.set(C,b),b}function o(C){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(b){return typeof b}:o=function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},o(C)}function a(){return a=Object.assign||function(C){for(var S=1;S"u"?w:b.placeholder,value:""},isOpen:!1},M.dropdownRef=(0,e.createRef)(),M.mounted=!0,M.handleDocumentClick=M.handleDocumentClick.bind(g(M)),M.fireChangeEvent=M.fireChangeEvent.bind(g(M)),M}return h(S,[{key:"componentDidUpdate",value:function(M){if(this.props.value!==M.value)if(this.props.value){var D=this.parseValue(this.props.value,this.props.options);D!==this.state.selected&&this.setState({selected:D})}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(M){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(M.type==="mousedown"&&M.button!==0)&&(M.stopPropagation(),M.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(M,D){var $;if(typeof M=="string")for(var H=0,I=D.length;H"u"&&($=M.label||M);var H=M.label||M.value||M,I=$===this.state.selected.value||$===this.state.selected,v=(D={},c(D,"".concat(this.props.baseClassName,"-option"),!0),c(D,M.className,!!M.className),c(D,"is-selected",I),D),E=(0,t.default)(v),U=Object.keys(M.data||{}).reduce(function(P,L){return A({},P,c({},"data-".concat(L),M.data[L]))},{});return e.default.createElement("div",a({key:$,className:E,onMouseDown:this.setValue.bind(this,$,H),onClick:this.setValue.bind(this,$,H),role:"option","aria-selected":I?"true":"false"},U),H)}},{key:"buildMenu",value:function(){var M=this,D=this.props,$=D.options,H=D.baseClassName,I=$.map(function(v){if(v.type==="group"){var E=e.default.createElement("div",{className:"".concat(H,"-title")},v.name),U=v.items.map(function(P){return M.renderOption(P)});return e.default.createElement("div",{className:"".concat(H,"-group"),key:v.name,role:"listbox",tabIndex:"-1"},E,U)}else return M.renderOption(v)});return I.length?I:e.default.createElement("div",{className:"".concat(H,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(M){this.mounted&&(this.dropdownRef.current.contains(M.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,D,$,H,I,v=this.props,E=v.baseClassName,U=v.controlClassName,P=v.placeholderClassName,L=v.menuClassName,z=v.arrowClassName,K=v.arrowClosed,O=v.arrowOpen,B=v.className,W=this.props.disabled?"Dropdown-disabled":"",ee=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,F=(0,t.default)((M={},c(M,"".concat(E,"-root"),!0),c(M,B,!!B),c(M,"is-open",this.state.isOpen),M)),X=(0,t.default)((D={},c(D,"".concat(E,"-control"),!0),c(D,U,!!U),c(D,W,!!W),D)),ue=(0,t.default)(($={},c($,"".concat(E,"-placeholder"),!0),c($,P,!!P),c($,"is-selected",this.isValueSelected()),$)),le=(0,t.default)((H={},c(H,"".concat(E,"-menu"),!0),c(H,L,!!L),H)),oe=(0,t.default)((I={},c(I,"".concat(E,"-arrow"),!0),c(I,z,!!z),I)),re=e.default.createElement("div",{className:ue},ee),pe=this.state.isOpen?e.default.createElement("div",{className:le,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:F},e.default.createElement("div",{className:X,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},re,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},O&&K?this.state.isOpen?O:K:e.default.createElement("span",{className:oe}))),pe)}}]),S}(e.Component);x.defaultProps={baseClassName:"Dropdown"};var _=x;n.default=_})(hz);const Jl=bl(hz);function cLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=Y.useContext(or),[s,o]=ye.useState([]),[a,l]=ye.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 ye.useEffect(()=>{if((t==null?void 0:t.loras)!=null){const u=t.loras.map((f,h)=>({value:h,label:f.name,description:f.description,manifest:f.manifest}));o(u)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Lora Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Lora Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:s,onChange:A,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&k.jsx("div",{className:Ve.actionButton,onClick:c,children:k.jsx("div",{children:" Create Lora Data "})})]})]})})}function uLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=Y.useContext(or),[s,o]=ye.useState([]),[a,l]=ye.useState(""),[A,c]=ye.useState(null),u=h=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[h.value].description),c(t.sprites[h.value]))},f=async()=>{const h=i.parent;h.remove(i),await r.createSpriteAtlas(A),h.add(i)};return ye.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const h=t.sprites.map((p,d)=>({value:d,label:p.name,description:p.description,manifest:p.manifest}));o(h)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Sprite Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Sprite Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:a||""}),A!=null&&k.jsx("div",{className:Ve.actionButton,onClick:f,children:k.jsx("div",{children:" Create Sprite Data "})})]})]})})}const pO=4096;function fLe({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=Y.useContext(or),[o,a]=ye.useState([]),[l,A]=ye.useState(""),[c,u]=ye.useState(""),[f,h]=ye.useState(""),[p,d]=ye.useState(!1),[g,m]=ye.useState(512),[y,w]=ye.useState(512),[x,_]=ye.useState(.1),[C,S]=ye.useState(.1),[b,M]=ye.useState("center"),[D,$]=ye.useState("center"),[H,I]=ye.useState("center"),[v,E]=ye.useState("head"),[U,P]=ye.useState("chest"),[L,z]=ye.useState(!0),[K,O]=ye.useState(!1),B=[{label:"center"},{label:"left"},{label:"right"}],W=[{label:"center"},{label:"top"},{label:"bottom"}],ee=[{label:"center"},{label:"front"},{label:"back"}],F=[{label:"head"},{label:"neck"},{label:"chest"},{label:"spine"},{label:"hips"},{label:"upperLeg"},{label:"lowerLeg"},{label:"foot"}],X=Ae=>{(t==null?void 0:t.thumbnails)!=null&&(A(t.thumbnails[Ae.value].description),h(t.thumbnails[Ae.value].manifest),u(t.thumbnails[Ae.value].name))},ue=(Ae,q,J,ce)=>isNaN(Ae)?ce:Ae>J?J:Ae{const q=parseInt(Ae.target.value);m(ue(q,1,pO,512))},oe=Ae=>{const q=parseInt(Ae.target.value);w(ue(q,1,pO,512))},re=Ae=>{const q=parseFloat(Ae.target.value);_(ue(q,0,1,.1))},pe=Ae=>{const q=parseFloat(Ae.target.value);S(ue(q,0,1,.1))},_e=Ae=>{d(Ae)},Re=async()=>{const Ae=i.parent;Ae.remove(i),await r.createThumbnails(t.thumbnails[0]),Ae.add(i)},Q=(Ae=!0)=>({topFrameOffset:C,bottomFrameOffset:x,thumbnailsWidth:g,thumbnailsHeight:y,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:D+"-"+H+"-"+b,topBoneName:v==="upperLeg"||v==="lowerLeg"||v==="foot"?"left"+v[0].toUpperCase()+v.slice(1):v,topBoneMaxVertex:L,bottomBoneName:U==="upperLeg"||U==="lowerLeg"||v==="foot"?"left"+U[0].toUpperCase()+U.slice(1):U,bottomBoneMaxVertex:K,saveOnlyIDs:Ae?null:n.id}]}),de=async(Ae=!1)=>{s.storeCurrentAvatar();const q=i.parent;q.remove(i),Ae?await r.createThumbnailsWithObjectData(Q(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(Q(!1),!1),q.add(i),s.loadStoredAvatar()};return ye.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const Ae=t.thumbnails.map((q,J)=>({value:J,label:q.name,description:q.description,manifest:q.manifest}));a(Ae)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Thumbnail Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsxs("div",{className:Ve.tabHolder,children:[k.jsx("div",{className:Ve.tabButton+(p?"":" "+Ve.tabButtonSelected),onClick:()=>{_e(!1)},children:k.jsxs("div",{children:[" ","Custom"," "]})}),k.jsx("div",{className:Ve.tabButton+(p?" "+Ve.tabButtonSelected:""),onClick:()=>{_e(!0)},children:k.jsxs("div",{children:[" ","Manifest"," "]})})]}),k.jsx("br",{}),p?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,children:"Thumbnail Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:o,value:c,onChange:X,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:l||""}),f!=""&&k.jsx("div",{className:Ve.actionButton,onClick:Re,children:k.jsx("div",{children:" Create Thumbnails "})})]}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Ve.traitInfoText,children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",k.jsx("input",{value:g,className:Ve["input-box"],step:1,onChange:Ae=>{m(Ae.target.value)},onBlur:le}),k.jsx("br",{}),"Height ",k.jsx("input",{value:y,className:Ve["input-box"],step:1,onChange:Ae=>{w(Ae.target.value)},onBlur:oe}),k.jsx("br",{}),"Top Spacing ",k.jsx("input",{value:x,className:Ve["input-box"],step:.1,onChange:Ae=>{_(Ae.target.value)},onBlur:re}),k.jsx("br",{}),"Bottom Spacing ",k.jsx("input",{value:C,className:Ve["input-box"],step:.1,onChange:Ae=>{S(Ae.target.value)},onBlur:pe}),k.jsx("br",{}),k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"X"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:B,onChange:Ae=>{$(Ae.label)},value:D})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Y"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:W,onChange:Ae=>{I(Ae.label)},value:H})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Z"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:ee,onChange:Ae=>{M(Ae.label)},value:b})]}),k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),k.jsxs("div",{className:Ve.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Top"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:F,onChange:Ae=>{E(Ae.label)},value:v})]}),k.jsxs("div",{className:Ve.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:F,onChange:Ae=>{P(Ae.label)},value:U})]}),k.jsxs("div",{style:{textAlign:"left"},children:[k.jsxs("div",{className:Ve.checkboxFlex,style:{marginTop:"20px"},children:[k.jsx("input",{type:"checkbox",checked:L,onChange:Ae=>{z(Ae.target.checked)}}),k.jsx("div",{className:Ve.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${L?"uses Top":"uses Low"} Vertex`})]}),k.jsxs("div",{className:Ve.checkboxFlex,style:{marginTop:"10px"},children:[k.jsx("input",{type:"checkbox",checked:K,onChange:Ae=>{O(Ae.target.checked)}}),k.jsx("div",{className:Ve.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${K?"uses Top":"uses Low"} Vertex`})]})]}),e==""?k.jsx("div",{className:Ve.traitInfoText+" "+Ve.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{marginTop:"20px"},children:"Generate"}),k.jsx("div",{className:Ve.traitInfoText+" "+Ve.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),k.jsxs("div",{className:Ve.simpleFlex,style:{marginTop:"0px"},children:[k.jsx("div",{className:Ve.actionButton,style:{margin:"0px"},onClick:()=>{de(!1)},children:k.jsx("div",{children:" Current "})}),k.jsx("div",{className:Ve.actionButton,style:{margin:"0px"},onClick:()=>{de(!0)},children:k.jsx("div",{children:" All "})})]})]})]})]})]})})}function hLe({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=Y.useState(""),s=o=>{o!=r?i(o):i("")};return k.jsxs("div",{children:[r=="Information"&&k.jsx(ALe,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&k.jsx(cLe,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&k.jsx(uLe,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&k.jsx(fLe,{selectedTrait:n,traitGroupName:t}),k.jsxs("div",{className:TB.InformationContainerPos,children:[k.jsx(wa,{title:"Tools",width:90,right:0}),k.jsx("div",{className:TB.scrollContainer,children:k.jsxs("div",{className:TB.optionsContainer,children:[k.jsx("div",{onClick:()=>{s("Information")},children:k.jsx(pA,{size:56,icon:NUe,rarity:r=="Information"?"mythic":"none"})},"Information"),k.jsx("div",{onClick:()=>{s("LoraCreation")},children:k.jsx(pA,{size:56,icon:QUe,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),k.jsx("div",{onClick:()=>{s("SpriteCreation")},children:k.jsx(pA,{size:56,icon:kUe,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),k.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:k.jsx(pA,{size:56,icon:HUe,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}function dLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:A,sceneElements:c}=Y.useContext(or),{playSound:u}=Y.useContext(Ys),{isMute:f}=Y.useContext($s),{t:h}=ye.useContext(To),p=()=>{!f&&u("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(dt.CREATE),r(!1)},[d,g]=Y.useState(null),[m,y]=Y.useState(null),[w,x]=Y.useState(""),[_,C]=Y.useState(null),[S,b]=Y.useState(null),[M,D]=Y.useState(""),[$,H]=Y.useState(!1),[I,v]=Y.useState({background:"#ffffff"}),E=()=>{!f&&u("backNextButton"),e(dt.SAVE),r(!1)},U=()=>{t(!0),g(null),i.loadRandomTraits().then(()=>{console.log("success"),w!=""&&C(i.getCurrentTraitData(w)),t(!1)}).catch(oe=>{t(!1),console.error("Error loading random traits:",oe.message)})},P=oe=>{v({background:oe.hex})},L=oe=>{v({background:oe.hex}),i.setTraitColor(w,oe.hex)},z=async oe=>{const re=ul(oe.name),pe=URL.createObjectURL(oe);await s.loadAnimation(pe,!1,0,!0,"",re),D(s.getCurrentAnimationName())},K=oe=>{if(H(!1),w!=""){t(!0);const re=URL.createObjectURL(oe);i.loadCustomTexture(w,re).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},O=oe=>{if(H(!1),w!=""){t(!0);const re=URL.createObjectURL(oe);i.loadCustomTrait(w,re).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},B=oe=>{H(!1),t(!0),i.loadTrait(oe.traitGroup.trait,oe.id).then(()=>{t(!1),C(oe)})},W=oe=>{H(!1),i.removeTrait(oe),C(null)},ee=oe=>{H(!1),t(!0),i.loadRandomTrait(oe).then(()=>{t(!1),C(i.getCurrentTraitData(oe))})},F=oe=>{H(!1);const re=Array.from(oe),pe=[],_e=Re=>new Promise((Q,de)=>{var Ae;if(Re&&Re.name.toLowerCase().endsWith(".json")){const q=new FileReader,J=`${(Ae=i.manifestData)==null?void 0:Ae.getAssetsDirectory()}/anata/_thumbnails/t_${Re.name.split("_")[0]}.jpg`;console.log(J),q.onload=function(ce){try{const xe=JSON.parse(ce.target.result);xe.thumb=J,pe.push(xe),Q()}catch(xe){console.error("Error parsing the JSON file:",xe),de(xe)}},q.readAsText(Re)}});Promise.all(re.map(_e)).then(()=>{pe.length>0&&(g(pe),t(!0),i.loadTraitsFromNFTObject(pe[0]).then(()=>{t(!1)}))}).catch(Re=>{console.error("Error processing files:",Re)})},X=async oe=>{const re=oe[0];re&&re.name.toLowerCase().endsWith(".fbx")&&z(re),re&&(re.name.toLowerCase().endsWith(".png")||re.name.toLowerCase().endsWith(".jpg"))&&K(re),re&&re.name.toLowerCase().endsWith(".vrm")&&O(re),re&&re.name.toLowerCase().endsWith(".json")&&F(oe)},ue=oe=>{!f&&u("optionClick"),H(!1),w!==oe.trait?(y(i.getTraits(oe.trait)),x(oe.trait),C(i.getCurrentTraitData(oe.trait)),b(i.getCurrentTraitVRM(oe.trait)),o({targetY:oe.cameraTarget.height,distance:oe.cameraTarget.distance})):(y(null),x(""),C(null),o({targetY:.8,distance:3.2}))},le=()=>{H(!1);var oe=document.createElement("input");oe.type="file",oe.accept=".vrm",oe.onchange=re=>{var pe=re.target.files[0];if(pe.name.endsWith(".vrm")){const _e=URL.createObjectURL(pe);t(!0),i.loadCustomTrait(w,_e).then(()=>{t(!1)})}},oe.click()};return k.jsxs("div",{className:Ln.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:h("pageTitles.chooseAppearance")}),k.jsx(Cg,{onFilesDrop:X}),k.jsxs("div",{className:Ln.sideMenu,children:[k.jsx(wa,{title:"Appearance",left:20}),k.jsx("div",{className:Ln.bottomLine}),k.jsx("div",{className:Ln.scrollContainer,children:k.jsx("div",{className:Ln["editor-container"],children:i.getGroupTraits().map((oe,re)=>k.jsxs("div",{className:Ln.editorButton,onClick:()=>{ue(oe)},children:[k.jsx(pA,{size:56,icon:oe.fullIconSvg,rarity:w!==oe.trait?"none":"mythic"}),k.jsx("div",{className:Ln.editorText,children:oe.name})]},"options_"+re))})})]}),!!m&&k.jsxs("div",{className:Ln.selectorContainerPos,children:[k.jsx(wa,{title:w,width:130,left:20}),_&&k.jsx("div",{className:Ln.selectorColorPickerButton,onClick:()=>{H(!$)},children:k.jsx("img",{className:Ln.selectorColorPickerImg,src:jme})}),!!$&&k.jsx("div",{draggable:!1,className:Ln.selectorColorPickerUI,children:k.jsx(lUe,{draggable:!1,width:"200px",color:I.background,onChange:P,onChangeComplete:L})}),k.jsx("div",{className:Ln.bottomLine}),k.jsx("div",{className:Ln.scrollContainerOptions,children:k.jsxs("div",{className:Ln["selector-container"],children:[k.jsx("div",{className:`${Ln.selectorButton}`,onClick:()=>{ee(w)},children:k.jsx(pA,{size:56,icon:Vme,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(w)?k.jsx(k.Fragment,{}):k.jsx("div",{className:`${Ln.selectorButton}`,icon:UP,onClick:()=>{W(w)},children:k.jsx(pA,{size:56,icon:UP,rarity:_==null?"mythic":"none"})},"no-trait"),m.map(oe=>{let re=oe.id===(_==null?void 0:_.id);return k.jsx("div",{className:`${Ln.selectorButton}`,onClick:()=>{B(oe)},children:k.jsx(pA,{size:56,icon:oe.fullThumbnail,rarity:re?"mythic":"none"})},oe.id)})]})}),k.jsx("div",{className:Ln.uploadContainer,children:k.jsx("div",{className:Ln.uploadButton,onClick:le,children:k.jsx("div",{children:"Upload "})})})]}),k.jsx(ST,{jsonSelectionArray:d}),k.jsx(hLe,{selectedTrait:_,selectedVRM:S,traitGroupName:w}),k.jsx(a_,{loadedAnimationName:M,randomize:U}),k.jsxs("div",{className:Ln.buttonContainer,children:[k.jsx(_n,{theme:"light",text:h("callToAction.back"),size:14,className:Ln.buttonLeft,onClick:p}),i.canDownload()&&k.jsx(_n,{theme:"light",text:h("callToAction.next"),size:14,className:Ln.buttonRight,onClick:E})]})]})}const pLe="_InformationContainerPos_rgqwy_1",mLe="_traitInfoTitle_rgqwy_13",gLe="_traitInfoText_rgqwy_21",vLe="_flexSelect_rgqwy_30",yLe="_scrollContainer_rgqwy_65",wLe="_checked_rgqwy_90",xLe="_checkmark_rgqwy_94",_Le="_checkboxHolder_rgqwy_107",bLe="_buttonContainer_rgqwy_114",BLe="_buttonLeft_rgqwy_123",ELe="_buttonRight_rgqwy_127",CLe="_buttonCenter_rgqwy_131",ci={InformationContainerPos:pLe,traitInfoTitle:mLe,traitInfoText:gLe,flexSelect:vLe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:yLe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:wLe,checkmark:xLe,checkboxHolder:_Le,buttonContainer:bLe,buttonLeft:BLe,buttonRight:ELe,buttonCenter:CLe},SLe="_InformationContainerPos_11mqa_2",MLe="_scrollContainer_11mqa_16",TLe="_traitInfoTitle_11mqa_28",ILe="_traitInfoText_11mqa_38",RLe="_flexSelect_11mqa_66",FLe="_checked_11mqa_124",ULe="_checkmark_11mqa_128",LLe="_checkboxHolder_11mqa_141",Gn={InformationContainerPos:SLe,scrollContainer:MLe,traitInfoTitle:TLe,traitInfoText:ILe,"input-box":"_input-box_11mqa_47",flexSelect:RLe,"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:FLe,checkmark:ULe,checkboxHolder:LLe};function y2({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=Y.useContext(or),[a,l]=ye.useState(0),[A,c]=ye.useState(0),[u,f]=ye.useState(0),[h,p]=ye.useState(0),[d,g]=ye.useState(0),[m,y]=ye.useState(0),[w,x]=ye.useState(0),[_,C]=ye.useState(0),[S,b]=ye.useState(0),[M,D]=ye.useState(0);return ye.useEffect(()=>{if(n!=null){const $=zh(n,"Mesh"),H=zh(n,"SkinnedMesh");l($.length),c(H.length);const I=$.concat(H),{stdMats:v,stdCutoutpMats:E,stdTranspMats:U,mToonMats:P,mToonCutoutMats:L,mToonTranspMats:z}=Oue(I);f(v.length),p(U.length),g(E.length),y(P.length),x(z.length),C(L.length);const{triangles:K,bones:O}=o.getBoneTriangleCount();b(K),D(O)}},[n]),n!=null?k.jsx("div",{children:k.jsxs("div",{className:Gn.InformationContainerPos,children:[k.jsx(wa,{title:"Model Information",width:180,right:20}),k.jsxs("div",{className:Gn.scrollContainer,children:[k.jsxs("div",{className:Gn.flexSelect,children:[(t==null?void 0:t.length)>1?k.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["left-button"]}`,onClick:s}):k.jsx(k.Fragment,{}),e&&k.jsx("div",{style:{textAlign:"center"},children:k.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?k.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["right-button"]}`,onClick:i}):k.jsx(k.Fragment,{})]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"Geometry info:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["Meshes: ",a]}),k.jsxs("div",{className:Gn.traitInfoText,children:["SkinnedMeshes: ",A]}),k.jsxs("div",{className:Gn.traitInfoText,children:["Triangles: ",S]}),k.jsxs("div",{className:Gn.traitInfoText,children:["Bones: ",M]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"Standard Material Count:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",u]}),k.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",d]}),k.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",h]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"MToon Material Count:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",m]}),k.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",_]}),k.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",w]})]})]})}):k.jsx(k.Fragment,{})}const PLe="_InformationContainerPos_b0msk_1",DLe="_traitInfoTitle_b0msk_13",OLe="_traitInfoText_b0msk_22",NLe="_flexSelect_b0msk_33",kLe="_scrollContainer_b0msk_68",QLe="_checked_b0msk_93",HLe="_checkmark_b0msk_97",zLe="_checkboxHolder_b0msk_110",lt={InformationContainerPos:PLe,traitInfoTitle:DLe,traitInfoText:OLe,flexSelect:NLe,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:kLe,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:QLe,checkmark:HLe,checkboxHolder:zLe};function B_({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=ye.useState(Oe.mergeOptions_atlas_std_size||6),[s,o]=ye.useState(Oe.mergeOptions_atlas_std_transp_size||6),[a,l]=ye.useState(Oe.mergeOptions_atlas_mtoon_size||6),[A,c]=ye.useState(Oe.mergeOptions_atlas_mtoon_transp_size||6),[u,f]=ye.useState(Oe.mergeOptions_sel_option||0),[h,p]=ye.useState(Oe.mergeOptions_two_sided_mat||!1),[d]=ye.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,m]=ye.useState(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm),[y,w]=ye.useState(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview),[x,_]=ye.useState(Oe.mergeOptions_drop_download||!1),[C,S]=ye.useState(Oe.merge_options_ktx_compression||!1),[b,M]=ye.useState(Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas),[D,$]=ye.useState(Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora),[H,I]=ye.useState(Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites),v=F=>{_(F.target.checked),Oe.mergeOptions_drop_download=F.target.checked},E=F=>{p(F.target.checked),Oe.mergeOptions_two_sided_mat=F.target.checked},U=F=>{S(F.target.checked),Oe.merge_options_ktx_compression=F.target.checked},P=F=>{M(F.target.checked),Oe.mergeOptions_create_atlas=F.target.checked},L=F=>{m(F.target.checked),Oe.mergeOptions_download_vrm=F.target.checked},z=F=>{w(F.target.checked),Oe.mergeOptions_download_vrm_preview=F.target.checked},K=F=>{$(F.target.checked),Oe.mergeOptions_download_lora=F.target.checked},O=F=>{I(F.target.checked),Oe.mergeOptions_download_sprites=F.target.checked},B=()=>{let F=u;u<=0?F=d.length-1:F-=1,f(F),Oe.mergeOptions_sel_option=F},W=()=>{let F=u;u>=d.length-1?F=0:F+=1,f(F),Oe.mergeOptions_sel_option=F},ee=async(F,X)=>{let ue=parseInt(F.target.value);ue>8?ue=8:ue<0&&(ue=0),(oe=>{switch(X){case"standard opaque":i(oe),Oe.mergeOptions_atlas_std_size=oe;break;case"standard transparent":o(oe),Oe.mergeOptions_atlas_std_transp_size=oe;break;case"mtoon opaque":l(oe),Oe.mergeOptions_atlas_mtoon_size=oe;break;case"mtoon transparent":c(oe),Oe.mergeOptions_atlas_mtoon_transp_size=oe;break}})(ue)};return k.jsxs("div",{className:lt.InformationContainerPos,children:[k.jsx(wa,{title:t,width:180,left:20}),k.jsxs("div",{className:lt.scrollContainer,children:[k.jsx("div",{className:lt.traitInfoTitle,children:"Download Options"}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:g,onChange:L}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:y,onChange:z}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM Preview"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:D,onChange:K}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Lora Data"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:H,onChange:O}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Sprites Data"]})})}),g&&k.jsxs(k.Fragment,{children:[e&&k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:b,onChange:P}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Create Atlas"]})})}),(e==!1||b)&&k.jsxs(k.Fragment,{children:[k.jsx("br",{}),k.jsx("div",{className:lt.traitInfoTitle,children:"Merge Atlas Type"}),k.jsx("br",{}),k.jsxs("div",{className:lt.flexSelect,children:[k.jsx("div",{className:`${lt["arrow-button"]} ${lt["left-button"]}`,onClick:B}),k.jsx("div",{className:lt.traitInfoText,style:{marginBottom:"0"},children:d[u]}),k.jsx("div",{className:`${lt["arrow-button"]} ${lt["right-button"]}`,onClick:W})]}),k.jsx("br",{}),k.jsx("br",{}),(u===0||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:lt.traitInfoTitle,children:"Standard Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Opaque: ",vn(r)+" x "+vn(r)]}),k.jsx($f,{value:r,onChange:F=>ee(F,"standard opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Transparent: ",vn(s)+" x "+vn(s)]}),k.jsx($f,{value:s,onChange:F=>ee(F,"standard transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),(u===1||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:lt.traitInfoTitle,children:"MToon Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Opaque: ",vn(a)+" x "+vn(a)]}),k.jsx($f,{value:a,onChange:F=>ee(F,"mtoon opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Transparent: ",vn(A)+" x "+vn(A)]}),k.jsx($f,{value:A,onChange:F=>ee(F,"mtoon transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),k.jsx("div",{className:lt.traitInfoTitle,children:"Options"}),k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:h,onChange:E}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Two Sided Material"]})}),n&&k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:x,onChange:v}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Drag Drop - Download"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:C,onChange:U}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function GLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=Y.useContext(or),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=Y.useState(""),{playSound:g}=Y.useContext(Ys),{isMute:m}=Y.useContext($s),[y,w]=Y.useState(null),x=()=>{!m&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(dt.LANDING)},_=()=>{const I=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:I===0||I==2,exportMtoonAtlas:I===1||I==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=(I,v=!1)=>{console.log(v),(async()=>{await s.loadTraitsFromNFTObject(y[I]),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await s.downloadVRM(y[I].name,_());const P=new ad,L=A.parent;L.remove(A);const z=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(z===!0){const O=r.loras.map(async B=>a.createLoraData(B,P));await Promise.all(O)}const K=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(K===!0){const O=r.sprites.map(async B=>l.createSpriteAtlas(B,P));await Promise.all(O)}(z===!0||K===!0)&&P.saveZip(y[I].name),L.add(A),I{t(!0),C(0,!0)},{t:b}=ye.useContext(To),M=async I=>{if(s.getCurrentCharacterModel()){const E=ul(I.name),U=URL.createObjectURL(I);await o.loadAnimation(U,!1,0,!0,"",E),d(o.getCurrentAnimationName()),URL.revokeObjectURL(U)}else console.warn("Please load a vrm model to test animations.")},D=async I=>{const v=URL.createObjectURL(I);await s.loadOptimizerCharacter(v),URL.revokeObjectURL(v);const E=ul(I.name);h(E),u(s.getCurrentCharacterModel())},$=I=>{const v=Array.from(I),E=[],U=P=>new Promise((L,z)=>{var K;if(P&&P.name.toLowerCase().endsWith(".json")){const O=new FileReader,B=`${(K=s.manifestData)==null?void 0:K.getAssetsDirectory()}/anata/_thumbnails/t_${P.name.split("_")[0]}.jpg`;O.onload=function(W){try{const ee=JSON.parse(W.target.result);ee.thumb=B,E.push(ee),L()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},O.readAsText(P)}});Promise.all(v.map(U)).then(()=>{E.length>0&&(w(E),t(!0),s.loadTraitsFromNFTObject(E[0]).then(()=>{t(!1)}))}).catch(P=>{console.error("Error processing files:",P)})},H=async I=>{const v=I[0];console.log("anim"),v&&v.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),M(v)),v&&v.name.toLowerCase().endsWith(".vrm")&&D(v),v&&v.name.toLowerCase().endsWith(".json")&&$(I)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Batch Download"}),k.jsx(Cg,{onFilesDrop:H}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(y2,{model:c}),k.jsx(ST,{jsonSelectionArray:y}),k.jsx(a_,{loadedAnimationName:p}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:b("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(y==null?void 0:y.length)==1&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:S}),(y==null?void 0:y.length)>1&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:S})]})]})}const Dg="abi/5.7.0",Dt=new ve(Dg),Jc={};let mO={calldata:!0,memory:!0,storage:!0},VLe={calldata:!0,memory:!0};function Rv(n,e){if(n==="bytes"||n==="string"){if(mO[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&VLe[e])return!0;return(mO[e]||e==="payable")&&Dt.throwArgumentError("invalid modifier","name",e),!1}function jLe(n,e){let t=n;function r(a){Dt.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!==Gt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Gt.full?", ":",")+")"):t+=this.type,e!==Gt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Gt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?_r.fromString(e,t):_r.fromObject(e)}static fromObject(e){return _r.isParamType(e)?e:new _r(Jc,{name:e.name||null,type:_f(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(_r.fromObject):null})}static fromString(e,t){function r(i){return _r.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(jLe(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function eg(n,e){return $Le(n).map(t=>_r.fromString(t,e))}class ol{constructor(e,t){e!==Jc&&Dt.throwError("use a static from method",ve.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),wy(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return ol.isFragment(e)?e:typeof e=="string"?ol.fromString(e):ol.fromObject(e)}static fromObject(e){if(ol.isFragment(e))return e;switch(e.type){case"function":return ea.fromObject(e);case"event":return el.fromObject(e);case"constructor":return qo.fromObject(e);case"error":return rA.fromObject(e);case"fallback":case"receive":return null}return Dt.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"?el.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?ea.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?qo.fromString(e.trim()):e.split(" ")[0]==="error"?rA.fromString(e.substring(5).trim()):Dt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class el extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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!==Gt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",e!==Gt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?el.fromString(e):el.fromObject(e)}static fromObject(e){if(el.isEventFragment(e))return e;e.type!=="event"&&Dt.throwArgumentError("invalid event object","value",e);const t={name:tg(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(_r.fromObject):[],type:"event"};return new el(Jc,t)}static fromString(e){let t=e.match(ng);t||Dt.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:Dt.warn("unknown modifier: "+i)}}),el.fromObject({name:t[1].trim(),anonymous:r,inputs:eg(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function dz(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&Dt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||Dt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ge.from(t[1]),t[0]):n}function pz(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 mz(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&&Dt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&Dt.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"&&Dt.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&&Dt.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"&&Dt.throwArgumentError("unable to determine stateMutability","value",n),e}class qo extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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===Gt.sighash&&Dt.throwError("cannot format a constructor for sighash",ve.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?qo.fromString(e):qo.fromObject(e)}static fromObject(e){if(qo.isConstructorFragment(e))return e;e.type!=="constructor"&&Dt.throwArgumentError("invalid constructor object","value",e);let t=mz(e);t.constant&&Dt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(_r.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new qo(Jc,r)}static fromString(e){let t={type:"constructor"};e=dz(e,t);let r=e.match(ng);return(!r||r[1].trim()!=="constructor")&&Dt.throwArgumentError("invalid constructor string","value",e),t.inputs=eg(r[2].trim(),!1),pz(r[3].trim(),t),qo.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class ea extends qo{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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!==Gt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",e!==Gt.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"?ea.fromString(e):ea.fromObject(e)}static fromObject(e){if(ea.isFunctionFragment(e))return e;e.type!=="function"&&Dt.throwArgumentError("invalid function object","value",e);let t=mz(e);const r={type:e.type,name:tg(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(_r.fromObject):[],outputs:e.outputs?e.outputs.map(_r.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new ea(Jc,r)}static fromString(e){let t={type:"function"};e=dz(e,t);let r=e.split(" returns ");r.length>2&&Dt.throwArgumentError("invalid function string","value",e);let i=r[0].match(ng);if(i||Dt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&tg(t.name),t.inputs=eg(i[2],!1),pz(i[3].trim(),t),r.length>1){let s=r[1].match(ng);(s[1].trim()!=""||s[3].trim()!="")&&Dt.throwArgumentError("unexpected tokens","value",e),t.outputs=eg(s[2],!1)}else t.outputs=[];return ea.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function gO(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Dt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class rA extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Gt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?rA.fromString(e):rA.fromObject(e)}static fromObject(e){if(rA.isErrorFragment(e))return e;e.type!=="error"&&Dt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:tg(e.name),inputs:e.inputs?e.inputs.map(_r.fromObject):[]};return gO(new rA(Jc,t))}static fromString(e){let t={type:"error"},r=e.match(ng);return r||Dt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&tg(t.name),t.inputs=eg(r[2],!1),gO(rA.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function _f(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const KLe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tg(n){return(!n||!n.match(KLe))&&Dt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const ng=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function $Le(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&w2.throwError("value out-of-bounds",ve.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Zi([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 nx{constructor(e,t,r,i){Ue(this,"_data",at(e)),Ue(this,"wordSize",t||32),Ue(this,"_coerceFunc",r),Ue(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):nx.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:w2.throwError("data out-of-bounds",ve.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new nx(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 XLe extends Il{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Dr(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return Dr(kn(e.readValue().toHexString(),20))}}class ZLe extends Il{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 Yf=new ve(Dg);function gz(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||Yf.throwError("cannot encode object for signature with missing names",ve.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]&&Yf.throwError("cannot encode object for signature with duplicate names",ve.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]=!0,t[c]})}else Yf.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Yf.throwArgumentError("types/value length mismatch","tuple",t);let i=new pS(n.wordSize),s=new pS(n.wordSize),o=[];e.forEach((l,A)=>{let c=r[A];if(l.dynamic){let u=s.length;l.encode(s,c);let f=i.writeUpdatableValue();o.push(h=>{f(h+u)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function vz(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===ve.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===ve.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 JLe extends Il{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&&Yf.throwError("insufficient data length",ve.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 gz(e,this.coders,t)}decode(e){return e.coerce(this.name,vz(e,this.coders))}}const Uv=new ve(Dg),s3e=new RegExp(/^bytes([0-9]*)$/),o3e=new RegExp(/^(u?int)([0-9]*)$/);class a3e{constructor(e){Ue(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new XLe(e.name);case"bool":return new qLe(e.name);case"string":return new i3e(e.name);case"bytes":return new e3e(e.name);case"array":return new JLe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Fv((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new n3e(e.name)}let t=e.type.match(o3e);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Uv.throwArgumentError("invalid "+t[1]+" bit length","param",e),new r3e(r/8,t[1]==="int",e.name)}if(t=e.type.match(s3e),t){let r=parseInt(t[1]);return(r===0||r>32)&&Uv.throwArgumentError("invalid bytes length","param",e),new t3e(r,e.name)}return Uv.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new nx(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new pS(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(_r.from(i)));return new Fv(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Uv.throwError("types/values length mismatch",ve.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(_r.from(o))),i=new Fv(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(_r.from(o)));return new Fv(i,"_").decode(this._getReader(at(t),r))}}const l3e=new a3e,bn=new ve(Dg);class A3e extends og{}class c3e extends og{}class u3e extends og{}class mS extends og{static isIndexed(e){return!!(e&&e._isIndexed)}}const f3e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function vO(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class yO{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Ue(this,"fragments",t.map(r=>ol.from(r)).filter(r=>r!=null)),Ue(this,"_abiCoder",Ji(new.target,"getAbiCoder")()),Ue(this,"functions",{}),Ue(this,"errors",{}),Ue(this,"events",{}),Ue(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){bn.warn("duplicate definition - constructor");return}Ue(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]){bn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Ue(this,"deploy",qo.from({payable:!1,type:"constructor"})),Ue(this,"_isInterface",!0)}format(e){e||(e=Gt.full),e===Gt.sighash&&bn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Gt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return l3e}static getAddress(e){return Dr(e)}static getSighash(e){return zr(bf(e.format()),0,4)}static getEventTopic(e){return bf(e.format())}getFunction(e){if(Et(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];bn.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?bn.throwArgumentError("no matching function","name",r):i.length>1&&bn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[ea.fromString(e).format()];return t||bn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Et(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];bn.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?bn.throwArgumentError("no matching event","name",r):i.length>1&&bn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[el.fromString(e).format()];return t||bn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Et(e)){const r=Ji(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}bn.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?bn.throwArgumentError("no matching error","name",r):i.length>1&&bn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[ea.fromString(e).format()];return t||bn.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 Ji(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),Ji(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)&&bn.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(Zi([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)&&bn.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(Zi([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=f3e[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 bn.throwError("call revert exception"+s,ve.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&&bn.throwError("too many arguments for "+e.format(),ve.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?bf(o):s.type==="bytes"?rr(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]),kn(nt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&bn.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"?bn.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&&bn.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(bf(l));else if(o.type==="bytes")r.push(rr(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 f=this.getEventTopic(e);(!Et(r[0],32)||r[0].toLowerCase()!==f)&&bn.throwError("fragment/topic mismatch",ve.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:f,value:r[0]}),r=r.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((f,h)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(i.push(_r.fromObject({type:"bytes32",name:f.name})),o.push(!0)):(i.push(f),o.push(!1)):(s.push(f),o.push(!1))});let a=r!=null?this._abiCoder.decode(i,Zi(r)):null,l=this._abiCoder.decode(s,t,!0),A=[],c=0,u=0;e.inputs.forEach((f,h)=>{if(f.indexed)if(a==null)A[h]=new mS({_isIndexed:!0,hash:null});else if(o[h])A[h]=new mS({_isIndexed:!0,hash:a[u++]});else try{A[h]=a[u++]}catch(p){A[h]=p}else try{A[h]=l[c++]}catch(p){A[h]=p}if(f.name&&A[f.name]==null){const p=A[h];p instanceof Error?Object.defineProperty(A,f.name,{enumerable:!0,get:()=>{throw vO(`property ${JSON.stringify(f.name)}`,p)}}):A[f.name]=p}});for(let f=0;f{throw vO(`index ${f}`,h)}})}return Object.freeze(A)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new c3e({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 A3e({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 u3e({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 h3e="contracts/5.7.0";var qc=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 Wn=new ve(h3e);function rx(n,e){return qc(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&Wn.throwArgumentError("invalid address or ENS name","name",t);try{return Dr(t)}catch{}n||Wn.throwError("a provider or signer is needed to resolve ENS names",ve.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&Wn.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function xy(n,e,t){return qc(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>xy(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield rx(n,e):t.type==="tuple"?yield xy(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>xy(n,r,t.arrayChildren))):Promise.reject(Wn.makeError("invalid value for array",ve.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function E_(n,e,t){return qc(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=wn(t.pop())),Wn.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=qn({override:rx(n.signer,r.from),signer:n.signer.getAddress()}).then(A=>qc(this,void 0,void 0,function*(){return Dr(A.signer)!==A.override&&Wn.throwError("Contract with a Signer cannot override from",ve.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),A.override})):r.from=n.signer.getAddress():r.from&&(r.from=rx(n.provider,r.from));const i=yield qn({args:xy(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=tu(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&&Wn.throwError(`cannot override ${l.map(A=>JSON.stringify(A)).join(",")}`,ve.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function d3e(n,e){return function(...t){return E_(n,e,t)}}function p3e(n,e){const t=n.signer||n.provider;return function(...r){return qc(this,void 0,void 0,function*(){t||Wn.throwError("estimate require a provider or signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield E_(n,e,r);return yield t.estimateGas(i)})}}function m3e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=ts(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 wz(n,e,t){const r=n.signer||n.provider;return function(...i){return qc(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=wn(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 E_(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===ve.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function g3e(n,e){return function(...t){return qc(this,void 0,void 0,function*(){n.signer||Wn.throwError("sending a transaction requires a signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield E_(n,e,t),i=yield n.signer.sendTransaction(r);return m3e(n,i),i})}}function wO(n,e,t){return e.constant?wz(n,e,t):g3e(n,e)}function xz(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 rg{constructor(e,t){Ue(this,"tag",e),Ue(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 v3e extends rg{constructor(){super("error",null)}}class xO extends rg{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&Wn.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(xz(s),s),Ue(this,"address",e),Ue(this,"interface",t),Ue(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=YLe(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class _O extends rg{constructor(e,t){super("*",{address:e}),Ue(this,"address",e),Ue(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 y3e{constructor(e,t,r){Ue(this,"interface",Ji(new.target,"getInterface")(t)),r==null?(Ue(this,"provider",null),Ue(this,"signer",null)):cg.isSigner(r)?(Ue(this,"provider",r.provider||null),Ue(this,"signer",r)):ag.isProvider(r)?(Ue(this,"provider",r),Ue(this,"signer",null)):Wn.throwArgumentError("invalid signer or provider","signerOrProvider",r),Ue(this,"callStatic",{}),Ue(this,"estimateGas",{}),Ue(this,"functions",{}),Ue(this,"populateTransaction",{}),Ue(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Ue(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?Ue(this.filters,a,this.filters[l[0]]):Wn.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Ue(this,"_runningEvents",{}),Ue(this,"_wrappedEmits",{}),e==null&&Wn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ue(this,"address",e),this.provider)Ue(this,"resolvedAddress",rx(this.provider,e));else try{Ue(this,"resolvedAddress",Promise.resolve(Dr(e)))}catch{Wn.throwError("provider is required to use ENS name as contract address",ve.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]){Wn.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&&Ue(this,o,wO(this,a,!0)),this.functions[o]==null&&Ue(this.functions,o,wO(this,a,!1)),this.callStatic[o]==null&&Ue(this.callStatic,o,wz(this,a,!0)),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,d3e(this,a)),this.estimateGas[o]==null&&Ue(this.estimateGas,o,p3e(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&&Ue(this,o,this[l])}catch{}this.functions[o]==null&&Ue(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Ue(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Ue(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return pN(e)}static getInterface(e){return yO.isInterface(e)?e:new yO(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"&&Wn.throwError("contract not deployed",ve.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||Wn.throwError("sending a transactions require a signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=wn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&Wn.throwError("cannot override "+r,ve.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new OS(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Ue(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return mS.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 v3e);if(e==="event")return this._normalizeRunningEvent(new rg("event",null));if(e==="*")return this._normalizeRunningEvent(new _O(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new xO(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 xO(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new rg(xz(t),t))}return this._normalizeRunningEvent(new _O(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=ts(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||Wn.throwError("events require a provider or a signer with a provider",ve.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=wn(i.filter);return typeof t=="string"&&Et(t,32)?(r!=null&&Wn.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 C_ extends y3e{}const w3e="0x543D43F390b7d681513045e8a85707438c463d80",ix={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"}]},bO={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"}]};function _z(n,e){return function(){return n.apply(e,arguments)}}const{toString:x3e}=Object.prototype,{getPrototypeOf:x2}=Object,S_=(n=>e=>{const t=x3e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Sa=n=>(n=n.toLowerCase(),e=>S_(e)===n),M_=n=>e=>typeof e===n,{isArray:vd}=Array,ig=M_("undefined");function _3e(n){return n!==null&&!ig(n)&&n.constructor!==null&&!ig(n.constructor)&&Qs(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const bz=Sa("ArrayBuffer");function b3e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&bz(n.buffer),e}const B3e=M_("string"),Qs=M_("function"),Bz=M_("number"),T_=n=>n!==null&&typeof n=="object",E3e=n=>n===!0||n===!1,_y=n=>{if(S_(n)!=="object")return!1;const e=x2(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},C3e=Sa("Date"),S3e=Sa("File"),M3e=Sa("Blob"),T3e=Sa("FileList"),I3e=n=>T_(n)&&Qs(n.pipe),R3e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Qs(n.append)&&((e=S_(n))==="formdata"||e==="object"&&Qs(n.toString)&&n.toString()==="[object FormData]"))},F3e=Sa("URLSearchParams"),U3e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Og(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),vd(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const Cz=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Sz=n=>!ig(n)&&n!==Cz;function gS(){const{caseless:n}=Sz(this)&&this||{},e={},t=(r,i)=>{const s=n&&Ez(e,i)||i;_y(e[s])&&_y(r)?e[s]=gS(e[s],r):_y(r)?e[s]=gS({},r):vd(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(Og(e,(i,s)=>{t&&Qs(i)?n[s]=_z(i,t):n[s]=i},{allOwnKeys:r}),n),P3e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),D3e=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},O3e=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&x2(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},N3e=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},k3e=n=>{if(!n)return null;if(vd(n))return n;let e=n.length;if(!Bz(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},Q3e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&x2(Uint8Array)),H3e=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},z3e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},G3e=Sa("HTMLFormElement"),V3e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),BO=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),j3e=Sa("RegExp"),Mz=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};Og(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},W3e=n=>{Mz(n,(e,t)=>{if(Qs(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Qs(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},K3e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return vd(n)?r(n):r(String(n).split(e)),t},$3e=()=>{},Y3e=(n,e)=>(n=+n,Number.isFinite(n)?n:e),IB="abcdefghijklmnopqrstuvwxyz",EO="0123456789",Tz={DIGIT:EO,ALPHA:IB,ALPHA_DIGIT:IB+IB.toUpperCase()+EO},X3e=(n=16,e=Tz.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function Z3e(n){return!!(n&&Qs(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const J3e=n=>{const e=new Array(10),t=(r,i)=>{if(T_(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=vd(r)?[]:{};return Og(r,(o,a)=>{const l=t(o,i+1);!ig(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},q3e=Sa("AsyncFunction"),ePe=n=>n&&(T_(n)||Qs(n))&&Qs(n.then)&&Qs(n.catch),Ie={isArray:vd,isArrayBuffer:bz,isBuffer:_3e,isFormData:R3e,isArrayBufferView:b3e,isString:B3e,isNumber:Bz,isBoolean:E3e,isObject:T_,isPlainObject:_y,isUndefined:ig,isDate:C3e,isFile:S3e,isBlob:M3e,isRegExp:j3e,isFunction:Qs,isStream:I3e,isURLSearchParams:F3e,isTypedArray:Q3e,isFileList:T3e,forEach:Og,merge:gS,extend:L3e,trim:U3e,stripBOM:P3e,inherits:D3e,toFlatObject:O3e,kindOf:S_,kindOfTest:Sa,endsWith:N3e,toArray:k3e,forEachEntry:H3e,matchAll:z3e,isHTMLForm:G3e,hasOwnProperty:BO,hasOwnProp:BO,reduceDescriptors:Mz,freezeMethods:W3e,toObjectSet:K3e,toCamelCase:V3e,noop:$3e,toFiniteNumber:Y3e,findKey:Ez,global:Cz,isContextDefined:Sz,ALPHABET:Tz,generateString:X3e,isSpecCompliantForm:Z3e,toJSONObject:J3e,isAsyncFn:q3e,isThenable:ePe};function Nt(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i)}Ie.inherits(Nt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ie.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Iz=Nt.prototype,Rz={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{Rz[n]={value:n}});Object.defineProperties(Nt,Rz);Object.defineProperty(Iz,"isAxiosError",{value:!0});Nt.from=(n,e,t,r,i,s)=>{const o=Object.create(Iz);return Ie.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Nt.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const tPe=null;function vS(n){return Ie.isPlainObject(n)||Ie.isArray(n)}function Fz(n){return Ie.endsWith(n,"[]")?n.slice(0,-2):n}function CO(n,e,t){return n?n.concat(e).map(function(i,s){return i=Fz(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function nPe(n){return Ie.isArray(n)&&!n.some(vS)}const rPe=Ie.toFlatObject(Ie,{},null,function(e){return/^is[A-Z]/.test(e)});function I_(n,e,t){if(!Ie.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Ie.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,g){return!Ie.isUndefined(g[d])});const r=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Ie.isSpecCompliantForm(e);if(!Ie.isFunction(i))throw new TypeError("visitor must be a function");function A(p){if(p===null)return"";if(Ie.isDate(p))return p.toISOString();if(!l&&Ie.isBlob(p))throw new Nt("Blob is not supported. Use a Buffer instead.");return Ie.isArrayBuffer(p)||Ie.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,d,g){let m=p;if(p&&!g&&typeof p=="object"){if(Ie.endsWith(d,"{}"))d=r?d:d.slice(0,-2),p=JSON.stringify(p);else if(Ie.isArray(p)&&nPe(p)||(Ie.isFileList(p)||Ie.endsWith(d,"[]"))&&(m=Ie.toArray(p)))return d=Fz(d),m.forEach(function(w,x){!(Ie.isUndefined(w)||w===null)&&e.append(o===!0?CO([d],x,s):o===null?d:d+"[]",A(w))}),!1}return vS(p)?!0:(e.append(CO(g,d,s),A(p)),!1)}const u=[],f=Object.assign(rPe,{defaultVisitor:c,convertValue:A,isVisitable:vS});function h(p,d){if(!Ie.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(p),Ie.forEach(p,function(m,y){(!(Ie.isUndefined(m)||m===null)&&i.call(e,m,Ie.isString(y)?y.trim():y,d,f))===!0&&h(m,d?d.concat(y):[y])}),u.pop()}}if(!Ie.isObject(n))throw new TypeError("data must be an object");return h(n),e}function SO(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function _2(n,e){this._pairs=[],n&&I_(n,this,e)}const Uz=_2.prototype;Uz.append=function(e,t){this._pairs.push([e,t])};Uz.toString=function(e){const t=e?function(r){return e.call(this,r,SO)}:SO;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function iPe(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lz(n,e,t){if(!e)return n;const r=t&&t.encode||iPe,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Ie.isURLSearchParams(e)?e.toString():new _2(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class sPe{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ie.forEach(this.handlers,function(r){r!==null&&e(r)})}}const MO=sPe,Pz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oPe=typeof URLSearchParams<"u"?URLSearchParams:_2,aPe=typeof FormData<"u"?FormData:null,lPe=typeof Blob<"u"?Blob:null,APe={isBrowser:!0,classes:{URLSearchParams:oPe,FormData:aPe,Blob:lPe},protocols:["http","https","file","blob","url","data"]},Dz=typeof window<"u"&&typeof document<"u",cPe=(n=>Dz&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),uPe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),fPe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Dz,hasStandardBrowserEnv:cPe,hasStandardBrowserWebWorkerEnv:uPe},Symbol.toStringTag,{value:"Module"})),ra={...fPe,...APe};function hPe(n,e){return I_(n,new ra.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ra.isNode&&Ie.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function dPe(n){return Ie.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function pPe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Ie.isArray(i)?i.length:o,l?(Ie.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Ie.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Ie.isArray(i[o])&&(i[o]=pPe(i[o])),!a)}if(Ie.isFormData(n)&&Ie.isFunction(n.entries)){const t={};return Ie.forEachEntry(n,(r,i)=>{e(dPe(r),i,t,0)}),t}return null}function mPe(n,e,t){if(Ie.isString(n))try{return(e||JSON.parse)(n),Ie.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const b2={transitional:Pz,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Ie.isObject(e);if(s&&Ie.isHTMLForm(e)&&(e=new FormData(e)),Ie.isFormData(e))return i?JSON.stringify(Oz(e)):e;if(Ie.isArrayBuffer(e)||Ie.isBuffer(e)||Ie.isStream(e)||Ie.isFile(e)||Ie.isBlob(e))return e;if(Ie.isArrayBufferView(e))return e.buffer;if(Ie.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return hPe(e,this.formSerializer).toString();if((a=Ie.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return I_(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),mPe(e)):e}],transformResponse:[function(e){const t=this.transitional||b2.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Ie.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Nt.from(a,Nt.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ra.classes.FormData,Blob:ra.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ie.forEach(["delete","get","head","post","put","patch"],n=>{b2.headers[n]={}});const B2=b2,gPe=Ie.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),vPe=n=>{const e={};let t,r,i;return n&&n.split(` +`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&gPe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},TO=Symbol("internals");function hp(n){return n&&String(n).trim().toLowerCase()}function by(n){return n===!1||n==null?n:Ie.isArray(n)?n.map(by):String(n)}function yPe(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const wPe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function RB(n,e,t,r,i){if(Ie.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Ie.isString(e)){if(Ie.isString(r))return e.indexOf(r)!==-1;if(Ie.isRegExp(r))return r.test(e)}}function xPe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function _Pe(n,e){const t=Ie.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class R_{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,A){const c=hp(l);if(!c)throw new Error("header name must be a non-empty string");const u=Ie.findKey(i,c);(!u||i[u]===void 0||A===!0||A===void 0&&i[u]!==!1)&&(i[u||l]=by(a))}const o=(a,l)=>Ie.forEach(a,(A,c)=>s(A,c,l));return Ie.isPlainObject(e)||e instanceof this.constructor?o(e,t):Ie.isString(e)&&(e=e.trim())&&!wPe(e)?o(vPe(e),t):e!=null&&s(t,e,r),this}get(e,t){if(e=hp(e),e){const r=Ie.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return yPe(i);if(Ie.isFunction(t))return t.call(this,i,r);if(Ie.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=hp(e),e){const r=Ie.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||RB(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=hp(o),o){const a=Ie.findKey(r,o);a&&(!t||RB(r,r[a],a,t))&&(delete r[a],i=!0)}}return Ie.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||RB(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Ie.forEach(this,(i,s)=>{const o=Ie.findKey(r,s);if(o){t[o]=by(i),delete t[s];return}const a=e?xPe(s):String(s).trim();a!==s&&delete t[s],t[a]=by(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Ie.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[TO]=this[TO]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=hp(o);r[a]||(_Pe(i,o),r[a]=!0)}return Ie.isArray(e)?e.forEach(s):s(e),this}}R_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(R_.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Ie.freezeMethods(R_);const fl=R_;function FB(n,e){const t=this||B2,r=e||t,i=fl.from(r.headers);let s=r.data;return Ie.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Nz(n){return!!(n&&n.__CANCEL__)}function Ng(n,e,t){Nt.call(this,n??"canceled",Nt.ERR_CANCELED,e,t),this.name="CanceledError"}Ie.inherits(Ng,Nt,{__CANCEL__:!0});function bPe(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new Nt("Request failed with status code "+t.status,[Nt.ERR_BAD_REQUEST,Nt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const BPe=ra.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Ie.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ie.isString(r)&&o.push("path="+r),Ie.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function EPe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function CPe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function kz(n,e){return n&&!EPe(e)?CPe(n,e):e}const SPe=ra.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(o){const a=Ie.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function MPe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function TPe(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const A=Date.now(),c=r[s];o||(o=A),t[i]=l,r[i]=A;let u=s,f=0;for(;u!==i;)f+=t[u++],u=u%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),A-o{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-t,l=r(a),A=s<=o;t=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&A?(o-s)/l:void 0,event:i};c[e?"download":"upload"]=!0,n(c)}}const IPe=typeof XMLHttpRequest<"u",RPe=IPe&&function(n){return new Promise(function(t,r){let i=n.data;const s=fl.from(n.headers).normalize();let{responseType:o,withXSRFToken:a}=n,l;function A(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let c;if(Ie.isFormData(i)){if(ra.hasStandardBrowserEnv||ra.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((c=s.getContentType())!==!1){const[d,...g]=c?c.split(";").map(m=>m.trim()).filter(Boolean):[];s.setContentType([d||"multipart/form-data",...g].join("; "))}}let u=new XMLHttpRequest;if(n.auth){const d=n.auth.username||"",g=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(d+":"+g))}const f=kz(n.baseURL,n.url);u.open(n.method.toUpperCase(),Lz(f,n.params,n.paramsSerializer),!0),u.timeout=n.timeout;function h(){if(!u)return;const d=fl.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!o||o==="text"||o==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:d,config:n,request:u};bPe(function(w){t(w),A()},function(w){r(w),A()},m),u=null}if("onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(h)},u.onabort=function(){u&&(r(new Nt("Request aborted",Nt.ECONNABORTED,n,u)),u=null)},u.onerror=function(){r(new Nt("Network Error",Nt.ERR_NETWORK,n,u)),u=null},u.ontimeout=function(){let g=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const m=n.transitional||Pz;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),r(new Nt(g,m.clarifyTimeoutError?Nt.ETIMEDOUT:Nt.ECONNABORTED,n,u)),u=null},ra.hasStandardBrowserEnv&&(a&&Ie.isFunction(a)&&(a=a(n)),a||a!==!1&&SPe(f))){const d=n.xsrfHeaderName&&n.xsrfCookieName&&BPe.read(n.xsrfCookieName);d&&s.set(n.xsrfHeaderName,d)}i===void 0&&s.setContentType(null),"setRequestHeader"in u&&Ie.forEach(s.toJSON(),function(g,m){u.setRequestHeader(m,g)}),Ie.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),o&&o!=="json"&&(u.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&u.addEventListener("progress",IO(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",IO(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=d=>{u&&(r(!d||d.type?new Ng(null,n,u):d),u.abort(),u=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const p=MPe(f);if(p&&ra.protocols.indexOf(p)===-1){r(new Nt("Unsupported protocol "+p+":",Nt.ERR_BAD_REQUEST,n));return}u.send(i||null)})},yS={http:tPe,xhr:RPe};Ie.forEach(yS,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const RO=n=>`- ${n}`,FPe=n=>Ie.isFunction(n)||n===null||n===!1,Qz={getAdapter:n=>{n=Ie.isArray(n)?n:[n];const{length:e}=n;let t,r;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(RO).join(` -`):" "+RO(s[0]):"as no adapter specified";throw new Nt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:yS};function UB(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Ng(null,n)}function FO(n){return UB(n),n.headers=fl.from(n.headers),n.data=FB.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Qz.getAdapter(n.adapter||B2.adapter)(n).then(function(r){return UB(n),r.data=FB.call(n,n.transformResponse,r),r.headers=fl.from(r.headers),r},function(r){return Nz(r)||(UB(n),r&&r.response&&(r.response.data=FB.call(n,n.transformResponse,r.response),r.response.headers=fl.from(r.response.headers))),Promise.reject(r)})}const UO=n=>n instanceof fl?{...n}:n;function Gh(n,e){e=e||{};const t={};function r(A,c,u){return Ie.isPlainObject(A)&&Ie.isPlainObject(c)?Ie.merge.call({caseless:u},A,c):Ie.isPlainObject(c)?Ie.merge({},c):Ie.isArray(c)?c.slice():c}function i(A,c,u){if(Ie.isUndefined(c)){if(!Ie.isUndefined(A))return r(void 0,A,u)}else return r(A,c,u)}function s(A,c){if(!Ie.isUndefined(c))return r(void 0,c)}function o(A,c){if(Ie.isUndefined(c)){if(!Ie.isUndefined(A))return r(void 0,A)}else return r(void 0,c)}function a(A,c,u){if(u in e)return r(A,c);if(u in n)return r(void 0,A)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(A,c)=>i(UO(A),UO(c),!0)};return Ie.forEach(Object.keys(Object.assign({},n,e)),function(c){const u=l[c]||i,f=u(n[c],e[c],c);Ie.isUndefined(f)&&u!==a||(t[c]=f)}),t}const Hz="1.6.8",E2={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{E2[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const LO={};E2.transitional=function(e,t,r){function i(s,o){return"[Axios v"+Hz+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new Nt(i(o," has been removed"+(t?" in "+t:"")),Nt.ERR_DEPRECATED);return t&&!LO[o]&&(LO[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};function FPe(n,e,t){if(typeof n!="object")throw new Nt("options must be an object",Nt.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new Nt("option "+s+" must be "+l,Nt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Nt("Unknown option "+s,Nt.ERR_BAD_OPTION)}}const wS={assertOptions:FPe,validators:E2},jl=wS.validators;class sx{constructor(e){this.defaults=e,this.interceptors={request:new MO,response:new MO}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Gh(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&wS.assertOptions(r,{silentJSONParsing:jl.transitional(jl.boolean),forcedJSONParsing:jl.transitional(jl.boolean),clarifyTimeoutError:jl.transitional(jl.boolean)},!1),i!=null&&(Ie.isFunction(i)?t.paramsSerializer={serialize:i}:wS.assertOptions(i,{encode:jl.function,serialize:jl.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Ie.merge(s.common,s[t.method]);s&&Ie.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),t.headers=fl.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(t)===!1||(l=l&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});const A=[];this.interceptors.response.forEach(function(d){A.push(d.fulfilled,d.rejected)});let c,u=0,f;if(!l){const p=[FO.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,A),f=p.length,c=Promise.resolve(t);u{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new Ng(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new C2(function(i){e=i}),cancel:e}}}const UPe=C2;function LPe(n){return function(t){return n.apply(null,t)}}function PPe(n){return Ie.isObject(n)&&n.isAxiosError===!0}const xS={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(xS).forEach(([n,e])=>{xS[e]=n});const DPe=xS;function zz(n){const e=new By(n),t=_z(By.prototype.request,e);return Ie.extend(t,By.prototype,e,{allOwnKeys:!0}),Ie.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return zz(Gh(n,i))},t}const sr=zz(B2);sr.Axios=By;sr.CanceledError=Ng;sr.CancelToken=UPe;sr.isCancel=Nz;sr.VERSION=Hz;sr.toFormData=I_;sr.AxiosError=Nt;sr.Cancel=sr.CanceledError;sr.all=function(e){return Promise.all(e)};sr.spread=LPe;sr.isAxiosError=PPe;sr.mergeConfig=Gh;sr.AxiosHeaders=fl;sr.formToJSON=n=>Oz(Ie.isHTMLForm(n)?new FormData(n):n);sr.getAdapter=Qz.getAdapter;sr.HttpStatusCode=DPe;sr.default=sr;const OPe=sr,NPe={}.VITE_OPENSEA_KEY,kPe={}.VITE_PINATA_API_KEY,QPe={}.VITE_PINATA_API_SECRET,LB="0x89";let Lv;async function HPe(){if(Lv!=null)return Lv;const n=new ZN("https://polygon-rpc.com/"),t=await new C_(ix.address,ix.abi,n).tokenPrice();return Lv=Ge.from(t).mul(1),Lv}function zPe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":NPe}};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 S2(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(LB,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:LB}]});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:LB}]});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 PB(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 OPe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:kPe,pinata_secret_api_key:QPe}})).data}const GPe=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 VPe(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 S2();if(s=="")return"Please Connect Wallet";if(!i||await jPe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let y=0;y<10;y++)try{return await PB(e,a).catch(x=>{console.error(y,"---",x)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const A=await Hfe(t,n,4096);let c;if(A){let y="AvatarGlb_"+Date.now()+".glb";c=await(async()=>{for(let w=0;w<10;w++)try{return await PB(A,y).catch(_=>(console.error(w,"---",_),"Couldn't save glb to pinata"))}catch(x){return console.warn(x),"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:GPe(n)},f=JSON.stringify(u),p=`ipfs://${(await PB(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let d=await HPe();const g=new kS(window.ethereum).getSigner(),m=new C_(ix.address,ix.abi,g);try{const y={value:d,from:s};if((await(await m.mintToken(1,p,y)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const jPe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=U9("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new C_(bO.address,bO.abi,t).beneficiaryBalanceOf(e,y3e,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 WPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=Y.useContext(or),[c,u]=ye.useState(null),[f,h]=ye.useState(""),{playSound:p}=Y.useContext(Ys),{isMute:d}=Y.useContext($s);Y.useState(null);const[g,m]=Y.useState(null),[y,w]=Y.useState(""),x=()=>{!d&&p("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(dt.LANDING)},_=()=>{const v=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:v===0||v==2,exportMtoonAtlas:v===1||v==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=v=>{const E=g[v].manifestName;(async()=>{(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(E,512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await i.downloadVRM(E,_());const z=new ad,K=A.parent;K.remove(A);const O=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(O===!0){const W=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(W)}const B=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(B===!0){const W=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(W)}(O===!0||B===!0)&&z.saveZip(g[v].manifestName),K.add(A),v{v==0?(console.log(r.loras[0]),C(v)):(await i.setManifest(g[v]),t(!0),i.loadInitialTraits().then(async()=>{await(U=>new Promise(P=>setTimeout(P,U)))(1),C(v)}))},b=()=>{t(!0),S(0)},{t:M}=ye.useContext(To),D=async v=>{if(i.getCurrentCharacterModel()){const U=ul(v.name),P=URL.createObjectURL(v);await s.loadAnimation(P,!1,0,!0,"",U),w(s.getCurrentAnimationName()),URL.revokeObjectURL(P)}else console.warn("Please load a vrm model to test animations.")},$=async v=>{const E=URL.createObjectURL(v);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const U=ul(v.name);h(U),u(i.getCurrentCharacterModel())},H=v=>{const E=Array.from(v),U=[],P=L=>new Promise((z,K)=>{if(L&&L.name.toLowerCase().endsWith(".json")){const O=new FileReader,B=L.name.replace(/\.[^/.]+$/,"");O.onload=function(W){try{const ee=JSON.parse(W.target.result),F=ee.thumbnail;ee.manifestName=B,U.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),K(ee)}},O.readAsText(L)}});Promise.all(E.map(P)).then(()=>{U.length>0&&(m(U),i.setManifest(U[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(L=>{console.error("Error processing files:",L)})},I=async v=>{const E=v[0];E&&E.name.toLowerCase().endsWith(".fbx")&&D(E),E&&E.name.toLowerCase().endsWith(".vrm")&&$(E),E&&E.name.toLowerCase().endsWith(".json")&&H(v)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),k.jsx(Cg,{onFilesDrop:I}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(y2,{model:c}),k.jsx(ST,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&k.jsx(a_,{loadedAnimationName:y}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:M("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(g==null?void 0:g.length)==1&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:b}),(g==null?void 0:g.length)>1&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:b})]})]})}const KPe="_classdisabled_hpzv8_1",$Pe="_container_hpzv8_6",YPe="_classContainer_hpzv8_14",XPe="_icon_hpzv8_39",ZPe="_name_hpzv8_70",JPe="_description_hpzv8_79",qPe="_classFrame_hpzv8_84",eDe="_frameContainer_hpzv8_104",tDe="_frame_hpzv8_104",nDe="_image_hpzv8_114",rDe="_lockedContainer_hpzv8_120",iDe="_locked_hpzv8_120",sDe="_buttonContainer_hpzv8_134",oDe="_buttonLeft_hpzv8_143",aDe="_buttonRight_hpzv8_147",lDe="_buttonCenter_hpzv8_151",ADe="_topLine_hpzv8_165",cDe="_bottomLine_hpzv8_191",ot={classdisabled:KPe,container:$Pe,classContainer:YPe,class:"_class_hpzv8_1",icon:XPe,name:ZPe,description:JPe,classFrame:qPe,frameContainer:eDe,frame:tDe,image:nDe,lockedContainer:rDe,locked:iDe,buttonContainer:sDe,buttonLeft:oDe,buttonRight:aDe,buttonCenter:lDe,topLine:ADe,bottomLine:cDe};function uDe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or),[l,A]=ye.useState([]);ye.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const p=o.characters.map(d=>({name:d.name,image:d.portrait,description:d.description,manifest:d.manifest,icon:d.icon,format:d.format,disabled:!1}));A(p)}},[o]);const c=()=>{e(dt.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(dt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(dt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsxs("div",{className:ot.classContainer,children:[l.map((p,d)=>k.jsxs("div",{className:p.disabled?ot.classdisabled:ot.class,onClick:p.disabled?null:()=>u(d),onMouseOver:p.disabled?null:()=>h(),children:[k.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${p.image})`},children:[k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),k.jsx("div",{className:ot.lockedContainer,children:p.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),k.jsx("div",{className:ot.name,children:p.name}),k.jsx("div",{className:ot.description,children:p.description})]},d)),k.jsxs("div",{className:ot.class,onClick:()=>f(),onMouseOver:()=>h(),children:[k.jsx("div",{className:ot.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),k.jsx("div",{className:ot.name,children:"Manifest"}),k.jsx("div",{className:ot.description,children:"Load by manifest"})]},"manifest-load")]}),k.jsx("div",{className:ot.bottomLine}),k.jsx("div",{className:ot.buttonContainer,children:k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}function fDe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or),[l,A]=ye.useState([]);ye.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const h=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(h)}},[o]);const c=()=>{e(dt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(dt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsx("div",{className:ot.classContainer,children:l.map((h,p)=>k.jsxs("div",{className:h.disabled?ot.classdisabled:ot.class,onClick:h.disabled?null:()=>u(p),onMouseOver:h.disabled?null:()=>f(),children:[k.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${h.image})`},children:[k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),k.jsx("div",{className:ot.lockedContainer,children:h.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),k.jsx("div",{className:ot.name,children:h.name}),k.jsx("div",{className:ot.description,children:h.description})]},p))}),k.jsx("div",{className:ot.bottomLine}),k.jsx("div",{className:ot.buttonContainer,children:k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}const hDe="_buttonContainer_1ueuk_1",dDe="_button_1ueuk_1",qu={buttonContainer:hDe,button:dDe},PO={}.VITE_OPENSEA_KEY;function pDe(){const{setViewMode:n}=Y.useContext(Ui),{playSound:e}=Y.useContext(Ys),{isMute:t}=Y.useContext($s),{characterManager:r}=Y.useContext(or),i=()=>{n(dt.CREATE),!t&&e("backNextButton")},s=()=>{n(dt.CLAIM),!t&&e("backNextButton")},o=()=>{n(dt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await S2()!=""&&n(dt.WALLET),!t&&e("backNextButton")};return k.jsx("div",{className:qu.container,children:k.jsxs("div",{className:qu.buttonContainer,children:[k.jsx("button",{className:qu.button,onClick:i,children:k.jsx("img",{src:"./assets/media/btn_create_character.png"})}),k.jsx("button",{className:qu.button,onClick:s,children:k.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),k.jsx("button",{className:qu.button,onClick:o,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),PO&&PO!=""&&k.jsx("button",{className:qu.button,onClick:a,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const uc={};var M2={exports:{}},ph=typeof Reflect=="object"?Reflect:null,DO=ph&&typeof ph.apply=="function"?ph.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Ey;ph&&typeof ph.ownKeys=="function"?Ey=ph.ownKeys:Object.getOwnPropertySymbols?Ey=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ey=function(e){return Object.getOwnPropertyNames(e)};function mDe(n){console&&console.warn&&console.warn(n)}var Gz=Number.isNaN||function(e){return e!==e};function en(){en.init.call(this)}M2.exports=en;M2.exports.once=wDe;en.EventEmitter=en;en.prototype._events=void 0;en.prototype._eventsCount=0;en.prototype._maxListeners=void 0;var OO=10;function F_(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(en,"defaultMaxListeners",{enumerable:!0,get:function(){return OO},set:function(n){if(typeof n!="number"||n<0||Gz(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");OO=n}});en.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};en.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Gz(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 Vz(n){return n._maxListeners===void 0?en.defaultMaxListeners:n._maxListeners}en.prototype.getMaxListeners=function(){return Vz(this)};en.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")DO(l,this,t);else for(var A=l.length,c=Yz(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,mDe(a)}return n}en.prototype.addListener=function(e,t){return jz(this,e,t,!1)};en.prototype.on=en.prototype.addListener;en.prototype.prependListener=function(e,t){return jz(this,e,t,!0)};function gDe(){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 Wz(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=gDe.bind(r);return i.listener=t,r.wrapFn=i,i}en.prototype.once=function(e,t){return F_(t),this.on(e,Wz(this,e,t)),this};en.prototype.prependOnceListener=function(e,t){return F_(t),this.prependListener(e,Wz(this,e,t)),this};en.prototype.removeListener=function(e,t){var r,i,s,o,a;if(F_(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():vDe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};en.prototype.off=en.prototype.removeListener;en.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 Kz(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?yDe(i):Yz(i,i.length)}en.prototype.listeners=function(e){return Kz(this,e,!0)};en.prototype.rawListeners=function(e){return Kz(this,e,!1)};en.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):$z.call(n,e)};en.prototype.listenerCount=$z;function $z(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}en.prototype.eventNames=function(){return this._eventsCount>0?Ey(this._events):[]};function Yz(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 Cy(n,e,t){return EDe()?Cy=Reflect.construct:Cy=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&ox(A,o.prototype),A},Cy.apply(null,arguments)}function CDe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function ax(n){var e=typeof Map=="function"?new Map:void 0;return ax=function(r){if(r===null||!CDe(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 Cy(r,arguments,bS(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ox(i,r)},ax(n)}function Pv(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 ef(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function ko(n){return n.hasOwnProperty("result")?n.result:n}var DB=function(n){T2(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}(ax(Error)),SDe=function(n){T2(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}(ax(Error)),MDe=function(n){T2(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Pv(i)),i.handleChainChanged=i.handleChainChanged.bind(Pv(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Pv(i)),i.handleClose=i.handleClose.bind(Pv(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 _S({provider:window.ethereum},a?{account:a}:{})}var f=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(h){return h&&ko(h)[0]})).then(function(h){a=h})}();return f&&f.then?f.then(u):u(f)},s=!1,o=this;if(!window.ethereum)throw new DB;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=ef(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(A){return ko(A)[0]})).then(function(A){a=A})},function(A){if(A.code===4001)throw new SDe});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=ko(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=ko(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=ef(function(){return Promise.resolve(window.ethereum.send("net_version").then(ko)).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 DB;var s,o=ef(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then(ko)).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=ko(window.ethereum.send({method:"eth_accounts"}))[0]),s}var A=function(){if(!s){var c=ef(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return ko(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 DB;var s,o=ef(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return ko(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(ef(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return ko(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(BDe);function TDe(){const{account:n,library:e,activate:t}=z9(),[r,i]=ye.useState([]),{setViewMode:s}=Y.useContext(Ui),{playSound:o}=Y.useContext(Ys),{isMute:a}=Y.useContext($s),l=new MDe({supportedChainIds:[137,1,3,4,5,42,97]});ye.useEffect(()=>{if(n&&e){const f="0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",h=["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 C_(f,h,e);p.balanceOf(n).then(d=>{const g=[];for(let m=0;m{const y=m.map(w=>p.tokenURI(w));Promise.all(y).then(w=>{i(w)})})})}},[n,e]);const A=()=>{t(l)},c=f=>{!a&&o("backNextButton"),s(dt.APPEARANCE)},u=()=>{s(dt.LANDING),!a&&o("backNextButton")};return k.jsxs("div",{className:uc.container,children:[!n&&k.jsxs("div",{className:uc.message,children:["Please connect your wallet to load your characters",k.jsx("button",{className:uc.button,onClick:()=>A(),children:"Connect"})]}),k.jsxs("div",{className:uc.characterContainer,children:[k.jsx("div",{className:uc.title,children:"Load Character"}),r.map((f,h)=>k.jsx("div",{className:uc.character,onClick:()=>{c()},children:JSON.stringify(f)},h))]}),k.jsx("button",{className:uc.button,onClick:()=>u(),children:"Back"})]})}const IDe="_container_q73cc_1",RDe="_mintContainer_q73cc_6",FDe="_mainTitleWrap_q73cc_33",UDe="_mainTitle_q73cc_33",LDe="_mintButtonContainer_q73cc_49",PDe="_mintButton_q73cc_49",DDe="_genesisText_q73cc_60",ODe="_required_q73cc_64",NDe="_divider_q73cc_68",kDe="_bottomContainer_q73cc_75",QDe="_mintInfo_q73cc_85",HDe="_topLine_q73cc_91",zDe="_bottomLine_q73cc_104",gi={container:IDe,mintContainer:RDe,mainTitleWrap:FDe,mainTitle:UDe,mintButtonContainer:LDe,mintButton:PDe,genesisText:DDe,required:ODe,divider:NDe,bottomContainer:kDe,mintInfo:QDe,topLine:HDe,bottomLine:zDe};function GDe(){const{model:n,avatar:e}=Y.useContext(or),{setViewMode:t}=Y.useContext(Ui),{playSound:r}=Y.useContext(Ys),{isMute:i}=Y.useContext($s),[s,o]=Y.useState(""),[a,l]=Y.useState(!1),A=()=>{t(dt.SAVE),!i&&r("backNextButton")};function c(){return k.jsxs("div",{className:gi.mainTitleWrap,children:[k.jsx("div",{className:gi.topLine}),k.jsx("div",{className:gi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const p=await VPe(e,null,n,{name:"XXXRestore"}.name);o(p),l(!1),console.log(p)}return k.jsxs("div",{className:gi.container,children:[k.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),k.jsxs("div",{className:gi.mintContainer,children:[k.jsx(c,{}),k.jsxs("div",{className:gi.mintButtonContainer,children:[k.jsx(_n,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:gi.mintButton,disabled:a,onClick:u,minWidth:220}),k.jsx("div",{className:gi.divider}),k.jsx(_n,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:gi.mintButton,disabled:!0,minWidth:220}),k.jsxs("span",{className:gi.genesisText,children:["(",k.jsx("span",{className:gi.required,children:"Coming Soon!"}),")"]})]}),k.jsxs("span",{className:gi.mintInfo,children:[s," "]})]}),k.jsx("div",{className:gi.bottomContainer,children:k.jsx(_n,{theme:"light",text:"Back",size:14,className:gi.buttonLeft,onClick:A})})]})}function VDe(){const{isLoading:n,setViewMode:e}=Y.useContext(Ui),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=Y.useContext(or),{playSound:l}=Y.useContext(Ys),{isMute:A}=Y.useContext($s),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=ye.useState([]),[g,m]=ye.useState(0),[y,w]=Y.useState("T-Pose"),x=()=>{!A&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(dt.LANDING)},_=()=>{const E=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:E===0||E==2,exportMtoonAtlas:E===1||E==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var W;(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(E+"_portrait",512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await r.downloadVRM(E+"_merged",_());const z=new ad,K=s.parent;K.remove(s),(W=r.getCurrentOptimizerCharacterModel().data)==null||W.isVRM0;const O=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(O===!0){const ee=t.loras.map(async F=>o.createLoraData(F,z));await Promise.all(ee)}const B=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(B===!0){const ee=t.sprites.map(async F=>a.createSpriteAtlas(F,z));await Promise.all(ee)}(O===!0||B===!0)&&z.saveZip(E),K.add(s)})()},{t:b}=ye.useContext(To),M=async E=>{if(r.getCurrentOptimizerCharacterModel()){const P=ul(E.name),L=URL.createObjectURL(E);await i.loadAnimation(L,!1,0,!0,"",P),w(i.getCurrentAnimationName()),URL.revokeObjectURL(L)}else console.warn("Please load a vrm model to test animations.")},D=()=>{if(g===0)H(p[p.length-1]),m(p.length-1);else{const E=g-1;H(p[E]),m(E)}},$=()=>{if(g>=p.length-1)H(p[0]),m(0);else{const E=g+1;H(p[E]),m(E)}},H=async E=>{const U=URL.createObjectURL(E);await r.loadOptimizerCharacter(U),URL.revokeObjectURL(U);const P=ul(E.name);h(P),u({...r.getCurrentCharacterModel()})},I=async E=>{H(E[0]);const U=[];for(let P=0;P{const U=E[0];U&&U.name.toLowerCase().endsWith(".fbx")&&M(U),U&&U.name.toLowerCase().endsWith(".vrm")&&I(E)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),k.jsx(Cg,{onFilesDrop:v}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),k.jsx(y2,{model:c,name:f,files:p,index:g,nextVrm:$,previousVrm:D}),k.jsx(a_,{loadedAnimationName:y}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:b("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(p==null?void 0:p.length)>1!=""&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:C}),c!=""&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:S})]})]})}const jDe="_buttonContainer_1fd4o_1",WDe="_buttonLeft_1fd4o_10",KDe="_buttonRight_1fd4o_14",$De="_buttonCenter_1fd4o_18",Dv={buttonContainer:jDe,buttonLeft:WDe,buttonRight:KDe,buttonCenter:$De},YDe="_button_13dfi_1",NO={button:YDe},XDe="Anon",ZDe=()=>{ye.useContext(To);const[n]=Y.useState(localStorage.getItem("name")||XDe),{model:e,characterManager:t}=ye.useContext(or),r=()=>{const o=Oe.mergeOptions_sel_option||0;return{createTextureAtlas:Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),ktxCompression:Oe.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},i=()=>{const o=r();t.downloadVRM(n,o)},s=()=>{const o=r();t.downloadGLB(n,o)};return k.jsxs(Y.Fragment,{children:[k.jsx(_n,{theme:"light",text:"GLB",icon:"download",size:14,className:NO.button,onClick:()=>{s()}}),k.jsx(_n,{theme:"light",text:"VRM",icon:"download",size:14,className:NO.button,onClick:i})]})};function JDe(){const{t:n}=ye.useContext(To),{playSound:e}=Y.useContext(Ys),{isMute:t}=Y.useContext($s),{setViewMode:r}=Y.useContext(Ui),i=()=>{r(dt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(dt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return k.jsxs("div",{className:Dv.container,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),k.jsxs("div",{className:Dv.buttonContainer,children:[k.jsx(Cg,{onFilesDrop:o}),k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:Dv.buttonLeft,onClick:i}),k.jsx(B_,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),k.jsx(ZDe,{}),k.jsx(_n,{theme:"light",text:"mint",size:14,className:Dv.buttonRight,onClick:s})]})]})}function qDe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or);ye.useState([]);const[l,A]=ye.useState([]);ye.useEffect(()=>{c()},[]);const c=async()=>{const d=await S2();zPe(d,"the-anata-nft").then(g=>{A(g.nfts),console.log(g.nfts)})},u=()=>{e(dt.LANDING),!s&&i("backNextButton")},f=async d=>{t(!0),a.loadManifest(o[d].manifest).then(()=>{e(dt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{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 k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsx("div",{className:ot.classContainer,children:l.map((d,g)=>k.jsxs("div",{className:ot.class,onClick:()=>f(g),onMouseOver:()=>p(),children:[k.jsx("div",{className:ot.classFrame,style:{backgroundImage:`url(${d.image_url})`},children:k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),k.jsx("div",{className:ot.name,children:d.name})]},g))}),k.jsx("div",{className:ot.bottomLine}),k.jsxs("div",{className:ot.buttonContainer,children:[k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:u}),k.jsx(_n,{theme:"light",text:"test",size:14,className:ot.buttonLeft,onClick:h})]})]})}const eOe=".//manifest.json",tOe=6,nOe=new Z(0,.8,0);new Z(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function rOe(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 iOe(){const n=await rOe(eOe),e=new lpe;return{initialManifest:n,effectManager:e}}const sOe=()=>{let n,e;const r=iOe().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}}},oOe=sOe();function aOe(){const{initialManifest:n,effectManager:e}=oOe.read(),[t,r]=ye.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=ye.useContext(or),{viewMode:u}=ye.useContext(Ui);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:nOe.y,targetZ:0,distance:tOe}),s&&([dt.APPEARANCE,dt.SAVE,dt.OPTIMIZER,dt.BATCHDOWNLOAD,dt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,p]=ye.useState(!1),[d,g]=ye.useState(""),[m,y]=ye.useState([]),w=(C,S)=>{g(C),p(!0),y([S])},x={[dt.LANDING]:k.jsx(pDe,{}),[dt.APPEARANCE]:k.jsx(hLe,{confirmDialog:w}),[dt.OPTIMIZER]:k.jsx(VDe,{}),[dt.CREATE]:k.jsx(fDe,{}),[dt.WALLET]:k.jsx(qDe,{}),[dt.CLAIM]:k.jsx(uDe,{}),[dt.BATCHMANIFEST]:k.jsx(WPe,{}),[dt.BATCHDOWNLOAD]:k.jsx(zLe,{}),[dt.LOAD]:k.jsx(TDe,{}),[dt.MINT]:k.jsx(GDe,{}),[dt.SAVE]:k.jsx(JDe,{})};let _=0;return ye.useEffect(()=>{const C=S=>{const b=new Date().getTime(),M=b-_;M<300&&M>10&&S.target.id=="editor-scene"&&r(!t),_=b};return window.addEventListener("touchend",C),window.addEventListener("click",C),()=>{window.removeEventListener("touchend",C),window.removeEventListener("click",C)}},[t]),ye.useEffect(()=>{if(A!=null)return f(),A.enabled=!0,[dt.LANDING,dt.CREATE,dt.CLAIM,dt.LOAD,dt.CLAIM,dt.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,A]),ye.useEffect(()=>{l(n)},[n]),ye.useContext(To),k.jsxs(ye.Fragment,{children:[k.jsx("div",{className:"generalTitle",children:"Character Studio"}),k.jsx(Cpe,{confirmDialogText:d,confirmDialogCallback:m,confirmDialogWindow:h,setConfirmDialogWindow:p}),k.jsx(Ipe,{}),x[u]]})}const lOe=n=>{const e=new kS(n);return e.pollingInterval=12e3,e};KB.createRoot(document.getElementById("root")).render(k.jsx(Y.StrictMode,{children:k.jsx(Q9,{getLibrary:lOe,children:k.jsx(XK,{children:k.jsx(Qde,{children:k.jsx($K,{children:k.jsx(vhe,{children:k.jsx(mhe,{children:k.jsx(She,{children:k.jsx(ye.Suspense,{children:k.jsx(aOe,{})})})})})})})})})}));export{ta as c,bl as g}; +`):" "+RO(s[0]):"as no adapter specified";throw new Nt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:yS};function UB(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Ng(null,n)}function FO(n){return UB(n),n.headers=fl.from(n.headers),n.data=FB.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Qz.getAdapter(n.adapter||B2.adapter)(n).then(function(r){return UB(n),r.data=FB.call(n,n.transformResponse,r),r.headers=fl.from(r.headers),r},function(r){return Nz(r)||(UB(n),r&&r.response&&(r.response.data=FB.call(n,n.transformResponse,r.response),r.response.headers=fl.from(r.response.headers))),Promise.reject(r)})}const UO=n=>n instanceof fl?{...n}:n;function Gh(n,e){e=e||{};const t={};function r(A,c,u){return Ie.isPlainObject(A)&&Ie.isPlainObject(c)?Ie.merge.call({caseless:u},A,c):Ie.isPlainObject(c)?Ie.merge({},c):Ie.isArray(c)?c.slice():c}function i(A,c,u){if(Ie.isUndefined(c)){if(!Ie.isUndefined(A))return r(void 0,A,u)}else return r(A,c,u)}function s(A,c){if(!Ie.isUndefined(c))return r(void 0,c)}function o(A,c){if(Ie.isUndefined(c)){if(!Ie.isUndefined(A))return r(void 0,A)}else return r(void 0,c)}function a(A,c,u){if(u in e)return r(A,c);if(u in n)return r(void 0,A)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(A,c)=>i(UO(A),UO(c),!0)};return Ie.forEach(Object.keys(Object.assign({},n,e)),function(c){const u=l[c]||i,f=u(n[c],e[c],c);Ie.isUndefined(f)&&u!==a||(t[c]=f)}),t}const Hz="1.6.8",E2={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{E2[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const LO={};E2.transitional=function(e,t,r){function i(s,o){return"[Axios v"+Hz+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new Nt(i(o," has been removed"+(t?" in "+t:"")),Nt.ERR_DEPRECATED);return t&&!LO[o]&&(LO[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};function UPe(n,e,t){if(typeof n!="object")throw new Nt("options must be an object",Nt.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new Nt("option "+s+" must be "+l,Nt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Nt("Unknown option "+s,Nt.ERR_BAD_OPTION)}}const wS={assertOptions:UPe,validators:E2},jl=wS.validators;class sx{constructor(e){this.defaults=e,this.interceptors={request:new MO,response:new MO}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+s):r.stack=s}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Gh(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&wS.assertOptions(r,{silentJSONParsing:jl.transitional(jl.boolean),forcedJSONParsing:jl.transitional(jl.boolean),clarifyTimeoutError:jl.transitional(jl.boolean)},!1),i!=null&&(Ie.isFunction(i)?t.paramsSerializer={serialize:i}:wS.assertOptions(i,{encode:jl.function,serialize:jl.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Ie.merge(s.common,s[t.method]);s&&Ie.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),t.headers=fl.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(t)===!1||(l=l&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});const A=[];this.interceptors.response.forEach(function(d){A.push(d.fulfilled,d.rejected)});let c,u=0,f;if(!l){const p=[FO.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,A),f=p.length,c=Promise.resolve(t);u{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new Ng(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new C2(function(i){e=i}),cancel:e}}}const LPe=C2;function PPe(n){return function(t){return n.apply(null,t)}}function DPe(n){return Ie.isObject(n)&&n.isAxiosError===!0}const xS={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(xS).forEach(([n,e])=>{xS[e]=n});const OPe=xS;function zz(n){const e=new By(n),t=_z(By.prototype.request,e);return Ie.extend(t,By.prototype,e,{allOwnKeys:!0}),Ie.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return zz(Gh(n,i))},t}const sr=zz(B2);sr.Axios=By;sr.CanceledError=Ng;sr.CancelToken=LPe;sr.isCancel=Nz;sr.VERSION=Hz;sr.toFormData=I_;sr.AxiosError=Nt;sr.Cancel=sr.CanceledError;sr.all=function(e){return Promise.all(e)};sr.spread=PPe;sr.isAxiosError=DPe;sr.mergeConfig=Gh;sr.AxiosHeaders=fl;sr.formToJSON=n=>Oz(Ie.isHTMLForm(n)?new FormData(n):n);sr.getAdapter=Qz.getAdapter;sr.HttpStatusCode=OPe;sr.default=sr;const NPe=sr,kPe={}.VITE_OPENSEA_KEY,QPe={}.VITE_PINATA_API_KEY,HPe={}.VITE_PINATA_API_SECRET,LB="0x89";let Lv;async function zPe(){if(Lv!=null)return Lv;const n=new ZN("https://polygon-rpc.com/"),t=await new C_(ix.address,ix.abi,n).tokenPrice();return Lv=Ge.from(t).mul(1),Lv}function GPe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":kPe}};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 S2(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(LB,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:LB}]});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:LB}]});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 PB(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 NPe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:QPe,pinata_secret_api_key:HPe}})).data}const VPe=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 jPe(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 S2();if(s=="")return"Please Connect Wallet";if(!i||await WPe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let y=0;y<10;y++)try{return await PB(e,a).catch(x=>{console.error(y,"---",x)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const A=await Hfe(t,n,4096);let c;if(A){let y="AvatarGlb_"+Date.now()+".glb";c=await(async()=>{for(let w=0;w<10;w++)try{return await PB(A,y).catch(_=>(console.error(w,"---",_),"Couldn't save glb to pinata"))}catch(x){return console.warn(x),"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:VPe(n)},f=JSON.stringify(u),p=`ipfs://${(await PB(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let d=await zPe();const g=new kS(window.ethereum).getSigner(),m=new C_(ix.address,ix.abi,g);try{const y={value:d,from:s};if((await(await m.mintToken(1,p,y)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const WPe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=U9("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new C_(bO.address,bO.abi,t).beneficiaryBalanceOf(e,w3e,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 KPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=Y.useContext(or),[c,u]=ye.useState(null),[f,h]=ye.useState(""),{playSound:p}=Y.useContext(Ys),{isMute:d}=Y.useContext($s);Y.useState(null);const[g,m]=Y.useState(null),[y,w]=Y.useState(""),x=()=>{!d&&p("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(dt.LANDING)},_=()=>{const v=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:v===0||v==2,exportMtoonAtlas:v===1||v==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=v=>{const E=g[v].manifestName;(async()=>{(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(E,512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await i.downloadVRM(E,_());const z=new ad,K=A.parent;K.remove(A);const O=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(O===!0){const W=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(W)}const B=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(B===!0){const W=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(W)}(O===!0||B===!0)&&z.saveZip(g[v].manifestName),K.add(A),v{v==0?(console.log(r.loras[0]),C(v)):(await i.setManifest(g[v]),t(!0),i.loadInitialTraits().then(async()=>{await(U=>new Promise(P=>setTimeout(P,U)))(1),C(v)}))},b=()=>{t(!0),S(0)},{t:M}=ye.useContext(To),D=async v=>{if(i.getCurrentCharacterModel()){const U=ul(v.name),P=URL.createObjectURL(v);await s.loadAnimation(P,!1,0,!0,"",U),w(s.getCurrentAnimationName()),URL.revokeObjectURL(P)}else console.warn("Please load a vrm model to test animations.")},$=async v=>{const E=URL.createObjectURL(v);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const U=ul(v.name);h(U),u(i.getCurrentCharacterModel())},H=v=>{const E=Array.from(v),U=[],P=L=>new Promise((z,K)=>{if(L&&L.name.toLowerCase().endsWith(".json")){const O=new FileReader,B=L.name.replace(/\.[^/.]+$/,"");O.onload=function(W){try{const ee=JSON.parse(W.target.result),F=ee.thumbnail;ee.manifestName=B,U.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),K(ee)}},O.readAsText(L)}});Promise.all(E.map(P)).then(()=>{U.length>0&&(m(U),i.setManifest(U[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(L=>{console.error("Error processing files:",L)})},I=async v=>{const E=v[0];E&&E.name.toLowerCase().endsWith(".fbx")&&D(E),E&&E.name.toLowerCase().endsWith(".vrm")&&$(E),E&&E.name.toLowerCase().endsWith(".json")&&H(v)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),k.jsx(Cg,{onFilesDrop:I}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(y2,{model:c}),k.jsx(ST,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&k.jsx(a_,{loadedAnimationName:y}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:M("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(g==null?void 0:g.length)==1&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:b}),(g==null?void 0:g.length)>1&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:b})]})]})}const $Pe="_classdisabled_hpzv8_1",YPe="_container_hpzv8_6",XPe="_classContainer_hpzv8_14",ZPe="_icon_hpzv8_39",JPe="_name_hpzv8_70",qPe="_description_hpzv8_79",eDe="_classFrame_hpzv8_84",tDe="_frameContainer_hpzv8_104",nDe="_frame_hpzv8_104",rDe="_image_hpzv8_114",iDe="_lockedContainer_hpzv8_120",sDe="_locked_hpzv8_120",oDe="_buttonContainer_hpzv8_134",aDe="_buttonLeft_hpzv8_143",lDe="_buttonRight_hpzv8_147",ADe="_buttonCenter_hpzv8_151",cDe="_topLine_hpzv8_165",uDe="_bottomLine_hpzv8_191",ot={classdisabled:$Pe,container:YPe,classContainer:XPe,class:"_class_hpzv8_1",icon:ZPe,name:JPe,description:qPe,classFrame:eDe,frameContainer:tDe,frame:nDe,image:rDe,lockedContainer:iDe,locked:sDe,buttonContainer:oDe,buttonLeft:aDe,buttonRight:lDe,buttonCenter:ADe,topLine:cDe,bottomLine:uDe};function fDe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or),[l,A]=ye.useState([]);ye.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const p=o.characters.map(d=>({name:d.name,image:d.portrait,description:d.description,manifest:d.manifest,icon:d.icon,format:d.format,disabled:!1}));A(p)}},[o]);const c=()=>{e(dt.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(dt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(dt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsxs("div",{className:ot.classContainer,children:[l.map((p,d)=>k.jsxs("div",{className:p.disabled?ot.classdisabled:ot.class,onClick:p.disabled?null:()=>u(d),onMouseOver:p.disabled?null:()=>h(),children:[k.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${p.image})`},children:[k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),k.jsx("div",{className:ot.lockedContainer,children:p.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),k.jsx("div",{className:ot.name,children:p.name}),k.jsx("div",{className:ot.description,children:p.description})]},d)),k.jsxs("div",{className:ot.class,onClick:()=>f(),onMouseOver:()=>h(),children:[k.jsx("div",{className:ot.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),k.jsx("div",{className:ot.name,children:"Manifest"}),k.jsx("div",{className:ot.description,children:"Load by manifest"})]},"manifest-load")]}),k.jsx("div",{className:ot.bottomLine}),k.jsx("div",{className:ot.buttonContainer,children:k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}function hDe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or),[l,A]=ye.useState([]);ye.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const h=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(h)}},[o]);const c=()=>{e(dt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(dt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsx("div",{className:ot.classContainer,children:l.map((h,p)=>k.jsxs("div",{className:h.disabled?ot.classdisabled:ot.class,onClick:h.disabled?null:()=>u(p),onMouseOver:h.disabled?null:()=>f(),children:[k.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${h.image})`},children:[k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),k.jsx("div",{className:ot.lockedContainer,children:h.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),k.jsx("div",{className:ot.name,children:h.name}),k.jsx("div",{className:ot.description,children:h.description})]},p))}),k.jsx("div",{className:ot.bottomLine}),k.jsx("div",{className:ot.buttonContainer,children:k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}const dDe="_buttonContainer_1ueuk_1",pDe="_button_1ueuk_1",qu={buttonContainer:dDe,button:pDe},PO={}.VITE_OPENSEA_KEY;function mDe(){const{setViewMode:n}=Y.useContext(Ui),{playSound:e}=Y.useContext(Ys),{isMute:t}=Y.useContext($s),{characterManager:r}=Y.useContext(or),i=()=>{n(dt.CREATE),!t&&e("backNextButton")},s=()=>{n(dt.CLAIM),!t&&e("backNextButton")},o=()=>{n(dt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await S2()!=""&&n(dt.WALLET),!t&&e("backNextButton")};return k.jsx("div",{className:qu.container,children:k.jsxs("div",{className:qu.buttonContainer,children:[k.jsx("button",{className:qu.button,onClick:i,children:k.jsx("img",{src:"./assets/media/btn_create_character.png"})}),k.jsx("button",{className:qu.button,onClick:s,children:k.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),k.jsx("button",{className:qu.button,onClick:o,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),PO&&PO!=""&&k.jsx("button",{className:qu.button,onClick:a,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const uc={};var M2={exports:{}},ph=typeof Reflect=="object"?Reflect:null,DO=ph&&typeof ph.apply=="function"?ph.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Ey;ph&&typeof ph.ownKeys=="function"?Ey=ph.ownKeys:Object.getOwnPropertySymbols?Ey=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ey=function(e){return Object.getOwnPropertyNames(e)};function gDe(n){console&&console.warn&&console.warn(n)}var Gz=Number.isNaN||function(e){return e!==e};function en(){en.init.call(this)}M2.exports=en;M2.exports.once=xDe;en.EventEmitter=en;en.prototype._events=void 0;en.prototype._eventsCount=0;en.prototype._maxListeners=void 0;var OO=10;function F_(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(en,"defaultMaxListeners",{enumerable:!0,get:function(){return OO},set:function(n){if(typeof n!="number"||n<0||Gz(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");OO=n}});en.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};en.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Gz(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 Vz(n){return n._maxListeners===void 0?en.defaultMaxListeners:n._maxListeners}en.prototype.getMaxListeners=function(){return Vz(this)};en.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")DO(l,this,t);else for(var A=l.length,c=Yz(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,gDe(a)}return n}en.prototype.addListener=function(e,t){return jz(this,e,t,!1)};en.prototype.on=en.prototype.addListener;en.prototype.prependListener=function(e,t){return jz(this,e,t,!0)};function vDe(){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 Wz(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=vDe.bind(r);return i.listener=t,r.wrapFn=i,i}en.prototype.once=function(e,t){return F_(t),this.on(e,Wz(this,e,t)),this};en.prototype.prependOnceListener=function(e,t){return F_(t),this.prependListener(e,Wz(this,e,t)),this};en.prototype.removeListener=function(e,t){var r,i,s,o,a;if(F_(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():yDe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};en.prototype.off=en.prototype.removeListener;en.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 Kz(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?wDe(i):Yz(i,i.length)}en.prototype.listeners=function(e){return Kz(this,e,!0)};en.prototype.rawListeners=function(e){return Kz(this,e,!1)};en.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):$z.call(n,e)};en.prototype.listenerCount=$z;function $z(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}en.prototype.eventNames=function(){return this._eventsCount>0?Ey(this._events):[]};function Yz(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 Cy(n,e,t){return CDe()?Cy=Reflect.construct:Cy=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&ox(A,o.prototype),A},Cy.apply(null,arguments)}function SDe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function ax(n){var e=typeof Map=="function"?new Map:void 0;return ax=function(r){if(r===null||!SDe(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 Cy(r,arguments,bS(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ox(i,r)},ax(n)}function Pv(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 ef(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function ko(n){return n.hasOwnProperty("result")?n.result:n}var DB=function(n){T2(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}(ax(Error)),MDe=function(n){T2(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}(ax(Error)),TDe=function(n){T2(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Pv(i)),i.handleChainChanged=i.handleChainChanged.bind(Pv(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Pv(i)),i.handleClose=i.handleClose.bind(Pv(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 _S({provider:window.ethereum},a?{account:a}:{})}var f=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(h){return h&&ko(h)[0]})).then(function(h){a=h})}();return f&&f.then?f.then(u):u(f)},s=!1,o=this;if(!window.ethereum)throw new DB;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=ef(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(A){return ko(A)[0]})).then(function(A){a=A})},function(A){if(A.code===4001)throw new MDe});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=ko(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=ko(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=ef(function(){return Promise.resolve(window.ethereum.send("net_version").then(ko)).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 DB;var s,o=ef(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then(ko)).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=ko(window.ethereum.send({method:"eth_accounts"}))[0]),s}var A=function(){if(!s){var c=ef(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return ko(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 DB;var s,o=ef(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return ko(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(ef(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return ko(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(EDe);function IDe(){const{account:n,library:e,activate:t}=z9(),[r,i]=ye.useState([]),{setViewMode:s}=Y.useContext(Ui),{playSound:o}=Y.useContext(Ys),{isMute:a}=Y.useContext($s),l=new TDe({supportedChainIds:[137,1,3,4,5,42,97]});ye.useEffect(()=>{if(n&&e){const f="0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",h=["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 C_(f,h,e);p.balanceOf(n).then(d=>{const g=[];for(let m=0;m{const y=m.map(w=>p.tokenURI(w));Promise.all(y).then(w=>{i(w)})})})}},[n,e]);const A=()=>{t(l)},c=f=>{!a&&o("backNextButton"),s(dt.APPEARANCE)},u=()=>{s(dt.LANDING),!a&&o("backNextButton")};return k.jsxs("div",{className:uc.container,children:[!n&&k.jsxs("div",{className:uc.message,children:["Please connect your wallet to load your characters",k.jsx("button",{className:uc.button,onClick:()=>A(),children:"Connect"})]}),k.jsxs("div",{className:uc.characterContainer,children:[k.jsx("div",{className:uc.title,children:"Load Character"}),r.map((f,h)=>k.jsx("div",{className:uc.character,onClick:()=>{c()},children:JSON.stringify(f)},h))]}),k.jsx("button",{className:uc.button,onClick:()=>u(),children:"Back"})]})}const RDe="_container_q73cc_1",FDe="_mintContainer_q73cc_6",UDe="_mainTitleWrap_q73cc_33",LDe="_mainTitle_q73cc_33",PDe="_mintButtonContainer_q73cc_49",DDe="_mintButton_q73cc_49",ODe="_genesisText_q73cc_60",NDe="_required_q73cc_64",kDe="_divider_q73cc_68",QDe="_bottomContainer_q73cc_75",HDe="_mintInfo_q73cc_85",zDe="_topLine_q73cc_91",GDe="_bottomLine_q73cc_104",gi={container:RDe,mintContainer:FDe,mainTitleWrap:UDe,mainTitle:LDe,mintButtonContainer:PDe,mintButton:DDe,genesisText:ODe,required:NDe,divider:kDe,bottomContainer:QDe,mintInfo:HDe,topLine:zDe,bottomLine:GDe};function VDe(){const{model:n,avatar:e}=Y.useContext(or),{setViewMode:t}=Y.useContext(Ui),{playSound:r}=Y.useContext(Ys),{isMute:i}=Y.useContext($s),[s,o]=Y.useState(""),[a,l]=Y.useState(!1),A=()=>{t(dt.SAVE),!i&&r("backNextButton")};function c(){return k.jsxs("div",{className:gi.mainTitleWrap,children:[k.jsx("div",{className:gi.topLine}),k.jsx("div",{className:gi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const p=await jPe(e,null,n,{name:"XXXRestore"}.name);o(p),l(!1),console.log(p)}return k.jsxs("div",{className:gi.container,children:[k.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),k.jsxs("div",{className:gi.mintContainer,children:[k.jsx(c,{}),k.jsxs("div",{className:gi.mintButtonContainer,children:[k.jsx(_n,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:gi.mintButton,disabled:a,onClick:u,minWidth:220}),k.jsx("div",{className:gi.divider}),k.jsx(_n,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:gi.mintButton,disabled:!0,minWidth:220}),k.jsxs("span",{className:gi.genesisText,children:["(",k.jsx("span",{className:gi.required,children:"Coming Soon!"}),")"]})]}),k.jsxs("span",{className:gi.mintInfo,children:[s," "]})]}),k.jsx("div",{className:gi.bottomContainer,children:k.jsx(_n,{theme:"light",text:"Back",size:14,className:gi.buttonLeft,onClick:A})})]})}function jDe(){const{isLoading:n,setViewMode:e}=Y.useContext(Ui),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=Y.useContext(or),{playSound:l}=Y.useContext(Ys),{isMute:A}=Y.useContext($s),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=ye.useState([]),[g,m]=ye.useState(0),[y,w]=Y.useState("T-Pose"),x=()=>{!A&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(dt.LANDING)},_=()=>{const E=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:E===0||E==2,exportMtoonAtlas:E===1||E==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var W;(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(E+"_portrait",512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await r.downloadVRM(E+"_merged",_());const z=new ad,K=s.parent;K.remove(s),(W=r.getCurrentOptimizerCharacterModel().data)==null||W.isVRM0;const O=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(O===!0){const ee=t.loras.map(async F=>o.createLoraData(F,z));await Promise.all(ee)}const B=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(B===!0){const ee=t.sprites.map(async F=>a.createSpriteAtlas(F,z));await Promise.all(ee)}(O===!0||B===!0)&&z.saveZip(E),K.add(s)})()},{t:b}=ye.useContext(To),M=async E=>{if(r.getCurrentOptimizerCharacterModel()){const P=ul(E.name),L=URL.createObjectURL(E);await i.loadAnimation(L,!1,0,!0,"",P),w(i.getCurrentAnimationName()),URL.revokeObjectURL(L)}else console.warn("Please load a vrm model to test animations.")},D=()=>{if(g===0)H(p[p.length-1]),m(p.length-1);else{const E=g-1;H(p[E]),m(E)}},$=()=>{if(g>=p.length-1)H(p[0]),m(0);else{const E=g+1;H(p[E]),m(E)}},H=async E=>{const U=URL.createObjectURL(E);await r.loadOptimizerCharacter(U),URL.revokeObjectURL(U);const P=ul(E.name);h(P),u({...r.getCurrentCharacterModel()})},I=async E=>{H(E[0]);const U=[];for(let P=0;P{const U=E[0];U&&U.name.toLowerCase().endsWith(".fbx")&&M(U),U&&U.name.toLowerCase().endsWith(".vrm")&&I(E)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),k.jsx(Cg,{onFilesDrop:v}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),k.jsx(y2,{model:c,name:f,files:p,index:g,nextVrm:$,previousVrm:D}),k.jsx(a_,{loadedAnimationName:y}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:b("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(p==null?void 0:p.length)>1!=""&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:C}),c!=""&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:S})]})]})}const WDe="_buttonContainer_1fd4o_1",KDe="_buttonLeft_1fd4o_10",$De="_buttonRight_1fd4o_14",YDe="_buttonCenter_1fd4o_18",Dv={buttonContainer:WDe,buttonLeft:KDe,buttonRight:$De,buttonCenter:YDe},XDe="_button_13dfi_1",NO={button:XDe},ZDe="Anon",JDe=()=>{ye.useContext(To);const[n]=Y.useState(localStorage.getItem("name")||ZDe),{model:e,characterManager:t}=ye.useContext(or),r=()=>{const o=Oe.mergeOptions_sel_option||0;return{createTextureAtlas:Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),ktxCompression:Oe.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},i=()=>{const o=r();t.downloadVRM(n,o)},s=()=>{const o=r();t.downloadGLB(n,o)};return k.jsxs(Y.Fragment,{children:[k.jsx(_n,{theme:"light",text:"GLB",icon:"download",size:14,className:NO.button,onClick:()=>{s()}}),k.jsx(_n,{theme:"light",text:"VRM",icon:"download",size:14,className:NO.button,onClick:i})]})};function qDe(){const{t:n}=ye.useContext(To),{playSound:e}=Y.useContext(Ys),{isMute:t}=Y.useContext($s),{setViewMode:r}=Y.useContext(Ui),i=()=>{r(dt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(dt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return k.jsxs("div",{className:Dv.container,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),k.jsxs("div",{className:Dv.buttonContainer,children:[k.jsx(Cg,{onFilesDrop:o}),k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:Dv.buttonLeft,onClick:i}),k.jsx(B_,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),k.jsx(JDe,{}),k.jsx(_n,{theme:"light",text:"mint",size:14,className:Dv.buttonRight,onClick:s})]})]})}function eOe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or);ye.useState([]);const[l,A]=ye.useState([]);ye.useEffect(()=>{c()},[]);const c=async()=>{const d=await S2();GPe(d,"the-anata-nft").then(g=>{A(g.nfts),console.log(g.nfts)})},u=()=>{e(dt.LANDING),!s&&i("backNextButton")},f=async d=>{t(!0),a.loadManifest(o[d].manifest).then(()=>{e(dt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{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 k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsx("div",{className:ot.classContainer,children:l.map((d,g)=>k.jsxs("div",{className:ot.class,onClick:()=>f(g),onMouseOver:()=>p(),children:[k.jsx("div",{className:ot.classFrame,style:{backgroundImage:`url(${d.image_url})`},children:k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),k.jsx("div",{className:ot.name,children:d.name})]},g))}),k.jsx("div",{className:ot.bottomLine}),k.jsxs("div",{className:ot.buttonContainer,children:[k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:u}),k.jsx(_n,{theme:"light",text:"test",size:14,className:ot.buttonLeft,onClick:h})]})]})}const tOe=".//manifest.json",nOe=6,rOe=new Z(0,.8,0);new Z(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function iOe(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 sOe(){const n=await iOe(tOe),e=new Ape;return{initialManifest:n,effectManager:e}}const oOe=()=>{let n,e;const r=sOe().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}}},aOe=oOe();function lOe(){const{initialManifest:n,effectManager:e}=aOe.read(),[t,r]=ye.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=ye.useContext(or),{viewMode:u}=ye.useContext(Ui);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:rOe.y,targetZ:0,distance:nOe}),s&&([dt.APPEARANCE,dt.SAVE,dt.OPTIMIZER,dt.BATCHDOWNLOAD,dt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,p]=ye.useState(!1),[d,g]=ye.useState(""),[m,y]=ye.useState([]),w=(C,S)=>{g(C),p(!0),y([S])},x={[dt.LANDING]:k.jsx(mDe,{}),[dt.APPEARANCE]:k.jsx(dLe,{confirmDialog:w}),[dt.OPTIMIZER]:k.jsx(jDe,{}),[dt.CREATE]:k.jsx(hDe,{}),[dt.WALLET]:k.jsx(eOe,{}),[dt.CLAIM]:k.jsx(fDe,{}),[dt.BATCHMANIFEST]:k.jsx(KPe,{}),[dt.BATCHDOWNLOAD]:k.jsx(GLe,{}),[dt.LOAD]:k.jsx(IDe,{}),[dt.MINT]:k.jsx(VDe,{}),[dt.SAVE]:k.jsx(qDe,{})};let _=0;return ye.useEffect(()=>{const C=S=>{const b=new Date().getTime(),M=b-_;M<300&&M>10&&S.target.id=="editor-scene"&&r(!t),_=b};return window.addEventListener("touchend",C),window.addEventListener("click",C),()=>{window.removeEventListener("touchend",C),window.removeEventListener("click",C)}},[t]),ye.useEffect(()=>{if(A!=null)return f(),A.enabled=!0,[dt.LANDING,dt.CREATE,dt.CLAIM,dt.LOAD,dt.CLAIM,dt.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,A]),ye.useEffect(()=>{l(n)},[n]),ye.useContext(To),k.jsxs(ye.Fragment,{children:[k.jsx("div",{className:"generalTitle",children:"Character Studio"}),k.jsx(Spe,{confirmDialogText:d,confirmDialogCallback:m,confirmDialogWindow:h,setConfirmDialogWindow:p}),k.jsx(Rpe,{}),x[u]]})}const AOe=n=>{const e=new kS(n);return e.pollingInterval=12e3,e};KB.createRoot(document.getElementById("root")).render(k.jsx(Y.StrictMode,{children:k.jsx(Q9,{getLibrary:AOe,children:k.jsx(XK,{children:k.jsx(Hde,{children:k.jsx($K,{children:k.jsx(yhe,{children:k.jsx(ghe,{children:k.jsx(Mhe,{children:k.jsx(ye.Suspense,{children:k.jsx(lOe,{})})})})})})})})})}));export{ta as c,bl as g}; diff --git a/index.html b/index.html index 48b7758e..e93e69aa 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Character Studio - +