@blockcerts/blockcerts-verifier 1.57.3 → 1.57.5

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 (36) hide show
  1. package/bundle-stats.html +1 -1
  2. package/dist/{EcdsaSecp256k1Signature2019-01e33e56-6efe219a.js → EcdsaSecp256k1Signature2019-01e33e56-_kD7OEMM.js} +1 -1
  3. package/dist/{Ed25519Signature2020-722d8d24-df100275.js → Ed25519Signature2020-722d8d24-52XGswpx.js} +1 -1
  4. package/dist/{HashlinkVerifier-40818bdd-2156022a.js → HashlinkVerifier-40818bdd-tYZmELFg.js} +1 -1
  5. package/dist/MerkleProof2017-MZJbBTpc-NVfw6WgB.js +75 -0
  6. package/dist/{MerkleProof2017-ac8d147b-dd9968ca.js → MerkleProof2017-ac8d147b-6wk-NtfB.js} +1 -1
  7. package/dist/{MerkleProof2019-6596bc5f-6920f4ea.js → MerkleProof2019-6596bc5f-AOhD0MU2.js} +1 -1
  8. package/dist/{checkRevocationStatusList2021-904b13ff-ca07e61e.js → checkRevocationStatusList2021-904b13ff-HXtw_2Lc.js} +2 -2
  9. package/dist/{controlVerificationMethod-80d0e7f0-27e88021.js → controlVerificationMethod-80d0e7f0-8ug9g49U.js} +1 -1
  10. package/dist/{did-key-common.esm-2e9ab4e3-8e1d8d48.js → did-key-common.esm-2e9ab4e3-X4avzjKx.js} +1 -1
  11. package/dist/{did-key-ed25519.esm-54d2cbca-52ecc5b1.js → did-key-ed25519.esm-54d2cbca-E7NBXv8_.js} +1 -1
  12. package/dist/{did-key-secp256k1.esm-8a01b23c-75ec86fd.js → did-key-secp256k1.esm-8a01b23c-iRA0puBs.js} +1 -1
  13. package/dist/{downloadPDF-3eae8dbd.js → downloadPDF-5Pw6AlBs.js} +2 -2
  14. package/dist/ensureNotRevoked-gui-UMnE-9nObicUP.js +1 -0
  15. package/dist/{index-6d4132ca-27a349f3.js → index-6d4132ca-BtAgIaHS.js} +1 -1
  16. package/dist/index-WX6J-tsk.js +2 -0
  17. package/dist/{index.es-8c0f0440.js → index.es-YP2tdnLj.js} +3 -3
  18. package/dist/{jsonld-signatures-8ecbbaa2-fff3092d.js → jsonld-signatures-8ecbbaa2-MztjIc1c.js} +1 -1
  19. package/dist/main.js +107 -127
  20. package/dist/{purify-f19816d8.js → purify-xGHUwWlQ.js} +1 -1
  21. package/dist/{x25519-08f432f1-3fdac820.js → x25519-08f432f1-4TKeGPT6.js} +1 -1
  22. package/package.json +4 -4
  23. package/dist/verifier-es-b337491f.js +0 -120
  24. /package/dist/{Suite-e65d26ad-9eb797e9.js → Suite-e65d26ad-e2QgHGhx.js} +0 -0
  25. /package/dist/{_commonjs-dynamic-modules-1e49c0dd-3e972b61.js → _commonjs-dynamic-modules-1e49c0dd-fkA6S-_a.js} +0 -0
  26. /package/dist/{elliptic-a9d84078-bc51730e.js → elliptic-a9d84078-BGmaMzNc.js} +0 -0
  27. /package/dist/{ensureNotRevoked-2dc26afb-7b9df556.js → ensureNotRevoked-2dc26afb-U5ByLE-t.js} +0 -0
  28. /package/dist/{ensureValidIssuingKey-b950fb8b-b8fdc4d0.js → ensureValidIssuingKey-b950fb8b-oM__XftS.js} +0 -0
  29. /package/dist/{index-0469d008-3e0eb763.js → index-0469d008-LwXIiw03.js} +0 -0
  30. /package/dist/{index-85f56501-cfd39fda.js → index-85f56501-xkysxAxC.js} +0 -0
  31. /package/dist/{index-69ba64e7.js → index-F1HqK0qm.js} +0 -0
  32. /package/dist/{index-a93e1e88-967d29f5.js → index-a93e1e88-w6XCMY1g.js} +0 -0
  33. /package/dist/{jsonld-6909fb49-1ef9cd75.js → jsonld-6909fb49-vaWL2Y4h.js} +0 -0
  34. /package/dist/{pako.esm-7a9981ef-ce496ef7.js → pako.esm-7a9981ef-RAILONW0.js} +0 -0
  35. /package/dist/{sha256-71400caa-e7398231.js → sha256-71400caa-o9J6pXuo.js} +0 -0
  36. /package/dist/{tslib.es6-28b6776b-35eb20e3.js → tslib.es6-28b6776b-qWIKDnpX.js} +0 -0
@@ -123,7 +123,7 @@ function(A){var t=function(A){var t,e,r,n,i,o,s,a,c,u;for(e=[],r=0,n=(A+=t="\0\0
123
123
  * Licensed under the MIT License.
124
124
  * http://opensource.org/licenses/mit-license
125
125
  */
126
- function(A){A.loadFile=function(A,t,e){return function(A,t,e){t=!1!==t,e="function"==typeof e?e:function(){};var r=void 0;try{r=function(A,t,e){var r=new XMLHttpRequest,n=0,i=function(A){var t=A.length,e=[],r=String.fromCharCode;for(n=0;n<t;n+=1)e.push(r(255&A.charCodeAt(n)));return e.join("")};if(r.open("GET",A,!t),r.overrideMimeType("text/plain; charset=x-user-defined"),!1===t&&(r.onload=function(){200===r.status?e(i(this.responseText)):e(void 0)}),r.send(null),t&&200===r.status)return i(r.responseText)}(A,t,e)}catch(A){}return r}(A,t,e)},A.loadImageFile=A.loadFile}(IA.API),function(t){function e(){return(W.html2canvas?Promise.resolve(W.html2canvas):Promise.resolve().then((function(){return me}))).catch((function(A){return Promise.reject(new Error("Could not load html2canvas: "+A))})).then((function(A){return A.default?A.default:A}))}function r(){return(W.DOMPurify?Promise.resolve(W.DOMPurify):import("./purify-f19816d8.js").then((function(A){return A.p}))).catch((function(A){return Promise.reject(new Error("Could not load dompurify: "+A))})).then((function(A){return A.default?A.default:A}))}var n=function(t){var e=A(t);return"undefined"===e?"undefined":"string"===e||t instanceof String?"string":"number"===e||t instanceof Number?"number":"function"===e||t instanceof Function?"function":t&&t.constructor===Array?"array":t&&1===t.nodeType?"element":"object"===e?"object":"unknown"},i=function(A,t){var e=document.createElement(A);for(var r in t.className&&(e.className=t.className),t.innerHTML&&t.dompurify&&(e.innerHTML=t.dompurify.sanitize(t.innerHTML)),t.style)e.style[r]=t.style[r];return e},o=function A(t){var e=Object.assign(A.convert(Promise.resolve()),JSON.parse(JSON.stringify(A.template))),r=A.convert(Promise.resolve(),e);return(r=r.setProgress(1,A,1,[A])).set(t)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(A,t){return A.__proto__=t||o.prototype,A},o.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},o.prototype.from=function(A,t){return this.then((function(){switch(t=t||function(A){switch(n(A)){case"string":return"string";case"element":return"canvas"===A.nodeName.toLowerCase()?"canvas":"element";default:return"unknown"}}(A)){case"string":return this.then(r).then((function(t){return this.set({src:i("div",{innerHTML:A,dompurify:t})})}));case"element":return this.set({src:A});case"canvas":return this.set({canvas:A});case"img":return this.set({img:A});default:return this.error("Unknown source type.")}}))},o.prototype.to=function(A){switch(A){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},o.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then((function(){var A={position:"relative",display:"inline-block",width:("number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},t=function A(t,e){for(var r=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),n=t.firstChild;n;n=n.nextSibling)!0!==e&&1===n.nodeType&&"SCRIPT"===n.nodeName||r.appendChild(A(n,e));return 1===t.nodeType&&("CANVAS"===t.nodeName?(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(t,0,0)):"TEXTAREA"!==t.nodeName&&"SELECT"!==t.nodeName||(r.value=t.value),r.addEventListener("load",(function(){r.scrollTop=t.scrollTop,r.scrollLeft=t.scrollLeft}),!0)),r}(this.prop.src,this.opt.html2canvas.javascriptEnabled);"BODY"===t.tagName&&(A.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=i("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=i("div",{className:"html2pdf__container",style:A}),this.prop.container.appendChild(t),this.prop.container.firstChild.appendChild(i("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"}))},o.prototype.toCanvas=function(){var A=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(A).then(e).then((function(A){var t=Object.assign({},this.opt.html2canvas);return delete t.onrendered,A(this.prop.container,t)})).then((function(A){(this.opt.html2canvas.onrendered||function(){})(A),this.prop.canvas=A,document.body.removeChild(this.prop.overlay)}))},o.prototype.toContext2d=function(){var A=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(A).then(e).then((function(A){var t=this.opt.jsPDF,e=this.opt.fontFaces,r="number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,n=Object.assign({async:!0,allowTaint:!0,scale:r,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete n.onrendered,t.context2d.autoPaging=void 0===this.opt.autoPaging||this.opt.autoPaging,t.context2d.posX=this.opt.x,t.context2d.posY=this.opt.y,t.context2d.margin=this.opt.margin,t.context2d.fontFaces=e,e)for(var i=0;i<e.length;++i){var o=e[i],s=o.src.find((function(A){return"truetype"===A.format}));s&&t.addFont(s.url,o.ref.name,o.ref.style)}return n.windowHeight=n.windowHeight||0,n.windowHeight=0==n.windowHeight?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):n.windowHeight,t.context2d.save(!0),A(this.prop.container,n)})).then((function(A){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(A),this.prop.canvas=A,document.body.removeChild(this.prop.overlay)}))},o.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then((function(){var A=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=A}))},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then((function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF}))},o.prototype.output=function(A,t,e){return"img"===(e=e||"pdf").toLowerCase()||"image"===e.toLowerCase()?this.outputImg(A,t):this.outputPdf(A,t)},o.prototype.outputPdf=function(A,t){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){return this.prop.pdf.output(A,t)}))},o.prototype.outputImg=function(A){return this.thenList([function(){return this.prop.img||this.toImg()}]).then((function(){switch(A){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+A+'" is not supported.'}}))},o.prototype.save=function(A){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(A?{filename:A}:null).then((function(){this.prop.pdf.save(this.opt.filename)}))},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){this.prop.callback(this.prop.pdf)}))},o.prototype.set=function(A){if("object"!==n(A))return this;var t=Object.keys(A||{}).map((function(t){if(t in o.template.prop)return function(){this.prop[t]=A[t]};switch(t){case"margin":return this.setMargin.bind(this,A.margin);case"jsPDF":return function(){return this.opt.jsPDF=A.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,A.pageSize);default:return function(){this.opt[t]=A[t]}}}),this);return this.then((function(){return this.thenList(t)}))},o.prototype.get=function(A,t){return this.then((function(){var e=A in o.template.prop?this.prop[A]:this.opt[A];return t?t(e):e}))},o.prototype.setMargin=function(A){return this.then((function(){switch(n(A)){case"number":A=[A,A,A,A];case"array":if(2===A.length&&(A=[A[0],A[1],A[0],A[1]]),4===A.length)break;default:return this.error("Invalid margin array.")}this.opt.margin=A})).then(this.setPageSize)},o.prototype.setPageSize=function(A){function t(A,t){return Math.floor(A*t/72*96)}return this.then((function(){(A=A||IA.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(A.inner={width:A.width-this.opt.margin[1]-this.opt.margin[3],height:A.height-this.opt.margin[0]-this.opt.margin[2]},A.inner.px={width:t(A.inner.width,A.k),height:t(A.inner.height,A.k)},A.inner.ratio=A.inner.height/A.inner.width),this.prop.pageSize=A}))},o.prototype.setProgress=function(A,t,e,r){return null!=A&&(this.progress.val=A),null!=t&&(this.progress.state=t),null!=e&&(this.progress.n=e),null!=r&&(this.progress.stack=r),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(A,t,e,r){return this.setProgress(A?this.progress.val+A:null,t||null,e?this.progress.n+e:null,r?this.progress.stack.concat(r):null)},o.prototype.then=function(A,t){var e=this;return this.thenCore(A,t,(function(A,t){return e.updateProgress(null,null,1,[A]),Promise.prototype.then.call(this,(function(t){return e.updateProgress(null,A),t})).then(A,t).then((function(A){return e.updateProgress(1),A}))}))},o.prototype.thenCore=function(A,t,e){e=e||Promise.prototype.then,A&&(A=A.bind(this)),t&&(t=t.bind(this));var r=-1!==Promise.toString().indexOf("[native code]")&&"Promise"===Promise.name?this:o.convert(Object.assign({},this),Promise.prototype),n=e.call(r,A,t);return o.convert(n,this.__proto__)},o.prototype.thenExternal=function(A,t){return Promise.prototype.then.call(this,A,t)},o.prototype.thenList=function(A){var t=this;return A.forEach((function(A){t=t.thenCore(A)})),t},o.prototype.catch=function(A){A&&(A=A.bind(this));var t=Promise.prototype.catch.call(this,A);return o.convert(t,this)},o.prototype.catchExternal=function(A){return Promise.prototype.catch.call(this,A)},o.prototype.error=function(A){return this.then((function(){throw new Error(A)}))},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,IA.getPageSize=function(t,e,r){if("object"===A(t)){var n=t;t=n.orientation,e=n.unit||e,r=n.format||r}e=e||"mm",r=r||"a4",t=(""+(t||"P")).toLowerCase();var i,o=(""+r).toLowerCase(),s={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(e){case"pt":i=1;break;case"mm":i=72/25.4;break;case"cm":i=72/2.54;break;case"in":i=72;break;case"px":i=.75;break;case"pc":case"em":i=12;break;case"ex":i=6;break;default:throw"Invalid unit: "+e}var a,c=0,u=0;if(s.hasOwnProperty(o))c=s[o][1]/i,u=s[o][0]/i;else try{c=r[1],u=r[0]}catch(A){throw new Error("Invalid format: "+r)}if("p"===t||"portrait"===t)t="p",u>c&&(a=u,u=c,c=a);else{if("l"!==t&&"landscape"!==t)throw"Invalid orientation: "+t;t="l",c>u&&(a=u,u=c,c=a)}return{width:u,height:c,unit:e,k:i,orientation:t}},t.html=function(A,t){(t=t||{}).callback=t.callback||function(){},t.html2canvas=t.html2canvas||{},t.html2canvas.canvas=t.html2canvas.canvas||this.canvas,t.jsPDF=t.jsPDF||this,t.fontFaces=t.fontFaces?t.fontFaces.map(yt):null;var e=new o(t);return t.worker?e:e.from(A).doCallback()}}(IA.API),IA.API.addJS=function(A){return Pt=A,this.internal.events.subscribe("postPutResources",(function(){Nt=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(Nt+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),St=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+Pt+")"),this.internal.out(">>"),this.internal.out("endobj")})),this.internal.events.subscribe("putCatalog",(function(){void 0!==Nt&&void 0!==St&&this.internal.out("/Names <</JavaScript "+Nt+" 0 R>>")})),this
126
+ function(A){A.loadFile=function(A,t,e){return function(A,t,e){t=!1!==t,e="function"==typeof e?e:function(){};var r=void 0;try{r=function(A,t,e){var r=new XMLHttpRequest,n=0,i=function(A){var t=A.length,e=[],r=String.fromCharCode;for(n=0;n<t;n+=1)e.push(r(255&A.charCodeAt(n)));return e.join("")};if(r.open("GET",A,!t),r.overrideMimeType("text/plain; charset=x-user-defined"),!1===t&&(r.onload=function(){200===r.status?e(i(this.responseText)):e(void 0)}),r.send(null),t&&200===r.status)return i(r.responseText)}(A,t,e)}catch(A){}return r}(A,t,e)},A.loadImageFile=A.loadFile}(IA.API),function(t){function e(){return(W.html2canvas?Promise.resolve(W.html2canvas):Promise.resolve().then((function(){return me}))).catch((function(A){return Promise.reject(new Error("Could not load html2canvas: "+A))})).then((function(A){return A.default?A.default:A}))}function r(){return(W.DOMPurify?Promise.resolve(W.DOMPurify):import("./purify-xGHUwWlQ.js").then((function(A){return A.p}))).catch((function(A){return Promise.reject(new Error("Could not load dompurify: "+A))})).then((function(A){return A.default?A.default:A}))}var n=function(t){var e=A(t);return"undefined"===e?"undefined":"string"===e||t instanceof String?"string":"number"===e||t instanceof Number?"number":"function"===e||t instanceof Function?"function":t&&t.constructor===Array?"array":t&&1===t.nodeType?"element":"object"===e?"object":"unknown"},i=function(A,t){var e=document.createElement(A);for(var r in t.className&&(e.className=t.className),t.innerHTML&&t.dompurify&&(e.innerHTML=t.dompurify.sanitize(t.innerHTML)),t.style)e.style[r]=t.style[r];return e},o=function A(t){var e=Object.assign(A.convert(Promise.resolve()),JSON.parse(JSON.stringify(A.template))),r=A.convert(Promise.resolve(),e);return(r=r.setProgress(1,A,1,[A])).set(t)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(A,t){return A.__proto__=t||o.prototype,A},o.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},o.prototype.from=function(A,t){return this.then((function(){switch(t=t||function(A){switch(n(A)){case"string":return"string";case"element":return"canvas"===A.nodeName.toLowerCase()?"canvas":"element";default:return"unknown"}}(A)){case"string":return this.then(r).then((function(t){return this.set({src:i("div",{innerHTML:A,dompurify:t})})}));case"element":return this.set({src:A});case"canvas":return this.set({canvas:A});case"img":return this.set({img:A});default:return this.error("Unknown source type.")}}))},o.prototype.to=function(A){switch(A){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},o.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then((function(){var A={position:"relative",display:"inline-block",width:("number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},t=function A(t,e){for(var r=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),n=t.firstChild;n;n=n.nextSibling)!0!==e&&1===n.nodeType&&"SCRIPT"===n.nodeName||r.appendChild(A(n,e));return 1===t.nodeType&&("CANVAS"===t.nodeName?(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(t,0,0)):"TEXTAREA"!==t.nodeName&&"SELECT"!==t.nodeName||(r.value=t.value),r.addEventListener("load",(function(){r.scrollTop=t.scrollTop,r.scrollLeft=t.scrollLeft}),!0)),r}(this.prop.src,this.opt.html2canvas.javascriptEnabled);"BODY"===t.tagName&&(A.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=i("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=i("div",{className:"html2pdf__container",style:A}),this.prop.container.appendChild(t),this.prop.container.firstChild.appendChild(i("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"}))},o.prototype.toCanvas=function(){var A=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(A).then(e).then((function(A){var t=Object.assign({},this.opt.html2canvas);return delete t.onrendered,A(this.prop.container,t)})).then((function(A){(this.opt.html2canvas.onrendered||function(){})(A),this.prop.canvas=A,document.body.removeChild(this.prop.overlay)}))},o.prototype.toContext2d=function(){var A=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(A).then(e).then((function(A){var t=this.opt.jsPDF,e=this.opt.fontFaces,r="number"!=typeof this.opt.width||isNaN(this.opt.width)||"number"!=typeof this.opt.windowWidth||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,n=Object.assign({async:!0,allowTaint:!0,scale:r,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete n.onrendered,t.context2d.autoPaging=void 0===this.opt.autoPaging||this.opt.autoPaging,t.context2d.posX=this.opt.x,t.context2d.posY=this.opt.y,t.context2d.margin=this.opt.margin,t.context2d.fontFaces=e,e)for(var i=0;i<e.length;++i){var o=e[i],s=o.src.find((function(A){return"truetype"===A.format}));s&&t.addFont(s.url,o.ref.name,o.ref.style)}return n.windowHeight=n.windowHeight||0,n.windowHeight=0==n.windowHeight?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):n.windowHeight,t.context2d.save(!0),A(this.prop.container,n)})).then((function(A){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(A),this.prop.canvas=A,document.body.removeChild(this.prop.overlay)}))},o.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then((function(){var A=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=A}))},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then((function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF}))},o.prototype.output=function(A,t,e){return"img"===(e=e||"pdf").toLowerCase()||"image"===e.toLowerCase()?this.outputImg(A,t):this.outputPdf(A,t)},o.prototype.outputPdf=function(A,t){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){return this.prop.pdf.output(A,t)}))},o.prototype.outputImg=function(A){return this.thenList([function(){return this.prop.img||this.toImg()}]).then((function(){switch(A){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+A+'" is not supported.'}}))},o.prototype.save=function(A){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(A?{filename:A}:null).then((function(){this.prop.pdf.save(this.opt.filename)}))},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then((function(){this.prop.callback(this.prop.pdf)}))},o.prototype.set=function(A){if("object"!==n(A))return this;var t=Object.keys(A||{}).map((function(t){if(t in o.template.prop)return function(){this.prop[t]=A[t]};switch(t){case"margin":return this.setMargin.bind(this,A.margin);case"jsPDF":return function(){return this.opt.jsPDF=A.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,A.pageSize);default:return function(){this.opt[t]=A[t]}}}),this);return this.then((function(){return this.thenList(t)}))},o.prototype.get=function(A,t){return this.then((function(){var e=A in o.template.prop?this.prop[A]:this.opt[A];return t?t(e):e}))},o.prototype.setMargin=function(A){return this.then((function(){switch(n(A)){case"number":A=[A,A,A,A];case"array":if(2===A.length&&(A=[A[0],A[1],A[0],A[1]]),4===A.length)break;default:return this.error("Invalid margin array.")}this.opt.margin=A})).then(this.setPageSize)},o.prototype.setPageSize=function(A){function t(A,t){return Math.floor(A*t/72*96)}return this.then((function(){(A=A||IA.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(A.inner={width:A.width-this.opt.margin[1]-this.opt.margin[3],height:A.height-this.opt.margin[0]-this.opt.margin[2]},A.inner.px={width:t(A.inner.width,A.k),height:t(A.inner.height,A.k)},A.inner.ratio=A.inner.height/A.inner.width),this.prop.pageSize=A}))},o.prototype.setProgress=function(A,t,e,r){return null!=A&&(this.progress.val=A),null!=t&&(this.progress.state=t),null!=e&&(this.progress.n=e),null!=r&&(this.progress.stack=r),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(A,t,e,r){return this.setProgress(A?this.progress.val+A:null,t||null,e?this.progress.n+e:null,r?this.progress.stack.concat(r):null)},o.prototype.then=function(A,t){var e=this;return this.thenCore(A,t,(function(A,t){return e.updateProgress(null,null,1,[A]),Promise.prototype.then.call(this,(function(t){return e.updateProgress(null,A),t})).then(A,t).then((function(A){return e.updateProgress(1),A}))}))},o.prototype.thenCore=function(A,t,e){e=e||Promise.prototype.then,A&&(A=A.bind(this)),t&&(t=t.bind(this));var r=-1!==Promise.toString().indexOf("[native code]")&&"Promise"===Promise.name?this:o.convert(Object.assign({},this),Promise.prototype),n=e.call(r,A,t);return o.convert(n,this.__proto__)},o.prototype.thenExternal=function(A,t){return Promise.prototype.then.call(this,A,t)},o.prototype.thenList=function(A){var t=this;return A.forEach((function(A){t=t.thenCore(A)})),t},o.prototype.catch=function(A){A&&(A=A.bind(this));var t=Promise.prototype.catch.call(this,A);return o.convert(t,this)},o.prototype.catchExternal=function(A){return Promise.prototype.catch.call(this,A)},o.prototype.error=function(A){return this.then((function(){throw new Error(A)}))},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,IA.getPageSize=function(t,e,r){if("object"===A(t)){var n=t;t=n.orientation,e=n.unit||e,r=n.format||r}e=e||"mm",r=r||"a4",t=(""+(t||"P")).toLowerCase();var i,o=(""+r).toLowerCase(),s={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(e){case"pt":i=1;break;case"mm":i=72/25.4;break;case"cm":i=72/2.54;break;case"in":i=72;break;case"px":i=.75;break;case"pc":case"em":i=12;break;case"ex":i=6;break;default:throw"Invalid unit: "+e}var a,c=0,u=0;if(s.hasOwnProperty(o))c=s[o][1]/i,u=s[o][0]/i;else try{c=r[1],u=r[0]}catch(A){throw new Error("Invalid format: "+r)}if("p"===t||"portrait"===t)t="p",u>c&&(a=u,u=c,c=a);else{if("l"!==t&&"landscape"!==t)throw"Invalid orientation: "+t;t="l",c>u&&(a=u,u=c,c=a)}return{width:u,height:c,unit:e,k:i,orientation:t}},t.html=function(A,t){(t=t||{}).callback=t.callback||function(){},t.html2canvas=t.html2canvas||{},t.html2canvas.canvas=t.html2canvas.canvas||this.canvas,t.jsPDF=t.jsPDF||this,t.fontFaces=t.fontFaces?t.fontFaces.map(yt):null;var e=new o(t);return t.worker?e:e.from(A).doCallback()}}(IA.API),IA.API.addJS=function(A){return Pt=A,this.internal.events.subscribe("postPutResources",(function(){Nt=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(Nt+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),St=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+Pt+")"),this.internal.out(">>"),this.internal.out("endobj")})),this.internal.events.subscribe("putCatalog",(function(){void 0!==Nt&&void 0!==St&&this.internal.out("/Names <</JavaScript "+Nt+" 0 R>>")})),this
127
127
  /**
128
128
  * @license
129
129
  * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
@@ -284,7 +284,7 @@ function(A){var t=function(A){for(var t=A.length,e=new Uint8Array(t),r=0;r<t;r++
284
284
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
285
285
  * ====================================================================
286
286
  */
287
- function(A){function t(){return(W.canvg?Promise.resolve(W.canvg):import("./index.es-8c0f0440.js")).catch((function(A){return Promise.reject(new Error("Could not load canvg: "+A))})).then((function(A){return A.default?A.default:A}))}IA.API.addSvgAsImage=function(A,e,r,n,i,o,s,a){if(isNaN(e)||isNaN(r))throw Y.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw Y.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=n,c.height=i;var u=c.getContext("2d");u.fillStyle="#fff",u.fillRect(0,0,c.width,c.height);var l={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return t().then((function(t){return t.fromString(u,A,l)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(A){return A.render(l)})).then((function(){h.addImage(c.toDataURL("image/jpeg",1),e,r,n,i,s,a)}))}}(),IA.API.putTotalPages=function(A){var t,e=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(A,"g"),e=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(A,this.internal.getFont()),"g"),e=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var n=0;n<this.internal.pages[r].length;n++)this.internal.pages[r][n]=this.internal.pages[r][n].replace(t,e);return this},IA.API.viewerPreferences=function(t,e){var r;t=t||{},e=e||!1;var n,i,o,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},a=Object.keys(s),c=[],u=0,l=0,h=0;function f(A,t){var e,r=!1;for(e=0;e<A.length;e+=1)A[e]===t&&(r=!0);return r}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,"reset"===t||!0===e){var B=a.length;for(h=0;h<B;h+=1)r[a[h]].value=r[a[h]].defaultValue,r[a[h]].explicitSet=!1}if("object"===A(t))for(i in t)if(o=t[i],f(a,i)&&void 0!==o){if("boolean"===r[i].type&&"boolean"==typeof o)r[i].value=o;else if("name"===r[i].type&&f(r[i].valueSet,o))r[i].value=o;else if("integer"===r[i].type&&Number.isInteger(o))r[i].value=o;else if("array"===r[i].type){for(u=0;u<o.length;u+=1)if(n=!0,1===o[u].length&&"number"==typeof o[u][0])c.push(String(o[u]-1));else if(o[u].length>1){for(l=0;l<o[u].length;l+=1)"number"!=typeof o[u][l]&&(n=!1);!0===n&&c.push([o[u][0]-1,o[u][1]-1].join(" "))}r[i].value="["+c.join(" ")+"]"}else r[i].value=r[i].defaultValue;r[i].explicitSet=!0}return!1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var A,t=[];for(A in r)!0===r[A].explicitSet&&("name"===r[A].type?t.push("/"+A+" /"+r[A].value):t.push("/"+A+" "+r[A].value));0!==t.length&&this.internal.write("/ViewerPreferences\n<<\n"+t.join("\n")+"\n>>")})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=r,this
287
+ function(A){function t(){return(W.canvg?Promise.resolve(W.canvg):import("./index.es-YP2tdnLj.js")).catch((function(A){return Promise.reject(new Error("Could not load canvg: "+A))})).then((function(A){return A.default?A.default:A}))}IA.API.addSvgAsImage=function(A,e,r,n,i,o,s,a){if(isNaN(e)||isNaN(r))throw Y.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw Y.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=n,c.height=i;var u=c.getContext("2d");u.fillStyle="#fff",u.fillRect(0,0,c.width,c.height);var l={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return t().then((function(t){return t.fromString(u,A,l)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(A){return A.render(l)})).then((function(){h.addImage(c.toDataURL("image/jpeg",1),e,r,n,i,s,a)}))}}(),IA.API.putTotalPages=function(A){var t,e=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(A,"g"),e=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(A,this.internal.getFont()),"g"),e=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var n=0;n<this.internal.pages[r].length;n++)this.internal.pages[r][n]=this.internal.pages[r][n].replace(t,e);return this},IA.API.viewerPreferences=function(t,e){var r;t=t||{},e=e||!1;var n,i,o,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},a=Object.keys(s),c=[],u=0,l=0,h=0;function f(A,t){var e,r=!1;for(e=0;e<A.length;e+=1)A[e]===t&&(r=!0);return r}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,"reset"===t||!0===e){var B=a.length;for(h=0;h<B;h+=1)r[a[h]].value=r[a[h]].defaultValue,r[a[h]].explicitSet=!1}if("object"===A(t))for(i in t)if(o=t[i],f(a,i)&&void 0!==o){if("boolean"===r[i].type&&"boolean"==typeof o)r[i].value=o;else if("name"===r[i].type&&f(r[i].valueSet,o))r[i].value=o;else if("integer"===r[i].type&&Number.isInteger(o))r[i].value=o;else if("array"===r[i].type){for(u=0;u<o.length;u+=1)if(n=!0,1===o[u].length&&"number"==typeof o[u][0])c.push(String(o[u]-1));else if(o[u].length>1){for(l=0;l<o[u].length;l+=1)"number"!=typeof o[u][l]&&(n=!1);!0===n&&c.push([o[u][0]-1,o[u][1]-1].join(" "))}r[i].value="["+c.join(" ")+"]"}else r[i].value=r[i].defaultValue;r[i].explicitSet=!0}return!1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var A,t=[];for(A in r)!0===r[A].explicitSet&&("name"===r[A].type?t.push("/"+A+" /"+r[A].value):t.push("/"+A+" "+r[A].value));0!==t.length&&this.internal.write("/ViewerPreferences\n<<\n"+t.join("\n")+"\n>>")})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=r,this
288
288
  /** ====================================================================
289
289
  * @license
290
290
  * jsPDF XMP metadata plugin
@@ -0,0 +1 @@
1
+ import{f as e,V as t,S as a,d as n}from"./index-WX6J-tsk.js";function i(i,r){if(!i||!r)return;Array.isArray(r)||(r=[r]),r=r.filter((e=>null!=e));const o=e(r,i.map((e=>e.id)));if(o.length>0){const e=i.findIndex((e=>e.id===o[0]));if(e>-1)throw new t(a.checkRevokedStatus,n.certificates.generateRevocationReason(i[e].revocationReason))}}export{i as default};
@@ -1,3 +1,3 @@
1
- import{p as e,l as t,h as r,D as n,G as o,c as i,i as s,d as a,H as c}from"./main.js";import{b as u}from"./index-0469d008-3e0eb763.js";import{b as l,r as f,i as p,m as h,e as d}from"./elliptic-a9d84078-bc51730e.js";function y(e,n){if(!e.verificationMethod)return void console.warn("No verification method found in the issuer document. This will likely become a requirement in the near future");const o=n.split("#")[1],i=e.verificationMethod.find((e=>e.id===`#${o}`||e.id===n));if(!i)throw new t("retrieveVerificationMethodPublicKey",`${u} - ${r.i18n.getText("errors","retrieveVerificationMethodPublicKey")}`);return i}var m=n(o),b=n(c),v={exports:{}};
1
+ import{p as e,l as t,h as r,D as n,G as o,c as i,i as s,d as a,H as c}from"./main.js";import{b as u}from"./index-0469d008-LwXIiw03.js";import{b as l,r as f,i as p,m as h,e as d}from"./elliptic-a9d84078-BGmaMzNc.js";function y(e,n){if(!e.verificationMethod)return void console.warn("No verification method found in the issuer document. This will likely become a requirement in the near future");const o=n.split("#")[1],i=e.verificationMethod.find((e=>e.id===`#${o}`||e.id===n));if(!i)throw new t("retrieveVerificationMethodPublicKey",`${u} - ${r.i18n.getText("errors","retrieveVerificationMethodPublicKey")}`);return i}var m=n(o),b=n(c),v={exports:{}};
2
2
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
3
3
  !function(e,t){var r=f,n=r.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=i),i.prototype=Object.create(n.prototype),o(n,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var o=n(e);return void 0!==t?"string"==typeof r?o.fill(t,r):o.fill(t):o.fill(0),o},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(v,v.exports);var g=v.exports;var w=class extends Error{constructor(e){super(e||"This operation is not supported for this key type")}};var _=class extends Error{constructor(){super("This has not been implemented yet")}};var k=class{constructor(){this.registry=[],this.classes={}}find(e){return this.registry.find(e)}define(e,t){e.forEach((e=>{let{kty:r}=e;if(!r)throw new Error("Invalid type definition");this.classes[r]||(this.classes[r]=t),this.registry.push(e)}))}normalize(e,t,r){let n=this.classes[e],o=this.find((e=>e[t]===r));if(!n||!o)throw new Error("Invalid type");return new n(o)}};const P=_;var S,E=class{constructor(e){this.params=e}fromPrivatePKCS1(e){throw new P}fromPrivatePKCS8(e){throw new P}fromPublicPKCS1(e){throw new P}fromPublicPKCS8(e){throw new P}fromPrivateBlk(e){throw new P}fromPublicBlk(e){throw new P}fromJwk(e){throw new P}toPrivatePKCS1(e){throw new P}toPrivatePKCS8(e){throw new P}toPublicPKCS1(e){throw new P}toPublicPKCS8(e){throw new P}toPrivateBlk(e){throw new P}toPublicBlk(e){throw new P}toPrivateJwk(e){throw new P}toPublicJwk(e){throw new P}static formatPem(e,t){return`-----BEGIN ${t} KEY-----\n`+e.match(/.{1,64}/g).join("\n")+`\n-----END ${t} KEY-----`}},K={},C={},B={},x=f,j=x.Buffer,A={};for(S in x)x.hasOwnProperty(S)&&"SlowBuffer"!==S&&"Buffer"!==S&&(A[S]=x[S]);var I=A.Buffer={};for(S in j)j.hasOwnProperty(S)&&"allocUnsafe"!==S&&"allocUnsafeSlow"!==S&&(I[S]=j[S]);if(A.Buffer.prototype=j.prototype,I.from&&I.from!==Uint8Array.from||(I.from=function(e,t,r){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return j(e,t,r)}),I.alloc||(I.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var n=j(e);return t&&0!==t.length?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n}),!A.kStringMaxLength)try{A.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(e){}A.constants||(A.constants={MAX_LENGTH:A.kMaxLength},A.kStringMaxLength&&(A.constants.MAX_STRING_LENGTH=A.kStringMaxLength));var q=A,T={};const U=p;function D(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function O(e,t){this.path=e,this.rethrow(t)}T.Reporter=D,D.prototype.isError=function(e){return e instanceof O},D.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},D.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},D.prototype.enterKey=function(e){return this._reporterState.path.push(e)},D.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},D.prototype.leaveKey=function(e,t,r){const n=this._reporterState;this.exitKey(e),null!==n.obj&&(n.obj[t]=r)},D.prototype.path=function(){return this._reporterState.path.join("/")},D.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},D.prototype.leaveObject=function(e){const t=this._reporterState,r=t.obj;return t.obj=e,r},D.prototype.error=function(e){let t;const r=this._reporterState,n=e instanceof O;if(t=n?e:new O(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return n||r.errors.push(t),t},D.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},U(O,Error),O.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,O),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var z={};const N=p,R=T.Reporter,V=q.Buffer;function J(e,t){R.call(this,t),V.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function M(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return M.isEncoderBuffer(e)||(e=new M(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=V.byteLength(e);else{if(!V.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}N(J,R),z.DecoderBuffer=J,J.isDecoderBuffer=function(e){if(e instanceof J)return!0;return"object"==typeof e&&V.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},J.prototype.save=function(){return{offset:this.offset,reporter:R.prototype.save.call(this)}},J.prototype.restore=function(e){const t=new J(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,R.prototype.restore.call(this,e.reporter),t},J.prototype.isEmpty=function(){return this.offset===this.length},J.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},J.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const r=new J(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},J.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},z.EncoderBuffer=M,M.isEncoderBuffer=function(e){if(e instanceof M)return!0;return"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},M.prototype.join=function(e,t){return e||(e=V.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(e,t),t+=r.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):V.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};const L=T.Reporter,$=z.EncoderBuffer,F=z.DecoderBuffer,G=h,Y=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],H=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(Y);function W(e,t,r){const n={};this._baseState=n,n.name=r,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}var X=W;const Z=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];W.prototype.clone=function(){const e=this._baseState,t={};Z.forEach((function(r){t[r]=e[r]}));const r=new this.constructor(t.parent);return r._baseState=t,r},W.prototype._wrap=function(){const e=this._baseState;H.forEach((function(t){this[t]=function(){const r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},W.prototype._init=function(e){const t=this._baseState;G(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),G.equal(t.children.length,1,"Root node can have only one child")},W.prototype._useArgs=function(e){const t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(G(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(G(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){W.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),Y.forEach((function(e){W.prototype[e]=function(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return G(null===t.tag),t.tag=e,this._useArgs(r),this}})),W.prototype.use=function(e){G(e);const t=this._baseState;return G(null===t.use),t.use=e,this},W.prototype.optional=function(){return this._baseState.optional=!0,this},W.prototype.def=function(e){const t=this._baseState;return G(null===t.default),t.default=e,t.optional=!0,this},W.prototype.explicit=function(e){const t=this._baseState;return G(null===t.explicit&&null===t.implicit),t.explicit=e,this},W.prototype.implicit=function(e){const t=this._baseState;return G(null===t.explicit&&null===t.implicit),t.implicit=e,this},W.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},W.prototype.key=function(e){const t=this._baseState;return G(null===t.key),t.key=e,this},W.prototype.any=function(){return this._baseState.any=!0,this},W.prototype.choice=function(e){const t=this._baseState;return G(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},W.prototype.contains=function(e){const t=this._baseState;return G(null===t.use),t.contains=e,this},W.prototype._decode=function(e,t){const r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));let n,o=r.default,i=!0,s=null;if(null!==r.key&&(s=e.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(i=this._peekTag(e,n,r.any),e.isError(i))return i}else{const n=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),i=!0}catch(e){i=!1}e.restore(n)}}if(r.obj&&i&&(n=e.enterObject()),i){if(null!==r.explicit){const t=this._decodeTag(e,r.explicit);if(e.isError(t))return t;e=t}const n=e.offset;if(null===r.use&&null===r.choice){let t;r.any&&(t=e.save());const n=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(n))return n;r.any?o=e.raw(t):e=n}if(t&&t.track&&null!==r.tag&&t.track(e.path(),n,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(o=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(o))return o;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new F(o);o=this._getUse(r.contains,e._reporterState.obj)._decode(n,t)}}return r.obj&&i&&(o=e.leaveObject(n)),null===r.key||null===o&&!0!==i?null!==s&&e.exitKey(s):e.leaveKey(s,r.key,o),o},W.prototype._decodeGeneric=function(e,t,r){const n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},W.prototype._getUse=function(e,t){const r=this._baseState;return r.useDecoder=this._use(e,t),G(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},W.prototype._decodeChoice=function(e,t){const r=this._baseState;let n=null,o=!1;return Object.keys(r.choice).some((function(i){const s=e.save(),a=r.choice[i];try{const r=a._decode(e,t);if(e.isError(r))return!1;n={type:i,value:r},o=!0}catch(t){return e.restore(s),!1}return!0}),this),o?n:e.error("Choice not matched")},W.prototype._createEncoderBuffer=function(e){return new $(e,this.reporter)},W.prototype._encode=function(e,t,r){const n=this._baseState;if(null!==n.default&&n.default===e)return;const o=this._encodeValue(e,t,r);return void 0===o||this._skipDefault(o,t,r)?void 0:o},W.prototype._encodeValue=function(e,t,r){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new L);let o=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}let i=null,s=!1;if(n.any)o=this._createEncoderBuffer(e);else if(n.choice)o=this._encodeChoice(e,t);else if(n.contains)i=this._getUse(n.contains,r)._encode(e,t),s=!0;else if(n.children)i=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");const n=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const o=r._encode(e[r._baseState.key],t,e);return t.leaveKey(n),o}),this).filter((function(e){return e})),i=this._createEncoderBuffer(i);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return t.error("Too many args for : "+n.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,i=this._createEncoderBuffer(e.map((function(r){const n=this._baseState;return this._getUse(n.args[0],e)._encode(r,t)}),r))}else null!==n.use?o=this._getUse(n.use,r)._encode(e,t):(i=this._encodePrimitive(n.tag,e),s=!0);if(!n.any&&null===n.choice){const e=null!==n.implicit?n.implicit:n.tag,r=null===n.implicit?"universal":"context";null===e?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(e,s,r,i))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},W.prototype._encodeChoice=function(e,t){const r=this._baseState,n=r.choice[e.type];return n||G(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},W.prototype._encodePrimitive=function(e,t){const r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},W.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},W.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var Q={};!function(e){function t(e){const t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);const n=e[r];t[n]=r})),t}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)}(Q);const ee=p,te=q.Buffer,re=X,ne=Q;function oe(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new se,this.tree._init(e.body)}var ie=oe;function se(e){re.call(this,"der",e)}function ae(e){return e<10?"0"+e:e}oe.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},ee(se,re),se.prototype._encodeComposite=function(e,t,r,n){const o=function(e,t,r,n){let o;"seqof"===e?e="seq":"setof"===e&&(e="set");if(ne.tagByName.hasOwnProperty(e))o=ne.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return n.error("Unknown tag: "+e);o=e}if(o>=31)return n.error("Multi-octet tag encoding unsupported");t||(o|=32);return o|=ne.tagClassByName[r||"universal"]<<6,o}(e,t,r,this.reporter);if(n.length<128){const e=te.alloc(2);return e[0]=o,e[1]=n.length,this._createEncoderBuffer([e,n])}let i=1;for(let e=n.length;e>=256;e>>=8)i++;const s=te.alloc(2+i);s[0]=o,s[1]=128|i;for(let e=1+i,t=n.length;t>0;e--,t>>=8)s[e]=255&t;return this._createEncoderBuffer([s,n])},se.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=te.alloc(2*e.length);for(let r=0;r<e.length;r++)t.writeUInt16BE(e.charCodeAt(r),2*r);return this._createEncoderBuffer(t)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},se.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(let t=0;t<e.length;t++)e[t]|=0}else if(Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let n=0;for(let t=0;t<e.length;t++){let r=e[t];for(n++;r>=128;r>>=7)n++}const o=te.alloc(n);let i=o.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(o[i--]=127&r;(r>>=7)>0;)o[i--]=128|127&r}return this._createEncoderBuffer(o)},se.prototype._encodeTime=function(e,t){let r;const n=new Date(e);return"gentime"===t?r=[ae(n.getUTCFullYear()),ae(n.getUTCMonth()+1),ae(n.getUTCDate()),ae(n.getUTCHours()),ae(n.getUTCMinutes()),ae(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[ae(n.getUTCFullYear()%100),ae(n.getUTCMonth()+1),ae(n.getUTCDate()),ae(n.getUTCHours()),ae(n.getUTCMinutes()),ae(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},se.prototype._encodeNull=function(){return this._createEncoderBuffer("")},se.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!te.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=te.from(t)}if(te.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=te.alloc(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let t=e;t>=256;t>>=8)r++;const n=new Array(r);for(let t=n.length-1;t>=0;t--)n[t]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(te.from(n))},se.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},se.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},se.prototype._skipDefault=function(e,t,r){const n=this._baseState;let o;if(null===n.default)return!1;const i=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),i.length!==n.defaultBuffer.length)return!1;for(o=0;o<i.length;o++)if(i[o]!==n.defaultBuffer[o])return!1;return!0};const ce=ie;function ue(e){ce.call(this,e),this.enc="pem"}p(ue,ce);var le=ue;ue.prototype.encode=function(e,t){const r=ce.prototype.encode.call(this,e).toString("base64"),n=["-----BEGIN "+t.label+"-----"];for(let e=0;e<r.length;e+=64)n.push(r.slice(e,e+64));return n.push("-----END "+t.label+"-----"),n.join("\n")},function(e){const t=e;t.der=ie,t.pem=le}(B);var fe={};const pe=p,he=l,de=z.DecoderBuffer,ye=X,me=Q;function be(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new ge,this.tree._init(e.body)}var ve=be;function ge(e){ye.call(this,"der",e)}function we(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=me.tagClass[r>>6],o=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:o,tag:r,tagStr:me.tag[r]}}function _e(e,t,r){let n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;const o=127&n;if(o>4)return e.error("length octect is too long");n=0;for(let t=0;t<o;t++){n<<=8;const t=e.readUInt8(r);if(e.isError(t))return t;n|=t}return n}be.prototype.decode=function(e,t){return de.isDecoderBuffer(e)||(e=new de(e,t)),this.tree._decode(e,t)},pe(ge,ye),ge.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;const n=e.save(),o=we(e,'Failed to peek tag: "'+t+'"');return e.isError(o)?o:(e.restore(n),o.tag===t||o.tagStr===t||o.tagStr+"of"===t||r)},ge.prototype._decodeTag=function(e,t,r){const n=we(e,'Failed to decode tag of "'+t+'"');if(e.isError(n))return n;let o=_e(e,n.primitive,'Failed to get length of "'+t+'"');if(e.isError(o))return o;if(!r&&n.tag!==t&&n.tagStr!==t&&n.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(n.primitive||null!==o)return e.skip(o,'Failed to match body of: "'+t+'"');const i=e.save(),s=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(s)?s:(o=e.offset-i.offset,e.restore(i),e.skip(o,'Failed to match body of: "'+t+'"'))},ge.prototype._skipUntilEnd=function(e,t){for(;;){const r=we(e,t);if(e.isError(r))return r;const n=_e(e,r.primitive,t);if(e.isError(n))return n;let o;if(o=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(o))return o;if("end"===r.tagStr)break}},ge.prototype._decodeList=function(e,t,r,n){const o=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const i=r.decode(e,"der",n);if(e.isError(i)&&t)break;o.push(i)}return o},ge.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let r="";for(let e=0;e<t.length/2;e++)r+=String.fromCharCode(t.readUInt16BE(2*e));return r}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},ge.prototype._decodeObjid=function(e,t,r){let n;const o=[];let i=0,s=0;for(;!e.isEmpty();)s=e.readUInt8(),i<<=7,i|=127&s,0==(128&s)&&(o.push(i),i=0);128&s&&o.push(i);const a=o[0]/40|0,c=o[0]%40;if(n=r?o:[a,c].concat(o.slice(1)),t){let e=t[n.join(" ")];void 0===e&&(e=t[n.join(".")]),void 0!==e&&(n=e)}return n},ge.prototype._decodeTime=function(e,t){const r=e.raw().toString();let n,o,i,s,a,c;if("gentime"===t)n=0|r.slice(0,4),o=0|r.slice(4,6),i=0|r.slice(6,8),s=0|r.slice(8,10),a=0|r.slice(10,12),c=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");n=0|r.slice(0,2),o=0|r.slice(2,4),i=0|r.slice(4,6),s=0|r.slice(6,8),a=0|r.slice(8,10),c=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,o-1,i,s,a,c,0)},ge.prototype._decodeNull=function(){return null},ge.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},ge.prototype._decodeInt=function(e,t){const r=e.raw();let n=new he(r);return t&&(n=t[n.toString(10)]||n),n},ge.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree};const ke=p,Pe=q.Buffer,Se=ve;function Ee(e){Se.call(this,e),this.enc="pem"}ke(Ee,Se);var Ke=Ee;Ee.prototype.decode=function(e,t){const r=e.toString().split(/[\r\n]+/g),n=t.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/;let i=-1,s=-1;for(let e=0;e<r.length;e++){const t=r[e].match(o);if(null!==t&&t[2]===n){if(-1!==i){if("END"!==t[1])break;s=e;break}if("BEGIN"!==t[1])break;i=e}}if(-1===i||-1===s)throw new Error("PEM section not found for: "+n);const a=r.slice(i+1,s).join("");a.replace(/[^a-z0-9+/=]+/gi,"");const c=Pe.from(a,"base64");return Se.prototype.decode.call(this,c,t)},function(e){const t=e;t.der=ve,t.pem=Ke}(fe),function(e){const t=B,r=fe,n=p;function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}e.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){const t=this.name;function r(e){this._initNamed(e,t)}return n(r,e),r.prototype._initNamed=function(t,r){e.call(this,t,r)},new r(this)},o.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(r[e])),this.decoders[e]},o.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},o.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(t[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}}(C);var Ce={};!function(e){const t=Ce;t.Reporter=T.Reporter,t.DecoderBuffer=z.DecoderBuffer,t.EncoderBuffer=z.EncoderBuffer,t.Node=X}();var Be={};!function(e){const t=e;t._reverse=function(e){const t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);const n=e[r];t[n]=r})),t},t.der=Q}(Be),function(e){const t=K;t.bignum=l,t.define=C.define,t.base=Ce,t.constants=Be,t.decoders=fe,t.encoders=B}();var xe={exports:{}},je={},Ae={};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.default=function(e){var t=e.length,r=t%4;if(!r)return e;var n=t,o=4-r,s=t+o,a=i.alloc(s);for(a.write(e);o--;)a.write("=",n++);return a.toString()},Object.defineProperty(je,"__esModule",{value:!0});var Ie=Ae;function qe(e,t){return void 0===t&&(t="utf8"),s(e)?Ue(e.toString("base64")):Ue(i.from(e,t).toString("base64"))}function Te(e){return e=e.toString(),Ie.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function Ue(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var De,Oe=qe;Oe.encode=qe,Oe.decode=function(e,t){return void 0===t&&(t="utf8"),i.from(Te(e),"base64").toString(t)},Oe.toBase64=Te,Oe.fromBase64=Ue,Oe.toBuffer=function(e){return i.from(Te(e),"base64")},je.default=Oe,(De=xe).exports=je.default,De.exports.default=De.exports;var ze=xe.exports,Ne=a(ze);const Re=K,Ve=ze;var Je=class{static convert(e,t,r){if(!e)return;if(t===r)return e;let n;if("raw"===t||e instanceof i)n=e;else if("uint8_array"===t||Array.isArray(e))n=i.from(e);else if("hex"===t)n=i.from(e,"hex");else if("base64"===t)n=i.from(e,"base64");else if("base64url"===t)n=Ve.toBuffer(e);else{if("bn"!==t&&"bignum"!==t)throw new Error("Invalid fromType");n=i.from(this.pad(e.toString(16)),"hex")}if("raw"===r)return n;if("uint8_array"===r)return Array.from(n);if("hex"===r)return n.toString("hex");if("base64"===r)return n.toString("base64");if("base64url"===r)return Ve.fromBase64(n.toString("base64"));if("bn"===r||"bignum"===r)return new Re.bignum(n);throw new Error("Invalid toType")}static pad(e){return e.length%2==1?`0${e}`:e}};const Me=K;const Le=new class{constructor(){Object.defineProperty(this,"_registry",{value:{}})}get registry(){return this._registry}define(e,t){this._registry[e]=Me.define(e,t(this))}normalize(e){return this.registry[e]}};Le.define("Version",(e=>function(){this.int({0:"two-prime",1:"multi"})})),Le.define("OtherPrimeInfos",(e=>function(){this.seq().obj(this.key("ri").int(),this.key("di").int(),this.key("ti").int())})),Le.define("AlgorithmIdentifier",(e=>function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())})),Le.define("PrivateKeyInfo",(e=>{let t=e.normalize("Version"),r=e.normalize("AlgorithmIdentifier");return function(){this.seq().obj(this.key("version").use(t),this.key("algorithm").use(r),this.key("privateKey").octstr())}})),Le.define("PublicKeyInfo",(e=>{let t=e.normalize("AlgorithmIdentifier");return function(){this.seq().obj(this.key("algorithm").use(t),this.key("publicKey").bitstr())}})),Le.define("RSAPrivateKey",(e=>{let t=e.normalize("Version"),r=e.normalize("OtherPrimeInfos");return function(){this.seq().obj(this.key("version").use(t),this.key("n").int(),this.key("e").int(),this.key("d").int(),this.key("p").int(),this.key("q").int(),this.key("dp").int(),this.key("dq").int(),this.key("qi").int(),this.key("other").optional().use(r))}})),Le.define("RSAPublicKey",(e=>function(){this.seq().obj(this.key("n").int(),this.key("e").int())})),Le.define("ECPrivateKey",(e=>function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().choice({namedCurve:this.objid()}),this.key("publicKey").explicit(1).optional().bitstr())}));var $e=Le;const Fe=E,Ge=Je,Ye=$e;var He=class e extends Fe{fromPrivatePKCS1(e){let t=Ye.normalize("RSAPrivateKey"),{n:r,e:n,d:o,p:i,q:s,dp:a,dq:c,qi:u}=t.decode(e,"der");return{n:Ge.convert(r,"bn","raw"),e:Ge.convert(n,"bn","raw"),d:Ge.convert(o,"bn","raw"),p:Ge.convert(i,"bn","raw"),q:Ge.convert(s,"bn","raw"),dp:Ge.convert(a,"bn","raw"),dq:Ge.convert(c,"bn","raw"),qi:Ge.convert(u,"bn","raw")}}fromPrivatePKCS8(e){let t=Ye.normalize("PrivateKeyInfo"),r=Ye.normalize("RSAPrivateKey"),n=t.decode(e,"der"),{n:o,e:i,d:s,p:a,q:c,dp:u,dq:l,qi:f}=r.decode(n.privateKey,"der");return{n:Ge.convert(o,"bn","raw"),e:Ge.convert(i,"bn","raw"),d:Ge.convert(s,"bn","raw"),p:Ge.convert(a,"bn","raw"),q:Ge.convert(c,"bn","raw"),dp:Ge.convert(u,"bn","raw"),dq:Ge.convert(l,"bn","raw"),qi:Ge.convert(f,"bn","raw")}}fromPublicPKCS1(e){let t=Ye.normalize("RSAPublicKey"),{n:r,e:n}=t.decode(e,"der");return{n:Ge.convert(r,"bn","raw"),e:Ge.convert(n,"bn","raw")}}fromPublicPKCS8(e){let t=Ye.normalize("PublicKeyInfo"),r=Ye.normalize("RSAPublicKey"),n=t.decode(e,"der"),{n:o,e:i}=r.decode(n.publicKey.data,"der");return{n:Ge.convert(o,"bn","raw"),e:Ge.convert(i,"bn","raw")}}fromJwk(e){let{n:t,e:r,d:n,p:o,q:i,dp:s,dq:a,qi:c,alg:u}=e;return{n:Ge.convert(t,"base64url","raw"),e:Ge.convert(r,"base64url","raw"),d:Ge.convert(n,"base64url","raw"),p:Ge.convert(o,"base64url","raw"),q:Ge.convert(i,"base64url","raw"),dp:Ge.convert(s,"base64url","raw"),dq:Ge.convert(a,"base64url","raw"),qi:Ge.convert(c,"base64url","raw")}}toPrivatePKCS1(t){let{n:r,e:n,d:o,p:i,q:s,dp:a,dq:c,qi:u}=t,{version:l}=this.params,f=Ye.normalize("RSAPrivateKey").encode({version:l,n:Ge.convert(r,"raw","bn"),e:Ge.convert(n,"raw","bn"),d:Ge.convert(o,"raw","bn"),p:Ge.convert(i,"raw","bn"),q:Ge.convert(s,"raw","bn"),dp:Ge.convert(a,"raw","bn"),dq:Ge.convert(c,"raw","bn"),qi:Ge.convert(u,"raw","bn")},"der").toString("base64");return e.formatPem(f,"RSA PRIVATE")}toPrivatePKCS8(t){let{n:r,e:n,d:o,p:s,q:a,dp:c,dq:u,qi:l}=t,{oid:f,algParameters:p,version:h}=this.params,d=Ye.normalize("PrivateKeyInfo"),y=Ye.normalize("RSAPrivateKey").encode({version:h,n:Ge.convert(r,"raw","bn"),e:Ge.convert(n,"raw","bn"),d:Ge.convert(o,"raw","bn"),p:Ge.convert(s,"raw","bn"),q:Ge.convert(a,"raw","bn"),dp:Ge.convert(c,"raw","bn"),dq:Ge.convert(u,"raw","bn"),qi:Ge.convert(l,"raw","bn")},"der"),m=d.encode({version:h,algorithm:{algorithm:f.split("."),parameters:i.from(p,"hex")},privateKey:y},"der").toString("base64");return e.formatPem(m,"PRIVATE")}toPublicPKCS1(t){let{n:r,e:n}=t,{version:o}=this.params,i=Ye.normalize("RSAPublicKey").encode({version:o,n:Ge.convert(r,"raw","bn"),e:Ge.convert(n,"raw","bn")},"der").toString("base64");return e.formatPem(i,"RSA PUBLIC")}toPublicPKCS8(t){let{n:r,e:n}=t,{oid:o,algParameters:s}=this.params,a=Ye.normalize("PublicKeyInfo"),c=Ye.normalize("RSAPublicKey").encode({n:Ge.convert(r,"raw","bn"),e:Ge.convert(n,"raw","bn")},"der"),u=a.encode({algorithm:{algorithm:o.split("."),parameters:i.from(s,"hex")},publicKey:{unused:0,data:c}},"der").toString("base64");return e.formatPem(u,"PUBLIC")}toPrivateJwk(e){let{n:t,e:r,d:n,p:o,q:i,dp:s,dq:a,qi:c}=e,{kty:u}=this.params;return{kty:u,n:Ge.convert(t,"raw","base64url"),e:Ge.convert(r,"raw","base64url"),d:Ge.convert(n,"raw","base64url"),p:Ge.convert(o,"raw","base64url"),q:Ge.convert(i,"raw","base64url"),dp:Ge.convert(s,"raw","base64url"),dq:Ge.convert(a,"raw","base64url"),qi:Ge.convert(c,"raw","base64url")}}toPublicJwk(e){let{n:t,e:r}=e,{kty:n}=this.params;return{kty:n,n:Ge.convert(t,"raw","base64url"),e:Ge.convert(r,"raw","base64url")}}};const We=new(0,d.ec)("secp256k1"),Xe=E,Ze=Je,Qe=$e;var et=class e extends Xe{fromPrivatePKCS1(t){let r=Qe.normalize("ECPrivateKey").decode(t,"der"),{privateKey:n,publicKey:{data:o}}=r,i=Ze.convert(o,"raw","hex"),{x:s,y:a}=e.getPoint(i);return{d:n,x:s,y:a}}fromPrivatePKCS8(t){let r=Qe.normalize("PrivateKeyInfo"),n=Qe.normalize("ECPrivateKey"),o=r.decode(t,"der"),i=n.decode(o.privateKey,"der"),{privateKey:s,publicKey:{data:a}}=i,c=Ze.convert(a,"raw","hex"),{x:u,y:l}=e.getPoint(c);return{d:s,x:u,y:l}}fromPublicPKCS8(t){let r=Qe.normalize("PublicKeyInfo").decode(t,"der"),n=Ze.convert(r.publicKey.data,"raw","hex");return e.getPoint(n)}fromPrivateBlk(e){let t=We.keyFromPrivate(e,"hex"),r=t.getPublic();return{d:Ze.convert(t.priv,"bn","raw"),x:Ze.convert(r.getX(),"bn","raw"),y:Ze.convert(r.getY(),"bn","raw")}}fromPublicBlk(t){return e.getPoint(t)}fromJwk(e){let{d:t,x:r,y:n}=e;return{d:Ze.convert(t,"base64url","raw"),x:Ze.convert(r,"base64url","raw"),y:Ze.convert(n,"base64url","raw")}}toPrivatePKCS1(t){let{namedCurve:r,keyVersion:n}=this.params,{d:o,x:i,y:s}=t,a=Qe.normalize("ECPrivateKey"),c=e.makePoint(i,s),u=a.encode({version:n,privateKey:o,parameters:{type:"namedCurve",value:r.split(".")},publicKey:{unused:0,data:c}},"der").toString("base64");return e.formatPem(u,"EC PRIVATE")}toPrivatePKCS8(t){let{oid:r,algParameters:n,keyVersion:o,infoVersion:s}=this.params,{d:a,x:c,y:u}=t,l=Qe.normalize("PrivateKeyInfo"),f=Qe.normalize("ECPrivateKey"),p=e.makePoint(c,u),h=f.encode({version:o,privateKey:a,publicKey:{unused:0,data:p}},"der"),d=l.encode({version:s,algorithm:{algorithm:r.split("."),parameters:i.from(n,"hex")},privateKey:h},"der").toString("base64");return e.formatPem(d,"PRIVATE")}toPublicPKCS8(t){let{oid:r,algParameters:n}=this.params,{x:o,y:s}=t,a=Qe.normalize("PublicKeyInfo"),c=e.makePoint(o,s),u=a.encode({algorithm:{algorithm:r.split("."),parameters:i.from(n,"hex")},publicKey:{unused:0,data:c}},"der").toString("base64");return e.formatPem(u,"PUBLIC")}toPrivateBlk(e){return e.d.toString("hex")}toPublicBlk(t){return Ze.convert(e.makePoint(t.x,t.y),"raw","hex")}toPrivateJwk(e){let{crv:t,kty:r}=this.params,{d:n,x:o,y:i}=e;return{kty:r,crv:t,d:Ze.convert(n,"raw","base64url"),x:Ze.convert(o,"raw","base64url"),y:Ze.convert(i,"raw","base64url")}}toPublicJwk(e){let{crv:t,kty:r}=this.params,{x:n,y:o}=e;return{kty:r,crv:t,x:Ze.convert(n,"raw","base64url"),y:Ze.convert(o,"raw","base64url")}}static getPoint(e){let t=e.slice(2,(e.length-2)/2+2),r=e.slice((e.length-2)/2+2);return{x:Ze.convert(t,"hex","raw"),y:Ze.convert(r,"hex","raw")}}static makePoint(e,t){let r=i.from("04","hex");return i.concat([r,e,t],r.length+e.length+t.length)}};const tt=E,rt=Je,nt=$e;var ot=class e extends tt{fromPrivatePKCS8(e){const t=nt.normalize("PrivateKeyInfo").decode(e,"der").privateKey.slice(2);return{d:t,x:this.publicKeyFromPrivate(t)}}fromPublicPKCS8(e){const t=nt.normalize("PublicKeyInfo").decode(e,"der");return{x:rt.convert(t.publicKey.data,"hex","raw")}}fromJwk(e){let{d:t,x:r}=e;return{d:rt.convert(t,"base64url","raw"),x:rt.convert(r,"base64url","raw")}}toPrivatePKCS8(t){let{oid:r,infoVersion:n}=this.params,{d:o}=t;const i=nt.normalize("PrivateKeyInfo"),s=this.privateKeyPadding(o);let a=i.encode({version:n,algorithm:{algorithm:r.split(".")},privateKey:s},"der").toString("base64");return e.formatPem(a,"PRIVATE")}toPublicPKCS8(t){let{oid:r}=this.params,{x:n}=t,o=nt.normalize("PublicKeyInfo").encode({algorithm:{algorithm:r.split(".")},publicKey:{unused:0,data:rt.convert(n,"hex","raw")}},"der").toString("base64");return e.formatPem(o,"PUBLIC")}toPrivateJwk(e){let{crv:t,kty:r}=this.params,{d:n,x:o}=e;return{kty:r,crv:t,d:rt.convert(n,"raw","base64url"),x:rt.convert(o,"raw","base64url")}}toPublicJwk(e){let{crv:t,kty:r}=this.params,{x:n}=e;return{kty:r,crv:t,x:rt.convert(n,"raw","base64url")}}privateKeyPadding(e){let t;if("Ed25519"!==this.params.crv)throw new Error(`${this.params.crv} is an invalid curve for EdDSA`);return t=i.from("0420","hex"),i.concat([t,e],t.length+e.length)}publicKeyFromPrivate(e){if("Ed25519"===this.params.crv){const t=new(0,d.eddsa)("ed25519");return i.from(t.keyFromSecret(e).getPublic())}throw new Error(`${this.params.crv} is an invalid curve for EdDSA`)}};const it=He,st=et,at=ot,ct=new k;ct.define([{kty:"RSA",oid:"1.2.840.113549.1.1.1",algParameters:"0500",version:"two-prime"}],it),ct.define([{kty:"EC",crv:"K-256",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.10",algParameters:"06052b8104000a",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-256",oid:"1.2.840.10045.2.1",namedCurve:"1.2.840.10045.3.1.7",algParameters:"06082a8648ce3d030107",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-384",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.34",algParameters:"06052b81040022",keyVersion:1,infoVersion:"two-prime"},{kty:"EC",crv:"P-521",oid:"1.2.840.10045.2.1",namedCurve:"1.3.132.0.35",algParameters:"06052b81040023",keyVersion:1,infoVersion:"two-prime"}],st),ct.define([{kty:"OKP",crv:"Ed25519",oid:"1.3.101.112",infoVersion:"two-prime"}],at);const ut=w,lt=_,ft=ct,pt=$e,ht=RegExp("\r?\n","g");class dt{constructor(e,t){if(!e)throw new ut("key is required");if(!t)throw new ut("options are required");let{kty:r,format:n,selector:o,crv:i,oid:s}=t;if(!t.kty)throw new ut("options.kty is required");if(!t.format)throw new ut("options.format is required");if(!t.selector)throw new ut("options.selector is required");if(!t.crv&&!t.oid)throw new ut("options.crv or options.oid is required");this.kty=r,this.format=n,this.selector=o,this.crv=i,this.oid=s,this.key=this.parseKey(e)}static from(e,t){if(!e)throw new ut("key is required");if(!t)throw new ut("format is required");if("jwk"===t){let r;if("string"==typeof e)try{r=JSON.parse(e)}catch(e){throw new ut("key is not a valid JWK")}else"object"==typeof e&&(r=e);let n,{kty:o,crv:i}=r;if(!o)throw new ut("kty is required for JWK");if("EC"===o&&!i)throw new ut("crv is required for EC JWK");"RSA"===o&&(n=ft.find((e=>e.kty===o)).oid);let s=r.d?"private":"public";return new dt(r,{kty:o,crv:i,oid:n,format:t,selector:s})}if("pem"===t){if("string"!=typeof e)throw new ut("key is not a valid PEM string");let r=e.split(ht),n=r.splice(0,1);r.splice(r.length-1,1);let o,s,a=r.join(""),c=/^-----BEGIN ((RSA|EC) )?(PUBLIC|PRIVATE) KEY-----$/.exec(n),u=c?c[2]:void 0,l=c?c[3]:void 0,f=i.from(a,"base64");if(!l)throw new ut("key is not a valid PEM string");if(u){if("RSA"===u)l="PRIVATE"===l?"private_pkcs1":"public_pkcs1",o=ft.find((e=>e.kty===u)).oid;else if("EC"===u){let e;if("PRIVATE"===l){l="private_pkcs1",e=pt.normalize(`${u}PrivateKey`).decode(f,"der")}else if("PUBLIC"===l){l="public_pkcs1",e=pt.normalize(`${u}PrivateKey`).decode(f,"der")}let{parameters:{value:t}}=e;s=ft.find((e=>e.namedCurve===t.join("."))).crv}}else{let e,t=pt.normalize("PrivateKeyInfo"),r=pt.normalize("PublicKeyInfo");"PRIVATE"===l?(l="private_pkcs8",e=t.decode(f,"der")):"PUBLIC"===l&&(l="public_pkcs8",e=r.decode(f,"der"));let{algorithm:{algorithm:n,parameters:i}}=e;n=n.join("."),i=i?i.toString("hex"):void 0;const a=ft.find((e=>e.oid===n));if(u=a?a.kty:void 0,!u)throw new ut(`${n} is not supported`);"RSA"===u||"OKP"===u?o=n:"EC"===u&&(s=ft.find((e=>e.algParameters===i)).crv)}return new dt(f,{kty:u,oid:o,crv:s,format:t,selector:l})}if("blk"===t)return new dt(e,{kty:"EC",crv:"K-256",format:t,selector:e.length>64?"public":"private"});throw new ut(`Invalid format ${t}`)}get alg(){let{kty:e,crv:t,oid:r}=this;if(!this.algorithm){if(t)Object.defineProperty(this,"algorithm",{value:ft.normalize(e,"crv",t)});else{if(!r)throw new Error("Both crv and oid are undefined");Object.defineProperty(this,"algorithm",{value:ft.normalize(e,"oid",r)})}if(!this.algorithm)throw new Error(`${this.crv||this.oid} is not implemented yet`)}return this.algorithm}parseKey(e){let{alg:t,format:r,selector:n}=this;if("pem"===r)switch(n){case"public_pkcs1":return t.fromPublicPKCS1(e);case"public_pkcs8":return t.fromPublicPKCS8(e);case"private_pkcs1":return t.fromPrivatePKCS1(e);case"private_pkcs8":return t.fromPrivatePKCS8(e);default:throw new Error("Invalid selector value")}if("jwk"===r)return t.fromJwk(e,n);if("blk"===r)switch(n){case"public":return t.fromPublicBlk(e);case"private":return t.fromPrivateBlk(e)}}toJwk(e){let{key:t,alg:r,selector:n}=this;switch(e){case"public":return r.toPublicJwk(t);case"private":if(n.includes("public"))throw new ut("Cannot export a private key from a public key");return r.toPrivateJwk(t);default:throw new Error("Invalid key selector")}}toString(e="pem",t="public_pkcs8"){let{key:r,alg:n,selector:o}=this;if("pem"===e)switch(t){case"public_pkcs1":return n.toPublicPKCS1(r);case"public_pkcs8":return n.toPublicPKCS8(r);case"private_pkcs1":if(o.includes("public"))throw new ut("Cannot export a private key from a public key");return n.toPrivatePKCS1(r);case"private_pkcs8":if(o.includes("public"))throw new ut("Cannot export a private key from a public key");return n.toPrivatePKCS8(r);default:throw new Error("Invalid key selector")}else if("jwk"===e)switch(t){case"public":return JSON.stringify(n.toPublicJwk(r));case"private":if(o.includes("public"))throw new ut("Cannot export a private key from a public key");return JSON.stringify(n.toPrivateJwk(r));default:throw new Error("Invalid key selector")}else if("blk"===e)switch(t){case"private":if(o.includes("public"))throw new ut("Cannot export a private key from a public key");return n.toPrivateBlk(r);case"public":return n.toPublicBlk(r);default:throw new Error("Invalid key selector")}throw new lt}}var yt=a(dt);var mt=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),i=o.charCodeAt(0);if(255!==t[i])throw new TypeError(o+" is ambiguous");t[i]=n}var s=e.length,a=e.charAt(0),c=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,o=0;e[r]===a;)n++,r++;for(var i=(e.length-r)*c+1>>>0,u=new Uint8Array(i);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var f=0,p=i-1;(0!==l||f<o)&&-1!==p;p--,f++)l+=s*u[p]>>>0,u[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=f,r++}for(var h=i-o;h!==i&&0===u[h];)h++;for(var d=new Uint8Array(n+(i-h)),y=n;h!==i;)d[y++]=u[h++];return d}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var c=(i-o)*u+1>>>0,l=new Uint8Array(c);o!==i;){for(var f=t[o],p=0,h=c-1;(0!==f||p<n)&&-1!==h;h--,p++)f+=256*l[h]>>>0,l[h]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");n=p,o++}for(var d=c-n;d!==c&&0===l[d];)d++;for(var y=a.repeat(r);d<c;++d)y+=e.charAt(l[d]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+s+" character")}}};var bt=mt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),vt=a(bt);export{b as a,m as b,bt as c,Ne as d,vt as e,yt as k,y as r,g as s};