@blockcerts/blockcerts-verifier 1.70.1 → 1.71.1

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.
Files changed (43) hide show
  1. package/bundle-stats.html +13 -13
  2. package/dist/DataIntegrityProof-elCNKq16-DBDuaDNt.js +7 -0
  3. package/dist/EcdsaSd2023-B0XPAIp6-K61axvBA.js +30 -0
  4. package/dist/EcdsaSecp256k1Signature2019-BHgoxmKI-DT2qHZod.js +1 -0
  5. package/dist/Ed25519Signature2020-BQsESRnS-TKZI_1AX.js +34 -0
  6. package/dist/EddsaRdfc2022-DQKzWHK4-BILzDBp-.js +14 -0
  7. package/dist/{HashlinkVerifier-mEn5oMxx-0x0OtiE4.js → HashlinkVerifier-BsVlaml5-B4Niv2-b.js} +2 -2
  8. package/dist/{MerkleProof2017-Cgbk--lC-CKvOfXrT.js → MerkleProof2017-CYM8CJHB-FYpMvld0.js} +1 -1
  9. package/dist/MerkleProof2019-BLrywo8h-Bo9rH2Eq.js +13 -0
  10. package/dist/{checkCredentialSchemaConformity-CuuMYTl6-DqE6I7JD.js → checkCredentialSchemaConformity-CKNtOu_t-B9iaCRUE.js} +1 -1
  11. package/dist/{controlVerificationMethod-C87jwGUr-CpVyq-8H.js → controlVerificationMethod-B4TgLED0-BGpxLjMq.js} +1 -1
  12. package/dist/{did-key-common.esm-D1RQn0yL-kJBnihy7.js → did-key-common.esm-BIftA62j-hVrUMxjy.js} +3 -3
  13. package/dist/{did-key-ed25519.esm-0v03exJh-COIOTeQ5.js → did-key-ed25519.esm-Drn3Y7PF-CqD0ifNk.js} +1 -1
  14. package/dist/{did-key-secp256k1.esm-Cs0ZCHjg-B35GrJww.js → did-key-secp256k1.esm-DH-f3o5q-C66E7IxB.js} +1 -1
  15. package/dist/downloadPDF-D2qwT_DJ.js +297 -0
  16. package/dist/ed25519-key-pair.esm-DPOFpdJ2-BrwuS0Ia.js +25 -0
  17. package/dist/{elliptic-HXNc7riQ-DrFZxkx3.js → elliptic-4aZS_cwf-BpaNaVm0.js} +1 -1
  18. package/dist/elliptic-BYqApR8Y-CKp7atgR.js +1 -0
  19. package/dist/{index-BJkS6Wwm-C8oVP6LM.js → index-BgTFEYQ4-DMaz98iZ.js} +7 -7
  20. package/dist/index-lyuTDW_o-nyi7dklX.js +1 -0
  21. package/dist/{index.es-kH7iskh8.js → index.es-BIiEi3w5.js} +2 -2
  22. package/dist/{jsonld-CMQE_cGn-899pOqB6.js → jsonld-B_Q2jvnp-BJ5uVeOU.js} +1 -1
  23. package/dist/{jsonld-signatures-ZtLxJmqT-B0W14Jb0.js → jsonld-signatures-BbILf-Q7-DTp6__ud.js} +1 -1
  24. package/dist/keyUtils-ExMI0fmg-NVOmd8LH.js +1 -0
  25. package/dist/main.js +116 -116
  26. package/dist/{retrieveVerificationMethodPublicKey-nmb3CCVx-DA6ovQri.js → retrieveVerificationMethodPublicKey-C5Gafl1E-Lv4waRy7.js} +1 -1
  27. package/dist/verifyIssuerProfile-DCJyz3ho-BwuCK9F3.js +1 -0
  28. package/dist/{x25519-CbZcE2Ac-NSl6svWQ.js → x25519-Kp6t9B5a-Dh8L0KYb.js} +1 -1
  29. package/package.json +4 -4
  30. package/dist/EcdsaSd2023-BDSl7Ei2-BKyD2rP9.js +0 -35
  31. package/dist/EcdsaSecp256k1Signature2019-Bk8_LQ8c-BqdRm-Jv.js +0 -1
  32. package/dist/Ed25519Signature2020-fyWut63D-R9eZ2oN0.js +0 -58
  33. package/dist/MerkleProof2019-Dhsn349H-DFyc-5gT.js +0 -3
  34. package/dist/downloadPDF-CWa3ZYVl.js +0 -346
  35. package/dist/elliptic-CRAl7yyq-DbLzV4aB.js +0 -1
  36. package/dist/verifyIssuerProfile-CYqfuwV1-DeQqsjiM.js +0 -1
  37. /package/dist/{checkRevocationStatusList2021-UjTyRcl_-BEBD8TO8.js → checkRevocationStatusList2021-CMAVXAVE-BEBD8TO8.js} +0 -0
  38. /package/dist/{ensureNotRevoked-CdrYFvh7-DvMIgM4L.js → ensureNotRevoked-hGps0prO-DvMIgM4L.js} +0 -0
  39. /package/dist/{ensureValidIssuingKey-n3jD_OlE-BdV46XBb.js → ensureValidIssuingKey-BMVCi2T2-BdV46XBb.js} +0 -0
  40. /package/dist/{index-BcfLkJHS-Dgus2xdV.js → index-BS134367-Dgus2xdV.js} +0 -0
  41. /package/dist/{index-DYND9Svl-C0eXpZGn.js → index-CQYVZlSE-C0eXpZGn.js} +0 -0
  42. /package/dist/{sha256-CN3v2fAD-C1PUWFZm.js → sha256-u2xsd4MQ-C1PUWFZm.js} +0 -0
  43. /package/dist/{webcrypto.es-hNUMWa8--BnVhHKeM.js → webcrypto.es-DpqeDikX-BnVhHKeM.js} +0 -0
@@ -1 +1 @@
1
- import{V as e,d as i}from"./main.js";import{b as r}from"./index-BcfLkJHS-Dgus2xdV.js";function t(t,o){if(!t.verificationMethod)return void console.warn("No verification method found in the issuer document. This will likely become a requirement in the near future");const n=o.split("#")[1],d=t.verificationMethod.find((e=>e.id===`#${n}`||e.id===o));if(!d)throw new e("retrieveVerificationMethodPublicKey",`${r} - ${i.i18n.getText("errors","retrieveVerificationMethodPublicKey")}`);return{...d}}export{t as r};
1
+ import{V as e,d as i}from"./main.js";import{b as r}from"./index-BS134367-Dgus2xdV.js";function t(t,o){if(!t.verificationMethod)return void console.warn("No verification method found in the issuer document. This will likely become a requirement in the near future");const n=o.split("#")[1],d=t.verificationMethod.find((e=>e.id===`#${n}`||e.id===o));if(!d)throw new e("retrieveVerificationMethodPublicKey",`${r} - ${i.i18n.getText("errors","retrieveVerificationMethodPublicKey")}`);return{...d}}export{t as r};
@@ -0,0 +1 @@
1
+ import{H as r,I as t}from"./main.js";async function o(o){if(!o.proof)return void console.warn("No proof found in the issuer profile.");let e=o.proof.type;"DataIntegrityProof"===e&&(e=r(o.proof.cryptosuite));const a=await async function(r){if(r===t.MerkleProof2019){const{default:r}=await import("./MerkleProof2019-BLrywo8h-Bo9rH2Eq.js");return r}if(r===t.Ed25519Signature2020){const{default:r}=await import("./Ed25519Signature2020-BQsESRnS-TKZI_1AX.js");return r}if(r===t.EcdsaSecp256k1Signature2019){const{default:r}=await import("./EcdsaSecp256k1Signature2019-BHgoxmKI-DT2qHZod.js");return r}if(r===t.EcdsaSd2023){const{default:r}=await import("./EcdsaSd2023-B0XPAIp6-K61axvBA.js");return r}}(e),i=new a({document:o,proof:o.proof,issuer:o.issuer?o.issuer:o,executeStep:async(r,t,o)=>t()});await i.init();try{await i.verifyProof()}catch(r){throw new Error(`Issuer profile verification failed: ${r.message}`)}}export{o as default};
@@ -1 +1 @@
1
- import{c as t}from"./_commonjs-dynamic-modules-COweQ1RR-BHR_E30J.js";import{s as e}from"./main.js";var r,n={},o={},i={},a={};var s,f,u,h={},l={};function c(){if(s)return l;return s=1,Object.defineProperty(l,"__esModule",{value:!0}),l.wipe=function(t){for(var e=0;e<t.length;e++)t[e]=0;return t},l}function d(){if(u)return i;u=1,Object.defineProperty(i,"__esModule",{value:!0}),i.SystemRandomSource=void 0;const n=(r||(r=1,Object.defineProperty(a,"__esModule",{value:!0}),a.BrowserRandomSource=void 0,a.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t="undefined"!=typeof self?self.crypto||self.msCrypto:null;t&&void 0!==t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let t=0;t<e.length;t+=65536)this._crypto.getRandomValues(e.subarray(t,t+Math.min(e.length-t,65536)));return e}}),a),o=function(){if(f)return h;f=1,Object.defineProperty(h,"__esModule",{value:!0}),h.NodeRandomSource=void 0;const r=c();return h.NodeRandomSource=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,void 0!==t){const t=e;t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(t);for(let t=0;t<n.length;t++)n[t]=e[t];return(0,r.wipe)(e),n}},h}();return i.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new o.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}},i}var y,E,w,_={},b={};function v(){if(E)return _;E=1,Object.defineProperty(_,"__esModule",{value:!0});var t,e=(y||(y=1,t=b,Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(t,e){var r=65535&t,n=65535&e;return r*n+((t>>>16&65535)*n+r*(e>>>16&65535)<<16>>>0)|0},t.add=function(t,e){return t+e|0},t.sub=function(t,e){return t-e|0},t.rotl=function(t,e){return t<<e|t>>>32-e},t.rotr=function(t,e){return t<<32-e|t>>>e},t.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}),b);function r(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}function n(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}function o(t,e){return void 0===e&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function i(t,e){return void 0===e&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function a(t,e){return void 0===e&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function s(t,e){return void 0===e&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}function f(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}function u(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}function h(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),f(t/4294967296>>>0,e,r),f(t>>>0,e,r+4),e}function l(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),u(t>>>0,e,r),u(t/4294967296>>>0,e,r+4),e}return _.readInt16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16},_.readUint16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])>>>0},_.readInt16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])<<16>>16},_.readUint16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])>>>0},_.writeUint16BE=r,_.writeInt16BE=r,_.writeUint16LE=n,_.writeInt16LE=n,_.readInt32BE=o,_.readUint32BE=i,_.readInt32LE=a,_.readUint32LE=s,_.writeUint32BE=f,_.writeInt32BE=f,_.writeUint32LE=u,_.writeInt32LE=u,_.readInt64BE=function(t,e){void 0===e&&(e=0);var r=o(t,e),n=o(t,e+4);return 4294967296*r+n-4294967296*(n>>31)},_.readUint64BE=function(t,e){return void 0===e&&(e=0),4294967296*i(t,e)+i(t,e+4)},_.readInt64LE=function(t,e){void 0===e&&(e=0);var r=a(t,e);return 4294967296*a(t,e+4)+r-4294967296*(r>>31)},_.readUint64LE=function(t,e){void 0===e&&(e=0);var r=s(t,e);return 4294967296*s(t,e+4)+r},_.writeUint64BE=h,_.writeInt64BE=h,_.writeUint64LE=l,_.writeInt64LE=l,_.readUintBE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,o=1,i=t/8+r-1;i>=r;i--)n+=e[i]*o,o*=256;return n},_.readUintLE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,o=1,i=r;i<r+t/8;i++)n+=e[i]*o,o*=256;return n},_.writeUintBE=function(t,r,n,o){if(void 0===n&&(n=new Uint8Array(t/8)),void 0===o&&(o=0),t%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!e.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var i=1,a=t/8+o-1;a>=o;a--)n[a]=r/i&255,i*=256;return n},_.writeUintLE=function(t,r,n,o){if(void 0===n&&(n=new Uint8Array(t/8)),void 0===o&&(o=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!e.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var i=1,a=o;a<o+t/8;a++)n[a]=r/i&255,i*=256;return n},_.readFloat32BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e)},_.readFloat32LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e,!0)},_.readFloat64BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e)},_.readFloat64LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e,!0)},_.writeFloat32BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t),e},_.writeFloat32LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t,!0),e},_.writeFloat64BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t),e},_.writeFloat64LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t,!0),e},_}function L(){return w||(w=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=d(),r=v(),n=c();function o(e,r=t.defaultRandomSource){return r.randomBytes(e)}t.defaultRandomSource=new e.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(e=t.defaultRandomSource){const i=o(4,e),a=(0,r.readUint32LE)(i);return(0,n.wipe)(i),a};const i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(e,r=i,a=t.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let s="";const f=r.length,u=256-256%f;for(;e>0;){const t=o(Math.ceil(256*e/u),a);for(let n=0;n<t.length&&e>0;n++){const o=t[n];o<u&&(s+=r.charAt(o%f),e--)}(0,n.wipe)(t)}return s}t.randomString=a,t.randomStringForEntropy=function(e,r=i,n=t.defaultRandomSource){return a(Math.ceil(e/(Math.log(r.length)/Math.LN2)),r,n)}}(o)),o}var g,M,p={};var m,S=(M||(M=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=L(),r=(g||(g=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=v(),r=c();t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function n(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return n.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},n.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},n.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},n.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},n.prototype.finish=function(t){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,o=r/536870912|0,a=r<<3,s=r%128<112?128:256;this._buffer[n]=128;for(var f=n+1;f<s-8;f++)this._buffer[f]=0;e.writeUint32BE(o,this._buffer,s-8),e.writeUint32BE(a,this._buffer,s-4),i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,s),this._finished=!0}for(f=0;f<this.digestLength/8;f++)e.writeUint32BE(this._stateHi[f],t,8*f),e.writeUint32BE(this._stateLo[f],t,8*f+4);return this},n.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},n.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(t){return this._stateHi.set(t.stateHi),this._stateLo.set(t.stateLo),this._bufferLength=t.bufferLength,t.buffer&&this._buffer.set(t.buffer),this._bytesHashed=t.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(t){r.wipe(t.stateHi),r.wipe(t.stateLo),t.buffer&&r.wipe(t.buffer),t.bufferLength=0,t.bytesHashed=0},n}();t.SHA512=n;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function i(t,r,n,i,a,s,f){for(var u,h,l,c,d,y,E,w,_=n[0],b=n[1],v=n[2],L=n[3],g=n[4],M=n[5],p=n[6],m=n[7],S=i[0],A=i[1],U=i[2],H=i[3],B=i[4],I=i[5],T=i[6],K=i[7];f>=128;){for(var N=0;N<16;N++){var R=8*N+s;t[N]=e.readUint32BE(a,R),r[N]=e.readUint32BE(a,R+4)}for(N=0;N<80;N++){var G,F,P=_,O=b,C=v,D=L,Y=g,j=M,k=p,V=S,X=A,x=U,z=H,Z=B,$=I,q=T;if(d=65535&(h=K),y=h>>>16,E=65535&(u=m),w=u>>>16,d+=65535&(h=(B>>>14|g<<18)^(B>>>18|g<<14)^(g>>>9|B<<23)),y+=h>>>16,E+=65535&(u=(g>>>14|B<<18)^(g>>>18|B<<14)^(B>>>9|g<<23)),w+=u>>>16,d+=65535&(h=B&I^~B&T),y+=h>>>16,E+=65535&(u=g&M^~g&p),w+=u>>>16,u=o[2*N],d+=65535&(h=o[2*N+1]),y+=h>>>16,E+=65535&u,w+=u>>>16,u=t[N%16],y+=(h=r[N%16])>>>16,E+=65535&u,w+=u>>>16,E+=(y+=(d+=65535&h)>>>16)>>>16,d=65535&(h=c=65535&d|y<<16),y=h>>>16,E=65535&(u=l=65535&E|(w+=E>>>16)<<16),w=u>>>16,d+=65535&(h=(S>>>28|_<<4)^(_>>>2|S<<30)^(_>>>7|S<<25)),y+=h>>>16,E+=65535&(u=(_>>>28|S<<4)^(S>>>2|_<<30)^(S>>>7|_<<25)),w+=u>>>16,y+=(h=S&A^S&U^A&U)>>>16,E+=65535&(u=_&b^_&v^b&v),w+=u>>>16,G=65535&(E+=(y+=(d+=65535&h)>>>16)>>>16)|(w+=E>>>16)<<16,F=65535&d|y<<16,d=65535&(h=z),y=h>>>16,E=65535&(u=D),w=u>>>16,y+=(h=c)>>>16,E+=65535&(u=l),w+=u>>>16,b=P,v=O,L=C,g=D=65535&(E+=(y+=(d+=65535&h)>>>16)>>>16)|(w+=E>>>16)<<16,M=Y,p=j,m=k,_=G,A=V,U=X,H=x,B=z=65535&d|y<<16,I=Z,T=$,K=q,S=F,N%16==15)for(R=0;R<16;R++)u=t[R],d=65535&(h=r[R]),y=h>>>16,E=65535&u,w=u>>>16,u=t[(R+9)%16],d+=65535&(h=r[(R+9)%16]),y+=h>>>16,E+=65535&u,w+=u>>>16,l=t[(R+1)%16],d+=65535&(h=((c=r[(R+1)%16])>>>1|l<<31)^(c>>>8|l<<24)^(c>>>7|l<<25)),y+=h>>>16,E+=65535&(u=(l>>>1|c<<31)^(l>>>8|c<<24)^l>>>7),w+=u>>>16,l=t[(R+14)%16],y+=(h=((c=r[(R+14)%16])>>>19|l<<13)^(l>>>29|c<<3)^(c>>>6|l<<26))>>>16,E+=65535&(u=(l>>>19|c<<13)^(c>>>29|l<<3)^l>>>6),w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,t[R]=65535&E|w<<16,r[R]=65535&d|y<<16}d=65535&(h=S),y=h>>>16,E=65535&(u=_),w=u>>>16,u=n[0],y+=(h=i[0])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[0]=_=65535&E|w<<16,i[0]=S=65535&d|y<<16,d=65535&(h=A),y=h>>>16,E=65535&(u=b),w=u>>>16,u=n[1],y+=(h=i[1])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[1]=b=65535&E|w<<16,i[1]=A=65535&d|y<<16,d=65535&(h=U),y=h>>>16,E=65535&(u=v),w=u>>>16,u=n[2],y+=(h=i[2])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[2]=v=65535&E|w<<16,i[2]=U=65535&d|y<<16,d=65535&(h=H),y=h>>>16,E=65535&(u=L),w=u>>>16,u=n[3],y+=(h=i[3])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[3]=L=65535&E|w<<16,i[3]=H=65535&d|y<<16,d=65535&(h=B),y=h>>>16,E=65535&(u=g),w=u>>>16,u=n[4],y+=(h=i[4])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[4]=g=65535&E|w<<16,i[4]=B=65535&d|y<<16,d=65535&(h=I),y=h>>>16,E=65535&(u=M),w=u>>>16,u=n[5],y+=(h=i[5])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[5]=M=65535&E|w<<16,i[5]=I=65535&d|y<<16,d=65535&(h=T),y=h>>>16,E=65535&(u=p),w=u>>>16,u=n[6],y+=(h=i[6])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[6]=p=65535&E|w<<16,i[6]=T=65535&d|y<<16,d=65535&(h=K),y=h>>>16,E=65535&(u=m),w=u>>>16,u=n[7],y+=(h=i[7])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[7]=m=65535&E|w<<16,i[7]=K=65535&d|y<<16,s+=128,f-=128}return s}t.hash=function(t){var e=new n;e.update(t);var r=e.digest();return e.clean(),r}}(p)),p),n=c();function o(t){const e=new Float64Array(16);if(t)for(let r=0;r<t.length;r++)e[r]=t[r];return e}t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32,new Uint8Array(32)[0]=9;const i=o(),a=o([1]),s=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),l=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(t,e){for(let r=0;r<16;r++)t[r]=0|e[r]}function y(t){let e=1;for(let r=0;r<16;r++){let n=t[r]+e+65535;e=Math.floor(n/65536),t[r]=n-65536*e}t[0]+=e-1+37*(e-1)}function E(t,e,r){const n=~(r-1);for(let r=0;r<16;r++){const o=n&(t[r]^e[r]);t[r]^=o,e[r]^=o}}function w(t,e){const r=o(),n=o();for(let t=0;t<16;t++)n[t]=e[t];y(n),y(n),y(n);for(let t=0;t<2;t++){r[0]=n[0]-65517;for(let t=1;t<15;t++)r[t]=n[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const t=r[15]>>16&1;r[14]&=65535,E(n,r,1-t)}for(let e=0;e<16;e++)t[2*e]=255&n[e],t[2*e+1]=n[e]>>8}function _(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function b(t,e){const r=new Uint8Array(32),n=new Uint8Array(32);return w(r,t),w(n,e),_(r,n)}function M(t){const e=new Uint8Array(32);return w(e,t),1&e[0]}function m(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function S(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function A(t,e,r){let n,o,i=0,a=0,s=0,f=0,u=0,h=0,l=0,c=0,d=0,y=0,E=0,w=0,_=0,b=0,v=0,L=0,g=0,M=0,p=0,m=0,S=0,A=0,U=0,H=0,B=0,I=0,T=0,K=0,N=0,R=0,G=0,F=r[0],P=r[1],O=r[2],C=r[3],D=r[4],Y=r[5],j=r[6],k=r[7],V=r[8],X=r[9],x=r[10],z=r[11],Z=r[12],$=r[13],q=r[14],Q=r[15];n=e[0],i+=n*F,a+=n*P,s+=n*O,f+=n*C,u+=n*D,h+=n*Y,l+=n*j,c+=n*k,d+=n*V,y+=n*X,E+=n*x,w+=n*z,_+=n*Z,b+=n*$,v+=n*q,L+=n*Q,n=e[1],a+=n*F,s+=n*P,f+=n*O,u+=n*C,h+=n*D,l+=n*Y,c+=n*j,d+=n*k,y+=n*V,E+=n*X,w+=n*x,_+=n*z,b+=n*Z,v+=n*$,L+=n*q,g+=n*Q,n=e[2],s+=n*F,f+=n*P,u+=n*O,h+=n*C,l+=n*D,c+=n*Y,d+=n*j,y+=n*k,E+=n*V,w+=n*X,_+=n*x,b+=n*z,v+=n*Z,L+=n*$,g+=n*q,M+=n*Q,n=e[3],f+=n*F,u+=n*P,h+=n*O,l+=n*C,c+=n*D,d+=n*Y,y+=n*j,E+=n*k,w+=n*V,_+=n*X,b+=n*x,v+=n*z,L+=n*Z,g+=n*$,M+=n*q,p+=n*Q,n=e[4],u+=n*F,h+=n*P,l+=n*O,c+=n*C,d+=n*D,y+=n*Y,E+=n*j,w+=n*k,_+=n*V,b+=n*X,v+=n*x,L+=n*z,g+=n*Z,M+=n*$,p+=n*q,m+=n*Q,n=e[5],h+=n*F,l+=n*P,c+=n*O,d+=n*C,y+=n*D,E+=n*Y,w+=n*j,_+=n*k,b+=n*V,v+=n*X,L+=n*x,g+=n*z,M+=n*Z,p+=n*$,m+=n*q,S+=n*Q,n=e[6],l+=n*F,c+=n*P,d+=n*O,y+=n*C,E+=n*D,w+=n*Y,_+=n*j,b+=n*k,v+=n*V,L+=n*X,g+=n*x,M+=n*z,p+=n*Z,m+=n*$,S+=n*q,A+=n*Q,n=e[7],c+=n*F,d+=n*P,y+=n*O,E+=n*C,w+=n*D,_+=n*Y,b+=n*j,v+=n*k,L+=n*V,g+=n*X,M+=n*x,p+=n*z,m+=n*Z,S+=n*$,A+=n*q,U+=n*Q,n=e[8],d+=n*F,y+=n*P,E+=n*O,w+=n*C,_+=n*D,b+=n*Y,v+=n*j,L+=n*k,g+=n*V,M+=n*X,p+=n*x,m+=n*z,S+=n*Z,A+=n*$,U+=n*q,H+=n*Q,n=e[9],y+=n*F,E+=n*P,w+=n*O,_+=n*C,b+=n*D,v+=n*Y,L+=n*j,g+=n*k,M+=n*V,p+=n*X,m+=n*x,S+=n*z,A+=n*Z,U+=n*$,H+=n*q,B+=n*Q,n=e[10],E+=n*F,w+=n*P,_+=n*O,b+=n*C,v+=n*D,L+=n*Y,g+=n*j,M+=n*k,p+=n*V,m+=n*X,S+=n*x,A+=n*z,U+=n*Z,H+=n*$,B+=n*q,I+=n*Q,n=e[11],w+=n*F,_+=n*P,b+=n*O,v+=n*C,L+=n*D,g+=n*Y,M+=n*j,p+=n*k,m+=n*V,S+=n*X,A+=n*x,U+=n*z,H+=n*Z,B+=n*$,I+=n*q,T+=n*Q,n=e[12],_+=n*F,b+=n*P,v+=n*O,L+=n*C,g+=n*D,M+=n*Y,p+=n*j,m+=n*k,S+=n*V,A+=n*X,U+=n*x,H+=n*z,B+=n*Z,I+=n*$,T+=n*q,K+=n*Q,n=e[13],b+=n*F,v+=n*P,L+=n*O,g+=n*C,M+=n*D,p+=n*Y,m+=n*j,S+=n*k,A+=n*V,U+=n*X,H+=n*x,B+=n*z,I+=n*Z,T+=n*$,K+=n*q,N+=n*Q,n=e[14],v+=n*F,L+=n*P,g+=n*O,M+=n*C,p+=n*D,m+=n*Y,S+=n*j,A+=n*k,U+=n*V,H+=n*X,B+=n*x,I+=n*z,T+=n*Z,K+=n*$,N+=n*q,R+=n*Q,n=e[15],L+=n*F,g+=n*P,M+=n*O,p+=n*C,m+=n*D,S+=n*Y,A+=n*j,U+=n*k,H+=n*V,B+=n*X,I+=n*x,T+=n*z,K+=n*Z,N+=n*$,R+=n*q,G+=n*Q,i+=38*g,a+=38*M,s+=38*p,f+=38*m,u+=38*S,h+=38*A,l+=38*U,c+=38*H,d+=38*B,y+=38*I,E+=38*T,w+=38*K,_+=38*N,b+=38*R,v+=38*G,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=E+o+65535,o=Math.floor(n/65536),E=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=_+o+65535,o=Math.floor(n/65536),_=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=L+o+65535,o=Math.floor(n/65536),L=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=E+o+65535,o=Math.floor(n/65536),E=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=_+o+65535,o=Math.floor(n/65536),_=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=L+o+65535,o=Math.floor(n/65536),L=n-65536*o,i+=o-1+37*(o-1),t[0]=i,t[1]=a,t[2]=s,t[3]=f,t[4]=u,t[5]=h,t[6]=l,t[7]=c,t[8]=d,t[9]=y,t[10]=E,t[11]=w,t[12]=_,t[13]=b,t[14]=v,t[15]=L}function U(t,e){A(t,e,e)}function H(t,e){const r=o();let n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)U(r,r),2!==n&&4!==n&&A(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function B(t,e){const r=o(),n=o(),i=o(),a=o(),s=o(),u=o(),h=o(),l=o(),c=o();S(r,t[1],t[0]),S(c,e[1],e[0]),A(r,r,c),m(n,t[0],t[1]),m(c,e[0],e[1]),A(n,n,c),A(i,t[3],e[3]),A(i,i,f),A(a,t[2],e[2]),m(a,a,a),S(s,n,r),S(u,a,i),m(h,a,i),m(l,n,r),A(t[0],s,u),A(t[1],l,h),A(t[2],h,u),A(t[3],s,l)}function I(t,e,r){for(let n=0;n<4;n++)E(t[n],e[n],r)}function T(t,e){const r=o(),n=o(),i=o();H(i,e[2]),A(r,e[0],i),A(n,e[1],i),w(t,n),t[31]^=M(r)<<7}function K(t,e,r){d(t[0],i),d(t[1],a),d(t[2],a),d(t[3],i);for(let n=255;n>=0;--n){const o=r[n/8|0]>>(7&n)&1;I(t,e,o),B(e,t),B(t,t),I(t,e,o)}}function N(t,e){const r=[o(),o(),o(),o()];d(r[0],u),d(r[1],h),d(r[2],a),A(r[3],u,h),K(t,r,e)}function R(e){if(e.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const n=(0,r.hash)(e);n[0]&=248,n[31]&=127,n[31]|=64;const i=new Uint8Array(32),a=[o(),o(),o(),o()];N(a,n),T(i,a);const s=new Uint8Array(64);return s.set(e),s.set(i,32),{publicKey:i,secretKey:s}}t.generateKeyPairFromSeed=R,t.generateKeyPair=function(t){const r=(0,e.randomBytes)(32,t),o=R(r);return(0,n.wipe)(r),o},t.extractPublicKeyFromSecretKey=function(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(e.subarray(32))};const G=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function F(t,e){let r,n,o,i;for(n=63;n>=32;--n){for(r=0,o=n-32,i=n-12;o<i;++o)e[o]+=r-16*e[n]*G[o-(n-32)],r=Math.floor((e[o]+128)/256),e[o]-=256*r;e[o]+=r,e[n]=0}for(r=0,o=0;o<32;o++)e[o]+=r-(e[31]>>4)*G[o],r=e[o]>>8,e[o]&=255;for(o=0;o<32;o++)e[o]-=r*G[o];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function P(t){const e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let e=0;e<64;e++)t[e]=0;F(t,e)}function O(t,e){const r=o(),n=o(),f=o(),u=o(),h=o(),c=o(),y=o();return d(t[2],a),function(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}(t[1],e),U(f,t[1]),A(u,f,s),S(f,f,t[2]),m(u,t[2],u),U(h,u),U(c,h),A(y,c,h),A(r,y,f),A(r,r,u),function(t,e){const r=o();let n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)U(r,r),1!==n&&A(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}(r,r),A(r,r,f),A(r,r,u),A(r,r,u),A(t[0],r,u),U(n,t[0]),A(n,n,u),b(n,f)&&A(t[0],t[0],l),U(n,t[0]),A(n,n,u),b(n,f)?-1:(M(t[0])===e[31]>>7&&S(t[0],i,t[0]),A(t[3],t[0],t[1]),0)}t.sign=function(t,e){const n=new Float64Array(64),i=[o(),o(),o(),o()],a=(0,r.hash)(t.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const s=new Uint8Array(64);s.set(a.subarray(32),32);const f=new r.SHA512;f.update(s.subarray(32)),f.update(e);const u=f.digest();f.clean(),P(u),N(i,u),T(s,i),f.reset(),f.update(s.subarray(0,32)),f.update(t.subarray(32)),f.update(e);const h=f.digest();P(h);for(let t=0;t<32;t++)n[t]=u[t];for(let t=0;t<32;t++)for(let e=0;e<32;e++)n[t+e]+=h[t]*a[e];return F(s.subarray(32),n),s},t.verify=function(e,n,i){const a=new Uint8Array(32),s=[o(),o(),o(),o()],f=[o(),o(),o(),o()];if(i.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(O(f,e))return!1;const u=new r.SHA512;u.update(i.subarray(0,32)),u.update(e),u.update(n);const h=u.digest();return P(h),K(s,f,h),N(f,i.subarray(32)),B(s,f),T(a,s),!_(i,a)},t.convertPublicKeyToX25519=function(t){let e=[o(),o(),o(),o()];if(O(e,t))throw new Error("Ed25519: invalid public key");let r=o(),n=o(),i=e[1];m(r,a,i),S(n,a,i),H(n,n),A(r,r,n);let s=new Uint8Array(32);return w(s,r),s},t.convertSecretKeyToX25519=function(t){const e=(0,r.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;const o=new Uint8Array(e.subarray(0,32));return(0,n.wipe)(e),o}}(n)),n),A={};var U=(m||(m=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=L(),r=c();function n(t){const e=new Float64Array(16);if(t)for(let r=0;r<t.length;r++)e[r]=t[r];return e}t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;const o=new Uint8Array(32);o[0]=9;const i=n([56129,1]);function a(t){let e=1;for(let r=0;r<16;r++){let n=t[r]+e+65535;e=Math.floor(n/65536),t[r]=n-65536*e}t[0]+=e-1+37*(e-1)}function s(t,e,r){const n=~(r-1);for(let r=0;r<16;r++){const o=n&(t[r]^e[r]);t[r]^=o,e[r]^=o}}function f(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function u(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function h(t,e,r){let n,o,i=0,a=0,s=0,f=0,u=0,h=0,l=0,c=0,d=0,y=0,E=0,w=0,_=0,b=0,v=0,L=0,g=0,M=0,p=0,m=0,S=0,A=0,U=0,H=0,B=0,I=0,T=0,K=0,N=0,R=0,G=0,F=r[0],P=r[1],O=r[2],C=r[3],D=r[4],Y=r[5],j=r[6],k=r[7],V=r[8],X=r[9],x=r[10],z=r[11],Z=r[12],$=r[13],q=r[14],Q=r[15];n=e[0],i+=n*F,a+=n*P,s+=n*O,f+=n*C,u+=n*D,h+=n*Y,l+=n*j,c+=n*k,d+=n*V,y+=n*X,E+=n*x,w+=n*z,_+=n*Z,b+=n*$,v+=n*q,L+=n*Q,n=e[1],a+=n*F,s+=n*P,f+=n*O,u+=n*C,h+=n*D,l+=n*Y,c+=n*j,d+=n*k,y+=n*V,E+=n*X,w+=n*x,_+=n*z,b+=n*Z,v+=n*$,L+=n*q,g+=n*Q,n=e[2],s+=n*F,f+=n*P,u+=n*O,h+=n*C,l+=n*D,c+=n*Y,d+=n*j,y+=n*k,E+=n*V,w+=n*X,_+=n*x,b+=n*z,v+=n*Z,L+=n*$,g+=n*q,M+=n*Q,n=e[3],f+=n*F,u+=n*P,h+=n*O,l+=n*C,c+=n*D,d+=n*Y,y+=n*j,E+=n*k,w+=n*V,_+=n*X,b+=n*x,v+=n*z,L+=n*Z,g+=n*$,M+=n*q,p+=n*Q,n=e[4],u+=n*F,h+=n*P,l+=n*O,c+=n*C,d+=n*D,y+=n*Y,E+=n*j,w+=n*k,_+=n*V,b+=n*X,v+=n*x,L+=n*z,g+=n*Z,M+=n*$,p+=n*q,m+=n*Q,n=e[5],h+=n*F,l+=n*P,c+=n*O,d+=n*C,y+=n*D,E+=n*Y,w+=n*j,_+=n*k,b+=n*V,v+=n*X,L+=n*x,g+=n*z,M+=n*Z,p+=n*$,m+=n*q,S+=n*Q,n=e[6],l+=n*F,c+=n*P,d+=n*O,y+=n*C,E+=n*D,w+=n*Y,_+=n*j,b+=n*k,v+=n*V,L+=n*X,g+=n*x,M+=n*z,p+=n*Z,m+=n*$,S+=n*q,A+=n*Q,n=e[7],c+=n*F,d+=n*P,y+=n*O,E+=n*C,w+=n*D,_+=n*Y,b+=n*j,v+=n*k,L+=n*V,g+=n*X,M+=n*x,p+=n*z,m+=n*Z,S+=n*$,A+=n*q,U+=n*Q,n=e[8],d+=n*F,y+=n*P,E+=n*O,w+=n*C,_+=n*D,b+=n*Y,v+=n*j,L+=n*k,g+=n*V,M+=n*X,p+=n*x,m+=n*z,S+=n*Z,A+=n*$,U+=n*q,H+=n*Q,n=e[9],y+=n*F,E+=n*P,w+=n*O,_+=n*C,b+=n*D,v+=n*Y,L+=n*j,g+=n*k,M+=n*V,p+=n*X,m+=n*x,S+=n*z,A+=n*Z,U+=n*$,H+=n*q,B+=n*Q,n=e[10],E+=n*F,w+=n*P,_+=n*O,b+=n*C,v+=n*D,L+=n*Y,g+=n*j,M+=n*k,p+=n*V,m+=n*X,S+=n*x,A+=n*z,U+=n*Z,H+=n*$,B+=n*q,I+=n*Q,n=e[11],w+=n*F,_+=n*P,b+=n*O,v+=n*C,L+=n*D,g+=n*Y,M+=n*j,p+=n*k,m+=n*V,S+=n*X,A+=n*x,U+=n*z,H+=n*Z,B+=n*$,I+=n*q,T+=n*Q,n=e[12],_+=n*F,b+=n*P,v+=n*O,L+=n*C,g+=n*D,M+=n*Y,p+=n*j,m+=n*k,S+=n*V,A+=n*X,U+=n*x,H+=n*z,B+=n*Z,I+=n*$,T+=n*q,K+=n*Q,n=e[13],b+=n*F,v+=n*P,L+=n*O,g+=n*C,M+=n*D,p+=n*Y,m+=n*j,S+=n*k,A+=n*V,U+=n*X,H+=n*x,B+=n*z,I+=n*Z,T+=n*$,K+=n*q,N+=n*Q,n=e[14],v+=n*F,L+=n*P,g+=n*O,M+=n*C,p+=n*D,m+=n*Y,S+=n*j,A+=n*k,U+=n*V,H+=n*X,B+=n*x,I+=n*z,T+=n*Z,K+=n*$,N+=n*q,R+=n*Q,n=e[15],L+=n*F,g+=n*P,M+=n*O,p+=n*C,m+=n*D,S+=n*Y,A+=n*j,U+=n*k,H+=n*V,B+=n*X,I+=n*x,T+=n*z,K+=n*Z,N+=n*$,R+=n*q,G+=n*Q,i+=38*g,a+=38*M,s+=38*p,f+=38*m,u+=38*S,h+=38*A,l+=38*U,c+=38*H,d+=38*B,y+=38*I,E+=38*T,w+=38*K,_+=38*N,b+=38*R,v+=38*G,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=E+o+65535,o=Math.floor(n/65536),E=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=_+o+65535,o=Math.floor(n/65536),_=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=L+o+65535,o=Math.floor(n/65536),L=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=E+o+65535,o=Math.floor(n/65536),E=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=_+o+65535,o=Math.floor(n/65536),_=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=L+o+65535,o=Math.floor(n/65536),L=n-65536*o,i+=o-1+37*(o-1),t[0]=i,t[1]=a,t[2]=s,t[3]=f,t[4]=u,t[5]=h,t[6]=l,t[7]=c,t[8]=d,t[9]=y,t[10]=E,t[11]=w,t[12]=_,t[13]=b,t[14]=v,t[15]=L}function l(t,e){h(t,e,e)}function d(t,e){const r=new Uint8Array(32),o=new Float64Array(80),c=n(),d=n(),y=n(),E=n(),w=n(),_=n();for(let e=0;e<31;e++)r[e]=t[e];r[31]=127&t[31]|64,r[0]&=248,function(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}(o,e);for(let t=0;t<16;t++)d[t]=o[t];c[0]=E[0]=1;for(let t=254;t>=0;--t){const e=r[t>>>3]>>>(7&t)&1;s(c,d,e),s(y,E,e),f(w,c,y),u(c,c,y),f(y,d,E),u(d,d,E),l(E,w),l(_,c),h(c,y,c),h(y,d,w),f(w,c,y),u(c,c,y),l(d,c),u(y,E,_),h(c,y,i),f(c,c,E),h(y,y,c),h(c,E,_),h(E,d,o),l(d,w),s(c,d,e),s(y,E,e)}for(let t=0;t<16;t++)o[t+16]=c[t],o[t+32]=y[t],o[t+48]=d[t],o[t+64]=E[t];const b=o.subarray(32),v=o.subarray(16);!function(t,e){const r=n();for(let t=0;t<16;t++)r[t]=e[t];for(let t=253;t>=0;t--)l(r,r),2!==t&&4!==t&&h(r,r,e);for(let e=0;e<16;e++)t[e]=r[e]}(b,b),h(v,v,b);const L=new Uint8Array(32);return function(t,e){const r=n(),o=n();for(let t=0;t<16;t++)o[t]=e[t];a(o),a(o),a(o);for(let t=0;t<2;t++){r[0]=o[0]-65517;for(let t=1;t<15;t++)r[t]=o[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=o[15]-32767-(r[14]>>16&1);const t=r[15]>>16&1;r[14]&=65535,s(o,r,1-t)}for(let e=0;e<16;e++)t[2*e]=255&o[e],t[2*e+1]=o[e]>>8}(L,v),L}function y(t){return d(t,o)}function E(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const r=new Uint8Array(e);return{publicKey:y(r),secretKey:r}}t.scalarMult=d,t.scalarMultBase=y,t.generateKeyPairFromSeed=E,t.generateKeyPair=function(t){const n=(0,e.randomBytes)(32,t),o=E(n);return(0,r.wipe)(n),o},t.sharedKey=function(e,r,n=!1){if(e.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const o=d(e,r);if(n){let t=0;for(let e=0;e<o.length;e++)t|=o[e];if(0===t)throw new Error("X25519: invalid shared key")}return o}}(A)),A);export{S as e,U as x};
1
+ import{c as t}from"./_commonjs-dynamic-modules-COweQ1RR-BHR_E30J.js";import{y as e}from"./main.js";var r,n={},o={},i={},a={};var s,f,u,h={},l={};function c(){if(s)return l;return s=1,Object.defineProperty(l,"__esModule",{value:!0}),l.wipe=function(t){for(var e=0;e<t.length;e++)t[e]=0;return t},l}function d(){if(u)return i;u=1,Object.defineProperty(i,"__esModule",{value:!0}),i.SystemRandomSource=void 0;const n=(r||(r=1,Object.defineProperty(a,"__esModule",{value:!0}),a.BrowserRandomSource=void 0,a.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t="undefined"!=typeof self?self.crypto||self.msCrypto:null;t&&void 0!==t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let t=0;t<e.length;t+=65536)this._crypto.getRandomValues(e.subarray(t,t+Math.min(e.length-t,65536)));return e}}),a),o=function(){if(f)return h;f=1,Object.defineProperty(h,"__esModule",{value:!0}),h.NodeRandomSource=void 0;const r=c();return h.NodeRandomSource=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,void 0!==t){const t=e;t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(t);for(let t=0;t<n.length;t++)n[t]=e[t];return(0,r.wipe)(e),n}},h}();return i.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new o.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}},i}var y,E,w,_={},b={};function v(){if(E)return _;E=1,Object.defineProperty(_,"__esModule",{value:!0});var t,e=(y||(y=1,t=b,Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(t,e){var r=65535&t,n=65535&e;return r*n+((t>>>16&65535)*n+r*(e>>>16&65535)<<16>>>0)|0},t.add=function(t,e){return t+e|0},t.sub=function(t,e){return t-e|0},t.rotl=function(t,e){return t<<e|t>>>32-e},t.rotr=function(t,e){return t<<32-e|t>>>e},t.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}),b);function r(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}function n(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}function o(t,e){return void 0===e&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function i(t,e){return void 0===e&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function a(t,e){return void 0===e&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function s(t,e){return void 0===e&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}function f(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}function u(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}function h(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),f(t/4294967296>>>0,e,r),f(t>>>0,e,r+4),e}function l(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),u(t>>>0,e,r),u(t/4294967296>>>0,e,r+4),e}return _.readInt16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16},_.readUint16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])>>>0},_.readInt16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])<<16>>16},_.readUint16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])>>>0},_.writeUint16BE=r,_.writeInt16BE=r,_.writeUint16LE=n,_.writeInt16LE=n,_.readInt32BE=o,_.readUint32BE=i,_.readInt32LE=a,_.readUint32LE=s,_.writeUint32BE=f,_.writeInt32BE=f,_.writeUint32LE=u,_.writeInt32LE=u,_.readInt64BE=function(t,e){void 0===e&&(e=0);var r=o(t,e),n=o(t,e+4);return 4294967296*r+n-4294967296*(n>>31)},_.readUint64BE=function(t,e){return void 0===e&&(e=0),4294967296*i(t,e)+i(t,e+4)},_.readInt64LE=function(t,e){void 0===e&&(e=0);var r=a(t,e);return 4294967296*a(t,e+4)+r-4294967296*(r>>31)},_.readUint64LE=function(t,e){void 0===e&&(e=0);var r=s(t,e);return 4294967296*s(t,e+4)+r},_.writeUint64BE=h,_.writeInt64BE=h,_.writeUint64LE=l,_.writeInt64LE=l,_.readUintBE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,o=1,i=t/8+r-1;i>=r;i--)n+=e[i]*o,o*=256;return n},_.readUintLE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,o=1,i=r;i<r+t/8;i++)n+=e[i]*o,o*=256;return n},_.writeUintBE=function(t,r,n,o){if(void 0===n&&(n=new Uint8Array(t/8)),void 0===o&&(o=0),t%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!e.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var i=1,a=t/8+o-1;a>=o;a--)n[a]=r/i&255,i*=256;return n},_.writeUintLE=function(t,r,n,o){if(void 0===n&&(n=new Uint8Array(t/8)),void 0===o&&(o=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!e.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var i=1,a=o;a<o+t/8;a++)n[a]=r/i&255,i*=256;return n},_.readFloat32BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e)},_.readFloat32LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e,!0)},_.readFloat64BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e)},_.readFloat64LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e,!0)},_.writeFloat32BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t),e},_.writeFloat32LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t,!0),e},_.writeFloat64BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t),e},_.writeFloat64LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t,!0),e},_}function L(){return w||(w=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=d(),r=v(),n=c();function o(e,r=t.defaultRandomSource){return r.randomBytes(e)}t.defaultRandomSource=new e.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(e=t.defaultRandomSource){const i=o(4,e),a=(0,r.readUint32LE)(i);return(0,n.wipe)(i),a};const i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(e,r=i,a=t.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let s="";const f=r.length,u=256-256%f;for(;e>0;){const t=o(Math.ceil(256*e/u),a);for(let n=0;n<t.length&&e>0;n++){const o=t[n];o<u&&(s+=r.charAt(o%f),e--)}(0,n.wipe)(t)}return s}t.randomString=a,t.randomStringForEntropy=function(e,r=i,n=t.defaultRandomSource){return a(Math.ceil(e/(Math.log(r.length)/Math.LN2)),r,n)}}(o)),o}var g,M,p={};var m,S=(M||(M=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=L(),r=(g||(g=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=v(),r=c();t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function n(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return n.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},n.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},n.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},n.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},n.prototype.finish=function(t){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,o=r/536870912|0,a=r<<3,s=r%128<112?128:256;this._buffer[n]=128;for(var f=n+1;f<s-8;f++)this._buffer[f]=0;e.writeUint32BE(o,this._buffer,s-8),e.writeUint32BE(a,this._buffer,s-4),i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,s),this._finished=!0}for(f=0;f<this.digestLength/8;f++)e.writeUint32BE(this._stateHi[f],t,8*f),e.writeUint32BE(this._stateLo[f],t,8*f+4);return this},n.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},n.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(t){return this._stateHi.set(t.stateHi),this._stateLo.set(t.stateLo),this._bufferLength=t.bufferLength,t.buffer&&this._buffer.set(t.buffer),this._bytesHashed=t.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(t){r.wipe(t.stateHi),r.wipe(t.stateLo),t.buffer&&r.wipe(t.buffer),t.bufferLength=0,t.bytesHashed=0},n}();t.SHA512=n;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function i(t,r,n,i,a,s,f){for(var u,h,l,c,d,y,E,w,_=n[0],b=n[1],v=n[2],L=n[3],g=n[4],M=n[5],p=n[6],m=n[7],S=i[0],A=i[1],U=i[2],H=i[3],B=i[4],I=i[5],T=i[6],K=i[7];f>=128;){for(var N=0;N<16;N++){var R=8*N+s;t[N]=e.readUint32BE(a,R),r[N]=e.readUint32BE(a,R+4)}for(N=0;N<80;N++){var G,F,P=_,O=b,C=v,D=L,Y=g,j=M,k=p,V=S,X=A,x=U,z=H,Z=B,$=I,q=T;if(d=65535&(h=K),y=h>>>16,E=65535&(u=m),w=u>>>16,d+=65535&(h=(B>>>14|g<<18)^(B>>>18|g<<14)^(g>>>9|B<<23)),y+=h>>>16,E+=65535&(u=(g>>>14|B<<18)^(g>>>18|B<<14)^(B>>>9|g<<23)),w+=u>>>16,d+=65535&(h=B&I^~B&T),y+=h>>>16,E+=65535&(u=g&M^~g&p),w+=u>>>16,u=o[2*N],d+=65535&(h=o[2*N+1]),y+=h>>>16,E+=65535&u,w+=u>>>16,u=t[N%16],y+=(h=r[N%16])>>>16,E+=65535&u,w+=u>>>16,E+=(y+=(d+=65535&h)>>>16)>>>16,d=65535&(h=c=65535&d|y<<16),y=h>>>16,E=65535&(u=l=65535&E|(w+=E>>>16)<<16),w=u>>>16,d+=65535&(h=(S>>>28|_<<4)^(_>>>2|S<<30)^(_>>>7|S<<25)),y+=h>>>16,E+=65535&(u=(_>>>28|S<<4)^(S>>>2|_<<30)^(S>>>7|_<<25)),w+=u>>>16,y+=(h=S&A^S&U^A&U)>>>16,E+=65535&(u=_&b^_&v^b&v),w+=u>>>16,G=65535&(E+=(y+=(d+=65535&h)>>>16)>>>16)|(w+=E>>>16)<<16,F=65535&d|y<<16,d=65535&(h=z),y=h>>>16,E=65535&(u=D),w=u>>>16,y+=(h=c)>>>16,E+=65535&(u=l),w+=u>>>16,b=P,v=O,L=C,g=D=65535&(E+=(y+=(d+=65535&h)>>>16)>>>16)|(w+=E>>>16)<<16,M=Y,p=j,m=k,_=G,A=V,U=X,H=x,B=z=65535&d|y<<16,I=Z,T=$,K=q,S=F,N%16==15)for(R=0;R<16;R++)u=t[R],d=65535&(h=r[R]),y=h>>>16,E=65535&u,w=u>>>16,u=t[(R+9)%16],d+=65535&(h=r[(R+9)%16]),y+=h>>>16,E+=65535&u,w+=u>>>16,l=t[(R+1)%16],d+=65535&(h=((c=r[(R+1)%16])>>>1|l<<31)^(c>>>8|l<<24)^(c>>>7|l<<25)),y+=h>>>16,E+=65535&(u=(l>>>1|c<<31)^(l>>>8|c<<24)^l>>>7),w+=u>>>16,l=t[(R+14)%16],y+=(h=((c=r[(R+14)%16])>>>19|l<<13)^(l>>>29|c<<3)^(c>>>6|l<<26))>>>16,E+=65535&(u=(l>>>19|c<<13)^(c>>>29|l<<3)^l>>>6),w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,t[R]=65535&E|w<<16,r[R]=65535&d|y<<16}d=65535&(h=S),y=h>>>16,E=65535&(u=_),w=u>>>16,u=n[0],y+=(h=i[0])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[0]=_=65535&E|w<<16,i[0]=S=65535&d|y<<16,d=65535&(h=A),y=h>>>16,E=65535&(u=b),w=u>>>16,u=n[1],y+=(h=i[1])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[1]=b=65535&E|w<<16,i[1]=A=65535&d|y<<16,d=65535&(h=U),y=h>>>16,E=65535&(u=v),w=u>>>16,u=n[2],y+=(h=i[2])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[2]=v=65535&E|w<<16,i[2]=U=65535&d|y<<16,d=65535&(h=H),y=h>>>16,E=65535&(u=L),w=u>>>16,u=n[3],y+=(h=i[3])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[3]=L=65535&E|w<<16,i[3]=H=65535&d|y<<16,d=65535&(h=B),y=h>>>16,E=65535&(u=g),w=u>>>16,u=n[4],y+=(h=i[4])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[4]=g=65535&E|w<<16,i[4]=B=65535&d|y<<16,d=65535&(h=I),y=h>>>16,E=65535&(u=M),w=u>>>16,u=n[5],y+=(h=i[5])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[5]=M=65535&E|w<<16,i[5]=I=65535&d|y<<16,d=65535&(h=T),y=h>>>16,E=65535&(u=p),w=u>>>16,u=n[6],y+=(h=i[6])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[6]=p=65535&E|w<<16,i[6]=T=65535&d|y<<16,d=65535&(h=K),y=h>>>16,E=65535&(u=m),w=u>>>16,u=n[7],y+=(h=i[7])>>>16,E+=65535&u,w+=u>>>16,w+=(E+=(y+=(d+=65535&h)>>>16)>>>16)>>>16,n[7]=m=65535&E|w<<16,i[7]=K=65535&d|y<<16,s+=128,f-=128}return s}t.hash=function(t){var e=new n;e.update(t);var r=e.digest();return e.clean(),r}}(p)),p),n=c();function o(t){const e=new Float64Array(16);if(t)for(let r=0;r<t.length;r++)e[r]=t[r];return e}t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32,new Uint8Array(32)[0]=9;const i=o(),a=o([1]),s=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),l=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(t,e){for(let r=0;r<16;r++)t[r]=0|e[r]}function y(t){let e=1;for(let r=0;r<16;r++){let n=t[r]+e+65535;e=Math.floor(n/65536),t[r]=n-65536*e}t[0]+=e-1+37*(e-1)}function E(t,e,r){const n=~(r-1);for(let r=0;r<16;r++){const o=n&(t[r]^e[r]);t[r]^=o,e[r]^=o}}function w(t,e){const r=o(),n=o();for(let t=0;t<16;t++)n[t]=e[t];y(n),y(n),y(n);for(let t=0;t<2;t++){r[0]=n[0]-65517;for(let t=1;t<15;t++)r[t]=n[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const t=r[15]>>16&1;r[14]&=65535,E(n,r,1-t)}for(let e=0;e<16;e++)t[2*e]=255&n[e],t[2*e+1]=n[e]>>8}function _(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function b(t,e){const r=new Uint8Array(32),n=new Uint8Array(32);return w(r,t),w(n,e),_(r,n)}function M(t){const e=new Uint8Array(32);return w(e,t),1&e[0]}function m(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function S(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function A(t,e,r){let n,o,i=0,a=0,s=0,f=0,u=0,h=0,l=0,c=0,d=0,y=0,E=0,w=0,_=0,b=0,v=0,L=0,g=0,M=0,p=0,m=0,S=0,A=0,U=0,H=0,B=0,I=0,T=0,K=0,N=0,R=0,G=0,F=r[0],P=r[1],O=r[2],C=r[3],D=r[4],Y=r[5],j=r[6],k=r[7],V=r[8],X=r[9],x=r[10],z=r[11],Z=r[12],$=r[13],q=r[14],Q=r[15];n=e[0],i+=n*F,a+=n*P,s+=n*O,f+=n*C,u+=n*D,h+=n*Y,l+=n*j,c+=n*k,d+=n*V,y+=n*X,E+=n*x,w+=n*z,_+=n*Z,b+=n*$,v+=n*q,L+=n*Q,n=e[1],a+=n*F,s+=n*P,f+=n*O,u+=n*C,h+=n*D,l+=n*Y,c+=n*j,d+=n*k,y+=n*V,E+=n*X,w+=n*x,_+=n*z,b+=n*Z,v+=n*$,L+=n*q,g+=n*Q,n=e[2],s+=n*F,f+=n*P,u+=n*O,h+=n*C,l+=n*D,c+=n*Y,d+=n*j,y+=n*k,E+=n*V,w+=n*X,_+=n*x,b+=n*z,v+=n*Z,L+=n*$,g+=n*q,M+=n*Q,n=e[3],f+=n*F,u+=n*P,h+=n*O,l+=n*C,c+=n*D,d+=n*Y,y+=n*j,E+=n*k,w+=n*V,_+=n*X,b+=n*x,v+=n*z,L+=n*Z,g+=n*$,M+=n*q,p+=n*Q,n=e[4],u+=n*F,h+=n*P,l+=n*O,c+=n*C,d+=n*D,y+=n*Y,E+=n*j,w+=n*k,_+=n*V,b+=n*X,v+=n*x,L+=n*z,g+=n*Z,M+=n*$,p+=n*q,m+=n*Q,n=e[5],h+=n*F,l+=n*P,c+=n*O,d+=n*C,y+=n*D,E+=n*Y,w+=n*j,_+=n*k,b+=n*V,v+=n*X,L+=n*x,g+=n*z,M+=n*Z,p+=n*$,m+=n*q,S+=n*Q,n=e[6],l+=n*F,c+=n*P,d+=n*O,y+=n*C,E+=n*D,w+=n*Y,_+=n*j,b+=n*k,v+=n*V,L+=n*X,g+=n*x,M+=n*z,p+=n*Z,m+=n*$,S+=n*q,A+=n*Q,n=e[7],c+=n*F,d+=n*P,y+=n*O,E+=n*C,w+=n*D,_+=n*Y,b+=n*j,v+=n*k,L+=n*V,g+=n*X,M+=n*x,p+=n*z,m+=n*Z,S+=n*$,A+=n*q,U+=n*Q,n=e[8],d+=n*F,y+=n*P,E+=n*O,w+=n*C,_+=n*D,b+=n*Y,v+=n*j,L+=n*k,g+=n*V,M+=n*X,p+=n*x,m+=n*z,S+=n*Z,A+=n*$,U+=n*q,H+=n*Q,n=e[9],y+=n*F,E+=n*P,w+=n*O,_+=n*C,b+=n*D,v+=n*Y,L+=n*j,g+=n*k,M+=n*V,p+=n*X,m+=n*x,S+=n*z,A+=n*Z,U+=n*$,H+=n*q,B+=n*Q,n=e[10],E+=n*F,w+=n*P,_+=n*O,b+=n*C,v+=n*D,L+=n*Y,g+=n*j,M+=n*k,p+=n*V,m+=n*X,S+=n*x,A+=n*z,U+=n*Z,H+=n*$,B+=n*q,I+=n*Q,n=e[11],w+=n*F,_+=n*P,b+=n*O,v+=n*C,L+=n*D,g+=n*Y,M+=n*j,p+=n*k,m+=n*V,S+=n*X,A+=n*x,U+=n*z,H+=n*Z,B+=n*$,I+=n*q,T+=n*Q,n=e[12],_+=n*F,b+=n*P,v+=n*O,L+=n*C,g+=n*D,M+=n*Y,p+=n*j,m+=n*k,S+=n*V,A+=n*X,U+=n*x,H+=n*z,B+=n*Z,I+=n*$,T+=n*q,K+=n*Q,n=e[13],b+=n*F,v+=n*P,L+=n*O,g+=n*C,M+=n*D,p+=n*Y,m+=n*j,S+=n*k,A+=n*V,U+=n*X,H+=n*x,B+=n*z,I+=n*Z,T+=n*$,K+=n*q,N+=n*Q,n=e[14],v+=n*F,L+=n*P,g+=n*O,M+=n*C,p+=n*D,m+=n*Y,S+=n*j,A+=n*k,U+=n*V,H+=n*X,B+=n*x,I+=n*z,T+=n*Z,K+=n*$,N+=n*q,R+=n*Q,n=e[15],L+=n*F,g+=n*P,M+=n*O,p+=n*C,m+=n*D,S+=n*Y,A+=n*j,U+=n*k,H+=n*V,B+=n*X,I+=n*x,T+=n*z,K+=n*Z,N+=n*$,R+=n*q,G+=n*Q,i+=38*g,a+=38*M,s+=38*p,f+=38*m,u+=38*S,h+=38*A,l+=38*U,c+=38*H,d+=38*B,y+=38*I,E+=38*T,w+=38*K,_+=38*N,b+=38*R,v+=38*G,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=E+o+65535,o=Math.floor(n/65536),E=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=_+o+65535,o=Math.floor(n/65536),_=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=L+o+65535,o=Math.floor(n/65536),L=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=E+o+65535,o=Math.floor(n/65536),E=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=_+o+65535,o=Math.floor(n/65536),_=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=L+o+65535,o=Math.floor(n/65536),L=n-65536*o,i+=o-1+37*(o-1),t[0]=i,t[1]=a,t[2]=s,t[3]=f,t[4]=u,t[5]=h,t[6]=l,t[7]=c,t[8]=d,t[9]=y,t[10]=E,t[11]=w,t[12]=_,t[13]=b,t[14]=v,t[15]=L}function U(t,e){A(t,e,e)}function H(t,e){const r=o();let n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)U(r,r),2!==n&&4!==n&&A(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function B(t,e){const r=o(),n=o(),i=o(),a=o(),s=o(),u=o(),h=o(),l=o(),c=o();S(r,t[1],t[0]),S(c,e[1],e[0]),A(r,r,c),m(n,t[0],t[1]),m(c,e[0],e[1]),A(n,n,c),A(i,t[3],e[3]),A(i,i,f),A(a,t[2],e[2]),m(a,a,a),S(s,n,r),S(u,a,i),m(h,a,i),m(l,n,r),A(t[0],s,u),A(t[1],l,h),A(t[2],h,u),A(t[3],s,l)}function I(t,e,r){for(let n=0;n<4;n++)E(t[n],e[n],r)}function T(t,e){const r=o(),n=o(),i=o();H(i,e[2]),A(r,e[0],i),A(n,e[1],i),w(t,n),t[31]^=M(r)<<7}function K(t,e,r){d(t[0],i),d(t[1],a),d(t[2],a),d(t[3],i);for(let n=255;n>=0;--n){const o=r[n/8|0]>>(7&n)&1;I(t,e,o),B(e,t),B(t,t),I(t,e,o)}}function N(t,e){const r=[o(),o(),o(),o()];d(r[0],u),d(r[1],h),d(r[2],a),A(r[3],u,h),K(t,r,e)}function R(e){if(e.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const n=(0,r.hash)(e);n[0]&=248,n[31]&=127,n[31]|=64;const i=new Uint8Array(32),a=[o(),o(),o(),o()];N(a,n),T(i,a);const s=new Uint8Array(64);return s.set(e),s.set(i,32),{publicKey:i,secretKey:s}}t.generateKeyPairFromSeed=R,t.generateKeyPair=function(t){const r=(0,e.randomBytes)(32,t),o=R(r);return(0,n.wipe)(r),o},t.extractPublicKeyFromSecretKey=function(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(e.subarray(32))};const G=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function F(t,e){let r,n,o,i;for(n=63;n>=32;--n){for(r=0,o=n-32,i=n-12;o<i;++o)e[o]+=r-16*e[n]*G[o-(n-32)],r=Math.floor((e[o]+128)/256),e[o]-=256*r;e[o]+=r,e[n]=0}for(r=0,o=0;o<32;o++)e[o]+=r-(e[31]>>4)*G[o],r=e[o]>>8,e[o]&=255;for(o=0;o<32;o++)e[o]-=r*G[o];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function P(t){const e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let e=0;e<64;e++)t[e]=0;F(t,e)}function O(t,e){const r=o(),n=o(),f=o(),u=o(),h=o(),c=o(),y=o();return d(t[2],a),function(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}(t[1],e),U(f,t[1]),A(u,f,s),S(f,f,t[2]),m(u,t[2],u),U(h,u),U(c,h),A(y,c,h),A(r,y,f),A(r,r,u),function(t,e){const r=o();let n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)U(r,r),1!==n&&A(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}(r,r),A(r,r,f),A(r,r,u),A(r,r,u),A(t[0],r,u),U(n,t[0]),A(n,n,u),b(n,f)&&A(t[0],t[0],l),U(n,t[0]),A(n,n,u),b(n,f)?-1:(M(t[0])===e[31]>>7&&S(t[0],i,t[0]),A(t[3],t[0],t[1]),0)}t.sign=function(t,e){const n=new Float64Array(64),i=[o(),o(),o(),o()],a=(0,r.hash)(t.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const s=new Uint8Array(64);s.set(a.subarray(32),32);const f=new r.SHA512;f.update(s.subarray(32)),f.update(e);const u=f.digest();f.clean(),P(u),N(i,u),T(s,i),f.reset(),f.update(s.subarray(0,32)),f.update(t.subarray(32)),f.update(e);const h=f.digest();P(h);for(let t=0;t<32;t++)n[t]=u[t];for(let t=0;t<32;t++)for(let e=0;e<32;e++)n[t+e]+=h[t]*a[e];return F(s.subarray(32),n),s},t.verify=function(e,n,i){const a=new Uint8Array(32),s=[o(),o(),o(),o()],f=[o(),o(),o(),o()];if(i.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(O(f,e))return!1;const u=new r.SHA512;u.update(i.subarray(0,32)),u.update(e),u.update(n);const h=u.digest();return P(h),K(s,f,h),N(f,i.subarray(32)),B(s,f),T(a,s),!_(i,a)},t.convertPublicKeyToX25519=function(t){let e=[o(),o(),o(),o()];if(O(e,t))throw new Error("Ed25519: invalid public key");let r=o(),n=o(),i=e[1];m(r,a,i),S(n,a,i),H(n,n),A(r,r,n);let s=new Uint8Array(32);return w(s,r),s},t.convertSecretKeyToX25519=function(t){const e=(0,r.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;const o=new Uint8Array(e.subarray(0,32));return(0,n.wipe)(e),o}}(n)),n),A={};var U=(m||(m=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=L(),r=c();function n(t){const e=new Float64Array(16);if(t)for(let r=0;r<t.length;r++)e[r]=t[r];return e}t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;const o=new Uint8Array(32);o[0]=9;const i=n([56129,1]);function a(t){let e=1;for(let r=0;r<16;r++){let n=t[r]+e+65535;e=Math.floor(n/65536),t[r]=n-65536*e}t[0]+=e-1+37*(e-1)}function s(t,e,r){const n=~(r-1);for(let r=0;r<16;r++){const o=n&(t[r]^e[r]);t[r]^=o,e[r]^=o}}function f(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function u(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function h(t,e,r){let n,o,i=0,a=0,s=0,f=0,u=0,h=0,l=0,c=0,d=0,y=0,E=0,w=0,_=0,b=0,v=0,L=0,g=0,M=0,p=0,m=0,S=0,A=0,U=0,H=0,B=0,I=0,T=0,K=0,N=0,R=0,G=0,F=r[0],P=r[1],O=r[2],C=r[3],D=r[4],Y=r[5],j=r[6],k=r[7],V=r[8],X=r[9],x=r[10],z=r[11],Z=r[12],$=r[13],q=r[14],Q=r[15];n=e[0],i+=n*F,a+=n*P,s+=n*O,f+=n*C,u+=n*D,h+=n*Y,l+=n*j,c+=n*k,d+=n*V,y+=n*X,E+=n*x,w+=n*z,_+=n*Z,b+=n*$,v+=n*q,L+=n*Q,n=e[1],a+=n*F,s+=n*P,f+=n*O,u+=n*C,h+=n*D,l+=n*Y,c+=n*j,d+=n*k,y+=n*V,E+=n*X,w+=n*x,_+=n*z,b+=n*Z,v+=n*$,L+=n*q,g+=n*Q,n=e[2],s+=n*F,f+=n*P,u+=n*O,h+=n*C,l+=n*D,c+=n*Y,d+=n*j,y+=n*k,E+=n*V,w+=n*X,_+=n*x,b+=n*z,v+=n*Z,L+=n*$,g+=n*q,M+=n*Q,n=e[3],f+=n*F,u+=n*P,h+=n*O,l+=n*C,c+=n*D,d+=n*Y,y+=n*j,E+=n*k,w+=n*V,_+=n*X,b+=n*x,v+=n*z,L+=n*Z,g+=n*$,M+=n*q,p+=n*Q,n=e[4],u+=n*F,h+=n*P,l+=n*O,c+=n*C,d+=n*D,y+=n*Y,E+=n*j,w+=n*k,_+=n*V,b+=n*X,v+=n*x,L+=n*z,g+=n*Z,M+=n*$,p+=n*q,m+=n*Q,n=e[5],h+=n*F,l+=n*P,c+=n*O,d+=n*C,y+=n*D,E+=n*Y,w+=n*j,_+=n*k,b+=n*V,v+=n*X,L+=n*x,g+=n*z,M+=n*Z,p+=n*$,m+=n*q,S+=n*Q,n=e[6],l+=n*F,c+=n*P,d+=n*O,y+=n*C,E+=n*D,w+=n*Y,_+=n*j,b+=n*k,v+=n*V,L+=n*X,g+=n*x,M+=n*z,p+=n*Z,m+=n*$,S+=n*q,A+=n*Q,n=e[7],c+=n*F,d+=n*P,y+=n*O,E+=n*C,w+=n*D,_+=n*Y,b+=n*j,v+=n*k,L+=n*V,g+=n*X,M+=n*x,p+=n*z,m+=n*Z,S+=n*$,A+=n*q,U+=n*Q,n=e[8],d+=n*F,y+=n*P,E+=n*O,w+=n*C,_+=n*D,b+=n*Y,v+=n*j,L+=n*k,g+=n*V,M+=n*X,p+=n*x,m+=n*z,S+=n*Z,A+=n*$,U+=n*q,H+=n*Q,n=e[9],y+=n*F,E+=n*P,w+=n*O,_+=n*C,b+=n*D,v+=n*Y,L+=n*j,g+=n*k,M+=n*V,p+=n*X,m+=n*x,S+=n*z,A+=n*Z,U+=n*$,H+=n*q,B+=n*Q,n=e[10],E+=n*F,w+=n*P,_+=n*O,b+=n*C,v+=n*D,L+=n*Y,g+=n*j,M+=n*k,p+=n*V,m+=n*X,S+=n*x,A+=n*z,U+=n*Z,H+=n*$,B+=n*q,I+=n*Q,n=e[11],w+=n*F,_+=n*P,b+=n*O,v+=n*C,L+=n*D,g+=n*Y,M+=n*j,p+=n*k,m+=n*V,S+=n*X,A+=n*x,U+=n*z,H+=n*Z,B+=n*$,I+=n*q,T+=n*Q,n=e[12],_+=n*F,b+=n*P,v+=n*O,L+=n*C,g+=n*D,M+=n*Y,p+=n*j,m+=n*k,S+=n*V,A+=n*X,U+=n*x,H+=n*z,B+=n*Z,I+=n*$,T+=n*q,K+=n*Q,n=e[13],b+=n*F,v+=n*P,L+=n*O,g+=n*C,M+=n*D,p+=n*Y,m+=n*j,S+=n*k,A+=n*V,U+=n*X,H+=n*x,B+=n*z,I+=n*Z,T+=n*$,K+=n*q,N+=n*Q,n=e[14],v+=n*F,L+=n*P,g+=n*O,M+=n*C,p+=n*D,m+=n*Y,S+=n*j,A+=n*k,U+=n*V,H+=n*X,B+=n*x,I+=n*z,T+=n*Z,K+=n*$,N+=n*q,R+=n*Q,n=e[15],L+=n*F,g+=n*P,M+=n*O,p+=n*C,m+=n*D,S+=n*Y,A+=n*j,U+=n*k,H+=n*V,B+=n*X,I+=n*x,T+=n*z,K+=n*Z,N+=n*$,R+=n*q,G+=n*Q,i+=38*g,a+=38*M,s+=38*p,f+=38*m,u+=38*S,h+=38*A,l+=38*U,c+=38*H,d+=38*B,y+=38*I,E+=38*T,w+=38*K,_+=38*N,b+=38*R,v+=38*G,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=E+o+65535,o=Math.floor(n/65536),E=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=_+o+65535,o=Math.floor(n/65536),_=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=L+o+65535,o=Math.floor(n/65536),L=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=E+o+65535,o=Math.floor(n/65536),E=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,n=_+o+65535,o=Math.floor(n/65536),_=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=L+o+65535,o=Math.floor(n/65536),L=n-65536*o,i+=o-1+37*(o-1),t[0]=i,t[1]=a,t[2]=s,t[3]=f,t[4]=u,t[5]=h,t[6]=l,t[7]=c,t[8]=d,t[9]=y,t[10]=E,t[11]=w,t[12]=_,t[13]=b,t[14]=v,t[15]=L}function l(t,e){h(t,e,e)}function d(t,e){const r=new Uint8Array(32),o=new Float64Array(80),c=n(),d=n(),y=n(),E=n(),w=n(),_=n();for(let e=0;e<31;e++)r[e]=t[e];r[31]=127&t[31]|64,r[0]&=248,function(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}(o,e);for(let t=0;t<16;t++)d[t]=o[t];c[0]=E[0]=1;for(let t=254;t>=0;--t){const e=r[t>>>3]>>>(7&t)&1;s(c,d,e),s(y,E,e),f(w,c,y),u(c,c,y),f(y,d,E),u(d,d,E),l(E,w),l(_,c),h(c,y,c),h(y,d,w),f(w,c,y),u(c,c,y),l(d,c),u(y,E,_),h(c,y,i),f(c,c,E),h(y,y,c),h(c,E,_),h(E,d,o),l(d,w),s(c,d,e),s(y,E,e)}for(let t=0;t<16;t++)o[t+16]=c[t],o[t+32]=y[t],o[t+48]=d[t],o[t+64]=E[t];const b=o.subarray(32),v=o.subarray(16);!function(t,e){const r=n();for(let t=0;t<16;t++)r[t]=e[t];for(let t=253;t>=0;t--)l(r,r),2!==t&&4!==t&&h(r,r,e);for(let e=0;e<16;e++)t[e]=r[e]}(b,b),h(v,v,b);const L=new Uint8Array(32);return function(t,e){const r=n(),o=n();for(let t=0;t<16;t++)o[t]=e[t];a(o),a(o),a(o);for(let t=0;t<2;t++){r[0]=o[0]-65517;for(let t=1;t<15;t++)r[t]=o[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=o[15]-32767-(r[14]>>16&1);const t=r[15]>>16&1;r[14]&=65535,s(o,r,1-t)}for(let e=0;e<16;e++)t[2*e]=255&o[e],t[2*e+1]=o[e]>>8}(L,v),L}function y(t){return d(t,o)}function E(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const r=new Uint8Array(e);return{publicKey:y(r),secretKey:r}}t.scalarMult=d,t.scalarMultBase=y,t.generateKeyPairFromSeed=E,t.generateKeyPair=function(t){const n=(0,e.randomBytes)(32,t),o=E(n);return(0,r.wipe)(n),o},t.sharedKey=function(e,r,n=!1){if(e.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const o=d(e,r);if(n){let t=0;for(let e=0;e<o.length;e++)t|=o[e];if(0===t)throw new Error("X25519: invalid shared key")}return o}}(A)),A);export{S as e,U as x};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockcerts/blockcerts-verifier",
3
- "version": "1.70.1",
3
+ "version": "1.71.1",
4
4
  "description": "A standalone universal viewer and verifier for blockcerts credentials",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,7 +11,7 @@
11
11
  "node": ">=20.0.0"
12
12
  },
13
13
  "dependencies": {
14
- "@blockcerts/cert-verifier-js": "^6.30.1",
14
+ "@blockcerts/cert-verifier-js": "^6.33.0",
15
15
  "@blockcerts/cert-verifier-js-v1-legacy": "^4.0.1",
16
16
  "@polymer/lit-element": "0.5.1",
17
17
  "@polymer/polymer": "3.5.2",
@@ -55,9 +55,9 @@
55
55
  "rollup": "^4.22.4",
56
56
  "rollup-plugin-livereload": "^2.0.0",
57
57
  "rollup-plugin-serve": "^3.0.0",
58
- "rollup-plugin-visualizer": "^5.9.2",
58
+ "rollup-plugin-visualizer": "^6.0.1",
59
59
  "semantic-release": "^24.2.3",
60
- "sinon": "^20.0.0",
60
+ "sinon": "^21.0.0",
61
61
  "stylelint": "^16.9.0",
62
62
  "stylelint-config-standard-scss": "^15.0.1",
63
63
  "typescript": "^5.8.3",
@@ -1,35 +0,0 @@
1
- import{d as e,f as t,V as r}from"./main.js";import{j as n,r as o}from"./jsonld-signatures-ZtLxJmqT-B0W14Jb0.js";import{j as i}from"./jsonld-CMQE_cGn-899pOqB6.js";import{d as a,e as s}from"./base64url-Cy03LJLt-vkTPfQOh.js";import{f as u}from"./index-BJkS6Wwm-C8oVP6LM.js";import{e as c,d as f}from"./index-DZLKRa_V-D_IQzjvG.js";import{S as d}from"./Suite-BmP2Qu19-D1ucdMDB.js";import"./pako.esm-BGRKTPxS-UdHShO7y.js";import"./sha256-CN3v2fAD-C1PUWFZm.js";import"./index-BcfLkJHS-Dgus2xdV.js";import{r as l}from"./retrieveVerificationMethodPublicKey-nmb3CCVx-DA6ovQri.js";import"./elliptic-HXNc7riQ-DrFZxkx3.js";var h=o();
2
- /*!
3
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
4
- */const p=globalThis.crypto;
5
- /*!
6
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
7
- */function y({algorithm:e="sha256"}={}){if("sha256"!==e)throw new Error(`Unsupported algorithm "${e}".`);return{hash:async e=>new Uint8Array(await p.subtle.digest("SHA-256",e))}}
8
- /*!
9
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
10
- */const g=new TextEncoder;function w(e){return g.encode(e)}
11
- /*!
12
- * Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
13
- */async function m({document:e,labelMapFactoryFunction:t,options:r}={}){const{nquads:n}=await async function({document:e,nquads:t,labelMapFactoryFunction:r,options:n}={}){let o,i=new Map;o=e?await b(e,{...n,canonicalIdMap:i}):await b(t.join(""),{...n,inputFormat:"application/n-quads",canonicalIdMap:i});i=function(e){let t=!1,r=!1,n=!1;const o=new Map;for(const[i,a]of e){if(!t&&(t=!0,r=i.startsWith("_:"),n=a.startsWith("_:"),!r&&!n))return e;o.set(r?i.slice(2):i,n?a.slice(2):a)}return o}(i);const a=await r({canonicalIdMap:i}),s=new Map;for(const[e,t]of a)s.set(i.get(e),t);const u=(e,t,r)=>"_:"+s.get(r);return{nquads:o.split("\n").slice(0,-1).map((e=>e.replace(/(_:([^\s]+))/g,u)+"\n")).sort(),labelMap:a}}
14
- /*!
15
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
16
- */({document:e,labelMapFactoryFunction:t,options:r});return n}async function b(e,t){if(!t||"object"!=typeof t)throw new TypeError('"options" must be an object.');if(t={algorithm:"RDFC-1.0",format:"application/n-quads",base:null,safe:!0,...t},"string"!=typeof e){const r={rdfDirection:"i18n-datatype",...t,produceGeneralizedRdf:!1};delete r.format,e=await i.toRDF(e,r)}return h.canonize(e,t)}async function v({document:e,proof:t,options:r,hasher:n}={}){n||(n=y());const o=await async function({document:e,proof:t,options:r}={}){return delete(t={"@context":e["@context"],...t}).proofValue,b(t,r)}({document:e,proof:t,options:r});return n.hash(w(o))}const E=["string","number","bigint","symbol"],A=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function M(e){if(null===e)return"null";if(void 0===e)return"undefined";if(!0===e||!1===e)return"boolean";const t=typeof e;if(E.includes(t))return t;if("function"===t)return"Function";if(Array.isArray(e))return"Array";if(function(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}(e))return"Buffer";const r=function(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(A.includes(t))return t;return}(e);return r||"Object"}class S{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}}S.uint=new S(0,"uint",!0),S.negint=new S(1,"negint",!0),S.bytes=new S(2,"bytes",!0),S.string=new S(3,"string",!0),S.array=new S(4,"array",!1),S.map=new S(5,"map",!1),S.tag=new S(6,"tag",!1),S.float=new S(7,"float",!0),S.false=new S(7,"false",!0),S.true=new S(7,"true",!0),S.null=new S(7,"null",!0),S.undefined=new S(7,"undefined",!0),S.break=new S(7,"break",!0);class ${constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}const T=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&"function"==typeof globalThis.Buffer.isBuffer,V=new TextDecoder,k=new TextEncoder;function x(e){return T&&globalThis.Buffer.isBuffer(e)}const I=T?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):P(e,t,r):(e,t,r)=>r-t>64?V.decode(e.subarray(t,r)):P(e,t,r),j=T?e=>e.length>64?globalThis.Buffer.from(e):D(e):e=>e.length>64?k.encode(e):D(e),U=T?(e,t,r)=>x(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r);function D(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=63&o|128):55296==(64512&o)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=63&o|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=63&o|128)}return t}function P(e,t,r){const n=[];for(;t<r;){const o=e[t];let i=null,a=o>239?4:o>223?3:o>191?2:1;if(t+a<=r){let r,n,s,u;switch(a){case 1:o<128&&(i=o);break;case 2:r=e[t+1],128==(192&r)&&(u=(31&o)<<6|63&r,u>127&&(i=u));break;case 3:r=e[t+1],n=e[t+2],128==(192&r)&&128==(192&n)&&(u=(15&o)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=e[t+1],n=e[t+2],s=e[t+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&o)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),t+=a}return function(e){const t=e.length;if(t<=B)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=B));return r}(n)}const B=4096;const N="CBOR decode error:",L="CBOR encode error:";function C(e,t,r){if(e.length-t<r)throw new Error(`${N} not enough data for type`)}const K=[24,256,65536,4294967296,BigInt("18446744073709551616")];function _(e,t,r){C(e,t,1);const n=e[t];if(!0===r.strict&&n<K[0])throw new Error(`${N} integer encoded in more bytes than necessary (strict decode)`);return n}function F(e,t,r){C(e,t,2);const n=e[t]<<8|e[t+1];if(!0===r.strict&&n<K[1])throw new Error(`${N} integer encoded in more bytes than necessary (strict decode)`);return n}function z(e,t,r){C(e,t,4);const n=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(!0===r.strict&&n<K[2])throw new Error(`${N} integer encoded in more bytes than necessary (strict decode)`);return n}function q(e,t,r){C(e,t,8);const n=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=16777216*e[t+4]+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],i=(BigInt(n)<<BigInt(32))+BigInt(o);if(!0===r.strict&&i<K[3])throw new Error(`${N} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(!0===r.allowBigInt)return i;throw new Error(`${N} integers outside of the safe integer range are not supported`)}function H(e,t){return O(e,0,t.value)}function O(e,t,r){if(r<K[0]){const n=Number(r);e.push([t|n])}else if(r<K[1]){const n=Number(r);e.push([24|t,n])}else if(r<K[2]){const n=Number(r);e.push([25|t,n>>>8,255&n])}else if(r<K[3]){const n=Number(r);e.push([26|t,n>>>24&255,n>>>16&255,n>>>8&255,255&n])}else{const n=BigInt(r);if(!(n<K[4]))throw new Error(`${N} encountered BigInt larger than allowable range`);{const r=[27|t,0,0,0,0,0,0,0];let o=Number(n&BigInt(4294967295)),i=Number(n>>BigInt(32)&BigInt(4294967295));r[8]=255&o,o>>=8,r[7]=255&o,o>>=8,r[6]=255&o,o>>=8,r[5]=255&o,r[4]=255&i,i>>=8,r[3]=255&i,i>>=8,r[2]=255&i,i>>=8,r[1]=255&i,e.push(r)}}}H.encodedSize=function(e){return O.encodedSize(e.value)},O.encodedSize=function(e){return e<K[0]?1:e<K[1]?2:e<K[2]?3:e<K[3]?5:9},H.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};const R=BigInt(-1),G=BigInt(1);function J(e,t){const r=t.value,n="bigint"==typeof r?r*R-G:-1*r-1;O(e,t.type.majorEncoded,n)}function W(e,t,r,n){C(e,t,r+n);const o=U(e,t+r,t+r+n);return new $(S.bytes,o,r+n)}function X(e,t,r,n){return W(e,t,1,r)}function Z(e){return void 0===e.encodedBytes&&(e.encodedBytes=e.type===S.string?j(e.value):e.value),e.encodedBytes}function Q(e,t){const r=Z(t);O(e,t.type.majorEncoded,r.length),e.push(r)}function Y(e,t,r,n,o){const i=r+n;C(e,t,i);const a=new $(S.string,I(e,t+r,t+i),i);return!0===o.retainStringBytes&&(a.byteValue=U(e,t+r,t+i)),a}function ee(e,t,r,n){return Y(e,t,1,r,n)}J.encodedSize=function(e){const t=e.value,r="bigint"==typeof t?t*R-G:-1*t-1;return r<K[0]?1:r<K[1]?2:r<K[2]?3:r<K[3]?5:9},J.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0},Q.encodedSize=function(e){const t=Z(e);return O.encodedSize(t.length)+t.length},Q.compareTokens=function(e,t){return r=Z(e),n=Z(t),r.length<n.length?-1:r.length>n.length?1:function(e,t){if(x(e)&&x(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}(r,n);var r,n};const te=Q;function re(e,t,r,n){return new $(S.array,n,r)}function ne(e,t,r,n){return re(0,0,1,r)}function oe(e,t){O(e,S.array.majorEncoded,t.value)}function ie(e,t,r,n){return new $(S.map,n,r)}function ae(e,t,r,n){return ie(0,0,1,r)}function se(e,t){O(e,S.map.majorEncoded,t.value)}function ue(e,t,r,n){return new $(S.tag,r,1)}function ce(e,t){O(e,S.tag.majorEncoded,t.value)}oe.compareTokens=H.compareTokens,oe.encodedSize=function(e){return O.encodedSize(e.value)},se.compareTokens=H.compareTokens,se.encodedSize=function(e){return O.encodedSize(e.value)},ce.compareTokens=H.compareTokens,ce.encodedSize=function(e){return O.encodedSize(e.value)};function fe(e,t,r){if(r){if(!1===r.allowNaN&&Number.isNaN(e))throw new Error(`${N} NaN values are not supported`);if(!1===r.allowInfinity&&(e===1/0||e===-1/0))throw new Error(`${N} Infinity values are not supported`)}return new $(S.float,e,t)}function de(e,t,r){const n=t.value;if(!1===n)e.push([20|S.float.majorEncoded]);else if(!0===n)e.push([21|S.float.majorEncoded]);else if(null===n)e.push([22|S.float.majorEncoded]);else if(void 0===n)e.push([23|S.float.majorEncoded]);else{let t,i=!1;r&&!0===r.float64||(ye(n),t=ge(pe,1),n===t||Number.isNaN(n)?(pe[0]=249,e.push(pe.slice(0,3)),i=!0):(we(n),t=me(pe,1),n===t&&(pe[0]=250,e.push(pe.slice(0,5)),i=!0))),i||(o=n,he.setFloat64(0,o,!1),t=be(pe,1),pe[0]=251,e.push(pe.slice(0,9)))}var o}de.encodedSize=function(e,t){const r=e.value;if(!1===r||!0===r||null==r)return 1;if(!t||!0!==t.float64){ye(r);let e=ge(pe,1);if(r===e||Number.isNaN(r))return 3;if(we(r),e=me(pe,1),r===e)return 5}return 9};const le=new ArrayBuffer(9),he=new DataView(le,1),pe=new Uint8Array(le,0);function ye(e){if(e===1/0)he.setUint16(0,31744,!1);else if(e===-1/0)he.setUint16(0,64512,!1);else if(Number.isNaN(e))he.setUint16(0,32256,!1);else{he.setFloat32(0,e);const t=he.getUint32(0),r=(2139095040&t)>>23,n=8388607&t;if(255===r)he.setUint16(0,31744,!1);else if(0===r)he.setUint16(0,(2147483648&e)>>16|n>>13,!1);else{const e=r-127;e<-24?he.setUint16(0,0):e<-14?he.setUint16(0,(2147483648&t)>>16|1<<24+e,!1):he.setUint16(0,(2147483648&t)>>16|e+15<<10|n>>13,!1)}}}function ge(e,t){if(e.length-t<2)throw new Error(`${N} not enough data for float16`);const r=(e[t]<<8)+e[t+1];if(31744===r)return 1/0;if(64512===r)return-1/0;if(32256===r)return NaN;const n=r>>10&31,o=1023&r;let i;return i=0===n?o*2**-24:31!==n?(o+1024)*2**(n-25):0===o?1/0:NaN,32768&r?-i:i}function we(e){he.setFloat32(0,e,!1)}function me(e,t){if(e.length-t<4)throw new Error(`${N} not enough data for float32`);const r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function be(e,t){if(e.length-t<8)throw new Error(`${N} not enough data for float64`);const r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}function ve(e,t,r){throw new Error(`${N} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ee(e){return()=>{throw new Error(`${N} ${e}`)}}de.compareTokens=H.compareTokens;const Ae=[];for(let e=0;e<=23;e++)Ae[e]=ve;Ae[24]=function(e,t,r,n){return new $(S.uint,_(e,t+1,n),2)},Ae[25]=function(e,t,r,n){return new $(S.uint,F(e,t+1,n),3)},Ae[26]=function(e,t,r,n){return new $(S.uint,z(e,t+1,n),5)},Ae[27]=function(e,t,r,n){return new $(S.uint,q(e,t+1,n),9)},Ae[28]=ve,Ae[29]=ve,Ae[30]=ve,Ae[31]=ve;for(let e=32;e<=55;e++)Ae[e]=ve;Ae[56]=function(e,t,r,n){return new $(S.negint,-1-_(e,t+1,n),2)},Ae[57]=function(e,t,r,n){return new $(S.negint,-1-F(e,t+1,n),3)},Ae[58]=function(e,t,r,n){return new $(S.negint,-1-z(e,t+1,n),5)},Ae[59]=function(e,t,r,n){const o=q(e,t+1,n);if("bigint"!=typeof o){const e=-1-o;if(e>=Number.MIN_SAFE_INTEGER)return new $(S.negint,e,9)}if(!0!==n.allowBigInt)throw new Error(`${N} integers outside of the safe integer range are not supported`);return new $(S.negint,R-BigInt(o),9)},Ae[60]=ve,Ae[61]=ve,Ae[62]=ve,Ae[63]=ve;for(let e=64;e<=87;e++)Ae[e]=X;Ae[88]=function(e,t,r,n){return W(e,t,2,_(e,t+1,n))},Ae[89]=function(e,t,r,n){return W(e,t,3,F(e,t+1,n))},Ae[90]=function(e,t,r,n){return W(e,t,5,z(e,t+1,n))},Ae[91]=function(e,t,r,n){const o=q(e,t+1,n);if("bigint"==typeof o)throw new Error(`${N} 64-bit integer bytes lengths not supported`);return W(e,t,9,o)},Ae[92]=ve,Ae[93]=ve,Ae[94]=ve,Ae[95]=Ee("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)Ae[e]=ee;Ae[120]=function(e,t,r,n){return Y(e,t,2,_(e,t+1,n),n)},Ae[121]=function(e,t,r,n){return Y(e,t,3,F(e,t+1,n),n)},Ae[122]=function(e,t,r,n){return Y(e,t,5,z(e,t+1,n),n)},Ae[123]=function(e,t,r,n){const o=q(e,t+1,n);if("bigint"==typeof o)throw new Error(`${N} 64-bit integer string lengths not supported`);return Y(e,t,9,o,n)},Ae[124]=ve,Ae[125]=ve,Ae[126]=ve,Ae[127]=Ee("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)Ae[e]=ne;Ae[152]=function(e,t,r,n){return re(0,0,2,_(e,t+1,n))},Ae[153]=function(e,t,r,n){return re(0,0,3,F(e,t+1,n))},Ae[154]=function(e,t,r,n){return re(0,0,5,z(e,t+1,n))},Ae[155]=function(e,t,r,n){const o=q(e,t+1,n);if("bigint"==typeof o)throw new Error(`${N} 64-bit integer array lengths not supported`);return re(0,0,9,o)},Ae[156]=ve,Ae[157]=ve,Ae[158]=ve,Ae[159]=function(e,t,r,n){if(!1===n.allowIndefinite)throw new Error(`${N} indefinite length items not allowed`);return re(0,0,1,1/0)};for(let e=160;e<=183;e++)Ae[e]=ae;Ae[184]=function(e,t,r,n){return ie(0,0,2,_(e,t+1,n))},Ae[185]=function(e,t,r,n){return ie(0,0,3,F(e,t+1,n))},Ae[186]=function(e,t,r,n){return ie(0,0,5,z(e,t+1,n))},Ae[187]=function(e,t,r,n){const o=q(e,t+1,n);if("bigint"==typeof o)throw new Error(`${N} 64-bit integer map lengths not supported`);return ie(0,0,9,o)},Ae[188]=ve,Ae[189]=ve,Ae[190]=ve,Ae[191]=function(e,t,r,n){if(!1===n.allowIndefinite)throw new Error(`${N} indefinite length items not allowed`);return ie(0,0,1,1/0)};for(let e=192;e<=215;e++)Ae[e]=ue;Ae[216]=function(e,t,r,n){return new $(S.tag,_(e,t+1,n),2)},Ae[217]=function(e,t,r,n){return new $(S.tag,F(e,t+1,n),3)},Ae[218]=function(e,t,r,n){return new $(S.tag,z(e,t+1,n),5)},Ae[219]=function(e,t,r,n){return new $(S.tag,q(e,t+1,n),9)},Ae[220]=ve,Ae[221]=ve,Ae[222]=ve,Ae[223]=ve;for(let e=224;e<=243;e++)Ae[e]=Ee("simple values are not supported");Ae[244]=ve,Ae[245]=ve,Ae[246]=ve,Ae[247]=function(e,t,r,n){if(!1===n.allowUndefined)throw new Error(`${N} undefined values are not supported`);return!0===n.coerceUndefinedToNull?new $(S.null,null,1):new $(S.undefined,void 0,1)},Ae[248]=Ee("simple values are not supported"),Ae[249]=function(e,t,r,n){return fe(ge(e,t+1),3,n)},Ae[250]=function(e,t,r,n){return fe(me(e,t+1),5,n)},Ae[251]=function(e,t,r,n){return fe(be(e,t+1),9,n)},Ae[252]=ve,Ae[253]=ve,Ae[254]=ve,Ae[255]=function(e,t,r,n){if(!1===n.allowIndefinite)throw new Error(`${N} indefinite length items not allowed`);return new $(S.break,void 0,1)};const Me=[];for(let e=0;e<24;e++)Me[e]=new $(S.uint,e,1);for(let e=-1;e>=-24;e--)Me[31-e]=new $(S.negint,e,1);Me[64]=new $(S.bytes,new Uint8Array(0),1),Me[96]=new $(S.string,"",1),Me[128]=new $(S.array,0,1),Me[160]=new $(S.map,0,1),Me[244]=new $(S.false,!1,1),Me[245]=new $(S.true,!0,1),Me[246]=new $(S.null,null,1),function(){const e=[];e[S.uint.major]=H,e[S.negint.major]=J,e[S.bytes.major]=Q,e[S.string.major]=te,e[S.array.major]=oe,e[S.map.major]=se,e[S.tag.major]=ce,e[S.float.major]=de}();class Se{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do{if(t.obj===e)return!0}while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${L} object contains circular references`);return new Se(t,e)}}const $e={null:new $(S.null,null),undefined:new $(S.undefined,void 0),true:new $(S.true,!0),false:new $(S.false,!1),emptyArray:new $(S.array,0),emptyMap:new $(S.map,0)},Te={number:(e,t,r,n)=>Number.isInteger(e)&&Number.isSafeInteger(e)?new $(e>=0?S.uint:S.negint,e):new $(S.float,e),bigint:(e,t,r,n)=>e>=BigInt(0)?new $(S.uint,e):new $(S.negint,e),Uint8Array:(e,t,r,n)=>new $(S.bytes,e),string:(e,t,r,n)=>new $(S.string,e),boolean:(e,t,r,n)=>e?$e.true:$e.false,null:(e,t,r,n)=>$e.null,undefined:(e,t,r,n)=>$e.undefined,ArrayBuffer:(e,t,r,n)=>new $(S.bytes,new Uint8Array(e)),DataView:(e,t,r,n)=>new $(S.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),Array(e,t,r,n){if(!e.length)return!0===r.addBreakTokens?[$e.emptyArray,new $(S.break)]:$e.emptyArray;n=Se.createCheck(n,e);const o=[];let i=0;for(const t of e)o[i++]=Ve(t,r,n);return r.addBreakTokens?[new $(S.array,e.length),o,new $(S.break)]:[new $(S.array,e.length),o]},Object(e,t,r,n){const o="Object"!==t,i=o?e.keys():Object.keys(e),a=o?e.size:i.length;if(!a)return!0===r.addBreakTokens?[$e.emptyMap,new $(S.break)]:$e.emptyMap;n=Se.createCheck(n,e);const s=[];let u=0;for(const t of i)s[u++]=[Ve(t,r,n),Ve(o?e.get(t):e[t],r,n)];return function(e,t){t.mapSorter&&e.sort(t.mapSorter)}(s,r),r.addBreakTokens?[new $(S.map,a),s,new $(S.break)]:[new $(S.map,a),s]}};Te.Map=Te.Object,Te.Buffer=Te.Uint8Array;for(const e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Te[`${e}Array`]=Te.DataView;function Ve(e,t={},r){const n=M(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||Te[n];if("function"==typeof o){const i=o(e,n,t,r);if(null!=i)return i}const i=Te[n];if(!i)throw new Error(`${L} unsupported type: ${n}`);return i(e,n,t,r)}const ke={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0};class xe{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){const e=this.data[this._pos];let t=Me[e];if(void 0===t){const r=Ae[e];if(!r)throw new Error(`${N} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);const n=31&e;t=r(this.data,this._pos,n,this.options)}return this._pos+=t.encodedLength,t}}const Ie=Symbol.for("DONE"),je=Symbol.for("BREAK");function Ue(e,t){if(e.done())return Ie;const r=e.next();if(r.type===S.break)return je;if(r.type.terminal)return r.value;if(r.type===S.array)return function(e,t,r){const n=[];for(let o=0;o<e.value;o++){const i=Ue(t,r);if(i===je){if(e.value===1/0)break;throw new Error(`${N} got unexpected break to lengthed array`)}if(i===Ie)throw new Error(`${N} found array but not enough entries (got ${o}, expected ${e.value})`);n[o]=i}return n}(r,e,t);if(r.type===S.map)return function(e,t,r){const n=!0===r.useMaps,o=n?void 0:{},i=n?new Map:void 0;for(let a=0;a<e.value;a++){const s=Ue(t,r);if(s===je){if(e.value===1/0)break;throw new Error(`${N} got unexpected break to lengthed map`)}if(s===Ie)throw new Error(`${N} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(!0!==n&&"string"!=typeof s)throw new Error(`${N} non-string keys not supported (got ${typeof s})`);if(!0===r.rejectDuplicateMapKeys&&(n&&i.has(s)||!n&&s in o))throw new Error(`${N} found repeat map key "${s}"`);const u=Ue(t,r);if(u===Ie)throw new Error(`${N} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?i.set(s,u):o[s]=u}return n?i:o}(r,e,t);if(r.type===S.tag){if(t.tags&&"function"==typeof t.tags[r.value]){const n=Ue(e,t);return t.tags[r.value](n)}throw new Error(`${N} tag not supported (${r.value})`)}throw new Error("unsupported")}function De(e,t){const[r,n]=function(e,t){if(!(e instanceof Uint8Array))throw new Error(`${N} data to decode must be a Uint8Array`);const r=(t=Object.assign({},ke,t)).tokenizer||new xe(e,t),n=Ue(r,t);if(n===Ie)throw new Error(`${N} did not find any content to decode`);if(n===je)throw new Error(`${N} got unexpected break`);return[n,e.subarray(r.pos())]}(e,t);if(n.length>0)throw new Error(`${N} too many terminals, data makes no sense`);return r}
17
- /*!
18
- * Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
19
- */const Pe=new Uint8Array([217,93,1]),Be=[];function Ne({proof:e}={}){try{if("string"!=typeof e?.proofValue)throw new TypeError('"proof.proofValue" must be a string.');if("u"!==e.proofValue[0])throw new Error("Only base64url multibase encoding is supported.");const t=a(e.proofValue.slice(1));if(!function(e,t){for(let r=0;r<t.length;++r)if(e[r]!==t[r])return!1;return!0}(t,Pe))throw new TypeError('"proof.proofValue" must be a derived proof.');const r=t.subarray(Pe.length),[n,o,i,u,c]=De(r,{useMaps:!0,tags:Be}),f=function(e){const t=new Map;for(const[r,n]of e.entries())t.set(`c14n${r}`,`u${s(n)}`);return t}(u),d={baseSignature:n,publicKey:o,signatures:i,labelMap:f,mandatoryIndexes:c};return function({baseSignature:e,publicKey:t,signatures:r,labelMap:n,mandatoryIndexes:o}){if(!(e instanceof Uint8Array&&64===e.length))throw new TypeError('"baseSignature" must be a Uint8Array of length 64.');if(!(t instanceof Uint8Array&&35===t.length))throw new TypeError('"publicKey" must be a Uint8Array of length 35.');if(!Array.isArray(r)||!r.every((e=>e instanceof Uint8Array)))throw new TypeError('"signatures" must be an array of Uint8Arrays.');if(!(n instanceof Map&&[...n.entries()].every((([e,t])=>"string"==typeof e&&"string"==typeof t))))throw new TypeError('"labelMap" must be a Map of strings to strings.');if(!Array.isArray(o)||!o.every(Number.isInteger))throw new TypeError('"mandatoryIndexes" must be an array of integers.')}(d),d}catch(e){const t=new TypeError('The proof does not include a valid "proofValue" property.');throw t.cause=e,t}}function Le({proofHash:e,publicKey:t,mandatoryHash:r}={}){!function({proofHash:e,publicKey:t,mandatoryHash:r}){if(!(e instanceof Uint8Array&&32===e.length))throw new TypeError('"proofHash" must be a Uint8Array of length 32.');if(!(t instanceof Uint8Array&&35===t.length))throw new TypeError('"publicKey" must be a Uint8Array of length 35.');if(!(r instanceof Uint8Array&&32===r.length))throw new TypeError('"mandatoryHash" must be a Uint8Array of length 32.')}({proofHash:e,publicKey:t,mandatoryHash:r});return function(e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;for(const n of e)t.set(n,r),r+=n.length;return t}([e,t,r])}Be[64]=function(e){return e}
20
- /*!
21
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
22
- */;const Ce="ecdsa-sd-2023";
23
- /*!
24
- * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
25
- */
26
- /*!
27
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
28
- */
29
- function Ke({requiredAlgorithm:e="P-256"}={}){return{name:Ce,requiredAlgorithm:e,createVerifier:_e,createVerifyData:Fe}}async function _e({verificationMethod:e}){const t=(await u(e)).verifier();return{algorithm:t.algorithm,id:t.id,verify:async({data:e})=>async function({verifier:e,data:t}={}){const{baseSignature:r,proofHash:n,publicKey:o,signatures:i,nonMandatory:a,mandatoryHash:s}=t,f="z"+c(o),d=await u({publicKeyMultibase:f});if(i.length!==a.length)throw new Error(`Signature count (${i.length}) does not match non-mandatory message count (${a.length}).`);const{verify:l}=d.verifier();if((await Promise.all(i.map(((e,t)=>l({data:w(a[t]),signature:e}))))).some((e=>!e)))return!1;const h=await Le({proofHash:n,publicKey:o,mandatoryHash:s});return e.verify({data:h,signature:r})}
30
- /*!
31
- * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
32
- */({verifier:t,data:e})}}async function Fe({cryptosuite:e,document:t,proof:r,documentLoader:n}){if(e?.name!==Ce)throw new TypeError(`"cryptosuite.name" must be "${Ce}".`);const o={documentLoader:n},i=v({document:t,proof:r,options:o}).catch((e=>e)),{baseSignature:a,publicKey:s,signatures:u,labelMap:c,mandatoryIndexes:f}=await Ne({proof:r}),d=await function({labelMap:e}={}){return async({canonicalIdMap:t})=>{const r=new Map;for(const[n,o]of t)r.set(n,e.get(o));return r}}({labelMap:c}),l=await m({document:t,labelMapFactoryFunction:d,options:o}),h=[],p=[];for(const[e,t]of l.entries())f.includes(e)?h.push(t):p.push(t);const{mandatoryHash:g}=await async function({mandatory:e,hasher:t}={}){return t||(t=y()),{mandatoryHash:await t.hash(w(e.join("")))}}({mandatory:h}),b=await i;if(b instanceof Error)throw b;return{baseSignature:a,proofHash:b,publicKey:s,signatures:u,nonMandatory:p,mandatoryHash:g}}const ze=new RegExp("-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](.[0-9]+)?|(24:00:00(.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"),qe=e=>ze.test(e),He=self&&(self.crypto||self.msCrypto);async function Oe({string:e}){const t=(new TextEncoder).encode(e);return new Uint8Array(await He.subtle.digest("SHA-256",t))}
33
- /*!
34
- * Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
35
- */const{suites:{LinkedDataProof:Re}}=n;class Ge extends Re{constructor({signer:e,date:t,cryptosuite:r,legacyContext:n=!1}={}){super({type:"DataIntegrityProof"});const{canonize:o,createVerifier:i,name:a,requiredAlgorithm:s,derive:u,createProofValue:c,createVerifyData:f}=r;if(!i||"function"!=typeof i)throw new TypeError('"cryptosuite.createVerifier" must be a function.');if(u&&"function"!=typeof u)throw new TypeError('"cryptosuite.derive" must be a function.');if(c&&"function"!=typeof c)throw new TypeError('"cryptosuite.createProofValue" must be a function.');if(f&&"function"!=typeof f)throw new TypeError('"cryptosuite.createVerifyData" must be a function.');if(this.contextUrl="https://w3id.org/security/data-integrity/v2",n&&(this.contextUrl="https://w3id.org/security/data-integrity/v1"),this.canonize=o,this.createVerifier=i,this.cryptosuite=a,this._cryptosuite=r,this.requiredAlgorithm=s,t){if(this.date=new Date(t),isNaN(this.date))throw TypeError(`"date" "${t}" is not a valid date.`)}else null===t&&(this.date=null);const d=function({signer:e,requiredAlgorithm:t}){const r={verificationMethod:void 0,signer:void 0};if(!e)return r;if("function"!=typeof e.sign)throw new TypeError("A signer API has not been specified.");const n=Array.isArray(t)?t.includes(e.algorithm):t===e.algorithm;if(!n){const r=Array.isArray(t)?t.join(", "):t,n=Array.isArray(t)?`is not a supported algorithm for the cryptosuite. The supported algorithms are: "${r}".`:`does not match the required algorithm for the cryptosuite "${r}".`,o=`The signer's algorithm "${e.algorithm}" ${n}`;throw new Error(o)}return r.signer=e,r.verificationMethod=e.id,r}({signer:e,requiredAlgorithm:s});this.verificationMethod=d.verificationMethod,this.signer=d.signer}async sign({verifyData:e,proof:t}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");const r=await this.signer.sign({data:e});return t.proofValue="z"+c(r),t}async verifySignature({verifyData:e,verificationMethod:t,proof:r}){const n=await this.createVerifier({verificationMethod:t});if(!(Array.isArray(this.requiredAlgorithm)?this.requiredAlgorithm.includes(n.algorithm):this.requiredAlgorithm===n.algorithm)){const e=Array.isArray(this.requiredAlgorithm)?this.requiredAlgorithm.join(", "):this.requiredAlgorithm,t=Array.isArray(this.requiredAlgorithm)?`is not a supported algorithm for the cryptosuite. The supported algorithms are: "${e}".`:`does not match the required algorithm for the cryptosuite "${e}".`,r=`The verifier's algorithm "${n.algorithm}" ${t}`;throw new Error(r)}const{proofValue:o}=r;if(!o||"string"!=typeof o)throw new TypeError('The proof does not include a valid "proofValue" property.');const i=o[0];let s;if("z"===i)s=f(o.slice(1));else{if("u"!==i)throw new Error("Only base58btc or base64url multibase encoding is supported.");s=a(o.slice(1))}return n.verify({data:e,signature:s})}async createProof({document:e,purpose:t,proofSet:r,documentLoader:n}){let o;o=this.proof?{...this.proof}:{},o.type=this.type;let i,a=this.date;return void 0===o.created&&void 0===a&&(a=new Date),a&&"string"!=typeof a&&(a=(e=>(null==e?e=new Date:"number"!=typeof e&&"string"!=typeof e||(e=new Date(e)),e.toISOString().slice(0,-5)+"Z"))(a)),a&&(o.created=a),o.verificationMethod=this.verificationMethod,o.cryptosuite=this.cryptosuite,o=await this.updateProof({document:e,proof:o,purpose:t,proofSet:r,documentLoader:n}),o=await t.update(o,{document:e,suite:this,documentLoader:n}),i=this._cryptosuite.createVerifyData?await this._cryptosuite.createVerifyData({cryptosuite:this._cryptosuite,document:e,proof:o,proofSet:r,documentLoader:n,dataIntegrityProof:this}):await this.createVerifyData({document:e,proof:o,proofSet:r,documentLoader:n}),this._cryptosuite.createProofValue?o.proofValue=await this._cryptosuite.createProofValue({cryptosuite:this._cryptosuite,verifyData:i,document:e,proof:o,proofSet:r,documentLoader:n,dataIntegrityProof:this}):o=await this.sign({verifyData:i,document:e,proof:o,proofSet:r,documentLoader:n}),o}async derive({document:e,purpose:t,proofSet:r,documentLoader:n}){if(!this._cryptosuite.derive)throw new Error('"cryptosuite.derive" not provided.');return this._cryptosuite.derive({cryptosuite:this._cryptosuite,document:e,purpose:t,proofSet:r,documentLoader:n,dataIntegrityProof:this})}async updateProof({proof:e}){return e}async verifyProof({proof:e,proofSet:t,document:r,documentLoader:n}){try{const o=await this.getVerificationMethod({proof:e,documentLoader:n});let i;i=this._cryptosuite.createVerifyData?await this._cryptosuite.createVerifyData({cryptosuite:this._cryptosuite,document:r,proof:e,proofSet:t,documentLoader:n,dataIntegrityProof:this,verificationMethod:o}):await this.createVerifyData({document:r,proof:e,proofSet:t,documentLoader:n,verificationMethod:o});if(!await this.verifySignature({verifyData:i,verificationMethod:o,proof:e}))throw new Error("Invalid signature.");if(void 0!==e.created&&!qe(e.created))throw new Error(`"proof.created" ("${e.created}") must be an XSD dateTimeStamp.`);if(void 0!==e.expires&&!qe(e.expires))throw new Error(`"proof.expires" ("${e.expires}") must be an XSD dateTimeStamp.`);return{verified:!0,verificationMethod:o}}catch(e){return{verified:!1,error:e}}}async createVerifyData({document:e,proof:t,documentLoader:r}){let n;const{_hashCache:o}=this;o&&o.document===e?n=o.hash:this._hashCache={document:e,hash:n=this.canonize(e,{documentLoader:r,base:null,safe:!0}).then((e=>Oe({string:e})))};const[i,a]=await Promise.all([this.canonizeProof(t,{document:e,documentLoader:r}).then((e=>Oe({string:e}))),n]);return((e,t)=>{const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r})(i,a)}async getVerificationMethod({proof:e,documentLoader:t}){let{verificationMethod:r}=e;if("object"==typeof r&&(r=r.id),!r)throw new Error('No "verificationMethod" found in proof.');const n=await t(r);if(!n)throw new Error(`Unable to load verification method "${r}".`);const{document:o}=n;return r="string"==typeof o?JSON.parse(o):o,r}async canonizeProof(e,{documentLoader:t,document:r}){return e={"@context":r["@context"],...e},this.ensureSuiteContext({document:e,addSuiteContext:!0}),delete e.proofValue,this.canonize(e,{documentLoader:t,safe:!0,base:null,skipExpansion:!1})}async matchProof({proof:e}){const{type:t,cryptosuite:r}=e;return t===this.type&&r===this.cryptosuite}ensureSuiteContext({document:e,addSuiteContext:t}){const{contextUrl:r}=this;if(Je({document:e,contextUrl:r})||Je({document:e,contextUrl:"https://www.w3.org/ns/credentials/v2"}))return;if(!t)throw new TypeError(`The document to be signed must contain this suite's @context, "${r}".`);const n=e["@context"]||[];e["@context"]=Array.isArray(n)?[...n,r]:[n,r]}}function Je({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}const{purposes:{AssertionProofPurpose:We,AuthenticationProofPurpose:Xe}}=n;var Ze;!function(e){e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.ensureVerificationMethodValidity="ensureVerificationMethodValidity",e.checkDocumentSignature="checkDocumentSignature"}(Ze||(Ze={}));class Qe extends d{verificationProcess=[Ze.retrieveVerificationMethodPublicKey,Ze.ensureVerificationMethodValidity,Ze.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSd2023";cryptosuite="ecdsa-sd-2023";publicKey;verificationKey;verificationMethod;proofPurpose;challenge;domain;proofPurposeMap;constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.issuer=e.issuer,this.proof=e.proof,this.proofPurpose=e.proofPurpose??"assertionMethod",this.challenge=e.proofChallenge??"",this.domain=e.proofDomain,this.proofPurposeMap={authentication:Xe,assertionMethod:We},this.validateProofType()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map((r=>e.verifier.convertToVerificationSubsteps(t,r)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return this.publicKey}getIssuerName(){return this.issuer.name??""}getIssuerProfileDomain(){try{return new URL(this.getIssuerProfileUrl()).hostname??""}catch(e){return""}}getIssuerProfileUrl(){return this.issuer.id??""}getSigningDate(){return this.proof.created}async executeStep(e,t,r){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}validateProofType(){const e=this.proof.type;if("DataIntegrityProof"!==e){if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}else{const e=this.proof.cryptosuite;if(!e)throw new Error(`Malformed proof passed. With DataIntegrityProof a cryptosuite must be defined. Expected: ${this.cryptosuite}`);if(e!==this.cryptosuite)throw new Error(`Incompatible proof cryptosuite passed. Expected: ${this.cryptosuite}, Got: ${e}`)}}generateDocumentLoader(e=[]){e.forEach((e=>{t[e.url]=e.value})),t[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(e){return e in t?{contextUrl:null,document:t[e],documentUrl:e}:i.documentLoader(e)}}getErrorMessage(e){return e.error.errors[0].message}getTargetVerificationMethodContainer(){if(this.issuer.didDocument){if(this.findVerificationMethod(this.issuer.didDocument.verificationMethod,this.issuer.didDocument.id))return this.issuer.didDocument}const e={...this.issuer};return delete e.didDocument,e}findVerificationMethod(e,t){return e.find((e=>e.id===this.proof.verificationMethod||t+e.id===this.proof.verificationMethod))??null}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(Ze.retrieveVerificationMethodPublicKey,(async()=>{if(this.verificationMethod=l(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod),!this.verificationMethod)throw new r(Ze.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(this.verificationMethod.revoked)throw new r(Ze.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return this.verificationMethod}),this.type)}async ensureVerificationMethodValidity(){await this.executeStep(Ze.ensureVerificationMethodValidity,(async()=>{if(this.verificationMethod.expires){if(new Date(this.verificationMethod.expires).getTime()<Date.now())throw new r(Ze.ensureVerificationMethodValidity,"The verification key has expired")}if(this.verificationMethod.revoked)throw new r(Ze.ensureVerificationMethodValidity,"The verification key has been revoked")}),this.type)}async checkDocumentSignature(){await this.executeStep(Ze.checkDocumentSignature,(async()=>{const e=new Ge({cryptosuite:Ke({requiredAlgorithm:"K-256"})}),t=this.documentToVerify.proof.verificationMethod;"authentication"!==this.proofPurpose||this.proof.challenge||(this.proof.challenge="");const o=await n.verify(this.documentToVerify,{suite:e,purpose:new this.proofPurposeMap[this.proofPurpose]({controller:this.getTargetVerificationMethodContainer(),challenge:this.challenge,domain:this.domain}),documentLoader:this.generateDocumentLoader([{url:t,value:this.verificationKey}])});if(!o.verified)throw console.error(JSON.stringify(o,null,2)),new r(Ze.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed: ${this.getErrorMessage(o)}`);console.log(`Credential ${this.type} signature successfully verified`)}),this.type)}}export{Qe as default};
@@ -1 +0,0 @@
1
- import{d as t,f as e,e as i,V as r,B as n,g as o,m as s,t as a,u as h,v as u,p as c,w as f}from"./main.js";import{j as l}from"./jsonld-signatures-ZtLxJmqT-B0W14Jb0.js";import{j as d}from"./jsonld-CMQE_cGn-899pOqB6.js";import{k as p,s as y,c as _,e as b,d as g,b as w,r as v,a as m}from"./elliptic-CRAl7yyq-DbLzV4aB.js";import{b as S,a as E}from"./elliptic-HXNc7riQ-DrFZxkx3.js";import{d as k,e as R}from"./index-DZLKRa_V-D_IQzjvG.js";import{S as M}from"./Suite-BmP2Qu19-D1ucdMDB.js";import"./pako.esm-BGRKTPxS-UdHShO7y.js";import"./sha256-CN3v2fAD-C1PUWFZm.js";import"./index-BcfLkJHS-Dgus2xdV.js";import{r as T}from"./retrieveVerificationMethodPublicKey-nmb3CCVx-DA6ovQri.js";var L,x,P,D,B,O,C={exports:{}},I=a(f);function A(){return x?L:(x=1,L=I.EventEmitter)}function K(){if(D)return P;function t(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function e(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(t,e,i){return(e=n(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function r(t,e,i){return e&&function(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,n(r.key),r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:String(e)}D=1;var o=E.Buffer,s=m.inspect,a=s&&s.custom||"inspect";return P=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return r(t,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,i=""+e.data;e=e.next;)i+=t+e.data;return i}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,i,r,n=o.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,i=n,r=a,o.prototype.copy.call(e,i,r),a+=s.data.length,s=s.next;return n}},{key:"consume",value:function(t,e){var i;return t<this.head.data.length?(i=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):i=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,i=1,r=e.data;for(t-=r.length;e=e.next;){var n=e.data,o=t>n.length?n.length:t;if(o===n.length?r+=n:r+=n.slice(0,t),0===(t-=o)){o===n.length?(++i,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++i}return this.length-=i,r}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),i=this.head,r=1;for(i.data.copy(e),t-=i.data.length;i=i.next;){var n=i.data,s=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,s),0===(t-=s)){s===n.length?(++r,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=n.slice(s));break}++r}return this.length-=r,e}},{key:a,value:function(t,i){return s(this,e(e({},i),{},{depth:0,customInspect:!1}))}}]),t}()}function j(){if(O)return B;function t(t,r){i(t,r),e(t)}function e(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}return O=1,B={destroy:function(r,n){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(n?n(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,u(i,this,r)):u(i,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,(function(i){!n&&i?o._writableState?o._writableState.errorEmitted?u(e,o):(o._writableState.errorEmitted=!0,u(t,o,i)):u(t,o,i):n?(u(e,o),n(i)):u(e,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var i=t._readableState,r=t._writableState;i&&i.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}}var N,V,U,q,W,F,H,$,z,G={};function X(){if(N)return G;N=1;var t={};function e(e,i,r){r||(r=Error);var n=function(t){var e,r;function n(e,r,n){return t.call(this,function(t,e,r){return"string"==typeof i?i:i(t,e,r)}(e,r,n))||this}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,n}(r);n.prototype.name=r.name,n.prototype.code=e,t[e]=n}function i(t,e){if(Array.isArray(t)){var i=t.length;return t=t.map((function(t){return String(t)})),i>2?"one of ".concat(e," ").concat(t.slice(0,i-1).join(", "),", or ")+t[i-1]:2===i?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}return e("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),e("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,o,s;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,i){return(void 0===i||i>t.length)&&(i=t.length),t.substring(i-e.length,i)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(i(e,"type"));else{var a=function(t,e,i){return"number"!=typeof i&&(i=0),!(i+e.length>t.length)&&-1!==t.indexOf(e,i)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(a," ").concat(n," ").concat(i(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),G.codes=t,G}function J(){if(U)return V;U=1;var t=X().codes.ERR_INVALID_OPT_VALUE;return V={getHighWaterMark:function(e,i,r,n){var o=function(t,e,i){return null!=t.highWaterMark?t.highWaterMark:e?t[i]:null}(i,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new t(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}}function Y(){if(W)return q;function t(t){try{if(!s.localStorage)return!1}catch(t){return!1}var e=s.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}return W=1,q=function(e,i){if(t("noDeprecation"))return e;var r=!1;return function(){if(!r){if(t("throwDeprecation"))throw new Error(i);t("traceDeprecation")?console.trace(i):console.warn(i),r=!0}return e.apply(this,arguments)}},q}function Q(){if(H)return F;function t(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,i){var r=t.entry;t.entry=null;for(;r;){var n=r.callback;e.pendingcb--,n(i),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}var e;H=1,F=R,R.WritableState=k;var i={deprecate:Y()},r=A(),n=E.Buffer,o=(void 0!==s?s:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,h=j(),c=J().getHighWaterMark,f=X().codes,l=f.ERR_INVALID_ARG_TYPE,d=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_MULTIPLE_CALLBACK,y=f.ERR_STREAM_CANNOT_PIPE,_=f.ERR_STREAM_DESTROYED,b=f.ERR_STREAM_NULL_VALUES,g=f.ERR_STREAM_WRITE_AFTER_END,w=f.ERR_UNKNOWN_ENCODING,v=h.errorOrDestroy;function m(){}function k(i,r,n){e=e||Z(),i=i||{},"boolean"!=typeof n&&(n=r instanceof e),this.objectMode=!!i.objectMode,n&&(this.objectMode=this.objectMode||!!i.writableObjectMode),this.highWaterMark=c(this,i,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===i.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=i.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var i=t._writableState,r=i.sync,n=i.writecb;if("function"!=typeof n)throw new p;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),e)!function(t,e,i,r,n){--e.pendingcb,i?(u(n,r),u(D,t,e),t._writableState.errorEmitted=!0,v(t,r)):(n(r),t._writableState.errorEmitted=!0,v(t,r),D(t,e))}(t,i,r,e,n);else{var o=x(i)||t.destroyed;o||i.corked||i.bufferProcessing||!i.bufferedRequest||L(t,i),r?u(T,t,i,o,n):T(t,i,o,n)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==i.emitClose,this.autoDestroy=!!i.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function R(t){var i=this instanceof(e=e||Z());if(!i&&!a.call(R,this))return new R(t);this._writableState=new k(t,this,i),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),r.call(this)}function M(t,e,i,r,n,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new _("write")):i?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function T(t,e,i,r){i||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),D(t,e)}function L(e,i){i.bufferProcessing=!0;var r=i.bufferedRequest;if(e._writev&&r&&r.next){var n=i.bufferedRequestCount,o=new Array(n),s=i.corkedRequestsFree;s.entry=r;for(var a=0,h=!0;r;)o[a]=r,r.isBuf||(h=!1),r=r.next,a+=1;o.allBuffers=h,M(e,i,!0,i.length,o,"",s.finish),i.pendingcb++,i.lastBufferedRequest=null,s.next?(i.corkedRequestsFree=s.next,s.next=null):i.corkedRequestsFree=new t(i),i.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,c=r.encoding,f=r.callback;if(M(e,i,!1,i.objectMode?1:u.length,u,c,f),r=r.next,i.bufferedRequestCount--,i.writing)break}null===r&&(i.lastBufferedRequest=null)}i.bufferedRequest=r,i.bufferProcessing=!1}function x(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(i){e.pendingcb--,i&&v(t,i),e.prefinished=!0,t.emit("prefinish"),D(t,e)}))}function D(t,e){var i=x(e);if(i&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,u(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return i}return S()(R,r),k.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(k.prototype,"buffer",{get:i.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(R,Symbol.hasInstance,{value:function(t){return!!a.call(this,t)||this===R&&(t&&t._writableState instanceof k)}})):a=function(t){return t instanceof this},R.prototype.pipe=function(){v(this,new y)},R.prototype.write=function(t,e,i){var r,s=this._writableState,a=!1,h=!s.objectMode&&(r=t,n.isBuffer(r)||r instanceof o);return h&&!n.isBuffer(t)&&(t=function(t){return n.from(t)}(t)),"function"==typeof e&&(i=e,e=null),h?e="buffer":e||(e=s.defaultEncoding),"function"!=typeof i&&(i=m),s.ending?function(t,e){var i=new g;v(t,i),u(e,i)}(this,i):(h||function(t,e,i,r){var n;return null===i?n=new b:"string"==typeof i||e.objectMode||(n=new l("chunk",["string","Buffer"],i)),!n||(v(t,n),u(r,n),!1)}(this,s,t,i))&&(s.pendingcb++,a=function(t,e,i,r,o,s){if(!i){var a=function(t,e,i){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=n.from(e,i));return e}(e,r,o);r!==a&&(i=!0,o="buffer",r=a)}var h=e.objectMode?1:r.length;e.length+=h;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:o,isBuf:i,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else M(t,e,!1,h,r,o,s);return u}(this,s,h,t,e,i)),a},R.prototype.cork=function(){this._writableState.corked++},R.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||L(this,t))},R.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(R.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),R.prototype._write=function(t,e,i){i(new d("_write()"))},R.prototype._writev=null,R.prototype.end=function(t,e,i){var r=this._writableState;return"function"==typeof t?(i=t,t=null,e=null):"function"==typeof e&&(i=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,i){e.ending=!0,D(t,e),i&&(e.finished?u(i):t.once("finish",i));e.ended=!0,t.writable=!1}(this,r,i),this},Object.defineProperty(R.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),R.prototype.destroy=h.destroy,R.prototype._undestroy=h.undestroy,R.prototype._destroy=function(t,e){e(t)},F}function Z(){if(z)return $;z=1;var t=Object.keys||function(t){var e=[];for(var i in t)e.push(i);return e};$=s;var e=Mt(),i=Q();S()(s,e);for(var r=t(i.prototype),n=0;n<r.length;n++){var o=r[n];s.prototype[o]||(s.prototype[o]=i.prototype[o])}function s(t){if(!(this instanceof s))return new s(t);e.call(this,t),i.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||u(h,this)}function h(t){t.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),$}var tt,et,it,rt,nt,ot,st,at,ht,ut,ct,ft,lt,dt,pt,yt,_t,bt,gt,wt,vt,mt,St={};function Et(){if(tt)return St;tt=1;var t=w().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(i){var r;switch(this.encoding=function(i){var r=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(i);if("string"!=typeof r&&(t.isEncoding===e||!e(i)))throw new Error("Unknown encoding: "+i);return r||i}(i),this.encoding){case"utf16le":this.text=o,this.end=s,r=4;break;case"utf8":this.fillLast=n,r=4;break;case"base64":this.text=a,this.end=h,r=3;break;default:return this.write=u,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(r)}function r(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t){var e=this.lastTotal-this.lastNeed,i=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}function a(t,e){var i=(t.length-e)%3;return 0===i?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function u(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}return St.StringDecoder=i,i.prototype.write=function(t){if(0===t.length)return"";var e,i;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?e?e+this.text(t,i):this.text(t,i):e||""},i.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},i.prototype.text=function(t,e){var i=function(t,e,i){var n=e.length-1;if(n<i)return 0;var o=r(e[n]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--n<i||-2===o)return 0;if(o=r(e[n]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--n<i||-2===o)return 0;if(o=r(e[n]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var n=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},i.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},St}function kt(){if(it)return et;it=1;var t=X().codes.ERR_STREAM_PREMATURE_CLOSE;function e(){}return et=function i(r,n,o){if("function"==typeof n)return i(r,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];t.apply(this,r)}}}(o||e);var s=n.readable||!1!==n.readable&&r.readable,a=n.writable||!1!==n.writable&&r.writable,h=function(){r.writable||c()},u=r._writableState&&r._writableState.finished,c=function(){a=!1,u=!0,s||o.call(r)},f=r._readableState&&r._readableState.endEmitted,l=function(){s=!1,f=!0,a||o.call(r)},d=function(t){o.call(r,t)},p=function(){var e;return s&&!f?(r._readableState&&r._readableState.ended||(e=new t),o.call(r,e)):a&&!u?(r._writableState&&r._writableState.ended||(e=new t),o.call(r,e)):void 0},y=function(){r.req.on("finish",c)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(r)?a&&!r._writableState&&(r.on("end",h),r.on("close",h)):(r.on("complete",c),r.on("abort",p),r.req?y():r.on("request",y)),r.on("end",l),r.on("finish",c),!1!==n.error&&r.on("error",d),r.on("close",p),function(){r.removeListener("complete",c),r.removeListener("abort",p),r.removeListener("request",y),r.req&&r.req.removeListener("finish",c),r.removeListener("end",h),r.removeListener("close",h),r.removeListener("finish",c),r.removeListener("end",l),r.removeListener("error",d),r.removeListener("close",p)}},et}function Rt(){if(nt)return rt;var t;function e(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}nt=1;var i=kt(),r=Symbol("lastResolve"),n=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),h=Symbol("handlePromise"),c=Symbol("stream");function f(t,e){return{value:t,done:e}}function l(t){var e=t[r];if(null!==e){var i=t[c].read();null!==i&&(t[a]=null,t[r]=null,t[n]=null,e(f(i,!1)))}}function d(t){u(l,t)}var p=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((e(t={get stream(){return this[c]},next:function(){var t=this,e=this[o];if(null!==e)return Promise.reject(e);if(this[s])return Promise.resolve(f(void 0,!0));if(this[c].destroyed)return new Promise((function(e,i){u((function(){t[o]?i(t[o]):e(f(void 0,!0))}))}));var i,r=this[a];if(r)i=new Promise(function(t,e){return function(i,r){t.then((function(){e[s]?i(f(void 0,!0)):e[h](i,r)}),r)}}(r,this));else{var n=this[c].read();if(null!==n)return Promise.resolve(f(n,!1));i=new Promise(this[h])}return this[a]=i,i}},Symbol.asyncIterator,(function(){return this})),e(t,"return",(function(){var t=this;return new Promise((function(e,i){t[c].destroy(null,(function(t){t?i(t):e(f(void 0,!0))}))}))})),t),p);return rt=function(t){var u,l=Object.create(y,(e(u={},c,{value:t,writable:!0}),e(u,r,{value:null,writable:!0}),e(u,n,{value:null,writable:!0}),e(u,o,{value:null,writable:!0}),e(u,s,{value:t._readableState.endEmitted,writable:!0}),e(u,h,{value:function(t,e){var i=l[c].read();i?(l[a]=null,l[r]=null,l[n]=null,t(f(i,!1))):(l[r]=t,l[n]=e)},writable:!0}),u));return l[a]=null,i(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=l[n];return null!==e&&(l[a]=null,l[r]=null,l[n]=null,e(t)),void(l[o]=t)}var i=l[r];null!==i&&(l[a]=null,l[r]=null,l[n]=null,i(f(void 0,!0))),l[s]=!0})),t.on("readable",d.bind(null,l)),l}}function Mt(){if(ht)return at;var t;ht=1,at=T,T.ReadableState=M,I.EventEmitter;var e=function(t,e){return t.listeners(e).length},i=A(),r=E.Buffer,n=(void 0!==s?s:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,a=m;o=a&&a.debuglog?a.debuglog("stream"):function(){};var h,f,l,d=K(),p=j(),y=J().getHighWaterMark,_=X().codes,b=_.ERR_INVALID_ARG_TYPE,g=_.ERR_STREAM_PUSH_AFTER_EOF,w=_.ERR_METHOD_NOT_IMPLEMENTED,v=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;S()(T,i);var k=p.errorOrDestroy,R=["error","close","destroy","pause","resume"];function M(e,i,r){t=t||Z(),e=e||{},"boolean"!=typeof r&&(r=i instanceof t),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=y(this,e,"readableHighWaterMark",r),this.buffer=new d,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=Et().StringDecoder),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function T(e){if(t=t||Z(),!(this instanceof T))return new T(e);var r=this instanceof t;this._readableState=new M(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),i.call(this)}function L(t,e,i,s,a){o("readableAddChunk",e);var h,u=t._readableState;if(null===e)u.reading=!1,function(t,e){if(o("onEofChunk"),e.ended)return;if(e.decoder){var i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,e.sync?B(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,O(t)))}(t,u);else if(a||(h=function(t,e){var i;o=e,r.isBuffer(o)||o instanceof n||"string"==typeof e||void 0===e||t.objectMode||(i=new b("chunk",["string","Buffer","Uint8Array"],e));var o;return i}(u,e)),h)k(t,h);else if(u.objectMode||e&&e.length>0)if("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===r.prototype||(e=function(t){return r.from(t)}(e)),s)u.endEmitted?k(t,new v):x(t,u,e,!0);else if(u.ended)k(t,new g);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!i?(e=u.decoder.write(e),u.objectMode||0!==e.length?x(t,u,e,!1):C(t,u)):x(t,u,e,!1)}else s||(u.reading=!1,C(t,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function x(t,e,i,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",i)):(e.length+=e.objectMode?1:i.length,r?e.buffer.unshift(i):e.buffer.push(i),e.needReadable&&B(t)),C(t,e)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=p.destroy,T.prototype._undestroy=p.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var i,n=this._readableState;return n.objectMode?i=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=r.from(t,e),e=""),i=!0),L(this,t,e,!1,i)},T.prototype.unshift=function(t){return L(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){h||(h=Et().StringDecoder);var e=new h(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var i=this._readableState.buffer.head,r="";null!==i;)r+=e.write(i.data),i=i.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var P=1073741824;function D(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=P?t=P:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function B(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,u(O,t))}function O(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,W(t)}function C(t,e){e.readingMore||(e.readingMore=!0,u(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var i=e.length;if(o("maybeReadMore read 0"),t.read(0),i===e.length)break}e.readingMore=!1}function V(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function U(t){o("readable nexttick read 0"),t.read(0)}function q(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),W(t),e.flowing&&!e.reading&&t.read(0)}function W(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function F(t,e){return 0===e.length?null:(e.objectMode?i=e.buffer.shift():!t||t>=e.length?(i=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):i=e.buffer.consume(t,e.decoder),i);var i}function H(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,u($,e,t))}function $(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var i=e._writableState;(!i||i.autoDestroy&&i.finished)&&e.destroy()}}function z(t,e){for(var i=0,r=t.length;i<r;i++)if(t[i]===e)return i;return-1}return T.prototype.read=function(t){o("read",t),t=parseInt(t,10);var e=this._readableState,i=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?H(this):B(this),null;if(0===(t=D(t,e))&&e.ended)return 0===e.length&&H(this),null;var r,n=e.needReadable;return o("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&o("length less than watermark",n=!0),e.ended||e.reading?o("reading or ended",n=!1):n&&(o("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=D(i,e))),null===(r=t>0?F(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&H(this)),null!==r&&this.emit("data",r),r},T.prototype._read=function(t){k(this,new w("_read()"))},T.prototype.pipe=function(t,i){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,i);var s=(!i||!1!==i.end)&&t!==c.stdout&&t!==c.stderr?h:b;function a(e,i){o("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,o("cleanup"),t.removeListener("close",y),t.removeListener("finish",_),t.removeListener("drain",f),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",h),r.removeListener("end",b),r.removeListener("data",d),l=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function h(){o("onend"),t.end()}n.endEmitted?u(s):r.once("end",s),t.on("unpipe",a);var f=function(t){return function(){var i=t._readableState;o("pipeOnDrain",i.awaitDrain),i.awaitDrain&&i.awaitDrain--,0===i.awaitDrain&&e(t,"data")&&(i.flowing=!0,W(t))}}(r);t.on("drain",f);var l=!1;function d(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==z(n.pipes,t))&&!l&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function p(i){o("onerror",i),b(),t.removeListener("error",p),0===e(t,"error")&&k(t,i)}function y(){t.removeListener("finish",_),b()}function _(){o("onfinish"),t.removeListener("close",y),b()}function b(){o("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,i){if("function"==typeof t.prependListener)return t.prependListener(e,i);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i)}(t,"error",p),t.once("close",y),t.once("finish",_),t.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),t},T.prototype.unpipe=function(t){var e=this._readableState,i={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,i)),this;if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<n;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=z(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,i)),this},T.prototype.on=function(t,e){var r=i.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?B(this):n.reading||u(U,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var r=i.prototype.removeListener.call(this,t,e);return"readable"===t&&u(V,this),r},T.prototype.removeAllListeners=function(t){var e=i.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||u(V,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,u(q,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,i=this._readableState,r=!1;for(var n in t.on("end",(function(){if(o("wrapped end"),i.decoder&&!i.ended){var t=i.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(o("wrapped data"),i.decoder&&(n=i.decoder.write(n)),i.objectMode&&null==n)||(i.objectMode||n&&n.length)&&(e.push(n)||(r=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var s=0;s<R.length;s++)t.on(R[s],this.emit.bind(this,R[s]));return this._read=function(e){o("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=Rt()),f(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=F,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,e){return void 0===l&&(l=st?ot:(st=1,ot=function(){throw new Error("Readable.from is not available in the browser")})),l(T,t,e)}),at}function Tt(){if(ct)return ut;ct=1,ut=a;var t=X().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,i=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,n=t.ERR_TRANSFORM_WITH_LENGTH_0,o=Z();function s(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new i);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function a(t){if(!(this instanceof a))return new a(t);o.call(this,t),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?u(this,null,null):this._flush((function(e,i){u(t,e,i)}))}function u(t,e,i){if(e)return t.emit("error",e);if(null!=i&&t.push(i),t._writableState.length)throw new n;if(t._transformState.transforming)throw new r;return t.push(null)}return S()(a,o),a.prototype.push=function(t,e){return this._transformState.needTransform=!1,o.prototype.push.call(this,t,e)},a.prototype._transform=function(t,i,r){r(new e("_transform()"))},a.prototype._write=function(t,e,i){var r=this._transformState;if(r.writecb=i,r.writechunk=t,r.writeencoding=e,!r.transforming){var n=this._readableState;(r.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},a.prototype._destroy=function(t,e){o.prototype._destroy.call(this,t,(function(t){e(t)}))},ut}function Lt(){if(pt)return dt;var t;pt=1;var e=X().codes,i=e.ERR_MISSING_ARGS,r=e.ERR_STREAM_DESTROYED;function n(t){if(t)throw t}function o(t){t()}function s(t,e){return t.pipe(e)}return dt=function(){for(var e=arguments.length,a=new Array(e),h=0;h<e;h++)a[h]=arguments[h];var u,c=function(t){return t.length?"function"!=typeof t[t.length-1]?n:t.pop():n}(a);if(Array.isArray(a[0])&&(a=a[0]),a.length<2)throw new i("streams");var f=a.map((function(e,i){var n=i<a.length-1;return function(e,i,n,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===t&&(t=kt()),t(e,{readable:i,writable:n},(function(t){if(t)return o(t);s=!0,o()}));var a=!1;return function(t){if(!s&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new r("pipe"))}}(e,n,i>0,(function(t){u||(u=t),t&&f.forEach(o),n||(f.forEach(o),c(u))}))}));return a.reduce(s)},dt}function xt(){return yt||(yt=1,t=C.exports,(t=C.exports=Mt()).Stream=t,t.Readable=t,t.Writable=Q(),t.Duplex=Z(),t.Transform=Tt(),t.PassThrough=function(){if(lt)return ft;lt=1,ft=e;var t=Tt();function e(i){if(!(this instanceof e))return new e(i);t.call(this,i)}return S()(e,t),e.prototype._transform=function(t,e,i){i(null,t)},ft}(),t.finished=kt(),t.pipeline=Lt()),C.exports;var t}function Pt(){if(bt)return _t;bt=1;var t=w().Buffer,e=xt().Transform;function i(i){e.call(this),this._block=t.allocUnsafe(i),this._blockSize=i,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return S()(i,e),i.prototype._transform=function(t,e,i){var r=null;try{this.update(t,e)}catch(t){r=t}i(r)},i.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},i.prototype.update=function(e,i){if(function(e,i){if(!t.isBuffer(e)&&"string"!=typeof e)throw new TypeError(i+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");t.isBuffer(e)||(e=t.from(e,i));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var s=0,a=8*e.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},i.prototype._update=function(){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var i=0;i<4;++i)this._length[i]=0;return e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},_t=i}var Dt,Bt,Ot,Ct,It,At,Kt,jt,Nt,Vt,Ut,qt,Wt,Ft,Ht,$t={exports:{}};function zt(){if(Bt)return Dt;Bt=1;var t=w().Buffer;function e(e,i){this._block=t.alloc(e),this._finalSize=i,this._blockSize=e,this._len=0}return e.prototype.update=function(e,i){"string"==typeof e&&(i=i||"utf8",e=t.from(e,i));for(var r=this._block,n=this._blockSize,o=e.length,s=this._len,a=0;a<o;){for(var h=s%n,u=Math.min(o-a,n-h),c=0;c<u;c++)r[h+c]=e[a+c];a+=u,(s+=u)%n==0&&this._update(r)}return this._len+=o,this},e.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var i=8*this._len;if(i<=4294967295)this._block.writeUInt32BE(i,this._blockSize-4);else{var r=(4294967295&i)>>>0,n=(i-r)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},e.prototype._update=function(){throw new Error("_update must be implemented by subclass")},Dt=e}function Gt(){if(jt)return Kt;jt=1;var t=S(),e=zt(),i=w().Buffer,r=[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],n=new Array(64);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t,e,i){return i^t&(e^i)}function a(t,e,i){return t&e|i&(t|e)}function h(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function u(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function c(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}return t(o,e),o.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},o.prototype._update=function(t){for(var e,i=this._w,n=0|this._a,o=0|this._b,f=0|this._c,l=0|this._d,d=0|this._e,p=0|this._f,y=0|this._g,_=0|this._h,b=0;b<16;++b)i[b]=t.readInt32BE(4*b);for(;b<64;++b)i[b]=0|(((e=i[b-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+i[b-7]+c(i[b-15])+i[b-16];for(var g=0;g<64;++g){var w=_+u(d)+s(d,p,y)+r[g]+i[g]|0,v=h(n)+a(n,o,f)|0;_=y,y=p,p=d,d=l+w|0,l=f,f=o,o=n,n=w+v|0}this._a=n+this._a|0,this._b=o+this._b|0,this._c=f+this._c|0,this._d=l+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=y+this._g|0,this._h=_+this._h|0},o.prototype._hash=function(){var t=i.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},Kt=o}function Xt(){if(qt)return Ut;qt=1;var t=S(),e=zt(),i=w().Buffer,r=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],n=new Array(160);function o(){this.init(),this._w=n,e.call(this,128,112)}function s(t,e,i){return i^t&(e^i)}function a(t,e,i){return t&e|i&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function u(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function c(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function l(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function d(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function p(t,e){return t>>>0<e>>>0?1:0}return t(o,e),o.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},o.prototype._update=function(t){for(var e=this._w,i=0|this._ah,n=0|this._bh,o=0|this._ch,y=0|this._dh,_=0|this._eh,b=0|this._fh,g=0|this._gh,w=0|this._hh,v=0|this._al,m=0|this._bl,S=0|this._cl,E=0|this._dl,k=0|this._el,R=0|this._fl,M=0|this._gl,T=0|this._hl,L=0;L<32;L+=2)e[L]=t.readInt32BE(4*L),e[L+1]=t.readInt32BE(4*L+4);for(;L<160;L+=2){var x=e[L-30],P=e[L-30+1],D=c(x,P),B=f(P,x),O=l(x=e[L-4],P=e[L-4+1]),C=d(P,x),I=e[L-14],A=e[L-14+1],K=e[L-32],j=e[L-32+1],N=B+A|0,V=D+I+p(N,B)|0;V=(V=V+O+p(N=N+C|0,C)|0)+K+p(N=N+j|0,j)|0,e[L]=V,e[L+1]=N}for(var U=0;U<160;U+=2){V=e[U],N=e[U+1];var q=a(i,n,o),W=a(v,m,S),F=h(i,v),H=h(v,i),$=u(_,k),z=u(k,_),G=r[U],X=r[U+1],J=s(_,b,g),Y=s(k,R,M),Q=T+z|0,Z=w+$+p(Q,T)|0;Z=(Z=(Z=Z+J+p(Q=Q+Y|0,Y)|0)+G+p(Q=Q+X|0,X)|0)+V+p(Q=Q+N|0,N)|0;var tt=H+W|0,et=F+q+p(tt,H)|0;w=g,T=M,g=b,M=R,b=_,R=k,_=y+Z+p(k=E+Q|0,E)|0,y=o,E=S,o=n,S=m,n=i,m=v,i=Z+et+p(v=Q+tt|0,Q)|0}this._al=this._al+v|0,this._bl=this._bl+m|0,this._cl=this._cl+S|0,this._dl=this._dl+E|0,this._el=this._el+k|0,this._fl=this._fl+R|0,this._gl=this._gl+M|0,this._hl=this._hl+T|0,this._ah=this._ah+i+p(this._al,v)|0,this._bh=this._bh+n+p(this._bl,m)|0,this._ch=this._ch+o+p(this._cl,S)|0,this._dh=this._dh+y+p(this._dl,E)|0,this._eh=this._eh+_+p(this._el,k)|0,this._fh=this._fh+b+p(this._fl,R)|0,this._gh=this._gh+g+p(this._gl,M)|0,this._hh=this._hh+w+p(this._hl,T)|0},o.prototype._hash=function(){var t=i.allocUnsafe(64);function e(e,i,r){t.writeInt32BE(e,r),t.writeInt32BE(i,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},Ut=o}function Jt(){if(Ht)return $t.exports;Ht=1;var t=$t.exports=function(e){e=e.toLowerCase();var i=t[e];if(!i)throw new Error(e+" is not supported (we accept pull requests)");return new i};return t.sha=function(){if(Ct)return Ot;Ct=1;var t=S(),e=zt(),i=w().Buffer,r=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t){return t<<30|t>>>2}function a(t,e,i,r){return 0===t?e&i|~e&r:2===t?e&i|e&r|i&r:e^i^r}return t(o,e),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},o.prototype._update=function(t){for(var e,i=this._w,n=0|this._a,o=0|this._b,h=0|this._c,u=0|this._d,c=0|this._e,f=0;f<16;++f)i[f]=t.readInt32BE(4*f);for(;f<80;++f)i[f]=i[f-3]^i[f-8]^i[f-14]^i[f-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=n)<<5|e>>>27)+a(d,o,h,u)+c+i[l]+r[d];c=u,u=h,h=s(o),o=n,n=p}this._a=n+this._a|0,this._b=o+this._b|0,this._c=h+this._c|0,this._d=u+this._d|0,this._e=c+this._e|0},o.prototype._hash=function(){var t=i.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},Ot=o}(),t.sha1=function(){if(At)return It;At=1;var t=S(),e=zt(),i=w().Buffer,r=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function o(){this.init(),this._w=n,e.call(this,64,56)}function s(t){return t<<5|t>>>27}function a(t){return t<<30|t>>>2}function h(t,e,i,r){return 0===t?e&i|~e&r:2===t?e&i|e&r|i&r:e^i^r}return t(o,e),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},o.prototype._update=function(t){for(var e,i=this._w,n=0|this._a,o=0|this._b,u=0|this._c,c=0|this._d,f=0|this._e,l=0;l<16;++l)i[l]=t.readInt32BE(4*l);for(;l<80;++l)i[l]=(e=i[l-3]^i[l-8]^i[l-14]^i[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),y=s(n)+h(p,o,u,c)+f+i[d]+r[p]|0;f=c,c=u,u=a(o),o=n,n=y}this._a=n+this._a|0,this._b=o+this._b|0,this._c=u+this._c|0,this._d=c+this._d|0,this._e=f+this._e|0},o.prototype._hash=function(){var t=i.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},It=o}(),t.sha224=function(){if(Vt)return Nt;Vt=1;var t=S(),e=Gt(),i=zt(),r=w().Buffer,n=new Array(64);function o(){this.init(),this._w=n,i.call(this,64,56)}return t(o,e),o.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},o.prototype._hash=function(){var t=r.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},Nt=o}(),t.sha256=Gt(),t.sha384=function(){if(Ft)return Wt;Ft=1;var t=S(),e=Xt(),i=zt(),r=w().Buffer,n=new Array(160);function o(){this.init(),this._w=n,i.call(this,128,112)}return t(o,e),o.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},o.prototype._hash=function(){var t=r.allocUnsafe(48);function e(e,i,r){t.writeInt32BE(e,r),t.writeInt32BE(i,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},Wt=o}(),t.sha512=Xt(),$t.exports}var Yt,Qt,Zt,te,ee=a(h);function ie(){if(Qt)return Yt;Qt=1;var t=w().Buffer,e=v.Transform,i=ee.StringDecoder;function r(t){e.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}S()(r,e);var n="undefined"!=typeof Uint8Array,o="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(t.prototype instanceof Uint8Array||t.TYPED_ARRAY_SUPPORT);return r.prototype.update=function(e,i,r){var s=function(e,i){if(e instanceof t)return e;if("string"==typeof e)return t.from(e,i);if(o&&ArrayBuffer.isView(e)){if(0===e.byteLength)return t.alloc(0);var r=t.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(n&&e instanceof Uint8Array)return t.from(e);if(t.isBuffer(e)&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))return t.from(e);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(e,i),a=this._update(s);return this.hashMode?this:(r&&(a=this._toString(a,r)),a)},r.prototype.setAutoPadding=function(){},r.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},r.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},r.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},r.prototype._transform=function(t,e,i){var r;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){r=t}finally{i(r)}},r.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},r.prototype._finalOrDigest=function(e){var i=this.__final()||t.alloc(0);return e&&(i=this._toString(i,e,!0)),i},r.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new i(e),this._encoding=e),this._encoding!==e)throw new Error("can’t switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},Yt=r}var re,ne=function(){if(te)return Zt;te=1;var t=S(),e=function(){if(wt)return gt;wt=1;var t=S(),e=Pt(),i=w().Buffer,r=new Array(16);function n(){e.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function o(t,e){return t<<e|t>>>32-e}function s(t,e,i,r,n,s,a){return o(t+(e&i|~e&r)+n+s|0,a)+e|0}function a(t,e,i,r,n,s,a){return o(t+(e&r|i&~r)+n+s|0,a)+e|0}function h(t,e,i,r,n,s,a){return o(t+(e^i^r)+n+s|0,a)+e|0}function u(t,e,i,r,n,s,a){return o(t+(i^(e|~r))+n+s|0,a)+e|0}return t(n,e),n.prototype._update=function(){for(var t=r,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var i=this._a,n=this._b,o=this._c,c=this._d;i=s(i,n,o,c,t[0],3614090360,7),c=s(c,i,n,o,t[1],3905402710,12),o=s(o,c,i,n,t[2],606105819,17),n=s(n,o,c,i,t[3],3250441966,22),i=s(i,n,o,c,t[4],4118548399,7),c=s(c,i,n,o,t[5],1200080426,12),o=s(o,c,i,n,t[6],2821735955,17),n=s(n,o,c,i,t[7],4249261313,22),i=s(i,n,o,c,t[8],1770035416,7),c=s(c,i,n,o,t[9],2336552879,12),o=s(o,c,i,n,t[10],4294925233,17),n=s(n,o,c,i,t[11],2304563134,22),i=s(i,n,o,c,t[12],1804603682,7),c=s(c,i,n,o,t[13],4254626195,12),o=s(o,c,i,n,t[14],2792965006,17),i=a(i,n=s(n,o,c,i,t[15],1236535329,22),o,c,t[1],4129170786,5),c=a(c,i,n,o,t[6],3225465664,9),o=a(o,c,i,n,t[11],643717713,14),n=a(n,o,c,i,t[0],3921069994,20),i=a(i,n,o,c,t[5],3593408605,5),c=a(c,i,n,o,t[10],38016083,9),o=a(o,c,i,n,t[15],3634488961,14),n=a(n,o,c,i,t[4],3889429448,20),i=a(i,n,o,c,t[9],568446438,5),c=a(c,i,n,o,t[14],3275163606,9),o=a(o,c,i,n,t[3],4107603335,14),n=a(n,o,c,i,t[8],1163531501,20),i=a(i,n,o,c,t[13],2850285829,5),c=a(c,i,n,o,t[2],4243563512,9),o=a(o,c,i,n,t[7],1735328473,14),i=h(i,n=a(n,o,c,i,t[12],2368359562,20),o,c,t[5],4294588738,4),c=h(c,i,n,o,t[8],2272392833,11),o=h(o,c,i,n,t[11],1839030562,16),n=h(n,o,c,i,t[14],4259657740,23),i=h(i,n,o,c,t[1],2763975236,4),c=h(c,i,n,o,t[4],1272893353,11),o=h(o,c,i,n,t[7],4139469664,16),n=h(n,o,c,i,t[10],3200236656,23),i=h(i,n,o,c,t[13],681279174,4),c=h(c,i,n,o,t[0],3936430074,11),o=h(o,c,i,n,t[3],3572445317,16),n=h(n,o,c,i,t[6],76029189,23),i=h(i,n,o,c,t[9],3654602809,4),c=h(c,i,n,o,t[12],3873151461,11),o=h(o,c,i,n,t[15],530742520,16),i=u(i,n=h(n,o,c,i,t[2],3299628645,23),o,c,t[0],4096336452,6),c=u(c,i,n,o,t[7],1126891415,10),o=u(o,c,i,n,t[14],2878612391,15),n=u(n,o,c,i,t[5],4237533241,21),i=u(i,n,o,c,t[12],1700485571,6),c=u(c,i,n,o,t[3],2399980690,10),o=u(o,c,i,n,t[10],4293915773,15),n=u(n,o,c,i,t[1],2240044497,21),i=u(i,n,o,c,t[8],1873313359,6),c=u(c,i,n,o,t[15],4264355552,10),o=u(o,c,i,n,t[6],2734768916,15),n=u(n,o,c,i,t[13],1309151649,21),i=u(i,n,o,c,t[4],4149444226,6),c=u(c,i,n,o,t[11],3174756917,10),o=u(o,c,i,n,t[2],718787259,15),n=u(n,o,c,i,t[9],3951481745,21),this._a=this._a+i|0,this._b=this._b+n|0,this._c=this._c+o|0,this._d=this._d+c|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},gt=n}(),i=function(){if(mt)return vt;mt=1;var t=E.Buffer,e=S(),i=Pt(),r=new Array(16),n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],o=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],a=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],u=[1352829926,1548603684,1836072691,2053994217,0];function c(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function f(t,e){return t<<e|t>>>32-e}function l(t,e,i,r,n,o,s,a){return f(t+(e^i^r)+o+s|0,a)+n|0}function d(t,e,i,r,n,o,s,a){return f(t+(e&i|~e&r)+o+s|0,a)+n|0}function p(t,e,i,r,n,o,s,a){return f(t+((e|~i)^r)+o+s|0,a)+n|0}function y(t,e,i,r,n,o,s,a){return f(t+(e&r|i&~r)+o+s|0,a)+n|0}function _(t,e,i,r,n,o,s,a){return f(t+(e^(i|~r))+o+s|0,a)+n|0}return e(c,i),c.prototype._update=function(){for(var t=r,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var i=0|this._a,c=0|this._b,b=0|this._c,g=0|this._d,w=0|this._e,v=0|this._a,m=0|this._b,S=0|this._c,E=0|this._d,k=0|this._e,R=0;R<80;R+=1){var M,T;R<16?(M=l(i,c,b,g,w,t[n[R]],h[0],s[R]),T=_(v,m,S,E,k,t[o[R]],u[0],a[R])):R<32?(M=d(i,c,b,g,w,t[n[R]],h[1],s[R]),T=y(v,m,S,E,k,t[o[R]],u[1],a[R])):R<48?(M=p(i,c,b,g,w,t[n[R]],h[2],s[R]),T=p(v,m,S,E,k,t[o[R]],u[2],a[R])):R<64?(M=y(i,c,b,g,w,t[n[R]],h[3],s[R]),T=d(v,m,S,E,k,t[o[R]],u[3],a[R])):(M=_(i,c,b,g,w,t[n[R]],h[4],s[R]),T=l(v,m,S,E,k,t[o[R]],u[4],a[R])),i=w,w=g,g=f(b,10),b=c,c=M,v=k,k=E,E=f(S,10),S=m,m=T}var L=this._b+b+E|0;this._b=this._c+g+k|0,this._c=this._d+w+v|0,this._d=this._e+i+m|0,this._e=this._a+c+S|0,this._a=L},c.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=t.alloc?t.alloc(20):new t(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},vt=c}(),r=Jt(),n=ie();function o(t){n.call(this,"digest"),this._hash=t}return t(o,n),o.prototype._update=function(t){this._hash.update(t)},o.prototype._final=function(){return this._hash.digest()},Zt=function(t){return"md5"===(t=t.toLowerCase())?new e:"rmd160"===t||"ripemd160"===t?new i:new o(r(t))}}(),oe=o(ne),se={exports:{}};var ae,he,ue,ce,fe,le,de=o(function(){if(re)return se.exports;re=1;var t=65536,e=4294967295,i=w().Buffer,r=s.crypto||s.msCrypto;return r&&r.getRandomValues?se.exports=function(n,o){if(n>e)throw new RangeError("requested too many random bytes");var s=i.allocUnsafe(n);if(n>0)if(n>t)for(var a=0;a<n;a+=t)r.getRandomValues(s.slice(a,a+t));else r.getRandomValues(s);if("function"==typeof o)return u((function(){o(null,s)}));return s}:se.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")},se.exports}());var pe=function(){if(le)return fe;le=1;const{CryptoLD:t}=(he||(he=1,ae={CryptoLD:class{constructor({suites:t}={}){this.suites=t||new Map}use(t){this.suites.set(t.suite,t)}async generate(t={}){return this._suiteForType(t).generate(t)}async from(t={}){const e=this._suiteForType(t);return t["@context"]?e.fromKeyDocument({document:t}):e.from(t)}async fromKeyDocument({document:t,checkContext:e=!0,checkRevoked:i=!0}={}){if(!t)throw new TypeError('The "document" parameter is required.');return this._suiteForType(t).fromKeyDocument({document:t,checkContext:e,checkRevoked:i})}async fromKeyId({id:t,documentLoader:e,checkContext:i=!0,checkRevoked:r=!0}={}){if(!t)throw new TypeError('The "id" parameter is required.');if(!e)throw new TypeError('The "documentLoader" parameter is required.');let n;try{if(({document:n}=await e(t)),!n)throw new Error('The "documentLoader" function must return a "document" object.')}catch(t){const e=new Error("Error fetching document: "+t.message);throw e.cause=t,e}const o=n.type;if(!o)throw new Error("Key suite type not found in fetched document.");const s=this.suites.get(o);if(!s)throw new Error(`Support for suite "${o}" is not installed.`);return s.fromKeyDocument({document:n,checkContext:i,checkRevoked:r})}_installed({type:t}){return this.suites.has(t)}_suiteForType(t){const e=t&&t.type;if(!e)throw new TypeError("Missing key type.");if(!this._installed({type:e}))throw new Error(`Support for key type "${e}" is not installed.`);return this.suites.get(e)}}}),ae),{LDKeyPair:e}=function(){if(ce)return ue;ce=1;class t{constructor({id:t,controller:e,revoked:i}={}){this.id=t,this.controller=e,this.revoked=i}static async generate(){throw new Error("Abstract method, must be implemented in subclass.")}static async fromKeyDocument({document:t,checkContext:e=!0,checkRevoked:i=!0}={}){if(!t)throw new TypeError('The "document" parameter is required.');if(e&&![].concat(t["@context"]).includes(this.SUITE_CONTEXT))throw new Error('Key document does not contain required context "'+this.SUITE_CONTEXT+'".');if(i&&t.revoked)throw new Error(`Key has been revoked since: "${t.revoked}".`);return this.from(t)}static async from(){throw new Error("Abstract method from() must be implemented in subclass.")}export({publicKey:t=!1,privateKey:e=!1}={}){if(!t&&!e)throw new Error('Export requires specifying either "publicKey" or "privateKey".');const i={id:this.id,type:this.type,controller:this.controller};return this.revoked&&(i.revoked=this.revoked),i}fingerprint(){throw new Error("Abstract method, must be implemented in subclass.")}verifyFingerprint(){throw new Error("Abstract method, must be implemented in subclass.")}signer(){return{async sign({}){throw new Error("Abstract method, must be implemented in subclass.")}}}verifier(){return{async verify({}){throw new Error("Abstract method, must be implemented in subclass.")}}}}return t.SUITE_CONTEXT="INVALID LDKeyPair CONTEXT",ue={LDKeyPair:t}}();return fe={CryptoLD:t,LDKeyPair:e}}(),ye=o(pe);const _e="EcdsaSecp256k1VerificationKey2019",be=t=>oe("sha256").update(t).digest();class ge extends ye.LDKeyPair{constructor({publicKeyBase58:t,privateKeyBase58:e,...i}){if(super(i),this.type=void 0,this.publicKeyBase58=void 0,this.privateKeyBase58=void 0,e&&!t){const t=b.publicKeyCreate(k(e));this.publicKeyBase58=R(t)}else this.publicKeyBase58=t;if(this.type=_e,this.privateKeyBase58=e,!this.publicKeyBase58)throw new TypeError('The "publicKeyBase58" property is required.')}static from(t){if(t.publicKeyHex||t.privateKeyHex){const{publicKeyHex:e,privateKeyHex:i,...r}=t;return new ge({...r,publicKeyBase58:e?R(n.from(e,"hex")):void 0,privateKeyBase58:i?R(n.from(i,"hex")):void 0})}return new ge(t)}static async generate({seed:t,compressed:e,...i}){if(t&&!b.privateKeyVerify(t))throw new Error("Provided seed is not a valid private key");let r=t;for(;void 0===r||!b.privateKeyVerify(r);)r=new Uint8Array(de(32));const n=b.publicKeyCreate(r,e);return new ge({publicKeyBase58:R(n),privateKeyBase58:R(r),...i})}export({publicKey:t=!1,privateKey:e=!1,includeContext:i=!1}={}){if(!t&&!e)throw new TypeError('export requires specifying either "publicKey" or "privateKey".');if(e&&!this.privateKeyBase58)throw new TypeError("No privateKey to export.");if(t&&!this.publicKeyBase58)throw new TypeError("No publicKey to export.");const r={type:this.type,id:this.id,controller:this.controller,revoked:this.revoked};return i&&(r["@context"]=ge.SUITE_CONTEXT),e&&(r.privateKeyBase58=this.privateKeyBase58),t&&(r.publicKeyBase58=this.publicKeyBase58),r}signer(){const{privateKeyBase58:t}=this;return t?{async sign({data:e}){const i=g.encode(JSON.stringify({alg:"ES256K",b64:!1,crit:["b64"]})),r=n.from(e.buffer,e.byteOffset,e.length),o=be(n.from(n.concat([n.from(`${i}.`,"utf8"),n.from(r.buffer,r.byteOffset,r.length)]))),{signature:s}=b.ecdsaSign(o,k(t));return`${i}..${g.encode(n.from(s))}`},id:this.id}:{async sign(){throw new Error("No private key to sign with.")},id:this.id}}verifier(){const{publicKeyBase58:t}=this;return t?{async verify({data:e,signature:i}){if(i.indexOf("..")<0)return!1;const[r,o]=i.split(".."),s=JSON.parse(g.decode(r));if("ES256K"!==s.alg||!1!==s.b64||!s.crit||!s.crit.length||"b64"!==s.crit[0])return!1;const a=n.from(e.buffer,e.byteOffset,e.length),h=be(n.from(n.concat([n.from(`${r}.`,"utf8"),n.from(a.buffer,a.byteOffset,a.length)])));let u;try{u=b.ecdsaVerify(n.from(g.decode(o,"hex"),"hex"),h,k(t))}catch(t){u=!1}return u},id:this.id}:{async verify(){throw new Error("No public key to verify against")},id:this.id}}}ge.suite=_e,ge.SUITE_CONTEXT="https://ns.did.ai/suites/secp256k1-2019/v1";const we="https://ns.did.ai/suites/secp256k1-2019/v1",ve=({document:t,contextUrl:e})=>{const i=t["@context"];return i===e||Array.isArray(i)&&i.includes(e)},me=({document:t})=>{const e=ve({document:t,contextUrl:we}),i=ve({document:t,contextUrl:"https://www.w3.org/2018/credentials/v1"}),r=ve({document:t,contextUrl:"https://w3id.org/security/v2"});return e&&i?(console.warn("Warning: The secp256k1-2019/v1 and credentials/v1 contexts are incompatible."),console.warn("For VCs using EcdsaSecp256k1Signature2019 suite, using the credentials/v1 context is sufficient."),!1):e&&r?(console.warn("Warning: The secp256k1-2019/v1 and security/v2 contexts are incompatible."),console.warn("For VCs using EcdsaSecp256k1Signature2019 suite, using the security/v2 context is sufficient."),!1):e||i||r};let Se=class extends l.suites.LinkedDataSignature{constructor(t={}){super({type:"EcdsaSecp256k1Signature2019",LDKeyClass:ge,contextUrl:we,...t}),this.requiredKeyType=void 0,this.requiredKeyType="EcdsaSecp256k1VerificationKey2019"}async sign({verifyData:t,proof:e}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");return{...e,jws:await this.signer.sign({data:t})}}async verifySignature({verifyData:t,verificationMethod:e,proof:i}){const{jws:r}=i;if(!r||"string"!=typeof r)throw new TypeError('The proof does not include a valid "jws" property.');let{verifier:n}=this;if(!n){n=(await this.LDKeyClass.from(e)).verifier()}return n.verify({data:t,signature:r})}async assertVerificationMethod({verificationMethod:t}){if(!me({document:t}))throw new TypeError(`The verification method (key) must contain "${this.contextUrl}".`);if(!d.hasValue(t,"type",this.requiredKeyType))throw new Error(`Invalid key type. Key type must be "${this.requiredKeyType}".`);if(void 0!==t.revoked)throw new Error("The verification method has been revoked.")}async getVerificationMethod({proof:t,documentLoader:e}){if(this.key)return this.key.export({publicKey:!0});const i="object"==typeof t.verificationMethod?t.verificationMethod.id:t.verificationMethod;if(!i)throw new Error('No "verificationMethod" found in proof.');const r=await d.frame(i,{"@context":this.contextUrl,"@embed":"@always",id:i},{documentLoader:e,compactToRelative:!1});if(!r)throw new Error(`Verification method ${i} not found.`);if(void 0!==r.revoked)throw new Error("The verification method has been revoked.");return await this.assertVerificationMethod({verificationMethod:r}),r}async matchProof({proof:t,document:e,purpose:i,documentLoader:r,expansionMap:n}){if(!me({document:e}))return!1;if(!await super.matchProof({proof:t,document:e,purpose:i,documentLoader:r,expansionMap:n}))return!1;if(!this.key)return!0;const{verificationMethod:o}=t,s="object"==typeof o?o.id:o;return this.isVerificationMethodMatchingKeyId(s)}ensureSuiteContext({document:t,addSuiteContext:e}){me({document:t})||super.ensureSuiteContext({document:t,addSuiteContext:e})}isVerificationMethodMatchingKeyId(t){return t===this.key.id||t===`${this.key.controller}${this.key.id}`}};Se.CONTEXT_URL=we,Se.CONTEXT={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},EcdsaSecp256k1VerificationKey2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1VerificationKey2019","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},blockchainAccountId:{"@id":"https://w3id.org/security#blockchainAccountId"},publicKeyJwk:{"@id":"https://w3id.org/security#publicKeyJwk","@type":"@json"},publicKeyBase58:{"@id":"https://w3id.org/security#publicKeyBase58"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},EcdsaSecp256k1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},jws:{"@id":"https://w3id.org/security#jws"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};const Ee="undefined"==typeof Buffer?n:Buffer,{purposes:{AssertionProofPurpose:ke,AuthenticationProofPurpose:Re}}=l;var Me;!function(t){t.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",t.ensureVerificationMethodValidity="ensureVerificationMethodValidity",t.checkDocumentSignature="checkDocumentSignature"}(Me||(Me={}));class Te extends M{verificationProcess=[Me.retrieveVerificationMethodPublicKey,Me.ensureVerificationMethodValidity,Me.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSecp256k1Signature2019";verificationKey;verificationMethod;publicKey;proofPurpose;challenge;domain;proofPurposeMap;constructor(t){super(t),t.executeStep&&(this.executeStep=t.executeStep),this.documentToVerify=t.document,this.issuer=t.issuer,this.proof=t.proof,this.proofPurpose=t.proofPurpose??"assertionMethod",this.challenge=t.proofChallenge??"",this.domain=t.proofDomain,this.proofPurposeMap={authentication:Re,assertionMethod:ke},this.validateProofType()}async init(){}async verifyProof(){for(const t of this.verificationProcess){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async verifyIdentity(){}getProofVerificationSteps(e){return this.verificationProcess.map((i=>t.verifier.convertToVerificationSubsteps(e,i)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return this.publicKey}getIssuerName(){return this.issuer.name??""}getIssuerProfileDomain(){try{return new URL(this.getIssuerProfileUrl()).hostname??""}catch(t){return""}}getIssuerProfileUrl(){return this.issuer.id??""}getSigningDate(){return this.proof.created}async executeStep(t,e,i){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}validateProofType(){const t=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(t!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${t}`)}isProofChain(){return"ChainedProof2021"===this.proof.type}generateDocumentLoader(){e[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(t){return t in e?{contextUrl:null,document:e[t],documentUrl:t}:d.documentLoader(t)}}retrieveInitialDocument(){const t=i(this.documentToVerify);if(Array.isArray(t.proof)){const e=t.proof.find((t=>t.type===this.type));delete t.proof,t.proof=e}return t}getTargetVerificationMethodContainer(){if(this.issuer.didDocument){if(this.findVerificationMethod(this.issuer.didDocument.verificationMethod,this.issuer.didDocument.id))return this.issuer.didDocument}const t={...this.issuer};return delete t.didDocument,t}findVerificationMethod(t,e){return t.find((t=>t.id===this.proof.verificationMethod||e+t.id===this.proof.verificationMethod))??null}getErrorMessage(t){return t.error.errors[0].message}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(Me.retrieveVerificationMethodPublicKey,(async()=>{if(this.verificationMethod=T(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod),this.verificationMethod.publicKeyJwk&&!this.verificationMethod.publicKeyBase58){const e=(t=>{const e=p.from({...t,crv:"K-256"},"jwk").toString("blk","public"),i=y.publicKeyConvert(Ee.from(e,"hex"),!0);return Ee.from(i).toString("hex")})(this.verificationMethod.publicKeyJwk);this.verificationMethod.publicKeyBase58=(t=e,_.encode(Ee.from(t,"hex"))),this.documentToVerify["@context"].includes("https://w3id.org/security/suites/secp256k1-2019/v1")||this.documentToVerify["@context"].push("https://w3id.org/security/suites/secp256k1-2019/v1")}var t;this.publicKey=this.verificationMethod.publicKeyBase58;const e=ge.from({...this.verificationMethod});if(!e)throw new r(Me.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(e.revoked)throw new r(Me.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return e}),this.type)}async ensureVerificationMethodValidity(){await this.executeStep(Me.ensureVerificationMethodValidity,(async()=>{if(this.verificationMethod.expires){if(new Date(this.verificationMethod.expires).getTime()<Date.now())throw new r(Me.ensureVerificationMethodValidity,"The verification key has expired")}if(this.verificationMethod.revoked)throw new r(Me.ensureVerificationMethodValidity,"The verification key has been revoked")}),this.type)}async checkDocumentSignature(){await this.executeStep(Me.checkDocumentSignature,(async()=>{const t=new Se({key:this.verificationKey});t.date=new Date(Date.now()).toISOString(),"authentication"!==this.proofPurpose||this.proof.challenge||(this.proof.challenge="");const e=await l.verify(this.retrieveInitialDocument(),{suite:t,purpose:new this.proofPurposeMap[this.proofPurpose]({controller:this.getTargetVerificationMethodContainer(),challenge:this.challenge,domain:this.domain}),documentLoader:this.generateDocumentLoader()});if(!e.verified)throw console.error(JSON.stringify(e,null,2)),new r(Me.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed: ${this.getErrorMessage(e)}`);console.log("Credential Secp256k1 signature successfully verified")}),this.type)}}export{Te as default};