@blockcerts/blockcerts-verifier 1.59.0 → 1.59.2

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 (33) hide show
  1. package/bundle-stats.html +1 -1
  2. package/dist/{EcdsaSecp256k1Signature2019-XwuS-fWx-n_8xXj1H.js → EcdsaSecp256k1Signature2019-XwuS-fWx-7dFfMy74.js} +1 -1
  3. package/dist/{Ed25519Signature2020-IJ4ybcbU-ii2PjWjh.js → Ed25519Signature2020-IJ4ybcbU--hEL5-Pa.js} +1 -1
  4. package/dist/{HashlinkVerifier-wyKYZ83G-aKb9h_9G.js → HashlinkVerifier-wyKYZ83G-bzhltPG4.js} +1 -1
  5. package/dist/{MerkleProof2017-MZJbBTpc-NVfw6WgB.js → MerkleProof2017-MZJbBTpc-0GcGcIV-.js} +1 -1
  6. package/dist/{MerkleProof2017-Ub6_JUVj-Z6jluDo2.js → MerkleProof2017-Ub6_JUVj-x8awkeml.js} +1 -1
  7. package/dist/{MerkleProof2019-QUwyEIHd-9hBGmPq_.js → MerkleProof2019-QUwyEIHd-iYt21yPG.js} +1 -1
  8. package/dist/{checkRevocationStatusList2021-d1qO1xnj-AIMXIqnZ.js → checkRevocationStatusList2021-d1qO1xnj-DH6pO-9Q.js} +1 -1
  9. package/dist/{controlVerificationMethod-6GJtYmqY-VwQyuM5o.js → controlVerificationMethod-6GJtYmqY-Ivo3O8nb.js} +1 -1
  10. package/dist/{did-key-common.esm-Fyh_U6fK-6hhnSYH5.js → did-key-common.esm-Fyh_U6fK-cOLlHenk.js} +1 -1
  11. package/dist/{did-key-ed25519.esm-1lIlZtof-q2UR_X9G.js → did-key-ed25519.esm-1lIlZtof-Grj-JpU9.js} +1 -1
  12. package/dist/did-key-secp256k1.esm-hA8kGTM0-G8ct6CwH.js +1 -0
  13. package/dist/{downloadPDF-6pZYEy3P.js → downloadPDF--IVgfc2I.js} +3 -3
  14. package/dist/{elliptic-il_lPAr--BGmaMzNc.js → elliptic-il_lPAr--VPyWJbY1.js} +1 -1
  15. package/dist/{ensureNotRevoked-2QGGtBqy-U5ByLE-t.js → ensureNotRevoked-2QGGtBqy-t8Yk4QI-.js} +1 -1
  16. package/dist/ensureNotRevoked-gui-UMnE-kFmYZEJe.js +1 -0
  17. package/dist/{ensureValidIssuingKey-zZEv5-cH-oM__XftS.js → ensureValidIssuingKey-zZEv5-cH-UoJe_Wnf.js} +1 -1
  18. package/dist/{index-MC635rre-r3wKwiyR.js → index-MC635rre-_DW5MUyk.js} +2 -2
  19. package/dist/{index-WX6J-tsk.js → index-UlvMASNZ.js} +1 -1
  20. package/dist/index-xsnp_Fid-o1HUYRUQ.js +1 -0
  21. package/dist/{index.es-NoR6QQLP.js → index.es-dEKcVerc.js} +1 -1
  22. package/dist/{jsonld-CXlzLf4P-Wh4x173W.js → jsonld-CXlzLf4P-ioHKtwiZ.js} +6 -6
  23. package/dist/{jsonld-signatures-ooFWZVS--VI8BZQOv.js → jsonld-signatures-ooFWZVS--ThP8ltUY.js} +5 -5
  24. package/dist/main.js +103 -103
  25. package/dist/{purify-05qYXQpp.js → purify-GC91XaSq.js} +1 -1
  26. package/dist/{sha256-wKeS8_4l-o9J6pXuo.js → sha256-wKeS8_4l-9eo2gOQb.js} +1 -1
  27. package/dist/{x25519-NtRELWAG-TIgip27e.js → x25519-NtRELWAG-2RynHlmX.js} +1 -1
  28. package/package.json +1 -1
  29. package/scripts/automated-update-blockcerts.org.sh +7 -1
  30. package/dist/did-key-secp256k1.esm-hA8kGTM0-5bW-jZai.js +0 -1
  31. package/dist/ensureNotRevoked-gui-UMnE-9nObicUP.js +0 -1
  32. package/dist/index-F1HqK0qm.js +0 -1
  33. package/dist/index-xsnp_Fid-LwXIiw03.js +0 -1
@@ -1,4 +1,4 @@
1
- import{f as e,A as t,p as r,c as i,h as n,o,n as s,l as a,D as h,E as u,F as c,d as l}from"./main.js";import{j as f}from"./jsonld-signatures-ooFWZVS--VI8BZQOv.js";import{j as d}from"./jsonld-CXlzLf4P-Wh4x173W.js";import{s as p,b as y,d as b,r as _,a as w,k as g,e as v}from"./index-MC635rre-r3wKwiyR.js";import{r as m,i as E,e as S}from"./elliptic-il_lPAr--BGmaMzNc.js";import{d as k,e as R}from"./index-CZOUZnn4-Lnb5-WZi.js";import{S as T}from"./Suite-Bhitn5l3-e2QgHGhx.js";import"./pako.esm-jjCKMBM4-RAILONW0.js";import"./sha256-wKeS8_4l-o9J6pXuo.js";import"./index-xsnp_Fid-LwXIiw03.js";var M,x,A={exports:{}},K={},L=h(u),I=L.EventEmitter;function O(e,t){P(e,t),C(e)}function C(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function P(e,t){e.emit("error",t)}var D={destroy:function(e,r){var i=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t(P,this,e)):t(P,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!r&&e?i._writableState?i._writableState.errorEmitted?t(C,i):(i._writableState.errorEmitted=!0,t(O,i,e)):t(O,i,e):r?(t(C,i),r(e)):t(C,i)})),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(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}},B={};var N={};function j(e,t,r){r||(r=Error);var i=function(e){var r,i;function n(r,i,n){return e.call(this,function(e,r,i){return"string"==typeof t?t:t(e,r,i)}(r,i,n))||this}return i=e,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);i.prototype.name=r.name,i.prototype.code=e,N[e]=i}function U(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}j("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),j("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,n,o,s;if("string"==typeof t&&(n="not ",t.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(U(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(a," ").concat(i," ").concat(U(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),j("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),j("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),j("ERR_STREAM_PREMATURE_CLOSE","Premature close"),j("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),j("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),j("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),j("ERR_STREAM_WRITE_AFTER_END","write after end"),j("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),j("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),j("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),B.codes=N;var V=B.codes.ERR_INVALID_OPT_VALUE;var q,W={getHighWaterMark:function(e,t,r,i){var n=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new V(i?r:"highWaterMark",n);return Math.floor(n)}return e.objectMode?16:16384}},F={};function z(){if(q)return F;q=1;var e=p.Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.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 r(r){var i;switch(this.encoding=function(r){var i=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(r);if("string"!=typeof i&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=a,this.end=h,i=3;break;default:return this.write=u,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(i)}function i(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function n(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function a(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}return F.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var o=i(t[n]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--n<r||-2===o)return 0;if(o=i(t[n]),o>=0)return o>0&&(e.lastNeed=o-2),o;if(--n<r||-2===o)return 0;if(o=i(t[n]),o>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},r.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},F}var H=B.codes.ERR_STREAM_PREMATURE_CLOSE;function $(){}var Z,X,G,J,Y=function e(t,r,i){if("function"==typeof r)return e(t,null,r);r||(r={}),i=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}(i||$);var n=r.readable||!1!==r.readable&&t.readable,o=r.writable||!1!==r.writable&&t.writable,s=function(){t.writable||h()},a=t._writableState&&t._writableState.finished,h=function(){o=!1,a=!0,n||i.call(t)},u=t._readableState&&t._readableState.endEmitted,c=function(){n=!1,u=!0,o||i.call(t)},l=function(e){i.call(t,e)},f=function(){var e;return n&&!u?(t._readableState&&t._readableState.ended||(e=new H),i.call(t,e)):o&&!a?(t._writableState&&t._writableState.ended||(e=new H),i.call(t,e)):void 0},d=function(){t.req.on("finish",h)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?o&&!t._writableState&&(t.on("end",s),t.on("close",s)):(t.on("complete",h),t.on("abort",f),t.req?d():t.on("request",d)),t.on("end",c),t.on("finish",h),!1!==r.error&&t.on("error",l),t.on("close",f),function(){t.removeListener("complete",h),t.removeListener("abort",f),t.removeListener("request",d),t.req&&t.req.removeListener("finish",h),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",h),t.removeListener("end",c),t.removeListener("error",l),t.removeListener("close",f)}};function Q(){if(X)return Z;var e;function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}X=1;var i=Y,n=Symbol("lastResolve"),o=Symbol("lastReject"),s=Symbol("error"),a=Symbol("ended"),h=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function l(e,t){return{value:e,done:t}}function f(e){var t=e[n];if(null!==t){var r=e[c].read();null!==r&&(e[h]=null,e[n]=null,e[o]=null,t(l(r,!1)))}}function d(e){t(f,e)}var p=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((r(e={get stream(){return this[c]},next:function(){var e=this,r=this[s];if(null!==r)return Promise.reject(r);if(this[a])return Promise.resolve(l(void 0,!0));if(this[c].destroyed)return new Promise((function(r,i){t((function(){e[s]?i(e[s]):r(l(void 0,!0))}))}));var i,n=this[h];if(n)i=new Promise(function(e,t){return function(r,i){e.then((function(){t[a]?r(l(void 0,!0)):t[u](r,i)}),i)}}(n,this));else{var o=this[c].read();if(null!==o)return Promise.resolve(l(o,!1));i=new Promise(this[u])}return this[h]=i,i}},Symbol.asyncIterator,(function(){return this})),r(e,"return",(function(){var e=this;return new Promise((function(t,r){e[c].destroy(null,(function(e){e?r(e):t(l(void 0,!0))}))}))})),e),p);return Z=function(e){var t,f=Object.create(y,(r(t={},c,{value:e,writable:!0}),r(t,n,{value:null,writable:!0}),r(t,o,{value:null,writable:!0}),r(t,s,{value:null,writable:!0}),r(t,a,{value:e._readableState.endEmitted,writable:!0}),r(t,u,{value:function(e,t){var r=f[c].read();r?(f[h]=null,f[n]=null,f[o]=null,e(l(r,!1))):(f[n]=e,f[o]=t)},writable:!0}),t));return f[h]=null,i(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=f[o];return null!==t&&(f[h]=null,f[n]=null,f[o]=null,t(e)),void(f[s]=e)}var r=f[n];null!==r&&(f[h]=null,f[n]=null,f[o]=null,r(l(void 0,!0))),f[a]=!0})),e.on("readable",d.bind(null,f)),f}}const ee=K;ee.Readable=me,me.ReadableState=ve,L.EventEmitter;var te=function(e,t){return e.listeners(t).length},re=I,ie=m.Buffer,ne=e.Uint8Array||function(){};var oe,se=w;oe=se&&se.debuglog?se.debuglog("stream"):function(){};var ae,he,ue,ce=function(){if(x)return M;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}x=1;var i=m.Buffer,n=w.inspect,o=n&&n.custom||"inspect";return M=function(){function s(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),this.head=null,this.tail=null,this.length=0}var a,h,u;return a=s,h=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,r,n,o=i.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,n=a,i.prototype.copy.call(t,r,n),a+=s.data.length,s=s.next;return o}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,i=t.data;for(e-=i.length;t=t.next;){var n=t.data,o=e>n.length?n.length:e;if(o===n.length?i+=n:i+=n.slice(0,e),0==(e-=o)){o===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,s),0==(e-=s)){s===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++n}return this.length-=n,t}},{key:o,value:function(r,i){return n(this,function(r){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?e(Object(n),!0).forEach((function(e){t(r,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}))}return r}({},i,{depth:0,customInspect:!1}))}}],h&&r(a.prototype,h),u&&r(a,u),s}(),M}(),le=D,fe=W.getHighWaterMark,de=B.codes,pe=de.ERR_INVALID_ARG_TYPE,ye=de.ERR_STREAM_PUSH_AFTER_EOF,be=de.ERR_METHOD_NOT_IMPLEMENTED,_e=de.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;E(me,re);var we=le.errorOrDestroy,ge=["error","close","destroy","pause","resume"];function ve(e,t,r){e=e||{},"boolean"!=typeof r&&(r=t instanceof ee.Duplex),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=fe(this,e,"readableHighWaterMark",r),this.buffer=new ce,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&&(ae||(ae=z().StringDecoder),this.decoder=new ae(e.encoding),this.encoding=e.encoding)}function me(e){if(!(this instanceof me))return new me(e);var t=this instanceof ee.Duplex;this._readableState=new ve(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),re.call(this)}function Ee(e,t,r,i,n){oe("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(oe("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?Te(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,Me(e)))}(e,s);else if(n||(o=function(e,t){var r;i=t,ie.isBuffer(i)||i instanceof ne||"string"==typeof t||void 0===t||e.objectMode||(r=new pe("chunk",["string","Buffer","Uint8Array"],t));var i;return r}(s,t)),o)we(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===ie.prototype||(t=function(e){return ie.from(e)}(t)),i)s.endEmitted?we(e,new _e):Se(e,s,t,!0);else if(s.ended)we(e,new ye);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?Se(e,s,t,!1):xe(e,s)):Se(e,s,t,!1)}else i||(s.reading=!1,xe(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function Se(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Te(e)),xe(e,t)}Object.defineProperty(me.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),me.prototype.destroy=le.destroy,me.prototype._undestroy=le.undestroy,me.prototype._destroy=function(e,t){t(e)},me.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=ie.from(e,t),t=""),r=!0),Ee(this,e,t,!1,r)},me.prototype.unshift=function(e){return Ee(this,e,null,!0,!1)},me.prototype.isPaused=function(){return!1===this._readableState.flowing},me.prototype.setEncoding=function(e){ae||(ae=z().StringDecoder);var t=new ae(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var ke=1073741824;function Re(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=ke?e=ke:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Te(e){var r=e._readableState;oe("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(oe("emitReadable",r.flowing),r.emittedReadable=!0,t(Me,e))}function Me(e){var t=e._readableState;oe("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Oe(e)}function xe(e,r){r.readingMore||(r.readingMore=!0,t(Ae,e,r))}function Ae(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(oe("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function Ke(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Le(e){oe("readable nexttick read 0"),e.read(0)}function Ie(e,t){oe("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Oe(e),t.flowing&&!t.reading&&e.read(0)}function Oe(e){var t=e._readableState;for(oe("flow",t.flowing);t.flowing&&null!==e.read(););}function Ce(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function Pe(e){var r=e._readableState;oe("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,t(De,r,e))}function De(e,t){if(oe("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function Be(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}me.prototype.read=function(e){oe("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return oe("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Pe(this):Te(this),null;if(0===(e=Re(e,t))&&t.ended)return 0===t.length&&Pe(this),null;var i,n=t.needReadable;return oe("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&oe("length less than watermark",n=!0),t.ended||t.reading?oe("reading or ended",n=!1):n&&(oe("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Re(r,t))),null===(i=e>0?Ce(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Pe(this)),null!==i&&this.emit("data",i),i},me.prototype._read=function(e){we(this,new be("_read()"))},me.prototype.pipe=function(e,i){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,oe("pipe count=%d opts=%j",o.pipesCount,i);var s=(!i||!1!==i.end)&&e!==r.stdout&&e!==r.stderr?h:y;function a(t,r){oe("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,oe("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",u),e.removeListener("error",f),e.removeListener("unpipe",a),n.removeListener("end",h),n.removeListener("end",y),n.removeListener("data",l),c=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function h(){oe("onend"),e.end()}o.endEmitted?t(s):n.once("end",s),e.on("unpipe",a);var u=function(e){return function(){var t=e._readableState;oe("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&te(e,"data")&&(t.flowing=!0,Oe(e))}}(n);e.on("drain",u);var c=!1;function l(t){oe("ondata");var r=e.write(t);oe("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==Be(o.pipes,e))&&!c&&(oe("false write response, pause",o.awaitDrain),o.awaitDrain++),n.pause())}function f(t){oe("onerror",t),y(),e.removeListener("error",f),0===te(e,"error")&&we(e,t)}function d(){e.removeListener("finish",p),y()}function p(){oe("onfinish"),e.removeListener("close",d),y()}function y(){oe("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",f),e.once("close",d),e.once("finish",p),e.emit("pipe",n),o.flowing||(oe("pipe resume"),n.resume()),e},me.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=Be(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},me.prototype.on=function(e,r){var i=re.prototype.on.call(this,e,r),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,oe("on readable",n.length,n.reading),n.length?Te(this):n.reading||t(Le,this))),i},me.prototype.addListener=me.prototype.on,me.prototype.removeListener=function(e,r){var i=re.prototype.removeListener.call(this,e,r);return"readable"===e&&t(Ke,this),i},me.prototype.removeAllListeners=function(e){var r=re.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||t(Ke,this),r},me.prototype.resume=function(){var e=this._readableState;return e.flowing||(oe("resume"),e.flowing=!e.readableListening,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t(Ie,e,r))}(this,e)),e.paused=!1,this},me.prototype.pause=function(){return oe("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(oe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},me.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(oe("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(oe("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var o=0;o<ge.length;o++)e.on(ge[o],this.emit.bind(this,ge[o]));return this._read=function(t){oe("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(me.prototype[Symbol.asyncIterator]=function(){return void 0===he&&(he=Q()),he(this)}),Object.defineProperty(me.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(me.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(me.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),me._fromList=Ce,Object.defineProperty(me.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(me.from=function(e,t){return void 0===ue&&(ue=J?G:(J=1,G=function(){throw new Error("Readable.from is not available in the browser")})),ue(me,e,t)});var Ne=function(e,t){if(je("noDeprecation"))return e;var r=!1;return function(){if(!r){if(je("throwDeprecation"))throw new Error(t);je("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function je(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}const Ue=K;function Ve(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}Ue.Writable=at,at.WritableState=st;var qe={deprecate:Ne},We=I,Fe=m.Buffer,ze=e.Uint8Array||function(){};var He,$e=D,Ze=W.getHighWaterMark,Xe=B.codes,Ge=Xe.ERR_INVALID_ARG_TYPE,Je=Xe.ERR_METHOD_NOT_IMPLEMENTED,Ye=Xe.ERR_MULTIPLE_CALLBACK,Qe=Xe.ERR_STREAM_CANNOT_PIPE,et=Xe.ERR_STREAM_DESTROYED,tt=Xe.ERR_STREAM_NULL_VALUES,rt=Xe.ERR_STREAM_WRITE_AFTER_END,it=Xe.ERR_UNKNOWN_ENCODING,nt=$e.errorOrDestroy;function ot(){}function st(e,r,i){e=e||{},"boolean"!=typeof i&&(i=r instanceof Ue.Duplex),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Ze(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=!1===e.decodeStrings;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var i=e._writableState,n=i.sync,o=i.writecb;if("function"!=typeof o)throw new Ye;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(i),r)!function(e,r,i,n,o){--r.pendingcb,i?(t(o,n),t(dt,e,r),e._writableState.errorEmitted=!0,nt(e,n)):(o(n),e._writableState.errorEmitted=!0,nt(e,n),dt(e,r))}(e,i,n,r,o);else{var s=lt(i)||e.destroyed;s||i.corked||i.bufferProcessing||!i.bufferedRequest||ct(e,i),n?t(ut,e,i,s,o):ut(e,i,s,o)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ve(this)}function at(e){var t=this instanceof Ue.Duplex;if(!t&&!He.call(at,this))return new at(e);this._writableState=new st(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),We.call(this)}function ht(e,t,r,i,n,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new et("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function ut(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),dt(e,t)}function ct(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)n[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;n.allBuffers=a,ht(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Ve(t),t.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,u=r.encoding,c=r.callback;if(ht(e,t,!1,t.objectMode?1:h.length,h,u,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function lt(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function ft(e,t){e._final((function(r){t.pendingcb--,r&&nt(e,r),t.prefinished=!0,e.emit("prefinish"),dt(e,t)}))}function dt(e,r){var i=lt(r);if(i&&(function(e,r){r.prefinished||r.finalCalled||("function"!=typeof e._final||r.destroyed?(r.prefinished=!0,e.emit("prefinish")):(r.pendingcb++,r.finalCalled=!0,t(ft,e,r)))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"),r.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return i}E(at,We),st.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(st.prototype,"buffer",{get:qe.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(He=Function.prototype[Symbol.hasInstance],Object.defineProperty(at,Symbol.hasInstance,{value:function(e){return!!He.call(this,e)||this===at&&(e&&e._writableState instanceof st)}})):He=function(e){return e instanceof this},at.prototype.pipe=function(){nt(this,new Qe)},at.prototype.write=function(e,r,i){var n,o=this._writableState,s=!1,a=!o.objectMode&&(n=e,Fe.isBuffer(n)||n instanceof ze);return a&&!Fe.isBuffer(e)&&(e=function(e){return Fe.from(e)}(e)),"function"==typeof r&&(i=r,r=null),a?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof i&&(i=ot),o.ending?function(e,r){var i=new rt;nt(e,i),t(r,i)}(this,i):(a||function(e,r,i,n){var o;return null===i?o=new tt:"string"==typeof i||r.objectMode||(o=new Ge("chunk",["string","Buffer"],i)),!o||(nt(e,o),t(n,o),!1)}(this,o,e,i))&&(o.pendingcb++,s=function(e,t,r,i,n,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Fe.from(t,r));return t}(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var a=t.objectMode?1:i.length;t.length+=a;var h=t.length<t.highWaterMark;h||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else ht(e,t,!1,a,i,n,o);return h}(this,o,a,e,r,i)),s},at.prototype.cork=function(){this._writableState.corked++},at.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||ct(this,e))},at.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new it(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(at.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(at.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),at.prototype._write=function(e,t,r){r(new Je("_write()"))},at.prototype._writev=null,at.prototype.end=function(e,r,i){var n=this._writableState;return"function"==typeof e?(i=e,e=null,r=null):"function"==typeof r&&(i=r,r=null),null!=e&&this.write(e,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,r,i){r.ending=!0,dt(e,r),i&&(r.finished?t(i):e.once("finish",i));r.ended=!0,e.writable=!1}(this,n,i),this},Object.defineProperty(at.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(at.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),at.prototype.destroy=$e.destroy,at.prototype._undestroy=$e.undestroy,at.prototype._destroy=function(e,t){t(e)};var pt=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};const yt=K;yt.Duplex=gt,E(gt,yt.Readable);for(var bt=pt(yt.Writable.prototype),_t=0;_t<bt.length;_t++){var wt=bt[_t];gt.prototype[wt]||(gt.prototype[wt]=yt.Writable.prototype[wt])}function gt(e){if(!(this instanceof gt))return new gt(e);yt.Readable.call(this,e),yt.Writable.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",vt)))}function vt(){this._writableState.ended||t(mt,this)}function mt(e){e.end()}Object.defineProperty(gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(gt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(gt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(gt.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});const Et=K;Et.Transform=At;var St=B.codes,kt=St.ERR_METHOD_NOT_IMPLEMENTED,Rt=St.ERR_MULTIPLE_CALLBACK,Tt=St.ERR_TRANSFORM_ALREADY_TRANSFORMING,Mt=St.ERR_TRANSFORM_WITH_LENGTH_0;function xt(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new Rt);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function At(e){if(!(this instanceof At))return new At(e);Et.Duplex.call(this,e),this._transformState={afterTransform:xt.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Kt)}function Kt(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Lt(this,null,null):this._flush((function(t,r){Lt(e,t,r)}))}function Lt(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Mt;if(e._transformState.transforming)throw new Tt;return e.push(null)}E(At,Et.Duplex),At.prototype.push=function(e,t){return this._transformState.needTransform=!1,Et.Duplex.prototype.push.call(this,e,t)},At.prototype._transform=function(e,t,r){r(new kt("_transform()"))},At.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},At.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},At.prototype._destroy=function(e,t){Et.Duplex.prototype._destroy.call(this,e,(function(e){t(e)}))};const It=K;function Ot(e){if(!(this instanceof Ot))return new Ot(e);Transform.call(this,e)}var Ct;It.PassThrough=Ot,E(Ot,It.Transform),Ot.prototype._transform=function(e,t,r){r(null,e)};var Pt=B.codes,Dt=Pt.ERR_MISSING_ARGS,Bt=Pt.ERR_STREAM_DESTROYED;function Nt(e){if(e)throw e}function jt(e){e()}function Ut(e,t){return e.pipe(t)}var Vt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i,n=function(e){return e.length?"function"!=typeof e[e.length-1]?Nt:e.pop():Nt}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Dt("streams");var o=t.map((function(e,r){var s=r<t.length-1;return function(e,t,r,i){i=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(i);var n=!1;e.on("close",(function(){n=!0})),void 0===Ct&&(Ct=Y),Ct(e,{readable:t,writable:r},(function(e){if(e)return i(e);n=!0,i()}));var o=!1;return function(t){if(!n&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void i(t||new Bt("pipe"))}}(e,s,r>0,(function(e){i||(i=e),e&&o.forEach(jt),s||(o.forEach(jt),n(i))}))}));return t.reduce(Ut)};!function(e,t){const r=K;(t=A.exports=r.Readable).Stream=r.Readable,t.Readable=r.Readable,t.Writable=r.Writable,t.Duplex=r.Duplex,t.Transform=r.Transform,t.PassThrough=r.PassThrough,t.finished=Y,t.pipeline=Vt}(0,A.exports);var qt=A.exports,Wt=p.Buffer,Ft=qt;function zt(e){Ft.Stream.Transform.call(this),this._block=Wt.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}E(zt,Ft.Stream.Transform),zt.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},zt.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},zt.prototype.update=function(e,t){if(function(e,t){if(!Wt.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");Wt.isBuffer(e)||(e=Wt.from(e,t));for(var r=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var n=this._blockOffset;n<this._blockSize;)r[n++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)r[this._blockOffset++]=e[i++];for(var o=0,s=8*e.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},zt.prototype._update=function(){throw new Error("_update is not implemented")},zt.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},zt.prototype._digest=function(){throw new Error("_digest is not implemented")};var Ht=zt,$t=E,Zt=Ht,Xt=p.Buffer,Gt=new Array(16);function Jt(){Zt.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function Yt(e,t){return e<<t|e>>>32-t}function Qt(e,t,r,i,n,o,s){return Yt(e+(t&r|~t&i)+n+o|0,s)+t|0}function er(e,t,r,i,n,o,s){return Yt(e+(t&i|r&~i)+n+o|0,s)+t|0}function tr(e,t,r,i,n,o,s){return Yt(e+(t^r^i)+n+o|0,s)+t|0}function rr(e,t,r,i,n,o,s){return Yt(e+(r^(t|~i))+n+o|0,s)+t|0}$t(Jt,Zt),Jt.prototype._update=function(){for(var e=Gt,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,i=this._b,n=this._c,o=this._d;r=Qt(r,i,n,o,e[0],3614090360,7),o=Qt(o,r,i,n,e[1],3905402710,12),n=Qt(n,o,r,i,e[2],606105819,17),i=Qt(i,n,o,r,e[3],3250441966,22),r=Qt(r,i,n,o,e[4],4118548399,7),o=Qt(o,r,i,n,e[5],1200080426,12),n=Qt(n,o,r,i,e[6],2821735955,17),i=Qt(i,n,o,r,e[7],4249261313,22),r=Qt(r,i,n,o,e[8],1770035416,7),o=Qt(o,r,i,n,e[9],2336552879,12),n=Qt(n,o,r,i,e[10],4294925233,17),i=Qt(i,n,o,r,e[11],2304563134,22),r=Qt(r,i,n,o,e[12],1804603682,7),o=Qt(o,r,i,n,e[13],4254626195,12),n=Qt(n,o,r,i,e[14],2792965006,17),r=er(r,i=Qt(i,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=er(o,r,i,n,e[6],3225465664,9),n=er(n,o,r,i,e[11],643717713,14),i=er(i,n,o,r,e[0],3921069994,20),r=er(r,i,n,o,e[5],3593408605,5),o=er(o,r,i,n,e[10],38016083,9),n=er(n,o,r,i,e[15],3634488961,14),i=er(i,n,o,r,e[4],3889429448,20),r=er(r,i,n,o,e[9],568446438,5),o=er(o,r,i,n,e[14],3275163606,9),n=er(n,o,r,i,e[3],4107603335,14),i=er(i,n,o,r,e[8],1163531501,20),r=er(r,i,n,o,e[13],2850285829,5),o=er(o,r,i,n,e[2],4243563512,9),n=er(n,o,r,i,e[7],1735328473,14),r=tr(r,i=er(i,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=tr(o,r,i,n,e[8],2272392833,11),n=tr(n,o,r,i,e[11],1839030562,16),i=tr(i,n,o,r,e[14],4259657740,23),r=tr(r,i,n,o,e[1],2763975236,4),o=tr(o,r,i,n,e[4],1272893353,11),n=tr(n,o,r,i,e[7],4139469664,16),i=tr(i,n,o,r,e[10],3200236656,23),r=tr(r,i,n,o,e[13],681279174,4),o=tr(o,r,i,n,e[0],3936430074,11),n=tr(n,o,r,i,e[3],3572445317,16),i=tr(i,n,o,r,e[6],76029189,23),r=tr(r,i,n,o,e[9],3654602809,4),o=tr(o,r,i,n,e[12],3873151461,11),n=tr(n,o,r,i,e[15],530742520,16),r=rr(r,i=tr(i,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=rr(o,r,i,n,e[7],1126891415,10),n=rr(n,o,r,i,e[14],2878612391,15),i=rr(i,n,o,r,e[5],4237533241,21),r=rr(r,i,n,o,e[12],1700485571,6),o=rr(o,r,i,n,e[3],2399980690,10),n=rr(n,o,r,i,e[10],4293915773,15),i=rr(i,n,o,r,e[1],2240044497,21),r=rr(r,i,n,o,e[8],1873313359,6),o=rr(o,r,i,n,e[15],4264355552,10),n=rr(n,o,r,i,e[6],2734768916,15),i=rr(i,n,o,r,e[13],1309151649,21),r=rr(r,i,n,o,e[4],4149444226,6),o=rr(o,r,i,n,e[11],3174756917,10),n=rr(n,o,r,i,e[2],718787259,15),i=rr(i,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},Jt.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=Xt.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var ir=Jt,nr=m.Buffer,or=E,sr=Ht,ar=new Array(16),hr=[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],ur=[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],cr=[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],lr=[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],fr=[0,1518500249,1859775393,2400959708,2840853838],dr=[1352829926,1548603684,1836072691,2053994217,0];function pr(){sr.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function yr(e,t){return e<<t|e>>>32-t}function br(e,t,r,i,n,o,s,a){return yr(e+(t^r^i)+o+s|0,a)+n|0}function _r(e,t,r,i,n,o,s,a){return yr(e+(t&r|~t&i)+o+s|0,a)+n|0}function wr(e,t,r,i,n,o,s,a){return yr(e+((t|~r)^i)+o+s|0,a)+n|0}function gr(e,t,r,i,n,o,s,a){return yr(e+(t&i|r&~i)+o+s|0,a)+n|0}function vr(e,t,r,i,n,o,s,a){return yr(e+(t^(r|~i))+o+s|0,a)+n|0}or(pr,sr),pr.prototype._update=function(){for(var e=ar,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,s=0|this._e,a=0|this._a,h=0|this._b,u=0|this._c,c=0|this._d,l=0|this._e,f=0;f<80;f+=1){var d,p;f<16?(d=br(r,i,n,o,s,e[hr[f]],fr[0],cr[f]),p=vr(a,h,u,c,l,e[ur[f]],dr[0],lr[f])):f<32?(d=_r(r,i,n,o,s,e[hr[f]],fr[1],cr[f]),p=gr(a,h,u,c,l,e[ur[f]],dr[1],lr[f])):f<48?(d=wr(r,i,n,o,s,e[hr[f]],fr[2],cr[f]),p=wr(a,h,u,c,l,e[ur[f]],dr[2],lr[f])):f<64?(d=gr(r,i,n,o,s,e[hr[f]],fr[3],cr[f]),p=_r(a,h,u,c,l,e[ur[f]],dr[3],lr[f])):(d=vr(r,i,n,o,s,e[hr[f]],fr[4],cr[f]),p=br(a,h,u,c,l,e[ur[f]],dr[4],lr[f])),r=s,s=o,o=yr(n,10),n=i,i=d,a=l,l=c,c=yr(u,10),u=h,h=p}var y=this._b+n+c|0;this._b=this._c+o+l|0,this._c=this._d+s+a|0,this._d=this._e+r+h|0,this._e=this._a+i+u|0,this._a=y},pr.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=nr.alloc?nr.alloc(20):new nr(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};var mr=pr,Er={exports:{}},Sr=p.Buffer;function kr(e,t){this._block=Sr.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}kr.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=Sr.from(e,t));for(var r=this._block,i=this._blockSize,n=e.length,o=this._len,s=0;s<n;){for(var a=o%i,h=Math.min(n-s,i-a),u=0;u<h;u++)r[a+u]=e[s+u];s+=h,(o+=h)%i==0&&this._update(r)}return this._len+=n,this},kr.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},kr.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Rr=kr,Tr=E,Mr=Rr,xr=p.Buffer,Ar=[1518500249,1859775393,-1894007588,-899497514],Kr=new Array(80);function Lr(){this.init(),this._w=Kr,Mr.call(this,64,56)}function Ir(e){return e<<30|e>>>2}function Or(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}Tr(Lr,Mr),Lr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Lr.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var u=0;u<80;++u){var c=~~(u/20),l=0|((t=i)<<5|t>>>27)+Or(c,n,o,s)+a+r[u]+Ar[c];a=s,s=o,o=Ir(n),n=i,i=l}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Lr.prototype._hash=function(){var e=xr.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Cr=Lr,Pr=E,Dr=Rr,Br=p.Buffer,Nr=[1518500249,1859775393,-1894007588,-899497514],jr=new Array(80);function Ur(){this.init(),this._w=jr,Dr.call(this,64,56)}function Vr(e){return e<<5|e>>>27}function qr(e){return e<<30|e>>>2}function Wr(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}Pr(Ur,Dr),Ur.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Ur.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<80;++h)r[h]=(t=r[h-3]^r[h-8]^r[h-14]^r[h-16])<<1|t>>>31;for(var u=0;u<80;++u){var c=~~(u/20),l=Vr(i)+Wr(c,n,o,s)+a+r[u]+Nr[c]|0;a=s,s=o,o=qr(n),n=i,i=l}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Ur.prototype._hash=function(){var e=Br.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Fr=Ur,zr=E,Hr=Rr,$r=p.Buffer,Zr=[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],Xr=new Array(64);function Gr(){this.init(),this._w=Xr,Hr.call(this,64,56)}function Jr(e,t,r){return r^e&(t^r)}function Yr(e,t,r){return e&t|r&(e|t)}function Qr(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function ei(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function ti(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}zr(Gr,Hr),Gr.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},Gr.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0|this._f,u=0|this._g,c=0|this._h,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<64;++l)r[l]=0|(((t=r[l-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[l-7]+ti(r[l-15])+r[l-16];for(var f=0;f<64;++f){var d=c+ei(a)+Jr(a,h,u)+Zr[f]+r[f]|0,p=Qr(i)+Yr(i,n,o)|0;c=u,u=h,h=a,a=s+d|0,s=o,o=n,n=i,i=d+p|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=h+this._f|0,this._g=u+this._g|0,this._h=c+this._h|0},Gr.prototype._hash=function(){var e=$r.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var ri=Gr,ii=E,ni=ri,oi=Rr,si=p.Buffer,ai=new Array(64);function hi(){this.init(),this._w=ai,oi.call(this,64,56)}ii(hi,ni),hi.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},hi.prototype._hash=function(){var e=si.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var ui=hi,ci=E,li=Rr,fi=p.Buffer,di=[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],pi=new Array(160);function yi(){this.init(),this._w=pi,li.call(this,128,112)}function bi(e,t,r){return r^e&(t^r)}function _i(e,t,r){return e&t|r&(e|t)}function wi(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function gi(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function vi(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function mi(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Ei(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Si(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function ki(e,t){return e>>>0<t>>>0?1:0}ci(yi,li),yi.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},yi.prototype._update=function(e){for(var t=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,h=0|this._gh,u=0|this._hh,c=0|this._al,l=0|this._bl,f=0|this._cl,d=0|this._dl,p=0|this._el,y=0|this._fl,b=0|this._gl,_=0|this._hl,w=0;w<32;w+=2)t[w]=e.readInt32BE(4*w),t[w+1]=e.readInt32BE(4*w+4);for(;w<160;w+=2){var g=t[w-30],v=t[w-30+1],m=vi(g,v),E=mi(v,g),S=Ei(g=t[w-4],v=t[w-4+1]),k=Si(v,g),R=t[w-14],T=t[w-14+1],M=t[w-32],x=t[w-32+1],A=E+T|0,K=m+R+ki(A,E)|0;K=(K=K+S+ki(A=A+k|0,k)|0)+M+ki(A=A+x|0,x)|0,t[w]=K,t[w+1]=A}for(var L=0;L<160;L+=2){K=t[L],A=t[L+1];var I=_i(r,i,n),O=_i(c,l,f),C=wi(r,c),P=wi(c,r),D=gi(s,p),B=gi(p,s),N=di[L],j=di[L+1],U=bi(s,a,h),V=bi(p,y,b),q=_+B|0,W=u+D+ki(q,_)|0;W=(W=(W=W+U+ki(q=q+V|0,V)|0)+N+ki(q=q+j|0,j)|0)+K+ki(q=q+A|0,A)|0;var F=P+O|0,z=C+I+ki(F,P)|0;u=h,_=b,h=a,b=y,a=s,y=p,s=o+W+ki(p=d+q|0,d)|0,o=n,d=f,n=i,f=l,i=r,l=c,r=W+z+ki(c=q+F|0,q)|0}this._al=this._al+c|0,this._bl=this._bl+l|0,this._cl=this._cl+f|0,this._dl=this._dl+d|0,this._el=this._el+p|0,this._fl=this._fl+y|0,this._gl=this._gl+b|0,this._hl=this._hl+_|0,this._ah=this._ah+r+ki(this._al,c)|0,this._bh=this._bh+i+ki(this._bl,l)|0,this._ch=this._ch+n+ki(this._cl,f)|0,this._dh=this._dh+o+ki(this._dl,d)|0,this._eh=this._eh+s+ki(this._el,p)|0,this._fh=this._fh+a+ki(this._fl,y)|0,this._gh=this._gh+h+ki(this._gl,b)|0,this._hh=this._hh+u+ki(this._hl,_)|0},yi.prototype._hash=function(){var e=fi.allocUnsafe(64);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Ri=yi,Ti=E,Mi=Ri,xi=Rr,Ai=p.Buffer,Ki=new Array(160);function Li(){this.init(),this._w=Ki,xi.call(this,128,112)}Ti(Li,Mi),Li.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},Li.prototype._hash=function(){var e=Ai.allocUnsafe(48);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Ii=Li,Oi=Er.exports=function(e){e=e.toLowerCase();var t=Oi[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Oi.sha=Cr,Oi.sha1=Fr,Oi.sha224=ui,Oi.sha256=ri,Oi.sha384=Ii,Oi.sha512=Ri;var Ci=Er.exports,Pi=h(c),Di=p.Buffer,Bi=y.Transform,Ni=Pi.StringDecoder;function ji(e){Bi.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}E(ji,Bi),ji.prototype.update=function(e,t,r){"string"==typeof e&&(e=Di.from(e,t));var i=this._update(e);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},ji.prototype.setAutoPadding=function(){},ji.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},ji.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},ji.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},ji.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){i=e}finally{r(i)}},ji.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},ji.prototype._finalOrDigest=function(e){var t=this.__final()||Di.alloc(0);return e&&(t=this._toString(t,e,!0)),t},ji.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new Ni(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i};var Ui=ir,Vi=mr,qi=Ci,Wi=ji;function Fi(e){Wi.call(this,"digest"),this._hash=e}E(Fi,Wi),Fi.prototype._update=function(e){this._hash.update(e)},Fi.prototype._final=function(){return this._hash.digest()};var zi=l((function(e){return"md5"===(e=e.toLowerCase())?new Ui:"rmd160"===e||"ripemd160"===e?new Vi:new Fi(qi(e))}));const Hi=new(0,S.ec)("secp256k1"),$i=Hi.curve,Zi=$i.n.constructor;function Xi(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new Zi(t);if(r.cmp($i.p)>=0)return null;r=r.toRed($i.red);let i=r.redSqr().redIMul(r).redIAdd($i.b).redSqrt();return 3===e!==i.isOdd()&&(i=i.redNeg()),Hi.keyPair({pub:{x:r,y:i}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let i=new Zi(t),n=new Zi(r);if(i.cmp($i.p)>=0||n.cmp($i.p)>=0)return null;if(i=i.toRed($i.red),n=n.toRed($i.red),(6===e||7===e)&&n.isOdd()!==(7===e))return null;const o=i.redSqr().redIMul(i);return n.redSqr().redISub(o.redIAdd($i.b)).isZero()?Hi.keyPair({pub:{x:i,y:n}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function Gi(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}var Ji={contextRandomize:()=>0,privateKeyVerify(e){const t=new Zi(e);return t.cmp($i.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new Zi(e),r=$i.n.sub(t).umod($i.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new Zi(t);if(r.cmp($i.n)>=0)return 1;if(r.iadd(new Zi(e)),r.cmp($i.n)>=0&&r.isub($i.n),r.isZero())return 1;const i=r.toArrayLike(Uint8Array,"be",32);return e.set(i),0},privateKeyTweakMul(e,t){let r=new Zi(t);if(r.cmp($i.n)>=0||r.isZero())return 1;r.imul(new Zi(e)),r.cmp($i.n)>=0&&(r=r.umod($i.n));const i=r.toArrayLike(Uint8Array,"be",32);return e.set(i),0},publicKeyVerify:e=>null===Xi(e)?1:0,publicKeyCreate(e,t){const r=new Zi(t);if(r.cmp($i.n)>=0||r.isZero())return 1;return Gi(e,Hi.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=Xi(t);if(null===r)return 1;return Gi(e,r.getPublic()),0},publicKeyNegate(e,t){const r=Xi(t);if(null===r)return 1;const i=r.getPublic();return i.y=i.y.redNeg(),Gi(e,i),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=Xi(t[e]),null===r[e])return 1;let i=r[0].getPublic();for(let e=1;e<r.length;++e)i=i.add(r[e].pub);return i.isInfinity()?2:(Gi(e,i),0)},publicKeyTweakAdd(e,t,r){const i=Xi(t);if(null===i)return 1;if((r=new Zi(r)).cmp($i.n)>=0)return 2;const n=i.getPublic().add($i.g.mul(r));return n.isInfinity()?2:(Gi(e,n),0)},publicKeyTweakMul(e,t,r){const i=Xi(t);if(null===i)return 1;if((r=new Zi(r)).cmp($i.n)>=0||r.isZero())return 2;return Gi(e,i.getPublic().mul(r)),0},signatureNormalize(e){const t=new Zi(e.subarray(0,32)),r=new Zi(e.subarray(32,64));return t.cmp($i.n)>=0||r.cmp($i.n)>=0?1:(1===r.cmp(Hi.nh)&&e.set($i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),i=t.subarray(32,64);if(new Zi(r).cmp($i.n)>=0)return 1;if(new Zi(i).cmp($i.n)>=0)return 1;const{output:n}=e;let o=n.subarray(4,37);o[0]=0,o.set(r,1);let s=33,a=0;for(;s>1&&0===o[a]&&!(128&o[a+1]);--s,++a);if(o=o.subarray(a),128&o[0])return 1;if(s>1&&0===o[0]&&!(128&o[1]))return 1;let h=n.subarray(39,72);h[0]=0,h.set(i,1);let u=33,c=0;for(;u>1&&0===h[c]&&!(128&h[c+1]);--u,++c);return h=h.subarray(c),128&h[0]||u>1&&0===h[0]&&!(128&h[1])?1:(e.outputlen=6+s+u,n[0]=48,n[1]=e.outputlen-2,n[2]=2,n[3]=o.length,n.set(o,4),n[4+s]=2,n[5+s]=h.length,n.set(h,6+s),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const i=t[5+r];if(0===i)return 1;if(6+r+i!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(i>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let n=t.subarray(4,4+r);if(33===n.length&&0===n[0]&&(n=n.subarray(1)),n.length>32)return 1;let o=t.subarray(6+r);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let s=new Zi(n);s.cmp($i.n)>=0&&(s=new Zi(0));let a=new Zi(t.subarray(6+r));return a.cmp($i.n)>=0&&(a=new Zi(0)),e.set(s.toArrayLike(Uint8Array,"be",32),0),e.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,i,n){if(n){const e=n;n=n=>{const o=e(t,r,null,i,n);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new Zi(o)}}const o=new Zi(r);if(o.cmp($i.n)>=0||o.isZero())return 1;let s;try{s=Hi.sign(t,r,{canonical:!0,k:n,pers:i})}catch(e){return 1}return e.signature.set(s.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(s.s.toArrayLike(Uint8Array,"be",32),32),e.recid=s.recoveryParam,0},ecdsaVerify(e,t,r){const i={r:e.subarray(0,32),s:e.subarray(32,64)},n=new Zi(i.r),o=new Zi(i.s);if(n.cmp($i.n)>=0||o.cmp($i.n)>=0)return 1;if(1===o.cmp(Hi.nh)||n.isZero()||o.isZero())return 3;const s=Xi(r);if(null===s)return 2;const a=s.getPublic();return Hi.verify(t,i,a)?0:3},ecdsaRecover(e,t,r,i){const n={r:t.slice(0,32),s:t.slice(32,64)},o=new Zi(n.r),s=new Zi(n.s);if(o.cmp($i.n)>=0||s.cmp($i.n)>=0)return 1;if(o.isZero()||s.isZero())return 2;let a;try{a=Hi.recoverPubKey(i,n,r)}catch(e){return 2}return Gi(e,a),0},ecdh(e,t,r,i,n,o,s){const a=Xi(t);if(null===a)return 1;const h=new Zi(r);if(h.cmp($i.n)>=0||h.isZero())return 2;const u=a.getPublic().mul(h);if(void 0===n){const t=u.encode(null,!0),r=Hi.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{o||(o=new Uint8Array(32));const t=u.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];s||(s=new Uint8Array(32));const r=u.getY().toArray("be",32);for(let e=0;e<32;++e)s[e]=r[e];const a=n(o,s,i);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}};const Yi="Impossible case. Please create issue.",Qi="The tweak was out of range or the resulted private key is invalid",en="The tweak was out of range or equal to zero",tn="Unknow error on context randomization",rn="Private Key is invalid",nn="Public Key could not be parsed",on="Public Key serialization error",sn="The sum of the public keys is not valid",an="Signature could not be parsed",hn="The nonce generation function failed, or the private key was invalid",un="Public key could not be recover",cn="Scalar was invalid (zero or overflow)";function ln(e,t){if(!e)throw new Error(t)}function fn(e,t,r){if(ln(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const i=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;ln(r.includes(t.length),i)}else{const i=`Expected ${e} to be an Uint8Array with length ${r}`;ln(t.length===r,i)}}function dn(e){ln("Boolean"===yn(e),"Expected compressed to be a Boolean")}function pn(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),fn("output",e,t),e}function yn(e){return Object.prototype.toString.call(e).slice(8,-1)}var bn=(e=>({contextRandomize(t){if(ln(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&fn("seed",t,32),1===e.contextRandomize(t))throw new Error(tn)},privateKeyVerify:t=>(fn("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(fn("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(Yi)}},privateKeyTweakAdd(t,r){switch(fn("private key",t,32),fn("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(Qi)}},privateKeyTweakMul(t,r){switch(fn("private key",t,32),fn("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(en)}},publicKeyVerify:t=>(fn("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,i){switch(fn("private key",t,32),dn(r),i=pn(i,r?33:65),e.publicKeyCreate(i,t)){case 0:return i;case 1:throw new Error(rn);case 2:throw new Error(on)}},publicKeyConvert(t,r=!0,i){switch(fn("public key",t,[33,65]),dn(r),i=pn(i,r?33:65),e.publicKeyConvert(i,t)){case 0:return i;case 1:throw new Error(nn);case 2:throw new Error(on)}},publicKeyNegate(t,r=!0,i){switch(fn("public key",t,[33,65]),dn(r),i=pn(i,r?33:65),e.publicKeyNegate(i,t)){case 0:return i;case 1:throw new Error(nn);case 2:throw new Error(Yi);case 3:throw new Error(on)}},publicKeyCombine(t,r=!0,i){ln(Array.isArray(t),"Expected public keys to be an Array"),ln(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)fn("public key",e,[33,65]);switch(dn(r),i=pn(i,r?33:65),e.publicKeyCombine(i,t)){case 0:return i;case 1:throw new Error(nn);case 2:throw new Error(sn);case 3:throw new Error(on)}},publicKeyTweakAdd(t,r,i=!0,n){switch(fn("public key",t,[33,65]),fn("tweak",r,32),dn(i),n=pn(n,i?33:65),e.publicKeyTweakAdd(n,t,r)){case 0:return n;case 1:throw new Error(nn);case 2:throw new Error(Qi)}},publicKeyTweakMul(t,r,i=!0,n){switch(fn("public key",t,[33,65]),fn("tweak",r,32),dn(i),n=pn(n,i?33:65),e.publicKeyTweakMul(n,t,r)){case 0:return n;case 1:throw new Error(nn);case 2:throw new Error(en)}},signatureNormalize(t){switch(fn("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(an)}},signatureExport(t,r){fn("signature",t,64);const i={output:r=pn(r,72),outputlen:72};switch(e.signatureExport(i,t)){case 0:return r.slice(0,i.outputlen);case 1:throw new Error(an);case 2:throw new Error(Yi)}},signatureImport(t,r){switch(fn("signature",t),r=pn(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(an);case 2:throw new Error(Yi)}},ecdsaSign(t,r,i={},n){fn("message",t,32),fn("private key",r,32),ln("Object"===yn(i),"Expected options to be an Object"),void 0!==i.data&&fn("options.data",i.data),void 0!==i.noncefn&&ln("Function"===yn(i.noncefn),"Expected options.noncefn to be a Function");const o={signature:n=pn(n,64),recid:null};switch(e.ecdsaSign(o,t,r,i.data,i.noncefn)){case 0:return o;case 1:throw new Error(hn);case 2:throw new Error(Yi)}},ecdsaVerify(t,r,i){switch(fn("signature",t,64),fn("message",r,32),fn("public key",i,[33,65]),e.ecdsaVerify(t,r,i)){case 0:return!0;case 3:return!1;case 1:throw new Error(an);case 2:throw new Error(nn)}},ecdsaRecover(t,r,i,n=!0,o){switch(fn("signature",t,64),ln("Number"===yn(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),fn("message",i,32),dn(n),o=pn(o,n?33:65),e.ecdsaRecover(o,t,r,i)){case 0:return o;case 1:throw new Error(an);case 2:throw new Error(un);case 3:throw new Error(Yi)}},ecdh(t,r,i={},n){switch(fn("public key",t,[33,65]),fn("private key",r,32),ln("Object"===yn(i),"Expected options to be an Object"),void 0!==i.data&&fn("options.data",i.data),void 0!==i.hashfn?(ln("Function"===yn(i.hashfn),"Expected options.hashfn to be a Function"),void 0!==i.xbuf&&fn("options.xbuf",i.xbuf,32),void 0!==i.ybuf&&fn("options.ybuf",i.ybuf,32),fn("output",n)):n=pn(n,32),e.ecdh(n,t,r,i.data,i.hashfn,i.xbuf,i.ybuf)){case 0:return n;case 1:throw new Error(nn);case 2:throw new Error(cn)}}}))(Ji),_n=l(bn),wn={exports:{}},gn=65536,vn=4294967295;var mn=p.Buffer,En=e.crypto||e.msCrypto;En&&En.getRandomValues?wn.exports=function(e,r){if(e>vn)throw new RangeError("requested too many random bytes");var i=mn.allocUnsafe(e);if(e>0)if(e>gn)for(var n=0;n<e;n+=gn)En.getRandomValues(i.slice(n,n+gn));else En.getRandomValues(i);if("function"==typeof r)return t((function(){r(null,i)}));return i}:wn.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var Sn=l(wn.exports);var kn={CryptoLD:class{constructor({suites:e}={}){this.suites=e||new Map}use(e){this.suites.set(e.suite,e)}async generate(e={}){return this._suiteForType(e).generate(e)}async from(e={}){const t=this._suiteForType(e);return e["@context"]?t.fromKeyDocument({document:e}):t.from(e)}async fromKeyDocument({document:e,checkContext:t=!0,checkRevoked:r=!0}={}){if(!e)throw new TypeError('The "document" parameter is required.');return this._suiteForType(e).fromKeyDocument({document:e,checkContext:t,checkRevoked:r})}async fromKeyId({id:e,documentLoader:t,checkContext:r=!0,checkRevoked:i=!0}={}){if(!e)throw new TypeError('The "id" parameter is required.');if(!t)throw new TypeError('The "documentLoader" parameter is required.');let n;try{if(({document:n}=await t(e)),!n)throw new Error('The "documentLoader" function must return a "document" object.')}catch(e){const t=new Error("Error fetching document: "+e.message);throw t.cause=e,t}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:r,checkRevoked:i})}_installed({type:e}){return this.suites.has(e)}_suiteForType(e){const t=e&&e.type;if(!t)throw new TypeError("Missing key type.");if(!this._installed({type:t}))throw new Error(`Support for key type "${t}" is not installed.`);return this.suites.get(t)}}};
1
+ import{a as e,t,p as r,B as i,d as n,h as o,f as s,V as a,u as h,v as u,w as c,g as l}from"./main.js";import{j as f}from"./jsonld-signatures-ooFWZVS--ThP8ltUY.js";import{j as d}from"./jsonld-CXlzLf4P-ioHKtwiZ.js";import{s as p,b as y,d as b,r as _,a as w,k as g,e as v}from"./index-MC635rre-_DW5MUyk.js";import{r as m,i as E,e as S}from"./elliptic-il_lPAr--VPyWJbY1.js";import{d as k,e as R}from"./index-CZOUZnn4-Lnb5-WZi.js";import{S as T}from"./Suite-Bhitn5l3-e2QgHGhx.js";import"./pako.esm-jjCKMBM4-RAILONW0.js";import"./sha256-wKeS8_4l-9eo2gOQb.js";import"./index-xsnp_Fid-o1HUYRUQ.js";var M,x,A={exports:{}},K={},L=h(u),I=L.EventEmitter;function O(e,t){P(e,t),C(e)}function C(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function P(e,t){e.emit("error",t)}var D={destroy:function(e,r){var i=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t(P,this,e)):t(P,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!r&&e?i._writableState?i._writableState.errorEmitted?t(C,i):(i._writableState.errorEmitted=!0,t(O,i,e)):t(O,i,e):r?(t(C,i),r(e)):t(C,i)})),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(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}},B={};var N={};function j(e,t,r){r||(r=Error);var i=function(e){var r,i;function n(r,i,n){return e.call(this,function(e,r,i){return"string"==typeof t?t:t(e,r,i)}(r,i,n))||this}return i=e,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);i.prototype.name=r.name,i.prototype.code=e,N[e]=i}function U(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}j("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),j("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,n,o,s;if("string"==typeof t&&(n="not ",t.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(U(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(a," ").concat(i," ").concat(U(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),j("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),j("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),j("ERR_STREAM_PREMATURE_CLOSE","Premature close"),j("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),j("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),j("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),j("ERR_STREAM_WRITE_AFTER_END","write after end"),j("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),j("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),j("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),B.codes=N;var V=B.codes.ERR_INVALID_OPT_VALUE;var q,W={getHighWaterMark:function(e,t,r,i){var n=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new V(i?r:"highWaterMark",n);return Math.floor(n)}return e.objectMode?16:16384}},F={};function z(){if(q)return F;q=1;var e=p.Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.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 r(r){var i;switch(this.encoding=function(r){var i=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(r);if("string"!=typeof i&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=a,this.end=h,i=3;break;default:return this.write=u,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(i)}function i(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function n(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function s(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function a(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}return F.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var o=i(t[n]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--n<r||-2===o)return 0;if(o=i(t[n]),o>=0)return o>0&&(e.lastNeed=o-2),o;if(--n<r||-2===o)return 0;if(o=i(t[n]),o>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},r.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},F}var H=B.codes.ERR_STREAM_PREMATURE_CLOSE;function $(){}var Z,X,G,J,Y=function e(t,r,i){if("function"==typeof r)return e(t,null,r);r||(r={}),i=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}(i||$);var n=r.readable||!1!==r.readable&&t.readable,o=r.writable||!1!==r.writable&&t.writable,s=function(){t.writable||h()},a=t._writableState&&t._writableState.finished,h=function(){o=!1,a=!0,n||i.call(t)},u=t._readableState&&t._readableState.endEmitted,c=function(){n=!1,u=!0,o||i.call(t)},l=function(e){i.call(t,e)},f=function(){var e;return n&&!u?(t._readableState&&t._readableState.ended||(e=new H),i.call(t,e)):o&&!a?(t._writableState&&t._writableState.ended||(e=new H),i.call(t,e)):void 0},d=function(){t.req.on("finish",h)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?o&&!t._writableState&&(t.on("end",s),t.on("close",s)):(t.on("complete",h),t.on("abort",f),t.req?d():t.on("request",d)),t.on("end",c),t.on("finish",h),!1!==r.error&&t.on("error",l),t.on("close",f),function(){t.removeListener("complete",h),t.removeListener("abort",f),t.removeListener("request",d),t.req&&t.req.removeListener("finish",h),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",h),t.removeListener("end",c),t.removeListener("error",l),t.removeListener("close",f)}};function Q(){if(X)return Z;var e;function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}X=1;var i=Y,n=Symbol("lastResolve"),o=Symbol("lastReject"),s=Symbol("error"),a=Symbol("ended"),h=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function l(e,t){return{value:e,done:t}}function f(e){var t=e[n];if(null!==t){var r=e[c].read();null!==r&&(e[h]=null,e[n]=null,e[o]=null,t(l(r,!1)))}}function d(e){t(f,e)}var p=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((r(e={get stream(){return this[c]},next:function(){var e=this,r=this[s];if(null!==r)return Promise.reject(r);if(this[a])return Promise.resolve(l(void 0,!0));if(this[c].destroyed)return new Promise((function(r,i){t((function(){e[s]?i(e[s]):r(l(void 0,!0))}))}));var i,n=this[h];if(n)i=new Promise(function(e,t){return function(r,i){e.then((function(){t[a]?r(l(void 0,!0)):t[u](r,i)}),i)}}(n,this));else{var o=this[c].read();if(null!==o)return Promise.resolve(l(o,!1));i=new Promise(this[u])}return this[h]=i,i}},Symbol.asyncIterator,(function(){return this})),r(e,"return",(function(){var e=this;return new Promise((function(t,r){e[c].destroy(null,(function(e){e?r(e):t(l(void 0,!0))}))}))})),e),p);return Z=function(e){var t,f=Object.create(y,(r(t={},c,{value:e,writable:!0}),r(t,n,{value:null,writable:!0}),r(t,o,{value:null,writable:!0}),r(t,s,{value:null,writable:!0}),r(t,a,{value:e._readableState.endEmitted,writable:!0}),r(t,u,{value:function(e,t){var r=f[c].read();r?(f[h]=null,f[n]=null,f[o]=null,e(l(r,!1))):(f[n]=e,f[o]=t)},writable:!0}),t));return f[h]=null,i(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=f[o];return null!==t&&(f[h]=null,f[n]=null,f[o]=null,t(e)),void(f[s]=e)}var r=f[n];null!==r&&(f[h]=null,f[n]=null,f[o]=null,r(l(void 0,!0))),f[a]=!0})),e.on("readable",d.bind(null,f)),f}}const ee=K;ee.Readable=me,me.ReadableState=ve,L.EventEmitter;var te=function(e,t){return e.listeners(t).length},re=I,ie=m.Buffer,ne=e.Uint8Array||function(){};var oe,se=w;oe=se&&se.debuglog?se.debuglog("stream"):function(){};var ae,he,ue,ce=function(){if(x)return M;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}x=1;var i=m.Buffer,n=w.inspect,o=n&&n.custom||"inspect";return M=function(){function s(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),this.head=null,this.tail=null,this.length=0}var a,h,u;return a=s,h=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,r,n,o=i.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,n=a,i.prototype.copy.call(t,r,n),a+=s.data.length,s=s.next;return o}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,i=t.data;for(e-=i.length;t=t.next;){var n=t.data,o=e>n.length?n.length:e;if(o===n.length?i+=n:i+=n.slice(0,e),0==(e-=o)){o===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,s),0==(e-=s)){s===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++n}return this.length-=n,t}},{key:o,value:function(r,i){return n(this,function(r){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?e(Object(n),!0).forEach((function(e){t(r,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}))}return r}({},i,{depth:0,customInspect:!1}))}}],h&&r(a.prototype,h),u&&r(a,u),s}(),M}(),le=D,fe=W.getHighWaterMark,de=B.codes,pe=de.ERR_INVALID_ARG_TYPE,ye=de.ERR_STREAM_PUSH_AFTER_EOF,be=de.ERR_METHOD_NOT_IMPLEMENTED,_e=de.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;E(me,re);var we=le.errorOrDestroy,ge=["error","close","destroy","pause","resume"];function ve(e,t,r){e=e||{},"boolean"!=typeof r&&(r=t instanceof ee.Duplex),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=fe(this,e,"readableHighWaterMark",r),this.buffer=new ce,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&&(ae||(ae=z().StringDecoder),this.decoder=new ae(e.encoding),this.encoding=e.encoding)}function me(e){if(!(this instanceof me))return new me(e);var t=this instanceof ee.Duplex;this._readableState=new ve(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),re.call(this)}function Ee(e,t,r,i,n){oe("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(oe("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?Te(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,Me(e)))}(e,s);else if(n||(o=function(e,t){var r;i=t,ie.isBuffer(i)||i instanceof ne||"string"==typeof t||void 0===t||e.objectMode||(r=new pe("chunk",["string","Buffer","Uint8Array"],t));var i;return r}(s,t)),o)we(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===ie.prototype||(t=function(e){return ie.from(e)}(t)),i)s.endEmitted?we(e,new _e):Se(e,s,t,!0);else if(s.ended)we(e,new ye);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?Se(e,s,t,!1):xe(e,s)):Se(e,s,t,!1)}else i||(s.reading=!1,xe(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function Se(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Te(e)),xe(e,t)}Object.defineProperty(me.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),me.prototype.destroy=le.destroy,me.prototype._undestroy=le.undestroy,me.prototype._destroy=function(e,t){t(e)},me.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=ie.from(e,t),t=""),r=!0),Ee(this,e,t,!1,r)},me.prototype.unshift=function(e){return Ee(this,e,null,!0,!1)},me.prototype.isPaused=function(){return!1===this._readableState.flowing},me.prototype.setEncoding=function(e){ae||(ae=z().StringDecoder);var t=new ae(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var ke=1073741824;function Re(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=ke?e=ke:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Te(e){var r=e._readableState;oe("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(oe("emitReadable",r.flowing),r.emittedReadable=!0,t(Me,e))}function Me(e){var t=e._readableState;oe("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Oe(e)}function xe(e,r){r.readingMore||(r.readingMore=!0,t(Ae,e,r))}function Ae(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(oe("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function Ke(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Le(e){oe("readable nexttick read 0"),e.read(0)}function Ie(e,t){oe("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Oe(e),t.flowing&&!t.reading&&e.read(0)}function Oe(e){var t=e._readableState;for(oe("flow",t.flowing);t.flowing&&null!==e.read(););}function Ce(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function Pe(e){var r=e._readableState;oe("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,t(De,r,e))}function De(e,t){if(oe("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function Be(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}me.prototype.read=function(e){oe("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return oe("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Pe(this):Te(this),null;if(0===(e=Re(e,t))&&t.ended)return 0===t.length&&Pe(this),null;var i,n=t.needReadable;return oe("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&oe("length less than watermark",n=!0),t.ended||t.reading?oe("reading or ended",n=!1):n&&(oe("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Re(r,t))),null===(i=e>0?Ce(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Pe(this)),null!==i&&this.emit("data",i),i},me.prototype._read=function(e){we(this,new be("_read()"))},me.prototype.pipe=function(e,i){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,oe("pipe count=%d opts=%j",o.pipesCount,i);var s=(!i||!1!==i.end)&&e!==r.stdout&&e!==r.stderr?h:y;function a(t,r){oe("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,oe("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",u),e.removeListener("error",f),e.removeListener("unpipe",a),n.removeListener("end",h),n.removeListener("end",y),n.removeListener("data",l),c=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function h(){oe("onend"),e.end()}o.endEmitted?t(s):n.once("end",s),e.on("unpipe",a);var u=function(e){return function(){var t=e._readableState;oe("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&te(e,"data")&&(t.flowing=!0,Oe(e))}}(n);e.on("drain",u);var c=!1;function l(t){oe("ondata");var r=e.write(t);oe("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==Be(o.pipes,e))&&!c&&(oe("false write response, pause",o.awaitDrain),o.awaitDrain++),n.pause())}function f(t){oe("onerror",t),y(),e.removeListener("error",f),0===te(e,"error")&&we(e,t)}function d(){e.removeListener("finish",p),y()}function p(){oe("onfinish"),e.removeListener("close",d),y()}function y(){oe("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",f),e.once("close",d),e.once("finish",p),e.emit("pipe",n),o.flowing||(oe("pipe resume"),n.resume()),e},me.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=Be(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},me.prototype.on=function(e,r){var i=re.prototype.on.call(this,e,r),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,oe("on readable",n.length,n.reading),n.length?Te(this):n.reading||t(Le,this))),i},me.prototype.addListener=me.prototype.on,me.prototype.removeListener=function(e,r){var i=re.prototype.removeListener.call(this,e,r);return"readable"===e&&t(Ke,this),i},me.prototype.removeAllListeners=function(e){var r=re.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||t(Ke,this),r},me.prototype.resume=function(){var e=this._readableState;return e.flowing||(oe("resume"),e.flowing=!e.readableListening,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t(Ie,e,r))}(this,e)),e.paused=!1,this},me.prototype.pause=function(){return oe("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(oe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},me.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(oe("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(oe("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var o=0;o<ge.length;o++)e.on(ge[o],this.emit.bind(this,ge[o]));return this._read=function(t){oe("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(me.prototype[Symbol.asyncIterator]=function(){return void 0===he&&(he=Q()),he(this)}),Object.defineProperty(me.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(me.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(me.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),me._fromList=Ce,Object.defineProperty(me.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(me.from=function(e,t){return void 0===ue&&(ue=J?G:(J=1,G=function(){throw new Error("Readable.from is not available in the browser")})),ue(me,e,t)});var Ne=function(e,t){if(je("noDeprecation"))return e;var r=!1;return function(){if(!r){if(je("throwDeprecation"))throw new Error(t);je("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function je(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}const Ue=K;function Ve(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}Ue.Writable=at,at.WritableState=st;var qe={deprecate:Ne},We=I,Fe=m.Buffer,ze=e.Uint8Array||function(){};var He,$e=D,Ze=W.getHighWaterMark,Xe=B.codes,Ge=Xe.ERR_INVALID_ARG_TYPE,Je=Xe.ERR_METHOD_NOT_IMPLEMENTED,Ye=Xe.ERR_MULTIPLE_CALLBACK,Qe=Xe.ERR_STREAM_CANNOT_PIPE,et=Xe.ERR_STREAM_DESTROYED,tt=Xe.ERR_STREAM_NULL_VALUES,rt=Xe.ERR_STREAM_WRITE_AFTER_END,it=Xe.ERR_UNKNOWN_ENCODING,nt=$e.errorOrDestroy;function ot(){}function st(e,r,i){e=e||{},"boolean"!=typeof i&&(i=r instanceof Ue.Duplex),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Ze(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=!1===e.decodeStrings;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var i=e._writableState,n=i.sync,o=i.writecb;if("function"!=typeof o)throw new Ye;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(i),r)!function(e,r,i,n,o){--r.pendingcb,i?(t(o,n),t(dt,e,r),e._writableState.errorEmitted=!0,nt(e,n)):(o(n),e._writableState.errorEmitted=!0,nt(e,n),dt(e,r))}(e,i,n,r,o);else{var s=lt(i)||e.destroyed;s||i.corked||i.bufferProcessing||!i.bufferedRequest||ct(e,i),n?t(ut,e,i,s,o):ut(e,i,s,o)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ve(this)}function at(e){var t=this instanceof Ue.Duplex;if(!t&&!He.call(at,this))return new at(e);this._writableState=new st(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),We.call(this)}function ht(e,t,r,i,n,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new et("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function ut(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),dt(e,t)}function ct(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)n[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;n.allBuffers=a,ht(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Ve(t),t.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,u=r.encoding,c=r.callback;if(ht(e,t,!1,t.objectMode?1:h.length,h,u,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function lt(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function ft(e,t){e._final((function(r){t.pendingcb--,r&&nt(e,r),t.prefinished=!0,e.emit("prefinish"),dt(e,t)}))}function dt(e,r){var i=lt(r);if(i&&(function(e,r){r.prefinished||r.finalCalled||("function"!=typeof e._final||r.destroyed?(r.prefinished=!0,e.emit("prefinish")):(r.pendingcb++,r.finalCalled=!0,t(ft,e,r)))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"),r.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return i}E(at,We),st.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(st.prototype,"buffer",{get:qe.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(He=Function.prototype[Symbol.hasInstance],Object.defineProperty(at,Symbol.hasInstance,{value:function(e){return!!He.call(this,e)||this===at&&(e&&e._writableState instanceof st)}})):He=function(e){return e instanceof this},at.prototype.pipe=function(){nt(this,new Qe)},at.prototype.write=function(e,r,i){var n,o=this._writableState,s=!1,a=!o.objectMode&&(n=e,Fe.isBuffer(n)||n instanceof ze);return a&&!Fe.isBuffer(e)&&(e=function(e){return Fe.from(e)}(e)),"function"==typeof r&&(i=r,r=null),a?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof i&&(i=ot),o.ending?function(e,r){var i=new rt;nt(e,i),t(r,i)}(this,i):(a||function(e,r,i,n){var o;return null===i?o=new tt:"string"==typeof i||r.objectMode||(o=new Ge("chunk",["string","Buffer"],i)),!o||(nt(e,o),t(n,o),!1)}(this,o,e,i))&&(o.pendingcb++,s=function(e,t,r,i,n,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Fe.from(t,r));return t}(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var a=t.objectMode?1:i.length;t.length+=a;var h=t.length<t.highWaterMark;h||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else ht(e,t,!1,a,i,n,o);return h}(this,o,a,e,r,i)),s},at.prototype.cork=function(){this._writableState.corked++},at.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||ct(this,e))},at.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new it(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(at.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(at.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),at.prototype._write=function(e,t,r){r(new Je("_write()"))},at.prototype._writev=null,at.prototype.end=function(e,r,i){var n=this._writableState;return"function"==typeof e?(i=e,e=null,r=null):"function"==typeof r&&(i=r,r=null),null!=e&&this.write(e,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,r,i){r.ending=!0,dt(e,r),i&&(r.finished?t(i):e.once("finish",i));r.ended=!0,e.writable=!1}(this,n,i),this},Object.defineProperty(at.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(at.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),at.prototype.destroy=$e.destroy,at.prototype._undestroy=$e.undestroy,at.prototype._destroy=function(e,t){t(e)};var pt=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};const yt=K;yt.Duplex=gt,E(gt,yt.Readable);for(var bt=pt(yt.Writable.prototype),_t=0;_t<bt.length;_t++){var wt=bt[_t];gt.prototype[wt]||(gt.prototype[wt]=yt.Writable.prototype[wt])}function gt(e){if(!(this instanceof gt))return new gt(e);yt.Readable.call(this,e),yt.Writable.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",vt)))}function vt(){this._writableState.ended||t(mt,this)}function mt(e){e.end()}Object.defineProperty(gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(gt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(gt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(gt.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});const Et=K;Et.Transform=At;var St=B.codes,kt=St.ERR_METHOD_NOT_IMPLEMENTED,Rt=St.ERR_MULTIPLE_CALLBACK,Tt=St.ERR_TRANSFORM_ALREADY_TRANSFORMING,Mt=St.ERR_TRANSFORM_WITH_LENGTH_0;function xt(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new Rt);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function At(e){if(!(this instanceof At))return new At(e);Et.Duplex.call(this,e),this._transformState={afterTransform:xt.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Kt)}function Kt(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Lt(this,null,null):this._flush((function(t,r){Lt(e,t,r)}))}function Lt(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Mt;if(e._transformState.transforming)throw new Tt;return e.push(null)}E(At,Et.Duplex),At.prototype.push=function(e,t){return this._transformState.needTransform=!1,Et.Duplex.prototype.push.call(this,e,t)},At.prototype._transform=function(e,t,r){r(new kt("_transform()"))},At.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},At.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},At.prototype._destroy=function(e,t){Et.Duplex.prototype._destroy.call(this,e,(function(e){t(e)}))};const It=K;function Ot(e){if(!(this instanceof Ot))return new Ot(e);Transform.call(this,e)}var Ct;It.PassThrough=Ot,E(Ot,It.Transform),Ot.prototype._transform=function(e,t,r){r(null,e)};var Pt=B.codes,Dt=Pt.ERR_MISSING_ARGS,Bt=Pt.ERR_STREAM_DESTROYED;function Nt(e){if(e)throw e}function jt(e){e()}function Ut(e,t){return e.pipe(t)}var Vt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i,n=function(e){return e.length?"function"!=typeof e[e.length-1]?Nt:e.pop():Nt}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Dt("streams");var o=t.map((function(e,r){var s=r<t.length-1;return function(e,t,r,i){i=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(i);var n=!1;e.on("close",(function(){n=!0})),void 0===Ct&&(Ct=Y),Ct(e,{readable:t,writable:r},(function(e){if(e)return i(e);n=!0,i()}));var o=!1;return function(t){if(!n&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void i(t||new Bt("pipe"))}}(e,s,r>0,(function(e){i||(i=e),e&&o.forEach(jt),s||(o.forEach(jt),n(i))}))}));return t.reduce(Ut)};!function(e,t){const r=K;(t=A.exports=r.Readable).Stream=r.Readable,t.Readable=r.Readable,t.Writable=r.Writable,t.Duplex=r.Duplex,t.Transform=r.Transform,t.PassThrough=r.PassThrough,t.finished=Y,t.pipeline=Vt}(0,A.exports);var qt=A.exports,Wt=p.Buffer,Ft=qt;function zt(e){Ft.Stream.Transform.call(this),this._block=Wt.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}E(zt,Ft.Stream.Transform),zt.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},zt.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},zt.prototype.update=function(e,t){if(function(e,t){if(!Wt.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");Wt.isBuffer(e)||(e=Wt.from(e,t));for(var r=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var n=this._blockOffset;n<this._blockSize;)r[n++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)r[this._blockOffset++]=e[i++];for(var o=0,s=8*e.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},zt.prototype._update=function(){throw new Error("_update is not implemented")},zt.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},zt.prototype._digest=function(){throw new Error("_digest is not implemented")};var Ht=zt,$t=E,Zt=Ht,Xt=p.Buffer,Gt=new Array(16);function Jt(){Zt.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function Yt(e,t){return e<<t|e>>>32-t}function Qt(e,t,r,i,n,o,s){return Yt(e+(t&r|~t&i)+n+o|0,s)+t|0}function er(e,t,r,i,n,o,s){return Yt(e+(t&i|r&~i)+n+o|0,s)+t|0}function tr(e,t,r,i,n,o,s){return Yt(e+(t^r^i)+n+o|0,s)+t|0}function rr(e,t,r,i,n,o,s){return Yt(e+(r^(t|~i))+n+o|0,s)+t|0}$t(Jt,Zt),Jt.prototype._update=function(){for(var e=Gt,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,i=this._b,n=this._c,o=this._d;r=Qt(r,i,n,o,e[0],3614090360,7),o=Qt(o,r,i,n,e[1],3905402710,12),n=Qt(n,o,r,i,e[2],606105819,17),i=Qt(i,n,o,r,e[3],3250441966,22),r=Qt(r,i,n,o,e[4],4118548399,7),o=Qt(o,r,i,n,e[5],1200080426,12),n=Qt(n,o,r,i,e[6],2821735955,17),i=Qt(i,n,o,r,e[7],4249261313,22),r=Qt(r,i,n,o,e[8],1770035416,7),o=Qt(o,r,i,n,e[9],2336552879,12),n=Qt(n,o,r,i,e[10],4294925233,17),i=Qt(i,n,o,r,e[11],2304563134,22),r=Qt(r,i,n,o,e[12],1804603682,7),o=Qt(o,r,i,n,e[13],4254626195,12),n=Qt(n,o,r,i,e[14],2792965006,17),r=er(r,i=Qt(i,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=er(o,r,i,n,e[6],3225465664,9),n=er(n,o,r,i,e[11],643717713,14),i=er(i,n,o,r,e[0],3921069994,20),r=er(r,i,n,o,e[5],3593408605,5),o=er(o,r,i,n,e[10],38016083,9),n=er(n,o,r,i,e[15],3634488961,14),i=er(i,n,o,r,e[4],3889429448,20),r=er(r,i,n,o,e[9],568446438,5),o=er(o,r,i,n,e[14],3275163606,9),n=er(n,o,r,i,e[3],4107603335,14),i=er(i,n,o,r,e[8],1163531501,20),r=er(r,i,n,o,e[13],2850285829,5),o=er(o,r,i,n,e[2],4243563512,9),n=er(n,o,r,i,e[7],1735328473,14),r=tr(r,i=er(i,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=tr(o,r,i,n,e[8],2272392833,11),n=tr(n,o,r,i,e[11],1839030562,16),i=tr(i,n,o,r,e[14],4259657740,23),r=tr(r,i,n,o,e[1],2763975236,4),o=tr(o,r,i,n,e[4],1272893353,11),n=tr(n,o,r,i,e[7],4139469664,16),i=tr(i,n,o,r,e[10],3200236656,23),r=tr(r,i,n,o,e[13],681279174,4),o=tr(o,r,i,n,e[0],3936430074,11),n=tr(n,o,r,i,e[3],3572445317,16),i=tr(i,n,o,r,e[6],76029189,23),r=tr(r,i,n,o,e[9],3654602809,4),o=tr(o,r,i,n,e[12],3873151461,11),n=tr(n,o,r,i,e[15],530742520,16),r=rr(r,i=tr(i,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=rr(o,r,i,n,e[7],1126891415,10),n=rr(n,o,r,i,e[14],2878612391,15),i=rr(i,n,o,r,e[5],4237533241,21),r=rr(r,i,n,o,e[12],1700485571,6),o=rr(o,r,i,n,e[3],2399980690,10),n=rr(n,o,r,i,e[10],4293915773,15),i=rr(i,n,o,r,e[1],2240044497,21),r=rr(r,i,n,o,e[8],1873313359,6),o=rr(o,r,i,n,e[15],4264355552,10),n=rr(n,o,r,i,e[6],2734768916,15),i=rr(i,n,o,r,e[13],1309151649,21),r=rr(r,i,n,o,e[4],4149444226,6),o=rr(o,r,i,n,e[11],3174756917,10),n=rr(n,o,r,i,e[2],718787259,15),i=rr(i,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},Jt.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=Xt.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var ir=Jt,nr=m.Buffer,or=E,sr=Ht,ar=new Array(16),hr=[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],ur=[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],cr=[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],lr=[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],fr=[0,1518500249,1859775393,2400959708,2840853838],dr=[1352829926,1548603684,1836072691,2053994217,0];function pr(){sr.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function yr(e,t){return e<<t|e>>>32-t}function br(e,t,r,i,n,o,s,a){return yr(e+(t^r^i)+o+s|0,a)+n|0}function _r(e,t,r,i,n,o,s,a){return yr(e+(t&r|~t&i)+o+s|0,a)+n|0}function wr(e,t,r,i,n,o,s,a){return yr(e+((t|~r)^i)+o+s|0,a)+n|0}function gr(e,t,r,i,n,o,s,a){return yr(e+(t&i|r&~i)+o+s|0,a)+n|0}function vr(e,t,r,i,n,o,s,a){return yr(e+(t^(r|~i))+o+s|0,a)+n|0}or(pr,sr),pr.prototype._update=function(){for(var e=ar,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,s=0|this._e,a=0|this._a,h=0|this._b,u=0|this._c,c=0|this._d,l=0|this._e,f=0;f<80;f+=1){var d,p;f<16?(d=br(r,i,n,o,s,e[hr[f]],fr[0],cr[f]),p=vr(a,h,u,c,l,e[ur[f]],dr[0],lr[f])):f<32?(d=_r(r,i,n,o,s,e[hr[f]],fr[1],cr[f]),p=gr(a,h,u,c,l,e[ur[f]],dr[1],lr[f])):f<48?(d=wr(r,i,n,o,s,e[hr[f]],fr[2],cr[f]),p=wr(a,h,u,c,l,e[ur[f]],dr[2],lr[f])):f<64?(d=gr(r,i,n,o,s,e[hr[f]],fr[3],cr[f]),p=_r(a,h,u,c,l,e[ur[f]],dr[3],lr[f])):(d=vr(r,i,n,o,s,e[hr[f]],fr[4],cr[f]),p=br(a,h,u,c,l,e[ur[f]],dr[4],lr[f])),r=s,s=o,o=yr(n,10),n=i,i=d,a=l,l=c,c=yr(u,10),u=h,h=p}var y=this._b+n+c|0;this._b=this._c+o+l|0,this._c=this._d+s+a|0,this._d=this._e+r+h|0,this._e=this._a+i+u|0,this._a=y},pr.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=nr.alloc?nr.alloc(20):new nr(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};var mr=pr,Er={exports:{}},Sr=p.Buffer;function kr(e,t){this._block=Sr.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}kr.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=Sr.from(e,t));for(var r=this._block,i=this._blockSize,n=e.length,o=this._len,s=0;s<n;){for(var a=o%i,h=Math.min(n-s,i-a),u=0;u<h;u++)r[a+u]=e[s+u];s+=h,(o+=h)%i==0&&this._update(r)}return this._len+=n,this},kr.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},kr.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Rr=kr,Tr=E,Mr=Rr,xr=p.Buffer,Ar=[1518500249,1859775393,-1894007588,-899497514],Kr=new Array(80);function Lr(){this.init(),this._w=Kr,Mr.call(this,64,56)}function Ir(e){return e<<30|e>>>2}function Or(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}Tr(Lr,Mr),Lr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Lr.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var u=0;u<80;++u){var c=~~(u/20),l=0|((t=i)<<5|t>>>27)+Or(c,n,o,s)+a+r[u]+Ar[c];a=s,s=o,o=Ir(n),n=i,i=l}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Lr.prototype._hash=function(){var e=xr.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Cr=Lr,Pr=E,Dr=Rr,Br=p.Buffer,Nr=[1518500249,1859775393,-1894007588,-899497514],jr=new Array(80);function Ur(){this.init(),this._w=jr,Dr.call(this,64,56)}function Vr(e){return e<<5|e>>>27}function qr(e){return e<<30|e>>>2}function Wr(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}Pr(Ur,Dr),Ur.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Ur.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<80;++h)r[h]=(t=r[h-3]^r[h-8]^r[h-14]^r[h-16])<<1|t>>>31;for(var u=0;u<80;++u){var c=~~(u/20),l=Vr(i)+Wr(c,n,o,s)+a+r[u]+Nr[c]|0;a=s,s=o,o=qr(n),n=i,i=l}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Ur.prototype._hash=function(){var e=Br.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Fr=Ur,zr=E,Hr=Rr,$r=p.Buffer,Zr=[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],Xr=new Array(64);function Gr(){this.init(),this._w=Xr,Hr.call(this,64,56)}function Jr(e,t,r){return r^e&(t^r)}function Yr(e,t,r){return e&t|r&(e|t)}function Qr(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function ei(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function ti(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}zr(Gr,Hr),Gr.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},Gr.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,h=0|this._f,u=0|this._g,c=0|this._h,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<64;++l)r[l]=0|(((t=r[l-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[l-7]+ti(r[l-15])+r[l-16];for(var f=0;f<64;++f){var d=c+ei(a)+Jr(a,h,u)+Zr[f]+r[f]|0,p=Qr(i)+Yr(i,n,o)|0;c=u,u=h,h=a,a=s+d|0,s=o,o=n,n=i,i=d+p|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=h+this._f|0,this._g=u+this._g|0,this._h=c+this._h|0},Gr.prototype._hash=function(){var e=$r.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var ri=Gr,ii=E,ni=ri,oi=Rr,si=p.Buffer,ai=new Array(64);function hi(){this.init(),this._w=ai,oi.call(this,64,56)}ii(hi,ni),hi.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},hi.prototype._hash=function(){var e=si.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var ui=hi,ci=E,li=Rr,fi=p.Buffer,di=[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],pi=new Array(160);function yi(){this.init(),this._w=pi,li.call(this,128,112)}function bi(e,t,r){return r^e&(t^r)}function _i(e,t,r){return e&t|r&(e|t)}function wi(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function gi(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function vi(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function mi(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Ei(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Si(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function ki(e,t){return e>>>0<t>>>0?1:0}ci(yi,li),yi.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},yi.prototype._update=function(e){for(var t=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,h=0|this._gh,u=0|this._hh,c=0|this._al,l=0|this._bl,f=0|this._cl,d=0|this._dl,p=0|this._el,y=0|this._fl,b=0|this._gl,_=0|this._hl,w=0;w<32;w+=2)t[w]=e.readInt32BE(4*w),t[w+1]=e.readInt32BE(4*w+4);for(;w<160;w+=2){var g=t[w-30],v=t[w-30+1],m=vi(g,v),E=mi(v,g),S=Ei(g=t[w-4],v=t[w-4+1]),k=Si(v,g),R=t[w-14],T=t[w-14+1],M=t[w-32],x=t[w-32+1],A=E+T|0,K=m+R+ki(A,E)|0;K=(K=K+S+ki(A=A+k|0,k)|0)+M+ki(A=A+x|0,x)|0,t[w]=K,t[w+1]=A}for(var L=0;L<160;L+=2){K=t[L],A=t[L+1];var I=_i(r,i,n),O=_i(c,l,f),C=wi(r,c),P=wi(c,r),D=gi(s,p),B=gi(p,s),N=di[L],j=di[L+1],U=bi(s,a,h),V=bi(p,y,b),q=_+B|0,W=u+D+ki(q,_)|0;W=(W=(W=W+U+ki(q=q+V|0,V)|0)+N+ki(q=q+j|0,j)|0)+K+ki(q=q+A|0,A)|0;var F=P+O|0,z=C+I+ki(F,P)|0;u=h,_=b,h=a,b=y,a=s,y=p,s=o+W+ki(p=d+q|0,d)|0,o=n,d=f,n=i,f=l,i=r,l=c,r=W+z+ki(c=q+F|0,q)|0}this._al=this._al+c|0,this._bl=this._bl+l|0,this._cl=this._cl+f|0,this._dl=this._dl+d|0,this._el=this._el+p|0,this._fl=this._fl+y|0,this._gl=this._gl+b|0,this._hl=this._hl+_|0,this._ah=this._ah+r+ki(this._al,c)|0,this._bh=this._bh+i+ki(this._bl,l)|0,this._ch=this._ch+n+ki(this._cl,f)|0,this._dh=this._dh+o+ki(this._dl,d)|0,this._eh=this._eh+s+ki(this._el,p)|0,this._fh=this._fh+a+ki(this._fl,y)|0,this._gh=this._gh+h+ki(this._gl,b)|0,this._hh=this._hh+u+ki(this._hl,_)|0},yi.prototype._hash=function(){var e=fi.allocUnsafe(64);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Ri=yi,Ti=E,Mi=Ri,xi=Rr,Ai=p.Buffer,Ki=new Array(160);function Li(){this.init(),this._w=Ki,xi.call(this,128,112)}Ti(Li,Mi),Li.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},Li.prototype._hash=function(){var e=Ai.allocUnsafe(48);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Ii=Li,Oi=Er.exports=function(e){e=e.toLowerCase();var t=Oi[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Oi.sha=Cr,Oi.sha1=Fr,Oi.sha224=ui,Oi.sha256=ri,Oi.sha384=Ii,Oi.sha512=Ri;var Ci=Er.exports,Pi=h(c),Di=p.Buffer,Bi=y.Transform,Ni=Pi.StringDecoder;function ji(e){Bi.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}E(ji,Bi),ji.prototype.update=function(e,t,r){"string"==typeof e&&(e=Di.from(e,t));var i=this._update(e);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},ji.prototype.setAutoPadding=function(){},ji.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},ji.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},ji.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},ji.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){i=e}finally{r(i)}},ji.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},ji.prototype._finalOrDigest=function(e){var t=this.__final()||Di.alloc(0);return e&&(t=this._toString(t,e,!0)),t},ji.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new Ni(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i};var Ui=ir,Vi=mr,qi=Ci,Wi=ji;function Fi(e){Wi.call(this,"digest"),this._hash=e}E(Fi,Wi),Fi.prototype._update=function(e){this._hash.update(e)},Fi.prototype._final=function(){return this._hash.digest()};var zi=l((function(e){return"md5"===(e=e.toLowerCase())?new Ui:"rmd160"===e||"ripemd160"===e?new Vi:new Fi(qi(e))}));const Hi=new(0,S.ec)("secp256k1"),$i=Hi.curve,Zi=$i.n.constructor;function Xi(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new Zi(t);if(r.cmp($i.p)>=0)return null;r=r.toRed($i.red);let i=r.redSqr().redIMul(r).redIAdd($i.b).redSqrt();return 3===e!==i.isOdd()&&(i=i.redNeg()),Hi.keyPair({pub:{x:r,y:i}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let i=new Zi(t),n=new Zi(r);if(i.cmp($i.p)>=0||n.cmp($i.p)>=0)return null;if(i=i.toRed($i.red),n=n.toRed($i.red),(6===e||7===e)&&n.isOdd()!==(7===e))return null;const o=i.redSqr().redIMul(i);return n.redSqr().redISub(o.redIAdd($i.b)).isZero()?Hi.keyPair({pub:{x:i,y:n}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function Gi(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}var Ji={contextRandomize:()=>0,privateKeyVerify(e){const t=new Zi(e);return t.cmp($i.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new Zi(e),r=$i.n.sub(t).umod($i.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new Zi(t);if(r.cmp($i.n)>=0)return 1;if(r.iadd(new Zi(e)),r.cmp($i.n)>=0&&r.isub($i.n),r.isZero())return 1;const i=r.toArrayLike(Uint8Array,"be",32);return e.set(i),0},privateKeyTweakMul(e,t){let r=new Zi(t);if(r.cmp($i.n)>=0||r.isZero())return 1;r.imul(new Zi(e)),r.cmp($i.n)>=0&&(r=r.umod($i.n));const i=r.toArrayLike(Uint8Array,"be",32);return e.set(i),0},publicKeyVerify:e=>null===Xi(e)?1:0,publicKeyCreate(e,t){const r=new Zi(t);if(r.cmp($i.n)>=0||r.isZero())return 1;return Gi(e,Hi.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=Xi(t);if(null===r)return 1;return Gi(e,r.getPublic()),0},publicKeyNegate(e,t){const r=Xi(t);if(null===r)return 1;const i=r.getPublic();return i.y=i.y.redNeg(),Gi(e,i),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=Xi(t[e]),null===r[e])return 1;let i=r[0].getPublic();for(let e=1;e<r.length;++e)i=i.add(r[e].pub);return i.isInfinity()?2:(Gi(e,i),0)},publicKeyTweakAdd(e,t,r){const i=Xi(t);if(null===i)return 1;if((r=new Zi(r)).cmp($i.n)>=0)return 2;const n=i.getPublic().add($i.g.mul(r));return n.isInfinity()?2:(Gi(e,n),0)},publicKeyTweakMul(e,t,r){const i=Xi(t);if(null===i)return 1;if((r=new Zi(r)).cmp($i.n)>=0||r.isZero())return 2;return Gi(e,i.getPublic().mul(r)),0},signatureNormalize(e){const t=new Zi(e.subarray(0,32)),r=new Zi(e.subarray(32,64));return t.cmp($i.n)>=0||r.cmp($i.n)>=0?1:(1===r.cmp(Hi.nh)&&e.set($i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),i=t.subarray(32,64);if(new Zi(r).cmp($i.n)>=0)return 1;if(new Zi(i).cmp($i.n)>=0)return 1;const{output:n}=e;let o=n.subarray(4,37);o[0]=0,o.set(r,1);let s=33,a=0;for(;s>1&&0===o[a]&&!(128&o[a+1]);--s,++a);if(o=o.subarray(a),128&o[0])return 1;if(s>1&&0===o[0]&&!(128&o[1]))return 1;let h=n.subarray(39,72);h[0]=0,h.set(i,1);let u=33,c=0;for(;u>1&&0===h[c]&&!(128&h[c+1]);--u,++c);return h=h.subarray(c),128&h[0]||u>1&&0===h[0]&&!(128&h[1])?1:(e.outputlen=6+s+u,n[0]=48,n[1]=e.outputlen-2,n[2]=2,n[3]=o.length,n.set(o,4),n[4+s]=2,n[5+s]=h.length,n.set(h,6+s),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const i=t[5+r];if(0===i)return 1;if(6+r+i!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(i>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let n=t.subarray(4,4+r);if(33===n.length&&0===n[0]&&(n=n.subarray(1)),n.length>32)return 1;let o=t.subarray(6+r);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let s=new Zi(n);s.cmp($i.n)>=0&&(s=new Zi(0));let a=new Zi(t.subarray(6+r));return a.cmp($i.n)>=0&&(a=new Zi(0)),e.set(s.toArrayLike(Uint8Array,"be",32),0),e.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,i,n){if(n){const e=n;n=n=>{const o=e(t,r,null,i,n);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new Zi(o)}}const o=new Zi(r);if(o.cmp($i.n)>=0||o.isZero())return 1;let s;try{s=Hi.sign(t,r,{canonical:!0,k:n,pers:i})}catch(e){return 1}return e.signature.set(s.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(s.s.toArrayLike(Uint8Array,"be",32),32),e.recid=s.recoveryParam,0},ecdsaVerify(e,t,r){const i={r:e.subarray(0,32),s:e.subarray(32,64)},n=new Zi(i.r),o=new Zi(i.s);if(n.cmp($i.n)>=0||o.cmp($i.n)>=0)return 1;if(1===o.cmp(Hi.nh)||n.isZero()||o.isZero())return 3;const s=Xi(r);if(null===s)return 2;const a=s.getPublic();return Hi.verify(t,i,a)?0:3},ecdsaRecover(e,t,r,i){const n={r:t.slice(0,32),s:t.slice(32,64)},o=new Zi(n.r),s=new Zi(n.s);if(o.cmp($i.n)>=0||s.cmp($i.n)>=0)return 1;if(o.isZero()||s.isZero())return 2;let a;try{a=Hi.recoverPubKey(i,n,r)}catch(e){return 2}return Gi(e,a),0},ecdh(e,t,r,i,n,o,s){const a=Xi(t);if(null===a)return 1;const h=new Zi(r);if(h.cmp($i.n)>=0||h.isZero())return 2;const u=a.getPublic().mul(h);if(void 0===n){const t=u.encode(null,!0),r=Hi.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{o||(o=new Uint8Array(32));const t=u.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];s||(s=new Uint8Array(32));const r=u.getY().toArray("be",32);for(let e=0;e<32;++e)s[e]=r[e];const a=n(o,s,i);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}};const Yi="Impossible case. Please create issue.",Qi="The tweak was out of range or the resulted private key is invalid",en="The tweak was out of range or equal to zero",tn="Unknow error on context randomization",rn="Private Key is invalid",nn="Public Key could not be parsed",on="Public Key serialization error",sn="The sum of the public keys is not valid",an="Signature could not be parsed",hn="The nonce generation function failed, or the private key was invalid",un="Public key could not be recover",cn="Scalar was invalid (zero or overflow)";function ln(e,t){if(!e)throw new Error(t)}function fn(e,t,r){if(ln(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const i=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;ln(r.includes(t.length),i)}else{const i=`Expected ${e} to be an Uint8Array with length ${r}`;ln(t.length===r,i)}}function dn(e){ln("Boolean"===yn(e),"Expected compressed to be a Boolean")}function pn(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),fn("output",e,t),e}function yn(e){return Object.prototype.toString.call(e).slice(8,-1)}var bn=(e=>({contextRandomize(t){if(ln(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&fn("seed",t,32),1===e.contextRandomize(t))throw new Error(tn)},privateKeyVerify:t=>(fn("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(fn("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(Yi)}},privateKeyTweakAdd(t,r){switch(fn("private key",t,32),fn("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(Qi)}},privateKeyTweakMul(t,r){switch(fn("private key",t,32),fn("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(en)}},publicKeyVerify:t=>(fn("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,i){switch(fn("private key",t,32),dn(r),i=pn(i,r?33:65),e.publicKeyCreate(i,t)){case 0:return i;case 1:throw new Error(rn);case 2:throw new Error(on)}},publicKeyConvert(t,r=!0,i){switch(fn("public key",t,[33,65]),dn(r),i=pn(i,r?33:65),e.publicKeyConvert(i,t)){case 0:return i;case 1:throw new Error(nn);case 2:throw new Error(on)}},publicKeyNegate(t,r=!0,i){switch(fn("public key",t,[33,65]),dn(r),i=pn(i,r?33:65),e.publicKeyNegate(i,t)){case 0:return i;case 1:throw new Error(nn);case 2:throw new Error(Yi);case 3:throw new Error(on)}},publicKeyCombine(t,r=!0,i){ln(Array.isArray(t),"Expected public keys to be an Array"),ln(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)fn("public key",e,[33,65]);switch(dn(r),i=pn(i,r?33:65),e.publicKeyCombine(i,t)){case 0:return i;case 1:throw new Error(nn);case 2:throw new Error(sn);case 3:throw new Error(on)}},publicKeyTweakAdd(t,r,i=!0,n){switch(fn("public key",t,[33,65]),fn("tweak",r,32),dn(i),n=pn(n,i?33:65),e.publicKeyTweakAdd(n,t,r)){case 0:return n;case 1:throw new Error(nn);case 2:throw new Error(Qi)}},publicKeyTweakMul(t,r,i=!0,n){switch(fn("public key",t,[33,65]),fn("tweak",r,32),dn(i),n=pn(n,i?33:65),e.publicKeyTweakMul(n,t,r)){case 0:return n;case 1:throw new Error(nn);case 2:throw new Error(en)}},signatureNormalize(t){switch(fn("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(an)}},signatureExport(t,r){fn("signature",t,64);const i={output:r=pn(r,72),outputlen:72};switch(e.signatureExport(i,t)){case 0:return r.slice(0,i.outputlen);case 1:throw new Error(an);case 2:throw new Error(Yi)}},signatureImport(t,r){switch(fn("signature",t),r=pn(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(an);case 2:throw new Error(Yi)}},ecdsaSign(t,r,i={},n){fn("message",t,32),fn("private key",r,32),ln("Object"===yn(i),"Expected options to be an Object"),void 0!==i.data&&fn("options.data",i.data),void 0!==i.noncefn&&ln("Function"===yn(i.noncefn),"Expected options.noncefn to be a Function");const o={signature:n=pn(n,64),recid:null};switch(e.ecdsaSign(o,t,r,i.data,i.noncefn)){case 0:return o;case 1:throw new Error(hn);case 2:throw new Error(Yi)}},ecdsaVerify(t,r,i){switch(fn("signature",t,64),fn("message",r,32),fn("public key",i,[33,65]),e.ecdsaVerify(t,r,i)){case 0:return!0;case 3:return!1;case 1:throw new Error(an);case 2:throw new Error(nn)}},ecdsaRecover(t,r,i,n=!0,o){switch(fn("signature",t,64),ln("Number"===yn(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),fn("message",i,32),dn(n),o=pn(o,n?33:65),e.ecdsaRecover(o,t,r,i)){case 0:return o;case 1:throw new Error(an);case 2:throw new Error(un);case 3:throw new Error(Yi)}},ecdh(t,r,i={},n){switch(fn("public key",t,[33,65]),fn("private key",r,32),ln("Object"===yn(i),"Expected options to be an Object"),void 0!==i.data&&fn("options.data",i.data),void 0!==i.hashfn?(ln("Function"===yn(i.hashfn),"Expected options.hashfn to be a Function"),void 0!==i.xbuf&&fn("options.xbuf",i.xbuf,32),void 0!==i.ybuf&&fn("options.ybuf",i.ybuf,32),fn("output",n)):n=pn(n,32),e.ecdh(n,t,r,i.data,i.hashfn,i.xbuf,i.ybuf)){case 0:return n;case 1:throw new Error(nn);case 2:throw new Error(cn)}}}))(Ji),_n=l(bn),wn={exports:{}},gn=65536,vn=4294967295;var mn=p.Buffer,En=e.crypto||e.msCrypto;En&&En.getRandomValues?wn.exports=function(e,r){if(e>vn)throw new RangeError("requested too many random bytes");var i=mn.allocUnsafe(e);if(e>0)if(e>gn)for(var n=0;n<e;n+=gn)En.getRandomValues(i.slice(n,n+gn));else En.getRandomValues(i);if("function"==typeof r)return t((function(){r(null,i)}));return i}:wn.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var Sn=l(wn.exports);var kn={CryptoLD:class{constructor({suites:e}={}){this.suites=e||new Map}use(e){this.suites.set(e.suite,e)}async generate(e={}){return this._suiteForType(e).generate(e)}async from(e={}){const t=this._suiteForType(e);return e["@context"]?t.fromKeyDocument({document:e}):t.from(e)}async fromKeyDocument({document:e,checkContext:t=!0,checkRevoked:r=!0}={}){if(!e)throw new TypeError('The "document" parameter is required.');return this._suiteForType(e).fromKeyDocument({document:e,checkContext:t,checkRevoked:r})}async fromKeyId({id:e,documentLoader:t,checkContext:r=!0,checkRevoked:i=!0}={}){if(!e)throw new TypeError('The "id" parameter is required.');if(!t)throw new TypeError('The "documentLoader" parameter is required.');let n;try{if(({document:n}=await t(e)),!n)throw new Error('The "documentLoader" function must return a "document" object.')}catch(e){const t=new Error("Error fetching document: "+e.message);throw t.cause=e,t}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:r,checkRevoked:i})}_installed({type:e}){return this.suites.has(e)}_suiteForType(e){const t=e&&e.type;if(!t)throw new TypeError("Missing key type.");if(!this._installed({type:t}))throw new Error(`Support for key type "${t}" is not installed.`);return this.suites.get(t)}}};
2
2
  /*!
3
3
  * Copyright (c) 2018-2021 Digital Bazaar, Inc. All rights reserved.
4
4
  */let Rn=class{constructor({id:e,controller:t,revoked:r}={}){this.id=e,this.controller=t,this.revoked=r}static async generate(){throw new Error("Abstract method, must be implemented in subclass.")}static async fromKeyDocument({document:e,checkContext:t=!0,checkRevoked:r=!0}={}){if(!e)throw new TypeError('The "document" parameter is required.');if(t){if(![].concat(e["@context"]).includes(this.SUITE_CONTEXT))throw new Error('Key document does not contain required context "'+this.SUITE_CONTEXT+'".')}if(r&&e.revoked)throw new Error(`Key has been revoked since: "${e.revoked}".`);return this.from(e)}static async from(){throw new Error("Abstract method from() must be implemented in subclass.")}export({publicKey:e=!1,privateKey:t=!1}={}){if(!e&&!t)throw new Error('Export requires specifying either "publicKey" or "privateKey".');const r={id:this.id,type:this.type,controller:this.controller};return this.revoked&&(r.revoked=this.revoked),r}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.")}}}};Rn.SUITE_CONTEXT="INVALID LDKeyPair CONTEXT";var Tn={LDKeyPair:Rn};const{CryptoLD:Mn}=kn,{LDKeyPair:xn}=Tn;var An=l({CryptoLD:Mn,LDKeyPair:xn});const Kn="EcdsaSecp256k1VerificationKey2019",Ln=e=>zi("sha256").update(e).digest();class In extends An.LDKeyPair{constructor({publicKeyBase58:e,privateKeyBase58:t,...r}){if(super(r),this.type=void 0,this.publicKeyBase58=void 0,this.privateKeyBase58=void 0,t&&!e){const e=bn.publicKeyCreate(k(t));this.publicKeyBase58=R(e)}else this.publicKeyBase58=e;if(this.type=Kn,this.privateKeyBase58=t,!this.publicKeyBase58)throw new TypeError('The "publicKeyBase58" property is required.')}static from(e){if(e.publicKeyHex||e.privateKeyHex){const{publicKeyHex:t,privateKeyHex:r,...n}=e;return new In({...n,publicKeyBase58:t?R(i.from(t,"hex")):void 0,privateKeyBase58:r?R(i.from(r,"hex")):void 0})}return new In(e)}static async generate({seed:e,compressed:t,...r}){if(e&&!bn.privateKeyVerify(e))throw new Error("Provided seed is not a valid private key");let i=e;for(;void 0===i||!bn.privateKeyVerify(i);)i=new Uint8Array(Sn(32));const n=bn.publicKeyCreate(i,t);return new In({publicKeyBase58:R(n),privateKeyBase58:R(i),...r})}export({publicKey:e=!1,privateKey:t=!1,includeContext:r=!1}={}){if(!e&&!t)throw new TypeError('export requires specifying either "publicKey" or "privateKey".');if(t&&!this.privateKeyBase58)throw new TypeError("No privateKey to export.");if(e&&!this.publicKeyBase58)throw new TypeError("No publicKey to export.");const i={type:this.type,id:this.id,controller:this.controller,revoked:this.revoked};return r&&(i["@context"]=In.SUITE_CONTEXT),t&&(i.privateKeyBase58=this.privateKeyBase58),e&&(i.publicKeyBase58=this.publicKeyBase58),i}signer(){const{privateKeyBase58:e}=this;return e?{async sign({data:t}){const r=b.encode(JSON.stringify({alg:"ES256K",b64:!1,crit:["b64"]})),n=i.from(t.buffer,t.byteOffset,t.length),o=Ln(i.from(i.concat([i.from(`${r}.`,"utf8"),i.from(n.buffer,n.byteOffset,n.length)]))),{signature:s}=bn.ecdsaSign(o,k(e));return`${r}..${b.encode(i.from(s))}`},id:this.id}:{async sign(){throw new Error("No private key to sign with.")},id:this.id}}verifier(){const{publicKeyBase58:e}=this;return e?{async verify({data:t,signature:r}){if(r.indexOf("..")<0)return!1;const[n,o]=r.split(".."),s=JSON.parse(b.decode(n));if("ES256K"!==s.alg||!1!==s.b64||!s.crit||!s.crit.length||"b64"!==s.crit[0])return!1;const a=i.from(t.buffer,t.byteOffset,t.length),h=Ln(i.from(i.concat([i.from(`${n}.`,"utf8"),i.from(a.buffer,a.byteOffset,a.length)])));let u;try{u=bn.ecdsaVerify(i.from(b.decode(o,"hex"),"hex"),h,k(e))}catch(e){u=!1}return u},id:this.id}:{async verify(){throw new Error("No public key to verify against")},id:this.id}}}In.suite=Kn,In.SUITE_CONTEXT="https://ns.did.ai/suites/secp256k1-2019/v1";const On="https://ns.did.ai/suites/secp256k1-2019/v1",Cn=({document:e,contextUrl:t})=>{const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)},Pn=({document:e})=>{const t=Cn({document:e,contextUrl:On}),r=Cn({document:e,contextUrl:"https://www.w3.org/2018/credentials/v1"}),i=Cn({document:e,contextUrl:"https://w3id.org/security/v2"});return t&&r?(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):t&&i?(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):t||r||i};let Dn=class extends f.suites.LinkedDataSignature{constructor(e={}){super({type:"EcdsaSecp256k1Signature2019",LDKeyClass:In,contextUrl:On,...e}),this.requiredKeyType=void 0,this.requiredKeyType="EcdsaSecp256k1VerificationKey2019"}async sign({verifyData:e,proof:t}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");return{...t,jws:await this.signer.sign({data:e})}}async verifySignature({verifyData:e,verificationMethod:t,proof:r}){const{jws:i}=r;if(!i||"string"!=typeof i)throw new TypeError('The proof does not include a valid "jws" property.');let{verifier:n}=this;if(!n){n=(await this.LDKeyClass.from(t)).verifier()}return n.verify({data:e,signature:i})}async assertVerificationMethod({verificationMethod:e}){if(!Pn({document:e}))throw new TypeError(`The verification method (key) must contain "${this.contextUrl}".`);if(!d.hasValue(e,"type",this.requiredKeyType))throw new Error(`Invalid key type. Key type must be "${this.requiredKeyType}".`);if(void 0!==e.revoked)throw new Error("The verification method has been revoked.")}async getVerificationMethod({proof:e,documentLoader:t}){if(this.key)return this.key.export({publicKey:!0});const r="object"==typeof e.verificationMethod?e.verificationMethod.id:e.verificationMethod;if(!r)throw new Error('No "verificationMethod" found in proof.');const i=await d.frame(r,{"@context":this.contextUrl,"@embed":"@always",id:r},{documentLoader:t,compactToRelative:!1});if(!i)throw new Error(`Verification method ${r} not found.`);if(void 0!==i.revoked)throw new Error("The verification method has been revoked.");return await this.assertVerificationMethod({verificationMethod:i}),i}async matchProof({proof:e,document:t,purpose:r,documentLoader:i,expansionMap:n}){if(!Pn({document:t}))return!1;if(!await super.matchProof({proof:e,document:t,purpose:r,documentLoader:i,expansionMap:n}))return!1;if(!this.key)return!0;const{verificationMethod:o}=e,s="object"==typeof o?o.id:o;return this.isVerificationMethodMatchingKeyId(s)}ensureSuiteContext({document:e,addSuiteContext:t}){Pn({document:e})||super.ensureSuiteContext({document:e,addSuiteContext:t})}isVerificationMethodMatchingKeyId(e){return e===this.key.id||e===`${this.key.controller}${this.key.id}`}};Dn.CONTEXT_URL=On,Dn.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 Bn="undefined"==typeof Buffer?i:Buffer,{purposes:{AssertionProofPurpose:Nn}}=f;var jn;!function(e){e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.checkDocumentSignature="checkDocumentSignature"}(jn||(jn={}));class Un extends T{verificationProcess=[jn.retrieveVerificationMethodPublicKey,jn.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSecp256k1Signature2019";verificationKey;publicKey;constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.issuer=e.issuer,this.proof=e.proof,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(e){return this.verificationProcess.map((t=>n.verifier.convertToVerificationSubsteps(e,t)))}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.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}isProofChain(){return"ChainedProof2021"===this.proof.type}generateDocumentLoader(){o[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(e){return e in o?{contextUrl:null,document:o[e],documentUrl:e}:d.documentLoader(e)}}retrieveInitialDocument(){const e=s(this.documentToVerify);if(Array.isArray(e.proof)){const t=e.proof.find((e=>e.type===this.type));delete e.proof,e.proof=t}return e}getTargetVerificationMethodContainer(){return this.issuer.didDocument??this.issuer}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(jn.retrieveVerificationMethodPublicKey,(async()=>{const e=_(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod);if(e.publicKeyJwk&&!e.publicKeyBase58){const r=(e=>{const t=g.from({...e,crv:"K-256"},"jwk").toString("blk","public"),r=_n.publicKeyConvert(Bn.from(t,"hex"),!0);return Bn.from(r).toString("hex")})(e.publicKeyJwk);e.publicKeyBase58=(t=r,v.encode(Bn.from(t,"hex")))}var t;this.publicKey=e.publicKeyBase58;const r=In.from({...e});if(!r)throw new a(jn.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(r.revoked)throw new a(jn.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return r}),this.type)}async checkDocumentSignature(){await this.executeStep(jn.checkDocumentSignature,(async()=>{const e=new Dn({key:this.verificationKey});e.date=new Date(Date.now()).toISOString();const t=await f.verify(this.retrieveInitialDocument(),{suite:e,purpose:new Nn,documentLoader:this.generateDocumentLoader()});if(!t.verified)throw console.error(JSON.stringify(t,null,2)),new a(jn.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed`);console.log("Credential Secp256k1 signature successfully verified")}),this.type)}}export{Un as default};
@@ -1,4 +1,4 @@
1
- import{h as t,o as e,n as r,l as n,y as i,c as o,i as a}from"./main.js";import{j as c}from"./jsonld-signatures-ooFWZVS--VI8BZQOv.js";import{j as s}from"./jsonld-CXlzLf4P-Wh4x173W.js";import{d as u,e as f}from"./index-CZOUZnn4-Lnb5-WZi.js";import{d as p,e as l}from"./base64url-qi3FT6uz-yv4mTXpu.js";import{_ as y}from"./tslib.es6-M1zqH4el-x9kNW1T_.js";import{x as h,e as d}from"./x25519-NtRELWAG-TIgip27e.js";import{S as w}from"./Suite-Bhitn5l3-e2QgHGhx.js";import"./_commonjs-dynamic-modules-F7P8sER7-fkA6S-_a.js";
1
+ import{d as t,h as e,f as r,V as n,q as i,B as o,i as a}from"./main.js";import{j as c}from"./jsonld-signatures-ooFWZVS--ThP8ltUY.js";import{j as s}from"./jsonld-CXlzLf4P-ioHKtwiZ.js";import{d as u,e as f}from"./index-CZOUZnn4-Lnb5-WZi.js";import{d as p,e as l}from"./base64url-qi3FT6uz-yv4mTXpu.js";import{_ as y}from"./tslib.es6-M1zqH4el-x9kNW1T_.js";import{x as h,e as d}from"./x25519-NtRELWAG-2RynHlmX.js";import{S as w}from"./Suite-Bhitn5l3-e2QgHGhx.js";import"./_commonjs-dynamic-modules-F7P8sER7-fkA6S-_a.js";
2
2
  /*!
3
3
  * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
4
4
  */function v({bytes:t,expectedLength:e=32,code:r}){if(!(t instanceof Uint8Array))throw new TypeError('"bytes" must be a Uint8Array.');if(t.length!==e){const t=new Error(`"bytes" must be a ${e}-byte Uint8Array.`);throw t.name="DataError",r&&(t.code=r),t}}