@stacks/profile
Version:
Library for Stacks profiles
2 lines • 169 kB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksProfile=e():t.StacksProfile=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))}})}},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 v))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(v.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=L(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 v=N(m*m),w=N(m*v),x=N(l*v),E=N(b*b-w-s*x),S=N(b*(x-E)-p*w),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=C(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=v.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=C(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:L(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 v.ZERO;if(h!==o)throw new Error("invZ was invalid");return new v(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 v{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(!R(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=U(h,a)*h%e,d=U(p,a)*h%e,y=U(d,s)*l%e,g=U(y,r)*y%e,m=U(g,i)*g%e,b=U(m,c)*m%e,v=U(b,f)*b%e,w=U(v,c)*m%e,x=U(w,a)*h%e,E=U(x,o)*g%e,S=U(E,n)*l%e,A=U(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 v(n,r);return c.assertValidity(),c}static fromUncompressedHex(t){const e=I(t.subarray(1,33)),n=I(t.subarray(33,65)),r=new v(e,n);return r.assertValidity(),r}static fromHex(t){const e=B(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 v.BASE.multiply(V(t))}static fromSignature(t,e,n){const{r,s:i}=W(e);if(![0,1,2,3].includes(n))throw new Error("Cannot recover: invalid recovery bit");const o=H(B(t)),{n:s}=u,a=2===n||3===n?r+s:r,c=L(a,s),f=N(-o*c,s),l=N(i*c,s),h=1&n?"03":"02",p=v.fromHex(h+_(a)),d=v.BASE.multiplyAndAddUnsafe(p,f,l);if(!d)throw new Error("Cannot recover signature: point at infinify");return d.assertValidity(),d}toRawBytes(t=!1){return T(this.toHex(t))}toHex(t=!1){const e=_(this.x);return t?`${this.hasEvenY()?"02":"03"}${e}`:`04${e}${_(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(!R(e)||!R(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 v(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!==v.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 w(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=v,v.BASE=new v(u.Gx,u.Gy),v.ZERO=new v(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:T(t));return new E(n,r)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!M(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!M(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 T(this.toDERHex())}toDERHex(){const t=w(P(this.s)),e=w(P(this.r)),n=t.length/2,r=e.length/2,i=P(n),o=P(r);return`30${P(r+n+4)}02${o}${e}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return T(this.toCompactHex())}toCompactHex(){return _(this.r)+_(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 j=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function _(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(i<=t&&t<j))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function O(t){const e=T(_(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function P(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 T(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 B(t){return t instanceof Uint8Array?Uint8Array.from(t):T(t)}function C(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&M(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 U(t,e){const{P:n}=u;let r=t;for(;e-- >i;)r*=r,r%=n;return r}function L(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 H(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 $,D;class z{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 M(t){return i<t&&t<u.n}function R(t){return i<t&&t<u.P}function q(t,e,n,r=!0){const{n:s}=u,a=H(t,!0);if(!M(a))return;const c=L(a,s),f=v.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(!M(e))throw new Error("Expected private key: 0 < key < n");return e}function K(t){return t instanceof v?(t.assertValidity(),t):v.fromHex(t)}function W(t){if(t instanceof E)return t.assertValidity(),t;try{return E.fromDER(t)}catch(e){return E.fromCompact(t)}}function G(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 v}function Z(t){return I(t.length>32?t.slice(0,32):t)}function J(t){const e=Z(t),n=N(e,u.n);return X(n<i?e:n)}function X(t){return O(t)}function Y(t,n,r){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const i=B(t),o=V(n),s=[X(o),J(i)];if(null!=r){!0===r&&(r=e.utils.randomBytes(32));const t=B(r);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");s.push(t)}return{seed:S(...s),m:Z(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 v.fromPrivateKey(t).toRawBytes(e)},e.recoverPublicKey=function(t,e,n,r=!1){return v.fromSignature(t,e,n).toRawBytes(r)},e.getSharedSecret=function(t,e,n=!1){if(G(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!G(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 z(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 z(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=W(t),e=B(e)}catch(t){return!1}const{r:o,s}=i;if(r.strict&&i.hasHighS())return!1;const a=H(e);let c;try{c=K(n)}catch(t){return!1}const{n:f}=u,l=L(s,f),h=N(a*l,f),p=N(o*l,f),d=v.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=B(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(!R(t)||!M(e))throw new Error("Invalid signature")}toHex(){return _(this.r)+_(this.s)}toRawBytes(){return T(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=B(t);const{x:i,scalar:o}=this.getScalar(V(n));if(this.px=i,this.d=o,this.rand=B(r),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(t){const e=v.fromPrivateKey(t),n=e.hasEvenY()?t:u.n-t;return{point:e,scalar:n,x:e.toRawX()}}initNonce(t,e){return O(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:B(e),P:K(n)}}function ot(t,e,n,r){const i=v.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,O(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,O(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 v.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},v.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:T,concatBytes:S,mod:N,invert:L,isValidPrivateKey(t){try{return V(t),!0}catch(t){return!1}},_bigintTo32Bytes:O,_normalizePrivateKey:V,hashToPrivateKey:t=>{if((t=B(t)).length<40||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return O(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=v.BASE){const n=e===v.BASE?e:new v(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 $)throw new d("sha256Sync is undefined, you need to set it");let n=ft[t];if(void 0===n){const e=$(Uint8Array.from(t,t=>t.charCodeAt(0)));n=S(e,e),ft[t]=n}return $(n,...e)},_JacobianPoint:g},Object.defineProperties(e.utils,{sha256Sync:{configurable:!1,get:()=>$,set(t){$||($=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]",v="[object ArrayBuffer]",w="[object DataView]",x="[object Float32Array]",E="[object Float64Array]",S="[object Int8Array]",A="[object Int16Array]",k="[object Int32Array]",j="[object Uint8Array]",_="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",F=/\w*$/,T=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,B={};B[o]=B["[object Array]"]=B[v]=B[w]=B[s]=B[a]=B[x]=B[E]=B[S]=B[A]=B[k]=B[f]=B[l]=B[h]=B[d]=B[y]=B[g]=B[m]=B[j]=B[_]=B[O]=B[P]=!0,B["[object Error]"]=B[c]=B[b]=!1;var C="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,N="object"==typeof self&&self&&self.Object===Object&&self,U=C||N||Function("return this")(),L=e&&!e.nodeType&&e,H=L&&t&&!t.nodeType&&t,$=H&&H.exports===L;function D(t,e){return t.set(e[0],e[1]),t}function z(t,e){return t.add(e),t}function M(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 R(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 W,G=Array.prototype,Z=Function.prototype,J=Object.prototype,X=U["__core-js_shared__"],Y=(W=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",Q=Z.toString,tt=J.hasOwnProperty,et=J.toString,nt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=$?U.Buffer:void 0,it=U.Symbol,ot=U.Uint8Array,st=V(Object.getPrototypeOf,Object),at=Object.create,ct=J.propertyIsEnumerable,ut=G.splice,ft=Object.getOwnPropertySymbols,lt=rt?rt.isBuffer:void 0,ht=V(Object.keys,Object),pt=Ut(U,"DataView"),dt=Ut(U,"Map"),yt=Ut(U,"Promise"),gt=Ut(U,"Set"),mt=Ut(U,"WeakMap"),bt=Ut(Object,"create"),vt=zt(pt),wt=zt(dt),xt=zt(yt),Et=zt(gt),St=zt(mt),At=it?it.prototype:void 0,kt=At?At.valueOf:void 0;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 _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 Pt(t){this.__data__=new _t(t)}function Ft(t,e,n){var r=t[e];tt.call(t,e)&&Mt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Tt(t,e){for(var n=t.length;n--;)if(Mt(t[n][0],e))return n;return-1}function It(t,e,n,r,i,p,b){var T;if(r&&(T=p?r(t,i,p,b):r(t)),void 0!==T)return T;if(!Wt(t))return t;var I=Rt(t);if(I){if(T=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,T)}else{var C=Ht(t),N=C==c||C==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(C==h||C==o||N&&!p){if(R(t))return p?t:{};if(T=function(t){return"function"!=typeof t.constructor||Dt(t)?{}:Wt(e=st(t))?at(e):{};var e}(N?{}:t),!e)return function(t,e){return Ct(t,Lt(t),e)}(t,function(t,e){return t&&Ct(e,Gt(e),t)}(T,t))}else{if(!B[C])return p?t:{};T=function(t,e,n,r){var i,o=t.constructor;switch(e){case v:return Bt(t);case s:case a:return new o(+t);case w:return function(t,e){var n=e?Bt(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 j:case _:case O:case P:return function(t,e){var n=e?Bt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case f:return function(t,e,n){return M(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 M(e?n(K(t),!0):K(t),z,new t.constructor)}(t,r,n);case m:return i=t,kt?Object(kt.call(i)):{}}}(t,C,It,e)}}b||(b=new Pt);var U=b.get(t);if(U)return U;if(b.set(t,T),!I)var L=n?function(t){return function(t,e,n){var r=e(t);return Rt(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,Gt,Lt)}(t):Gt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}(L||t,function(i,o){L&&(i=t[o=i]),Ft(T,o,It(i,e,n,r,o,t,b))}),T}function Bt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Ct(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 Ut(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Wt(t)||(e=t,Y&&Y in e))&&(Kt(t)||R(t)?nt:T).test(zt(t));var e}(n)?n:void 0}jt.prototype.clear=function(){this.__data__=bt?bt(null):{}},jt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},jt.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},jt.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:tt.call(e,t)},jt.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?r:e,this},_t.prototype.clear=function(){this.__data__=[]},_t.prototype.delete=function(t){var e=this.__data__,n=Tt(e,t);return!(n<0||(n==e.length-1?e.pop():ut.call(e,n,1),0))},_t.prototype.get=function(t){var e=this.__data__,n=Tt(e,t);return n<0?void 0:e[n][1]},_t.prototype.has=function(t){return Tt(this.__data__,t)>-1},_t.prototype.set=function(t,e){var n=this.__data__,r=Tt(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Ot.prototype.clear=function(){this.__data__={hash:new jt,map:new(dt||_t),string:new jt}},Ot.prototype.delete=function(t){return Nt(this,t).delete(t)},Ot.prototype.get=function(t){return Nt(this,t).get(t)},Ot.prototype.has=function(t){return Nt(this,t).has(t)},Ot.prototype.set=function(t,e){return Nt(this,t).set(t,e),this},Pt.prototype.clear=function(){this.__data__=new _t},Pt.prototype.delete=function(t){return this.__data__.delete(t)},Pt.prototype.get=function(t){return this.__data__.get(t)},Pt.prototype.has=function(t){return this.__data__.has(t)},Pt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof _t){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new Ot(r)}return n.set(t,e),this};var Lt=ft?V(ft,Object):function(){return[]},Ht=function(t){return et.call(t)};function $t(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||J)}function zt(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Mt(t,e){return t===e||t!=t&&e!=e}(pt&&Ht(new pt(new ArrayBuffer(1)))!=w||dt&&Ht(new dt)!=f||yt&&Ht(yt.resolve())!=p||gt&&Ht(new gt)!=y||mt&&Ht(new mt)!=b)&&(Ht=function(t){var e=et.call(t),n=e==h?t.constructor:void 0,r=n?zt(n):void 0;if(r)switch(r){case vt:return w;case wt:return f;case xt:return p;case Et:return y;case St:return b}return e});var Rt=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=Wt(t)?et.call(t):"";return e==c||e==u}function Wt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return qt(t)?function(t,e){var n=Rt(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||$t(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 ne