@stacks/storage 7.3.0 → 7.3.1-beta.0
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/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +6 -6
package/dist/umd/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksStorage=e():t.StacksStorage=e()}(this,()=>(()=>{var t,e,n={13:(t,e,n)=>{t.exports=n(790)},28:()=>{},70:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SECP256K1Client=void 0;const r=n(500),i=n(688),o=n(261),s=n(599),a=n(87),c=n(74);o.utils.hmacSha256Sync=(t,...e)=>{const n=r.hmac.create(i.sha256,t);return e.forEach(t=>n.update(t)),n.digest()};class u{static derivePublicKey(t,e=!0){return 66===t.length&&(t=t.slice(0,64)),t.length<64&&(t=t.padStart(64,"0")),(0,c.bytesToHex)(o.getPublicKey(t,e))}static signHash(t,e,n="jose"){if(!t||!e)throw new a.MissingParametersError("a signing input hash and private key are all required");const r=o.signSync(t,e.slice(0,64),{der:!0,canonical:!1});if("der"===n)return(0,c.bytesToHex)(r);if("jose"===n)return(0,s.derToJose)(r,"ES256");throw Error("Invalid signature format")}static loadSignature(t){return(0,s.joseToDer)(t,"ES256")}static verifyHash(t,e,n){if(!t||!e||!n)throw new a.MissingParametersError("a signing input hash, der signature, and public key are all required");return o.verify(e,t,n,{strict:!1})}}e.SECP256K1Client=u,u.algorithmName="ES256K"},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")}},87:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidTokenError=e.MissingParametersError=void 0;class n extends Error{constructor(t){super(),this.name="MissingParametersError",this.message=t||""}}e.MissingParametersError=n;class r extends Error{constructor(t){super(),this.name="InvalidTokenError",this.message=t||""}}e.InvalidTokenError=r},118:(t,e)=>{"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t){if(t){if("string"==typeof t)return n(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}function i(t,e){return void 0===e&&(e="{$origin}\n{$ttl}\n\n; SOA Record\n{name} {ttl} IN SOA {mname}{rname}(\n{serial} ;serial\n{refresh} ;refresh\n{retry} ;retry\n{expire} ;expire\n{minimum} ;minimum ttl\n)\n\n; NS Records\n{ns}\n\n; MX Records\n{mx}\n\n; A Records\n{a}\n\n; AAAA Records\n{aaaa}\n\n; CNAME Records\n{cname}\n\n; PTR Records\n{ptr}\n\n; TXT Records\n{txt}\n\n; SRV Records\n{srv}\n\n; SPF Records\n{spf}\n\n; URI Records\n{uri}\n"),e=function(t,e){var n="";return void 0!==t&&(n+="$ORIGIN "+t),e.replace("{$origin}",n)}(t.$origin,e),e=function(t,e){var n="";return void 0!==t&&(n+="$TTL "+t),e.replace("{$ttl}",n)}(t.$ttl,e),e=function(t,e){var n=e;if(void 0!==t)for(var r in t.name=t.name||"@",t.ttl=t.ttl||"",t)n=n.replace("{"+r+"}",t[r]+"\t");return n}(t.soa,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tNS\t"+s.host+"\n"}return e.replace("{ns}",n)}(t.ns,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tA\t"+s.ip+"\n"}return e.replace("{a}",n)}(t.a,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tAAAA\t"+s.ip+"\n"}return e.replace("{aaaa}",n)}(t.aaaa,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tCNAME\t"+s.alias+"\n"}return e.replace("{cname}",n)}(t.cname,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tMX\t"+s.preference+"\t"+s.host+"\n"}return e.replace("{mx}",n)}(t.mx,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tPTR\t"+s.host+"\n"}return e.replace("{ptr}",n)}(t.ptr,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tTXT\t";var a=s.txt;"string"==typeof a?n+='"'+a+'"':a instanceof Array&&(n+=a.map(function(t){return'"'+t+'"'}).join(" ")),n+="\n"}return e.replace("{txt}",n)}(t.txt,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tSRV\t"+s.priority+"\t",n+=s.weight+"\t",n+=s.port+"\t",n+=s.target+"\n"}return e.replace("{srv}",n)}(t.srv,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tSPF\t"+s.data+"\n"}return e.replace("{spf}",n)}(t.spf,e),(e=function(t,e){e=(e=e.replace("{zone}",t.$origin||!!t.soa&&t.soa.name||"")).replace("{datetime}",(new Date).toISOString());var n=Math.round(Date.now()/1e3);return e.replace("{time}",""+n)}(t,e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tURI\t"+s.priority+"\t",n+=s.weight+"\t",n+='"'+s.target+'"\n'}return e.replace("{uri}",n)}(t.uri,e))).replace(/\n{2,}/gim,"\n\n")}function o(t){return function(t){for(var e,n={},i=r(t.split("\n"));!(e=i()).done;){var o=e.value;if(o&&o.trim()){var m=o.toUpperCase();/\s+TXT\s+/.test(m)?(n.txt=n.txt||[],n.txt.push(h(o))):0===m.indexOf("$ORIGIN")?n.$origin=o.split(/\s+/g)[1]:0===m.indexOf("$TTL")?n.$ttl=parseInt(o.split(/\s+/g)[1],10):/\s+SOA\s+/.test(m)?n.soa=s(o):/\s+NS\s+/.test(m)?(n.ns=n.ns||[],n.ns.push(a(o))):/\s+A\s+/.test(m)?(n.a=n.a||[],n.a.push(c(o,n.a))):/\s+AAAA\s+/.test(m)?(n.aaaa=n.aaaa||[],n.aaaa.push(u(o))):/\s+CNAME\s+/.test(m)?(n.cname=n.cname||[],n.cname.push(f(o))):/\s+MX\s+/.test(m)?(n.mx=n.mx||[],n.mx.push(l(o))):/\s+PTR\s+/.test(m)?(n.ptr=n.ptr||[],n.ptr.push(p(o,n.ptr,n.$origin))):/\s+SRV\s+/.test(m)?(n.srv=n.srv||[],n.srv.push(d(o))):/\s+SPF\s+/.test(m)?(n.spf=n.spf||[],n.spf.push(y(o))):/\s+URI\s+/.test(m)&&(n.uri=n.uri||[],n.uri.push(g(o)))}}return n}(t=function(t){for(var e=[],n=/\([\s\S]*?\)/gim,r=n.exec(t);null!==r;){var i=r[0].replace(/\s+/gm," ");e.push({match:r,replacement:i}),r=n.exec(t)}for(var o=t.split(""),s=0,a=e;s<a.length;s++){var c=a[s],u=c.match;o.splice(u.index,u[0].length,c.replacement)}return o.join("").replace(/\(|\)/gim," ")}(t=function(t){return t.replace(/(^|[^\\]);.*/g,function(t,e){return e||""})}(t)))}function s(t){var e={},n=t.trim().split(/\s+/g),r=n.length;return e.name=n[0],e.minimum=parseInt(n[r-1],10),e.expire=parseInt(n[r-2],10),e.retry=parseInt(n[r-3],10),e.refresh=parseInt(n[r-4],10),e.serial=parseInt(n[r-5],10),e.rname=n[r-6],e.mname=n[r-7],isNaN(n[1])||(e.ttl=parseInt(n[1],10)),e}function a(t){var e=t.trim().split(/\s+/g),n={name:e[0],host:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function c(t,e){var n=t.trim().split(/\s+/g),r=t.trim().toUpperCase().split(/\s+/g),i={name:n[0],ip:n[n.length-1]};return 0===r.lastIndexOf("A")&&(i.name=e.length?e[e.length-1].name:"@"),isNaN(n[1])||(i.ttl=parseInt(n[1],10)),i}function u(t){var e=t.trim().split(/\s+/g),n={name:e[0],ip:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function f(t){var e=t.trim().split(/\s+/g),n={name:e[0],alias:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function l(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],preference:parseInt(e[n-2],10),host:e[n-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function h(t){var e=t.trim().match(/[^\s"']+|"[^"]*"|'[^']*'/g);if(!e)throw new Error("Failure to tokenize TXT record");var n,r=e.length,i=e.indexOf("TXT");function o(t){return t.indexOf('"')>-1&&(t=t.split('"')[1]),t}n=r-i-1>1?[].concat(e.slice(i+1).map(o)):o(e[r-1]);var s={name:e[0],txt:n};return isNaN(e[1])||(s.ttl=parseInt(e[1],10)),s}function p(t,e,n){var r=t.trim().split(/\s+/g);0===t.trim().toUpperCase().split(/\s+/g).lastIndexOf("PTR")&&e[e.length-1]&&r.unshift(e[e.length-1].name);var i={name:r[0],fullname:r[0]+"."+n,host:r[r.length-1]};return isNaN(r[1])||(i.ttl=parseInt(r[1],10)),i}function d(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],target:e[n-1],priority:parseInt(e[n-4],10),weight:parseInt(e[n-3],10),port:parseInt(e[n-2],10)};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function y(t){for(var e=t.trim().split(/\s+/g),n={name:e[0],data:""},r=e.length;r-- >4;)n.data=e[r]+" "+n.data.trim();return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function g(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],target:e[n-1].replace(/"/g,""),priority:parseInt(e[n-3],10),weight:parseInt(e[n-2],10)};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}(function(){var t=function(t){this.jsonZoneFile="object"==typeof t?JSON.parse(JSON.stringify(t)):"string"==typeof t?o(t):void 0}.prototype;t.toJSON=function(){return this.jsonZoneFile},t.toString=function(){return i(this.toJSON())}})(),e.makeZoneFile=i,e.parseZoneFile=o},165:(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 f=u/4,l=this.get();if(f>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<f;t++)c.setUint32(4*t,l[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},211:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256Async=e.hashSha256=void 0;const i=n(688);function o(t){return(0,i.sha256)(t)}e.hashSha256=o,e.hashSha256Async=function(t){return r(this,void 0,void 0,function*(){try{if("undefined"!=typeof crypto&&void 0!==crypto.subtle){const e="string"==typeof t?(new TextEncoder).encode(t):t,n=yield crypto.subtle.digest("SHA-256",e);return new Uint8Array(n)}{const e=n(951);if(!e.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(e.createHash("sha256").update(t).digest())}}catch(e){return console.log(e),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(o(t))}})}},216:(t,e,n)=>{const r=n(403);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},258:(t,e,n)=>{"use strict";e.bJ=void 0;n(669),n(639);const r=n(877);Object.defineProperty(e,"bJ",{enumerable:!0,get:function(){return r.c32address}})},261:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.schnorr=e.verify=e.signSync=e.sign=e.getSharedSecret=e.recoverPublicKey=e.getPublicKey=e.Signature=e.Point=e.CURVE=void 0;const r=n(28),i=BigInt(0),o=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(8),u=Object.freeze({a:i,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});e.CURVE=u;const f=(t,e)=>(t+e/s)/e,l={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=u,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,a=BigInt("0x100000000000000000000000000000000"),c=f(s*t,e),l=f(-r*t,e);let h=N(t-c*n-l*i,e),p=N(-c*r-l*s,e);const d=h>a,y=p>a;if(d&&(h=e-h),y&&(p=e-p),h>a||p>a)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:d,k1:h,k2neg:y,k2:p}}};function h(t){const{a:e,b:n}=u,r=N(t*t),i=N(r*t);return N(i+e*t+n)}const p=u.a===i;class d extends Error{constructor(t){super(t)}}function y(t){if(!(t instanceof g))throw new TypeError("JacobianPoint expected")}class g{constructor(t,e,n){this.x=t,this.y=e,this.z=n}static fromAffine(t){if(!(t instanceof w))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(w.ZERO)?g.ZERO:new g(t.x,t.y,o)}static toAffineBatch(t){const e=function(t,e=u.P){const n=new Array(t.length),r=P(t.reduce((t,r,o)=>r===i?t:(n[o]=t,N(t*r,e)),o),e);return t.reduceRight((t,r,o)=>r===i?t:(n[o]=N(t*n[o],e),N(t*r,e)),r),n}(t.map(t=>t.z));return t.map((t,n)=>t.toAffine(e[n]))}static normalizeZ(t){return g.toAffineBatch(t).map(g.fromAffine)}equals(t){y(t);const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t,a=N(r*r),c=N(s*s),u=N(e*c),f=N(i*a),l=N(N(n*s)*c),h=N(N(o*r)*a);return u===f&&l===h}negate(){return new g(this.x,N(-this.y),this.z)}double(){const{x:t,y:e,z:n}=this,r=N(t*t),i=N(e*e),o=N(i*i),u=t+i,f=N(s*(N(u*u)-r-o)),l=N(a*r),h=N(l*l),p=N(h-s*f),d=N(l*(f-p)-c*o),y=N(s*e*n);return new g(p,d,y)}add(t){y(t);const{x:e,y:n,z:r}=this,{x:o,y:a,z:c}=t;if(o===i||a===i)return this;if(e===i||n===i)return t;const u=N(r*r),f=N(c*c),l=N(e*f),h=N(o*u),p=N(N(n*c)*f),d=N(N(a*r)*u),m=N(h-l),b=N(d-p);if(m===i)return b===i?this.double():g.ZERO;const w=N(m*m),v=N(m*w),x=N(l*w),E=N(b*b-v-s*x),S=N(b*(x-E)-p*v),A=N(r*c*m);return new g(E,S,A)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=g.ZERO;if("bigint"==typeof t&&t===i)return e;let n=L(t);if(n===o)return this;if(!p){let t=e,r=this;for(;n>i;)n&o&&(t=t.add(r)),r=r.double(),n>>=o;return t}let{k1neg:r,k1:s,k2neg:a,k2:c}=l.splitScalar(n),u=e,f=e,h=this;for(;s>i||c>i;)s&o&&(u=u.add(h)),c&o&&(f=f.add(h)),h=h.double(),s>>=o,c>>=o;return r&&(u=u.negate()),a&&(f=f.negate()),f=new g(N(f.x*l.beta),f.y,f.z),u.add(f)}precomputeWindow(t){const e=p?128/t+1:256/t+1,n=[];let r=this,i=r;for(let o=0;o<e;o++){i=r,n.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(t,e){!e&&this.equals(g.BASE)&&(e=w.BASE);const n=e&&e._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=e&&b.get(e);r||(r=this.precomputeWindow(n),e&&1!==n&&(r=g.normalizeZ(r),b.set(e,r)));let i=g.ZERO,s=g.BASE;const a=1+(p?128/n:256/n),c=2**(n-1),u=BigInt(2**n-1),f=2**n,l=BigInt(n);for(let e=0;e<a;e++){const n=e*c;let a=Number(t&u);t>>=l,a>c&&(a-=f,t+=o);const h=n,p=n+Math.abs(a)-1,d=e%2!=0,y=a<0;0===a?s=s.add(m(d,r[h])):i=i.add(m(y,r[p]))}return{p:i,f:s}}multiply(t,e){let n,r,i=L(t);if(p){const{k1neg:t,k1:o,k2neg:s,k2:a}=l.splitScalar(i);let{p:c,f:u}=this.wNAF(o,e),{p:f,f:h}=this.wNAF(a,e);c=m(t,c),f=m(s,f),f=new g(N(f.x*l.beta),f.y,f.z),n=c.add(f),r=u.add(h)}else{const{p:t,f:o}=this.wNAF(i,e);n=t,r=o}return g.normalizeZ([n,r])[0]}toAffine(t){const{x:e,y:n,z:r}=this,i=this.equals(g.ZERO);null==t&&(t=i?c:P(r));const s=t,a=N(s*s),u=N(a*s),f=N(e*a),l=N(n*u),h=N(r*s);if(i)return w.ZERO;if(h!==o)throw new Error("invZ was invalid");return new w(f,l)}}function m(t,e){const n=e.negate();return t?n:e}g.BASE=new g(u.Gx,u.Gy,o),g.ZERO=new g(i,o,i);const b=new WeakMap;class w{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,b.delete(this)}hasEvenY(){return this.y%s===i}static fromCompressedHex(t){const e=32===t.length,n=I(e?t:t.subarray(1));if(!M(n))throw new Error("Point is not on curve");let r=function(t){const{P:e}=u,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),c=BigInt(44),f=BigInt(88),l=t*t*t%e,h=l*l*t%e,p=B(h,a)*h%e,d=B(p,a)*h%e,y=B(d,s)*l%e,g=B(y,r)*y%e,m=B(g,i)*g%e,b=B(m,c)*m%e,w=B(b,f)*b%e,v=B(w,c)*m%e,x=B(v,a)*h%e,E=B(x,o)*g%e,S=B(E,n)*l%e,A=B(S,s);if(A*A%e!==t)throw new Error("Cannot find square root");return A}(h(n));const i=(r&o)===o;e?i&&(r=N(-r)):!(1&~t[0])!==i&&(r=N(-r));const c=new w(n,r);return c.assertValidity(),c}static fromUncompressedHex(t){const e=I(t.subarray(1,33)),n=I(t.subarray(33,65)),r=new w(e,n);return r.assertValidity(),r}static fromHex(t){const e=U(t),n=e.length,r=e[0];if(32===n)return this.fromCompressedHex(e);if(33===n&&(2===r||3===r))return this.fromCompressedHex(e);if(65===n&&4===r)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${n}`)}static fromPrivateKey(t){return w.BASE.multiply(V(t))}static fromSignature(t,e,n){const{r,s:i}=G(e);if(![0,1,2,3].includes(n))throw new Error("Cannot recover: invalid recovery bit");const o=$(U(t)),{n:s}=u,a=2===n||3===n?r+s:r,c=P(a,s),f=N(-o*c,s),l=N(i*c,s),h=1&n?"03":"02",p=w.fromHex(h+O(a)),d=w.BASE.multiplyAndAddUnsafe(p,f,l);if(!d)throw new Error("Cannot recover signature: point at infinify");return d.assertValidity(),d}toRawBytes(t=!1){return C(this.toHex(t))}toHex(t=!1){const e=O(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${O(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:n}=this;if(!M(e)||!M(n))throw new Error(t);const r=N(n*n);if(N(r-h(e))!==i)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new w(this.x,N(-this.y))}double(){return g.fromAffine(this).double().toAffine()}add(t){return g.fromAffine(this).add(g.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return g.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,n){const r=g.fromAffine(this),s=e===i||e===o||this!==w.BASE?r.multiplyUnsafe(e):r.multiply(e),a=g.fromAffine(t).multiplyUnsafe(n),c=s.add(a);return c.equals(g.ZERO)?void 0:c.toAffine()}}function v(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function x(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${k(t)}`);const e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:I(n),left:t.subarray(e+2)}}e.Point=w,w.BASE=new w(u.Gx,u.Gy),w.ZERO=new w(i,i);class E{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,n="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${n}: Expected string or Uint8Array`);const r=e?k(t):t;if(128!==r.length)throw new Error(`${n}: Expected 64-byte hex`);return new E(F(r.slice(0,64)),F(r.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:n,s:r}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${k(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:n}=x(t.subarray(2)),{data:r,left:i}=x(n);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${k(i)}`);return{r:e,s:r}}(e?t:C(t));return new E(n,r)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!z(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!z(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=u.n>>o;return this.s>t}normalizeS(){return this.hasHighS()?new E(this.r,N(-this.s,u.n)):this}toDERRawBytes(){return C(this.toDERHex())}toDERHex(){const t=v(T(this.s)),e=v(T(this.r)),n=t.length/2,r=e.length/2,i=T(n),o=T(r);return`30${T(r+n+4)}02${o}${e}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return C(this.toCompactHex())}toCompactHex(){return O(this.r)+O(this.s)}}function S(...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.Signature=E;const A=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function k(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let n=0;n<t.length;n++)e+=A[t[n]];return e}const _=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function O(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(i<=t&&t<_))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function j(t){const e=C(O(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function T(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function F(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function C(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"+t.length);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 I(t){return F(k(t))}function U(t){return t instanceof Uint8Array?Uint8Array.from(t):C(t)}function L(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&z(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function N(t,e=u.P){const n=t%e;return n>=i?n:e+n}function B(t,e){const{P:n}=u;let r=t;for(;e-- >i;)r*=r,r%=n;return r}function P(t,e=u.P){if(t===i||e<=i)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=N(t,e),r=e,s=i,a=o,c=o,f=i;for(;n!==i;){const t=r/n,e=r%n,i=s-c*t,o=a-f*t;r=n,n=e,s=c,a=f,c=i,f=o}if(r!==o)throw new Error("invert: does not exist");return N(s,e)}function $(t,e=!1){const n=function(t){const e=8*t.length-256,n=I(t);return e>0?n>>BigInt(e):n}(t);if(e)return n;const{n:r}=u;return n>=r?n-r:n}let H,D;class R{constructor(t,e){if(this.hashLen=t,this.qByteLen=e,"number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}hmac(...t){return e.utils.hmacSha256(this.k,...t)}hmacSync(...t){return D(this.k,...t)}checkSync(){if("function"!=typeof D)throw new d("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=await this.hmac(this.v);const n=this.v.slice();e.push(n),t+=this.v.length}return S(...e)}generateSync(){this.checkSync(),this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=this.hmacSync(this.v);const n=this.v.slice();e.push(n),t+=this.v.length}return S(...e)}}function z(t){return i<t&&t<u.n}function M(t){return i<t&&t<u.P}function q(t,e,n,r=!0){const{n:s}=u,a=$(t,!0);if(!z(a))return;const c=P(a,s),f=w.BASE.multiply(a),l=N(f.x,s);if(l===i)return;const h=N(c*N(e+n*l,s),s);if(h===i)return;let p=new E(l,h),d=(f.x===p.r?0:2)|Number(f.y&o);return r&&p.hasHighS()&&(p=p.normalizeS(),d^=1),{sig:p,recovery:d}}function V(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=F(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=I(t)}if(!z(e))throw new Error("Expected private key: 0 < key < n");return e}function K(t){return t instanceof w?(t.assertValidity(),t):w.fromHex(t)}function G(t){if(t instanceof E)return t.assertValidity(),t;try{return E.fromDER(t)}catch(e){return E.fromCompact(t)}}function W(t){const e=t instanceof Uint8Array,n="string"==typeof t,r=(e||n)&&t.length;return e?33===r||65===r:n?66===r||130===r:t instanceof w}function J(t){return I(t.length>32?t.slice(0,32):t)}function Z(t){const e=J(t),n=N(e,u.n);return X(n<i?e:n)}function X(t){return j(t)}function Y(t,n,r){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const i=U(t),o=V(n),s=[X(o),Z(i)];if(null!=r){!0===r&&(r=e.utils.randomBytes(32));const t=U(r);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");s.push(t)}return{seed:S(...s),m:J(i),d:o}}function Q(t,e){const{sig:n,recovery:r}=t,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},e),s=i?n.toDERRawBytes():n.toCompactRawBytes();return o?[s,r]:s}e.getPublicKey=function(t,e=!1){return w.fromPrivateKey(t).toRawBytes(e)},e.recoverPublicKey=function(t,e,n,r=!1){return w.fromSignature(t,e,n).toRawBytes(r)},e.getSharedSecret=function(t,e,n=!1){if(W(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!W(e))throw new TypeError("getSharedSecret: second arg must be public key");const r=K(e);return r.assertValidity(),r.multiply(V(t)).toRawBytes(n)},e.sign=async function(t,e,n={}){const{seed:r,m:i,d:o}=Y(t,e,n.extraEntropy),s=new R(32,32);let a;for(await s.reseed(r);!(a=q(await s.generate(),i,o,n.canonical));)await s.reseed();return Q(a,n)},e.signSync=function(t,e,n={}){const{seed:r,m:i,d:o}=Y(t,e,n.extraEntropy),s=new R(32,32);let a;for(s.reseedSync(r);!(a=q(s.generateSync(),i,o,n.canonical));)s.reseedSync();return Q(a,n)};const tt={strict:!0};function et(t){return N(I(t),u.n)}e.verify=function(t,e,n,r=tt){let i;try{i=G(t),e=U(e)}catch(t){return!1}const{r:o,s}=i;if(r.strict&&i.hasHighS())return!1;const a=$(e);let c;try{c=K(n)}catch(t){return!1}const{n:f}=u,l=P(s,f),h=N(a*l,f),p=N(o*l,f),d=w.BASE.multiplyAndAddUnsafe(c,h,p);return!!d&&N(d.x,f)===o};class nt{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=U(t);if(64!==e.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${e.length}`);const n=I(e.subarray(0,32)),r=I(e.subarray(32,64));return new nt(n,r)}assertValidity(){const{r:t,s:e}=this;if(!M(t)||!z(e))throw new Error("Invalid signature")}toHex(){return O(this.r)+O(this.s)}toRawBytes(){return C(this.toHex())}}class rt{constructor(t,n,r=e.utils.randomBytes()){if(null==t)throw new TypeError(`sign: Expected valid message, not "${t}"`);this.m=U(t);const{x:i,scalar:o}=this.getScalar(V(n));if(this.px=i,this.d=o,this.rand=U(r),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(t){const e=w.fromPrivateKey(t),n=e.hasEvenY()?t:u.n-t;return{point:e,scalar:n,x:e.toRawX()}}initNonce(t,e){return j(t^I(e))}finalizeNonce(t){const e=N(I(t),u.n);if(e===i)throw new Error("sign: Creation of signature failed. k is zero");const{point:n,x:r,scalar:o}=this.getScalar(e);return{R:n,rx:r,k:o}}finalizeSig(t,e,n,r){return new nt(t.x,N(e+n*r,u.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}async calc(){const{m:t,d:n,px:r,rand:i}=this,o=e.utils.taggedHash,s=this.initNonce(n,await o(ut.aux,i)),{R:a,rx:c,k:u}=this.finalizeNonce(await o(ut.nonce,s,r,t)),f=et(await o(ut.challenge,c,r,t)),l=this.finalizeSig(a,u,f,n);return await st(l,t,r)||this.error(),l}calcSync(){const{m:t,d:n,px:r,rand:i}=this,o=e.utils.taggedHashSync,s=this.initNonce(n,o(ut.aux,i)),{R:a,rx:c,k:u}=this.finalizeNonce(o(ut.nonce,s,r,t)),f=et(o(ut.challenge,c,r,t)),l=this.finalizeSig(a,u,f,n);return at(l,t,r)||this.error(),l}}function it(t,e,n){const r=t instanceof nt,i=r?t:nt.fromHex(t);return r&&i.assertValidity(),{...i,m:U(e),P:K(n)}}function ot(t,e,n,r){const i=w.BASE.multiplyAndAddUnsafe(e,V(n),N(-r,u.n));return!(!i||!i.hasEvenY()||i.x!==t)}async function st(t,n,r){try{const{r:i,s:o,m:s,P:a}=it(t,n,r),c=et(await e.utils.taggedHash(ut.challenge,j(i),a.toRawX(),s));return ot(i,a,o,c)}catch(t){return!1}}function at(t,n,r){try{const{r:i,s:o,m:s,P:a}=it(t,n,r),c=et(e.utils.taggedHashSync(ut.challenge,j(i),a.toRawX(),s));return ot(i,a,o,c)}catch(t){if(t instanceof d)throw t;return!1}}e.schnorr={Signature:nt,getPublicKey:function(t){return w.fromPrivateKey(t).toRawX()},sign:async function(t,e,n){return new rt(t,e,n).calc()},verify:st,signSync:function(t,e,n){return new rt(t,e,n).calcSync()},verifySync:at},w.BASE._setWindowSize(8);const ct={node:r,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},ut={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},ft={};e.utils={bytesToHex:k,hexToBytes:C,concatBytes:S,mod:N,invert:P,isValidPrivateKey(t){try{return V(t),!0}catch(t){return!1}},_bigintTo32Bytes:j,_normalizePrivateKey:V,hashToPrivateKey:t=>{if((t=U(t)).length<40||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return j(N(I(t),u.n-o)+o)},randomBytes:(t=32)=>{if(ct.web)return ct.web.getRandomValues(new Uint8Array(t));if(ct.node){const{randomBytes:e}=ct.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>e.utils.hashToPrivateKey(e.utils.randomBytes(40)),precompute(t=8,e=w.BASE){const n=e===w.BASE?e:new w(e.x,e.y);return n._setWindowSize(t),n.multiply(a),n},sha256:async(...t)=>{if(ct.web){const e=await ct.web.subtle.digest("SHA-256",S(...t));return new Uint8Array(e)}if(ct.node){const{createHash:e}=ct.node,n=e("sha256");return t.forEach(t=>n.update(t)),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(ct.web){const n=await ct.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=S(...e),i=await ct.web.subtle.sign("HMAC",n,r);return new Uint8Array(i)}if(ct.node){const{createHmac:n}=ct.node,r=n("sha256",t);return e.forEach(t=>r.update(t)),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...n)=>{let r=ft[t];if(void 0===r){const n=await e.utils.sha256(Uint8Array.from(t,t=>t.charCodeAt(0)));r=S(n,n),ft[t]=r}return e.utils.sha256(r,...n)},taggedHashSync:(t,...e)=>{if("function"!=typeof H)throw new d("sha256Sync is undefined, you need to set it");let n=ft[t];if(void 0===n){const e=H(Uint8Array.from(t,t=>t.charCodeAt(0)));n=S(e,e),ft[t]=n}return H(n,...e)},_JacobianPoint:g},Object.defineProperties(e.utils,{sha256Sync:{configurable:!1,get:()=>H,set(t){H||(H=t)}},hmacSha256Sync:{configurable:!1,get:()=>D,set(t){D||(D=t)}}})},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]",f="[object Map]",l="[object Number]",h="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",m="[object Symbol]",b="[object WeakMap]",w="[object ArrayBuffer]",v="[object DataView]",x="[object Float32Array]",E="[object Float64Array]",S="[object Int8Array]",A="[object Int16Array]",k="[object Int32Array]",_="[object Uint8Array]",O="[object Uint8ClampedArray]",j="[object Uint16Array]",T="[object Uint32Array]",F=/\w*$/,C=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,U={};U[o]=U["[object Array]"]=U[w]=U[v]=U[s]=U[a]=U[x]=U[E]=U[S]=U[A]=U[k]=U[f]=U[l]=U[h]=U[d]=U[y]=U[g]=U[m]=U[_]=U[O]=U[j]=U[T]=!0,U["[object Error]"]=U[c]=U[b]=!1;var L="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,N="object"==typeof self&&self&&self.Object===Object&&self,B=L||N||Function("return this")(),P=e&&!e.nodeType&&e,$=P&&t&&!t.nodeType&&t,H=$&&$.exports===P;function D(t,e){return t.set(e[0],e[1]),t}function R(t,e){return t.add(e),t}function z(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 M(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function q(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function V(t,e){return function(n){return t(e(n))}}function K(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var G,W=Array.prototype,J=Function.prototype,Z=Object.prototype,X=B["__core-js_shared__"],Y=(G=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",Q=J.toString,tt=Z.hasOwnProperty,et=Z.toString,nt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=H?B.Buffer:void 0,it=B.Symbol,ot=B.Uint8Array,st=V(Object.getPrototypeOf,Object),at=Object.create,ct=Z.propertyIsEnumerable,ut=W.splice,ft=Object.getOwnPropertySymbols,lt=rt?rt.isBuffer:void 0,ht=V(Object.keys,Object),pt=Bt(B,"DataView"),dt=Bt(B,"Map"),yt=Bt(B,"Promise"),gt=Bt(B,"Set"),mt=Bt(B,"WeakMap"),bt=Bt(Object,"create"),wt=Rt(pt),vt=Rt(dt),xt=Rt(yt),Et=Rt(gt),St=Rt(mt),At=it?it.prototype:void 0,kt=At?At.valueOf:void 0;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 Ot(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 jt(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){this.__data__=new Ot(t)}function Ft(t,e,n){var r=t[e];tt.call(t,e)&&zt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ct(t,e){for(var n=t.length;n--;)if(zt(t[n][0],e))return n;return-1}function It(t,e,n,r,i,p,b){var C;if(r&&(C=p?r(t,i,p,b):r(t)),void 0!==C)return C;if(!Gt(t))return t;var I=Mt(t);if(I){if(C=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,C)}else{var L=$t(t),N=L==c||L==u;if(Vt(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(L==h||L==o||N&&!p){if(M(t))return p?t:{};if(C=function(t){return"function"!=typeof t.constructor||Dt(t)?{}:Gt(e=st(t))?at(e):{};var e}(N?{}:t),!e)return function(t,e){return Lt(t,Pt(t),e)}(t,function(t,e){return t&&Lt(e,Wt(e),t)}(C,t))}else{if(!U[L])return p?t:{};C=function(t,e,n,r){var i,o=t.constructor;switch(e){case w:return Ut(t);case s:case a:return new o(+t);case v:return function(t,e){var n=e?Ut(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case x:case E:case S:case A:case k:case _:case O:case j:case T:return function(t,e){var n=e?Ut(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case f:return function(t,e,n){return z(e?n(q(t),!0):q(t),D,new t.constructor)}(t,r,n);case l:case g:return new o(t);case d:return function(t){var e=new t.constructor(t.source,F.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,n){return z(e?n(K(t),!0):K(t),R,new t.constructor)}(t,r,n);case m:return i=t,kt?Object(kt.call(i)):{}}}(t,L,It,e)}}b||(b=new Tt);var B=b.get(t);if(B)return B;if(b.set(t,C),!I)var P=n?function(t){return function(t,e,n){var r=e(t);return Mt(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,Wt,Pt)}(t):Wt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}(P||t,function(i,o){P&&(i=t[o=i]),Ft(C,o,It(i,e,n,r,o,t,b))}),C}function Ut(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Lt(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;Ft(n,s,void 0===a?t[s]:a)}return n}function Nt(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 Bt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Gt(t)||(e=t,Y&&Y in e))&&(Kt(t)||M(t)?nt:C).test(Rt(t));var e}(n)?n:void 0}_t.prototype.clear=function(){this.__data__=bt?bt(null):{}},_t.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},_t.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},_t.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:tt.call(e,t)},_t.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?r:e,this},Ot.prototype.clear=function(){this.__data__=[]},Ot.prototype.delete=function(t){var e=this.__data__,n=Ct(e,t);return!(n<0||(n==e.length-1?e.pop():ut.call(e,n,1),0))},Ot.prototype.get=function(t){var e=this.__data__,n=Ct(e,t);return n<0?void 0:e[n][1]},Ot.prototype.has=function(t){return Ct(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var n=this.__data__,r=Ct(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},jt.prototype.clear=function(){this.__data__={hash:new _t,map:new(dt||Ot),string:new _t}},jt.prototype.delete=function(t){return Nt(this,t).delete(t)},jt.prototype.get=function(t){return Nt(this,t).get(t)},jt.prototype.has=function(t){return Nt(this,t).has(t)},jt.prototype.set=function(t,e){return Nt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new Ot},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ot){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new jt(r)}return n.set(t,e),this};var Pt=ft?V(ft,Object):function(){return[]},$t=function(t){return et.call(t)};function Ht(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||I.test(t))&&t>-1&&t%1==0&&t<e}function Dt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Z)}function Rt(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function zt(t,e){return t===e||t!=t&&e!=e}(pt&&$t(new pt(new ArrayBuffer(1)))!=v||dt&&$t(new dt)!=f||yt&&$t(yt.resolve())!=p||gt&&$t(new gt)!=y||mt&&$t(new mt)!=b)&&($t=function(t){var e=et.call(t),n=e==h?t.constructor:void 0,r=n?Rt(n):void 0;if(r)switch(r){case wt:return v;case vt:return f;case xt:return p;case Et:return y;case St:return b}return e});var Mt=Array.isArray;function qt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Kt(t)}var Vt=lt||function(){return!1};function Kt(t){var e=Gt(t)?et.call(t):"";return e==c||e==u}function Gt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return qt(t)?function(t,e){var n=Mt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&qt(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||Ht(s,r))||n.push(s);return n}(t):function(t){if(!Dt(t))return ht(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 It(t,!0,!0)}},402:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenVerifier=void 0;const r=n(886),i=n(546),o=n(87),s=n(211);e.TokenVerifier=class{constructor(t,e){if(!t||!e)throw new o.MissingParametersError("a signing algorithm and public key are required");if("string"!=typeof t)throw"signing algorithm parameter must be a string";if(t=t.toUpperCase(),!i.cryptoClients.hasOwnProperty(t))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=i.cryptoClients[t],this.rawPublicKey=e}verify(t){return"string"==typeof t?this.verifyCompact(t,!1):"object"==typeof t&&this.verifyExpanded(t,!1)}verifyAsync(t){return"string"==typeof t?this.verifyCompact(t,!0):"object"==typeof t?this.verifyExpanded(t,!0):Promise.resolve(!1)}verifyCompact(t,e){const n=t.split("."),r=n[0]+"."+n[1],i=t=>{const e=this.cryptoClient.loadSignature(n[2]);return this.cryptoClient.verifyHash(t,e,this.rawPublicKey)};if(e)return(0,s.hashSha256Async)(r).then(t=>i(t));{const t=(0,s.hashSha256)(r);return i(t)}}verifyExpanded(t,e){const n=[t.header.join("."),r.encode(t.payload)].join(".");let i=!0;const o=e=>(t.signature.map(t=>{const n=this.cryptoClient.loadSignature(t);this.cryptoClient.verifyHash(e,n,this.rawPublicKey)||(i=!1)}),i);if(e)return(0,s.hashSha256Async)(n).then(t=>o(t));{const t=(0,s.hashSha256)(n);return o(t)}}}},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 f(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 f=t.charCodeAt(n);if(f>255)return;var l=e[f];if(255===l)return;for(var h=0,p=o-1;(0!==l||h<i)&&-1!==p;p--,h++)l+=s*u[p]>>>0,u[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var d=o-i;d!==o&&0===u[d];)d++;for(var y=new Uint8Array(r+(o-d)),g=r;d!==o;)y[g++]=u[d++];return y}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,f=new Uint8Array(c);i!==o;){for(var l=e[i],h=0,p=c-1;(0!==l||h<r)&&-1!==p;p--,h++)l+=256*f[p]>>>0,f[p]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");r=h,i++}for(var d=c-r;d!==c&&0===f[d];)d++;for(var y=a.repeat(n);d<c;++d)y+=t.charAt(f[d]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},410:(t,e,n)=>{"use strict";t.exports=n(118)},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}}},418:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.TokenSigner=e.createUnsecuredToken=void 0;const i=n(886),o=n(546),s=n(87),a=n(211);function c(t,e){const n=[],r=i.encode(JSON.stringify(e));n.push(r);const o=i.encode(JSON.stringify(t));return n.push(o),n.join(".")}e.createUnsecuredToken=function(t){return c(t,{typ:"JWT",alg:"none"})+"."},e.TokenSigner=class{constructor(t,e){if(!t||!e)throw new s.MissingParametersError("a signing algorithm and private key are required");if("string"!=typeof t)throw new Error("signing algorithm parameter must be a string");if(t=t.toUpperCase(),!o.cryptoClients.hasOwnProperty(t))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=o.cryptoClients[t],this.rawPrivateKey=e}header(t={}){const e={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},e,t)}sign(t,e=!1,n={}){const r=this.header(n),i=c(t,r),o=(0,a.hashSha256)(i);return this.createWithSignedHash(t,e,r,i,o)}signAsync(t,e=!1,n={}){return r(this,void 0,void 0,function*(){const r=this.header(n),i=c(t,r),o=yield(0,a.hashSha256Async)(i);return this.createWithSignedHash(t,e,r,i,o)})}createWithSignedHash(t,e,n,r,o){const s=this.cryptoClient.signHash(o,this.rawPrivateKey);return e?{header:[i.encode(JSON.stringify(n))],payload:JSON.stringify(t),signature:[s]}:[r,s].join(".")}}},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},500:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=void 0;const r=n(460),i=n(74);class o extends i.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,r.default.hash(t);const n=(0,i.toBytes)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=t.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),s.fill(0)}update(t){return r.default.exists(this),this.iHash.update(t),this}digestInto(t){r.default.exists(this),r.default.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=r,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.hmac=(t,e,n)=>new o(t,e).update(n).digest(),e.hmac.create=(t,e)=>new o(t,e)},546:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cryptoClients=e.SECP256K1Client=void 0;const r=n(70);Object.defineProperty(e,"SECP256K1Client",{enumerable:!0,get:function(){return r.SECP256K1Client}});const i={ES256K:r.SECP256K1Client};e.cryptoClients=i},574:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeToken=void 0;const r=n(886);e.decodeToken=function(t){if("string"==typeof t){const e=t.split(".");return{header:JSON.parse(r.decode(e[0])),payload:JSON.parse(r.decode(e[1])),signature:e[2]}}if("object"==typeof t){if("string"!=typeof t.payload)throw new Error("Expected token payload to be a base64 or json string");let e=t.payload;"{"!==t.payload[0]&&(e=r.decode(e));const n=[];return t.header.map(t=>{const e=JSON.parse(r.decode(t));n.push(e)}),{header:n,payload:JSON.parse(e),signature:t.signature}}}},599:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.joseToDer=e.derToJose=void 0;const r=n(991),i=n(886);function o(t){return(t/8|0)+(t%8==0?0:1)}const s={ES256:o(256),ES384:o(384),ES512:o(521)};function a(t){const e=s[t];if(e)return e;throw new Error(`Unknown algorithm "${t}"`)}function c(t){if(t instanceof Uint8Array)return t;if("string"==typeof t)return(0,r.toByteArray)((0,i.pad)(t));throw new TypeError("ECDSA signature must be a Base64 string or a Uint8Array")}function u(t,e,n){let r=0;for(;e+r<n&&0===t[e+r];)++r;return t[e+r]>=128&&--r,r}e.derToJose=function(t,e){const n=c(t),o=a(e),s=o+1,u=n.length;let f=0;if(48!==n[f++])throw new Error('Could not find expected "seq"');let l=n[f++];if(129===l&&(l=n[f++]),u-f<l)throw new Error(`"seq" specified length of "${l}", only "${u-f}" remaining`);if(2!==n[f++])throw new Error('Could not find expected "int" for "r"');const h=n[f++];if(u-f-2<h)throw new Error(`"r" specified length of "${h}", only "${u-f-2}" available`);if(s<h)throw new Error(`"r" specified length of "${h}", max of "${s}" is acceptable`);const p=f;if(f+=h,2!==n[f++])throw new Error('Could not find expected "int" for "s"');const d=n[f++];if(u-f!==d)throw new Error(`"s" specified length of "${d}", expected "${u-f}"`);if(s<d)throw new Error(`"s" specified length of "${d}", max of "${s}" is acceptable`);const y=f;if(f+=d,f!==u)throw new Error(`Expected to consume entire array, but "${u-f}" bytes remain`);const g=o-h,m=o-d,b=new Uint8Array(g+h+m+d);for(f=0;f<g;++f)b[f]=0;b.set(n.subarray(p+Math.max(-g,0),p+h),f),f=o;for(const t=f;f<t+m;++f)b[f]=0;return b.set(n.subarray(y+Math.max(-m,0),y+d),f),(0,i.escape)((0,r.fromByteArray)(b))},e.joseToDer=function(t,e){t=c(t);const n=a(e),r=t.length;if(r!==2*n)throw new TypeError(`"${e}" signatures must be "${2*n}" bytes, saw "${r}"`);const i=u(t,0,n),o=u(t,n,t.length),s=n-i,f=n-o,l=2+s+1+1+f,h=l<128,p=new Uint8Array((h?2:3)+l);let d=0;return p[d++]=48,h?p[d++]=l:(p[d++]=129,p[d++]=255&l),p[d++]=2,p[d++]=s,i<0?(p[d++]=0,p.set(t.subarray(0,n),d),d+=n):(p.set(t.subarray(i,n),d),d+=n-i),p[d++]=2,p[d++]=f,o<0?(p[d++]=0,p.set(t.subarray(n),d)):p.set(t.subarray(n+o),d),p}},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)]}},668:function(t,e,n){t=n.nmd(t);var r=n(907);!function(e){"use strict";function i(t,e){e|=0;for(var n=Math.max(t.length-e,0),r=Array(n),i=0;i<n;i++)r[i]=t[e+i];return r}var o=function(t){var e=i(arguments,1);return function(){var n=i(arguments);return t.apply(null,e.concat(n))}},s=function(t){return function(){var e=i(arguments),n=e.pop();t.call(this,e,n)}};function a(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var c="function"==typeof setImmediate&&setImmediate,u="object"==typeof r&&"function"==typeof r.nextTick;function f(t){setTimeout(t,0)}function l(t){return function(e){var n=i(arguments,1);t(function(){e.apply(null,n)})}}var h=l(c?setImmediate:u?r.nextTick:f);function p(t){return s(function(e,n){var r;try{r=t.apply(this,e)}catch(t){return n(t)}a(r)&&"function"==typeof r.then?r.then(function(t){d(n,null,t)},function(t){d(n,t.message?t:new Error(t))}):n(null,r)})}function d(t,e,n){try{t(e,n)}catch(t){h(y,t)}}function y(t){throw t}var g="function"==typeof Symbol;function m(t){return g&&"AsyncFunction"===t[Symbol.toStringTag]}function b(t){return m(t)?p(t):t}function w(t){return function(e){var n=i(arguments,1),r=s(function(n,r){var i=this;return t(e,function(t,e){b(t).apply(i,n.concat(e))},r)});return n.length?r.apply(this,n):r}}var v="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,x="object"==typeof self&&self&&self.Object===Object&&self,E=v||x||Function("return this")(),S=E.Symbol,A=Object.prototype,k=A.hasOwnProperty,_=A.toString,O=S?S.toStringTag:void 0;var j=Object.prototype.toString;var T=S?S.toStringTag:void 0;function F(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":T&&T in Object(t)?function(t){var e=k.call(t,O),n=t[O];try{t[O]=void 0;var r=!0}catch(t){}var i=_.call(t);return r&&(e?t[O]=n:delete t[O]),i}(t):function(t){return j.call(t)}(t)}function C(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function I(t){return null!=t&&C(t.length)&&!function(t){if(!a(t))return!1;var e=F(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)}var U={};function L(){}function N(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var B="function"==typeof Symbol&&Symbol.iterator;function P(t){return null!=t&&"object"==typeof t}function $(t){return P(t)&&"[object Arguments]"==F(t)}var H=Object.prototype,D=H.hasOwnProperty,R=H.propertyIsEnumerable,z=$(function(){return arguments}())?$:function(t){return P(t)&&D.call(t,"callee")&&!R.call(t,"callee")},M=Array.isArray;var q="object"==typeof e&&e&&!e.nodeType&&e,V=q&&t&&!t.nodeType&&t,K=V&&V.exports===q?E.Buffer:void 0,G=(K?K.isBuffer:void 0)||function(){return!1},W=/^(?:0|[1-9]\d*)$/;function J(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&W.test(t))&&t>-1&&t%1==0&&t<e}var Z={};Z["[object Float32Array]"]=Z["[object Float64Array]"]=Z["[object Int8Array]"]=Z["[object Int16Array]"]=Z["[object Int32Array]"]=Z["[object Uint8Array]"]=Z["[object Uint8ClampedArray]"]=Z["[object Uint16Array]"]=Z["[object Uint32Array]"]=!0,Z["[object Arguments]"]=Z["[object Array]"]=Z["[object ArrayBuffer]"]=Z["[object Boolean]"]=Z["[object DataView]"]=Z["[object Date]"]=Z["[object Error]"]=Z["[object Function]"]=Z["[object Map]"]=Z["[object Number]"]=Z["[object Object]"]=Z["[object RegExp]"]=Z["[object Set]"]=Z["[object String]"]=Z["[object WeakMap]"]=!1;var X,Y="object"==typeof e&&e&&!e.nodeType&&e,Q=Y&&t&&!t.nodeType&&t,tt=Q&&Q.exports===Y&&v.process,et=function(){try{return Q&&Q.require&&Q.require("util").types||tt&&tt.binding&&tt.binding("util")}catch(t){}}(),nt=et&&et.isTypedArray,rt=nt?(X=nt,function(t){return X(t)}):function(t){return P(t)&&C(t.length)&&!!Z[F(t)]},it=Object.prototype.hasOwnProperty;function ot(t,e){var n=M(t),r=!n&&z(t),i=!n&&!r&&G(t),o=!n&&!r&&!i&&rt(t),s=n||r||i||o,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!it.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||J(u,c))||a.push(u);return a}var st=Object.prototype;var at=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),ct=Object.prototype.hasOwnProperty;function ut(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||st))return at(t);var e,n,r=[];for(var i in Object(t))ct.call(t,i)&&"constructor"!=i&&r.push(i);return r}function ft(t){return I(t)?ot(t):ut(t)}function lt(t){if(I(t))return function(t){var e=-1,n=t.length;return function(){return++e<n?{value:t[e],key:e}:null}}(t);var e,n,r,i,o=function(t){return B&&t[B]&&t[B]()}(t);return o?function(t){var e=-1;return function(){var n=t.next();return n.done?null:(e++,{value:n.value,key:e})}}(o):(n=ft(e=t),r=-1,i=n.length,function t(){var o=n[++r];return"__proto__"===o?t():r<i?{value:e[o],key:o}:null})}function ht(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function pt(t){return function(e,n,r){if(r=N(r||L),t<=0||!e)return r(null);var i=lt(e),o=!1,s=0,a=!1;function c(t,e){if(s-=1,t)o=!0,r(t);else{if(e===U||o&&s<=0)return o=!0,r(null);a||u()}}function u(){for(a=!0;s<t&&!o;){var e=i();if(null===e)return o=!0,void(s<=0&&r(null));s+=1,n(e.value,e.key,ht(c))}a=!1}u()}}function dt(t,e,n,r){pt(e)(t,b(n),r)}function yt(t,e){return function(n,r,i){return t(n,e,r,i)}}function gt(t,e,n){n=N(n||L);var r=0,i=0,o=t.length;function s(t,e){t?n(t):++i!==o&&e!==U||n(null)}for(0===o&&n(null);r<o;r++)e(t[r],r,ht(s))}var mt=yt(dt,1/0),bt=function(t,e,n){(I(t)?gt:mt)(t,b(e),n)};function wt(t){return function(e,n,r){return t(bt,e,b(n),r)}}function vt(t,e,n,r){r=r||L,e=e||[];var i=[],o=0,s=b(n);t(e,function(t,e,n){var r=o++;s(t,function(t,e){i[r]=e,n(t)})},function(t){r(t,i)})}var xt=wt(vt),Et=w(xt);function St(t){return function(e,n,r,i){return t(pt(n),e,b(r),i)}}var At=St(vt),kt=yt(At,1),_t=w(kt);function Ot(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}var jt,Tt=function(t,e,n){for(var r=-1,i=Object(t),o=n(t),s=o.length;s--;){var a=o[jt?s:++r];if(!1===e(i[a],a,i))break}return t};function Ft(t,e){return t&&Tt(t,e,ft)}function Ct(t){return t!=t}function It(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,Ct,n)}var Ut=function(t,e,n){"function"==typeof e&&(n=e,e=null),n=N(n||L);var r=ft(t).length;if(!r)return n(null);e||(e=r);var o={},s=0,a=!1,c=Object.create(null),u=[],f=[],l={};function h(t,e){u.push(function(){!function(t,e){if(!a){var r=ht(function(e,r){if(s--,arguments.length>2&&(r=i(arguments,1)),e){var u={};Ft(o,function(t,e){u[e]=t}),u[t]=r,a=!0,c=Object.create(null),n(e,u)}else o[t]=r,Ot(c[t]||[],function(t){t()}),p()});s++;var u=b(e[e.length-1]);e.length>1?u(o,r):u(r)}}(t,e)})}function p(){if(0===u.length&&0===s)return n(null,o);for(;u.length&&s<e;)u.shift()()}function d(e){var n=[];return Ft(t,function(t,r){M(t)&&It(t,e,0)>=0&&n.push(r)}),n}Ft(t,function(e,n){if(!M(e))return h(n,[e]),void f.push(n);var r=e.slice(0,e.length-1),i=r.length;if(0===i)return h(n,e),void f.push(n);l[n]=i,Ot(r,function(o){if(!t[o])throw new Error("async.auto task `"+n+"` has a non-existent dependency `"+o+"` in "+r.join(", "));var s,a,u;a=function(){0===--i&&h(n,e)},(u=c[s=o])||(u=c[s]=[]),u.push(a)})}),function(){for(var t=0;f.length;)t++,Ot(d(f.pop()),function(t){0===--l[t]&&f.push(t)});if(t!==r)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),p()};function Lt(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var Nt=S?S.prototype:void 0,Bt=Nt?Nt.toString:void 0;function Pt(t){if("string"==typeof t)return t;if(M(t))return Lt(t,Pt)+"";if(function(t){return"symbol"==typeof t||P(t)&&"[object Symbol]"==F(t)}(t))return Bt?Bt.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function $t(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:function(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}(t,e,n)}var Ht=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Dt="\\ud800-\\udfff",Rt="["+Dt+"]",zt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Mt="\\ud83c[\\udffb-\\udfff]",qt="[^"+Dt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",Gt="(?:"+zt+"|"+Mt+")?",Wt="[\\ufe0e\\ufe0f]?",Jt=Wt+Gt+("(?:\\u200d(?:"+[qt,Vt,Kt].join("|")+")"+Wt+Gt+")*"),Zt="(?:"+[qt+zt+"?",zt,Vt,Kt,Rt].join("|")+")",Xt=RegExp(Mt+"(?="+Mt+")|"+Zt+Jt,"g");function Yt(t){return function(t){return Ht.test(t)}(t)?function(t){return t.match(Xt)||[]}(t):function(t){return t.split("")}(t)}var Qt=/^\s+|\s+$/g;function te(t,e,n){if((t=null==(r=t)?"":Pt(r))&&(n||void 0===e))return t.replace(Qt,"");var r;if(!t||!(e=Pt(e)))return t;var i=Yt(t),o=Yt(e);return $t(i,function(t,e){for(var n=-1,r=t.length;++n<r&&It(e,t[n],0)>-1;);return n}(i,o),function(t,e){for(var n=t.length;n--&&It(e,t[n],0)>-1;);return n}(i,o)+1).join("")}var ee=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ne=/,/,re=/(=.+)?(\s*)$/,ie=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function oe(t,e){var n={};Ft(t,function(t,e){var r,i=m(t),o=!i&&1===t.length||i&&0===t.length;if(M(t))r=t.slice(0,-1),t=t[t.length-1],n[e]=r.concat(r.length>0?s:t);else if(o)n[e]=t;else{if(r=function(t){return(t=(t=(t=t.toString().replace(ie,"")).match(ee)[2].replace(" ",""))?t.split(ne):[]).map(function(t){return te(t.replace(re,""))})}(t),0===t.length&&!i&&0===r.length)throw new Error("autoInject task functions require explicit parameters.");i||r.pop(),n[e]=r.concat(s)}function s(e,n){var i=Lt(r,function(t){return e[t]});i.push(n),b(t).apply(null,i)}}),Ut(n,e)}function se(){this.head=this.tail=null,this.length=0}function ae(t,e){t.length=1,t.head=t.tail=e}function ce(t,e,n){if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var r=b(t),i=0,o=[],s=!1;function a(t,e,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(f.started=!0,M(t)||(t=[t]),0===t.length&&f.idle())return h(function(){f.drain()});for(var r=0,i=t.length;r<i;r++){var o={data:t[r],callback:n||L};e?f._tasks.unshift(o):f._tasks.push(o)}s||(s=!0,h(function(){s=!1,f.process()}))}function c(t){return function(e){i-=1;for(var n=0,r=t.length;n<r;n++){var s=t[n],a=It(o,s,0);0===a?o.shift():a>0&&o.splice(a,1),s.callback.apply(s,arguments),null!=e&&f.error(e,s.data)}i<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}var u=!1,f={_tasks:new se,concurrency:e,payload:n,saturated:L,unsaturated:L,buffer:e/4,empty:L,drain:L,error:L,started:!1,paused:!1,push:function(t,e){a(t,!1,e)},kill:function(){f.drain=L,f._tasks.empty()},unshift:function(t,e){a(t,!0,e)},remove:function(t){f._tasks.remove(t)},process:function(){if(!u){for(u=!0;!f.paused&&i<f.concurrency&&f._tasks.length;){var t=[],e=[],n=f._tasks.length;f.payload&&(n=Math.min(n,f.payload));for(var s=0;s<n;s++){var a=f._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===f._tasks.length&&f.empty(),i===f.concurrency&&f.saturated();var l=ht(c(t));r(e,l)}u=!1}},length:function(){return f._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return f._tasks.length+i===0},pause:function(){f.paused=!0},resume:function(){!1!==f.paused&&(f.paused=!1,h(f.process))}};return f}function ue(t,e){return ce(t,1,e)}se.prototype.removeLink=function(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t},se.prototype.empty=function(){for(;this.head;)this.shift();return this},se.prototype.insertAfter=function(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1},se.prototype.insertBefore=function(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1},se.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):ae(this,t)},se.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):ae(this,t)},se.prototype.shift=function(){return this.head&&this.removeLink(this.head)},se.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},se.prototype.toArray=function(){for(var t=Array(this.length),e=this.head,n=0;n<this.length;n++)t[n]=e.data,e=e.next;return t},se.prototype.remove=function(t){for(var e=this.head;e;){var n=e.next;t(e)&&this.removeLink(e),e=n}return this};var fe=yt(dt,1);function le(t,e,n,r){r=N(r||L);var i=b(n);fe(t,function(t,n,r){i(e,t,function(t,n){e=n,r(t)})},function(t){r(t,e)})}function he(){var t=Lt(arguments,b);return function(){var e=i(arguments),n=this,r=e[e.length-1];"function"==typeof r?e.pop():r=L,le(t,e,function(t,e,r){e.apply(n,t.concat(function(t){var e=i(arguments,1);r(t,e)}))},function(t,e){r.apply(n,[t].concat(e))})}}var pe=function(){return he.apply(null,i(arguments).reverse())},de=Array.prototype.concat,ye=function(t,e,n,r){r=r||L;var o=b(n);At(t,e,function(t,e){o(t,function(t){return t?e(t):e(null,i(arguments,1))})},function(t,e){for(var n=[],i=0;i<e.length;i++)e[i]&&(n=de.apply(n,e[i]));return r(t,n)})},ge=yt(ye,1/0),me=yt(ye,1),be=function(){var t=i(arguments),e=[null].concat(t);return function(){return arguments[arguments.length-1].apply(this,e)}};function we(t){return t}function ve(t,e){return function(n,r,i,o){o=o||L;var s,a=!1;n(r,function(n,r,o){i(n,function(r,i){r?o(r):t(i)&&!s?(a=!0,s=e(!0,n),o(null,U)):o()})},function(t){t?o(t):o(null,a?s:e(!1))})}}function xe(t,e){return e}var Ee=wt(ve(we,xe)),Se=St(ve(we,xe)),Ae=yt(Se,1);function ke(t){return function(e){var n=i(arguments,1);n.push(function(e){var n=i(arguments,1);"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&Ot(n,function(e){console[t](e)}))}),b(e).apply(null,n)}}var _e=ke("dir");function Oe(t,e,n){n=ht(n||L);var r=b(t),o=b(e);function s(t){if(t)return n(t);var e=i(arguments,1);e.push(a),o.apply(this,e)}function a(t,e){return t?n(t):e?void r(s):n(null)}a(null,!0)}function je(t,e,n){n=ht(n||L);var r=b(t),o=function(t){if(t)return n(t);var s=i(arguments,1);if(e.apply(this,s))return r(o);n.apply(null,[null].concat(s))};r(o)}function Te(t,e,n){je(t,function(){return!e.apply(this,arguments)},n)}function Fe(t,e,n){n=ht(n||L);var r=b(e),i=b(t);function o(t){if(t)return n(t);i(s)}function s(t,e){return t?n(t):e?void r(o):n(null)}i(s)}function Ce(t){return function(e,n,r){return t(e,r)}}function Ie(t,e,n){bt(t,Ce(b(e)),n)}function Ue(t,e,n,r){pt(e)(t,Ce(b(n)),r)}var Le=yt(Ue,1);function Ne(t){return m(t)?t:s(function(e,n){var r=!0;e.push(function(){var t=arguments;r?h(function(){n.apply(null,t)}):n.apply(null,t)}),t.apply(this,e),r=!1})}function Be(t){return!t}var Pe=wt(ve(Be,Be)),$e=St(ve(Be,Be)),He=yt($e,1);function De(t){return function(e){return null==e?void 0:e[t]}}function Re(t,e,n,r){var i=new Array(e.length);t(e,function(t,e,r){n(t,function(t,n){i[e]=!!n,r(t)})},function(t){if(t)return r(t);for(var n=[],o=0;o<e.length;o++)i[o]&&n.push(e[o]);r(null,n)})}function ze(t,e,n,r){var i=[];t(e,function(t,e,r){n(t,function(n,o){n?r(n):(o&&i.push({index:e,value:t}),r())})},function(t){t?r(t):r(null,Lt(i.sort(function(t,e){return t.index-e.index}),De("value")))})}function Me(t,e,n,r){(I(e)?Re:ze)(t,e,b(n),r||L)}var qe=wt(Me),Ve=St(Me),Ke=yt(Ve,1);function Ge(t,e){var n=ht(e||L),r=b(Ne(t));!function t(e){if(e)return n(e);r(t)}()}var We=function(t,e,n,r){r=r||L;var i=b(n);At(t,e,function(t,e){i(t,function(n,r){return n?e(n):e(null,{key:r,val:t})})},function(t,e){for(var n={},i=Object.prototype.hasOwnProperty,o=0;o<e.length;o++)if(e[o]){var s=e[o].key,a=e[o].val;i.call(n,s)?n[s].push(a):n[s]=[a]}return r(t,n)})},Je=yt(We,1/0),Ze=yt(We,1),Xe=ke("log");function Ye(t,e,n,r){r=N(r||L);var i={},o=b(n);dt(t,e,function(t,e,n){o(t,e,function(t,r){if(t)return n(t);i[e]=r,n()})},function(t){r(t,i)})}var Qe=yt(Ye,1/0),tn=yt(Ye,1);function en(t,e){return e in t}function nn(t,e){var n=Object.create(null),r=Object.create(null);e=e||we;var o=b(t),a=s(function(t,s){var a=e.apply(null,t);en(n,a)?h(function(){s.apply(null,n[a])}):en(r,a)?r[a].push(s):(r[a]=[s],o.apply(null,t.concat(function(){var t=i(arguments);n[a]=t;var e=r[a];delete r[a];for(var o=0,s=e.length;o<s;o++)e[o].apply(null,t)})))});return a.memo=n,a.unmemoized=t,a}var rn=l(u?r.nextTick:c?setImmediate:f);function on(t,e,n){n=n||L;var r=I(e)?[]:{};t(e,function(t,e,n){b(t)(function(t,o){arguments.length>2&&(o=i(arguments,1)),r[e]=o,n(t)})},function(t){n(t,r)})}function sn(t,e){on(bt,t,e)}function an(t,e,n){on(pt(e),t,n)}var cn=function(t,e){var n=b(t);return ce(function(t,e){n(t[0],e)},e,1)},un=function(t,e){var n=cn(t,e);return n.push=function(t,e,r){if(null==r&&(r=L),"function"!=typeof r)throw new Error("task callback must be a function");if(n.started=!0,M(t)||(t=[t]),0===t.length)return h(function(){n.drain()});e=e||0;for(var i=n._tasks.head;i&&e>=i.priority;)i=i.next;for(var o=0,s=t.length;o<s;o++){var a={data:t[o],priority:e,callback:r};i?n._tasks.insertBefore(i,a):n._tasks.push(a)}h(n.process)},delete n.unshift,n};function fn(t,e){if(e=N(e||L),!M(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var n=0,r=t.length;n<r;n++)b(t[n])(e)}function ln(t,e,n,r){le(i(t).reverse(),e,n,r)}function hn(t){var e=b(t);return s(function(t,n){return t.push(function(t,e){var r;t?n(null,{error:t}):(r=arguments.length<=2?e:i(arguments,1),n(null,{value:r}))}),e.apply(this,t)})}function pn(t){var e;return M(t)?e=Lt(t,hn):(e={},Ft(t,function(t,n){e[n]=hn.call(this,t)})),e}function dn(t,e,n,r){Me(t,e,function(t,e){n(t,function(t,n){e(t,!n)})},r)}var yn=wt(dn),gn=St(dn),mn=yt(gn,1);function bn(t){return function(){return t}}function wn(t,e,n){var r={times:5,intervalFunc:bn(0)};if(arguments.length<3&&"function"==typeof t?(n=e||L,e=t):(function(t,e){if("object"==typeof e)t.times=+e.times||5,t.intervalFunc="function"==typeof e.interval?e.interval:bn(+e.interval||0),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||5}}(r,t),n=n||L),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var i=b(e),o=1;!function t(){i(function(e){e&&o++<r.times&&("function"!=typeof r.errorFilter||r.errorFilter(e))?setTimeout(t,r.intervalFunc(o)):n.apply(null,arguments)})}()}var vn=function(t,e){e||(e=t,t=null);var n=b(e);return s(function(e,r){function i(t){n.apply(null,e.concat(t))}t?wn(t,i,r):wn(i,r)})};function xn(t,e){on(fe,t,e)}var En=wt(ve(Boolean,we)),Sn=St(ve(Boolean,we)),An=yt(Sn,1);function kn(t,e,n){var r=b(e);function i(t,e){var n=t.criteria,r=e.criteria;return n<r?-1:n>r?1:0}xt(t,function(t,e){r(t,function(n,r){if(n)return e(n);e(null,{value:t,criteria:r})})},function(t,e){if(t)return n(t);n(null,Lt(e.sort(i),De("value")))})}function _n(t,e,n){var r=b(t);return s(function(i,o){var s,a=!1;i.push(function(){a||(o.apply(null,arguments),clearTimeout(s))}),s=setTimeout(function(){var e=t.name||"anonymous",r=new Error('Callback function "'+e+'" timed out.');r.code="ETIMEDOUT",n&&(r.info=n),a=!0,o(r)},e),r.apply(null,i)})}var On=Math.ceil,jn=Math.max;function Tn(t,e,n,r){var i=b(n);At(function(t,e,n,r){for(var i=-1,o=jn(On((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}(0,t,1),e,i,r)}var Fn=yt(Tn,1/0),Cn=yt(Tn,1);function In(t,e,n,r){arguments.length<=3&&(r=n,n=e,e=M(t)?[]:{}),r=N(r||L);var i=b(n);bt(t,function(t,n,r){i(e,t,n,r)},function(t){r(t,e)})}function Un(t,e){var n,r=null;e=e||L,Le(t,function(t,e){b(t)(function(t,o){n=arguments.length>2?i(arguments,1):o,r=t,e(!t)})},function(){e(r,n)})}function Ln(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function Nn(t,e,n){n=ht(n||L);var r=b(e);if(!t())return n(null);var o=function(e){if(e)return n(e);if(t())return r(o);var s=i(arguments,1);n.apply(null,[null].concat(s))};r(o)}function Bn(t,e,n){Nn(function(){return!t.apply(this,arguments)},e,n)}var Pn=function(t,e){if(e=N(e||L),!M(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var n=0;function r(e){var r=b(t[n++]);e.push(ht(o)),r.apply(null,e)}function o(o){if(o||n===t.length)return e.apply(null,arguments);r(i(arguments,1))}r([])},$n={apply:o,applyEach:Et,applyEachSeries:_t,asyncify:p,auto:Ut,autoInject:oe,cargo:ue,compose:pe,concat:ge,concatLimit:ye,concatSeries:me,constant:be,detect:Ee,detectLimit:Se,detectSeries:Ae,dir:_e,doDuring:Oe,doUntil:Te,doWhilst:je,during:Fe,each:Ie,eachLimit:Ue,eachOf:bt,eachOfLimit:dt,eachOfSeries:fe,eachSeries:Le,ensureAsync:Ne,every:Pe,everyLimit:$e,everySeries:He,filter:qe,filterLimit:Ve,filterSeries:Ke,forever:Ge,groupBy:Je,groupByLimit:We,groupBySeries:Ze,log:Xe,map:xt,mapLimit:At,mapSeries:kt,mapValues:Qe,mapValuesLimit:Ye,mapValuesSeries:tn,memoize:nn,nextTick:rn,parallel:sn,parallelLimit:an,priorityQueue:un,queue:cn,race:fn,reduce:le,reduceRight:ln,reflect:hn,reflectAll:pn,reject:yn,rejectLimit:gn,rejectSeries:mn,retry:wn,retryable:vn,seq:he,series:xn,setImmediate:h,some:En,someLimit:Sn,someSeries:An,sortBy:kn,timeout:_n,times:Fn,timesLimit:Tn,timesSeries:Cn,transform:In,tryEach:Un,unmemoize:Ln,until:Bn,waterfall:Pn,whilst:Nn,all:Pe,allLimit:$e,allSeries:He,any:En,anyLimit:Sn,anySeries:An,find:Ee,findLimit:Se,findSeries:Ae,forEach:Ie,forEachSeries:Le,forEachLimit:Ue,forEachOf:bt,forEachOfSeries:fe,forEachOfLimit:dt,inject:le,foldl:le,foldr:ln,select:qe,selectLimit:Ve,selectSeries:Ke,wrapSync:p};e.default=$n,e.apply=o,e.applyEach=Et,e.applyEachSeries=_t,e.asyncify=p,e.auto=Ut,e.autoInject=oe,e.cargo=ue,e.compose=pe,e.concat=ge,e.concatLimit=ye,e.concatSeries=me,e.constant=be,e.detect=Ee,e.detectLimit=Se,e.detectSeries=Ae,e.dir=_e,e.doDuring=Oe,e.doUntil=Te,e.doWhilst=je,e.during=Fe,e.each=Ie,e.eachLimit=Ue,e.eachOf=bt,e.eachOfLimit=dt,e.eachOfSeries=fe,e.eachSeries=Le,e.ensureAsync=Ne,e.every=Pe,e.everyLimit=$e,e.everySeries=He,e.filter=qe,e.filterLimit=Ve,e.filterSeries=Ke,e.forever=Ge,e.groupBy=Je,e.groupByLimit=We,e.groupBySeries=Ze,e.log=Xe,e.map=xt,e.mapLimit=At,e.mapSeries=kt,e.mapValues=Qe,e.mapValuesLimit=Ye,e.mapValuesSeries=tn,e.memoize=nn,e.nextTick=rn,e.parallel=sn,e.parallelLimit=an,e.priorityQueue=un,e.queue=cn,e.race=fn,e.reduce=le,e.reduceRight=ln,e.reflect=hn,e.reflectAll=pn,e.reject=yn,e.rejectLimit=gn,e.rejectSeries=mn,e.retry=wn,e.retryable=vn,e.seq=he,e.series=xn,e.setImmediate=h,e.some=En,e.someLimit=Sn,e.someSeries=An,e.sortBy=kn,e.timeout=_n,e.times=Fn,e.timesLimit=Tn,e.timesSeries=Cn,e.transform=In,e.tryEach=Un,e.unmemoize=Ln,e.until=Bn,e.waterfall=Pn,e.whilst=Nn,e.all=Pe,e.allLimit=$e,e.allSeries=He,e.any=En,e.anyLimit=Sn,e.anySeries=An,e.find=Ee,e.findLimit=Se,e.findSeries=Ae,e.forEach=Ie,e.forEachSeries=Le,e.forEachLimit=Ue,e.forEachOf=bt,e.forEachOfSeries=fe,e.forEachOfLimit=dt,e.inject=le,e.foldl=le,e.foldr=ln,e.select=qe,e.selectLimit=Ve,e.selectSeries=Ke,e.wrapSync=p,Object.defineProperty(e,"__esModule",{value:!0})}(e)},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,f=e.c32[r+u];s=c,o.unshift(f)}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 f=0;for(let t=0;t<a.length&&"0"===a[t];t++)f++;a=a.slice(f-f%2);let l=a.join("");for(let t=0;t<s;t++)l=`00${l}`;if(n){const t=2*n-l.length;for(let e=0;e<t;e+=2)l=`00${l}`}return l}},688:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const r=n(165),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 f 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:f,E:l,F:h,G:p,H:d}=this;for(let t=0;t<64;t++){const e=d+((0,i.rotr)(l,6)^(0,i.rotr)(l,11)^(0,i.rotr)(l,25))+o(l,h,p)+a[t]+u[t]|0,y=((0,i.rotr)(n,2)^(0,i.rotr)(n,13)^(0,i.rotr)(n,22))+s(n,r,c)|0;d=p,p=h,h=l,l=f+e|0,f=c,c=r,r=n,n=e+y|0}n=n+this.A|0,r=r+this.B|0,c=c+this.C|0,f=f+this.D|0,l=l+this.E|0,h=h+this.F|0,p=p+this.G|0,d=d+this.H|0,this.set(n,r,c,f,l,h,p,d)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends f{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 f),e.sha224=(0,i.wrapConstructor)(()=>new l)},790:(t,e,n)=>{!function(){var e={};if(e.async=n(668),"object"!=typeof e.async)throw new Error("Module async is required (https://github.com/caolan/async)");var r=e.async;function i(t,e){if(!e||"object"!=typeof e)return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function o(){var t={},e=Array.prototype.slice.call(arguments),n=null,r=null;return e.forEach(function(e){if(e&&e.constructor===Object)for(n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]]}),t}function s(){this.custom={},this.extend=function(t){return i(this.custom,t)},this.reset=function(){this.custom={}},this.remove=function(t){c.array(t)||(t=[t]),t.forEach(function(t){delete this.custom[t]},this)}}function a(t,e){var n=["@"];if(this._schema=t,this._custom={},null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._custom["$"+r]=e[r]);this._getDepth=function(){return n.length},this._dumpStack=function(){return n.map(function(t){return t.replace(/^\[/g,"")}).join(".").replace(/\.\u001b\u001c\u001d\u001e/g,"[")},this._deeperObject=function(t){return n.push(/^[a-z$_][a-z0-9$_]*$/i.test(t)?t:'["'+t+'"]'),this},this._deeperArray=function(t){return n.push("["+t+"]"),this},this._back=function(){return n.pop(),this}}var c={function:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},number:function(t){return"number"==typeof t&&!isNaN(t)},integer:function(t){return"number"==typeof t&&t%1==0},NaN:function(t){return"number"==typeof t&&isNaN(t)},boolean:function(t){return"boolean"==typeof t},null:function(t){return null===t},date:function(t){return null!=t&&t instanceof Date},object:function(t){return"object"==typeof t&&null!=t&&t.constructor!==Array},array:function(t){return null!=t&&t.constructor===Array},any:function(){return!0}};function u(t,e){return"function"==typeof t?e instanceof t:c[t=t in c?t:"any"](e)}function f(t,e){for(var n=[],r=t.indexOf(e);-1!==r;)n.push(r),r=t.indexOf(e,r+1);return n}var l={void:/^$/,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)?(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z?|(-|\+)\d{2}:\d{2})$/,date:/^\d{4}-\d{2}-\d{2}$/,coolDateTime:/^\d{4}(-|\/)\d{2}(-|\/)\d{2}(T| )\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,time:/^\d{2}\:\d{2}\:\d{2}$/,color:/^#([0-9a-f])+$/i,email:new RegExp("(?:[^\\W_](?:[\\w\\.\\+]+)@(?:localhost|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|موريتانيا|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|السعودية|yokohama|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|католик|الجزائر|العليان|اتصالات|پاکستان|البحرين|كاثوليك|இந்தியா|yamaxun|youtube|zuerich|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|москва|онлайн|ファッション|भारतम्|ارامكو|امارات|الاردن|المغرب|ابوظبي|مليسيا|இலங்கை|فلسطين|yachts|yandex|zappos|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|ישראל|বাংলা|భారత్|भारोत|संगठन|ایران|بازار|بھارت|سودان|همراه|سورية|ഭാരതം|嘉里大酒店|yahoo|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|ಭಾರತ|ଭାରତ|大众汽车|ভাৰত|ভারত|موقع|香格里拉|сайт|アマゾン|дети|ポイント|ලංකා|電訊盈科|クラウド|ભારત|भारत|عمان|بارت|ڀارت|عراق|شبكة|بيتك|组织机构|تونس|グーグル|ਭਾਰਤ|yoga|zara|zero|zone|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|कॉम|セール|คอม|我爱你|қаз|срб|бел|קום|淡马锡|орг|नेट|ストア|мкд|كوم|中文网|ком|укр|亚马逊|诺基亚|飞利浦|мон|عرب|ไทย|рус|ລາວ|みんな|天主教|مصر|قطر|հայ|新加坡|xxx|xyz|you|yun|zip|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|佛山|慈善|集团|在线|한국|点看|八卦|公益|公司|网站|移动|联通|бг|时尚|微博|삼성|商标|商店|商城|ею|新闻|家電|中信|中国|中國|娱乐|谷歌|购物|通販|网店|餐厅|网络|香港|食品|台湾|台灣|手机|澳門|닷컴|政府|გე|机构|健康|招聘|рф|大拿|ευ|ελ|世界|書籍|网址|닷넷|コム|游戏|企业|信息|嘉里|广东|政务|ye|yt|za|zm|zw))))"),numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_-]+$/i,javascript:/^[a-z_\$][a-z0-9_\$]*$/i,upperString:/^[A-Z ]*$/,lowerString:/^[a-z ]*$/,v4uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i},h={optional:function(t,e){!0!==("boolean"==typeof t.optional?t.optional:"true"===t.optional)&&void 0===e&&this.report("is missing and not optional",null,"optional")},type:function(t,e){if(void 0!==e&&("string"==typeof t.type||t.type instanceof Array||"function"==typeof t.type)){var n=c.array(t.type)?t.type:[t.type];n.some(function(t){return u(t,e)})||(n=n.map(function(t){return"function"==typeof t?"an instance of "+t.name:t}),this.report("must be "+n.join(" or ")+", but is "+function(t){for(var e in c)if(u(e,t))return"any"===e||"object"===e&&t.constructor!==Object?"an instance of "+t.constructor.name:e}(e),null,"type"))}},uniqueness:function(t,e){if("string"==typeof t.uniqueness&&(t.uniqueness="true"===t.uniqueness),"boolean"==typeof t.uniqueness&&!1!==t.uniqueness&&(c.array(e)||"string"==typeof e))for(var n=[],r=0;r<e.length;r++)if(!(n.indexOf(e[r])>=0)){var i=f(e,e[r]);i.length>1&&(n.push(e[r]),this.report("has value ["+e[r]+"] more than once at indexes ["+i.join(", ")+"]",null,"uniqueness"))}},pattern:function(t,e){var n=t.pattern;if("string"==typeof e){var r=!1;c.array(n)||(n=[n]),n.forEach(function(t){"string"==typeof t&&t in l&&(t=l[t]),t instanceof RegExp&&t.test(e)&&(r=!0)}),r||this.report("must match ["+n.join(" or ")+'], but is equal to "'+e+'"',null,"pattern")}},validDate:function(t,e){"true"===String(t.validDate)&&e instanceof Date&&isNaN(e.getTime())&&this.report("must be a valid date",null,"validDate")},minLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.minLength);isNaN(n)||e.length<n&&this.report("must be longer than "+n+" elements, but it has "+e.length,null,"minLength")}},maxLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.maxLength);isNaN(n)||e.length>n&&this.report("must be shorter than "+n+" elements, but it has "+e.length,null,"maxLength")}},exactLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.exactLength);isNaN(n)||e.length!==n&&this.report("must have exactly "+n+" elements, but it have "+e.length,null,"exactLength")}},lt:function(t,e){var n=Number(t.lt);"number"!=typeof e||isNaN(n)||e>=n&&this.report("must be less than "+n+', but is equal to "'+e+'"',null,"lt")},lte:function(t,e){var n=Number(t.lte);"number"!=typeof e||isNaN(n)||e>n&&this.report("must be less than or equal to "+n+', but is equal to "'+e+'"',null,"lte")},gt:function(t,e){var n=Number(t.gt);"number"!=typeof e||isNaN(n)||e<=n&&this.report("must be greater than "+n+', but is equal to "'+e+'"',null,"gt")},gte:function(t,e){var n=Number(t.gte);"number"!=typeof e||isNaN(n)||e<n&&this.report("must be greater than or equal to "+n+', but is equal to "'+e+'"',null,"gte")},eq:function(t,e){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e){var n=t.eq;if("number"==typeof n||"string"==typeof n||"boolean"==typeof n||c.array(n))if(c.array(n)){for(var r=0;r<n.length;r++)if(e===n[r])return;this.report("must be equal to ["+n.map(function(t){return'"'+t+'"'}).join(" or ")+'], but is equal to "'+e+'"',null,"eq")}else e!==n&&this.report('must be equal to "'+n+'", but is equal to "'+e+'"',null,"eq")}},ne:function(t,e){if("number"==typeof e||"string"==typeof e){var n=t.ne;if("number"==typeof n||"string"==typeof n||c.array(n))if(c.array(n)){for(var r=0;r<n.length;r++)if(e===n[r])return void this.report('must not be equal to "'+n[r]+'"',null,"ne")}else e===n&&this.report('must not be equal to "'+n+'"',null,"ne")}},someKeys:function(t,e){var n=t.someKeys;c.object(e)&&(n.some(function(t){return t in e})||this.report("must have at least key "+n.map(function(t){return'"'+t+'"'}).join(" or "),null,"someKeys"))},strict:function(t,e){if("string"==typeof t.strict&&(t.strict="true"===t.strict),!0===t.strict&&c.object(e)&&c.object(t.properties)&&void 0===t.properties["*"]){var n=Object.keys(e).filter(function(e){return void 0===t.properties[e]});if(n.length>0){var r="should not contains "+(n.length>1?"properties":"property")+" ["+n.map(function(t){return'"'+t+'"'}).join(", ")+"]";this.report(r,null,"strict")}}},exec:function(t,e,n){var r=this;if("function"==typeof n)return this.asyncExec(t,e,n);(c.array(t.exec)?t.exec:[t.exec]).forEach(function(n){"function"==typeof n&&n.call(r,t,e)})},properties:function(t,e,n){if("function"==typeof n)return this.asyncProperties(t,e,n);if(t.properties instanceof Object&&e instanceof Object){var r,i=t.properties;if(null!=i["*"])for(r in e)r in i||(this._deeperObject(r),this._validate(i["*"],e[r]),this._back());for(r in i)"*"!==r&&(this._deeperObject(r),this._validate(i[r],e[r]),this._back())}},items:function(t,e,n){if("function"==typeof n)return this.asyncItems(t,e,n);if(t.items instanceof Object&&e instanceof Object){var r,i,o=t.items;if(c.array(o)&&c.array(e))for(r=0,i=o.length;r<i;r++)this._deeperArray(r),this._validate(o[r],e[r]),this._back();else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this._deeperArray(s),this._validate(o,e[s]),this._back())}}},p={asyncExec:function(t,e,n){var i=this;r.eachSeries(c.array(t.exec)?t.exec:[t.exec],function(n,o){if("function"==typeof n){if(n.length>2)return n.call(i,t,e,o);n.call(i,t,e)}r.nextTick(o)},n)},asyncProperties:function(t,e,n){if(!(t.properties instanceof Object&&c.object(e)))return n();var i=this,o=t.properties;r.series([function(t){if(null==o["*"])return t();r.eachSeries(Object.keys(e),function(t,n){if(t in o)return r.nextTick(n);i._deeperObject(t),i._asyncValidate(o["*"],e[t],function(t){i._back(),n(t)})},t)},function(t){r.eachSeries(Object.keys(o),function(t,n){if("*"===t)return r.nextTick(n);i._deeperObject(t),i._asyncValidate(o[t],e[t],function(t){i._back(),n(t)})},t)}],n)},asyncItems:function(t,e,n){if(!(t.items instanceof Object&&e instanceof Object))return n();var i=this,o=t.items;c.array(o)&&c.array(e)?r.timesSeries(o.length,function(t,n){i._deeperArray(t),i._asyncValidate(o[t],e[t],function(t,e){i._back(),n(t,e)}),i._back()},n):r.eachSeries(Object.keys(e),function(t,n){i._deeperArray(t),i._asyncValidate(o,e[t],function(t,e){i._back(),n(t,e)})},n)}};function d(t,e){a.prototype.constructor.call(this,t,o(d.custom,e));var n=[];this._basicFields=Object.keys(h),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t,e,r){var i={code:e||this.userCode||null,reason:r||"unknown",message:this.userError||t||"is invalid",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};return n.push(i),this},this.result=function(){return{error:n,valid:0===n.length,format:function(){return!0===this.valid?"Candidate is valid":this.error.map(function(t){return"Property "+t.property+": "+t.message}).join("\n")}}}}i(d.prototype,h),i(d.prototype,p),i(d,new s),d.prototype.validate=function(t,e){if(this.origin=t,"function"==typeof e){var n=this;return r.nextTick(function(){n._asyncValidate(n._schema,t,function(t){n.origin=null,e(t,n.result())})})}return this._validate(this._schema,t).result()},d.prototype._validate=function(t,e,n){return this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,this._basicFields.forEach(function(n){!(n in t)&&"optional"!==n||"function"!=typeof this[n]||this[n](t,e)},this),this._customFields.forEach(function(n){n in t&&"function"==typeof this._custom[n]&&this._custom[n].call(this,t,e)},this),this},d.prototype._asyncValidate=function(t,e,n){var i=this;this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,r.series([function(n){r.eachSeries(Object.keys(h),function(n,o){r.nextTick(function(){if((n in t||"optional"===n)&&"function"==typeof i[n]){if(i[n].length>2)return i[n](t,e,o);i[n](t,e)}o()})},n)},function(n){r.eachSeries(Object.keys(i._custom),function(n,o){r.nextTick(function(){if(n in t&&"function"==typeof i._custom[n]){if(i._custom[n].length>2)return i._custom[n].call(i,t,e,o);i._custom[n].call(i,t,e)}o()})},n)}],n)};var y={number:function(t,e){var n;if("number"==typeof t)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(n=parseFloat(t.replace(/,/g,".").replace(/ /g,""))))return n}else if(t instanceof Date)return+t;return null},integer:function(t,e){var n;if("number"==typeof t&&t%1==0)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(n=parseInt(t.replace(/ /g,""),10)))return n}else{if("number"==typeof t)return parseInt(t,10);if("boolean"==typeof t)return t?1:0;if(t instanceof Date)return+t}return null},string:function(t,e){return"boolean"==typeof t||"number"==typeof t||t instanceof Date?t.toString():c.array(t)?e.items||e.properties?t:t.join(String(e.joinWith||",")):t instanceof Object?e.items||e.properties?t:JSON.stringify(t):"string"==typeof t&&t.length?t:null},date:function(t,e){if(t instanceof Date)return t;var n=new Date(t);return isNaN(n.getTime())?null:n},boolean:function(t,e){return void 0===t?null:("string"!=typeof t||"false"!==t.toLowerCase())&&!!t},object:function(t,e){if("string"!=typeof t||c.object(t))return t;try{return JSON.parse(t)}catch(t){return null}},array:function(t,e){if(c.array(t))return t;if(void 0===t)return null;if("string"==typeof t){if("["===t.substring(0,1)&&"]"===t.slice(-1))try{return JSON.parse(t)}catch(t){return null}return t.split(String(e.splitWith||","))}return c.array(t)?null:[t]}},g={upper:function(t){return t.toUpperCase()},lower:function(t){return t.toLowerCase()},title:function(t){return t.replace(/\S*/g,function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()})},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.substr(1)},trim:function(t){return t.trim()}},m={strict:function(t,e){return"string"==typeof t.strict&&(t.strict="true"===t.strict),!0!==t.strict?e:c.object(t.properties)&&c.object(e)?(Object.keys(e).forEach(function(n){n in t.properties||delete e[n]}),e):e},optional:function(t,e){return!0===("boolean"==typeof t.optional?t.optional:"false"!==t.optional)||void 0!==e?e:(this.report(),t.def===Date?new Date:t.def)},type:function(t,e){if("string"!=typeof t.type||"function"!=typeof y[t.type])return e;var n,r="boolean"!=typeof t.optional||t.optional;return"function"==typeof y[t.type]?(null===(n=y[t.type](e,t))&&!r||!n&&isNaN(n)||null===n&&"string"===t.type)&&(n=t.def):r||(n=t.def),(null!=n||void 0!==t.def&&t.def===n)&&n!==e?(this.report(),n):e},rules:function(t,e){var n=t.rules;if("string"!=typeof e||"string"!=typeof n&&!c.array(n))return e;var r=!1;return(c.array(n)?n:[n]).forEach(function(t){"function"==typeof g[t]&&(e=g[t](e),r=!0)}),r&&this.report(),e},min:function(t,e){var n=Number(e);if(isNaN(n))return e;var r=Number(t.min);return isNaN(r)?e:n<r?(this.report(),r):e},max:function(t,e){var n=Number(e);if(isNaN(n))return e;var r=Number(t.max);return isNaN(r)?e:n>r?(this.report(),r):e},minLength:function(t,e){var n=Number(t.minLength);if("string"!=typeof e||isNaN(n)||n<0)return e;var r="",i=n-e.length;if(i>0){for(var o=0;o<i;o++)r+="-";return this.report(),e+r}return e},maxLength:function(t,e){var n=Number(t.maxLength);return"string"!=typeof e||isNaN(n)||n<0?e:e.length>n?(this.report(),e.slice(0,n)):e},properties:function(t,e,n){if("function"==typeof n)return this.asyncProperties(t,e,n);if(!e||"object"!=typeof e)return e;var r,i,o=t.properties;if(void 0!==o["*"])for(i in e)i in o||(this._deeperObject(i),(void 0!==(r=this._sanitize(o["*"],e[i]))||"exec"in o["*"])&&(e[i]=r),this._back());for(i in o)"*"!==i&&(this._deeperObject(i),(void 0!==(r=this._sanitize(o[i],e[i]))||"exec"in o[i])&&(e[i]=r),this._back());return e},items:function(t,e,n){if("function"==typeof n)return this.asyncItems(t,e,n);if(!(t.items instanceof Object&&e instanceof Object))return e;var r;if(c.array(t.items)&&c.array(e)){var i=t.items.length<e.length?t.items.length:e.length;for(r=0;r<i;r++)this._deeperArray(r),e[r]=this._sanitize(t.items[r],e[r]),this._back()}else for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._deeperArray(r),e[r]=this._sanitize(t.items,e[r]),this._back());return e},exec:function(t,e,n){return"function"==typeof n?this.asyncExec(t,e,n):((c.array(t.exec)?t.exec:[t.exec]).forEach(function(n){"function"==typeof n&&(e=n.call(this,t,e))},this),e)}},b={asyncExec:function(t,e,n){var i=this,o=c.array(t.exec)?t.exec:[t.exec];r.eachSeries(o,function(n,r){if("function"==typeof n){if(n.length>2)return n.call(i,t,e,function(t,n){if(t)return r(t);e=n,r()});e=n.call(i,t,e)}r()},function(t){n(t,e)})},asyncProperties:function(t,e,n){if(!e||"object"!=typeof e)return n(null,e);var i=this,o=t.properties;r.series([function(t){if(null==o["*"])return t();var n=o["*"];r.eachSeries(Object.keys(e),function(t,r){if(t in o)return r();i._deeperObject(t),i._asyncSanitize(n,e[t],function(n,o){void 0!==o&&(e[t]=o),i._back(),r()})},t)},function(t){r.eachSeries(Object.keys(o),function(t,n){if("*"===t)return n();i._deeperObject(t),i._asyncSanitize(o[t],e[t],function(r,o){if(r)return n(r);void 0!==o&&(e[t]=o),i._back(),n()})},t)}],function(t){return n(t,e)})},asyncItems:function(t,e,n){if(!(t.items instanceof Object&&e instanceof Object))return n(null,e);var i=this,o=t.items;if(c.array(o)&&c.array(e)){var s=o.length<e.length?o.length:e.length;r.timesSeries(s,function(t,n){i._deeperArray(t),i._asyncSanitize(o[t],e[t],function(r,o){if(r)return n(r);e[t]=o,i._back(),n()})},function(t){n(t,e)})}else r.eachSeries(Object.keys(e),function(t,n){i._deeperArray(t),i._asyncSanitize(o,e[t],function(r,o){if(r)return n();e[t]=o,i._back(),n()})},function(t){n(t,e)});return e}};function w(t,e){a.prototype.constructor.call(this,t,o(w.custom,e));var n=[];this._basicFields=Object.keys(m),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t){var e={message:t||"was sanitized",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};n.some(function(t){return t.property===e.property})||n.push(e)},this.result=function(t){return{data:t,reporting:n,format:function(){return this.reporting.map(function(t){return"Property "+t.property+" "+t.message}).join("\n")}}}}i(w.prototype,m),i(w.prototype,b),i(w,new s),w.prototype.sanitize=function(t,e){if(this.origin=t,"function"==typeof e){var n=this;return this._asyncSanitize(this._schema,t,function(t,r){n.origin=null,e(t,n.result(r))})}var r=this._sanitize(this._schema,t);return this.origin=null,this.result(r)},w.prototype._sanitize=function(t,e){return this.userAlias=t.alias||null,this._basicFields.forEach(function(n){!(n in t)&&"optional"!==n||"function"!=typeof this[n]||(e=this[n](t,e))},this),this._customFields.forEach(function(n){n in t&&"function"==typeof this._custom[n]&&(e=this._custom[n].call(this,t,e))},this),e},w.prototype._asyncSanitize=function(t,e,n){var i=this;this.userAlias=t.alias||null,r.waterfall([function(n){r.reduce(i._basicFields,e,function(e,n,o){r.nextTick(function(){if((n in t||"optional"===n)&&"function"==typeof i[n]){if(i[n].length>2)return i[n](t,e,o);e=i[n](t,e)}o(null,e)})},n)},function(e,n){r.reduce(i._customFields,e,function(e,n,o){r.nextTick(function(){if(n in t&&"function"==typeof i._custom[n]){if(i._custom[n].length>2)return i._custom[n].call(i,t,e,o);e=i._custom[n].call(i,t,e)}o(null,e)})},n)}],n)};var v=2147483647,x={int:function(t,e){return t+(0|Math.random()*(e-t+1))},float:function(t,e){return Math.random()*(e-t)+t},bool:function(){return Math.random()>.5},char:function(t,e){return String.fromCharCode(this.int(t,e))},fromList:function(t){return t[this.int(0,t.length-1)]}},E={"date-time":function(){return(new Date).toISOString()},date:function(){return(new Date).toISOString().replace(/T.*$/,"")},time:function(){return(new Date).toLocaleTimeString({},{hour12:!1})},color:function(t,e){var n="#";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("0123456789abcdefABCDEF");return n},numeric:function(){return""+x.int(0,v)},integer:function(){return!0===x.bool()?"-"+this.numeric():this.numeric()},decimal:function(){return this.integer()+"."+this.numeric()},alpha:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return n},alphaNumeric:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");return n},alphaDash:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("_-abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789_-");return n},javascript:function(t,e){for(var n=x.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),r=0,i=x.int(t,e-1);r<i;r++)n+=x.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$0123456789_$");return n}};function S(t){var e=-2147483648,n=v;return null!=t.gte?e=t.gte:null!=t.gt&&(e=t.gt+1),null!=t.lte?n=t.lte:null!=t.lt&&(n=t.lt-1),{min:e,max:n}}var A={string:function(t){if(null!=t.eq)return t.eq;var e="",n=null!=t.minLength?t.minLength:0,r=null!=t.maxLength?t.maxLength:32;if("string"==typeof t.pattern&&"function"==typeof E[t.pattern])return E[t.pattern](n,r);for(var i=null!=t.exactLength?t.exactLength:x.int(n,r),o=0;o<i;o++)e+=x.char(32,126);return e},number:function(t){if(null!=t.eq)return t.eq;var e=S(t),n=x.float(e.min,e.max);if(null!=t.ne)for(var r=c.array(t.ne)?t.ne:[t.ne];-1!==r.indexOf(n);)n=x.float(e.min,e.max);return n},integer:function(t){if(null!=t.eq)return t.eq;var e=S(t),n=x.int(e.min,e.max);if(null!=t.ne)for(var r=c.array(t.ne)?t.ne:[t.ne];-1!==r.indexOf(n);)n=x.int(e.min,e.max);return n},boolean:function(t){return null!=t.eq?t.eq:x.bool()},null:function(t){return null},date:function(t){return null!=t.eq?t.eq:new Date},object:function(t){var e={},n=t.properties||{};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(!0===n[r].optional&&!0===x.bool())continue;if("*"!==r)e[r]=this.generate(n[r]);else for(var i="__random_key_",o=i+0,s=x.int(1,9),a=1;a<=s;a++)o in n||(e[o]=this.generate(n[r])),o=i+a}return e},array:function(t){var e,n,r,i,o=t.items||{},s=null!=t.minLength?t.minLength:0,a=null!=t.maxLength?t.maxLength:16;if(c.array(o))for(r=o.length,null!=t.exactLength?r=t.exactLength:r<s?r=s:r>a&&(r=a),n=new Array(r),e=null,i=0;i<r;i++)e=o[i].type||"any",c.array(e)&&(e=e[x.int(0,e.length-1)]),n[i]=this[e](o[i]);else for(r=null!=t.exactLength?t.exactLength:x.int(s,a),n=new Array(r),e=o.type||"any",c.array(e)&&(e=e[x.int(0,e.length-1)]),i=0;i<r;i++)n[i]=this[e](o);return n},any:function(t){var e=Object.keys(A);return this[e[x.int(0,e.length-2)]](t)}};function k(){}i(k.prototype,A);var _=null;k.instance=function(){return _ instanceof k||(_=new k),_},k.prototype.generate=function(t){var e=t.type||"any";return c.array(e)&&(e=e[x.int(0,e.length-1)]),this[e](t)};var O={};t.exports?t.exports=O:window.SchemaInspector=O,O.newSanitization=function(t,e){return new w(t,e)},O.newValidation=function(t,e){return new d(t,e)},O.Validation=d,O.Sanitization=w,O.sanitize=function(t,e,n,r){return 3===arguments.length&&"function"==typeof n&&(r=n,n=null),new w(t,n).sanitize(e,r)},O.validate=function(t,e,n,r){return 3===arguments.length&&"function"==typeof n&&(r=n,n=null),new d(t,n).validate(e,r)},O.generate=function(t,e){if("number"==typeof e){for(var n=new Array(e),r=0;r<e;r++)n[r]=k.instance().generate(t);return n}return k.instance().generate(t)}}()},818:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(418),e),i(n(402),e),i(n(574),e),i(n(87),e),i(n(546),e)},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)}},886:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=e.unescape=e.escape=e.pad=void 0;const r=n(991);function i(t){return`${t}${"=".repeat(4-(t.length%4||4))}`}function o(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function s(t){return i(t).replace(/-/g,"+").replace(/_/g,"/")}e.pad=i,e.escape=o,e.unescape=s,e.encode=function(t){return o((0,r.fromByteArray)((new TextEncoder).encode(t)))},e.decode=function(t){return(new TextDecoder).decode((0,r.toByteArray)(i(s(t))))}},907:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,c=[],u=!1,f=-1;function l(){u&&a&&(u=!1,a.length?c=a.concat(c):f=-1,c.length&&h())}function h(){if(!u){var t=s(l);u=!0;for(var e=c.length;e;){for(a=c,c=[];++f<e;)a&&a[f].run();f=-1,e=c.length}a=null,u=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function d(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||u||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=d,r.addListener=d,r.once=d,r.off=d,r.removeListener=d,r.removeAllListeners=d,r.emit=d,r.prependListener=d,r.prependOnceListener=d,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},951:()=>{},976:()=>{},991:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],c=o[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),f=0,l=c>0?s-4:s;for(n=0;n<l;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[f++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e),u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,c=r-i;a<c;a+=s)o.push(u(t,a,a+s>c?c:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function u(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(c(r));return i.join("")}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].call(o.exports,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";i.r(o),i.d(o,{BLOCKSTACK_GAIA_HUB_LABEL:()=>Mn,GaiaHubConfig:()=>t.GaiaHubConfig,Storage:()=>Xn,connectToGaiaHub:()=>Gn,deleteFromGaiaHub:()=>Vn,getBucketUrl:()=>Wn,getFullReadUrl:()=>Kn,getUserAppFileUrl:()=>Yn,uploadToGaiaHub:()=>qn});var t={};i.r(t),i.d(t,{me:()=>Mn,HV:()=>Gn,BP:()=>Vn,zz:()=>Jn,ah:()=>Wn,tH:()=>Kn,Sz:()=>qn});const e=33,n={referrerPolicy:"origin",headers:{"x-hiro-product":"stacksjs"}};async function r(t,e){const r={};return Object.assign(r,n,e),await fetch(t,r)}function s(...t){const{fetchLib:e,middlewares:n}=function(t){let e=r,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 a,c,u,f,l;!function(t){t[t.Mainnet=1]="Mainnet",t[t.Testnet=2147483648]="Testnet"}(a||(a={})),function(t){t[t.Mainnet=385875968]="Mainnet",t[t.Testnet=4278190080]="Testnet"}(c||(c={})),a.Mainnet,(l=u||(u={}))[l.Mainnet=0]="Mainnet",l[l.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"}(f||(f={})),u.Mainnet;const h={chainId:a.Mainnet,transactionVersion:u.Mainnet,peerNetworkId:c.Mainnet,magicBytes:"X2",bootAddress:"SP000000000000000000002Q6VF78",addressVersion:{singleSig:f.MainnetSingleSig,multiSig:f.MainnetMultiSig},client:{baseUrl:"https://api.mainnet.hiro.so"}},p={chainId:a.Testnet,transactionVersion:u.Testnet,peerNetworkId:c.Testnet,magicBytes:"T2",bootAddress:"ST000000000000000000002AMW42H",addressVersion:{singleSig:f.TestnetSingleSig,multiSig:f.TestnetMultiSig},client:{baseUrl:"https://api.testnet.hiro.so"}},d={...p,addressVersion:{...p.addressVersion},magicBytes:"id",client:{baseUrl:"http://localhost:3999"}},y={...d,addressVersion:{...d.addressVersion},client:{...d.client}};function g(t){return"string"==typeof t?function(t){switch(t){case"mainnet":return h;case"testnet":return p;case"devnet":return d;case"mocknet":return y;default:throw new Error(`Unknown network name: ${t}`)}}(t):t}function m(t){return t.client.fetch?t.client:{...t.client,fetch:s()}}var b=i(818);const w=["debug","info","warn","error","none"],v={},x={};for(let t=0;t<w.length;t++){const e=w[t];v[e]=t,x[t]=e}class E{static error(t){this.shouldLog("error")&&console.error(this.logMessage("error",t))}static warn(t){this.shouldLog("warn")&&console.warn(this.logMessage("warn",t))}static info(t){this.shouldLog("info")&&console.log(this.logMessage("info",t))}static debug(t){this.shouldLog("debug")&&console.log(this.logMessage("debug",t))}static logMessage(t,e){return`[${t.toUpperCase()}] ${e}`}static shouldLog(t){return v.debug<=v[t]}}function S(t){return Number.isFinite(t)?Math.floor(1024*t*1024):0}function A(){let t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)})}function k(t,{throwIfUnavailable:e,usageDesc:n,returnEmptyObject:r}={}){let o;try{if(o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i.g)return i.g;throw new Error("Unexpected runtime environment - no supported global scope (`window`, `self`, `global`) available")}(),o){const e=o[t];if(e)return e}}catch(e){E.error(`Error getting object '${t}' from global scope '${o}': ${e}`)}if(e){const e=function(t,e,n){return n?`Use of '${n}' requires \`${e}\` which is unavailable on the '${t}' object within the currently executing environment.`:`\`${e}\` is unavailable on the '${t}' object within the currently executing environment.`}(o,t.toString(),n);throw E.error(e),new Error(e)}if(r)return{}}const _=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function O(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(const n of t)e+=_[n];return e}function j(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);var e;t=(e=t,t=/^0x/i.test(e)?e.slice(2):e).length%2?`0${t}`:t;const n=new Uint8Array(t.length/2);for(let e=0;e<n.length;e++){const r=2*e,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[e]=o}return n}function T(t){return(new TextEncoder).encode(t)}function F(...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 C(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${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}`)}const U={number:C,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:I,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");C(t.outputLen),C(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){I(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}},L=("object"==typeof self&&"crypto"in self&&self.crypto,t=>new DataView(t.buffer,t.byteOffset,t.byteLength)),N=(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 B(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 P{clone(){return this._cloneInto()}}function $(t){const e=e=>t().update(B(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}class H extends P{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,U.hash(t);const n=B(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){return U.exists(this),this.iHash.update(t),this}digestInto(t){U.exists(this),U.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=r,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const D=(t,e,n)=>new H(t,e).update(n).digest();D.create=(t,e)=>new H(t,e);class R extends P{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=L(this.buffer)}update(t){U.exists(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=B(t)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s===r){const e=L(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){U.exists(this),U.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=L(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 z=(t,e,n)=>t&e^~t&n,M=(t,e,n)=>t&e^t&n^e&n,q=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]),V=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),K=new Uint32Array(64);class G extends R{constructor(){super(64,32,8,!1),this.A=0|V[0],this.B=0|V[1],this.C=0|V[2],this.D=0|V[3],this.E=0|V[4],this.F=0|V[5],this.G=0|V[6],this.H=0|V[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)K[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=K[t-15],n=K[t-2],r=N(e,7)^N(e,18)^e>>>3,i=N(n,17)^N(n,19)^n>>>10;K[t]=i+K[t-7]+r+K[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+(N(s,6)^N(s,11)^N(s,25))+z(s,a,c)+q[t]+K[t]|0,f=(N(n,2)^N(n,13)^N(n,22))+M(n,r,i)|0;u=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+f|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(){K.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class W extends G{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 J=$(()=>new G);$(()=>new W);var Z=i(976),X=i.t(Z,2);const Y=BigInt(0),Q=BigInt(1),tt=BigInt(2),et=BigInt(3),nt=BigInt(8),rt=Object.freeze({a:Y,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:Q,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),it=(t,e)=>(t+e/tt)/e,ot={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=rt,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Q*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=it(o*t,e),c=it(-r*t,e);let u=Lt(t-a*n-c*i,e),f=Lt(-a*r-c*o,e);const l=u>s,h=f>s;if(l&&(u=e-u),h&&(f=e-f),u>s||f>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:l,k1:u,k2neg:h,k2:f}}},st=32,at=32,ct=32,ut=st+1,ft=2*st+1;function lt(t){const{a:e,b:n}=rt,r=Lt(t*t),i=Lt(r*t);return Lt(i+e*t+n)}const ht=rt.a===Y;class pt extends Error{constructor(t){super(t)}}function dt(t){if(!(t instanceof yt))throw new TypeError("JacobianPoint expected")}class yt{constructor(t,e,n){this.x=t,this.y=e,this.z=n}static fromAffine(t){if(!(t instanceof bt))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(bt.ZERO)?yt.ZERO:new yt(t.x,t.y,Q)}static toAffineBatch(t){const e=function(t,e=rt.P){const n=new Array(t.length),r=Bt(t.reduce((t,r,i)=>r===Y?t:(n[i]=t,Lt(t*r,e)),Q),e);return t.reduceRight((t,r,i)=>r===Y?t:(n[i]=Lt(t*n[i],e),Lt(t*r,e)),r),n}(t.map(t=>t.z));return t.map((t,n)=>t.toAffine(e[n]))}static normalizeZ(t){return yt.toAffineBatch(t).map(yt.fromAffine)}equals(t){dt(t);const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t,a=Lt(r*r),c=Lt(s*s),u=Lt(e*c),f=Lt(i*a),l=Lt(Lt(n*s)*c),h=Lt(Lt(o*r)*a);return u===f&&l===h}negate(){return new yt(this.x,Lt(-this.y),this.z)}double(){const{x:t,y:e,z:n}=this,r=Lt(t*t),i=Lt(e*e),o=Lt(i*i),s=t+i,a=Lt(tt*(Lt(s*s)-r-o)),c=Lt(et*r),u=Lt(c*c),f=Lt(u-tt*a),l=Lt(c*(a-f)-nt*o),h=Lt(tt*e*n);return new yt(f,l,h)}add(t){dt(t);const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t;if(i===Y||o===Y)return this;if(e===Y||n===Y)return t;const a=Lt(r*r),c=Lt(s*s),u=Lt(e*c),f=Lt(i*a),l=Lt(Lt(n*s)*c),h=Lt(Lt(o*r)*a),p=Lt(f-u),d=Lt(h-l);if(p===Y)return d===Y?this.double():yt.ZERO;const y=Lt(p*p),g=Lt(p*y),m=Lt(u*y),b=Lt(d*d-g-tt*m),w=Lt(d*(m-b)-l*g),v=Lt(r*s*p);return new yt(b,w,v)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=yt.ZERO;if("bigint"==typeof t&&t===Y)return e;let n=Ut(t);if(n===Q)return this;if(!ht){let t=e,r=this;for(;n>Y;)n&Q&&(t=t.add(r)),r=r.double(),n>>=Q;return t}let{k1neg:r,k1:i,k2neg:o,k2:s}=ot.splitScalar(n),a=e,c=e,u=this;for(;i>Y||s>Y;)i&Q&&(a=a.add(u)),s&Q&&(c=c.add(u)),u=u.double(),i>>=Q,s>>=Q;return r&&(a=a.negate()),o&&(c=c.negate()),c=new yt(Lt(c.x*ot.beta),c.y,c.z),a.add(c)}precomputeWindow(t){const e=ht?128/t+1:256/t+1,n=[];let r=this,i=r;for(let o=0;o<e;o++){i=r,n.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(t,e){!e&&this.equals(yt.BASE)&&(e=bt.BASE);const n=e&&e._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=e&&mt.get(e);r||(r=this.precomputeWindow(n),e&&1!==n&&(r=yt.normalizeZ(r),mt.set(e,r)));let i=yt.ZERO,o=yt.BASE;const s=1+(ht?128/n:256/n),a=2**(n-1),c=BigInt(2**n-1),u=2**n,f=BigInt(n);for(let e=0;e<s;e++){const n=e*a;let s=Number(t&c);t>>=f,s>a&&(s-=u,t+=Q);const l=n,h=n+Math.abs(s)-1,p=e%2!=0,d=s<0;0===s?o=o.add(gt(p,r[l])):i=i.add(gt(d,r[h]))}return{p:i,f:o}}multiply(t,e){let n,r,i=Ut(t);if(ht){const{k1neg:t,k1:o,k2neg:s,k2:a}=ot.splitScalar(i);let{p:c,f:u}=this.wNAF(o,e),{p:f,f:l}=this.wNAF(a,e);c=gt(t,c),f=gt(s,f),f=new yt(Lt(f.x*ot.beta),f.y,f.z),n=c.add(f),r=u.add(l)}else{const{p:t,f:o}=this.wNAF(i,e);n=t,r=o}return yt.normalizeZ([n,r])[0]}toAffine(t){const{x:e,y:n,z:r}=this,i=this.equals(yt.ZERO);null==t&&(t=i?nt:Bt(r));const o=t,s=Lt(o*o),a=Lt(s*o),c=Lt(e*s),u=Lt(n*a),f=Lt(r*o);if(i)return bt.ZERO;if(f!==Q)throw new Error("invZ was invalid");return new bt(c,u)}}function gt(t,e){const n=e.negate();return t?n:e}yt.BASE=new yt(rt.Gx,rt.Gy,Q),yt.ZERO=new yt(Y,Q,Y);const mt=new WeakMap;class bt{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,mt.delete(this)}hasEvenY(){return this.y%tt===Y}static fromCompressedHex(t){const e=32===t.length,n=Ct(e?t:t.subarray(1));if(!zt(n))throw new Error("Point is not on curve");let r=function(t){const{P:e}=rt,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),c=t*t*t%e,u=c*c*t%e,f=Nt(u,et)*u%e,l=Nt(f,et)*u%e,h=Nt(l,tt)*c%e,p=Nt(h,r)*h%e,d=Nt(p,i)*p%e,y=Nt(d,s)*d%e,g=Nt(y,a)*y%e,m=Nt(g,s)*d%e,b=Nt(m,et)*u%e,w=Nt(b,o)*p%e,v=Nt(w,n)*c%e,x=Nt(v,tt);if(x*x%e!==t)throw new Error("Cannot find square root");return x}(lt(n));const i=(r&Q)===Q;e?i&&(r=Lt(-r)):!(1&~t[0])!==i&&(r=Lt(-r));const o=new bt(n,r);return o.assertValidity(),o}static fromUncompressedHex(t){const e=Ct(t.subarray(1,st+1)),n=Ct(t.subarray(st+1,2*st+1)),r=new bt(e,n);return r.assertValidity(),r}static fromHex(t){const e=It(t),n=e.length,r=e[0];if(n===st)return this.fromCompressedHex(e);if(n===ut&&(2===r||3===r))return this.fromCompressedHex(e);if(n===ft&&4===r)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-${ut} compressed bytes or ${ft} uncompressed bytes, not ${n}`)}static fromPrivateKey(t){return bt.BASE.multiply(qt(t))}static fromSignature(t,e,n){const{r,s:i}=Vt(e);if(![0,1,2,3].includes(n))throw new Error("Cannot recover: invalid recovery bit");const o=Pt(It(t)),{n:s}=rt,a=2===n||3===n?r+s:r,c=Bt(a,s),u=Lt(-o*c,s),f=Lt(i*c,s),l=1&n?"03":"02",h=bt.fromHex(l+_t(a)),p=bt.BASE.multiplyAndAddUnsafe(h,u,f);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(t=!1){return Ft(this.toHex(t))}toHex(t=!1){const e=_t(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${_t(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:n}=this;if(!zt(e)||!zt(n))throw new Error(t);const r=Lt(n*n);if(Lt(r-lt(e))!==Y)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new bt(this.x,Lt(-this.y))}double(){return yt.fromAffine(this).double().toAffine()}add(t){return yt.fromAffine(this).add(yt.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return yt.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,n){const r=yt.fromAffine(this),i=e===Y||e===Q||this!==bt.BASE?r.multiplyUnsafe(e):r.multiply(e),o=yt.fromAffine(t).multiplyUnsafe(n),s=i.add(o);return s.equals(yt.ZERO)?void 0:s.toAffine()}}function wt(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function vt(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${At(t)}`);const e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Ct(n),left:t.subarray(e+2)}}bt.BASE=new bt(rt.Gx,rt.Gy),bt.ZERO=new bt(Y,Y);class xt{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,n="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${n}: Expected string or Uint8Array`);const r=e?At(t):t;if(128!==r.length)throw new Error(`${n}: Expected 64-byte hex`);return new xt(Tt(r.slice(0,64)),Tt(r.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:n,s:r}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${At(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:n}=vt(t.subarray(2)),{data:r,left:i}=vt(n);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${At(i)}`);return{r:e,s:r}}(e?t:Ft(t));return new xt(n,r)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!Rt(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Rt(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=rt.n>>Q;return this.s>t}normalizeS(){return this.hasHighS()?new xt(this.r,Lt(-this.s,rt.n)):this}toDERRawBytes(){return Ft(this.toDERHex())}toDERHex(){const t=wt(jt(this.s)),e=wt(jt(this.r)),n=t.length/2,r=e.length/2,i=jt(n),o=jt(r);return`30${jt(r+n+4)}02${o}${e}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Ft(this.toCompactHex())}toCompactHex(){return _t(this.r)+_t(this.s)}}function Et(...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}const St=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function At(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let n=0;n<t.length;n++)e+=St[t[n]];return e}const kt=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function _t(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(Y<=t&&t<kt))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function Ot(t){const e=Ft(_t(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function jt(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function Tt(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function Ft(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"+t.length);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 Ct(t){return Tt(At(t))}function It(t){return t instanceof Uint8Array?Uint8Array.from(t):Ft(t)}function Ut(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&Rt(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Lt(t,e=rt.P){const n=t%e;return n>=Y?n:e+n}function Nt(t,e){const{P:n}=rt;let r=t;for(;e-- >Y;)r*=r,r%=n;return r}function Bt(t,e=rt.P){if(t===Y||e<=Y)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Lt(t,e),r=e,i=Y,o=Q,s=Q,a=Y;for(;n!==Y;){const t=r/n,e=r%n,c=i-s*t,u=o-a*t;r=n,n=e,i=s,o=a,s=c,a=u}if(r!==Q)throw new Error("invert: does not exist");return Lt(i,e)}function Pt(t,e=!1){const n=function(t){const e=8*t.length-8*at,n=Ct(t);return e>0?n>>BigInt(e):n}(t);if(e)return n;const{n:r}=rt;return n>=r?n-r:n}let $t,Ht;class Dt{constructor(t,e){if(this.hashLen=t,this.qByteLen=e,"number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}hmac(...t){return Qt.hmacSha256(this.k,...t)}hmacSync(...t){return Ht(this.k,...t)}checkSync(){if("function"!=typeof Ht)throw new pt("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=await this.hmac(this.v);const n=this.v.slice();e.push(n),t+=this.v.length}return Et(...e)}generateSync(){this.checkSync(),this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=this.hmacSync(this.v);const n=this.v.slice();e.push(n),t+=this.v.length}return Et(...e)}}function Rt(t){return Y<t&&t<rt.n}function zt(t){return Y<t&&t<rt.P}function Mt(t,e,n,r=!0){const{n:i}=rt,o=Pt(t,!0);if(!Rt(o))return;const s=Bt(o,i),a=bt.BASE.multiply(o),c=Lt(a.x,i);if(c===Y)return;const u=Lt(s*Lt(e+n*c,i),i);if(u===Y)return;let f=new xt(c,u),l=(a.x===f.r?0:2)|Number(a.y&Q);return r&&f.hasHighS()&&(f=f.normalizeS(),l^=1),{sig:f,recovery:l}}function qt(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(t.length!==2*at)throw new Error("Expected 32 bytes of private key");e=Tt(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(t.length!==at)throw new Error("Expected 32 bytes of private key");e=Ct(t)}if(!Rt(e))throw new Error("Expected private key: 0 < key < n");return e}function Vt(t){if(t instanceof xt)return t.assertValidity(),t;try{return xt.fromDER(t)}catch(e){return xt.fromCompact(t)}}function Kt(t){return Ct(t.length>st?t.slice(0,st):t)}function Gt(t){const e=Kt(t),n=Lt(e,rt.n);return Wt(n<Y?e:n)}function Wt(t){return Ot(t)}function Jt(t,e,n={}){const{seed:r,m:i,d:o}=function(t,e,n){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const r=It(t),i=qt(e),o=[Wt(i),Gt(r)];if(null!=n){!0===n&&(n=Qt.randomBytes(st));const t=It(n);if(t.length!==st)throw new Error(`sign: Expected ${st} bytes of extra data`);o.push(t)}return{seed:Et(...o),m:Kt(r),d:i}}(t,e,n.extraEntropy),s=new Dt(ct,at);let a;for(s.reseedSync(r);!(a=Mt(s.generateSync(),i,o,n.canonical));)s.reseedSync();return function(t,e){const{sig:n,recovery:r}=t,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},e),s=i?n.toDERRawBytes():n.toCompactRawBytes();return o?[s,r]:s}(a,n)}const Zt={strict:!0};bt.BASE._setWindowSize(8);const Xt={node:X,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},Yt={},Qt={bytesToHex:At,hexToBytes:Ft,concatBytes:Et,mod:Lt,invert:Bt,isValidPrivateKey(t){try{return qt(t),!0}catch(t){return!1}},_bigintTo32Bytes:Ot,_normalizePrivateKey:qt,hashToPrivateKey:t=>{t=It(t);const e=at+8;if(t.length<e||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return Ot(Lt(Ct(t),rt.n-Q)+Q)},randomBytes:(t=32)=>{if(Xt.web)return Xt.web.getRandomValues(new Uint8Array(t));if(Xt.node){const{randomBytes:e}=Xt.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Qt.hashToPrivateKey(Qt.randomBytes(at+8)),precompute(t=8,e=bt.BASE){const n=e===bt.BASE?e:new bt(e.x,e.y);return n._setWindowSize(t),n.multiply(et),n},sha256:async(...t)=>{if(Xt.web){const e=await Xt.web.subtle.digest("SHA-256",Et(...t));return new Uint8Array(e)}if(Xt.node){const{createHash:e}=Xt.node,n=e("sha256");return t.forEach(t=>n.update(t)),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(Xt.web){const n=await Xt.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=Et(...e),i=await Xt.web.subtle.sign("HMAC",n,r);return new Uint8Array(i)}if(Xt.node){const{createHmac:n}=Xt.node,r=n("sha256",t);return e.forEach(t=>r.update(t)),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...e)=>{let n=Yt[t];if(void 0===n){const e=await Qt.sha256(Uint8Array.from(t,t=>t.charCodeAt(0)));n=Et(e,e),Yt[t]=n}return Qt.sha256(n,...e)},taggedHashSync:(t,...e)=>{if("function"!=typeof $t)throw new pt("sha256Sync is undefined, you need to set it");let n=Yt[t];if(void 0===n){const e=$t(Uint8Array.from(t,t=>t.charCodeAt(0)));n=Et(e,e),Yt[t]=n}return $t(n,...e)},_JacobianPoint:yt};Object.defineProperties(Qt,{sha256Sync:{configurable:!1,get:()=>$t,set(t){$t||($t=t)}},hmacSha256Sync:{configurable:!1,get:()=>Ht,set(t){Ht||(Ht=t)}}});var te,ee,ne,re,ie=i(258);(re=te||(te={}))[re.TokenTransfer=0]="TokenTransfer",re[re.SmartContract=1]="SmartContract",re[re.VersionedSmartContract=6]="VersionedSmartContract",re[re.ContractCall=2]="ContractCall",re[re.PoisonMicroblock=3]="PoisonMicroblock",re[re.Coinbase=4]="Coinbase",re[re.CoinbaseToAltRecipient=5]="CoinbaseToAltRecipient",re[re.TenureChange=7]="TenureChange",re[re.NakamotoCoinbase=8]="NakamotoCoinbase",function(t){t[t.Clarity1=1]="Clarity1",t[t.Clarity2=2]="Clarity2",t[t.Clarity3=3]="Clarity3",t[t.Clarity4=4]="Clarity4"}(ee||(ee={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(ne||(ne={}));var oe,se,ae,ce,ue,fe,le,he,pe,de,ye,ge,me,be;ne.OnChainOnly,ne.OffChainOnly,ne.Any,ne.OnChainOnly,ne.OnChainOnly,ne.OffChainOnly,ne.OffChainOnly,ne.Any,ne.Any,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(oe||(oe={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(se||(se={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}(ae||(ae={})),(be=ce||(ce={}))[be.P2PKH=0]="P2PKH",be[be.P2SH=1]="P2SH",be[be.P2WPKH=2]="P2WPKH",be[be.P2WSH=3]="P2WSH",be[be.P2SHNonSequential=5]="P2SHNonSequential",be[be.P2WSHNonSequential=7]="P2WSHNonSequential",(me=ue||(ue={}))[me.Compressed=0]="Compressed",me[me.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"}(fe||(fe={})),function(t){t[t.Sends=16]="Sends",t[t.DoesNotSend=17]="DoesNotSend"}(le||(le={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(he||(he={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(pe||(pe={})),function(t){t[t.BlockFound=0]="BlockFound",t[t.Extended=1]="Extended"}(de||(de={})),function(t){t[t.PublicKeyCompressed=0]="PublicKeyCompressed",t[t.PublicKeyUncompressed=1]="PublicKeyUncompressed",t[t.SignatureCompressed=2]="SignatureCompressed",t[t.SignatureUncompressed=3]="SignatureUncompressed"}(ye||(ye={})),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"}(ge||(ge={}));const we=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),ve=Uint8Array.from({length:16},(t,e)=>e),xe=ve.map(t=>(9*t+5)%16);let Ee=[ve],Se=[xe];for(let t=0;t<4;t++)for(let e of[Ee,Se])e.push(e[t].map(t=>we[t]));const Ae=[[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)),ke=Ee.map((t,e)=>t.map(t=>Ae[e][t])),_e=Se.map((t,e)=>t.map(t=>Ae[e][t])),Oe=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),je=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),Te=(t,e)=>t<<e|t>>>32-e;function Fe(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 Ce=new Uint32Array(16);class Ie extends R{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)Ce[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,f=0|this.h4,l=f;for(let t=0;t<5;t++){const e=4-t,h=Oe[t],p=je[t],d=Ee[t],y=Se[t],g=ke[t],m=_e[t];for(let e=0;e<16;e++){const r=Te(n+Fe(t,i,s,c)+Ce[d[e]]+h,g[e])+f|0;n=f,f=c,c=0|Te(s,10),s=i,i=r}for(let t=0;t<16;t++){const n=Te(r+Fe(e,o,a,u)+Ce[y[t]]+p,m[t])+l|0;r=l,l=u,u=0|Te(a,10),a=o,o=n}}this.set(this.h1+s+u|0,this.h2+c+l|0,this.h3+f+r|0,this.h4+n+o|0,this.h0+i+a|0)}roundClean(){Ce.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const Ue=$(()=>new Ie),Le=BigInt(2**32-1),Ne=BigInt(32);function Be(t,e=!1){return e?{h:Number(t&Le),l:Number(t>>Ne&Le)}:{h:0|Number(t>>Ne&Le),l:0|Number(t&Le)}}const Pe=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}=Be(t[i],e);[n[i],r[i]]=[o,s]}return[n,r]},$e=(t,e,n)=>t>>>n,He=(t,e,n)=>t<<32-n|e>>>n,De=(t,e,n)=>t>>>n|e<<32-n,Re=(t,e,n)=>t<<32-n|e>>>n,ze=(t,e,n)=>t<<64-n|e>>>n-32,Me=(t,e,n)=>t>>>n-32|e<<64-n,qe=function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},Ve=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),Ke=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,Ge=(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,Je=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,Ze=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0),[Xe,Ye]=Pe(["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))),Qe=new Uint32Array(80),tn=new Uint32Array(80);class en extends R{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:f,Fl:l,Gh:h,Gl:p,Hh:d,Hl:y}=this;return[t,e,n,r,i,o,s,a,c,u,f,l,h,p,d,y]}set(t,e,n,r,i,o,s,a,c,u,f,l,h,p,d,y){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|f,this.Fl=0|l,this.Gh=0|h,this.Gl=0|p,this.Hh=0|d,this.Hl=0|y}process(t,e){for(let n=0;n<16;n++,e+=4)Qe[n]=t.getUint32(e),tn[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Qe[t-15],n=0|tn[t-15],r=De(e,n,1)^De(e,n,8)^$e(e,n,7),i=Re(e,n,1)^Re(e,n,8)^He(e,n,7),o=0|Qe[t-2],s=0|tn[t-2],a=De(o,s,19)^ze(o,s,61)^$e(o,s,6),c=Re(o,s,19)^Me(o,s,61)^He(o,s,6),u=Ge(i,c,tn[t-7],tn[t-16]),f=We(u,r,a,Qe[t-7],Qe[t-16]);Qe[t]=0|f,tn[t]=0|u}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:u,Eh:f,El:l,Fh:h,Fl:p,Gh:d,Gl:y,Hh:g,Hl:m}=this;for(let t=0;t<80;t++){const e=De(f,l,14)^De(f,l,18)^ze(f,l,41),b=Re(f,l,14)^Re(f,l,18)^Me(f,l,41),w=f&h^~f&d,v=Ze(m,b,l&p^~l&y,Ye[t],tn[t]),x=Je(v,g,e,w,Xe[t],Qe[t]),E=0|v,S=De(n,r,28)^ze(n,r,34)^ze(n,r,39),A=Re(n,r,28)^Me(n,r,34)^Me(n,r,39),k=n&i^n&s^i&s,_=r&o^r&a^o&a;g=0|d,m=0|y,d=0|h,y=0|p,h=0|f,p=0|l,({h:f,l}=qe(0|c,0|u,0|x,0|E)),c=0|s,u=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const O=Ve(E,A,_);n=Ke(O,x,S,k),r=0|O}({h:n,l:r}=qe(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=qe(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=qe(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=qe(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l}=qe(0|this.Eh,0|this.El,0|f,0|l)),({h,l:p}=qe(0|this.Fh,0|this.Fl,0|h,0|p)),({h:d,l:y}=qe(0|this.Gh,0|this.Gl,0|d,0|y)),({h:g,l:m}=qe(0|this.Hh,0|this.Hl,0|g,0|m)),this.set(n,r,i,o,s,a,c,u,f,l,h,p,d,y,g,m)}roundClean(){Qe.fill(0),tn.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 nn extends en{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 rn extends en{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 on extends en{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}}$(()=>new en),$(()=>new nn),$(()=>new rn),$(()=>new on),i(290);var sn,an;function cn(t,e="mainnet"){e=g(e),t="string"==typeof t?j(t):t;const n=function(t,e){switch(e=g(e??h),t){case ce.P2PKH:switch(e.transactionVersion){case u.Mainnet:return f.MainnetSingleSig;case u.Testnet:return f.TestnetSingleSig;default:throw new Error(`Unexpected transactionVersion ${e.transactionVersion} for hashMode ${t}`)}case ce.P2SH:case ce.P2SHNonSequential:case ce.P2WPKH:case ce.P2WSH:case ce.P2WSHNonSequential:switch(e.transactionVersion){case u.Mainnet:return f.MainnetMultiSig;case u.Testnet:return f.TestnetMultiSig;default:throw new Error(`Unexpected transactionVersion ${e.transactionVersion} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${t}`)}}(ce.P2PKH,e);var r,i,o;return o=(r=n,i=O(Ue(J(t))),{type:sn.Address,version:r,hash160:i}),(0,ie.bJ)(o.version,o.hash160)}function un(t,e=null){let n;n=e?function(t,e){const n=(0,b.decodeToken)(t),r=n.payload;if("string"==typeof r)throw new Error("Unexpected token payload type of string");if(!r.hasOwnProperty("subject")||!r.subject)throw new Error("Token doesn't have a subject");if(!r.subject.hasOwnProperty("publicKey"))throw new Error("Token doesn't have a subject public key");if(!r.hasOwnProperty("issuer")||!r.issuer)throw new Error("Token doesn't have an issuer");if(!r.issuer.hasOwnProperty("publicKey"))throw new Error("Token doesn't have an issuer public key");if(!r.hasOwnProperty("claim"))throw new Error("Token doesn't have a claim");const i=r.issuer.publicKey,o=cn(i);if(e===i);else if(e!==o)throw new Error("Token issuer public key does not match the verifying value");const s=new b.TokenVerifier(n.header.alg,i);if(!s)throw new Error("Invalid token verifier");if(!s.verify(t))throw new Error("Token verification failed");return n}(t,e):(0,b.decodeToken)(t);let r={};if(n.hasOwnProperty("payload")){const t=n.payload;if("string"==typeof t)throw new Error("Unexpected token payload type of string");t.hasOwnProperty("claim")&&(r=t.claim)}return r}function fn(t,e){let n;return e.proof&&e.proof.url&&(n=e.proof.url),{"@type":"Account",service:t,identifier:e.username,proofType:"http",proofUrl:n}}(an=sn||(sn={}))[an.Address=0]="Address",an[an.Principal=1]="Principal",an[an.LengthPrefixedString=2]="LengthPrefixedString",an[an.MemoString=3]="MemoString",an[an.Asset=4]="Asset",an[an.PostCondition=5]="PostCondition",an[an.PublicKey=6]="PublicKey",an[an.LengthPrefixedList=7]="LengthPrefixedList",an[an.Payload=8]="Payload",an[an.MessageSignature=9]="MessageSignature",an[an.StructuredDataSignature=10]="StructuredDataSignature",an[an.TransactionAuthField=11]="TransactionAuthField",Qt.hmacSha256Sync=(t,...e)=>{const n=D.create(J,t);return e.forEach(t=>n.update(t)),n.digest()};var ln=i(410),hn=i(13);const pn={type:"object",properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"}}};class dn{constructor(t={}){this._profile=Object.assign({},{"@context":"http://schema.org/"},t)}toJSON(){return Object.assign({},this._profile)}toToken(t){return function(t,e,n,r,i="ES256K",o=new Date,s=function(){return new Date((new Date).setFullYear((new Date).getFullYear()+1))}()){if("ES256K"!==i)throw new Error("Signing algorithm not supported");const a=b.SECP256K1Client.derivePublicKey(e);n||(n={publicKey:a}),r||(r={publicKey:a});const c=new b.TokenSigner(i,e),u={jti:A(),iat:o.toISOString(),exp:s.toISOString(),subject:n,issuer:r,claim:t};return c.sign(u)}(this.toJSON(),t)}static validateSchema(t,e=!1){return pn.strict=e,hn.validate(pn,t)}static fromToken(t,e=null){const n=un(t,e);return new dn(n)}static makeZoneFile(t,e){return function(t,e){if(!e.includes("://"))throw new Error("Invalid token file url");const n=e.split("://")[0],r=e.split("://")[1].split("/"),i={$origin:t,$ttl:3600,uri:[{name:"_http._tcp",priority:10,weight:1,target:`${n}://${r[0]}${`/${r.slice(1).join("/")}`}`}]};return(0,ln.makeZoneFile)(i,"{$origin}\n{$ttl}\n{uri}\n")}(t,e)}}const yn={type:"object",strict:!1,properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"},"@id":{type:"string",optional:!0},name:{type:"string",optional:!0},givenName:{type:"string",optional:!0},familyName:{type:"string",optional:!0},description:{type:"string",optional:!0},image:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},name:{type:"string",optional:!0},contentUrl:{type:"string",optional:!0}}}},website:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},url:{type:"string",optional:!0}}}},account:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},service:{type:"string",optional:!0},identifier:{type:"string",optional:!0},proofType:{type:"string",optional:!0},proofUrl:{type:"string",optional:!0},proofMessage:{type:"string",optional:!0},proofSignature:{type:"string",optional:!0}}}},worksFor:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},knows:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},address:{type:"object",optional:!0,properties:{"@type":{type:"string"},streetAddress:{type:"string",optional:!0},addressLocality:{type:"string",optional:!0},postalCode:{type:"string",optional:!0},addressCountry:{type:"string",optional:!0}}},birthDate:{type:"string",optional:!0},taxID:{type:"string",optional:!0}}};class gn extends dn{constructor(t={"@type":"Person"}){super(t),this._profile=Object.assign({},{"@type":"Person"},this._profile)}static validateSchema(t,e=!1){return yn.strict=e,hn.validate(pn,t)}static fromToken(t,e=null){const n=un(t,e);return new gn(n)}static fromLegacyFormat(t){const e=function(t){const e={"@type":"Person"};if(t){t.name&&t.name.formatted&&(e.name=t.name.formatted),t.bio&&(e.description=t.bio),t.location&&t.location.formatted&&(e.address={"@type":"PostalAddress",addressLocality:t.location.formatted});const n=[];t.avatar&&t.avatar.url&&n.push({"@type":"ImageObject",name:"avatar",contentUrl:t.avatar.url}),t.cover&&t.cover.url&&n.push({"@type":"ImageObject",name:"cover",contentUrl:t.cover.url}),n.length&&(e.image=n),t.website&&(e.website=[{"@type":"WebSite",url:t.website}]);const r=[];t.bitcoin&&t.bitcoin.address&&r.push({"@type":"Account",role:"payment",service:"bitcoin",identifier:t.bitcoin.address}),t.twitter&&t.twitter.username&&r.push(fn("twitter",t.twitter)),t.facebook&&t.facebook.username&&r.push(fn("facebook",t.facebook)),t.github&&t.github.username&&r.push(fn("github",t.github)),t.auth&&t.auth.length>0&&t.auth[0]&&t.auth[0].publicKeychain&&r.push({"@type":"Account",role:"key",service:"bip32",identifier:t.auth[0].publicKeychain}),t.pgp&&t.pgp.url&&r.push({"@type":"Account",role:"key",service:"pgp",identifier:t.pgp.fingerprint,contentUrl:t.pgp.url}),e.account=r}return e}(t);return new gn(e)}toJSON(){return{profile:this.profile(),name:this.name(),givenName:this.givenName(),familyName:this.familyName(),description:this.description(),avatarUrl:this.avatarUrl(),verifiedAccounts:this.verifiedAccounts(),address:this.address(),birthDate:this.birthDate(),connections:this.connections(),organizations:this.organizations()}}profile(){return Object.assign({},this._profile)}name(){return function(t){if(!t)return null;let e=null;return t.name?e=t.name:(t.givenName||t.familyName)&&(e="",t.givenName&&(e=t.givenName),t.familyName&&(e+=` ${t.familyName}`)),e}(this.profile())}givenName(){return function(t){if(!t)return null;let e=null;return t.givenName?e=t.givenName:t.name&&(e=t.name.split(" ").slice(0,-1).join(" ")),e}(this.profile())}familyName(){return function(t){if(!t)return null;let e=null;return t.familyName?e=t.familyName:t.name&&(e=t.name.split(" ").pop()),e}(this.profile())}description(){return function(t){if(!t)return null;let e=null;return t.description&&(e=t.description),e}(this.profile())}avatarUrl(){return function(t){if(!t)return null;let e=null;return t.image&&t.image.map(t=>"avatar"===t.name?(e=t.contentUrl,e):null),e}(this.profile())}verifiedAccounts(t){return function(t,e){if(!t)return null;const n=[];return t.hasOwnProperty("account")&&e&&t.account.map(t=>{let r=!1,i=null;return e.map(e=>(e.hasOwnProperty("proof_url")&&(e.proofUrl=e.proof_url),!(!e.valid||e.service!==t.service||e.identifier!==t.identifier||!e.proofUrl||(r=!0,i=e.proofUrl,0)))),r?(t.proofUrl=i,n.push(t),t):null}),n}(this.profile(),t)}address(){return function(t){if(!t)return null;let e=null;if(t.hasOwnProperty("address")){const n=[];t.address.hasOwnProperty("streetAddress")&&n.push(t.address.streetAddress),t.address.hasOwnProperty("addressLocality")&&n.push(t.address.addressLocality),t.address.hasOwnProperty("postalCode")&&n.push(t.address.postalCode),t.address.hasOwnProperty("addressCountry")&&n.push(t.address.addressCountry),n.length&&(e=n.join(", "))}return e}(this.profile())}birthDate(){return function(t){if(!t)return null;const e=["January","February","March","April","May","June","July","August","September","October","November","December"];let n=null;if(t.hasOwnProperty("birthDate")){const r=new Date(t.birthDate);n=`${e[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`}return n}(this.profile())}connections(){return function(t){if(!t)return null;let e=[];return t.hasOwnProperty("knows")&&(e=t.knows),e}(this.profile())}organizations(){return(t=this.profile())?t.hasOwnProperty("worksFor")?t.worksFor:[]:null;var t}}function mn(t){if(!t.username)return Promise.reject(new Error("No username provided"));const e=g(t.network??"mainnet"),n=Object.assign({},m(e),t.client);let r;if(t.zoneFileLookupURL){const e=`${t.zoneFileLookupURL.replace(/\/$/,"")}/${t.username}`;r=n.fetch(e).then(t=>t.json())}else r=function(t){const e=g(t.network??"mainnet"),n=Object.assign({},m(e),t.client),r=`${n.baseUrl}/v1/names/${t.name}`;return n.fetch(r).then(t=>{if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error(`Bad response status: ${t.status}`);return t.json()}).then(t=>t.address?Object.assign({},t,{address:t.address}):t)}({name:t.username});return r.then(t=>{if(t.hasOwnProperty("zonefile")&&t.hasOwnProperty("address"))return function(t){const e=g(t.network??"mainnet"),n=Object.assign({},m(e),t.client);return new Promise((e,r)=>{let i=null;try{i=(0,ln.parseZoneFile)(t.zoneFile),i.hasOwnProperty("$origin")||(i=null)}catch(t){r(t)}let o=null;if(i&&Object.keys(i).length>0)o=function(t){if(!t.hasOwnProperty("uri"))return null;if(!Array.isArray(t.uri))return null;if(t.uri.length<1)return null;const e=t.uri.filter(t=>t.hasOwnProperty("target")&&"_http._tcp"===t.name);if(e.length<1)return null;const n=e[0];if(!n.hasOwnProperty("target"))return null;let r=n.target;return r.startsWith("https")||r.startsWith("http")||(r=`https://${r}`),r}(i);else try{return e(gn.fromLegacyFormat(JSON.parse(t.zoneFile)).profile())}catch(t){return r(t)}o?n.fetch(o).then(t=>t.text()).then(t=>JSON.parse(t)).then(n=>{const r=un(n[0].token,t.publicKeyOrAddress);e(r)}).catch(t=>{E.error(`resolveZoneFileToProfile: error fetching token file ${o}: ${t}`),r(t)}):(E.debug("Token file url not found. Resolving to blank profile."),e({}))})}({zoneFile:t.zonefile,publicKeyOrAddress:t.address,client:n});throw new Error("Invalid zonefile lookup response: did not contain `address` or `zonefile` field")})}const bn={MISSING_PARAMETER:"missing_parameter",REMOTE_SERVICE_ERROR:"remote_service_error",INVALID_STATE:"invalid_state",NO_SESSION_DATA:"no_session_data",DOES_NOT_EXIST:"does_not_exist",FAILED_DECRYPTION_ERROR:"failed_decryption_error",INVALID_DID_ERROR:"invalid_did_error",NOT_ENOUGH_FUNDS_ERROR:"not_enough_error",INVALID_AMOUNT_ERROR:"invalid_amount_error",LOGIN_FAILED_ERROR:"login_failed",SIGNATURE_VERIFICATION_ERROR:"signature_verification_failure",CONFLICT_ERROR:"conflict_error",NOT_ENOUGH_PROOF_ERROR:"not_enough_proof_error",BAD_PATH_ERROR:"bad_path_error",VALIDATION_ERROR:"validation_error",PAYLOAD_TOO_LARGE_ERROR:"payload_too_large_error",PRECONDITION_FAILED_ERROR:"precondition_failed_error",UNKNOWN:"unknown"};Object.freeze(bn);class wn extends Error{constructor(t){super();let e=t.message,n=`Error Code: ${t.code}`,r=this.stack;if(r)n+=`Stack Trace:\n${r}`;else try{throw new Error}catch(t){r=t.stack}e+=`\nIf you believe this exception is caused by a bug in stacks.js,\n please file a bug report: https://github.com/blockstack/stacks.js/issues\n\n${n}`,this.message=e,this.code=t.code,this.parameter=t.parameter?t.parameter:void 0}toString(){return`${super.toString()}\n code: ${this.code} param: ${this.parameter?this.parameter:"n/a"}`}}class vn extends wn{constructor(t){const e=`Failed to verify signature: ${t}`;super({code:bn.SIGNATURE_VERIFICATION_ERROR,message:e}),this.message=e,this.name="SignatureVerificationError"}}class xn extends wn{constructor(t){super({code:bn.INVALID_STATE,message:t}),this.message=t,this.name="InvalidStateError"}}class En extends wn{constructor(t,e){super(t),e&&(this.hubError={statusCode:e.status,statusText:e.statusText},"string"==typeof e.body?this.hubError.message=e.body:"object"==typeof e.body&&Object.assign(this.hubError,e.body))}}class Sn extends En{constructor(t,e){super({message:t,code:bn.DOES_NOT_EXIST},e),this.name="DoesNotExist"}}class An extends En{constructor(t,e){super({message:t,code:bn.CONFLICT_ERROR},e),this.name="ConflictError"}}class kn extends En{constructor(t,e){super({message:t,code:bn.NOT_ENOUGH_PROOF_ERROR},e),this.name="NotEnoughProofError"}}class _n extends En{constructor(t,e){super({message:t,code:bn.BAD_PATH_ERROR},e),this.name="BadPathError"}}class On extends En{constructor(t,e){super({message:t,code:bn.VALIDATION_ERROR},e),this.name="ValidationError"}}class jn extends En{constructor(t,e,n){super({message:t,code:bn.PAYLOAD_TOO_LARGE_ERROR},e),this.name="PayloadTooLargeError",this.maxUploadByteSize=n}}class Tn extends En{constructor(t,e){super({message:t,code:bn.PRECONDITION_FAILED_ERROR},e),this.name="PreconditionFailedError"}}function Fn(t){const e="string"==typeof t?j(t):t;if(32!=e.length&&33!=e.length)throw new Error(`Improperly formatted private-key. Private-key byte length should be 32 or 33. Length provided: ${e.length}`);if(33==e.length&&1!==e[32])throw new Error("Improperly formatted private-key. 33 bytes indicate compressed key, but the last byte must be == 01");return e}var Cn=i(216),In=i.n(Cn);function Un(t){return J(t)}const Ln=0;function Nn(t,e=Ln){var n;return function(t,e){return function(t){const e=J(J(t));return In().encode(F(t,e).slice(0,t.length+4))}(F(new Uint8Array([t]),e.slice(0,20)))}(e,(n=Un("string"==typeof t?j(t):t),Ue(n)))}function Bn(t){return O(function(t,e=!1){return bt.fromPrivateKey(t).toRawBytes(e)}(Fn(t).slice(0,32),!0))}Qt.hmacSha256Sync=(t,...e)=>{const n=D.create(J,t);return e.forEach(t=>n.update(t)),n.digest()};var Pn,$n=i(991);function Hn(t,e,n){return function(t,e,n,r=Zt){let i;try{i=Vt(t),e=It(e)}catch(t){return!1}const{r:o,s}=i;if(r.strict&&i.hasHighS())return!1;const a=Pt(e);let c;try{c=function(t){return t instanceof bt?(t.assertValidity(),t):bt.fromHex(t)}(n)}catch(t){return!1}const{n:u}=rt,f=Bt(s,u),l=Lt(a*f,u),h=Lt(o*f,u),p=bt.BASE.multiplyAndAddUnsafe(c,l,h);return!!p&&Lt(p.x,u)===o}(n,Un("string"==typeof t?T(t):t),e,{strict:!1})}Qt.hmacSha256Sync=(t,...e)=>{const n=D.create(J,t);return e.forEach(t=>n.update(t)),n.digest()},function(t){t.InvalidFormat="InvalidFormat",t.IsNotPoint="IsNotPoint"}(Pn||(Pn={}));const Dn=class t{constructor(e,n){this.wasString="string"==typeof e,this.content=t.normalizeContentDataType(e,n),this.contentType=n||this.detectContentType(),this.contentByteLength=this.detectContentLength()}static normalizeContentDataType(t,e){try{if("string"==typeof t){const n=(e||"").toLowerCase().replace("-","");if(n.includes("charset")&&!n.includes("charset=utf8")&&!n.includes("charset=ascii"))throw new Error(`Unable to determine byte length with charset: ${e}`);if("undefined"!=typeof TextEncoder){const e=(new TextEncoder).encode(t);return new Uint8Array(e.buffer)}return T(t)}if(t instanceof Uint8Array)return t;if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength));if("undefined"!=typeof Blob&&t instanceof Blob)return t;if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return new Uint8Array(t);if(Array.isArray(t)){if(t.length>0&&(!Number.isInteger(t[0])||t[0]<0||t[0]>255))throw new Error(`Unexpected array values provided as file data: value "${t[0]}" at index 0 is not an octet number. ${this.supportedTypesMsg}`);return new Uint8Array(t)}{const e=Object.prototype.toString.call(t);throw new Error(`Unexpected type provided as file data: ${e}. ${this.supportedTypesMsg}`)}}catch(t){throw console.error(t),new Error(`Error processing data: ${t}`)}}detectContentType(){return this.wasString?"text/plain; charset=utf-8":"undefined"!=typeof Blob&&this.content instanceof Blob&&this.content.type?this.content.type:"application/octet-stream"}detectContentLength(){if(ArrayBuffer.isView(this.content)||this.content instanceof Uint8Array)return this.content.byteLength;if("undefined"!=typeof Blob&&this.content instanceof Blob)return this.content.size;const t=Object.prototype.toString.call(this.content),e=new Error(`Unexpected type "${t}" while detecting content length`);throw console.error(e),e}async loadContent(){try{if(this.content instanceof Uint8Array)return this.content;if(ArrayBuffer.isView(this.content))return new Uint8Array(this.content.buffer,this.content.byteOffset,this.content.byteLength);if("undefined"!=typeof Blob&&this.content instanceof Blob){const t=new FileReader,e=new Promise((e,n)=>{t.onerror=t=>{n(t)},t.onload=()=>{const n=t.result;e(new Uint8Array(n))},t.readAsArrayBuffer(this.content)});return await e}{const t=Object.prototype.toString.call(this.content);throw new Error(`Unexpected type ${t}`)}}catch(t){console.error(t);const e=new Error(`Error loading content: ${t}`);throw console.error(e),e}}load(){return void 0===this.loadedData&&(this.loadedData=this.loadContent()),this.loadedData}};Dn.supportedTypesMsg="Supported types are: `string` (to be UTF8 encoded), `Blob`, `File`, `ArrayBuffer`, `UInt8Array` or any other typed array buffer. ";let Rn=Dn;const zn=(t=32)=>Qt.randomBytes(t),Mn="blockstack-gaia-hub-config";async function qn(t,e,n,r="application/octet-stream",i=!0,o,a,c=s()){E.debug(`uploadToGaiaHub: uploading ${t} to ${n.server}`);const u={"Content-Type":r,Authorization:`bearer ${n.token}`};a||(i?u["If-None-Match"]="*":o&&(u["If-Match"]=o));const f=await c(`${n.server}/store/${n.address}/${t}`,{method:"POST",headers:u,body:e});if(!f.ok)throw await Jn(f,"Error when uploading to Gaia hub.",n);const l=await f.text();return JSON.parse(l)}async function Vn(t,e,n=s()){E.debug(`deleteFromGaiaHub: deleting ${t} from ${e.server}`);const r=await n(`${e.server}/delete/${e.address}/${t}`,{method:"DELETE",headers:{Authorization:`bearer ${e.token}`}});if(!r.ok)throw await Jn(r,"Error deleting file from Gaia hub.",e)}function Kn(t,e){return Promise.resolve(`${e.url_prefix}${e.address}/${t}`)}async function Gn(t,n,r,i=s()){E.debug(`connectToGaiaHub: ${t}/hub_info`);const o=await i(`${t}/hub_info`),a=await o.json(),c=a.read_url_prefix,u=function(t,n,r,i){const o=t.challenge_text,s=t.latest_auth_version&&parseInt(t.latest_auth_version.slice(1),10)>=1,a=Bn(n);if(!s)return function(t,n){let r;try{r=JSON.parse(t)}catch(t){throw new Error("Failed in parsing legacy challenge text from the gaia hub.")}if("gaiahub"===r[0]&&"blockstack_storage_please_sign"===r[3]){const r=Jt(Un(T(t)),Fn(n.length===2*e?n:`${n}01`).slice(0,32),{der:!1}),i=xt.fromCompact(O(r)).toDERHex(),o=Bn(n);return(0,$n.fromByteArray)(T(JSON.stringify({publickey:o,signature:i})))}throw new Error("Failed to connect to legacy gaia hub. If you operate this hub, please update.")}(o,n);const c={gaiaChallenge:o,hubUrl:r,iss:a,salt:O(zn(16)),associationToken:i};return`v1:${new b.TokenSigner("ES256K",n).sign(c)}`}(a,n,t,r),f=Nn(Bn(n));return{url_prefix:c,max_file_upload_size_megabytes:a.max_file_upload_size_megabytes,address:f,token:u,server:t}}async function Wn(t,e,n=s()){const r=await n(`${t}/hub_info`),i=await r.text();return`${JSON.parse(i).read_url_prefix}${Nn(Bn(e))}/`}async function Jn(t,e,n){if(t.ok)throw new Error("Cannot get a BlockstackError from a valid response.");const r=await async function(t){let e,n="";try{n=await t.text();try{e=JSON.parse(n)}catch(t){}}catch(t){E.debug(`Error getting bad http response text: ${t}`)}return{status:t.status,statusText:t.statusText,body:e||n}}(t);if(401===r.status)return new On(e,r);if(402===r.status)return new kn(e,r);if(403===r.status)return new _n(e,r);if(404===r.status)throw new Sn(e,r);if(409===r.status)return new An(e,r);if(412===r.status)return new Tn(e,r);if(413===r.status){const t=n&&n.max_file_upload_size_megabytes?S(n.max_file_upload_size_megabytes):0;return new jn(e,r,t)}return new Error(e)}const Zn=".sig";class Xn{constructor(t){this.userSession=t.userSession}async getFile(t,e){const n={decrypt:!0,verify:!1,app:k("location",{returnEmptyObject:!0}).origin},r=Object.assign({},n,e);if(r.verify&&!r.decrypt)return this.getFileSignedUnencrypted(t,r);const i=await this.getFileContents(t,r.app,r.username,r.zoneFileLookupURL,!!r.decrypt);if(null===i)return i;if(r.decrypt&&!r.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");if("string"==typeof r.decrypt){const t={privateKey:r.decrypt};return this.userSession.decryptContent(i,t)}return this.userSession.decryptContent(i)}if(r.decrypt&&r.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");let e;return"string"==typeof r.decrypt&&(e=r.decrypt),this.handleSignedEncryptedContents(t,i,r.app,e,r.username,r.zoneFileLookupURL)}if(r.verify||r.decrypt)throw new Error("Should be unreachable.");return i}async getUserAppFileUrl(t,e,n,r){const i=await mn({username:e,zoneFileLookupURL:r});let o;return i.hasOwnProperty("apps")&&i.apps.hasOwnProperty(n)&&(o=`${i.apps[n].replace(/\/?(\?|#|$)/,"/$1")}${t}`),o}async getGaiaAddress(t,e,n){const r=Qn(this.userSession,{app:t,username:e,zoneFileLookupURL:n});let i;if(e)i=await this.getUserAppFileUrl("/",r.username,r.app,r.zoneFileLookupURL);else{const t=await this.getOrSetLocalGaiaHubConnection();i=await Kn("/",t)}const o=i.match(/([13][a-km-zA-HJ-NP-Z0-9]{26,35})/);if(!o)throw new Error("Failed to parse gaia address");return o[o.length-1]}async getFileUrl(t,e){const n=Qn(this.userSession,e);let r;if(n.username)r=await this.getUserAppFileUrl(t,n.username,n.app,n.zoneFileLookupURL);else{const e=await this.getOrSetLocalGaiaHubConnection();r=await Kn(t,e)}if(r)return r;throw new Error("Missing readURL")}async getFileContents(t,e,n,r,i,o=s()){const a={app:e,username:n,zoneFileLookupURL:r},c=await this.getFileUrl(t,a),u=await o(c);if(!u.ok)throw await Jn(u,`getFile ${t} failed.`,null);let f=u.headers.get("Content-Type");"string"==typeof f&&(f=f.toLowerCase());const l=u.headers.get("ETag");if(l){const e=this.userSession.store.getSessionData();e.etags[t]=l,this.userSession.store.setSessionData(e)}return i||null===f||f.startsWith("text")||f.startsWith("application/json")?u.text():u.arrayBuffer()}async getFileSignedUnencrypted(t,e){const n=`${t}${Zn}`;try{const[r,i,o]=await Promise.all([this.getFileContents(t,e.app,e.username,e.zoneFileLookupURL,!1),this.getFileContents(n,e.app,e.username,e.zoneFileLookupURL,!0),this.getGaiaAddress(e.app,e.username,e.zoneFileLookupURL)]);if(!r)return r;if(!o)throw new vn(`Failed to get gaia address for verification of: ${t}`);if(!i||"string"!=typeof i)throw new vn(`Failed to obtain signature for file: ${t} -- looked in ${t}${Zn}`);let s,a;try{const t=JSON.parse(i);s=t.signature,a=t.publicKey}catch(e){if(e instanceof SyntaxError)throw new Error(`Failed to parse signature content JSON (path: ${t}${Zn}) The content may be corrupted.`);throw e}const c=Nn(a);if(o!==c)throw new vn(`Signer pubkey address (${c}) doesn't match gaia address (${o})`);if(!Hn("string"==typeof r?T(r):new Uint8Array(r),a,s))throw new vn(`Contents do not match ECDSA signature: path: ${t}, signature: ${t}${Zn}`);return r}catch(e){if(e instanceof Sn&&e.message.indexOf(n)>=0)throw new vn(`Failed to obtain signature for file: ${t} -- looked in ${t}${Zn}`);throw e}}async handleSignedEncryptedContents(t,e,n,r,i,o){const s=Bn(r||this.userSession.loadUserData().appPrivateKey),a=i?await this.getGaiaAddress(n,i,o):Nn(s);if(!a)throw new vn(`Failed to get gaia address for verification of: ${t}`);let c;try{c=JSON.parse(e)}catch(t){throw t instanceof SyntaxError?new Error("Failed to parse encrypted, signed content JSON. The content may not be encrypted. If using getFile, try passing { verify: false, decrypt: false }."):t}const u=c.signature,f=c.publicKey,l=c.cipherText,h=Nn(f);if(f&&l&&u){if(h!==a)throw new vn(`Signer pubkey address (${h}) doesn't match gaia address (${a})`);if(Hn(l,f,u)){if("string"==typeof r){const t={privateKey:r};return this.userSession.decryptContent(l,t)}return this.userSession.decryptContent(l)}throw new vn(`Contents do not match ECDSA signature in file: ${t}`)}throw new vn(`Failed to get signature verification data from file: ${t}`)}async putFile(t,e,n){var r,i;const o=Object.assign({},{encrypt:!0,sign:!1,cipherTextEncoding:"hex",dangerouslyIgnoreEtag:!1},n),s=await this.getOrSetLocalGaiaHubConnection(),a=S(s.max_file_upload_size_megabytes),c=a>0,u=new Rn(e,o.contentType);let f,l=u.contentType;if(!o.encrypt&&c&&u.contentByteLength>a){const t=`The max file upload size for this hub is ${a} bytes, the given content is ${u.contentByteLength} bytes`,e=new jn(t,null,a);throw console.error(e),e}if(o.encrypt&&c){const t=function(t){const{payloadShell:e,payloadValuesLength:n}=function(t){const e={iv:"",ephemeralPK:"",mac:"",cipherText:"",wasString:!!t.wasString};return"base64"===t.cipherTextEncoding&&(e.cipherTextEncoding="base64"),{payloadValuesLength:162,payloadShell:JSON.stringify(e)}}(t),r=(i=t.contentLength,16*(Math.floor(i/16)+1));var i;let o;if(t.cipherTextEncoding&&"hex"!==t.cipherTextEncoding){if("base64"!==t.cipherTextEncoding)throw new Error(`Unexpected cipherTextEncoding "${t.cipherTextEncoding}"`);o=function(t){return 4*Math.ceil(t/3)}(r)}else o=2*r;if(t.sign){const{signedPayloadShell:t,signedPayloadValuesLength:r}=function(t){const e={signature:"",publicKey:"",cipherText:t};return{signedPayloadValuesLength:210,signedPayloadShell:JSON.stringify(e)}}(e);return t.length+r+n+o}return e.length+n+o}({contentLength:u.contentByteLength,wasString:u.wasString,sign:!!o.sign,cipherTextEncoding:o.cipherTextEncoding});if(t>a){const e=new jn(`The max file upload size for this hub is ${a} bytes, the given content is ${t} bytes after encryption`,null,a);throw console.error(e),e}}let h=!0;const p=this.userSession.store.getSessionData();let d;if(o.dangerouslyIgnoreEtag||(null==(r=p.etags)?void 0:r[t])&&(h=!1,f=null==(i=p.etags)?void 0:i[t]),!o.encrypt&&o.sign){const e=await u.load();let n;n="string"==typeof o.sign?o.sign:this.userSession.loadUserData().appPrivateKey;const r=function(t,e){const n="string"==typeof e?T(e):e,r=Bn(t);return{signature:O(Jt(Un(n),t)),publicKey:r}}(n,e),i=JSON.stringify(r);d=async n=>{const r=(await Promise.all([qn(t,e,n,l,h,f,o.dangerouslyIgnoreEtag),qn(`${t}${Zn}`,i,n,"application/json")]))[0];return!o.dangerouslyIgnoreEtag&&r.etag&&(p.etags[t]=r.etag,this.userSession.store.setSessionData(p)),r.publicURL}}else{let e;if(o.encrypt||o.sign){let t;t="string"==typeof o.encrypt?o.encrypt:"string"==typeof o.sign?Bn(o.sign):Bn(this.userSession.loadUserData().appPrivateKey);const n=await u.load();e=await this.userSession.encryptContent(n,{publicKey:t,wasString:u.wasString,cipherTextEncoding:o.cipherTextEncoding,sign:o.sign}),l="application/json"}else e=u.content;d=async n=>{const r=await qn(t,e,n,l,h,f,o.dangerouslyIgnoreEtag);return r.etag&&(p.etags[t]=r.etag,this.userSession.store.setSessionData(p)),r.publicURL}}try{return await d(s)}catch(t){if(function(t){if(!t||!t.hubError||!t.hubError.statusCode)return!1;const e=t.hubError.statusCode;return 401===e||(409===e||e>=500&&e<=599)}(t)){console.error(t),console.error("Possible recoverable error during Gaia upload, retrying...");const e=await this.setLocalGaiaHubConnection();return await d(e)}throw t}}async deleteFile(t,e){const n=await this.getOrSetLocalGaiaHubConnection();if(Object.assign({},e).wasSigned)try{await Vn(t,n),await Vn(`${t}${Zn}`,n);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const r=await this.setLocalGaiaHubConnection();await Vn(t,r),await Vn(`${t}${Zn}`,n);const i=this.userSession.store.getSessionData();delete i.etags[t],this.userSession.store.setSessionData(i)}else try{await Vn(t,n);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const n=await this.setLocalGaiaHubConnection();await Vn(t,n);const r=this.userSession.store.getSessionData();delete r.etags[t],this.userSession.store.setSessionData(r)}}getAppBucketUrl(t,e){return Wn(t,e)}async listFilesLoop(t,e,n,r,i,o=s()){if(n>65536)throw new Error("Too many entries to list");let a;t=t||await this.getOrSetLocalGaiaHubConnection();try{const n=JSON.stringify({page:e}),r={method:"POST",headers:{"Content-Type":"application/json","Content-Length":`${n.length}`,Authorization:`bearer ${t.token}`},body:n};if(a=await o(`${t.server}/list-files/${t.address}`,r),!a.ok)throw await Jn(a,"ListFiles failed.",t)}catch(t){if(0===n){const t=await this.setLocalGaiaHubConnection();return this.listFilesLoop(t,e,n+1,0,i)}throw t}const c=await a.text(),u=JSON.parse(c),f=u.entries,l=u.page;if(null==f)throw new Error("Bad listFiles response: no entries");let h=0;for(let t=0;t<f.length;t++)if(null!==f[t]&&(h++,!i(f[t])))return r+t;return l&&f.length>0?this.listFilesLoop(t,l,n+1,r+h,i):r+h}listFiles(t){return this.listFilesLoop(null,null,0,0,t)}async getOrSetLocalGaiaHubConnection(){const t=this.userSession.store.getSessionData().userData;if(!t)throw new xn("Missing userData");const e=t.gaiaHubConfig;return e?Promise.resolve(e):this.setLocalGaiaHubConnection()}async setLocalGaiaHubConnection(){const t=this.userSession.loadUserData();if(!t)throw new xn("Missing userData");t.hubUrl||(t.hubUrl="https://hub.blockstack.org");const e=await Gn(t.hubUrl,t.appPrivateKey,t.gaiaAssociationToken);t.gaiaHubConfig=e;const n=this.userSession.store.getSessionData();return n.userData.gaiaHubConfig=e,this.userSession.store.setSessionData(n),e}}function Yn(t){return new Xn({}).getUserAppFileUrl(t.path,t.username,t.appOrigin,t.zoneFileLookupURL)}function Qn(t,e){var n;const r=Object.assign({},e);if(r.username){if(!r.app){if(!t.appConfig)throw new xn("Missing AppConfig");r.app=t.appConfig.appDomain}if(!r.zoneFileLookupURL){if(!t.appConfig)throw new xn("Missing AppConfig");if(!t.store)throw new xn("Missing store UserSession");const e=(null==(n=t.store.getSessionData().userData)?void 0:n.coreNode)||t.appConfig.coreNode;e&&(r.zoneFileLookupURL=`${e}/v1/names`)}}return r}})(),o})());
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksStorage=e():t.StacksStorage=e()}(this,()=>(()=>{var t,e,n={13:(t,e,n)=>{t.exports=n(790)},28:()=>{},70:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SECP256K1Client=void 0;const r=n(500),i=n(688),o=n(261),s=n(599),a=n(87),c=n(74);o.utils.hmacSha256Sync=(t,...e)=>{const n=r.hmac.create(i.sha256,t);return e.forEach(t=>n.update(t)),n.digest()};class u{static derivePublicKey(t,e=!0){return 66===t.length&&(t=t.slice(0,64)),t.length<64&&(t=t.padStart(64,"0")),(0,c.bytesToHex)(o.getPublicKey(t,e))}static signHash(t,e,n="jose"){if(!t||!e)throw new a.MissingParametersError("a signing input hash and private key are all required");const r=o.signSync(t,e.slice(0,64),{der:!0,canonical:!1});if("der"===n)return(0,c.bytesToHex)(r);if("jose"===n)return(0,s.derToJose)(r,"ES256");throw Error("Invalid signature format")}static loadSignature(t){return(0,s.joseToDer)(t,"ES256")}static verifyHash(t,e,n){if(!t||!e||!n)throw new a.MissingParametersError("a signing input hash, der signature, and public key are all required");return o.verify(e,t,n,{strict:!1})}}e.SECP256K1Client=u,u.algorithmName="ES256K"},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")}},87:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InvalidTokenError=e.MissingParametersError=void 0;class n extends Error{constructor(t){super(),this.name="MissingParametersError",this.message=t||""}}e.MissingParametersError=n;class r extends Error{constructor(t){super(),this.name="InvalidTokenError",this.message=t||""}}e.InvalidTokenError=r},118:(t,e)=>{"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t){if(t){if("string"==typeof t)return n(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}function i(t,e){return void 0===e&&(e="{$origin}\n{$ttl}\n\n; SOA Record\n{name} {ttl} IN SOA {mname}{rname}(\n{serial} ;serial\n{refresh} ;refresh\n{retry} ;retry\n{expire} ;expire\n{minimum} ;minimum ttl\n)\n\n; NS Records\n{ns}\n\n; MX Records\n{mx}\n\n; A Records\n{a}\n\n; AAAA Records\n{aaaa}\n\n; CNAME Records\n{cname}\n\n; PTR Records\n{ptr}\n\n; TXT Records\n{txt}\n\n; SRV Records\n{srv}\n\n; SPF Records\n{spf}\n\n; URI Records\n{uri}\n"),e=function(t,e){var n="";return void 0!==t&&(n+="$ORIGIN "+t),e.replace("{$origin}",n)}(t.$origin,e),e=function(t,e){var n="";return void 0!==t&&(n+="$TTL "+t),e.replace("{$ttl}",n)}(t.$ttl,e),e=function(t,e){var n=e;if(void 0!==t)for(var r in t.name=t.name||"@",t.ttl=t.ttl||"",t)n=n.replace("{"+r+"}",t[r]+"\t");return n}(t.soa,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tNS\t"+s.host+"\n"}return e.replace("{ns}",n)}(t.ns,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tA\t"+s.ip+"\n"}return e.replace("{a}",n)}(t.a,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tAAAA\t"+s.ip+"\n"}return e.replace("{aaaa}",n)}(t.aaaa,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tCNAME\t"+s.alias+"\n"}return e.replace("{cname}",n)}(t.cname,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tMX\t"+s.preference+"\t"+s.host+"\n"}return e.replace("{mx}",n)}(t.mx,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tPTR\t"+s.host+"\n"}return e.replace("{ptr}",n)}(t.ptr,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tTXT\t";var a=s.txt;"string"==typeof a?n+='"'+a+'"':a instanceof Array&&(n+=a.map(function(t){return'"'+t+'"'}).join(" ")),n+="\n"}return e.replace("{txt}",n)}(t.txt,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tSRV\t"+s.priority+"\t",n+=s.weight+"\t",n+=s.port+"\t",n+=s.target+"\n"}return e.replace("{srv}",n)}(t.srv,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tSPF\t"+s.data+"\n"}return e.replace("{spf}",n)}(t.spf,e),(e=function(t,e){e=(e=e.replace("{zone}",t.$origin||!!t.soa&&t.soa.name||"")).replace("{datetime}",(new Date).toISOString());var n=Math.round(Date.now()/1e3);return e.replace("{time}",""+n)}(t,e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tURI\t"+s.priority+"\t",n+=s.weight+"\t",n+='"'+s.target+'"\n'}return e.replace("{uri}",n)}(t.uri,e))).replace(/\n{2,}/gim,"\n\n")}function o(t){return function(t){for(var e,n={},i=r(t.split("\n"));!(e=i()).done;){var o=e.value;if(o&&o.trim()){var m=o.toUpperCase();/\s+TXT\s+/.test(m)?(n.txt=n.txt||[],n.txt.push(h(o))):0===m.indexOf("$ORIGIN")?n.$origin=o.split(/\s+/g)[1]:0===m.indexOf("$TTL")?n.$ttl=parseInt(o.split(/\s+/g)[1],10):/\s+SOA\s+/.test(m)?n.soa=s(o):/\s+NS\s+/.test(m)?(n.ns=n.ns||[],n.ns.push(a(o))):/\s+A\s+/.test(m)?(n.a=n.a||[],n.a.push(c(o,n.a))):/\s+AAAA\s+/.test(m)?(n.aaaa=n.aaaa||[],n.aaaa.push(u(o))):/\s+CNAME\s+/.test(m)?(n.cname=n.cname||[],n.cname.push(f(o))):/\s+MX\s+/.test(m)?(n.mx=n.mx||[],n.mx.push(l(o))):/\s+PTR\s+/.test(m)?(n.ptr=n.ptr||[],n.ptr.push(p(o,n.ptr,n.$origin))):/\s+SRV\s+/.test(m)?(n.srv=n.srv||[],n.srv.push(d(o))):/\s+SPF\s+/.test(m)?(n.spf=n.spf||[],n.spf.push(y(o))):/\s+URI\s+/.test(m)&&(n.uri=n.uri||[],n.uri.push(g(o)))}}return n}(t=function(t){for(var e=[],n=/\([\s\S]*?\)/gim,r=n.exec(t);null!==r;){var i=r[0].replace(/\s+/gm," ");e.push({match:r,replacement:i}),r=n.exec(t)}for(var o=t.split(""),s=0,a=e;s<a.length;s++){var c=a[s],u=c.match;o.splice(u.index,u[0].length,c.replacement)}return o.join("").replace(/\(|\)/gim," ")}(t=function(t){return t.replace(/(^|[^\\]);.*/g,function(t,e){return e||""})}(t)))}function s(t){var e={},n=t.trim().split(/\s+/g),r=n.length;return e.name=n[0],e.minimum=parseInt(n[r-1],10),e.expire=parseInt(n[r-2],10),e.retry=parseInt(n[r-3],10),e.refresh=parseInt(n[r-4],10),e.serial=parseInt(n[r-5],10),e.rname=n[r-6],e.mname=n[r-7],isNaN(n[1])||(e.ttl=parseInt(n[1],10)),e}function a(t){var e=t.trim().split(/\s+/g),n={name:e[0],host:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function c(t,e){var n=t.trim().split(/\s+/g),r=t.trim().toUpperCase().split(/\s+/g),i={name:n[0],ip:n[n.length-1]};return 0===r.lastIndexOf("A")&&(i.name=e.length?e[e.length-1].name:"@"),isNaN(n[1])||(i.ttl=parseInt(n[1],10)),i}function u(t){var e=t.trim().split(/\s+/g),n={name:e[0],ip:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function f(t){var e=t.trim().split(/\s+/g),n={name:e[0],alias:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function l(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],preference:parseInt(e[n-2],10),host:e[n-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function h(t){var e=t.trim().match(/[^\s"']+|"[^"]*"|'[^']*'/g);if(!e)throw new Error("Failure to tokenize TXT record");var n,r=e.length,i=e.indexOf("TXT");function o(t){return t.indexOf('"')>-1&&(t=t.split('"')[1]),t}n=r-i-1>1?[].concat(e.slice(i+1).map(o)):o(e[r-1]);var s={name:e[0],txt:n};return isNaN(e[1])||(s.ttl=parseInt(e[1],10)),s}function p(t,e,n){var r=t.trim().split(/\s+/g);0===t.trim().toUpperCase().split(/\s+/g).lastIndexOf("PTR")&&e[e.length-1]&&r.unshift(e[e.length-1].name);var i={name:r[0],fullname:r[0]+"."+n,host:r[r.length-1]};return isNaN(r[1])||(i.ttl=parseInt(r[1],10)),i}function d(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],target:e[n-1],priority:parseInt(e[n-4],10),weight:parseInt(e[n-3],10),port:parseInt(e[n-2],10)};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function y(t){for(var e=t.trim().split(/\s+/g),n={name:e[0],data:""},r=e.length;r-- >4;)n.data=e[r]+" "+n.data.trim();return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function g(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],target:e[n-1].replace(/"/g,""),priority:parseInt(e[n-3],10),weight:parseInt(e[n-2],10)};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}(function(){var t=function(t){this.jsonZoneFile="object"==typeof t?JSON.parse(JSON.stringify(t)):"string"==typeof t?o(t):void 0}.prototype;t.toJSON=function(){return this.jsonZoneFile},t.toString=function(){return i(this.toJSON())}})(),e.makeZoneFile=i,e.parseZoneFile=o},165:(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 f=u/4,l=this.get();if(f>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<f;t++)c.setUint32(4*t,l[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},211:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256Async=e.hashSha256=void 0;const i=n(688);function o(t){return(0,i.sha256)(t)}e.hashSha256=o,e.hashSha256Async=function(t){return r(this,void 0,void 0,function*(){try{if("undefined"!=typeof crypto&&void 0!==crypto.subtle){const e="string"==typeof t?(new TextEncoder).encode(t):t,n=yield crypto.subtle.digest("SHA-256",e);return new Uint8Array(n)}{const e=n(951);if(!e.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(e.createHash("sha256").update(t).digest())}}catch(e){return console.log(e),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(o(t))}})}},216:(t,e,n)=>{const r=n(403);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},258:(t,e,n)=>{"use strict";e.bJ=void 0;n(669),n(639);const r=n(877);Object.defineProperty(e,"bJ",{enumerable:!0,get:function(){return r.c32address}})},261:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.schnorr=e.verify=e.signSync=e.sign=e.getSharedSecret=e.recoverPublicKey=e.getPublicKey=e.Signature=e.Point=e.CURVE=void 0;const r=n(28),i=BigInt(0),o=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(8),u=Object.freeze({a:i,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});e.CURVE=u;const f=(t,e)=>(t+e/s)/e,l={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=u,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,a=BigInt("0x100000000000000000000000000000000"),c=f(s*t,e),l=f(-r*t,e);let h=N(t-c*n-l*i,e),p=N(-c*r-l*s,e);const d=h>a,y=p>a;if(d&&(h=e-h),y&&(p=e-p),h>a||p>a)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:d,k1:h,k2neg:y,k2:p}}};function h(t){const{a:e,b:n}=u,r=N(t*t),i=N(r*t);return N(i+e*t+n)}const p=u.a===i;class d extends Error{constructor(t){super(t)}}function y(t){if(!(t instanceof g))throw new TypeError("JacobianPoint expected")}class g{constructor(t,e,n){this.x=t,this.y=e,this.z=n}static fromAffine(t){if(!(t instanceof w))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(w.ZERO)?g.ZERO:new g(t.x,t.y,o)}static toAffineBatch(t){const e=function(t,e=u.P){const n=new Array(t.length),r=P(t.reduce((t,r,o)=>r===i?t:(n[o]=t,N(t*r,e)),o),e);return t.reduceRight((t,r,o)=>r===i?t:(n[o]=N(t*n[o],e),N(t*r,e)),r),n}(t.map(t=>t.z));return t.map((t,n)=>t.toAffine(e[n]))}static normalizeZ(t){return g.toAffineBatch(t).map(g.fromAffine)}equals(t){y(t);const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t,a=N(r*r),c=N(s*s),u=N(e*c),f=N(i*a),l=N(N(n*s)*c),h=N(N(o*r)*a);return u===f&&l===h}negate(){return new g(this.x,N(-this.y),this.z)}double(){const{x:t,y:e,z:n}=this,r=N(t*t),i=N(e*e),o=N(i*i),u=t+i,f=N(s*(N(u*u)-r-o)),l=N(a*r),h=N(l*l),p=N(h-s*f),d=N(l*(f-p)-c*o),y=N(s*e*n);return new g(p,d,y)}add(t){y(t);const{x:e,y:n,z:r}=this,{x:o,y:a,z:c}=t;if(o===i||a===i)return this;if(e===i||n===i)return t;const u=N(r*r),f=N(c*c),l=N(e*f),h=N(o*u),p=N(N(n*c)*f),d=N(N(a*r)*u),m=N(h-l),b=N(d-p);if(m===i)return b===i?this.double():g.ZERO;const w=N(m*m),v=N(m*w),x=N(l*w),E=N(b*b-v-s*x),S=N(b*(x-E)-p*v),A=N(r*c*m);return new g(E,S,A)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=g.ZERO;if("bigint"==typeof t&&t===i)return e;let n=L(t);if(n===o)return this;if(!p){let t=e,r=this;for(;n>i;)n&o&&(t=t.add(r)),r=r.double(),n>>=o;return t}let{k1neg:r,k1:s,k2neg:a,k2:c}=l.splitScalar(n),u=e,f=e,h=this;for(;s>i||c>i;)s&o&&(u=u.add(h)),c&o&&(f=f.add(h)),h=h.double(),s>>=o,c>>=o;return r&&(u=u.negate()),a&&(f=f.negate()),f=new g(N(f.x*l.beta),f.y,f.z),u.add(f)}precomputeWindow(t){const e=p?128/t+1:256/t+1,n=[];let r=this,i=r;for(let o=0;o<e;o++){i=r,n.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(t,e){!e&&this.equals(g.BASE)&&(e=w.BASE);const n=e&&e._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=e&&b.get(e);r||(r=this.precomputeWindow(n),e&&1!==n&&(r=g.normalizeZ(r),b.set(e,r)));let i=g.ZERO,s=g.BASE;const a=1+(p?128/n:256/n),c=2**(n-1),u=BigInt(2**n-1),f=2**n,l=BigInt(n);for(let e=0;e<a;e++){const n=e*c;let a=Number(t&u);t>>=l,a>c&&(a-=f,t+=o);const h=n,p=n+Math.abs(a)-1,d=e%2!=0,y=a<0;0===a?s=s.add(m(d,r[h])):i=i.add(m(y,r[p]))}return{p:i,f:s}}multiply(t,e){let n,r,i=L(t);if(p){const{k1neg:t,k1:o,k2neg:s,k2:a}=l.splitScalar(i);let{p:c,f:u}=this.wNAF(o,e),{p:f,f:h}=this.wNAF(a,e);c=m(t,c),f=m(s,f),f=new g(N(f.x*l.beta),f.y,f.z),n=c.add(f),r=u.add(h)}else{const{p:t,f:o}=this.wNAF(i,e);n=t,r=o}return g.normalizeZ([n,r])[0]}toAffine(t){const{x:e,y:n,z:r}=this,i=this.equals(g.ZERO);null==t&&(t=i?c:P(r));const s=t,a=N(s*s),u=N(a*s),f=N(e*a),l=N(n*u),h=N(r*s);if(i)return w.ZERO;if(h!==o)throw new Error("invZ was invalid");return new w(f,l)}}function m(t,e){const n=e.negate();return t?n:e}g.BASE=new g(u.Gx,u.Gy,o),g.ZERO=new g(i,o,i);const b=new WeakMap;class w{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,b.delete(this)}hasEvenY(){return this.y%s===i}static fromCompressedHex(t){const e=32===t.length,n=I(e?t:t.subarray(1));if(!M(n))throw new Error("Point is not on curve");let r=function(t){const{P:e}=u,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),c=BigInt(44),f=BigInt(88),l=t*t*t%e,h=l*l*t%e,p=B(h,a)*h%e,d=B(p,a)*h%e,y=B(d,s)*l%e,g=B(y,r)*y%e,m=B(g,i)*g%e,b=B(m,c)*m%e,w=B(b,f)*b%e,v=B(w,c)*m%e,x=B(v,a)*h%e,E=B(x,o)*g%e,S=B(E,n)*l%e,A=B(S,s);if(A*A%e!==t)throw new Error("Cannot find square root");return A}(h(n));const i=(r&o)===o;e?i&&(r=N(-r)):!(1&~t[0])!==i&&(r=N(-r));const c=new w(n,r);return c.assertValidity(),c}static fromUncompressedHex(t){const e=I(t.subarray(1,33)),n=I(t.subarray(33,65)),r=new w(e,n);return r.assertValidity(),r}static fromHex(t){const e=U(t),n=e.length,r=e[0];if(32===n)return this.fromCompressedHex(e);if(33===n&&(2===r||3===r))return this.fromCompressedHex(e);if(65===n&&4===r)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${n}`)}static fromPrivateKey(t){return w.BASE.multiply(V(t))}static fromSignature(t,e,n){const{r,s:i}=G(e);if(![0,1,2,3].includes(n))throw new Error("Cannot recover: invalid recovery bit");const o=$(U(t)),{n:s}=u,a=2===n||3===n?r+s:r,c=P(a,s),f=N(-o*c,s),l=N(i*c,s),h=1&n?"03":"02",p=w.fromHex(h+O(a)),d=w.BASE.multiplyAndAddUnsafe(p,f,l);if(!d)throw new Error("Cannot recover signature: point at infinify");return d.assertValidity(),d}toRawBytes(t=!1){return C(this.toHex(t))}toHex(t=!1){const e=O(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${O(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:n}=this;if(!M(e)||!M(n))throw new Error(t);const r=N(n*n);if(N(r-h(e))!==i)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new w(this.x,N(-this.y))}double(){return g.fromAffine(this).double().toAffine()}add(t){return g.fromAffine(this).add(g.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return g.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,n){const r=g.fromAffine(this),s=e===i||e===o||this!==w.BASE?r.multiplyUnsafe(e):r.multiply(e),a=g.fromAffine(t).multiplyUnsafe(n),c=s.add(a);return c.equals(g.ZERO)?void 0:c.toAffine()}}function v(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function x(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${k(t)}`);const e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:I(n),left:t.subarray(e+2)}}e.Point=w,w.BASE=new w(u.Gx,u.Gy),w.ZERO=new w(i,i);class E{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,n="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${n}: Expected string or Uint8Array`);const r=e?k(t):t;if(128!==r.length)throw new Error(`${n}: Expected 64-byte hex`);return new E(F(r.slice(0,64)),F(r.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:n,s:r}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${k(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:n}=x(t.subarray(2)),{data:r,left:i}=x(n);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${k(i)}`);return{r:e,s:r}}(e?t:C(t));return new E(n,r)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!z(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!z(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=u.n>>o;return this.s>t}normalizeS(){return this.hasHighS()?new E(this.r,N(-this.s,u.n)):this}toDERRawBytes(){return C(this.toDERHex())}toDERHex(){const t=v(T(this.s)),e=v(T(this.r)),n=t.length/2,r=e.length/2,i=T(n),o=T(r);return`30${T(r+n+4)}02${o}${e}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return C(this.toCompactHex())}toCompactHex(){return O(this.r)+O(this.s)}}function S(...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.Signature=E;const A=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function k(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let n=0;n<t.length;n++)e+=A[t[n]];return e}const _=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function O(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(i<=t&&t<_))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function j(t){const e=C(O(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function T(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function F(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function C(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"+t.length);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 I(t){return F(k(t))}function U(t){return t instanceof Uint8Array?Uint8Array.from(t):C(t)}function L(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&z(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function N(t,e=u.P){const n=t%e;return n>=i?n:e+n}function B(t,e){const{P:n}=u;let r=t;for(;e-- >i;)r*=r,r%=n;return r}function P(t,e=u.P){if(t===i||e<=i)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=N(t,e),r=e,s=i,a=o,c=o,f=i;for(;n!==i;){const t=r/n,e=r%n,i=s-c*t,o=a-f*t;r=n,n=e,s=c,a=f,c=i,f=o}if(r!==o)throw new Error("invert: does not exist");return N(s,e)}function $(t,e=!1){const n=function(t){const e=8*t.length-256,n=I(t);return e>0?n>>BigInt(e):n}(t);if(e)return n;const{n:r}=u;return n>=r?n-r:n}let H,D;class R{constructor(t,e){if(this.hashLen=t,this.qByteLen=e,"number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}hmac(...t){return e.utils.hmacSha256(this.k,...t)}hmacSync(...t){return D(this.k,...t)}checkSync(){if("function"!=typeof D)throw new d("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=await this.hmac(this.v);const n=this.v.slice();e.push(n),t+=this.v.length}return S(...e)}generateSync(){this.checkSync(),this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=this.hmacSync(this.v);const n=this.v.slice();e.push(n),t+=this.v.length}return S(...e)}}function z(t){return i<t&&t<u.n}function M(t){return i<t&&t<u.P}function q(t,e,n,r=!0){const{n:s}=u,a=$(t,!0);if(!z(a))return;const c=P(a,s),f=w.BASE.multiply(a),l=N(f.x,s);if(l===i)return;const h=N(c*N(e+n*l,s),s);if(h===i)return;let p=new E(l,h),d=(f.x===p.r?0:2)|Number(f.y&o);return r&&p.hasHighS()&&(p=p.normalizeS(),d^=1),{sig:p,recovery:d}}function V(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=F(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=I(t)}if(!z(e))throw new Error("Expected private key: 0 < key < n");return e}function K(t){return t instanceof w?(t.assertValidity(),t):w.fromHex(t)}function G(t){if(t instanceof E)return t.assertValidity(),t;try{return E.fromDER(t)}catch(e){return E.fromCompact(t)}}function W(t){const e=t instanceof Uint8Array,n="string"==typeof t,r=(e||n)&&t.length;return e?33===r||65===r:n?66===r||130===r:t instanceof w}function J(t){return I(t.length>32?t.slice(0,32):t)}function Z(t){const e=J(t),n=N(e,u.n);return X(n<i?e:n)}function X(t){return j(t)}function Y(t,n,r){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const i=U(t),o=V(n),s=[X(o),Z(i)];if(null!=r){!0===r&&(r=e.utils.randomBytes(32));const t=U(r);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");s.push(t)}return{seed:S(...s),m:J(i),d:o}}function Q(t,e){const{sig:n,recovery:r}=t,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},e),s=i?n.toDERRawBytes():n.toCompactRawBytes();return o?[s,r]:s}e.getPublicKey=function(t,e=!1){return w.fromPrivateKey(t).toRawBytes(e)},e.recoverPublicKey=function(t,e,n,r=!1){return w.fromSignature(t,e,n).toRawBytes(r)},e.getSharedSecret=function(t,e,n=!1){if(W(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!W(e))throw new TypeError("getSharedSecret: second arg must be public key");const r=K(e);return r.assertValidity(),r.multiply(V(t)).toRawBytes(n)},e.sign=async function(t,e,n={}){const{seed:r,m:i,d:o}=Y(t,e,n.extraEntropy),s=new R(32,32);let a;for(await s.reseed(r);!(a=q(await s.generate(),i,o,n.canonical));)await s.reseed();return Q(a,n)},e.signSync=function(t,e,n={}){const{seed:r,m:i,d:o}=Y(t,e,n.extraEntropy),s=new R(32,32);let a;for(s.reseedSync(r);!(a=q(s.generateSync(),i,o,n.canonical));)s.reseedSync();return Q(a,n)};const tt={strict:!0};function et(t){return N(I(t),u.n)}e.verify=function(t,e,n,r=tt){let i;try{i=G(t),e=U(e)}catch(t){return!1}const{r:o,s}=i;if(r.strict&&i.hasHighS())return!1;const a=$(e);let c;try{c=K(n)}catch(t){return!1}const{n:f}=u,l=P(s,f),h=N(a*l,f),p=N(o*l,f),d=w.BASE.multiplyAndAddUnsafe(c,h,p);return!!d&&N(d.x,f)===o};class nt{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=U(t);if(64!==e.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${e.length}`);const n=I(e.subarray(0,32)),r=I(e.subarray(32,64));return new nt(n,r)}assertValidity(){const{r:t,s:e}=this;if(!M(t)||!z(e))throw new Error("Invalid signature")}toHex(){return O(this.r)+O(this.s)}toRawBytes(){return C(this.toHex())}}class rt{constructor(t,n,r=e.utils.randomBytes()){if(null==t)throw new TypeError(`sign: Expected valid message, not "${t}"`);this.m=U(t);const{x:i,scalar:o}=this.getScalar(V(n));if(this.px=i,this.d=o,this.rand=U(r),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(t){const e=w.fromPrivateKey(t),n=e.hasEvenY()?t:u.n-t;return{point:e,scalar:n,x:e.toRawX()}}initNonce(t,e){return j(t^I(e))}finalizeNonce(t){const e=N(I(t),u.n);if(e===i)throw new Error("sign: Creation of signature failed. k is zero");const{point:n,x:r,scalar:o}=this.getScalar(e);return{R:n,rx:r,k:o}}finalizeSig(t,e,n,r){return new nt(t.x,N(e+n*r,u.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}async calc(){const{m:t,d:n,px:r,rand:i}=this,o=e.utils.taggedHash,s=this.initNonce(n,await o(ut.aux,i)),{R:a,rx:c,k:u}=this.finalizeNonce(await o(ut.nonce,s,r,t)),f=et(await o(ut.challenge,c,r,t)),l=this.finalizeSig(a,u,f,n);return await st(l,t,r)||this.error(),l}calcSync(){const{m:t,d:n,px:r,rand:i}=this,o=e.utils.taggedHashSync,s=this.initNonce(n,o(ut.aux,i)),{R:a,rx:c,k:u}=this.finalizeNonce(o(ut.nonce,s,r,t)),f=et(o(ut.challenge,c,r,t)),l=this.finalizeSig(a,u,f,n);return at(l,t,r)||this.error(),l}}function it(t,e,n){const r=t instanceof nt,i=r?t:nt.fromHex(t);return r&&i.assertValidity(),{...i,m:U(e),P:K(n)}}function ot(t,e,n,r){const i=w.BASE.multiplyAndAddUnsafe(e,V(n),N(-r,u.n));return!(!i||!i.hasEvenY()||i.x!==t)}async function st(t,n,r){try{const{r:i,s:o,m:s,P:a}=it(t,n,r),c=et(await e.utils.taggedHash(ut.challenge,j(i),a.toRawX(),s));return ot(i,a,o,c)}catch(t){return!1}}function at(t,n,r){try{const{r:i,s:o,m:s,P:a}=it(t,n,r),c=et(e.utils.taggedHashSync(ut.challenge,j(i),a.toRawX(),s));return ot(i,a,o,c)}catch(t){if(t instanceof d)throw t;return!1}}e.schnorr={Signature:nt,getPublicKey:function(t){return w.fromPrivateKey(t).toRawX()},sign:async function(t,e,n){return new rt(t,e,n).calc()},verify:st,signSync:function(t,e,n){return new rt(t,e,n).calcSync()},verifySync:at},w.BASE._setWindowSize(8);const ct={node:r,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},ut={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},ft={};e.utils={bytesToHex:k,hexToBytes:C,concatBytes:S,mod:N,invert:P,isValidPrivateKey(t){try{return V(t),!0}catch(t){return!1}},_bigintTo32Bytes:j,_normalizePrivateKey:V,hashToPrivateKey:t=>{if((t=U(t)).length<40||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return j(N(I(t),u.n-o)+o)},randomBytes:(t=32)=>{if(ct.web)return ct.web.getRandomValues(new Uint8Array(t));if(ct.node){const{randomBytes:e}=ct.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>e.utils.hashToPrivateKey(e.utils.randomBytes(40)),precompute(t=8,e=w.BASE){const n=e===w.BASE?e:new w(e.x,e.y);return n._setWindowSize(t),n.multiply(a),n},sha256:async(...t)=>{if(ct.web){const e=await ct.web.subtle.digest("SHA-256",S(...t));return new Uint8Array(e)}if(ct.node){const{createHash:e}=ct.node,n=e("sha256");return t.forEach(t=>n.update(t)),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(ct.web){const n=await ct.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=S(...e),i=await ct.web.subtle.sign("HMAC",n,r);return new Uint8Array(i)}if(ct.node){const{createHmac:n}=ct.node,r=n("sha256",t);return e.forEach(t=>r.update(t)),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...n)=>{let r=ft[t];if(void 0===r){const n=await e.utils.sha256(Uint8Array.from(t,t=>t.charCodeAt(0)));r=S(n,n),ft[t]=r}return e.utils.sha256(r,...n)},taggedHashSync:(t,...e)=>{if("function"!=typeof H)throw new d("sha256Sync is undefined, you need to set it");let n=ft[t];if(void 0===n){const e=H(Uint8Array.from(t,t=>t.charCodeAt(0)));n=S(e,e),ft[t]=n}return H(n,...e)},_JacobianPoint:g},Object.defineProperties(e.utils,{sha256Sync:{configurable:!1,get:()=>H,set(t){H||(H=t)}},hmacSha256Sync:{configurable:!1,get:()=>D,set(t){D||(D=t)}}})},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]",f="[object Map]",l="[object Number]",h="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",m="[object Symbol]",b="[object WeakMap]",w="[object ArrayBuffer]",v="[object DataView]",x="[object Float32Array]",E="[object Float64Array]",S="[object Int8Array]",A="[object Int16Array]",k="[object Int32Array]",_="[object Uint8Array]",O="[object Uint8ClampedArray]",j="[object Uint16Array]",T="[object Uint32Array]",F=/\w*$/,C=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,U={};U[o]=U["[object Array]"]=U[w]=U[v]=U[s]=U[a]=U[x]=U[E]=U[S]=U[A]=U[k]=U[f]=U[l]=U[h]=U[d]=U[y]=U[g]=U[m]=U[_]=U[O]=U[j]=U[T]=!0,U["[object Error]"]=U[c]=U[b]=!1;var L="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,N="object"==typeof self&&self&&self.Object===Object&&self,B=L||N||Function("return this")(),P=e&&!e.nodeType&&e,$=P&&t&&!t.nodeType&&t,H=$&&$.exports===P;function D(t,e){return t.set(e[0],e[1]),t}function R(t,e){return t.add(e),t}function z(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 M(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function q(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function V(t,e){return function(n){return t(e(n))}}function K(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var G,W=Array.prototype,J=Function.prototype,Z=Object.prototype,X=B["__core-js_shared__"],Y=(G=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",Q=J.toString,tt=Z.hasOwnProperty,et=Z.toString,nt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=H?B.Buffer:void 0,it=B.Symbol,ot=B.Uint8Array,st=V(Object.getPrototypeOf,Object),at=Object.create,ct=Z.propertyIsEnumerable,ut=W.splice,ft=Object.getOwnPropertySymbols,lt=rt?rt.isBuffer:void 0,ht=V(Object.keys,Object),pt=Bt(B,"DataView"),dt=Bt(B,"Map"),yt=Bt(B,"Promise"),gt=Bt(B,"Set"),mt=Bt(B,"WeakMap"),bt=Bt(Object,"create"),wt=Rt(pt),vt=Rt(dt),xt=Rt(yt),Et=Rt(gt),St=Rt(mt),At=it?it.prototype:void 0,kt=At?At.valueOf:void 0;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 Ot(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 jt(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){this.__data__=new Ot(t)}function Ft(t,e,n){var r=t[e];tt.call(t,e)&&zt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ct(t,e){for(var n=t.length;n--;)if(zt(t[n][0],e))return n;return-1}function It(t,e,n,r,i,p,b){var C;if(r&&(C=p?r(t,i,p,b):r(t)),void 0!==C)return C;if(!Gt(t))return t;var I=Mt(t);if(I){if(C=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,C)}else{var L=$t(t),N=L==c||L==u;if(Vt(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(L==h||L==o||N&&!p){if(M(t))return p?t:{};if(C=function(t){return"function"!=typeof t.constructor||Dt(t)?{}:Gt(e=st(t))?at(e):{};var e}(N?{}:t),!e)return function(t,e){return Lt(t,Pt(t),e)}(t,function(t,e){return t&&Lt(e,Wt(e),t)}(C,t))}else{if(!U[L])return p?t:{};C=function(t,e,n,r){var i,o=t.constructor;switch(e){case w:return Ut(t);case s:case a:return new o(+t);case v:return function(t,e){var n=e?Ut(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case x:case E:case S:case A:case k:case _:case O:case j:case T:return function(t,e){var n=e?Ut(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case f:return function(t,e,n){return z(e?n(q(t),!0):q(t),D,new t.constructor)}(t,r,n);case l:case g:return new o(t);case d:return function(t){var e=new t.constructor(t.source,F.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,n){return z(e?n(K(t),!0):K(t),R,new t.constructor)}(t,r,n);case m:return i=t,kt?Object(kt.call(i)):{}}}(t,L,It,e)}}b||(b=new Tt);var B=b.get(t);if(B)return B;if(b.set(t,C),!I)var P=n?function(t){return function(t,e,n){var r=e(t);return Mt(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,Wt,Pt)}(t):Wt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}(P||t,function(i,o){P&&(i=t[o=i]),Ft(C,o,It(i,e,n,r,o,t,b))}),C}function Ut(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Lt(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;Ft(n,s,void 0===a?t[s]:a)}return n}function Nt(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 Bt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Gt(t)||(e=t,Y&&Y in e))&&(Kt(t)||M(t)?nt:C).test(Rt(t));var e}(n)?n:void 0}_t.prototype.clear=function(){this.__data__=bt?bt(null):{}},_t.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},_t.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},_t.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:tt.call(e,t)},_t.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?r:e,this},Ot.prototype.clear=function(){this.__data__=[]},Ot.prototype.delete=function(t){var e=this.__data__,n=Ct(e,t);return!(n<0||(n==e.length-1?e.pop():ut.call(e,n,1),0))},Ot.prototype.get=function(t){var e=this.__data__,n=Ct(e,t);return n<0?void 0:e[n][1]},Ot.prototype.has=function(t){return Ct(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var n=this.__data__,r=Ct(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},jt.prototype.clear=function(){this.__data__={hash:new _t,map:new(dt||Ot),string:new _t}},jt.prototype.delete=function(t){return Nt(this,t).delete(t)},jt.prototype.get=function(t){return Nt(this,t).get(t)},jt.prototype.has=function(t){return Nt(this,t).has(t)},jt.prototype.set=function(t,e){return Nt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new Ot},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ot){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new jt(r)}return n.set(t,e),this};var Pt=ft?V(ft,Object):function(){return[]},$t=function(t){return et.call(t)};function Ht(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||I.test(t))&&t>-1&&t%1==0&&t<e}function Dt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Z)}function Rt(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function zt(t,e){return t===e||t!=t&&e!=e}(pt&&$t(new pt(new ArrayBuffer(1)))!=v||dt&&$t(new dt)!=f||yt&&$t(yt.resolve())!=p||gt&&$t(new gt)!=y||mt&&$t(new mt)!=b)&&($t=function(t){var e=et.call(t),n=e==h?t.constructor:void 0,r=n?Rt(n):void 0;if(r)switch(r){case wt:return v;case vt:return f;case xt:return p;case Et:return y;case St:return b}return e});var Mt=Array.isArray;function qt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Kt(t)}var Vt=lt||function(){return!1};function Kt(t){var e=Gt(t)?et.call(t):"";return e==c||e==u}function Gt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return qt(t)?function(t,e){var n=Mt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&qt(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||Ht(s,r))||n.push(s);return n}(t):function(t){if(!Dt(t))return ht(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 It(t,!0,!0)}},402:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenVerifier=void 0;const r=n(886),i=n(546),o=n(87),s=n(211);e.TokenVerifier=class{constructor(t,e){if(!t||!e)throw new o.MissingParametersError("a signing algorithm and public key are required");if("string"!=typeof t)throw"signing algorithm parameter must be a string";if(t=t.toUpperCase(),!i.cryptoClients.hasOwnProperty(t))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=i.cryptoClients[t],this.rawPublicKey=e}verify(t){return"string"==typeof t?this.verifyCompact(t,!1):"object"==typeof t&&this.verifyExpanded(t,!1)}verifyAsync(t){return"string"==typeof t?this.verifyCompact(t,!0):"object"==typeof t?this.verifyExpanded(t,!0):Promise.resolve(!1)}verifyCompact(t,e){const n=t.split("."),r=n[0]+"."+n[1],i=t=>{const e=this.cryptoClient.loadSignature(n[2]);return this.cryptoClient.verifyHash(t,e,this.rawPublicKey)};if(e)return(0,s.hashSha256Async)(r).then(t=>i(t));{const t=(0,s.hashSha256)(r);return i(t)}}verifyExpanded(t,e){const n=[t.header.join("."),r.encode(t.payload)].join(".");let i=!0;const o=e=>(t.signature.map(t=>{const n=this.cryptoClient.loadSignature(t);this.cryptoClient.verifyHash(e,n,this.rawPublicKey)||(i=!1)}),i);if(e)return(0,s.hashSha256Async)(n).then(t=>o(t));{const t=(0,s.hashSha256)(n);return o(t)}}}},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 f(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 f=t.charCodeAt(n);if(f>255)return;var l=e[f];if(255===l)return;for(var h=0,p=o-1;(0!==l||h<i)&&-1!==p;p--,h++)l+=s*u[p]>>>0,u[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var d=o-i;d!==o&&0===u[d];)d++;for(var y=new Uint8Array(r+(o-d)),g=r;d!==o;)y[g++]=u[d++];return y}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,f=new Uint8Array(c);i!==o;){for(var l=e[i],h=0,p=c-1;(0!==l||h<r)&&-1!==p;p--,h++)l+=256*f[p]>>>0,f[p]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");r=h,i++}for(var d=c-r;d!==c&&0===f[d];)d++;for(var y=a.repeat(n);d<c;++d)y+=t.charAt(f[d]);return y},decodeUnsafe:f,decode:function(t){var e=f(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},410:(t,e,n)=>{"use strict";t.exports=n(118)},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}}},418:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.TokenSigner=e.createUnsecuredToken=void 0;const i=n(886),o=n(546),s=n(87),a=n(211);function c(t,e){const n=[],r=i.encode(JSON.stringify(e));n.push(r);const o=i.encode(JSON.stringify(t));return n.push(o),n.join(".")}e.createUnsecuredToken=function(t){return c(t,{typ:"JWT",alg:"none"})+"."},e.TokenSigner=class{constructor(t,e){if(!t||!e)throw new s.MissingParametersError("a signing algorithm and private key are required");if("string"!=typeof t)throw new Error("signing algorithm parameter must be a string");if(t=t.toUpperCase(),!o.cryptoClients.hasOwnProperty(t))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=o.cryptoClients[t],this.rawPrivateKey=e}header(t={}){const e={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},e,t)}sign(t,e=!1,n={}){const r=this.header(n),i=c(t,r),o=(0,a.hashSha256)(i);return this.createWithSignedHash(t,e,r,i,o)}signAsync(t,e=!1,n={}){return r(this,void 0,void 0,function*(){const r=this.header(n),i=c(t,r),o=yield(0,a.hashSha256Async)(i);return this.createWithSignedHash(t,e,r,i,o)})}createWithSignedHash(t,e,n,r,o){const s=this.cryptoClient.signHash(o,this.rawPrivateKey);return e?{header:[i.encode(JSON.stringify(n))],payload:JSON.stringify(t),signature:[s]}:[r,s].join(".")}}},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},500:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=void 0;const r=n(460),i=n(74);class o extends i.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,r.default.hash(t);const n=(0,i.toBytes)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=t.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),s.fill(0)}update(t){return r.default.exists(this),this.iHash.update(t),this}digestInto(t){r.default.exists(this),r.default.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=r,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.hmac=(t,e,n)=>new o(t,e).update(n).digest(),e.hmac.create=(t,e)=>new o(t,e)},546:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cryptoClients=e.SECP256K1Client=void 0;const r=n(70);Object.defineProperty(e,"SECP256K1Client",{enumerable:!0,get:function(){return r.SECP256K1Client}});const i={ES256K:r.SECP256K1Client};e.cryptoClients=i},574:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeToken=void 0;const r=n(886);e.decodeToken=function(t){if("string"==typeof t){const e=t.split(".");return{header:JSON.parse(r.decode(e[0])),payload:JSON.parse(r.decode(e[1])),signature:e[2]}}if("object"==typeof t){if("string"!=typeof t.payload)throw new Error("Expected token payload to be a base64 or json string");let e=t.payload;"{"!==t.payload[0]&&(e=r.decode(e));const n=[];return t.header.map(t=>{const e=JSON.parse(r.decode(t));n.push(e)}),{header:n,payload:JSON.parse(e),signature:t.signature}}}},599:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.joseToDer=e.derToJose=void 0;const r=n(991),i=n(886);function o(t){return(t/8|0)+(t%8==0?0:1)}const s={ES256:o(256),ES384:o(384),ES512:o(521)};function a(t){const e=s[t];if(e)return e;throw new Error(`Unknown algorithm "${t}"`)}function c(t){if(t instanceof Uint8Array)return t;if("string"==typeof t)return(0,r.toByteArray)((0,i.pad)(t));throw new TypeError("ECDSA signature must be a Base64 string or a Uint8Array")}function u(t,e,n){let r=0;for(;e+r<n&&0===t[e+r];)++r;return t[e+r]>=128&&--r,r}e.derToJose=function(t,e){const n=c(t),o=a(e),s=o+1,u=n.length;let f=0;if(48!==n[f++])throw new Error('Could not find expected "seq"');let l=n[f++];if(129===l&&(l=n[f++]),u-f<l)throw new Error(`"seq" specified length of "${l}", only "${u-f}" remaining`);if(2!==n[f++])throw new Error('Could not find expected "int" for "r"');const h=n[f++];if(u-f-2<h)throw new Error(`"r" specified length of "${h}", only "${u-f-2}" available`);if(s<h)throw new Error(`"r" specified length of "${h}", max of "${s}" is acceptable`);const p=f;if(f+=h,2!==n[f++])throw new Error('Could not find expected "int" for "s"');const d=n[f++];if(u-f!==d)throw new Error(`"s" specified length of "${d}", expected "${u-f}"`);if(s<d)throw new Error(`"s" specified length of "${d}", max of "${s}" is acceptable`);const y=f;if(f+=d,f!==u)throw new Error(`Expected to consume entire array, but "${u-f}" bytes remain`);const g=o-h,m=o-d,b=new Uint8Array(g+h+m+d);for(f=0;f<g;++f)b[f]=0;b.set(n.subarray(p+Math.max(-g,0),p+h),f),f=o;for(const t=f;f<t+m;++f)b[f]=0;return b.set(n.subarray(y+Math.max(-m,0),y+d),f),(0,i.escape)((0,r.fromByteArray)(b))},e.joseToDer=function(t,e){t=c(t);const n=a(e),r=t.length;if(r!==2*n)throw new TypeError(`"${e}" signatures must be "${2*n}" bytes, saw "${r}"`);const i=u(t,0,n),o=u(t,n,t.length),s=n-i,f=n-o,l=2+s+1+1+f,h=l<128,p=new Uint8Array((h?2:3)+l);let d=0;return p[d++]=48,h?p[d++]=l:(p[d++]=129,p[d++]=255&l),p[d++]=2,p[d++]=s,i<0?(p[d++]=0,p.set(t.subarray(0,n),d),d+=n):(p.set(t.subarray(i,n),d),d+=n-i),p[d++]=2,p[d++]=f,o<0?(p[d++]=0,p.set(t.subarray(n),d)):p.set(t.subarray(n+o),d),p}},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)]}},668:function(t,e,n){t=n.nmd(t);var r=n(907);!function(e){"use strict";function i(t,e){e|=0;for(var n=Math.max(t.length-e,0),r=Array(n),i=0;i<n;i++)r[i]=t[e+i];return r}var o=function(t){var e=i(arguments,1);return function(){var n=i(arguments);return t.apply(null,e.concat(n))}},s=function(t){return function(){var e=i(arguments),n=e.pop();t.call(this,e,n)}};function a(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var c="function"==typeof setImmediate&&setImmediate,u="object"==typeof r&&"function"==typeof r.nextTick;function f(t){setTimeout(t,0)}function l(t){return function(e){var n=i(arguments,1);t(function(){e.apply(null,n)})}}var h=l(c?setImmediate:u?r.nextTick:f);function p(t){return s(function(e,n){var r;try{r=t.apply(this,e)}catch(t){return n(t)}a(r)&&"function"==typeof r.then?r.then(function(t){d(n,null,t)},function(t){d(n,t.message?t:new Error(t))}):n(null,r)})}function d(t,e,n){try{t(e,n)}catch(t){h(y,t)}}function y(t){throw t}var g="function"==typeof Symbol;function m(t){return g&&"AsyncFunction"===t[Symbol.toStringTag]}function b(t){return m(t)?p(t):t}function w(t){return function(e){var n=i(arguments,1),r=s(function(n,r){var i=this;return t(e,function(t,e){b(t).apply(i,n.concat(e))},r)});return n.length?r.apply(this,n):r}}var v="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,x="object"==typeof self&&self&&self.Object===Object&&self,E=v||x||Function("return this")(),S=E.Symbol,A=Object.prototype,k=A.hasOwnProperty,_=A.toString,O=S?S.toStringTag:void 0;var j=Object.prototype.toString;var T=S?S.toStringTag:void 0;function F(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":T&&T in Object(t)?function(t){var e=k.call(t,O),n=t[O];try{t[O]=void 0;var r=!0}catch(t){}var i=_.call(t);return r&&(e?t[O]=n:delete t[O]),i}(t):function(t){return j.call(t)}(t)}function C(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function I(t){return null!=t&&C(t.length)&&!function(t){if(!a(t))return!1;var e=F(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)}var U={};function L(){}function N(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var B="function"==typeof Symbol&&Symbol.iterator;function P(t){return null!=t&&"object"==typeof t}function $(t){return P(t)&&"[object Arguments]"==F(t)}var H=Object.prototype,D=H.hasOwnProperty,R=H.propertyIsEnumerable,z=$(function(){return arguments}())?$:function(t){return P(t)&&D.call(t,"callee")&&!R.call(t,"callee")},M=Array.isArray;var q="object"==typeof e&&e&&!e.nodeType&&e,V=q&&t&&!t.nodeType&&t,K=V&&V.exports===q?E.Buffer:void 0,G=(K?K.isBuffer:void 0)||function(){return!1},W=/^(?:0|[1-9]\d*)$/;function J(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&W.test(t))&&t>-1&&t%1==0&&t<e}var Z={};Z["[object Float32Array]"]=Z["[object Float64Array]"]=Z["[object Int8Array]"]=Z["[object Int16Array]"]=Z["[object Int32Array]"]=Z["[object Uint8Array]"]=Z["[object Uint8ClampedArray]"]=Z["[object Uint16Array]"]=Z["[object Uint32Array]"]=!0,Z["[object Arguments]"]=Z["[object Array]"]=Z["[object ArrayBuffer]"]=Z["[object Boolean]"]=Z["[object DataView]"]=Z["[object Date]"]=Z["[object Error]"]=Z["[object Function]"]=Z["[object Map]"]=Z["[object Number]"]=Z["[object Object]"]=Z["[object RegExp]"]=Z["[object Set]"]=Z["[object String]"]=Z["[object WeakMap]"]=!1;var X,Y="object"==typeof e&&e&&!e.nodeType&&e,Q=Y&&t&&!t.nodeType&&t,tt=Q&&Q.exports===Y&&v.process,et=function(){try{return Q&&Q.require&&Q.require("util").types||tt&&tt.binding&&tt.binding("util")}catch(t){}}(),nt=et&&et.isTypedArray,rt=nt?(X=nt,function(t){return X(t)}):function(t){return P(t)&&C(t.length)&&!!Z[F(t)]},it=Object.prototype.hasOwnProperty;function ot(t,e){var n=M(t),r=!n&&z(t),i=!n&&!r&&G(t),o=!n&&!r&&!i&&rt(t),s=n||r||i||o,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!it.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||J(u,c))||a.push(u);return a}var st=Object.prototype;var at=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),ct=Object.prototype.hasOwnProperty;function ut(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||st))return at(t);var e,n,r=[];for(var i in Object(t))ct.call(t,i)&&"constructor"!=i&&r.push(i);return r}function ft(t){return I(t)?ot(t):ut(t)}function lt(t){if(I(t))return function(t){var e=-1,n=t.length;return function(){return++e<n?{value:t[e],key:e}:null}}(t);var e,n,r,i,o=function(t){return B&&t[B]&&t[B]()}(t);return o?function(t){var e=-1;return function(){var n=t.next();return n.done?null:(e++,{value:n.value,key:e})}}(o):(n=ft(e=t),r=-1,i=n.length,function t(){var o=n[++r];return"__proto__"===o?t():r<i?{value:e[o],key:o}:null})}function ht(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function pt(t){return function(e,n,r){if(r=N(r||L),t<=0||!e)return r(null);var i=lt(e),o=!1,s=0,a=!1;function c(t,e){if(s-=1,t)o=!0,r(t);else{if(e===U||o&&s<=0)return o=!0,r(null);a||u()}}function u(){for(a=!0;s<t&&!o;){var e=i();if(null===e)return o=!0,void(s<=0&&r(null));s+=1,n(e.value,e.key,ht(c))}a=!1}u()}}function dt(t,e,n,r){pt(e)(t,b(n),r)}function yt(t,e){return function(n,r,i){return t(n,e,r,i)}}function gt(t,e,n){n=N(n||L);var r=0,i=0,o=t.length;function s(t,e){t?n(t):++i!==o&&e!==U||n(null)}for(0===o&&n(null);r<o;r++)e(t[r],r,ht(s))}var mt=yt(dt,1/0),bt=function(t,e,n){(I(t)?gt:mt)(t,b(e),n)};function wt(t){return function(e,n,r){return t(bt,e,b(n),r)}}function vt(t,e,n,r){r=r||L,e=e||[];var i=[],o=0,s=b(n);t(e,function(t,e,n){var r=o++;s(t,function(t,e){i[r]=e,n(t)})},function(t){r(t,i)})}var xt=wt(vt),Et=w(xt);function St(t){return function(e,n,r,i){return t(pt(n),e,b(r),i)}}var At=St(vt),kt=yt(At,1),_t=w(kt);function Ot(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}var jt,Tt=function(t,e,n){for(var r=-1,i=Object(t),o=n(t),s=o.length;s--;){var a=o[jt?s:++r];if(!1===e(i[a],a,i))break}return t};function Ft(t,e){return t&&Tt(t,e,ft)}function Ct(t){return t!=t}function It(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,Ct,n)}var Ut=function(t,e,n){"function"==typeof e&&(n=e,e=null),n=N(n||L);var r=ft(t).length;if(!r)return n(null);e||(e=r);var o={},s=0,a=!1,c=Object.create(null),u=[],f=[],l={};function h(t,e){u.push(function(){!function(t,e){if(!a){var r=ht(function(e,r){if(s--,arguments.length>2&&(r=i(arguments,1)),e){var u={};Ft(o,function(t,e){u[e]=t}),u[t]=r,a=!0,c=Object.create(null),n(e,u)}else o[t]=r,Ot(c[t]||[],function(t){t()}),p()});s++;var u=b(e[e.length-1]);e.length>1?u(o,r):u(r)}}(t,e)})}function p(){if(0===u.length&&0===s)return n(null,o);for(;u.length&&s<e;)u.shift()()}function d(e){var n=[];return Ft(t,function(t,r){M(t)&&It(t,e,0)>=0&&n.push(r)}),n}Ft(t,function(e,n){if(!M(e))return h(n,[e]),void f.push(n);var r=e.slice(0,e.length-1),i=r.length;if(0===i)return h(n,e),void f.push(n);l[n]=i,Ot(r,function(o){if(!t[o])throw new Error("async.auto task `"+n+"` has a non-existent dependency `"+o+"` in "+r.join(", "));var s,a,u;a=function(){0===--i&&h(n,e)},(u=c[s=o])||(u=c[s]=[]),u.push(a)})}),function(){for(var t=0;f.length;)t++,Ot(d(f.pop()),function(t){0===--l[t]&&f.push(t)});if(t!==r)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),p()};function Lt(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var Nt=S?S.prototype:void 0,Bt=Nt?Nt.toString:void 0;function Pt(t){if("string"==typeof t)return t;if(M(t))return Lt(t,Pt)+"";if(function(t){return"symbol"==typeof t||P(t)&&"[object Symbol]"==F(t)}(t))return Bt?Bt.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function $t(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:function(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}(t,e,n)}var Ht=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Dt="\\ud800-\\udfff",Rt="["+Dt+"]",zt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Mt="\\ud83c[\\udffb-\\udfff]",qt="[^"+Dt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",Gt="(?:"+zt+"|"+Mt+")?",Wt="[\\ufe0e\\ufe0f]?",Jt=Wt+Gt+("(?:\\u200d(?:"+[qt,Vt,Kt].join("|")+")"+Wt+Gt+")*"),Zt="(?:"+[qt+zt+"?",zt,Vt,Kt,Rt].join("|")+")",Xt=RegExp(Mt+"(?="+Mt+")|"+Zt+Jt,"g");function Yt(t){return function(t){return Ht.test(t)}(t)?function(t){return t.match(Xt)||[]}(t):function(t){return t.split("")}(t)}var Qt=/^\s+|\s+$/g;function te(t,e,n){if((t=null==(r=t)?"":Pt(r))&&(n||void 0===e))return t.replace(Qt,"");var r;if(!t||!(e=Pt(e)))return t;var i=Yt(t),o=Yt(e);return $t(i,function(t,e){for(var n=-1,r=t.length;++n<r&&It(e,t[n],0)>-1;);return n}(i,o),function(t,e){for(var n=t.length;n--&&It(e,t[n],0)>-1;);return n}(i,o)+1).join("")}var ee=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ne=/,/,re=/(=.+)?(\s*)$/,ie=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function oe(t,e){var n={};Ft(t,function(t,e){var r,i=m(t),o=!i&&1===t.length||i&&0===t.length;if(M(t))r=t.slice(0,-1),t=t[t.length-1],n[e]=r.concat(r.length>0?s:t);else if(o)n[e]=t;else{if(r=function(t){return(t=(t=(t=t.toString().replace(ie,"")).match(ee)[2].replace(" ",""))?t.split(ne):[]).map(function(t){return te(t.replace(re,""))})}(t),0===t.length&&!i&&0===r.length)throw new Error("autoInject task functions require explicit parameters.");i||r.pop(),n[e]=r.concat(s)}function s(e,n){var i=Lt(r,function(t){return e[t]});i.push(n),b(t).apply(null,i)}}),Ut(n,e)}function se(){this.head=this.tail=null,this.length=0}function ae(t,e){t.length=1,t.head=t.tail=e}function ce(t,e,n){if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var r=b(t),i=0,o=[],s=!1;function a(t,e,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(f.started=!0,M(t)||(t=[t]),0===t.length&&f.idle())return h(function(){f.drain()});for(var r=0,i=t.length;r<i;r++){var o={data:t[r],callback:n||L};e?f._tasks.unshift(o):f._tasks.push(o)}s||(s=!0,h(function(){s=!1,f.process()}))}function c(t){return function(e){i-=1;for(var n=0,r=t.length;n<r;n++){var s=t[n],a=It(o,s,0);0===a?o.shift():a>0&&o.splice(a,1),s.callback.apply(s,arguments),null!=e&&f.error(e,s.data)}i<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}var u=!1,f={_tasks:new se,concurrency:e,payload:n,saturated:L,unsaturated:L,buffer:e/4,empty:L,drain:L,error:L,started:!1,paused:!1,push:function(t,e){a(t,!1,e)},kill:function(){f.drain=L,f._tasks.empty()},unshift:function(t,e){a(t,!0,e)},remove:function(t){f._tasks.remove(t)},process:function(){if(!u){for(u=!0;!f.paused&&i<f.concurrency&&f._tasks.length;){var t=[],e=[],n=f._tasks.length;f.payload&&(n=Math.min(n,f.payload));for(var s=0;s<n;s++){var a=f._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===f._tasks.length&&f.empty(),i===f.concurrency&&f.saturated();var l=ht(c(t));r(e,l)}u=!1}},length:function(){return f._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return f._tasks.length+i===0},pause:function(){f.paused=!0},resume:function(){!1!==f.paused&&(f.paused=!1,h(f.process))}};return f}function ue(t,e){return ce(t,1,e)}se.prototype.removeLink=function(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t},se.prototype.empty=function(){for(;this.head;)this.shift();return this},se.prototype.insertAfter=function(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1},se.prototype.insertBefore=function(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1},se.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):ae(this,t)},se.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):ae(this,t)},se.prototype.shift=function(){return this.head&&this.removeLink(this.head)},se.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},se.prototype.toArray=function(){for(var t=Array(this.length),e=this.head,n=0;n<this.length;n++)t[n]=e.data,e=e.next;return t},se.prototype.remove=function(t){for(var e=this.head;e;){var n=e.next;t(e)&&this.removeLink(e),e=n}return this};var fe=yt(dt,1);function le(t,e,n,r){r=N(r||L);var i=b(n);fe(t,function(t,n,r){i(e,t,function(t,n){e=n,r(t)})},function(t){r(t,e)})}function he(){var t=Lt(arguments,b);return function(){var e=i(arguments),n=this,r=e[e.length-1];"function"==typeof r?e.pop():r=L,le(t,e,function(t,e,r){e.apply(n,t.concat(function(t){var e=i(arguments,1);r(t,e)}))},function(t,e){r.apply(n,[t].concat(e))})}}var pe=function(){return he.apply(null,i(arguments).reverse())},de=Array.prototype.concat,ye=function(t,e,n,r){r=r||L;var o=b(n);At(t,e,function(t,e){o(t,function(t){return t?e(t):e(null,i(arguments,1))})},function(t,e){for(var n=[],i=0;i<e.length;i++)e[i]&&(n=de.apply(n,e[i]));return r(t,n)})},ge=yt(ye,1/0),me=yt(ye,1),be=function(){var t=i(arguments),e=[null].concat(t);return function(){return arguments[arguments.length-1].apply(this,e)}};function we(t){return t}function ve(t,e){return function(n,r,i,o){o=o||L;var s,a=!1;n(r,function(n,r,o){i(n,function(r,i){r?o(r):t(i)&&!s?(a=!0,s=e(!0,n),o(null,U)):o()})},function(t){t?o(t):o(null,a?s:e(!1))})}}function xe(t,e){return e}var Ee=wt(ve(we,xe)),Se=St(ve(we,xe)),Ae=yt(Se,1);function ke(t){return function(e){var n=i(arguments,1);n.push(function(e){var n=i(arguments,1);"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&Ot(n,function(e){console[t](e)}))}),b(e).apply(null,n)}}var _e=ke("dir");function Oe(t,e,n){n=ht(n||L);var r=b(t),o=b(e);function s(t){if(t)return n(t);var e=i(arguments,1);e.push(a),o.apply(this,e)}function a(t,e){return t?n(t):e?void r(s):n(null)}a(null,!0)}function je(t,e,n){n=ht(n||L);var r=b(t),o=function(t){if(t)return n(t);var s=i(arguments,1);if(e.apply(this,s))return r(o);n.apply(null,[null].concat(s))};r(o)}function Te(t,e,n){je(t,function(){return!e.apply(this,arguments)},n)}function Fe(t,e,n){n=ht(n||L);var r=b(e),i=b(t);function o(t){if(t)return n(t);i(s)}function s(t,e){return t?n(t):e?void r(o):n(null)}i(s)}function Ce(t){return function(e,n,r){return t(e,r)}}function Ie(t,e,n){bt(t,Ce(b(e)),n)}function Ue(t,e,n,r){pt(e)(t,Ce(b(n)),r)}var Le=yt(Ue,1);function Ne(t){return m(t)?t:s(function(e,n){var r=!0;e.push(function(){var t=arguments;r?h(function(){n.apply(null,t)}):n.apply(null,t)}),t.apply(this,e),r=!1})}function Be(t){return!t}var Pe=wt(ve(Be,Be)),$e=St(ve(Be,Be)),He=yt($e,1);function De(t){return function(e){return null==e?void 0:e[t]}}function Re(t,e,n,r){var i=new Array(e.length);t(e,function(t,e,r){n(t,function(t,n){i[e]=!!n,r(t)})},function(t){if(t)return r(t);for(var n=[],o=0;o<e.length;o++)i[o]&&n.push(e[o]);r(null,n)})}function ze(t,e,n,r){var i=[];t(e,function(t,e,r){n(t,function(n,o){n?r(n):(o&&i.push({index:e,value:t}),r())})},function(t){t?r(t):r(null,Lt(i.sort(function(t,e){return t.index-e.index}),De("value")))})}function Me(t,e,n,r){(I(e)?Re:ze)(t,e,b(n),r||L)}var qe=wt(Me),Ve=St(Me),Ke=yt(Ve,1);function Ge(t,e){var n=ht(e||L),r=b(Ne(t));!function t(e){if(e)return n(e);r(t)}()}var We=function(t,e,n,r){r=r||L;var i=b(n);At(t,e,function(t,e){i(t,function(n,r){return n?e(n):e(null,{key:r,val:t})})},function(t,e){for(var n={},i=Object.prototype.hasOwnProperty,o=0;o<e.length;o++)if(e[o]){var s=e[o].key,a=e[o].val;i.call(n,s)?n[s].push(a):n[s]=[a]}return r(t,n)})},Je=yt(We,1/0),Ze=yt(We,1),Xe=ke("log");function Ye(t,e,n,r){r=N(r||L);var i={},o=b(n);dt(t,e,function(t,e,n){o(t,e,function(t,r){if(t)return n(t);i[e]=r,n()})},function(t){r(t,i)})}var Qe=yt(Ye,1/0),tn=yt(Ye,1);function en(t,e){return e in t}function nn(t,e){var n=Object.create(null),r=Object.create(null);e=e||we;var o=b(t),a=s(function(t,s){var a=e.apply(null,t);en(n,a)?h(function(){s.apply(null,n[a])}):en(r,a)?r[a].push(s):(r[a]=[s],o.apply(null,t.concat(function(){var t=i(arguments);n[a]=t;var e=r[a];delete r[a];for(var o=0,s=e.length;o<s;o++)e[o].apply(null,t)})))});return a.memo=n,a.unmemoized=t,a}var rn=l(u?r.nextTick:c?setImmediate:f);function on(t,e,n){n=n||L;var r=I(e)?[]:{};t(e,function(t,e,n){b(t)(function(t,o){arguments.length>2&&(o=i(arguments,1)),r[e]=o,n(t)})},function(t){n(t,r)})}function sn(t,e){on(bt,t,e)}function an(t,e,n){on(pt(e),t,n)}var cn=function(t,e){var n=b(t);return ce(function(t,e){n(t[0],e)},e,1)},un=function(t,e){var n=cn(t,e);return n.push=function(t,e,r){if(null==r&&(r=L),"function"!=typeof r)throw new Error("task callback must be a function");if(n.started=!0,M(t)||(t=[t]),0===t.length)return h(function(){n.drain()});e=e||0;for(var i=n._tasks.head;i&&e>=i.priority;)i=i.next;for(var o=0,s=t.length;o<s;o++){var a={data:t[o],priority:e,callback:r};i?n._tasks.insertBefore(i,a):n._tasks.push(a)}h(n.process)},delete n.unshift,n};function fn(t,e){if(e=N(e||L),!M(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var n=0,r=t.length;n<r;n++)b(t[n])(e)}function ln(t,e,n,r){le(i(t).reverse(),e,n,r)}function hn(t){var e=b(t);return s(function(t,n){return t.push(function(t,e){var r;t?n(null,{error:t}):(r=arguments.length<=2?e:i(arguments,1),n(null,{value:r}))}),e.apply(this,t)})}function pn(t){var e;return M(t)?e=Lt(t,hn):(e={},Ft(t,function(t,n){e[n]=hn.call(this,t)})),e}function dn(t,e,n,r){Me(t,e,function(t,e){n(t,function(t,n){e(t,!n)})},r)}var yn=wt(dn),gn=St(dn),mn=yt(gn,1);function bn(t){return function(){return t}}function wn(t,e,n){var r={times:5,intervalFunc:bn(0)};if(arguments.length<3&&"function"==typeof t?(n=e||L,e=t):(function(t,e){if("object"==typeof e)t.times=+e.times||5,t.intervalFunc="function"==typeof e.interval?e.interval:bn(+e.interval||0),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||5}}(r,t),n=n||L),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var i=b(e),o=1;!function t(){i(function(e){e&&o++<r.times&&("function"!=typeof r.errorFilter||r.errorFilter(e))?setTimeout(t,r.intervalFunc(o)):n.apply(null,arguments)})}()}var vn=function(t,e){e||(e=t,t=null);var n=b(e);return s(function(e,r){function i(t){n.apply(null,e.concat(t))}t?wn(t,i,r):wn(i,r)})};function xn(t,e){on(fe,t,e)}var En=wt(ve(Boolean,we)),Sn=St(ve(Boolean,we)),An=yt(Sn,1);function kn(t,e,n){var r=b(e);function i(t,e){var n=t.criteria,r=e.criteria;return n<r?-1:n>r?1:0}xt(t,function(t,e){r(t,function(n,r){if(n)return e(n);e(null,{value:t,criteria:r})})},function(t,e){if(t)return n(t);n(null,Lt(e.sort(i),De("value")))})}function _n(t,e,n){var r=b(t);return s(function(i,o){var s,a=!1;i.push(function(){a||(o.apply(null,arguments),clearTimeout(s))}),s=setTimeout(function(){var e=t.name||"anonymous",r=new Error('Callback function "'+e+'" timed out.');r.code="ETIMEDOUT",n&&(r.info=n),a=!0,o(r)},e),r.apply(null,i)})}var On=Math.ceil,jn=Math.max;function Tn(t,e,n,r){var i=b(n);At(function(t,e,n,r){for(var i=-1,o=jn(On((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}(0,t,1),e,i,r)}var Fn=yt(Tn,1/0),Cn=yt(Tn,1);function In(t,e,n,r){arguments.length<=3&&(r=n,n=e,e=M(t)?[]:{}),r=N(r||L);var i=b(n);bt(t,function(t,n,r){i(e,t,n,r)},function(t){r(t,e)})}function Un(t,e){var n,r=null;e=e||L,Le(t,function(t,e){b(t)(function(t,o){n=arguments.length>2?i(arguments,1):o,r=t,e(!t)})},function(){e(r,n)})}function Ln(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function Nn(t,e,n){n=ht(n||L);var r=b(e);if(!t())return n(null);var o=function(e){if(e)return n(e);if(t())return r(o);var s=i(arguments,1);n.apply(null,[null].concat(s))};r(o)}function Bn(t,e,n){Nn(function(){return!t.apply(this,arguments)},e,n)}var Pn=function(t,e){if(e=N(e||L),!M(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var n=0;function r(e){var r=b(t[n++]);e.push(ht(o)),r.apply(null,e)}function o(o){if(o||n===t.length)return e.apply(null,arguments);r(i(arguments,1))}r([])},$n={apply:o,applyEach:Et,applyEachSeries:_t,asyncify:p,auto:Ut,autoInject:oe,cargo:ue,compose:pe,concat:ge,concatLimit:ye,concatSeries:me,constant:be,detect:Ee,detectLimit:Se,detectSeries:Ae,dir:_e,doDuring:Oe,doUntil:Te,doWhilst:je,during:Fe,each:Ie,eachLimit:Ue,eachOf:bt,eachOfLimit:dt,eachOfSeries:fe,eachSeries:Le,ensureAsync:Ne,every:Pe,everyLimit:$e,everySeries:He,filter:qe,filterLimit:Ve,filterSeries:Ke,forever:Ge,groupBy:Je,groupByLimit:We,groupBySeries:Ze,log:Xe,map:xt,mapLimit:At,mapSeries:kt,mapValues:Qe,mapValuesLimit:Ye,mapValuesSeries:tn,memoize:nn,nextTick:rn,parallel:sn,parallelLimit:an,priorityQueue:un,queue:cn,race:fn,reduce:le,reduceRight:ln,reflect:hn,reflectAll:pn,reject:yn,rejectLimit:gn,rejectSeries:mn,retry:wn,retryable:vn,seq:he,series:xn,setImmediate:h,some:En,someLimit:Sn,someSeries:An,sortBy:kn,timeout:_n,times:Fn,timesLimit:Tn,timesSeries:Cn,transform:In,tryEach:Un,unmemoize:Ln,until:Bn,waterfall:Pn,whilst:Nn,all:Pe,allLimit:$e,allSeries:He,any:En,anyLimit:Sn,anySeries:An,find:Ee,findLimit:Se,findSeries:Ae,forEach:Ie,forEachSeries:Le,forEachLimit:Ue,forEachOf:bt,forEachOfSeries:fe,forEachOfLimit:dt,inject:le,foldl:le,foldr:ln,select:qe,selectLimit:Ve,selectSeries:Ke,wrapSync:p};e.default=$n,e.apply=o,e.applyEach=Et,e.applyEachSeries=_t,e.asyncify=p,e.auto=Ut,e.autoInject=oe,e.cargo=ue,e.compose=pe,e.concat=ge,e.concatLimit=ye,e.concatSeries=me,e.constant=be,e.detect=Ee,e.detectLimit=Se,e.detectSeries=Ae,e.dir=_e,e.doDuring=Oe,e.doUntil=Te,e.doWhilst=je,e.during=Fe,e.each=Ie,e.eachLimit=Ue,e.eachOf=bt,e.eachOfLimit=dt,e.eachOfSeries=fe,e.eachSeries=Le,e.ensureAsync=Ne,e.every=Pe,e.everyLimit=$e,e.everySeries=He,e.filter=qe,e.filterLimit=Ve,e.filterSeries=Ke,e.forever=Ge,e.groupBy=Je,e.groupByLimit=We,e.groupBySeries=Ze,e.log=Xe,e.map=xt,e.mapLimit=At,e.mapSeries=kt,e.mapValues=Qe,e.mapValuesLimit=Ye,e.mapValuesSeries=tn,e.memoize=nn,e.nextTick=rn,e.parallel=sn,e.parallelLimit=an,e.priorityQueue=un,e.queue=cn,e.race=fn,e.reduce=le,e.reduceRight=ln,e.reflect=hn,e.reflectAll=pn,e.reject=yn,e.rejectLimit=gn,e.rejectSeries=mn,e.retry=wn,e.retryable=vn,e.seq=he,e.series=xn,e.setImmediate=h,e.some=En,e.someLimit=Sn,e.someSeries=An,e.sortBy=kn,e.timeout=_n,e.times=Fn,e.timesLimit=Tn,e.timesSeries=Cn,e.transform=In,e.tryEach=Un,e.unmemoize=Ln,e.until=Bn,e.waterfall=Pn,e.whilst=Nn,e.all=Pe,e.allLimit=$e,e.allSeries=He,e.any=En,e.anyLimit=Sn,e.anySeries=An,e.find=Ee,e.findLimit=Se,e.findSeries=Ae,e.forEach=Ie,e.forEachSeries=Le,e.forEachLimit=Ue,e.forEachOf=bt,e.forEachOfSeries=fe,e.forEachOfLimit=dt,e.inject=le,e.foldl=le,e.foldr=ln,e.select=qe,e.selectLimit=Ve,e.selectSeries=Ke,e.wrapSync=p,Object.defineProperty(e,"__esModule",{value:!0})}(e)},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,f=e.c32[r+u];s=c,o.unshift(f)}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 f=0;for(let t=0;t<a.length&&"0"===a[t];t++)f++;a=a.slice(f-f%2);let l=a.join("");for(let t=0;t<s;t++)l=`00${l}`;if(n){const t=2*n-l.length;for(let e=0;e<t;e+=2)l=`00${l}`}return l}},688:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const r=n(165),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 f 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:f,E:l,F:h,G:p,H:d}=this;for(let t=0;t<64;t++){const e=d+((0,i.rotr)(l,6)^(0,i.rotr)(l,11)^(0,i.rotr)(l,25))+o(l,h,p)+a[t]+u[t]|0,y=((0,i.rotr)(n,2)^(0,i.rotr)(n,13)^(0,i.rotr)(n,22))+s(n,r,c)|0;d=p,p=h,h=l,l=f+e|0,f=c,c=r,r=n,n=e+y|0}n=n+this.A|0,r=r+this.B|0,c=c+this.C|0,f=f+this.D|0,l=l+this.E|0,h=h+this.F|0,p=p+this.G|0,d=d+this.H|0,this.set(n,r,c,f,l,h,p,d)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends f{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 f),e.sha224=(0,i.wrapConstructor)(()=>new l)},790:(t,e,n)=>{!function(){var e={};if(e.async=n(668),"object"!=typeof e.async)throw new Error("Module async is required (https://github.com/caolan/async)");var r=e.async;function i(t,e){if(!e||"object"!=typeof e)return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function o(){var t={},e=Array.prototype.slice.call(arguments),n=null,r=null;return e.forEach(function(e){if(e&&e.constructor===Object)for(n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]]}),t}function s(){this.custom={},this.extend=function(t){return i(this.custom,t)},this.reset=function(){this.custom={}},this.remove=function(t){c.array(t)||(t=[t]),t.forEach(function(t){delete this.custom[t]},this)}}function a(t,e){var n=["@"];if(this._schema=t,this._custom={},null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._custom["$"+r]=e[r]);this._getDepth=function(){return n.length},this._dumpStack=function(){return n.map(function(t){return t.replace(/^\[/g,"")}).join(".").replace(/\.\u001b\u001c\u001d\u001e/g,"[")},this._deeperObject=function(t){return n.push(/^[a-z$_][a-z0-9$_]*$/i.test(t)?t:'["'+t+'"]'),this},this._deeperArray=function(t){return n.push("["+t+"]"),this},this._back=function(){return n.pop(),this}}var c={function:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},number:function(t){return"number"==typeof t&&!isNaN(t)},integer:function(t){return"number"==typeof t&&t%1==0},NaN:function(t){return"number"==typeof t&&isNaN(t)},boolean:function(t){return"boolean"==typeof t},null:function(t){return null===t},date:function(t){return null!=t&&t instanceof Date},object:function(t){return"object"==typeof t&&null!=t&&t.constructor!==Array},array:function(t){return null!=t&&t.constructor===Array},any:function(){return!0}};function u(t,e){return"function"==typeof t?e instanceof t:c[t=t in c?t:"any"](e)}function f(t,e){for(var n=[],r=t.indexOf(e);-1!==r;)n.push(r),r=t.indexOf(e,r+1);return n}var l={void:/^$/,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)?(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z?|(-|\+)\d{2}:\d{2})$/,date:/^\d{4}-\d{2}-\d{2}$/,coolDateTime:/^\d{4}(-|\/)\d{2}(-|\/)\d{2}(T| )\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,time:/^\d{2}\:\d{2}\:\d{2}$/,color:/^#([0-9a-f])+$/i,email:new RegExp("(?:[^\\W_](?:[\\w\\.\\+]+)@(?:localhost|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|موريتانيا|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|السعودية|yokohama|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|католик|الجزائر|العليان|اتصالات|پاکستان|البحرين|كاثوليك|இந்தியா|yamaxun|youtube|zuerich|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|москва|онлайн|ファッション|भारतम्|ارامكو|امارات|الاردن|المغرب|ابوظبي|مليسيا|இலங்கை|فلسطين|yachts|yandex|zappos|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|ישראל|বাংলা|భారత్|भारोत|संगठन|ایران|بازار|بھارت|سودان|همراه|سورية|ഭാരതം|嘉里大酒店|yahoo|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|ಭಾರತ|ଭାରତ|大众汽车|ভাৰত|ভারত|موقع|香格里拉|сайт|アマゾン|дети|ポイント|ලංකා|電訊盈科|クラウド|ભારત|भारत|عمان|بارت|ڀارت|عراق|شبكة|بيتك|组织机构|تونس|グーグル|ਭਾਰਤ|yoga|zara|zero|zone|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|कॉम|セール|คอม|我爱你|қаз|срб|бел|קום|淡马锡|орг|नेट|ストア|мкд|كوم|中文网|ком|укр|亚马逊|诺基亚|飞利浦|мон|عرب|ไทย|рус|ລາວ|みんな|天主教|مصر|قطر|հայ|新加坡|xxx|xyz|you|yun|zip|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|佛山|慈善|集团|在线|한국|点看|八卦|公益|公司|网站|移动|联通|бг|时尚|微博|삼성|商标|商店|商城|ею|新闻|家電|中信|中国|中國|娱乐|谷歌|购物|通販|网店|餐厅|网络|香港|食品|台湾|台灣|手机|澳門|닷컴|政府|გე|机构|健康|招聘|рф|大拿|ευ|ελ|世界|書籍|网址|닷넷|コム|游戏|企业|信息|嘉里|广东|政务|ye|yt|za|zm|zw))))"),numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_-]+$/i,javascript:/^[a-z_\$][a-z0-9_\$]*$/i,upperString:/^[A-Z ]*$/,lowerString:/^[a-z ]*$/,v4uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i},h={optional:function(t,e){!0!==("boolean"==typeof t.optional?t.optional:"true"===t.optional)&&void 0===e&&this.report("is missing and not optional",null,"optional")},type:function(t,e){if(void 0!==e&&("string"==typeof t.type||t.type instanceof Array||"function"==typeof t.type)){var n=c.array(t.type)?t.type:[t.type];n.some(function(t){return u(t,e)})||(n=n.map(function(t){return"function"==typeof t?"an instance of "+t.name:t}),this.report("must be "+n.join(" or ")+", but is "+function(t){for(var e in c)if(u(e,t))return"any"===e||"object"===e&&t.constructor!==Object?"an instance of "+t.constructor.name:e}(e),null,"type"))}},uniqueness:function(t,e){if("string"==typeof t.uniqueness&&(t.uniqueness="true"===t.uniqueness),"boolean"==typeof t.uniqueness&&!1!==t.uniqueness&&(c.array(e)||"string"==typeof e))for(var n=[],r=0;r<e.length;r++)if(!(n.indexOf(e[r])>=0)){var i=f(e,e[r]);i.length>1&&(n.push(e[r]),this.report("has value ["+e[r]+"] more than once at indexes ["+i.join(", ")+"]",null,"uniqueness"))}},pattern:function(t,e){var n=t.pattern;if("string"==typeof e){var r=!1;c.array(n)||(n=[n]),n.forEach(function(t){"string"==typeof t&&t in l&&(t=l[t]),t instanceof RegExp&&t.test(e)&&(r=!0)}),r||this.report("must match ["+n.join(" or ")+'], but is equal to "'+e+'"',null,"pattern")}},validDate:function(t,e){"true"===String(t.validDate)&&e instanceof Date&&isNaN(e.getTime())&&this.report("must be a valid date",null,"validDate")},minLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.minLength);isNaN(n)||e.length<n&&this.report("must be longer than "+n+" elements, but it has "+e.length,null,"minLength")}},maxLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.maxLength);isNaN(n)||e.length>n&&this.report("must be shorter than "+n+" elements, but it has "+e.length,null,"maxLength")}},exactLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.exactLength);isNaN(n)||e.length!==n&&this.report("must have exactly "+n+" elements, but it have "+e.length,null,"exactLength")}},lt:function(t,e){var n=Number(t.lt);"number"!=typeof e||isNaN(n)||e>=n&&this.report("must be less than "+n+', but is equal to "'+e+'"',null,"lt")},lte:function(t,e){var n=Number(t.lte);"number"!=typeof e||isNaN(n)||e>n&&this.report("must be less than or equal to "+n+', but is equal to "'+e+'"',null,"lte")},gt:function(t,e){var n=Number(t.gt);"number"!=typeof e||isNaN(n)||e<=n&&this.report("must be greater than "+n+', but is equal to "'+e+'"',null,"gt")},gte:function(t,e){var n=Number(t.gte);"number"!=typeof e||isNaN(n)||e<n&&this.report("must be greater than or equal to "+n+', but is equal to "'+e+'"',null,"gte")},eq:function(t,e){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e){var n=t.eq;if("number"==typeof n||"string"==typeof n||"boolean"==typeof n||c.array(n))if(c.array(n)){for(var r=0;r<n.length;r++)if(e===n[r])return;this.report("must be equal to ["+n.map(function(t){return'"'+t+'"'}).join(" or ")+'], but is equal to "'+e+'"',null,"eq")}else e!==n&&this.report('must be equal to "'+n+'", but is equal to "'+e+'"',null,"eq")}},ne:function(t,e){if("number"==typeof e||"string"==typeof e){var n=t.ne;if("number"==typeof n||"string"==typeof n||c.array(n))if(c.array(n)){for(var r=0;r<n.length;r++)if(e===n[r])return void this.report('must not be equal to "'+n[r]+'"',null,"ne")}else e===n&&this.report('must not be equal to "'+n+'"',null,"ne")}},someKeys:function(t,e){var n=t.someKeys;c.object(e)&&(n.some(function(t){return t in e})||this.report("must have at least key "+n.map(function(t){return'"'+t+'"'}).join(" or "),null,"someKeys"))},strict:function(t,e){if("string"==typeof t.strict&&(t.strict="true"===t.strict),!0===t.strict&&c.object(e)&&c.object(t.properties)&&void 0===t.properties["*"]){var n=Object.keys(e).filter(function(e){return void 0===t.properties[e]});if(n.length>0){var r="should not contains "+(n.length>1?"properties":"property")+" ["+n.map(function(t){return'"'+t+'"'}).join(", ")+"]";this.report(r,null,"strict")}}},exec:function(t,e,n){var r=this;if("function"==typeof n)return this.asyncExec(t,e,n);(c.array(t.exec)?t.exec:[t.exec]).forEach(function(n){"function"==typeof n&&n.call(r,t,e)})},properties:function(t,e,n){if("function"==typeof n)return this.asyncProperties(t,e,n);if(t.properties instanceof Object&&e instanceof Object){var r,i=t.properties;if(null!=i["*"])for(r in e)r in i||(this._deeperObject(r),this._validate(i["*"],e[r]),this._back());for(r in i)"*"!==r&&(this._deeperObject(r),this._validate(i[r],e[r]),this._back())}},items:function(t,e,n){if("function"==typeof n)return this.asyncItems(t,e,n);if(t.items instanceof Object&&e instanceof Object){var r,i,o=t.items;if(c.array(o)&&c.array(e))for(r=0,i=o.length;r<i;r++)this._deeperArray(r),this._validate(o[r],e[r]),this._back();else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this._deeperArray(s),this._validate(o,e[s]),this._back())}}},p={asyncExec:function(t,e,n){var i=this;r.eachSeries(c.array(t.exec)?t.exec:[t.exec],function(n,o){if("function"==typeof n){if(n.length>2)return n.call(i,t,e,o);n.call(i,t,e)}r.nextTick(o)},n)},asyncProperties:function(t,e,n){if(!(t.properties instanceof Object&&c.object(e)))return n();var i=this,o=t.properties;r.series([function(t){if(null==o["*"])return t();r.eachSeries(Object.keys(e),function(t,n){if(t in o)return r.nextTick(n);i._deeperObject(t),i._asyncValidate(o["*"],e[t],function(t){i._back(),n(t)})},t)},function(t){r.eachSeries(Object.keys(o),function(t,n){if("*"===t)return r.nextTick(n);i._deeperObject(t),i._asyncValidate(o[t],e[t],function(t){i._back(),n(t)})},t)}],n)},asyncItems:function(t,e,n){if(!(t.items instanceof Object&&e instanceof Object))return n();var i=this,o=t.items;c.array(o)&&c.array(e)?r.timesSeries(o.length,function(t,n){i._deeperArray(t),i._asyncValidate(o[t],e[t],function(t,e){i._back(),n(t,e)}),i._back()},n):r.eachSeries(Object.keys(e),function(t,n){i._deeperArray(t),i._asyncValidate(o,e[t],function(t,e){i._back(),n(t,e)})},n)}};function d(t,e){a.prototype.constructor.call(this,t,o(d.custom,e));var n=[];this._basicFields=Object.keys(h),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t,e,r){var i={code:e||this.userCode||null,reason:r||"unknown",message:this.userError||t||"is invalid",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};return n.push(i),this},this.result=function(){return{error:n,valid:0===n.length,format:function(){return!0===this.valid?"Candidate is valid":this.error.map(function(t){return"Property "+t.property+": "+t.message}).join("\n")}}}}i(d.prototype,h),i(d.prototype,p),i(d,new s),d.prototype.validate=function(t,e){if(this.origin=t,"function"==typeof e){var n=this;return r.nextTick(function(){n._asyncValidate(n._schema,t,function(t){n.origin=null,e(t,n.result())})})}return this._validate(this._schema,t).result()},d.prototype._validate=function(t,e,n){return this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,this._basicFields.forEach(function(n){!(n in t)&&"optional"!==n||"function"!=typeof this[n]||this[n](t,e)},this),this._customFields.forEach(function(n){n in t&&"function"==typeof this._custom[n]&&this._custom[n].call(this,t,e)},this),this},d.prototype._asyncValidate=function(t,e,n){var i=this;this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,r.series([function(n){r.eachSeries(Object.keys(h),function(n,o){r.nextTick(function(){if((n in t||"optional"===n)&&"function"==typeof i[n]){if(i[n].length>2)return i[n](t,e,o);i[n](t,e)}o()})},n)},function(n){r.eachSeries(Object.keys(i._custom),function(n,o){r.nextTick(function(){if(n in t&&"function"==typeof i._custom[n]){if(i._custom[n].length>2)return i._custom[n].call(i,t,e,o);i._custom[n].call(i,t,e)}o()})},n)}],n)};var y={number:function(t,e){var n;if("number"==typeof t)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(n=parseFloat(t.replace(/,/g,".").replace(/ /g,""))))return n}else if(t instanceof Date)return+t;return null},integer:function(t,e){var n;if("number"==typeof t&&t%1==0)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(n=parseInt(t.replace(/ /g,""),10)))return n}else{if("number"==typeof t)return parseInt(t,10);if("boolean"==typeof t)return t?1:0;if(t instanceof Date)return+t}return null},string:function(t,e){return"boolean"==typeof t||"number"==typeof t||t instanceof Date?t.toString():c.array(t)?e.items||e.properties?t:t.join(String(e.joinWith||",")):t instanceof Object?e.items||e.properties?t:JSON.stringify(t):"string"==typeof t&&t.length?t:null},date:function(t,e){if(t instanceof Date)return t;var n=new Date(t);return isNaN(n.getTime())?null:n},boolean:function(t,e){return void 0===t?null:("string"!=typeof t||"false"!==t.toLowerCase())&&!!t},object:function(t,e){if("string"!=typeof t||c.object(t))return t;try{return JSON.parse(t)}catch(t){return null}},array:function(t,e){if(c.array(t))return t;if(void 0===t)return null;if("string"==typeof t){if("["===t.substring(0,1)&&"]"===t.slice(-1))try{return JSON.parse(t)}catch(t){return null}return t.split(String(e.splitWith||","))}return c.array(t)?null:[t]}},g={upper:function(t){return t.toUpperCase()},lower:function(t){return t.toLowerCase()},title:function(t){return t.replace(/\S*/g,function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()})},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.substr(1)},trim:function(t){return t.trim()}},m={strict:function(t,e){return"string"==typeof t.strict&&(t.strict="true"===t.strict),!0!==t.strict?e:c.object(t.properties)&&c.object(e)?(Object.keys(e).forEach(function(n){n in t.properties||delete e[n]}),e):e},optional:function(t,e){return!0===("boolean"==typeof t.optional?t.optional:"false"!==t.optional)||void 0!==e?e:(this.report(),t.def===Date?new Date:t.def)},type:function(t,e){if("string"!=typeof t.type||"function"!=typeof y[t.type])return e;var n,r="boolean"!=typeof t.optional||t.optional;return"function"==typeof y[t.type]?(null===(n=y[t.type](e,t))&&!r||!n&&isNaN(n)||null===n&&"string"===t.type)&&(n=t.def):r||(n=t.def),(null!=n||void 0!==t.def&&t.def===n)&&n!==e?(this.report(),n):e},rules:function(t,e){var n=t.rules;if("string"!=typeof e||"string"!=typeof n&&!c.array(n))return e;var r=!1;return(c.array(n)?n:[n]).forEach(function(t){"function"==typeof g[t]&&(e=g[t](e),r=!0)}),r&&this.report(),e},min:function(t,e){var n=Number(e);if(isNaN(n))return e;var r=Number(t.min);return isNaN(r)?e:n<r?(this.report(),r):e},max:function(t,e){var n=Number(e);if(isNaN(n))return e;var r=Number(t.max);return isNaN(r)?e:n>r?(this.report(),r):e},minLength:function(t,e){var n=Number(t.minLength);if("string"!=typeof e||isNaN(n)||n<0)return e;var r="",i=n-e.length;if(i>0){for(var o=0;o<i;o++)r+="-";return this.report(),e+r}return e},maxLength:function(t,e){var n=Number(t.maxLength);return"string"!=typeof e||isNaN(n)||n<0?e:e.length>n?(this.report(),e.slice(0,n)):e},properties:function(t,e,n){if("function"==typeof n)return this.asyncProperties(t,e,n);if(!e||"object"!=typeof e)return e;var r,i,o=t.properties;if(void 0!==o["*"])for(i in e)i in o||(this._deeperObject(i),(void 0!==(r=this._sanitize(o["*"],e[i]))||"exec"in o["*"])&&(e[i]=r),this._back());for(i in o)"*"!==i&&(this._deeperObject(i),(void 0!==(r=this._sanitize(o[i],e[i]))||"exec"in o[i])&&(e[i]=r),this._back());return e},items:function(t,e,n){if("function"==typeof n)return this.asyncItems(t,e,n);if(!(t.items instanceof Object&&e instanceof Object))return e;var r;if(c.array(t.items)&&c.array(e)){var i=t.items.length<e.length?t.items.length:e.length;for(r=0;r<i;r++)this._deeperArray(r),e[r]=this._sanitize(t.items[r],e[r]),this._back()}else for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._deeperArray(r),e[r]=this._sanitize(t.items,e[r]),this._back());return e},exec:function(t,e,n){return"function"==typeof n?this.asyncExec(t,e,n):((c.array(t.exec)?t.exec:[t.exec]).forEach(function(n){"function"==typeof n&&(e=n.call(this,t,e))},this),e)}},b={asyncExec:function(t,e,n){var i=this,o=c.array(t.exec)?t.exec:[t.exec];r.eachSeries(o,function(n,r){if("function"==typeof n){if(n.length>2)return n.call(i,t,e,function(t,n){if(t)return r(t);e=n,r()});e=n.call(i,t,e)}r()},function(t){n(t,e)})},asyncProperties:function(t,e,n){if(!e||"object"!=typeof e)return n(null,e);var i=this,o=t.properties;r.series([function(t){if(null==o["*"])return t();var n=o["*"];r.eachSeries(Object.keys(e),function(t,r){if(t in o)return r();i._deeperObject(t),i._asyncSanitize(n,e[t],function(n,o){void 0!==o&&(e[t]=o),i._back(),r()})},t)},function(t){r.eachSeries(Object.keys(o),function(t,n){if("*"===t)return n();i._deeperObject(t),i._asyncSanitize(o[t],e[t],function(r,o){if(r)return n(r);void 0!==o&&(e[t]=o),i._back(),n()})},t)}],function(t){return n(t,e)})},asyncItems:function(t,e,n){if(!(t.items instanceof Object&&e instanceof Object))return n(null,e);var i=this,o=t.items;if(c.array(o)&&c.array(e)){var s=o.length<e.length?o.length:e.length;r.timesSeries(s,function(t,n){i._deeperArray(t),i._asyncSanitize(o[t],e[t],function(r,o){if(r)return n(r);e[t]=o,i._back(),n()})},function(t){n(t,e)})}else r.eachSeries(Object.keys(e),function(t,n){i._deeperArray(t),i._asyncSanitize(o,e[t],function(r,o){if(r)return n();e[t]=o,i._back(),n()})},function(t){n(t,e)});return e}};function w(t,e){a.prototype.constructor.call(this,t,o(w.custom,e));var n=[];this._basicFields=Object.keys(m),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t){var e={message:t||"was sanitized",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};n.some(function(t){return t.property===e.property})||n.push(e)},this.result=function(t){return{data:t,reporting:n,format:function(){return this.reporting.map(function(t){return"Property "+t.property+" "+t.message}).join("\n")}}}}i(w.prototype,m),i(w.prototype,b),i(w,new s),w.prototype.sanitize=function(t,e){if(this.origin=t,"function"==typeof e){var n=this;return this._asyncSanitize(this._schema,t,function(t,r){n.origin=null,e(t,n.result(r))})}var r=this._sanitize(this._schema,t);return this.origin=null,this.result(r)},w.prototype._sanitize=function(t,e){return this.userAlias=t.alias||null,this._basicFields.forEach(function(n){!(n in t)&&"optional"!==n||"function"!=typeof this[n]||(e=this[n](t,e))},this),this._customFields.forEach(function(n){n in t&&"function"==typeof this._custom[n]&&(e=this._custom[n].call(this,t,e))},this),e},w.prototype._asyncSanitize=function(t,e,n){var i=this;this.userAlias=t.alias||null,r.waterfall([function(n){r.reduce(i._basicFields,e,function(e,n,o){r.nextTick(function(){if((n in t||"optional"===n)&&"function"==typeof i[n]){if(i[n].length>2)return i[n](t,e,o);e=i[n](t,e)}o(null,e)})},n)},function(e,n){r.reduce(i._customFields,e,function(e,n,o){r.nextTick(function(){if(n in t&&"function"==typeof i._custom[n]){if(i._custom[n].length>2)return i._custom[n].call(i,t,e,o);e=i._custom[n].call(i,t,e)}o(null,e)})},n)}],n)};var v=2147483647,x={int:function(t,e){return t+(0|Math.random()*(e-t+1))},float:function(t,e){return Math.random()*(e-t)+t},bool:function(){return Math.random()>.5},char:function(t,e){return String.fromCharCode(this.int(t,e))},fromList:function(t){return t[this.int(0,t.length-1)]}},E={"date-time":function(){return(new Date).toISOString()},date:function(){return(new Date).toISOString().replace(/T.*$/,"")},time:function(){return(new Date).toLocaleTimeString({},{hour12:!1})},color:function(t,e){var n="#";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("0123456789abcdefABCDEF");return n},numeric:function(){return""+x.int(0,v)},integer:function(){return!0===x.bool()?"-"+this.numeric():this.numeric()},decimal:function(){return this.integer()+"."+this.numeric()},alpha:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return n},alphaNumeric:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");return n},alphaDash:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("_-abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789_-");return n},javascript:function(t,e){for(var n=x.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),r=0,i=x.int(t,e-1);r<i;r++)n+=x.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$0123456789_$");return n}};function S(t){var e=-2147483648,n=v;return null!=t.gte?e=t.gte:null!=t.gt&&(e=t.gt+1),null!=t.lte?n=t.lte:null!=t.lt&&(n=t.lt-1),{min:e,max:n}}var A={string:function(t){if(null!=t.eq)return t.eq;var e="",n=null!=t.minLength?t.minLength:0,r=null!=t.maxLength?t.maxLength:32;if("string"==typeof t.pattern&&"function"==typeof E[t.pattern])return E[t.pattern](n,r);for(var i=null!=t.exactLength?t.exactLength:x.int(n,r),o=0;o<i;o++)e+=x.char(32,126);return e},number:function(t){if(null!=t.eq)return t.eq;var e=S(t),n=x.float(e.min,e.max);if(null!=t.ne)for(var r=c.array(t.ne)?t.ne:[t.ne];-1!==r.indexOf(n);)n=x.float(e.min,e.max);return n},integer:function(t){if(null!=t.eq)return t.eq;var e=S(t),n=x.int(e.min,e.max);if(null!=t.ne)for(var r=c.array(t.ne)?t.ne:[t.ne];-1!==r.indexOf(n);)n=x.int(e.min,e.max);return n},boolean:function(t){return null!=t.eq?t.eq:x.bool()},null:function(t){return null},date:function(t){return null!=t.eq?t.eq:new Date},object:function(t){var e={},n=t.properties||{};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(!0===n[r].optional&&!0===x.bool())continue;if("*"!==r)e[r]=this.generate(n[r]);else for(var i="__random_key_",o=i+0,s=x.int(1,9),a=1;a<=s;a++)o in n||(e[o]=this.generate(n[r])),o=i+a}return e},array:function(t){var e,n,r,i,o=t.items||{},s=null!=t.minLength?t.minLength:0,a=null!=t.maxLength?t.maxLength:16;if(c.array(o))for(r=o.length,null!=t.exactLength?r=t.exactLength:r<s?r=s:r>a&&(r=a),n=new Array(r),e=null,i=0;i<r;i++)e=o[i].type||"any",c.array(e)&&(e=e[x.int(0,e.length-1)]),n[i]=this[e](o[i]);else for(r=null!=t.exactLength?t.exactLength:x.int(s,a),n=new Array(r),e=o.type||"any",c.array(e)&&(e=e[x.int(0,e.length-1)]),i=0;i<r;i++)n[i]=this[e](o);return n},any:function(t){var e=Object.keys(A);return this[e[x.int(0,e.length-2)]](t)}};function k(){}i(k.prototype,A);var _=null;k.instance=function(){return _ instanceof k||(_=new k),_},k.prototype.generate=function(t){var e=t.type||"any";return c.array(e)&&(e=e[x.int(0,e.length-1)]),this[e](t)};var O={};t.exports?t.exports=O:window.SchemaInspector=O,O.newSanitization=function(t,e){return new w(t,e)},O.newValidation=function(t,e){return new d(t,e)},O.Validation=d,O.Sanitization=w,O.sanitize=function(t,e,n,r){return 3===arguments.length&&"function"==typeof n&&(r=n,n=null),new w(t,n).sanitize(e,r)},O.validate=function(t,e,n,r){return 3===arguments.length&&"function"==typeof n&&(r=n,n=null),new d(t,n).validate(e,r)},O.generate=function(t,e){if("number"==typeof e){for(var n=new Array(e),r=0;r<e;r++)n[r]=k.instance().generate(t);return n}return k.instance().generate(t)}}()},818:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(418),e),i(n(402),e),i(n(574),e),i(n(87),e),i(n(546),e)},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)}},886:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=e.unescape=e.escape=e.pad=void 0;const r=n(991);function i(t){return`${t}${"=".repeat(4-(t.length%4||4))}`}function o(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function s(t){return i(t).replace(/-/g,"+").replace(/_/g,"/")}e.pad=i,e.escape=o,e.unescape=s,e.encode=function(t){return o((0,r.fromByteArray)((new TextEncoder).encode(t)))},e.decode=function(t){return(new TextDecoder).decode((0,r.toByteArray)(i(s(t))))}},907:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,c=[],u=!1,f=-1;function l(){u&&a&&(u=!1,a.length?c=a.concat(c):f=-1,c.length&&h())}function h(){if(!u){var t=s(l);u=!0;for(var e=c.length;e;){for(a=c,c=[];++f<e;)a&&a[f].run();f=-1,e=c.length}a=null,u=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function d(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||u||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=d,r.addListener=d,r.once=d,r.off=d,r.removeListener=d,r.removeAllListeners=d,r.emit=d,r.prependListener=d,r.prependOnceListener=d,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},951:()=>{},976:()=>{},991:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],c=o[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),f=0,l=c>0?s-4:s;for(n=0;n<l;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[f++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e),u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,c=r-i;a<c;a+=s)o.push(u(t,a,a+s>c?c:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function u(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(c(r));return i.join("")}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].call(o.exports,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";i.r(o),i.d(o,{BLOCKSTACK_GAIA_HUB_LABEL:()=>Mn,GaiaHubConfig:()=>t.GaiaHubConfig,Storage:()=>Xn,connectToGaiaHub:()=>Gn,deleteFromGaiaHub:()=>Vn,getBucketUrl:()=>Wn,getFullReadUrl:()=>Kn,getUserAppFileUrl:()=>Yn,uploadToGaiaHub:()=>qn});var t={};i.r(t),i.d(t,{me:()=>Mn,HV:()=>Gn,BP:()=>Vn,zz:()=>Jn,ah:()=>Wn,tH:()=>Kn,Sz:()=>qn});const e=33,n={referrerPolicy:"origin",headers:{"x-hiro-product":"stacksjs"}};async function r(t,e){const r={};return Object.assign(r,n,e),await fetch(t,r)}function s(...t){const{fetchLib:e,middlewares:n}=function(t){let e=r,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 a,c,u,f,l;!function(t){t[t.Mainnet=1]="Mainnet",t[t.Testnet=2147483648]="Testnet"}(a||(a={})),function(t){t[t.Mainnet=385875968]="Mainnet",t[t.Testnet=4278190080]="Testnet"}(c||(c={})),a.Mainnet,(l=u||(u={}))[l.Mainnet=0]="Mainnet",l[l.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"}(f||(f={})),u.Mainnet;const h={chainId:a.Mainnet,transactionVersion:u.Mainnet,peerNetworkId:c.Mainnet,magicBytes:"X2",bootAddress:"SP000000000000000000002Q6VF78",addressVersion:{singleSig:f.MainnetSingleSig,multiSig:f.MainnetMultiSig},client:{baseUrl:"https://api.mainnet.hiro.so"}},p={chainId:a.Testnet,transactionVersion:u.Testnet,peerNetworkId:c.Testnet,magicBytes:"T2",bootAddress:"ST000000000000000000002AMW42H",addressVersion:{singleSig:f.TestnetSingleSig,multiSig:f.TestnetMultiSig},client:{baseUrl:"https://api.testnet.hiro.so"}},d={...p,addressVersion:{...p.addressVersion},magicBytes:"id",client:{baseUrl:"http://localhost:3999"}},y={...d,addressVersion:{...d.addressVersion},client:{...d.client}};function g(t){return"string"==typeof t?function(t){switch(t){case"mainnet":return h;case"testnet":return p;case"devnet":return d;case"mocknet":return y;default:throw new Error(`Unknown network name: ${t}`)}}(t):t}function m(t){return t.client.fetch?t.client:{...t.client,fetch:s()}}var b=i(818);const w=["debug","info","warn","error","none"],v={},x={};for(let t=0;t<w.length;t++){const e=w[t];v[e]=t,x[t]=e}class E{static error(t){this.shouldLog("error")&&console.error(this.logMessage("error",t))}static warn(t){this.shouldLog("warn")&&console.warn(this.logMessage("warn",t))}static info(t){this.shouldLog("info")&&console.log(this.logMessage("info",t))}static debug(t){this.shouldLog("debug")&&console.log(this.logMessage("debug",t))}static logMessage(t,e){return`[${t.toUpperCase()}] ${e}`}static shouldLog(t){return v.debug<=v[t]}}function S(t){return Number.isFinite(t)?Math.floor(1024*t*1024):0}function A(){let t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)})}function k(t,{throwIfUnavailable:e,usageDesc:n,returnEmptyObject:r}={}){let o;try{if(o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i.g)return i.g;throw new Error("Unexpected runtime environment - no supported global scope (`window`, `self`, `global`) available")}(),o){const e=o[t];if(e)return e}}catch(e){E.error(`Error getting object '${t}' from global scope '${o}': ${e}`)}if(e){const e=function(t,e,n){return n?`Use of '${n}' requires \`${e}\` which is unavailable on the '${t}' object within the currently executing environment.`:`\`${e}\` is unavailable on the '${t}' object within the currently executing environment.`}(o,t.toString(),n);throw E.error(e),new Error(e)}if(r)return{}}const _=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function O(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(const n of t)e+=_[n];return e}function j(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);var e;t=(e=t,t=/^0x/i.test(e)?e.slice(2):e).length%2?`0${t}`:t;const n=new Uint8Array(t.length/2);for(let e=0;e<n.length;e++){const r=2*e,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[e]=o}return n}function T(t){return(new TextEncoder).encode(t)}function F(...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 C(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${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}`)}const U={number:C,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:I,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");C(t.outputLen),C(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){I(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}},L=("object"==typeof self&&"crypto"in self&&self.crypto,t=>new DataView(t.buffer,t.byteOffset,t.byteLength)),N=(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 B(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 P{clone(){return this._cloneInto()}}function $(t){const e=e=>t().update(B(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}class H extends P{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,U.hash(t);const n=B(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){return U.exists(this),this.iHash.update(t),this}digestInto(t){U.exists(this),U.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=r,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const D=(t,e,n)=>new H(t,e).update(n).digest();D.create=(t,e)=>new H(t,e);class R extends P{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=L(this.buffer)}update(t){U.exists(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=B(t)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s===r){const e=L(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){U.exists(this),U.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=L(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 z=(t,e,n)=>t&e^~t&n,M=(t,e,n)=>t&e^t&n^e&n,q=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]),V=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),K=new Uint32Array(64);class G extends R{constructor(){super(64,32,8,!1),this.A=0|V[0],this.B=0|V[1],this.C=0|V[2],this.D=0|V[3],this.E=0|V[4],this.F=0|V[5],this.G=0|V[6],this.H=0|V[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)K[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=K[t-15],n=K[t-2],r=N(e,7)^N(e,18)^e>>>3,i=N(n,17)^N(n,19)^n>>>10;K[t]=i+K[t-7]+r+K[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+(N(s,6)^N(s,11)^N(s,25))+z(s,a,c)+q[t]+K[t]|0,f=(N(n,2)^N(n,13)^N(n,22))+M(n,r,i)|0;u=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+f|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(){K.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class W extends G{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 J=$(()=>new G);$(()=>new W);var Z=i(976),X=i.t(Z,2);const Y=BigInt(0),Q=BigInt(1),tt=BigInt(2),et=BigInt(3),nt=BigInt(8),rt=Object.freeze({a:Y,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:Q,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),it=(t,e)=>(t+e/tt)/e,ot={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=rt,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Q*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=it(o*t,e),c=it(-r*t,e);let u=Lt(t-a*n-c*i,e),f=Lt(-a*r-c*o,e);const l=u>s,h=f>s;if(l&&(u=e-u),h&&(f=e-f),u>s||f>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:l,k1:u,k2neg:h,k2:f}}},st=32,at=32,ct=32,ut=st+1,ft=2*st+1;function lt(t){const{a:e,b:n}=rt,r=Lt(t*t),i=Lt(r*t);return Lt(i+e*t+n)}const ht=rt.a===Y;class pt extends Error{constructor(t){super(t)}}function dt(t){if(!(t instanceof yt))throw new TypeError("JacobianPoint expected")}class yt{constructor(t,e,n){this.x=t,this.y=e,this.z=n}static fromAffine(t){if(!(t instanceof bt))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(bt.ZERO)?yt.ZERO:new yt(t.x,t.y,Q)}static toAffineBatch(t){const e=function(t,e=rt.P){const n=new Array(t.length),r=Bt(t.reduce((t,r,i)=>r===Y?t:(n[i]=t,Lt(t*r,e)),Q),e);return t.reduceRight((t,r,i)=>r===Y?t:(n[i]=Lt(t*n[i],e),Lt(t*r,e)),r),n}(t.map(t=>t.z));return t.map((t,n)=>t.toAffine(e[n]))}static normalizeZ(t){return yt.toAffineBatch(t).map(yt.fromAffine)}equals(t){dt(t);const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t,a=Lt(r*r),c=Lt(s*s),u=Lt(e*c),f=Lt(i*a),l=Lt(Lt(n*s)*c),h=Lt(Lt(o*r)*a);return u===f&&l===h}negate(){return new yt(this.x,Lt(-this.y),this.z)}double(){const{x:t,y:e,z:n}=this,r=Lt(t*t),i=Lt(e*e),o=Lt(i*i),s=t+i,a=Lt(tt*(Lt(s*s)-r-o)),c=Lt(et*r),u=Lt(c*c),f=Lt(u-tt*a),l=Lt(c*(a-f)-nt*o),h=Lt(tt*e*n);return new yt(f,l,h)}add(t){dt(t);const{x:e,y:n,z:r}=this,{x:i,y:o,z:s}=t;if(i===Y||o===Y)return this;if(e===Y||n===Y)return t;const a=Lt(r*r),c=Lt(s*s),u=Lt(e*c),f=Lt(i*a),l=Lt(Lt(n*s)*c),h=Lt(Lt(o*r)*a),p=Lt(f-u),d=Lt(h-l);if(p===Y)return d===Y?this.double():yt.ZERO;const y=Lt(p*p),g=Lt(p*y),m=Lt(u*y),b=Lt(d*d-g-tt*m),w=Lt(d*(m-b)-l*g),v=Lt(r*s*p);return new yt(b,w,v)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=yt.ZERO;if("bigint"==typeof t&&t===Y)return e;let n=Ut(t);if(n===Q)return this;if(!ht){let t=e,r=this;for(;n>Y;)n&Q&&(t=t.add(r)),r=r.double(),n>>=Q;return t}let{k1neg:r,k1:i,k2neg:o,k2:s}=ot.splitScalar(n),a=e,c=e,u=this;for(;i>Y||s>Y;)i&Q&&(a=a.add(u)),s&Q&&(c=c.add(u)),u=u.double(),i>>=Q,s>>=Q;return r&&(a=a.negate()),o&&(c=c.negate()),c=new yt(Lt(c.x*ot.beta),c.y,c.z),a.add(c)}precomputeWindow(t){const e=ht?128/t+1:256/t+1,n=[];let r=this,i=r;for(let o=0;o<e;o++){i=r,n.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(t,e){!e&&this.equals(yt.BASE)&&(e=bt.BASE);const n=e&&e._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=e&&mt.get(e);r||(r=this.precomputeWindow(n),e&&1!==n&&(r=yt.normalizeZ(r),mt.set(e,r)));let i=yt.ZERO,o=yt.BASE;const s=1+(ht?128/n:256/n),a=2**(n-1),c=BigInt(2**n-1),u=2**n,f=BigInt(n);for(let e=0;e<s;e++){const n=e*a;let s=Number(t&c);t>>=f,s>a&&(s-=u,t+=Q);const l=n,h=n+Math.abs(s)-1,p=e%2!=0,d=s<0;0===s?o=o.add(gt(p,r[l])):i=i.add(gt(d,r[h]))}return{p:i,f:o}}multiply(t,e){let n,r,i=Ut(t);if(ht){const{k1neg:t,k1:o,k2neg:s,k2:a}=ot.splitScalar(i);let{p:c,f:u}=this.wNAF(o,e),{p:f,f:l}=this.wNAF(a,e);c=gt(t,c),f=gt(s,f),f=new yt(Lt(f.x*ot.beta),f.y,f.z),n=c.add(f),r=u.add(l)}else{const{p:t,f:o}=this.wNAF(i,e);n=t,r=o}return yt.normalizeZ([n,r])[0]}toAffine(t){const{x:e,y:n,z:r}=this,i=this.equals(yt.ZERO);null==t&&(t=i?nt:Bt(r));const o=t,s=Lt(o*o),a=Lt(s*o),c=Lt(e*s),u=Lt(n*a),f=Lt(r*o);if(i)return bt.ZERO;if(f!==Q)throw new Error("invZ was invalid");return new bt(c,u)}}function gt(t,e){const n=e.negate();return t?n:e}yt.BASE=new yt(rt.Gx,rt.Gy,Q),yt.ZERO=new yt(Y,Q,Y);const mt=new WeakMap;class bt{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,mt.delete(this)}hasEvenY(){return this.y%tt===Y}static fromCompressedHex(t){const e=32===t.length,n=Ct(e?t:t.subarray(1));if(!zt(n))throw new Error("Point is not on curve");let r=function(t){const{P:e}=rt,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),c=t*t*t%e,u=c*c*t%e,f=Nt(u,et)*u%e,l=Nt(f,et)*u%e,h=Nt(l,tt)*c%e,p=Nt(h,r)*h%e,d=Nt(p,i)*p%e,y=Nt(d,s)*d%e,g=Nt(y,a)*y%e,m=Nt(g,s)*d%e,b=Nt(m,et)*u%e,w=Nt(b,o)*p%e,v=Nt(w,n)*c%e,x=Nt(v,tt);if(x*x%e!==t)throw new Error("Cannot find square root");return x}(lt(n));const i=(r&Q)===Q;e?i&&(r=Lt(-r)):!(1&~t[0])!==i&&(r=Lt(-r));const o=new bt(n,r);return o.assertValidity(),o}static fromUncompressedHex(t){const e=Ct(t.subarray(1,st+1)),n=Ct(t.subarray(st+1,2*st+1)),r=new bt(e,n);return r.assertValidity(),r}static fromHex(t){const e=It(t),n=e.length,r=e[0];if(n===st)return this.fromCompressedHex(e);if(n===ut&&(2===r||3===r))return this.fromCompressedHex(e);if(n===ft&&4===r)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-${ut} compressed bytes or ${ft} uncompressed bytes, not ${n}`)}static fromPrivateKey(t){return bt.BASE.multiply(qt(t))}static fromSignature(t,e,n){const{r,s:i}=Vt(e);if(![0,1,2,3].includes(n))throw new Error("Cannot recover: invalid recovery bit");const o=Pt(It(t)),{n:s}=rt,a=2===n||3===n?r+s:r,c=Bt(a,s),u=Lt(-o*c,s),f=Lt(i*c,s),l=1&n?"03":"02",h=bt.fromHex(l+_t(a)),p=bt.BASE.multiplyAndAddUnsafe(h,u,f);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(t=!1){return Ft(this.toHex(t))}toHex(t=!1){const e=_t(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${_t(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:n}=this;if(!zt(e)||!zt(n))throw new Error(t);const r=Lt(n*n);if(Lt(r-lt(e))!==Y)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new bt(this.x,Lt(-this.y))}double(){return yt.fromAffine(this).double().toAffine()}add(t){return yt.fromAffine(this).add(yt.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return yt.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,n){const r=yt.fromAffine(this),i=e===Y||e===Q||this!==bt.BASE?r.multiplyUnsafe(e):r.multiply(e),o=yt.fromAffine(t).multiplyUnsafe(n),s=i.add(o);return s.equals(yt.ZERO)?void 0:s.toAffine()}}function wt(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function vt(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${At(t)}`);const e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Ct(n),left:t.subarray(e+2)}}bt.BASE=new bt(rt.Gx,rt.Gy),bt.ZERO=new bt(Y,Y);class xt{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,n="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${n}: Expected string or Uint8Array`);const r=e?At(t):t;if(128!==r.length)throw new Error(`${n}: Expected 64-byte hex`);return new xt(Tt(r.slice(0,64)),Tt(r.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:n,s:r}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${At(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:n}=vt(t.subarray(2)),{data:r,left:i}=vt(n);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${At(i)}`);return{r:e,s:r}}(e?t:Ft(t));return new xt(n,r)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!Rt(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Rt(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=rt.n>>Q;return this.s>t}normalizeS(){return this.hasHighS()?new xt(this.r,Lt(-this.s,rt.n)):this}toDERRawBytes(){return Ft(this.toDERHex())}toDERHex(){const t=wt(jt(this.s)),e=wt(jt(this.r)),n=t.length/2,r=e.length/2,i=jt(n),o=jt(r);return`30${jt(r+n+4)}02${o}${e}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Ft(this.toCompactHex())}toCompactHex(){return _t(this.r)+_t(this.s)}}function Et(...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}const St=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function At(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let n=0;n<t.length;n++)e+=St[t[n]];return e}const kt=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function _t(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(Y<=t&&t<kt))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function Ot(t){const e=Ft(_t(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function jt(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function Tt(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function Ft(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"+t.length);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 Ct(t){return Tt(At(t))}function It(t){return t instanceof Uint8Array?Uint8Array.from(t):Ft(t)}function Ut(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&Rt(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Lt(t,e=rt.P){const n=t%e;return n>=Y?n:e+n}function Nt(t,e){const{P:n}=rt;let r=t;for(;e-- >Y;)r*=r,r%=n;return r}function Bt(t,e=rt.P){if(t===Y||e<=Y)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Lt(t,e),r=e,i=Y,o=Q,s=Q,a=Y;for(;n!==Y;){const t=r/n,e=r%n,c=i-s*t,u=o-a*t;r=n,n=e,i=s,o=a,s=c,a=u}if(r!==Q)throw new Error("invert: does not exist");return Lt(i,e)}function Pt(t,e=!1){const n=function(t){const e=8*t.length-8*at,n=Ct(t);return e>0?n>>BigInt(e):n}(t);if(e)return n;const{n:r}=rt;return n>=r?n-r:n}let $t,Ht;class Dt{constructor(t,e){if(this.hashLen=t,this.qByteLen=e,"number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}hmac(...t){return Qt.hmacSha256(this.k,...t)}hmacSync(...t){return Ht(this.k,...t)}checkSync(){if("function"!=typeof Ht)throw new pt("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=await this.hmac(this.v);const n=this.v.slice();e.push(n),t+=this.v.length}return Et(...e)}generateSync(){this.checkSync(),this.incr();let t=0;const e=[];for(;t<this.qByteLen;){this.v=this.hmacSync(this.v);const n=this.v.slice();e.push(n),t+=this.v.length}return Et(...e)}}function Rt(t){return Y<t&&t<rt.n}function zt(t){return Y<t&&t<rt.P}function Mt(t,e,n,r=!0){const{n:i}=rt,o=Pt(t,!0);if(!Rt(o))return;const s=Bt(o,i),a=bt.BASE.multiply(o),c=Lt(a.x,i);if(c===Y)return;const u=Lt(s*Lt(e+n*c,i),i);if(u===Y)return;let f=new xt(c,u),l=(a.x===f.r?0:2)|Number(a.y&Q);return r&&f.hasHighS()&&(f=f.normalizeS(),l^=1),{sig:f,recovery:l}}function qt(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(t.length!==2*at)throw new Error("Expected 32 bytes of private key");e=Tt(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(t.length!==at)throw new Error("Expected 32 bytes of private key");e=Ct(t)}if(!Rt(e))throw new Error("Expected private key: 0 < key < n");return e}function Vt(t){if(t instanceof xt)return t.assertValidity(),t;try{return xt.fromDER(t)}catch(e){return xt.fromCompact(t)}}function Kt(t){return Ct(t.length>st?t.slice(0,st):t)}function Gt(t){const e=Kt(t),n=Lt(e,rt.n);return Wt(n<Y?e:n)}function Wt(t){return Ot(t)}function Jt(t,e,n={}){const{seed:r,m:i,d:o}=function(t,e,n){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const r=It(t),i=qt(e),o=[Wt(i),Gt(r)];if(null!=n){!0===n&&(n=Qt.randomBytes(st));const t=It(n);if(t.length!==st)throw new Error(`sign: Expected ${st} bytes of extra data`);o.push(t)}return{seed:Et(...o),m:Kt(r),d:i}}(t,e,n.extraEntropy),s=new Dt(ct,at);let a;for(s.reseedSync(r);!(a=Mt(s.generateSync(),i,o,n.canonical));)s.reseedSync();return function(t,e){const{sig:n,recovery:r}=t,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},e),s=i?n.toDERRawBytes():n.toCompactRawBytes();return o?[s,r]:s}(a,n)}const Zt={strict:!0};bt.BASE._setWindowSize(8);const Xt={node:X,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},Yt={},Qt={bytesToHex:At,hexToBytes:Ft,concatBytes:Et,mod:Lt,invert:Bt,isValidPrivateKey(t){try{return qt(t),!0}catch(t){return!1}},_bigintTo32Bytes:Ot,_normalizePrivateKey:qt,hashToPrivateKey:t=>{t=It(t);const e=at+8;if(t.length<e||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return Ot(Lt(Ct(t),rt.n-Q)+Q)},randomBytes:(t=32)=>{if(Xt.web)return Xt.web.getRandomValues(new Uint8Array(t));if(Xt.node){const{randomBytes:e}=Xt.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Qt.hashToPrivateKey(Qt.randomBytes(at+8)),precompute(t=8,e=bt.BASE){const n=e===bt.BASE?e:new bt(e.x,e.y);return n._setWindowSize(t),n.multiply(et),n},sha256:async(...t)=>{if(Xt.web){const e=await Xt.web.subtle.digest("SHA-256",Et(...t));return new Uint8Array(e)}if(Xt.node){const{createHash:e}=Xt.node,n=e("sha256");return t.forEach(t=>n.update(t)),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(Xt.web){const n=await Xt.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=Et(...e),i=await Xt.web.subtle.sign("HMAC",n,r);return new Uint8Array(i)}if(Xt.node){const{createHmac:n}=Xt.node,r=n("sha256",t);return e.forEach(t=>r.update(t)),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(t,...e)=>{let n=Yt[t];if(void 0===n){const e=await Qt.sha256(Uint8Array.from(t,t=>t.charCodeAt(0)));n=Et(e,e),Yt[t]=n}return Qt.sha256(n,...e)},taggedHashSync:(t,...e)=>{if("function"!=typeof $t)throw new pt("sha256Sync is undefined, you need to set it");let n=Yt[t];if(void 0===n){const e=$t(Uint8Array.from(t,t=>t.charCodeAt(0)));n=Et(e,e),Yt[t]=n}return $t(n,...e)},_JacobianPoint:yt};Object.defineProperties(Qt,{sha256Sync:{configurable:!1,get:()=>$t,set(t){$t||($t=t)}},hmacSha256Sync:{configurable:!1,get:()=>Ht,set(t){Ht||(Ht=t)}}});var te,ee,ne,re,ie=i(258);(re=te||(te={}))[re.TokenTransfer=0]="TokenTransfer",re[re.SmartContract=1]="SmartContract",re[re.VersionedSmartContract=6]="VersionedSmartContract",re[re.ContractCall=2]="ContractCall",re[re.PoisonMicroblock=3]="PoisonMicroblock",re[re.Coinbase=4]="Coinbase",re[re.CoinbaseToAltRecipient=5]="CoinbaseToAltRecipient",re[re.TenureChange=7]="TenureChange",re[re.NakamotoCoinbase=8]="NakamotoCoinbase",function(t){t[t.Clarity1=1]="Clarity1",t[t.Clarity2=2]="Clarity2",t[t.Clarity3=3]="Clarity3",t[t.Clarity4=4]="Clarity4"}(ee||(ee={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(ne||(ne={}));var oe,se,ae,ce,ue,fe,le,he,pe,de,ye,ge,me,be;ne.OnChainOnly,ne.OffChainOnly,ne.Any,ne.OnChainOnly,ne.OnChainOnly,ne.OffChainOnly,ne.OffChainOnly,ne.Any,ne.Any,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(oe||(oe={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(se||(se={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}(ae||(ae={})),(be=ce||(ce={}))[be.P2PKH=0]="P2PKH",be[be.P2SH=1]="P2SH",be[be.P2WPKH=2]="P2WPKH",be[be.P2WSH=3]="P2WSH",be[be.P2SHNonSequential=5]="P2SHNonSequential",be[be.P2WSHNonSequential=7]="P2WSHNonSequential",(me=ue||(ue={}))[me.Compressed=0]="Compressed",me[me.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"}(fe||(fe={})),function(t){t[t.Sends=16]="Sends",t[t.DoesNotSend=17]="DoesNotSend"}(le||(le={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(he||(he={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(pe||(pe={})),function(t){t[t.BlockFound=0]="BlockFound",t[t.Extended=1]="Extended",t[t.ExtendedRuntime=2]="ExtendedRuntime",t[t.ExtendedReadCount=3]="ExtendedReadCount",t[t.ExtendedReadLength=4]="ExtendedReadLength",t[t.ExtendedWriteCount=5]="ExtendedWriteCount",t[t.ExtendedWriteLength=6]="ExtendedWriteLength"}(de||(de={})),function(t){t[t.PublicKeyCompressed=0]="PublicKeyCompressed",t[t.PublicKeyUncompressed=1]="PublicKeyUncompressed",t[t.SignatureCompressed=2]="SignatureCompressed",t[t.SignatureUncompressed=3]="SignatureUncompressed"}(ye||(ye={})),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"}(ge||(ge={}));const we=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),ve=Uint8Array.from({length:16},(t,e)=>e),xe=ve.map(t=>(9*t+5)%16);let Ee=[ve],Se=[xe];for(let t=0;t<4;t++)for(let e of[Ee,Se])e.push(e[t].map(t=>we[t]));const Ae=[[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)),ke=Ee.map((t,e)=>t.map(t=>Ae[e][t])),_e=Se.map((t,e)=>t.map(t=>Ae[e][t])),Oe=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),je=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),Te=(t,e)=>t<<e|t>>>32-e;function Fe(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 Ce=new Uint32Array(16);class Ie extends R{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)Ce[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,f=0|this.h4,l=f;for(let t=0;t<5;t++){const e=4-t,h=Oe[t],p=je[t],d=Ee[t],y=Se[t],g=ke[t],m=_e[t];for(let e=0;e<16;e++){const r=Te(n+Fe(t,i,s,c)+Ce[d[e]]+h,g[e])+f|0;n=f,f=c,c=0|Te(s,10),s=i,i=r}for(let t=0;t<16;t++){const n=Te(r+Fe(e,o,a,u)+Ce[y[t]]+p,m[t])+l|0;r=l,l=u,u=0|Te(a,10),a=o,o=n}}this.set(this.h1+s+u|0,this.h2+c+l|0,this.h3+f+r|0,this.h4+n+o|0,this.h0+i+a|0)}roundClean(){Ce.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const Ue=$(()=>new Ie),Le=BigInt(2**32-1),Ne=BigInt(32);function Be(t,e=!1){return e?{h:Number(t&Le),l:Number(t>>Ne&Le)}:{h:0|Number(t>>Ne&Le),l:0|Number(t&Le)}}const Pe=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}=Be(t[i],e);[n[i],r[i]]=[o,s]}return[n,r]},$e=(t,e,n)=>t>>>n,He=(t,e,n)=>t<<32-n|e>>>n,De=(t,e,n)=>t>>>n|e<<32-n,Re=(t,e,n)=>t<<32-n|e>>>n,ze=(t,e,n)=>t<<64-n|e>>>n-32,Me=(t,e,n)=>t>>>n-32|e<<64-n,qe=function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},Ve=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),Ke=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,Ge=(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,Je=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,Ze=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0),[Xe,Ye]=Pe(["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))),Qe=new Uint32Array(80),tn=new Uint32Array(80);class en extends R{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:f,Fl:l,Gh:h,Gl:p,Hh:d,Hl:y}=this;return[t,e,n,r,i,o,s,a,c,u,f,l,h,p,d,y]}set(t,e,n,r,i,o,s,a,c,u,f,l,h,p,d,y){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|f,this.Fl=0|l,this.Gh=0|h,this.Gl=0|p,this.Hh=0|d,this.Hl=0|y}process(t,e){for(let n=0;n<16;n++,e+=4)Qe[n]=t.getUint32(e),tn[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Qe[t-15],n=0|tn[t-15],r=De(e,n,1)^De(e,n,8)^$e(e,n,7),i=Re(e,n,1)^Re(e,n,8)^He(e,n,7),o=0|Qe[t-2],s=0|tn[t-2],a=De(o,s,19)^ze(o,s,61)^$e(o,s,6),c=Re(o,s,19)^Me(o,s,61)^He(o,s,6),u=Ge(i,c,tn[t-7],tn[t-16]),f=We(u,r,a,Qe[t-7],Qe[t-16]);Qe[t]=0|f,tn[t]=0|u}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:u,Eh:f,El:l,Fh:h,Fl:p,Gh:d,Gl:y,Hh:g,Hl:m}=this;for(let t=0;t<80;t++){const e=De(f,l,14)^De(f,l,18)^ze(f,l,41),b=Re(f,l,14)^Re(f,l,18)^Me(f,l,41),w=f&h^~f&d,v=Ze(m,b,l&p^~l&y,Ye[t],tn[t]),x=Je(v,g,e,w,Xe[t],Qe[t]),E=0|v,S=De(n,r,28)^ze(n,r,34)^ze(n,r,39),A=Re(n,r,28)^Me(n,r,34)^Me(n,r,39),k=n&i^n&s^i&s,_=r&o^r&a^o&a;g=0|d,m=0|y,d=0|h,y=0|p,h=0|f,p=0|l,({h:f,l}=qe(0|c,0|u,0|x,0|E)),c=0|s,u=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const O=Ve(E,A,_);n=Ke(O,x,S,k),r=0|O}({h:n,l:r}=qe(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=qe(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=qe(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=qe(0|this.Dh,0|this.Dl,0|c,0|u)),({h:f,l}=qe(0|this.Eh,0|this.El,0|f,0|l)),({h,l:p}=qe(0|this.Fh,0|this.Fl,0|h,0|p)),({h:d,l:y}=qe(0|this.Gh,0|this.Gl,0|d,0|y)),({h:g,l:m}=qe(0|this.Hh,0|this.Hl,0|g,0|m)),this.set(n,r,i,o,s,a,c,u,f,l,h,p,d,y,g,m)}roundClean(){Qe.fill(0),tn.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 nn extends en{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 rn extends en{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 on extends en{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}}$(()=>new en),$(()=>new nn),$(()=>new rn),$(()=>new on),i(290);var sn,an;function cn(t,e="mainnet"){e=g(e),t="string"==typeof t?j(t):t;const n=function(t,e){switch(e=g(e??h),t){case ce.P2PKH:switch(e.transactionVersion){case u.Mainnet:return f.MainnetSingleSig;case u.Testnet:return f.TestnetSingleSig;default:throw new Error(`Unexpected transactionVersion ${e.transactionVersion} for hashMode ${t}`)}case ce.P2SH:case ce.P2SHNonSequential:case ce.P2WPKH:case ce.P2WSH:case ce.P2WSHNonSequential:switch(e.transactionVersion){case u.Mainnet:return f.MainnetMultiSig;case u.Testnet:return f.TestnetMultiSig;default:throw new Error(`Unexpected transactionVersion ${e.transactionVersion} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${t}`)}}(ce.P2PKH,e);var r,i,o;return o=(r=n,i=O(Ue(J(t))),{type:sn.Address,version:r,hash160:i}),(0,ie.bJ)(o.version,o.hash160)}function un(t,e=null){let n;n=e?function(t,e){const n=(0,b.decodeToken)(t),r=n.payload;if("string"==typeof r)throw new Error("Unexpected token payload type of string");if(!r.hasOwnProperty("subject")||!r.subject)throw new Error("Token doesn't have a subject");if(!r.subject.hasOwnProperty("publicKey"))throw new Error("Token doesn't have a subject public key");if(!r.hasOwnProperty("issuer")||!r.issuer)throw new Error("Token doesn't have an issuer");if(!r.issuer.hasOwnProperty("publicKey"))throw new Error("Token doesn't have an issuer public key");if(!r.hasOwnProperty("claim"))throw new Error("Token doesn't have a claim");const i=r.issuer.publicKey,o=cn(i);if(e===i);else if(e!==o)throw new Error("Token issuer public key does not match the verifying value");const s=new b.TokenVerifier(n.header.alg,i);if(!s)throw new Error("Invalid token verifier");if(!s.verify(t))throw new Error("Token verification failed");return n}(t,e):(0,b.decodeToken)(t);let r={};if(n.hasOwnProperty("payload")){const t=n.payload;if("string"==typeof t)throw new Error("Unexpected token payload type of string");t.hasOwnProperty("claim")&&(r=t.claim)}return r}function fn(t,e){let n;return e.proof&&e.proof.url&&(n=e.proof.url),{"@type":"Account",service:t,identifier:e.username,proofType:"http",proofUrl:n}}(an=sn||(sn={}))[an.Address=0]="Address",an[an.Principal=1]="Principal",an[an.LengthPrefixedString=2]="LengthPrefixedString",an[an.MemoString=3]="MemoString",an[an.Asset=4]="Asset",an[an.PostCondition=5]="PostCondition",an[an.PublicKey=6]="PublicKey",an[an.LengthPrefixedList=7]="LengthPrefixedList",an[an.Payload=8]="Payload",an[an.MessageSignature=9]="MessageSignature",an[an.StructuredDataSignature=10]="StructuredDataSignature",an[an.TransactionAuthField=11]="TransactionAuthField",Qt.hmacSha256Sync=(t,...e)=>{const n=D.create(J,t);return e.forEach(t=>n.update(t)),n.digest()};var ln=i(410),hn=i(13);const pn={type:"object",properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"}}};class dn{constructor(t={}){this._profile=Object.assign({},{"@context":"http://schema.org/"},t)}toJSON(){return Object.assign({},this._profile)}toToken(t){return function(t,e,n,r,i="ES256K",o=new Date,s=function(){return new Date((new Date).setFullYear((new Date).getFullYear()+1))}()){if("ES256K"!==i)throw new Error("Signing algorithm not supported");const a=b.SECP256K1Client.derivePublicKey(e);n||(n={publicKey:a}),r||(r={publicKey:a});const c=new b.TokenSigner(i,e),u={jti:A(),iat:o.toISOString(),exp:s.toISOString(),subject:n,issuer:r,claim:t};return c.sign(u)}(this.toJSON(),t)}static validateSchema(t,e=!1){return pn.strict=e,hn.validate(pn,t)}static fromToken(t,e=null){const n=un(t,e);return new dn(n)}static makeZoneFile(t,e){return function(t,e){if(!e.includes("://"))throw new Error("Invalid token file url");const n=e.split("://")[0],r=e.split("://")[1].split("/"),i={$origin:t,$ttl:3600,uri:[{name:"_http._tcp",priority:10,weight:1,target:`${n}://${r[0]}${`/${r.slice(1).join("/")}`}`}]};return(0,ln.makeZoneFile)(i,"{$origin}\n{$ttl}\n{uri}\n")}(t,e)}}const yn={type:"object",strict:!1,properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"},"@id":{type:"string",optional:!0},name:{type:"string",optional:!0},givenName:{type:"string",optional:!0},familyName:{type:"string",optional:!0},description:{type:"string",optional:!0},image:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},name:{type:"string",optional:!0},contentUrl:{type:"string",optional:!0}}}},website:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},url:{type:"string",optional:!0}}}},account:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},service:{type:"string",optional:!0},identifier:{type:"string",optional:!0},proofType:{type:"string",optional:!0},proofUrl:{type:"string",optional:!0},proofMessage:{type:"string",optional:!0},proofSignature:{type:"string",optional:!0}}}},worksFor:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},knows:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},address:{type:"object",optional:!0,properties:{"@type":{type:"string"},streetAddress:{type:"string",optional:!0},addressLocality:{type:"string",optional:!0},postalCode:{type:"string",optional:!0},addressCountry:{type:"string",optional:!0}}},birthDate:{type:"string",optional:!0},taxID:{type:"string",optional:!0}}};class gn extends dn{constructor(t={"@type":"Person"}){super(t),this._profile=Object.assign({},{"@type":"Person"},this._profile)}static validateSchema(t,e=!1){return yn.strict=e,hn.validate(pn,t)}static fromToken(t,e=null){const n=un(t,e);return new gn(n)}static fromLegacyFormat(t){const e=function(t){const e={"@type":"Person"};if(t){t.name&&t.name.formatted&&(e.name=t.name.formatted),t.bio&&(e.description=t.bio),t.location&&t.location.formatted&&(e.address={"@type":"PostalAddress",addressLocality:t.location.formatted});const n=[];t.avatar&&t.avatar.url&&n.push({"@type":"ImageObject",name:"avatar",contentUrl:t.avatar.url}),t.cover&&t.cover.url&&n.push({"@type":"ImageObject",name:"cover",contentUrl:t.cover.url}),n.length&&(e.image=n),t.website&&(e.website=[{"@type":"WebSite",url:t.website}]);const r=[];t.bitcoin&&t.bitcoin.address&&r.push({"@type":"Account",role:"payment",service:"bitcoin",identifier:t.bitcoin.address}),t.twitter&&t.twitter.username&&r.push(fn("twitter",t.twitter)),t.facebook&&t.facebook.username&&r.push(fn("facebook",t.facebook)),t.github&&t.github.username&&r.push(fn("github",t.github)),t.auth&&t.auth.length>0&&t.auth[0]&&t.auth[0].publicKeychain&&r.push({"@type":"Account",role:"key",service:"bip32",identifier:t.auth[0].publicKeychain}),t.pgp&&t.pgp.url&&r.push({"@type":"Account",role:"key",service:"pgp",identifier:t.pgp.fingerprint,contentUrl:t.pgp.url}),e.account=r}return e}(t);return new gn(e)}toJSON(){return{profile:this.profile(),name:this.name(),givenName:this.givenName(),familyName:this.familyName(),description:this.description(),avatarUrl:this.avatarUrl(),verifiedAccounts:this.verifiedAccounts(),address:this.address(),birthDate:this.birthDate(),connections:this.connections(),organizations:this.organizations()}}profile(){return Object.assign({},this._profile)}name(){return function(t){if(!t)return null;let e=null;return t.name?e=t.name:(t.givenName||t.familyName)&&(e="",t.givenName&&(e=t.givenName),t.familyName&&(e+=` ${t.familyName}`)),e}(this.profile())}givenName(){return function(t){if(!t)return null;let e=null;return t.givenName?e=t.givenName:t.name&&(e=t.name.split(" ").slice(0,-1).join(" ")),e}(this.profile())}familyName(){return function(t){if(!t)return null;let e=null;return t.familyName?e=t.familyName:t.name&&(e=t.name.split(" ").pop()),e}(this.profile())}description(){return function(t){if(!t)return null;let e=null;return t.description&&(e=t.description),e}(this.profile())}avatarUrl(){return function(t){if(!t)return null;let e=null;return t.image&&t.image.map(t=>"avatar"===t.name?(e=t.contentUrl,e):null),e}(this.profile())}verifiedAccounts(t){return function(t,e){if(!t)return null;const n=[];return t.hasOwnProperty("account")&&e&&t.account.map(t=>{let r=!1,i=null;return e.map(e=>(e.hasOwnProperty("proof_url")&&(e.proofUrl=e.proof_url),!(!e.valid||e.service!==t.service||e.identifier!==t.identifier||!e.proofUrl||(r=!0,i=e.proofUrl,0)))),r?(t.proofUrl=i,n.push(t),t):null}),n}(this.profile(),t)}address(){return function(t){if(!t)return null;let e=null;if(t.hasOwnProperty("address")){const n=[];t.address.hasOwnProperty("streetAddress")&&n.push(t.address.streetAddress),t.address.hasOwnProperty("addressLocality")&&n.push(t.address.addressLocality),t.address.hasOwnProperty("postalCode")&&n.push(t.address.postalCode),t.address.hasOwnProperty("addressCountry")&&n.push(t.address.addressCountry),n.length&&(e=n.join(", "))}return e}(this.profile())}birthDate(){return function(t){if(!t)return null;const e=["January","February","March","April","May","June","July","August","September","October","November","December"];let n=null;if(t.hasOwnProperty("birthDate")){const r=new Date(t.birthDate);n=`${e[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`}return n}(this.profile())}connections(){return function(t){if(!t)return null;let e=[];return t.hasOwnProperty("knows")&&(e=t.knows),e}(this.profile())}organizations(){return(t=this.profile())?t.hasOwnProperty("worksFor")?t.worksFor:[]:null;var t}}function mn(t){if(!t.username)return Promise.reject(new Error("No username provided"));const e=g(t.network??"mainnet"),n=Object.assign({},m(e),t.client);let r;if(t.zoneFileLookupURL){const e=`${t.zoneFileLookupURL.replace(/\/$/,"")}/${t.username}`;r=n.fetch(e).then(t=>t.json())}else r=function(t){const e=g(t.network??"mainnet"),n=Object.assign({},m(e),t.client),r=`${n.baseUrl}/v1/names/${t.name}`;return n.fetch(r).then(t=>{if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error(`Bad response status: ${t.status}`);return t.json()}).then(t=>t.address?Object.assign({},t,{address:t.address}):t)}({name:t.username});return r.then(t=>{if(t.hasOwnProperty("zonefile")&&t.hasOwnProperty("address"))return function(t){const e=g(t.network??"mainnet"),n=Object.assign({},m(e),t.client);return new Promise((e,r)=>{let i=null;try{i=(0,ln.parseZoneFile)(t.zoneFile),i.hasOwnProperty("$origin")||(i=null)}catch(t){r(t)}let o=null;if(i&&Object.keys(i).length>0)o=function(t){if(!t.hasOwnProperty("uri"))return null;if(!Array.isArray(t.uri))return null;if(t.uri.length<1)return null;const e=t.uri.filter(t=>t.hasOwnProperty("target")&&"_http._tcp"===t.name);if(e.length<1)return null;const n=e[0];if(!n.hasOwnProperty("target"))return null;let r=n.target;return r.startsWith("https")||r.startsWith("http")||(r=`https://${r}`),r}(i);else try{return e(gn.fromLegacyFormat(JSON.parse(t.zoneFile)).profile())}catch(t){return r(t)}o?n.fetch(o).then(t=>t.text()).then(t=>JSON.parse(t)).then(n=>{const r=un(n[0].token,t.publicKeyOrAddress);e(r)}).catch(t=>{E.error(`resolveZoneFileToProfile: error fetching token file ${o}: ${t}`),r(t)}):(E.debug("Token file url not found. Resolving to blank profile."),e({}))})}({zoneFile:t.zonefile,publicKeyOrAddress:t.address,client:n});throw new Error("Invalid zonefile lookup response: did not contain `address` or `zonefile` field")})}const bn={MISSING_PARAMETER:"missing_parameter",REMOTE_SERVICE_ERROR:"remote_service_error",INVALID_STATE:"invalid_state",NO_SESSION_DATA:"no_session_data",DOES_NOT_EXIST:"does_not_exist",FAILED_DECRYPTION_ERROR:"failed_decryption_error",INVALID_DID_ERROR:"invalid_did_error",NOT_ENOUGH_FUNDS_ERROR:"not_enough_error",INVALID_AMOUNT_ERROR:"invalid_amount_error",LOGIN_FAILED_ERROR:"login_failed",SIGNATURE_VERIFICATION_ERROR:"signature_verification_failure",CONFLICT_ERROR:"conflict_error",NOT_ENOUGH_PROOF_ERROR:"not_enough_proof_error",BAD_PATH_ERROR:"bad_path_error",VALIDATION_ERROR:"validation_error",PAYLOAD_TOO_LARGE_ERROR:"payload_too_large_error",PRECONDITION_FAILED_ERROR:"precondition_failed_error",UNKNOWN:"unknown"};Object.freeze(bn);class wn extends Error{constructor(t){super();let e=t.message,n=`Error Code: ${t.code}`,r=this.stack;if(r)n+=`Stack Trace:\n${r}`;else try{throw new Error}catch(t){r=t.stack}e+=`\nIf you believe this exception is caused by a bug in stacks.js,\n please file a bug report: https://github.com/blockstack/stacks.js/issues\n\n${n}`,this.message=e,this.code=t.code,this.parameter=t.parameter?t.parameter:void 0}toString(){return`${super.toString()}\n code: ${this.code} param: ${this.parameter?this.parameter:"n/a"}`}}class vn extends wn{constructor(t){const e=`Failed to verify signature: ${t}`;super({code:bn.SIGNATURE_VERIFICATION_ERROR,message:e}),this.message=e,this.name="SignatureVerificationError"}}class xn extends wn{constructor(t){super({code:bn.INVALID_STATE,message:t}),this.message=t,this.name="InvalidStateError"}}class En extends wn{constructor(t,e){super(t),e&&(this.hubError={statusCode:e.status,statusText:e.statusText},"string"==typeof e.body?this.hubError.message=e.body:"object"==typeof e.body&&Object.assign(this.hubError,e.body))}}class Sn extends En{constructor(t,e){super({message:t,code:bn.DOES_NOT_EXIST},e),this.name="DoesNotExist"}}class An extends En{constructor(t,e){super({message:t,code:bn.CONFLICT_ERROR},e),this.name="ConflictError"}}class kn extends En{constructor(t,e){super({message:t,code:bn.NOT_ENOUGH_PROOF_ERROR},e),this.name="NotEnoughProofError"}}class _n extends En{constructor(t,e){super({message:t,code:bn.BAD_PATH_ERROR},e),this.name="BadPathError"}}class On extends En{constructor(t,e){super({message:t,code:bn.VALIDATION_ERROR},e),this.name="ValidationError"}}class jn extends En{constructor(t,e,n){super({message:t,code:bn.PAYLOAD_TOO_LARGE_ERROR},e),this.name="PayloadTooLargeError",this.maxUploadByteSize=n}}class Tn extends En{constructor(t,e){super({message:t,code:bn.PRECONDITION_FAILED_ERROR},e),this.name="PreconditionFailedError"}}function Fn(t){const e="string"==typeof t?j(t):t;if(32!=e.length&&33!=e.length)throw new Error(`Improperly formatted private-key. Private-key byte length should be 32 or 33. Length provided: ${e.length}`);if(33==e.length&&1!==e[32])throw new Error("Improperly formatted private-key. 33 bytes indicate compressed key, but the last byte must be == 01");return e}var Cn=i(216),In=i.n(Cn);function Un(t){return J(t)}const Ln=0;function Nn(t,e=Ln){var n;return function(t,e){return function(t){const e=J(J(t));return In().encode(F(t,e).slice(0,t.length+4))}(F(new Uint8Array([t]),e.slice(0,20)))}(e,(n=Un("string"==typeof t?j(t):t),Ue(n)))}function Bn(t){return O(function(t,e=!1){return bt.fromPrivateKey(t).toRawBytes(e)}(Fn(t).slice(0,32),!0))}Qt.hmacSha256Sync=(t,...e)=>{const n=D.create(J,t);return e.forEach(t=>n.update(t)),n.digest()};var Pn,$n=i(991);function Hn(t,e,n){return function(t,e,n,r=Zt){let i;try{i=Vt(t),e=It(e)}catch(t){return!1}const{r:o,s}=i;if(r.strict&&i.hasHighS())return!1;const a=Pt(e);let c;try{c=function(t){return t instanceof bt?(t.assertValidity(),t):bt.fromHex(t)}(n)}catch(t){return!1}const{n:u}=rt,f=Bt(s,u),l=Lt(a*f,u),h=Lt(o*f,u),p=bt.BASE.multiplyAndAddUnsafe(c,l,h);return!!p&&Lt(p.x,u)===o}(n,Un("string"==typeof t?T(t):t),e,{strict:!1})}Qt.hmacSha256Sync=(t,...e)=>{const n=D.create(J,t);return e.forEach(t=>n.update(t)),n.digest()},function(t){t.InvalidFormat="InvalidFormat",t.IsNotPoint="IsNotPoint"}(Pn||(Pn={}));const Dn=class t{constructor(e,n){this.wasString="string"==typeof e,this.content=t.normalizeContentDataType(e,n),this.contentType=n||this.detectContentType(),this.contentByteLength=this.detectContentLength()}static normalizeContentDataType(t,e){try{if("string"==typeof t){const n=(e||"").toLowerCase().replace("-","");if(n.includes("charset")&&!n.includes("charset=utf8")&&!n.includes("charset=ascii"))throw new Error(`Unable to determine byte length with charset: ${e}`);if("undefined"!=typeof TextEncoder){const e=(new TextEncoder).encode(t);return new Uint8Array(e.buffer)}return T(t)}if(t instanceof Uint8Array)return t;if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength));if("undefined"!=typeof Blob&&t instanceof Blob)return t;if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return new Uint8Array(t);if(Array.isArray(t)){if(t.length>0&&(!Number.isInteger(t[0])||t[0]<0||t[0]>255))throw new Error(`Unexpected array values provided as file data: value "${t[0]}" at index 0 is not an octet number. ${this.supportedTypesMsg}`);return new Uint8Array(t)}{const e=Object.prototype.toString.call(t);throw new Error(`Unexpected type provided as file data: ${e}. ${this.supportedTypesMsg}`)}}catch(t){throw console.error(t),new Error(`Error processing data: ${t}`)}}detectContentType(){return this.wasString?"text/plain; charset=utf-8":"undefined"!=typeof Blob&&this.content instanceof Blob&&this.content.type?this.content.type:"application/octet-stream"}detectContentLength(){if(ArrayBuffer.isView(this.content)||this.content instanceof Uint8Array)return this.content.byteLength;if("undefined"!=typeof Blob&&this.content instanceof Blob)return this.content.size;const t=Object.prototype.toString.call(this.content),e=new Error(`Unexpected type "${t}" while detecting content length`);throw console.error(e),e}async loadContent(){try{if(this.content instanceof Uint8Array)return this.content;if(ArrayBuffer.isView(this.content))return new Uint8Array(this.content.buffer,this.content.byteOffset,this.content.byteLength);if("undefined"!=typeof Blob&&this.content instanceof Blob){const t=new FileReader,e=new Promise((e,n)=>{t.onerror=t=>{n(t)},t.onload=()=>{const n=t.result;e(new Uint8Array(n))},t.readAsArrayBuffer(this.content)});return await e}{const t=Object.prototype.toString.call(this.content);throw new Error(`Unexpected type ${t}`)}}catch(t){console.error(t);const e=new Error(`Error loading content: ${t}`);throw console.error(e),e}}load(){return void 0===this.loadedData&&(this.loadedData=this.loadContent()),this.loadedData}};Dn.supportedTypesMsg="Supported types are: `string` (to be UTF8 encoded), `Blob`, `File`, `ArrayBuffer`, `UInt8Array` or any other typed array buffer. ";let Rn=Dn;const zn=(t=32)=>Qt.randomBytes(t),Mn="blockstack-gaia-hub-config";async function qn(t,e,n,r="application/octet-stream",i=!0,o,a,c=s()){E.debug(`uploadToGaiaHub: uploading ${t} to ${n.server}`);const u={"Content-Type":r,Authorization:`bearer ${n.token}`};a||(i?u["If-None-Match"]="*":o&&(u["If-Match"]=o));const f=await c(`${n.server}/store/${n.address}/${t}`,{method:"POST",headers:u,body:e});if(!f.ok)throw await Jn(f,"Error when uploading to Gaia hub.",n);const l=await f.text();return JSON.parse(l)}async function Vn(t,e,n=s()){E.debug(`deleteFromGaiaHub: deleting ${t} from ${e.server}`);const r=await n(`${e.server}/delete/${e.address}/${t}`,{method:"DELETE",headers:{Authorization:`bearer ${e.token}`}});if(!r.ok)throw await Jn(r,"Error deleting file from Gaia hub.",e)}function Kn(t,e){return Promise.resolve(`${e.url_prefix}${e.address}/${t}`)}async function Gn(t,n,r,i=s()){E.debug(`connectToGaiaHub: ${t}/hub_info`);const o=await i(`${t}/hub_info`),a=await o.json(),c=a.read_url_prefix,u=function(t,n,r,i){const o=t.challenge_text,s=t.latest_auth_version&&parseInt(t.latest_auth_version.slice(1),10)>=1,a=Bn(n);if(!s)return function(t,n){let r;try{r=JSON.parse(t)}catch(t){throw new Error("Failed in parsing legacy challenge text from the gaia hub.")}if("gaiahub"===r[0]&&"blockstack_storage_please_sign"===r[3]){const r=Jt(Un(T(t)),Fn(n.length===2*e?n:`${n}01`).slice(0,32),{der:!1}),i=xt.fromCompact(O(r)).toDERHex(),o=Bn(n);return(0,$n.fromByteArray)(T(JSON.stringify({publickey:o,signature:i})))}throw new Error("Failed to connect to legacy gaia hub. If you operate this hub, please update.")}(o,n);const c={gaiaChallenge:o,hubUrl:r,iss:a,salt:O(zn(16)),associationToken:i};return`v1:${new b.TokenSigner("ES256K",n).sign(c)}`}(a,n,t,r),f=Nn(Bn(n));return{url_prefix:c,max_file_upload_size_megabytes:a.max_file_upload_size_megabytes,address:f,token:u,server:t}}async function Wn(t,e,n=s()){const r=await n(`${t}/hub_info`),i=await r.text();return`${JSON.parse(i).read_url_prefix}${Nn(Bn(e))}/`}async function Jn(t,e,n){if(t.ok)throw new Error("Cannot get a BlockstackError from a valid response.");const r=await async function(t){let e,n="";try{n=await t.text();try{e=JSON.parse(n)}catch(t){}}catch(t){E.debug(`Error getting bad http response text: ${t}`)}return{status:t.status,statusText:t.statusText,body:e||n}}(t);if(401===r.status)return new On(e,r);if(402===r.status)return new kn(e,r);if(403===r.status)return new _n(e,r);if(404===r.status)throw new Sn(e,r);if(409===r.status)return new An(e,r);if(412===r.status)return new Tn(e,r);if(413===r.status){const t=n&&n.max_file_upload_size_megabytes?S(n.max_file_upload_size_megabytes):0;return new jn(e,r,t)}return new Error(e)}const Zn=".sig";class Xn{constructor(t){this.userSession=t.userSession}async getFile(t,e){const n={decrypt:!0,verify:!1,app:k("location",{returnEmptyObject:!0}).origin},r=Object.assign({},n,e);if(r.verify&&!r.decrypt)return this.getFileSignedUnencrypted(t,r);const i=await this.getFileContents(t,r.app,r.username,r.zoneFileLookupURL,!!r.decrypt);if(null===i)return i;if(r.decrypt&&!r.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");if("string"==typeof r.decrypt){const t={privateKey:r.decrypt};return this.userSession.decryptContent(i,t)}return this.userSession.decryptContent(i)}if(r.decrypt&&r.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");let e;return"string"==typeof r.decrypt&&(e=r.decrypt),this.handleSignedEncryptedContents(t,i,r.app,e,r.username,r.zoneFileLookupURL)}if(r.verify||r.decrypt)throw new Error("Should be unreachable.");return i}async getUserAppFileUrl(t,e,n,r){const i=await mn({username:e,zoneFileLookupURL:r});let o;return i.hasOwnProperty("apps")&&i.apps.hasOwnProperty(n)&&(o=`${i.apps[n].replace(/\/?(\?|#|$)/,"/$1")}${t}`),o}async getGaiaAddress(t,e,n){const r=Qn(this.userSession,{app:t,username:e,zoneFileLookupURL:n});let i;if(e)i=await this.getUserAppFileUrl("/",r.username,r.app,r.zoneFileLookupURL);else{const t=await this.getOrSetLocalGaiaHubConnection();i=await Kn("/",t)}const o=i.match(/([13][a-km-zA-HJ-NP-Z0-9]{26,35})/);if(!o)throw new Error("Failed to parse gaia address");return o[o.length-1]}async getFileUrl(t,e){const n=Qn(this.userSession,e);let r;if(n.username)r=await this.getUserAppFileUrl(t,n.username,n.app,n.zoneFileLookupURL);else{const e=await this.getOrSetLocalGaiaHubConnection();r=await Kn(t,e)}if(r)return r;throw new Error("Missing readURL")}async getFileContents(t,e,n,r,i,o=s()){const a={app:e,username:n,zoneFileLookupURL:r},c=await this.getFileUrl(t,a),u=await o(c);if(!u.ok)throw await Jn(u,`getFile ${t} failed.`,null);let f=u.headers.get("Content-Type");"string"==typeof f&&(f=f.toLowerCase());const l=u.headers.get("ETag");if(l){const e=this.userSession.store.getSessionData();e.etags[t]=l,this.userSession.store.setSessionData(e)}return i||null===f||f.startsWith("text")||f.startsWith("application/json")?u.text():u.arrayBuffer()}async getFileSignedUnencrypted(t,e){const n=`${t}${Zn}`;try{const[r,i,o]=await Promise.all([this.getFileContents(t,e.app,e.username,e.zoneFileLookupURL,!1),this.getFileContents(n,e.app,e.username,e.zoneFileLookupURL,!0),this.getGaiaAddress(e.app,e.username,e.zoneFileLookupURL)]);if(!r)return r;if(!o)throw new vn(`Failed to get gaia address for verification of: ${t}`);if(!i||"string"!=typeof i)throw new vn(`Failed to obtain signature for file: ${t} -- looked in ${t}${Zn}`);let s,a;try{const t=JSON.parse(i);s=t.signature,a=t.publicKey}catch(e){if(e instanceof SyntaxError)throw new Error(`Failed to parse signature content JSON (path: ${t}${Zn}) The content may be corrupted.`);throw e}const c=Nn(a);if(o!==c)throw new vn(`Signer pubkey address (${c}) doesn't match gaia address (${o})`);if(!Hn("string"==typeof r?T(r):new Uint8Array(r),a,s))throw new vn(`Contents do not match ECDSA signature: path: ${t}, signature: ${t}${Zn}`);return r}catch(e){if(e instanceof Sn&&e.message.indexOf(n)>=0)throw new vn(`Failed to obtain signature for file: ${t} -- looked in ${t}${Zn}`);throw e}}async handleSignedEncryptedContents(t,e,n,r,i,o){const s=Bn(r||this.userSession.loadUserData().appPrivateKey),a=i?await this.getGaiaAddress(n,i,o):Nn(s);if(!a)throw new vn(`Failed to get gaia address for verification of: ${t}`);let c;try{c=JSON.parse(e)}catch(t){throw t instanceof SyntaxError?new Error("Failed to parse encrypted, signed content JSON. The content may not be encrypted. If using getFile, try passing { verify: false, decrypt: false }."):t}const u=c.signature,f=c.publicKey,l=c.cipherText,h=Nn(f);if(f&&l&&u){if(h!==a)throw new vn(`Signer pubkey address (${h}) doesn't match gaia address (${a})`);if(Hn(l,f,u)){if("string"==typeof r){const t={privateKey:r};return this.userSession.decryptContent(l,t)}return this.userSession.decryptContent(l)}throw new vn(`Contents do not match ECDSA signature in file: ${t}`)}throw new vn(`Failed to get signature verification data from file: ${t}`)}async putFile(t,e,n){var r,i;const o=Object.assign({},{encrypt:!0,sign:!1,cipherTextEncoding:"hex",dangerouslyIgnoreEtag:!1},n),s=await this.getOrSetLocalGaiaHubConnection(),a=S(s.max_file_upload_size_megabytes),c=a>0,u=new Rn(e,o.contentType);let f,l=u.contentType;if(!o.encrypt&&c&&u.contentByteLength>a){const t=`The max file upload size for this hub is ${a} bytes, the given content is ${u.contentByteLength} bytes`,e=new jn(t,null,a);throw console.error(e),e}if(o.encrypt&&c){const t=function(t){const{payloadShell:e,payloadValuesLength:n}=function(t){const e={iv:"",ephemeralPK:"",mac:"",cipherText:"",wasString:!!t.wasString};return"base64"===t.cipherTextEncoding&&(e.cipherTextEncoding="base64"),{payloadValuesLength:162,payloadShell:JSON.stringify(e)}}(t),r=(i=t.contentLength,16*(Math.floor(i/16)+1));var i;let o;if(t.cipherTextEncoding&&"hex"!==t.cipherTextEncoding){if("base64"!==t.cipherTextEncoding)throw new Error(`Unexpected cipherTextEncoding "${t.cipherTextEncoding}"`);o=function(t){return 4*Math.ceil(t/3)}(r)}else o=2*r;if(t.sign){const{signedPayloadShell:t,signedPayloadValuesLength:r}=function(t){const e={signature:"",publicKey:"",cipherText:t};return{signedPayloadValuesLength:210,signedPayloadShell:JSON.stringify(e)}}(e);return t.length+r+n+o}return e.length+n+o}({contentLength:u.contentByteLength,wasString:u.wasString,sign:!!o.sign,cipherTextEncoding:o.cipherTextEncoding});if(t>a){const e=new jn(`The max file upload size for this hub is ${a} bytes, the given content is ${t} bytes after encryption`,null,a);throw console.error(e),e}}let h=!0;const p=this.userSession.store.getSessionData();let d;if(o.dangerouslyIgnoreEtag||(null==(r=p.etags)?void 0:r[t])&&(h=!1,f=null==(i=p.etags)?void 0:i[t]),!o.encrypt&&o.sign){const e=await u.load();let n;n="string"==typeof o.sign?o.sign:this.userSession.loadUserData().appPrivateKey;const r=function(t,e){const n="string"==typeof e?T(e):e,r=Bn(t);return{signature:O(Jt(Un(n),t)),publicKey:r}}(n,e),i=JSON.stringify(r);d=async n=>{const r=(await Promise.all([qn(t,e,n,l,h,f,o.dangerouslyIgnoreEtag),qn(`${t}${Zn}`,i,n,"application/json")]))[0];return!o.dangerouslyIgnoreEtag&&r.etag&&(p.etags[t]=r.etag,this.userSession.store.setSessionData(p)),r.publicURL}}else{let e;if(o.encrypt||o.sign){let t;t="string"==typeof o.encrypt?o.encrypt:"string"==typeof o.sign?Bn(o.sign):Bn(this.userSession.loadUserData().appPrivateKey);const n=await u.load();e=await this.userSession.encryptContent(n,{publicKey:t,wasString:u.wasString,cipherTextEncoding:o.cipherTextEncoding,sign:o.sign}),l="application/json"}else e=u.content;d=async n=>{const r=await qn(t,e,n,l,h,f,o.dangerouslyIgnoreEtag);return r.etag&&(p.etags[t]=r.etag,this.userSession.store.setSessionData(p)),r.publicURL}}try{return await d(s)}catch(t){if(function(t){if(!t||!t.hubError||!t.hubError.statusCode)return!1;const e=t.hubError.statusCode;return 401===e||(409===e||e>=500&&e<=599)}(t)){console.error(t),console.error("Possible recoverable error during Gaia upload, retrying...");const e=await this.setLocalGaiaHubConnection();return await d(e)}throw t}}async deleteFile(t,e){const n=await this.getOrSetLocalGaiaHubConnection();if(Object.assign({},e).wasSigned)try{await Vn(t,n),await Vn(`${t}${Zn}`,n);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const r=await this.setLocalGaiaHubConnection();await Vn(t,r),await Vn(`${t}${Zn}`,n);const i=this.userSession.store.getSessionData();delete i.etags[t],this.userSession.store.setSessionData(i)}else try{await Vn(t,n);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const n=await this.setLocalGaiaHubConnection();await Vn(t,n);const r=this.userSession.store.getSessionData();delete r.etags[t],this.userSession.store.setSessionData(r)}}getAppBucketUrl(t,e){return Wn(t,e)}async listFilesLoop(t,e,n,r,i,o=s()){if(n>65536)throw new Error("Too many entries to list");let a;t=t||await this.getOrSetLocalGaiaHubConnection();try{const n=JSON.stringify({page:e}),r={method:"POST",headers:{"Content-Type":"application/json","Content-Length":`${n.length}`,Authorization:`bearer ${t.token}`},body:n};if(a=await o(`${t.server}/list-files/${t.address}`,r),!a.ok)throw await Jn(a,"ListFiles failed.",t)}catch(t){if(0===n){const t=await this.setLocalGaiaHubConnection();return this.listFilesLoop(t,e,n+1,0,i)}throw t}const c=await a.text(),u=JSON.parse(c),f=u.entries,l=u.page;if(null==f)throw new Error("Bad listFiles response: no entries");let h=0;for(let t=0;t<f.length;t++)if(null!==f[t]&&(h++,!i(f[t])))return r+t;return l&&f.length>0?this.listFilesLoop(t,l,n+1,r+h,i):r+h}listFiles(t){return this.listFilesLoop(null,null,0,0,t)}async getOrSetLocalGaiaHubConnection(){const t=this.userSession.store.getSessionData().userData;if(!t)throw new xn("Missing userData");const e=t.gaiaHubConfig;return e?Promise.resolve(e):this.setLocalGaiaHubConnection()}async setLocalGaiaHubConnection(){const t=this.userSession.loadUserData();if(!t)throw new xn("Missing userData");t.hubUrl||(t.hubUrl="https://hub.blockstack.org");const e=await Gn(t.hubUrl,t.appPrivateKey,t.gaiaAssociationToken);t.gaiaHubConfig=e;const n=this.userSession.store.getSessionData();return n.userData.gaiaHubConfig=e,this.userSession.store.setSessionData(n),e}}function Yn(t){return new Xn({}).getUserAppFileUrl(t.path,t.username,t.appOrigin,t.zoneFileLookupURL)}function Qn(t,e){var n;const r=Object.assign({},e);if(r.username){if(!r.app){if(!t.appConfig)throw new xn("Missing AppConfig");r.app=t.appConfig.appDomain}if(!r.zoneFileLookupURL){if(!t.appConfig)throw new xn("Missing AppConfig");if(!t.store)throw new xn("Missing store UserSession");const e=(null==(n=t.store.getSessionData().userData)?void 0:n.coreNode)||t.appConfig.coreNode;e&&(r.zoneFileLookupURL=`${e}/v1/names`)}}return r}})(),o})());
|
|
3
3
|
//# sourceMappingURL=index.js.map
|