@blockcerts/blockcerts-verifier 1.72.4 → 1.74.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 (52) 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 +469 -466
  7. package/dist/{DataIntegrityProof-x-pKdBCc-B_YUlE0Z.js → DataIntegrityProof-DRK-bLb_-CItV0ZXY.js} +1 -1
  8. package/dist/EcdsaSd2023-CdilbQE4-BlaeM9K_.js +26 -0
  9. package/dist/EcdsaSecp256k1Signature2019-rfxWS2XE-C73WHAtH.js +1 -0
  10. package/dist/{Ed25519Signature2020-B6yblwC5-BRlzT2Yc.js → Ed25519Signature2020-CDbX0d2Z-Dc1L-exZ.js} +7 -7
  11. package/dist/{EddsaRdfc2022-Csk9U_qt-B798omlR.js → EddsaRdfc2022-Do0HFpDb-BcV_n8Fk.js} +4 -4
  12. package/dist/{HashlinkVerifier-Bi7nn19S-DMjUYzMR.js → HashlinkVerifier-Cdnza1Dw-A9htzw7A.js} +1 -1
  13. package/dist/MerkleProof2017-5uQFQKSe-dtmePIpg.js +1 -0
  14. package/dist/MerkleProof2019-DraC60XD-B9XV8wNx.js +5 -0
  15. package/dist/Suite-BmP2Qu19-D1ucdMDB.js +1 -0
  16. package/dist/_polyfill-node.path-hKwMKLNw-B7aPtphV.js +1 -0
  17. package/dist/checkBitStringStatusList-CKk6xxUL-D99R7EXK.js +1 -0
  18. package/dist/checkCredentialSchemaConformity-U2NlIuJZ-swOY09NS.js +1 -0
  19. package/dist/controlVerificationMethod-Blm4pE1t-BYBRLxNP.js +1 -0
  20. package/dist/{downloadPDF-UAsY-nU_.js → downloadPDF-C-y2U2YC.js} +3 -3
  21. package/dist/ensureValidIssuingKey-D7OT4D35--HN0afRq.js +1 -0
  22. package/dist/index-BNsIYV4r-BnYxKy2f.js +14 -0
  23. package/dist/{index-D7PA_QcD-CyttRwCk.js → index-C4ZZHHRx-BOdwDnYa.js} +1 -1
  24. package/dist/index-CVS5Gn9h-DNgvq6Wk.js +7 -0
  25. package/dist/index-D2bS6rRi-D_ppNIsb.js +66 -0
  26. package/dist/index-Dr7MpiEc-D5LHgMik.js +30 -0
  27. package/dist/{index-DNlz8u7B-CYTlxhyY.js → index-uKBVup0_-Dh4-8Ruv.js} +1 -1
  28. package/dist/{index.es-CnYWLNZV.js → index.es-BmC2s_4v.js} +1 -1
  29. package/dist/{Suite-CBLHluYK-Dmvbh142.js → jsonld-DOUjwF6J-dtl20tiV.js} +1 -1
  30. package/dist/{jsonld-signatures-BtZPa7MV-DTekMXP5.js → jsonld-signatures-BJXipuab-CB799Kkm.js} +7 -7
  31. package/dist/main.js +122 -122
  32. package/dist/purify.es-C6IIzwyE.js +2 -0
  33. package/dist/retrieveVerificationMethodPublicKey-CT9YA_Wr-Djl8Ri41.js +1 -0
  34. package/dist/verifyIssuerProfile-BG-odQrl-0JjZhiiC.js +1 -0
  35. package/package.json +9 -9
  36. package/dist/EcdsaSd2023-CU35O_1w-CISk0lEt.js +0 -30
  37. package/dist/EcdsaSecp256k1Signature2019-DiXIv8yq-B2kEN_Qo.js +0 -1
  38. package/dist/MerkleProof2017-BIJKwMk5-CLYAJK4G.js +0 -1
  39. package/dist/MerkleProof2019-CeAt2OGM-DOuISx_E.js +0 -5
  40. package/dist/checkCredentialSchemaConformity-CECtM4WI-C1vg05zb.js +0 -1
  41. package/dist/checkRevocationStatusList2021-B7NFlV-5-C3Zng1tA.js +0 -13
  42. package/dist/controlVerificationMethod-Cuyek_Vk-C_Uq2iA5.js +0 -1
  43. package/dist/ensureValidIssuingKey-DN2kpCwj-DY8BTObG.js +0 -1
  44. package/dist/index-DFOHyoZq-BCuOIg2Z.js +0 -29
  45. package/dist/pako.esm-BGRKTPxS-Bodm4Eha.js +0 -2
  46. package/dist/purify.es-Om653OSQ.js +0 -2
  47. package/dist/retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js +0 -1
  48. package/dist/sha2-JcCWfgvE-By1_saxP.js +0 -2
  49. package/dist/verifyIssuerProfile-DQji41Fc-l31-7imR.js +0 -1
  50. /package/dist/{ensureNotRevoked-CNUfpW4F-BheL-ZKZ.js → ensureNotRevoked-DrQAPfcJ-BheL-ZKZ.js} +0 -0
  51. /package/dist/{index-6G1g4ypj-Dgus2xdV.js → index-yOIIz7AL-Dgus2xdV.js} +0 -0
  52. /package/dist/{webcrypto.es-aoUxIxUm-gGk5JRJH.js → webcrypto.es-FKUHCUj--gGk5JRJH.js} +0 -0
@@ -0,0 +1,66 @@
1
+ import{v as t,u as e}from"./main.js";import{j as i}from"./jsonld-signatures-BJXipuab-CB799Kkm.js";import{j as r}from"./jsonld-DOUjwF6J-dtl20tiV.js";
2
+ /*!
3
+ * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
4
+ */function a(t,e){if("number"!=typeof t)throw new TypeError(`"${e}" must be number.`)}function s(t,e){if(!(Number.isInteger(t)&&t>0))throw new TypeError(`"${e}" must be a positive integer.`)}function n(t,e){if("boolean"!=typeof t)throw new TypeError(`"${e}" must be a boolean.`)}function o(t,e){if(!(t instanceof Uint8Array))throw new TypeError(`"${e}" must be a Uint8Array.`)}
5
+ /*! pako 2.2.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function d(t){let e=t.length;for(;--e>=0;)t[e]=0}const l=256,h=286,c=30,w=15,u=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),p=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),f=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),_=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),g=new Array(576);d(g);const m=new Array(60);d(m);const y=new Array(512);d(y);const b=new Array(256);d(b);const v=new Array(29);d(v);const k=new Array(c);function x(t,e,i,r,a){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=a,this.has_stree=t&&t.length}let S,z,E;function A(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}d(k);const R=t=>t<256?y[t]:y[256+(t>>>7)],U=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},M=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<<t.bi_valid&65535,U(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)},T=(t,e,i)=>{M(t,i[2*e],i[2*e+1])},D=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},j=(t,e,i)=>{const r=new Array(16);let a,s,n=0;for(a=1;a<=w;a++)n=n+i[a-1]<<1,r[a]=n;for(s=0;s<=e;s++){let e=t[2*s+1];0!==e&&(t[2*s]=D(r[e]++,e))}},L=t=>{let e;for(e=0;e<h;e++)t.dyn_ltree[2*e]=0;for(e=0;e<c;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Z=t=>{t.bi_valid>8?U(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},C=(t,e,i,r)=>{const a=2*e,s=2*i;return t[a]<t[s]||t[a]===t[s]&&r[e]<=r[i]},I=(t,e,i)=>{const r=t.heap[i];let a=i<<1;for(;a<=t.heap_len&&(a<t.heap_len&&C(e,t.heap[a+1],t.heap[a],t.depth)&&a++,!C(e,r,t.heap[a],t.depth));)t.heap[i]=t.heap[a],i=a,a<<=1;t.heap[i]=r},O=(t,e,i)=>{let r,a,s,n,o=0;if(0!==t.sym_next)do{r=255&t.pending_buf[t.sym_buf+o++],r+=(255&t.pending_buf[t.sym_buf+o++])<<8,a=t.pending_buf[t.sym_buf+o++],0===r?T(t,a,e):(s=b[a],T(t,s+l+1,e),n=u[s],0!==n&&(a-=v[s],M(t,a,n)),r--,s=R(r),T(t,s,i),n=p[s],0!==n&&(r-=k[s],M(t,r,n)))}while(o<t.sym_next);T(t,256,e)},F=(t,e)=>{const i=e.dyn_tree,r=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.elems;let n,o,d,l=-1;for(t.heap_len=0,t.heap_max=573,n=0;n<s;n++)0!==i[2*n]?(t.heap[++t.heap_len]=l=n,t.depth[n]=0):i[2*n+1]=0;for(;t.heap_len<2;)d=t.heap[++t.heap_len]=l<2?++l:0,i[2*d]=1,t.depth[d]=0,t.opt_len--,a&&(t.static_len-=r[2*d+1]);for(e.max_code=l,n=t.heap_len>>1;n>=1;n--)I(t,i,n);d=s;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],I(t,i,1),o=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=o,i[2*d]=i[2*n]+i[2*o],t.depth[d]=(t.depth[n]>=t.depth[o]?t.depth[n]:t.depth[o])+1,i[2*n+1]=i[2*o+1]=d,t.heap[1]=d++,I(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,r=e.max_code,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,n=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,d=e.stat_desc.max_length;let l,h,c,u,p,f,_=0;for(u=0;u<=w;u++)t.bl_count[u]=0;for(i[2*t.heap[t.heap_max]+1]=0,l=t.heap_max+1;l<573;l++)h=t.heap[l],u=i[2*i[2*h+1]+1]+1,u>d&&(u=d,_++),i[2*h+1]=u,h>r||(t.bl_count[u]++,p=0,h>=o&&(p=n[h-o]),f=i[2*h],t.opt_len+=f*(u+p),s&&(t.static_len+=f*(a[2*h+1]+p)));if(0!==_){do{for(u=d-1;0===t.bl_count[u];)u--;t.bl_count[u]--,t.bl_count[u+1]+=2,t.bl_count[d]--,_-=2}while(_>0);for(u=d;0!==u;u--)for(h=t.bl_count[u];0!==h;)c=t.heap[--l],c>r||(i[2*c+1]!==u&&(t.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),h--)}})(t,e),j(i,l,t.bl_count)},B=(t,e,i)=>{let r,a,s=-1,n=e[1],o=0,d=7,l=4;for(0===n&&(d=138,l=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)a=n,n=e[2*(r+1)+1],++o<d&&a===n||(o<l?t.bl_tree[2*a]+=o:0!==a?(a!==s&&t.bl_tree[2*a]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=a,0===n?(d=138,l=3):a===n?(d=6,l=3):(d=7,l=4))},N=(t,e,i)=>{let r,a,s=-1,n=e[1],o=0,d=7,l=4;for(0===n&&(d=138,l=3),r=0;r<=i;r++)if(a=n,n=e[2*(r+1)+1],!(++o<d&&a===n)){if(o<l)do{T(t,a,t.bl_tree)}while(0!==--o);else 0!==a?(a!==s&&(T(t,a,t.bl_tree),o--),T(t,16,t.bl_tree),M(t,o-3,2)):o<=10?(T(t,17,t.bl_tree),M(t,o-3,3)):(T(t,18,t.bl_tree),M(t,o-11,7));o=0,s=a,0===n?(d=138,l=3):a===n?(d=6,l=3):(d=7,l=4)}};let P=!1;const V=(t,e,i,r)=>{M(t,0+(r?1:0),3),Z(t),U(t,i),U(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};var $=(t,e,i,r)=>{let a,s,n=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<l;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),F(t,t.l_desc),F(t,t.d_desc),n=(t=>{let e;for(B(t,t.dyn_ltree,t.l_desc.max_code),B(t,t.dyn_dtree,t.d_desc.max_code),F(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*_[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),a=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=a&&(a=s)):a=s=i+5,i+4<=a&&-1!==e?V(t,e,i,r):4===t.strategy||s===a?(M(t,2+(r?1:0),3),O(t,g,m)):(M(t,4+(r?1:0),3),((t,e,i,r)=>{let a;for(M(t,e-257,5),M(t,i-1,5),M(t,r-4,4),a=0;a<r;a++)M(t,t.bl_tree[2*_[a]+1],3);N(t,t.dyn_ltree,e-1),N(t,t.dyn_dtree,i-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,n+1),O(t,t.dyn_ltree,t.dyn_dtree)),L(t),r&&Z(t)},H={_tr_init:t=>{P||((()=>{let t,e,i,r,a;const s=new Array(16);for(i=0,r=0;r<28;r++)for(v[r]=i,t=0;t<1<<u[r];t++)b[i++]=r;for(b[i-1]=r,a=0,r=0;r<16;r++)for(k[r]=a,t=0;t<1<<p[r];t++)y[a++]=r;for(a>>=7;r<c;r++)for(k[r]=a<<7,t=0;t<1<<p[r]-7;t++)y[256+a++]=r;for(e=0;e<=w;e++)s[e]=0;for(t=0;t<=143;)g[2*t+1]=8,t++,s[8]++;for(;t<=255;)g[2*t+1]=9,t++,s[9]++;for(;t<=279;)g[2*t+1]=7,t++,s[7]++;for(;t<=287;)g[2*t+1]=8,t++,s[8]++;for(j(g,287,s),t=0;t<c;t++)m[2*t+1]=5,m[2*t]=D(t,5);S=new x(g,u,257,h,w),z=new x(m,p,0,c,w),E=new x(new Array(0),f,0,19,7)})(),P=!0),t.l_desc=new A(t.dyn_ltree,S),t.d_desc=new A(t.dyn_dtree,z),t.bl_desc=new A(t.bl_tree,E),t.bi_buf=0,t.bi_valid=0,L(t)},_tr_stored_block:V,_tr_flush_block:$,_tr_tally:(t,e,i)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(b[i]+l+1)]++,t.dyn_dtree[2*R(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{M(t,2,3),T(t,256,g),(t=>{16===t.bi_valid?(U(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var X=(t,e,i,r)=>{let a=65535&t,s=t>>>16&65535,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{a=a+e[r++]|0,s=s+a|0}while(--n);a%=65521,s%=65521}return a|s<<16};const K=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var J=(t,e,i,r)=>{const a=K,s=r+i;t^=-1;for(let i=r;i<s;i++)t=t>>>8^a[255&(t^e[i])];return-1^t},q={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Y={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:G,_tr_stored_block:W,_tr_flush_block:Q,_tr_tally:tt,_tr_align:et}=H,{Z_NO_FLUSH:it,Z_PARTIAL_FLUSH:rt,Z_FULL_FLUSH:at,Z_FINISH:st,Z_BLOCK:nt,Z_OK:ot,Z_STREAM_END:dt,Z_STREAM_ERROR:lt,Z_DATA_ERROR:ht,Z_BUF_ERROR:ct,Z_DEFAULT_COMPRESSION:wt,Z_FILTERED:ut,Z_HUFFMAN_ONLY:pt,Z_RLE:ft,Z_FIXED:_t,Z_DEFAULT_STRATEGY:gt,Z_UNKNOWN:mt,Z_DEFLATED:yt}=Y,bt=258,vt=262,kt=42,xt=113,St=666,zt=(t,e)=>(t.msg=q[e],e),Et=t=>2*t-(t>4?9:0),At=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Rt=t=>{let e,i,r,a=t.w_size;e=t.hash_size,r=e;do{i=t.head[--r],t.head[r]=i>=a?i-a:0}while(--e);e=a,r=e;do{i=t.prev[--r],t.prev[r]=i>=a?i-a:0}while(--e)};let Ut=(t,e,i)=>(e<<t.hash_shift^i)&t.hash_mask;const Mt=(t,e)=>{let i;if(t.legacy_hash)i=t.ins_h=Ut(t,t.ins_h,t.window[e+3-1]);else{const r=t.window,a=r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24;i=t.ins_h=Math.imul(a,66521)+66521>>>16&t.hash_mask}const r=t.prev[e&t.w_mask]=t.head[i];return t.head[i]=e,r},Tt=t=>{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},Dt=(t,e)=>{Q(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Tt(t.strm)},jt=(t,e)=>{t.pending_buf[t.pending++]=e},Lt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Zt=(t,e,i,r)=>{let a=t.avail_in;return a>r&&(a=r),0===a?0:(t.avail_in-=a,e.set(t.input.subarray(t.next_in,t.next_in+a),i),1===t.state.wrap?t.adler=X(t.adler,e,a,i):2===t.state.wrap&&(t.adler=J(t.adler,e,a,i)),t.next_in+=a,t.total_in+=a,a)},Ct=(t,e)=>{let i,r,a=t.max_chain_length,s=t.strstart,n=t.prev_length,o=t.nice_match;const d=t.strstart>t.w_size-vt?t.strstart-(t.w_size-vt):0,l=t.window,h=t.w_mask,c=t.prev,w=t.strstart+bt;let u=l[s+n-1],p=l[s+n];t.prev_length>=t.good_match&&(a>>=2),o>t.lookahead&&(o=t.lookahead);do{if(i=e,l[i+n]===p&&l[i+n-1]===u&&l[i]===l[s]&&l[++i]===l[s+1]){s+=2,i++;do{}while(l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&l[++s]===l[++i]&&s<w);if(r=bt-(w-s),s=w-bt,r>n){if(t.match_start=e,n=r,r>=o)break;u=l[s+n-1],p=l[s+n]}}}while((e=c[e&h])>d&&0!==--a);return n<=t.lookahead?n:t.lookahead},It=t=>{const e=t.w_size;let i,r,a;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-vt)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Rt(t),r+=e),0===t.strm.avail_in)break;if(i=Zt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=i,t.legacy_hash){if(t.lookahead+t.insert>=3)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=Ut(t,t.ins_h,t.window[a+1]);t.insert&&(Mt(t,a),a++,t.insert--,!(t.lookahead+t.insert<3)););}else if(t.lookahead+t.insert>3)for(a=t.strstart-t.insert;t.insert&&(Mt(t,a),a++,t.insert--,!(t.lookahead+t.insert<=3)););}while(t.lookahead<vt&&0!==t.strm.avail_in)},Ot=(t,e)=>{let i,r,a,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,n=0,o=t.strm.avail_in;do{if(i=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a)break;if(a=t.strm.avail_out-a,r=t.strstart-t.block_start,i>r+t.strm.avail_in&&(i=r+t.strm.avail_in),i>a&&(i=a),i<s&&(0===i&&e!==st||e===it||i!==r+t.strm.avail_in))break;n=e===st&&i===r+t.strm.avail_in?1:0,W(t,0,0,n),t.pending_buf[t.pending-4]=i,t.pending_buf[t.pending-3]=i>>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Tt(t.strm),r&&(r>i&&(r=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+r),t.strm.next_out),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r,t.block_start+=r,i-=r),i&&(Zt(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===n);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),n?4:e!==it&&e!==st&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(a=t.window_size-t.strstart,t.strm.avail_in>a&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(Zt(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water<t.strstart&&(t.high_water=t.strstart),a=t.bi_valid+42>>3,a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a,s=a>t.w_size?t.w_size:a,r=t.strstart-t.block_start,(r>=s||(r||e===st)&&e!==it&&0===t.strm.avail_in&&r<=a)&&(i=r>a?a:r,n=e===st&&0===t.strm.avail_in&&i===r?1:0,W(t,t.block_start,i,n),t.block_start+=i,Tt(t.strm)),n?3:1)},Ft=(t,e)=>{let i,r;for(;;){if(t.lookahead<vt){if(It(t),t.lookahead<vt&&e===it)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(i=Mt(t,t.strstart)),0!==i&&t.strstart-i<=t.w_size-vt&&(t.match_length=Ct(t,i)),t.match_length>=3)if(r=tt(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,i=Mt(t,t.strstart)}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.legacy_hash&&(t.ins_h=t.window[t.strstart],t.ins_h=Ut(t,t.ins_h,t.window[t.strstart+1]));else r=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Dt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===st?(Dt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Dt(t,!1),0===t.strm.avail_out)?1:2},Bt=(t,e)=>{let i,r,a;for(;;){if(t.lookahead<vt){if(It(t),t.lookahead<vt&&e===it)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(i=Mt(t,t.strstart)),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-vt&&(t.match_length=Ct(t,i),t.match_length<=5&&(t.strategy===ut||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){a=t.strstart+t.lookahead-3,r=tt(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=a&&(i=Mt(t,t.strstart))}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(Dt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(r=tt(t,0,t.window[t.strstart-1]),r&&Dt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=tt(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===st?(Dt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Dt(t,!1),0===t.strm.avail_out)?1:2};function Nt(t,e,i,r,a){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=a}const Pt=[new Nt(0,0,0,0,Ot),new Nt(4,4,8,4,Ft),new Nt(4,5,16,8,Ft),new Nt(4,6,32,32,Ft),new Nt(4,4,16,16,Bt),new Nt(8,16,32,32,Bt),new Nt(8,16,128,128,Bt),new Nt(8,32,128,256,Bt),new Nt(32,128,258,1024,Bt),new Nt(32,258,258,4096,Bt)];function Vt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=yt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.legacy_hash=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),At(this.dyn_ltree),At(this.dyn_dtree),At(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),At(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),At(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const $t=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==kt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==xt&&e.status!==St?1:0},Ht=t=>{if($t(t))return zt(t,lt);t.total_in=t.total_out=0,t.data_type=mt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?kt:xt,t.adler=2===e.wrap?0:1,e.last_flush=-2,G(e),ot},Xt=t=>{const e=Ht(t);var i;return e===ot&&((i=t.state).window_size=2*i.w_size,At(i.head),i.max_lazy_match=Pt[i.level].max_lazy,i.good_match=Pt[i.level].good_length,i.nice_match=Pt[i.level].nice_length,i.max_chain_length=Pt[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},Kt=(t,e,i,r,a,s,n)=>{if(!t)return lt;let o=1;if(e===wt&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),a<1||a>9||i!==yt||r<8||r>15||e<0||e>9||s<0||s>_t||8===r&&1!==o)return zt(t,lt);8===r&&(r=9);const d=new Vt;return t.state=d,d.strm=t,d.status=kt,d.wrap=o,d.gzhead=null,d.w_bits=r,d.w_size=1<<d.w_bits,d.w_mask=d.w_size-1,d.legacy_hash=n?1:0,d.hash_bits=a+7,!d.legacy_hash&&d.hash_bits<15&&(d.hash_bits=15),d.hash_size=1<<d.hash_bits,d.hash_mask=d.hash_size-1,d.hash_shift=~~((d.hash_bits+3-1)/3),d.window=new Uint8Array(2*d.w_size),d.head=new Uint16Array(d.hash_size),d.prev=new Uint16Array(d.w_size),d.lit_bufsize=1<<a+6,d.pending_buf_size=4*d.lit_bufsize,d.pending_buf=new Uint8Array(d.pending_buf_size),d.sym_buf=d.lit_bufsize,d.sym_end=3*(d.lit_bufsize-1),d.level=e,d.strategy=s,d.method=i,Xt(t)};var Jt={deflateInit:(t,e)=>Kt(t,e,yt,15,8,gt),deflateInit2:Kt,deflateReset:Xt,deflateResetKeep:Ht,deflateSetHeader:(t,e)=>$t(t)||2!==t.state.wrap?lt:(t.state.gzhead=e,ot),deflate:(t,e)=>{if($t(t)||e>nt||e<0)return t?zt(t,lt):lt;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===St&&e!==st)return zt(t,0===t.avail_out?ct:lt);const r=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Tt(t),0===t.avail_out)return i.last_flush=-1,ot}else if(0===t.avail_in&&Et(e)<=Et(r)&&e!==st)return zt(t,ct);if(i.status===St&&0!==t.avail_in)return zt(t,ct);if(i.status===kt&&0===i.wrap&&(i.status=xt),i.status===kt){let e=yt+(i.w_bits-8<<4)<<8,r=-1;if(r=i.strategy>=pt||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=r<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Lt(i,e),0!==i.strstart&&(Lt(i,t.adler>>>16),Lt(i,65535&t.adler)),t.adler=1,i.status=xt,Tt(t),0!==i.pending)return i.last_flush=-1,ot}if(57===i.status)if(t.adler=0,jt(i,31),jt(i,139),jt(i,8),i.gzhead)jt(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),jt(i,255&i.gzhead.time),jt(i,i.gzhead.time>>8&255),jt(i,i.gzhead.time>>16&255),jt(i,i.gzhead.time>>24&255),jt(i,9===i.level?2:i.strategy>=pt||i.level<2?4:0),jt(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(jt(i,255&i.gzhead.extra.length),jt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=J(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(jt(i,0),jt(i,0),jt(i,0),jt(i,0),jt(i,0),jt(i,9===i.level?2:i.strategy>=pt||i.level<2?4:0),jt(i,3),i.status=xt,Tt(t),0!==i.pending)return i.last_flush=-1,ot;if(69===i.status){if(i.gzhead.extra){let e=i.pending,r=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+r>i.pending_buf_size;){let a=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+a),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=J(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=a,Tt(t),0!==i.pending)return i.last_flush=-1,ot;e=0,r-=a}let a=new Uint8Array(i.gzhead.extra);i.pending_buf.set(a.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending+=r,i.gzhead.hcrc&&i.pending>e&&(t.adler=J(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(t.adler=J(t.adler,i.pending_buf,i.pending-r,r)),Tt(t),0!==i.pending)return i.last_flush=-1,ot;r=0}e=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,jt(i,e)}while(0!==e);i.gzhead.hcrc&&i.pending>r&&(t.adler=J(t.adler,i.pending_buf,i.pending-r,r)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(t.adler=J(t.adler,i.pending_buf,i.pending-r,r)),Tt(t),0!==i.pending)return i.last_flush=-1,ot;r=0}e=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,jt(i,e)}while(0!==e);i.gzhead.hcrc&&i.pending>r&&(t.adler=J(t.adler,i.pending_buf,i.pending-r,r))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Tt(t),0!==i.pending))return i.last_flush=-1,ot;jt(i,255&t.adler),jt(i,t.adler>>8&255),t.adler=0}if(i.status=xt,Tt(t),0!==i.pending)return i.last_flush=-1,ot}if(0!==t.avail_in||0!==i.lookahead||e!==it&&i.status!==St){let r=0===i.level?Ot(i,e):i.strategy===pt?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(It(t),0===t.lookahead)){if(e===it)return 1;break}if(t.match_length=0,i=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(Dt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===st?(Dt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Dt(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===ft?((t,e)=>{let i,r,a,s;const n=t.window;for(;;){if(t.lookahead<=bt){if(It(t),t.lookahead<=bt&&e===it)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(a=t.strstart-1,r=n[a],r===n[++a]&&r===n[++a]&&r===n[++a])){s=t.strstart+bt;do{}while(r===n[++a]&&r===n[++a]&&r===n[++a]&&r===n[++a]&&r===n[++a]&&r===n[++a]&&r===n[++a]&&r===n[++a]&&a<s);t.match_length=bt-(s-a),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=tt(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=tt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(Dt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===st?(Dt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Dt(t,!1),0===t.strm.avail_out)?1:2})(i,e):Pt[i.level].func(i,e);if(3!==r&&4!==r||(i.status=St),1===r||3===r)return 0===t.avail_out&&(i.last_flush=-1),ot;if(2===r&&(e===rt?et(i):e!==nt&&(W(i,0,0,!1),e===at&&(At(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Tt(t),0===t.avail_out))return i.last_flush=-1,ot}return e!==st?ot:i.wrap<=0?dt:(2===i.wrap?(jt(i,255&t.adler),jt(i,t.adler>>8&255),jt(i,t.adler>>16&255),jt(i,t.adler>>24&255),jt(i,255&t.total_in),jt(i,t.total_in>>8&255),jt(i,t.total_in>>16&255),jt(i,t.total_in>>24&255)):(Lt(i,t.adler>>>16),Lt(i,65535&t.adler)),Tt(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?ot:dt)},deflateEnd:t=>{if($t(t))return lt;const e=t.state.status;return t.state=null,e===xt?zt(t,ht):ot},deflateSetDictionary:(t,e)=>{let i=e.length;if($t(t))return lt;const r=t.state,a=r.wrap;if(2===a||1===a&&r.status!==kt||r.lookahead)return lt;if(1===a&&(t.adler=X(t.adler,e,i,0)),r.wrap=0,i>=r.w_size){0===a&&(At(r.head),r.strstart=0,r.block_start=0,r.insert=0);let t=new Uint8Array(r.w_size);t.set(e.subarray(i-r.w_size,i),0),e=t,i=r.w_size}const s=t.avail_in,n=t.next_in,o=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,It(r);r.lookahead>=3;){let t=r.strstart,e=r.lookahead-2;do{Mt(r,t),t++}while(--e);r.strstart=t,r.lookahead=2,It(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=n,t.input=o,t.avail_in=s,r.wrap=a,ot},deflateInfo:"pako deflate (from Nodeca project)"};const qt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Yt=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)qt(i,e)&&(t[e]=i[e])}}return t},Gt=t=>{let e=0;for(let i=0,r=t.length;i<r;i++)e+=t[i].length;const i=new Uint8Array(e);for(let e=0,r=0,a=t.length;e<a;e++){let a=t[e];i.set(a,r),r+=a.length}return i};let Wt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Wt=!1}const Qt=new Uint8Array(256);for(let t=0;t<256;t++)Qt[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Qt[254]=Qt[255]=1;var te=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,r,a,s,n=t.length,o=0;for(a=0;a<n;a++)i=t.charCodeAt(a),55296==(64512&i)&&a+1<n&&(r=t.charCodeAt(a+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),a++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(o),s=0,a=0;s<o;a++)i=t.charCodeAt(a),55296==(64512&i)&&a+1<n&&(r=t.charCodeAt(a+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),a++)),i<128?e[s++]=i:i<2048?(e[s++]=192|i>>>6,e[s++]=128|63&i):i<65536?(e[s++]=224|i>>>12,e[s++]=128|i>>>6&63,e[s++]=128|63&i):(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63,e[s++]=128|i>>>6&63,e[s++]=128|63&i);return e},ee=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let r,a;const s=new Array(2*i);for(a=0,r=0;r<i;){let e=t[r++];if(e<128){s[a++]=e;continue}let n=Qt[e];if(n>4)s[a++]=65533,r+=n-1;else{for(e&=2===n?31:3===n?15:7;n>1&&r<i;)e=e<<6|63&t[r++],n--;n>1?s[a++]=65533:e<65536?s[a++]=e:(e-=65536,s[a++]=55296|e>>10&1023,s[a++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Wt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i})(s,a)},ie=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+Qt[t[i]]>e?i:e};var re=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const ae=Object.prototype.toString,{Z_NO_FLUSH:se,Z_SYNC_FLUSH:ne,Z_FULL_FLUSH:oe,Z_FINISH:de,Z_OK:le,Z_STREAM_END:he,Z_DEFAULT_COMPRESSION:ce,Z_DEFAULT_STRATEGY:we,Z_DEFLATED:ue}=Y,pe={level:ce,method:ue,chunkSize:16384,windowBits:15,memLevel:8,strategy:we,legacyHash:!0};function fe(t){this.options=Yt({},pe,t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new re,this.strm.avail_out=0;let i=Jt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy,e.legacyHash);if(i!==le)throw new Error(q[i]);if(e.header&&Jt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?te(e.dictionary):"[object ArrayBuffer]"===ae.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=Jt.deflateSetDictionary(this.strm,t),i!==le)throw new Error(q[i]);this._dict_set=!0}}fe.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize;let a,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?de:se,"string"==typeof t?i.input=te(t):"[object ArrayBuffer]"===ae.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),(s===ne||s===oe)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(a=Jt.deflate(i,s),a===he)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),a=Jt.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===le;if(0!==i.avail_out){if(s>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},fe.prototype.onData=function(t){this.chunks.push(t)},fe.prototype.onEnd=function(t){t===le&&(this.result=Gt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var _e={gzip:function(t,e){return(e=e||{}).gzip=!0,function(t,e){const i=new fe(e);if(i.push(t,!0),i.err)throw i.msg||q[i.err];return i.result}(t,e)}};const ge=16209;var me=function(t,e){let i,r,a,s,n,o,d,l,h,c,w,u,p,f,_,g,m,y,b,v,k,x,S,z;const E=t.state;i=t.next_in,S=t.input,r=i+(t.avail_in-5),a=t.next_out,z=t.output,s=a-(e-t.avail_out),n=a+(t.avail_out-257),o=E.dmax,d=E.wsize,l=E.whave,h=E.wnext,c=E.window,w=E.hold,u=E.bits,p=E.lencode,f=E.distcode,_=(1<<E.lenbits)-1,g=(1<<E.distbits)-1;t:do{u<15&&(w+=S[i++]<<u,u+=8,w+=S[i++]<<u,u+=8),m=p[w&_];e:for(;;){if(y=m>>>24,w>>>=y,u-=y,y=m>>>16&255,0===y)z[a++]=65535&m;else{if(!(16&y)){if(64&y){if(32&y){E.mode=16191;break t}t.msg="invalid literal/length code",E.mode=ge;break t}m=p[(65535&m)+(w&(1<<y)-1)];continue e}for(b=65535&m,y&=15,y&&(u<y&&(w+=S[i++]<<u,u+=8),b+=w&(1<<y)-1,w>>>=y,u-=y),u<15&&(w+=S[i++]<<u,u+=8,w+=S[i++]<<u,u+=8),m=f[w&g];;){if(y=m>>>24,w>>>=y,u-=y,y=m>>>16&255,16&y){if(v=65535&m,y&=15,u<y&&(w+=S[i++]<<u,u+=8,u<y&&(w+=S[i++]<<u,u+=8)),v+=w&(1<<y)-1,v>o){t.msg="invalid distance too far back",E.mode=ge;break t}if(w>>>=y,u-=y,y=a-s,v>y){if(y=v-y,y>l&&E.sane){t.msg="invalid distance too far back",E.mode=ge;break t}if(k=0,x=c,0===h){if(k+=d-y,y<b){b-=y;do{z[a++]=c[k++]}while(--y);k=a-v,x=z}}else if(h<y){if(k+=d+h-y,y-=h,y<b){b-=y;do{z[a++]=c[k++]}while(--y);if(k=0,h<b){y=h,b-=y;do{z[a++]=c[k++]}while(--y);k=a-v,x=z}}}else if(k+=h-y,y<b){b-=y;do{z[a++]=c[k++]}while(--y);k=a-v,x=z}for(;b>2;)z[a++]=x[k++],z[a++]=x[k++],z[a++]=x[k++],b-=3;b&&(z[a++]=x[k++],b>1&&(z[a++]=x[k++]))}else{k=a-v;do{z[a++]=z[k++],z[a++]=z[k++],z[a++]=z[k++],b-=3}while(b>2);b&&(z[a++]=z[k++],b>1&&(z[a++]=z[k++]))}break}if(64&y){t.msg="invalid distance code",E.mode=ge;break t}m=f[(65535&m)+(w&(1<<y)-1)]}}break}}while(i<r&&a<n);b=u>>3,i-=b,u-=b<<3,w&=(1<<u)-1,t.next_in=i,t.next_out=a,t.avail_in=i<r?r-i+5:5-(i-r),t.avail_out=a<n?n-a+257:257-(a-n),E.hold=w,E.bits=u};const ye=15,be=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ve=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,199,75]),ke=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),xe=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Se=(t,e,i,r,a,s,n,o)=>{const d=o.bits;let l,h,c,w,u,p,f=0,_=0,g=0,m=0,y=0,b=0,v=0,k=0,x=0,S=0,z=null;const E=new Uint16Array(16),A=new Uint16Array(16);let R,U,M,T=null;for(f=0;f<=ye;f++)E[f]=0;for(_=0;_<r;_++)E[e[i+_]]++;for(y=d,m=ye;m>=1&&0===E[m];m--);if(y>m&&(y=m),0===m)return a[s++]=20971520,a[s++]=20971520,o.bits=1,0;for(g=1;g<m&&0===E[g];g++);for(y<g&&(y=g),k=1,f=1;f<=ye;f++)if(k<<=1,k-=E[f],k<0)return-1;if(k>0&&(0===t||1!==m))return-1;for(A[1]=0,f=1;f<ye;f++)A[f+1]=A[f]+E[f];for(_=0;_<r;_++)0!==e[i+_]&&(n[A[e[i+_]]++]=_);if(0===t?(z=T=n,p=20):1===t?(z=be,T=ve,p=257):(z=ke,T=xe,p=0),S=0,_=0,f=g,u=s,b=y,v=0,c=-1,x=1<<y,w=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){R=f-v,n[_]+1<p?(U=0,M=n[_]):n[_]>=p?(U=T[n[_]-p],M=z[n[_]-p]):(U=96,M=0),l=1<<f-v,h=1<<b,g=h;do{h-=l,a[u+(S>>v)+h]=R<<24|U<<16|M}while(0!==h);for(l=1<<f-1;S&l;)l>>=1;if(0!==l?(S&=l-1,S+=l):S=0,_++,0===--E[f]){if(f===m)break;f=e[i+n[_]]}if(f>y&&(S&w)!==c){for(0===v&&(v=y),u+=g,b=f-v,k=1<<b;b+v<m&&(k-=E[b+v],!(k<=0));)b++,k<<=1;if(x+=1<<b,1===t&&x>852||2===t&&x>592)return 1;c=S&w,a[c]=y<<24|b<<16|u-s}}return 0!==S&&(a[u+S]=f-v<<24|64<<16),o.bits=y,0};const{Z_FINISH:ze,Z_BLOCK:Ee,Z_TREES:Ae,Z_OK:Re,Z_STREAM_END:Ue,Z_NEED_DICT:Me,Z_STREAM_ERROR:Te,Z_DATA_ERROR:De,Z_MEM_ERROR:je,Z_BUF_ERROR:Le,Z_DEFLATED:Ze}=Y,Ce=16180,Ie=16190,Oe=16191,Fe=16192,Be=16194,Ne=16199,Pe=16200,Ve=16206,$e=16209,He=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Xe(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ke=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Ce||e.mode>16211?1:0},Je=t=>{if(Ke(t))return Te;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ce,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Re},qe=t=>{if(Ke(t))return Te;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Je(t)},Ye=(t,e)=>{let i;if(Ke(t))return Te;const r=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Te:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,qe(t))},Ge=(t,e)=>{if(!t)return Te;const i=new Xe;t.state=i,i.strm=t,i.window=null,i.mode=Ce;const r=Ye(t,e);return r!==Re&&(t.state=null),r};let We,Qe,ti=!0;const ei=t=>{if(ti){We=new Int32Array(512),Qe=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Se(1,t.lens,0,288,We,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Se(2,t.lens,0,32,Qe,0,t.work,{bits:5}),ti=!1}t.lencode=We,t.lenbits=9,t.distcode=Qe,t.distbits=5},ii=(t,e,i,r)=>{let a;const s=t.state;return null===s.window&&(s.window=new Uint8Array(1<<s.wbits)),0===s.wsize&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0),r>=s.wsize?(s.window.set(e.subarray(i-s.wsize,i),0),s.wnext=0,s.whave=s.wsize):(a=s.wsize-s.wnext,a>r&&(a=r),s.window.set(e.subarray(i-r,i-r+a),s.wnext),(r-=a)?(s.window.set(e.subarray(i-r,i),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=a,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=a))),0};var ri={inflateReset:qe,inflateReset2:Ye,inflateResetKeep:Je,inflateInit:t=>Ge(t,15),inflateInit2:Ge,inflate:(t,e)=>{let i,r,a,s,n,o,d,l,h,c,w,u,p,f,_,g,m,y,b,v,k,x,S=0;const z=new Uint8Array(4);let E,A;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ke(t)||!t.output||!t.input&&0!==t.avail_in)return Te;i=t.state,i.mode===Oe&&(i.mode=Fe),n=t.next_out,a=t.output,d=t.avail_out,s=t.next_in,r=t.input,o=t.avail_in,l=i.hold,h=i.bits,c=o,w=d,x=Re;t:for(;;)switch(i.mode){case Ce:if(0===i.wrap){i.mode=Fe;break}for(;h<16;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(2&i.wrap&&35615===l){0===i.wbits&&(i.wbits=15),i.check=0,z[0]=255&l,z[1]=l>>>8&255,i.check=J(i.check,z,2,0),l=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&l)<<8)+(l>>8))%31){t.msg="incorrect header check",i.mode=$e;break}if((15&l)!==Ze){t.msg="unknown compression method",i.mode=$e;break}if(l>>>=4,h-=4,k=8+(15&l),0===i.wbits&&(i.wbits=k),k>15||k>i.wbits){t.msg="invalid window size",i.mode=$e;break}i.dmax=1<<i.wbits,i.flags=0,t.adler=i.check=1,i.mode=512&l?16189:Oe,l=0,h=0;break;case 16181:for(;h<16;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(i.flags=l,(255&i.flags)!==Ze){t.msg="unknown compression method",i.mode=$e;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=$e;break}i.head&&(i.head.text=l>>8&1),512&i.flags&&4&i.wrap&&(z[0]=255&l,z[1]=l>>>8&255,i.check=J(i.check,z,2,0)),l=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}i.head&&(i.head.time=l),512&i.flags&&4&i.wrap&&(z[0]=255&l,z[1]=l>>>8&255,z[2]=l>>>16&255,z[3]=l>>>24&255,i.check=J(i.check,z,4,0)),l=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}i.head&&(i.head.xflags=255&l,i.head.os=l>>8),512&i.flags&&4&i.wrap&&(z[0]=255&l,z[1]=l>>>8&255,i.check=J(i.check,z,2,0)),l=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}i.length=l,i.head&&(i.head.extra_len=l),512&i.flags&&4&i.wrap&&(z[0]=255&l,z[1]=l>>>8&255,i.check=J(i.check,z,2,0)),l=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(u=i.length,u>o&&(u=o),u&&(i.head&&(k=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(s,s+u),k)),512&i.flags&&4&i.wrap&&(i.check=J(i.check,r,u,s)),o-=u,s+=u,i.length-=u),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break t;u=0;do{k=r[s+u++],i.head&&k&&i.length<65536&&(i.head.name+=String.fromCharCode(k))}while(k&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=J(i.check,r,u,s)),o-=u,s+=u,k)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break t;u=0;do{k=r[s+u++],i.head&&k&&i.length<65536&&(i.head.comment+=String.fromCharCode(k))}while(k&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=J(i.check,r,u,s)),o-=u,s+=u,k)break t}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;h<16;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(4&i.wrap&&l!==(65535&i.check)){t.msg="header crc mismatch",i.mode=$e;break}l=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=Oe;break;case 16189:for(;h<32;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}t.adler=i.check=He(l),l=0,h=0,i.mode=Ie;case Ie:if(0===i.havedict)return t.next_out=n,t.avail_out=d,t.next_in=s,t.avail_in=o,i.hold=l,i.bits=h,Me;t.adler=i.check=1,i.mode=Oe;case Oe:if(e===Ee||e===Ae)break t;case Fe:if(i.last){l>>>=7&h,h-=7&h,i.mode=Ve;break}for(;h<3;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}switch(i.last=1&l,l>>>=1,h-=1,3&l){case 0:i.mode=16193;break;case 1:if(ei(i),i.mode=Ne,e===Ae){l>>>=2,h-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=$e}l>>>=2,h-=2;break;case 16193:for(l>>>=7&h,h-=7&h;h<32;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if((65535&l)!=(l>>>16^65535)){t.msg="invalid stored block lengths",i.mode=$e;break}if(i.length=65535&l,l=0,h=0,i.mode=Be,e===Ae)break t;case Be:i.mode=16195;case 16195:if(u=i.length,u){if(u>o&&(u=o),u>d&&(u=d),0===u)break t;a.set(r.subarray(s,s+u),n),o-=u,s+=u,d-=u,n+=u,i.length-=u;break}i.mode=Oe;break;case 16196:for(;h<14;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(i.nlen=257+(31&l),l>>>=5,h-=5,i.ndist=1+(31&l),l>>>=5,h-=5,i.ncode=4+(15&l),l>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=$e;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;h<3;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}i.lens[R[i.have++]]=7&l,l>>>=3,h-=3}for(;i.have<19;)i.lens[R[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,E={bits:i.lenbits},x=Se(0,i.lens,0,19,i.lencode,0,i.work,E),i.lenbits=E.bits,x){t.msg="invalid code lengths set",i.mode=$e;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;S=i.lencode[l&(1<<i.lenbits)-1],_=S>>>24,g=S>>>16&255,m=65535&S,!(_<=h);){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(m<16)l>>>=_,h-=_,i.lens[i.have++]=m;else{if(16===m){for(A=_+2;h<A;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(l>>>=_,h-=_,0===i.have){t.msg="invalid bit length repeat",i.mode=$e;break}k=i.lens[i.have-1],u=3+(3&l),l>>>=2,h-=2}else if(17===m){for(A=_+3;h<A;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}l>>>=_,h-=_,k=0,u=3+(7&l),l>>>=3,h-=3}else{for(A=_+7;h<A;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}l>>>=_,h-=_,k=0,u=11+(127&l),l>>>=7,h-=7}if(i.have+u>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=$e;break}for(;u--;)i.lens[i.have++]=k}}if(i.mode===$e)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=$e;break}if(i.lenbits=9,E={bits:i.lenbits},x=Se(1,i.lens,0,i.nlen,i.lencode,0,i.work,E),i.lenbits=E.bits,x){t.msg="invalid literal/lengths set",i.mode=$e;break}if(i.distbits=6,i.distcode=i.distdyn,E={bits:i.distbits},x=Se(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,E),i.distbits=E.bits,x){t.msg="invalid distances set",i.mode=$e;break}if(i.mode=Ne,e===Ae)break t;case Ne:i.mode=Pe;case Pe:if(o>=6&&d>=258){t.next_out=n,t.avail_out=d,t.next_in=s,t.avail_in=o,i.hold=l,i.bits=h,me(t,w),n=t.next_out,a=t.output,d=t.avail_out,s=t.next_in,r=t.input,o=t.avail_in,l=i.hold,h=i.bits,i.mode===Oe&&(i.back=-1);break}for(i.back=0;S=i.lencode[l&(1<<i.lenbits)-1],_=S>>>24,g=S>>>16&255,m=65535&S,!(_<=h);){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(g&&!(240&g)){for(y=_,b=g,v=m;S=i.lencode[v+((l&(1<<y+b)-1)>>y)],_=S>>>24,g=S>>>16&255,m=65535&S,!(y+_<=h);){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}l>>>=y,h-=y,i.back+=y}if(l>>>=_,h-=_,i.back+=_,i.length=m,0===g){i.mode=16205;break}if(32&g){i.back=-1,i.mode=Oe;break}if(64&g){t.msg="invalid literal/length code",i.mode=$e;break}i.extra=15&g,i.mode=16201;case 16201:if(i.extra){for(A=i.extra;h<A;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;S=i.distcode[l&(1<<i.distbits)-1],_=S>>>24,g=S>>>16&255,m=65535&S,!(_<=h);){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(!(240&g)){for(y=_,b=g,v=m;S=i.distcode[v+((l&(1<<y+b)-1)>>y)],_=S>>>24,g=S>>>16&255,m=65535&S,!(y+_<=h);){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}l>>>=y,h-=y,i.back+=y}if(l>>>=_,h-=_,i.back+=_,64&g){t.msg="invalid distance code",i.mode=$e;break}i.offset=m,i.extra=15&g,i.mode=16203;case 16203:if(i.extra){for(A=i.extra;h<A;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=$e;break}i.mode=16204;case 16204:if(0===d)break t;if(u=w-d,i.offset>u){if(u=i.offset-u,u>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=$e;break}u>i.wnext?(u-=i.wnext,p=i.wsize-u):p=i.wnext-u,u>i.length&&(u=i.length),f=i.window}else f=a,p=n-i.offset,u=i.length;u>d&&(u=d),d-=u,i.length-=u;do{a[n++]=f[p++]}while(--u);0===i.length&&(i.mode=Pe);break;case 16205:if(0===d)break t;a[n++]=i.length,d--,i.mode=Pe;break;case Ve:if(i.wrap){for(;h<32;){if(0===o)break t;o--,l|=r[s++]<<h,h+=8}if(w-=d,t.total_out+=w,i.total+=w,4&i.wrap&&w&&(t.adler=i.check=i.flags?J(i.check,a,w,n-w):X(i.check,a,w,n-w)),w=d,4&i.wrap&&(i.flags?l:He(l))!==i.check){t.msg="incorrect data check",i.mode=$e;break}l=0,h=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;h<32;){if(0===o)break t;o--,l+=r[s++]<<h,h+=8}if(4&i.wrap&&l!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=$e;break}l=0,h=0}i.mode=16208;case 16208:x=Ue;break t;case $e:x=De;break t;case 16210:return je;default:return Te}return t.next_out=n,t.avail_out=d,t.next_in=s,t.avail_in=o,i.hold=l,i.bits=h,(i.wsize||w!==t.avail_out&&i.mode<$e&&(i.mode<Ve||e!==ze))&&ii(t,t.output,t.next_out,w-t.avail_out),c-=t.avail_in,w-=t.avail_out,t.total_in+=c,t.total_out+=w,i.total+=w,4&i.wrap&&w&&(t.adler=i.check=i.flags?J(i.check,a,w,t.next_out-w):X(i.check,a,w,t.next_out-w)),t.data_type=i.bits+(i.last?64:0)+(i.mode===Oe?128:0)+(i.mode===Ne||i.mode===Be?256:0),(0===c&&0===w||e===ze)&&x===Re&&(x=Le),x},inflateEnd:t=>{if(Ke(t))return Te;let e=t.state;return e.window&&(e.window=null),t.state=null,Re},inflateGetHeader:(t,e)=>{if(Ke(t))return Te;const i=t.state;return 2&i.wrap?(i.head=e,e.done=!1,Re):Te},inflateSetDictionary:(t,e)=>{const i=e.length;let r,a,s;return Ke(t)?Te:(r=t.state,0!==r.wrap&&r.mode!==Ie?Te:r.mode===Ie&&(a=1,a=X(a,e,i,0),a!==r.check)?De:(s=ii(t,e,i,i),s?(r.mode=16210,je):(r.havedict=1,Re)))},inflateInfo:"pako inflate (from Nodeca project)"};var ai=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const si=Object.prototype.toString,{Z_NO_FLUSH:ni,Z_FINISH:oi,Z_OK:di,Z_STREAM_END:li,Z_NEED_DICT:hi,Z_STREAM_ERROR:ci,Z_DATA_ERROR:wi,Z_MEM_ERROR:ui,Z_BUF_ERROR:pi}=Y,fi={chunkSize:65536,windowBits:15,to:""};function _i(t){this.options=Yt({},fi,t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new re,this.strm.avail_out=0;let i=ri.inflateInit2(this.strm,e.windowBits);if(i!==di)throw new Error(q[i]);if(this.header=new ai,ri.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=te(e.dictionary):"[object ArrayBuffer]"===si.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=ri.inflateSetDictionary(this.strm,e.dictionary),i!==di)))throw new Error(q[i])}_i.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize,a=this.options.dictionary;let s,n,o;if(this.ended)return!1;for(n=e===~~e?e:!0===e?oi:ni,"[object ArrayBuffer]"===si.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),s=ri.inflate(i,n),s===hi&&a&&(s=ri.inflateSetDictionary(i,a),s===di?s=ri.inflate(i,n):s===wi&&(s=hi));i.avail_in>0&&s===li&&2&i.state.wrap&&0!==i.state.flags&&0!==i.input[i.next_in];)ri.inflateReset(i),s=ri.inflate(i,n);switch(s){case ci:case wi:case hi:case ui:return this.onEnd(s),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||s===li||n>0))if("string"===this.options.to){let t=ie(i.output,i.next_out),e=i.next_out-t,a=ee(i.output,t);i.next_out=e,i.avail_out=r-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(a)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out)),i.avail_out=0,i.next_out=0;if(s!==di&&s!==pi||0!==o){if(s===li)return s=ri.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===i.avail_in){if(n===oi)return s=ri.inflateEnd(this.strm),this.onEnd(s===di?pi:s),this.ended=!0,!1;break}}}return!0},_i.prototype.onData=function(t){this.chunks.push(t)},_i.prototype.onEnd=function(t){t===di&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Gt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var gi={ungzip:function(t,e){const i=new _i(e);if(i.push(t,!0),i.err)throw i.msg||q[i.err];return i.result}};const{gzip:mi}=_e,{ungzip:yi}=gi;var bi=mi,vi=yi;
6
+ /*!
7
+ * Copyright (c) 2020-2023 Digital Bazaar, Inc. All rights reserved.
8
+ */
9
+ class ki{constructor({length:t,buffer:e,leftToRightIndexing:i,littleEndianBits:r}={}){if(t&&e)throw new Error('Only one of "length" or "buffer" must be given.');if(void 0!==t?s(t,"length"):o(e,"buffer"),void 0!==r){if(void 0!==i)throw new Error('Using both "littleEndianBits" and "leftToRightIndexing" is not allowed.');n(r,"littleEndianBits"),i=r}void 0===i?i=!0:n(i,"leftToRightIndexing"),t?(this.bits=new Uint8Array(Math.ceil(t/8)),this.length=t):(this.bits=new Uint8Array(e.buffer),this.length=8*e.length),this.leftToRightIndexing=i}set(t,e){a(t,"position"),n(e,"on");const{length:i,leftToRightIndexing:r}=this,{index:s,bit:o}=xi(t,i,r);e?this.bits[s]|=o:this.bits[s]&=255^o}get(t){a(t,"position");const{length:e,leftToRightIndexing:i}=this,{index:r,bit:s}=xi(t,e,i);return!!(this.bits[r]&s)}async encodeBits(){return t(bi(this.bits))}static async decodeBits({encoded:t}){return function(t,e){if("string"!=typeof t)throw new TypeError(`"${e}" must be a string.`)}(t,"encoded"),vi(e(t))}async compressBits(){return bi(this.bits)}static async uncompressBits({compressed:t}){return o(t,"compressed"),vi(t)}}function xi(t,e,i){if(function(t,e){if(!(Number.isInteger(t)&&t>=0))throw new TypeError(`"${e}" must be a non-negative integer.`)}(t,"position"),s(e,"length"),n(i,"leftToRightIndexing"),t>=e)throw new Error(`Position "${t}" is out of range "0-${e-1}".`);const r=t%8;return{index:Math.floor(t/8),bit:1<<(i?7-r:r)}}
10
+ /*!
11
+ * Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
12
+ */
13
+ /*!
14
+ * Copyright (c) 2021-2024 Digital Bazaar, Inc. All rights reserved.
15
+ */
16
+ const Si=new Map,zi=new Map,Ei=new Map;function Ai({contextsMap:t,metadataMap:e,namedMap:i,metadata:r}){t.set(r.id,r.context),e.set(r.id,r),i.set(r.shortName,r)}Ai({contextsMap:Si,metadataMap:zi,namedMap:Ei,metadata:{id:"https://www.w3.org/ns/credentials/undefined-terms/v2",type:"ContextMetadata",shortName:"undefined-terms-v2",url:new URL("../contexts/undefined-terms-v2.jsonld",import.meta.url),context:{"@context":{"@vocab":"https://www.w3.org/ns/credentials/undefined-term#"}}}}),Ai({contextsMap:Si,metadataMap:zi,namedMap:Ei,metadata:{id:"https://www.w3.org/2018/credentials/v1",type:"ContextMetadata",shortName:"v1",url:new URL("../contexts/v1.jsonld",import.meta.url),context:{"@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",VerifiableCredential:{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",credentialSchema:{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",JsonSchemaValidator2018:"cred:JsonSchemaValidator2018"}},credentialStatus:{"@id":"cred:credentialStatus","@type":"@id"},credentialSubject:{"@id":"cred:credentialSubject","@type":"@id"},evidence:{"@id":"cred:evidence","@type":"@id"},expirationDate:{"@id":"cred:expirationDate","@type":"xsd:dateTime"},holder:{"@id":"cred:holder","@type":"@id"},issued:{"@id":"cred:issued","@type":"xsd:dateTime"},issuer:{"@id":"cred:issuer","@type":"@id"},issuanceDate:{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},proof:{"@id":"sec:proof","@type":"@id","@container":"@graph"},refreshService:{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",ManualRefreshService2018:"cred:ManualRefreshService2018"}},termsOfUse:{"@id":"cred:termsOfUse","@type":"@id"},validFrom:{"@id":"cred:validFrom","@type":"xsd:dateTime"},validUntil:{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},VerifiablePresentation:{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",sec:"https://w3id.org/security#",holder:{"@id":"cred:holder","@type":"@id"},proof:{"@id":"sec:proof","@type":"@id","@container":"@graph"},verifiableCredential:{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},EcdsaSecp256k1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},EcdsaSecp256r1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},Ed25519Signature2018:{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},RsaSignature2018:{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":!0,challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":!0,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}}}),Ai({contextsMap:Si,metadataMap:zi,namedMap:Ei,metadata:{id:"https://www.w3.org/ns/credentials/v2",type:"ContextMetadata",shortName:"v2",url:new URL("../contexts/v2.jsonld",import.meta.url),context:{"@context":{"@protected":!0,id:"@id",type:"@type",description:"https://schema.org/description",digestMultibase:{"@id":"https://w3id.org/security#digestMultibase","@type":"https://w3id.org/security#multibase"},digestSRI:{"@id":"https://www.w3.org/2018/credentials#digestSRI","@type":"https://www.w3.org/2018/credentials#sriString"},mediaType:{"@id":"https://schema.org/encodingFormat"},name:"https://schema.org/name",VerifiableCredential:{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@protected":!0,id:"@id",type:"@type",confidenceMethod:{"@id":"https://www.w3.org/2018/credentials#confidenceMethod","@type":"@id"},credentialSchema:{"@id":"https://www.w3.org/2018/credentials#credentialSchema","@type":"@id"},credentialStatus:{"@id":"https://www.w3.org/2018/credentials#credentialStatus","@type":"@id"},credentialSubject:{"@id":"https://www.w3.org/2018/credentials#credentialSubject","@type":"@id"},description:"https://schema.org/description",evidence:{"@id":"https://www.w3.org/2018/credentials#evidence","@type":"@id"},issuer:{"@id":"https://www.w3.org/2018/credentials#issuer","@type":"@id"},name:"https://schema.org/name",proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},refreshService:{"@id":"https://www.w3.org/2018/credentials#refreshService","@type":"@id"},relatedResource:{"@id":"https://www.w3.org/2018/credentials#relatedResource","@type":"@id"},renderMethod:{"@id":"https://www.w3.org/2018/credentials#renderMethod","@type":"@id"},termsOfUse:{"@id":"https://www.w3.org/2018/credentials#termsOfUse","@type":"@id"},validFrom:{"@id":"https://www.w3.org/2018/credentials#validFrom","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},validUntil:{"@id":"https://www.w3.org/2018/credentials#validUntil","@type":"http://www.w3.org/2001/XMLSchema#dateTime"}}},EnvelopedVerifiableCredential:"https://www.w3.org/2018/credentials#EnvelopedVerifiableCredential",VerifiablePresentation:{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@protected":!0,id:"@id",type:"@type",holder:{"@id":"https://www.w3.org/2018/credentials#holder","@type":"@id"},proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},termsOfUse:{"@id":"https://www.w3.org/2018/credentials#termsOfUse","@type":"@id"},verifiableCredential:{"@id":"https://www.w3.org/2018/credentials#verifiableCredential","@type":"@id","@container":"@graph","@context":null}}},EnvelopedVerifiablePresentation:"https://www.w3.org/2018/credentials#EnvelopedVerifiablePresentation",JsonSchemaCredential:"https://www.w3.org/2018/credentials#JsonSchemaCredential",JsonSchema:{"@id":"https://www.w3.org/2018/credentials#JsonSchema","@context":{"@protected":!0,id:"@id",type:"@type",jsonSchema:{"@id":"https://www.w3.org/2018/credentials#jsonSchema","@type":"@json"}}},BitstringStatusListCredential:"https://www.w3.org/ns/credentials/status#BitstringStatusListCredential",BitstringStatusList:{"@id":"https://www.w3.org/ns/credentials/status#BitstringStatusList","@context":{"@protected":!0,id:"@id",type:"@type",encodedList:{"@id":"https://www.w3.org/ns/credentials/status#encodedList","@type":"https://w3id.org/security#multibase"},statusPurpose:"https://www.w3.org/ns/credentials/status#statusPurpose",ttl:"https://www.w3.org/ns/credentials/status#ttl"}},BitstringStatusListEntry:{"@id":"https://www.w3.org/ns/credentials/status#BitstringStatusListEntry","@context":{"@protected":!0,id:"@id",type:"@type",statusListCredential:{"@id":"https://www.w3.org/ns/credentials/status#statusListCredential","@type":"@id"},statusListIndex:"https://www.w3.org/ns/credentials/status#statusListIndex",statusPurpose:"https://www.w3.org/ns/credentials/status#statusPurpose",statusMessage:{"@id":"https://www.w3.org/ns/credentials/status#statusMessage","@context":{"@protected":!0,id:"@id",type:"@type",message:"https://www.w3.org/ns/credentials/status#message",status:"https://www.w3.org/ns/credentials/status#status"}},statusReference:{"@id":"https://www.w3.org/ns/credentials/status#statusReference","@type":"@id"},statusSize:{"@id":"https://www.w3.org/ns/credentials/status#statusSize","@type":"https://www.w3.org/2001/XMLSchema#integer"}}},DataIntegrityProof:{"@id":"https://w3id.org/security#DataIntegrityProof","@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"},cryptosuite:{"@id":"https://w3id.org/security#cryptosuite","@type":"https://w3id.org/security#cryptosuiteString"},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",previousProof:{"@id":"https://w3id.org/security#previousProof","@type":"@id"},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"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@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"}}},"...":{"@id":"https://www.iana.org/assignments/jwt#..."},_sd:{"@id":"https://www.iana.org/assignments/jwt#_sd","@type":"@json"},_sd_alg:{"@id":"https://www.iana.org/assignments/jwt#_sd_alg"},aud:{"@id":"https://www.iana.org/assignments/jwt#aud","@type":"@id"},cnf:{"@id":"https://www.iana.org/assignments/jwt#cnf","@context":{"@protected":!0,kid:{"@id":"https://www.iana.org/assignments/jwt#kid","@type":"@id"},jwk:{"@id":"https://www.iana.org/assignments/jwt#jwk","@type":"@json"}}},exp:{"@id":"https://www.iana.org/assignments/jwt#exp","@type":"https://www.w3.org/2001/XMLSchema#nonNegativeInteger"},iat:{"@id":"https://www.iana.org/assignments/jwt#iat","@type":"https://www.w3.org/2001/XMLSchema#nonNegativeInteger"},iss:{"@id":"https://www.iana.org/assignments/jose#iss","@type":"@id"},jku:{"@id":"https://www.iana.org/assignments/jose#jku","@type":"@id"},kid:{"@id":"https://www.iana.org/assignments/jose#kid","@type":"@id"},nbf:{"@id":"https://www.iana.org/assignments/jwt#nbf","@type":"https://www.w3.org/2001/XMLSchema#nonNegativeInteger"},sub:{"@id":"https://www.iana.org/assignments/jose#sub","@type":"@id"},x5u:{"@id":"https://www.iana.org/assignments/jose#x5u","@type":"@id"}}}}});
17
+ /*!
18
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
19
+ */
20
+ const Ri=new RegExp("-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](.[0-9]+)?|(24:00:00(.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"),Ui=Ei.get("v1").id,Mi=Ei.get("v2").id,Ti=new Map([[Ui,1],[Mi,2]]);function Di({credential:t,prop:e}){const i=t[e];if(!Ri.test(i))throw new Error(`"${e}" must be a valid date: ${i}`)}function ji({credential:t,version:e}){return function({credential:t}={}){const e=t?.["@context"]?.[0];return Ti.get(e)}({credential:t})===e}function Li({t1:t,t2:e,maxClockSkew:i}){return Math.abs(t-e)<1e3*i?0:t<e?-1:1}
21
+ /*!
22
+ * Copyright (c) 2019-2024 Digital Bazaar, Inc. All rights reserved.
23
+ */const Zi=new Map([...Si]);
24
+ /*!
25
+ * Copyright (c) 2019-2023 Digital Bazaar, Inc. All rights reserved.
26
+ */
27
+ /*!
28
+ * Copyright (c) 2019-2023 Digital Bazaar, Inc. All rights reserved.
29
+ */
30
+ const{purposes:{AssertionProofPurpose:Ci}}=i;class Ii extends Ci{constructor({controller:t,date:e,maxTimestampDelta:i}={}){super({controller:t,date:e,maxTimestampDelta:i})}async validate(t,{document:e,suite:i,verificationMethod:a,documentLoader:s}){try{const n=await super.validate(t,{document:e,suite:i,verificationMethod:a,documentLoader:s});if(!n.valid)throw n.error;const o=r.getValues(e,"issuer");if(!o||0===o.length)throw new Error("Credential issuer is required.");const d="string"==typeof o[0]?o[0]:o[0].id;if(n.controller.id!==d)throw new Error("Credential issuer must match the verification method controller.");return{valid:!0}}catch(t){return{valid:!1,error:t}}}}
31
+ /**
32
+ * A JavaScript implementation of Verifiable Credentials.
33
+ *
34
+ * @author Dave Longley
35
+ * @author David I. Lehn
36
+ *
37
+ * @license BSD 3-Clause License
38
+ * Copyright (c) 2017-2025 Digital Bazaar, Inc.
39
+ * All rights reserved.
40
+ *
41
+ * Redistribution and use in source and binary forms, with or without
42
+ * modification, are permitted provided that the following conditions are met:
43
+ *
44
+ * Redistributions of source code must retain the above copyright notice,
45
+ * this list of conditions and the following disclaimer.
46
+ *
47
+ * Redistributions in binary form must reproduce the above copyright
48
+ * notice, this list of conditions and the following disclaimer in the
49
+ * documentation and/or other materials provided with the distribution.
50
+ *
51
+ * Neither the name of the Digital Bazaar, Inc. nor the names of its
52
+ * contributors may be used to endorse or promote products derived from
53
+ * this software without specific prior written permission.
54
+ *
55
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
56
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
57
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
58
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
59
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
61
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
62
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
63
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
64
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
65
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
66
+ */const{AssertionProofPurpose:Oi,AuthenticationProofPurpose:Fi}=i.purposes,Bi=i.extendContextLoader(async function(t){const e=Zi.get(t);if(void 0!==e)return{contextUrl:null,documentUrl:t,document:e};throw new Error(`Document loader unable to load URL "${t}".`)});async function Ni(t={}){const{credential:e}=t;try{if(!e)throw new TypeError('A "credential" property is required for verifying.');return await async function(t={}){const{credential:e,checkStatus:a,now:s,maxClockSkew:n}=t;if(function({credential:t,now:e=new Date,mode:i="verify",maxClockSkew:a=300}={}){"string"==typeof e&&(e=new Date(e));if(function({context:t}){if(!Ti.has(t[0]))throw new Error(`"${Ui}" or "${Mi}" needs to be first in the list of contexts.`)}({context:t["@context"]}),!t.type)throw new Error('"type" property is required.');if(!r.getValues(t,"type").includes("VerifiableCredential"))throw new Error('"type" must include `VerifiableCredential`.');if(function({credential:t}){if(!t?.credentialSubject)throw new Error('"credentialSubject" property is required.');if(Array.isArray(t?.credentialSubject))return t?.credentialSubject.map(t=>Hi({subject:t}));Hi({subject:t?.credentialSubject})}({credential:t}),!t.issuer)throw new Error('"issuer" property is required.');if(ji({credential:t,version:1})){if(!t.issuanceDate)throw new Error('"issuanceDate" property is required.');if(Di({credential:t,prop:"issuanceDate"}),r.getValues(t,"issuanceDate").length>1)throw new Error('"issuanceDate" property can only have one value.');if("expirationDate"in t&&(Di({credential:t,prop:"expirationDate"}),"verify"===i)){if(Li({t1:e,t2:new Date(t.expirationDate),maxClockSkew:a})>0)throw new Error("Credential has expired.")}if("verify"===i){if(Li({t1:new Date(t.issuanceDate),t2:e,maxClockSkew:a})>0)throw new Error(`The current date time (${e.toISOString()}) is before the "issuanceDate" (${t.issuanceDate}).`)}}if(ji({credential:t,version:2})){let{validUntil:r,validFrom:s}=t;if(r&&(Di({credential:t,prop:"validUntil"}),"verify"===i&&(r=new Date(t.validUntil),Li({t1:e,t2:r,maxClockSkew:a})>0)))throw new Error(`The current date time (${e.toISOString()}) is after "validUntil" (${t.validUntil}).`);if(s&&(Di({credential:t,prop:"validFrom"}),"verify"===i&&(s=new Date(t.validFrom),Li({t1:s,t2:e,maxClockSkew:a})>0)))throw new Error(`The current date time (${e.toISOString()}) is before "validFrom" (${t.validFrom}).`)}if(r.getValues(t,"issuer").length>1)throw new Error('"issuer" property can only have one value.');if("issuer"in t){const e=Pi(t.issuer);if(!e)throw new Error('"issuer" id is required.');Ji({id:e,propertyName:"issuer"})}r.getValues(t,"credentialStatus").forEach(t=>{if("id"in t&&Ji({id:t.id,propertyName:"credentialStatus.id"}),!t.type)throw new Error('"credentialStatus" must include a type.')}),r.getValues(t,"evidence").forEach(t=>{const e=Pi(t);e&&Ji({id:e,propertyName:"evidence"})});for(const e of Vi)if(e in t){const i=t[e];if(Array.isArray(i)){i.forEach(t=>$i(t,e));continue}$i(i,e)}}({credential:e,now:s,maxClockSkew:n}),e.credentialStatus&&"function"!=typeof t.checkStatus)throw new TypeError('A "checkStatus" function must be given to verify credentials with "credentialStatus".');const o=t.documentLoader||Bi,{controller:d}=t,l=t.purpose||new Ii({controller:d}),h=await i.verify(e,{...t,purpose:l,documentLoader:o});if(!h.verified)return h;e.credentialStatus&&(h.statusResult=await a(t),h.statusResult.verified||(h.verified=!1));return h}(t)}catch(t){return{verified:!1,results:[{credential:e,verified:!1,error:t}],error:t}}}function Pi(t){return"string"==typeof t?t:"id"in t?t.id:void 0}const Vi=["proof","credentialStatus","termsOfUse","evidence"];function $i(t,e){if(!Xi(t))throw new Error(`property "${e}" must be an object.`);if(Ki(t))throw new Error(`property "${e}" can not be an empty object.`);if(!("type"in t))throw new Error(`property "${e}" must have property type.`)}function Hi({subject:t}){if(!1===Xi(t))throw new Error('"credentialSubject" must be a non-null object.');if(Ki(t))throw new Error('"credentialSubject" must make a claim.');t.id&&Ji({id:t.id,propertyName:"credentialSubject.id"})}function Xi(t){return null!==t&&"object"==typeof t}function Ki(t){return!Xi(t)||0===Object.keys(t).length}function Ji({id:t,propertyName:e}){let i;try{i=new URL(t)}catch(i){const r=new TypeError(`"${e}" must be a URI: "${t}".`);throw r.cause=i,r}if(!i.protocol)throw new TypeError(`"${e}" must be a URI: "${t}".`)}export{ki as B,Ei as n,Ni as v};
@@ -0,0 +1,30 @@
1
+ import{u as t,f as e,w as r}from"./main.js";
2
+ /*!
3
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
4
+ */
5
+ const n="ECDSA",i=!0,o="https://w3id.org/security/suites/ecdsa-2019/v1",s="https://w3id.org/security/multikey/v1",c="z",u=new Uint8Array([231,1]),a=new Uint8Array([128,36]),f=new Uint8Array([129,36]),l=new Uint8Array([130,36]),d=new Uint8Array([129,38]),h=new Uint8Array([134,38]),y=new Uint8Array([135,38]),p=new Uint8Array([136,38]),w="P-256",g="P-384",b="P-521",m="K-256",E="SHA-256",v="SHA-384",B="SHA-512",x=globalThis.crypto,k=globalThis.CryptoKey??x.CryptoKey;function K({curve:t}){if(t===w||t===m)return E;if(t===g)return v;if(t===b)return B;throw new TypeError(`Unsupported curve "${t}".`)}
6
+ /*!
7
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
8
+ */function A({publicMultikey:t}){if(t[0]===a[0]&&t[1]===a[1])return w;if(t[0]===f[0]&&t[1]===f[1])return g;if(t[0]===l[0]&&t[1]===l[1])return b;if(t[0]===u[0]&&t[1]===u[1])return m;throw new TypeError("Unsupported public multikey header.")}function U({secretMultikey:t}){if(t[0]===h[0]&&t[1]===h[1])return w;if(t[0]===y[0]&&t[1]===y[1])return g;if(t[0]===p[0]&&t[1]===p[1])return b;if(t[0]===d[0]&&t[1]===d[1])return m;throw new TypeError("Unsupported secret multikey header.")}function O({curve:t}){if(t===w||t===m)return 32;if(t===g)return 48;if(t===b)return 66;throw new TypeError(`Unsupported curve "${t}".`)}
9
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
10
+ function R(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function S(t,e=""){if(!Number.isSafeInteger(t)||t<0){throw new Error(`${e&&`"${e}" `}expected integer >= 0, got ${t}`)}}function C(t,e,r=""){const n=R(t),i=t?.length,o=void 0!==e;if(!n||o&&i!==e){throw new Error((r&&`"${r}" `)+"expected Uint8Array"+(o?` of length ${e}`:"")+", got "+(n?`length=${i}`:"type="+typeof t))}return t}function I(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash must wrapped by utils.createHasher");S(t.outputLen),S(t.blockLen)}function H(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function j(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function q(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function F(t,e){return t<<32-e|t>>>e}const M=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),L=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function N(t){if(C(t),M)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=L[t[r]];return e}const T=48,P=57,Z=65,V=70,D=97,_=102;function $(t){return t>=T&&t<=P?t-T:t>=Z&&t<=V?t-(Z-10):t>=D&&t<=_?t-(D-10):void 0}function Y(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);if(M)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,i=0;e<r;e++,i+=2){const r=$(t.charCodeAt(i)),o=$(t.charCodeAt(i+1));if(void 0===r||void 0===o){const e=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+i)}n[e]=16*r+o}return n}function z(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];C(n),e+=n.length}const r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}function G(t,e={}){const r=(e,r)=>t(r).update(e).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=e=>t(e),Object.assign(r,e),Object.freeze(r)}function X(t=32){const e="object"==typeof globalThis?globalThis.crypto:null;if("function"!=typeof e?.getRandomValues)throw new Error("crypto.getRandomValues must be defined");return e.getRandomValues(new Uint8Array(t))}const W=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function J(t,e,r){return t&e^~t&r}function Q(t,e,r){return t&e^t&r^e&r}class tt{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,r,n){this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(t),this.view=q(this.buffer)}update(t){H(this),C(t);const{view:e,buffer:r,blockLen:n}=this,i=t.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const e=q(t);for(;n<=i-o;o+=n)this.process(e,o);continue}r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){H(this),function(t,e){C(t,void 0,"digestInto() output");const r=e.outputLen;if(t.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,j(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;r.setBigUint64(n-8,BigInt(8*this.length),i),this.process(r,0);const s=q(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const u=c/4,a=this.get();if(u>a.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<u;t++)s.setUint32(4*t,a[t],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.destroyed=o,t.finished=i,t.length=n,t.pos=s,n%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const et=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rt=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]),nt=new Uint32Array(64);class it extends tt{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:c}=this;return[t,e,r,n,i,o,s,c]}set(t,e,r,n,i,o,s,c){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|c}process(t,e){for(let r=0;r<16;r++,e+=4)nt[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=nt[t-15],r=nt[t-2],n=F(e,7)^F(e,18)^e>>>3,i=F(r,17)^F(r,19)^r>>>10;nt[t]=i+nt[t-7]+n+nt[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:c,G:u,H:a}=this;for(let t=0;t<64;t++){const e=a+(F(s,6)^F(s,11)^F(s,25))+J(s,c,u)+rt[t]+nt[t]|0,f=(F(r,2)^F(r,13)^F(r,22))+Q(r,n,i)|0;a=u,u=c,c=s,s=o+e|0,o=i,i=n,n=r,r=e+f|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,c=c+this.F|0,u=u+this.G|0,a=a+this.H|0,this.set(r,n,i,o,s,c,u,a)}roundClean(){j(nt)}destroy(){this.set(0,0,0,0,0,0,0,0),j(this.buffer)}}class ot extends it{A=0|et[0];B=0|et[1];C=0|et[2];D=0|et[3];E=0|et[4];F=0|et[5];G=0|et[6];H=0|et[7];constructor(){super(32)}}const st=G(()=>new ot,W(1)),ct=BigInt(0),ut=BigInt(1);
11
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function at(t,e=""){if("boolean"!=typeof t){throw new Error((e&&`"${e}" `)+"expected boolean, got type="+typeof t)}return t}function ft(t){if("bigint"==typeof t){if(!gt(t))throw new Error("positive bigint expected, got "+t)}else S(t);return t}function lt(t){const e=ft(t).toString(16);return 1&e.length?"0"+e:e}function dt(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?ct:BigInt("0x"+t)}function ht(t){return dt(N(t))}function yt(t){return dt(N(function(t){return Uint8Array.from(t)}(C(t)).reverse()))}function pt(t,e){S(e);const r=Y((t=ft(t)).toString(16).padStart(2*e,"0"));if(r.length!==e)throw new Error("number too large");return r}function wt(t,e){return pt(t,e).reverse()}const gt=t=>"bigint"==typeof t&&ct<=t;function bt(t,e,r,n){if(!function(t,e,r){return gt(t)&&gt(e)&&gt(r)&&e<=t&&t<r}(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}const mt=t=>(ut<<BigInt(t))-ut;function Et(t,e={},r={}){if(!t||"object"!=typeof t)throw new Error("expected valid options object");const n=(e,r)=>Object.entries(e).forEach(([e,n])=>function(e,r,n){const i=t[e];if(n&&void 0===i)return;const o=typeof i;if(o!==r||null===i)throw new Error(`param "${e}" is invalid: expected ${r}, got ${o}`)}(e,n,r));n(e,!1),n(r,!0)}function vt(t){const e=new WeakMap;return(r,...n)=>{const i=e.get(r);if(void 0!==i)return i;const o=t(r,...n);return e.set(r,o),o}}
12
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Bt=BigInt(0),xt=BigInt(1),kt=BigInt(2),Kt=BigInt(3),At=BigInt(4),Ut=BigInt(5),Ot=BigInt(7),Rt=BigInt(8),St=BigInt(9),Ct=BigInt(16);function It(t,e){const r=t%e;return r>=Bt?r:e+r}function Ht(t,e,r){let n=t;for(;e-- >Bt;)n*=n,n%=r;return n}function jt(t,e){if(t===Bt)throw new Error("invert: expected non-zero number");if(e<=Bt)throw new Error("invert: expected positive modulus, got "+e);let r=It(t,e),n=e,i=Bt,o=xt;for(;r!==Bt;){const t=n%r,e=i-o*(n/r);n=r,r=t,i=o,o=e}if(n!==xt)throw new Error("invert: does not exist");return It(i,e)}function qt(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function Ft(t,e){const r=(t.ORDER+xt)/At,n=t.pow(e,r);return qt(t,n,e),n}function Mt(t,e){const r=(t.ORDER-Ut)/Rt,n=t.mul(e,kt),i=t.pow(n,r),o=t.mul(e,i),s=t.mul(t.mul(o,kt),i),c=t.mul(o,t.sub(s,t.ONE));return qt(t,c,e),c}function Lt(t){if(t<Kt)throw new Error("sqrt is not defined for small field");let e=t-xt,r=0;for(;e%kt===Bt;)e/=kt,r++;let n=kt;const i=Dt(t);for(;1===Zt(i,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return Ft;let o=i.pow(n,e);const s=(e+xt)/kt;return function(t,n){if(t.is0(n))return n;if(1!==Zt(t,n))throw new Error("Cannot find square root");let i=r,c=t.mul(t.ONE,o),u=t.pow(n,e),a=t.pow(n,s);for(;!t.eql(u,t.ONE);){if(t.is0(u))return t.ZERO;let e=1,r=t.sqr(u);for(;!t.eql(r,t.ONE);)if(e++,r=t.sqr(r),e===i)throw new Error("Cannot find square root");const n=xt<<BigInt(i-e-1),o=t.pow(c,n);i=e,c=t.sqr(o),u=t.mul(u,c),a=t.mul(a,o)}return a}}function Nt(t){return t%At===Kt?Ft:t%Rt===Ut?Mt:t%Ct===St?function(t){const e=Dt(t),r=Lt(t),n=r(e,e.neg(e.ONE)),i=r(e,n),o=r(e,e.neg(n)),s=(t+Ot)/Ct;return(t,e)=>{let r=t.pow(e,s),c=t.mul(r,n);const u=t.mul(r,i),a=t.mul(r,o),f=t.eql(t.sqr(c),e),l=t.eql(t.sqr(u),e);r=t.cmov(r,c,f),c=t.cmov(a,u,l);const d=t.eql(t.sqr(c),e),h=t.cmov(r,c,d);return qt(t,h,e),h}}(t):Lt(t)}const Tt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Pt(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((e,r,i)=>t.is0(r)?e:(n[i]=e,t.mul(e,r)),t.ONE),o=t.inv(i);return e.reduceRight((e,r,i)=>t.is0(r)?e:(n[i]=t.mul(e,n[i]),t.mul(e,r)),o),n}function Zt(t,e){const r=(t.ORDER-xt)/kt,n=t.pow(e,r),i=t.eql(n,t.ONE),o=t.eql(n,t.ZERO),s=t.eql(n,t.neg(t.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}class Vt{ORDER;BITS;BYTES;isLE;ZERO=Bt;ONE=xt;_lengths;_sqrt;_mod;constructor(t,e={}){if(t<=Bt)throw new Error("invalid field: expected ORDER > 0, got "+t);let r;this.isLE=!1,null!=e&&"object"==typeof e&&("number"==typeof e.BITS&&(r=e.BITS),"function"==typeof e.sqrt&&(this.sqrt=e.sqrt),"boolean"==typeof e.isLE&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=e.allowedLengths?.slice()),"boolean"==typeof e.modFromBytes&&(this._mod=e.modFromBytes));const{nBitLength:n,nByteLength:i}=function(t,e){void 0!==e&&S(e);const r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}(t,r);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=n,this.BYTES=i,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return It(t,this.ORDER)}isValid(t){if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return Bt<=t&&t<this.ORDER}is0(t){return t===Bt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&xt)===xt}neg(t){return It(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return It(t*t,this.ORDER)}add(t,e){return It(t+e,this.ORDER)}sub(t,e){return It(t-e,this.ORDER)}mul(t,e){return It(t*e,this.ORDER)}pow(t,e){return function(t,e,r){if(r<Bt)throw new Error("invalid exponent, negatives unsupported");if(r===Bt)return t.ONE;if(r===xt)return e;let n=t.ONE,i=e;for(;r>Bt;)r&xt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=xt;return n}(this,t,e)}div(t,e){return It(t*jt(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return jt(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=Nt(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?wt(t,this.BYTES):pt(t,this.BYTES)}fromBytes(t,e=!1){C(t);const{_lengths:r,BYTES:n,isLE:i,ORDER:o,_mod:s}=this;if(r){if(!r.includes(t.length)||t.length>n)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);const e=new Uint8Array(n);e.set(t,i?0:e.length-t.length),t=e}if(t.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let c=i?yt(t):ht(t);if(s&&(c=It(c,o)),!e&&!this.isValid(c))throw new Error("invalid field element: outside of range 0..ORDER");return c}invertBatch(t){return Pt(this,t)}cmov(t,e,r){return r?e:t}}function Dt(t,e={}){return new Vt(t,e)}function _t(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function $t(t){const e=_t(t);return e+Math.ceil(e/2)}
13
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
14
+ const Yt=BigInt(0),zt=BigInt(1);function Gt(t,e){const r=e.negate();return t?r:e}function Xt(t,e){const r=Pt(t.Fp,e.map(t=>t.Z));return e.map((e,n)=>t.fromAffine(e.toAffine(r[n])))}function Wt(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Jt(t,e){Wt(t,e);const r=2**t;return{windows:Math.ceil(e/t)+1,windowSize:2**(t-1),mask:mt(t),maxNumber:r,shiftBy:BigInt(t)}}function Qt(t,e,r){const{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r;let c=Number(t&i),u=t>>s;c>n&&(c-=o,u+=zt);const a=e*n;return{nextN:u,offset:a+Math.abs(c)-1,isZero:0===c,isNeg:c<0,isNegF:e%2!=0,offsetF:a}}const te=new WeakMap,ee=new WeakMap;function re(t){return ee.get(t)||1}function ne(t){if(t!==Yt)throw new Error("invalid wNAF")}class ie{BASE;ZERO;Fn;bits;constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,r=this.ZERO){let n=t;for(;e>Yt;)e&zt&&(r=r.add(n)),n=n.double(),e>>=zt;return r}precomputeWindow(t,e){const{windows:r,windowSize:n}=Jt(e,this.bits),i=[];let o=t,s=o;for(let t=0;t<r;t++){s=o,i.push(s);for(let t=1;t<n;t++)s=s.add(o),i.push(s);o=s.double()}return i}wNAF(t,e,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let n=this.ZERO,i=this.BASE;const o=Jt(t,this.bits);for(let t=0;t<o.windows;t++){const{nextN:s,offset:c,isZero:u,isNeg:a,isNegF:f,offsetF:l}=Qt(r,t,o);r=s,u?i=i.add(Gt(f,e[l])):n=n.add(Gt(a,e[c]))}return ne(r),{p:n,f:i}}wNAFUnsafe(t,e,r,n=this.ZERO){const i=Jt(t,this.bits);for(let t=0;t<i.windows&&r!==Yt;t++){const{nextN:o,offset:s,isZero:c,isNeg:u}=Qt(r,t,i);if(r=o,!c){const t=e[s];n=n.add(u?t.negate():t)}}return ne(r),n}getPrecomputes(t,e,r){let n=te.get(e);return n||(n=this.precomputeWindow(e,t),1!==t&&("function"==typeof r&&(n=r(n)),te.set(e,n))),n}cached(t,e,r){const n=re(t);return this.wNAF(n,this.getPrecomputes(n,t,r),e)}unsafe(t,e,r,n){const i=re(t);return 1===i?this._unsafeLadder(t,e,n):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),e,n)}createCache(t,e){Wt(e,this.bits),ee.set(t,e),te.delete(t)}hasCache(t){return 1!==re(t)}}function oe(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function(t){Et(t,Tt.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",BYTES:"number",BITS:"number"}))}(e),e}return Dt(t,{isLE:r})}class se{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,e){if(I(t),C(e,void 0,"key"),this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,n=new Uint8Array(r);n.set(e.length>r?t.create().update(e).digest():e);for(let t=0;t<n.length;t++)n[t]^=54;this.iHash.update(n),this.oHash=t.create();for(let t=0;t<n.length;t++)n[t]^=106;this.oHash.update(n),j(n)}update(t){return H(this),this.iHash.update(t),this}digestInto(t){H(this),C(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ce=(t,e,r)=>new se(t,e).update(r).digest();ce.create=(t,e)=>new se(t,e);
15
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
16
+ const ue=(t,e)=>(t+(t>=0?e:-e)/we)/e;function ae(t,e,r){const[[n,i],[o,s]]=e,c=ue(s*t,r),u=ue(-i*t,r);let a=t-c*n-u*o,f=-c*i-u*s;const l=a<ye,d=f<ye;l&&(a=-a),d&&(f=-f);const h=mt(Math.ceil(function(t){let e;for(e=0;t>ct;t>>=ut,e+=1);return e}(r)/2))+pe;if(a<ye||a>=h||f<ye||f>=h)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:l,k1:a,k2neg:d,k2:f}}function fe(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function le(t,e){const r={};for(let n of Object.keys(e))r[n]=void 0===t[n]?e[n]:t[n];return at(r.lowS,"lowS"),at(r.prehash,"prehash"),void 0!==r.format&&fe(r.format),r}class de extends Error{constructor(t=""){super(t)}}const he={Err:de,_tlv:{encode:(t,e)=>{const{Err:r}=he;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(1&e.length)throw new r("tlv.encode: unpadded data");const n=e.length/2,i=lt(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const o=n>127?lt(i.length/2|128):"";return lt(t)+o+i+e},decode(t,e){const{Err:r}=he;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const i=e[n++];let o=0;if(!!(128&i)){const t=127&i;if(!t)throw new r("tlv.decode(long): indefinite length not supported");if(t>4)throw new r("tlv.decode(long): byte length is too big");const s=e.subarray(n,n+t);if(s.length!==t)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(const t of s)o=o<<8|t;if(n+=t,o<128)throw new r("tlv.decode(long): not minimal encoding")}else o=i;const s=e.subarray(n,n+o);if(s.length!==o)throw new r("tlv.decode: wrong value length");return{v:s,l:e.subarray(n+o)}}},_int:{encode(t){const{Err:e}=he;if(t<ye)throw new e("integer: negative integers are not allowed");let r=lt(t);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=he;if(128&t[0])throw new e("invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return ht(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=he,i=C(t,void 0,"signature"),{v:o,l:s}=n.decode(48,i);if(s.length)throw new e("invalid signature: left bytes after parsing");const{v:c,l:u}=n.decode(2,o),{v:a,l:f}=n.decode(2,u);if(f.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(c),s:r.decode(a)}},hexFromSig(t){const{_tlv:e,_int:r}=he,n=e.encode(2,r.encode(t.r))+e.encode(2,r.encode(t.s));return e.encode(48,n)}},ye=BigInt(0),pe=BigInt(1),we=BigInt(2),ge=BigInt(3),be=BigInt(4);function me(t,e={}){const r=function(t,e,r={},n){if(void 0===n&&(n="edwards"===t),!e||"object"!=typeof e)throw new Error(`expected valid ${t} CURVE object`);for(const t of["p","n","h"]){const r=e[t];if(!("bigint"==typeof r&&r>Yt))throw new Error(`CURVE.${t} must be positive bigint`)}const i=oe(e.p,r.Fp,n),o=oe(e.n,r.Fn,n),s=["Gx","Gy","a","b"];for(const t of s)if(!i.isValid(e[t]))throw new Error(`CURVE.${t} must be valid field element of CURVE.Fp`);return{CURVE:e=Object.freeze(Object.assign({},e)),Fp:i,Fn:o}}("weierstrass",t,e),{Fp:n,Fn:i}=r;let o=r.CURVE;const{h:s,n:c}=o;Et(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:u}=e;if(u&&(!n.is0(o.a)||"bigint"!=typeof u.beta||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const a=ve(n,i);function f(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const l=e.toBytes||function(t,e,r){const{x:i,y:o}=e.toAffine(),s=n.toBytes(i);if(at(r,"isCompressed"),r){f();return z(Ee(!n.isOdd(o)),s)}return z(Uint8Array.of(4),s,n.toBytes(o))},d=e.fromBytes||function(t){C(t,void 0,"Point");const{publicKey:e,publicKeyUncompressed:r}=a,i=t.length,o=t[0],s=t.subarray(1);if(i!==e||2!==o&&3!==o){if(i===r&&4===o){const t=n.BYTES,e=n.fromBytes(s.subarray(0,t)),r=n.fromBytes(s.subarray(t,2*t));if(!y(e,r))throw new Error("bad point: is not on curve");return{x:e,y:r}}throw new Error(`bad point: got length ${i}, expected compressed=${e} or uncompressed=${r}`)}{const t=n.fromBytes(s);if(!n.isValid(t))throw new Error("bad point: is not on curve, wrong x");const e=h(t);let r;try{r=n.sqrt(e)}catch(t){const e=t instanceof Error?": "+t.message:"";throw new Error("bad point: is not on curve, sqrt error"+e)}f();return!(1&~o)!==n.isOdd(r)&&(r=n.neg(r)),{x:t,y:r}}};function h(t){const e=n.sqr(t),r=n.mul(e,t);return n.add(n.add(r,n.mul(t,o.a)),o.b)}function y(t,e){const r=n.sqr(e),i=h(t);return n.eql(r,i)}if(!y(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const p=n.mul(n.pow(o.a,ge),be),w=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(p,w)))throw new Error("bad curve params: a or b");function g(t,e,r=!1){if(!n.isValid(e)||r&&n.is0(e))throw new Error(`bad point coordinate ${t}`);return e}function b(t){if(!(t instanceof x))throw new Error("Weierstrass Point expected")}function m(t){if(!u||!u.basises)throw new Error("no endo");return ae(t,u.basises,i.ORDER)}const E=vt((t,e)=>{const{X:r,Y:i,Z:o}=t;if(n.eql(o,n.ONE))return{x:r,y:i};const s=t.is0();null==e&&(e=s?n.ONE:n.inv(o));const c=n.mul(r,e),u=n.mul(i,e),a=n.mul(o,e);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(a,n.ONE))throw new Error("invZ was invalid");return{x:c,y:u}}),v=vt(t=>{if(t.is0()){if(e.allowInfinityPoint&&!n.is0(t.Y))return;throw new Error("bad point: ZERO")}const{x:r,y:i}=t.toAffine();if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not field elements");if(!y(r,i))throw new Error("bad point: equation left != right");if(!t.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function B(t,e,r,i,o){return r=new x(n.mul(r.X,t),r.Y,r.Z),e=Gt(i,e),r=Gt(o,r),e.add(r)}class x{static BASE=new x(o.Gx,o.Gy,n.ONE);static ZERO=new x(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(t,e,r){this.X=g("x",t),this.Y=g("y",e,!0),this.Z=g("z",r),Object.freeze(this)}static CURVE(){return o}static fromAffine(t){const{x:e,y:r}=t||{};if(!t||!n.isValid(e)||!n.isValid(r))throw new Error("invalid affine point");if(t instanceof x)throw new Error("projective point not allowed");return n.is0(e)&&n.is0(r)?x.ZERO:new x(e,r,n.ONE)}static fromBytes(t){const e=x.fromAffine(d(C(t,void 0,"point")));return e.assertValidity(),e}static fromHex(t){return x.fromBytes(Y(t))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(t=8,e=!0){return K.createCache(this,t),e||this.multiply(ge),this}assertValidity(){v(this)}hasEvenY(){const{y:t}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(t)}equals(t){b(t);const{X:e,Y:r,Z:i}=this,{X:o,Y:s,Z:c}=t,u=n.eql(n.mul(e,c),n.mul(o,i)),a=n.eql(n.mul(r,c),n.mul(s,i));return u&&a}negate(){return new x(this.X,n.neg(this.Y),this.Z)}double(){const{a:t,b:e}=o,r=n.mul(e,ge),{X:i,Y:s,Z:c}=this;let u=n.ZERO,a=n.ZERO,f=n.ZERO,l=n.mul(i,i),d=n.mul(s,s),h=n.mul(c,c),y=n.mul(i,s);return y=n.add(y,y),f=n.mul(i,c),f=n.add(f,f),u=n.mul(t,f),a=n.mul(r,h),a=n.add(u,a),u=n.sub(d,a),a=n.add(d,a),a=n.mul(u,a),u=n.mul(y,u),f=n.mul(r,f),h=n.mul(t,h),y=n.sub(l,h),y=n.mul(t,y),y=n.add(y,f),f=n.add(l,l),l=n.add(f,l),l=n.add(l,h),l=n.mul(l,y),a=n.add(a,l),h=n.mul(s,c),h=n.add(h,h),l=n.mul(h,y),u=n.sub(u,l),f=n.mul(h,d),f=n.add(f,f),f=n.add(f,f),new x(u,a,f)}add(t){b(t);const{X:e,Y:r,Z:i}=this,{X:s,Y:c,Z:u}=t;let a=n.ZERO,f=n.ZERO,l=n.ZERO;const d=o.a,h=n.mul(o.b,ge);let y=n.mul(e,s),p=n.mul(r,c),w=n.mul(i,u),g=n.add(e,r),m=n.add(s,c);g=n.mul(g,m),m=n.add(y,p),g=n.sub(g,m),m=n.add(e,i);let E=n.add(s,u);return m=n.mul(m,E),E=n.add(y,w),m=n.sub(m,E),E=n.add(r,i),a=n.add(c,u),E=n.mul(E,a),a=n.add(p,w),E=n.sub(E,a),l=n.mul(d,m),a=n.mul(h,w),l=n.add(a,l),a=n.sub(p,l),l=n.add(p,l),f=n.mul(a,l),p=n.add(y,y),p=n.add(p,y),w=n.mul(d,w),m=n.mul(h,m),p=n.add(p,w),w=n.sub(y,w),w=n.mul(d,w),m=n.add(m,w),y=n.mul(p,m),f=n.add(f,y),y=n.mul(E,m),a=n.mul(g,a),a=n.sub(a,y),y=n.mul(g,p),l=n.mul(E,l),l=n.add(l,y),new x(a,f,l)}subtract(t){return this.add(t.negate())}is0(){return this.equals(x.ZERO)}multiply(t){const{endo:r}=e;if(!i.isValidNot0(t))throw new Error("invalid scalar: out of range");let n,o;const s=t=>K.cached(this,t,t=>Xt(x,t));if(r){const{k1neg:e,k1:i,k2neg:c,k2:u}=m(t),{p:a,f:f}=s(i),{p:l,f:d}=s(u);o=f.add(d),n=B(r.beta,a,l,e,c)}else{const{p:e,f:r}=s(t);n=e,o=r}return Xt(x,[n,o])[0]}multiplyUnsafe(t){const{endo:r}=e,n=this;if(!i.isValid(t))throw new Error("invalid scalar: out of range");if(t===ye||n.is0())return x.ZERO;if(t===pe)return n;if(K.hasCache(this))return this.multiply(t);if(r){const{k1neg:e,k1:i,k2neg:o,k2:s}=m(t),{p1:c,p2:u}=function(t,e,r,n){let i=e,o=t.ZERO,s=t.ZERO;for(;r>Yt||n>Yt;)r&zt&&(o=o.add(i)),n&zt&&(s=s.add(i)),i=i.double(),r>>=zt,n>>=zt;return{p1:o,p2:s}}(x,n,i,s);return B(r.beta,c,u,e,o)}return K.unsafe(n,t)}toAffine(t){return E(this,t)}isTorsionFree(){const{isTorsionFree:t}=e;return s===pe||(t?t(x,this):K.unsafe(this,c).is0())}clearCofactor(){const{clearCofactor:t}=e;return s===pe?this:t?t(x,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(t=!0){return at(t,"isCompressed"),this.assertValidity(),l(x,this,t)}toHex(t=!0){return N(this.toBytes(t))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const k=i.BITS,K=new ie(x,e.endo?Math.ceil(k/2):k);return x.BASE.precompute(8),x}function Ee(t){return Uint8Array.of(t?2:3)}function ve(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function Be(t,e={}){const{Fn:r}=t,n=e.randomBytes||X,i=Object.assign(ve(t.Fp,r),{seed:$t(r.ORDER)});function o(t=n(i.seed)){return function(t,e,r=!1){C(t);const n=t.length,i=_t(e),o=$t(e);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);const s=It(r?yt(t):ht(t),e-xt)+xt;return r?wt(s,i):pt(s,i)}(C(t,i.seed,"seed"),r.ORDER)}function s(e,n=!0){return t.BASE.multiply(r.fromBytes(e)).toBytes(n)}function c(t){const{secretKey:e,publicKey:n,publicKeyUncompressed:o}=i;if(!R(t))return;if("_lengths"in r&&r._lengths||e===n)return;const s=C(t,void 0,"key").length;return s===n||s===o}const u={isValidSecretKey:function(t){try{const e=r.fromBytes(t);return r.isValidNot0(e)}catch(t){return!1}},isValidPublicKey:function(e,r){const{publicKey:n,publicKeyUncompressed:o}=i;try{const i=e.length;return(!0!==r||i===n)&&((!1!==r||i===o)&&!!t.fromBytes(e))}catch(t){return!1}},randomSecretKey:o},a=function(t,e){return function(r){const n=t(r);return{secretKey:n,publicKey:e(n)}}}(o,s);return Object.freeze({getPublicKey:s,getSharedSecret:function(e,n,i=!0){if(!0===c(e))throw new Error("first arg must be private key");if(!1===c(n))throw new Error("second arg must be public key");const o=r.fromBytes(e);return t.fromBytes(n).multiply(o).toBytes(i)},keygen:a,Point:t,utils:u,lengths:i})}function xe(t,e,r={}){I(e),Et(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=(r=Object.assign({},r)).randomBytes||X,i=r.hmac||((t,r)=>ce(e,t,r)),{Fp:o,Fn:s}=t,{ORDER:c,BITS:u}=s,{keygen:a,getPublicKey:f,getSharedSecret:l,utils:d,lengths:h}=Be(t,r),y={prehash:!0,lowS:"boolean"!=typeof r.lowS||r.lowS,format:"compact",extraEntropy:!1},p=c*we<o.ORDER;function w(t){return t>c>>pe}function g(t,e){if(!s.isValidNot0(e))throw new Error(`invalid signature ${t}: out of range 1..Point.Fn.ORDER`);return e}function b(){if(p)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function m(t,e){fe(e);const r=h.signature;return C(t,"compact"===e?r:"recovered"===e?r+1:void 0)}class E{r;s;recovery;constructor(t,e,r){if(this.r=g("r",t),this.s=g("s",e),null!=r){if(b(),![0,1,2,3].includes(r))throw new Error("invalid recovery id");this.recovery=r}Object.freeze(this)}static fromBytes(t,e=y.format){let r;if(m(t,e),"der"===e){const{r:e,s:r}=he.toSig(C(t));return new E(e,r)}"recovered"===e&&(r=t[0],e="compact",t=t.subarray(1));const n=h.signature/2,i=t.subarray(0,n),o=t.subarray(n,2*n);return new E(s.fromBytes(i),s.fromBytes(o),r)}static fromHex(t,e){return this.fromBytes(Y(t),e)}assertRecovery(){const{recovery:t}=this;if(null==t)throw new Error("invalid recovery id: must be present");return t}addRecoveryBit(t){return new E(this.r,this.s,t)}recoverPublicKey(e){const{r:r,s:n}=this,i=this.assertRecovery(),u=2===i||3===i?r+c:r;if(!o.isValid(u))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const a=o.toBytes(u),f=t.fromBytes(z(Ee(!(1&i)),a)),l=s.inv(u),d=B(C(e,void 0,"msgHash")),h=s.create(-d*l),y=s.create(n*l),p=t.BASE.multiplyUnsafe(h).add(f.multiplyUnsafe(y));if(p.is0())throw new Error("invalid recovery: point at infinify");return p.assertValidity(),p}hasHighS(){return w(this.s)}toBytes(t=y.format){if(fe(t),"der"===t)return Y(he.hexFromSig(this));const{r:e,s:r}=this,n=s.toBytes(e),i=s.toBytes(r);return"recovered"===t?(b(),z(Uint8Array.of(this.assertRecovery()),n,i)):z(n,i)}toHex(t){return N(this.toBytes(t))}}const v=r.bits2int||function(t){if(t.length>8192)throw new Error("input is too large");const e=ht(t),r=8*t.length-u;return r>0?e>>BigInt(r):e},B=r.bits2int_modN||function(t){return s.create(v(t))},x=mt(u);function k(t){return bt("num < 2^"+u,t,ye,x),s.toBytes(t)}function K(t,r){return C(t,void 0,"message"),r?C(e(t),void 0,"prehashed message"):t}return Object.freeze({keygen:a,getPublicKey:f,getSharedSecret:l,utils:d,lengths:h,Point:t,sign:function(r,o,c={}){const{seed:u,k2sig:a}=function(e,r,i){const{lowS:o,prehash:c,extraEntropy:u}=le(i,y);e=K(e,c);const a=B(e),f=s.fromBytes(r);if(!s.isValidNot0(f))throw new Error("invalid private key");const l=[k(f),k(a)];if(null!=u&&!1!==u){const t=!0===u?n(h.secretKey):u;l.push(C(t,void 0,"extraEntropy"))}const d=z(...l),g=a;return{seed:d,k2sig:function(e){const r=v(e);if(!s.isValidNot0(r))return;const n=s.inv(r),i=t.BASE.multiply(r).toAffine(),c=s.create(i.x);if(c===ye)return;const u=s.create(n*s.create(g+c*f));if(u===ye)return;let a=(i.x===c?0:2)|Number(i.y&pe),l=u;return o&&w(u)&&(l=s.neg(u),a^=1),new E(c,l,p?void 0:a)}}}(r,o,c);return function(t,e,r){if(S(t,"hashLen"),S(e,"qByteLen"),"function"!=typeof r)throw new Error("hmacFn must be a function");const n=t=>new Uint8Array(t),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1);let c=n(t),u=n(t),a=0;const f=()=>{c.fill(1),u.fill(0),a=0},l=(...t)=>r(u,z(c,...t)),d=(t=i)=>{u=l(o,t),c=l(),0!==t.length&&(u=l(s,t),c=l())},h=()=>{if(a++>=1e3)throw new Error("drbg: tried max amount of iterations");let t=0;const r=[];for(;t<e;){c=l();const e=c.slice();r.push(e),t+=c.length}return z(...r)};return(t,e)=>{let r;for(f(),d(t);!(r=e(h()));)d();return f(),r}}(e.outputLen,s.BYTES,i)(u,a).toBytes(c.format)},verify:function(e,r,n,i={}){const{lowS:o,prehash:c,format:u}=le(i,y);if(n=C(n,void 0,"publicKey"),r=K(r,c),!R(e)){throw new Error("verify expects Uint8Array signature"+(e instanceof E?", use sig.toBytes()":""))}m(e,u);try{const i=E.fromBytes(e,u),c=t.fromBytes(n);if(o&&i.hasHighS())return!1;const{r:a,s:f}=i,l=B(r),d=s.inv(f),h=s.create(l*d),y=s.create(a*d),p=t.BASE.multiplyUnsafe(h).add(c.multiplyUnsafe(y));if(p.is0())return!1;return s.create(p.x)===a}catch(t){return!1}},recoverPublicKey:function(t,e,r={}){const{prehash:n}=le(r,y);return e=K(e,n),E.fromBytes(t,"recovered").recoverPublicKey(e).toBytes()},Signature:E,hash:e})}
17
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ke={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Ke={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Ae=BigInt(2);const Ue=Dt(ke.p,{sqrt:function(t){const e=ke.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),c=BigInt(44),u=BigInt(88),a=t*t*t%e,f=a*a*t%e,l=Ht(f,r,e)*f%e,d=Ht(l,r,e)*f%e,h=Ht(d,Ae,e)*a%e,y=Ht(h,i,e)*h%e,p=Ht(y,o,e)*y%e,w=Ht(p,c,e)*p%e,g=Ht(w,u,e)*w%e,b=Ht(g,c,e)*p%e,m=Ht(b,r,e)*f%e,E=Ht(m,s,e)*y%e,v=Ht(E,n,e)*a%e,B=Ht(v,Ae,e);if(!Ue.eql(Ue.sqr(B),t))throw new Error("Cannot find square root");return B}}),Oe=xe(me(ke,{Fp:Ue,endo:Ke}),st);class Re{constructor(t){this.ec={...Oe},null!=t.priv&&(this.priv=t.priv),null!=t.pub&&(this.pub=t.pub)}static hexToBytes(t){if("string"!=typeof t)throw new Error("hex string expected");if(t.length%2)throw new Error("hex string must have even length");const e=t.length/2,r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=parseInt(t.substr(2*n,2),16);return r}static bytesToHex(t){return Array.from(t||[]).map(t=>t.toString(16).padStart(2,"0")).join("")}static keyFromPublic(t,e="hex"){const r="hex"===e?Re.hexToBytes(t):t;return new Re({pub:r})}getPublic(t=!0,e="hex"){this.pub||(this.pub=this.ec.getPublicKey(this.priv,!1));let r=this.pub;const n=this.ec.Point.fromHex(Re.bytesToHex(r)).toHex(t);return r=Re.hexToBytes(n),"hex"===e?Re.bytesToHex(r):r}}
18
+ /*!
19
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
20
+ */const Se=new Map([[w,{secret:new Uint8Array([48,103,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,77,48,75,2,1,1,4,32]),public:new Uint8Array([161,36,3,34,0])}],[g,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,109,48,107,2,1,1,4,48]),public:new Uint8Array([161,52,3,50,0])}],[b,{secret:new Uint8Array([48,129,170,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,129,146,48,129,143,2,1,1,4,66]),public:new Uint8Array([161,70,3,68,0])}],[m,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,4,109,48,107,2,1,1,4,32]),public:new Uint8Array([161,68,3,66,0])}]]),Ce=new Map([[w,new Uint8Array([48,57,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,34,0])],[g,new Uint8Array([48,70,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,3,50,0])],[b,new Uint8Array([48,88,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,3,68,0])],[m,new Uint8Array([48,86,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,3,66,0])]]);function Ie(t){return Uint8Array.from(Re.keyFromPublic(t,"bytes").getPublic(!1,"array"))}async function He({id:t,controller:r,secretKeyMultibase:o,publicKeyMultibase:s,keyAgreement:u=!1}){if(!s)throw new TypeError('The "publicKeyMultibase" property is required.');const a={id:t,controller:r};if(!s||"string"!=typeof s||s[0]!==c)throw new TypeError('"publicKeyMultibase" must be a multibase, base58-encoded string.');const f=e(s.slice(1)),l={name:u?"ECDH":n,namedCurve:A({publicMultikey:f})},d=function({publicMultikey:t}){const e=A({publicMultikey:t});let r=t.subarray(2);e===m&&(r=Ie(r));return function({curve:t,publicKey:e}){const r=Ce.get(t),n=new Uint8Array(r.length+e.length);let i=0;return n.set(r,i),i+=r.length,n.set(e,i),n}
21
+ /*!
22
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
23
+ */({curve:e,publicKey:r})}({publicMultikey:f}),h=u?[]:["verify"];if(l.namedCurve===m){const{Crypto:t}=await import("./webcrypto.es-FKUHCUj--gGk5JRJH.js"),e=new t;a.publicKey=await e.subtle.importKey("spki",d,l,i,h)}else a.publicKey=await x.subtle.importKey("spki",d,l,i,h);if(o){if("string"!=typeof o||o[0]!==c)throw new TypeError('"secretKeyMultibase" must be a multibase, base58-encoded string.');const t=e(o.slice(1));!function({secretMultikey:t,publicMultikey:e}){const r=A({publicMultikey:e}),n=U({secretMultikey:t});if(r!==n)throw new Error(`Public key curve ('${r}') does not match secret key curve ('${n}').`)}({secretMultikey:t,publicMultikey:f});const r=function({secretMultikey:t,publicMultikey:e}){const r=U({secretMultikey:t}),n=t.subarray(2),i=e.subarray(2);return function({curve:t,secretKey:e,publicKey:r}){const n=Se.get(t);if(!n)throw new Error(`Unsupported curve "${t}".`);t===m&&(r=Ie(r));const i=new Uint8Array(n.secret.length+e.length+n.public.length+r.length);let o=0;return i.set(n.secret,o),o+=n.secret.length,i.set(e,o),o+=e.length,i.set(n.public,o),o+=n.public.length,i.set(r,o),i}({curve:r,secretKey:n,publicKey:i})}({secretMultikey:t,publicMultikey:f}),n=u?["deriveBits"]:["sign"];if(l.namedCurve===m){const{Crypto:t}=await import("./webcrypto.es-FKUHCUj--gGk5JRJH.js"),e=new t;a.secretKey=await e.subtle.importKey("pkcs8",r,l,i,n)}else a.secretKey=await x.subtle.importKey("pkcs8",r,l,i,n)}return a}function je({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:r}=e,n=O({curve:r}),i=t(e.x),o=t(e.y),s=new Uint8Array(n+1),c=o[o.length-1]%2==0;return s[0]=c?2:3,s.set(i,s.length-i.length),s}function qe({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:n}=e,i=O({curve:n}),o=t(e.x),s=t(e.y),d=new Uint8Array(2+(i+1));!function({curve:t,buffer:e}){if(t===w)e[0]=a[0],e[1]=a[1];else if(t===g)e[0]=f[0],e[1]=f[1];else if(t===b)e[0]=l[0],e[1]=l[1];else{if(t!==m)throw new TypeError(`Unsupported curve "${t}".`);e[0]=u[0],e[1]=u[1]}}({curve:n,buffer:d});const h=s[s.length-1]%2==0;d[2]=h?2:3,d.set(o,d.length-o.length);return c+r(d)}function Fe({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:n}=e,i=O({curve:n}),o=t(e.d),s=new Uint8Array(2+i);!function({curve:t,buffer:e}){if(t===w)e[0]=h[0],e[1]=h[1];else if(t===g)e[0]=y[0],e[1]=y[1];else if(t===b)e[0]=p[0],e[1]=p[1];else{if(t!==m)throw new TypeError(`Unsupported curve "${t}".`);e[0]=d[0],e[1]=d[1]}}({curve:e.crv,buffer:s}),s.set(o,s.length-o.length);return c+r(s)}const Me=new Set(["EcdsaSecp256r1VerificationKey2019","EcdsaSecp384r1VerificationKey2019","EcdsaSecp521r1VerificationKey2019","EcdsaSecp256k1VerificationKey2019"]);async function Le({keyPair:t}){if(!Me.has(t.type))throw new TypeError(`Unsupported key type "${t.type}".`);if(t["@context"]||(t["@context"]=o),!function({document:t,contextUrl:e}){const r=t["@context"];return r===e||Array.isArray(r)&&r.includes(e)}
24
+ /*!
25
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
26
+ */({document:t,contextUrl:o}))throw new TypeError(`Context not supported "${t["@context"]}".`);return{"@context":s,id:t.id,type:"Multikey",controller:t.controller,publicKeyMultibase:t.publicKeyMultibase,secretKeyMultibase:t.secretKeyMultibase}}async function Ne(t,e={}){"boolean"==typeof e&&(e={keyAgreement:e});const{keyAgreement:r}=e;let n={...t};if("Multikey"!==n.type){if(n.publicKeyJwk)return async function({jwk:t,secretKey:e=!1}={}){const r={"@context":s,type:"Multikey",publicKeyMultibase:qe({jwk:t})};e&&t.d&&(r.secretKeyMultibase=Fe({jwk:t}));const n=!t.key_ops||t.key_ops.includes("deriveBits");return Ne(r,n)}({jwk:n.publicKeyJwk,secretKey:!1});if(n.type)return n=await Le({keyPair:n}),Pe({keyPair:n,keyAgreement:r})}return n.type||(n.type="Multikey"),n["@context"]||(n["@context"]=s),n.controller&&!n.id&&(n.id=`${t.controller}#${t.publicKeyMultibase}`),function(t){if(!t||"object"!=typeof t)throw new TypeError('"key" must be an object.');if("Multikey"!==t.type)throw new TypeError('"key" must be a Multikey with type "Multikey".');if(!(t["@context"]===s||Array.isArray(t["@context"])&&t["@context"].includes(s)))throw new TypeError(`"key" must be a Multikey with context "${s}".`)}(n),Pe({keyPair:n,keyAgreement:r})}async function Te({keyPair:t,secretKey:e=!1}={}){t?.publicKey instanceof k||(t=await He(t));const r=e&&!!t.secretKey?t.secretKey:t.publicKey;let n;if(t.publicKey.algorithm.namedCurve===m){const{Crypto:t}=await import("./webcrypto.es-FKUHCUj--gGk5JRJH.js"),e=new t;n=await e.subtle.exportKey("jwk",r)}else n=await x.subtle.exportKey("jwk",r);return n}async function Pe({keyPair:e,keyAgreement:r=!1}){e?.publicKey instanceof k||e.publicKey?.algorithm.namedCurve===m||(e=await He(e));const i=async({publicKey:r=!0,secretKey:n=!1,includeContext:i=!0,raw:o=!1}={})=>{if(o){const i=await Te({keyPair:e,secretKey:n}),o={};return r&&(o.publicKey=je({jwk:i})),n&&(o.secretKey=function({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:r}=e,n=O({curve:r}),i=t(e.d),o=new Uint8Array(n);return o.set(i,o.length-i.length),o}({jwk:i})),o}return async function({keyPair:t,secretKey:e,publicKey:r,includeContext:n}={}){if(!r&&!e)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const i=e&&!!t.secretKey,o=i?t.secretKey:t.publicKey;let c;if(o.algorithm.namedCurve===m){const{Crypto:t}=await import("./webcrypto.es-FKUHCUj--gGk5JRJH.js"),e=new t;c=await e.subtle.exportKey("jwk",o)}else c=await x.subtle.exportKey("jwk",o);const u={};return n&&(u["@context"]=s),u.id=t.id,u.type="Multikey",u.controller=t.controller,r&&(u.publicKeyMultibase=qe({jwk:c})),i&&(u.secretKeyMultibase=Fe({jwk:c})),u}({keyPair:e,publicKey:r,secretKey:n,includeContext:i})},{publicKeyMultibase:o,secretKeyMultibase:c}=await i({publicKey:!0,secretKey:!0,includeContext:!0});return e={...e,publicKeyMultibase:o,secretKeyMultibase:c,keyAgreement:r,export:i,signer(){const{id:t,secretKey:r}=e;
27
+ /*!
28
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
29
+ */
30
+ return function({id:t,secretKey:e}){if(!e)throw new Error('"secretKey" is required for signing.');const{namedCurve:r}=e.algorithm,i={name:n,hash:{name:K({curve:r})}};return{algorithm:r,id:t,async sign({data:t}={}){if(r===m){const{Crypto:r}=await import("./webcrypto.es-FKUHCUj--gGk5JRJH.js"),n=new r;return new Uint8Array(await n.subtle.sign(i,e,t))}return new Uint8Array(await x.subtle.sign(i,e,t))}}}({id:t,secretKey:r})},verifier(){const{id:t,publicKey:r}=e;return function({id:t,publicKey:e}){if(!e)throw new Error('"publicKey" is required for verifying.');const{namedCurve:r}=e.algorithm,i={name:n,hash:{name:K({curve:r})}};return{algorithm:r,id:t,async verify({data:t,signature:n}={}){if(r===m){const{Crypto:r}=await import("./webcrypto.es-FKUHCUj--gGk5JRJH.js");return(new r).subtle.verify(i,e,n,t)}return x.subtle.verify(i,e,n,t)}}}({id:t,publicKey:r})},async deriveSecret({publicKey:t,remotePublicKey:r}={}){if(r&&t)throw new Error('Only one of "remotePublicKey" and "publicKey" must be given.');if(!e.keyAgreement){const t=Error('"keyAgreement" is not supported by this keypair.');throw t.name="NotSupportedError",t}return async function({localKeyPair:t,remoteKeyPair:e}){if(!t.secretKey){const t=Error('"secretKey" required to derive secret.');throw t.name="NotSupportedError",t}t=await He({...t,keyAgreement:!0}),e=await He({...e,keyAgreement:!0});const{namedCurve:r}=t.secretKey.algorithm,n=O({curve:r});if(r===m){const{Crypto:i}=await import("./webcrypto.es-FKUHCUj--gGk5JRJH.js"),o=new i,s=await o.subtle.deriveBits({name:"ECDH",namedCurve:r,public:e.publicKey},t.secretKey,8*n);return new Uint8Array(s,0,n)}const i=await x.subtle.deriveBits({name:"ECDH",namedCurve:r,public:e.publicKey},t.secretKey,8*n);return new Uint8Array(i,0,n)}({localKeyPair:this,remoteKeyPair:r||t})}}}export{je as a,Ne as f,Te as t};