graz 0.0.44-alpha.1 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var bo=Object.create;var Xe=Object.defineProperty;var Ro=Object.getOwnPropertyDescriptor;var Oo=Object.getOwnPropertyNames;var No=Object.getPrototypeOf,Do=Object.prototype.hasOwnProperty;var w=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Lo=(t,e)=>{for(var n in e)Xe(t,n,{get:e[n],enumerable:!0})},vn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Oo(e))!Do.call(t,s)&&s!==n&&Xe(t,s,{get:()=>e[s],enumerable:!(r=Ro(e,s))||r.enumerable});return t};var Ye=(t,e,n)=>(n=t!=null?bo(No(t)):{},vn(e||!t||!t.__esModule?Xe(n,"default",{value:t,enumerable:!0}):n,t)),qo=t=>vn(Xe({},"__esModule",{value:!0}),t);var Gn=w((Fu,Pn)=>{"use strict";Pn.exports=b;var M=null;try{M=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function b(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}b.prototype.__isLong__;Object.defineProperty(b.prototype,"__isLong__",{value:!0});function B(t){return(t&&t.__isLong__)===!0}b.isLong=B;var On={},Nn={};function ce(t,e){var n,r,s;return e?(t>>>=0,(s=0<=t&&t<256)&&(r=Nn[t],r)?r:(n=R(t,(t|0)<0?-1:0,!0),s&&(Nn[t]=n),n)):(t|=0,(s=-128<=t&&t<128)&&(r=On[t],r)?r:(n=R(t,t<0?-1:0,!1),s&&(On[t]=n),n))}b.fromInt=ce;function k(t,e){if(isNaN(t))return e?ae:z;if(e){if(t<0)return ae;if(t>=_n)return Fn}else{if(t<=-Ln)return U;if(t+1>=Ln)return $n}return t<0?k(-t,e).neg():R(t%Ae|0,t/Ae|0,e)}b.fromNumber=k;function R(t,e,n){return new b(t,e,n)}b.fromBits=R;var Ze=Math.pow;function Tt(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return z;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return Tt(t.substring(1),e,n).neg();for(var s=k(Ze(n,8)),o=z,i=0;i<t.length;i+=8){var c=Math.min(8,t.length-i),a=parseInt(t.substring(i,i+c),n);if(c<8){var u=k(Ze(n,c));o=o.mul(u).add(k(a))}else o=o.mul(s),o=o.add(k(a))}return o.unsigned=e,o}b.fromString=Tt;function H(t,e){return typeof t=="number"?k(t,e):typeof t=="string"?Tt(t,e):R(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}b.fromValue=H;var Dn=65536,Fo=1<<24,Ae=Dn*Dn,_n=Ae*Ae,Ln=_n/2,qn=ce(Fo),z=ce(0);b.ZERO=z;var ae=ce(0,!0);b.UZERO=ae;var we=ce(1);b.ONE=we;var jn=ce(1,!0);b.UONE=jn;var vt=ce(-1);b.NEG_ONE=vt;var $n=R(-1,2147483647,!1);b.MAX_VALUE=$n;var Fn=R(-1,-1,!0);b.MAX_UNSIGNED_VALUE=Fn;var U=R(0,-2147483648,!1);b.MIN_VALUE=U;var l=b.prototype;l.toInt=function(){return this.unsigned?this.low>>>0:this.low};l.toNumber=function(){return this.unsigned?(this.high>>>0)*Ae+(this.low>>>0):this.high*Ae+(this.low>>>0)};l.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(U)){var n=k(e),r=this.div(n),s=r.mul(n).sub(this);return r.toString(e)+s.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=k(Ze(e,6),this.unsigned),i=this,c="";;){var a=i.div(o),u=i.sub(a.mul(o)).toInt()>>>0,p=u.toString(e);if(i=a,i.isZero())return p+c;for(;p.length<6;)p="0"+p;c=""+p+c}};l.getHighBits=function(){return this.high};l.getHighBitsUnsigned=function(){return this.high>>>0};l.getLowBits=function(){return this.low};l.getLowBitsUnsigned=function(){return this.low>>>0};l.getNumBitsAbs=function(){if(this.isNegative())return this.eq(U)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};l.isZero=function(){return this.high===0&&this.low===0};l.eqz=l.isZero;l.isNegative=function(){return!this.unsigned&&this.high<0};l.isPositive=function(){return this.unsigned||this.high>=0};l.isOdd=function(){return(this.low&1)===1};l.isEven=function(){return(this.low&1)===0};l.equals=function(e){return B(e)||(e=H(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};l.eq=l.equals;l.notEquals=function(e){return!this.eq(e)};l.neq=l.notEquals;l.ne=l.notEquals;l.lessThan=function(e){return this.comp(e)<0};l.lt=l.lessThan;l.lessThanOrEqual=function(e){return this.comp(e)<=0};l.lte=l.lessThanOrEqual;l.le=l.lessThanOrEqual;l.greaterThan=function(e){return this.comp(e)>0};l.gt=l.greaterThan;l.greaterThanOrEqual=function(e){return this.comp(e)>=0};l.gte=l.greaterThanOrEqual;l.ge=l.greaterThanOrEqual;l.compare=function(e){if(B(e)||(e=H(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};l.comp=l.compare;l.negate=function(){return!this.unsigned&&this.eq(U)?U:this.not().add(we)};l.neg=l.negate;l.add=function(e){B(e)||(e=H(e));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,o=this.low&65535,i=e.high>>>16,c=e.high&65535,a=e.low>>>16,u=e.low&65535,p=0,h=0,C=0,m=0;return m+=o+u,C+=m>>>16,m&=65535,C+=s+a,h+=C>>>16,C&=65535,h+=r+c,p+=h>>>16,h&=65535,p+=n+i,p&=65535,R(C<<16|m,p<<16|h,this.unsigned)};l.subtract=function(e){return B(e)||(e=H(e)),this.add(e.neg())};l.sub=l.subtract;l.multiply=function(e){if(this.isZero())return z;if(B(e)||(e=H(e)),M){var n=M.mul(this.low,this.high,e.low,e.high);return R(n,M.get_high(),this.unsigned)}if(e.isZero())return z;if(this.eq(U))return e.isOdd()?U:z;if(e.eq(U))return this.isOdd()?U:z;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(qn)&&e.lt(qn))return k(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,o=this.low>>>16,i=this.low&65535,c=e.high>>>16,a=e.high&65535,u=e.low>>>16,p=e.low&65535,h=0,C=0,m=0,F=0;return F+=i*p,m+=F>>>16,F&=65535,m+=o*p,C+=m>>>16,m&=65535,m+=i*u,C+=m>>>16,m&=65535,C+=s*p,h+=C>>>16,C&=65535,C+=o*u,h+=C>>>16,C&=65535,C+=i*a,h+=C>>>16,C&=65535,h+=r*p+s*u+o*a+i*c,h&=65535,R(m<<16|F,h<<16|C,this.unsigned)};l.mul=l.multiply;l.divide=function(e){if(B(e)||(e=H(e)),e.isZero())throw Error("division by zero");if(M){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?M.div_u:M.div_s)(this.low,this.high,e.low,e.high);return R(n,M.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ae:z;var r,s,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return ae;if(e.gt(this.shru(1)))return jn;o=ae}else{if(this.eq(U)){if(e.eq(we)||e.eq(vt))return U;if(e.eq(U))return we;var i=this.shr(1);return r=i.div(e).shl(1),r.eq(z)?e.isNegative()?we:vt:(s=this.sub(e.mul(r)),o=r.add(s.div(e)),o)}else if(e.eq(U))return this.unsigned?ae:z;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=z}for(s=this;s.gte(e);){r=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(r)/Math.LN2),a=c<=48?1:Ze(2,c-48),u=k(r),p=u.mul(e);p.isNegative()||p.gt(s);)r-=a,u=k(r,this.unsigned),p=u.mul(e);u.isZero()&&(u=we),o=o.add(u),s=s.sub(p)}return o};l.div=l.divide;l.modulo=function(e){if(B(e)||(e=H(e)),M){var n=(this.unsigned?M.rem_u:M.rem_s)(this.low,this.high,e.low,e.high);return R(n,M.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};l.mod=l.modulo;l.rem=l.modulo;l.not=function(){return R(~this.low,~this.high,this.unsigned)};l.and=function(e){return B(e)||(e=H(e)),R(this.low&e.low,this.high&e.high,this.unsigned)};l.or=function(e){return B(e)||(e=H(e)),R(this.low|e.low,this.high|e.high,this.unsigned)};l.xor=function(e){return B(e)||(e=H(e)),R(this.low^e.low,this.high^e.high,this.unsigned)};l.shiftLeft=function(e){return B(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?R(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):R(0,this.low<<e-32,this.unsigned)};l.shl=l.shiftLeft;l.shiftRight=function(e){return B(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?R(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):R(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};l.shr=l.shiftRight;l.shiftRightUnsigned=function(e){if(B(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return R(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?R(n,0,this.unsigned):R(n>>>e-32,0,this.unsigned)};l.shru=l.shiftRightUnsigned;l.shr_u=l.shiftRightUnsigned;l.toSigned=function(){return this.unsigned?R(this.low,this.high,!1):this};l.toUnsigned=function(){return this.unsigned?this:R(this.low,this.high,!0)};l.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};l.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};l.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};b.fromBytes=function(e,n,r){return r?b.fromBytesLE(e,n):b.fromBytesBE(e,n)};b.fromBytesLE=function(e,n){return new b(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};b.fromBytesBE=function(e,n){return new b(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)}});var $e=w((tp,Tr)=>{"use strict";var $i="2.0.0",Fi=Number.MAX_SAFE_INTEGER||9007199254740991,Pi=16,Gi=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Tr.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Pi,MAX_SAFE_INTEGER:Fi,RELEASE_TYPES:Gi,SEMVER_SPEC_VERSION:$i,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Fe=w((np,br)=>{"use strict";var Ui=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};br.exports=Ui});var be=w((oe,Rr)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:en}=$e(),Bi=Fe();oe=Rr.exports={};var Wi=oe.re=[],f=oe.src=[],g=oe.t={},Mi=0,x=(t,e,n)=>{let r=Mi++;Bi(t,r,e),g[t]=r,f[r]=e,Wi[r]=new RegExp(e,n?"g":void 0)};x("NUMERICIDENTIFIER","0|[1-9]\\d*");x("NUMERICIDENTIFIERLOOSE","[0-9]+");x("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");x("MAINVERSION",`(${f[g.NUMERICIDENTIFIER]})\\.(${f[g.NUMERICIDENTIFIER]})\\.(${f[g.NUMERICIDENTIFIER]})`);x("MAINVERSIONLOOSE",`(${f[g.NUMERICIDENTIFIERLOOSE]})\\.(${f[g.NUMERICIDENTIFIERLOOSE]})\\.(${f[g.NUMERICIDENTIFIERLOOSE]})`);x("PRERELEASEIDENTIFIER",`(?:${f[g.NUMERICIDENTIFIER]}|${f[g.NONNUMERICIDENTIFIER]})`);x("PRERELEASEIDENTIFIERLOOSE",`(?:${f[g.NUMERICIDENTIFIERLOOSE]}|${f[g.NONNUMERICIDENTIFIER]})`);x("PRERELEASE",`(?:-(${f[g.PRERELEASEIDENTIFIER]}(?:\\.${f[g.PRERELEASEIDENTIFIER]})*))`);x("PRERELEASELOOSE",`(?:-?(${f[g.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${f[g.PRERELEASEIDENTIFIERLOOSE]})*))`);x("BUILDIDENTIFIER","[0-9A-Za-z-]+");x("BUILD",`(?:\\+(${f[g.BUILDIDENTIFIER]}(?:\\.${f[g.BUILDIDENTIFIER]})*))`);x("FULLPLAIN",`v?${f[g.MAINVERSION]}${f[g.PRERELEASE]}?${f[g.BUILD]}?`);x("FULL",`^${f[g.FULLPLAIN]}$`);x("LOOSEPLAIN",`[v=\\s]*${f[g.MAINVERSIONLOOSE]}${f[g.PRERELEASELOOSE]}?${f[g.BUILD]}?`);x("LOOSE",`^${f[g.LOOSEPLAIN]}$`);x("GTLT","((?:<|>)?=?)");x("XRANGEIDENTIFIERLOOSE",`${f[g.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);x("XRANGEIDENTIFIER",`${f[g.NUMERICIDENTIFIER]}|x|X|\\*`);x("XRANGEPLAIN",`[v=\\s]*(${f[g.XRANGEIDENTIFIER]})(?:\\.(${f[g.XRANGEIDENTIFIER]})(?:\\.(${f[g.XRANGEIDENTIFIER]})(?:${f[g.PRERELEASE]})?${f[g.BUILD]}?)?)?`);x("XRANGEPLAINLOOSE",`[v=\\s]*(${f[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${f[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${f[g.XRANGEIDENTIFIERLOOSE]})(?:${f[g.PRERELEASELOOSE]})?${f[g.BUILD]}?)?)?`);x("XRANGE",`^${f[g.GTLT]}\\s*${f[g.XRANGEPLAIN]}$`);x("XRANGELOOSE",`^${f[g.GTLT]}\\s*${f[g.XRANGEPLAINLOOSE]}$`);x("COERCE",`(^|[^\\d])(\\d{1,${en}})(?:\\.(\\d{1,${en}}))?(?:\\.(\\d{1,${en}}))?(?:$|[^\\d])`);x("COERCERTL",f[g.COERCE],!0);x("LONETILDE","(?:~>?)");x("TILDETRIM",`(\\s*)${f[g.LONETILDE]}\\s+`,!0);oe.tildeTrimReplace="$1~";x("TILDE",`^${f[g.LONETILDE]}${f[g.XRANGEPLAIN]}$`);x("TILDELOOSE",`^${f[g.LONETILDE]}${f[g.XRANGEPLAINLOOSE]}$`);x("LONECARET","(?:\\^)");x("CARETTRIM",`(\\s*)${f[g.LONECARET]}\\s+`,!0);oe.caretTrimReplace="$1^";x("CARET",`^${f[g.LONECARET]}${f[g.XRANGEPLAIN]}$`);x("CARETLOOSE",`^${f[g.LONECARET]}${f[g.XRANGEPLAINLOOSE]}$`);x("COMPARATORLOOSE",`^${f[g.GTLT]}\\s*(${f[g.LOOSEPLAIN]})$|^$`);x("COMPARATOR",`^${f[g.GTLT]}\\s*(${f[g.FULLPLAIN]})$|^$`);x("COMPARATORTRIM",`(\\s*)${f[g.GTLT]}\\s*(${f[g.LOOSEPLAIN]}|${f[g.XRANGEPLAIN]})`,!0);oe.comparatorTrimReplace="$1$2$3";x("HYPHENRANGE",`^\\s*(${f[g.XRANGEPLAIN]})\\s+-\\s+(${f[g.XRANGEPLAIN]})\\s*$`);x("HYPHENRANGELOOSE",`^\\s*(${f[g.XRANGEPLAINLOOSE]})\\s+-\\s+(${f[g.XRANGEPLAINLOOSE]})\\s*$`);x("STAR","(<|>)?=?\\s*\\*");x("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");x("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var at=w((rp,Or)=>{"use strict";var ki=Object.freeze({loose:!0}),zi=Object.freeze({}),Ki=t=>t?typeof t!="object"?ki:t:zi;Or.exports=Ki});var tn=w((sp,Lr)=>{"use strict";var Nr=/^[0-9]+$/,Dr=(t,e)=>{let n=Nr.test(t),r=Nr.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:t<e?-1:1},Qi=(t,e)=>Dr(e,t);Lr.exports={compareIdentifiers:Dr,rcompareIdentifiers:Qi}});var _=w((op,$r)=>{"use strict";var ct=Fe(),{MAX_LENGTH:qr,MAX_SAFE_INTEGER:ut}=$e(),{re:_r,t:jr}=be(),Vi=at(),{compareIdentifiers:Re}=tn(),nn=class t{constructor(e,n){if(n=Vi(n),e instanceof t){if(e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>qr)throw new TypeError(`version is longer than ${qr} characters`);ct("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let r=e.trim().match(n.loose?_r[jr.LOOSE]:_r[jr.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>ut||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ut||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ut||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let o=+s;if(o>=0&&o<ut)return o}return s}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(ct("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),Re(this.major,e.major)||Re(this.minor,e.minor)||Re(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let n=0;do{let r=this.prerelease[n],s=e.prerelease[n];if(ct("prerelease compare",n,r,s),r===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(r===void 0)return-1;if(r===s)continue;return Re(r,s)}while(++n)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let n=0;do{let r=this.build[n],s=e.build[n];if(ct("prerelease compare",n,r,s),r===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(r===void 0)return-1;if(r===s)continue;return Re(r,s)}while(++n)}inc(e,n,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(r)?1:0;if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(n){let o=[n,s];r===!1&&(o=[n]),Re(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};$r.exports=nn});var fe=w((ip,Pr)=>{"use strict";var Fr=_(),Hi=(t,e,n=!1)=>{if(t instanceof Fr)return t;try{return new Fr(t,e)}catch(r){if(!n)return null;throw r}};Pr.exports=Hi});var Ur=w((ap,Gr)=>{"use strict";var Xi=fe(),Yi=(t,e)=>{let n=Xi(t,e);return n?n.version:null};Gr.exports=Yi});var Wr=w((cp,Br)=>{"use strict";var Zi=fe(),Ji=(t,e)=>{let n=Zi(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null};Br.exports=Ji});var zr=w((up,kr)=>{"use strict";var Mr=_(),ea=(t,e,n,r,s)=>{typeof n=="string"&&(s=r,r=n,n=void 0);try{return new Mr(t instanceof Mr?t.version:t,n).inc(e,r,s).version}catch{return null}};kr.exports=ea});var Vr=w((lp,Qr)=>{"use strict";var Kr=fe(),ta=(t,e)=>{let n=Kr(t,null,!0),r=Kr(e,null,!0),s=n.compare(r);if(s===0)return null;let o=s>0,i=o?n:r,c=o?r:n,a=!!i.prerelease.length,u=a?"pre":"";return n.major!==r.major?u+"major":n.minor!==r.minor?u+"minor":n.patch!==r.patch?u+"patch":a?"prerelease":c.patch?"patch":c.minor?"minor":"major"};Qr.exports=ta});var Xr=w((pp,Hr)=>{"use strict";var na=_(),ra=(t,e)=>new na(t,e).major;Hr.exports=ra});var Zr=w((hp,Yr)=>{"use strict";var sa=_(),oa=(t,e)=>new sa(t,e).minor;Yr.exports=oa});var es=w((mp,Jr)=>{"use strict";var ia=_(),aa=(t,e)=>new ia(t,e).patch;Jr.exports=aa});var ns=w((fp,ts)=>{"use strict";var ca=fe(),ua=(t,e)=>{let n=ca(t,e);return n&&n.prerelease.length?n.prerelease:null};ts.exports=ua});var K=w((gp,ss)=>{"use strict";var rs=_(),la=(t,e,n)=>new rs(t,n).compare(new rs(e,n));ss.exports=la});var is=w((dp,os)=>{"use strict";var pa=K(),ha=(t,e,n)=>pa(e,t,n);os.exports=ha});var cs=w((yp,as)=>{"use strict";var ma=K(),fa=(t,e)=>ma(t,e,!0);as.exports=fa});var lt=w((Ep,ls)=>{"use strict";var us=_(),ga=(t,e,n)=>{let r=new us(t,n),s=new us(e,n);return r.compare(s)||r.compareBuild(s)};ls.exports=ga});var hs=w((Cp,ps)=>{"use strict";var da=lt(),ya=(t,e)=>t.sort((n,r)=>da(n,r,e));ps.exports=ya});var fs=w((Sp,ms)=>{"use strict";var Ea=lt(),Ca=(t,e)=>t.sort((n,r)=>Ea(r,n,e));ms.exports=Ca});var Pe=w((wp,gs)=>{"use strict";var Sa=K(),wa=(t,e,n)=>Sa(t,e,n)>0;gs.exports=wa});var pt=w((Ap,ds)=>{"use strict";var Aa=K(),xa=(t,e,n)=>Aa(t,e,n)<0;ds.exports=xa});var rn=w((xp,ys)=>{"use strict";var Ia=K(),va=(t,e,n)=>Ia(t,e,n)===0;ys.exports=va});var sn=w((Ip,Es)=>{"use strict";var Ta=K(),ba=(t,e,n)=>Ta(t,e,n)!==0;Es.exports=ba});var ht=w((vp,Cs)=>{"use strict";var Ra=K(),Oa=(t,e,n)=>Ra(t,e,n)>=0;Cs.exports=Oa});var mt=w((Tp,Ss)=>{"use strict";var Na=K(),Da=(t,e,n)=>Na(t,e,n)<=0;Ss.exports=Da});var on=w((bp,ws)=>{"use strict";var La=rn(),qa=sn(),_a=Pe(),ja=ht(),$a=pt(),Fa=mt(),Pa=(t,e,n,r)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t===n;case"!==":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t!==n;case"":case"=":case"==":return La(t,n,r);case"!=":return qa(t,n,r);case">":return _a(t,n,r);case">=":return ja(t,n,r);case"<":return $a(t,n,r);case"<=":return Fa(t,n,r);default:throw new TypeError(`Invalid operator: ${e}`)}};ws.exports=Pa});var xs=w((Rp,As)=>{"use strict";var Ga=_(),Ua=fe(),{re:ft,t:gt}=be(),Ba=(t,e)=>{if(t instanceof Ga)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let n=null;if(!e.rtl)n=t.match(ft[gt.COERCE]);else{let r;for(;(r=ft[gt.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)(!n||r.index+r[0].length!==n.index+n[0].length)&&(n=r),ft[gt.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;ft[gt.COERCERTL].lastIndex=-1}return n===null?null:Ua(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,e)};As.exports=Ba});var vs=w((Op,Is)=>{"use strict";Is.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var bs=w((Np,Ts)=>{"use strict";Ts.exports=T;T.Node=ge;T.create=T;function T(t){var e=this;if(e instanceof T||(e=new T),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(s){e.push(s)});else if(arguments.length>0)for(var n=0,r=arguments.length;n<r;n++)e.push(arguments[n]);return e}T.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,n=t.prev;return e&&(e.prev=n),n&&(n.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=n),t.list.length--,t.next=null,t.prev=null,t.list=null,e};T.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};T.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};T.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)Ma(this,arguments[t]);return this.length};T.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)ka(this,arguments[t]);return this.length};T.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}};T.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}};T.prototype.forEach=function(t,e){e=e||this;for(var n=this.head,r=0;n!==null;r++)t.call(e,n.value,r,this),n=n.next};T.prototype.forEachReverse=function(t,e){e=e||this;for(var n=this.tail,r=this.length-1;n!==null;r--)t.call(e,n.value,r,this),n=n.prev};T.prototype.get=function(t){for(var e=0,n=this.head;n!==null&&e<t;e++)n=n.next;if(e===t&&n!==null)return n.value};T.prototype.getReverse=function(t){for(var e=0,n=this.tail;n!==null&&e<t;e++)n=n.prev;if(e===t&&n!==null)return n.value};T.prototype.map=function(t,e){e=e||this;for(var n=new T,r=this.head;r!==null;)n.push(t.call(e,r.value,this)),r=r.next;return n};T.prototype.mapReverse=function(t,e){e=e||this;for(var n=new T,r=this.tail;r!==null;)n.push(t.call(e,r.value,this)),r=r.prev;return n};T.prototype.reduce=function(t,e){var n,r=this.head;if(arguments.length>1)n=e;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;r!==null;s++)n=t(n,r.value,s),r=r.next;return n};T.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;r!==null;s--)n=t(n,r.value,s),r=r.prev;return n};T.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;n!==null;e++)t[e]=n.value,n=n.next;return t};T.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;n!==null;e++)t[e]=n.value,n=n.prev;return t};T.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var n=new T;if(e<t||e<0)return n;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(;s!==null&&r<e;r++,s=s.next)n.push(s.value);return n};T.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var n=new T;if(e<t||e<0)return n;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=this.length,s=this.tail;s!==null&&r>e;r--)s=s.prev;for(;s!==null&&r>t;r--,s=s.prev)n.push(s.value);return n};T.prototype.splice=function(t,e,...n){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(var o=[],r=0;s&&r<e;r++)o.push(s.value),s=this.removeNode(s);s===null&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(var r=0;r<n.length;r++)s=Wa(this,s,n[r]);return o};T.prototype.reverse=function(){for(var t=this.head,e=this.tail,n=t;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=e,this.tail=t,this};function Wa(t,e,n){var r=e===t.head?new ge(n,null,e,t):new ge(n,e,e.next,t);return r.next===null&&(t.tail=r),r.prev===null&&(t.head=r),t.length++,r}function Ma(t,e){t.tail=new ge(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function ka(t,e){t.head=new ge(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function ge(t,e,n,r){if(!(this instanceof ge))return new ge(t,e,n,r);this.list=r,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{vs()(T)}catch{}});var Ls=w((Dp,Ds)=>{"use strict";var za=bs(),de=Symbol("max"),te=Symbol("length"),Oe=Symbol("lengthCalculator"),Ue=Symbol("allowStale"),ye=Symbol("maxAge"),ee=Symbol("dispose"),Rs=Symbol("noDisposeOnSet"),L=Symbol("lruList"),X=Symbol("cache"),Ns=Symbol("updateAgeOnGet"),an=()=>1,un=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let n=this[de]=e.max||1/0,r=e.length||an;if(this[Oe]=typeof r!="function"?an:r,this[Ue]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[ye]=e.maxAge||0,this[ee]=e.dispose,this[Rs]=e.noDisposeOnSet||!1,this[Ns]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[de]=e||1/0,Ge(this)}get max(){return this[de]}set allowStale(e){this[Ue]=!!e}get allowStale(){return this[Ue]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[ye]=e,Ge(this)}get maxAge(){return this[ye]}set lengthCalculator(e){typeof e!="function"&&(e=an),e!==this[Oe]&&(this[Oe]=e,this[te]=0,this[L].forEach(n=>{n.length=this[Oe](n.value,n.key),this[te]+=n.length})),Ge(this)}get lengthCalculator(){return this[Oe]}get length(){return this[te]}get itemCount(){return this[L].length}rforEach(e,n){n=n||this;for(let r=this[L].tail;r!==null;){let s=r.prev;Os(this,e,r,n),r=s}}forEach(e,n){n=n||this;for(let r=this[L].head;r!==null;){let s=r.next;Os(this,e,r,n),r=s}}keys(){return this[L].toArray().map(e=>e.key)}values(){return this[L].toArray().map(e=>e.value)}reset(){this[ee]&&this[L]&&this[L].length&&this[L].forEach(e=>this[ee](e.key,e.value)),this[X]=new Map,this[L]=new za,this[te]=0}dump(){return this[L].map(e=>dt(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[L]}set(e,n,r){if(r=r||this[ye],r&&typeof r!="number")throw new TypeError("maxAge must be a number");let s=r?Date.now():0,o=this[Oe](n,e);if(this[X].has(e)){if(o>this[de])return Ne(this,this[X].get(e)),!1;let a=this[X].get(e).value;return this[ee]&&(this[Rs]||this[ee](e,a.value)),a.now=s,a.maxAge=r,a.value=n,this[te]+=o-a.length,a.length=o,this.get(e),Ge(this),!0}let i=new ln(e,n,o,s,r);return i.length>this[de]?(this[ee]&&this[ee](e,n),!1):(this[te]+=i.length,this[L].unshift(i),this[X].set(e,this[L].head),Ge(this),!0)}has(e){if(!this[X].has(e))return!1;let n=this[X].get(e).value;return!dt(this,n)}get(e){return cn(this,e,!0)}peek(e){return cn(this,e,!1)}pop(){let e=this[L].tail;return e?(Ne(this,e),e.value):null}del(e){Ne(this,this[X].get(e))}load(e){this.reset();let n=Date.now();for(let r=e.length-1;r>=0;r--){let s=e[r],o=s.e||0;if(o===0)this.set(s.k,s.v);else{let i=o-n;i>0&&this.set(s.k,s.v,i)}}}prune(){this[X].forEach((e,n)=>cn(this,n,!1))}},cn=(t,e,n)=>{let r=t[X].get(e);if(r){let s=r.value;if(dt(t,s)){if(Ne(t,r),!t[Ue])return}else n&&(t[Ns]&&(r.value.now=Date.now()),t[L].unshiftNode(r));return s.value}},dt=(t,e)=>{if(!e||!e.maxAge&&!t[ye])return!1;let n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[ye]&&n>t[ye]},Ge=t=>{if(t[te]>t[de])for(let e=t[L].tail;t[te]>t[de]&&e!==null;){let n=e.prev;Ne(t,e),e=n}},Ne=(t,e)=>{if(e){let n=e.value;t[ee]&&t[ee](n.key,n.value),t[te]-=n.length,t[X].delete(n.key),t[L].removeNode(e)}},ln=class{constructor(e,n,r,s,o){this.key=e,this.value=n,this.length=r,this.now=s,this.maxAge=o||0}},Os=(t,e,n,r)=>{let s=n.value;dt(t,s)&&(Ne(t,n),t[Ue]||(s=void 0)),s&&e.call(r,s.value,s.key,t)};Ds.exports=un});var Q=w((Lp,$s)=>{"use strict";var pn=class t{constructor(e,n){if(n=Qa(n),e instanceof t)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new t(e.raw,n);if(e instanceof hn)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e,this.set=e.split("||").map(r=>this.parseRange(r.trim())).filter(r=>r.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter(s=>!_s(s[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&ec(s[0])){this.set=[s];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();let r=((this.options.includePrerelease&&Za)|(this.options.loose&&Ja))+":"+e,s=qs.get(r);if(s)return s;let o=this.options.loose,i=o?W[j.HYPHENRANGELOOSE]:W[j.HYPHENRANGE];e=e.replace(i,lc(this.options.includePrerelease)),N("hyphen replace",e),e=e.replace(W[j.COMPARATORTRIM],Ha),N("comparator trim",e),e=e.replace(W[j.TILDETRIM],Xa),e=e.replace(W[j.CARETTRIM],Ya),e=e.split(/\s+/).join(" ");let c=e.split(" ").map(h=>tc(h,this.options)).join(" ").split(/\s+/).map(h=>uc(h,this.options));o&&(c=c.filter(h=>(N("loose invalid filter",h,this.options),!!h.match(W[j.COMPARATORLOOSE])))),N("range list",c);let a=new Map,u=c.map(h=>new hn(h,this.options));for(let h of u){if(_s(h))return[h];a.set(h.value,h)}a.size>1&&a.has("")&&a.delete("");let p=[...a.values()];return qs.set(r,p),p}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(r=>js(r,n)&&e.set.some(s=>js(s,n)&&r.every(o=>s.every(i=>o.intersects(i,n)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Va(e,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(pc(this.set[n],e,this.options))return!0;return!1}};$s.exports=pn;var Ka=Ls(),qs=new Ka({max:1e3}),Qa=at(),hn=Be(),N=Fe(),Va=_(),{re:W,t:j,comparatorTrimReplace:Ha,tildeTrimReplace:Xa,caretTrimReplace:Ya}=be(),{FLAG_INCLUDE_PRERELEASE:Za,FLAG_LOOSE:Ja}=$e(),_s=t=>t.value==="<0.0.0-0",ec=t=>t.value==="",js=(t,e)=>{let n=!0,r=t.slice(),s=r.pop();for(;n&&r.length;)n=r.every(o=>s.intersects(o,e)),s=r.pop();return n},tc=(t,e)=>(N("comp",t,e),t=sc(t,e),N("caret",t),t=nc(t,e),N("tildes",t),t=ic(t,e),N("xrange",t),t=cc(t,e),N("stars",t),t),$=t=>!t||t.toLowerCase()==="x"||t==="*",nc=(t,e)=>t.trim().split(/\s+/).map(n=>rc(n,e)).join(" "),rc=(t,e)=>{let n=e.loose?W[j.TILDELOOSE]:W[j.TILDE];return t.replace(n,(r,s,o,i,c)=>{N("tilde",t,r,s,o,i,c);let a;return $(s)?a="":$(o)?a=`>=${s}.0.0 <${+s+1}.0.0-0`:$(i)?a=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`:c?(N("replaceTilde pr",c),a=`>=${s}.${o}.${i}-${c} <${s}.${+o+1}.0-0`):a=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`,N("tilde return",a),a})},sc=(t,e)=>t.trim().split(/\s+/).map(n=>oc(n,e)).join(" "),oc=(t,e)=>{N("caret",t,e);let n=e.loose?W[j.CARETLOOSE]:W[j.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(s,o,i,c,a)=>{N("caret",t,s,o,i,c,a);let u;return $(o)?u="":$(i)?u=`>=${o}.0.0${r} <${+o+1}.0.0-0`:$(c)?o==="0"?u=`>=${o}.${i}.0${r} <${o}.${+i+1}.0-0`:u=`>=${o}.${i}.0${r} <${+o+1}.0.0-0`:a?(N("replaceCaret pr",a),o==="0"?i==="0"?u=`>=${o}.${i}.${c}-${a} <${o}.${i}.${+c+1}-0`:u=`>=${o}.${i}.${c}-${a} <${o}.${+i+1}.0-0`:u=`>=${o}.${i}.${c}-${a} <${+o+1}.0.0-0`):(N("no pr"),o==="0"?i==="0"?u=`>=${o}.${i}.${c}${r} <${o}.${i}.${+c+1}-0`:u=`>=${o}.${i}.${c}${r} <${o}.${+i+1}.0-0`:u=`>=${o}.${i}.${c} <${+o+1}.0.0-0`),N("caret return",u),u})},ic=(t,e)=>(N("replaceXRanges",t,e),t.split(/\s+/).map(n=>ac(n,e)).join(" ")),ac=(t,e)=>{t=t.trim();let n=e.loose?W[j.XRANGELOOSE]:W[j.XRANGE];return t.replace(n,(r,s,o,i,c,a)=>{N("xRange",t,r,s,o,i,c,a);let u=$(o),p=u||$(i),h=p||$(c),C=h;return s==="="&&C&&(s=""),a=e.includePrerelease?"-0":"",u?s===">"||s==="<"?r="<0.0.0-0":r="*":s&&C?(p&&(i=0),c=0,s===">"?(s=">=",p?(o=+o+1,i=0,c=0):(i=+i+1,c=0)):s==="<="&&(s="<",p?o=+o+1:i=+i+1),s==="<"&&(a="-0"),r=`${s+o}.${i}.${c}${a}`):p?r=`>=${o}.0.0${a} <${+o+1}.0.0-0`:h&&(r=`>=${o}.${i}.0${a} <${o}.${+i+1}.0-0`),N("xRange return",r),r})},cc=(t,e)=>(N("replaceStars",t,e),t.trim().replace(W[j.STAR],"")),uc=(t,e)=>(N("replaceGTE0",t,e),t.trim().replace(W[e.includePrerelease?j.GTE0PRE:j.GTE0],"")),lc=t=>(e,n,r,s,o,i,c,a,u,p,h,C,m)=>($(r)?n="":$(s)?n=`>=${r}.0.0${t?"-0":""}`:$(o)?n=`>=${r}.${s}.0${t?"-0":""}`:i?n=`>=${n}`:n=`>=${n}${t?"-0":""}`,$(u)?a="":$(p)?a=`<${+u+1}.0.0-0`:$(h)?a=`<${u}.${+p+1}.0-0`:C?a=`<=${u}.${p}.${h}-${C}`:t?a=`<${u}.${p}.${+h+1}-0`:a=`<=${a}`,`${n} ${a}`.trim()),pc=(t,e,n)=>{for(let r=0;r<t.length;r++)if(!t[r].test(e))return!1;if(e.prerelease.length&&!n.includePrerelease){for(let r=0;r<t.length;r++)if(N(t[r].semver),t[r].semver!==hn.ANY&&t[r].semver.prerelease.length>0){let s=t[r].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var Be=w((qp,Ws)=>{"use strict";var We=Symbol("SemVer ANY"),gn=class t{static get ANY(){return We}constructor(e,n){if(n=Fs(n),e instanceof t){if(e.loose===!!n.loose)return e;e=e.value}fn("comparator",e,n),this.options=n,this.loose=!!n.loose,this.parse(e),this.semver===We?this.value="":this.value=this.operator+this.semver.version,fn("comp",this)}parse(e){let n=this.options.loose?Ps[Gs.COMPARATORLOOSE]:Ps[Gs.COMPARATOR],r=e.match(n);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new Us(r[2],this.options.loose):this.semver=We}toString(){return this.value}test(e){if(fn("Comparator.test",e,this.options.loose),this.semver===We||e===We)return!0;if(typeof e=="string")try{e=new Us(e,this.options)}catch{return!1}return mn(e,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Bs(e.value,n).test(this.value):e.operator===""?e.value===""?!0:new Bs(this.value,n).test(e.semver):(n=Fs(n),n.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||mn(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||mn(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Ws.exports=gn;var Fs=at(),{re:Ps,t:Gs}=be(),mn=on(),fn=Fe(),Us=_(),Bs=Q()});var Me=w((_p,Ms)=>{"use strict";var hc=Q(),mc=(t,e,n)=>{try{e=new hc(e,n)}catch{return!1}return e.test(t)};Ms.exports=mc});var zs=w((jp,ks)=>{"use strict";var fc=Q(),gc=(t,e)=>new fc(t,e).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));ks.exports=gc});var Qs=w(($p,Ks)=>{"use strict";var dc=_(),yc=Q(),Ec=(t,e,n)=>{let r=null,s=null,o=null;try{o=new yc(e,n)}catch{return null}return t.forEach(i=>{o.test(i)&&(!r||s.compare(i)===-1)&&(r=i,s=new dc(r,n))}),r};Ks.exports=Ec});var Hs=w((Fp,Vs)=>{"use strict";var Cc=_(),Sc=Q(),wc=(t,e,n)=>{let r=null,s=null,o=null;try{o=new Sc(e,n)}catch{return null}return t.forEach(i=>{o.test(i)&&(!r||s.compare(i)===1)&&(r=i,s=new Cc(r,n))}),r};Vs.exports=wc});var Zs=w((Pp,Ys)=>{"use strict";var dn=_(),Ac=Q(),Xs=Pe(),xc=(t,e)=>{t=new Ac(t,e);let n=new dn("0.0.0");if(t.test(n)||(n=new dn("0.0.0-0"),t.test(n)))return n;n=null;for(let r=0;r<t.set.length;++r){let s=t.set[r],o=null;s.forEach(i=>{let c=new dn(i.semver.version);switch(i.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!o||Xs(c,o))&&(o=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!n||Xs(n,o))&&(n=o)}return n&&t.test(n)?n:null};Ys.exports=xc});var eo=w((Gp,Js)=>{"use strict";var Ic=Q(),vc=(t,e)=>{try{return new Ic(t,e).range||"*"}catch{return null}};Js.exports=vc});var yt=w((Up,so)=>{"use strict";var Tc=_(),ro=Be(),{ANY:bc}=ro,Rc=Q(),Oc=Me(),to=Pe(),no=pt(),Nc=mt(),Dc=ht(),Lc=(t,e,n,r)=>{t=new Tc(t,r),e=new Rc(e,r);let s,o,i,c,a;switch(n){case">":s=to,o=Nc,i=no,c=">",a=">=";break;case"<":s=no,o=Dc,i=to,c="<",a="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Oc(t,e,r))return!1;for(let u=0;u<e.set.length;++u){let p=e.set[u],h=null,C=null;if(p.forEach(m=>{m.semver===bc&&(m=new ro(">=0.0.0")),h=h||m,C=C||m,s(m.semver,h.semver,r)?h=m:i(m.semver,C.semver,r)&&(C=m)}),h.operator===c||h.operator===a||(!C.operator||C.operator===c)&&o(t,C.semver))return!1;if(C.operator===a&&i(t,C.semver))return!1}return!0};so.exports=Lc});var io=w((Bp,oo)=>{"use strict";var qc=yt(),_c=(t,e,n)=>qc(t,e,">",n);oo.exports=_c});var co=w((Wp,ao)=>{"use strict";var jc=yt(),$c=(t,e,n)=>jc(t,e,"<",n);ao.exports=$c});var po=w((Mp,lo)=>{"use strict";var uo=Q(),Fc=(t,e,n)=>(t=new uo(t,n),e=new uo(e,n),t.intersects(e,n));lo.exports=Fc});var mo=w((kp,ho)=>{"use strict";var Pc=Me(),Gc=K();ho.exports=(t,e,n)=>{let r=[],s=null,o=null,i=t.sort((p,h)=>Gc(p,h,n));for(let p of i)Pc(p,e,n)?(o=p,s||(s=p)):(o&&r.push([s,o]),o=null,s=null);s&&r.push([s,null]);let c=[];for(let[p,h]of r)p===h?c.push(p):!h&&p===i[0]?c.push("*"):h?p===i[0]?c.push(`<=${h}`):c.push(`${p} - ${h}`):c.push(`>=${p}`);let a=c.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return a.length<u.length?a:e}});var So=w((zp,Co)=>{"use strict";var fo=Q(),En=Be(),{ANY:yn}=En,ke=Me(),Cn=K(),Uc=(t,e,n={})=>{if(t===e)return!0;t=new fo(t,n),e=new fo(e,n);let r=!1;e:for(let s of t.set){for(let o of e.set){let i=Wc(s,o,n);if(r=r||i!==null,i)continue e}if(r)return!1}return!0},Bc=[new En(">=0.0.0-0")],go=[new En(">=0.0.0")],Wc=(t,e,n)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===yn){if(e.length===1&&e[0].semver===yn)return!0;n.includePrerelease?t=Bc:t=go}if(e.length===1&&e[0].semver===yn){if(n.includePrerelease)return!0;e=go}let r=new Set,s,o;for(let m of t)m.operator===">"||m.operator===">="?s=yo(s,m,n):m.operator==="<"||m.operator==="<="?o=Eo(o,m,n):r.add(m.semver);if(r.size>1)return null;let i;if(s&&o){if(i=Cn(s.semver,o.semver,n),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let m of r){if(s&&!ke(m,String(s),n)||o&&!ke(m,String(o),n))return null;for(let F of e)if(!ke(m,String(F),n))return!1;return!0}let c,a,u,p,h=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1,C=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;h&&h.prerelease.length===1&&o.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let m of e){if(p=p||m.operator===">"||m.operator===">=",u=u||m.operator==="<"||m.operator==="<=",s){if(C&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===C.major&&m.semver.minor===C.minor&&m.semver.patch===C.patch&&(C=!1),m.operator===">"||m.operator===">="){if(c=yo(s,m,n),c===m&&c!==s)return!1}else if(s.operator===">="&&!ke(s.semver,String(m),n))return!1}if(o){if(h&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===h.major&&m.semver.minor===h.minor&&m.semver.patch===h.patch&&(h=!1),m.operator==="<"||m.operator==="<="){if(a=Eo(o,m,n),a===m&&a!==o)return!1}else if(o.operator==="<="&&!ke(o.semver,String(m),n))return!1}if(!m.operator&&(o||s)&&i!==0)return!1}return!(s&&u&&!o&&i!==0||o&&p&&!s&&i!==0||C||h)},yo=(t,e,n)=>{if(!t)return e;let r=Cn(t.semver,e.semver,n);return r>0?t:r<0||e.operator===">"&&t.operator===">="?e:t},Eo=(t,e,n)=>{if(!t)return e;let r=Cn(t.semver,e.semver,n);return r<0?t:r>0||e.operator==="<"&&t.operator==="<="?e:t};Co.exports=Uc});var wn=w((Kp,xo)=>{"use strict";var Sn=be(),wo=$e(),Mc=_(),Ao=tn(),kc=fe(),zc=Ur(),Kc=Wr(),Qc=zr(),Vc=Vr(),Hc=Xr(),Xc=Zr(),Yc=es(),Zc=ns(),Jc=K(),eu=is(),tu=cs(),nu=lt(),ru=hs(),su=fs(),ou=Pe(),iu=pt(),au=rn(),cu=sn(),uu=ht(),lu=mt(),pu=on(),hu=xs(),mu=Be(),fu=Q(),gu=Me(),du=zs(),yu=Qs(),Eu=Hs(),Cu=Zs(),Su=eo(),wu=yt(),Au=io(),xu=co(),Iu=po(),vu=mo(),Tu=So();xo.exports={parse:kc,valid:zc,clean:Kc,inc:Qc,diff:Vc,major:Hc,minor:Xc,patch:Yc,prerelease:Zc,compare:Jc,rcompare:eu,compareLoose:tu,compareBuild:nu,sort:ru,rsort:su,gt:ou,lt:iu,eq:au,neq:cu,gte:uu,lte:lu,cmp:pu,coerce:hu,Comparator:mu,Range:fu,satisfies:gu,toComparators:du,maxSatisfying:yu,minSatisfying:Eu,minVersion:Cu,validRange:Su,outside:wu,gtr:Au,ltr:xu,intersects:Iu,simplifyRange:vu,subset:Tu,SemVer:Mc,re:Sn.re,src:Sn.src,tokens:Sn.t,SEMVER_SPEC_VERSION:wo.SEMVER_SPEC_VERSION,RELEASE_TYPES:wo.RELEASE_TYPES,compareIdentifiers:Ao.compareIdentifiers,rcompareIdentifiers:Ao.rcompareIdentifiers}});var Ru={};Lo(Ru,{GrazEvents:()=>Jt,GrazProvider:()=>Li,WALLET_TYPES:()=>St,WalletType:()=>Ct,checkWallet:()=>pe,clearRecentChain:()=>Rt,configureGraz:()=>Dt,connect:()=>Ie,createClients:()=>qe,createQueryClient:()=>At,createSigningClients:()=>_e,defineAsset:()=>qi,defineAssetList:()=>_i,defineChain:()=>si,defineChainInfo:()=>oi,defineChains:()=>Xt,defineRegistryChain:()=>ji,disconnect:()=>nt,executeContract:()=>Ft,getActiveChainCurrency:()=>Ot,getAvailableWallets:()=>Po,getBalanceStaked:()=>qt,getBalances:()=>Lt,getCosmostation:()=>tt,getKeplr:()=>Je,getLeap:()=>et,getQueryRaw:()=>Gt,getQuerySmart:()=>Pt,getRecentChain:()=>Go,getWCCosmostation:()=>Vn,getWCKeplr:()=>Kn,getWCLeap:()=>Qn,getWallet:()=>xe,getWalletConnect:()=>he,instantiateContract:()=>$t,mainnetChains:()=>ii,mainnetChainsArray:()=>ai,reconnect:()=>Z,registryToChainInfo:()=>bu,sendIbcTokens:()=>jt,sendTokens:()=>_t,suggestChain:()=>rt,suggestChainAndConnect:()=>Nt,testnetChains:()=>ci,testnetChainsArray:()=>ui,useAccount:()=>re,useActiveChain:()=>di,useActiveChainCurrency:()=>yi,useActiveChainValidators:()=>Ei,useActiveWalletType:()=>li,useBalance:()=>pi,useBalanceStaked:()=>gi,useBalances:()=>Sr,useCheckWallet:()=>je,useClients:()=>Ai,useConnect:()=>hi,useDisconnect:()=>mi,useExecuteContract:()=>Ri,useGrazEvents:()=>Ir,useInstantiateContract:()=>bi,useOfflineSigners:()=>wr,useQueryClient:()=>Ii,useQueryRaw:()=>Ni,useQuerySmart:()=>Oi,useRecentChain:()=>Ci,useSendIbcTokens:()=>Ti,useSendTokens:()=>vi,useSigners:()=>fi,useSigningClients:()=>xi,useSuggestChain:()=>Si,useSuggestChainAndConnect:()=>wi});module.exports=qo(Ru);var Hn=require("@cosmjs/stargate");var ie="graz-reconnect-session";var wt=require("zustand"),Tn=require("zustand/middleware"),Ce=require("zustand/middleware");var Ct=(c=>(c.KEPLR="keplr",c.LEAP="leap",c.COSMOSTATION="cosmostation",c.WALLETCONNECT="walletconnect",c.WC_KEPLR_MOBILE="wc_keplr_mobile",c.WC_LEAP_MOBILE="wc_leap_mobile",c.WC_COSMOSTATION_MOBILE="wc_cosmostation_mobile",c))(Ct||{}),St=["keplr","leap","cosmostation","walletconnect","wc_keplr_mobile","wc_leap_mobile","wc_cosmostation_mobile"];var _o={recentChain:null,defaultChain:null,defaultSigningClient:"stargate",walletType:"keplr",walletConnect:{options:null,web3Modal:null},_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},Le={account:null,activeChain:null,balances:null,clients:null,offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,signingClients:null,status:"disconnected",wcSignClient:null},jo={name:"graz-session",version:1,partialize:t=>({account:t.account,activeChain:t.activeChain}),storage:(0,Tn.createJSONStorage)(()=>sessionStorage)},$o={name:"graz-internal",partialize:t=>({recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:1},E=(0,wt.create)((0,Ce.subscribeWithSelector)((0,Ce.persist)(()=>Le,jo))),v=(0,wt.create)((0,Ce.subscribeWithSelector)((0,Ce.persist)(()=>_o,$o)));var xt=require("@cosmjs/cosmwasm-stargate"),It=require("@cosmjs/stargate"),Rn=require("@cosmjs/tendermint-rpc");var bn=require("@cosmjs/stargate"),Se=require("@cosmjs/utils");var At=(...t)=>{let{tendermint:e}=E.getState().clients,n=new bn.QueryClient(e),r=t.map(s=>s(n));for(let s of r){(0,Se.assert)((0,Se.isNonNullObject)(s),"Extension must be a non-null object");for(let[o,i]of Object.entries(s)){(0,Se.assert)((0,Se.isNonNullObject)(i),`Module must be a non-null object. Found type ${typeof i} for module "${o}".`);let c=n[o]||{};n[o]={...c,...i}}}return n};var qe=async({rpc:t,rpcHeaders:e})=>{let n={url:t,headers:{...e||{}}},[r,s,o]=await Promise.all([xt.SigningCosmWasmClient.connect(n),It.SigningStargateClient.connect(n),Rn.Tendermint34Client.connect(t)]);return{cosmWasm:r,stargate:s,tendermint:o}},_e=async t=>{let{rpc:e,rpcHeaders:n,offlineSignerAuto:r,cosmWasmSignerOptions:s={},stargateSignerOptions:o={}}=t,i={url:e,headers:{...n||{}}},[c,a]=await Promise.all([xt.SigningCosmWasmClient.connectWithSigner(i,r,s),It.SigningStargateClient.connectWithSigner(i,r,o)]);return{cosmWasm:c,stargate:a}};var Wn=require("@cosmjs/encoding"),Mn=require("@walletconnect/sign-client"),kn=require("@walletconnect/utils"),zn=Ye(Gn());var ue=()=>typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1,Un=()=>ue()&&navigator.userAgent.toLowerCase().includes("android"),Bn=()=>ue()&&(navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad"));var bt=(t,e,n=new Error("Promise timed out"))=>{let r=new Promise((s,o)=>{setTimeout(()=>{o(n)},e)});return Promise.race([t,r])};var pe=(t=v.getState().walletType)=>{try{return xe(t),!0}catch{return!1}},le=()=>{window.sessionStorage.removeItem(ie),E.setState(Le)},Je=()=>{if(typeof window.keplr<"u"){let t=window.keplr;return Object.assign(t,{subscription:r=>(window.addEventListener("keplr_keystorechange",()=>{le(),r()}),()=>{window.removeEventListener("keplr_keystorechange",()=>{le(),r()})})})}throw v.getState()._notFoundFn(),new Error("window.keplr is not defined")},et=()=>{if(typeof window.leap<"u"){let t=window.leap;return Object.assign(t,{subscription:r=>(window.addEventListener("leap_keystorechange",()=>{le(),r()}),()=>{window.removeEventListener("leap_keystorechange",()=>{le(),r()})})})}throw v.getState()._notFoundFn(),new Error("window.leap is not defined")},tt=()=>{if(typeof window.cosmostation.providers.keplr<"u"){let t=window.cosmostation.providers.keplr;return Object.assign(t,{subscription:r=>(window.cosmostation.cosmos.on("accountChanged",()=>{le(),r()}),()=>{window.cosmostation.cosmos.off("accountChanged",()=>{le(),r()})})})}throw v.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")},he=t=>{var A,P,V;if(!((V=(P=(A=v.getState().walletConnect)==null?void 0:A.options)==null?void 0:P.projectId)!=null&&V.trim()))throw new Error("walletConnect.options.projectId is not defined");let e=(t==null?void 0:t.encoding)||"base64",n=y=>{if(!t)return;let{appUrl:d,formatNativeUrl:S}=t;if(ue()){if(Un())if(!y)window.open(d.mobile.android,"_self","noreferrer noopener");else{let I=S(d.mobile.android,y,"android");window.open(I,"_self","noreferrer noopener")}if(Bn())if(!y)window.open(d.mobile.ios,"_self","noreferrer noopener");else{let I=S(d.mobile.ios,y,"ios");window.open(I,"_self","noreferrer noopener")}}},r=()=>{let{wcSignClient:y}=E.getState();if(!y)throw new Error("walletConnect.signClient is not defined");le(),v.setState({_reconnect:!1,_reconnectConnector:null,recentChain:null})},s=async y=>{let{wcSignClient:d}=E.getState();if(!d)throw new Error("walletConnect.signClient is not defined");if(!y)throw new Error("No wallet connect session");await d.disconnect({topic:y,reason:(0,kn.getSdkError)("USER_DISCONNECTED")}),await c(d),r()},o=y=>{var d,S;try{let{wcSignClient:I}=E.getState();if(!I)throw new Error("walletConnect.signClient is not defined");let O=I.session.getAll().at(-1);if(!O)return;let D=(S=(d=I.session.getAll().at(-1))==null?void 0:d.namespaces.cosmos)==null?void 0:S.accounts.find(q=>q.startsWith(`cosmos:${y}`));if(!(O.expiry*1e3>Date.now()+1e3))throw s(O.topic),new Error("invalid session");if(!D)try{let q=I.find({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${y}`],events:["chainChanged","accountsChanged"]}}});if(!q.length)throw new Error("no session");return q.at(-1)}catch(q){if(!q.message.toLowerCase().includes("no matching key"))throw q}return O}catch(I){if(!I.message.toLowerCase().includes("no matching key"))throw I}},i=y=>{try{return o(y)}catch{return}},c=async y=>{try{let d=y.core.pairing.pairings.getAll({active:!1});if(!d.length)return;await Promise.all(d.map(async S=>{await y.core.pairing.pairings.delete(S.topic,{code:7001,message:"clear pairing"})}))}catch(d){if(!d.message.toLowerCase().includes("no matching key"))throw d}},a=async()=>{let{walletConnect:y}=v.getState();if(!(y!=null&&y.options))throw new Error("walletConnect.options is not defined");let{wcSignClient:d}=E.getState();if(d)return E.setState({wcSignClient:d}),d;let S=await Mn.SignClient.init(y.options);return E.setState({wcSignClient:S}),S},u=y=>{let{wcSignClient:d}=E.getState();if(d)return d.events.on("session_delete",S=>{r()}),d.events.on("session_expire",S=>{r()}),d.events.on("session_event",S=>{var I,O;if(S.params.event.name==="accountsChanged"&&((I=S.params.event.data)==null?void 0:I[0])!==((O=E.getState().account)==null?void 0:O.bech32Address)){let D=S.params.chainId.split(":")[1];D&&p(D)}else y()}),()=>{d.events.off("session_delete",S=>{r()}),d.events.off("session_expire",S=>{r()}),d.events.off("session_event",S=>{var I,O;if(S.params.event.name==="accountsChanged"&&((I=S.params.event.data)==null?void 0:I[0])!==((O=E.getState().account)==null?void 0:O.bech32Address)){let D=S.params.chainId.split(":")[1];D&&p(D)}else y()})}},p=async y=>{var Ve;let{wcSignClient:d}=E.getState();if(!d)throw new Error("enable walletConnect.signClient is not defined");let{walletConnect:S}=v.getState();if(!((Ve=S==null?void 0:S.options)!=null&&Ve.projectId))throw new Error("walletConnect.options.projectId is not defined");let{Web3Modal:I}=await import("@web3modal/standalone"),O=new I({projectId:S.options.projectId,walletConnectVersion:2,enableExplorer:!1,explorerRecommendedWalletIds:"NONE",...S.web3Modal}),{account:D,activeChain:J}=E.getState(),q=i(y);if((J==null?void 0:J.chainId)!==y&&!q||!D){let{uri:G,approval:He}=await d.connect({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${y}`],events:["chainChanged","accountsChanged"]}}});if(!G)throw new Error("No wallet connect uri");t?n(G):await O.openModal({uri:G});try{await bt((async()=>{await He()})(),4e4,new Error("Modal approval timeout"))}catch(In){if(O.closeModal(),!In.message.toLowerCase().includes("no matching key"))return Promise.reject(In)}return t||O.closeModal(),Promise.resolve()}try{await bt((async()=>{let G=await C(y);E.setState({account:G})})(),1e4,new Error("Connection timeout"))}catch(G){if(s(q==null?void 0:q.topic),!G.message.toLowerCase().includes("no matching key"))throw G}},h=async y=>{var O;let{wcSignClient:d}=E.getState();if(!d)throw new Error("walletConnect.signClient is not defined");let S=(O=o(y))==null?void 0:O.topic;if(!S)throw new Error("No wallet connect session");n();let I=await d.request({topic:S,chainId:`cosmos:${y}`,request:{method:"cosmos_getAccounts",params:{}}});if(!I[0])throw new Error("No wallet connect account");return{address:I[0].address,algo:I[0].algo,pubkey:new Uint8Array(Buffer.from(I[0].pubkey,e))}},C=async y=>{let{address:d,algo:S,pubkey:I}=await h(y);return{address:(0,Wn.fromBech32)(d).data,algo:S,bech32Address:d,name:"",pubKey:I,isKeystone:!1,isNanoLedger:!1}},m=async(...y)=>{var G,He;let[d,S,I]=y,{account:O,wcSignClient:D}=E.getState();if(!D)throw new Error("walletConnect.signClient is not defined");if(!O)throw new Error("account is not defined");let J=(G=o(d))==null?void 0:G.topic;if(!J)throw new Error("No wallet connect session");if(!I.bodyBytes)throw new Error("No bodyBytes");if(!I.authInfoBytes)throw new Error("No authInfoBytes");let q={topic:J,chainId:`cosmos:${d}`,request:{method:"cosmos_signDirect",params:{signerAddress:S,signDoc:{...I,bodyBytes:Buffer.from(I.bodyBytes).toString(e),authInfoBytes:Buffer.from(I.authInfoBytes).toString(e),accountNumber:(He=I.accountNumber)==null?void 0:He.toString()}}}};return n(),await D.request(q)},F=async(...y)=>{let[d,S,I]=y,{signature:O,signed:D}=await m(d,S,I);return{signed:{chainId:D.chainId,accountNumber:zn.default.fromString(D.accountNumber,!1),authInfoBytes:new Uint8Array(Buffer.from(D.authInfoBytes,e)),bodyBytes:new Uint8Array(Buffer.from(D.bodyBytes,e))},signature:O}},Ke=async(...y)=>{var G;let[d,S,I,O]=y,{wcSignClient:D}=E.getState(),{account:J}=E.getState();if(!D)throw new Error("walletConnect.signClient is not defined");if(!J)throw new Error("account is not defined");let q=(G=o(d))==null?void 0:G.topic;if(!q)throw new Error("No wallet connect session");return n(),await D.request({topic:q,chainId:`cosmos:${d}`,request:{method:"cosmos_signDirect",params:{signerAddress:S,signDoc:I}}})},ne=async(...y)=>{let[d,S,I,O]=y;return await Ke(d,S,I)},Ee=y=>({getAccounts:async()=>[await h(y)],signDirect:(d,S)=>F(y,d,S)}),Y=y=>({getAccounts:async()=>[await h(y)],signAmino:(d,S)=>ne(y,d,S)});return{enable:p,experimentalSuggestChain:async(...y)=>{await Promise.reject(new Error("WalletConnect does not support experimentalSuggestChain"))},getKey:C,getOfflineSigner:y=>({getAccounts:async()=>[await h(y)],signDirect:(d,S)=>F(y,d,S),signAmino:(d,S)=>ne(y,d,S)}),getOfflineSignerAuto:async y=>(await C(y)).isNanoLedger?Y(y):Ee(y),getOfflineSignerOnlyAmino:Y,signAmino:ne,signDirect:F,subscription:u,init:a}},Kn=()=>{var e,n,r;if(!((r=(n=(e=v.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!ue())throw new Error("WalletConnect Keplr mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"keplrwallet://",android:"intent://"}},walletType:"wc_keplr_mobile",formatNativeUrl:(s,o,i)=>{let c=s.replaceAll("/","").replaceAll(":",""),a=encodeURIComponent(o);switch(i){case"ios":return`${c}://wcV2?${a}`;case"android":return`${c}://wcV2?${a}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;default:return`${c}://wc?uri=${a}`}}};return he(t)},Qn=()=>{var e,n,r;if(!((r=(n=(e=v.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!ue())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"leapcosmos://",android:"intent://"}},walletType:"wc_leap_mobile",formatNativeUrl:(s,o,i)=>{let c=s.replaceAll("/","").replaceAll(":",""),a=encodeURIComponent(o);switch(i){case"ios":return`${c}://wcV2?${a}`;case"android":return`${c}://wcV2?${a}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;default:return`${c}://wc?uri=${a}`}}};return he(t)},Vn=()=>{var e,n,r;if(!((r=(n=(e=v.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!ue())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"hex",appUrl:{mobile:{ios:"cosmostation://",android:"cosmostation://"}},walletType:"wc_leap_mobile",formatNativeUrl:(s,o,i)=>`${s.replaceAll("/","").replaceAll(":","")}://wc?${o}`};return he(t)},xe=(t=v.getState().walletType)=>{switch(t){case"keplr":return Je();case"leap":return et();case"cosmostation":return tt();case"walletconnect":return he();case"wc_keplr_mobile":return Kn();case"wc_leap_mobile":return Qn();case"wc_cosmostation_mobile":return Vn();default:throw new Error("Unknown wallet type")}},Po=()=>Object.fromEntries(St.map(t=>[t,pe(t)]));var Ie=async t=>{var e;try{let{defaultChain:n,recentChain:r,walletType:s}=v.getState(),o=(t==null?void 0:t.walletType)||s;if(!pe(o))throw new Error(`${o} is not available`);let c=xe(o),a=(t==null?void 0:t.chain)||r||n;if(!a)throw new Error("No last known connected chain, connect action requires chain info");E.setState(Y=>{let De=v.getState()._reconnect||!!v.getState()._reconnectConnector||!!a;return Y.activeChain&&Y.activeChain.chainId!==a.chainId?{status:"connecting"}:De?{status:"reconnecting"}:{status:"connecting"}});let{account:u,activeChain:p}=E.getState();if(await((e=c.init)==null?void 0:e.call(c)),!u||(p==null?void 0:p.chainId)!==a.chainId){await c.enable(a.chainId);let Y=await c.getKey(a.chainId);E.setState({account:Y})}let h=c.getOfflineSigner(a.chainId),C=c.getOfflineSignerOnlyAmino(a.chainId),m=await c.getOfflineSignerAuto(a.chainId),F=a.gas?Hn.GasPrice.fromString(`${a.gas.price}${a.gas.denom}`):void 0,[Ke,ne]=await Promise.all([qe(a),_e({...a,offlineSignerAuto:m,cosmWasmSignerOptions:{gasPrice:F,...(t==null?void 0:t.signerOpts)||{}}})]);v.setState({recentChain:a,walletType:o,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:o}),E.setState({activeChain:a,clients:Ke,offlineSigner:h,offlineSignerAmino:C,offlineSignerAuto:m,signingClients:ne,status:"connected"}),typeof window<"u"&&window.sessionStorage.setItem(ie,"Active");let{account:Ee}=E.getState();return{account:Ee,walletType:o,chain:a}}catch(n){throw console.error("connect ",n),E.getState().account===null&&E.setState({status:"disconnected"}),E.getState().account&&E.getState().activeChain&&E.setState({status:"connected"}),n}},nt=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem(ie),E.setState(Le),v.setState(e=>({_reconnect:!1,_reconnectConnector:null,recentChain:t?null:e.recentChain})),Promise.resolve()),Z=async t=>{var s;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=v.getState();try{let o=pe(n||void 0);if(e&&o&&n)return await Ie({chain:e,walletType:n,autoReconnect:r})}catch(o){(s=t==null?void 0:t.onError)==null||s.call(t,o),nt()}};var Rt=()=>{v.setState({recentChain:null})},Ot=t=>{let{activeChain:e}=E.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},Go=()=>v.getState().recentChain,rt=async t=>(await xe().experimentalSuggestChain(t),t),Nt=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...s})=>{let o=await rt(t);return{...await Ie({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...s}),chain:o}};var Dt=(t={})=>(v.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletConnect:t.walletConnect||e.walletConnect,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var Lt=async t=>{let{activeChain:e,signingClients:n}=E.getState();if(!e||!n)throw new Error("No connected account detected");let{defaultSigningClient:r}=v.getState();return await Promise.all(e.currencies.map(async o=>{let i=o.coinMinimalDenom.startsWith("cw20:");return n[r].getBalance(t,i?o.coinMinimalDenom.replace("cw20:",""):o.coinMinimalDenom)}))},qt=async t=>{let{clients:e}=E.getState();if(!(e!=null&&e.stargate))throw new Error("Stargate client is not ready");return e.stargate.getBalanceStaked(t)},_t=async({senderAddress:t,recipientAddress:e,amount:n,fee:r,memo:s})=>{let{defaultSigningClient:o}=v.getState(),{signingClients:i}=E.getState();if(!i)throw new Error("No connected account detected");if(!t)throw new Error("senderAddress is not defined");return i[o].sendTokens(t,e,n,r,s)},jt=async({senderAddress:t,recipientAddress:e,transferAmount:n,sourcePort:r,sourceChannel:s,timeoutHeight:o,timeoutTimestamp:i,fee:c,memo:a})=>{let{signingClients:u}=E.getState();if(!(u!=null&&u.stargate))throw new Error("Stargate signing client is not ready");if(!t)throw new Error("senderAddress is not defined");return u.stargate.sendIbcTokens(t,e,n,r,s,o,i,c,a)},$t=async({senderAddress:t,msg:e,fee:n,options:r,label:s,codeId:o})=>{let{signingClients:i}=E.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.instantiate(t,o,e,s,n,r)},Ft=async({senderAddress:t,msg:e,fee:n,contractAddress:r,funds:s,memo:o})=>{let{signingClients:i}=E.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.execute(t,r,e,n,o,s)},Pt=async(t,e)=>{let{clients:n}=E.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");return await n.cosmWasm.queryContractSmart(t,e)},Gt=(t,e)=>{let{clients:n}=E.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.cosmWasm.queryContractRaw(t,r)};var Yn=require("@keplr-wallet/cosmos"),Zn={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Uo={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Bo={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},Wo={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},Mo={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},ko={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Xn=[Zn,Uo,Bo,Wo,Mo,ko],Ut={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:Zn,bip44:{coinType:118},bech32Config:Yn.Bech32Address.defaultBech32Config("axelar"),currencies:Xn,feeCurrencies:Xn};var er=require("@keplr-wallet/cosmos"),tr={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Jn=[tr],Bt={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:tr,bip44:{coinType:118},bech32Config:er.Bech32Address.defaultBech32Config("cosmos"),currencies:Jn,feeCurrencies:Jn};var rr=require("@keplr-wallet/cosmos"),sr={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},zo={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},Ko={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Qo={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Vo={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Ho={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Xo={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Yo={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Zo={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Jo={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},ei={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},nr=[sr,zo,Ko,Qo,Vo,Ho,Xo,Yo,Zo,Jo,ei],Wt={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:sr,bip44:{coinType:118},bech32Config:rr.Bech32Address.defaultBech32Config("juno"),currencies:nr,feeCurrencies:nr};var ir=require("@keplr-wallet/cosmos"),ar={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},ti={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},or=[ar,ti],Mt={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:ar,bip44:{coinType:118},bech32Config:ir.Bech32Address.defaultBech32Config("osmo"),currencies:or,feeCurrencies:or};var ur=require("@keplr-wallet/cosmos"),lr={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},cr=[lr],kt={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:lr,bip44:{coinType:118},bech32Config:ur.Bech32Address.defaultBech32Config("somm"),currencies:cr,feeCurrencies:cr};var hr=require("@keplr-wallet/cosmos"),mr={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},pr=[mr],zt={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:hr.Bech32Address.defaultBech32Config("CRE"),currencies:pr,feeCurrencies:pr,stakeCurrency:mr,coinType:118};var fr=require("@keplr-wallet/cosmos"),Kt={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},ni=[Kt],Qt={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:Kt,bip44:{coinType:118},bech32Config:fr.Bech32Address.defaultBech32Config("juno"),currencies:ni,feeCurrencies:[Kt],coinType:118};var gr=require("@keplr-wallet/cosmos"),Vt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},ri=[Vt],Ht={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:Vt,bip44:{coinType:118},bech32Config:gr.Bech32Address.defaultBech32Config("osmo"),currencies:ri,feeCurrencies:[Vt],coinType:118};var Xt=t=>t,si=t=>t,oi=t=>t,ii=Xt({axelar:Ut,cosmoshub:Bt,juno:Wt,osmosis:Mt,sommelier:kt}),ai=[Ut,Bt,Wt,Mt,kt],ci=Xt({crescent:zt,juno:Qt,osmosis:Ht}),ui=[zt,Qt,Ht];var me=require("@tanstack/react-query"),Er=require("react"),Cr=require("zustand/shallow");var dr=require("@tanstack/react-query"),yr=require("zustand/shallow");var li=()=>v(t=>({walletType:t.walletType,isCosmostation:t.walletType==="cosmostation",isCosmostationMobile:t.walletType==="wc_cosmostation_mobile",isKeplr:t.walletType==="keplr",isKeplrMobile:t.walletType==="wc_keplr_mobile",isLeap:t.walletType==="leap",isLeapMobile:t.walletType==="wc_leap_mobile",isWalletConnect:t.walletType==="walletconnect"}),yr.shallow),je=t=>{let n=["USE_CHECK_WALLET",v(s=>t||s.walletType)];return(0,dr.useQuery)(n,({queryKey:[,s]})=>pe(s))};var re=({onConnect:t,onDisconnect:e}={})=>{let n=E(s=>s.account),r=E(s=>s.status);return(0,Er.useEffect)(()=>E.subscribe(s=>s.status,(s,o)=>{if(s==="connected"){let{account:i,activeChain:c}=E.getState(),{walletType:a}=v.getState();t==null||t({account:i,chain:c,walletType:a,isReconnect:o==="reconnecting"})}s==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:Z,status:r}},Sr=t=>{let{data:e}=re(),n=t||(e==null?void 0:e.bech32Address);return(0,me.useQuery)(["USE_BALANCES",n],({queryKey:[,o]})=>Lt(o),{enabled:!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})},pi=(t,e)=>{let{data:n}=Sr(e);return(0,me.useQuery)(["USE_BALANCE",n,t,e],({queryKey:[,o]})=>o==null?void 0:o.find(i=>i.denom===t),{enabled:!!n})},hi=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=(0,me.useMutation)(["USE_CONNECT",t,e,n],Ie,{onError:(i,c)=>Promise.resolve(t==null?void 0:t(i,c)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:o}=je();return{connect:i=>s.mutate(i),connectAsync:i=>s.mutateAsync(i),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:!!o,status:s.status}},mi=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=(0,me.useMutation)(["USE_DISCONNECT",t,e,n],nt,{onError:o=>Promise.resolve(t==null?void 0:t(o,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:o=>s.mutate(o),disconnectAsync:o=>s.mutateAsync(o),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,status:s.status}},wr=()=>E(t=>({signer:t.offlineSigner,signerAmino:t.offlineSignerAmino,signerAuto:t.offlineSignerAuto}),Cr.shallow),fi=()=>wr(),gi=t=>{let{data:e}=re(),n=t||(e==null?void 0:e.bech32Address);return(0,me.useQuery)(["USE_BALANCE_STAKED",n],({queryKey:[,o]})=>qt(n),{enabled:!!n})};var ve=require("@tanstack/react-query");var di=()=>E(t=>t.activeChain),yi=t=>(0,ve.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>Ot(r)),Ei=(t,e="BOND_STATUS_BONDED")=>(0,ve.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],({queryKey:[,s,o]})=>s.staking.validators(o),{enabled:typeof t<"u"}),Ci=()=>({data:v(e=>e.recentChain),clear:Rt}),Si=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=(0,ve.useMutation)(["USE_SUGGEST_CHAIN",t,e,n],rt,{onError:(o,i)=>Promise.resolve(t==null?void 0:t(o,i)),onMutate:e,onSuccess:o=>Promise.resolve(n==null?void 0:n(o))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,suggest:s.mutate,suggestAsync:s.mutateAsync,status:s.status}},wi=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=(0,ve.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],Nt,{onError:(i,c)=>Promise.resolve(t==null?void 0:t(i,c)),onMutate:i=>e==null?void 0:e(i),onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:o}=je();return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:!!o,status:s.status,suggestAndConnect:s.mutate,suggestAndConnectAsync:s.mutateAsync}};var Yt=require("@tanstack/react-query");var Ai=t=>{let e=E(s=>s.clients);return(0,Yt.useQuery)(["USE_CLIENTS",t,e],({queryKey:[,s,o]})=>s!=null&&s.rpc?qe(s):o,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:s=>{E.setState({clients:s})},initialData:e})},xi=t=>{let e=E(s=>s.signingClients);return(0,Yt.useQuery)(["USE_SIGNING_CLIENTS",t,e],({queryKey:[,s,o]})=>s!=null&&s.rpc?_e(s):o,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:s=>{E.setState({signingClients:s})},initialData:e})};var Ar=require("@tanstack/react-query");var Ii=(...t)=>{let e=["USE_QUERY_CLIENT",...t];return(0,Ar.useQuery)(e,({queryKey:[,...r]})=>At(...t),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var se=require("@tanstack/react-query");var vi=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=re(),s=r==null?void 0:r.bech32Address,i=(0,se.useMutation)(["USE_SEND_TOKENS",t,e,n,s],c=>_t({senderAddress:s,...c}),{onError:(c,a)=>Promise.resolve(t==null?void 0:t(c,a)),onMutate:e,onSuccess:c=>Promise.resolve(n==null?void 0:n(c))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},Ti=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=re(),s=r==null?void 0:r.bech32Address,i=(0,se.useMutation)(["USE_SEND_IBC_TOKENS",t,e,n,s],c=>jt({senderAddress:s,...c}),{onError:(c,a)=>Promise.resolve(t==null?void 0:t(c,a)),onMutate:e,onSuccess:c=>Promise.resolve(n==null?void 0:n(c))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},bi=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:s}=re(),o=s==null?void 0:s.bech32Address,a=(0,se.useMutation)(["USE_INSTANTIATE_CONTRACT",e,n,r,t,o],u=>{if(!o)throw new Error("senderAddress is undefined");let p={...u,fee:u.fee??"auto",senderAddress:o,codeId:t};return $t(p)},{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:n,onSuccess:u=>Promise.resolve(r==null?void 0:r(u))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,instantiateContract:a.mutate,instantiateContractAsync:a.mutateAsync,status:a.status}},Ri=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:s}=re(),o=s==null?void 0:s.bech32Address,a=(0,se.useMutation)(["USE_EXECUTE_CONTRACT",e,n,r,t,o],u=>{if(!o)throw new Error("senderAddress is undefined");let p={...u,fee:u.fee??"auto",senderAddress:o,contractAddress:t,memo:u.memo??"",funds:u.funds??[]};return Ft(p)},{onError:(u,p)=>Promise.resolve(e==null?void 0:e(u,p)),onMutate:n,onSuccess:u=>Promise.resolve(r==null?void 0:r(u))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,executeContract:a.mutate,executeContractAsync:a.mutateAsync,status:a.status}},Oi=(t,e)=>(0,se.useQuery)(["USE_QUERY_SMART",t,e],({queryKey:[,s]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return Pt(t,e)},{enabled:!!t&&!!e}),Ni=(t,e)=>(0,se.useQuery)(["USE_QUERY_RAW",e,t],({queryKey:[,s]})=>{if(!t||!e)throw new Error("address or key undefined");return Gt(t,e)},{enabled:!!t&&!!e});var it=require("@tanstack/react-query"),vr=require("@tanstack/react-query-devtools");var st=require("react"),ot=require("react/jsx-runtime"),xr=({children:t})=>{let[e,n]=(0,st.useState)(!1);return(0,st.useEffect)(()=>{n(!0)},[]),(0,ot.jsx)(ot.Fragment,{children:e?t:null})};var Zt=require("react");var Ir=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem(ie)==="Active",{_reconnect:e,_onReconnectFailed:n,_reconnectConnector:r}=v(),{activeChain:s,wcSignClient:o}=E();return(0,Zt.useEffect)(()=>{r&&(t&&s?Z({onError:n}):!t&&e&&Z({onError:n}))},[]),(0,Zt.useEffect)(()=>{var i,c,a,u,p,h,C,m;r&&(r==="cosmostation"&&((c=(i=tt()).subscription)==null||c.call(i,()=>{Z({onError:n})})),r==="keplr"&&((u=(a=Je()).subscription)==null||u.call(a,()=>{Z({onError:n})})),r==="leap"&&((h=(p=et()).subscription)==null||h.call(p,()=>{Z({onError:n})})),r==="walletconnect"&&o&&((m=(C=he()).subscription)==null||m.call(C,()=>{Z({onError:n})})))},[r,o]),null},Jt=()=>(Ir(),null);var Te=require("react/jsx-runtime"),Di=new it.QueryClient({}),Li=({children:t,grazOptions:e,debug:n,...r})=>(e&&Dt(e),(0,Te.jsxs)(it.QueryClientProvider,{client:Di,...r,children:[(0,Te.jsxs)(xr,{children:[(0,Te.jsx)(Jt,{}),t]}),n?(0,Te.jsx)(vr.ReactQueryDevtools,{initialIsOpen:!1,position:"bottom-right"}):null]},"graz-provider"));var qi=t=>t,_i=t=>t,ji=t=>t;var To=require("@keplr-wallet/cosmos"),ze=Ye(wn());function Io(t,e){if(t)return;if(process.env.NODE_ENV==="production")throw new Error(An);let n=typeof e=="function"?e():e,r=n?`${An}: ${n}`:An;throw new Error(r)}var An="Invariant failed";var vo=Ye(wn()),xn=t=>{if(!(0,vo.valid)(t))switch(t.split(".").length){case 1:return`${t}.0.0`;case 2:return`${t}.0`;case 3:default:throw new Error("invalid semver")}return t};var bu=t=>{var ne,Ee,Y,De,Qe,Et;let{chain:e,getRestEndpoint:n=({apis:A})=>{var P,V;return((V=(P=A==null?void 0:A.rest)==null?void 0:P[0])==null?void 0:V.address)??""},getRpcEndpoint:r=({apis:A})=>{var P,V;return((V=(P=A==null?void 0:A.rpc)==null?void 0:P[0])==null?void 0:V.address)??""}}=t,s=[],o=xn(((ne=e.codebase)==null?void 0:ne.cosmos_sdk_version)??"0.4");if((0,ze.satisfies)(o,">=0.4")&&s.push("stargate"),(0,ze.satisfies)(o,">=0.43")&&s.push("no-legacy-stdTx"),s.push("ibc-transfer"),(0,ze.satisfies)(o,">=0.45")&&s.push("ibc-go"),(Ee=e.codebase)!=null&&Ee.cosmwasm_enabled){s.push("cosmwasm");let A=xn(e.codebase.cosmwasm_version??"0.24");(0,ze.satisfies)(A,">=0.24")&&s.push("wasmd_0.24+")}let i=[];"assetlists"in t&&Array.isArray(t.assetlists)&&(i=((Y=t.assetlists.find(A=>A.chain_name===e.chain_name))==null?void 0:Y.assets)||[]),"assetlist"in t&&Array.isArray(t.assetlist.assets)&&(i=t.assetlist.assets),"assets"in t&&Array.isArray(t.assets)&&(i=t.assets);let c=((De=e.fees)==null?void 0:De.fee_tokens.map(A=>A.denom))||[],a={};for(let A of((Qe=e.fees)==null?void 0:Qe.fee_tokens)||[])a[A.denom]={low:A.low_gas_price??.01,average:A.average_gas_price??.025,high:A.high_gas_price??.04};let u=((Et=e.staking)==null?void 0:Et.staking_tokens.map(A=>A.denom))||[],p=i.map(A=>{var V,y;let P=A.denom_units.reduce((d,S)=>S.exponent>d.exponent?S:d);return{coinDenom:A.symbol,coinMinimalDenom:A.base,coinDecimals:P.exponent,coinGeckoId:A.coingecko_id,coinImageUrl:((V=A.logo_URIs)==null?void 0:V.svg)??((y=A.logo_URIs)==null?void 0:y.png)}}),h=p[0];Io(h,`chain '${e.chain_name}' has no assets`);let C=p.find(A=>u.includes(A.coinDenom))??h,m=p.filter(A=>c.includes(A.coinMinimalDenom)).map(A=>{if(!a.hasOwnProperty(A.coinMinimalDenom))return A;let P=a[A.coinMinimalDenom];return{...A,gasPriceStep:P}}),F=p.filter(A=>C.coinDenom===A.coinDenom).map(A=>{if(!a.hasOwnProperty(A.coinMinimalDenom))return A;let P=a[A.coinMinimalDenom];return{...A,gasPriceStep:P}});return{rpc:r(e),rest:n(e),chainId:e.chain_id,chainName:e.pretty_name||"",bip44:{coinType:e.slip44||118},bech32Config:To.Bech32Address.defaultBech32Config(e.bech32_prefix),currencies:p,stakeCurrency:C,feeCurrencies:m.length!==0?m:F,features:s}};0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineAsset,defineAssetList,defineChain,defineChainInfo,defineChains,defineRegistryChain,disconnect,executeContract,getActiveChainCurrency,getAvailableWallets,getBalanceStaked,getBalances,getCosmostation,getKeplr,getLeap,getQueryRaw,getQuerySmart,getRecentChain,getWCCosmostation,getWCKeplr,getWCLeap,getWallet,getWalletConnect,instantiateContract,mainnetChains,mainnetChainsArray,reconnect,registryToChainInfo,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useActiveWalletType,useBalance,useBalanceStaked,useBalances,useCheckWallet,useClients,useConnect,useDisconnect,useExecuteContract,useGrazEvents,useInstantiateContract,useOfflineSigners,useQueryClient,useQueryRaw,useQuerySmart,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect});
1
+ "use strict";var pn=Object.create;var ue=Object.defineProperty;var mn=Object.getOwnPropertyDescriptor;var gn=Object.getOwnPropertyNames;var fn=Object.getPrototypeOf,dn=Object.prototype.hasOwnProperty;var hn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),yn=(t,e)=>{for(var n in e)ue(t,n,{get:e[n],enumerable:!0})},ut=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of gn(e))!dn.call(t,o)&&o!==n&&ue(t,o,{get:()=>e[o],enumerable:!(r=mn(e,o))||r.enumerable});return t};var lt=(t,e,n)=>(n=t!=null?pn(fn(t)):{},ut(e||!t||!t.__esModule?ue(n,"default",{value:t,enumerable:!0}):n,t)),Cn=t=>ut(ue({},"__esModule",{value:!0}),t);var bt=hn((_o,Et)=>{"use strict";Et.exports=S;var O=null;try{O=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function S(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}S.prototype.__isLong__;Object.defineProperty(S.prototype,"__isLong__",{value:!0});function D(t){return(t&&t.__isLong__)===!0}S.isLong=D;var ft={},dt={};function G(t,e){var n,r,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(r=dt[t],r)?r:(n=w(t,(t|0)<0?-1:0,!0),o&&(dt[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(r=ft[t],r)?r:(n=w(t,t<0?-1:0,!1),o&&(ft[t]=n),n))}S.fromInt=G;function j(t,e){if(isNaN(t))return e?q:F;if(e){if(t<0)return q;if(t>=St)return xt}else{if(t<=-yt)return v;if(t+1>=yt)return At}return t<0?j(-t,e).neg():w(t%Y|0,t/Y|0,e)}S.fromNumber=j;function w(t,e,n){return new S(t,e,n)}S.fromBits=w;var le=Math.pow;function De(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return F;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return De(t.substring(1),e,n).neg();for(var o=j(le(n,8)),s=F,i=0;i<t.length;i+=8){var a=Math.min(8,t.length-i),c=parseInt(t.substring(i,i+a),n);if(a<8){var g=j(le(n,a));s=s.mul(g).add(j(c))}else s=s.mul(o),s=s.add(j(c))}return s.unsigned=e,s}S.fromString=De;function k(t,e){return typeof t=="number"?j(t,e):typeof t=="string"?De(t,e):w(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}S.fromValue=k;var ht=65536,xn=1<<24,Y=ht*ht,St=Y*Y,yt=St/2,Ct=G(xn),F=G(0);S.ZERO=F;var q=G(0,!0);S.UZERO=q;var Z=G(1);S.ONE=Z;var wt=G(1,!0);S.UONE=wt;var ve=G(-1);S.NEG_ONE=ve;var At=w(-1,2147483647,!1);S.MAX_VALUE=At;var xt=w(-1,-1,!0);S.MAX_UNSIGNED_VALUE=xt;var v=w(0,-2147483648,!1);S.MIN_VALUE=v;var u=S.prototype;u.toInt=function(){return this.unsigned?this.low>>>0:this.low};u.toNumber=function(){return this.unsigned?(this.high>>>0)*Y+(this.low>>>0):this.high*Y+(this.low>>>0)};u.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(v)){var n=j(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=j(le(e,6),this.unsigned),i=this,a="";;){var c=i.div(s),g=i.sub(c.mul(s)).toInt()>>>0,d=g.toString(e);if(i=c,i.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}};u.getHighBits=function(){return this.high};u.getHighBitsUnsigned=function(){return this.high>>>0};u.getLowBits=function(){return this.low};u.getLowBitsUnsigned=function(){return this.low>>>0};u.getNumBitsAbs=function(){if(this.isNegative())return this.eq(v)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};u.isZero=function(){return this.high===0&&this.low===0};u.eqz=u.isZero;u.isNegative=function(){return!this.unsigned&&this.high<0};u.isPositive=function(){return this.unsigned||this.high>=0};u.isOdd=function(){return(this.low&1)===1};u.isEven=function(){return(this.low&1)===0};u.equals=function(e){return D(e)||(e=k(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};u.eq=u.equals;u.notEquals=function(e){return!this.eq(e)};u.neq=u.notEquals;u.ne=u.notEquals;u.lessThan=function(e){return this.comp(e)<0};u.lt=u.lessThan;u.lessThanOrEqual=function(e){return this.comp(e)<=0};u.lte=u.lessThanOrEqual;u.le=u.lessThanOrEqual;u.greaterThan=function(e){return this.comp(e)>0};u.gt=u.greaterThan;u.greaterThanOrEqual=function(e){return this.comp(e)>=0};u.gte=u.greaterThanOrEqual;u.ge=u.greaterThanOrEqual;u.compare=function(e){if(D(e)||(e=k(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};u.comp=u.compare;u.negate=function(){return!this.unsigned&&this.eq(v)?v:this.not().add(Z)};u.neg=u.negate;u.add=function(e){D(e)||(e=k(e));var n=this.high>>>16,r=this.high&65535,o=this.low>>>16,s=this.low&65535,i=e.high>>>16,a=e.high&65535,c=e.low>>>16,g=e.low&65535,d=0,x=0,C=0,E=0;return E+=s+g,C+=E>>>16,E&=65535,C+=o+c,x+=C>>>16,C&=65535,x+=r+a,d+=x>>>16,x&=65535,d+=n+i,d&=65535,w(C<<16|E,d<<16|x,this.unsigned)};u.subtract=function(e){return D(e)||(e=k(e)),this.add(e.neg())};u.sub=u.subtract;u.multiply=function(e){if(this.isZero())return F;if(D(e)||(e=k(e)),O){var n=O.mul(this.low,this.high,e.low,e.high);return w(n,O.get_high(),this.unsigned)}if(e.isZero())return F;if(this.eq(v))return e.isOdd()?v:F;if(e.eq(v))return this.isOdd()?v:F;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Ct)&&e.lt(Ct))return j(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=this.high&65535,s=this.low>>>16,i=this.low&65535,a=e.high>>>16,c=e.high&65535,g=e.low>>>16,d=e.low&65535,x=0,C=0,E=0,_=0;return _+=i*d,E+=_>>>16,_&=65535,E+=s*d,C+=E>>>16,E&=65535,E+=i*g,C+=E>>>16,E&=65535,C+=o*d,x+=C>>>16,C&=65535,C+=s*g,x+=C>>>16,C&=65535,C+=i*c,x+=C>>>16,C&=65535,x+=r*d+o*g+s*c+i*a,x&=65535,w(E<<16|_,x<<16|C,this.unsigned)};u.mul=u.multiply;u.divide=function(e){if(D(e)||(e=k(e)),e.isZero())throw Error("division by zero");if(O){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?O.div_u:O.div_s)(this.low,this.high,e.low,e.high);return w(n,O.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?q:F;var r,o,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return q;if(e.gt(this.shru(1)))return wt;s=q}else{if(this.eq(v)){if(e.eq(Z)||e.eq(ve))return v;if(e.eq(v))return Z;var i=this.shr(1);return r=i.div(e).shl(1),r.eq(F)?e.isNegative()?Z:ve:(o=this.sub(e.mul(r)),s=r.add(o.div(e)),s)}else if(e.eq(v))return this.unsigned?q:F;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=F}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:le(2,a-48),g=j(r),d=g.mul(e);d.isNegative()||d.gt(o);)r-=c,g=j(r,this.unsigned),d=g.mul(e);g.isZero()&&(g=Z),s=s.add(g),o=o.sub(d)}return s};u.div=u.divide;u.modulo=function(e){if(D(e)||(e=k(e)),O){var n=(this.unsigned?O.rem_u:O.rem_s)(this.low,this.high,e.low,e.high);return w(n,O.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};u.mod=u.modulo;u.rem=u.modulo;u.not=function(){return w(~this.low,~this.high,this.unsigned)};u.and=function(e){return D(e)||(e=k(e)),w(this.low&e.low,this.high&e.high,this.unsigned)};u.or=function(e){return D(e)||(e=k(e)),w(this.low|e.low,this.high|e.high,this.unsigned)};u.xor=function(e){return D(e)||(e=k(e)),w(this.low^e.low,this.high^e.high,this.unsigned)};u.shiftLeft=function(e){return D(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?w(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):w(0,this.low<<e-32,this.unsigned)};u.shl=u.shiftLeft;u.shiftRight=function(e){return D(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?w(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):w(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};u.shr=u.shiftRight;u.shiftRightUnsigned=function(e){if(D(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return w(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?w(n,0,this.unsigned):w(n>>>e-32,0,this.unsigned)};u.shru=u.shiftRightUnsigned;u.shr_u=u.shiftRightUnsigned;u.toSigned=function(){return this.unsigned?w(this.low,this.high,!1):this};u.toUnsigned=function(){return this.unsigned?this:w(this.low,this.high,!0)};u.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};u.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};u.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};S.fromBytes=function(e,n,r){return r?S.fromBytesLE(e,n):S.fromBytesBE(e,n)};S.fromBytesLE=function(e,n){return new S(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};S.fromBytesBE=function(e,n){return new S(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)}});var So={};yn(So,{GrazEvents:()=>ot,GrazProvider:()=>Co,WALLET_TYPES:()=>xe,WalletType:()=>Ae,checkWallet:()=>z,clearRecentChain:()=>Fe,configureGraz:()=>Ne,connect:()=>J,createClients:()=>re,createQueryClient:()=>be,createSigningClients:()=>se,defineChain:()=>Ln,defineChainInfo:()=>zn,defineChains:()=>et,disconnect:()=>de,executeContract:()=>qe,getActiveChainCurrency:()=>ke,getAvailableWallets:()=>En,getBalanceStaked:()=>Me,getBalances:()=>We,getCosmostation:()=>ge,getKeplr:()=>pe,getLeap:()=>me,getQueryRaw:()=>Le,getQuerySmart:()=>Ge,getRecentChain:()=>bn,getVectis:()=>fe,getWCCosmostation:()=>jt,getWCKeplr:()=>_t,getWCLeap:()=>Ot,getWallet:()=>X,getWalletConnect:()=>K,instantiateContract:()=>Pe,mainnetChains:()=>Kn,mainnetChainsArray:()=>Qn,reconnect:()=>B,sendIbcTokens:()=>Ue,sendTokens:()=>Re,suggestChain:()=>he,suggestChainAndConnect:()=>Be,testnetChains:()=>Hn,testnetChainsArray:()=>Vn,useAccount:()=>M,useActiveChain:()=>to,useActiveChainCurrency:()=>no,useActiveChainValidators:()=>oo,useActiveWalletType:()=>$n,useBalance:()=>Zn,useBalanceStaked:()=>eo,useBalances:()=>on,useCheckWallet:()=>ie,useClients:()=>co,useConnect:()=>Yn,useDisconnect:()=>Xn,useExecuteContract:()=>go,useGrazEvents:()=>an,useInstantiateContract:()=>mo,useOfflineSigners:()=>rn,useQueryClient:()=>uo,useQueryRaw:()=>ho,useQuerySmart:()=>fo,useRecentChain:()=>ro,useSendIbcTokens:()=>po,useSendTokens:()=>lo,useSigners:()=>Jn,useSigningClients:()=>ao,useSuggestChain:()=>so,useSuggestChainAndConnect:()=>io});module.exports=Cn(So);var Ft=require("@cosmjs/stargate");var P="graz-reconnect-session";var Ee=require("zustand"),pt=require("zustand/middleware"),V=require("zustand/middleware");var Ae=(c=>(c.KEPLR="keplr",c.LEAP="leap",c.VECTIS="vectis",c.COSMOSTATION="cosmostation",c.WALLETCONNECT="walletconnect",c.WC_KEPLR_MOBILE="wc_keplr_mobile",c.WC_LEAP_MOBILE="wc_leap_mobile",c.WC_COSMOSTATION_MOBILE="wc_cosmostation_mobile",c))(Ae||{}),xe=["keplr","leap","vectis","cosmostation","walletconnect","wc_keplr_mobile","wc_leap_mobile","wc_cosmostation_mobile"];var Sn={recentChain:null,defaultChain:null,defaultSigningClient:"stargate",walletType:"keplr",walletConnect:{options:null,web3Modal:null},_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},oe={account:null,activeChain:null,balances:null,clients:null,offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,signingClients:null,status:"disconnected",wcSignClient:null},wn={name:"graz-session",version:1,partialize:t=>({account:t.account,activeChain:t.activeChain}),storage:(0,pt.createJSONStorage)(()=>sessionStorage)},An={name:"graz-internal",partialize:t=>({recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:1},m=(0,Ee.create)((0,V.subscribeWithSelector)((0,V.persist)(()=>oe,wn))),y=(0,Ee.create)((0,V.subscribeWithSelector)((0,V.persist)(()=>Sn,An)));var Ie=require("@cosmjs/cosmwasm-stargate"),Te=require("@cosmjs/stargate"),gt=require("@cosmjs/tendermint-rpc");var mt=require("@cosmjs/stargate"),$=require("@cosmjs/utils");var be=(...t)=>{let{tendermint:e}=m.getState().clients,n=new mt.QueryClient(e),r=t.map(o=>o(n));for(let o of r){(0,$.assert)((0,$.isNonNullObject)(o),"Extension must be a non-null object");for(let[s,i]of Object.entries(o)){(0,$.assert)((0,$.isNonNullObject)(i),`Module must be a non-null object. Found type ${typeof i} for module "${s}".`);let a=n[s]||{};n[s]={...a,...i}}}return n};var re=async({rpc:t,rpcHeaders:e})=>{let n={url:t,headers:{...e||{}}},[r,o,s]=await Promise.all([Ie.SigningCosmWasmClient.connect(n),Te.SigningStargateClient.connect(n),gt.Tendermint34Client.connect(t)]);return{cosmWasm:r,stargate:o,tendermint:s}},se=async t=>{let{rpc:e,rpcHeaders:n,offlineSignerAuto:r,cosmWasmSignerOptions:o={},stargateSignerOptions:s={}}=t,i={url:e,headers:{...n||{}}},[a,c]=await Promise.all([Ie.SigningCosmWasmClient.connectWithSigner(i,r,o),Te.SigningStargateClient.connectWithSigner(i,r,s)]);return{cosmWasm:a,stargate:c}};var Oe=require("@cosmjs/encoding"),vt=require("@walletconnect/sign-client"),Dt=require("@walletconnect/utils"),je=lt(bt());var L=()=>typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1,It=()=>L()&&navigator.userAgent.toLowerCase().includes("android"),Tt=()=>L()&&(navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad"));var _e=(t,e,n=new Error("Promise timed out"))=>{let r=new Promise((o,s)=>{setTimeout(()=>{s(n)},e)});return Promise.race([t,r])};var z=(t=y.getState().walletType)=>{try{return X(t),!0}catch{return!1}},W=()=>{window.sessionStorage.removeItem(P),m.setState(oe)},pe=()=>{if(typeof window.keplr<"u"){let t=window.keplr;return Object.assign(t,{subscription:r=>(window.addEventListener("keplr_keystorechange",()=>{W(),r()}),()=>{window.removeEventListener("keplr_keystorechange",()=>{W(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.keplr is not defined")},me=()=>{if(typeof window.leap<"u"){let t=window.leap;return Object.assign(t,{subscription:r=>(window.addEventListener("leap_keystorechange",()=>{W(),r()}),()=>{window.removeEventListener("leap_keystorechange",()=>{W(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.leap is not defined")},ge=()=>{if(typeof window.cosmostation.providers.keplr<"u"){let t=window.cosmostation.providers.keplr;return Object.assign(t,{subscription:r=>(window.cosmostation.cosmos.on("accountChanged",()=>{W(),r()}),()=>{window.cosmostation.cosmos.off("accountChanged",()=>{W(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")},fe=()=>{if(typeof window.vectis<"u"){let t=window.vectis.cosmos;return{enable:a=>t.enable(a),getOfflineSigner:a=>t.getOfflineSigner(a),getOfflineSignerAuto:a=>t.getOfflineSignerAuto(a),getKey:async a=>{let c=await t.getKey(a);return{address:(0,Oe.fromBech32)(c.address).data,algo:c.algo,bech32Address:c.address,name:c.name,pubKey:c.pubKey,isKeystone:!1,isNanoLedger:c.isNanoLedger}},subscription:a=>(window.addEventListener("vectis_accountChanged",()=>{W(),a()}),()=>{window.removeEventListener("vectis_accountChanged",()=>{W(),a()})}),getOfflineSignerOnlyAmino:(...a)=>t.getOfflineSignerAmino(...a),experimentalSuggestChain:async(...a)=>{let[c]=a,g={...c,rpcUrl:c.rpc,restUrl:c.rest,prettyName:c.chainName.replace(" ",""),bech32Prefix:c.bech32Config.bech32PrefixAccAddr};return t.suggestChains([g])},signDirect:async(...a)=>{var d;let{1:c,2:g}=a;return t.signDirect(c,{bodyBytes:g.bodyBytes||Uint8Array.from([]),authInfoBytes:g.authInfoBytes||Uint8Array.from([]),accountNumber:je.default.fromString(((d=g.accountNumber)==null?void 0:d.toString())||"",!1),chainId:g.chainId||""})},signAmino:async(...a)=>{let{1:c,2:g}=a;return t.signAmino(c,g)}}}throw y.getState()._notFoundFn(),new Error("window.vectis is not defined")},K=t=>{var st,it,ct;if(!((ct=(it=(st=y.getState().walletConnect)==null?void 0:st.options)==null?void 0:it.projectId)!=null&&ct.trim()))throw new Error("walletConnect.options.projectId is not defined");let e=(t==null?void 0:t.encoding)||"base64",n=p=>{if(!t)return;let{appUrl:l,formatNativeUrl:f}=t;if(L()){if(It())if(!p)window.open(l.mobile.android,"_self","noreferrer noopener");else{let h=f(l.mobile.android,p,"android");window.open(h,"_self","noreferrer noopener")}if(Tt())if(!p)window.open(l.mobile.ios,"_self","noreferrer noopener");else{let h=f(l.mobile.ios,p,"ios");window.open(h,"_self","noreferrer noopener")}}},r=()=>{let{wcSignClient:p}=m.getState();if(!p)throw new Error("walletConnect.signClient is not defined");W(),y.setState({_reconnect:!1,_reconnectConnector:null,recentChain:null})},o=async p=>{let{wcSignClient:l}=m.getState();if(!l)throw new Error("walletConnect.signClient is not defined");if(!p)throw new Error("No wallet connect session");await l.disconnect({topic:p,reason:(0,Dt.getSdkError)("USER_DISCONNECTED")}),await a(l),r()},s=p=>{var l,f;try{let{wcSignClient:h}=m.getState();if(!h)throw new Error("walletConnect.signClient is not defined");let A=h.session.getAll().at(-1);if(!A)return;let b=(f=(l=h.session.getAll().at(-1))==null?void 0:l.namespaces.cosmos)==null?void 0:f.accounts.find(I=>I.startsWith(`cosmos:${p}`));if(!(A.expiry*1e3>Date.now()+1e3))throw o(A.topic),new Error("invalid session");if(!b)try{let I=h.find({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!I.length)throw new Error("no session");return I.at(-1)}catch(I){if(!I.message.toLowerCase().includes("no matching key"))throw I}return A}catch(h){if(!h.message.toLowerCase().includes("no matching key"))throw h}},i=p=>{try{return s(p)}catch{return}},a=async p=>{try{let l=p.core.pairing.pairings.getAll({active:!1});if(!l.length)return;await Promise.all(l.map(async f=>{await p.core.pairing.pairings.delete(f.topic,{code:7001,message:"clear pairing"})}))}catch(l){if(!l.message.toLowerCase().includes("no matching key"))throw l}},c=async()=>{let{walletConnect:p}=y.getState();if(!(p!=null&&p.options))throw new Error("walletConnect.options is not defined");let{wcSignClient:l}=m.getState();if(l)return m.setState({wcSignClient:l}),l;let f=await vt.SignClient.init(p.options);return m.setState({wcSignClient:f}),f},g=p=>{let{wcSignClient:l}=m.getState();if(l)return l.events.on("session_delete",f=>{r()}),l.events.on("session_expire",f=>{r()}),l.events.on("session_event",f=>{var h,A;if(f.params.event.name==="accountsChanged"&&((h=f.params.event.data)==null?void 0:h[0])!==((A=m.getState().account)==null?void 0:A.bech32Address)){let b=f.params.chainId.split(":")[1];b&&d(b)}else p()}),()=>{l.events.off("session_delete",f=>{r()}),l.events.off("session_expire",f=>{r()}),l.events.off("session_event",f=>{var h,A;if(f.params.event.name==="accountsChanged"&&((h=f.params.event.data)==null?void 0:h[0])!==((A=m.getState().account)==null?void 0:A.bech32Address)){let b=f.params.chainId.split(":")[1];b&&d(b)}else p()})}},d=async p=>{var ce;let{wcSignClient:l}=m.getState();if(!l)throw new Error("enable walletConnect.signClient is not defined");let{walletConnect:f}=y.getState();if(!((ce=f==null?void 0:f.options)!=null&&ce.projectId))throw new Error("walletConnect.options.projectId is not defined");let{Web3Modal:h}=await import("@web3modal/standalone"),A=new h({projectId:f.options.projectId,walletConnectVersion:2,enableExplorer:!1,explorerRecommendedWalletIds:"NONE",...f.web3Modal}),{account:b,activeChain:N}=m.getState(),I=i(p);if((N==null?void 0:N.chainId)!==p&&!I||!b){let{uri:T,approval:ae}=await l.connect({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!T)throw new Error("No wallet connect uri");t?n(T):await A.openModal({uri:T});try{await _e((async()=>{await ae()})(),4e4,new Error("Modal approval timeout"))}catch(at){if(A.closeModal(),!at.message.toLowerCase().includes("no matching key"))return Promise.reject(at)}return t||A.closeModal(),Promise.resolve()}try{await _e((async()=>{let T=await C(p);m.setState({account:T})})(),1e4,new Error("Connection timeout"))}catch(T){if(o(I==null?void 0:I.topic),!T.message.toLowerCase().includes("no matching key"))throw T}},x=async p=>{var A;let{wcSignClient:l}=m.getState();if(!l)throw new Error("walletConnect.signClient is not defined");let f=(A=s(p))==null?void 0:A.topic;if(!f)throw new Error("No wallet connect session");n();let h=await l.request({topic:f,chainId:`cosmos:${p}`,request:{method:"cosmos_getAccounts",params:{}}});if(!h[0])throw new Error("No wallet connect account");return{address:h[0].address,algo:h[0].algo,pubkey:new Uint8Array(Buffer.from(h[0].pubkey,e))}},C=async p=>{let{address:l,algo:f,pubkey:h}=await x(p);return{address:(0,Oe.fromBech32)(l).data,algo:f,bech32Address:l,name:"",pubKey:h,isKeystone:!1,isNanoLedger:!1}},E=async(...p)=>{var T,ae;let[l,f,h]=p,{account:A,wcSignClient:b}=m.getState();if(!b)throw new Error("walletConnect.signClient is not defined");if(!A)throw new Error("account is not defined");let N=(T=s(l))==null?void 0:T.topic;if(!N)throw new Error("No wallet connect session");if(!h.bodyBytes)throw new Error("No bodyBytes");if(!h.authInfoBytes)throw new Error("No authInfoBytes");let I={topic:N,chainId:`cosmos:${l}`,request:{method:"cosmos_signDirect",params:{signerAddress:f,signDoc:{...h,bodyBytes:Buffer.from(h.bodyBytes).toString(e),authInfoBytes:Buffer.from(h.authInfoBytes).toString(e),accountNumber:(ae=h.accountNumber)==null?void 0:ae.toString()}}}};return n(),await b.request(I)},_=async(...p)=>{let[l,f,h]=p,{signature:A,signed:b}=await E(l,f,h);return{signed:{chainId:b.chainId,accountNumber:je.default.fromString(b.accountNumber,!1),authInfoBytes:new Uint8Array(Buffer.from(b.authInfoBytes,e)),bodyBytes:new Uint8Array(Buffer.from(b.bodyBytes,e))},signature:A}},H=async(...p)=>{var T;let[l,f,h,A]=p,{wcSignClient:b}=m.getState(),{account:N}=m.getState();if(!b)throw new Error("walletConnect.signClient is not defined");if(!N)throw new Error("account is not defined");let I=(T=s(l))==null?void 0:T.topic;if(!I)throw new Error("No wallet connect session");return n(),await b.request({topic:I,chainId:`cosmos:${l}`,request:{method:"cosmos_signDirect",params:{signerAddress:f,signDoc:h}}})},ne=async(...p)=>{let[l,f,h,A]=p;return await H(l,f,h)},we=p=>({getAccounts:async()=>[await x(p)],signDirect:(l,f)=>_(p,l,f)}),U=p=>({getAccounts:async()=>[await x(p)],signAmino:(l,f)=>ne(p,l,f)});return{enable:d,experimentalSuggestChain:async(...p)=>{await Promise.reject(new Error("WalletConnect does not support experimentalSuggestChain"))},getKey:C,getOfflineSigner:p=>({getAccounts:async()=>[await x(p)],signDirect:(l,f)=>_(p,l,f),signAmino:(l,f)=>ne(p,l,f)}),getOfflineSignerAuto:async p=>(await C(p)).isNanoLedger?U(p):we(p),getOfflineSignerOnlyAmino:U,signAmino:ne,signDirect:_,subscription:g,init:c}},_t=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!L())throw new Error("WalletConnect Keplr mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"keplrwallet://",android:"intent://"}},walletType:"wc_keplr_mobile",formatNativeUrl:(o,s,i)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(s);switch(i){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return K(t)},Ot=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!L())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"leapcosmos://",android:"intent://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,s,i)=>{let a=o.replaceAll("/","").replaceAll(":",""),c=encodeURIComponent(s);switch(i){case"ios":return`${a}://wcV2?${c}`;case"android":return`${a}://wcV2?${c}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;default:return`${a}://wc?uri=${c}`}}};return K(t)},jt=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!L())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"hex",appUrl:{mobile:{ios:"cosmostation://",android:"cosmostation://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,s,i)=>`${o.replaceAll("/","").replaceAll(":","")}://wc?${s}`};return K(t)},X=(t=y.getState().walletType)=>{switch(t){case"keplr":return pe();case"leap":return me();case"cosmostation":return ge();case"vectis":return fe();case"walletconnect":return K();case"wc_keplr_mobile":return _t();case"wc_leap_mobile":return Ot();case"wc_cosmostation_mobile":return jt();default:throw new Error("Unknown wallet type")}},En=()=>Object.fromEntries(xe.map(t=>[t,z(t)]));var J=async t=>{var e;try{let{defaultChain:n,recentChain:r,walletType:o}=y.getState(),s=(t==null?void 0:t.walletType)||o;if(!z(s))throw new Error(`${s} is not available`);let a=X(s),c=(t==null?void 0:t.chain)||r||n;if(!c)throw new Error("No last known connected chain, connect action requires chain info");m.setState(U=>{let rt=y.getState()._reconnect||!!y.getState()._reconnectConnector||!!c;return U.activeChain&&U.activeChain.chainId!==c.chainId?{status:"connecting"}:rt?{status:"reconnecting"}:{status:"connecting"}});let{account:g,activeChain:d}=m.getState();if(await((e=a.init)==null?void 0:e.call(a)),!g||(d==null?void 0:d.chainId)!==c.chainId){await a.enable(c.chainId);let U=await a.getKey(c.chainId);m.setState({account:U})}let x=a.getOfflineSigner(c.chainId),C=a.getOfflineSignerOnlyAmino(c.chainId),E=await a.getOfflineSignerAuto(c.chainId),_=c.gas?Ft.GasPrice.fromString(`${c.gas.price}${c.gas.denom}`):void 0,[H,ne]=await Promise.all([re(c),se({...c,offlineSignerAuto:E,cosmWasmSignerOptions:{gasPrice:_,...(t==null?void 0:t.signerOpts)||{}}})]);y.setState({recentChain:c,walletType:s,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:s}),m.setState({activeChain:c,clients:H,offlineSigner:x,offlineSignerAmino:C,offlineSignerAuto:E,signingClients:ne,status:"connected"}),typeof window<"u"&&window.sessionStorage.setItem(P,"Active");let{account:we}=m.getState();return{account:we,walletType:s,chain:c}}catch(n){throw console.error("connect ",n),m.getState().account===null&&m.setState({status:"disconnected"}),m.getState().account&&m.getState().activeChain&&m.setState({status:"connected"}),n}},de=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem(P),m.setState(oe),y.setState(e=>({_reconnect:!1,_reconnectConnector:null,recentChain:t?null:e.recentChain})),Promise.resolve()),B=async t=>{var o;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=y.getState();try{let s=z(n||void 0);if(e&&s&&n)return await J({chain:e,walletType:n,autoReconnect:r})}catch(s){(o=t==null?void 0:t.onError)==null||o.call(t,s),de()}};var Fe=()=>{y.setState({recentChain:null})},ke=t=>{let{activeChain:e}=m.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},bn=()=>y.getState().recentChain,he=async t=>(await X().experimentalSuggestChain(t),t),Be=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...o})=>{let s=await he(t);return{...await J({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...o}),chain:s}};var Ne=(t={})=>(y.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletConnect:t.walletConnect||e.walletConnect,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var We=async t=>{let{activeChain:e,signingClients:n}=m.getState();if(!e||!n)throw new Error("No connected account detected");let{defaultSigningClient:r}=y.getState();return await Promise.all(e.currencies.map(async s=>{let i=s.coinMinimalDenom.startsWith("cw20:");return n[r].getBalance(t,i?s.coinMinimalDenom.replace("cw20:",""):s.coinMinimalDenom)}))},Me=async t=>{let{clients:e}=m.getState();if(!(e!=null&&e.stargate))throw new Error("Stargate client is not ready");return e.stargate.getBalanceStaked(t)},Re=async({senderAddress:t,recipientAddress:e,amount:n,fee:r,memo:o})=>{let{defaultSigningClient:s}=y.getState(),{signingClients:i}=m.getState();if(!i)throw new Error("No connected account detected");if(!t)throw new Error("senderAddress is not defined");return i[s].sendTokens(t,e,n,r,o)},Ue=async({senderAddress:t,recipientAddress:e,transferAmount:n,sourcePort:r,sourceChannel:o,timeoutHeight:s,timeoutTimestamp:i,fee:a,memo:c})=>{let{signingClients:g}=m.getState();if(!(g!=null&&g.stargate))throw new Error("Stargate signing client is not ready");if(!t)throw new Error("senderAddress is not defined");return g.stargate.sendIbcTokens(t,e,n,r,o,s,i,a,c)},Pe=async({senderAddress:t,msg:e,fee:n,options:r,label:o,codeId:s})=>{let{signingClients:i}=m.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.instantiate(t,s,e,o,n,r)},qe=async({senderAddress:t,msg:e,fee:n,contractAddress:r,funds:o,memo:s})=>{let{signingClients:i}=m.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.execute(t,r,e,n,s,o)},Ge=async(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");return await n.cosmWasm.queryContractSmart(t,e)},Le=(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.cosmWasm.queryContractRaw(t,r)};var Bt=require("@keplr-wallet/cosmos"),Nt={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},In={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},Tn={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},vn={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},Dn={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},_n={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},kt=[Nt,In,Tn,vn,Dn,_n],ze={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:Nt,bip44:{coinType:118},bech32Config:Bt.Bech32Address.defaultBech32Config("axelar"),currencies:kt,feeCurrencies:kt};var Mt=require("@keplr-wallet/cosmos"),Rt={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Wt=[Rt],Ke={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:Rt,bip44:{coinType:118},bech32Config:Mt.Bech32Address.defaultBech32Config("cosmos"),currencies:Wt,feeCurrencies:Wt};var Pt=require("@keplr-wallet/cosmos"),qt={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},On={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},jn={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},Fn={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},kn={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},Bn={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},Nn={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Wn={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Mn={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Rn={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Un={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},Ut=[qt,On,jn,Fn,kn,Bn,Nn,Wn,Mn,Rn,Un],Qe={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:qt,bip44:{coinType:118},bech32Config:Pt.Bech32Address.defaultBech32Config("juno"),currencies:Ut,feeCurrencies:Ut};var Lt=require("@keplr-wallet/cosmos"),zt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Pn={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Gt=[zt,Pn],He={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:zt,bip44:{coinType:118},bech32Config:Lt.Bech32Address.defaultBech32Config("osmo"),currencies:Gt,feeCurrencies:Gt};var Qt=require("@keplr-wallet/cosmos"),Ht={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},Kt=[Ht],Ve={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:Ht,bip44:{coinType:118},bech32Config:Qt.Bech32Address.defaultBech32Config("somm"),currencies:Kt,feeCurrencies:Kt};var $t=require("@keplr-wallet/cosmos"),Zt={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},Vt=[Zt],$e={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:$t.Bech32Address.defaultBech32Config("CRE"),currencies:Vt,feeCurrencies:Vt,stakeCurrency:Zt,coinType:118};var Yt=require("@keplr-wallet/cosmos"),Ze={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},qn=[Ze],Ye={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:Ze,bip44:{coinType:118},bech32Config:Yt.Bech32Address.defaultBech32Config("juno"),currencies:qn,feeCurrencies:[Ze],coinType:118};var Xt=require("@keplr-wallet/cosmos"),Xe={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},Gn=[Xe],Je={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:Xe,bip44:{coinType:118},bech32Config:Xt.Bech32Address.defaultBech32Config("osmo"),currencies:Gn,feeCurrencies:[Xe],coinType:118};var et=t=>t,Ln=t=>t,zn=t=>t,Kn=et({axelar:ze,cosmoshub:Ke,juno:Qe,osmosis:He,sommelier:Ve}),Qn=[ze,Ke,Qe,He,Ve],Hn=et({crescent:$e,juno:Ye,osmosis:Je}),Vn=[$e,Ye,Je];var Q=require("@tanstack/react-query"),tn=require("react"),nn=require("zustand/shallow");var Jt=require("@tanstack/react-query"),en=require("zustand/shallow");var $n=()=>y(t=>({walletType:t.walletType,isCosmostation:t.walletType==="cosmostation",isCosmostationMobile:t.walletType==="wc_cosmostation_mobile",isKeplr:t.walletType==="keplr",isKeplrMobile:t.walletType==="wc_keplr_mobile",isLeap:t.walletType==="leap",isLeapMobile:t.walletType==="wc_leap_mobile",isVectis:t.walletType==="vectis",isWalletConnect:t.walletType==="walletconnect"}),en.shallow),ie=t=>{let n=["USE_CHECK_WALLET",y(o=>t||o.walletType)];return(0,Jt.useQuery)(n,({queryKey:[,o]})=>z(o))};var M=({onConnect:t,onDisconnect:e}={})=>{let n=m(o=>o.account),r=m(o=>o.status);return(0,tn.useEffect)(()=>m.subscribe(o=>o.status,(o,s)=>{if(o==="connected"){let{account:i,activeChain:a}=m.getState(),{walletType:c}=y.getState();t==null||t({account:i,chain:a,walletType:c,isReconnect:s==="reconnecting"})}o==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:B,status:r}},on=t=>{let{data:e}=M(),n=t||(e==null?void 0:e.bech32Address);return(0,Q.useQuery)(["USE_BALANCES",n],({queryKey:[,s]})=>We(s),{enabled:!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})},Zn=(t,e)=>{let{data:n}=on(e);return(0,Q.useQuery)(["USE_BALANCE",n,t,e],({queryKey:[,s]})=>s==null?void 0:s.find(i=>i.denom===t),{enabled:!!n})},Yn=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,Q.useMutation)(["USE_CONNECT",t,e,n],J,{onError:(i,a)=>Promise.resolve(t==null?void 0:t(i,a)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:s}=ie();return{connect:i=>o.mutate(i),connectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!s,status:o.status}},Xn=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,Q.useMutation)(["USE_DISCONNECT",t,e,n],de,{onError:s=>Promise.resolve(t==null?void 0:t(s,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:s=>o.mutate(s),disconnectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}},rn=()=>m(t=>({signer:t.offlineSigner,signerAmino:t.offlineSignerAmino,signerAuto:t.offlineSignerAuto}),nn.shallow),Jn=()=>rn(),eo=t=>{let{data:e}=M(),n=t||(e==null?void 0:e.bech32Address);return(0,Q.useQuery)(["USE_BALANCE_STAKED",n],({queryKey:[,s]})=>Me(n),{enabled:!!n})};var ee=require("@tanstack/react-query");var to=()=>m(t=>t.activeChain),no=t=>(0,ee.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>ke(r)),oo=(t,e="BOND_STATUS_BONDED")=>(0,ee.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],({queryKey:[,o,s]})=>o.staking.validators(s),{enabled:typeof t<"u"}),ro=()=>({data:y(e=>e.recentChain),clear:Fe}),so=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,ee.useMutation)(["USE_SUGGEST_CHAIN",t,e,n],he,{onError:(s,i)=>Promise.resolve(t==null?void 0:t(s,i)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}},io=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,ee.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],Be,{onError:(i,a)=>Promise.resolve(t==null?void 0:t(i,a)),onMutate:i=>e==null?void 0:e(i),onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:s}=ie();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!s,status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}};var tt=require("@tanstack/react-query");var co=t=>{let e=m(o=>o.clients);return(0,tt.useQuery)(["USE_CLIENTS",t,e],({queryKey:[,o,s]})=>o!=null&&o.rpc?re(o):s,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:o=>{m.setState({clients:o})},initialData:e})},ao=t=>{let e=m(o=>o.signingClients);return(0,tt.useQuery)(["USE_SIGNING_CLIENTS",t,e],({queryKey:[,o,s]})=>o!=null&&o.rpc?se(o):s,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:o=>{m.setState({signingClients:o})},initialData:e})};var sn=require("@tanstack/react-query");var uo=(...t)=>{let e=["USE_QUERY_CLIENT",...t];return(0,sn.useQuery)(e,({queryKey:[,...r]})=>be(...t),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var R=require("@tanstack/react-query");var lo=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=M(),o=r==null?void 0:r.bech32Address,i=(0,R.useMutation)(["USE_SEND_TOKENS",t,e,n,o],a=>Re({senderAddress:o,...a}),{onError:(a,c)=>Promise.resolve(t==null?void 0:t(a,c)),onMutate:e,onSuccess:a=>Promise.resolve(n==null?void 0:n(a))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},po=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=M(),o=r==null?void 0:r.bech32Address,i=(0,R.useMutation)(["USE_SEND_IBC_TOKENS",t,e,n,o],a=>Ue({senderAddress:o,...a}),{onError:(a,c)=>Promise.resolve(t==null?void 0:t(a,c)),onMutate:e,onSuccess:a=>Promise.resolve(n==null?void 0:n(a))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},mo=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=M(),s=o==null?void 0:o.bech32Address,c=(0,R.useMutation)(["USE_INSTANTIATE_CONTRACT",e,n,r,t,s],g=>{if(!s)throw new Error("senderAddress is undefined");let d={...g,fee:g.fee??"auto",senderAddress:s,codeId:t};return Pe(d)},{onError:(g,d)=>Promise.resolve(e==null?void 0:e(g,d)),onMutate:n,onSuccess:g=>Promise.resolve(r==null?void 0:r(g))});return{error:c.error,isLoading:c.isLoading,isSuccess:c.isSuccess,instantiateContract:c.mutate,instantiateContractAsync:c.mutateAsync,status:c.status}},go=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=M(),s=o==null?void 0:o.bech32Address,c=(0,R.useMutation)(["USE_EXECUTE_CONTRACT",e,n,r,t,s],g=>{if(!s)throw new Error("senderAddress is undefined");let d={...g,fee:g.fee??"auto",senderAddress:s,contractAddress:t,memo:g.memo??"",funds:g.funds??[]};return qe(d)},{onError:(g,d)=>Promise.resolve(e==null?void 0:e(g,d)),onMutate:n,onSuccess:g=>Promise.resolve(r==null?void 0:r(g))});return{error:c.error,isLoading:c.isLoading,isSuccess:c.isSuccess,executeContract:c.mutate,executeContractAsync:c.mutateAsync,status:c.status}},fo=(t,e)=>(0,R.useQuery)(["USE_QUERY_SMART",t,e],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return Ge(t,e)},{enabled:!!t&&!!e}),ho=(t,e)=>(0,R.useQuery)(["USE_QUERY_RAW",e,t],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or key undefined");return Le(t,e)},{enabled:!!t&&!!e});var Se=require("@tanstack/react-query"),un=require("@tanstack/react-query-devtools");var ye=require("react"),Ce=require("react/jsx-runtime"),cn=({children:t})=>{let[e,n]=(0,ye.useState)(!1);return(0,ye.useEffect)(()=>{n(!0)},[]),(0,Ce.jsx)(Ce.Fragment,{children:e?t:null})};var nt=require("react");var an=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem(P)==="Active",{_reconnect:e,_onReconnectFailed:n,_reconnectConnector:r}=y(),{activeChain:o,wcSignClient:s}=m();return(0,nt.useEffect)(()=>{r&&(t&&o?B({onError:n}):!t&&e&&B({onError:n}))},[]),(0,nt.useEffect)(()=>{var i,a,c,g,d,x,C,E,_,H;r&&(r==="cosmostation"&&((a=(i=ge()).subscription)==null||a.call(i,()=>{B({onError:n})})),r==="keplr"&&((g=(c=pe()).subscription)==null||g.call(c,()=>{B({onError:n})})),r==="leap"&&((x=(d=me()).subscription)==null||x.call(d,()=>{B({onError:n})})),r==="vectis"&&((E=(C=fe()).subscription)==null||E.call(C,()=>{B({onError:n})})),r==="walletconnect"&&s&&((H=(_=K()).subscription)==null||H.call(_,()=>{B({onError:n})})))},[r,s]),null},ot=()=>(an(),null);var te=require("react/jsx-runtime"),yo=new Se.QueryClient({}),Co=({children:t,grazOptions:e,debug:n,...r})=>(e&&Ne(e),(0,te.jsxs)(Se.QueryClientProvider,{client:yo,...r,children:[(0,te.jsxs)(cn,{children:[(0,te.jsx)(ot,{}),t]}),n?(0,te.jsx)(un.ReactQueryDevtools,{initialIsOpen:!1,position:"bottom-right"}):null]},"graz-provider"));0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,executeContract,getActiveChainCurrency,getAvailableWallets,getBalanceStaked,getBalances,getCosmostation,getKeplr,getLeap,getQueryRaw,getQuerySmart,getRecentChain,getVectis,getWCCosmostation,getWCKeplr,getWCLeap,getWallet,getWalletConnect,instantiateContract,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useActiveWalletType,useBalance,useBalanceStaked,useBalances,useCheckWallet,useClients,useConnect,useDisconnect,useExecuteContract,useGrazEvents,useInstantiateContract,useOfflineSigners,useQueryClient,useQueryRaw,useQuerySmart,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect});