@blockcerts/blockcerts-verifier 1.74.0 → 1.75.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 (40) hide show
  1. package/bundle-stats.html +1 -1
  2. package/coverage/lcov.info +102 -102
  3. package/dist/Bbs2023-Bp5cEh1R-CyaAsSfy.js +64 -0
  4. package/dist/{DataIntegrityProof-DRK-bLb_-CItV0ZXY.js → DataIntegrityProof-C6eNcfZD-DxdoQnVI.js} +1 -1
  5. package/dist/EcdsaSd2023-DZZuYYEc-CWUg-wCj.js +14 -0
  6. package/dist/{EcdsaSecp256k1Signature2019-rfxWS2XE-C73WHAtH.js → EcdsaSecp256k1Signature2019-DhXTmkRz-BDI0F5k3.js} +1 -1
  7. package/dist/{Ed25519Signature2020-CDbX0d2Z-Dc1L-exZ.js → Ed25519Signature2020-DQ74b0xi-mZPb25zD.js} +1 -1
  8. package/dist/{EddsaRdfc2022-Do0HFpDb-BcV_n8Fk.js → EddsaRdfc2022-DoIsbQDP-CdTbCYWu.js} +4 -4
  9. package/dist/MerkleProof2017-DjEiaTFN-DYmuOUac.js +1 -0
  10. package/dist/MerkleProof2019-eet_uSL0-DMgMKE-N.js +5 -0
  11. package/dist/{checkBitStringStatusList-CKk6xxUL-D99R7EXK.js → checkBitStringStatusList-imqRJLbC-BxFzQ5zP.js} +1 -1
  12. package/dist/checkCredentialSchemaConformity-drHrI5ZX-D8a64oBH.js +1 -0
  13. package/dist/{controlVerificationMethod-Blm4pE1t-BYBRLxNP.js → controlVerificationMethod-yDdxMt7K-CmPWOLBp.js} +1 -1
  14. package/dist/decode-BvGwOAqu-BaxzowN_.js +13 -0
  15. package/dist/ensureValidIssuingKey-BBsblYif-DXO_G6MC.js +1 -0
  16. package/dist/{index-C4ZZHHRx-BOdwDnYa.js → index-B5gC_Ed--DC3Wd_3X.js} +4 -4
  17. package/dist/{index-BNsIYV4r-BnYxKy2f.js → index-BALRZPPb-BXRdR9Sh.js} +2 -2
  18. package/dist/{index-CVS5Gn9h-DNgvq6Wk.js → index-D8xF_f-v-BlsVgJYJ.js} +1 -1
  19. package/dist/{index-D2bS6rRi-D_ppNIsb.js → index-Dab3X91f-dKXR6RU7.js} +4 -4
  20. package/dist/index-cqs5icUJ-DWIE-ahU.js +23 -0
  21. package/dist/{jsonld-signatures-BJXipuab-CB799Kkm.js → jsonld-signatures-B0DqrrUT-B4B7KZ3F.js} +2 -2
  22. package/dist/main.js +114 -114
  23. package/dist/{retrieveVerificationMethodPublicKey-CT9YA_Wr-Djl8Ri41.js → retrieveVerificationMethodPublicKey-B-kSksW4-OGh7Cdla.js} +1 -1
  24. package/dist/sha2-CJXzPerd-BVhQN7q7.js +1 -0
  25. package/dist/verifyIssuerProfile-Bn2qjtLO-CctriaZ1.js +1 -0
  26. package/dist/weierstrass-qx_4bPUU-BwaVz9Sr.js +5 -0
  27. package/package.json +2 -2
  28. package/dist/EcdsaSd2023-CdilbQE4-BlaeM9K_.js +0 -26
  29. package/dist/MerkleProof2017-5uQFQKSe-dtmePIpg.js +0 -1
  30. package/dist/MerkleProof2019-DraC60XD-B9XV8wNx.js +0 -5
  31. package/dist/checkCredentialSchemaConformity-U2NlIuJZ-swOY09NS.js +0 -1
  32. package/dist/ensureValidIssuingKey-D7OT4D35--HN0afRq.js +0 -1
  33. package/dist/index-Dr7MpiEc-D5LHgMik.js +0 -30
  34. package/dist/verifyIssuerProfile-BG-odQrl-0JjZhiiC.js +0 -1
  35. /package/dist/{HashlinkVerifier-Cdnza1Dw-A9htzw7A.js → HashlinkVerifier-CLOBeWTC-A9htzw7A.js} +0 -0
  36. /package/dist/{ensureNotRevoked-DrQAPfcJ-BheL-ZKZ.js → ensureNotRevoked-DkeMWyFL-BheL-ZKZ.js} +0 -0
  37. /package/dist/{index-uKBVup0_-Dh4-8Ruv.js → index-DBwScGKb-Dh4-8Ruv.js} +0 -0
  38. /package/dist/{index-yOIIz7AL-Dgus2xdV.js → index-DLhZKDC_-Dgus2xdV.js} +0 -0
  39. /package/dist/{jsonld-DOUjwF6J-dtl20tiV.js → jsonld-BHLXlZBJ-dtl20tiV.js} +0 -0
  40. /package/dist/{webcrypto.es-FKUHCUj--gGk5JRJH.js → webcrypto.es-D4KX-5fg-gGk5JRJH.js} +0 -0
@@ -0,0 +1,13 @@
1
+ import{r as n}from"./DataIntegrityProof-C6eNcfZD-DxdoQnVI.js";import{j as e}from"./jsonld-BHLXlZBJ-dtl20tiV.js";
2
+ /*!
3
+ * Copyright (c) 2023-2026 Digital Bazaar, Inc.
4
+ */const t=globalThis.crypto;function r({algorithm:n="sha256"}={}){if("sha256"!==n)throw new Error(`Unsupported algorithm "${n}".`);return{hash:async n=>new Uint8Array(await t.subtle.digest("SHA-256",n))}}
5
+ /*!
6
+ * Copyright (c) 2023-2026 Digital Bazaar, Inc.
7
+ */const o=new TextEncoder;function i(n){return o.encode(n)}
8
+ /*!
9
+ * Copyright (c) 2023-2026 Digital Bazaar, Inc.
10
+ */async function a({document:n,labelMapFactoryFunction:e,options:t}={}){const{nquads:r}=await async function({document:n,nquads:e,labelMapFactoryFunction:t,options:r}={}){let o,i=new Map;o=n?await s(n,{...r,canonicalIdMap:i}):await s(e.join(""),{...r,inputFormat:"application/n-quads",canonicalIdMap:i});i=function(n){let e=!1,t=!1,r=!1;const o=new Map;for(const[i,a]of n){if(!e&&(e=!0,t=i.startsWith("_:"),r=a.startsWith("_:"),!t&&!r))return n;o.set(t?i.slice(2):i,r?a.slice(2):a)}return o}(i);const a=await t({canonicalIdMap:i}),u=new Map;for(const[n,e]of a)u.set(i.get(n),e);const c=(n,e,t)=>"_:"+u.get(t);return{nquads:o.split("\n").slice(0,-1).map(n=>n.replace(/(_:([^\s]+))/g,c)+"\n").sort(),labelMap:a}}
11
+ /*!
12
+ * Copyright (c) 2023-2026 Digital Bazaar, Inc.
13
+ */({document:n,labelMapFactoryFunction:e,options:t});return r}function u({labelMap:n}={}){return async({canonicalIdMap:e})=>{const t=new Map;for(const[r,o]of e)t.set(r,n.get(o));return t}}async function s(t,r){if(!r||"object"!=typeof r)throw new TypeError('"options" must be an object.');if(r={algorithm:"RDFC-1.0",format:"application/n-quads",base:null,safe:!0,...r},"string"!=typeof t){const n={rdfDirection:"i18n-datatype",...r,produceGeneralizedRdf:!1};delete n.format,t=await e.toRDF(t,n)}return n.canonize(t,r)}async function c({document:n,proof:e,options:t,hasher:o}={}){o||(o=r());const a=await async function({document:n,proof:e,options:t}={}){return delete(e={"@context":n["@context"],...e}).proofValue,s(e,t)}({document:n,proof:e,options:t});return o.hash(i(a))}async function f({mandatory:n,hasher:e}={}){e||(e=r());return{mandatoryHash:await e.hash(i(n.join("")))}}const l=["string","number","bigint","symbol"],d=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function p(n){if(null===n)return"null";if(void 0===n)return"undefined";if(!0===n||!1===n)return"boolean";const e=typeof n;if(l.includes(e))return e;if("function"===e)return"Function";if(Array.isArray(n))return"Array";if(function(n){return n&&n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer.call(null,n)}(n))return"Buffer";const t=function(n){const e=Object.prototype.toString.call(n).slice(8,-1);if(d.includes(e))return e;return}(n);return t||"Object"}class w{constructor(n,e,t){this.major=n,this.majorEncoded=n<<5,this.name=e,this.terminal=t}toString(){return`Type[${this.major}].${this.name}`}compare(n){return this.major<n.major?-1:this.major>n.major?1:0}}w.uint=new w(0,"uint",!0),w.negint=new w(1,"negint",!0),w.bytes=new w(2,"bytes",!0),w.string=new w(3,"string",!0),w.array=new w(4,"array",!1),w.map=new w(5,"map",!1),w.tag=new w(6,"tag",!1),w.float=new w(7,"float",!0),w.false=new w(7,"false",!0),w.true=new w(7,"true",!0),w.null=new w(7,"null",!0),w.undefined=new w(7,"undefined",!0),w.break=new w(7,"break",!0);class h{constructor(n,e,t){this.type=n,this.value=e,this.encodedLength=t,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}const g=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&"function"==typeof globalThis.Buffer.isBuffer,y=new TextDecoder,m=new TextEncoder;function b(n){return g&&globalThis.Buffer.isBuffer(n)}const E=g?(n,e,t)=>t-e>64?globalThis.Buffer.from(n.subarray(e,t)).toString("utf8"):k(n,e,t):(n,e,t)=>t-e>64?y.decode(n.subarray(e,t)):k(n,e,t),$=g?n=>n.length>64?globalThis.Buffer.from(n):B(n):n=>n.length>64?m.encode(n):B(n),v=g?(n,e,t)=>b(n)?new Uint8Array(n.subarray(e,t)):n.slice(e,t):(n,e,t)=>n.slice(e,t);function B(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let o=n.charCodeAt(r);o<128?e[t++]=o:o<2048?(e[t++]=o>>6|192,e[t++]=63&o|128):55296==(64512&o)&&r+1<n.length&&56320==(64512&n.charCodeAt(r+1))?(o=65536+((1023&o)<<10)+(1023&n.charCodeAt(++r)),e[t++]=o>>18|240,e[t++]=o>>12&63|128,e[t++]=o>>6&63|128,e[t++]=63&o|128):(e[t++]=o>>12|224,e[t++]=o>>6&63|128,e[t++]=63&o|128)}return e}function k(n,e,t){const r=[];for(;e<t;){const o=n[e];let i=null,a=o>239?4:o>223?3:o>191?2:1;if(e+a<=t){let t,r,u,s;switch(a){case 1:o<128&&(i=o);break;case 2:t=n[e+1],128==(192&t)&&(s=(31&o)<<6|63&t,s>127&&(i=s));break;case 3:t=n[e+1],r=n[e+2],128==(192&t)&&128==(192&r)&&(s=(15&o)<<12|(63&t)<<6|63&r,s>2047&&(s<55296||s>57343)&&(i=s));break;case 4:t=n[e+1],r=n[e+2],u=n[e+3],128==(192&t)&&128==(192&r)&&128==(192&u)&&(s=(15&o)<<18|(63&t)<<12|(63&r)<<6|63&u,s>65535&&s<1114112&&(i=s))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),e+=a}return function(n){const e=n.length;if(e<=j)return String.fromCharCode.apply(String,n);let t="",r=0;for(;r<e;)t+=String.fromCharCode.apply(String,n.slice(r,r+=j));return t}(r)}const j=4096;const A="CBOR decode error:",I="CBOR encode error:";function N(n,e,t){if(n.length-e<t)throw new Error(`${A} not enough data for type`)}const S=[24,256,65536,4294967296,BigInt("18446744073709551616")];function T(n,e,t){N(n,e,1);const r=n[e];if(!0===t.strict&&r<S[0])throw new Error(`${A} integer encoded in more bytes than necessary (strict decode)`);return r}function U(n,e,t){N(n,e,2);const r=n[e]<<8|n[e+1];if(!0===t.strict&&r<S[1])throw new Error(`${A} integer encoded in more bytes than necessary (strict decode)`);return r}function F(n,e,t){N(n,e,4);const r=16777216*n[e]+(n[e+1]<<16)+(n[e+2]<<8)+n[e+3];if(!0===t.strict&&r<S[2])throw new Error(`${A} integer encoded in more bytes than necessary (strict decode)`);return r}function M(n,e,t){N(n,e,8);const r=16777216*n[e]+(n[e+1]<<16)+(n[e+2]<<8)+n[e+3],o=16777216*n[e+4]+(n[e+5]<<16)+(n[e+6]<<8)+n[e+7],i=(BigInt(r)<<BigInt(32))+BigInt(o);if(!0===t.strict&&i<S[3])throw new Error(`${A} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(!0===t.allowBigInt)return i;throw new Error(`${A} integers outside of the safe integer range are not supported`)}function z(n,e){return x(n,0,e.value)}function x(n,e,t){if(t<S[0]){const r=Number(t);n.push([e|r])}else if(t<S[1]){const r=Number(t);n.push([24|e,r])}else if(t<S[2]){const r=Number(t);n.push([25|e,r>>>8,255&r])}else if(t<S[3]){const r=Number(t);n.push([26|e,r>>>24&255,r>>>16&255,r>>>8&255,255&r])}else{const r=BigInt(t);if(!(r<S[4]))throw new Error(`${A} encountered BigInt larger than allowable range`);{const t=[27|e,0,0,0,0,0,0,0];let o=Number(r&BigInt(4294967295)),i=Number(r>>BigInt(32)&BigInt(4294967295));t[8]=255&o,o>>=8,t[7]=255&o,o>>=8,t[6]=255&o,o>>=8,t[5]=255&o,t[4]=255&i,i>>=8,t[3]=255&i,i>>=8,t[2]=255&i,i>>=8,t[1]=255&i,n.push(t)}}}z.encodedSize=function(n){return x.encodedSize(n.value)},x.encodedSize=function(n){return n<S[0]?1:n<S[1]?2:n<S[2]?3:n<S[3]?5:9},z.compareTokens=function(n,e){return n.value<e.value?-1:n.value>e.value?1:0};const C=BigInt(-1),D=BigInt(1);function O(n,e){const t=e.value,r="bigint"==typeof t?t*C-D:-1*t-1;x(n,e.type.majorEncoded,r)}function _(n,e,t,r){N(n,e,t+r);const o=v(n,e+t,e+t+r);return new h(w.bytes,o,t+r)}function R(n,e,t,r){return _(n,e,1,t)}function V(n){return void 0===n.encodedBytes&&(n.encodedBytes=n.type===w.string?$(n.value):n.value),n.encodedBytes}function G(n,e){const t=V(e);x(n,e.type.majorEncoded,t.length),n.push(t)}function L(n,e,t,r,o){const i=t+r;N(n,e,i);const a=new h(w.string,E(n,e+t,e+i),i);return!0===o.retainStringBytes&&(a.byteValue=v(n,e+t,e+i)),a}function q(n,e,t,r){return L(n,e,1,t,r)}O.encodedSize=function(n){const e=n.value,t="bigint"==typeof e?e*C-D:-1*e-1;return t<S[0]?1:t<S[1]?2:t<S[2]?3:t<S[3]?5:9},O.compareTokens=function(n,e){return n.value<e.value?1:n.value>e.value?-1:0},G.encodedSize=function(n){const e=V(n);return x.encodedSize(e.length)+e.length},G.compareTokens=function(n,e){return t=V(n),r=V(e),t.length<r.length?-1:t.length>r.length?1:function(n,e){if(b(n)&&b(e))return n.compare(e);for(let t=0;t<n.length;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}(t,r);var t,r};const H=G;function W(n,e,t,r){return new h(w.array,r,t)}function K(n,e,t,r){return W(0,0,1,t)}function P(n,e){x(n,w.array.majorEncoded,e.value)}function X(n,e,t,r){return new h(w.map,r,t)}function Z(n,e,t,r){return X(0,0,1,t)}function J(n,e){x(n,w.map.majorEncoded,e.value)}function Q(n,e,t,r){return new h(w.tag,t,1)}function Y(n,e){x(n,w.tag.majorEncoded,e.value)}P.compareTokens=z.compareTokens,P.encodedSize=function(n){return x.encodedSize(n.value)},J.compareTokens=z.compareTokens,J.encodedSize=function(n){return x.encodedSize(n.value)},Y.compareTokens=z.compareTokens,Y.encodedSize=function(n){return x.encodedSize(n.value)};function nn(n,e,t){if(t){if(!1===t.allowNaN&&Number.isNaN(n))throw new Error(`${A} NaN values are not supported`);if(!1===t.allowInfinity&&(n===1/0||n===-1/0))throw new Error(`${A} Infinity values are not supported`)}return new h(w.float,n,e)}function en(n,e,t){const r=e.value;if(!1===r)n.push([20|w.float.majorEncoded]);else if(!0===r)n.push([21|w.float.majorEncoded]);else if(null===r)n.push([22|w.float.majorEncoded]);else if(void 0===r)n.push([23|w.float.majorEncoded]);else{let e,i=!1;t&&!0===t.float64||(an(r),e=un(on,1),r===e||Number.isNaN(r)?(on[0]=249,n.push(on.slice(0,3)),i=!0):(sn(r),e=cn(on,1),r===e&&(on[0]=250,n.push(on.slice(0,5)),i=!0))),i||(o=r,rn.setFloat64(0,o,!1),e=fn(on,1),on[0]=251,n.push(on.slice(0,9)))}var o}en.encodedSize=function(n,e){const t=n.value;if(!1===t||!0===t||null==t)return 1;if(!e||!0!==e.float64){an(t);let n=un(on,1);if(t===n||Number.isNaN(t))return 3;if(sn(t),n=cn(on,1),t===n)return 5}return 9};const tn=new ArrayBuffer(9),rn=new DataView(tn,1),on=new Uint8Array(tn,0);function an(n){if(n===1/0)rn.setUint16(0,31744,!1);else if(n===-1/0)rn.setUint16(0,64512,!1);else if(Number.isNaN(n))rn.setUint16(0,32256,!1);else{rn.setFloat32(0,n);const e=rn.getUint32(0),t=(2139095040&e)>>23,r=8388607&e;if(255===t)rn.setUint16(0,31744,!1);else if(0===t)rn.setUint16(0,(2147483648&n)>>16|r>>13,!1);else{const n=t-127;n<-24?rn.setUint16(0,0):n<-14?rn.setUint16(0,(2147483648&e)>>16|1<<24+n,!1):rn.setUint16(0,(2147483648&e)>>16|n+15<<10|r>>13,!1)}}}function un(n,e){if(n.length-e<2)throw new Error(`${A} not enough data for float16`);const t=(n[e]<<8)+n[e+1];if(31744===t)return 1/0;if(64512===t)return-1/0;if(32256===t)return NaN;const r=t>>10&31,o=1023&t;let i;return i=0===r?o*2**-24:31!==r?(o+1024)*2**(r-25):0===o?1/0:NaN,32768&t?-i:i}function sn(n){rn.setFloat32(0,n,!1)}function cn(n,e){if(n.length-e<4)throw new Error(`${A} not enough data for float32`);const t=(n.byteOffset||0)+e;return new DataView(n.buffer,t,4).getFloat32(0,!1)}function fn(n,e){if(n.length-e<8)throw new Error(`${A} not enough data for float64`);const t=(n.byteOffset||0)+e;return new DataView(n.buffer,t,8).getFloat64(0,!1)}function ln(n,e,t){throw new Error(`${A} encountered invalid minor (${t}) for major ${n[e]>>>5}`)}function dn(n){return()=>{throw new Error(`${A} ${n}`)}}en.compareTokens=z.compareTokens;const pn=[];for(let n=0;n<=23;n++)pn[n]=ln;pn[24]=function(n,e,t,r){return new h(w.uint,T(n,e+1,r),2)},pn[25]=function(n,e,t,r){return new h(w.uint,U(n,e+1,r),3)},pn[26]=function(n,e,t,r){return new h(w.uint,F(n,e+1,r),5)},pn[27]=function(n,e,t,r){return new h(w.uint,M(n,e+1,r),9)},pn[28]=ln,pn[29]=ln,pn[30]=ln,pn[31]=ln;for(let n=32;n<=55;n++)pn[n]=ln;pn[56]=function(n,e,t,r){return new h(w.negint,-1-T(n,e+1,r),2)},pn[57]=function(n,e,t,r){return new h(w.negint,-1-U(n,e+1,r),3)},pn[58]=function(n,e,t,r){return new h(w.negint,-1-F(n,e+1,r),5)},pn[59]=function(n,e,t,r){const o=M(n,e+1,r);if("bigint"!=typeof o){const n=-1-o;if(n>=Number.MIN_SAFE_INTEGER)return new h(w.negint,n,9)}if(!0!==r.allowBigInt)throw new Error(`${A} integers outside of the safe integer range are not supported`);return new h(w.negint,C-BigInt(o),9)},pn[60]=ln,pn[61]=ln,pn[62]=ln,pn[63]=ln;for(let n=64;n<=87;n++)pn[n]=R;pn[88]=function(n,e,t,r){return _(n,e,2,T(n,e+1,r))},pn[89]=function(n,e,t,r){return _(n,e,3,U(n,e+1,r))},pn[90]=function(n,e,t,r){return _(n,e,5,F(n,e+1,r))},pn[91]=function(n,e,t,r){const o=M(n,e+1,r);if("bigint"==typeof o)throw new Error(`${A} 64-bit integer bytes lengths not supported`);return _(n,e,9,o)},pn[92]=ln,pn[93]=ln,pn[94]=ln,pn[95]=dn("indefinite length bytes/strings are not supported");for(let n=96;n<=119;n++)pn[n]=q;pn[120]=function(n,e,t,r){return L(n,e,2,T(n,e+1,r),r)},pn[121]=function(n,e,t,r){return L(n,e,3,U(n,e+1,r),r)},pn[122]=function(n,e,t,r){return L(n,e,5,F(n,e+1,r),r)},pn[123]=function(n,e,t,r){const o=M(n,e+1,r);if("bigint"==typeof o)throw new Error(`${A} 64-bit integer string lengths not supported`);return L(n,e,9,o,r)},pn[124]=ln,pn[125]=ln,pn[126]=ln,pn[127]=dn("indefinite length bytes/strings are not supported");for(let n=128;n<=151;n++)pn[n]=K;pn[152]=function(n,e,t,r){return W(0,0,2,T(n,e+1,r))},pn[153]=function(n,e,t,r){return W(0,0,3,U(n,e+1,r))},pn[154]=function(n,e,t,r){return W(0,0,5,F(n,e+1,r))},pn[155]=function(n,e,t,r){const o=M(n,e+1,r);if("bigint"==typeof o)throw new Error(`${A} 64-bit integer array lengths not supported`);return W(0,0,9,o)},pn[156]=ln,pn[157]=ln,pn[158]=ln,pn[159]=function(n,e,t,r){if(!1===r.allowIndefinite)throw new Error(`${A} indefinite length items not allowed`);return W(0,0,1,1/0)};for(let n=160;n<=183;n++)pn[n]=Z;pn[184]=function(n,e,t,r){return X(0,0,2,T(n,e+1,r))},pn[185]=function(n,e,t,r){return X(0,0,3,U(n,e+1,r))},pn[186]=function(n,e,t,r){return X(0,0,5,F(n,e+1,r))},pn[187]=function(n,e,t,r){const o=M(n,e+1,r);if("bigint"==typeof o)throw new Error(`${A} 64-bit integer map lengths not supported`);return X(0,0,9,o)},pn[188]=ln,pn[189]=ln,pn[190]=ln,pn[191]=function(n,e,t,r){if(!1===r.allowIndefinite)throw new Error(`${A} indefinite length items not allowed`);return X(0,0,1,1/0)};for(let n=192;n<=215;n++)pn[n]=Q;pn[216]=function(n,e,t,r){return new h(w.tag,T(n,e+1,r),2)},pn[217]=function(n,e,t,r){return new h(w.tag,U(n,e+1,r),3)},pn[218]=function(n,e,t,r){return new h(w.tag,F(n,e+1,r),5)},pn[219]=function(n,e,t,r){return new h(w.tag,M(n,e+1,r),9)},pn[220]=ln,pn[221]=ln,pn[222]=ln,pn[223]=ln;for(let n=224;n<=243;n++)pn[n]=dn("simple values are not supported");pn[244]=ln,pn[245]=ln,pn[246]=ln,pn[247]=function(n,e,t,r){if(!1===r.allowUndefined)throw new Error(`${A} undefined values are not supported`);return!0===r.coerceUndefinedToNull?new h(w.null,null,1):new h(w.undefined,void 0,1)},pn[248]=dn("simple values are not supported"),pn[249]=function(n,e,t,r){return nn(un(n,e+1),3,r)},pn[250]=function(n,e,t,r){return nn(cn(n,e+1),5,r)},pn[251]=function(n,e,t,r){return nn(fn(n,e+1),9,r)},pn[252]=ln,pn[253]=ln,pn[254]=ln,pn[255]=function(n,e,t,r){if(!1===r.allowIndefinite)throw new Error(`${A} indefinite length items not allowed`);return new h(w.break,void 0,1)};const wn=[];for(let n=0;n<24;n++)wn[n]=new h(w.uint,n,1);for(let n=-1;n>=-24;n--)wn[31-n]=new h(w.negint,n,1);wn[64]=new h(w.bytes,new Uint8Array(0),1),wn[96]=new h(w.string,"",1),wn[128]=new h(w.array,0,1),wn[160]=new h(w.map,0,1),wn[244]=new h(w.false,!1,1),wn[245]=new h(w.true,!0,1),wn[246]=new h(w.null,null,1),function(){const n=[];n[w.uint.major]=z,n[w.negint.major]=O,n[w.bytes.major]=G,n[w.string.major]=H,n[w.array.major]=P,n[w.map.major]=J,n[w.tag.major]=Y,n[w.float.major]=en}();class hn{constructor(n,e){this.obj=n,this.parent=e}includes(n){let e=this;do{if(e.obj===n)return!0}while(e=e.parent);return!1}static createCheck(n,e){if(n&&n.includes(e))throw new Error(`${I} object contains circular references`);return new hn(e,n)}}const gn={null:new h(w.null,null),undefined:new h(w.undefined,void 0),true:new h(w.true,!0),false:new h(w.false,!1),emptyArray:new h(w.array,0),emptyMap:new h(w.map,0)},yn={number:(n,e,t,r)=>Number.isInteger(n)&&Number.isSafeInteger(n)?new h(n>=0?w.uint:w.negint,n):new h(w.float,n),bigint:(n,e,t,r)=>n>=BigInt(0)?new h(w.uint,n):new h(w.negint,n),Uint8Array:(n,e,t,r)=>new h(w.bytes,n),string:(n,e,t,r)=>new h(w.string,n),boolean:(n,e,t,r)=>n?gn.true:gn.false,null:(n,e,t,r)=>gn.null,undefined:(n,e,t,r)=>gn.undefined,ArrayBuffer:(n,e,t,r)=>new h(w.bytes,new Uint8Array(n)),DataView:(n,e,t,r)=>new h(w.bytes,new Uint8Array(n.buffer,n.byteOffset,n.byteLength)),Array(n,e,t,r){if(!n.length)return!0===t.addBreakTokens?[gn.emptyArray,new h(w.break)]:gn.emptyArray;r=hn.createCheck(r,n);const o=[];let i=0;for(const e of n)o[i++]=mn(e,t,r);return t.addBreakTokens?[new h(w.array,n.length),o,new h(w.break)]:[new h(w.array,n.length),o]},Object(n,e,t,r){const o="Object"!==e,i=o?n.keys():Object.keys(n),a=o?n.size:i.length;if(!a)return!0===t.addBreakTokens?[gn.emptyMap,new h(w.break)]:gn.emptyMap;r=hn.createCheck(r,n);const u=[];let s=0;for(const e of i)u[s++]=[mn(e,t,r),mn(o?n.get(e):n[e],t,r)];return function(n,e){e.mapSorter&&n.sort(e.mapSorter)}(u,t),t.addBreakTokens?[new h(w.map,a),u,new h(w.break)]:[new h(w.map,a),u]}};yn.Map=yn.Object,yn.Buffer=yn.Uint8Array;for(const n of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))yn[`${n}Array`]=yn.DataView;function mn(n,e={},t){const r=p(n),o=e&&e.typeEncoders&&e.typeEncoders[r]||yn[r];if("function"==typeof o){const i=o(n,r,e,t);if(null!=i)return i}const i=yn[r];if(!i)throw new Error(`${I} unsupported type: ${r}`);return i(n,r,e,t)}const bn={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0};class En{constructor(n,e={}){this._pos=0,this.data=n,this.options=e}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){const n=this.data[this._pos];let e=wn[n];if(void 0===e){const t=pn[n];if(!t)throw new Error(`${A} no decoder for major type ${n>>>5} (byte 0x${n.toString(16).padStart(2,"0")})`);const r=31&n;e=t(this.data,this._pos,r,this.options)}return this._pos+=e.encodedLength,e}}const $n=Symbol.for("DONE"),vn=Symbol.for("BREAK");function Bn(n,e){if(n.done())return $n;const t=n.next();if(t.type===w.break)return vn;if(t.type.terminal)return t.value;if(t.type===w.array)return function(n,e,t){const r=[];for(let o=0;o<n.value;o++){const i=Bn(e,t);if(i===vn){if(n.value===1/0)break;throw new Error(`${A} got unexpected break to lengthed array`)}if(i===$n)throw new Error(`${A} found array but not enough entries (got ${o}, expected ${n.value})`);r[o]=i}return r}(t,n,e);if(t.type===w.map)return function(n,e,t){const r=!0===t.useMaps,o=r?void 0:{},i=r?new Map:void 0;for(let a=0;a<n.value;a++){const u=Bn(e,t);if(u===vn){if(n.value===1/0)break;throw new Error(`${A} got unexpected break to lengthed map`)}if(u===$n)throw new Error(`${A} found map but not enough entries (got ${a} [no key], expected ${n.value})`);if(!0!==r&&"string"!=typeof u)throw new Error(`${A} non-string keys not supported (got ${typeof u})`);if(!0===t.rejectDuplicateMapKeys&&(r&&i.has(u)||!r&&u in o))throw new Error(`${A} found repeat map key "${u}"`);const s=Bn(e,t);if(s===$n)throw new Error(`${A} found map but not enough entries (got ${a} [no value], expected ${n.value})`);r?i.set(u,s):o[u]=s}return r?i:o}(t,n,e);if(t.type===w.tag){if(e.tags&&"function"==typeof e.tags[t.value]){const r=Bn(n,e);return e.tags[t.value](r)}throw new Error(`${A} tag not supported (${t.value})`)}throw new Error("unsupported")}function kn(n,e){const[t,r]=function(n,e){if(!(n instanceof Uint8Array))throw new Error(`${A} data to decode must be a Uint8Array`);const t=(e=Object.assign({},bn,e)).tokenizer||new En(n,e),r=Bn(t,e);if(r===$n)throw new Error(`${A} did not find any content to decode`);if(r===vn)throw new Error(`${A} got unexpected break`);return[r,n.subarray(t.pos())]}(n,e);if(r.length>0)throw new Error(`${A} too many terminals, data makes no sense`);return t}export{f as a,u as c,kn as d,c as h,a as l,i as s};
@@ -0,0 +1 @@
1
+ import{s as e,V as s,g as r,P as i}from"./main.js";function n(n,o,t){let d="";const a=function(e,s){let r=null;for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&i.toLowerCase()===s.toLowerCase()&&(r=i);return e[r]}(n,o),c=e(t);if(a?(a.created&&c<=a.created&&(d="invalidIssuingAddressCreationTime"),a.revoked&&c>=a.revoked&&(d="invalidIssuingAddressRevoked"),a.expires&&c>=a.expires&&(d="invalidIssuingAddressExpired")):d="invalidIssuingAddressUnknown",d)throw new s("checkAuthenticity",r("errors",d),i.CRYPTOGRAPHIC_SECURITY_ERROR)}export{n as e};
@@ -1,5 +1,5 @@
1
1
  import{v as e,w as t,u as r,f as n}from"./main.js";import{n as i}from"./_polyfill-node.crypto-MVmI5M_M-exGcp6nW.js";
2
- /*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */const o=BigInt(0),s=BigInt(1),c=BigInt(2),a=BigInt(8),f=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),u=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:f,n:f,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),l=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),y=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");const d=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),w=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),p=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),h=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class b{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof k))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(k.ZERO)?b.ZERO:new b(e.x,e.y,s,j(e.x*e.y))}static toAffineBatch(e){const t=function(e,t=u.P){const r=new Array(e.length),n=_(e.reduce((e,n,i)=>n===o?e:(r[i]=e,j(e*n,t)),s),t);return e.reduceRight((e,n,i)=>n===o?e:(r[i]=j(e*r[i],t),j(e*n,t)),n),r}(e.map(e=>e.z));return e.map((e,r)=>e.toAffine(t[r]))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){m(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e,c=j(t*s),a=j(i*n),f=j(r*s),u=j(o*n);return c===a&&f===u}negate(){return new b(j(-this.x),this.y,this.z,j(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:n}=u,i=j(e*e),o=j(t*t),s=j(c*j(r*r)),a=j(n*i),f=e+t,l=j(j(f*f)-i-o),y=a+o,d=y-s,w=a-o,p=j(l*d),h=j(y*w),g=j(l*w),m=j(d*y);return new b(p,h,m,g)}add(e){m(e);const{x:t,y:r,z:n,t:i}=this,{x:s,y:a,z:f,t:u}=e,l=j((r-t)*(a+s)),y=j((r+t)*(a-s)),d=j(y-l);if(d===o)return this.double();const w=j(n*c*u),p=j(i*c*f),h=p+w,g=y+l,x=p-w,E=j(h*d),K=j(g*x),B=j(h*x),k=j(d*g);return new b(E,K,k,B)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(b.BASE)&&(t=k.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&B.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=b.normalizeZ(n),B.set(t,n)));let i=b.ZERO,o=b.BASE;const c=1+256/r,a=2**(r-1),f=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let t=0;t<c;t++){const r=t*a;let c=Number(e&f);e>>=l,c>a&&(c-=u,e+=s);const y=r,d=r+Math.abs(c)-1,w=t%2!=0,p=c<0;0===c?o=o.add(g(w,n[y])):i=i.add(g(p,n[d]))}return b.normalizeZ([i,o])[0]}multiply(e,t){return this.wNAF(N(e,u.l),t)}multiplyUnsafe(e){let t=N(e,u.l,!1);const r=b.BASE,n=b.ZERO;if(t===o)return n;if(this.equals(n)||t===s)return this;if(this.equals(r))return this.wNAF(t);let i=n,c=this;for(;t>o;)t&s&&(i=i.add(c)),c=c.double(),t>>=s;return i}isSmallOrder(){return this.multiplyUnsafe(u.h).equals(b.ZERO)}isTorsionFree(){let e=this.multiplyUnsafe(u.l/c).double();return u.l%c&&(e=e.add(this)),e.equals(b.ZERO)}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(b.ZERO);null==e&&(e=i?a:_(n));const o=j(t*e),c=j(r*e),f=j(n*e);if(i)return k.ZERO;if(f!==s)throw new Error("invZ was invalid");return new k(o,c)}fromRistrettoBytes(){E()}toRistrettoBytes(){E()}fromRistrettoHash(){E()}}function g(e,t){const r=t.negate();return e?r:t}function m(e){if(!(e instanceof b))throw new TypeError("ExtendedPoint expected")}function x(e){if(!(e instanceof K))throw new TypeError("RistrettoPoint expected")}function E(){throw new Error("Legacy method: switch to RistrettoPoint")}b.BASE=new b(u.Gx,u.Gy,s,j(u.Gx*u.Gy)),b.ZERO=new b(o,s,s,o);class K{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=u,r=j(y*e*e),n=j((r+s)*p);let i=BigInt(-1);const o=j((i-t*r)*j(r+t));let{isValid:c,value:a}=H(n,o),f=j(a*e);S(f)||(f=j(-f)),c||(a=f),c||(i=r);const l=j(i*(r-s)*h-o),w=a*a,g=j((a+a)*o),m=j(l*d),x=j(s-w),E=j(s+w);return new b(j(g*E),j(x*m),j(m*E),j(g*x))}static hashToCurve(e){const t=O((e=V(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),n=O(e.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new K(r.add(i))}static fromHex(e){e=V(e,32);const{a:t,d:r}=u,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=O(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(U(i),e)||S(i))throw new Error(n);const c=j(i*i),a=j(s+t*c),f=j(s-t*c),l=j(a*a),y=j(f*f),d=j(t*r*l-y),{isValid:w,value:p}=q(j(d*y)),h=j(p*f),g=j(p*h*d);let m=j((i+i)*h);S(m)&&(m=j(-m));const x=j(a*g),E=j(m*x);if(!w||S(E)||x===o)throw new Error(n);return new K(new b(m,x,s,E))}toRawBytes(){let{x:e,y:t,z:r,t:n}=this.ep;const i=j(j(r+t)*j(r-t)),o=j(e*t),s=j(o*o),{value:c}=q(j(i*s)),a=j(c*i),f=j(c*o),u=j(a*f*n);let l;if(S(n*u)){let r=j(t*y),n=j(e*y);e=r,t=n,l=j(a*w)}else l=f;S(e*u)&&(t=j(-t));let d=j((r-t)*l);return S(d)&&(d=j(-d)),U(d)}toHex(){return P(this.toRawBytes())}toString(){return this.toHex()}equals(e){x(e);const t=this.ep,r=e.ep,n=j(t.x*r.y)===j(t.y*r.x),i=j(t.y*r.y)===j(t.x*r.x);return n||i}add(e){return x(e),new K(this.ep.add(e.ep))}subtract(e){return x(e),new K(this.ep.subtract(e.ep))}multiply(e){return new K(this.ep.multiply(e))}multiplyUnsafe(e){return new K(this.ep.multiplyUnsafe(e))}}K.BASE=new K(b.BASE),K.ZERO=new K(b.ZERO);const B=new WeakMap;class k{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,B.delete(this)}static fromHex(e,t=!0){const{d:r,P:n}=u,i=(e=V(e,32)).slice();i[31]=-129&e[31];const o=T(i);if(t&&o>=n)throw new Error("Expected 0 < hex < P");if(!t&&o>=l)throw new Error("Expected 0 < hex < 2**256");const c=j(o*o),a=j(c-s),f=j(r*c+s);let{isValid:y,value:d}=H(a,f);if(!y)throw new Error("Point.fromHex: invalid y coordinate");const w=(d&s)===s;return!!(128&e[31])!==w&&(d=j(-d)),new k(d,o)}static async fromPrivateKey(e){return(await F(e)).point}toRawBytes(){const e=U(this.y);return e[31]|=this.x&s?128:0,e}toHex(){return P(this.toRawBytes())}toX25519(){const{y:e}=this;return U(j((s+e)*_(s-e)))}isTorsionFree(){return b.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new k(j(-this.x),this.y)}add(e){return b.fromAffine(this).add(b.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return b.fromAffine(this).multiply(e,this).toAffine()}}k.BASE=new k(u.Gx,u.Gy),k.ZERO=new k(o,s);class A{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=V(e,64),r=k.fromHex(t.slice(0,32),!1),n=T(t.slice(32,64));return new A(r,n)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof k))throw new Error("Expected Point instance");return N(t,u.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(U(this.s),32),e}toHex(){return P(this.toRawBytes())}}function v(...e){if(!e.every(e=>e instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(1===e.length)return e[0];const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}const M=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function P(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=M[e[r]];return t}function I(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function R(e){return I(e.toString(16).padStart(64,"0"))}function U(e){return R(e).reverse()}function S(e){return(j(e)&s)===s}function T(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+P(Uint8Array.from(e).reverse()))}const z=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function O(e){return j(T(e)&z)}function j(e,t=u.P){const r=e%t;return r>=o?r:t+r}function _(e,t=u.P){if(e===o||t<=o)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=j(e,t),n=t,i=o,c=s;for(;r!==o;){const e=n%r,t=i-c*(n/r);n=r,r=e,i=c,c=t}if(n!==s)throw new Error("invert: does not exist");return j(i,t)}function Z(e,t){const{P:r}=u;let n=e;for(;t-- >o;)n*=n,n%=r;return n}function H(e,t){const r=j(t*t*t),n=function(e){const{P:t}=u,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),a=BigInt(80),f=e*e%t*e%t,l=Z(f,c)*f%t,y=Z(l,s)*e%t,d=Z(y,r)*y%t,w=Z(d,n)*d%t,p=Z(w,i)*w%t,h=Z(p,o)*p%t,b=Z(h,a)*h%t,g=Z(b,a)*h%t,m=Z(g,n)*d%t;return{pow_p_5_8:Z(m,c)*e%t,b2:f}}(e*j(r*r*t)).pow_p_5_8;let i=j(e*r*n);const o=j(t*i*i),a=i,f=j(i*y),l=o===e,d=o===j(-e),w=o===j(-e*y);return l&&(i=a),(d||w)&&(i=f),S(i)&&(i=j(-i)),{isValid:l||d,value:i}}function q(e){return H(s,e)}function $(e){return j(T(e),u.l)}function V(e,t){const r=e instanceof Uint8Array?Uint8Array.from(e):I(e);if("number"==typeof t&&r.length!==t)throw new Error(`Expected ${t} bytes`);return r}function N(e,t,r=!0){if(!t)throw new TypeError("Specify max value");if("number"==typeof e&&Number.isSafeInteger(e)&&(e=BigInt(e)),"bigint"==typeof e&&e<t)if(r){if(o<e)return e}else if(o<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}let W;async function F(e){return function(e){const t=((r=e.slice(0,32))[0]&=248,r[31]&=127,r[31]|=64,r);var r;const n=e.slice(32,64),i=$(t),o=k.BASE.multiply(i),s=o.toRawBytes();return{head:t,prefix:n,scalar:i,point:o,pointBytes:s}}(await L.sha512(function(e){if(32!==(e="bigint"==typeof e||"number"==typeof e?R(N(e,l)):V(e)).length)throw new Error("Expected 32 bytes");return e}(e)))}async function G(e){return(await F(e)).pointBytes}async function J(e,t){e=V(e);const{prefix:r,scalar:n,pointBytes:i}=await F(t),o=$(await L.sha512(r,e)),s=k.BASE.multiply(o),c=j(o+$(await L.sha512(s.toRawBytes(),i,e))*n,u.l);return new A(s,c).toRawBytes()}async function C(e,t,r){const{r:n,SB:i,msg:o,pub:s}=function(e,t,r){t=V(t),r instanceof k||(r=k.fromHex(r,!1));const{r:n,s:i}=e instanceof A?e.assertValidity():A.fromHex(e);return{r:n,s:i,SB:b.BASE.multiplyUnsafe(i),pub:r,msg:t}}(e,t,r),c=await L.sha512(n.toRawBytes(),s.toRawBytes(),o);return function(e,t,r,n){const i=$(n),o=b.fromAffine(e).multiplyUnsafe(i);return b.fromAffine(t).add(o).subtract(r).multiplyUnsafe(u.h).equals(b.ZERO)}(s,n,i,c)}k.BASE._setWindowSize(8);const D={node:i,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},L={bytesToHex:P,hexToBytes:I,concatBytes:v,getExtendedPublicKey:F,mod:j,invert:_,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:e=>{if((e=V(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return j(T(e),u.l-s)+s},randomBytes:(e=32)=>{if(D.web)return D.web.getRandomValues(new Uint8Array(e));if(D.node){const{randomBytes:t}=D.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>L.randomBytes(32),sha512:async(...e)=>{const t=v(...e);if(D.web){const e=await D.web.subtle.digest("SHA-512",t.buffer);return new Uint8Array(e)}if(D.node)return Uint8Array.from(D.node.createHash("sha512").update(t).digest());throw new Error("The environment doesn't have sha512 function")},precompute(e=8,t=k.BASE){const r=t.equals(k.BASE)?t:new k(t.x,t.y);return r._setWindowSize(e),r.multiply(c),r},sha512Sync:void 0};Object.defineProperties(L,{sha512Sync:{configurable:!1,get:()=>W,set(e){W||(W=e)}}});
2
+ /*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */const o=BigInt(0),s=BigInt(1),c=BigInt(2),a=BigInt(8),f=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),u=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:f,n:f,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),l=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),y=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");const w=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),d=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),p=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),h=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class b{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof k))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(k.ZERO)?b.ZERO:new b(e.x,e.y,s,j(e.x*e.y))}static toAffineBatch(e){const t=function(e,t=u.P){const r=new Array(e.length),n=_(e.reduce((e,n,i)=>n===o?e:(r[i]=e,j(e*n,t)),s),t);return e.reduceRight((e,n,i)=>n===o?e:(r[i]=j(e*r[i],t),j(e*n,t)),n),r}(e.map(e=>e.z));return e.map((e,r)=>e.toAffine(t[r]))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){m(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e,c=j(t*s),a=j(i*n),f=j(r*s),u=j(o*n);return c===a&&f===u}negate(){return new b(j(-this.x),this.y,this.z,j(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:n}=u,i=j(e*e),o=j(t*t),s=j(c*j(r*r)),a=j(n*i),f=e+t,l=j(j(f*f)-i-o),y=a+o,w=y-s,d=a-o,p=j(l*w),h=j(y*d),g=j(l*d),m=j(w*y);return new b(p,h,m,g)}add(e){m(e);const{x:t,y:r,z:n,t:i}=this,{x:s,y:a,z:f,t:u}=e,l=j((r-t)*(a+s)),y=j((r+t)*(a-s)),w=j(y-l);if(w===o)return this.double();const d=j(n*c*u),p=j(i*c*f),h=p+d,g=y+l,x=p-d,E=j(h*w),K=j(g*x),B=j(h*x),k=j(w*g);return new b(E,K,k,B)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(b.BASE)&&(t=k.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&B.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=b.normalizeZ(n),B.set(t,n)));let i=b.ZERO,o=b.BASE;const c=1+256/r,a=2**(r-1),f=BigInt(2**r-1),u=2**r,l=BigInt(r);for(let t=0;t<c;t++){const r=t*a;let c=Number(e&f);e>>=l,c>a&&(c-=u,e+=s);const y=r,w=r+Math.abs(c)-1,d=t%2!=0,p=c<0;0===c?o=o.add(g(d,n[y])):i=i.add(g(p,n[w]))}return b.normalizeZ([i,o])[0]}multiply(e,t){return this.wNAF(N(e,u.l),t)}multiplyUnsafe(e){let t=N(e,u.l,!1);const r=b.BASE,n=b.ZERO;if(t===o)return n;if(this.equals(n)||t===s)return this;if(this.equals(r))return this.wNAF(t);let i=n,c=this;for(;t>o;)t&s&&(i=i.add(c)),c=c.double(),t>>=s;return i}isSmallOrder(){return this.multiplyUnsafe(u.h).equals(b.ZERO)}isTorsionFree(){let e=this.multiplyUnsafe(u.l/c).double();return u.l%c&&(e=e.add(this)),e.equals(b.ZERO)}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(b.ZERO);null==e&&(e=i?a:_(n));const o=j(t*e),c=j(r*e),f=j(n*e);if(i)return k.ZERO;if(f!==s)throw new Error("invZ was invalid");return new k(o,c)}fromRistrettoBytes(){E()}toRistrettoBytes(){E()}fromRistrettoHash(){E()}}function g(e,t){const r=t.negate();return e?r:t}function m(e){if(!(e instanceof b))throw new TypeError("ExtendedPoint expected")}function x(e){if(!(e instanceof K))throw new TypeError("RistrettoPoint expected")}function E(){throw new Error("Legacy method: switch to RistrettoPoint")}b.BASE=new b(u.Gx,u.Gy,s,j(u.Gx*u.Gy)),b.ZERO=new b(o,s,s,o);class K{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=u,r=j(y*e*e),n=j((r+s)*p);let i=BigInt(-1);const o=j((i-t*r)*j(r+t));let{isValid:c,value:a}=H(n,o),f=j(a*e);S(f)||(f=j(-f)),c||(a=f),c||(i=r);const l=j(i*(r-s)*h-o),d=a*a,g=j((a+a)*o),m=j(l*w),x=j(s-d),E=j(s+d);return new b(j(g*E),j(x*m),j(m*E),j(g*x))}static hashToCurve(e){const t=O((e=V(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),n=O(e.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new K(r.add(i))}static fromHex(e){e=V(e,32);const{a:t,d:r}=u,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=O(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(U(i),e)||S(i))throw new Error(n);const c=j(i*i),a=j(s+t*c),f=j(s-t*c),l=j(a*a),y=j(f*f),w=j(t*r*l-y),{isValid:d,value:p}=q(j(w*y)),h=j(p*f),g=j(p*h*w);let m=j((i+i)*h);S(m)&&(m=j(-m));const x=j(a*g),E=j(m*x);if(!d||S(E)||x===o)throw new Error(n);return new K(new b(m,x,s,E))}toRawBytes(){let{x:e,y:t,z:r,t:n}=this.ep;const i=j(j(r+t)*j(r-t)),o=j(e*t),s=j(o*o),{value:c}=q(j(i*s)),a=j(c*i),f=j(c*o),u=j(a*f*n);let l;if(S(n*u)){let r=j(t*y),n=j(e*y);e=r,t=n,l=j(a*d)}else l=f;S(e*u)&&(t=j(-t));let w=j((r-t)*l);return S(w)&&(w=j(-w)),U(w)}toHex(){return P(this.toRawBytes())}toString(){return this.toHex()}equals(e){x(e);const t=this.ep,r=e.ep,n=j(t.x*r.y)===j(t.y*r.x),i=j(t.y*r.y)===j(t.x*r.x);return n||i}add(e){return x(e),new K(this.ep.add(e.ep))}subtract(e){return x(e),new K(this.ep.subtract(e.ep))}multiply(e){return new K(this.ep.multiply(e))}multiplyUnsafe(e){return new K(this.ep.multiplyUnsafe(e))}}K.BASE=new K(b.BASE),K.ZERO=new K(b.ZERO);const B=new WeakMap;class k{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,B.delete(this)}static fromHex(e,t=!0){const{d:r,P:n}=u,i=(e=V(e,32)).slice();i[31]=-129&e[31];const o=T(i);if(t&&o>=n)throw new Error("Expected 0 < hex < P");if(!t&&o>=l)throw new Error("Expected 0 < hex < 2**256");const c=j(o*o),a=j(c-s),f=j(r*c+s);let{isValid:y,value:w}=H(a,f);if(!y)throw new Error("Point.fromHex: invalid y coordinate");const d=(w&s)===s;return!!(128&e[31])!==d&&(w=j(-w)),new k(w,o)}static async fromPrivateKey(e){return(await F(e)).point}toRawBytes(){const e=U(this.y);return e[31]|=this.x&s?128:0,e}toHex(){return P(this.toRawBytes())}toX25519(){const{y:e}=this;return U(j((s+e)*_(s-e)))}isTorsionFree(){return b.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new k(j(-this.x),this.y)}add(e){return b.fromAffine(this).add(b.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return b.fromAffine(this).multiply(e,this).toAffine()}}k.BASE=new k(u.Gx,u.Gy),k.ZERO=new k(o,s);class A{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=V(e,64),r=k.fromHex(t.slice(0,32),!1),n=T(t.slice(32,64));return new A(r,n)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof k))throw new Error("Expected Point instance");return N(t,u.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(U(this.s),32),e}toHex(){return P(this.toRawBytes())}}function v(...e){if(!e.every(e=>e instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(1===e.length)return e[0];const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}const M=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function P(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=M[e[r]];return t}function I(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function R(e){return I(e.toString(16).padStart(64,"0"))}function U(e){return R(e).reverse()}function S(e){return(j(e)&s)===s}function T(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+P(Uint8Array.from(e).reverse()))}const z=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function O(e){return j(T(e)&z)}function j(e,t=u.P){const r=e%t;return r>=o?r:t+r}function _(e,t=u.P){if(e===o||t<=o)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=j(e,t),n=t,i=o,c=s;for(;r!==o;){const e=n%r,t=i-c*(n/r);n=r,r=e,i=c,c=t}if(n!==s)throw new Error("invert: does not exist");return j(i,t)}function Z(e,t){const{P:r}=u;let n=e;for(;t-- >o;)n*=n,n%=r;return n}function H(e,t){const r=j(t*t*t),n=function(e){const{P:t}=u,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),a=BigInt(80),f=e*e%t*e%t,l=Z(f,c)*f%t,y=Z(l,s)*e%t,w=Z(y,r)*y%t,d=Z(w,n)*w%t,p=Z(d,i)*d%t,h=Z(p,o)*p%t,b=Z(h,a)*h%t,g=Z(b,a)*h%t,m=Z(g,n)*w%t;return{pow_p_5_8:Z(m,c)*e%t,b2:f}}(e*j(r*r*t)).pow_p_5_8;let i=j(e*r*n);const o=j(t*i*i),a=i,f=j(i*y),l=o===e,w=o===j(-e),d=o===j(-e*y);return l&&(i=a),(w||d)&&(i=f),S(i)&&(i=j(-i)),{isValid:l||w,value:i}}function q(e){return H(s,e)}function $(e){return j(T(e),u.l)}function V(e,t){const r=e instanceof Uint8Array?Uint8Array.from(e):I(e);if("number"==typeof t&&r.length!==t)throw new Error(`Expected ${t} bytes`);return r}function N(e,t,r=!0){if(!t)throw new TypeError("Specify max value");if("number"==typeof e&&Number.isSafeInteger(e)&&(e=BigInt(e)),"bigint"==typeof e&&e<t)if(r){if(o<e)return e}else if(o<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}let W;async function F(e){return function(e){const t=((r=e.slice(0,32))[0]&=248,r[31]&=127,r[31]|=64,r);var r;const n=e.slice(32,64),i=$(t),o=k.BASE.multiply(i),s=o.toRawBytes();return{head:t,prefix:n,scalar:i,point:o,pointBytes:s}}(await L.sha512(function(e){if(32!==(e="bigint"==typeof e||"number"==typeof e?R(N(e,l)):V(e)).length)throw new Error("Expected 32 bytes");return e}(e)))}async function G(e){return(await F(e)).pointBytes}async function J(e,t){e=V(e);const{prefix:r,scalar:n,pointBytes:i}=await F(t),o=$(await L.sha512(r,e)),s=k.BASE.multiply(o),c=j(o+$(await L.sha512(s.toRawBytes(),i,e))*n,u.l);return new A(s,c).toRawBytes()}async function C(e,t,r){const{r:n,SB:i,msg:o,pub:s}=function(e,t,r){t=V(t),r instanceof k||(r=k.fromHex(r,!1));const{r:n,s:i}=e instanceof A?e.assertValidity():A.fromHex(e);return{r:n,s:i,SB:b.BASE.multiplyUnsafe(i),pub:r,msg:t}}(e,t,r),c=await L.sha512(n.toRawBytes(),s.toRawBytes(),o);return function(e,t,r,n){const i=$(n),o=b.fromAffine(e).multiplyUnsafe(i);return b.fromAffine(t).add(o).subtract(r).multiplyUnsafe(u.h).equals(b.ZERO)}(s,n,i,c)}k.BASE._setWindowSize(8);const D={node:i,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},L={bytesToHex:P,hexToBytes:I,concatBytes:v,getExtendedPublicKey:F,mod:j,invert:_,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:e=>{if((e=V(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return j(T(e),u.l-s)+s},randomBytes:(e=32)=>{if(D.web)return D.web.getRandomValues(new Uint8Array(e));if(D.node){const{randomBytes:t}=D.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>L.randomBytes(32),sha512:async(...e)=>{const t=v(...e);if(D.web){const e=await D.web.subtle.digest("SHA-512",t.buffer);return new Uint8Array(e)}if(D.node)return Uint8Array.from(D.node.createHash("sha512").update(t).digest());throw new Error("The environment doesn't have sha512 function")},precompute(e=8,t=k.BASE){const r=t.equals(k.BASE)?t:new k(t.x,t.y);return r._setWindowSize(e),r.multiply(c),r},sha512Sync:void 0};Object.defineProperties(L,{sha512Sync:{configurable:!1,get:()=>W,set(e){W||(W=e)}}});
3
3
  /*!
4
4
  * Copyright (c) 2020-2022 Digital Bazaar, Inc. All rights reserved.
5
5
  */
@@ -24,10 +24,10 @@ function ce({keyPair:e}){const t={};return e.publicKey&&(t.publicKeyMultibase=ae
24
24
  */async function fe({keyPair:e,secretKey:t,publicKey:r,includeContext:n,canonicalize:i=!1}={}){if(!r&&!t)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const o=t&&!!e.secretKey,s={};return n&&(s["@context"]=ie),s.id=e.id,s.type="Multikey",s.controller=e.controller,r&&(s.publicKeyMultibase=function({publicKey:e}={}){if(e.length!==oe)throw new Error(`Invalid public key size (${e.length}); expected 32.`);const{publicKeyMultibase:t}=ce({keyPair:{publicKey:e}});return t}(e)),o&&(s.secretKeyMultibase=function({secretKey:e,canonicalize:t=!1}={}){if(e.length!==se){if(64!==e.length)throw new Error(`Invalid secret key size (${e.length}); expected 32.`);t&&(e=e.subarray(0,se))}const{secretKeyMultibase:r}=ce({keyPair:{secretKey:e}});return r}
25
25
  /*!
26
26
  * Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
27
- */({...e,canonicalize:i})),e.revoked&&(s.revoked=e.revoked),s}async function ue({id:e,controller:t,secretKeyMultibase:r,publicKeyMultibase:i,revoked:o}){if(!i)throw new TypeError('The "publicKeyMultibase" property is required.');const{publicKey:s,secretKey:c}=function({publicKeyMultibase:e,secretKeyMultibase:t}){if(!e||"string"!=typeof e||"z"!==e[0])throw new Error('"publicKeyMultibase" must be a multibase, base58-encoded string.');const r=n(e.substr(1)).slice(re.length);let i;if(t){if("string"!=typeof t||"z"!==t[0])throw new Error('"secretKeyMultibase" must be a multibase, base58-encoded string.');i=n(t.substr(1)).slice(ne.length)}return{publicKey:r,secretKey:i}}({publicKeyMultibase:i,secretKeyMultibase:r});return t&&!e&&(e=`${t}#${i}`),{id:e,controller:t,publicKey:s,secretKey:c,publicKeyMultibase:i,secretKeyMultibase:r,revoked:o}}function le({jwk:e}={}){const t=function({jwk:e}={}){const{kty:t,crv:n,x:i}=e;if("OKP"!==t)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==n)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof i)throw new TypeError('"jwk.x" must be a string.');const o=r(e.x);if(o.length!==oe)throw new Error(`Invalid public key size (${o.length}); expected 32.`);return o}({jwk:e}),{publicKeyMultibase:n}=ce({keyPair:{publicKey:t}});return n}function ye({jwk:e}={}){const t=function({jwk:e}={}){const{kty:t,crv:n,d:i}=e;if("OKP"!==t)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==n)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof i)throw new TypeError('"jwk.d" must be a string.');const o=Uint8Array.from(r(e.d));if(o.length!==se)throw new Error(`Invalid secret key size (${o.length}); expected 32.`);return o}({jwk:e}),{secretKeyMultibase:n}=ce({keyPair:{secretKey:t}});return n}const de=new Map([["Ed25519VerificationKey2020",{contextUrl:"https://w3id.org/security/suites/ed25519-2020/v1",translationFn:async function({keyPair:e}){return{...e,type:"Multikey","@context":ie,secretKeyMultibase:e.privateKeyMultibase}}}],["Ed25519VerificationKey2018",{contextUrl:"https://w3id.org/security/suites/ed25519-2018/v1",translationFn:async function({keyPair:e}){const t={publicKey:n(e.publicKeyBase58),secretKey:void 0};e.privateKeyBase58&&(t.secretKey=n(e.privateKeyBase58));const{publicKeyMultibase:r,secretKeyMultibase:i}=ce({keyPair:t});return{"@context":ie,id:e.id,type:"Multikey",controller:e.controller,revoked:e.revoked,publicKeyMultibase:r,secretKeyMultibase:i}}
27
+ */({...e,canonicalize:i})),e.revoked&&(s.revoked=e.revoked),s}async function ue({id:e,controller:t,secretKeyMultibase:r,publicKeyMultibase:i,revoked:o}){if(!i)throw new TypeError('The "publicKeyMultibase" property is required.');const{publicKey:s,secretKey:c}=function({publicKeyMultibase:e,secretKeyMultibase:t}){if(!e||"string"!=typeof e||"z"!==e[0])throw new Error('"publicKeyMultibase" must be a multibase, base58-encoded string.');const r=n(e.substr(1)).slice(re.length);let i;if(t){if("string"!=typeof t||"z"!==t[0])throw new Error('"secretKeyMultibase" must be a multibase, base58-encoded string.');i=n(t.substr(1)).slice(ne.length)}return{publicKey:r,secretKey:i}}({publicKeyMultibase:i,secretKeyMultibase:r});return t&&!e&&(e=`${t}#${i}`),{id:e,controller:t,publicKey:s,secretKey:c,publicKeyMultibase:i,secretKeyMultibase:r,revoked:o}}function le({jwk:e}={}){const t=function({jwk:e}={}){const{kty:t,crv:n,x:i}=e;if("OKP"!==t)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==n)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof i)throw new TypeError('"jwk.x" must be a string.');const o=r(e.x);if(o.length!==oe)throw new Error(`Invalid public key size (${o.length}); expected 32.`);return o}({jwk:e}),{publicKeyMultibase:n}=ce({keyPair:{publicKey:t}});return n}function ye({jwk:e}={}){const t=function({jwk:e}={}){const{kty:t,crv:n,d:i}=e;if("OKP"!==t)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==n)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof i)throw new TypeError('"jwk.d" must be a string.');const o=Uint8Array.from(r(e.d));if(o.length!==se)throw new Error(`Invalid secret key size (${o.length}); expected 32.`);return o}({jwk:e}),{secretKeyMultibase:n}=ce({keyPair:{secretKey:t}});return n}const we=new Map([["Ed25519VerificationKey2020",{contextUrl:"https://w3id.org/security/suites/ed25519-2020/v1",translationFn:async function({keyPair:e}){return{...e,type:"Multikey","@context":ie,secretKeyMultibase:e.privateKeyMultibase}}}],["Ed25519VerificationKey2018",{contextUrl:"https://w3id.org/security/suites/ed25519-2018/v1",translationFn:async function({keyPair:e}){const t={publicKey:n(e.publicKeyBase58),secretKey:void 0};e.privateKeyBase58&&(t.secretKey=n(e.privateKeyBase58));const{publicKeyMultibase:r,secretKeyMultibase:i}=ce({keyPair:t});return{"@context":ie,id:e.id,type:"Multikey",controller:e.controller,revoked:e.revoked,publicKeyMultibase:r,secretKeyMultibase:i}}
28
28
  /*!
29
29
  * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
30
- */}]]);async function we({keyPair:e}){const t=de.get(e.type);if(!t)throw new Error(`Unsupported key type "${e.type}".`);const{contextUrl:r,translationFn:n}=t;if(e["@context"]||(e["@context"]=r),!function({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}
30
+ */}]]);async function de({keyPair:e}){const t=we.get(e.type);if(!t)throw new Error(`Unsupported key type "${e.type}".`);const{contextUrl:r,translationFn:n}=t;if(e["@context"]||(e["@context"]=r),!function({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}
31
31
  /*!
32
32
  * Copyright (c) 2020-2023 Digital Bazaar, Inc. All rights reserved.
33
- */({document:e,contextUrl:r}))throw new Error(`Context not supported "${e["@context"]}".`);return n({keyPair:e})}async function pe(e){let t={...e};if("Multikey"!==t.type){if(t.publicKeyJwk){let e,r;return"JsonWebKey"!==t.type&&"JsonWebKey2020"!==t.type||({id:e,controller:r}=t),he({jwk:t.publicKeyJwk,secretKey:!1,id:e,controller:r})}if(t.type)return t=await we({keyPair:t}),be({keyPair:t})}return t.type||(t.type="Multikey"),t["@context"]||(t["@context"]=ie),function(e){if(!e||"object"!=typeof e)throw new TypeError('"key" must be an object.');if("Multikey"!==e.type)throw new Error('"key" must be a Multikey with type "Multikey".');if(!(e["@context"]===ie||Array.isArray(e["@context"])&&e["@context"].includes(ie)))throw new TypeError(`"key" must be a Multikey with context "${ie}".`)}(t),be({keyPair:t})}async function he({jwk:e,secretKey:t=!1,id:r,controller:n}={}){const i={"@context":ie,type:"Multikey",publicKeyMultibase:le({jwk:e})};return"string"==typeof r&&(i.id=r),"string"==typeof n&&(i.controller=n),t&&e.d&&(i.secretKeyMultibase=ye({jwk:e})),pe(i)}async function be({keyPair:e}){return e.publicKey||(e=await ue(e)),e={...e,async export({publicKey:t=!0,secretKey:r=!1,includeContext:n=!0,raw:i=!1,canonicalize:o=!1}={}){if(i){const{publicKey:t,secretKey:r}=e,n={};return t&&(n.publicKey=t.slice()),r&&(o&&r.length>se?n.secretKey=r.subarray(0,se).slice():n.secretKey=r),n}return fe({keyPair:e,publicKey:t,secretKey:r,includeContext:n,canonicalize:o})},signer(){const{id:t,secretKey:r}=e;return ee({id:t,secretKey:r})},verifier(){const{id:t,publicKey:r}=e;return te({id:t,publicKey:r})}}}var ge=Object.freeze({__proto__:null,from:pe,fromJwk:he,generate:async function({id:e,controller:t,seed:r}={}){let n;n=r?await Q(r):await async function(){const e=new Uint8Array(32);X.getRandomValues(e);const t=await Q(e);return e.fill(0),t}();const{publicKeyMultibase:i,secretKeyMultibase:o}=ce({keyPair:n});return t&&!e&&(e=`${t}#${i}`),be({keyPair:{id:e,controller:t,publicKeyMultibase:i,secretKeyMultibase:o,...n}})},toJwk:async function({keyPair:t,secretKey:r=!1}={}){const n={kty:"OKP",crv:"Ed25519",x:e(t.publicKey)};return r&&!!t.secretKey&&(n.d=e(t.secretKey)),n}});export{pe as f,G as g,ge as i,J as s,C as v};
33
+ */({document:e,contextUrl:r}))throw new Error(`Context not supported "${e["@context"]}".`);return n({keyPair:e})}async function pe(e){let t={...e};if("Multikey"!==t.type){if(t.publicKeyJwk){let e,r;return"JsonWebKey"!==t.type&&"JsonWebKey2020"!==t.type||({id:e,controller:r}=t),he({jwk:t.publicKeyJwk,secretKey:!1,id:e,controller:r})}if(t.type)return t=await de({keyPair:t}),be({keyPair:t})}return t.type||(t.type="Multikey"),t["@context"]||(t["@context"]=ie),function(e){if(!e||"object"!=typeof e)throw new TypeError('"key" must be an object.');if("Multikey"!==e.type)throw new Error('"key" must be a Multikey with type "Multikey".');if(!(e["@context"]===ie||Array.isArray(e["@context"])&&e["@context"].includes(ie)))throw new TypeError(`"key" must be a Multikey with context "${ie}".`)}(t),be({keyPair:t})}async function he({jwk:e,secretKey:t=!1,id:r,controller:n}={}){const i={"@context":ie,type:"Multikey",publicKeyMultibase:le({jwk:e})};return"string"==typeof r&&(i.id=r),"string"==typeof n&&(i.controller=n),t&&e.d&&(i.secretKeyMultibase=ye({jwk:e})),pe(i)}async function be({keyPair:e}){return e.publicKey||(e=await ue(e)),e={...e,async export({publicKey:t=!0,secretKey:r=!1,includeContext:n=!0,raw:i=!1,canonicalize:o=!1}={}){if(i){const{publicKey:t,secretKey:r}=e,n={};return t&&(n.publicKey=t.slice()),r&&(o&&r.length>se?n.secretKey=r.subarray(0,se).slice():n.secretKey=r),n}return fe({keyPair:e,publicKey:t,secretKey:r,includeContext:n,canonicalize:o})},signer(){const{id:t,secretKey:r}=e;return ee({id:t,secretKey:r})},verifier(){const{id:t,publicKey:r}=e;return te({id:t,publicKey:r})}}}var ge=Object.freeze({__proto__:null,from:pe,fromJwk:he,generate:async function({id:e,controller:t,seed:r}={}){let n;n=r?await Q(r):await async function(){const e=new Uint8Array(32);X.getRandomValues(e);const t=await Q(e);return e.fill(0),t}();const{publicKeyMultibase:i,secretKeyMultibase:o}=ce({keyPair:n});return t&&!e&&(e=`${t}#${i}`),be({keyPair:{id:e,controller:t,publicKeyMultibase:i,secretKeyMultibase:o,...n}})},toJwk:async function({keyPair:t,secretKey:r=!1}={}){const n={kty:"OKP",crv:"Ed25519",x:e(t.publicKey)};return r&&!!t.secretKey&&(n.d=e(t.secretKey)),n}});export{pe as f,G as g,ge as i,J as s,C as v};
@@ -1,4 +1,4 @@
1
- import{B as t,n as e,v as s}from"./index-D2bS6rRi-D_ppNIsb.js";import"./main.js";import"./jsonld-signatures-BJXipuab-CB799Kkm.js";import"./jsonld-DOUjwF6J-dtl20tiV.js";
1
+ import{B as t,n as e,v as s}from"./index-Dab3X91f-dKXR6RU7.js";import"./main.js";import"./jsonld-signatures-B0DqrrUT-B4B7KZ3F.js";import"./jsonld-BHLXlZBJ-dtl20tiV.js";
2
2
  /*!
3
3
  * Copyright (c) 2024 Digital Bazaar, Inc. All rights reserved.
4
4
  */class r{constructor({length:e,buffer:s}={}){this.bitstring=new t({length:e,buffer:s}),this.length=this.bitstring.length}setStatus(t,e){if("boolean"!=typeof e)throw new TypeError('"status" must be a boolean.');return this.bitstring.set(t,e)}getStatus(t){return this.bitstring.get(t)}async encode(){return"u"+await this.bitstring.encodeBits()}static async decode({encodedList:e}){try{if("u"!==e[0])throw'"encodedList" must start with the character "u".';const s=await t.decodeBits({encoded:e.slice(1)});return new r({buffer:s})}catch(t){if(t instanceof Error)throw t;throw new Error(`Could not decode encoded status list; reason: ${t}`)}}}
@@ -11,4 +11,4 @@ import{B as t,n as e,v as s}from"./index-D2bS6rRi-D_ppNIsb.js";import"./main.js"
11
11
  const i="https://www.w3.org/ns/credentials/status/v1",n=0;(new Map).set(i,{"@context":{"@protected":!0,id:"@id",type:"@type",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"}}}}});(new Map).set(i,n);const a=i,o=e.get("v1").id,u=e.get("v2").id,d=[o,a],c=[u];
12
12
  /*!
13
13
  * Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
14
- */async function w({length:t}){return new r({length:t})}async function l({encodedList:t}){return r.decode({encodedList:t})}async function p({id:t,list:e,statusPurpose:s,context:r}){if(!t||"string"!=typeof t)throw new TypeError('"id" is required.');if(!e||"function"!=typeof e.encode)throw new TypeError('"list" is required.');if(!s||"string"!=typeof s)throw new TypeError('"statusPurpose" is required.');if(r){if(!r.every((t,e)=>t===d[e])&&!r.every((t,e)=>t===c[e]))throw new TypeError(`"context" must be either "${d}" or "${c}".`)}else r=[...c];return{"@context":r,id:t,type:["VerifiableCredential","BitstringStatusListCredential"],credentialSubject:{id:`${t}#list`,type:"BitstringStatusList",encodedList:await e.encode(),statusPurpose:s}}}async function f({credential:t,documentLoader:e,suite:r,verifyBitstringStatusListCredential:i=!0,verifyMatchingIssuers:n=!0}={}){let a;try{a=await async function({credential:t,documentLoader:e,suite:r,verifyBitstringStatusListCredential:i,verifyMatchingIssuers:n}){if(L({credential:t}),"function"!=typeof e)throw new TypeError('"documentLoader" must be a function.');if(i&&!(r&&(a=r,Array.isArray(a)&&a.length>0&&a.every(t=>t&&"object"==typeof t)||!Array.isArray(r)&&"object"==typeof r)))throw new TypeError('"suite" must be an object or an array of objects.');var a;const o=b({credential:t});if(0===o.length)throw new Error('"credentialStatus.type" must be "BitstringStatusListEntry".');o.forEach(t=>S({credentialStatus:t}));const u=await Promise.all(o.map(a=>async function({credential:t,credentialStatus:e,verifyBitstringStatusListCredential:r,verifyMatchingIssuers:i,suite:n,documentLoader:a}){const{statusListIndex:o}=e,u=parseInt(o,10);let d;try{({document:d}=await a(e.statusListCredential))}catch(t){const e=new Error(`Could not load "BitstringStatusListCredential"; reason: ${t.message}`);throw e.cause=t,e}const{statusPurpose:c}=e,{statusPurpose:w}=d.credentialSubject;if(w!==c)throw new Error(`The status purpose "${w}" of the status list credential does not match the status purpose "${c}" in the credential.`);if(r){const t=await s({credential:d,suite:n,documentLoader:a});if(!t.verified){const{error:e}=t;let s='"BitstringStatusListCredential" not verified';s+=e?`; reason: ${e.message}`:".";const r=new Error(s);throw e&&(r.cause=t.error),r}}if(i){const e="object"==typeof t.issuer?t.issuer.id:t.issuer,s="object"==typeof d.issuer?d.issuer.id:d.issuer;if(!e||!s||e!==s)throw new Error("Issuers of the status list credential and verifiable credential do not match.")}if(!d.type.includes("BitstringStatusListCredential"))throw new Error('Status list credential type must include "BitstringStatusListCredential".');const{credentialSubject:p}=d;if("BitstringStatusList"!==p.type)throw new Error('Status list type must be "BitstringStatusList".');const{encodedList:f}=p,y=(await l({encodedList:f})).getStatus(u);return{verified:!0,credentialStatus:e,status:y}}({credential:t,credentialStatus:a,suite:r,documentLoader:e,verifyBitstringStatusListCredential:i,verifyMatchingIssuers:n})));return{verified:u.every(({verified:t=!1}={})=>!0===t),results:u}}({credential:t,documentLoader:e,suite:r,verifyBitstringStatusListCredential:i,verifyMatchingIssuers:n})}catch(t){a={verified:!1,error:t}}return a}function y({credential:t}={}){L({credential:t});const{"@context":e}=t;if(!Array.isArray(e))throw new TypeError('"@context" must be an array.');const s=e[0]===u;if(!s&&e[0]!==o)throw new TypeError(`The first "@context" value must be "${o}" or "${u}".`);const{credentialStatus:r}=t;if(!r)return!1;if("object"!=typeof r)throw new Error('"credentialStatus" is invalid.');if(!s&&!e.includes(a))return!1;return b({credential:t}).length>0}function h({credential:t}={}){L({credential:t});const{"@context":e}=t;if(!Array.isArray(e))throw new TypeError('"@context" must be an array.');if(e[0]!==u){if(e[0]!==o)throw new TypeError(`The first "@context" value must be "${o}".`);if(!e.includes(a))throw new TypeError(`"@context" must include "${a}".`)}}function g({credential:t,statusPurpose:e}={}){if(L({credential:t}),h({credential:t}),!e||"string"!=typeof e)throw new TypeError('"statusPurpose" must be a string.');if(!t.credentialStatus||"object"!=typeof t.credentialStatus)throw new Error('"credentialStatus" is missing or invalid.');const s=b({credential:t});if(0===s.length)throw new Error(`"credentialStatus" with type "BitstringStatusListEntry" and status purpose "${e}" not found.`);const r=s.filter(t=>S({credentialStatus:t})).find(t=>t.statusPurpose===e);if(!r)throw new Error(`"credentialStatus" with type "BitstringStatusListEntry" and status purpose "${e}" not found.`);return r}function S({credentialStatus:t}){if("BitstringStatusListEntry"!==t.type)throw new Error('"credentialStatus.type" must be "BitstringStatusListEntry".');if("string"!=typeof t.statusPurpose)throw new TypeError('"credentialStatus.statusPurpose" must be a string.');if(t.id&&"string"!=typeof t.id)throw new TypeError('"credentialStatus.id" must be a string.');if("string"!=typeof t.statusListCredential)throw new TypeError('"credentialStatus.statusListCredential" must be a string.');const e=parseInt(t.statusListIndex,10);if(isNaN(e))throw new TypeError('"statusListIndex" must be an integer.');if(t.id===t.statusListCredential)throw new Error('"credentialStatus.id" must not be "credentialStatus.statusListCredential".');return t}function L({credential:t}){if(!t||"object"!=typeof t)throw new TypeError('"credential" must be an object.')}function b({credential:t}){const{credentialStatus:e}=t;return Array.isArray(e)?e.filter(t=>"BitstringStatusListEntry"===t.type):e&&"BitstringStatusListEntry"===e.type?[e]:[]}export{r as BitstringStatusList,d as VC_BSL_VC_V1_CONTEXT,c as VC_BSL_VC_V2_CONTEXT,h as assertBitstringStatusListContext,f as checkStatus,p as createCredential,w as createList,l as decodeList,g as getCredentialStatus,y as statusTypeMatches};
14
+ */async function w({length:t}){return new r({length:t})}async function l({encodedList:t}){return r.decode({encodedList:t})}async function p({id:t,list:e,statusPurpose:s,context:r}){if(!t||"string"!=typeof t)throw new TypeError('"id" is required.');if(!e||"function"!=typeof e.encode)throw new TypeError('"list" is required.');if(!s||"string"!=typeof s)throw new TypeError('"statusPurpose" is required.');if(r){if(!r.every((t,e)=>t===d[e])&&!r.every((t,e)=>t===c[e]))throw new TypeError(`"context" must be either "${d}" or "${c}".`)}else r=[...c];return{"@context":r,id:t,type:["VerifiableCredential","BitstringStatusListCredential"],credentialSubject:{id:`${t}#list`,type:"BitstringStatusList",encodedList:await e.encode(),statusPurpose:s}}}async function f({credential:t,documentLoader:e,suite:r,verifyBitstringStatusListCredential:i=!0,verifyMatchingIssuers:n=!0}={}){let a;try{a=await async function({credential:t,documentLoader:e,suite:r,verifyBitstringStatusListCredential:i,verifyMatchingIssuers:n}){if(L({credential:t}),"function"!=typeof e)throw new TypeError('"documentLoader" must be a function.');if(i&&!(r&&(a=r,Array.isArray(a)&&a.length>0&&a.every(t=>t&&"object"==typeof t)||!Array.isArray(r)&&"object"==typeof r)))throw new TypeError('"suite" must be an object or an array of objects.');var a;const o=m({credential:t});if(0===o.length)throw new Error('"credentialStatus.type" must be "BitstringStatusListEntry".');o.forEach(t=>S({credentialStatus:t}));const u=await Promise.all(o.map(a=>async function({credential:t,credentialStatus:e,verifyBitstringStatusListCredential:r,verifyMatchingIssuers:i,suite:n,documentLoader:a}){const{statusListIndex:o}=e,u=parseInt(o,10);let d;try{({document:d}=await a(e.statusListCredential))}catch(t){const e=new Error(`Could not load "BitstringStatusListCredential"; reason: ${t.message}`);throw e.cause=t,e}const{statusPurpose:c}=e,{statusPurpose:w}=d.credentialSubject;if(w!==c)throw new Error(`The status purpose "${w}" of the status list credential does not match the status purpose "${c}" in the credential.`);if(r){const t=await s({credential:d,suite:n,documentLoader:a});if(!t.verified){const{error:e}=t;let s='"BitstringStatusListCredential" not verified';s+=e?`; reason: ${e.message}`:".";const r=new Error(s);throw e&&(r.cause=t.error),r}}if(i){const e="object"==typeof t.issuer?t.issuer.id:t.issuer,s="object"==typeof d.issuer?d.issuer.id:d.issuer;if(!e||!s||e!==s)throw new Error("Issuers of the status list credential and verifiable credential do not match.")}if(!d.type.includes("BitstringStatusListCredential"))throw new Error('Status list credential type must include "BitstringStatusListCredential".');const{credentialSubject:p}=d;if("BitstringStatusList"!==p.type)throw new Error('Status list type must be "BitstringStatusList".');const{encodedList:f}=p,y=(await l({encodedList:f})).getStatus(u);return{verified:!0,credentialStatus:e,status:y}}({credential:t,credentialStatus:a,suite:r,documentLoader:e,verifyBitstringStatusListCredential:i,verifyMatchingIssuers:n})));return{verified:u.every(({verified:t=!1}={})=>!0===t),results:u}}({credential:t,documentLoader:e,suite:r,verifyBitstringStatusListCredential:i,verifyMatchingIssuers:n})}catch(t){a={verified:!1,error:t}}return a}function y({credential:t}={}){L({credential:t});const{"@context":e}=t;if(!Array.isArray(e))throw new TypeError('"@context" must be an array.');const s=e[0]===u;if(!s&&e[0]!==o)throw new TypeError(`The first "@context" value must be "${o}" or "${u}".`);const{credentialStatus:r}=t;if(!r)return!1;if("object"!=typeof r)throw new Error('"credentialStatus" is invalid.');if(!s&&!e.includes(a))return!1;return m({credential:t}).length>0}function h({credential:t}={}){L({credential:t});const{"@context":e}=t;if(!Array.isArray(e))throw new TypeError('"@context" must be an array.');if(e[0]!==u){if(e[0]!==o)throw new TypeError(`The first "@context" value must be "${o}".`);if(!e.includes(a))throw new TypeError(`"@context" must include "${a}".`)}}function g({credential:t,statusPurpose:e}={}){if(L({credential:t}),h({credential:t}),!e||"string"!=typeof e)throw new TypeError('"statusPurpose" must be a string.');if(!t.credentialStatus||"object"!=typeof t.credentialStatus)throw new Error('"credentialStatus" is missing or invalid.');const s=m({credential:t});if(0===s.length)throw new Error(`"credentialStatus" with type "BitstringStatusListEntry" and status purpose "${e}" not found.`);const r=s.filter(t=>S({credentialStatus:t})).find(t=>t.statusPurpose===e);if(!r)throw new Error(`"credentialStatus" with type "BitstringStatusListEntry" and status purpose "${e}" not found.`);return r}function S({credentialStatus:t}){if("BitstringStatusListEntry"!==t.type)throw new Error('"credentialStatus.type" must be "BitstringStatusListEntry".');if("string"!=typeof t.statusPurpose)throw new TypeError('"credentialStatus.statusPurpose" must be a string.');if(t.id&&"string"!=typeof t.id)throw new TypeError('"credentialStatus.id" must be a string.');if("string"!=typeof t.statusListCredential)throw new TypeError('"credentialStatus.statusListCredential" must be a string.');const e=parseInt(t.statusListIndex,10);if(isNaN(e))throw new TypeError('"statusListIndex" must be an integer.');if(t.id===t.statusListCredential)throw new Error('"credentialStatus.id" must not be "credentialStatus.statusListCredential".');return t}function L({credential:t}){if(!t||"object"!=typeof t)throw new TypeError('"credential" must be an object.')}function m({credential:t}){const{credentialStatus:e}=t;return Array.isArray(e)?e.filter(t=>"BitstringStatusListEntry"===t.type):e&&"BitstringStatusListEntry"===e.type?[e]:[]}export{r as BitstringStatusList,d as VC_BSL_VC_V1_CONTEXT,c as VC_BSL_VC_V2_CONTEXT,h as assertBitstringStatusListContext,f as checkStatus,p as createCredential,w as createList,l as decodeList,g as getCredentialStatus,y as statusTypeMatches};
@@ -1,4 +1,4 @@
1
- import{v as e,B as t}from"./index-D2bS6rRi-D_ppNIsb.js";import"./main.js";import"./jsonld-signatures-BJXipuab-CB799Kkm.js";import"./jsonld-DOUjwF6J-dtl20tiV.js";
1
+ import{v as e,B as t}from"./index-Dab3X91f-dKXR6RU7.js";import"./main.js";import"./jsonld-signatures-B0DqrrUT-B4B7KZ3F.js";import"./jsonld-BHLXlZBJ-dtl20tiV.js";
2
2
  /*!
3
3
  * Copyright (c) 2020-2022 Digital Bazaar, Inc. All rights reserved.
4
4
  */class r{constructor({length:e,buffer:r}={}){this.bitstring=new t({length:e,buffer:r}),this.length=this.bitstring.length}setRevoked(e,t){if("boolean"!=typeof t)throw new TypeError('"revoked" must be a boolean.');return this.bitstring.set(e,t)}isRevoked(e){return this.bitstring.get(e)}async encode(){return this.bitstring.encodeBits()}static async decode({encodedList:e}){const i=await t.decodeBits({encoded:e});return new r({buffer:i})}}
@@ -1,8 +1,8 @@
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";
1
+ import{v as t,u as e}from"./main.js";import{j as i}from"./jsonld-signatures-B0DqrrUT-B4B7KZ3F.js";import{j as r}from"./jsonld-BHLXlZBJ-dtl20tiV.js";
2
2
  /*!
3
3
  * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
4
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;
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},L=(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))}},j=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)},B=(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),L(i,l,t.bl_count)},F=(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)),B(t,t.l_desc),B(t,t.d_desc),n=(t=>{let e;for(F(t,t.dyn_ltree,t.l_desc.max_code),F(t,t.dyn_dtree,t.d_desc.max_code),B(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)),j(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(L(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,j(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 q=(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},J={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=J[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)},Lt=(t,e)=>{t.pending_buf[t.pending++]=e},jt=(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=q(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)},Bt=(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},Ft=(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,Bt),new Nt(4,5,16,8,Bt),new Nt(4,6,32,32,Bt),new Nt(4,4,16,16,Ft),new Nt(8,16,32,32,Ft),new Nt(8,16,128,128,Ft),new Nt(8,32,128,256,Ft),new Nt(32,128,258,1024,Ft),new Nt(32,258,258,4096,Ft)];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 qt={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,jt(i,e),0!==i.strstart&&(jt(i,t.adler>>>16),jt(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,Lt(i,31),Lt(i,139),Lt(i,8),i.gzhead)Lt(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)),Lt(i,255&i.gzhead.time),Lt(i,i.gzhead.time>>8&255),Lt(i,i.gzhead.time>>16&255),Lt(i,i.gzhead.time>>24&255),Lt(i,9===i.level?2:i.strategy>=pt||i.level<2?4:0),Lt(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Lt(i,255&i.gzhead.extra.length),Lt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=q(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Lt(i,0),Lt(i,0),Lt(i,0),Lt(i,0),Lt(i,0),Lt(i,9===i.level?2:i.strategy>=pt||i.level<2?4:0),Lt(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=q(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=q(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=q(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,Lt(i,e)}while(0!==e);i.gzhead.hcrc&&i.pending>r&&(t.adler=q(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=q(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,Lt(i,e)}while(0!==e);i.gzhead.hcrc&&i.pending>r&&(t.adler=q(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;Lt(i,255&t.adler),Lt(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?(Lt(i,255&t.adler),Lt(i,t.adler>>8&255),Lt(i,t.adler>>16&255),Lt(i,t.adler>>24&255),Lt(i,255&t.total_in),Lt(i,t.total_in>>8&255),Lt(i,t.total_in>>16&255),Lt(i,t.total_in>>24&255)):(jt(i,t.adler>>>16),jt(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 Jt=(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)Jt(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=qt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy,e.legacyHash);if(i!==le)throw new Error(J[i]);if(e.header&&qt.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=qt.deflateSetDictionary(this.strm,t),i!==le)throw new Error(J[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=qt.deflate(i,s),a===he)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),a=qt.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||J[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:Le,Z_BUF_ERROR:je,Z_DEFLATED:Ze}=Y,Ce=16180,Ie=16190,Oe=16191,Be=16192,Fe=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},qe=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},Je=t=>{if(Ke(t))return Te;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,qe(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,Je(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:Je,inflateReset2:Ye,inflateResetKeep:qe,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=Be),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=Be;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=q(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=q(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=q(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=q(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=q(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=q(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=q(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=q(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 Be: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=Fe,e===Ae)break t;case Fe: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?q(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 Le;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?q(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===Fe?256:0),(0===c&&0===w||e===ze)&&x===Re&&(x=je),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,Le):(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(J[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(J[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||J[i.err];return i.result}};const{gzip:mi}=_e,{ungzip:yi}=gi;var bi=mi,vi=yi;
6
6
  /*!
7
7
  * Copyright (c) 2020-2023 Digital Bazaar, Inc. All rights reserved.
8
8
  */
@@ -17,7 +17,7 @@ const Si=new Map,zi=new Map,Ei=new Map;function Ai({contextsMap:t,metadataMap:e,
17
17
  /*!
18
18
  * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
19
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}
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 Li({credential:t,version:e}){return function({credential:t}={}){const e=t?.["@context"]?.[0];return Ti.get(e)}({credential:t})===e}function ji({t1:t,t2:e,maxClockSkew:i}){return Math.abs(t-e)<1e3*i?0:t<e?-1:1}
21
21
  /*!
22
22
  * Copyright (c) 2019-2024 Digital Bazaar, Inc. All rights reserved.
23
23
  */const Zi=new Map([...Si]);
@@ -63,4 +63,4 @@ const{purposes:{AssertionProofPurpose:Ci}}=i;class Ii extends Ci{constructor({co
63
63
  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
64
64
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
65
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};
66
+ */const{AssertionProofPurpose:Oi,AuthenticationProofPurpose:Bi}=i.purposes,Fi=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(Li({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(ji({t1:e,t2:new Date(t.expirationDate),maxClockSkew:a})>0)throw new Error("Credential has expired.")}if("verify"===i){if(ji({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(Li({credential:t,version:2})){let{validUntil:r,validFrom:s}=t;if(r&&(Di({credential:t,prop:"validUntil"}),"verify"===i&&(r=new Date(t.validUntil),ji({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),ji({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.');qi({id:e,propertyName:"issuer"})}r.getValues(t,"credentialStatus").forEach(t=>{if("id"in t&&qi({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&&qi({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||Fi,{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&&qi({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 qi({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,23 @@
1
+ import{u as e,f as t,w as r}from"./main.js";import{s as n}from"./sha2-CJXzPerd-BVhQN7q7.js";import{e as i,w as c,F as s,p as u}from"./weierstrass-qx_4bPUU-BwaVz9Sr.js";
2
+ /*!
3
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
4
+ */
5
+ const o="ECDSA",y=!0,a="https://w3id.org/security/suites/ecdsa-2019/v1",f="https://w3id.org/security/multikey/v1",l="z",p=new Uint8Array([231,1]),b=new Uint8Array([128,36]),w=new Uint8Array([129,36]),d=new Uint8Array([130,36]),k=new Uint8Array([129,38]),K=new Uint8Array([134,38]),h=new Uint8Array([135,38]),g=new Uint8Array([136,38]),m="P-256",v="P-384",x="P-521",A="K-256",E="SHA-256",M="SHA-384",U="SHA-512",C=globalThis.crypto,j=globalThis.CryptoKey??C.CryptoKey;function T({curve:e}){if(e===m||e===A)return E;if(e===v)return M;if(e===x)return U;throw new TypeError(`Unsupported curve "${e}".`)}
6
+ /*!
7
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
8
+ */function B({publicMultikey:e}){if(e[0]===b[0]&&e[1]===b[1])return m;if(e[0]===w[0]&&e[1]===w[1])return v;if(e[0]===d[0]&&e[1]===d[1])return x;if(e[0]===p[0]&&e[1]===p[1])return A;throw new TypeError("Unsupported public multikey header.")}function P({secretMultikey:e}){if(e[0]===K[0]&&e[1]===K[1])return m;if(e[0]===h[0]&&e[1]===h[1])return v;if(e[0]===g[0]&&e[1]===g[1])return x;if(e[0]===k[0]&&e[1]===k[1])return A;throw new TypeError("Unsupported secret multikey header.")}function I({curve:e}){if(e===m||e===A)return 32;if(e===v)return 48;if(e===x)return 66;throw new TypeError(`Unsupported curve "${e}".`)}
9
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
10
+ const S={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},$={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},D=BigInt(2);const H=s(S.p,{sqrt:function(e){const t=S.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),c=BigInt(22),s=BigInt(23),o=BigInt(44),y=BigInt(88),a=e*e*e%t,f=a*a*e%t,l=u(f,r,t)*f%t,p=u(l,r,t)*f%t,b=u(p,D,t)*a%t,w=u(b,i,t)*b%t,d=u(w,c,t)*w%t,k=u(d,o,t)*d%t,K=u(k,y,t)*k%t,h=u(K,o,t)*d%t,g=u(h,r,t)*f%t,m=u(g,s,t)*w%t,v=u(m,n,t)*a%t,x=u(v,D,t);if(!H.eql(H.sqr(x),e))throw new Error("Cannot find square root");return x}}),q=i(c(S,{Fp:H,endo:$}),n);class X{constructor(e){this.ec={...q},null!=e.priv&&(this.priv=e.priv),null!=e.pub&&(this.pub=e.pub)}static hexToBytes(e){if("string"!=typeof e)throw new Error("hex string expected");if(e.length%2)throw new Error("hex string must have even length");const t=e.length/2,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=parseInt(e.substr(2*n,2),16);return r}static bytesToHex(e){return Array.from(e||[]).map(e=>e.toString(16).padStart(2,"0")).join("")}static keyFromPublic(e,t="hex"){const r="hex"===t?X.hexToBytes(e):e;return new X({pub:r})}getPublic(e=!0,t="hex"){this.pub||(this.pub=this.ec.getPublicKey(this.priv,!1));let r=this.pub;const n=this.ec.Point.fromHex(X.bytesToHex(r)).toHex(e);return r=X.hexToBytes(n),"hex"===t?X.bytesToHex(r):r}}
11
+ /*!
12
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
13
+ */const F=new Map([[m,{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])}],[v,{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])}],[x,{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])}],[A,{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])}]]),V=new Map([[m,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])],[v,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])],[x,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])],[A,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 J(e){return Uint8Array.from(X.keyFromPublic(e,"bytes").getPublic(!1,"array"))}async function _({id:e,controller:r,secretKeyMultibase:n,publicKeyMultibase:i,keyAgreement:c=!1}){if(!i)throw new TypeError('The "publicKeyMultibase" property is required.');const s={id:e,controller:r};if(!i||"string"!=typeof i||i[0]!==l)throw new TypeError('"publicKeyMultibase" must be a multibase, base58-encoded string.');const u=t(i.slice(1)),a={name:c?"ECDH":o,namedCurve:B({publicMultikey:u})},f=function({publicMultikey:e}){const t=B({publicMultikey:e});let r=e.subarray(2);t===A&&(r=J(r));return function({curve:e,publicKey:t}){const r=V.get(e),n=new Uint8Array(r.length+t.length);let i=0;return n.set(r,i),i+=r.length,n.set(t,i),n}
14
+ /*!
15
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
16
+ */({curve:t,publicKey:r})}({publicMultikey:u}),p=c?[]:["verify"];if(a.namedCurve===A){const{Crypto:e}=await import("./webcrypto.es-D4KX-5fg-gGk5JRJH.js"),t=new e;s.publicKey=await t.subtle.importKey("spki",f,a,y,p)}else s.publicKey=await C.subtle.importKey("spki",f,a,y,p);if(n){if("string"!=typeof n||n[0]!==l)throw new TypeError('"secretKeyMultibase" must be a multibase, base58-encoded string.');const e=t(n.slice(1));!function({secretMultikey:e,publicMultikey:t}){const r=B({publicMultikey:t}),n=P({secretMultikey:e});if(r!==n)throw new Error(`Public key curve ('${r}') does not match secret key curve ('${n}').`)}({secretMultikey:e,publicMultikey:u});const r=function({secretMultikey:e,publicMultikey:t}){const r=P({secretMultikey:e}),n=e.subarray(2),i=t.subarray(2);return function({curve:e,secretKey:t,publicKey:r}){const n=F.get(e);if(!n)throw new Error(`Unsupported curve "${e}".`);e===A&&(r=J(r));const i=new Uint8Array(n.secret.length+t.length+n.public.length+r.length);let c=0;return i.set(n.secret,c),c+=n.secret.length,i.set(t,c),c+=t.length,i.set(n.public,c),c+=n.public.length,i.set(r,c),i}({curve:r,secretKey:n,publicKey:i})}({secretMultikey:e,publicMultikey:u}),i=c?["deriveBits"]:["sign"];if(a.namedCurve===A){const{Crypto:e}=await import("./webcrypto.es-D4KX-5fg-gGk5JRJH.js"),t=new e;s.secretKey=await t.subtle.importKey("pkcs8",r,a,y,i)}else s.secretKey=await C.subtle.importKey("pkcs8",r,a,y,i)}return s}function z({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:r}=t,n=I({curve:r}),i=e(t.x),c=e(t.y),s=new Uint8Array(n+1),u=c[c.length-1]%2==0;return s[0]=u?2:3,s.set(i,s.length-i.length),s}function G({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:n}=t,i=I({curve:n}),c=e(t.x),s=e(t.y),u=new Uint8Array(2+(i+1));!function({curve:e,buffer:t}){if(e===m)t[0]=b[0],t[1]=b[1];else if(e===v)t[0]=w[0],t[1]=w[1];else if(e===x)t[0]=d[0],t[1]=d[1];else{if(e!==A)throw new TypeError(`Unsupported curve "${e}".`);t[0]=p[0],t[1]=p[1]}}({curve:n,buffer:u});const o=s[s.length-1]%2==0;u[2]=o?2:3,u.set(c,u.length-c.length);return l+r(u)}function N({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:n}=t,i=I({curve:n}),c=e(t.d),s=new Uint8Array(2+i);!function({curve:e,buffer:t}){if(e===m)t[0]=K[0],t[1]=K[1];else if(e===v)t[0]=h[0],t[1]=h[1];else if(e===x)t[0]=g[0],t[1]=g[1];else{if(e!==A)throw new TypeError(`Unsupported curve "${e}".`);t[0]=k[0],t[1]=k[1]}}({curve:t.crv,buffer:s}),s.set(c,s.length-c.length);return l+r(s)}const O=new Set(["EcdsaSecp256r1VerificationKey2019","EcdsaSecp384r1VerificationKey2019","EcdsaSecp521r1VerificationKey2019","EcdsaSecp256k1VerificationKey2019"]);async function L({keyPair:e}){if(!O.has(e.type))throw new TypeError(`Unsupported key type "${e.type}".`);if(e["@context"]||(e["@context"]=a),!function({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}
17
+ /*!
18
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
19
+ */({document:e,contextUrl:a}))throw new TypeError(`Context not supported "${e["@context"]}".`);return{"@context":f,id:e.id,type:"Multikey",controller:e.controller,publicKeyMultibase:e.publicKeyMultibase,secretKeyMultibase:e.secretKeyMultibase}}async function Q(e,t={}){"boolean"==typeof t&&(t={keyAgreement:t});const{keyAgreement:r}=t;let n={...e};if("Multikey"!==n.type){if(n.publicKeyJwk)return async function({jwk:e,secretKey:t=!1}={}){const r={"@context":f,type:"Multikey",publicKeyMultibase:G({jwk:e})};t&&e.d&&(r.secretKeyMultibase=N({jwk:e}));const n=!e.key_ops||e.key_ops.includes("deriveBits");return Q(r,n)}({jwk:n.publicKeyJwk,secretKey:!1});if(n.type)return n=await L({keyPair:n}),W({keyPair:n,keyAgreement:r})}return n.type||(n.type="Multikey"),n["@context"]||(n["@context"]=f),n.controller&&!n.id&&(n.id=`${e.controller}#${e.publicKeyMultibase}`),function(e){if(!e||"object"!=typeof e)throw new TypeError('"key" must be an object.');if("Multikey"!==e.type)throw new TypeError('"key" must be a Multikey with type "Multikey".');if(!(e["@context"]===f||Array.isArray(e["@context"])&&e["@context"].includes(f)))throw new TypeError(`"key" must be a Multikey with context "${f}".`)}(n),W({keyPair:n,keyAgreement:r})}async function R({keyPair:e,secretKey:t=!1}={}){e?.publicKey instanceof j||(e=await _(e));const r=t&&!!e.secretKey?e.secretKey:e.publicKey;let n;if(e.publicKey.algorithm.namedCurve===A){const{Crypto:e}=await import("./webcrypto.es-D4KX-5fg-gGk5JRJH.js"),t=new e;n=await t.subtle.exportKey("jwk",r)}else n=await C.subtle.exportKey("jwk",r);return n}async function W({keyPair:t,keyAgreement:r=!1}){t?.publicKey instanceof j||t.publicKey?.algorithm.namedCurve===A||(t=await _(t));const n=async({publicKey:r=!0,secretKey:n=!1,includeContext:i=!0,raw:c=!1}={})=>{if(c){const i=await R({keyPair:t,secretKey:n}),c={};return r&&(c.publicKey=z({jwk:i})),n&&(c.secretKey=function({jwk:t}={}){if("EC"!==t?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:r}=t,n=I({curve:r}),i=e(t.d),c=new Uint8Array(n);return c.set(i,c.length-i.length),c}({jwk:i})),c}return async function({keyPair:e,secretKey:t,publicKey:r,includeContext:n}={}){if(!r&&!t)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const i=t&&!!e.secretKey,c=i?e.secretKey:e.publicKey;let s;if(c.algorithm.namedCurve===A){const{Crypto:e}=await import("./webcrypto.es-D4KX-5fg-gGk5JRJH.js"),t=new e;s=await t.subtle.exportKey("jwk",c)}else s=await C.subtle.exportKey("jwk",c);const u={};return n&&(u["@context"]=f),u.id=e.id,u.type="Multikey",u.controller=e.controller,r&&(u.publicKeyMultibase=G({jwk:s})),i&&(u.secretKeyMultibase=N({jwk:s})),u}({keyPair:t,publicKey:r,secretKey:n,includeContext:i})},{publicKeyMultibase:i,secretKeyMultibase:c}=await n({publicKey:!0,secretKey:!0,includeContext:!0});return t={...t,publicKeyMultibase:i,secretKeyMultibase:c,keyAgreement:r,export:n,signer(){const{id:e,secretKey:r}=t;
20
+ /*!
21
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
22
+ */
23
+ return function({id:e,secretKey:t}){if(!t)throw new Error('"secretKey" is required for signing.');const{namedCurve:r}=t.algorithm,n={name:o,hash:{name:T({curve:r})}};return{algorithm:r,id:e,async sign({data:e}={}){if(r===A){const{Crypto:r}=await import("./webcrypto.es-D4KX-5fg-gGk5JRJH.js"),i=new r;return new Uint8Array(await i.subtle.sign(n,t,e))}return new Uint8Array(await C.subtle.sign(n,t,e))}}}({id:e,secretKey:r})},verifier(){const{id:e,publicKey:r}=t;return function({id:e,publicKey:t}){if(!t)throw new Error('"publicKey" is required for verifying.');const{namedCurve:r}=t.algorithm,n={name:o,hash:{name:T({curve:r})}};return{algorithm:r,id:e,async verify({data:e,signature:i}={}){if(r===A){const{Crypto:r}=await import("./webcrypto.es-D4KX-5fg-gGk5JRJH.js");return(new r).subtle.verify(n,t,i,e)}return C.subtle.verify(n,t,i,e)}}}({id:e,publicKey:r})},async deriveSecret({publicKey:e,remotePublicKey:r}={}){if(r&&e)throw new Error('Only one of "remotePublicKey" and "publicKey" must be given.');if(!t.keyAgreement){const e=Error('"keyAgreement" is not supported by this keypair.');throw e.name="NotSupportedError",e}return async function({localKeyPair:e,remoteKeyPair:t}){if(!e.secretKey){const e=Error('"secretKey" required to derive secret.');throw e.name="NotSupportedError",e}e=await _({...e,keyAgreement:!0}),t=await _({...t,keyAgreement:!0});const{namedCurve:r}=e.secretKey.algorithm,n=I({curve:r});if(r===A){const{Crypto:i}=await import("./webcrypto.es-D4KX-5fg-gGk5JRJH.js"),c=new i,s=await c.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*n);return new Uint8Array(s,0,n)}const i=await C.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*n);return new Uint8Array(i,0,n)}({localKeyPair:this,remoteKeyPair:r||e})}}}export{z as a,Q as f,R as t};