UNPKG

@stacks/stacking

Version:
2 lines 140 kB
/*! For license information please see index.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksStacking=e():t.StacksStacking=e()}(this,()=>(()=>{var t,e,n={74:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;const r=n(452);if(e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),e.rotr=(t,e)=>t<<32-e|t>>>e,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const i=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function o(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}function s(t){if("string"==typeof t&&(t=o(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}e.bytesToHex=function(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=i[t[n]];return e},e.hexToBytes=function(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(t.length/2);for(let n=0;n<e.length;n++){const r=2*n,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e},e.nextTick=async()=>{},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);const t=Date.now()-i;t>=0&&t<n||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=o,e.toBytes=s,e.concatBytes=function(...t){if(!t.every(t=>t instanceof Uint8Array))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const i=t[e];n.set(i,r),r+=i.length}return n},e.Hash=class{clone(){return this._cloneInto()}},e.checkOpts=function(t,e){if(void 0!==e&&("object"!=typeof e||(n=e,"[object Object]"!==Object.prototype.toString.call(n)||n.constructor!==Object)))throw new TypeError("Options should be object or undefined");var n;return Object.assign(t,e)},e.wrapConstructor=function(t){const e=e=>t().update(s(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,n)=>t(n).update(s(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(r.crypto.web)return r.crypto.web.getRandomValues(new Uint8Array(t));if(r.crypto.node)return new Uint8Array(r.crypto.node.randomBytes(t).buffer);throw new Error("The environment doesn't have randomBytes function")}},216:(t,e,n)=>{const r=n(403);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},258:(t,e,n)=>{"use strict";e.ns=e.bJ=void 0;n(669),n(639);const r=n(877);Object.defineProperty(e,"bJ",{enumerable:!0,get:function(){return r.c32address}}),Object.defineProperty(e,"ns",{enumerable:!0,get:function(){return r.c32addressDecode}})},290:(t,e,n)=>{t=n.nmd(t);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",h="[object Map]",d="[object Number]",f="[object Object]",l="[object Promise]",p="[object RegExp]",g="[object Set]",y="[object String]",w="[object Symbol]",b="[object WeakMap]",m="[object ArrayBuffer]",A="[object DataView]",E="[object Float32Array]",S="[object Float64Array]",v="[object Int8Array]",x="[object Int16Array]",C="[object Int32Array]",I="[object Uint8Array]",_="[object Uint8ClampedArray]",T="[object Uint16Array]",P="[object Uint32Array]",k=/\w*$/,R=/^\[object .+?Constructor\]$/,O=/^(?:0|[1-9]\d*)$/,N={};N[o]=N["[object Array]"]=N[m]=N[A]=N[s]=N[a]=N[E]=N[S]=N[v]=N[x]=N[C]=N[h]=N[d]=N[f]=N[p]=N[g]=N[y]=N[w]=N[I]=N[_]=N[T]=N[P]=!0,N["[object Error]"]=N[c]=N[b]=!1;var B="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,U="object"==typeof self&&self&&self.Object===Object&&self,H=B||U||Function("return this")(),$=e&&!e.nodeType&&e,D=$&&t&&!t.nodeType&&t,L=D&&D.exports===$;function K(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function j(t,e,n,r){var i=-1,o=t?t.length:0;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function G(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function F(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function W(t,e){return function(n){return t(e(n))}}function V(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var q,z=Array.prototype,X=Function.prototype,J=Object.prototype,Z=H["__core-js_shared__"],Y=(q=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+q:"",Q=X.toString,tt=J.hasOwnProperty,et=J.toString,nt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=L?H.Buffer:void 0,it=H.Symbol,ot=H.Uint8Array,st=W(Object.getPrototypeOf,Object),at=Object.create,ct=J.propertyIsEnumerable,ut=z.splice,ht=Object.getOwnPropertySymbols,dt=rt?rt.isBuffer:void 0,ft=W(Object.keys,Object),lt=Ht(H,"DataView"),pt=Ht(H,"Map"),gt=Ht(H,"Promise"),yt=Ht(H,"Set"),wt=Ht(H,"WeakMap"),bt=Ht(Object,"create"),mt=Mt(lt),At=Mt(pt),Et=Mt(gt),St=Mt(yt),vt=Mt(wt),xt=it?it.prototype:void 0,Ct=xt?xt.valueOf:void 0;function It(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function _t(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Pt(t){this.__data__=new _t(t)}function kt(t,e,n){var r=t[e];tt.call(t,e)&&jt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Rt(t,e){for(var n=t.length;n--;)if(jt(t[n][0],e))return n;return-1}function Ot(t,e,n,r,i,l,b){var R;if(r&&(R=l?r(t,i,l,b):r(t)),void 0!==R)return R;if(!qt(t))return t;var O=Gt(t);if(O){if(R=function(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!e)return function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(t,R)}else{var B=Dt(t),U=B==c||B==u;if(Wt(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(B==f||B==o||U&&!l){if(G(t))return l?t:{};if(R=function(t){return"function"!=typeof t.constructor||Kt(t)?{}:qt(e=st(t))?at(e):{};var e}(U?{}:t),!e)return function(t,e){return Bt(t,$t(t),e)}(t,function(t,e){return t&&Bt(e,zt(e),t)}(R,t))}else{if(!N[B])return l?t:{};R=function(t,e,n,r){var i,o=t.constructor;switch(e){case m:return Nt(t);case s:case a:return new o(+t);case A:return function(t,e){var n=e?Nt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case E:case S:case v:case x:case C:case I:case _:case T:case P:return function(t,e){var n=e?Nt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case h:return function(t,e,n){return j(e?n(F(t),!0):F(t),K,new t.constructor)}(t,r,n);case d:case y:return new o(t);case p:return function(t){var e=new t.constructor(t.source,k.exec(t));return e.lastIndex=t.lastIndex,e}(t);case g:return function(t,e,n){return j(e?n(V(t),!0):V(t),M,new t.constructor)}(t,r,n);case w:return i=t,Ct?Object(Ct.call(i)):{}}}(t,B,Ot,e)}}b||(b=new Pt);var H=b.get(t);if(H)return H;if(b.set(t,R),!O)var $=n?function(t){return function(t,e,n){var r=e(t);return Gt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,zt,$t)}(t):zt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}($||t,function(i,o){$&&(i=t[o=i]),kt(R,o,Ot(i,e,n,r,o,t,b))}),R}function Nt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Bt(t,e,n,r){n||(n={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=r?r(n[s],t[s],s,n,t):void 0;kt(n,s,void 0===a?t[s]:a)}return n}function Ut(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function Ht(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!qt(t)||(e=t,Y&&Y in e))&&(Vt(t)||G(t)?nt:R).test(Mt(t));var e}(n)?n:void 0}It.prototype.clear=function(){this.__data__=bt?bt(null):{}},It.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},It.prototype.get=function(t){var e=this.__data__;if(bt){var n=e[t];return n===r?void 0:n}return tt.call(e,t)?e[t]:void 0},It.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:tt.call(e,t)},It.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?r:e,this},_t.prototype.clear=function(){this.__data__=[]},_t.prototype.delete=function(t){var e=this.__data__,n=Rt(e,t);return!(n<0||(n==e.length-1?e.pop():ut.call(e,n,1),0))},_t.prototype.get=function(t){var e=this.__data__,n=Rt(e,t);return n<0?void 0:e[n][1]},_t.prototype.has=function(t){return Rt(this.__data__,t)>-1},_t.prototype.set=function(t,e){var n=this.__data__,r=Rt(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new It,map:new(pt||_t),string:new It}},Tt.prototype.delete=function(t){return Ut(this,t).delete(t)},Tt.prototype.get=function(t){return Ut(this,t).get(t)},Tt.prototype.has=function(t){return Ut(this,t).has(t)},Tt.prototype.set=function(t,e){return Ut(this,t).set(t,e),this},Pt.prototype.clear=function(){this.__data__=new _t},Pt.prototype.delete=function(t){return this.__data__.delete(t)},Pt.prototype.get=function(t){return this.__data__.get(t)},Pt.prototype.has=function(t){return this.__data__.has(t)},Pt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof _t){var r=n.__data__;if(!pt||r.length<199)return r.push([t,e]),this;n=this.__data__=new Tt(r)}return n.set(t,e),this};var $t=ht?W(ht,Object):function(){return[]},Dt=function(t){return et.call(t)};function Lt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||O.test(t))&&t>-1&&t%1==0&&t<e}function Kt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function Mt(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function jt(t,e){return t===e||t!=t&&e!=e}(lt&&Dt(new lt(new ArrayBuffer(1)))!=A||pt&&Dt(new pt)!=h||gt&&Dt(gt.resolve())!=l||yt&&Dt(new yt)!=g||wt&&Dt(new wt)!=b)&&(Dt=function(t){var e=et.call(t),n=e==f?t.constructor:void 0,r=n?Mt(n):void 0;if(r)switch(r){case mt:return A;case At:return h;case Et:return l;case St:return g;case vt:return b}return e});var Gt=Array.isArray;function Ft(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Vt(t)}var Wt=dt||function(){return!1};function Vt(t){var e=qt(t)?et.call(t):"";return e==c||e==u}function qt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function zt(t){return Ft(t)?function(t,e){var n=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Ft(t)}(t)&&tt.call(t,"callee")&&(!ct.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var s in t)!e&&!tt.call(t,s)||i&&("length"==s||Lt(s,r))||n.push(s);return n}(t):function(t){if(!Kt(t))return ft(t);var e=[];for(var n in Object(t))tt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return Ot(t,!0,!0)}},403:t=>{"use strict";t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var r=0;r<t.length;r++){var i=t.charAt(r),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=r}var s=t.length,a=t.charAt(0),c=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var n=0,r=0,i=0;t[n]===a;)r++,n++;for(var o=(t.length-n)*c+1>>>0,u=new Uint8Array(o);t[n];){var h=t.charCodeAt(n);if(h>255)return;var d=e[h];if(255===d)return;for(var f=0,l=o-1;(0!==d||f<i)&&-1!==l;l--,f++)d+=s*u[l]>>>0,u[l]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");i=f,n++}for(var p=o-i;p!==o&&0===u[p];)p++;for(var g=new Uint8Array(r+(o-p)),y=r;p!==o;)g[y++]=u[p++];return g}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var c=(o-i)*u+1>>>0,h=new Uint8Array(c);i!==o;){for(var d=e[i],f=0,l=c-1;(0!==d||f<r)&&-1!==l;l--,f++)d+=256*h[l]>>>0,h[l]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=c-r;p!==c&&0===h[p];)p++;for(var g=a.repeat(n);p<c;++p)g+=t.charAt(h[p]);return g},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},414:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;const r=n(688),i=n(74),o=n(403),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.encode=function(t,e="00"){const n="string"==typeof t?(0,i.hexToBytes)(t):t,a="string"==typeof e?(0,i.hexToBytes)(e):t;if(!(n instanceof Uint8Array&&a instanceof Uint8Array))throw new TypeError("Argument must be of type Uint8Array or string");const c=(0,r.sha256)((0,r.sha256)(new Uint8Array([...a,...n])));return o(s).encode([...a,...n,...c.slice(0,4)])},e.decode=function(t){const e=o(s).decode(t),n=e.slice(0,1),i=e.slice(1,-4),a=(0,r.sha256)((0,r.sha256)(new Uint8Array([...n,...i])));return e.slice(-4).forEach((t,e)=>{if(t!==a[e])throw new Error("Invalid checksum")}),{prefix:n,data:i}}},452:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},460:(t,e)=>{"use strict";function n(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function r(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)}function i(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function o(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");n(t.outputLen),n(t.blockLen)}function s(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function a(t,e){i(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.output=e.exists=e.hash=e.bytes=e.bool=e.number=void 0,e.number=n,e.bool=r,e.bytes=i,e.hash=o,e.exists=s,e.output=a;const c={number:n,bool:r,bytes:i,hash:o,exists:s,output:a};e.default=c},546:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SHA2=void 0;const r=n(460),i=n(74);class o extends i.Hash{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.createView)(this.buffer)}update(t){r.default.exists(this);const{view:e,buffer:n,blockLen:o}=this,s=(t=(0,i.toBytes)(t)).length;for(let r=0;r<s;){const a=Math.min(o-this.pos,s-r);if(a===o){const e=(0,i.createView)(t);for(;o<=s-r;r+=o)this.process(e,r);continue}n.set(t.subarray(r,r+a),this.pos),this.pos+=a,r+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){r.default.exists(this),r.default.output(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:o,isLE:s}=this;let{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let t=a;t<o;t++)e[t]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,u=r?0:4;t.setUint32(e+c,s,r),t.setUint32(e+u,a,r)}(n,o-8,BigInt(8*this.length),s),this.process(n,0);const c=(0,i.createView)(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=u/4,d=this.get();if(h>d.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<h;t++)c.setUint32(4*t,d[t],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return t.length=r,t.pos=s,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}}e.SHA2=o},639:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32checkDecode=e.c32checkEncode=void 0;const r=n(688),i=n(74),o=n(669);function s(t){const e=(0,r.sha256)((0,r.sha256)((0,i.hexToBytes)(t)));return(0,i.bytesToHex)(e.slice(0,4))}e.c32checkEncode=function(t,e){if(t<0||t>=32)throw new Error("Invalid version (must be between 0 and 31)");if(!e.match(/^[0-9a-fA-F]*$/))throw new Error("Invalid data (not a hex string)");(e=e.toLowerCase()).length%2!=0&&(e=`0${e}`);let n=t.toString(16);1===n.length&&(n=`0${n}`);const r=s(`${n}${e}`),i=(0,o.c32encode)(`${e}${r}`);return`${o.c32[t]}${i}`},e.c32checkDecode=function(t){t=(0,o.c32normalize)(t);const e=(0,o.c32decode)(t.slice(1)),n=t[0],r=o.c32.indexOf(n),i=e.slice(-8);let a=r.toString(16);if(1===a.length&&(a=`0${a}`),s(`${a}${e.substring(0,e.length-8)}`)!==i)throw new Error("Invalid c32check string: checksum mismatch");return[r,e.substring(0,e.length-8)]}},669:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;const r=n(74);e.c32="0123456789ABCDEFGHJKMNPQRSTVWXYZ";const i="0123456789abcdef";function o(t){return t.toUpperCase().replace(/O/g,"0").replace(/L|I/g,"1")}e.c32encode=function(t,n){if(!t.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");t.length%2!=0&&(t=`0${t}`);let o=[],s=0;for(let n=(t=t.toLowerCase()).length-1;n>=0;n--)if(s<4){const r=i.indexOf(t[n])>>s;let a=0;0!==n&&(a=i.indexOf(t[n-1]));const c=1+s,u=a%(1<<c)<<5-c,h=e.c32[r+u];s=c,o.unshift(h)}else s=0;let a=0;for(let t=0;t<o.length&&"0"===o[t];t++)a++;o=o.slice(a);const c=(new TextDecoder).decode((0,r.hexToBytes)(t)).match(/^\u0000*/),u=c?c[0].length:0;for(let t=0;t<u;t++)o.unshift(e.c32[0]);if(n){const t=n-o.length;for(let n=0;n<t;n++)o.unshift(e.c32[0])}return o.join("")},e.c32normalize=o,e.c32decode=function(t,n){if(!(t=o(t)).match(`^[${e.c32}]*$`))throw new Error("Not a c32-encoded string");const r=t.match(`^${e.c32[0]}*`),s=r?r[0].length:0;let a=[],c=0,u=0;for(let n=t.length-1;n>=0;n--){4===u&&(a.unshift(i[c]),u=0,c=0);const r=(e.c32.indexOf(t[n])<<u)+c,o=i[r%16];if(u+=1,c=r>>4,c>1<<u)throw new Error("Panic error in decoding.");a.unshift(o)}a.unshift(i[c]),a.length%2==1&&a.unshift("0");let h=0;for(let t=0;t<a.length&&"0"===a[t];t++)h++;a=a.slice(h-h%2);let d=a.join("");for(let t=0;t<s;t++)d=`00${d}`;if(n){const t=2*n-d.length;for(let e=0;e<t;e+=2)d=`00${d}`}return d}},688:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const r=n(546),i=n(74),o=(t,e,n)=>t&e^~t&n,s=(t,e,n)=>t&e^t&n^e&n,a=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),c=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64);class h extends r.SHA2{constructor(){super(64,32,8,!1),this.A=0|c[0],this.B=0|c[1],this.C=0|c[2],this.D=0|c[3],this.E=0|c[4],this.F=0|c[5],this.G=0|c[6],this.H=0|c[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)u[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=u[t-15],n=u[t-2],r=(0,i.rotr)(e,7)^(0,i.rotr)(e,18)^e>>>3,o=(0,i.rotr)(n,17)^(0,i.rotr)(n,19)^n>>>10;u[t]=o+u[t-7]+r+u[t-16]|0}let{A:n,B:r,C:c,D:h,E:d,F:f,G:l,H:p}=this;for(let t=0;t<64;t++){const e=p+((0,i.rotr)(d,6)^(0,i.rotr)(d,11)^(0,i.rotr)(d,25))+o(d,f,l)+a[t]+u[t]|0,g=((0,i.rotr)(n,2)^(0,i.rotr)(n,13)^(0,i.rotr)(n,22))+s(n,r,c)|0;p=l,l=f,f=d,d=h+e|0,h=c,c=r,r=n,n=e+g|0}n=n+this.A|0,r=r+this.B|0,c=c+this.C|0,h=h+this.D|0,d=d+this.E|0,f=f+this.F|0,l=l+this.G|0,p=p+this.H|0,this.set(n,r,c,h,d,f,l,p)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class d extends h{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}e.sha256=(0,i.wrapConstructor)(()=>new h),e.sha224=(0,i.wrapConstructor)(()=>new d)},877:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32ToB58=e.b58ToC32=e.c32addressDecode=e.c32address=e.versions=void 0;const r=n(639),i=n(414),o=n(74);e.versions={mainnet:{p2pkh:22,p2sh:20},testnet:{p2pkh:26,p2sh:21}};const s={};s[0]=e.versions.mainnet.p2pkh,s[5]=e.versions.mainnet.p2sh,s[111]=e.versions.testnet.p2pkh,s[196]=e.versions.testnet.p2sh;const a={};function c(t,e){if(!e.match(/^[0-9a-fA-F]{40}$/))throw new Error("Invalid argument: not a hash160 hex string");return`S${(0,r.c32checkEncode)(t,e)}`}function u(t){if(t.length<=5)throw new Error("Invalid c32 address: invalid length");if("S"!=t[0])throw new Error('Invalid c32 address: must start with "S"');return(0,r.c32checkDecode)(t.slice(1))}a[e.versions.mainnet.p2pkh]=0,a[e.versions.mainnet.p2sh]=5,a[e.versions.testnet.p2pkh]=111,a[e.versions.testnet.p2sh]=196,e.c32address=c,e.c32addressDecode=u,e.b58ToC32=function(t,e=-1){const n=i.decode(t),r=(0,o.bytesToHex)(n.data),a=parseInt((0,o.bytesToHex)(n.prefix),16);let u;return e<0?(u=a,void 0!==s[a]&&(u=s[a])):u=e,c(u,r)},e.c32ToB58=function(t,e=-1){const n=u(t),r=n[0],o=n[1];let s;e<0?(s=r,void 0!==a[r]&&(s=a[r])):s=e;let c=s.toString(16);return 1===c.length&&(c=`0${c}`),i.encode(o,c)}},976:()=>{},991:(t,e)=>{"use strict";for(var n=[],r=[],i=("undefined"!=typeof Uint8Array&&Uint8Array,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),o=0;o<64;++o)n[o]=i[o],r[i.charCodeAt(o)]=o;r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63}},r={};function i(t){var e=r[t];if(void 0!==e)return e.exports;var o=r[t]={id:t,loaded:!1,exports:{}};return n[t](o,o.exports,i),o.loaded=!0,o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&r&&n;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(t=>s[t]=()=>n[t]);return s.default=()=>n,i.d(o,s),o},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var o={};return(()=>{"use strict";function t(t,n){return c(e(t),n)}function e(t){if("bigint"==typeof t)return t;if("string"==typeof t)return BigInt(t);if("number"==typeof t){if(!Number.isInteger(t))throw new RangeError("Invalid value. Values of type 'number' must be an integer.");if(t>Number.MAX_SAFE_INTEGER)throw new RangeError(`Invalid value. Values of type 'number' must be less than or equal to ${Number.MAX_SAFE_INTEGER}. For larger values, try using a BigInt instead.`);return BigInt(t)}if(E(t,Uint8Array))return BigInt(`0x${d(t)}`);throw new TypeError("intToBigInt: Invalid value type. Must be a number, bigint, BigInt-compatible string, or Uint8Array.")}function n(t){return/^0x/i.test(t)?t.slice(2):t}function r(t){if("string"!=typeof t)throw new TypeError("hexToBigInt: expected string, got "+typeof t);return BigInt(`0x${t}`)}function s(t,n=8){return("bigint"==typeof t?t:e(t)).toString(16).padStart(2*n,"0")}function a(t){return parseInt(t,16)}function c(t,e=16){return f(s(t,e))}function u(t){return e=BigInt(`0x${d(t)}`),n=BigInt(8*t.byteLength),function(t,e){return t&BigInt(1)<<e}(e,n-BigInt(1))?e-(BigInt(1)<<n):e;var e,n}i.r(o),i.d(o,{InvalidAddressError:()=>Ro,Pox4SignatureTopic:()=>Wo,StackingClient:()=>ns,btcAddressVersionToLegacyHashMode:()=>Oo,decodeBtcAddress:()=>No,decodeBtcAddressBytes:()=>Bo,ensureLegacyBtcAddressForPox1:()=>Go,ensurePox2Activated:()=>jo,ensureSignerArgsReadiness:()=>Fo,extractPoxAddressFromClarityValue:()=>Uo,getErrorString:()=>Ho,pox4SignatureMessage:()=>zo,poxAddressToBtcAddress:()=>Lo,poxAddressToTuple:()=>$o,signPox4SignatureHash:()=>Vo,unwrap:()=>Ko,unwrapMap:()=>Mo,verifyPox4SignatureHash:()=>qo});const h=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function d(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(const n of t)e+=h[n];return e}function f(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);t=(t=n(t)).length%2?`0${t}`:t;const e=new Uint8Array(t.length/2);for(let n=0;n<e.length;n++){const r=2*n,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e}function l(t){return(new TextEncoder).encode(t)}function p(t){return(new TextDecoder).decode(t)}function g(t){const e=[];for(let n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return new Uint8Array(e)}function y(t){return String.fromCharCode.apply(null,t)}function w(t){return!Number.isInteger(t)||t<0||t>255}function b(t){if(t.some(w))throw new Error("Some values are invalid bytes.");return new Uint8Array(t)}function m(...t){if(!t.every(t=>t instanceof Uint8Array))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const i=t[e];n.set(i,r),r+=i.length}return n}function A(t){return m(...t.map(t=>"number"==typeof t?b([t]):t instanceof Array?b(t):t))}function E(t,e){return t instanceof e||t?.constructor?.name?.toLowerCase()===e.name}const S={referrerPolicy:"origin",headers:{"x-hiro-product":"stacksjs"}};async function v(t,e){const n={};return Object.assign(n,S,e),await fetch(t,n)}function x(...t){const{fetchLib:e,middlewares:n}=function(t){let e=v,n=[];return t.length>0&&"function"==typeof t[0]&&(e=t.shift()),t.length>0&&(n=t),{fetchLib:e,middlewares:n}}(t);return async(t,r)=>{let i={url:t,init:r??{}};for(const t of n)"function"==typeof t.pre&&(i=await Promise.resolve(t.pre({fetch:e,...i}))??i);let o=await e(i.url,i.init);for(const t of n)if("function"==typeof t.post){const n=await Promise.resolve(t.post({fetch:e,url:i.url,init:i.init,response:o?.clone()??o}));o=n??o}return o}}var C,I,_,T,P;!function(t){t[t.Mainnet=1]="Mainnet",t[t.Testnet=2147483648]="Testnet"}(C||(C={})),function(t){t[t.Mainnet=385875968]="Mainnet",t[t.Testnet=4278190080]="Testnet"}(I||(I={})),C.Mainnet,(P=_||(_={}))[P.Mainnet=0]="Mainnet",P[P.Testnet=128]="Testnet",function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(T||(T={})),_.Mainnet;const k={chainId:C.Mainnet,transactionVersion:_.Mainnet,peerNetworkId:I.Mainnet,magicBytes:"X2",bootAddress:"SP000000000000000000002Q6VF78",addressVersion:{singleSig:T.MainnetSingleSig,multiSig:T.MainnetMultiSig},client:{baseUrl:"https://api.mainnet.hiro.so"}},R={chainId:C.Testnet,transactionVersion:_.Testnet,peerNetworkId:I.Testnet,magicBytes:"T2",bootAddress:"ST000000000000000000002AMW42H",addressVersion:{singleSig:T.TestnetSingleSig,multiSig:T.TestnetMultiSig},client:{baseUrl:"https://api.testnet.hiro.so"}},O={...R,addressVersion:{...R.addressVersion},magicBytes:"id",client:{baseUrl:"http://localhost:3999"}},N={...O,addressVersion:{...O.addressVersion},client:{...O.client}},B=["mainnet","testnet","devnet","mocknet"];function U(t){return"string"==typeof t?function(t){switch(t){case"mainnet":return k;case"testnet":return R;case"devnet":return O;case"mocknet":return N;default:throw new Error(`Unknown network name: ${t}`)}}(t):t}function H(t){return t.client.fetch?t.client:{...t.client,fetch:x()}}class $ extends Error{constructor(t){super(t),this.message=t,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class D extends ${constructor(t){super(t)}}class L extends ${constructor(t){super(t)}}class K extends ${constructor(t){super(t)}}class M extends ${constructor(t){super(t)}}class j extends ${constructor(t){super(t)}}function G(t,e){return t[e]}function F(t,e,n=0){return t[n]=e,t}function W(t,e,n=0){return t[n+3]=e,e>>>=8,t[n+2]=e,e>>>=8,t[n+1]=e,e>>>=8,t[n]=e,t}function V(t,e,n=0){return t[n+0]=255&e,e>>>=8,t[n+1]=255&e,e>>>=8,t[n+2]=255&e,e>>>=8,t[n+3]=255&e,t}const q=new Map;function z(t,e){const n=q.get(t);if(void 0!==n)return n(e);const r=function(t){const e=Object.values(t).filter(t=>"number"==typeof t),n=new Set(e);return t=>n.has(t)}(t);return q.set(t,r),z(t,e)}class X{constructor(t){this.consumed=0,this.source="string"==typeof t?f(t):t}readBytes(t){const e=this.source.subarray(this.consumed,this.consumed+t);return this.consumed+=t,e}readUInt32BE(){return(t=this.readBytes(4))[0]*2**24+65536*t[1]+256*t[2]+t[3];var t}readUInt8(){return G(this.readBytes(1),0)}readUInt16BE(){return((t=this.readBytes(2))[0+0]<<8|t[1])>>>0;var t}readBigUIntLE(t){const e=d(this.readBytes(t).slice().reverse());return BigInt(`0x${e}`)}readBigUIntBE(t){const e=d(this.readBytes(t));return BigInt(`0x${e}`)}get readOffset(){return this.consumed}set readOffset(t){this.consumed=t}get internalBytes(){return this.source}readUInt8Enum(t,e){const n=this.readUInt8();if(z(t,n))return n;throw e(n)}}const J=128,Z=128,Y=16;var Q,tt,et,nt,rt,it;(it=Q||(Q={}))[it.TokenTransfer=0]="TokenTransfer",it[it.SmartContract=1]="SmartContract",it[it.VersionedSmartContract=6]="VersionedSmartContract",it[it.ContractCall=2]="ContractCall",it[it.PoisonMicroblock=3]="PoisonMicroblock",it[it.Coinbase=4]="Coinbase",it[it.CoinbaseToAltRecipient=5]="CoinbaseToAltRecipient",it[it.TenureChange=7]="TenureChange",it[it.NakamotoCoinbase=8]="NakamotoCoinbase",(rt=tt||(tt={}))[rt.Clarity1=1]="Clarity1",rt[rt.Clarity2=2]="Clarity2",rt[rt.Clarity3=3]="Clarity3",rt[rt.Clarity4=4]="Clarity4",(nt=et||(et={}))[nt.OnChainOnly=1]="OnChainOnly",nt[nt.OffChainOnly=2]="OffChainOnly",nt[nt.Any=3]="Any";var ot,st,at,ct,ut,ht,dt,ft,lt,pt,gt,yt,wt,bt,mt,At,Et,St,vt,xt;function Ct(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function It(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}et.OnChainOnly,et.OffChainOnly,et.Any,et.OnChainOnly,et.OnChainOnly,et.OffChainOnly,et.OffChainOnly,et.Any,et.Any,(xt=ot||(ot={}))[xt.Allow=1]="Allow",xt[xt.Deny=2]="Deny",(vt=st||(st={}))[vt.STX=0]="STX",vt[vt.Fungible=1]="Fungible",vt[vt.NonFungible=2]="NonFungible",(St=at||(at={}))[St.Standard=4]="Standard",St[St.Sponsored=5]="Sponsored",(Et=ct||(ct={}))[Et.P2PKH=0]="P2PKH",Et[Et.P2SH=1]="P2SH",Et[Et.P2WPKH=2]="P2WPKH",Et[Et.P2WSH=3]="P2WSH",Et[Et.P2SHNonSequential=5]="P2SHNonSequential",Et[Et.P2WSHNonSequential=7]="P2WSHNonSequential",(At=ut||(ut={}))[At.Compressed=0]="Compressed",At[At.Uncompressed=1]="Uncompressed",function(t){t[t.Equal=1]="Equal",t[t.Greater=2]="Greater",t[t.GreaterEqual=3]="GreaterEqual",t[t.Less=4]="Less",t[t.LessEqual=5]="LessEqual"}(ht||(ht={})),function(t){t[t.Sends=16]="Sends",t[t.DoesNotSend=17]="DoesNotSend"}(dt||(dt={})),(mt=ft||(ft={}))[mt.Origin=1]="Origin",mt[mt.Standard=2]="Standard",mt[mt.Contract=3]="Contract",function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(lt||(lt={})),(bt=pt||(pt={}))[bt.BlockFound=0]="BlockFound",bt[bt.Extended=1]="Extended",bt[bt.ExtendedRuntime=2]="ExtendedRuntime",bt[bt.ExtendedReadCount=3]="ExtendedReadCount",bt[bt.ExtendedReadLength=4]="ExtendedReadLength",bt[bt.ExtendedWriteCount=5]="ExtendedWriteCount",bt[bt.ExtendedWriteLength=6]="ExtendedWriteLength",(wt=gt||(gt={}))[wt.PublicKeyCompressed=0]="PublicKeyCompressed",wt[wt.PublicKeyUncompressed=1]="PublicKeyUncompressed",wt[wt.SignatureCompressed=2]="SignatureCompressed",wt[wt.SignatureUncompressed=3]="SignatureUncompressed",function(t){t.Serialization="Serialization",t.Deserialization="Deserialization",t.SignatureValidation="SignatureValidation",t.FeeTooLow="FeeTooLow",t.BadNonce="BadNonce",t.NotEnoughFunds="NotEnoughFunds",t.NoSuchContract="NoSuchContract",t.NoSuchPublicFunction="NoSuchPublicFunction",t.BadFunctionArgument="BadFunctionArgument",t.ContractAlreadyExists="ContractAlreadyExists",t.PoisonMicroblocksDoNotConflict="PoisonMicroblocksDoNotConflict",t.PoisonMicroblockHasUnknownPubKeyHash="PoisonMicroblockHasUnknownPubKeyHash",t.PoisonMicroblockIsInvalid="PoisonMicroblockIsInvalid",t.BadAddressVersionByte="BadAddressVersionByte",t.NoCoinbaseViaMempool="NoCoinbaseViaMempool",t.ServerFailureNoSuchChainTip="ServerFailureNoSuchChainTip",t.ServerFailureDatabase="ServerFailureDatabase",t.ServerFailureOther="ServerFailureOther"}(yt||(yt={}));const _t={number:Ct,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:It,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Ct(t.outputLen),Ct(t.blockLen)},exists:function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},output:function(t,e){It(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}},Tt=("object"==typeof self&&"crypto"in self&&self.crypto,t=>new DataView(t.buffer,t.byteOffset,t.byteLength)),Pt=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function kt(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));class Rt{clone(){return this._cloneInto()}}function Ot(t){const e=e=>t().update(kt(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}class Nt extends Rt{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Tt(this.buffer)}update(t){_t.exists(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=kt(t)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s===r){const e=Tt(t);for(;r<=i-o;o+=r)this.process(e,o);continue}n.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){_t.exists(this),_t.output(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let t=o;t<r;t++)e[t]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,u=r?0:4;t.setUint32(e+c,s,r),t.setUint32(e+u,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=Tt(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<c;t++)s.setUint32(4*t,u[t],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return t.length=r,t.pos=s,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}}const Bt=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Ut=Uint8Array.from({length:16},(t,e)=>e),Ht=Ut.map(t=>(9*t+5)%16);let $t=[Ut],Dt=[Ht];for(let t=0;t<4;t++)for(let e of[$t,Dt])e.push(e[t].map(t=>Bt[t]));const Lt=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>new Uint8Array(t)),Kt=$t.map((t,e)=>t.map(t=>Lt[e][t])),Mt=Dt.map((t,e)=>t.map(t=>Lt[e][t])),jt=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Gt=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),Ft=(t,e)=>t<<e|t>>>32-e;function Wt(t,e,n,r){return 0===t?e^n^r:1===t?e&n|~e&r:2===t?(e|~n)^r:3===t?e&r|n&~r:e^(n|~r)}const Vt=new Uint32Array(16);class qt extends Nt{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:e,h2:n,h3:r,h4:i}=this;return[t,e,n,r,i]}set(t,e,n,r,i){this.h0=0|t,this.h1=0|e,this.h2=0|n,this.h3=0|r,this.h4=0|i}process(t,e){for(let n=0;n<16;n++,e+=4)Vt[n]=t.getUint32(e,!0);let n=0|this.h0,r=n,i=0|this.h1,o=i,s=0|this.h2,a=s,c=0|this.h3,u=c,h=0|this.h4,d=h;for(let t=0;t<5;t++){const e=4-t,f=jt[t],l=Gt[t],p=$t[t],g=Dt[t],y=Kt[t],w=Mt[t];for(let e=0;e<16;e++){const r=Ft(n+Wt(t,i,s,c)+Vt[p[e]]+f,y[e])+h|0;n=h,h=c,c=0|Ft(s,10),s=i,i=r}for(let t=0;t<16;t++){const n=Ft(r+Wt(e,o,a,u)+Vt[g[t]]+l,w[t])+d|0;r=d,d=u,u=0|Ft(a,10),a=o,o=n}}this.set(this.h1+s+u|0,this.h2+c+d|0,this.h3+h+r|0,this.h4+n+o|0,this.h0+i+a|0)}roundClean(){Vt.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const zt=Ot(()=>new qt),Xt=(t,e,n)=>t&e^~t&n,Jt=(t,e,n)=>t&e^t&n^e&n,Zt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Yt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Qt=new Uint32Array(64);class te extends Nt{constructor(){super(64,32,8,!1),this.A=0|Yt[0],this.B=0|Yt[1],this.C=0|Yt[2],this.D=0|Yt[3],this.E=0|Yt[4],this.F=0|Yt[5],this.G=0|Yt[6],this.H=0|Yt[7]}get(){const{A:t,B:e,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[t,e,n,r,i,o,s,a]}set(t,e,n,r,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Qt[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Qt[t-15],n=Qt[t-2],r=Pt(e,7)^Pt(e,18)^e>>>3,i=Pt(n,17)^Pt(n,19)^n>>>10;Qt[t]=i+Qt[t-7]+r+Qt[t-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let t=0;t<64;t++){const e=u+(Pt(s,6)^Pt(s,11)^Pt(s,25))+Xt(s,a,c)+Zt[t]+Qt[t]|0,h=(Pt(n,2)^Pt(n,13)^Pt(n,22))+Jt(n,r,i)|0;u=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+h|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,i,o,s,a,c,u)}roundClean(){Qt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class ee extends te{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const ne=Ot(()=>new te),re=(Ot(()=>new ee),BigInt(2**32-1)),ie=BigInt(32);function oe(t,e=!1){return e?{h:Number(t&re),l:Number(t>>ie&re)}:{h:0|Number(t>>ie&re),l:0|Number(t&re)}}const se=function(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=oe(t[i],e);[n[i],r[i]]=[o,s]}return[n,r]},ae=(t,e,n)=>t>>>n,ce=(t,e,n)=>t<<32-n|e>>>n,ue=(t,e,n)=>t>>>n|e<<32-n,he=(t,e,n)=>t<<32-n|e>>>n,de=(t,e,n)=>t<<64-n|e>>>n-32,fe=(t,e,n)=>t>>>n-32|e<<64-n,le=function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},pe=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),ge=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,ye=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),we=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,be=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,me=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0),[Ae,Ee]=se(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Se=new Uint32Array(80),ve=new Uint32Array(80);class xe extends Nt{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:u,Fh:h,Fl:d,Gh:f,Gl:l,Hh:p,Hl:g}=this;return[t,e,n,r,i,o,s,a,c,u,h,d,f,l,p,g]}set(t,e,n,r,i,o,s,a,c,u,h,d,f,l,p,g){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|h,this.Fl=0|d,this.Gh=0|f,this.Gl=0|l,this.Hh=0|p,this.Hl=0|g}process(t,e){for(let n=0;n<16;n++,e+=4)Se[n]=t.getUint32(e),ve[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Se[t-15],n=0|ve[t-15],r=ue(e,n,1)^ue(e,n,8)^ae(e,n,7),i=he(e,n,1)^he(e,n,8)^ce(e,n,7),o=0|Se[t-2],s=0|ve[t-2],a=ue(o,s,19)^de(o,s,61)^ae(o,s,6),c=he(o,s,19)^fe(o,s,61)^ce(o,s,6),u=ye(i,c,ve[t-7],ve[t-16]),h=we(u,r,a,Se[t-7],Se[t-16]);Se[t]=0|h,ve[t]=0|u}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:u,Eh:h,El:d,Fh:f,Fl:l,Gh:p,Gl:g,Hh:y,Hl:w}=this;for(let t=0;t<80;t++){const e=ue(h,d,14)^ue(h,d,18)^de(h,d,41),b=he(h,d,14)^he(h,d,18)^fe(h,d,41),m=h&f^~h&p,A=me(w,b,d&l^~d&g,Ee[t],ve[t]),E=be(A,y,e,m,Ae[t],Se[t]),S=0|A,v=ue(n,r,28)^de(n,r,34)^de(n,r,39),x=he(n,r,28)^fe(n,r,34)^fe(n,r,39),C=n&i^n&s^i&s,I=r&o^r&a^o&a;y=0|p,w=0|g,p=0|f,g=0|l,f=0|h,l=0|d,({h,l:d}=le(0|c,0|u,0|E,0|S)),c=0|s,u=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const _=pe(S,x,I);n=ge(_,E,v,C),r=0|_}({h:n,l:r}=le(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=le(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=le(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=le(0|this.Dh,0|this.Dl,0|c,0|u)),({h,l:d}=le(0|this.Eh,0|this.El,0|h,0|d)),({h:f,l}=le(0|this.Fh,0|this.Fl,0|f,0|l)),({h:p,l:g}=le(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:w}=le(0|this.Hh,0|this.Hl,0|y,0|w)),this.set(n,r,i,o,s,a,c,u,h,d,f,l,p,g,y,w)}roundClean(){Se.fill(0),ve.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Ce extends xe{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class Ie extends xe{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class _e extends xe{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}Ot(()=>new xe),Ot(()=>new Ce);const Te=Ot(()=>new Ie);Ot(()=>new _e);var Pe=i(976),ke=i.t(Pe,2);const Re=BigInt(0),Oe=BigInt(1),Ne=BigInt(2),Be=BigInt(3),Ue=BigInt(8),He=Object.freeze({a:Re,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:Oe,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),$e=(t,e)=>(t+e/Ne)/e,De={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=He,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Oe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=$e(o*t,e),c=$e(-r*t,e);let u=pn(t-a*n-c*i,e),h=pn(-a*r-c*o,e);const d=u>s,f=h>s;if(d&&(u=e-u),f&&(h=e-h),u>s||h>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:d,k1:u,k2neg:f,k2:h}}},Le=32,Ke=32,Me=32,je=Le+1,Ge=2*Le+1;function Fe(t){const{a:e,b:n}=He,r=pn(t*t),i=pn(r*t);return pn(i+e*t+n)}const We=He.a===Re;class Ve extends Error{constructor(t){super(t)}}function qe(t){if(!(t instanceof ze))throw new TypeError("JacobianPoint expected")}class ze{constructor(t,e,n){this.x=t,this.y=e,this.z=n}static fromAffine(t){if(!(t instanceof Ze))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(Ze.ZERO)?ze.ZERO:new ze(t.x,t.y,Oe)}static toAffineBatch(t){const e=function(t,e=He.P){const n=new Array(t.length),r=yn(t.reduce((t,r,i)=>r===Re?t:(n[i]=t,pn(t*r,e)),Oe),e);return t.reduceRight((t,r,i)=>r===Re?t:(n[i]=pn(t*n[i],e),pn(t*r,e)),r),n}(t.map(t=>t.z));return t.map((t,n)=>t.toAffine(e[n]))}static normalizeZ(t){return ze.toAffineBatch(t).map(ze.fromAffine)}equals(t){qe(t);const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t,a=pn(r*r),c=pn(s*s),u=pn(e*c),h=pn(i*a),d=pn(pn(n*s)*c),f=pn(pn(o*r)*a);return u===h&&d===f}negate(){return new ze(this.x,pn(-this.y),this.z)}double(){const{x:t,y:e,z:n}=this