@blockcerts/blockcerts-verifier 1.72.4 → 1.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +8 -0
  2. package/bundle-stats.html +1 -1
  3. package/codecov +0 -0
  4. package/codecov.SHA256SUM +1 -0
  5. package/codecov.SHA256SUM.sig +16 -0
  6. package/coverage/lcov.info +475 -472
  7. package/dist/{DataIntegrityProof-x-pKdBCc-B_YUlE0Z.js → DataIntegrityProof-D8TnXEkl-CGiIg0kn.js} +2 -2
  8. package/dist/{EcdsaSd2023-CU35O_1w-CISk0lEt.js → EcdsaSd2023-D2eJBmaY-mHNjbn8h.js} +11 -15
  9. package/dist/EcdsaSecp256k1Signature2019-BRdQnZ0o-D_QN8KrS.js +1 -0
  10. package/dist/{Ed25519Signature2020-B6yblwC5-BRlzT2Yc.js → Ed25519Signature2020-D2tdrIA4-PSi5TCQH.js} +5 -5
  11. package/dist/{EddsaRdfc2022-Csk9U_qt-B798omlR.js → EddsaRdfc2022-CpZAUc7W-BJP0532C.js} +3 -3
  12. package/dist/MerkleProof2017-DW_9FhLr-C0dPtifx.js +1 -0
  13. package/dist/MerkleProof2019-DJbo7uW--CHlhsnHk.js +5 -0
  14. package/dist/Suite-BmP2Qu19-D1ucdMDB.js +1 -0
  15. package/dist/_polyfill-node.path-hKwMKLNw-B7aPtphV.js +1 -0
  16. package/dist/checkBitStringStatusList-BUPuVWy_-CYedocxJ.js +13 -0
  17. package/dist/checkCredentialSchemaConformity-CJdGwNcY-CaSak-bD.js +1 -0
  18. package/dist/{controlVerificationMethod-Cuyek_Vk-C_Uq2iA5.js → controlVerificationMethod-C71lJp3H-n-AbzkO8.js} +1 -1
  19. package/dist/{downloadPDF-UAsY-nU_.js → downloadPDF-BU6CfP-N.js} +2 -2
  20. package/dist/{ensureNotRevoked-CNUfpW4F-BheL-ZKZ.js → ensureNotRevoked-BWp1jPEo-DSQMtjrj.js} +1 -1
  21. package/dist/ensureValidIssuingKey-BYAR3LEF-76kiqVKA.js +1 -0
  22. package/dist/{index-DNlz8u7B-CYTlxhyY.js → index-BCu3PGuw-Dh4-8Ruv.js} +1 -1
  23. package/dist/index-CB7VaVsF-G_Mj6xql.js +30 -0
  24. package/dist/index-Jn9Q6fuB-uChPhl1c.js +56 -0
  25. package/dist/{index.es-CnYWLNZV.js → index.es-C2GPR7m7.js} +1 -1
  26. package/dist/jsonld-DqC1oHcn-ruRlORc0.js +88 -0
  27. package/dist/main.js +85 -85
  28. package/dist/purify.es-C6IIzwyE.js +2 -0
  29. package/dist/{retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js → retrieveVerificationMethodPublicKey-Dai7em0K-BqIH8qzD.js} +1 -1
  30. package/dist/verifyIssuerProfile-zkczSLpC-CTHpISfH.js +1 -0
  31. package/package.json +9 -9
  32. package/dist/EcdsaSecp256k1Signature2019-DiXIv8yq-B2kEN_Qo.js +0 -1
  33. package/dist/MerkleProof2017-BIJKwMk5-CLYAJK4G.js +0 -1
  34. package/dist/MerkleProof2019-CeAt2OGM-DOuISx_E.js +0 -5
  35. package/dist/Suite-CBLHluYK-Dmvbh142.js +0 -33
  36. package/dist/checkCredentialSchemaConformity-CECtM4WI-C1vg05zb.js +0 -1
  37. package/dist/checkRevocationStatusList2021-B7NFlV-5-C3Zng1tA.js +0 -13
  38. package/dist/ensureValidIssuingKey-DN2kpCwj-DY8BTObG.js +0 -1
  39. package/dist/index-DFOHyoZq-BCuOIg2Z.js +0 -29
  40. package/dist/jsonld-signatures-BtZPa7MV-DTekMXP5.js +0 -56
  41. package/dist/pako.esm-BGRKTPxS-Bodm4Eha.js +0 -2
  42. package/dist/purify.es-Om653OSQ.js +0 -2
  43. package/dist/sha2-JcCWfgvE-By1_saxP.js +0 -2
  44. package/dist/verifyIssuerProfile-DQji41Fc-l31-7imR.js +0 -1
  45. /package/dist/{HashlinkVerifier-Bi7nn19S-DMjUYzMR.js → HashlinkVerifier-BcdAFe02-DMjUYzMR.js} +0 -0
  46. /package/dist/{index-6G1g4ypj-Dgus2xdV.js → index-KzSDgEl9-Dgus2xdV.js} +0 -0
  47. /package/dist/{index-D7PA_QcD-CyttRwCk.js → index-OtXtCWrq-CyttRwCk.js} +0 -0
  48. /package/dist/{webcrypto.es-aoUxIxUm-gGk5JRJH.js → webcrypto.es-9hytEjC6-gGk5JRJH.js} +0 -0
@@ -0,0 +1,2 @@
1
+ /*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */
2
+ function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function t(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw r}}return l}}(t,n)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const n=Object.entries,o=Object.setPrototypeOf,r=Object.isFrozen,i=Object.getPrototypeOf,a=Object.getOwnPropertyDescriptor;let l=Object.freeze,c=Object.seal,s=Object.create,u="undefined"!=typeof Reflect&&Reflect,f=u.apply,p=u.construct;l||(l=function(e){return e}),c||(c=function(e){return e}),f||(f=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return e.apply(t,o)}),p||(p=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return new e(...n)});const m=L(Array.prototype.forEach),d=L(Array.prototype.lastIndexOf),h=L(Array.prototype.pop),g=L(Array.prototype.push),y=L(Array.prototype.splice),b=Array.isArray,T=L(String.prototype.toLowerCase),S=L(String.prototype.toString),E=L(String.prototype.match),A=L(String.prototype.replace),N=L(String.prototype.indexOf),_=L(String.prototype.trim),w=L(Number.prototype.toString),O=L(Boolean.prototype.toString),v="undefined"==typeof BigInt?null:L(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:L(Symbol.prototype.toString),R=L(Object.prototype.hasOwnProperty),C=L(Object.prototype.toString),I=L(RegExp.prototype.test),k=(x=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p(x,t)});var x;function L(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return f(e,t,o)}}function M(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:T;if(o&&o(e,null),!b(t))return e;let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(r(t)||(t[i]=e),o=e)}e[o]=!0}return e}function z(e){for(let t=0;t<e.length;t++){R(e,t)||(e[t]=null)}return e}function P(e){const o=s(null);for(const i of n(e)){var r=t(i,2);const n=r[0],a=r[1];R(e,n)&&(b(a)?o[n]=z(a):a&&"object"==typeof a&&a.constructor===Object?o[n]=P(a):o[n]=a)}return o}function U(e,t){for(;null!==e;){const n=a(e,t);if(n){if(n.get)return L(n.get);if("function"==typeof n.value)return L(n.value)}e=i(e)}return function(){return null}}const F=l(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),H=l(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),j=l(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),B=l(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),G=l(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),W=l(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Y=l(["#text"]),q=l(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),X=l(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$=l(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),K=l(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V=c(/{{[\w\W]*|^[\w\W]*}}/g),Z=c(/<%[\w\W]*|^[\w\W]*%>/g),J=c(/\${[\w\W]*/g),Q=c(/^data-[\-\w.\u00B7-\uFFFF]+$/),ee=c(/^aria-[\-\w]+$/),te=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ne=c(/^(?:\w+script|data):/i),oe=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),re=c(/^html$/i),ie=c(/^[a-z][.\w]*(-[.\w]+)+$/i),ae=c(/<[/\w!]/g),le=c(/<[/\w]/g),ce=c(/<\/no(script|embed|frames)/i),se=c(/\/>/i),ue=1,fe=3,pe=7,me=8,de=9,he=11,ge=function(){return"undefined"==typeof window?null:window},ye=function(e,t,n,o){return R(e,t)&&b(e[t])?M(o.base?P(o.base):{},e[t],o.transform):n};var be=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ge();const o=t=>e(t);if(o.version="3.4.13",o.removed=[],!t||!t.document||t.document.nodeType!==de||!t.Element)return o.isSupported=!1,o;let r=t.document;const i=r,a=i.currentScript;t.DocumentFragment;const u=t.HTMLTemplateElement,f=t.Node,p=t.Element,x=t.NodeFilter,L=t.NamedNodeMap;void 0===L&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const z=t.DOMParser,be=t.trustedTypes,Te=p.prototype,Se=U(Te,"cloneNode"),Ee=U(Te,"remove"),Ae=U(Te,"nextSibling"),Ne=U(Te,"childNodes"),_e=U(Te,"parentNode"),we=U(Te,"shadowRoot"),Oe=U(Te,"attributes"),ve=f&&f.prototype?U(f.prototype,"nodeType"):null,De=f&&f.prototype?U(f.prototype,"nodeName"):null,Re=f&&f.prototype?U(f.prototype,"ownerDocument"):null;if("function"==typeof u){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let Ce,Ie,ke="",xe=!1,Le=0;const Me=function(){if(Le>0)throw k('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ze=function(e){Me(),Le++;try{return Ce.createHTML(e)}finally{Le--}},Pe=function(){return xe||(Ie=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(be,a),xe=!0),Ie},Ue=r,Fe=Ue.implementation,He=Ue.createNodeIterator,je=Ue.createDocumentFragment,Be=Ue.getElementsByTagName,Ge=i.importNode;let We={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};o.isSupported="function"==typeof n&&"function"==typeof _e&&Fe&&void 0!==Fe.createHTMLDocument;const Ye=V,qe=Z,Xe=J,$e=Q,Ke=ee,Ve=ne,Ze=oe,Je=ie;let Qe=te,et=null;const tt=M({},[...F,...H,...j,...G,...Y]);let nt=null;const ot=M({},[...q,...X,...$,...K]);let rt=Object.seal(s(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),it=null,at=null;const lt=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ct=!0,st=!0,ut=!1,ft=!0,pt=!1,mt=!0,dt=!1,ht=!1,gt=null,yt=null,bt=!1,Tt=!1,St=!1,Et=!1,At=!0,Nt=!1;const _t="user-content-";let wt=!0,Ot=!1,vt={},Dt=null;const Rt=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ct=null;const It=M({},["audio","video","img","source","image","track"]);let kt=null;const xt=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Lt="http://www.w3.org/1998/Math/MathML",Mt="http://www.w3.org/2000/svg",zt="http://www.w3.org/1999/xhtml";let Pt=zt,Ut=!1,Ft=null;const Ht=M({},[Lt,Mt,zt],S),jt=l(["mi","mo","mn","ms","mtext"]);let Bt=M({},jt);const Gt=l(["annotation-xml"]);let Wt=M({},Gt);const Yt=M({},["title","style","font","a","script"]);let qt=null;const Xt=["application/xhtml+xml","text/html"];let $t=null,Kt=null;const Vt=r.createElement("form"),Zt=function(e){return e instanceof RegExp||e instanceof Function},Jt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Kt&&Kt===e)return;e&&"object"==typeof e||(e={}),e=P(e),qt=-1===Xt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,$t="application/xhtml+xml"===qt?S:T,et=ye(e,"ALLOWED_TAGS",tt,{transform:$t}),nt=ye(e,"ALLOWED_ATTR",ot,{transform:$t}),Ft=ye(e,"ALLOWED_NAMESPACES",Ht,{transform:S}),kt=ye(e,"ADD_URI_SAFE_ATTR",xt,{transform:$t,base:xt}),Ct=ye(e,"ADD_DATA_URI_TAGS",It,{transform:$t,base:It}),Dt=ye(e,"FORBID_CONTENTS",Rt,{transform:$t}),it=ye(e,"FORBID_TAGS",P({}),{transform:$t}),at=ye(e,"FORBID_ATTR",P({}),{transform:$t}),vt=!!R(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?P(e.USE_PROFILES):e.USE_PROFILES),ct=!1!==e.ALLOW_ARIA_ATTR,st=!1!==e.ALLOW_DATA_ATTR,ut=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ft=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,pt=e.SAFE_FOR_TEMPLATES||!1,mt=!1!==e.SAFE_FOR_XML,dt=e.WHOLE_DOCUMENT||!1,Tt=e.RETURN_DOM||!1,St=e.RETURN_DOM_FRAGMENT||!1,Et=e.RETURN_TRUSTED_TYPE||!1,bt=e.FORCE_BODY||!1,At=!1!==e.SANITIZE_DOM,Nt=e.SANITIZE_NAMED_PROPS||!1,wt=!1!==e.KEEP_CONTENT,Ot=e.IN_PLACE||!1,Qe=function(e){try{return I(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:te,Pt="string"==typeof e.NAMESPACE?e.NAMESPACE:zt,Bt=R(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?P(e.MATHML_TEXT_INTEGRATION_POINTS):M({},jt),Wt=R(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?P(e.HTML_INTEGRATION_POINTS):M({},Gt);const t=R(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?P(e.CUSTOM_ELEMENT_HANDLING):s(null);if(rt=s(null),R(t,"tagNameCheck")&&Zt(t.tagNameCheck)&&(rt.tagNameCheck=t.tagNameCheck),R(t,"attributeNameCheck")&&Zt(t.attributeNameCheck)&&(rt.attributeNameCheck=t.attributeNameCheck),R(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(rt.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),c(rt),pt&&(st=!1),St&&(Tt=!0),vt&&(et=M({},Y),nt=s(null),!0===vt.html&&(M(et,F),M(nt,q)),!0===vt.svg&&(M(et,H),M(nt,X),M(nt,K)),!0===vt.svgFilters&&(M(et,j),M(nt,X),M(nt,K)),!0===vt.mathMl&&(M(et,G),M(nt,$),M(nt,K))),lt.tagCheck=null,lt.attributeCheck=null,R(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?lt.tagCheck=e.ADD_TAGS:b(e.ADD_TAGS)&&(et===tt&&(et=P(et)),M(et,e.ADD_TAGS,$t))),R(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?lt.attributeCheck=e.ADD_ATTR:b(e.ADD_ATTR)&&(nt===ot&&(nt=P(nt)),M(nt,e.ADD_ATTR,$t))),R(e,"ADD_URI_SAFE_ATTR")&&b(e.ADD_URI_SAFE_ATTR)&&M(kt,e.ADD_URI_SAFE_ATTR,$t),R(e,"FORBID_CONTENTS")&&b(e.FORBID_CONTENTS)&&(Dt===Rt&&(Dt=P(Dt)),M(Dt,e.FORBID_CONTENTS,$t)),R(e,"ADD_FORBID_CONTENTS")&&b(e.ADD_FORBID_CONTENTS)&&(Dt===Rt&&(Dt=P(Dt)),M(Dt,e.ADD_FORBID_CONTENTS,$t)),wt&&(et["#text"]=!0),dt&&M(et,["html","head","body"]),et.table&&(M(et,["tbody"]),delete it.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=Ce;Ce=e.TRUSTED_TYPES_POLICY;try{ke=ze("")}catch(e){throw Ce=t,e}}else null===e.TRUSTED_TYPES_POLICY?(Ce=void 0,ke=""):(void 0===Ce&&(Ce=Pe()),Ce&&"string"==typeof ke&&(ke=ze("")));l&&l(e),Kt=e},Qt=M({},[...H,...j,...B]),en=M({},[...G,...W]),tn=function(e){let t=_e(e);t&&t.tagName||(t={namespaceURI:Pt,tagName:"template"});const n=T(e.tagName),o=T(t.tagName);return!!Ft[e.namespaceURI]&&(e.namespaceURI===Mt?function(e,t,n){return t.namespaceURI===zt?"svg"===e:t.namespaceURI===Lt?"svg"===e&&("annotation-xml"===n||Bt[n]):Boolean(Qt[e])}(n,t,o):e.namespaceURI===Lt?function(e,t,n){return t.namespaceURI===zt?"math"===e:t.namespaceURI===Mt?"math"===e&&Wt[n]:Boolean(en[e])}(n,t,o):e.namespaceURI===zt?function(e,t,n){return!(t.namespaceURI===Mt&&!Wt[n])&&!(t.namespaceURI===Lt&&!Bt[n])&&!en[e]&&(Yt[e]||!Qt[e])}(n,t,o):!("application/xhtml+xml"!==qt||!Ft[e.namespaceURI]))},nn=function(e){g(o.removed,{element:e});try{_e(e).removeChild(e)}catch(t){if(Ee(e),!_e(e))throw k("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},on=function(e){ln(e);const t=Ne(e);if(t){const e=[];m(t,t=>{g(e,t)}),m(e,e=>{try{Ee(e)}catch(e){}})}const n=Oe(e);if(n)for(let t=n.length-1;t>=0;--t){const o=n[t],r=o&&o.name;if("string"==typeof r)try{e.removeAttribute(r)}catch(e){}}},rn=function(e,t){try{g(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){g(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Tt||St)try{nn(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},an=function(e){const t=Oe(e);if(t)for(let n=t.length-1;n>=0;--n){const o=t[n],r=o&&o.name;if("string"==typeof r&&!nt[$t(r)])try{e.removeAttribute(r)}catch(e){}}},ln=function(e){const t=[e];for(;t.length>0;){const e=t.pop();(ve?ve(e):e.nodeType)===ue&&an(e);const n=Ne(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},cn=function(e){let t=null,n=null;if(bt)e="<remove></remove>"+e;else{const t=E(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===qt&&Pt===zt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=Ce?ze(e):e;if(Pt===zt)try{t=(new z).parseFromString(o,qt)}catch(e){}if(!t||!t.documentElement){t=Fe.createDocument(Pt,"template",null);try{t.documentElement.innerHTML=Ut?ke:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),Pt===zt?Be.call(t,dt?"html":"body")[0]:dt?t.documentElement:i},sn=function(e){const t=Re?Re(e):e.ownerDocument;return He.call(t||e,e,x.SHOW_ELEMENT|x.SHOW_COMMENT|x.SHOW_TEXT|x.SHOW_PROCESSING_INSTRUCTION|x.SHOW_CDATA_SECTION,null)},un=function(e){return e=A(e,Ye," "),e=A(e,qe," "),e=A(e,Xe," ")},fn=function(e){var t;e.normalize();const n=Re?Re(e):e.ownerDocument,o=He.call(n||e,e,x.SHOW_TEXT|x.SHOW_COMMENT|x.SHOW_CDATA_SECTION|x.SHOW_PROCESSING_INSTRUCTION,null);let r=o.nextNode();for(;r;)r.data=un(r.data),r=o.nextNode();const i=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");i&&m(i,e=>{mn(e.content)&&fn(e.content)})},pn=function(e){const t=De?De(e):null;return"string"==typeof t&&("form"===$t(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Oe(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==ve(e)||e.childNodes!==Ne(e)))},mn=function(e){if(!ve||"object"!=typeof e||null===e)return!1;try{return ve(e)===he}catch(e){return!1}},dn=function(e){if(!ve||"object"!=typeof e||null===e)return!1;try{return"number"==typeof ve(e)}catch(e){return!1}};function hn(e,t,n){0!==e.length&&m(e,e=>{e.call(o,t,n,Kt)})}const gn=function(e,t,n,o){return 0===e.length?t:t===n||t===o?P(t):t},yn=function(e,t){if(hn(We.beforeSanitizeElements,e,null),e!==t&&null===_e(e))return Ot&&ln(e),!0;if(pn(e))return nn(e),!0;const n=$t(De?De(e):e.nodeName);if(et=gn(We.uponSanitizeElement,et,tt,gt),hn(We.uponSanitizeElement,e,{tagName:n,allowedTags:et}),e!==t&&null===_e(e))return Ot&&ln(e),!0;if(function(e,t){return!!(mt&&e.hasChildNodes()&&!dn(e.firstElementChild)&&I(ae,e.textContent)&&I(ae,e.innerHTML))||!(!mt||e.namespaceURI!==zt||"style"!==t||!dn(e.firstElementChild))||e.nodeType===pe||!(!mt||e.nodeType!==me||!I(le,e.data))}(e,n))return nn(e),!0;if(it[n]||!(lt.tagCheck instanceof Function&&lt.tagCheck(n))&&!et[n]){const o=function(e,t,n){if(!it[t]&&Sn(t)){if(rt.tagNameCheck instanceof RegExp&&I(rt.tagNameCheck,t))return!1;if(rt.tagNameCheck instanceof Function&&rt.tagNameCheck(t))return!1}if(wt&&!Dt[t]){const t=_e(e),o=Ne(e);if(o&&t)for(let r=o.length-1;r>=0;--r){const i=e===n?Se(o[r],!0):o[r];t.insertBefore(i,Ae(e))}}return nn(e),!0}(e,n,t);return!1===o&&hn(We.afterSanitizeElements,e,null),o}if((ve?ve(e):e.nodeType)===ue&&!tn(e))return nn(e),!0;if(("noscript"===n||"noembed"===n||"noframes"===n)&&I(ce,e.innerHTML))return nn(e),!0;if(pt&&e.nodeType===fe){const t=un(e.textContent);e.textContent!==t&&(g(o.removed,{element:e.cloneNode()}),e.textContent=t)}return hn(We.afterSanitizeElements,e,null),!1},bn=function(e,t,n){if(at[t])return!1;if(mt&&"patchsrc"===t)return!1;if(mt&&"for"===t&&"label"!==e&&"output"!==e)return!1;if(At&&("id"===t||"name"===t)&&(n in r||n in Vt))return!1;const o=nt[t]||lt.attributeCheck instanceof Function&&lt.attributeCheck(t,e);if(st&&I($e,t));else if(ct&&I(Ke,t));else if(o)if(kt[t]);else if(I(Qe,A(n,Ze,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==N(n,"data:")||!Ct[e]){if(ut&&!I(Ve,A(n,Ze,"")));else if(n)return!1}else;else if(!(Sn(e)&&(rt.tagNameCheck instanceof RegExp&&I(rt.tagNameCheck,e)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(e))&&(rt.attributeNameCheck instanceof RegExp&&I(rt.attributeNameCheck,t)||rt.attributeNameCheck instanceof Function&&rt.attributeNameCheck(t,e))||"is"===t&&rt.allowCustomizedBuiltInElements&&(rt.tagNameCheck instanceof RegExp&&I(rt.tagNameCheck,n)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(n))))return!1;return!0},Tn=M({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Sn=function(e){return!Tn[T(e)]&&I(Je,e)},En=function(e,t,n,o){if(Ce&&"object"==typeof be&&"function"==typeof be.getAttributeType&&!n)switch(be.getAttributeType(e,t)){case"TrustedHTML":return ze(o);case"TrustedScriptURL":return function(e){Me(),Le++;try{return Ce.createScriptURL(e)}finally{Le--}}(o)}return o},An=function(e,t,n,r){try{n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),pn(e)?nn(e):h(o.removed)}catch(n){rn(t,e)}},Nn=function(e){hn(We.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||pn(e))return;nt=gn(We.uponSanitizeAttribute,nt,ot,yt);const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:nt,forceKeepAttr:void 0};let o=t.length;const r=$t(e.nodeName);for(;o--;){const i=t[o],a=i.name,l=i.namespaceURI,c=i.value,s=$t(a),u=c;let f="value"===a?u:_(u);n.attrName=s,n.attrValue=f,n.keepAttr=!0,n.forceKeepAttr=void 0,hn(We.uponSanitizeAttribute,e,n),f=n.attrValue,!Nt||"id"!==s&&"name"!==s||0===N(f,_t)||(rn(a,e),f=_t+f),mt&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)?rn(a,e):"attributename"===s&&E(f,"href")?rn(a,e):n.forceKeepAttr||(n.keepAttr&&(ft||!I(se,f))?(pt&&(f=un(f)),bn(r,s,f)?(f=En(r,s,l,f),f!==u&&An(e,a,l,f)):rn(a,e)):rn(a,e))}hn(We.afterSanitizeAttributes,e,null)},_n=function(e){let t=null;const n=sn(e);for(hn(We.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){hn(We.uponSanitizeShadowNode,t,null),yn(t,e),Nn(t),mn(t.content)&&_n(t.content);if((ve?ve(t):t.nodeType)===ue){const e=we(t);mn(e)&&(wn(e),_n(e))}}hn(We.afterSanitizeShadowDOM,e,null)},wn=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){_n(e.shadow);continue}const n=e.node,o=(ve?ve(n):n.nodeType)===ue,r=Ne(n);if(r)for(let e=r.length-1;e>=0;--e)t.push({node:r[e],shadow:null});if(o){const e=De?De(n):null;if("string"==typeof e&&"template"===$t(e)){const e=n.content;mn(e)&&t.push({node:e,shadow:null})}}if(o){const e=we(n);mn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,a=null,l=null;if(Ut=!e,Ut&&(e="\x3c!--\x3e"),"string"!=typeof e&&!dn(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return w(e);case"boolean":return O(e);case"bigint":return v?v(e):"0";case"symbol":return D?D(e):"Symbol()";case"undefined":default:return C(e);case"function":case"object":{if(null===e)return C(e);const t=e,n=U(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:C(e)}return C(e)}}}(e)))throw k("dirty is not a string, aborting");if(!o.isSupported)return e;ht?(et=gt,nt=yt):Jt(t),(We.uponSanitizeElement.length>0||We.uponSanitizeAttribute.length>0)&&(et=P(et)),We.uponSanitizeAttribute.length>0&&(nt=P(nt)),o.removed=[];const c=Ot&&"string"!=typeof e&&dn(e);if(c){!function(e){if(!mt)return;const t=[e];for(;t.length>0;){const e=t.pop(),n=ve?ve(e):e.nodeType;if(n===pe||n===me&&I(le,e.data)){try{Ee(e)}catch(e){}continue}if(n===ue){const t=e,n=$t(De?De(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&"label"!==n&&"output"!==n&&t.removeAttribute("for")}catch(e){}}const o=Ne(e);if(o)for(let e=o.length-1;e>=0;--e)t.push(o[e])}}(e);const t=De?De(e):e.nodeName;if("string"==typeof t){const n=$t(t);if(!et[n]||it[n])throw on(e),k("root node is forbidden and cannot be sanitized in-place")}if(pn(e))throw on(e),k("root node is clobbered and cannot be sanitized in-place");try{wn(e)}catch(t){throw on(e),t}}else if(dn(e))n=cn("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),r.nodeType===ue&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),wn(r);else{if(!Tt&&!pt&&!dt&&-1===e.indexOf("<"))return Ce&&Et?ze(e):e;if(n=cn(e),!n)return Tt?null:Et?ke:""}n&&bt&&nn(n.firstChild);const s=c?e:n;try{const e=sn(s);for(;a=e.nextNode();)yn(a,s),Nn(a),mn(a.content)&&_n(a.content)}catch(t){throw c&&(on(e),m(o.removed,e=>{e.element&&ln(e.element)})),t}if(c)return m(o.removed,e=>{e.element&&ln(e.element)}),pt&&fn(e),e;if(Tt){if(pt&&fn(n),St)for(l=je.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(nt.shadowroot||nt.shadowrootmode)&&(l=Ge.call(i,l,!0)),l}let u=dt?n.outerHTML:n.innerHTML;return dt&&et["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&I(re,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),pt&&(u=un(u)),Ce&&Et?ze(u):u},o.setConfig=function(){Jt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ht=!0,gt=et,yt=nt},o.clearConfig=function(){Kt=null,ht=!1,gt=null,yt=null,Ce=Ie,ke=""},o.isValidAttribute=function(e,t,n){Kt||Jt({});const o=$t(e),r=$t(t);return bn(o,r,n)},o.addHook=function(e,t){"function"==typeof t&&R(We,e)&&g(We[e],t)},o.removeHook=function(e,t){if(R(We,e)){if(void 0!==t){const n=d(We[e],t);return-1===n?void 0:y(We[e],n,1)[0]}return h(We[e])}},o.removeHooks=function(e){R(We,e)&&(We[e]=[])},o.removeAllHooks=function(){We={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();export{be as default};
@@ -1 +1 @@
1
- import{V as e,d as i}from"./main.js";import{b as r}from"./index-6G1g4ypj-Dgus2xdV.js";function t(t,o){if(!t.verificationMethod)return void console.warn("No verification method found in the issuer document. This will likely become a requirement in the near future");const n=o.split("#")[1],a=t.verificationMethod.find(e=>e.id===`#${n}`||e.id===o);if(!a)throw new e("retrieveVerificationMethodPublicKey",`${r} - ${i.i18n.getText("errors","retrieveVerificationMethodPublicKey")}`);return{...a}}export{t as r};
1
+ import{V as e,d as i}from"./main.js";import{b as r}from"./index-KzSDgEl9-Dgus2xdV.js";function t(t,o){if(!t.verificationMethod)return void console.warn("No verification method found in the issuer document. This will likely become a requirement in the near future");const n=o.split("#")[1],a=t.verificationMethod.find(e=>e.id===`#${n}`||e.id===o);if(!a)throw new e("retrieveVerificationMethodPublicKey",`${r} - ${i.i18n.getText("errors","retrieveVerificationMethodPublicKey")}`);return{...a}}export{t as r};
@@ -0,0 +1 @@
1
+ import{H as r,I as t}from"./main.js";async function e(e){if(!e.proof)return void console.warn("No proof found in the issuer profile.");let o=e.proof.type;"DataIntegrityProof"===o&&(o=r(e.proof.cryptosuite));const a=await async function(r){if(r===t.MerkleProof2019){const{default:r}=await import("./MerkleProof2019-DJbo7uW--CHlhsnHk.js");return r}if(r===t.Ed25519Signature2020){const{default:r}=await import("./Ed25519Signature2020-D2tdrIA4-PSi5TCQH.js");return r}if(r===t.EcdsaSecp256k1Signature2019){const{default:r}=await import("./EcdsaSecp256k1Signature2019-BRdQnZ0o-D_QN8KrS.js");return r}if(r===t.EcdsaSd2023){const{default:r}=await import("./EcdsaSd2023-D2eJBmaY-mHNjbn8h.js");return r}}(o),i=new a({document:e,proof:e.proof,issuer:e.issuer?e.issuer:e,executeStep:async(r,t,e)=>t()});await i.init();try{await i.verifyProof()}catch(r){throw new Error(`Issuer profile verification failed: ${r.message}`)}}export{e as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockcerts/blockcerts-verifier",
3
- "version": "1.72.4",
3
+ "version": "1.73.0",
4
4
  "description": "A standalone universal viewer and verifier for blockcerts credentials",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,7 +11,7 @@
11
11
  "node": ">=20.0.0"
12
12
  },
13
13
  "dependencies": {
14
- "@blockcerts/cert-verifier-js": "^6.35.2",
14
+ "@blockcerts/cert-verifier-js": "^6.36.0",
15
15
  "@blockcerts/cert-verifier-js-v1-legacy": "^4.0.2",
16
16
  "@polymer/lit-element": "0.5.1",
17
17
  "@polymer/polymer": "3.5.2",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@commitlint/cli": "^20.1.0",
34
- "@commitlint/config-conventional": "^20.5.0",
34
+ "@commitlint/config-conventional": "^21.2.0",
35
35
  "@eslint/js": "^10.0.1",
36
36
  "@open-wc/testing": "^4.0.0",
37
37
  "@rollup/plugin-commonjs": "^29.0.2",
@@ -41,11 +41,11 @@
41
41
  "@rollup/plugin-typescript": "^12.1.2",
42
42
  "@types/mocha": "^10.0.10",
43
43
  "@types/qrcode-svg": "^1.1.1",
44
- "@types/sinon": "^21.0.0",
44
+ "@types/sinon": "^22.0.0",
45
45
  "@typescript-eslint/eslint-plugin": "^8.30.1",
46
46
  "@typescript-eslint/parser": "^8.23.0",
47
- "@vitest/coverage-istanbul": "^4.0.6",
48
- "@web/test-runner": "^0.20.1",
47
+ "@vitest/coverage-istanbul": "^4.1.10",
48
+ "@web/test-runner": "^1.0.0",
49
49
  "concurrently": "^9.1.2",
50
50
  "eslint": "^10.0.3",
51
51
  "express": "^5.1.0",
@@ -56,12 +56,12 @@
56
56
  "rollup-plugin-livereload": "^2.0.0",
57
57
  "rollup-plugin-serve": "^3.0.0",
58
58
  "rollup-plugin-visualizer": "^7.0.0",
59
- "sinon": "^21.0.0",
60
- "stylelint": "^16.9.0",
59
+ "sinon": "^22.0.0",
60
+ "stylelint": "^17.7.0",
61
61
  "stylelint-config-standard-scss": "^15.0.1",
62
62
  "typescript": "^5.8.3",
63
63
  "typescript-eslint": "^8.29.1",
64
- "vitest": "^4.0.6",
64
+ "vitest": "^4.1.10",
65
65
  "wc-sass-render": "blockchain-certificates/wc-sass-render"
66
66
  },
67
67
  "scripts": {
@@ -1 +0,0 @@
1
- import{d as e,p as t,a as i,w as o,x as r,E as n,V as s}from"./main.js";import{j as c}from"./jsonld-signatures-BtZPa7MV-DTekMXP5.js";import{S as a,j as d}from"./Suite-CBLHluYK-Dmvbh142.js";import"./pako.esm-BGRKTPxS-Bodm4Eha.js";import"./index-6G1g4ypj-Dgus2xdV.js";import{r as h}from"./retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js";const u="https://ns.did.ai/suites/secp256k1-2019/v1",p="https://www.w3.org/ns/credentials/v2",f=({document:e,contextUrl:t})=>{const i=e["@context"];return Array.isArray(i)?t.some(e=>i.includes(e)):t.includes(i)},y=({document:e})=>{const t=f({document:e,contextUrl:[u,"https://w3id.org/security/suites/secp256k1-2019/v1"]}),i=f({document:e,contextUrl:["https://www.w3.org/2018/credentials/v1"]}),o=f({document:e,contextUrl:[p]}),r=f({document:e,contextUrl:["https://w3id.org/security/v2"]});return t&&i?(console.warn("Warning: The secp256k1-2019/v1 and credentials/v1 contexts are incompatible."),console.warn("For VCs using EcdsaSecp256k1Signature2019 suite, using the credentials/v1 context is sufficient."),!1):!t&&o?(console.warn("This library does not (yet) follow the Data Integrity Proof format."),console.warn("When using the credentials/v2 context, consumers need to specify the secp256k1-2019/v1 context."),!1):t&&r?(console.warn("Warning: The secp256k1-2019/v1 and security/v2 contexts are incompatible."),console.warn("For VCs using EcdsaSecp256k1Signature2019 suite, using the security/v2 context is sufficient."),!1):t||i||r};let l=class extends c.suites.LinkedDataSignature{requiredKeyType;constructor(e={}){super({type:"EcdsaSecp256k1Signature2019",LDKeyClass:n,contextUrl:u,...e}),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:i}){const{jws:o}=i;if(!o||"string"!=typeof o)throw new TypeError('The proof does not include a valid "jws" property.');let{verifier:r}=this;if(!r){r=(await this.LDKeyClass.from(t)).verifier()}return r.verify({data:e,signature:o})}async assertVerificationMethod({verificationMethod:e}){if(!y({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 i="object"==typeof e.verificationMethod?e.verificationMethod.id:e.verificationMethod;if(!i)throw new Error('No "verificationMethod" found in proof.');const o=await d.frame(i,{"@context":this.contextUrl,"@embed":"@always",id:i},{documentLoader:t,compactToRelative:!1});if(!o)throw new Error(`Verification method ${i} not found.`);if(void 0!==o.revoked)throw new Error("The verification method has been revoked.");return await this.assertVerificationMethod({verificationMethod:o}),o}async matchProof({proof:e,document:t,purpose:i,documentLoader:o,expansionMap:r}){if(!y({document:t}))return!1;if(!await super.matchProof({proof:e,document:t,purpose:i,documentLoader:o,expansionMap:r}))return!1;if(!this.key)return!0;const{verificationMethod:n}=e,s="object"==typeof n?n.id:n;return this.isVerificationMethodMatchingKeyId(s)}ensureSuiteContext({document:e,addSuiteContext:t}){y({document:e})&&!f({document:e,contextUrl:[p]})||super.ensureSuiteContext({document:e,addSuiteContext:t})}isVerificationMethodMatchingKeyId(e){return e===this.key.id||e===`${this.key.controller}${this.key.id}`}};l.CONTEXT_URL=u,l.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{purposes:{AssertionProofPurpose:g,AuthenticationProofPurpose:w}}=c;var m;!function(e){e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.ensureVerificationMethodValidity="ensureVerificationMethodValidity",e.checkDocumentSignature="checkDocumentSignature"}(m||(m={}));class v extends a{verificationProcess=[m.retrieveVerificationMethodPublicKey,m.ensureVerificationMethodValidity,m.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSecp256k1Signature2019";verificationKey;verificationMethod;publicKey;proofPurpose;challenge;domain;proofPurposeMap;constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.issuer=e.issuer,this.proof=e.proof,this.proofPurpose=e.proofPurpose??"assertionMethod",this.challenge=e.proofChallenge??"",this.domain=e.proofDomain,this.proofPurposeMap={authentication:w,assertionMethod:g},this.validateProofType()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map(i=>e.verifier.convertToVerificationSubsteps(t,i))}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,i){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(){t[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(e){return e in t?{contextUrl:null,document:t[e],documentUrl:e}:d.documentLoader(e)}}retrieveInitialDocument(){const e=i(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(){if(this.issuer.didDocument){if(this.findVerificationMethod(this.issuer.didDocument.verificationMethod,this.issuer.didDocument.id))return this.issuer.didDocument}const e={...this.issuer};return delete e.didDocument,e}findVerificationMethod(e,t){return e.find(e=>e.id===this.proof.verificationMethod||t+e.id===this.proof.verificationMethod)??null}getErrorMessage(e){return e.error.errors[0].message}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(m.retrieveVerificationMethodPublicKey,async()=>{if(this.verificationMethod=h(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod),this.verificationMethod.publicKeyJwk&&!this.verificationMethod.publicKeyBase58){const e=o(this.verificationMethod.publicKeyJwk);this.verificationMethod.publicKeyBase58=r(e),this.documentToVerify["@context"].includes("https://www.w3.org/ns/credentials/v2")&&!this.documentToVerify["@context"].includes("https://w3id.org/security/suites/secp256k1-2019/v1")&&this.documentToVerify["@context"].push("https://w3id.org/security/suites/secp256k1-2019/v1")}this.publicKey=this.verificationMethod.publicKeyBase58;const e=n.from({...this.verificationMethod});if(!e)throw new s(m.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(e.revoked)throw new s(m.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return e},this.type)}async ensureVerificationMethodValidity(){await this.executeStep(m.ensureVerificationMethodValidity,async()=>{if(this.verificationMethod.expires){if(new Date(this.verificationMethod.expires).getTime()<Date.now())throw new s(m.ensureVerificationMethodValidity,"The verification key has expired")}if(this.verificationMethod.revoked)throw new s(m.ensureVerificationMethodValidity,"The verification key has been revoked")},this.type)}async checkDocumentSignature(){await this.executeStep(m.checkDocumentSignature,async()=>{const e=new l({key:this.verificationKey});e.date=new Date(Date.now()).toISOString(),"authentication"!==this.proofPurpose||this.proof.challenge||(this.proof.challenge="");const t=await c.verify(this.retrieveInitialDocument(),{suite:e,purpose:new this.proofPurposeMap[this.proofPurpose]({controller:this.getTargetVerificationMethodContainer(),challenge:this.challenge,domain:this.domain}),documentLoader:this.generateDocumentLoader()});if(!t.verified)throw console.error(JSON.stringify(t,null,2)),new s(m.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed: ${this.getErrorMessage(t)}`);console.log("Credential Secp256k1 signature successfully verified")},this.type)}}export{v as default};
@@ -1 +0,0 @@
1
- import{d as e,r as t,V as i,g as s,i as r,B as o,a,p as n}from"./main.js";import"./pako.esm-BGRKTPxS-Bodm4Eha.js";import{S as c,j as h}from"./Suite-CBLHluYK-Dmvbh142.js";import{s as u}from"./sha2-JcCWfgvE-By1_saxP.js";import{e as p}from"./ensureValidIssuingKey-DN2kpCwj-DY8BTObG.js";import"./index-6G1g4ypj-Dgus2xdV.js";function f(e){e=e.trim();const t=[];for(let i=0;i<e.length;i+=2)t.push(parseInt(e.substring(i,i+2),16));return t}function l(e){const t=a(e);return"proof"in t?function(e){const t=a(e);if(!Array.isArray(e.proof))return delete t.proof,t;const i=e.proof.find(e=>"ChainedProof2021"!==e.type);return t.proof=i,t}(t):("signature"in t&&delete t.signature,t)}async function d(e){e["@context"].find(e=>r(e)&&"@vocab"in e)||e["@context"].push({"@vocab":"http://fallback.org/"});const t=l(e),a={algorithm:"URDNA2015",format:"application/nquads",documentLoader:function(e){return e in n?{contextUrl:null,document:n[e],documentUrl:e}:h.documentLoader(e)}};let c;try{c=await h.normalize(t,a)}catch(e){throw console.error(e),new i("computeLocalHash",s("errors","failedJsonLdNormalization"))}const p=function(e){const t=e.split("\n"),i=/<http:\/\/fallback\.org\/(.*)>/,s=t.map(e=>i.exec(e)).filter(e=>null!=e);if(s.length>0){const e=s.map(e=>e[1]).sort();return Array.from(new Set(e))}return null}(c);if(p)throw new i("computeLocalHash",`${s("errors","foundUnmappedFields")}: ${p.join(", ")}`);return o.from(u(Uint8Array.from(function(e){const t=[];for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);s<128?t.push(s):s<2048?t.push(192|s>>6,128|63&s):s<55296||s>=57344?t.push(224|s>>12,128|s>>6&63,128|63&s):(i++,s=65536+((1023&s)<<10|1023&e.charCodeAt(i)),t.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s))}return t}(c)))).toString("hex")}var y;!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.checkAuthenticity="checkAuthenticity"}(y||(y={}));class m extends c{verificationProcess=[y.getTransactionId,y.computeLocalHash,y.fetchRemoteHash,y.compareHashes,y.checkMerkleRoot,y.checkReceipt,y.parseIssuerKeys,y.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;proof;type="MerkleProof2017";constructor(t){super(t),t.executeStep&&(this.executeStep=t.executeStep),this.documentToVerify=t.document,this.explorerAPIs=t.explorerAPIs,this.issuer=t.issuer,this.proof=t.proof,this.validateProofType(),this.receipt=this.documentToVerify.signature,this.chain=e.certificates.getChain("",this.receipt),this.transactionId=e.certificates.getTransactionId(this.receipt),this.adaptVerificationProcessToChain()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map(i=>e.verifier.convertToVerificationSubsteps(t,i))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return e.chains.isMockChain(this.chain)?"This mock chain does not support issuing addresses":this.txData?this.txData.issuingAddress:void console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?")}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){const e=new URL(this.getIssuerProfileUrl());return e?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.documentToVerify.issuedOn}getChain(){return this.chain}getReceipt(){return this.receipt}getTransactionIdString(){return e.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return e.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return e.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}validateProofType(){if(this.proof.type[0]!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${this.proof.type[0]}`)}adaptVerificationProcessToChain(){e.chains.isMockChain(this.chain)&&(t(this.verificationProcess,y.getTransactionId),t(this.verificationProcess,y.fetchRemoteHash),t(this.verificationProcess,y.parseIssuerKeys),t(this.verificationProcess,y.checkMerkleRoot),t(this.verificationProcess,y.checkAuthenticity))}async executeStep(e,t,i){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}async getTransactionId(){await this.executeStep(y.getTransactionId,()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new i("getTransactionId",s("errors","isTransactionIdValid"))}(this.transactionId),this.type)}async computeLocalHash(){this.localHash=await this.executeStep(y.computeLocalHash,async()=>await d(this.documentToVerify),this.type)}async fetchRemoteHash(){this.txData=await this.executeStep(y.fetchRemoteHash,async()=>await e.verifier.lookForTx({transactionId:this.transactionId,chain:this.chain.code,explorerAPIs:this.explorerAPIs}),this.type)}async compareHashes(){await this.executeStep(y.compareHashes,()=>function(e,t){if(e!==t)throw new i("compareHashes",s("errors","ensureHashesEqual"));return!0}(this.localHash,this.receipt.targetHash),this.type)}async checkMerkleRoot(){await this.executeStep(y.checkMerkleRoot,()=>function(e,t){if(e!==t)throw new i("checkMerkleRoot",s("errors","ensureMerkleRootEqual"));return!0}(this.receipt.merkleRoot,this.txData.remoteHash),this.type)}async checkReceipt(){await this.executeStep(y.checkReceipt,()=>{!function(e){let t=e.targetHash;const r=e.merkleRoot;try{const s=e.proof??e.path;if(s)for(const e in s){const r=s[e];let a;if(void 0!==r.left)a=f(`${r.left}${t}`),t=o.from(u(Uint8Array.from(a))).toString("hex");else{if(void 0===r.right)throw new i("checkReceipt","Trigger catch error.");a=f(`${t}${r.right}`),t=o.from(u(Uint8Array.from(a))).toString("hex")}}}catch(e){throw new i("checkReceipt",s("errors","ensureValidReceipt"))}if(t!==r)throw new i("checkReceipt",s("errors","invalidMerkleReceipt"))}(this.receipt)},this.type)}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(y.parseIssuerKeys,()=>e.verifier.parseIssuerKeys(this.issuer),this.type)}async checkAuthenticity(){await this.executeStep(y.checkAuthenticity,()=>{p(this.issuerPublicKeyList,this.txData.issuingAddress,this.txData.time)},this.type)}}export{m as default};
@@ -1,5 +0,0 @@
1
- import{r as e}from"./index-DNlz8u7B-CYTlxhyY.js";import{d as t,b as r,r as n,c as i,l as o,e as s,B as a,f as c,S as u,h,p as f,P as l,j as d,k as p,m as y,n as g,o as E}from"./main.js";import{j as m}from"./jsonld-signatures-BtZPa7MV-DTekMXP5.js";import{S as _,j as w}from"./Suite-CBLHluYK-Dmvbh142.js";import{s as b}from"./sha2-JcCWfgvE-By1_saxP.js";import{t as P,a as I}from"./index-DFOHyoZq-BCuOIg2Z.js";import"./pako.esm-BGRKTPxS-Bodm4Eha.js";import{e as A}from"./ensureValidIssuingKey-DN2kpCwj-DY8BTObG.js";import"./index-6G1g4ypj-Dgus2xdV.js";import{r as T}from"./retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js";var O,v,S,N,U,R,k={type:"object",required:["merkleRoot","targetHash","anchors"],properties:{merkleRoot:{type:"string",minLength:64,maxLength:64},targetHash:{type:"string",minLength:64,maxLength:64},anchors:{type:"array",minItems:1,contains:{type:"string"}}}};!function(){if(N)return S;N=1;const t=function(){if(v)return O;v=1;const t=k,{validator:r}=e(),n=r(t);return O=n}();S={validate:t}}();var B,M,L=h(R?U:(R=1,U={root:{merkleRoot:0,targetHash:1,anchors:2,path:3},path:{left:0,right:1},chain:{btc:{id:0,networks:{mainnet:1,testnet:3}},eth:{id:1,networks:{mainnet:1,ropsten:3,rinkeby:4,goerli:5,sepolia:11155111}},mtc:{id:2,networks:{mainnet:137,mumbai:80001}},mocknet:{id:-1,networks:{mocknet:-1}}}})),x={};function D(){if(M)return B;M=1;const e=p,{Buffer:t}=d,r=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0});class n extends e.Transform{constructor(e,r,n={}){let i=null,o=null;switch(typeof e){case"object":t.isBuffer(e)?i=e:e&&(n=e);break;case"string":i=e;break;case"undefined":break;default:throw new TypeError("Invalid input")}switch(typeof r){case"object":r&&(n=r);break;case"string":o=r;break;case"undefined":break;default:throw new TypeError("Invalid inputEncoding")}if(!n||"object"!=typeof n)throw new TypeError("Invalid options");null==i&&(i=n.input),null==o&&(o=n.inputEncoding),delete n.input,delete n.inputEncoding;const s=null==n.watchPipe||n.watchPipe;delete n.watchPipe;const a=Boolean(n.readError);delete n.readError,super(n),this.readError=a,s&&this.on("pipe",e=>{const t=e._readableState.objectMode;if(this.length>0&&t!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");this._readableState.objectMode=t,this._writableState.objectMode=t}),null!=i&&this.end(i,o)}static isNoFilter(e){return e instanceof this}static compare(e,t){if(!(e instanceof this))throw new TypeError("Arguments must be NoFilters");return e===t?0:e.compare(t)}static concat(e,r){if(!Array.isArray(e))throw new TypeError("list argument must be an Array of NoFilters");if(0===e.length||0===r)return t.alloc(0);null==r&&(r=e.reduce((e,t)=>{if(!(t instanceof n))throw new TypeError("list argument must be an Array of NoFilters");return e+t.length},0));let i=!0,o=!0;const s=e.map(e=>{if(!(e instanceof n))throw new TypeError("list argument must be an Array of NoFilters");const r=e.slice();return t.isBuffer(r)?o=!1:i=!1,r});if(i)return t.concat(s,r);if(o)return[].concat(...s).slice(0,r);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(e,r,n){this._readableState.objectMode||t.isBuffer(e)||(e=t.from(e,r)),this.push(e),n()}_bufArray(){let e=this._readableState.buffer;if(!Array.isArray(e)){let t=e.head;for(e=[];null!=t;)e.push(t.data),t=t.next}return e}read(e){const t=super.read(e);if(null!=t){if(this.emit("read",t),this.readError&&t.length<e)throw new Error(`Read ${t.length}, wanted ${e}`)}else if(this.readError)throw new Error(`No data available, wanted ${e}`);return t}readFull(e){let t=null,r=null,n=null;return new Promise((i,o)=>{this.length>=e?i(this.read(e)):this.writableFinished?o(new Error(`Stream finished before ${e} bytes were available`)):(t=t=>{this.length>=e&&i(this.read(e))},r=()=>{o(new Error(`Stream finished before ${e} bytes were available`))},n=o,this.on("readable",t),this.on("error",n),this.on("finish",r))}).finally(()=>{t&&(this.removeListener("readable",t),this.removeListener("error",n),this.removeListener("finish",r))})}promise(e){let t=!1;return new Promise((r,n)=>{this.on("finish",()=>{const n=this.read();null==e||t||(t=!0,e(null,n)),r(n)}),this.on("error",r=>{null==e||t||(t=!0,e(r)),n(r)})})}compare(e){if(!(e instanceof n))throw new TypeError("Arguments must be NoFilters");if(this===e)return 0;const r=this.slice(),i=e.slice();if(t.isBuffer(r)&&t.isBuffer(i))return r.compare(i);throw new Error("Cannot compare streams in object mode")}equals(e){return 0===this.compare(e)}slice(e,r){if(this._readableState.objectMode)return this._bufArray().slice(e,r);const n=this._bufArray();switch(n.length){case 0:return t.alloc(0);case 1:return n[0].slice(e,r);default:return t.concat(n).slice(e,r)}}get(e){return this.slice()[e]}toJSON(){const e=this.slice();return t.isBuffer(e)?e.toJSON():e}toString(e,n,i){const o=this.slice(n,i);return t.isBuffer(o)?e&&"utf8"!==e?o.toString(e):r.decode(o):JSON.stringify(o)}[Symbol.for("nodejs.util.inspect.custom")](e,r){const n=this._bufArray().map(e=>t.isBuffer(e)?r.stylize(e.toString("hex"),"string"):JSON.stringify(e)).join(", ");return`${this.constructor.name} [${n}]`}get length(){return this._readableState.length}writeBigInt(e){let r=e.toString(16);if(e<0){const t=BigInt(Math.floor(r.length/2));r=(e=(BigInt(1)<<t*BigInt(8))+e).toString(16)}return r.length%2&&(r=`0${r}`),this.push(t.from(r,"hex"))}readUBigInt(e){const r=this.read(e);return t.isBuffer(r)?BigInt(`0x${r.toString("hex")}`):null}readBigInt(e){const r=this.read(e);if(!t.isBuffer(r))return null;let n=BigInt(`0x${r.toString("hex")}`);if(128&r[0]){n-=BigInt(1)<<BigInt(r.length)*BigInt(8)}return n}writeUInt8(e){const r=t.from([e]);return this.push(r)}writeUInt16LE(e){const r=t.alloc(2);return r.writeUInt16LE(e),this.push(r)}writeUInt16BE(e){const r=t.alloc(2);return r.writeUInt16BE(e),this.push(r)}writeUInt32LE(e){const r=t.alloc(4);return r.writeUInt32LE(e),this.push(r)}writeUInt32BE(e){const r=t.alloc(4);return r.writeUInt32BE(e),this.push(r)}writeInt8(e){const r=t.from([e]);return this.push(r)}writeInt16LE(e){const r=t.alloc(2);return r.writeUInt16LE(e),this.push(r)}writeInt16BE(e){const r=t.alloc(2);return r.writeUInt16BE(e),this.push(r)}writeInt32LE(e){const r=t.alloc(4);return r.writeUInt32LE(e),this.push(r)}writeInt32BE(e){const r=t.alloc(4);return r.writeUInt32BE(e),this.push(r)}writeFloatLE(e){const r=t.alloc(4);return r.writeFloatLE(e),this.push(r)}writeFloatBE(e){const r=t.alloc(4);return r.writeFloatBE(e),this.push(r)}writeDoubleLE(e){const r=t.alloc(8);return r.writeDoubleLE(e),this.push(r)}writeDoubleBE(e){const r=t.alloc(8);return r.writeDoubleBE(e),this.push(r)}writeBigInt64LE(e){const r=t.alloc(8);return r.writeBigInt64LE(e),this.push(r)}writeBigInt64BE(e){const r=t.alloc(8);return r.writeBigInt64BE(e),this.push(r)}writeBigUInt64LE(e){const r=t.alloc(8);return r.writeBigUInt64LE(e),this.push(r)}writeBigUInt64BE(e){const r=t.alloc(8);return r.writeBigUInt64BE(e),this.push(r)}readUInt8(){const e=this.read(1);return t.isBuffer(e)?e.readUInt8():null}readUInt16LE(){const e=this.read(2);return t.isBuffer(e)?e.readUInt16LE():null}readUInt16BE(){const e=this.read(2);return t.isBuffer(e)?e.readUInt16BE():null}readUInt32LE(){const e=this.read(4);return t.isBuffer(e)?e.readUInt32LE():null}readUInt32BE(){const e=this.read(4);return t.isBuffer(e)?e.readUInt32BE():null}readInt8(){const e=this.read(1);return t.isBuffer(e)?e.readInt8():null}readInt16LE(){const e=this.read(2);return t.isBuffer(e)?e.readInt16LE():null}readInt16BE(){const e=this.read(2);return t.isBuffer(e)?e.readInt16BE():null}readInt32LE(){const e=this.read(4);return t.isBuffer(e)?e.readInt32LE():null}readInt32BE(){const e=this.read(4);return t.isBuffer(e)?e.readInt32BE():null}readFloatLE(){const e=this.read(4);return t.isBuffer(e)?e.readFloatLE():null}readFloatBE(){const e=this.read(4);return t.isBuffer(e)?e.readFloatBE():null}readDoubleLE(){const e=this.read(8);return t.isBuffer(e)?e.readDoubleLE():null}readDoubleBE(){const e=this.read(8);return t.isBuffer(e)?e.readDoubleBE():null}readBigInt64LE(){const e=this.read(8);return t.isBuffer(e)?e.readBigInt64LE():null}readBigInt64BE(){const e=this.read(8);return t.isBuffer(e)?e.readBigInt64BE():null}readBigUInt64LE(){const e=this.read(8);return t.isBuffer(e)?e.readBigUInt64LE():null}readBigUInt64BE(){const e=this.read(8);return t.isBuffer(e)?e.readBigUInt64BE():null}}return B=n}var C,V,F,H,j,G,K,$,z,Y,W,J,q,X,Q,Z,ee,te,re,ne,ie,oe,se,ae,ce={};function ue(){return C||(C=1,(e=ce).MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},e.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36,SET:258},e.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},e.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},e.SYMS={NULL:Symbol.for("github.com/hildjj/node-cbor/null"),UNDEFINED:Symbol.for("github.com/hildjj/node-cbor/undef"),PARENT:Symbol.for("github.com/hildjj/node-cbor/parent"),BREAK:Symbol.for("github.com/hildjj/node-cbor/break"),STREAM:Symbol.for("github.com/hildjj/node-cbor/stream")},e.SHIFT32=4294967296,e.BI={MINUS_ONE:BigInt(-1),NEG_MAX:BigInt(-1)-BigInt(Number.MAX_SAFE_INTEGER),MAXINT32:BigInt("0xffffffff"),MAXINT64:BigInt("0xffffffffffffffff"),SHIFT32:BigInt(e.SHIFT32)}),ce;var e}function he(){return V||(V=1,function(e){const{Buffer:t}=d,r=D(),n=p,i=ue(),{NUMBYTES:o,SHIFT32:s,BI:a,SYMS:c}=i,u=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0});e.utf8=e=>u.decode(e),e.utf8.checksUTF8=!0,e.isBufferish=function(e){return e&&"object"==typeof e&&(t.isBuffer(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof ArrayBuffer||e instanceof DataView)},e.bufferishToBuffer=function(e){return t.isBuffer(e)?e:ArrayBuffer.isView(e)?t.from(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?t.from(e):null},e.parseCBORint=function(e,t){switch(e){case o.ONE:return t.readUInt8(0);case o.TWO:return t.readUInt16BE(0);case o.FOUR:return t.readUInt32BE(0);case o.EIGHT:{const e=t.readUInt32BE(0),r=t.readUInt32BE(4);return e>2097151?BigInt(e)*a.SHIFT32+BigInt(r):e*s+r}default:throw new Error(`Invalid additional info for int: ${e}`)}},e.writeHalf=function(e,r){const n=t.allocUnsafe(4);n.writeFloatBE(r,0);const i=n.readUInt32BE(0);if(8191&i)return!1;let o=i>>16&32768;const s=i>>23&255,a=8388607&i;if(s>=113&&s<=142)o+=(s-112<<10)+(a>>13);else{if(!(s>=103&&s<113))return!1;if(a&(1<<126-s)-1)return!1;o+=a+8388608>>126-s}return e.writeUInt16BE(o),!0},e.parseHalf=function(e){const t=128&e[0]?-1:1,r=(124&e[0])>>2,n=(3&e[0])<<8|e[1];return r?31===r?t*(n?NaN:1/0):t*2**(r-25)*(1024+n):5.960464477539063e-8*t*n},e.parseCBORfloat=function(t){switch(t.length){case 2:return e.parseHalf(t);case 4:return t.readFloatBE(0);case 8:return t.readDoubleBE(0);default:throw new Error(`Invalid float size: ${t.length}`)}},e.hex=function(e){return t.from(e.replace(/^0x/,""),"hex")},e.bin=function(e){let r=0,n=(e=e.replace(/\s/g,"")).length%8||8;const i=[];for(;n<=e.length;)i.push(parseInt(e.slice(r,n),2)),r=n,n+=8;return t.from(i)},e.arrayEqual=function(e,t){return null==e&&null==t||null!=e&&null!=t&&(e.length===t.length&&e.every((e,r)=>e===t[r]))},e.bufferToBigInt=function(e){return BigInt(`0x${e.toString("hex")}`)},e.cborValueToString=function(t,r=-1){switch(typeof t){case"symbol":{switch(t){case c.NULL:return"null";case c.UNDEFINED:return"undefined";case c.BREAK:return"BREAK"}if(t.description)return t.description;const e=t.toString().match(/^Symbol\((?<name>.*)\)/);return e&&e.groups.name?e.groups.name:"Symbol"}case"string":return JSON.stringify(t);case"bigint":return t.toString();case"number":{const e=Object.is(t,-0)?"-0":String(t);return r>0?`${e}_${r}`:e}case"object":{if(!t)return"null";const n=e.bufferishToBuffer(t);if(n){const e=n.toString("hex");return r===-1/0?e:`h'${e}'`}return t&&"function"==typeof t[Symbol.for("nodejs.util.inspect.custom")]?t[Symbol.for("nodejs.util.inspect.custom")]():Array.isArray(t)?"[]":"{}"}}return String(t)},e.guessEncoding=function(t,i){if("string"==typeof t)return new r(t,null==i?"hex":i);const o=e.bufferishToBuffer(t);if(o)return new r(o);if((s=t)instanceof n.Readable||["read","on","pipe"].every(e=>"function"==typeof s[e]))return t;var s;throw new Error("Unknown input type")};const h={"=":"","+":"-","/":"_"};e.base64url=function(t){return e.bufferishToBuffer(t).toString("base64").replace(/[=+/]/g,e=>h[e])},e.base64=function(t){return e.bufferishToBuffer(t).toString("base64")},e.isBigEndian=function(){const e=new Uint8Array(4);return!((new Uint32Array(e.buffer)[0]=1)&e[0])}}(x)),x}function fe(){if(G)return j;G=1;const e=ue(),t=he(),r=Symbol("INTERNAL_JSON");function n(e,r){if(t.isBufferish(e))e.toJSON=r;else if(Array.isArray(e))for(const t of e)n(t,r);else if(e&&"object"==typeof e&&(!(e instanceof f)||e.tag<21||e.tag>23))for(const t of Object.values(e))n(t,r)}function i(){return t.base64(this)}function o(){return t.base64url(this)}function s(){return this.toString("hex")}const a={0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>t.bufferToBigInt(e),3:r=>e.BI.MINUS_ONE-t.bufferToBigInt(r),21:(e,i)=>(t.isBufferish(e)?i[r]=o:n(e,o),i),22:(e,o)=>(t.isBufferish(e)?o[r]=i:n(e,i),o),23:(e,i)=>(t.isBufferish(e)?i[r]=s:n(e,s),i),32:e=>new URL(e),33:(e,t)=>{if(!e.match(/^[a-zA-Z0-9_-]+$/))throw new Error("Invalid base64url characters");const r=e.length%4;if(1===r)throw new Error("Invalid base64url length");if(2===r){if(-1==="AQgw".indexOf(e[e.length-1]))throw new Error("Invalid base64 padding")}else if(3===r&&-1==="AEIMQUYcgkosw048".indexOf(e[e.length-1]))throw new Error("Invalid base64 padding");return t},34:(e,t)=>{const r=e.match(/^[a-zA-Z0-9+/]+(?<padding>={0,2})$/);if(!r)throw new Error("Invalid base64 characters");if(e.length%4!=0)throw new Error("Invalid base64 length");if("="===r.groups.padding){if(-1==="AQgw".indexOf(e[e.length-2]))throw new Error("Invalid base64 padding")}else if("=="===r.groups.padding&&-1==="AEIMQUYcgkosw048".indexOf(e[e.length-3]))throw new Error("Invalid base64 padding");return t},35:e=>new RegExp(e),258:e=>new Set(e)},c={64:Uint8Array,65:Uint16Array,66:Uint32Array,68:Uint8ClampedArray,69:Uint16Array,70:Uint32Array,72:Int8Array,73:Int16Array,74:Int32Array,77:Int16Array,78:Int32Array,81:Float32Array,82:Float64Array,85:Float32Array,86:Float64Array};function u(e,r){if(!t.isBufferish(e))throw new TypeError("val not a buffer");const{tag:n}=r,i=c[n];if(!i)throw new Error(`Invalid typed array tag: ${n}`);const o=2**(((16&n)>>4)+(3&n));!(4&n)!==t.isBigEndian()&&o>1&&function(e,t,r,n){const i=new DataView(e),[o,s]={2:[i.getUint16,i.setUint16],4:[i.getUint32,i.setUint32],8:[i.getBigUint64,i.setBigUint64]}[t],a=r+n;for(let e=r;e<a;e+=t)s.call(i,e,o.call(i,e,!0))}(e.buffer,o,e.byteOffset,e.byteLength);return new i(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}"undefined"!=typeof BigUint64Array&&(c[67]=BigUint64Array,c[71]=BigUint64Array),"undefined"!=typeof BigInt64Array&&(c[75]=BigInt64Array,c[79]=BigInt64Array);for(const e of Object.keys(c))a[e]=u;let h={};class f{constructor(e,t,r){if(this.tag=e,this.value=t,this.err=r,"number"!=typeof this.tag)throw new Error(`Invalid tag type (${typeof this.tag})`);if(this.tag<0||(0|this.tag)!==this.tag)throw new Error(`Tag must be a positive integer: ${this.tag}`)}toJSON(){if(this[r])return this[r].call(this.value);const e={tag:this.tag,value:this.value};return this.err&&(e.err=this.err),e}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){let t=null==e?void 0:e[this.tag];if(null===t)return this;if("function"!=typeof t&&(t=f.TAGS[this.tag],"function"!=typeof t))return this;try{return t.call(this,this.value,this)}catch(e){return e&&e.message&&e.message.length>0?this.err=e.message:this.err=e,this}}static get TAGS(){return h}static set TAGS(e){h=e}static reset(){f.TAGS={...a}}}return f.INTERNAL_JSON=r,f.reset(),j=f}function le(){if($)return K;$=1;const{MT:e,SIMPLE:t,SYMS:r}=ue();class n{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error(`value must be a small positive integer: ${e}`);this.value=e}toString(){return`simple(${this.value})`}[Symbol.for("nodejs.util.inspect.custom")](e,t){return`simple(${this.value})`}encodeCBOR(t){return t._pushInt(this.value,e.SIMPLE_FLOAT)}static isSimple(e){return e instanceof n}static decode(e,i=!0,o=!1){switch(e){case t.FALSE:return!1;case t.TRUE:return!0;case t.NULL:return i?null:r.NULL;case t.UNDEFINED:if(i)return;return r.UNDEFINED;case-1:if(!i||!o)throw new Error("Invalid BREAK");return r.BREAK;default:return new n(e)}}}return K=n}function de(){if(Y)return z;Y=1;const e=function(){if(H)return F;H=1;const e=p,t=D();class r extends e.Transform{constructor(e){super(e),this._writableState.objectMode=!1,this._readableState.objectMode=!0,this.bs=new t,this.__restart()}_transform(e,t,r){for(this.bs.write(e);this.bs.length>=this.__needed;){let e=null;const t=null===this.__needed?void 0:this.bs.read(this.__needed);try{e=this.__parser.next(t)}catch(e){return r(e)}this.__needed&&(this.__fresh=!1),e.done?(this.push(e.value),this.__restart()):this.__needed=e.value||1/0}return r()}*_parse(){throw new Error("Must be implemented in subclass")}__restart(){this.__needed=null,this.__parser=this._parse(),this.__fresh=!0}_flush(e){e(this.__fresh?null:new Error("unexpected end of input"))}}return F=r}(),t=fe(),r=le(),n=he(),i=D(),o=ue(),{MT:s,NUMBYTES:a,SYMS:c,BI:u}=o,{Buffer:h}=d,f=Symbol("count"),l=Symbol("major type"),y=Symbol("error"),g=Symbol("not found");function E(e,t,r){const n=[];return n[f]=r,n[c.PARENT]=e,n[l]=t,n}function m(e,t){const r=new i;return r[f]=-1,r[c.PARENT]=e,r[l]=t,r}class _ extends Error{constructor(e,t){super(`Unexpected data: 0x${e.toString(16)}`),this.name="UnexpectedDataError",this.byte=e,this.value=t}}function w(e,t){switch(typeof e){case"function":return{options:{},cb:e};case"string":return{options:{encoding:e},cb:t};case"object":return{options:e||{},cb:t};default:throw new TypeError("Unknown option type")}}class b extends e{constructor(e={}){const{tags:t={},max_depth:r=-1,preferMap:n=!1,preferWeb:o=!1,required:s=!1,encoding:a="hex",extendedResults:c=!1,preventDuplicateKeys:u=!1,...h}=e;super({defaultEncoding:a,...h}),this.running=!0,this.max_depth=r,this.tags=t,this.preferMap=n,this.preferWeb=o,this.extendedResults=c,this.required=s,this.preventDuplicateKeys=u,c&&(this.bs.on("read",this._onRead.bind(this)),this.valueBytes=new i)}static nullcheck(e){switch(e){case c.NULL:return null;case c.UNDEFINED:return;case g:throw new Error("Value not found");default:return e}}static decodeFirstSync(e,t={}){if(null==e)throw new TypeError("input required");({options:t}=w(t));const{encoding:r="hex",...i}=t,o=new b(i),s=n.guessEncoding(e,r),a=o._parse();let c=a.next();for(;!c.done;){const e=s.read(c.value);if(null==e||e.length!==c.value)throw new Error("Insufficient data");o.extendedResults&&o.valueBytes.write(e),c=a.next(e)}let u=null;if(o.extendedResults)u=c.value,u.unused=s.read();else if(u=b.nullcheck(c.value),s.length>0){const e=s.read(1);throw s.unshift(e),new _(e[0],u)}return u}static decodeAllSync(e,t={}){if(null==e)throw new TypeError("input required");({options:t}=w(t));const{encoding:r="hex",...i}=t,o=new b(i),s=n.guessEncoding(e,r),a=[];for(;s.length>0;){const e=o._parse();let t=e.next();for(;!t.done;){const r=s.read(t.value);if(null==r||r.length!==t.value)throw new Error("Insufficient data");o.extendedResults&&o.valueBytes.write(r),t=e.next(r)}a.push(b.nullcheck(t.value))}return a}static decodeFirst(e,t={},r=null){if(null==e)throw new TypeError("input required");({options:t,cb:r}=w(t,r));const{encoding:i="hex",required:o=!1,...s}=t,a=new b(s);let c=g;const u=n.guessEncoding(e,i),h=new Promise((e,t)=>{a.on("data",e=>{c=b.nullcheck(e),a.close()}),a.once("error",r=>a.extendedResults&&r instanceof _?(c.unused=a.bs.slice(),e(c)):(c!==g&&(r.value=c),c=y,a.close(),t(r))),a.once("end",()=>{switch(c){case g:return o?t(new Error("No CBOR found")):e(c);case y:return;default:return e(c)}})});return"function"==typeof r&&h.then(e=>r(null,e),r),u.pipe(a),h}static decodeAll(e,t={},r=null){if(null==e)throw new TypeError("input required");({options:t,cb:r}=w(t,r));const{encoding:i="hex",...o}=t,s=new b(o),a=[];s.on("data",e=>a.push(b.nullcheck(e)));const c=new Promise((e,t)=>{s.on("error",t),s.on("end",()=>e(a))});return"function"==typeof r&&c.then(e=>r(void 0,e),e=>r(e,void 0)),n.guessEncoding(e,i).pipe(s),c}close(){this.running=!1,this.__fresh=!0}_onRead(e){this.valueBytes.write(e)}*_parse(){let e=null,o=0,d=null;for(;;){if(this.max_depth>=0&&o>this.max_depth)throw new Error(`Maximum depth ${this.max_depth} exceeded`);const[p]=yield 1;if(!this.running)throw this.bs.unshift(h.from([p])),new _(p);const y=p>>5,g=31&p,w=null==e?void 0:e[l],P=null==e?void 0:e.length;switch(g){case a.ONE:this.emit("more-bytes",y,1,w,P),[d]=yield 1;break;case a.TWO:case a.FOUR:case a.EIGHT:{const e=1<<g-24;this.emit("more-bytes",y,e,w,P);const t=yield e;d=y===s.SIMPLE_FLOAT?t:n.parseCBORint(g,t);break}case 28:case 29:case 30:throw this.running=!1,new Error(`Additional info not implemented: ${g}`);case a.INDEFINITE:switch(y){case s.POS_INT:case s.NEG_INT:case s.TAG:throw new Error(`Invalid indefinite encoding for MT ${y}`)}d=-1;break;default:d=g}switch(y){case s.POS_INT:break;case s.NEG_INT:d=d===Number.MAX_SAFE_INTEGER?u.NEG_MAX:"bigint"==typeof d?u.MINUS_ONE-d:-1-d;break;case s.BYTE_STRING:case s.UTF8_STRING:switch(d){case 0:this.emit("start-string",y,d,w,P),d=y===s.UTF8_STRING?"":this.preferWeb?new Uint8Array(0):h.allocUnsafe(0);break;case-1:this.emit("start",y,c.STREAM,w,P),e=m(e,y),o++;continue;default:this.emit("start-string",y,d,w,P),d=yield d,y===s.UTF8_STRING?d=n.utf8(d):this.preferWeb&&(d=new Uint8Array(d.buffer,d.byteOffset,d.length))}break;case s.ARRAY:case s.MAP:switch(d){case 0:d=y===s.MAP?this.preferMap?new Map:{}:[];break;case-1:this.emit("start",y,c.STREAM,w,P),e=E(e,y,-1),o++;continue;default:this.emit("start",y,d,w,P),e=E(e,y,d*(y-3)),o++;continue}break;case s.TAG:this.emit("start",y,d,w,P),e=E(e,y,1),e.push(d),o++;continue;case s.SIMPLE_FLOAT:if("number"==typeof d){if(g===a.ONE&&d<32)throw new Error(`Invalid two-byte encoding of simple value ${d}`);const t=null!=e;d=r.decode(d,t,t&&e[f]<0)}else d=n.parseCBORfloat(d)}this.emit("value",d,w,P,g);let I=!1;for(;null!=e;){if(d===c.BREAK)e[f]=1;else if(Array.isArray(e))e.push(d);else{const t=e[l];if(null!=t&&t!==y)throw this.running=!1,new Error("Invalid major type in indefinite encoding");e.write(d)}if(0!==--e[f]){I=!0;break}if(--o,delete e[f],Array.isArray(e))switch(e[l]){case s.ARRAY:d=e;break;case s.MAP:{let t=!this.preferMap;if(e.length%2!=0)throw new Error(`Invalid map length: ${e.length}`);for(let r=0,n=e.length;t&&r<n;r+=2)if("string"!=typeof e[r]||"__proto__"===e[r]){t=!1;break}if(t){d={};for(let t=0,r=e.length;t<r;t+=2){if(this.preventDuplicateKeys&&Object.prototype.hasOwnProperty.call(d,e[t]))throw new Error("Duplicate keys in a map");d[e[t]]=e[t+1]}}else{d=new Map;for(let t=0,r=e.length;t<r;t+=2){if(this.preventDuplicateKeys&&d.has(e[t]))throw new Error("Duplicate keys in a map");d.set(e[t],e[t+1])}}break}case s.TAG:d=new t(e[0],e[1]).convert(this.tags);break}else if(e instanceof i)switch(e[l]){case s.BYTE_STRING:d=e.slice(),this.preferWeb&&(d=new Uint8Array(d.buffer,d.byteOffset,d.length));break;case s.UTF8_STRING:d=e.toString("utf-8")}this.emit("stop",e[l]);const r=e;e=e[c.PARENT],delete r[c.PARENT],delete r[l]}if(!I){if(this.extendedResults){const e=this.valueBytes.slice(),t={value:b.nullcheck(d),bytes:e,length:e.length};return this.valueBytes=new i,t}return d}}}}return b.NOT_FOUND=g,z=b}function pe(){if(J)return W;J=1;const e=p,t=he(),r=de(),n=D(),{MT:i,NUMBYTES:o,SYMS:s}=ue(),{Buffer:a}=d;function c(e){return e>1?"s":""}class u extends e.Transform{constructor(e={}){const{depth:t=1,max_depth:i=10,no_summary:o=!1,tags:s={},preferWeb:a,encoding:c,...u}=e;super({...u,readableObjectMode:!1,writableObjectMode:!1}),this.depth=t,this.max_depth=i,this.all=new n,s[24]||(s[24]=this._tag_24.bind(this)),this.parser=new r({tags:s,max_depth:i,preferWeb:a,encoding:c}),this.parser.on("value",this._on_value.bind(this)),this.parser.on("start",this._on_start.bind(this)),this.parser.on("start-string",this._on_start_string.bind(this)),this.parser.on("stop",this._on_stop.bind(this)),this.parser.on("more-bytes",this._on_more.bind(this)),this.parser.on("error",this._on_error.bind(this)),o||this.parser.on("data",this._on_data.bind(this)),this.parser.bs.on("read",this._on_read.bind(this))}_tag_24(e){const t=new u({depth:this.depth+1,no_summary:!0});t.on("data",e=>this.push(e)),t.on("error",e=>this.emit("error",e)),t.end(e)}_transform(e,t,r){this.parser.write(e,t,r)}_flush(e){return this.parser._flush(e)}static comment(e,r={},i=null){if(null==e)throw new Error("input required");({options:r,cb:i}=function(e,t){switch(typeof e){case"function":return{options:{},cb:e};case"string":return{options:{encoding:e},cb:t};case"number":return{options:{max_depth:e},cb:t};case"object":return{options:e||{},cb:t};default:throw new TypeError("Unknown option type")}}(r,i));const o=new n,{encoding:s="hex",...a}=r,c=new u(a);let h=null;return"function"==typeof i?(c.on("end",()=>{i(null,o.toString("utf8"))}),c.on("error",i)):h=new Promise((e,t)=>{c.on("end",()=>{e(o.toString("utf8"))}),c.on("error",t)}),c.pipe(o),t.guessEncoding(e,s).pipe(c),h}_on_error(e){this.push("ERROR: "),this.push(e.toString()),this.push("\n")}_on_read(e){this.all.write(e);const t=e.toString("hex");this.push(new Array(this.depth+1).join(" ")),this.push(t);let r=2*(this.max_depth-this.depth)-t.length;r<1&&(r=1),this.push(new Array(r+1).join(" ")),this.push("-- ")}_on_more(e,t,r,n){let o="";switch(this.depth++,e){case i.POS_INT:o="Positive number,";break;case i.NEG_INT:o="Negative number,";break;case i.ARRAY:o="Array, length";break;case i.MAP:o="Map, count";break;case i.BYTE_STRING:o="Bytes, length";break;case i.UTF8_STRING:o="String, length";break;case i.SIMPLE_FLOAT:o=1===t?"Simple value,":"Float,"}this.push(`${o} next ${t} byte${c(t)}\n`)}_on_start_string(e,t,r,n){let o="";switch(this.depth++,e){case i.BYTE_STRING:o=`Bytes, length: ${t}`;break;case i.UTF8_STRING:o=`String, length: ${t.toString()}`}this.push(`${o}\n`)}_on_start(e,t,r,n){switch(this.depth++,r){case i.ARRAY:this.push(`[${n}], `);break;case i.MAP:n%2?this.push(`{Val:${Math.floor(n/2)}}, `):this.push(`{Key:${Math.floor(n/2)}}, `)}switch(e){case i.TAG:this.push(`Tag #${t}`),24===t&&this.push(" Encoded CBOR data item");break;case i.ARRAY:t===s.STREAM?this.push("Array (streaming)"):this.push(`Array, ${t} item${c(t)}`);break;case i.MAP:t===s.STREAM?this.push("Map (streaming)"):this.push(`Map, ${t} pair${c(t)}`);break;case i.BYTE_STRING:this.push("Bytes (streaming)");break;case i.UTF8_STRING:this.push("String (streaming)")}this.push("\n")}_on_stop(e){this.depth--}_on_value(e,r,n,c){if(e!==s.BREAK)switch(r){case i.ARRAY:this.push(`[${n}], `);break;case i.MAP:n%2?this.push(`{Val:${Math.floor(n/2)}}, `):this.push(`{Key:${Math.floor(n/2)}}, `)}const u=t.cborValueToString(e,-1/0);switch("string"==typeof e||a.isBuffer(e)?(e.length>0&&(this.push(u),this.push("\n")),this.depth--):(this.push(u),this.push("\n")),c){case o.ONE:case o.TWO:case o.FOUR:case o.EIGHT:this.depth--}}_on_data(){this.push("0x"),this.push(this.all.read().toString("hex")),this.push("\n")}}return W=u}function ye(){if(X)return q;X=1;const e=p,t=de(),r=he(),n=D(),{MT:i,SYMS:o}=ue();class s extends e.Transform{constructor(e={}){const{separator:r="\n",stream_errors:n=!1,tags:i,max_depth:o,preferWeb:s,encoding:a,...c}=e;super({...c,readableObjectMode:!1,writableObjectMode:!1}),this.float_bytes=-1,this.separator=r,this.stream_errors=n,this.parser=new t({tags:i,max_depth:o,preferWeb:s,encoding:a}),this.parser.on("more-bytes",this._on_more.bind(this)),this.parser.on("value",this._on_value.bind(this)),this.parser.on("start",this._on_start.bind(this)),this.parser.on("stop",this._on_stop.bind(this)),this.parser.on("data",this._on_data.bind(this)),this.parser.on("error",this._on_error.bind(this))}_transform(e,t,r){this.parser.write(e,t,r)}_flush(e){this.parser._flush(t=>this.stream_errors?(t&&this._on_error(t),e()):e(t))}static diagnose(e,t={},i=null){if(null==e)throw new TypeError("input required");({options:t,cb:i}=function(e,t){switch(typeof e){case"function":return{options:{},cb:e};case"string":return{options:{encoding:e},cb:t};case"object":return{options:e||{},cb:t};default:throw new TypeError("Unknown option type")}}(t,i));const{encoding:o="hex",...a}=t,c=new n,u=new s(a);let h=null;return"function"==typeof i?(u.on("end",()=>i(null,c.toString("utf8"))),u.on("error",i)):h=new Promise((e,t)=>{u.on("end",()=>e(c.toString("utf8"))),u.on("error",t)}),u.pipe(c),r.guessEncoding(e,o).pipe(u),h}_on_error(e){this.stream_errors?this.push(e.toString()):this.emit("error",e)}_on_more(e,t,r,n){e===i.SIMPLE_FLOAT&&(this.float_bytes={2:1,4:2,8:3}[t])}_fore(e,t){switch(e){case i.BYTE_STRING:case i.UTF8_STRING:case i.ARRAY:t>0&&this.push(", ");break;case i.MAP:t>0&&(t%2?this.push(": "):this.push(", "))}}_on_value(e,t,n){if(e===o.BREAK)return;this._fore(t,n);const i=this.float_bytes;this.float_bytes=-1,this.push(r.cborValueToString(e,i))}_on_start(e,t,r,n){switch(this._fore(r,n),e){case i.TAG:this.push(`${t}(`);break;case i.ARRAY:this.push("[");break;case i.MAP:this.push("{");break;case i.BYTE_STRING:case i.UTF8_STRING:this.push("(")}t===o.STREAM&&this.push("_ ")}_on_stop(e){switch(e){case i.TAG:this.push(")");break;case i.ARRAY:this.push("]");break;case i.MAP:this.push("}");break;case i.BYTE_STRING:case i.UTF8_STRING:this.push(")")}}_on_data(){this.push(this.separator)}}return q=s}function ge(){if(Z)return Q;Z=1;const e=p,t=D(),r=he(),n=ue(),{MT:i,NUMBYTES:o,SHIFT32:s,SIMPLE:a,SYMS:c,TAG:u,BI:h}=n,{Buffer:f}=d,l=i.SIMPLE_FLOAT<<5|o.TWO,y=i.SIMPLE_FLOAT<<5|o.FOUR,g=i.SIMPLE_FLOAT<<5|o.EIGHT,E=i.SIMPLE_FLOAT<<5|a.TRUE,m=i.SIMPLE_FLOAT<<5|a.FALSE,_=i.SIMPLE_FLOAT<<5|a.UNDEFINED,w=i.SIMPLE_FLOAT<<5|a.NULL,b=f.from([255]),P=f.from("f97e00","hex"),I=f.from("f9fc00","hex"),A=f.from("f97c00","hex"),T=f.from("f98000","hex"),O={};let v={};class S extends e.Transform{constructor(e={}){const{canonical:t=!1,encodeUndefined:r,disallowUndefinedKeys:n=!1,dateType:i="number",collapseBigIntegers:o=!1,detectLoops:s=!1,omitUndefinedProperties:a=!1,genTypes:c=[],...u}=e;if(super({...u,readableObjectMode:!1,writableObjectMode:!0}),this.canonical=t,this.encodeUndefined=r,this.disallowUndefinedKeys=n,this.dateType=function(e){if(!e)return"number";switch(e.toLowerCase()){case"number":return"number";case"float":return"float";case"int":case"integer":return"int";case"string":return"string"}throw new TypeError(`dateType invalid, got "${e}"`)}(i),this.collapseBigIntegers=!!this.canonical||o,this.detectLoops=void 0,"boolean"==typeof s)s&&(this.detectLoops=new WeakSet);else{if(!(s instanceof WeakSet))throw new TypeError("detectLoops must be boolean or WeakSet");this.detectLoops=s}if(this.omitUndefinedProperties=a,this.semanticTypes={...S.SEMANTIC_TYPES},Array.isArray(c))for(let e=0,t=c.length;e<t;e+=2)this.addSemanticType(c[e],c[e+1]);else for(const[e,t]of Object.entries(c))this.addSemanticType(e,t)}_transform(e,t,r){r(!1===this.pushAny(e)?new Error("Push Error"):void 0)}_flush(e){e()}_pushUInt8(e){const t=f.allocUnsafe(1);return t.writeUInt8(e,0),this.push(t)}_pushUInt16BE(e){const t=f.allocUnsafe(2);return t.writeUInt16BE(e,0),this.push(t)}_pushUInt32BE(e){const t=f.allocUnsafe(4);return t.writeUInt32BE(e,0),this.push(t)}_pushFloatBE(e){const t=f.allocUnsafe(4);return t.writeFloatBE(e,0),this.push(t)}_pushDoubleBE(e){const t=f.allocUnsafe(8);return t.writeDoubleBE(e,0),this.push(t)}_pushNaN(){return this.push(P)}_pushInfinity(e){const t=e<0?I:A;return this.push(t)}_pushFloat(e){if(this.canonical){const t=f.allocUnsafe(2);if(r.writeHalf(t,e))return this._pushUInt8(l)&&this.push(t)}return Math.fround(e)===e?this._pushUInt8(y)&&this._pushFloatBE(e):this._pushUInt8(g)&&this._pushDoubleBE(e)}_pushInt(e,t,r){const n=t<<5;if(e<24)return this._pushUInt8(n|e);if(e<=255)return this._pushUInt8(n|o.ONE)&&this._pushUInt8(e);if(e<=65535)return this._pushUInt8(n|o.TWO)&&this._pushUInt16BE(e);if(e<=4294967295)return this._pushUInt8(n|o.FOUR)&&this._pushUInt32BE(e);let a=Number.MAX_SAFE_INTEGER;return t===i.NEG_INT&&a--,e<=a?this._pushUInt8(n|o.EIGHT)&&this._pushUInt32BE(Math.floor(e/s))&&this._pushUInt32BE(e%s):t===i.NEG_INT?this._pushFloat(r):this._pushFloat(e)}_pushIntNum(e){return Object.is(e,-0)?this.push(T):e<0?this._pushInt(-e-1,i.NEG_INT,e):this._pushInt(e,i.POS_INT)}_pushNumber(e){return isNaN(e)?this._pushNaN():isFinite(e)?Math.round(e)===e?this._pushIntNum(e):this._pushFloat(e):this._pushInfinity(e)}_pushString(e){const t=f.byteLength(e,"utf8");return this._pushInt(t,i.UTF8_STRING)&&this.push(e,"utf8")}_pushBoolean(e){return this._pushUInt8(e?E:m)}_pushUndefined(e){switch(typeof this.encodeUndefined){case"undefined":return this._pushUInt8(_);case"function":return this.pushAny(this.encodeUndefined(e));case"object":{const e=r.bufferishToBuffer(this.encodeUndefined);if(e)return this.push(e)}}return this.pushAny(this.encodeUndefined)}_pushNull(e){return this._pushUInt8(w)}_pushTag(e){return this._pushInt(e,i.TAG)}_pushJSBigint(e){let t=i.POS_INT,r=u.POS_BIGINT;if(e<0&&(e=-e+h.MINUS_ONE,t=i.NEG_INT,r=u.NEG_BIGINT),this.collapseBigIntegers&&e<=h.MAXINT64)return e<=4294967295?this._pushInt(Number(e),t):this._pushUInt8(t<<5|o.EIGHT)&&this._pushUInt32BE(Number(e/h.SHIFT32))&&this._pushUInt32BE(Number(e%h.SHIFT32));let n=e.toString(16);n.length%2&&(n=`0${n}`);const s=f.from(n,"hex");return this._pushTag(r)&&S._pushBuffer(this,s)}_pushObject(e,t){if(!e)return this._pushNull(e);if(!(t={indefinite:!1,skipTypes:!1,...t}).indefinite&&this.detectLoops){if(this.detectLoops.has(e))throw new Error("Loop detected while CBOR encoding.\nCall removeLoopDetectors before resuming.");this.detectLoops.add(e)}if(!t.skipTypes){const t=e.encodeCBOR;if("function"==typeof t)return t.call(e,this);const r=this.semanticTypes[e.constructor.name];if(r)return r.call(e,this,e)}const r=Object.keys(e).filter(t=>{const r=typeof e[t];return"function"!==r&&(!this.omitUndefinedProperties||"undefined"!==r)}),n={};if(this.canonical&&r.sort((e,t)=>{const r=n[e]||(n[e]=S.encode(e)),i=n[t]||(n[t]=S.encode(t));return r.compare(i)}),t.indefinite){if(!this._pushUInt8(i.MAP<<5|o.INDEFINITE))return!1}else if(!this._pushInt(r.length,i.MAP))return!1;let s=null;for(let t=0,i=r.length;t<i;t++){const i=r[t];if(this.canonical&&(s=n[i])){if(!this.push(s))return!1}else if(!this._pushString(i))return!1;if(!this.pushAny(e[i]))return!1}if(t.indefinite){if(!this.push(b))return!1}else this.detectLoops&&this.detectLoops.delete(e);return!0}_encodeAll(e){const r=new t({highWaterMark:this.readableHighWaterMark});this.pipe(r);for(const t of e)this.pushAny(t);return this.end(),r.read()}addSemanticType(e,t){const r="string"==typeof e?e:e.name,n=this.semanticTypes[r];if(t){if("function"!=typeof t)throw new TypeError("fun must be of type function");this.semanticTypes[r]=t}else n&&delete this.semanticTypes[r];return n}pushAny(e){switch(typeof e){case"number":return this._pushNumber(e);case"bigint":return this._pushJSBigint(e);case"string":return this._pushString(e);case"boolean":return this._pushBoolean(e);case"undefined":return this._pushUndefined(e);case"object":return this._pushObject(e);case"symbol":switch(e){case c.NULL:return this._pushNull(null);case c.UNDEFINED:return this._pushUndefined(void 0);default:throw new TypeError(`Unknown symbol: ${e.toString()}`)}default:throw new TypeError(`Unknown type: ${typeof e}, ${"function"==typeof e.toString?e.toString():""}`)}}static pushArray(e,t,r){r={indefinite:!1,...r};const n=t.length;if(r.indefinite){if(!e._pushUInt8(i.ARRAY<<5|o.INDEFINITE))return!1}else if(!e._pushInt(n,i.ARRAY))return!1;for(let r=0;r<n;r++)if(!e.pushAny(t[r]))return!1;return!(r.indefinite&&!e.push(b))}removeLoopDetectors(){return!!this.detectLoops&&(this.detectLoops=new WeakSet,!0)}static _pushDate(e,t){switch(e.dateType){case"string":return e._pushTag(u.DATE_STRING)&&e._pushString(t.toISOString());case"int":return e._pushTag(u.DATE_EPOCH)&&e._pushIntNum(Math.round(t.getTime()/1e3));case"float":return e._pushTag(u.DATE_EPOCH)&&e._pushFloat(t.getTime()/1e3);default:return e._pushTag(u.DATE_EPOCH)&&e.pushAny(t.getTime()/1e3)}}static _pushBuffer(e,t){return e._pushInt(t.length,i.BYTE_STRING)&&e.push(t)}static _pushNoFilter(e,t){return S._pushBuffer(e,t.slice())}static _pushRegexp(e,t){return e._pushTag(u.REGEXP)&&e.pushAny(t.source)}static _pushSet(e,t){if(!e._pushTag(u.SET))return!1;if(!e._pushInt(t.size,i.ARRAY))return!1;for(const r of t)if(!e.pushAny(r))return!1;return!0}static _pushURL(e,t){return e._pushTag(u.URI)&&e.pushAny(t.toString())}static _pushBoxed(e,t){return e.pushAny(t.valueOf())}static _pushMap(e,r,n){n={indefinite:!1,...n};let s=[...r.entries()];if(e.omitUndefinedProperties&&(s=s.filter(([e,t])=>void 0!==t)),n.indefinite){if(!e._pushUInt8(i.MAP<<5|o.INDEFINITE))return!1}else if(!e._pushInt(s.length,i.MAP))return!1;if(e.canonical){const r=new S({genTypes:e.semanticTypes,canonical:e.canonical,detectLoops:Boolean(e.detectLoops),dateType:e.dateType,disallowUndefinedKeys:e.disallowUndefinedKeys,collapseBigIntegers:e.collapseBigIntegers}),n=new t({highWaterMark:e.readableHighWaterMark});r.pipe(n),s.sort(([e],[t])=>{r.pushAny(e);const i=n.read();r.pushAny(t);const o=n.read();return i.compare(o)});for(const[t,r]of s){if(e.disallowUndefinedKeys&&void 0===t)throw new Error("Invalid Map key: undefined");if(!e.pushAny(t)||!e.pushAny(r))return!1}}else for(const[t,r]of s){if(e.disallowUndefinedKeys&&void 0===t)throw new Error("Invalid Map key: undefined");if(!e.pushAny(t)||!e.pushAny(r))return!1}return!(n.indefinite&&!e.push(b))}static _pushTypedArray(e,t){let n=64,i=t.BYTES_PER_ELEMENT;const{name:o}=t.constructor;return o.startsWith("Float")?(n|=16,i/=2):o.includes("U")||(n|=8),(o.includes("Clamped")||1!==i&&!r.isBigEndian())&&(n|=4),n|={1:0,2:1,4:2,8:3}[i],!!e._pushTag(n)&&S._pushBuffer(e,f.from(t.buffer,t.byteOffset,t.byteLength))}static _pushArrayBuffer(e,t){return S._pushBuffer(e,f.from(t))}static encodeIndefinite(e,t,n={}){if(null==t){if(null==this)throw new Error("No object to encode");t=this}const{chunkSize:s=4096}=n;let a=!0;const c=typeof t;let u=null;if("string"===c){a=a&&e._pushUInt8(i.UTF8_STRING<<5|o.INDEFINITE);let r=0;for(;r<t.length;){const n=r+s;a=a&&e._pushString(t.slice(r,n)),r=n}a=a&&e.push(b)}else if(u=r.bufferishToBuffer(t)){a=a&&e._pushUInt8(i.BYTE_STRING<<5|o.INDEFINITE);let t=0;for(;t<u.length;){const r=t+s;a=a&&S._pushBuffer(e,u.slice(t,r)),t=r}a=a&&e.push(b)}else if(Array.isArray(t))a=a&&S.pushArray(e,t,{indefinite:!0});else if(t instanceof Map)a=a&&S._pushMap(e,t,{indefinite:!0});else{if("object"!==c)throw new Error("Invalid indefinite encoding");a=a&&e._pushObject(t,{indefinite:!0,skipTypes:!0})}return a}static encode(...e){return(new S)._encodeAll(e)}static encodeCanonical(...e){return new S({canonical:!0})._encodeAll(e)}static encodeOne(e,t){return new S(t)._encodeAll([e])}static encodeAsync(e,t){return new Promise((r,n)=>{const i=[],o=new S(t);o.on("data",e=>i.push(e)),o.on("error",n),o.on("finish",()=>r(f.concat(i))),o.pushAny(e),o.end()})}static get SEMANTIC_TYPES(){return v}static set SEMANTIC_TYPES(e){v=e}static reset(){S.SEMANTIC_TYPES={...O}}}return Object.assign(O,{Array:S.pushArray,Date:S._pushDate,Buffer:S._pushBuffer,[f.name]:S._pushBuffer,Map:S._pushMap,NoFilter:S._pushNoFilter,[t.name]:S._pushNoFilter,RegExp:S._pushRegexp,Set:S._pushSet,ArrayBuffer:S._pushArrayBuffer,Uint8ClampedArray:S._pushTypedArray,Uint8Array:S._pushTypedArray,Uint16Array:S._pushTypedArray,Uint32Array:S._pushTypedArray,Int8Array:S._pushTypedArray,Int16Array:S._pushTypedArray,Int32Array:S._pushTypedArray,Float32Array:S._pushTypedArray,Float64Array:S._pushTypedArray,URL:S._pushURL,Boolean:S._pushBoxed,Number:S._pushBoxed,String:S._pushBoxed}),"undefined"!=typeof BigUint64Array&&(O[BigUint64Array.name]=S._pushTypedArray),"undefined"!=typeof BigInt64Array&&(O[BigInt64Array.name]=S._pushTypedArray),S.reset(),Q=S}function Ee(){if(te)return ee;te=1;const{Buffer:e}=d,t=ge(),r=de(),{MT:n}=ue();class i extends Map{constructor(e){super(e)}static _encode(e){return t.encodeCanonical(e).toString("base64")}static _decode(e){return r.decodeFirstSync(e,"base64")}get(e){return super.get(i._encode(e))}set(e,t){return super.set(i._encode(e),t)}delete(e){return super.delete(i._encode(e))}has(e){return super.has(i._encode(e))}*keys(){for(const e of super.keys())yield i._decode(e)}*entries(){for(const e of super.entries())yield[i._decode(e[0]),e[1]]}[Symbol.iterator](){return this.entries()}forEach(e,t=this){if("function"!=typeof e)throw new TypeError("Must be function");for(const r of super.entries())e.call(t,r[1],i._decode(r[0]),this)}encodeCBOR(t){if(!t._pushInt(this.size,n.MAP))return!1;if(t.canonical){const r=Array.from(super.entries()).map(t=>[e.from(t[0],"base64"),t[1]]);r.sort((e,t)=>e[0].compare(t[0]));for(const e of r)if(!t.push(e[0])||!t.pushAny(e[1]))return!1}else for(const r of super.entries())if(!t.push(e.from(r[0],"base64"))||!t.pushAny(r[1]))return!1;return!0}}return ee=i}function me(){if(oe)return ie;oe=1;const e=ge(),t=function(){if(ne)return re;ne=1;class e{constructor(){this.clear()}clear(){this.map=new WeakMap,this.count=0,this.recording=!0}stop(){this.recording=!1}check(t){const r=this.map.get(t);if(r)return r.length>1?r[0]||this.recording?r[1]:(r[0]=!0,e.FIRST):this.recording?(r.push(this.count++),r[1]):e.NEVER;if(!this.recording)throw new Error("New object detected when not recording");return this.map.set(t,[!1]),e.NEVER}}return e.NEVER=-1,e.FIRST=-2,re=e}(),{Buffer:r}=d;class n extends e{constructor(e){super(e),this.valueSharing=new t}_pushObject(e,r){if(null!==e){const r=this.valueSharing.check(e);switch(r){case t.FIRST:this._pushTag(28);break;case t.NEVER:break;default:return this._pushTag(29)&&this._pushIntNum(r)}}return super._pushObject(e,r)}stopRecording(){this.valueSharing.stop()}clearRecording(){this.valueSharing.clear()}static encode(...e){const t=new n;t.on("data",()=>{});for(const r of e)t.pushAny(r);return t.stopRecording(),t.removeAllListeners("data"),t._encodeAll(e)}static encodeCanonical(...e){throw new Error("Cannot encode canonically in a SharedValueEncoder, which serializes objects multiple times.")}static encodeOne(e,t){const r=new n(t);return r.on("data",()=>{}),r.pushAny(e),r.stopRecording(),r.removeAllListeners("data"),r._encodeAll([e])}static encodeAsync(e,t){return new Promise((i,o)=>{const s=[],a=new n(t);a.on("data",()=>{}),a.on("error",o),a.on("finish",()=>i(r.concat(s))),a.pushAny(e),a.stopRecording(),a.removeAllListeners("data"),a.on("data",e=>s.push(e)),a.pushAny(e),a.end()})}}return ie=n}var _e=function(){if(ae)return se;ae=1;const e=pe(),t=ye(),r=de(),n=ge(),i=le(),o=fe(),s=Ee(),a=me();return se={Commented:e,Diagnose:t,Decoder:r,Encoder:n,Simple:i,Tagged:o,Map:s,SharedValueEncoder:a,comment:e.comment,decodeAll:r.decodeAll,decodeFirst:r.decodeFirst,decodeAllSync:r.decodeAllSync,decodeFirstSync:r.decodeFirstSync,diagnose:t.diagnose,encode:n.encode,encodeCanonical:n.encodeCanonical,encodeOne:n.encodeOne,encodeAsync:n.encodeAsync,decode:r.decodeFirstSync,leveldb:{decode:r.decodeFirstSync,encode:n.encode,buffer:!0,name:"cbor"},reset(){n.reset(),o.reset()}}}(),we=h(_e);function be(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e]))}class Pe{constructor(e){if(!function(e){if("string"!=typeof e)return!1;if(e.length<=1)return!1;if("z"!==e[0])return!1;const t=e.slice(1);return/^[1-9A-HJ-NP-Za-km-z]+$/.test(t)}(e))throw new Error("Base58 string is invalid. Cannot construct Decoder.");this.base58=e}constructRootJSON(e){const t=be(L.root);return e.reduce((e,r)=>{const n=t[r[0]];let i=r[1];return i instanceof Array&&("anchors"===n&&(i=this.constructAnchorsJSON(i)),"path"===n&&(i=this.constructPathJSON(i))),(i instanceof a||i instanceof Uint8Array)&&(i=we.decode(i).toString("hex")),e[n]=i,e},{})}constructAnchorsJSON(e){const t=(r=L.chain,n=e=>e.id,Object.entries(r).reduce((e,[t,r])=>{const i=n(r);return(e[i]||=[]).push(t),e},{}));var r,n;return e.map(e=>e.reduce((e,r)=>{if(0===r[0])return`${e}:${t[r[1]]}`;if(1===r[0]){const t=e.split(":").pop();return`${e}:${be(L.chain[t].networks)[r[1]]}`}return`${e}:${we.decode(r[1]).toString("hex")}`},"blink"))}constructPathJSON(e){const t=be(L.path);return e.map(e=>({[t[e[0]]]:we.decode(e[1]).toString("hex")}))}decode(){const e=c(this.base58.slice(1)),t=we.decode(a.from(e));return this.constructRootJSON(t)}}function Ie(e){return Object.keys(s).map(e=>s[e]).find(t=>t.signatureValue===e)}function Ae(e=null){if(e?.anchors){const{anchors:t}=e,r=t[0];if("string"==typeof r)return function(e){const t=e.split(":");let r;switch(t[1]){case s.mocknet.blinkCode:return Ie(s.mocknet.signatureValue);case s.bitcoin.blinkCode:r=s.bitcoin.name;break;case s.ethmain.blinkCode:r=s.ethmain.name;break;default:throw new Error("Could not retrieve chain.")}const n=t[2],i=r.toLowerCase()+function(e){const t=e.substr(0,1),r=e.substr(1,e.length-1);return t.toUpperCase()+r.toLowerCase()}(n);return Ie(i)}(r)}return null}function Te(e,t){const r=e.findIndex(e=>e===t);r>-1&&e.splice(r,1)}class Oe extends Error{stepCode;constructor(e,t){super(t),this.stepCode=e}}var ve="en-US",Se={"en-US":{errors:{assertProofValidityPurposeVerifier:"Invalid proof purpose. Expected ${expectedProofPurpose} but received ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"The verification method ${proof.verificationMethod} is not allowed for the proof purpose ${expectedProofPurpose}",assertProofValidityDomainVerifier:"The proof is not authorized for this domain",assertProofValidityInvalidChallenge:"The proof's challenge does not match the verifier's challenge",assertProofValidityNoProofPurpose:"`proofPurpose` property is missing from proof",assertProofValidityNoCreated:"`created` property is missing from proof",ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},fr:{errors:{assertProofValidityPurposeVerifier:"Objectif de la signature invalide. Attendu: ${expectedProofPurpose} mais la signature a un objectif de ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"La méthode de vérification ${proof.verificationMethod} n'est pas autorisée pour l'objectif de verification: ${expectedProofPurpose}",assertProofValidityDomainVerifier:"La signature n'est pas autorisée pour ce domaine",assertProofValidityInvalidChallenge:"Le challenge de la signature ne correspond pas au challenge de vérification",assertProofValidityNoProofPurpose:"La propriété `proofPurpose` est manquante dans la signature",assertProofValidityNoCreated:"La propriété `created` est manquante dans la signature",ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",noProofSpecified:"La propriété 'proof' du document est un tableau mais aucune preuve n'a été passée pour savoir ce qu'il faut vérifier"}},es:{errors:{assertProofValidityPurposeVerifier:"Objectivo de verificación invalido. Se esperaba ${expectedProofPurpose} pero recibió ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"El método de verificación ${proof.verificationMethod} no está permitido para el objectivo de verificación ${expectedProofPurpose}",assertProofValidityDomainVerifier:"La prueba no está autorizada para este dominio",assertProofValidityInvalidChallenge:"El reto de la prueba no coincide con el reto de verificación",assertProofValidityNoProofPurpose:"Falta propiedad `proofPurpose` en la prueba",assertProofValidityNoCreated:"Falta propiedad `created` en la prueba",ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",noProofSpecified:"La propiedad 'proof' del documento es una lista, pero no prueba especifica ha sido declarada para conocer el punto de verificación"}},mt:{errors:{assertProofValidityPurposeVerifier:"Invalid proof purpose. Expected ${expectedProofPurpose} but received ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"The verification method ${proof.verificationMethod} is not allowed for the proof purpose ${expectedProofPurpose}",assertProofValidityDomainVerifier:"The proof is not authorized for this domain",assertProofValidityInvalidChallenge:"The proof's challenge does not match the verifier's challenge",assertProofValidityNoProofPurpose:"`proofPurpose` property is missing from proof",assertProofValidityNoCreated:"`created` property is missing from proof",ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},"it-IT":{errors:{assertProofValidityPurposeVerifier:"Invalid proof purpose. Expected ${expectedProofPurpose} but received ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"The verification method ${proof.verificationMethod} is not allowed for the proof purpose ${expectedProofPurpose}",assertProofValidityDomainVerifier:"The proof is not authorized for this domain",assertProofValidityInvalidChallenge:"The proof's challenge does not match the verifier's challenge",assertProofValidityNoProofPurpose:"`proofPurpose` property is missing from proof",assertProofValidityNoCreated:"`created` property is missing from proof",ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},ja:{errors:{assertProofValidityPurposeVerifier:"Invalid proof purpose. Expected ${expectedProofPurpose} but received ${proof.proofPurpose}",assertProofValidityPurposeIssuerKey:"The verification method ${proof.verificationMethod} is not allowed for the proof purpose ${expectedProofPurpose}",assertProofValidityDomainVerifier:"The proof is not authorized for this domain",assertProofValidityInvalidChallenge:"The proof's challenge does not match the verifier's challenge",assertProofValidityNoProofPurpose:"`proofPurpose` property is missing from proof",assertProofValidityNoCreated:"`created` property is missing from proof",ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}}};function Ne(e,t){return t?Se[ve]?Se[ve][e]?Se[ve][e][t]?Se[ve][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}function Ue({expectedProofPurpose:e,expectedDomain:t,expectedChallenge:r,proof:n,issuer:i}){if(!n.proofPurpose)throw new Oe("assertProofValidity",Ne("errors","assertProofValidityNoProofPurpose"));if(!n.created)throw new Oe("assertProofValidity",Ne("errors","assertProofValidityNoCreated"));return n.proofPurpose&&function({expectedProofPurpose:e,proof:t,issuer:r}){if(t.proofPurpose!==e)throw new Oe("assertProofValidity",Ne("errors","assertProofValidityPurposeVerifier").replace("${expectedProofPurpose}",e).replace("${proof.proofPurpose}",t.proofPurpose));if(r&&!r[e]?.includes(t.verificationMethod))throw new Oe("assertProofValidity",Ne("errors","assertProofValidityPurposeIssuerKey").replace("${proof.verificationMethod}",t.verificationMethod).replace("${expectedProofPurpose}",e));"authentication"!==e||t.domain||console.warn("No domain found in proof, but it is recommended for authentication purposes")}({expectedProofPurpose:e,proof:n,issuer:i}),n.domain&&function({expectedDomain:e,proof:t,expectedChallenge:r}){if(!e.includes(t.domain))throw new Oe("assertProofValidity",Ne("errors","assertProofValidityDomainVerifier").replace("${expectedDomain}",e.join(", ")).replace("${proof.domain}",t.domain));if(t.domain&&!t.challenge&&console.warn("No challenge found in proof, but it is recommended for domain verification"),t.challenge&&t.challenge!==r)throw new Oe("assertProofValidity",Ne("errors","assertProofValidityInvalidChallenge"))}({expectedDomain:t,proof:n,expectedChallenge:r}),!0}var Re={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},ke={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},Be={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}},Me={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@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"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@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"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};function Le(e){e=e.trim();const t=[];for(let r=0;r<e.length;r+=2)t.push(parseInt(e.substring(r,r+2),16));return t}async function xe(e,t=null,r=async e=>Promise){e["@context"].find(e=>{return(t=e)===Object(t)&&"@vocab"in e;var t})||e["@context"].push({"@vocab":"http://fallback.org/"});const n=JSON.parse(JSON.stringify(e));if(Array.isArray(n.proof)){if(!t)throw new Oe("computeLocalHash",Ne("errors","noProofSpecified"));const e=n.proof.findIndex(e=>e.proofValue===t.proofValue);n.proof=n.proof.slice(0,e)}else delete n.proof;const i={algorithm:"URDNA2015",format:"application/nquads",documentLoader:async function(e){return null!=r&&await r(e),e in f?{contextUrl:null,document:f[e],documentUrl:e}:w.documentLoader(e)},safe:!1};let o;try{o=await w.normalize(n,i)}catch(e){throw console.error(e),new Oe("computeLocalHash",Ne("errors","failedJsonLdNormalization"))}const s=function(e){const t=e.split("\n"),r=/<http:\/\/fallback\.org\/(.*)>/,n=t.map(e=>r.exec(e)).filter(e=>null!=e);if(n.length>0){const e=n.map(e=>e[1]).sort();return Array.from(new Set(e))}return null}(o);if(s)throw new Oe("computeLocalHash",`${Ne("errors","foundUnmappedFields")}: ${s.join(", ")}`);return a.from(b(Uint8Array.from(function(e){const t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&e.charCodeAt(r)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return t}(o)))).toString("hex")}f["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=Re,f["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=Re,f["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=ke,f["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=ke,f["https://w3id.org/blockcerts/v3.0-alpha"]=ke,f["https://www.blockcerts.org/schema/3.0-beta/context.json"]=Be,f["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=Be,f["https://w3id.org/blockcerts/v3.0-beta"]=Be,f["https://w3id.org/security/suites/ed25519-2020/v1"]=Me;const De=a,Ce=e=>{const t=(e=>{e={...e,crv:"K-256"};const t=I({jwk:e});return De.from(t).toString("hex")})(e);let r=De.from(t,"hex"),n=32-r.length;for(;n>0;)r=De.concat([De.from("00","hex"),r]),n--;return r},Ve={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};var Fe,He=Object.freeze({__proto__:null,bitcoin:Ve,regtest:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}});!function(e){e[e.OP_FALSE=0]="OP_FALSE",e[e.OP_0=0]="OP_0",e[e.OP_PUSHDATA1=76]="OP_PUSHDATA1",e[e.OP_PUSHDATA2=77]="OP_PUSHDATA2",e[e.OP_PUSHDATA4=78]="OP_PUSHDATA4",e[e.OP_1NEGATE=79]="OP_1NEGATE",e[e.OP_RESERVED=80]="OP_RESERVED",e[e.OP_TRUE=81]="OP_TRUE",e[e.OP_1=81]="OP_1",e[e.OP_2=82]="OP_2",e[e.OP_3=83]="OP_3",e[e.OP_4=84]="OP_4",e[e.OP_5=85]="OP_5",e[e.OP_6=86]="OP_6",e[e.OP_7=87]="OP_7",e[e.OP_8=88]="OP_8",e[e.OP_9=89]="OP_9",e[e.OP_10=90]="OP_10",e[e.OP_11=91]="OP_11",e[e.OP_12=92]="OP_12",e[e.OP_13=93]="OP_13",e[e.OP_14=94]="OP_14",e[e.OP_15=95]="OP_15",e[e.OP_16=96]="OP_16",e[e.OP_NOP=97]="OP_NOP",e[e.OP_VER=98]="OP_VER",e[e.OP_IF=99]="OP_IF",e[e.OP_NOTIF=100]="OP_NOTIF",e[e.OP_VERIF=101]="OP_VERIF",e[e.OP_VERNOTIF=102]="OP_VERNOTIF",e[e.OP_ELSE=103]="OP_ELSE",e[e.OP_ENDIF=104]="OP_ENDIF",e[e.OP_VERIFY=105]="OP_VERIFY",e[e.OP_RETURN=106]="OP_RETURN",e[e.OP_TOALTSTACK=107]="OP_TOALTSTACK",e[e.OP_FROMALTSTACK=108]="OP_FROMALTSTACK",e[e.OP_2DROP=109]="OP_2DROP",e[e.OP_2DUP=110]="OP_2DUP",e[e.OP_3DUP=111]="OP_3DUP",e[e.OP_2OVER=112]="OP_2OVER",e[e.OP_2ROT=113]="OP_2ROT",e[e.OP_2SWAP=114]="OP_2SWAP",e[e.OP_IFDUP=115]="OP_IFDUP",e[e.OP_DEPTH=116]="OP_DEPTH",e[e.OP_DROP=117]="OP_DROP",e[e.OP_DUP=118]="OP_DUP",e[e.OP_NIP=119]="OP_NIP",e[e.OP_OVER=120]="OP_OVER",e[e.OP_PICK=121]="OP_PICK",e[e.OP_ROLL=122]="OP_ROLL",e[e.OP_ROT=123]="OP_ROT",e[e.OP_SWAP=124]="OP_SWAP",e[e.OP_TUCK=125]="OP_TUCK",e[e.OP_CAT=126]="OP_CAT",e[e.OP_SUBSTR=127]="OP_SUBSTR",e[e.OP_LEFT=128]="OP_LEFT",e[e.OP_RIGHT=129]="OP_RIGHT",e[e.OP_SIZE=130]="OP_SIZE",e[e.OP_INVERT=131]="OP_INVERT",e[e.OP_AND=132]="OP_AND",e[e.OP_OR=133]="OP_OR",e[e.OP_XOR=134]="OP_XOR",e[e.OP_EQUAL=135]="OP_EQUAL",e[e.OP_EQUALVERIFY=136]="OP_EQUALVERIFY",e[e.OP_RESERVED1=137]="OP_RESERVED1",e[e.OP_RESERVED2=138]="OP_RESERVED2",e[e.OP_1ADD=139]="OP_1ADD",e[e.OP_1SUB=140]="OP_1SUB",e[e.OP_2MUL=141]="OP_2MUL",e[e.OP_2DIV=142]="OP_2DIV",e[e.OP_NEGATE=143]="OP_NEGATE",e[e.OP_ABS=144]="OP_ABS",e[e.OP_NOT=145]="OP_NOT",e[e.OP_0NOTEQUAL=146]="OP_0NOTEQUAL",e[e.OP_ADD=147]="OP_ADD",e[e.OP_SUB=148]="OP_SUB",e[e.OP_MUL=149]="OP_MUL",e[e.OP_DIV=150]="OP_DIV",e[e.OP_MOD=151]="OP_MOD",e[e.OP_LSHIFT=152]="OP_LSHIFT",e[e.OP_RSHIFT=153]="OP_RSHIFT",e[e.OP_BOOLAND=154]="OP_BOOLAND",e[e.OP_BOOLOR=155]="OP_BOOLOR",e[e.OP_NUMEQUAL=156]="OP_NUMEQUAL",e[e.OP_NUMEQUALVERIFY=157]="OP_NUMEQUALVERIFY",e[e.OP_NUMNOTEQUAL=158]="OP_NUMNOTEQUAL",e[e.OP_LESSTHAN=159]="OP_LESSTHAN",e[e.OP_GREATERTHAN=160]="OP_GREATERTHAN",e[e.OP_LESSTHANOREQUAL=161]="OP_LESSTHANOREQUAL",e[e.OP_GREATERTHANOREQUAL=162]="OP_GREATERTHANOREQUAL",e[e.OP_MIN=163]="OP_MIN",e[e.OP_MAX=164]="OP_MAX",e[e.OP_WITHIN=165]="OP_WITHIN",e[e.OP_RIPEMD160=166]="OP_RIPEMD160",e[e.OP_SHA1=167]="OP_SHA1",e[e.OP_SHA256=168]="OP_SHA256",e[e.OP_HASH160=169]="OP_HASH160",e[e.OP_HASH256=170]="OP_HASH256",e[e.OP_CODESEPARATOR=171]="OP_CODESEPARATOR",e[e.OP_CHECKSIG=172]="OP_CHECKSIG",e[e.OP_CHECKSIGVERIFY=173]="OP_CHECKSIGVERIFY",e[e.OP_CHECKMULTISIG=174]="OP_CHECKMULTISIG",e[e.OP_CHECKMULTISIGVERIFY=175]="OP_CHECKMULTISIGVERIFY",e[e.OP_NOP1=176]="OP_NOP1",e[e.OP_CHECKLOCKTIMEVERIFY=177]="OP_CHECKLOCKTIMEVERIFY",e[e.OP_NOP2=177]="OP_NOP2",e[e.OP_CHECKSEQUENCEVERIFY=178]="OP_CHECKSEQUENCEVERIFY",e[e.OP_NOP3=178]="OP_NOP3",e[e.OP_NOP4=179]="OP_NOP4",e[e.OP_NOP5=180]="OP_NOP5",e[e.OP_NOP6=181]="OP_NOP6",e[e.OP_NOP7=182]="OP_NOP7",e[e.OP_NOP8=183]="OP_NOP8",e[e.OP_NOP9=184]="OP_NOP9",e[e.OP_NOP10=185]="OP_NOP10",e[e.OP_CHECKSIGADD=186]="OP_CHECKSIGADD",e[e.OP_PUBKEYHASH=253]="OP_PUBKEYHASH",e[e.OP_PUBKEY=254]="OP_PUBKEY",e[e.OP_INVALIDOPCODE=255]="OP_INVALIDOPCODE"}(Fe||(Fe={}));const je="0123456789abcdefABCDEF",Ge=je.split("").map(e=>e.codePointAt(0)),Ke=Array(256).fill(!0).map((e,t)=>{const r=String.fromCodePoint(t),n=je.indexOf(r);return n<0?void 0:n<16?n:n-6}),$e=new TextEncoder,ze=new TextDecoder;function Ye(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}function We(e){const t=e||new Uint8Array;return t.length>512?function(e){const t=new Uint8Array(2*e.length);for(let r=0;r<e.length;++r)t[2*r]=Ge[e[r]>>4],t[2*r+1]=Ge[15&e[r]];return ze.decode(t)}(t):function(e){let t="";for(let r=0;r<e.length;++r)t+=je[Ke[Ge[e[r]>>4]]],t+=je[Ke[Ge[15&e[r]]]];return t}(t)}function Je(e){const t=$e.encode(e||""),r=new Uint8Array(Math.floor(t.length/2));let n;for(n=0;n<r.length;n++){const e=Ke[t[2*n]],i=Ke[t[2*n+1]];if(void 0===e||void 0===i)break;r[n]=e<<4|i}return n===r.length?r:r.slice(0,n)}function qe(e,t){const r=Math.min(e.length,t.length);for(let n=0;n<r;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return e.length===t.length?0:e.length>t.length?1:-1}function Xe(e,t,r){if(t+1>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(r>255)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 255. Received ${r}`);return e[t]=r,t+1}function Qe(e,t,r,n){if(t+4>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>4294967295)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received ${r}`);return"LE"===n?(e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255):(e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r),t+4}function Ze(e,t){if(t+1>e.length)throw new Error("Offset is outside the bounds of Uint8Array");return e[t]}function et(e,t,r){if(t+4>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0;return r=(r<<8)+e[t+3]>>>0,r=(r<<8)+e[t+2]>>>0,r=(r<<8)+e[t+1]>>>0,r=(r<<8)+e[t]>>>0,r}{let r=0;return r=(r<<8)+e[t]>>>0,r=(r<<8)+e[t+1]>>>0,r=(r<<8)+e[t+2]>>>0,r=(r<<8)+e[t+3]>>>0,r}}function tt(e){return e<Fe.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}function rt(e,t,r){const n=tt(t);return 1===n?Xe(e,r,t):2===n?(Xe(e,r,Fe.OP_PUSHDATA1),Xe(e,r+1,t)):3===n?(Xe(e,r,Fe.OP_PUSHDATA2),function(e,t,r,n){if(t+2>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>65535)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 65535. Received ${r}`);"LE"===n?(e[t]=255&r,e[t+1]=r>>8&255):(e[t]=r>>8&255,e[t+1]=255&r)}(e,r+1,t,"LE")):(Xe(e,r,Fe.OP_PUSHDATA4),Qe(e,r+1,t,"LE")),n}function nt(e,t){const r=Ze(e,t);let n,i;if(r<Fe.OP_PUSHDATA1)n=r,i=1;else if(r===Fe.OP_PUSHDATA1){if(t+2>e.length)return null;n=Ze(e,t+1),i=2}else if(r===Fe.OP_PUSHDATA2){if(t+3>e.length)return null;n=function(e,t,r){if(t+2>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0;return r=(r<<8)+e[t+1],r=(r<<8)+e[t],r}{let r=0;return r=(r<<8)+e[t],r=(r<<8)+e[t+1],r}}(e,t+1,"LE"),i=3}else{if(t+5>e.length)return null;if(r!==Fe.OP_PUSHDATA4)throw new Error("Unexpected opcode");n=et(e,t+1,"LE"),i=5}return{opcode:r,number:n,size:i}}function it(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function ot(e){const t=typeof e;return"string"===t?`"${e}"`:"number"===t||"bigint"===t||"boolean"===t?`${e}`:"object"===t||"function"===t?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}function st(e,t,r,n,i){const o=i&&"input"in i?i.input:r.value,s=i?.expected??e.expects??null,a=i?.received??ot(o),c={kind:e.kind,type:e.type,input:o,expected:s,received:a,message:`Invalid ${t}: ${s?`Expected ${s} but r`:"R"}eceived ${a}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},u="schema"===e.kind,h=i?.message??e.message??(e.reference,void c.lang)??(u?void c.lang:null)??n.message??void c.lang;void 0!==h&&(c.message="function"==typeof h?h(c):h),u&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}function at(e){return{version:1,vendor:"valibot",validate:t=>e["~run"]({value:t},it())}}function ct(e,t){const r=[...new Set(e)];return r.length>1?`(${r.join(` ${t} `)})`:r[0]??"never"}var ut=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function ht(e,t){return{kind:"validation",type:"length",reference:ht,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length!==this.requirement&&st(this,"length",e,t,{received:`${e.value.length}`}),e}}}function ft(e,t,r){return"function"==typeof e.fallback?e.fallback(t,r):e.fallback}function lt(e,t,r){return"function"==typeof e.default?e.default(t,r):e.default}function dt(e,t){return{kind:"schema",type:"custom",reference:dt,expects:"unknown",async:!1,check:e,message:t,get"~standard"(){return at(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:st(this,"type",e,t),e}}}function pt(e,t){return{kind:"schema",type:"instance",reference:pt,expects:e.name,async:!1,class:e,message:t,get"~standard"(){return at(this)},"~run"(e,t){return e.value instanceof this.class?e.typed=!0:st(this,"type",e,t),e}}}function yt(e,t){return{kind:"schema",type:"object",reference:yt,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return at(this)},"~run"(e,t){const r=e.value;if(r&&"object"==typeof r){e.typed=!0,e.value={};for(const n in this.entries){const i=this.entries[n];if(n in r||("exact_optional"===i.type||"optional"===i.type||"nullish"===i.type)&&void 0!==i.default){const o=n in r?r[n]:lt(i),s=i["~run"]({value:o},t);if(s.issues){const i={type:"object",origin:"value",input:r,key:n,value:o};for(const t of s.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}s.typed||(e.typed=!1),e.value[n]=s.value}else if(void 0!==i.fallback)e.value[n]=ft(i);else if("exact_optional"!==i.type&&"optional"!==i.type&&"nullish"!==i.type&&(st(this,"key",e,t,{input:void 0,expected:`"${n}"`,path:[{type:"object",origin:"key",input:r,key:n,value:r[n]}]}),t.abortEarly))break}}else st(this,"type",e,t);return e}}}function gt(e,t){return{kind:"schema",type:"optional",reference:gt,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return at(this)},"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=lt(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}}}function Et(e){return{kind:"schema",type:"string",reference:Et,expects:"string",async:!1,message:e,get"~standard"(){return at(this)},"~run"(e,t){return"string"==typeof e.value?e.typed=!0:st(this,"type",e,t),e}}}function mt(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function _t(e,t,r){const n=e["~run"]({value:t},it(r));if(n.issues)throw new ut(n.issues);return n.value}const wt=new Uint8Array(32),bt=Je("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Pt=e=>function(...e){return{...e[0],pipe:e,get"~standard"(){return at(this)},"~run"(t,r){for(const n of e)if("metadata"!==n.kind){if(t.issues&&("schema"===n.kind||"transformation"===n.kind)){t.typed=!1;break}t.issues&&(r.abortEarly||r.abortPipeEarly)||(t=n["~run"](t,r))}return t}}}(pt(Uint8Array),ht(e));function It(e){if(!(e instanceof Uint8Array))return!1;if(e.length<33)return!1;const t=e[0],r=e.slice(1,33);if(0===qe(wt,r))return!1;if(qe(r,bt)>=0)return!1;if((2===t||3===t)&&33===e.length)return!0;const n=e.slice(33);return 0!==qe(wt,n)&&(!(qe(n,bt)>=0)&&(4===t&&65===e.length))}const At=Pt(20),Tt=pt(Uint8Array),Ot=Fe.OP_RESERVED,vt=function e(t,r){return{kind:"schema",type:"array",reference:e,expects:"Array",async:!1,item:t,message:r,get"~standard"(){return at(this)},"~run"(e,t){const r=e.value;if(Array.isArray(r)){e.typed=!0,e.value=[];for(let n=0;n<r.length;n++){const i=r[n],o=this.item["~run"]({value:i},t);if(o.issues){const s={type:"array",origin:"value",input:r,key:n,value:i};for(const t of o.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value.push(o.value)}}else st(this,"type",e,t);return e}}}(function e(t,r){return{kind:"schema",type:"union",reference:e,expects:ct(t.map(e=>e.expects),"|"),async:!1,options:t,message:r,get"~standard"(){return at(this)},"~run"(e,t){let r,n,i;for(const o of this.options){const s=o["~run"]({value:e.value},t);if(s.typed){if(!s.issues){r=s;break}n?n.push(s):n=[s]}else i?i.push(s):i=[s]}if(r)return r;if(n){if(1===n.length)return n[0];st(this,"type",e,t,{issues:mt(n)}),e.typed=!0}else{if(1===i?.length)return i[0];st(this,"type",e,t,{issues:mt(i)})}return e}}}([pt(Uint8Array),function e(t){return{kind:"schema",type:"number",reference:e,expects:"number",async:!1,message:t,get"~standard"(){return at(this)},"~run"(e,t){return"number"!=typeof e.value||isNaN(e.value)?st(this,"type",e,t):e.typed=!0,e}}}()]));function St(e){return 0===e.length?Fe.OP_0:1===e.length?e[0]>=1&&e[0]<=16?Ot+e[0]:129===e[0]?Fe.OP_1NEGATE:void 0:void 0}function Nt(e){return e instanceof Uint8Array}function Ut(e){if(e instanceof Uint8Array)return e;_t(vt,e);const t=e.reduce((e,t)=>Nt(t)?1===t.length&&void 0!==St(t)?e+1:e+tt(t.length)+t.length:e+1,0),r=new Uint8Array(t);let n=0;if(e.forEach(e=>{if(Nt(e)){const t=St(e);if(void 0!==t)return Xe(r,n,t),void(n+=1);n+=rt(r,e.length,n),r.set(e,n),n+=e.length}else Xe(r,n,e),n+=1}),n!==r.length)throw new Error("Could not decode chunks");return r}function Rt(e){if(t=e,!vt["~run"]({value:t},{abortEarly:!0}).issues)return e;var t;_t(Tt,e);const r=[];let n=0;for(;n<e.length;){const t=e[n];if(t>Fe.OP_0&&t<=Fe.OP_PUSHDATA4){const t=nt(e,n);if(null===t)return null;if(n+=t.size,n+t.number>e.length)return null;const i=e.slice(n,n+t.number);n+=t.number;const o=St(i);void 0!==o?r.push(o):r.push(i)}else r.push(t),n+=1}return r}function kt(e){return e instanceof Uint8Array&&(!!function(e){const t=-129&e;return t>0&&t<4}(e[e.length-1])&&function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;const t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;const r=e[5+t];return!(0===r||6+t+r!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||r>1&&0===e[t+6]&&!(128&e[t+7]))}(e.slice(0,-1)))}function Bt(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=r.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})}function Mt(e){let t;return()=>(void 0!==t||(t=e()),t)}function Lt(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");
2
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
- var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function xt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Dt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ct(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Vt(e,t){return e<<32-t|e>>>t}function Ft(e,t){return e<<t|e>>>32-t>>>0}function Ht(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}(e)),Lt(e),e}Fe.OP_RESERVED;let jt=class{};function Gt(e){const t=t=>e().update(Ht(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Kt(e,t,r){return e&t^~e&r}function $t(e,t,r){return e&t^e&r^t&r}let zt=class extends jt{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=Ct(this.buffer)}update(e){xt(this),Lt(e=Ht(e));const{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const t=Ct(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){xt(this),function(e,t){Lt(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,Dt(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Ct(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)s.setUint32(4*e,u[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=s,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}};const Yt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Wt=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Jt=(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),qt=(()=>Jt.map(e=>(9*e+5)%16))(),Xt=(()=>{const e=[[Jt],[qt]];for(let t=0;t<4;t++)for(let r of e)r.push(r[t].map(e=>Wt[e]));return e})(),Qt=(()=>Xt[0])(),Zt=(()=>Xt[1])(),er=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),tr=Qt.map((e,t)=>e.map(e=>er[t][e])),rr=Zt.map((e,t)=>e.map(e=>er[t][e])),nr=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),ir=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function or(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const sr=new Uint32Array(16);class ar extends zt{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:i}=this;return[e,t,r,n,i]}set(e,t,r,n,i){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|i}process(e,t){for(let r=0;r<16;r++,t+=4)sr[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,i=0|this.h1,o=i,s=0|this.h2,a=s,c=0|this.h3,u=c,h=0|this.h4,f=h;for(let e=0;e<5;e++){const t=4-e,l=nr[e],d=ir[e],p=Qt[e],y=Zt[e],g=tr[e],E=rr[e];for(let t=0;t<16;t++){const n=Ft(r+or(e,i,s,c)+sr[p[t]]+l,g[t])+h|0;r=h,h=c,c=0|Ft(s,10),s=i,i=n}for(let e=0;e<16;e++){const r=Ft(n+or(t,o,a,u)+sr[y[e]]+d,E[e])+f|0;n=f,f=u,u=0|Ft(a,10),a=o,o=r}}this.set(this.h1+s+u|0,this.h2+c+f|0,this.h3+h+n|0,this.h4+r+o|0,this.h0+i+a|0)}roundClean(){Dt(sr)}destroy(){this.destroyed=!0,Dt(this.buffer),this.set(0,0,0,0,0)}}const cr=Gt(()=>new ar),ur=Uint32Array.from([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]),hr=new Uint32Array(64);let fr=class extends zt{constructor(e=32){super(64,e,8,!1),this.A=0|Yt[0],this.B=0|Yt[1],this.C=0|Yt[2],this.D=0|Yt[3],this.E=0|Yt[4],this.F=0|Yt[5],this.G=0|Yt[6],this.H=0|Yt[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)hr[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=hr[e-15],r=hr[e-2],n=Vt(t,7)^Vt(t,18)^t>>>3,i=Vt(r,17)^Vt(r,19)^r>>>10;hr[e]=i+hr[e-7]+n+hr[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(Vt(s,6)^Vt(s,11)^Vt(s,25))+Kt(s,a,c)+ur[e]+hr[e]|0,h=(Vt(r,2)^Vt(r,13)^Vt(r,22))+$t(r,n,i)|0;u=c,c=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+h|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,s,a,c,u)}roundClean(){Dt(hr)}destroy(){this.set(0,0,0,0,0,0,0,0),Dt(this.buffer)}};const lr=Gt(()=>new fr);function dr(e){return cr(lr(e))}function pr(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");
4
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5
- var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function yr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function gr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Er(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function mr(e,t){return e<<32-t|e>>>t}function _r(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}(e)),pr(e),e}Uint8Array.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),Uint8Array.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),Uint8Array.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),Uint8Array.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),Uint8Array.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),Uint8Array.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),Uint8Array.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),Uint8Array.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),Uint8Array.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129]);class wr{}function br(e){const t=t=>e().update(_r(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Pr(e,t,r){return e&t^~e&r}function Ir(e,t,r){return e&t^e&r^t&r}class Ar extends wr{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=Er(this.buffer)}update(e){yr(this),pr(e=_r(e));const{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const t=Er(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){yr(this),function(e,t){pr(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,gr(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Er(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)s.setUint32(4*e,u[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=s,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Tr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Or=Uint32Array.from([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]),vr=new Uint32Array(64);class Sr extends Ar{constructor(e=32){super(64,e,8,!1),this.A=0|Tr[0],this.B=0|Tr[1],this.C=0|Tr[2],this.D=0|Tr[3],this.E=0|Tr[4],this.F=0|Tr[5],this.G=0|Tr[6],this.H=0|Tr[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)vr[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=vr[e-15],r=vr[e-2],n=mr(t,7)^mr(t,18)^t>>>3,i=mr(r,17)^mr(r,19)^r>>>10;vr[e]=i+vr[e-7]+n+vr[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(mr(s,6)^mr(s,11)^mr(s,25))+Pr(s,a,c)+Or[e]+vr[e]|0,h=(mr(r,2)^mr(r,13)^mr(r,22))+Ir(r,n,i)|0;u=c,c=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+h|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,s,a,c,u)}roundClean(){gr(vr)}destroy(){this.set(0,0,0,0,0,0,0,0),gr(this.buffer)}}const Nr=br(()=>new Sr);var Ur=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),n=e(r),i=r.length+4,o=new Uint8Array(i);return o.set(r,0),o.set(n.subarray(0,4),r.length),E.encode(o)},decode:function(e){var r=t(E.decode(e));if(null==r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=E.decodeUnsafe(e);if(null!=r)return t(r)}}}(function(e){return Nr(Nr(e))});const Rr=Fe;function kr(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),_t(function(e){const t={};for(const r in e.entries)t[r]=gt(e.entries[r]);return{...e,entries:t,get"~standard"(){return at(this)}}}(yt({network:yt({}),address:Et(),hash:At,output:Pt(25),pubkey:dt(It),signature:dt(kt),input:Tt})),e);const r=Mt(()=>{const t=Ur.decode(e.address);return{version:Ze(t,0),hash:t.slice(1)}}),n=Mt(()=>Rt(e.input)),i=e.network||Ve,o={name:"p2pkh",network:i};if(Bt(o,"address",()=>{if(!o.hash)return;const e=new Uint8Array(21);return Xe(e,0,i.pubKeyHash),e.set(o.hash,1),Ur.encode(e)}),Bt(o,"hash",()=>e.output?e.output.slice(3,23):e.address?r().hash:e.pubkey||o.pubkey?dr(e.pubkey||o.pubkey):void 0),Bt(o,"output",()=>{if(o.hash)return Ut([Rr.OP_DUP,Rr.OP_HASH160,o.hash,Rr.OP_EQUALVERIFY,Rr.OP_CHECKSIG])}),Bt(o,"pubkey",()=>{if(e.input)return n()[1]}),Bt(o,"signature",()=>{if(e.input)return n()[0]}),Bt(o,"input",()=>{if(e.pubkey&&e.signature)return Ut([e.signature,e.pubkey])}),Bt(o,"witness",()=>{if(o.input)return[]}),t.validate){let t=Uint8Array.from([]);if(e.address){if(r().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw new TypeError("Invalid address");t=r().hash}if(e.hash){if(t.length>0&&0!==qe(t,e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==Rr.OP_DUP||e.output[1]!==Rr.OP_HASH160||20!==e.output[2]||e.output[23]!==Rr.OP_EQUALVERIFY||e.output[24]!==Rr.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=e.output.slice(3,23);if(t.length>0&&0!==qe(t,r))throw new TypeError("Hash mismatch");t=r}if(e.pubkey){const r=dr(e.pubkey);if(t.length>0&&0!==qe(t,r))throw new TypeError("Hash mismatch");t=r}if(e.input){const r=n();if(2!==r.length)throw new TypeError("Input is invalid");if(!kt(r[0]))throw new TypeError("Input has invalid signature");if(!It(r[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&0!==qe(e.signature,r[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&0!==qe(e.pubkey,r[1]))throw new TypeError("Pubkey mismatch");const i=dr(r[1]);if(t.length>0&&0!==qe(t,i))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)}var Br,Mr={};!function(){if(Br)return Mr;Br=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.bech32m=Mr.bech32=void 0;const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",t={};for(let r=0;r<32;r++){const n=e.charAt(r);t[n]=r}function r(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function n(e){let t=1;for(let n=0;n<e.length;++n){const i=e.charCodeAt(n);if(i<33||i>126)return"Invalid prefix ("+e+")";t=r(t)^i>>5}t=r(t);for(let n=0;n<e.length;++n){const i=e.charCodeAt(n);t=r(t)^31&i}return t}function i(e,t,r,n){let i=0,o=0;const s=(1<<r)-1,a=[];for(let n=0;n<e.length;++n)for(i=i<<t|e[n],o+=t;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=t)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return a}function o(e){return i(e,8,5,!0)}function s(e){const t=i(e,5,8,!1);if(Array.isArray(t))return t}function a(e){const t=i(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function c(i){let c;function u(e,i){if(i=i||90,e.length<8)return e+" too short";if(e.length>i)return"Exceeds length limit";const o=e.toLowerCase(),s=e.toUpperCase();if(e!==o&&e!==s)return"Mixed-case string "+e;const a=(e=o).lastIndexOf("1");if(-1===a)return"No separator character for "+e;if(0===a)return"Missing prefix for "+e;const u=e.slice(0,a),h=e.slice(a+1);if(h.length<6)return"Data too short";let f=n(u);if("string"==typeof f)return f;const l=[];for(let e=0;e<h.length;++e){const n=h.charAt(e),i=t[n];if(void 0===i)return"Unknown character "+n;f=r(f)^i,e+6>=h.length||l.push(i)}return f!==c?"Invalid checksum for "+e:{prefix:u,words:l}}return c="bech32"===i?1:734539939,{decodeUnsafe:function(e,t){const r=u(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=u(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(t,i,o){if(o=o||90,t.length+7+i.length>o)throw new TypeError("Exceeds length limit");let s=n(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let a=t+"1";for(let t=0;t<i.length;++t){const n=i[t];if(n>>5)throw new Error("Non 5-bit word");s=r(s)^n,a+=e.charAt(n)}for(let e=0;e<6;++e)s=r(s);s^=c;for(let t=0;t<6;++t){a+=e.charAt(s>>5*(5-t)&31)}return a},toWords:o,fromWordsUnsafe:s,fromWords:a}}Mr.bech32=c("bech32"),Mr.bech32m=c("bech32m")}();const Lr="0123456789abcdefABCDEF";Lr.split("").map(e=>e.codePointAt(0)),Array(256).fill(!0).map((e,t)=>{const r=String.fromCodePoint(t),n=Lr.indexOf(r);return n<0?void 0:n<16?n:n-6}),new TextEncoder,new TextDecoder;function xr(e){"number"==typeof e?function(e){if(e<0||e>Number.MAX_SAFE_INTEGER||e%1!=0)throw new RangeError("value out of range")}(e):(e=>{if(e<0||e>0xffffffffffffffffn)throw new RangeError("value out of range")})(e)}function Dr(e,t,r){xr(e),void 0===r&&(r=0),void 0===t&&(t=new Uint8Array(Vr(e)));let n=0;return e<253?(t.set([Number(e)],r),n=1):e<=65535?(t.set([253],r),function(e,t,r,n){if(t+2>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>65535)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 65535. Received ${r}`);"LE"===n?(e[t]=255&r,e[t+1]=r>>8&255):(e[t]=r>>8&255,e[t+1]=255&r)}(t,r+1,Number(e),"LE"),n=3):e<=4294967295?(t.set([254],r),function(e,t,r,n){if(t+4>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>4294967295)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received ${r}`);"LE"===n?(e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255):(e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r)}(t,r+1,Number(e),"LE"),n=5):(t.set([255],r),function(e,t,r,n){if(t+8>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if(n=n.toUpperCase(),r>0xffffffffffffffffn)throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 18446744073709551615. Received ${r}`);"LE"===n?(e[t]=Number(0xffn&r),e[t+1]=Number(r>>8n&0xffn),e[t+2]=Number(r>>16n&0xffn),e[t+3]=Number(r>>24n&0xffn),e[t+4]=Number(r>>32n&0xffn),e[t+5]=Number(r>>40n&0xffn),e[t+6]=Number(r>>48n&0xffn),e[t+7]=Number(r>>56n&0xffn)):(e[t]=Number(r>>56n&0xffn),e[t+1]=Number(r>>48n&0xffn),e[t+2]=Number(r>>40n&0xffn),e[t+3]=Number(r>>32n&0xffn),e[t+4]=Number(r>>24n&0xffn),e[t+5]=Number(r>>16n&0xffn),e[t+6]=Number(r>>8n&0xffn),e[t+7]=Number(0xffn&r))}(t,r+1,BigInt(e),"LE"),n=9),{buffer:t,bytes:n}}function Cr(e,t){void 0===t&&(t=0);const r=e.at(t);if(void 0===r)throw new Error("buffer too small");if(r<253)return{numberValue:r,bigintValue:BigInt(r),bytes:1};if(253===r){const r=function(e,t,r){if(t+2>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0;return r=(r<<8)+e[t+1],r=(r<<8)+e[t],r}{let r=0;return r=(r<<8)+e[t],r=(r<<8)+e[t+1],r}}(e,t+1,"LE");return{numberValue:r,bigintValue:BigInt(r),bytes:3}}if(254===r){const r=function(e,t,r){if(t+4>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0;return r=(r<<8)+e[t+3]>>>0,r=(r<<8)+e[t+2]>>>0,r=(r<<8)+e[t+1]>>>0,r=(r<<8)+e[t]>>>0,r}{let r=0;return r=(r<<8)+e[t]>>>0,r=(r<<8)+e[t+1]>>>0,r=(r<<8)+e[t+2]>>>0,r=(r<<8)+e[t+3]>>>0,r}}(e,t+1,"LE");return{numberValue:r,bigintValue:BigInt(r),bytes:5}}{const r=function(e,t,r){if(t+8>e.length)throw new Error("Offset is outside the bounds of Uint8Array");if("LE"===(r=r.toUpperCase())){let r=0n;return r=(r<<8n)+BigInt(e[t+7]),r=(r<<8n)+BigInt(e[t+6]),r=(r<<8n)+BigInt(e[t+5]),r=(r<<8n)+BigInt(e[t+4]),r=(r<<8n)+BigInt(e[t+3]),r=(r<<8n)+BigInt(e[t+2]),r=(r<<8n)+BigInt(e[t+1]),r=(r<<8n)+BigInt(e[t]),r}{let r=0n;return r=(r<<8n)+BigInt(e[t]),r=(r<<8n)+BigInt(e[t+1]),r=(r<<8n)+BigInt(e[t+2]),r=(r<<8n)+BigInt(e[t+3]),r=(r<<8n)+BigInt(e[t+4]),r=(r<<8n)+BigInt(e[t+5]),r=(r<<8n)+BigInt(e[t+6]),r=(r<<8n)+BigInt(e[t+7]),r}}(e,t+1,"LE");return{numberValue:r<=Number.MAX_SAFE_INTEGER?Number(r):null,bigintValue:r,bytes:9}}}function Vr(e){return xr(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var Fr,Hr,jr;Je("0000000000000000000000000000000000000000000000000000000000000000"),Je("0000000000000000000000000000000000000000000000000000000000000001"),Je("ffffffffffffffff"),function(e){e[e.UNSIGNED_TX=0]="UNSIGNED_TX",e[e.GLOBAL_XPUB=1]="GLOBAL_XPUB"}(Fr||(Fr={})),function(e){e[e.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",e[e.WITNESS_UTXO=1]="WITNESS_UTXO",e[e.PARTIAL_SIG=2]="PARTIAL_SIG",e[e.SIGHASH_TYPE=3]="SIGHASH_TYPE",e[e.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",e[e.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",e[e.BIP32_DERIVATION=6]="BIP32_DERIVATION",e[e.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",e[e.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",e[e.POR_COMMITMENT=9]="POR_COMMITMENT",e[e.TAP_KEY_SIG=19]="TAP_KEY_SIG",e[e.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",e[e.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",e[e.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",e[e.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",e[e.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT"}(Hr||(Hr={})),function(e){e[e.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",e[e.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",e[e.BIP32_DERIVATION=2]="BIP32_DERIVATION",e[e.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",e[e.TAP_TREE=6]="TAP_TREE",e[e.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION"}(jr||(jr={}));const Gr=e=>33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0];function Kr(e,t=Gr){return{decode:function(r){if(r.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+We(r.key));const n=r.key.slice(1);if(!t(n))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+We(r.key));if(r.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:r.value.slice(0,4),pubkey:n,path:"m"};for(const e of(o=r.value.length/4-1,[...Array(o).keys()])){const t=et(r.value,4*e+4,"LE"),n=!!(2147483648&t),o=2147483647&t;i.path+="/"+o.toString(10)+(n?"'":"")}var o;return i},encode:function(t){const r=Ye([Uint8Array.from([e]),t.pubkey]),n=t.path.split("/"),i=new Uint8Array(4*n.length);i.set(t.masterFingerprint,0);let o=4;return n.slice(1).forEach(e=>{const t="'"===e.slice(-1);let r=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(r+=2147483648),Qe(i,o,r,"LE"),o+=4}),{key:r,value:i}},check:function(e){return e.pubkey instanceof Uint8Array&&e.masterFingerprint instanceof Uint8Array&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Uint8Array; pubkey: Uint8Array; path: string; }",canAddToArray:function(e,t,r){const n=We(t.pubkey);return!r.has(n)&&(r.add(n),0===e.filter(e=>0===qe(e.pubkey,t.pubkey)).length)}}}function $r(e){return function(t){let r;if(e.includes(t.key[0])&&(r=t.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+We(t.key));return r}}function zr(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+We(t.key));return t.value},encode:function(t){return{key:Uint8Array.from([e]),value:t}},check:function(e){return e instanceof Uint8Array},expected:"Uint8Array",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}}const Yr=e=>32===e.length;function Wr(e){const t=Kr(e,Yr);return{decode:function(e){const{numberValue:r,bytes:n}=Cr(e.value),i=t.decode({key:e.key,value:e.value.slice(n+32*Number(r))}),o=new Array(Number(r));for(let t=0,i=n;t<r;t++,i+=32)o[t]=e.value.slice(i,i+32);return{...i,leafHashes:o}},encode:function(e){const r=t.encode(e),n=Vr(e.leafHashes.length),i=new Uint8Array(n);Dr(e.leafHashes.length,i);const o=Ye([i,...e.leafHashes,r.value]);return{...r,value:o}},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every(e=>e instanceof Uint8Array&&32===e.length)&&t.check(e)},expected:"{ masterFingerprint: Uint8Array; pubkey: Uint8Array; path: string; leafHashes: Uint8Array[]; }",canAddToArray:t.canAddToArray}}function Jr(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+We(t.key));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:Uint8Array.from([e]),value:t}},check:function(e){return e instanceof Uint8Array&&32===e.length},expected:"Uint8Array",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}}function qr(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+We(t.key));return t.value},encode:function(t){return{key:Uint8Array.from([e]),value:t}},check:function(e){return e instanceof Uint8Array},expected:"Uint8Array",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}}Kr(Hr.BIP32_DERIVATION),zr(Hr.REDEEM_SCRIPT),qr(Hr.WITNESS_SCRIPT),$r([Hr.PARTIAL_SIG,Hr.BIP32_DERIVATION]),Wr(Hr.TAP_BIP32_DERIVATION),Jr(Hr.TAP_INTERNAL_KEY),Kr(jr.BIP32_DERIVATION),zr(jr.REDEEM_SCRIPT),qr(jr.WITNESS_SCRIPT),$r([jr.BIP32_DERIVATION]),Wr(jr.TAP_BIP32_DERIVATION),Jr(jr.TAP_INTERNAL_KEY);var Xr,Qr={exports:{}};var Zr,en=(Xr||(Xr=1,Zr=Qr,function(){var e="input is invalid type",t="object"==typeof window,r=t?window:{};r.JS_SHA3_NO_WINDOW&&(t=!1);var n=!t&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof y&&y.versions&&y.versions.node?r=g:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&Zr.exports,o=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),a=[4,1024,262144,67108864],c=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],f=[128,256],l=["hex","buffer","arrayBuffer","array","digest"],d={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!o||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,r){return function(n){return new R(e,t,e).update(n)[r]()}},E=function(e,t,r){return function(n,i){return new R(e,t,i).update(n)[r]()}},m=function(e,t,r){return function(t,n,i,o){return I["cshake"+e].update(t,n,i,o)[r]()}},_=function(e,t,r){return function(t,n,i,o){return I["kmac"+e].update(t,n,i,o)[r]()}},w=function(e,t,r,n){for(var i=0;i<l.length;++i){var o=l[i];e[o]=t(r,n,o)}return e},b=function(e,t){var r=p(e,t,"hex");return r.create=function(){return new R(e,t,e)},r.update=function(e){return r.create().update(e)},w(r,p,e,t)},P=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:b},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:b},{name:"shake",padding:[31,7936,2031616,520093696],bits:f,createMethod:function(e,t){var r=E(e,t,"hex");return r.create=function(r){return new R(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},w(r,E,e,t)}},{name:"cshake",padding:a,bits:f,createMethod:function(e,t){var r=d[e],n=m(e,0,"hex");return n.create=function(n,i,o){return i||o?new R(e,t,n).bytepad([i,o],r):I["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},w(n,m,e,t)}},{name:"kmac",padding:a,bits:f,createMethod:function(e,t){var r=d[e],n=_(e,0,"hex");return n.create=function(n,i,o){return new k(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},w(n,_,e,t)}}],I={},A=[],T=0;T<P.length;++T)for(var O=P[T],v=O.bits,S=0;S<v.length;++S){var N=O.name+"_"+v[S];if(A.push(N),I[N]=O.createMethod(v[S],O.padding),"sha3"!==O.name){var U=O.name+v[S];A.push(U),I[U]=I[N]}}function R(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function k(e,t,r){R.call(this,e,t,r)}R.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(o&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||o&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,s,a=this.blocks,u=this.byteCount,h=t.length,f=this.blockCount,l=0,d=this.s;l<h;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<f+1;++i)a[i]=0;if(r)for(i=this.start;l<h&&i<u;++l)a[i>>2]|=t[l]<<c[3&i++];else for(i=this.start;l<h&&i<u;++l)(s=t.charCodeAt(l))<128?a[i>>2]|=s<<c[3&i++]:s<2048?(a[i>>2]|=(192|s>>6)<<c[3&i++],a[i>>2]|=(128|63&s)<<c[3&i++]):s<55296||s>=57344?(a[i>>2]|=(224|s>>12)<<c[3&i++],a[i>>2]|=(128|s>>6&63)<<c[3&i++],a[i>>2]|=(128|63&s)<<c[3&i++]):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++l)),a[i>>2]|=(240|s>>18)<<c[3&i++],a[i>>2]|=(128|s>>12&63)<<c[3&i++],a[i>>2]|=(128|s>>6&63)<<c[3&i++],a[i>>2]|=(128|63&s)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=a[f],i=0;i<f;++i)d[i]^=a[i];B(d),this.reset=!0}else this.start=i}return this},R.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},R.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(o&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||o&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,s=t.length;if(r)i=s;else for(var a=0;a<t.length;++a){var c=t.charCodeAt(a);c<128?i+=1:c<2048?i+=2:c<55296||c>=57344?i+=3:(c=65536+((1023&c)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},R.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,o=[];return o.length=i,this.update(o),this},R.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];B(n)}},R.prototype.toString=R.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,c="";a<n;){for(o=0;o<t&&a<n;++o,++a)e=r[o],c+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t===0&&(B(r),o=0)}return i&&(e=r[o],c+=s[e>>4&15]+s[15&e],i>1&&(c+=s[e>>12&15]+s[e>>8&15]),i>2&&(c+=s[e>>20&15]+s[e>>16&15])),c},R.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s<n;){for(o=0;o<t&&s<n;++o,++s)c[s]=r[o];s%t===0&&B(r)}return i&&(c[o]=r[o],e=e.slice(0,a)),e},R.prototype.buffer=R.prototype.arrayBuffer,R.prototype.digest=R.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,c=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=a<<2,t=n[s],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r===0&&B(n)}return o&&(e=a<<2,t=n[s],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},k.prototype=new R,k.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var B=function(e){var t,r,n,i,o,s,a,c,h,f,l,d,p,y,g,E,m,_,w,b,P,I,A,T,O,v,S,N,U,R,k,B,M,L,x,D,C,V,F,H,j,G,K,$,z,Y,W,J,q,X,Q,Z,ee,te,re,ne,ie,oe,se,ae,ce,ue,he;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],h=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|h>>>31),r=o^(h<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(f<<1|l>>>31),r=a^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(d<<1|p>>>31),r=h^(p<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,y=e[0],g=e[1],Y=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,N=e[20]<<3|e[21]>>>29,U=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,G=e[40]<<18|e[41]>>>14,K=e[41]<<18|e[40]>>>14,L=e[2]<<1|e[3]>>>31,x=e[3]<<1|e[2]>>>31,E=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,q=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,k=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,he=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,C=e[15]<<6|e[14]>>>26,_=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,M=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,O=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,V=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,b=e[36]<<21|e[37]>>>11,P=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,$=e[8]<<27|e[9]>>>5,z=e[9]<<27|e[8]>>>5,v=e[18]<<20|e[19]>>>12,S=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,j=e[39]<<8|e[38]>>>24,I=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=y^~E&_,e[1]=g^~m&w,e[10]=T^~v&N,e[11]=O^~S&U,e[20]=L^~D&V,e[21]=x^~C&F,e[30]=$^~Y&J,e[31]=z^~W&q,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=E^~_&b,e[3]=m^~w&P,e[12]=v^~N&R,e[13]=S^~U&k,e[22]=D^~V&H,e[23]=C^~F&j,e[32]=Y^~J&X,e[33]=W^~q&Q,e[42]=ne^~oe&ae,e[43]=ie^~se&ce,e[4]=_^~b&I,e[5]=w^~P&A,e[14]=N^~R&B,e[15]=U^~k&M,e[24]=V^~H&G,e[25]=F^~j&K,e[34]=J^~X&Z,e[35]=q^~Q&ee,e[44]=oe^~ae&ue,e[45]=se^~ce&he,e[6]=b^~I&y,e[7]=P^~A&g,e[16]=R^~B&T,e[17]=k^~M&O,e[26]=H^~G&L,e[27]=j^~K&x,e[36]=X^~Z&$,e[37]=Q^~ee&z,e[46]=ae^~ue&te,e[47]=ce^~he&re,e[8]=I^~y&E,e[9]=A^~g&m,e[18]=B^~T&v,e[19]=M^~O&S,e[28]=G^~L&D,e[29]=K^~x&C,e[38]=Z^~$&Y,e[39]=ee^~z&W,e[48]=ue^~te&ne,e[49]=he^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)Zr.exports=I;else for(T=0;T<A.length;++T)r[A[T]]=I[A[T]]}()),Qr.exports),tn=h(en);let rn=!1,nn=!1;const on={debug:1,default:2,info:2,warning:3,error:4,off:5};let sn=on.default,an=null;const cn=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var un,hn;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(un||(un={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(hn||(hn={}));const fn="0123456789abcdef";class ln{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==on[r]&&this.throwArgumentError("invalid log level name","logLevel",e),sn>on[r]||console.log.apply(console,t)}debug(...e){this._log(ln.levels.DEBUG,e)}info(...e){this._log(ln.levels.INFO,e)}warn(...e){this._log(ln.levels.WARNING,e)}makeError(e,t,r){if(nn)return this.makeError("censored error",t,{});t||(t=ln.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=fn[t[e]>>4],r+=fn[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let o="";switch(t){case hn.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case hn.CALL_EXCEPTION:case hn.INSUFFICIENT_FUNDS:case hn.MISSING_NEW:case hn.NONCE_EXPIRED:case hn.REPLACEMENT_UNDERPRICED:case hn.TRANSACTION_REPLACED:case hn.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const s=new Error(e);return s.reason=i,s.code=t,Object.keys(r).forEach(function(e){s[e]=r[e]}),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,ln.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){cn&&this.throwError("platform missing String.prototype.normalize",ln.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:cn})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,ln.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,ln.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,ln.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,ln.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",ln.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",ln.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",ln.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return an||(an=new ln("logger/5.8.0")),an}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",ln.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),rn){if(!e)return;this.globalLogger().throwError("error censorship permanent",ln.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}nn=!!e,rn=!!t}static setLogLevel(e){const t=on[e.toLowerCase()];null!=t?sn=t:ln.globalLogger().warn("invalid log level - "+e)}static from(e){return new ln(e)}}ln.errors=hn,ln.levels=un;const dn=new ln("bytes/5.8.0");function pn(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return pn(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function yn(e){return"number"==typeof e&&e==e&&e%1==0}function gn(e,t){if(t||(t={}),"number"==typeof e){dn.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),pn(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),function(e){return!!e.toHexString}(e)&&(e=e.toHexString()),function(e){if("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))return!1;return!0}(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":dn.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return pn(new Uint8Array(n))}return function(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!yn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!yn(r)||r<0||r>=256)return!1}return!0}(e)?pn(new Uint8Array(e)):dn.throwArgumentError("invalid arrayify value","value",e)}function En(e,t){const r=a,n=e.toString("hex"),i=r.from(l.fromHex(n).toBytes(!1)).toString("hex").slice(2);var o;return`0x${(o=r.from(i,"hex"),"0x"+tn.keccak_256(gn(o))).slice(26).toString()}`}async function mn(e,t){let r;"publicKeyJwk"in e?r=Ce(e.publicKeyJwk):void 0!==e.publicKeyMultibase&&(r=await(async({publicKeyMultibase:e})=>{const t=await P({keyPair:{publicKeyMultibase:e}});return Ce(t)})(e));const n=Ne("errors","identityErrorBaseMessage");let i="";switch(t.code){case u.Bitcoin:case u.Mocknet:case u.Testnet:i=function(e,t){return kr({pubkey:e,network:He[t.code]}).address}(r,t);break;case u.Ethmain:case u.Ethropst:case u.Ethrinkeby:case u.Ethgoerli:case u.Ethsepolia:i=En(r);break;default:throw new Oe("deriveIssuingAddressFromPublicKey",`${n} - ${Ne("errors","deriveIssuingAddressFromPublicKey")}`)}return i}function _n(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(s).some(e=>e===t)&&!!s[t].test}return!1}const{LinkedDataProof:wn}=m.suites;class bn extends wn{challenge;domain;type="MerkleProof2019";issuer=null;issuerEndpoint="";verificationMethod=null;externalProof=null;proof=null;proofValue=null;proofPurpose;document=null;explorerAPIs=[];chain;txData;localDocumentHash;derivedIssuingAddress;documentLoader=null;proofVerificationProcess=["assertProofValidity","getTransactionId","computeLocalHash","fetchRemoteHash","compareHashes","checkMerkleRoot","checkReceipt"];identityVerificationProcess=["deriveIssuingAddressFromPublicKey","ensureVerificationMethodValidity","compareIssuingAddress"];transactionId="";constructor({issuer:e=null,verificationMethod:t=null,document:r=null,proof:n=null,options:i={},proofPurpose:o="assertionMethod",domain:s=[],challenge:a=""}){super({type:"MerkleProof2019"}),this.issuer=e,this.verificationMethod=t,this.document=r,this.proofPurpose=o,this.domain=Array.isArray(s)?s:[s],this.challenge=a,this.externalProof=n,this.setOptions(i),(this.externalProof||this.document)&&(this.setProof(this.externalProof),this.getChain(),_n(this.chain)&&(this.adaptProofVerificationProcessToMocknet(),this.adaptIdentityVerificationProcessToMocknet()))}static decodeMerkleProof2019(e){return new Pe(e.proofValue).decode()}createVerifier(){}createVerifyData(){}setProof(e=null){const t=e??this.document.proof;if(!t)throw new Error("The passed document is not signed.");this.proof=t,this.proofValue=bn.decodeMerkleProof2019(this.proof)}async verifyProof({documentLoader:e,verifyIdentity:t,document:r,proof:n}={documentLoader:e=>{},verifyIdentity:!0}){let i;this.documentLoader=e;let o="";if(r&&(this.document=r),n&&this.setProof(n),this.getChain(),_n(this.chain)&&(this.adaptProofVerificationProcessToMocknet(),this.adaptIdentityVerificationProcessToMocknet()),!this.document)throw new Error("A document signed by MerkleProof2019 is required for the verification process.");try{await this.verifyProcess(this.proofVerificationProcess),t&&await this.verifyIdentity(),i=!0}catch(e){console.error(e),i=!1,o=e.message}return{verificationMethod:this.verificationMethod,verified:i,error:o}}async createProof({document:e,purpose:t="assertionMethod"}){if(!this.issuerEndpoint)throw new Error("No issuer endpoint provided. Please set the issuerEndpoint option when instantiating the suite.");const r=await fetch(this.issuerEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({credential:e})}).then(e=>e.json()).catch(e=>{console.error(e)});if(r.verifiableCredential)return r.verifiableCredential.proof;console.error("An error occurred while creating the proof:",r)}async createProofValue({document:e}){const t=await this.createProof({document:e});return t?t.proofValue:"error creating proof"}ensureSuiteContext(){}async verifyIdentity(){if(null!=this.verificationMethod)try{await this.verifyProcess(this.identityVerificationProcess)}catch(e){throw new Error(e)}}getProofVerificationProcess(){return this.proofVerificationProcess}getIdentityVerificationProcess(){return this.identityVerificationProcess}getIssuerPublicKey(){return _n(this.chain)?"This mock chain does not support issuing addresses":this.getTxData()?.issuingAddress??""}getIssuanceTime(){return this.getTxData()?.time??""}getChain(){return this.chain||(this.chain=Ae(this.proofValue)),this.chain}getTxData(){return this.txData?this.txData:(console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?"),null)}adaptProofVerificationProcessToMocknet(){Te(this.proofVerificationProcess,"getTransactionId"),Te(this.proofVerificationProcess,"fetchRemoteHash"),Te(this.proofVerificationProcess,"checkMerkleRoot")}adaptIdentityVerificationProcessToMocknet(){this.identityVerificationProcess=["ensureVerificationMethodValidity"]}setOptions(e){this.explorerAPIs=e.explorerAPIs??[],e.executeStepMethod&&"function"==typeof e.executeStepMethod&&(this.executeStep=e.executeStepMethod),this.issuerEndpoint=e.issuerEndpoint??""}async executeStep(e,t,r=""){return await t()}async verifyProcess(e){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async assertProofValidity(){await this.executeStep("assertProofValidity",()=>Ue({expectedProofPurpose:this.proofPurpose,expectedDomain:this.domain,expectedChallenge:this.challenge,proof:this.proof,issuer:this.issuer}),this.type)}async checkMerkleRoot(){await this.executeStep("checkMerkleRoot",()=>function(e,t){if(e!==t)throw new Oe("checkMerkleRoot",Ne("errors","ensureMerkleRootEqual"));return!0}(this.proofValue.merkleRoot,this.txData.remoteHash),this.type)}async compareHashes(){await this.executeStep("compareHashes",()=>function(e,t){if(e!==t)throw new Oe("compareHashes",Ne("errors","ensureHashesEqual"));return!0}(this.localDocumentHash,this.proofValue.targetHash),this.type)}async computeLocalHash(){this.localDocumentHash=await this.executeStep("computeLocalHash",async()=>await xe(this.document,this.proof,this.documentLoader),this.type)}async checkReceipt(){await this.executeStep("checkReceipt",()=>{!function(e){let t=e.targetHash;const r=e.merkleRoot;try{const r=e.path;if(r&&t)for(const e in r){const n=r[e];let i;if(void 0!==n.left)i=Le(`${n.left}${t}`),t=a.from(b(Uint8Array.from(i))).toString("hex");else{if(void 0===n.right)throw new Oe("checkReceipt","Trigger catch error.");i=Le(`${t}${n.right}`),t=a.from(b(Uint8Array.from(i))).toString("hex")}}}catch(e){throw new Oe("checkReceipt",Ne("errors","ensureValidReceipt"))}if(t!==r)throw new Oe("checkReceipt",Ne("errors","invalidMerkleReceipt"))}(this.proofValue)},this.type)}async getTransactionId(){this.transactionId=function(e=null){if(!e)throw new Error("DecodedProof is not set");const{anchors:t}=e,r=t[0];if("string"==typeof r)return r.split(":").pop();throw new Error("Could not retrieve transaction id as was provided an unexpected format")}(this.proofValue);return await this.executeStep("getTransactionId",()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new Oe("getTransactionId",Ne("errors","isTransactionIdValid"))}(this.transactionId),this.type)}async fetchRemoteHash(){this.txData=await this.executeStep("fetchRemoteHash",async()=>await o({transactionId:this.transactionId,chain:this.chain?.code,explorerAPIs:this.explorerAPIs}),this.type)}async deriveIssuingAddressFromPublicKey(){this.derivedIssuingAddress=await this.executeStep("deriveIssuingAddressFromPublicKey",async()=>await mn(this.verificationMethod,this.chain),this.type)}async ensureVerificationMethodValidity(){await this.executeStep("ensureVerificationMethodValidity",async()=>{if(this.verificationMethod.expires){if(new Date(this.verificationMethod.expires).getTime()<Date.now())throw new Oe("ensureVerificationMethodValidity","The verification key has expired")}if(this.verificationMethod.revoked)throw new Oe("ensureVerificationMethodValidity","The verification key has been revoked")},this.type)}async compareIssuingAddress(){await this.executeStep("compareIssuingAddress",()=>{!function(e,t){const r=Ne("errors","identityErrorBaseMessage");if(e.toLowerCase()!==t.toLowerCase())throw new Oe("compareIssuingAddress",`${r} - ${Ne("errors","compareIssuingAddress")}`)}(this.getIssuerPublicKey(),this.derivedIssuingAddress)},this.type)}}var Pn;function In(e){return bn.decodeMerkleProof2019(e)}!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkImagesIntegrity="checkImagesIntegrity",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.ensureVerificationMethodValidity="ensureVerificationMethodValidity",e.deriveIssuingAddressFromPublicKey="deriveIssuingAddressFromPublicKey",e.compareIssuingAddress="compareIssuingAddress",e.checkAuthenticity="checkAuthenticity"}(Pn||(Pn={}));class An extends _{proofVerificationProcess=[Pn.parseIssuerKeys,Pn.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;verificationMethod;derivedIssuingAddress;hasDid;proof;type="MerkleProof2019";cryptosuite="merkle-proof-2019";suite;proofPurpose;proofDomain;proofChallenge;constructor(e){super(e),this.executeStep=e.executeStep,this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.proof=e.proof,this.issuer=e.issuer,this.proofPurpose=e.proofPurpose,this.proofDomain=e.proofDomain,this.proofChallenge=e.proofChallenge,this.validateProofType(),this.receipt=In(this.proof),this.transactionId=t.certificates.getTransactionId(this.receipt),this.setHasDid()}async init(){await this.setVerificationSuite(),this.chain=this.suite.getChain(),this.adaptVerificationProcessToChain()}async verifyProof(){await this.suite.verifyProof({verifyIdentity:!1}),await this.verifyProcess(this.proofVerificationProcess)}async verifyIdentity(){await this.suite.verifyIdentity()}getProofVerificationSteps(e){return[...this.suite.getProofVerificationProcess(),...this.proofVerificationProcess].map(r=>t.verifier.convertToVerificationSubsteps(e,r))}getIdentityVerificationSteps(e){return this.hasDid?this.suite.getIdentityVerificationProcess().map(r=>t.verifier.convertToVerificationSubsteps(e,r)):[]}getIssuerPublicKey(){return this.suite.getIssuerPublicKey()}getIssuanceTime(){return this.suite.getIssuanceTime()}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){const e=new URL(this.getIssuerProfileUrl());return e?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.proof.created}getChain(){return this.suite.getChain()}getReceipt(){return this.receipt}getTransactionIdString(){return t.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return t.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return t.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}async executeStep(e,t,r){throw new Error("executeStep method needs to be overwritten by injecting from Verifier")}async setVerificationSuite(){await this.setIssuerFromProofVerificationMethod(),this.verificationMethod=T(this.getTargetVerificationMethodContainer(),r(this.proof)),this.suite=new bn({document:this.documentToVerify,proof:this.proof,verificationMethod:this.verificationMethod,proofPurpose:this.proofPurpose,domain:this.proofDomain,challenge:this.proofChallenge,options:{explorerAPIs:this.explorerAPIs,executeStepMethod:this.executeStep}})}adaptVerificationProcessToChain(){t.chains.isMockChain(this.chain)&&(n(this.proofVerificationProcess,Pn.parseIssuerKeys),n(this.proofVerificationProcess,Pn.checkAuthenticity))}getTargetVerificationMethodContainer(){if(this.issuer.didDocument)return this.issuer.didDocument;const e={...this.issuer};return delete e.didDocument,e}findVerificationMethod(e,t){return e?.find(e=>e.id===this.proof.verificationMethod||t+e.id===this.proof.verificationMethod)??null}isProofChain(){return"ChainedProof2021"===this.proof.type}isMultipleProof(){return Array.isArray(this.documentToVerify.proof)}getProofIndex(){return this.isMultipleProof()?this.documentToVerify.proof.findIndex(e=>e.proofValue===this.proof.proofValue):-1}async setIssuerFromProofVerificationMethod(){if(this.getProofIndex()>0){const e=this.proof.verificationMethod.split("#")[0];this.issuer=await t.verifier.getIssuerProfile(e)}}setHasDid(){if(this.getProofIndex()>0){const e=this.proof.verificationMethod.split("#")[0];return void(this.hasDid=i(e))}this.hasDid=!!this.issuer.didDocument}validateProofType(){const e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if("DataIntegrityProof"===e){const e=this.proof.cryptosuite;if(!e)throw new Error(`Malformed proof passed. With DataIntegrityProof a cryptosuite must be defined. Expected: ${this.cryptosuite}`);if(e!==this.cryptosuite)throw new Error(`Incompatible proof cryptosuite passed. Expected: ${this.cryptosuite}, Got: ${e}`);return}if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}async verifyProcess(e){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(Pn.parseIssuerKeys,()=>t.verifier.parseIssuerKeys(this.issuer),this.type)}async checkAuthenticity(){await this.executeStep(Pn.checkAuthenticity,()=>{A(this.issuerPublicKeyList,this.getIssuerPublicKey(),this.getIssuanceTime())},this.type)}}export{An as default,In as parseReceipt};