@enbox/crypto 0.0.2 → 0.0.4

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 (226) hide show
  1. package/README.md +34 -102
  2. package/dist/browser.mjs +6 -10
  3. package/dist/browser.mjs.map +4 -4
  4. package/dist/esm/algorithms/aes-ctr.js +1 -1
  5. package/dist/esm/algorithms/aes-gcm.js +35 -2
  6. package/dist/esm/algorithms/aes-gcm.js.map +1 -1
  7. package/dist/esm/algorithms/aes-kw.js +154 -0
  8. package/dist/esm/algorithms/aes-kw.js.map +1 -0
  9. package/dist/esm/algorithms/ecdsa.js +119 -6
  10. package/dist/esm/algorithms/ecdsa.js.map +1 -1
  11. package/dist/esm/algorithms/eddsa.js +99 -6
  12. package/dist/esm/algorithms/eddsa.js.map +1 -1
  13. package/dist/esm/algorithms/hkdf.js +53 -0
  14. package/dist/esm/algorithms/hkdf.js.map +1 -0
  15. package/dist/esm/algorithms/pbkdf2.js +55 -0
  16. package/dist/esm/algorithms/pbkdf2.js.map +1 -0
  17. package/dist/esm/algorithms/sha-2.js +2 -2
  18. package/dist/esm/algorithms/sha-2.js.map +1 -1
  19. package/dist/esm/algorithms/x25519.js +125 -0
  20. package/dist/esm/algorithms/x25519.js.map +1 -0
  21. package/dist/esm/crypto-error.js +41 -0
  22. package/dist/esm/crypto-error.js.map +1 -0
  23. package/dist/esm/index.js +8 -0
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/jose/jwk.js +52 -26
  26. package/dist/esm/jose/jwk.js.map +1 -1
  27. package/dist/esm/local-key-manager.js +9 -3
  28. package/dist/esm/local-key-manager.js.map +1 -1
  29. package/dist/esm/primitives/aes-ctr.js.map +1 -1
  30. package/dist/esm/primitives/aes-gcm.js.map +1 -1
  31. package/dist/esm/primitives/aes-kw.js +246 -0
  32. package/dist/esm/primitives/aes-kw.js.map +1 -0
  33. package/dist/esm/primitives/concat-kdf.js +1 -1
  34. package/dist/esm/primitives/concat-kdf.js.map +1 -1
  35. package/dist/esm/primitives/ecies-secp256k1.js +79 -0
  36. package/dist/esm/primitives/ecies-secp256k1.js.map +1 -0
  37. package/dist/esm/primitives/ed25519.js +3 -3
  38. package/dist/esm/primitives/ed25519.js.map +1 -1
  39. package/dist/esm/primitives/hkdf.js +79 -0
  40. package/dist/esm/primitives/hkdf.js.map +1 -0
  41. package/dist/esm/primitives/pbkdf2.js +49 -0
  42. package/dist/esm/primitives/pbkdf2.js.map +1 -1
  43. package/dist/esm/primitives/secp256k1.js +4 -4
  44. package/dist/esm/primitives/secp256k1.js.map +1 -1
  45. package/dist/esm/primitives/secp256r1.js +4 -4
  46. package/dist/esm/primitives/secp256r1.js.map +1 -1
  47. package/dist/esm/primitives/x25519.js +10 -17
  48. package/dist/esm/primitives/x25519.js.map +1 -1
  49. package/dist/esm/primitives/xchacha20-poly1305.js +48 -3
  50. package/dist/esm/primitives/xchacha20-poly1305.js.map +1 -1
  51. package/dist/esm/primitives/xchacha20.js +1 -1
  52. package/dist/esm/primitives/xchacha20.js.map +1 -1
  53. package/dist/esm/utils.js +30 -0
  54. package/dist/esm/utils.js.map +1 -1
  55. package/dist/types/algorithms/aes-ctr.d.ts +2 -2
  56. package/dist/types/algorithms/aes-ctr.d.ts.map +1 -1
  57. package/dist/types/algorithms/aes-gcm.d.ts +25 -5
  58. package/dist/types/algorithms/aes-gcm.d.ts.map +1 -1
  59. package/dist/types/algorithms/aes-kw.d.ts +129 -0
  60. package/dist/types/algorithms/aes-kw.d.ts.map +1 -0
  61. package/dist/types/algorithms/ecdsa.d.ts +49 -4
  62. package/dist/types/algorithms/ecdsa.d.ts.map +1 -1
  63. package/dist/types/algorithms/eddsa.d.ts +49 -4
  64. package/dist/types/algorithms/eddsa.d.ts.map +1 -1
  65. package/dist/types/algorithms/hkdf.d.ts +35 -0
  66. package/dist/types/algorithms/hkdf.d.ts.map +1 -0
  67. package/dist/types/algorithms/pbkdf2.d.ts +35 -0
  68. package/dist/types/algorithms/pbkdf2.d.ts.map +1 -0
  69. package/dist/types/algorithms/sha-2.d.ts +2 -2
  70. package/dist/types/algorithms/sha-2.d.ts.map +1 -1
  71. package/dist/types/algorithms/x25519.d.ts +76 -0
  72. package/dist/types/algorithms/x25519.d.ts.map +1 -0
  73. package/dist/types/crypto-error.d.ts +29 -0
  74. package/dist/types/crypto-error.d.ts.map +1 -0
  75. package/dist/types/index.d.ts +8 -0
  76. package/dist/types/index.d.ts.map +1 -1
  77. package/dist/types/jose/jwk.d.ts.map +1 -1
  78. package/dist/types/local-key-manager.d.ts +6 -6
  79. package/dist/types/local-key-manager.d.ts.map +1 -1
  80. package/dist/types/primitives/aes-kw.d.ts +103 -0
  81. package/dist/types/primitives/aes-kw.d.ts.map +1 -0
  82. package/dist/types/primitives/concat-kdf.d.ts +1 -1
  83. package/dist/types/primitives/concat-kdf.d.ts.map +1 -1
  84. package/dist/types/primitives/ecies-secp256k1.d.ts +53 -0
  85. package/dist/types/primitives/ecies-secp256k1.d.ts.map +1 -0
  86. package/dist/types/primitives/hkdf.d.ts +90 -0
  87. package/dist/types/primitives/hkdf.d.ts.map +1 -0
  88. package/dist/types/primitives/pbkdf2.d.ts +58 -0
  89. package/dist/types/primitives/pbkdf2.d.ts.map +1 -1
  90. package/dist/types/primitives/x25519.d.ts +9 -16
  91. package/dist/types/primitives/x25519.d.ts.map +1 -1
  92. package/dist/types/primitives/xchacha20-poly1305.d.ts +47 -0
  93. package/dist/types/primitives/xchacha20-poly1305.d.ts.map +1 -1
  94. package/dist/types/types/cipher.d.ts +1 -1
  95. package/dist/types/types/crypto-api.d.ts +54 -6
  96. package/dist/types/types/crypto-api.d.ts.map +1 -1
  97. package/dist/types/types/key-converter.d.ts +37 -15
  98. package/dist/types/types/key-converter.d.ts.map +1 -1
  99. package/dist/types/types/key-deriver.d.ts +41 -0
  100. package/dist/types/types/key-deriver.d.ts.map +1 -1
  101. package/dist/types/types/key-io.d.ts +37 -0
  102. package/dist/types/types/key-io.d.ts.map +1 -1
  103. package/dist/types/types/params-direct.d.ts +96 -1
  104. package/dist/types/types/params-direct.d.ts.map +1 -1
  105. package/dist/types/types/params-kms.d.ts +55 -0
  106. package/dist/types/types/params-kms.d.ts.map +1 -1
  107. package/dist/types/utils.d.ts +19 -0
  108. package/dist/types/utils.d.ts.map +1 -1
  109. package/dist/utils.js +1 -1
  110. package/dist/utils.js.map +4 -4
  111. package/package.json +29 -45
  112. package/src/algorithms/aes-ctr.ts +2 -2
  113. package/src/algorithms/aes-gcm.ts +41 -4
  114. package/src/algorithms/aes-kw.ts +182 -0
  115. package/src/algorithms/ecdsa.ts +145 -8
  116. package/src/algorithms/eddsa.ts +117 -10
  117. package/src/algorithms/hkdf.ts +54 -0
  118. package/src/algorithms/pbkdf2.ts +57 -0
  119. package/src/algorithms/sha-2.ts +3 -3
  120. package/src/algorithms/x25519.ts +153 -0
  121. package/src/crypto-error.ts +45 -0
  122. package/src/index.ts +8 -0
  123. package/src/jose/jwk.ts +32 -32
  124. package/src/local-key-manager.ts +22 -16
  125. package/src/primitives/aes-ctr.ts +1 -1
  126. package/src/primitives/aes-gcm.ts +5 -5
  127. package/src/primitives/aes-kw.ts +269 -0
  128. package/src/primitives/concat-kdf.ts +4 -2
  129. package/src/primitives/ecies-secp256k1.ts +113 -0
  130. package/src/primitives/ed25519.ts +6 -6
  131. package/src/primitives/hkdf.ts +121 -0
  132. package/src/primitives/pbkdf2.ts +91 -0
  133. package/src/primitives/secp256k1.ts +6 -6
  134. package/src/primitives/secp256r1.ts +6 -6
  135. package/src/primitives/x25519.ts +12 -19
  136. package/src/primitives/xchacha20-poly1305.ts +57 -4
  137. package/src/primitives/xchacha20.ts +1 -1
  138. package/src/types/cipher.ts +1 -1
  139. package/src/types/crypto-api.ts +129 -11
  140. package/src/types/key-converter.ts +33 -7
  141. package/src/types/key-deriver.ts +49 -0
  142. package/src/types/key-io.ts +40 -0
  143. package/src/types/params-direct.ts +118 -1
  144. package/src/types/params-kms.ts +67 -0
  145. package/src/utils.ts +55 -2
  146. package/dist/browser.js +0 -64
  147. package/dist/browser.js.map +0 -7
  148. package/dist/cjs/algorithms/aes-ctr.js +0 -188
  149. package/dist/cjs/algorithms/aes-ctr.js.map +0 -1
  150. package/dist/cjs/algorithms/aes-gcm.js +0 -196
  151. package/dist/cjs/algorithms/aes-gcm.js.map +0 -1
  152. package/dist/cjs/algorithms/crypto-algorithm.js +0 -13
  153. package/dist/cjs/algorithms/crypto-algorithm.js.map +0 -1
  154. package/dist/cjs/algorithms/ecdsa.js +0 -352
  155. package/dist/cjs/algorithms/ecdsa.js.map +0 -1
  156. package/dist/cjs/algorithms/eddsa.js +0 -325
  157. package/dist/cjs/algorithms/eddsa.js.map +0 -1
  158. package/dist/cjs/algorithms/sha-2.js +0 -119
  159. package/dist/cjs/algorithms/sha-2.js.map +0 -1
  160. package/dist/cjs/index.js +0 -41
  161. package/dist/cjs/index.js.map +0 -1
  162. package/dist/cjs/jose/jwe.js +0 -3
  163. package/dist/cjs/jose/jwe.js.map +0 -1
  164. package/dist/cjs/jose/jwk.js +0 -278
  165. package/dist/cjs/jose/jwk.js.map +0 -1
  166. package/dist/cjs/jose/jws.js +0 -3
  167. package/dist/cjs/jose/jws.js.map +0 -1
  168. package/dist/cjs/jose/jwt.js +0 -3
  169. package/dist/cjs/jose/jwt.js.map +0 -1
  170. package/dist/cjs/jose/utils.js +0 -60
  171. package/dist/cjs/jose/utils.js.map +0 -1
  172. package/dist/cjs/local-key-manager.js +0 -521
  173. package/dist/cjs/local-key-manager.js.map +0 -1
  174. package/dist/cjs/package.json +0 -1
  175. package/dist/cjs/primitives/aes-ctr.js +0 -398
  176. package/dist/cjs/primitives/aes-ctr.js.map +0 -1
  177. package/dist/cjs/primitives/aes-gcm.js +0 -425
  178. package/dist/cjs/primitives/aes-gcm.js.map +0 -1
  179. package/dist/cjs/primitives/concat-kdf.js +0 -215
  180. package/dist/cjs/primitives/concat-kdf.js.map +0 -1
  181. package/dist/cjs/primitives/ed25519.js +0 -651
  182. package/dist/cjs/primitives/ed25519.js.map +0 -1
  183. package/dist/cjs/primitives/pbkdf2.js +0 -120
  184. package/dist/cjs/primitives/pbkdf2.js.map +0 -1
  185. package/dist/cjs/primitives/secp256k1.js +0 -958
  186. package/dist/cjs/primitives/secp256k1.js.map +0 -1
  187. package/dist/cjs/primitives/secp256r1.js +0 -959
  188. package/dist/cjs/primitives/secp256r1.js.map +0 -1
  189. package/dist/cjs/primitives/sha256.js +0 -93
  190. package/dist/cjs/primitives/sha256.js.map +0 -1
  191. package/dist/cjs/primitives/x25519.js +0 -498
  192. package/dist/cjs/primitives/x25519.js.map +0 -1
  193. package/dist/cjs/primitives/xchacha20-poly1305.js +0 -340
  194. package/dist/cjs/primitives/xchacha20-poly1305.js.map +0 -1
  195. package/dist/cjs/primitives/xchacha20.js +0 -316
  196. package/dist/cjs/primitives/xchacha20.js.map +0 -1
  197. package/dist/cjs/types/cipher.js +0 -3
  198. package/dist/cjs/types/cipher.js.map +0 -1
  199. package/dist/cjs/types/crypto-api.js +0 -3
  200. package/dist/cjs/types/crypto-api.js.map +0 -1
  201. package/dist/cjs/types/hasher.js +0 -3
  202. package/dist/cjs/types/hasher.js.map +0 -1
  203. package/dist/cjs/types/identifier.js +0 -3
  204. package/dist/cjs/types/identifier.js.map +0 -1
  205. package/dist/cjs/types/key-compressor.js +0 -3
  206. package/dist/cjs/types/key-compressor.js.map +0 -1
  207. package/dist/cjs/types/key-converter.js +0 -3
  208. package/dist/cjs/types/key-converter.js.map +0 -1
  209. package/dist/cjs/types/key-deriver.js +0 -3
  210. package/dist/cjs/types/key-deriver.js.map +0 -1
  211. package/dist/cjs/types/key-generator.js +0 -3
  212. package/dist/cjs/types/key-generator.js.map +0 -1
  213. package/dist/cjs/types/key-io.js +0 -3
  214. package/dist/cjs/types/key-io.js.map +0 -1
  215. package/dist/cjs/types/key-wrapper.js +0 -3
  216. package/dist/cjs/types/key-wrapper.js.map +0 -1
  217. package/dist/cjs/types/params-direct.js +0 -3
  218. package/dist/cjs/types/params-direct.js.map +0 -1
  219. package/dist/cjs/types/params-enclosed.js +0 -3
  220. package/dist/cjs/types/params-enclosed.js.map +0 -1
  221. package/dist/cjs/types/params-kms.js +0 -3
  222. package/dist/cjs/types/params-kms.js.map +0 -1
  223. package/dist/cjs/types/signer.js +0 -3
  224. package/dist/cjs/types/signer.js.map +0 -1
  225. package/dist/cjs/utils.js +0 -173
  226. package/dist/cjs/utils.js.map +0 -1
package/dist/browser.js DELETED
@@ -1,64 +0,0 @@
1
- "use strict";var Web5Crypto=(()=>{var c0=Object.create;var Vi=Object.defineProperty;var f0=Object.getOwnPropertyDescriptor;var u0=Object.getOwnPropertyNames;var l0=Object.getPrototypeOf,d0=Object.prototype.hasOwnProperty;var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Is=(t,e)=>{for(var r in e)Vi(t,r,{get:e[r],enumerable:!0})},cu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of u0(e))!d0.call(t,i)&&i!==r&&Vi(t,i,{get:()=>e[i],enumerable:!(n=f0(e,i))||n.enumerable});return t};var Hi=(t,e,r)=>(r=t!=null?c0(l0(t)):{},cu(e||!t||!t.__esModule?Vi(r,"default",{value:t,enumerable:!0}):r,t)),h0=t=>cu(Vi({},"__esModule",{value:!0}),t);var uu=M((O_,fu)=>{var p0=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Gi=()=>p0.now(),y0=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Rs=t=>t===1/0||y0(t),Us=class t{constructor({max:e=1/0,ttl:r,updateAgeOnGet:n=!1,checkAgeOnGet:i=!1,noUpdateTTL:o=!1,dispose:s,noDisposeOnSet:a=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,r!==void 0&&!Rs(r))throw new TypeError("ttl must be positive integer or Infinity if set");if(!Rs(e))throw new TypeError("max must be positive integer or Infinity");if(this.ttl=r,this.max=e,this.updateAgeOnGet=!!n,this.checkAgeOnGet=!!i,this.noUpdateTTL=!!o,this.noDisposeOnSet=!!a,s!==void 0){if(typeof s!="function")throw new TypeError("dispose must be function if set");this.dispose=s}this.timer=void 0,this.timerExpiration=void 0}setTimer(e,r){if(this.timerExpiration<e)return;this.timer&&clearTimeout(this.timer);let n=setTimeout(()=>{this.timer=void 0,this.timerExpiration=void 0,this.purgeStale();for(let i in this.expirations){this.setTimer(i,i-Gi());break}},r);n.unref&&n.unref(),this.timerExpiration=e,this.timer=n}cancelTimer(){this.timer&&(clearTimeout(this.timer),this.timerExpiration=void 0,this.timer=void 0)}cancelTimers(){return process.emitWarning('TTLCache.cancelTimers has been renamed to TTLCache.cancelTimer (no "s"), and will be removed in the next major version update'),this.cancelTimer()}clear(){let e=this.dispose!==t.prototype.dispose?[...this]:[];this.data.clear(),this.expirationMap.clear(),this.cancelTimer(),this.expirations=Object.create(null);for(let[r,n]of e)this.dispose(n,r,"delete")}setTTL(e,r=this.ttl){let n=this.expirationMap.get(e);if(n!==void 0){let i=this.expirations[n];!i||i.length<=1?delete this.expirations[n]:this.expirations[n]=i.filter(o=>o!==e)}if(r!==1/0){let i=Math.floor(Gi()+r);this.expirationMap.set(e,i),this.expirations[i]||(this.expirations[i]=[],this.setTimer(i,r)),this.expirations[i].push(e)}else this.expirationMap.set(e,1/0)}set(e,r,{ttl:n=this.ttl,noUpdateTTL:i=this.noUpdateTTL,noDisposeOnSet:o=this.noDisposeOnSet}={}){if(!Rs(n))throw new TypeError("ttl must be positive integer or Infinity");if(this.expirationMap.has(e)){i||this.setTTL(e,n);let s=this.data.get(e);s!==r&&(this.data.set(e,r),o||this.dispose(s,e,"set"))}else this.setTTL(e,n),this.data.set(e,r);for(;this.size>this.max;)this.purgeToCapacity();return this}has(e){return this.data.has(e)}getRemainingTTL(e){let r=this.expirationMap.get(e);return r===1/0?r:r!==void 0?Math.max(0,Math.ceil(r-Gi())):0}get(e,{updateAgeOnGet:r=this.updateAgeOnGet,ttl:n=this.ttl,checkAgeOnGet:i=this.checkAgeOnGet}={}){let o=this.data.get(e);if(i&&this.getRemainingTTL(e)===0){this.delete(e);return}return r&&this.setTTL(e,n),o}dispose(e,r){}delete(e){let r=this.expirationMap.get(e);if(r!==void 0){let n=this.data.get(e);this.data.delete(e),this.expirationMap.delete(e);let i=this.expirations[r];return i&&(i.length<=1?delete this.expirations[r]:this.expirations[r]=i.filter(o=>o!==e)),this.dispose(n,e,"delete"),this.size===0&&this.cancelTimer(),!0}return!1}purgeToCapacity(){for(let e in this.expirations){let r=this.expirations[e];if(this.size-r.length>=this.max){delete this.expirations[e];let n=[];for(let i of r)n.push([i,this.data.get(i)]),this.data.delete(i),this.expirationMap.delete(i);for(let[i,o]of n)this.dispose(o,i,"evict")}else{let n=this.size-this.max,i=[];for(let o of r.splice(0,n))i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"evict");return}}}get size(){return this.data.size}purgeStale(){let e=Math.ceil(Gi());for(let r in this.expirations){if(r==="Infinity"||r>e)return;let n=[...this.expirations[r]||[]],i=[];delete this.expirations[r];for(let o of n)i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"stale")}this.size===0&&this.cancelTimer()}*entries(){for(let e in this.expirations)for(let r of this.expirations[e])yield[r,this.data.get(r)]}*keys(){for(let e in this.expirations)for(let r of this.expirations[e])yield r}*values(){for(let e in this.expirations)for(let r of this.expirations[e])yield this.data.get(r)}[Symbol.iterator](){return this.entries()}};fu.exports=Us});var Tu=M(Bu=>{"use strict";Bu.supports=function(...e){let r=e.reduce((n,i)=>Object.assign(n,i),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}});var ze=M((CA,ku)=>{"use strict";ku.exports=class extends Error{constructor(e,r){super(e||""),typeof r=="object"&&r!==null&&(r.code&&(this.code=String(r.code)),r.expected&&(this.expected=!0),r.transient&&(this.transient=!0),r.cause&&(this.cause=r.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}});var Ru=M(Ji=>{"use strict";Ji.byteLength=z0;Ji.toByteArray=Z0;Ji.fromByteArray=ew;var ft=[],qe=[],J0=typeof Uint8Array<"u"?Uint8Array:Array,Gs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ar=0,Pu=Gs.length;Ar<Pu;++Ar)ft[Ar]=Gs[Ar],qe[Gs.charCodeAt(Ar)]=Ar;var Ar,Pu;qe[45]=62;qe[95]=63;function Iu(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function z0(t){var e=Iu(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Y0(t,e,r){return(e+r)*3/4-r}function Z0(t){var e,r=Iu(t),n=r[0],i=r[1],o=new J0(Y0(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=qe[t.charCodeAt(c)]<<18|qe[t.charCodeAt(c+1)]<<12|qe[t.charCodeAt(c+2)]<<6|qe[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=qe[t.charCodeAt(c)]<<2|qe[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=qe[t.charCodeAt(c)]<<10|qe[t.charCodeAt(c+1)]<<4|qe[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function X0(t){return ft[t>>18&63]+ft[t>>12&63]+ft[t>>6&63]+ft[t&63]}function Q0(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(X0(n));return i.join("")}function ew(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Q0(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(ft[e>>2]+ft[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(ft[e>>10]+ft[e>>4&63]+ft[e<<2&63]+"=")),i.join("")}});var Uu=M(Ws=>{Ws.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,c=(1<<a)-1,f=c>>1,u=-7,l=r?i-1:0,p=r?-1:1,h=t[e+l];for(l+=p,o=h&(1<<-u)-1,h>>=-u,u+=a;u>0;o=o*256+t[e+l],l+=p,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=s*256+t[e+l],l+=p,u-=8);if(o===0)o=1-f;else{if(o===c)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-f}return(h?-1:1)*s*Math.pow(2,o-n)};Ws.write=function(t,e,r,n,i,o){var s,a,c,f=o*8-i-1,u=(1<<f)-1,l=u>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,y=n?1:-1,d=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+l>=1?e+=p/c:e+=p*Math.pow(2,1-l),e*c>=2&&(s++,c/=2),s+l>=u?(a=0,s=u):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s=s+l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+h]=a&255,h+=y,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;t[r+h]=s&255,h+=y,s/=256,f-=8);t[r+h-y]|=d*128}});var je=M(pn=>{"use strict";var Js=Ru(),dn=Uu(),Cu=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;pn.Buffer=x;pn.SlowBuffer=sw;pn.INSPECT_MAX_BYTES=50;var zi=2147483647;pn.kMaxLength=zi;x.TYPED_ARRAY_SUPPORT=tw();!x.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function tw(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(x.prototype,"parent",{enumerable:!0,get:function(){if(x.isBuffer(this))return this.buffer}});Object.defineProperty(x.prototype,"offset",{enumerable:!0,get:function(){if(x.isBuffer(this))return this.byteOffset}});function Bt(t){if(t>zi)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,x.prototype),e}function x(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Xs(t)}return Nu(t,e,r)}x.poolSize=8192;function Nu(t,e,r){if(typeof t=="string")return nw(t,e);if(ArrayBuffer.isView(t))return iw(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(ut(t,ArrayBuffer)||t&&ut(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(t,SharedArrayBuffer)||t&&ut(t.buffer,SharedArrayBuffer)))return Ys(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return x.from(n,e,r);let i=ow(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return x.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}x.from=function(t,e,r){return Nu(t,e,r)};Object.setPrototypeOf(x.prototype,Uint8Array.prototype);Object.setPrototypeOf(x,Uint8Array);function Du(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function rw(t,e,r){return Du(t),t<=0?Bt(t):e!==void 0?typeof r=="string"?Bt(t).fill(e,r):Bt(t).fill(e):Bt(t)}x.alloc=function(t,e,r){return rw(t,e,r)};function Xs(t){return Du(t),Bt(t<0?0:Qs(t)|0)}x.allocUnsafe=function(t){return Xs(t)};x.allocUnsafeSlow=function(t){return Xs(t)};function nw(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!x.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Mu(t,e)|0,n=Bt(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function zs(t){let e=t.length<0?0:Qs(t.length)|0,r=Bt(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function iw(t){if(ut(t,Uint8Array)){let e=new Uint8Array(t);return Ys(e.buffer,e.byteOffset,e.byteLength)}return zs(t)}function Ys(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,x.prototype),n}function ow(t){if(x.isBuffer(t)){let e=Qs(t.length)|0,r=Bt(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ta(t.length)?Bt(0):zs(t);if(t.type==="Buffer"&&Array.isArray(t.data))return zs(t.data)}function Qs(t){if(t>=zi)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+zi.toString(16)+" bytes");return t|0}function sw(t){return+t!=t&&(t=0),x.alloc(+t)}x.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==x.prototype};x.compare=function(e,r){if(ut(e,Uint8Array)&&(e=x.from(e,e.offset,e.byteLength)),ut(r,Uint8Array)&&(r=x.from(r,r.offset,r.byteLength)),!x.isBuffer(e)||!x.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};x.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};x.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return x.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=x.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){let s=e[n];if(ut(s,Uint8Array))o+s.length>i.length?(x.isBuffer(s)||(s=x.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(x.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function Mu(t,e){if(x.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||ut(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Zs(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Ju(t).length;default:if(i)return n?-1:Zs(t).length;e=(""+e).toLowerCase(),i=!0}}x.byteLength=Mu;function aw(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return mw(this,e,r);case"utf8":case"utf-8":return ju(this,e,r);case"ascii":return yw(this,e,r);case"latin1":case"binary":return ww(this,e,r);case"base64":return hw(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bw(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}x.prototype._isBuffer=!0;function Sr(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}x.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)Sr(this,r,r+1);return this};x.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)Sr(this,r,r+3),Sr(this,r+1,r+2);return this};x.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)Sr(this,r,r+7),Sr(this,r+1,r+6),Sr(this,r+2,r+5),Sr(this,r+3,r+4);return this};x.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ju(this,0,e):aw.apply(this,arguments)};x.prototype.toLocaleString=x.prototype.toString;x.prototype.equals=function(e){if(!x.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:x.compare(this,e)===0};x.prototype.inspect=function(){let e="",r=pn.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Cu&&(x.prototype[Cu]=x.prototype.inspect);x.prototype.compare=function(e,r,n,i,o){if(ut(e,Uint8Array)&&(e=x.from(e,e.offset,e.byteLength)),!x.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let s=o-i,a=n-r,c=Math.min(s,a),f=this.slice(i,o),u=e.slice(r,n);for(let l=0;l<c;++l)if(f[l]!==u[l]){s=f[l],a=u[l];break}return s<a?-1:a<s?1:0};function qu(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ta(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=x.from(e,n)),x.isBuffer(e))return e.length===0?-1:Lu(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Lu(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Lu(t,e,r,n,i){let o=1,s=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,a/=2,r/=2}function c(u,l){return o===1?u[l]:u.readUInt16BE(l*o)}let f;if(i){let u=-1;for(f=r;f<s;f++)if(c(t,f)===c(e,u===-1?0:f-u)){if(u===-1&&(u=f),f-u+1===a)return u*o}else u!==-1&&(f-=f-u),u=-1}else for(r+a>s&&(r=s-a),f=r;f>=0;f--){let u=!0;for(let l=0;l<a;l++)if(c(t,f+l)!==c(e,l)){u=!1;break}if(u)return f}return-1}x.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};x.prototype.indexOf=function(e,r,n){return qu(this,e,r,n,!0)};x.prototype.lastIndexOf=function(e,r,n){return qu(this,e,r,n,!1)};function cw(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let a=parseInt(e.substr(s*2,2),16);if(ta(a))return s;t[r+s]=a}return s}function fw(t,e,r,n){return Yi(Zs(e,t.length-r),t,r,n)}function uw(t,e,r,n){return Yi(_w(e),t,r,n)}function lw(t,e,r,n){return Yi(Ju(e),t,r,n)}function dw(t,e,r,n){return Yi(Aw(e,t.length-r),t,r,n)}x.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return cw(this,e,r,n);case"utf8":case"utf-8":return fw(this,e,r,n);case"ascii":case"latin1":case"binary":return uw(this,e,r,n);case"base64":return lw(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dw(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};x.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function hw(t,e,r){return e===0&&r===t.length?Js.fromByteArray(t):Js.fromByteArray(t.slice(e,r))}function ju(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){let c,f,u,l;switch(a){case 1:o<128&&(s=o);break;case 2:c=t[i+1],(c&192)===128&&(l=(o&31)<<6|c&63,l>127&&(s=l));break;case 3:c=t[i+1],f=t[i+2],(c&192)===128&&(f&192)===128&&(l=(o&15)<<12|(c&63)<<6|f&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:c=t[i+1],f=t[i+2],u=t[i+3],(c&192)===128&&(f&192)===128&&(u&192)===128&&(l=(o&15)<<18|(c&63)<<12|(f&63)<<6|u&63,l>65535&&l<1114112&&(s=l))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return pw(n)}var Ou=4096;function pw(t){let e=t.length;if(e<=Ou)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Ou));return r}function yw(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function ww(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function mw(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=e;o<r;++o)i+=Sw[t[o]];return i}function bw(t,e,r){let n=t.slice(e,r),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}x.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,x.prototype),i};function me(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}x.prototype.readUintLE=x.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return i};x.prototype.readUintBE=x.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};x.prototype.readUint8=x.prototype.readUInt8=function(e,r){return e=e>>>0,r||me(e,1,this.length),this[e]};x.prototype.readUint16LE=x.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||me(e,2,this.length),this[e]|this[e+1]<<8};x.prototype.readUint16BE=x.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||me(e,2,this.length),this[e]<<8|this[e+1]};x.prototype.readUint32LE=x.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||me(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};x.prototype.readUint32BE=x.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};x.prototype.readBigUInt64LE=Xt(function(e){e=e>>>0,hn(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Qn(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});x.prototype.readBigUInt64BE=Xt(function(e){e=e>>>0,hn(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Qn(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});x.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};x.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(e,r,this.length);let i=r,o=1,s=this[e+--i];for(;i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};x.prototype.readInt8=function(e,r){return e=e>>>0,r||me(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};x.prototype.readInt16LE=function(e,r){e=e>>>0,r||me(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};x.prototype.readInt16BE=function(e,r){e=e>>>0,r||me(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};x.prototype.readInt32LE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};x.prototype.readInt32BE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};x.prototype.readBigInt64LE=Xt(function(e){e=e>>>0,hn(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Qn(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});x.prototype.readBigInt64BE=Xt(function(e){e=e>>>0,hn(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Qn(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});x.prototype.readFloatLE=function(e,r){return e=e>>>0,r||me(e,4,this.length),dn.read(this,e,!0,23,4)};x.prototype.readFloatBE=function(e,r){return e=e>>>0,r||me(e,4,this.length),dn.read(this,e,!1,23,4)};x.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||me(e,8,this.length),dn.read(this,e,!0,52,8)};x.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||me(e,8,this.length),dn.read(this,e,!1,52,8)};function Ie(t,e,r,n,i,o){if(!x.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}x.prototype.writeUintLE=x.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Ie(this,e,r,n,a,0)}let o=1,s=0;for(this[r]=e&255;++s<n&&(o*=256);)this[r+s]=e/o&255;return r+n};x.prototype.writeUintBE=x.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Ie(this,e,r,n,a,0)}let o=n-1,s=1;for(this[r+o]=e&255;--o>=0&&(s*=256);)this[r+o]=e/s&255;return r+n};x.prototype.writeUint8=x.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,1,255,0),this[r]=e&255,r+1};x.prototype.writeUint16LE=x.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};x.prototype.writeUint16BE=x.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};x.prototype.writeUint32LE=x.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};x.prototype.writeUint32BE=x.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Fu(t,e,r,n,i){Wu(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,r}function $u(t,e,r,n,i){Wu(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o=o>>8,t[r+6]=o,o=o>>8,t[r+5]=o,o=o>>8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s=s>>8,t[r+2]=s,s=s>>8,t[r+1]=s,s=s>>8,t[r]=s,r+8}x.prototype.writeBigUInt64LE=Xt(function(e,r=0){return Fu(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});x.prototype.writeBigUInt64BE=Xt(function(e,r=0){return $u(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});x.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let c=Math.pow(2,8*n-1);Ie(this,e,r,n,c-1,-c)}let o=0,s=1,a=0;for(this[r]=e&255;++o<n&&(s*=256);)e<0&&a===0&&this[r+o-1]!==0&&(a=1),this[r+o]=(e/s>>0)-a&255;return r+n};x.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let c=Math.pow(2,8*n-1);Ie(this,e,r,n,c-1,-c)}let o=n-1,s=1,a=0;for(this[r+o]=e&255;--o>=0&&(s*=256);)e<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(e/s>>0)-a&255;return r+n};x.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};x.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};x.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};x.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};x.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Ie(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};x.prototype.writeBigInt64LE=Xt(function(e,r=0){return Fu(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});x.prototype.writeBigInt64BE=Xt(function(e,r=0){return $u(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Vu(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Hu(t,e,r,n,i){return e=+e,r=r>>>0,i||Vu(t,e,r,4,34028234663852886e22,-34028234663852886e22),dn.write(t,e,r,n,23,4),r+4}x.prototype.writeFloatLE=function(e,r,n){return Hu(this,e,r,!0,n)};x.prototype.writeFloatBE=function(e,r,n){return Hu(this,e,r,!1,n)};function Gu(t,e,r,n,i){return e=+e,r=r>>>0,i||Vu(t,e,r,8,17976931348623157e292,-17976931348623157e292),dn.write(t,e,r,n,52,8),r+8}x.prototype.writeDoubleLE=function(e,r,n){return Gu(this,e,r,!0,n)};x.prototype.writeDoubleBE=function(e,r,n){return Gu(this,e,r,!1,n)};x.prototype.copy=function(e,r,n,i){if(!x.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};x.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!x.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let s=e.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=r;o<n;++o)this[o]=e;else{let s=x.isBuffer(e)?e:x.from(e,i),a=s.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-r;++o)this[o+r]=s[o%a]}return this};var ln={};function ea(t,e,r){ln[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}ea("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ea("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ea("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Ku(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Ku(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ku(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function gw(t,e,r){hn(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Qn(e,t.length-(r+1))}function Wu(t,e,r,n,i,o){if(t>r||t<e){let s=typeof e=="bigint"?"n":"",a;throw o>3?e===0||e===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${e}${s} and <= ${r}${s}`,new ln.ERR_OUT_OF_RANGE("value",a,t)}gw(n,i,o)}function hn(t,e){if(typeof t!="number")throw new ln.ERR_INVALID_ARG_TYPE(e,"number",t)}function Qn(t,e,r){throw Math.floor(t)!==t?(hn(t,r),new ln.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new ln.ERR_BUFFER_OUT_OF_BOUNDS:new ln.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var xw=/[^+/0-9A-Za-z-_]/g;function Ew(t){if(t=t.split("=")[0],t=t.trim().replace(xw,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Zs(t,e){e=e||1/0;let r,n=t.length,i=null,o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function _w(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Aw(t,e){let r,n,i,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Ju(t){return Js.toByteArray(Ew(t))}function Yi(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function ut(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function ta(t){return t!==t}var Sw=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Xt(t){return typeof BigInt>"u"?vw:t}function vw(){throw new Error("BigInt not supported")}});var na=M((DA,zu)=>{"use strict";var ra=null;zu.exports=function(){return ra===null&&(ra={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),ra}});var sa=M(Yu=>{"use strict";var ia=ze(),Bw=new Set(["buffer","view","utf8"]),oa=class{constructor(e){if(this.encode=e.encode||this.encode,this.decode=e.decode||this.decode,this.name=e.name||this.name,this.format=e.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!Bw.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");e.createViewTranscoder&&(this.createViewTranscoder=e.createViewTranscoder),e.createBufferTranscoder&&(this.createBufferTranscoder=e.createBufferTranscoder),e.createUTF8Transcoder&&(this.createUTF8Transcoder=e.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new ia(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new ia(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new ia(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};Yu.Encoding=oa});var ua=M(Zi=>{"use strict";var{Buffer:ca}=je()||{},{Encoding:fa}=sa(),Tw=na(),ei=class extends fa{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new ti({encode:this.encode,decode:e=>this.decode(ca.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},ti=class extends fa{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new ei({encode:e=>{let r=this.encode(e);return ca.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},aa=class extends fa{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new ei({encode:e=>ca.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:r}=Tw();return new ti({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(r.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};Zi.BufferFormat=ei;Zi.ViewFormat=ti;Zi.UTF8Format=aa});var el=M(vr=>{"use strict";var{Buffer:Ae}=je()||{Buffer:{isBuffer:()=>!1}},{textEncoder:Xu,textDecoder:Zu}=na()(),{BufferFormat:ri,ViewFormat:la,UTF8Format:Qu}=ua(),Xi=t=>t;vr.utf8=new Qu({encode:function(t){return Ae.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?Zu.decode(t):String(t)},decode:Xi,name:"utf8",createViewTranscoder(){return new la({encode:function(t){return ArrayBuffer.isView(t)?t:Xu.encode(t)},decode:function(t){return Zu.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new ri({encode:function(t){return Ae.isBuffer(t)?t:ArrayBuffer.isView(t)?Ae.from(t.buffer,t.byteOffset,t.byteLength):Ae.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}});vr.json=new Qu({encode:JSON.stringify,decode:JSON.parse,name:"json"});vr.buffer=new ri({encode:function(t){return Ae.isBuffer(t)?t:ArrayBuffer.isView(t)?Ae.from(t.buffer,t.byteOffset,t.byteLength):Ae.from(String(t),"utf8")},decode:Xi,name:"buffer",createViewTranscoder(){return new la({encode:function(t){return ArrayBuffer.isView(t)?t:Ae.from(String(t),"utf8")},decode:function(t){return Ae.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}});vr.view=new la({encode:function(t){return ArrayBuffer.isView(t)?t:Xu.encode(t)},decode:Xi,name:"view",createBufferTranscoder(){return new ri({encode:function(t){return Ae.isBuffer(t)?t:ArrayBuffer.isView(t)?Ae.from(t.buffer,t.byteOffset,t.byteLength):Ae.from(String(t),"utf8")},decode:Xi,name:`${this.name}+buffer`})}});vr.hex=new ri({encode:function(t){return Ae.isBuffer(t)?t:Ae.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"});vr.base64=new ri({encode:function(t){return Ae.isBuffer(t)?t:Ae.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})});var nl=M(rl=>{"use strict";var tl=ze(),eo=el(),{Encoding:kw}=sa(),{BufferFormat:Pw,ViewFormat:Iw,UTF8Format:Rw}=ua(),ni=Symbol("formats"),Qi=Symbol("encodings"),Uw=new Set(["buffer","view","utf8"]),da=class{constructor(e){if(Array.isArray(e)){if(!e.every(r=>Uw.has(r)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[Qi]=new Map,this[ni]=new Set(e);for(let r in eo)try{this.encoding(r)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[Qi].values()))}encoding(e){let r=this[Qi].get(e);if(r===void 0){if(typeof e=="string"&&e!==""){if(r=Kw[e],!r)throw new tl(`Encoding '${e}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof e!="object"||e===null)throw new TypeError("First argument 'encoding' must be a string or object");r=Cw(e)}let{name:n,format:i}=r;if(!this[ni].has(i))if(this[ni].has("view"))r=r.createViewTranscoder();else if(this[ni].has("buffer"))r=r.createBufferTranscoder();else if(this[ni].has("utf8"))r=r.createUTF8Transcoder();else throw new tl(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let o of[e,n,r.name,r.commonName])this[Qi].set(o,r)}return r}};rl.Transcoder=da;function Cw(t){if(t instanceof kw)return t;let e="type"in t&&typeof t.type=="string"?t.type:void 0,r=t.name||e||`anonymous-${Nw++}`;switch(Lw(t)){case"view":return new Iw({...t,name:r});case"utf8":return new Rw({...t,name:r});case"buffer":return new Pw({...t,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function Lw(t){return"format"in t&&t.format!==void 0?t.format:"buffer"in t&&typeof t.buffer=="boolean"?t.buffer?"buffer":"utf8":"code"in t&&Number.isInteger(t.code)?"view":"buffer"}var Ow={binary:eo.buffer,"utf-8":eo.utf8},Kw={...eo,...Ow},Nw=0});var wn=M(($A,ha)=>{"use strict";var yn=typeof Reflect=="object"?Reflect:null,il=yn&&typeof yn.apply=="function"?yn.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},to;yn&&typeof yn.ownKeys=="function"?to=yn.ownKeys:Object.getOwnPropertySymbols?to=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:to=function(e){return Object.getOwnPropertyNames(e)};function Dw(t){console&&console.warn&&console.warn(t)}var sl=Number.isNaN||function(e){return e!==e};function re(){re.init.call(this)}ha.exports=re;ha.exports.once=Fw;re.EventEmitter=re;re.prototype._events=void 0;re.prototype._eventsCount=0;re.prototype._maxListeners=void 0;var ol=10;function ro(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(re,"defaultMaxListeners",{enumerable:!0,get:function(){return ol},set:function(t){if(typeof t!="number"||t<0||sl(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ol=t}});re.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};re.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||sl(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function al(t){return t._maxListeners===void 0?re.defaultMaxListeners:t._maxListeners}re.prototype.getMaxListeners=function(){return al(this)};re.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(c===void 0)return!1;if(typeof c=="function")il(c,this,r);else for(var f=c.length,u=dl(c,f),n=0;n<f;++n)il(u[n],this,r);return!0};function cl(t,e,r,n){var i,o,s;if(ro(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),i=al(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,Dw(a)}return t}re.prototype.addListener=function(e,r){return cl(this,e,r,!1)};re.prototype.on=re.prototype.addListener;re.prototype.prependListener=function(e,r){return cl(this,e,r,!0)};function Mw(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function fl(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Mw.bind(n);return i.listener=r,n.wrapFn=i,i}re.prototype.once=function(e,r){return ro(r),this.on(e,fl(this,e,r)),this};re.prototype.prependOnceListener=function(e,r){return ro(r),this.prependListener(e,fl(this,e,r)),this};re.prototype.removeListener=function(e,r){var n,i,o,s,a;if(ro(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===r||n[s].listener===r){a=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():qw(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};re.prototype.off=re.prototype.removeListener;re.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var o=Object.keys(n),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function ul(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?jw(i):dl(i,i.length)}re.prototype.listeners=function(e){return ul(this,e,!0)};re.prototype.rawListeners=function(e){return ul(this,e,!1)};re.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ll.call(t,e)};re.prototype.listenerCount=ll;function ll(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}re.prototype.eventNames=function(){return this._eventsCount>0?to(this._events):[]};function dl(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function qw(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function jw(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Fw(t,e){return new Promise(function(r,n){function i(s){t.removeListener(e,o),n(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}hl(t,e,o,{once:!0}),e!=="error"&&$w(t,i,{once:!0})})}function $w(t,e,r){typeof t.on=="function"&&hl(t,"error",e,r)}function hl(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var yl=M((VA,pl)=>{pl.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var ii=M(pa=>{"use strict";var wl=yl();pa.fromCallback=function(t,e){if(t===void 0){var r=new Promise(function(n,i){t=function(o,s){o?i(o):n(s)}});t[e!==void 0?e:"promise"]=r}else if(typeof t!="function")throw new TypeError("Callback must be a function");return t};pa.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){wl(()=>e(null,r))}).catch(function(r){wl(()=>e(r))})}});var no=M(ya=>{"use strict";ya.getCallback=function(t,e){return typeof t=="function"?t:e};ya.getOptions=function(t,e){return typeof t=="object"&&t!==null?t:e!==void 0?e:{}}});var ir=M(ao=>{"use strict";var{fromCallback:wa}=ii(),Le=ze(),{getOptions:ma,getCallback:ml}=no(),Br=Symbol("promise"),mn=Symbol("callback"),lt=Symbol("working"),Tr=Symbol("handleOne"),Tt=Symbol("handleMany"),ba=Symbol("autoClose"),rr=Symbol("finishWork"),dt=Symbol("returnMany"),Qt=Symbol("closing"),oi=Symbol("handleClose"),io=Symbol("closed"),si=Symbol("closeCallbacks"),tr=Symbol("keyEncoding"),kr=Symbol("valueEncoding"),ga=Symbol("abortOnClose"),oo=Symbol("legacy"),xa=Symbol("keys"),Ea=Symbol("values"),er=Symbol("limit"),Fe=Symbol("count"),so=Object.freeze({}),Vw=()=>{},bl=!1,ai=class{constructor(e,r,n){if(typeof e!="object"||e===null){let i=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${i}`)}if(typeof r!="object"||r===null)throw new TypeError("The second argument must be an options object");this[io]=!1,this[si]=[],this[lt]=!1,this[Qt]=!1,this[ba]=!1,this[mn]=null,this[Tr]=this[Tr].bind(this),this[Tt]=this[Tt].bind(this),this[oi]=this[oi].bind(this),this[tr]=r[tr],this[kr]=r[kr],this[oo]=n,this[er]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[Fe]=0,this[ga]=!!r.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[Fe]}get limit(){return this[er]}next(e){let r;if(e===void 0)r=new Promise((n,i)=>{e=(o,s,a)=>{o?i(o):this[oo]?s===void 0&&a===void 0?n():n([s,a]):n(s)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[Qt]?this.nextTick(e,new Le("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[lt]?this.nextTick(e,new Le("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[lt]=!0,this[mn]=e,this[Fe]>=this[er]?this.nextTick(this[Tr],null):this._next(this[Tr])),r}_next(e){this.nextTick(e)}nextv(e,r,n){return n=ml(r,n),n=wa(n,Br),r=ma(r,so),Number.isInteger(e)?(this[Qt]?this.nextTick(n,new Le("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[lt]?this.nextTick(n,new Le("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[er]<1/0&&(e=Math.min(e,this[er]-this[Fe])),this[lt]=!0,this[mn]=n,e<=0?this.nextTick(this[Tt],null,[]):this._nextv(e,r,this[Tt])),n[Br]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[Br])}_nextv(e,r,n){let i=[],o=(s,a,c)=>{if(s)return n(s);if(this[oo]?a===void 0&&c===void 0:a===void 0)return n(null,i);i.push(this[oo]?[a,c]:a),i.length===e?n(null,i):this._next(o)};this._next(o)}all(e,r){return r=ml(e,r),r=wa(r,Br),e=ma(e,so),this[Qt]?this.nextTick(r,new Le("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[lt]?this.nextTick(r,new Le("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[lt]=!0,this[mn]=r,this[ba]=!0,this[Fe]>=this[er]?this.nextTick(this[Tt],null,[]):this._all(e,this[Tt])),r[Br]}_all(e,r){let n=this[Fe],i=[],o=()=>{let a=this[er]<1/0?Math.min(1e3,this[er]-n):1e3;a<=0?this.nextTick(r,null,i):this._nextv(a,so,s)},s=(a,c)=>{a?r(a):c.length===0?r(null,i):(i.push.apply(i,c),n+=c.length,o())};o()}[rr](){let e=this[mn];return this[ga]&&e===null?Vw:(this[lt]=!1,this[mn]=null,this[Qt]&&this._close(this[oi]),e)}[dt](e,r,n){this[ba]?this.close(e.bind(null,r,n)):e(r,n)}seek(e,r){if(r=ma(r,so),!this[Qt]){if(this[lt])throw new Le("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let n=this.db.keyEncoding(r.keyEncoding||this[tr]),i=n.format;r.keyEncoding!==i&&(r={...r,keyEncoding:i});let o=this.db.prefixKey(n.encode(e),i);this._seek(o,r)}}}_seek(e,r){throw new Le("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(e){return e=wa(e,Br),this[io]?this.nextTick(e):this[Qt]?this[si].push(e):(this[Qt]=!0,this[si].push(e),this[lt]?this[ga]&&this[rr]()(new Le("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[oi])),e[Br]}_close(e){this.nextTick(e)}[oi](){this[io]=!0,this.db.detachResource(this);let e=this[si];this[si]=[];for(let r of e)r()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.next())!==void 0;)yield e}finally{this[io]||await this.close()}}},bn=class extends ai{constructor(e,r){super(e,r,!0),this[xa]=r.keys!==!1,this[Ea]=r.values!==!1}[Tr](e,r,n){let i=this[rr]();if(e)return i(e);try{r=this[xa]&&r!==void 0?this[tr].decode(r):void 0,n=this[Ea]&&n!==void 0?this[kr].decode(n):void 0}catch(o){return i(new nr("entry",o))}r===void 0&&n===void 0||this[Fe]++,i(null,r,n)}[Tt](e,r){let n=this[rr]();if(e)return this[dt](n,e);try{for(let i of r){let o=i[0],s=i[1];i[0]=this[xa]&&o!==void 0?this[tr].decode(o):void 0,i[1]=this[Ea]&&s!==void 0?this[kr].decode(s):void 0}}catch(i){return this[dt](n,new nr("entries",i))}this[Fe]+=r.length,this[dt](n,null,r)}end(e){return!bl&&typeof console<"u"&&(bl=!0,console.warn(new Le("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(e)}},_a=class extends ai{constructor(e,r){super(e,r,!1)}[Tr](e,r){let n=this[rr]();if(e)return n(e);try{r=r!==void 0?this[tr].decode(r):void 0}catch(i){return n(new nr("key",i))}r!==void 0&&this[Fe]++,n(null,r)}[Tt](e,r){let n=this[rr]();if(e)return this[dt](n,e);try{for(let i=0;i<r.length;i++){let o=r[i];r[i]=o!==void 0?this[tr].decode(o):void 0}}catch(i){return this[dt](n,new nr("keys",i))}this[Fe]+=r.length,this[dt](n,null,r)}},Aa=class extends ai{constructor(e,r){super(e,r,!1)}[Tr](e,r){let n=this[rr]();if(e)return n(e);try{r=r!==void 0?this[kr].decode(r):void 0}catch(i){return n(new nr("value",i))}r!==void 0&&this[Fe]++,n(null,r)}[Tt](e,r){let n=this[rr]();if(e)return this[dt](n,e);try{for(let i=0;i<r.length;i++){let o=r[i];r[i]=o!==void 0?this[kr].decode(o):void 0}}catch(i){return this[dt](n,new nr("values",i))}this[Fe]+=r.length,this[dt](n,null,r)}},nr=class extends Le{constructor(e,r){super(`Iterator could not decode ${e}`,{code:"LEVEL_DECODE_ERROR",cause:r})}};for(let t of["_ended property","_nexting property","_end method"])Object.defineProperty(bn.prototype,t.split(" ")[0],{get(){throw new Le(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new Le(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})}});bn.keyEncoding=tr;bn.valueEncoding=kr;ao.AbstractIterator=bn;ao.AbstractKeyIterator=_a;ao.AbstractValueIterator=Aa});var gl=M(Sa=>{"use strict";var{AbstractKeyIterator:Hw,AbstractValueIterator:Gw}=ir(),Pr=Symbol("iterator"),ci=Symbol("callback"),gn=Symbol("handleOne"),Ir=Symbol("handleMany"),fi=class extends Hw{constructor(e,r){super(e,r),this[Pr]=e.iterator({...r,keys:!0,values:!1}),this[gn]=this[gn].bind(this),this[Ir]=this[Ir].bind(this)}},co=class extends Gw{constructor(e,r){super(e,r),this[Pr]=e.iterator({...r,keys:!1,values:!0}),this[gn]=this[gn].bind(this),this[Ir]=this[Ir].bind(this)}};for(let t of[fi,co]){let e=t===fi,r=e?n=>n[0]:n=>n[1];t.prototype._next=function(n){this[ci]=n,this[Pr].next(this[gn])},t.prototype[gn]=function(n,i,o){let s=this[ci];n?s(n):s(null,e?i:o)},t.prototype._nextv=function(n,i,o){this[ci]=o,this[Pr].nextv(n,i,this[Ir])},t.prototype._all=function(n,i){this[ci]=i,this[Pr].all(n,this[Ir])},t.prototype[Ir]=function(n,i){let o=this[ci];n?o(n):o(null,i.map(r))},t.prototype._seek=function(n,i){this[Pr].seek(n,i)},t.prototype._close=function(n){this[Pr].close(n)}}Sa.DefaultKeyIterator=fi;Sa.DefaultValueIterator=co});var xl=M(yo=>{"use strict";var{AbstractIterator:Ww,AbstractKeyIterator:Jw,AbstractValueIterator:zw}=ir(),va=ze(),Re=Symbol("nut"),ho=Symbol("undefer"),po=Symbol("factory"),fo=class extends Ww{constructor(e,r){super(e,r),this[Re]=null,this[po]=()=>e.iterator(r),this.db.defer(()=>this[ho]())}},uo=class extends Jw{constructor(e,r){super(e,r),this[Re]=null,this[po]=()=>e.keys(r),this.db.defer(()=>this[ho]())}},lo=class extends zw{constructor(e,r){super(e,r),this[Re]=null,this[po]=()=>e.values(r),this.db.defer(()=>this[ho]())}};for(let t of[fo,uo,lo])t.prototype[ho]=function(){this.db.status==="open"&&(this[Re]=this[po]())},t.prototype._next=function(e){this[Re]!==null?this[Re].next(e):this.db.status==="opening"?this.db.defer(()=>this._next(e)):this.nextTick(e,new va("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._nextv=function(e,r,n){this[Re]!==null?this[Re].nextv(e,r,n):this.db.status==="opening"?this.db.defer(()=>this._nextv(e,r,n)):this.nextTick(n,new va("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._all=function(e,r){this[Re]!==null?this[Re].all(r):this.db.status==="opening"?this.db.defer(()=>this._all(e,r)):this.nextTick(r,new va("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._seek=function(e,r){this[Re]!==null?this[Re]._seek(e,r):this.db.status==="opening"&&this.db.defer(()=>this._seek(e,r))},t.prototype._close=function(e){this[Re]!==null?this[Re].close(e):this.db.status==="opening"?this.db.defer(()=>this._close(e)):this.nextTick(e)};yo.DeferredIterator=fo;yo.DeferredKeyIterator=uo;yo.DeferredValueIterator=lo});var Ta=M(_l=>{"use strict";var{fromCallback:El}=ii(),wo=ze(),{getCallback:Yw,getOptions:Zw}=no(),mo=Symbol("promise"),$e=Symbol("status"),xn=Symbol("operations"),ui=Symbol("finishClose"),En=Symbol("closeCallbacks"),Ba=class{constructor(e){if(typeof e!="object"||e===null){let r=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${r}`)}this[xn]=[],this[En]=[],this[$e]="open",this[ui]=this[ui].bind(this),this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get length(){return this[xn].length}put(e,r,n){if(this[$e]!=="open")throw new wo("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let i=this.db._checkKey(e)||this.db._checkValue(r);if(i)throw i;let o=n&&n.sublevel!=null?n.sublevel:this.db,s=n,a=o.keyEncoding(n&&n.keyEncoding),c=o.valueEncoding(n&&n.valueEncoding),f=a.format;n={...n,keyEncoding:f,valueEncoding:c.format},o!==this.db&&(n.sublevel=null);let u=o.prefixKey(a.encode(e),f),l=c.encode(r);return this._put(u,l,n),this[xn].push({...s,type:"put",key:e,value:r}),this}_put(e,r,n){}del(e,r){if(this[$e]!=="open")throw new wo("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let n=this.db._checkKey(e);if(n)throw n;let i=r&&r.sublevel!=null?r.sublevel:this.db,o=r,s=i.keyEncoding(r&&r.keyEncoding),a=s.format;return r={...r,keyEncoding:a},i!==this.db&&(r.sublevel=null),this._del(i.prefixKey(s.encode(e),a),r),this[xn].push({...o,type:"del",key:e}),this}_del(e,r){}clear(){if(this[$e]!=="open")throw new wo("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[xn]=[],this}_clear(){}write(e,r){return r=Yw(e,r),r=El(r,mo),e=Zw(e),this[$e]!=="open"?this.nextTick(r,new wo("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(r):(this[$e]="writing",this._write(e,n=>{this[$e]="closing",this[En].push(()=>r(n)),n||this.db.emit("batch",this[xn]),this._close(this[ui])})),r[mo]}_write(e,r){}close(e){return e=El(e,mo),this[$e]==="closing"?this[En].push(e):this[$e]==="closed"?this.nextTick(e):(this[En].push(e),this[$e]!=="writing"&&(this[$e]="closing",this._close(this[ui]))),e[mo]}_close(e){this.nextTick(e)}[ui](){this[$e]="closed",this.db.detachResource(this);let e=this[En];this[En]=[];for(let r of e)r()}};_l.AbstractChainedBatch=Ba});var Sl=M(Al=>{"use strict";var{AbstractChainedBatch:Xw}=Ta(),Qw=ze(),_n=Symbol("encoded"),ka=class extends Xw{constructor(e){super(e),this[_n]=[]}_put(e,r,n){this[_n].push({...n,type:"put",key:e,value:r})}_del(e,r){this[_n].push({...r,type:"del",key:e})}_clear(){this[_n]=[]}_write(e,r){this.db.status==="opening"?this.db.defer(()=>this._write(e,r)):this.db.status==="open"?this[_n].length===0?this.nextTick(r):this.db._batch(this[_n],e,r):this.nextTick(r,new Qw("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};Al.DefaultChainedBatch=ka});var Tl=M((XA,Bl)=>{"use strict";var vl=ze(),em=Object.prototype.hasOwnProperty,tm=new Set(["lt","lte","gt","gte"]);Bl.exports=function(t,e){let r={};for(let n in t)if(em.call(t,n)&&!(n==="keyEncoding"||n==="valueEncoding")){if(n==="start"||n==="end")throw new vl(`The legacy range option '${n}' has been removed`,{code:"LEVEL_LEGACY"});if(n==="encoding")throw new vl("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});tm.has(n)?r[n]=e.encode(t[n]):r[n]=t[n]}return r.reverse=!!r.reverse,r.limit=Number.isInteger(r.limit)&&r.limit>=0?r.limit:-1,r}});var Pa=M((QA,Pl)=>{var kl;Pl.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:globalThis):t=>(kl||(kl=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var Ul=M((eS,Rl)=>{"use strict";var Il=Pa();Rl.exports=function(t,...e){e.length===0?Il(t):Il(()=>t(...e))}});var Cl=M(bo=>{"use strict";var{AbstractIterator:rm,AbstractKeyIterator:nm,AbstractValueIterator:im}=ir(),An=Symbol("unfix"),Ye=Symbol("iterator"),Rr=Symbol("handleOne"),or=Symbol("handleMany"),kt=Symbol("callback"),li=class extends rm{constructor(e,r,n,i){super(e,r),this[Ye]=n,this[An]=i,this[Rr]=this[Rr].bind(this),this[or]=this[or].bind(this),this[kt]=null}[Rr](e,r,n){let i=this[kt];if(e)return i(e);r!==void 0&&(r=this[An](r)),i(e,r,n)}[or](e,r){let n=this[kt];if(e)return n(e);for(let i of r){let o=i[0];o!==void 0&&(i[0]=this[An](o))}n(e,r)}},di=class extends nm{constructor(e,r,n,i){super(e,r),this[Ye]=n,this[An]=i,this[Rr]=this[Rr].bind(this),this[or]=this[or].bind(this),this[kt]=null}[Rr](e,r){let n=this[kt];if(e)return n(e);r!==void 0&&(r=this[An](r)),n(e,r)}[or](e,r){let n=this[kt];if(e)return n(e);for(let i=0;i<r.length;i++){let o=r[i];o!==void 0&&(r[i]=this[An](o))}n(e,r)}},hi=class extends im{constructor(e,r,n){super(e,r),this[Ye]=n}};for(let t of[li,di])t.prototype._next=function(e){this[kt]=e,this[Ye].next(this[Rr])},t.prototype._nextv=function(e,r,n){this[kt]=n,this[Ye].nextv(e,r,this[or])},t.prototype._all=function(e,r){this[kt]=r,this[Ye].all(e,this[or])};for(let t of[hi])t.prototype._next=function(e){this[Ye].next(e)},t.prototype._nextv=function(e,r,n){this[Ye].nextv(e,r,n)},t.prototype._all=function(e,r){this[Ye].all(e,r)};for(let t of[li,di,hi])t.prototype._seek=function(e,r){this[Ye].seek(e,r)},t.prototype._close=function(e){this[Ye].close(e)};bo.AbstractSublevelIterator=li;bo.AbstractSublevelKeyIterator=di;bo.AbstractSublevelValueIterator=hi});var Nl=M((rS,Kl)=>{"use strict";var Ia=ze(),{Buffer:Ca}=je()||{},{AbstractSublevelIterator:om,AbstractSublevelKeyIterator:sm,AbstractSublevelValueIterator:am}=Cl(),Pt=Symbol("prefix"),Ll=Symbol("upperBound"),pi=Symbol("prefixRange"),Oe=Symbol("parent"),Ra=Symbol("unfix"),Ol=new TextEncoder,cm={separator:"!"};Kl.exports=function({AbstractLevel:t}){class e extends t{static defaults(n){if(typeof n=="string")throw new Ia("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(n&&n.open)throw new Ia("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return n==null?cm:n.separator?n:{...n,separator:"!"}}constructor(n,i,o){let{separator:s,manifest:a,...c}=e.defaults(o);i=um(i,s);let f=s.charCodeAt(0)+1,u=n[Oe]||n;if(!Ol.encode(i).every(h=>h>f&&h<127))throw new Ia(`Prefix must use bytes > ${f} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(fm(u,a),c);let l=(n.prefix||"")+s+i+s,p=l.slice(0,-1)+String.fromCharCode(f);this[Oe]=u,this[Pt]=new go(l),this[Ll]=new go(p),this[Ra]=new La,this.nextTick=u.nextTick}prefixKey(n,i){if(i==="utf8")return this[Pt].utf8+n;if(n.byteLength===0)return this[Pt][i];if(i==="view"){let o=this[Pt].view,s=new Uint8Array(o.byteLength+n.byteLength);return s.set(o,0),s.set(n,o.byteLength),s}else{let o=this[Pt].buffer;return Ca.concat([o,n],o.byteLength+n.byteLength)}}[pi](n,i){n.gte!==void 0?n.gte=this.prefixKey(n.gte,i):n.gt!==void 0?n.gt=this.prefixKey(n.gt,i):n.gte=this[Pt][i],n.lte!==void 0?n.lte=this.prefixKey(n.lte,i):n.lt!==void 0?n.lt=this.prefixKey(n.lt,i):n.lte=this[Ll][i]}get prefix(){return this[Pt].utf8}get db(){return this[Oe]}_open(n,i){this[Oe].open({passive:!0},i)}_put(n,i,o,s){this[Oe].put(n,i,o,s)}_get(n,i,o){this[Oe].get(n,i,o)}_getMany(n,i,o){this[Oe].getMany(n,i,o)}_del(n,i,o){this[Oe].del(n,i,o)}_batch(n,i,o){this[Oe].batch(n,i,o)}_clear(n,i){this[pi](n,n.keyEncoding),this[Oe].clear(n,i)}_iterator(n){this[pi](n,n.keyEncoding);let i=this[Oe].iterator(n),o=this[Ra].get(this[Pt].utf8.length,n.keyEncoding);return new om(this,n,i,o)}_keys(n){this[pi](n,n.keyEncoding);let i=this[Oe].keys(n),o=this[Ra].get(this[Pt].utf8.length,n.keyEncoding);return new sm(this,n,i,o)}_values(n){this[pi](n,n.keyEncoding);let i=this[Oe].values(n);return new am(this,n,i)}}return{AbstractSublevel:e}};var fm=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:Ua(t,"utf8"),buffer:Ua(t,"buffer"),view:Ua(t,"view")}}},Ua=function(t,e){return t.supports.encodings[e]?t.keyEncoding(e).name===e:!1},go=class{constructor(e){this.utf8=e,this.view=Ol.encode(e),this.buffer=Ca?Ca.from(this.view.buffer,0,this.view.byteLength):{}}},La=class{constructor(){this.cache=new Map}get(e,r){let n=this.cache.get(r);return n===void 0&&(r==="view"?n=(function(i,o){return o.subarray(i)}).bind(null,e):n=(function(i,o){return o.slice(i)}).bind(null,e),this.cache.set(r,n)),n}},um=function(t,e){let r=0,n=t.length;for(;r<n&&t[r]===e;)r++;for(;n>r&&t[n-1]===e;)n--;return t.slice(r,n)}});var Ma=M(Da=>{"use strict";var{supports:lm}=Tu(),{Transcoder:dm}=nl(),{EventEmitter:hm}=wn(),{fromCallback:sr}=ii(),Ze=ze(),{AbstractIterator:Ur}=ir(),{DefaultKeyIterator:pm,DefaultValueIterator:ym}=gl(),{DeferredIterator:wm,DeferredKeyIterator:mm,DeferredValueIterator:bm}=xl(),{DefaultChainedBatch:Dl}=Sl(),{getCallback:Cr,getOptions:ar}=no(),xo=Tl(),J=Symbol("promise"),It=Symbol("landed"),Lr=Symbol("resources"),Oa=Symbol("closeResources"),yi=Symbol("operations"),wi=Symbol("undefer"),Eo=Symbol("deferOpen"),Ml=Symbol("options"),X=Symbol("status"),Or=Symbol("defaultOptions"),Sn=Symbol("transcoder"),_o=Symbol("keyEncoding"),Ka=Symbol("valueEncoding"),gm=()=>{},mi=class extends hm{constructor(e,r){if(super(),typeof e!="object"||e===null)throw new TypeError("The first argument 'manifest' must be an object");r=ar(r);let{keyEncoding:n,valueEncoding:i,passive:o,...s}=r;this[Lr]=new Set,this[yi]=[],this[Eo]=!0,this[Ml]=s,this[X]="opening",this.supports=lm(e,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:e.snapshots!==!1,permanence:e.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:e.encodings||{},events:Object.assign({},e.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[Sn]=new dm(xm(this)),this[_o]=this[Sn].encoding(n||"utf8"),this[Ka]=this[Sn].encoding(i||"utf8");for(let a of this[Sn].encodings())this.supports.encodings[a.commonName]||(this.supports.encodings[a.commonName]=!0);this[Or]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[_o].commonName,valueEncoding:this[Ka].commonName}),key:Object.freeze({keyEncoding:this[_o].commonName})},this.nextTick(()=>{this[Eo]&&this.open({passive:!1},gm)})}get status(){return this[X]}keyEncoding(e){return this[Sn].encoding(e??this[_o])}valueEncoding(e){return this[Sn].encoding(e??this[Ka])}open(e,r){r=Cr(e,r),r=sr(r,J),e={...this[Ml],...ar(e)},e.createIfMissing=e.createIfMissing!==!1,e.errorIfExists=!!e.errorIfExists;let n=i=>{this[X]==="closing"||this[X]==="opening"?this.once(It,i?()=>n(i):n):this[X]!=="open"?r(new Ze("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:i})):r()};return e.passive?this[X]==="opening"?this.once(It,n):this.nextTick(n):this[X]==="closed"||this[Eo]?(this[Eo]=!1,this[X]="opening",this.emit("opening"),this._open(e,i=>{if(i){this[X]="closed",this[Oa](()=>{this.emit(It),n(i)}),this[wi]();return}this[X]="open",this[wi](),this.emit(It),this[X]==="open"&&this.emit("open"),this[X]==="open"&&this.emit("ready"),n()})):this[X]==="open"?this.nextTick(n):this.once(It,()=>this.open(e,r)),r[J]}_open(e,r){this.nextTick(r)}close(e){e=sr(e,J);let r=n=>{this[X]==="opening"||this[X]==="closing"?this.once(It,n?r(n):r):this[X]!=="closed"?e(new Ze("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:n})):e()};if(this[X]==="open"){this[X]="closing",this.emit("closing");let n=i=>{this[X]="open",this[wi](),this.emit(It),r(i)};this[Oa](()=>{this._close(i=>{if(i)return n(i);this[X]="closed",this[wi](),this.emit(It),this[X]==="closed"&&this.emit("closed"),r()})})}else this[X]==="closed"?this.nextTick(r):this.once(It,()=>this.close(e));return e[J]}[Oa](e){if(this[Lr].size===0)return this.nextTick(e);let r=this[Lr].size,n=!0,i=()=>{--r===0&&(n?this.nextTick(e):e())};for(let o of this[Lr])o.close(i);n=!1,this[Lr].clear()}_close(e){this.nextTick(e)}get(e,r,n){if(n=Cr(r,n),n=sr(n,J),r=ar(r,this[Or].entry),this[X]==="opening")return this.defer(()=>this.get(e,r,n)),n[J];if(vn(this,n))return n[J];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[J];let o=this.keyEncoding(r.keyEncoding),s=this.valueEncoding(r.valueEncoding),a=o.format,c=s.format;return(r.keyEncoding!==a||r.valueEncoding!==c)&&(r=Object.assign({},r,{keyEncoding:a,valueEncoding:c})),this._get(this.prefixKey(o.encode(e),a),r,(f,u)=>{if(f)return(f.code==="LEVEL_NOT_FOUND"||f.notFound||/NotFound/i.test(f))&&(f.code||(f.code="LEVEL_NOT_FOUND"),f.notFound||(f.notFound=!0),f.status||(f.status=404)),n(f);try{u=s.decode(u)}catch(l){return n(new Ze("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:l}))}n(null,u)}),n[J]}_get(e,r,n){this.nextTick(n,new Error("NotFound"))}getMany(e,r,n){if(n=Cr(r,n),n=sr(n,J),r=ar(r,this[Or].entry),this[X]==="opening")return this.defer(()=>this.getMany(e,r,n)),n[J];if(vn(this,n))return n[J];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'keys' must be an array")),n[J];if(e.length===0)return this.nextTick(n,null,[]),n[J];let i=this.keyEncoding(r.keyEncoding),o=this.valueEncoding(r.valueEncoding),s=i.format,a=o.format;(r.keyEncoding!==s||r.valueEncoding!==a)&&(r=Object.assign({},r,{keyEncoding:s,valueEncoding:a}));let c=new Array(e.length);for(let f=0;f<e.length;f++){let u=e[f],l=this._checkKey(u);if(l)return this.nextTick(n,l),n[J];c[f]=this.prefixKey(i.encode(u),s)}return this._getMany(c,r,(f,u)=>{if(f)return n(f);try{for(let l=0;l<u.length;l++)u[l]!==void 0&&(u[l]=o.decode(u[l]))}catch(l){return n(new Ze(`Could not decode one or more of ${u.length} value(s)`,{code:"LEVEL_DECODE_ERROR",cause:l}))}n(null,u)}),n[J]}_getMany(e,r,n){this.nextTick(n,null,new Array(e.length).fill(void 0))}put(e,r,n,i){if(i=Cr(n,i),i=sr(i,J),n=ar(n,this[Or].entry),this[X]==="opening")return this.defer(()=>this.put(e,r,n,i)),i[J];if(vn(this,i))return i[J];let o=this._checkKey(e)||this._checkValue(r);if(o)return this.nextTick(i,o),i[J];let s=this.keyEncoding(n.keyEncoding),a=this.valueEncoding(n.valueEncoding),c=s.format,f=a.format;(n.keyEncoding!==c||n.valueEncoding!==f)&&(n=Object.assign({},n,{keyEncoding:c,valueEncoding:f}));let u=this.prefixKey(s.encode(e),c),l=a.encode(r);return this._put(u,l,n,p=>{if(p)return i(p);this.emit("put",e,r),i()}),i[J]}_put(e,r,n,i){this.nextTick(i)}del(e,r,n){if(n=Cr(r,n),n=sr(n,J),r=ar(r,this[Or].key),this[X]==="opening")return this.defer(()=>this.del(e,r,n)),n[J];if(vn(this,n))return n[J];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[J];let o=this.keyEncoding(r.keyEncoding),s=o.format;return r.keyEncoding!==s&&(r=Object.assign({},r,{keyEncoding:s})),this._del(this.prefixKey(o.encode(e),s),r,a=>{if(a)return n(a);this.emit("del",e),n()}),n[J]}_del(e,r,n){this.nextTick(n)}batch(e,r,n){if(!arguments.length){if(this[X]==="opening")return new Dl(this);if(this[X]!=="open")throw new Ze("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof e=="function"?n=e:n=Cr(r,n),n=sr(n,J),r=ar(r,this[Or].empty),this[X]==="opening")return this.defer(()=>this.batch(e,r,n)),n[J];if(vn(this,n))return n[J];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'operations' must be an array")),n[J];if(e.length===0)return this.nextTick(n),n[J];let i=new Array(e.length),{keyEncoding:o,valueEncoding:s,...a}=r;for(let c=0;c<e.length;c++){if(typeof e[c]!="object"||e[c]===null)return this.nextTick(n,new TypeError("A batch operation must be an object")),n[J];let f=Object.assign({},e[c]);if(f.type!=="put"&&f.type!=="del")return this.nextTick(n,new TypeError("A batch operation must have a type property that is 'put' or 'del'")),n[J];let u=this._checkKey(f.key);if(u)return this.nextTick(n,u),n[J];let l=f.sublevel!=null?f.sublevel:this,p=l.keyEncoding(f.keyEncoding||o),h=p.format;if(f.key=l.prefixKey(p.encode(f.key),h),f.keyEncoding=h,f.type==="put"){let y=this._checkValue(f.value);if(y)return this.nextTick(n,y),n[J];let d=l.valueEncoding(f.valueEncoding||s);f.value=d.encode(f.value),f.valueEncoding=d.format}l!==this&&(f.sublevel=null),i[c]=f}return this._batch(i,a,c=>{if(c)return n(c);this.emit("batch",e),n()}),n[J]}_batch(e,r,n){this.nextTick(n)}sublevel(e,r){return this._sublevel(e,Na.defaults(r))}_sublevel(e,r){return new Na(this,e,r)}prefixKey(e,r){return e}clear(e,r){if(r=Cr(e,r),r=sr(r,J),e=ar(e,this[Or].empty),this[X]==="opening")return this.defer(()=>this.clear(e,r)),r[J];if(vn(this,r))return r[J];let n=e,i=this.keyEncoding(e.keyEncoding);return e=xo(e,i),e.keyEncoding=i.format,e.limit===0?this.nextTick(r):this._clear(e,o=>{if(o)return r(o);this.emit("clear",n),r()}),r[J]}_clear(e,r){this.nextTick(r)}iterator(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=xo(e,r),e.keys=e.keys!==!1,e.values=e.values!==!1,e[Ur.keyEncoding]=r,e[Ur.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[X]==="opening")return new wm(this,e);if(this[X]!=="open")throw new Ze("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(e)}_iterator(e){return new Ur(this,e)}keys(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=xo(e,r),e[Ur.keyEncoding]=r,e[Ur.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[X]==="opening")return new mm(this,e);if(this[X]!=="open")throw new Ze("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(e)}_keys(e){return new pm(this,e)}values(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=xo(e,r),e[Ur.keyEncoding]=r,e[Ur.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[X]==="opening")return new bm(this,e);if(this[X]!=="open")throw new Ze("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(e)}_values(e){return new ym(this,e)}defer(e){if(typeof e!="function")throw new TypeError("The first argument must be a function");this[yi].push(e)}[wi](){if(this[yi].length===0)return;let e=this[yi];this[yi]=[];for(let r of e)r()}attachResource(e){if(typeof e!="object"||e===null||typeof e.close!="function")throw new TypeError("The first argument must be a resource object");this[Lr].add(e)}detachResource(e){this[Lr].delete(e)}_chainedBatch(){return new Dl(this)}_checkKey(e){if(e==null)return new Ze("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(e){if(e==null)return new Ze("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};mi.prototype.nextTick=Ul();var{AbstractSublevel:Na}=Nl()({AbstractLevel:mi});Da.AbstractLevel=mi;Da.AbstractSublevel=Na;var vn=function(t,e){return t[X]!=="open"?(t.nextTick(e,new Ze("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},xm=function(t){return Object.keys(t.supports.encodings).filter(e=>!!t.supports.encodings[e])}});var qa=M(Kr=>{"use strict";Kr.AbstractLevel=Ma().AbstractLevel;Kr.AbstractSublevel=Ma().AbstractSublevel;Kr.AbstractIterator=ir().AbstractIterator;Kr.AbstractKeyIterator=ir().AbstractKeyIterator;Kr.AbstractValueIterator=ir().AbstractValueIterator;Kr.AbstractChainedBatch=Ta().AbstractChainedBatch});var jl=M((oS,ql)=>{ql.exports=_m;var Em=Pa();function _m(t,e,r){if(typeof e!="number")throw new Error("second argument must be a Number");let n,i,o,s,a,c=!0,f;Array.isArray(t)?(n=[],o=i=t.length):(s=Object.keys(t),n={},o=i=s.length);function u(p){function h(){r&&r(p,n),r=null}c?Em(h):h()}function l(p,h,y){if(n[p]=y,h&&(a=!0),--o===0||h)u(h);else if(!a&&f<i){let d;s?(d=s[f],f+=1,t[d](function(w,m){l(d,w,m)})):(d=f,f+=1,t[d](function(w,m){l(d,w,m)}))}}f=e,o?s?s.some(function(p,h){return t[p](function(y,d){l(p,y,d)}),h===e-1}):t.some(function(p,h){return p(function(y,d){l(h,y,d)}),h===e-1}):u(null),c=!1}});var ja=M((sS,Fl)=>{"use strict";Fl.exports=function(e){let r=e.gte!==void 0?e.gte:e.gt!==void 0?e.gt:void 0,n=e.lte!==void 0?e.lte:e.lt!==void 0?e.lt:void 0,i=e.gte===void 0,o=e.lte===void 0;return r!==void 0&&n!==void 0?IDBKeyRange.bound(r,n,i,o):r!==void 0?IDBKeyRange.lowerBound(r,i):n!==void 0?IDBKeyRange.upperBound(n,o):null}});var Fa=M((aS,$l)=>{"use strict";var Am=new TextEncoder;$l.exports=function(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):Am.encode(t)}});var Jl=M(Wl=>{"use strict";var{AbstractIterator:Sm}=qa(),Vl=ja(),Ao=Fa(),ht=Symbol("cache"),Rt=Symbol("finished"),Ke=Symbol("options"),Ut=Symbol("currentOptions"),Nr=Symbol("position"),$a=Symbol("location"),Bn=Symbol("first"),Hl={},Va=class extends Sm{constructor(e,r,n){super(e,n),this[ht]=[],this[Rt]=this.limit===0,this[Ke]=n,this[Ut]={...n},this[Nr]=void 0,this[$a]=r,this[Bn]=!0}_nextv(e,r,n){if(this[Bn]=!1,this[Rt])return this.nextTick(n,null,[]);if(this[ht].length>0)return e=Math.min(e,this[ht].length),this.nextTick(n,null,this[ht].splice(0,e));this[Nr]!==void 0&&(this[Ke].reverse?(this[Ut].lt=this[Nr],this[Ut].lte=void 0):(this[Ut].gt=this[Nr],this[Ut].gte=void 0));let i;try{i=Vl(this[Ut])}catch{return this[Rt]=!0,this.nextTick(n,null,[])}let o=this.db.db.transaction([this[$a]],"readonly"),s=o.objectStore(this[$a]),a=[];if(this[Ke].reverse){let c=!this[Ke].values&&s.openKeyCursor?"openKeyCursor":"openCursor";s[c](i,"prev").onsuccess=f=>{let u=f.target.result;if(u){let{key:l,value:p}=u;this[Nr]=l,a.push([this[Ke].keys&&l!==void 0?Ao(l):void 0,this[Ke].values&&p!==void 0?Ao(p):void 0]),a.length<e?u.continue():Gl(o)}else this[Rt]=!0}}else{let c,f,u=()=>{if(c===void 0||f===void 0)return;let l=Math.max(c.length,f.length);l===0||e===1/0?this[Rt]=!0:this[Nr]=c[l-1],a.length=l;for(let p=0;p<l;p++){let h=c[p],y=f[p];a[p]=[this[Ke].keys&&h!==void 0?Ao(h):void 0,this[Ke].values&&y!==void 0?Ao(y):void 0]}Gl(o)};this[Ke].keys||e<1/0?s.getAllKeys(i,e<1/0?e:void 0).onsuccess=l=>{c=l.target.result,u()}:(c=[],this.nextTick(u)),this[Ke].values?s.getAll(i,e<1/0?e:void 0).onsuccess=l=>{f=l.target.result,u()}:(f=[],this.nextTick(u))}o.onabort=()=>{n(o.error||new Error("aborted by user")),n=null},o.oncomplete=()=>{n(null,a),n=null}}_next(e){if(this[ht].length>0){let[r,n]=this[ht].shift();this.nextTick(e,null,r,n)}else if(this[Rt])this.nextTick(e);else{let r=Math.min(100,this.limit-this.count);this[Bn]&&(this[Bn]=!1,r=1),this._nextv(r,Hl,(n,i)=>{if(n)return e(n);this[ht]=i,this._next(e)})}}_all(e,r){this[Bn]=!1;let n=this[ht].splice(0,this[ht].length),i=this.limit-this.count-n.length;if(i<=0)return this.nextTick(r,null,n);this._nextv(i,Hl,(o,s)=>{if(o)return r(o);n.length>0&&(s=n.concat(s)),r(null,s)})}_seek(e,r){this[Bn]=!0,this[ht]=[],this[Rt]=!1,this[Nr]=void 0,this[Ut]={...this[Ke]};let n;try{n=Vl(this[Ke])}catch{this[Rt]=!0;return}n!==null&&!n.includes(e)?this[Rt]=!0:this[Ke].reverse?this[Ut].lte=e:this[Ut].gte=e}};Wl.Iterator=Va;function Gl(t){typeof t.commit=="function"&&t.commit()}});var Yl=M((fS,zl)=>{"use strict";zl.exports=function(e,r,n,i,o){if(i.limit===0)return e.nextTick(o);let s=e.db.transaction([r],"readwrite"),a=s.objectStore(r),c=0;s.oncomplete=function(){o()},s.onabort=function(){o(s.error||new Error("aborted by user"))};let f=a.openKeyCursor?"openKeyCursor":"openCursor",u=i.reverse?"prev":"next";a[f](n,u).onsuccess=function(l){let p=l.target.result;p&&(a.delete(p.key).onsuccess=function(){(i.limit<=0||++c<i.limit)&&p.continue()})}}});var rd=M(td=>{"use strict";var{AbstractLevel:vm}=qa(),Zl=ze(),Bm=jl(),{fromCallback:Tm}=ii(),{Iterator:km}=Jl(),Xl=Fa(),Pm=Yl(),Im=ja(),ed="level-js-",bi=Symbol("idb"),Ha=Symbol("namePrefix"),Ct=Symbol("location"),Ga=Symbol("version"),Dr=Symbol("store"),gi=Symbol("onComplete"),Ql=Symbol("promise"),So=class extends vm{constructor(e,r,n){if(typeof r=="function"||typeof n=="function")throw new Zl("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:i,version:o,...s}=r||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},s),typeof e!="string")throw new Error("constructor requires a location string argument");this[Ct]=e,this[Ha]=i??ed,this[Ga]=parseInt(o||1,10),this[bi]=null}get location(){return this[Ct]}get namePrefix(){return this[Ha]}get version(){return this[Ga]}get db(){return this[bi]}get type(){return"browser-level"}_open(e,r){let n=indexedDB.open(this[Ha]+this[Ct],this[Ga]);n.onerror=function(){r(n.error||new Error("unknown error"))},n.onsuccess=()=>{this[bi]=n.result,r()},n.onupgradeneeded=i=>{let o=i.target.result;o.objectStoreNames.contains(this[Ct])||o.createObjectStore(this[Ct])}}[Dr](e){return this[bi].transaction([this[Ct]],e).objectStore(this[Ct])}[gi](e,r){let n=e.transaction;n.onabort=function(){r(n.error||new Error("aborted by user"))},n.oncomplete=function(){r(null,e.result)}}_get(e,r,n){let i=this[Dr]("readonly"),o;try{o=i.get(e)}catch(s){return this.nextTick(n,s)}this[gi](o,function(s,a){if(s)return n(s);if(a===void 0)return n(new Zl("Entry not found",{code:"LEVEL_NOT_FOUND"}));n(null,Xl(a))})}_getMany(e,r,n){let i=this[Dr]("readonly"),o=e.map(s=>a=>{let c;try{c=i.get(s)}catch(f){return a(f)}c.onsuccess=()=>{let f=c.result;a(null,f===void 0?f:Xl(f))},c.onerror=f=>{f.stopPropagation(),a(c.error)}});Bm(o,16,n)}_del(e,r,n){let i=this[Dr]("readwrite"),o;try{o=i.delete(e)}catch(s){return this.nextTick(n,s)}this[gi](o,n)}_put(e,r,n,i){let o=this[Dr]("readwrite"),s;try{s=o.put(r,e)}catch(a){return this.nextTick(i,a)}this[gi](s,i)}_iterator(e){return new km(this,this[Ct],e)}_batch(e,r,n){let i=this[Dr]("readwrite"),o=i.transaction,s=0,a;o.onabort=function(){n(a||o.error||new Error("aborted by user"))},o.oncomplete=function(){n()};function c(){let f=e[s++],u=f.key,l;try{l=f.type==="del"?i.delete(u):i.put(f.value,u)}catch(p){a=p,o.abort();return}s<e.length?l.onsuccess=c:typeof o.commit=="function"&&o.commit()}c()}_clear(e,r){let n,i;try{n=Im(e)}catch{return this.nextTick(r)}if(e.limit>=0)return Pm(this,this[Ct],n,e,r);try{let o=this[Dr]("readwrite");i=n?o.delete(n):o.clear()}catch(o){return this.nextTick(r,o)}this[gi](i,r)}_close(e){this[bi].close(),this.nextTick(e)}};So.destroy=function(t,e,r){typeof e=="function"&&(r=e,e=ed),r=Tm(r,Ql);let n=indexedDB.deleteDatabase(e+t);return n.onsuccess=function(){r()},n.onerror=function(i){r(i)},r[Ql]};td.BrowserLevel=So});var id=M(nd=>{nd.Level=rd().BrowserLevel});var ce=M((yS,od)=>{"use strict";od.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var Tn=M((wS,Bo)=>{"use strict";var{AbortController:sd,AbortSignal:Um}=typeof self<"u"?self:typeof window<"u"?window:void 0;Bo.exports=sd;Bo.exports.AbortSignal=Um;Bo.exports.default=sd});var Se=M((mS,Ja)=>{"use strict";var Cm=je(),{kResistStopPropagation:Lm,SymbolDispose:Om}=ce(),Km=globalThis.AbortSignal||Tn().AbortSignal,Nm=globalThis.AbortController||Tn().AbortController,Dm=Object.getPrototypeOf(async function(){}).constructor,ad=globalThis.Blob||Cm.Blob,Mm=typeof ad<"u"?function(e){return e instanceof ad}:function(e){return!1},cd=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},qm=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},Wa=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
2
- `;super(r),this.name="AggregateError",this.errors=e}};Ja.exports={AggregateError:Wa,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof Dm},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Mm,deprecate(t,e){return t},addAbortListener:wn().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);cd(e,"signal"),qm(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Lm]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Om](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:Km.any||function(e){if(e.length===1)return e[0];let r=new Nm,n=()=>r.abort();return e.forEach(i=>{cd(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};Ja.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Te=M((bS,ld)=>{"use strict";var{format:jm,inspect:To,AggregateError:Fm}=Se(),$m=globalThis.AggregateError||Fm,Vm=Symbol("kIsNodeError"),Hm=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Gm=/^([A-Z][a-z0-9]*)+$/,Wm="__node_internal_",ko={};function qr(t,e){if(!t)throw new ko.ERR_INTERNAL_ASSERTION(e)}function fd(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Jm(t,e,r){if(typeof e=="function")return qr(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return qr(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:jm(e,...r)}function xe(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(Jm(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[Vm]=!0,ko[t]=n}function ud(t){let e=Wm+t.name;return Object.defineProperty(t,"name",{value:e}),t}function zm(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new $m([e,t],e.message);return r.code=e.code,r}return t||e}var za=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new ko.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};xe("ERR_ASSERTION","%s",Error);xe("ERR_INVALID_ARG_TYPE",(t,e,r)=>{qr(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],o=[],s=[];for(let c of e)qr(typeof c=="string","All expected entries have to be of type string"),Hm.includes(c)?i.push(c.toLowerCase()):Gm.test(c)?o.push(c):(qr(c!=="object",'The value "object" should be written as "Object"'),s.push(c));if(o.length>0){let c=i.indexOf("object");c!==-1&&(i.splice(i,c,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let c=i.pop();n+=`one of type ${i.join(", ")}, or ${c}`}}(o.length>0||s.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let c=o.pop();n+=`an instance of ${o.join(", ")}, or ${c}`}}s.length>0&&(n+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{let c=s.pop();n+=`one of ${s.join(", ")}, or ${c}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let c=To(r,{depth:-1});n+=`. Received ${c}`}}else{let c=To(r,{colors:!1});c.length>25&&(c=`${c.slice(0,25)}...`),n+=`. Received type ${typeof r} (${c})`}return n},TypeError);xe("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=To(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);xe("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);xe("ERR_MISSING_ARGS",(...t)=>{qr(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);xe("ERR_OUT_OF_RANGE",(t,e,r)=>{qr(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=fd(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=fd(n)),n+="n"):n=To(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);xe("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);xe("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);xe("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);xe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);xe("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);xe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);xe("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);xe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);xe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);xe("ERR_STREAM_WRITE_AFTER_END","write after end",Error);xe("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);ld.exports={AbortError:za,aggregateTwoErrors:ud(zm),hideStackFrames:ud,codes:ko}});var Pn=M((gS,Ed)=>{"use strict";var{ArrayIsArray:Za,ArrayPrototypeIncludes:yd,ArrayPrototypeJoin:wd,ArrayPrototypeMap:Ym,NumberIsInteger:Xa,NumberIsNaN:Zm,NumberMAX_SAFE_INTEGER:Xm,NumberMIN_SAFE_INTEGER:Qm,NumberParseInt:eb,ObjectPrototypeHasOwnProperty:tb,RegExpPrototypeExec:md,String:rb,StringPrototypeToUpperCase:nb,StringPrototypeTrim:ib}=ce(),{hideStackFrames:Ve,codes:{ERR_SOCKET_BAD_PORT:ob,ERR_INVALID_ARG_TYPE:ve,ERR_INVALID_ARG_VALUE:kn,ERR_OUT_OF_RANGE:jr,ERR_UNKNOWN_SIGNAL:dd}}=Te(),{normalizeEncoding:sb}=Se(),{isAsyncFunction:ab,isArrayBufferView:cb}=Se().types,hd={};function fb(t){return t===(t|0)}function ub(t){return t===t>>>0}var lb=/^[0-7]+$/,db="must be a 32-bit unsigned integer or an octal string";function hb(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(md(lb,t)===null)throw new kn(e,t,db);t=eb(t,8)}return bd(t,e),t}var pb=Ve((t,e,r=Qm,n=Xm)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Xa(t))throw new jr(e,"an integer",t);if(t<r||t>n)throw new jr(e,`>= ${r} && <= ${n}`,t)}),yb=Ve((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Xa(t))throw new jr(e,"an integer",t);if(t<r||t>n)throw new jr(e,`>= ${r} && <= ${n}`,t)}),bd=Ve((t,e,r=!1)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Xa(t))throw new jr(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new jr(e,`>= ${n} && <= ${i}`,t)});function Qa(t,e){if(typeof t!="string")throw new ve(e,"string",t)}function wb(t,e,r=void 0,n){if(typeof t!="number")throw new ve(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&Zm(t))throw new jr(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var mb=Ve((t,e,r)=>{if(!yd(r,t)){let i="must be one of: "+wd(Ym(r,o=>typeof o=="string"?`'${o}'`:rb(o)),", ");throw new kn(e,t,i)}});function gd(t,e){if(typeof t!="boolean")throw new ve(e,"boolean",t)}function Ya(t,e,r){return t==null||!tb(t,e)?r:t[e]}var bb=Ve((t,e,r=null)=>{let n=Ya(r,"allowArray",!1),i=Ya(r,"allowFunction",!1);if(!Ya(r,"nullable",!1)&&t===null||!n&&Za(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new ve(e,"Object",t)}),gb=Ve((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new ve(e,"a dictionary",t)}),Po=Ve((t,e,r=0)=>{if(!Za(t))throw new ve(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new kn(e,t,n)}});function xb(t,e){Po(t,e);for(let r=0;r<t.length;r++)Qa(t[r],`${e}[${r}]`)}function Eb(t,e){Po(t,e);for(let r=0;r<t.length;r++)gd(t[r],`${e}[${r}]`)}function _b(t,e){Po(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new ve(i,"AbortSignal",n);xd(n,i)}}function Ab(t,e="signal"){if(Qa(t,e),hd[t]===void 0)throw hd[nb(t)]!==void 0?new dd(t+" (signals must use all capital letters)"):new dd(t)}var Sb=Ve((t,e="buffer")=>{if(!cb(t))throw new ve(e,["Buffer","TypedArray","DataView"],t)});function vb(t,e){let r=sb(e),n=t.length;if(r==="hex"&&n%2!==0)throw new kn("encoding",e,`is invalid for data of length ${n}`)}function Bb(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&ib(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new ob(e,t,r);return t|0}var xd=Ve((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ve(e,"AbortSignal",t)}),Tb=Ve((t,e)=>{if(typeof t!="function")throw new ve(e,"Function",t)}),kb=Ve((t,e)=>{if(typeof t!="function"||ab(t))throw new ve(e,"Function",t)}),Pb=Ve((t,e)=>{if(t!==void 0)throw new ve(e,"undefined",t)});function Ib(t,e,r){if(!yd(r,t))throw new ve(e,`('${wd(r,"|")}')`,t)}var Rb=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pd(t,e){if(typeof t>"u"||!md(Rb,t))throw new kn(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Ub(t){if(typeof t=="string")return pd(t,"hints"),t;if(Za(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];pd(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new kn("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ed.exports={isInt32:fb,isUint32:ub,parseFileMode:hb,validateArray:Po,validateStringArray:xb,validateBooleanArray:Eb,validateAbortSignalArray:_b,validateBoolean:gd,validateBuffer:Sb,validateDictionary:gb,validateEncoding:vb,validateFunction:Tb,validateInt32:yb,validateInteger:pb,validateNumber:wb,validateObject:bb,validateOneOf:mb,validatePlainFunction:kb,validatePort:Bb,validateSignalName:Ab,validateString:Qa,validateUint32:bd,validateUndefined:Pb,validateUnion:Ib,validateAbortSignal:xd,validateLinkHeaderValue:Ub}});var cr=M((xS,vd)=>{var ue=vd.exports={},pt,yt;function ec(){throw new Error("setTimeout has not been defined")}function tc(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?pt=setTimeout:pt=ec}catch{pt=ec}try{typeof clearTimeout=="function"?yt=clearTimeout:yt=tc}catch{yt=tc}})();function _d(t){if(pt===setTimeout)return setTimeout(t,0);if((pt===ec||!pt)&&setTimeout)return pt=setTimeout,setTimeout(t,0);try{return pt(t,0)}catch{try{return pt.call(null,t,0)}catch{return pt.call(this,t,0)}}}function Cb(t){if(yt===clearTimeout)return clearTimeout(t);if((yt===tc||!yt)&&clearTimeout)return yt=clearTimeout,clearTimeout(t);try{return yt(t)}catch{try{return yt.call(null,t)}catch{return yt.call(this,t)}}}var Lt=[],In=!1,Fr,Io=-1;function Lb(){!In||!Fr||(In=!1,Fr.length?Lt=Fr.concat(Lt):Io=-1,Lt.length&&Ad())}function Ad(){if(!In){var t=_d(Lb);In=!0;for(var e=Lt.length;e;){for(Fr=Lt,Lt=[];++Io<e;)Fr&&Fr[Io].run();Io=-1,e=Lt.length}Fr=null,In=!1,Cb(t)}}ue.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Lt.push(new Sd(t,e)),Lt.length===1&&!In&&_d(Ad)};function Sd(t,e){this.fun=t,this.array=e}Sd.prototype.run=function(){this.fun.apply(null,this.array)};ue.title="browser";ue.browser=!0;ue.env={};ue.argv=[];ue.version="";ue.versions={};function Ot(){}ue.on=Ot;ue.addListener=Ot;ue.once=Ot;ue.off=Ot;ue.removeListener=Ot;ue.removeAllListeners=Ot;ue.emit=Ot;ue.prependListener=Ot;ue.prependOnceListener=Ot;ue.listeners=function(t){return[]};ue.binding=function(t){throw new Error("process.binding is not supported")};ue.cwd=function(){return"/"};ue.chdir=function(t){throw new Error("process.chdir is not supported")};ue.umask=function(){return 0}});var mt=M((ES,qd)=>{"use strict";var{SymbolAsyncIterator:Bd,SymbolIterator:Td,SymbolFor:$r}=ce(),kd=$r("nodejs.stream.destroyed"),Pd=$r("nodejs.stream.errored"),rc=$r("nodejs.stream.readable"),nc=$r("nodejs.stream.writable"),Id=$r("nodejs.stream.disturbed"),Ob=$r("nodejs.webstream.isClosedPromise"),Kb=$r("nodejs.webstream.controllerErrorFunction");function Ro(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Uo(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Nb(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function wt(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Rd(t){return!!(t&&!wt(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Ud(t){return!!(t&&!wt(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Cd(t){return!!(t&&!wt(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Db(t){return Rd(t)||Ud(t)||Cd(t)}function Mb(t,e){return t==null?!1:e===!0?typeof t[Bd]=="function":e===!1?typeof t[Td]=="function":typeof t[Bd]=="function"||typeof t[Td]=="function"}function Co(t){if(!wt(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[kd]||n!=null&&n.destroyed)}function Ld(t){if(!Uo(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function qb(t,e){if(!Uo(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function jb(t){if(!Ro(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Od(t,e){if(!Ro(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Kd(t){return t&&t[rc]!=null?t[rc]:typeof t?.readable!="boolean"?null:Co(t)?!1:Ro(t)&&t.readable&&!Od(t)}function Nd(t){return t&&t[nc]!=null?t[nc]:typeof t?.writable!="boolean"?null:Co(t)?!1:Uo(t)&&t.writable&&!Ld(t)}function Fb(t,e){return wt(t)?Co(t)?!0:!(e?.readable!==!1&&Kd(t)||e?.writable!==!1&&Nd(t)):null}function $b(t){var e,r;return wt(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function Vb(t){var e,r;return wt(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function Hb(t){if(!wt(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Dd(t)?t._closed:null}function Dd(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Md(t){return typeof t._sent100=="boolean"&&Dd(t)}function Gb(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function Wb(t){if(!wt(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Md(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Jb(t){var e;return!!(t&&((e=t[Id])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function zb(t){var e,r,n,i,o,s,a,c,f,u;return!!(t&&((e=(r=(n=(i=(o=(s=t[Pd])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(c=t._writableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&r!==void 0?r:(f=t._readableState)===null||f===void 0?void 0:f.errored)!==null&&e!==void 0?e:!((u=t._writableState)===null||u===void 0)&&u.errored))}qd.exports={isDestroyed:Co,kIsDestroyed:kd,isDisturbed:Jb,kIsDisturbed:Id,isErrored:zb,kIsErrored:Pd,isReadable:Kd,kIsReadable:rc,kIsClosedPromise:Ob,kControllerErrorFunction:Kb,kIsWritable:nc,isClosed:Hb,isDuplexNodeStream:Nb,isFinished:Fb,isIterable:Mb,isReadableNodeStream:Ro,isReadableStream:Rd,isReadableEnded:jb,isReadableFinished:Od,isReadableErrored:Vb,isNodeStream:wt,isWebStream:Db,isWritable:Nd,isWritableNodeStream:Uo,isWritableStream:Ud,isWritableEnded:Ld,isWritableFinished:qb,isWritableErrored:$b,isServerRequest:Gb,isServerResponse:Md,willEmitClose:Wb,isTransformStream:Cd}});var Kt=M((_S,cc)=>{var fr=cr(),{AbortError:zd,codes:Yb}=Te(),{ERR_INVALID_ARG_TYPE:Zb,ERR_STREAM_PREMATURE_CLOSE:jd}=Yb,{kEmptyObject:oc,once:sc}=Se(),{validateAbortSignal:Xb,validateFunction:Qb,validateObject:eg,validateBoolean:tg}=Pn(),{Promise:rg,PromisePrototypeThen:ng,SymbolDispose:Yd}=ce(),{isClosed:ig,isReadable:Fd,isReadableNodeStream:ic,isReadableStream:og,isReadableFinished:$d,isReadableErrored:Vd,isWritable:Hd,isWritableNodeStream:Gd,isWritableStream:sg,isWritableFinished:Wd,isWritableErrored:Jd,isNodeStream:ag,willEmitClose:cg,kIsClosedPromise:fg}=mt(),Rn;function ug(t){return t.setHeader&&typeof t.abort=="function"}var ac=()=>{};function Zd(t,e,r){var n,i;if(arguments.length===2?(r=e,e=oc):e==null?e=oc:eg(e,"options"),Qb(r,"callback"),Xb(e.signal,"options.signal"),r=sc(r),og(t)||sg(t))return lg(t,e,r);if(!ag(t))throw new Zb("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:ic(t),s=(i=e.writable)!==null&&i!==void 0?i:Gd(t),a=t._writableState,c=t._readableState,f=()=>{t.writable||p()},u=cg(t)&&ic(t)===o&&Gd(t)===s,l=Wd(t,!1),p=()=>{l=!0,t.destroyed&&(u=!1),!(u&&(!t.readable||o))&&(!o||h)&&r.call(t)},h=$d(t,!1),y=()=>{h=!0,t.destroyed&&(u=!1),!(u&&(!t.writable||s))&&(!s||l)&&r.call(t)},d=E=>{r.call(t,E)},w=ig(t),m=()=>{w=!0;let E=Jd(t)||Vd(t);if(E&&typeof E!="boolean")return r.call(t,E);if(o&&!h&&ic(t,!0)&&!$d(t,!1))return r.call(t,new jd);if(s&&!l&&!Wd(t,!1))return r.call(t,new jd);r.call(t)},A=()=>{w=!0;let E=Jd(t)||Vd(t);if(E&&typeof E!="boolean")return r.call(t,E);r.call(t)},g=()=>{t.req.on("finish",p)};ug(t)?(t.on("complete",p),u||t.on("abort",m),t.req?g():t.on("request",g)):s&&!a&&(t.on("end",f),t.on("close",f)),!u&&typeof t.aborted=="boolean"&&t.on("aborted",m),t.on("end",y),t.on("finish",p),e.error!==!1&&t.on("error",d),t.on("close",m),w?fr.nextTick(m):a!=null&&a.errorEmitted||c!=null&&c.errorEmitted?u||fr.nextTick(A):(!o&&(!u||Fd(t))&&(l||Hd(t)===!1)||!s&&(!u||Hd(t))&&(h||Fd(t)===!1)||c&&t.req&&t.aborted)&&fr.nextTick(A);let _=()=>{r=ac,t.removeListener("aborted",m),t.removeListener("complete",p),t.removeListener("abort",m),t.removeListener("request",g),t.req&&t.req.removeListener("finish",p),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",p),t.removeListener("end",y),t.removeListener("error",d),t.removeListener("close",m)};if(e.signal&&!w){let E=()=>{let B=r;_(),B.call(t,new zd(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)fr.nextTick(E);else{Rn=Rn||Se().addAbortListener;let B=Rn(e.signal,E),T=r;r=sc((...k)=>{B[Yd](),T.apply(t,k)})}}return _}function lg(t,e,r){let n=!1,i=ac;if(e.signal)if(i=()=>{n=!0,r.call(t,new zd(void 0,{cause:e.signal.reason}))},e.signal.aborted)fr.nextTick(i);else{Rn=Rn||Se().addAbortListener;let s=Rn(e.signal,i),a=r;r=sc((...c)=>{s[Yd](),a.apply(t,c)})}let o=(...s)=>{n||fr.nextTick(()=>r.apply(t,s))};return ng(t[fg].promise,o,o),ac}function dg(t,e){var r;let n=!1;return e===null&&(e=oc),(r=e)!==null&&r!==void 0&&r.cleanup&&(tg(e.cleanup,"cleanup"),n=e.cleanup),new rg((i,o)=>{let s=Zd(t,e,a=>{n&&s(),a?o(a):i()})})}cc.exports=Zd;cc.exports.finished=dg});var Vr=M((AS,oh)=>{"use strict";var bt=cr(),{aggregateTwoErrors:hg,codes:{ERR_MULTIPLE_CALLBACK:pg},AbortError:yg}=Te(),{Symbol:eh}=ce(),{kIsDestroyed:wg,isDestroyed:mg,isFinished:bg,isServerRequest:gg}=mt(),th=eh("kDestroy"),fc=eh("kConstruct");function rh(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function xg(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(rh(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Xd(this,t,e):this.once(th,function(o){Xd(this,hg(o,t),e)}),this)}function Xd(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;rh(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?bt.nextTick(Eg,t,o):bt.nextTick(nh,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function Eg(t,e){uc(t,e),nh(t)}function nh(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function uc(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function _g(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function lc(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?bt.nextTick(uc,t,e):uc(t,e))}function Ag(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(fc,e),!(t.listenerCount(fc)>1)&&bt.nextTick(Sg,t)}function Sg(t){let e=!1;function r(n){if(e){lc(t,n??new pg);return}e=!0;let i=t._readableState,o=t._writableState,s=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(th,n):n?lc(t,n,!0):bt.nextTick(vg,t)}try{t._construct(n=>{bt.nextTick(r,n)})}catch(n){bt.nextTick(r,n)}}function vg(t){t.emit(fc)}function Qd(t){return t?.setHeader&&typeof t.abort=="function"}function ih(t){t.emit("close")}function Bg(t,e){t.emit("error",e),bt.nextTick(ih,t)}function Tg(t,e){!t||mg(t)||(!e&&!bg(t)&&(e=new yg),gg(t)?(t.socket=null,t.destroy(e)):Qd(t)?t.abort():Qd(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?bt.nextTick(Bg,t,e):bt.nextTick(ih,t),t.destroyed||(t[wg]=!0))}oh.exports={construct:Ag,destroyer:Tg,destroy:xg,undestroy:_g,errorOrDestroy:lc}});var Ko=M((SS,ah)=>{"use strict";var{ArrayIsArray:kg,ObjectSetPrototypeOf:sh}=ce(),{EventEmitter:Lo}=wn();function Oo(t){Lo.call(this,t)}sh(Oo.prototype,Lo.prototype);sh(Oo,Lo);Oo.prototype.pipe=function(t,e){let r=this;function n(u){t.writable&&t.write(u)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function c(u){f(),Lo.listenerCount(this,"error")===0&&this.emit("error",u)}dc(r,"error",c),dc(t,"error",c);function f(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t};function dc(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):kg(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}ah.exports={Stream:Oo,prependListener:dc}});var xi=M((vS,No)=>{"use strict";var{SymbolDispose:Pg}=ce(),{AbortError:ch,codes:Ig}=Te(),{isNodeStream:fh,isWebStream:Rg,kControllerErrorFunction:Ug}=mt(),Cg=Kt(),{ERR_INVALID_ARG_TYPE:uh}=Ig,hc,Lg=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new uh(e,"AbortSignal",t)};No.exports.addAbortSignal=function(e,r){if(Lg(e,"signal"),!fh(r)&&!Rg(r))throw new uh("stream",["ReadableStream","WritableStream","Stream"],r);return No.exports.addAbortSignalNoValidate(e,r)};No.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=fh(e)?()=>{e.destroy(new ch(void 0,{cause:t.reason}))}:()=>{e[Ug](new ch(void 0,{cause:t.reason}))};if(t.aborted)r();else{hc=hc||Se().addAbortListener;let n=hc(t,r);Cg(e,n[Pg])}return e}});var hh=M((TS,dh)=>{"use strict";var{StringPrototypeSlice:lh,SymbolIterator:Og,TypedArrayPrototypeSet:Do,Uint8Array:Kg}=ce(),{Buffer:pc}=je(),{inspect:Ng}=Se();dh.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return pc.alloc(0);let r=pc.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)Do(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Og](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let o=n.data;if(e>o.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=lh(o,0,e),this.head=n,n.data=lh(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=pc.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)Do(r,s,n-e),e-=s.length;else{e===s.length?(Do(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(Do(r,new Kg(s.buffer,s.byteOffset,e),n-e),this.head=i,i.data=s.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return Ng(this,{...r,depth:0,customInspect:!1})}}});var Ei=M((kS,mh)=>{"use strict";var{MathFloor:Dg,NumberIsInteger:Mg}=ce(),{validateInteger:qg}=Pn(),{ERR_INVALID_ARG_VALUE:jg}=Te().codes,ph=16*1024,yh=16;function Fg(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function wh(t){return t?yh:ph}function $g(t,e){qg(e,"value",0),t?yh=e:ph=e}function Vg(t,e,r,n){let i=Fg(e,n,r);if(i!=null){if(!Mg(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new jg(o,i)}return Dg(i)}return wh(t.objectMode)}mh.exports={getHighWaterMark:Vg,getDefaultHighWaterMark:wh,setDefaultHighWaterMark:$g}});var xh=M((yc,gh)=>{var Mo=je(),gt=Mo.Buffer;function bh(t,e){for(var r in t)e[r]=t[r]}gt.from&&gt.alloc&&gt.allocUnsafe&&gt.allocUnsafeSlow?gh.exports=Mo:(bh(Mo,yc),yc.Buffer=Hr);function Hr(t,e,r){return gt(t,e,r)}Hr.prototype=Object.create(gt.prototype);bh(gt,Hr);Hr.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return gt(t,e,r)};Hr.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=gt(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Hr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gt(t)};Hr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Mo.SlowBuffer(t)}});var Ah=M(_h=>{"use strict";var mc=xh().Buffer,Eh=mc.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Hg(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Gg(t){var e=Hg(t);if(typeof e!="string"&&(mc.isEncoding===Eh||!Eh(t)))throw new Error("Unknown encoding: "+t);return e||t}_h.StringDecoder=_i;function _i(t){this.encoding=Gg(t);var e;switch(this.encoding){case"utf16le":this.text=Xg,this.end=Qg,e=4;break;case"utf8":this.fillLast=zg,e=4;break;case"base64":this.text=ex,this.end=tx,e=3;break;default:this.write=rx,this.end=nx;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=mc.allocUnsafe(e)}_i.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};_i.prototype.end=Zg;_i.prototype.text=Yg;_i.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function wc(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Wg(t,e,r){var n=e.length-1;if(n<r)return 0;var i=wc(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=wc(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=wc(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Jg(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function zg(t){var e=this.lastTotal-this.lastNeed,r=Jg(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Yg(t,e){var r=Wg(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Zg(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Xg(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Qg(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function ex(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function tx(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function rx(t){return t.toString(this.encoding)}function nx(t){return t&&t.length?this.write(t):""}});var bc=M((IS,Th)=>{"use strict";var Sh=cr(),{PromisePrototypeThen:ix,SymbolAsyncIterator:vh,SymbolIterator:Bh}=ce(),{Buffer:ox}=je(),{ERR_INVALID_ARG_TYPE:sx,ERR_STREAM_NULL_VALUES:ax}=Te().codes;function cx(t,e,r){let n;if(typeof e=="string"||e instanceof ox)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[vh])i=!0,n=e[vh]();else if(e&&e[Bh])i=!1,n=e[Bh]();else throw new sx("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,c())},o._destroy=function(f,u){ix(a(f),()=>Sh.nextTick(u,f),l=>Sh.nextTick(u,l||f))};async function a(f){let u=f!=null,l=typeof n.throw=="function";if(u&&l){let{value:p,done:h}=await n.throw(f);if(await p,h)return}if(typeof n.return=="function"){let{value:p}=await n.return();await p}}async function c(){for(;;){try{let{value:f,done:u}=i?await n.next():n.next();if(u)o.push(null);else{let l=f&&typeof f.then=="function"?await f:f;if(l===null)throw s=!1,new ax;if(o.push(l))continue;s=!1}}catch(f){o.destroy(f)}break}}return o}Th.exports=cx});var Si=M((RS,Hh)=>{var Xe=cr(),{ArrayPrototypeIndexOf:fx,NumberIsInteger:ux,NumberIsNaN:lx,NumberParseInt:dx,ObjectDefineProperties:Bc,ObjectKeys:hx,ObjectSetPrototypeOf:Ih,Promise:Rh,SafeSet:px,SymbolAsyncDispose:yx,SymbolAsyncIterator:wx,Symbol:mx}=ce();Hh.exports=z;z.ReadableState=$o;var{EventEmitter:bx}=wn(),{Stream:ur,prependListener:gx}=Ko(),{Buffer:gc}=je(),{addAbortSignal:xx}=xi(),Uh=Kt(),Q=Se().debuglog("stream",t=>{Q=t}),Ex=hh(),Ln=Vr(),{getHighWaterMark:_x,getDefaultHighWaterMark:Ax}=Ei(),{aggregateTwoErrors:kh,codes:{ERR_INVALID_ARG_TYPE:Sx,ERR_METHOD_NOT_IMPLEMENTED:vx,ERR_OUT_OF_RANGE:Bx,ERR_STREAM_PUSH_AFTER_EOF:Tx,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:kx},AbortError:Px}=Te(),{validateObject:Ix}=Pn(),Gr=mx("kPaused"),{StringDecoder:Ch}=Ah(),Rx=bc();Ih(z.prototype,ur.prototype);Ih(z,ur);var xc=()=>{},{errorOrDestroy:Un}=Ln,Cn=1,Ux=2,Lh=4,Ai=8,Oh=16,qo=32,jo=64,Kh=128,Cx=256,Lx=512,Ox=1024,Sc=2048,vc=4096,Kx=8192,Nx=16384,Dx=32768,Nh=65536,Mx=1<<17,qx=1<<18;function he(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Bc($o.prototype,{objectMode:he(Cn),ended:he(Ux),endEmitted:he(Lh),reading:he(Ai),constructed:he(Oh),sync:he(qo),needReadable:he(jo),emittedReadable:he(Kh),readableListening:he(Cx),resumeScheduled:he(Lx),errorEmitted:he(Ox),emitClose:he(Sc),autoDestroy:he(vc),destroyed:he(Kx),closed:he(Nx),closeEmitted:he(Dx),multiAwaitDrain:he(Nh),readingMore:he(Mx),dataEmitted:he(qx)});function $o(t,e,r){typeof r!="boolean"&&(r=e instanceof xt()),this.state=Sc|vc|Oh|qo,t&&t.objectMode&&(this.state|=Cn),r&&t&&t.readableObjectMode&&(this.state|=Cn),this.highWaterMark=t?_x(this,t,"readableHighWaterMark",r):Ax(!1),this.buffer=new Ex,this.length=0,this.pipes=[],this.flowing=null,this[Gr]=null,t&&t.emitClose===!1&&(this.state&=~Sc),t&&t.autoDestroy===!1&&(this.state&=~vc),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Ch(t.encoding),this.encoding=t.encoding)}function z(t){if(!(this instanceof z))return new z(t);let e=this instanceof xt();this._readableState=new $o(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&xx(t.signal,this)),ur.call(this,t),Ln.construct(this,()=>{this._readableState.needReadable&&Fo(this,this._readableState)})}z.prototype.destroy=Ln.destroy;z.prototype._undestroy=Ln.undestroy;z.prototype._destroy=function(t,e){e(t)};z.prototype[bx.captureRejectionSymbol]=function(t){this.destroy(t)};z.prototype[yx]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Px,this.destroy(t)),new Rh((e,r)=>Uh(this,n=>n&&n!==t?r(n):e(null)))};z.prototype.push=function(t,e){return Dh(this,t,e,!1)};z.prototype.unshift=function(t,e){return Dh(this,t,e,!0)};function Dh(t,e,r,n){Q("readableAddChunk",e);let i=t._readableState,o;if(i.state&Cn||(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=gc.from(e,r).toString(i.encoding):(e=gc.from(e,r),r=""))):e instanceof gc?r="":ur._isUint8Array(e)?(e=ur._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new Sx("chunk",["string","Buffer","Uint8Array"],e))),o)Un(t,o);else if(e===null)i.state&=~Ai,$x(t,i);else if(i.state&Cn||e&&e.length>0)if(n)if(i.state&Lh)Un(t,new kx);else{if(i.destroyed||i.errored)return!1;Ec(t,i,e,!0)}else if(i.ended)Un(t,new Tx);else{if(i.destroyed||i.errored)return!1;i.state&=~Ai,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Ec(t,i,e,!1):Fo(t,i)):Ec(t,i,e,!1)}else n||(i.state&=~Ai,Fo(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function Ec(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&Nh?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.state&jo&&Vo(t)),Fo(t,e)}z.prototype.isPaused=function(){let t=this._readableState;return t[Gr]===!0||t.flowing===!1};z.prototype.setEncoding=function(t){let e=new Ch(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var jx=1073741824;function Fx(t){if(t>jx)throw new Bx("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Ph(t,e){return t<=0||e.length===0&&e.ended?0:e.state&Cn?1:lx(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}z.prototype.read=function(t){Q("read",t),t===void 0?t=NaN:ux(t)||(t=dx(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Fx(t)),t!==0&&(e.state&=~Kh),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Q("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?_c(this):Vo(this),null;if(t=Ph(t,e),t===0&&e.ended)return e.length===0&&_c(this),null;let n=(e.state&jo)!==0;if(Q("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Q("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,Q("reading, ended or constructing",n);else if(n){Q("do read"),e.state|=Ai|qo,e.length===0&&(e.state|=jo);try{this._read(e.highWaterMark)}catch(o){Un(this,o)}e.state&=~qo,e.reading||(t=Ph(r,e))}let i;return t>0?i=$h(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&_c(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function $x(t,e){if(Q("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Vo(t):(e.needReadable=!1,e.emittedReadable=!0,Mh(t))}}function Vo(t){let e=t._readableState;Q("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Q("emitReadable",e.flowing),e.emittedReadable=!0,Xe.nextTick(Mh,t))}function Mh(t){let e=t._readableState;Q("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,jh(t)}function Fo(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Xe.nextTick(Vx,t,e))}function Vx(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Q("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}z.prototype._read=function(t){throw new vx("_read()")};z.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new px(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),Q("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==Xe.stdout&&t!==Xe.stderr?a:w;n.endEmitted?Xe.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(m,A){Q("onunpipe"),m===r&&A&&A.hasUnpiped===!1&&(A.hasUnpiped=!0,u())}function a(){Q("onend"),t.end()}let c,f=!1;function u(){Q("cleanup"),t.removeListener("close",y),t.removeListener("finish",d),c&&t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",w),r.removeListener("data",p),f=!0,c&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}function l(){f||(n.pipes.length===1&&n.pipes[0]===t?(Q("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(Q("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),c||(c=Hx(r,t),t.on("drain",c))}r.on("data",p);function p(m){Q("ondata");let A=t.write(m);Q("dest.write",A),A===!1&&l()}function h(m){if(Q("onerror",m),w(),t.removeListener("error",h),t.listenerCount("error")===0){let A=t._writableState||t._readableState;A&&!A.errorEmitted?Un(t,m):t.emit("error",m)}}gx(t,"error",h);function y(){t.removeListener("finish",d),w()}t.once("close",y);function d(){Q("onfinish"),t.removeListener("close",y),w()}t.once("finish",d);function w(){Q("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?l():n.flowing||(Q("pipe resume"),r.resume()),t};function Hx(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Q("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Q("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}z.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let i=e.pipes;e.pipes=[],this.pause();for(let o=0;o<i.length;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}let n=fx(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};z.prototype.on=function(t,e){let r=ur.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Q("on readable",n.length,n.reading),n.length?Vo(this):n.reading||Xe.nextTick(Gx,this)),r};z.prototype.addListener=z.prototype.on;z.prototype.removeListener=function(t,e){let r=ur.prototype.removeListener.call(this,t,e);return t==="readable"&&Xe.nextTick(qh,this),r};z.prototype.off=z.prototype.removeListener;z.prototype.removeAllListeners=function(t){let e=ur.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Xe.nextTick(qh,this),e};function qh(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Gr]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Gx(t){Q("readable nexttick read 0"),t.read(0)}z.prototype.resume=function(){let t=this._readableState;return t.flowing||(Q("resume"),t.flowing=!t.readableListening,Wx(this,t)),t[Gr]=!1,this};function Wx(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Xe.nextTick(Jx,t,e))}function Jx(t,e){Q("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),jh(t),e.flowing&&!e.reading&&t.read(0)}z.prototype.pause=function(){return Q("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Q("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Gr]=!0,this};function jh(t){let e=t._readableState;for(Q("flow",e.flowing);e.flowing&&t.read()!==null;);}z.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{Un(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=hx(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};z.prototype[wx]=function(){return Fh(this)};z.prototype.iterator=function(t){return t!==void 0&&Ix(t,"options"),Fh(this,t)};function Fh(t,e){typeof t.read!="function"&&(t=z.wrap(t,{objectMode:!0}));let r=zx(t,e);return r.stream=t,r}async function*zx(t,e){let r=xc;function n(s){this===t?(r(),r=xc):r=s}t.on("readable",n);let i,o=Uh(t,{writable:!1},s=>{i=s?kh(i,s):null,r(),r=xc});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(i)throw i;if(i===null)return;await new Rh(n)}}}catch(s){throw i=kh(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Ln.destroyer(t,null):(t.off("readable",n),o())}}Bc(z.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Bc($o.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Gr]!==!1},set(t){this[Gr]=!!t}}});z._fromList=$h;function $h(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function _c(t){let e=t._readableState;Q("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Xe.nextTick(Yx,e,t))}function Yx(t,e){if(Q("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)Xe.nextTick(Zx,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Zx(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}z.from=function(t,e){return Rx(z,t,e)};var Ac;function Vh(){return Ac===void 0&&(Ac={}),Ac}z.fromWeb=function(t,e){return Vh().newStreamReadableFromReadableStream(t,e)};z.toWeb=function(t,e){return Vh().newReadableStreamFromStreamReadable(t,e)};z.wrap=function(t,e){var r,n;return new z({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){Ln.destroyer(t,i),o(i)}}).wrap(t)}});var zo=M((US,np)=>{var Wr=cr(),{ArrayPrototypeSlice:Jh,Error:Xx,FunctionPrototypeSymbolHasInstance:zh,ObjectDefineProperty:Yh,ObjectDefineProperties:Qx,ObjectSetPrototypeOf:Zh,StringPrototypeToLowerCase:eE,Symbol:tE,SymbolHasInstance:rE}=ce();np.exports=fe;fe.WritableState=Ti;var{EventEmitter:nE}=wn(),vi=Ko().Stream,{Buffer:Ho}=je(),Jo=Vr(),{addAbortSignal:iE}=xi(),{getHighWaterMark:oE,getDefaultHighWaterMark:sE}=Ei(),{ERR_INVALID_ARG_TYPE:aE,ERR_METHOD_NOT_IMPLEMENTED:cE,ERR_MULTIPLE_CALLBACK:Xh,ERR_STREAM_CANNOT_PIPE:fE,ERR_STREAM_DESTROYED:Bi,ERR_STREAM_ALREADY_FINISHED:uE,ERR_STREAM_NULL_VALUES:lE,ERR_STREAM_WRITE_AFTER_END:dE,ERR_UNKNOWN_ENCODING:Qh}=Te().codes,{errorOrDestroy:On}=Jo;Zh(fe.prototype,vi.prototype);Zh(fe,vi);function Pc(){}var Kn=tE("kOnFinished");function Ti(t,e,r){typeof r!="boolean"&&(r=e instanceof xt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?oE(this,t,"writableHighWaterMark",r):sE(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=pE.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Wo(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Kn]=[]}function Wo(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Ti.prototype.getBuffer=function(){return Jh(this.buffered,this.bufferedIndex)};Yh(Ti.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function fe(t){let e=this instanceof xt();if(!e&&!zh(fe,this))return new fe(t);this._writableState=new Ti(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&iE(t.signal,this)),vi.call(this,t),Jo.construct(this,()=>{let r=this._writableState;r.writing||Rc(this,r),Uc(this,r)})}Yh(fe,rE,{__proto__:null,value:function(t){return zh(this,t)?!0:this!==fe?!1:t&&t._writableState instanceof Ti}});fe.prototype.pipe=function(){On(this,new fE)};function ep(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!Ho.isEncoding(r))throw new Qh(r);typeof n!="function"&&(n=Pc)}if(e===null)throw new lE;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=Ho.from(e,r),r="buffer");else if(e instanceof Ho)r="buffer";else if(vi._isUint8Array(e))e=vi._uint8ArrayToBuffer(e),r="buffer";else throw new aE("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new dE:i.destroyed&&(o=new Bi("write")),o?(Wr.nextTick(n,o),On(t,o,!0),o):(i.pendingcb++,hE(t,i,e,r,n))}fe.prototype.write=function(t,e,r){return ep(this,t,e,r)===!0};fe.prototype.cork=function(){this._writableState.corked++};fe.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Rc(this,t))};fe.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=eE(e)),!Ho.isEncoding(e))throw new Qh(e);return this._writableState.defaultEncoding=e,this};function hE(t,e,r,n,i){let o=e.objectMode?1:r.length;e.length+=o;let s=e.length<e.highWaterMark;return s||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==Pc&&(e.allNoop=!1)):(e.writelen=o,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),s&&!e.errored&&!e.destroyed}function Gh(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Bi("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function Wh(t,e,r,n){--e.pendingcb,n(r),Ic(e),On(t,r)}function pE(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){On(t,new Xh);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?Wr.nextTick(Wh,t,r,e,i):Wh(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&Rc(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},Wr.nextTick(yE,r.afterWriteTickInfo)):tp(t,r,1,i))}function yE({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,tp(t,e,r,n)}function tp(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&Ic(e),Uc(t,e)}function Ic(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:o,callback:s}=t.buffered[i],a=t.objectMode?1:o.length;t.length-=a,s((e=t.errored)!==null&&e!==void 0?e:new Bi("write"))}let r=t[Kn].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Bi("end"))}Wo(t)}function Rc(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,o=r.length-n;if(!o)return;let s=n;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?Pc:f=>{for(let u=s;u<r.length;++u)r[u].callback(f)},c=e.allNoop&&s===0?r:Jh(r,s);c.allBuffers=e.allBuffers,Gh(t,e,!0,e.length,c,"",a),Wo(e)}else{do{let{chunk:a,encoding:c,callback:f}=r[s];r[s++]=null;let u=i?1:a.length;Gh(t,e,!1,u,a,c,f)}while(s<r.length&&!e.writing);s===r.length?Wo(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}fe.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new cE("_write()")};fe.prototype._writev=null;fe.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let o=ep(this,t,e);o instanceof Xx&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Uc(this,n,!0),n.ended=!0):n.finished?i=new uE("end"):n.destroyed&&(i=new Bi("end"))),typeof r=="function"&&(i||n.finished?Wr.nextTick(r,i):n[Kn].push(r)),this};function Go(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function wE(t,e){let r=!1;function n(i){if(r){On(t,i??Xh());return}if(r=!0,e.pendingcb--,i){let o=e[Kn].splice(0);for(let s=0;s<o.length;s++)o[s](i);On(t,i,e.sync)}else Go(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,Wr.nextTick(kc,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function mE(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,wE(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Uc(t,e,r){Go(e)&&(mE(t,e),e.pendingcb===0&&(r?(e.pendingcb++,Wr.nextTick((n,i)=>{Go(i)?kc(n,i):i.pendingcb--},t,e)):Go(e)&&(e.pendingcb++,kc(t,e))))}function kc(t,e){e.pendingcb--,e.finished=!0;let r=e[Kn].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}Qx(fe.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var bE=Jo.destroy;fe.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Kn].length)&&Wr.nextTick(Ic,r),bE.call(this,t,e),this};fe.prototype._undestroy=Jo.undestroy;fe.prototype._destroy=function(t,e){e(t)};fe.prototype[nE.captureRejectionSymbol]=function(t){this.destroy(t)};var Tc;function rp(){return Tc===void 0&&(Tc={}),Tc}fe.fromWeb=function(t,e){return rp().newStreamWritableFromWritableStream(t,e)};fe.toWeb=function(t){return rp().newWritableStreamFromStreamWritable(t)}});var bp=M((CS,mp)=>{var Cc=cr(),gE=je(),{isReadable:xE,isWritable:EE,isIterable:ip,isNodeStream:_E,isReadableNodeStream:op,isWritableNodeStream:sp,isDuplexNodeStream:AE,isReadableStream:ap,isWritableStream:cp}=mt(),fp=Kt(),{AbortError:yp,codes:{ERR_INVALID_ARG_TYPE:SE,ERR_INVALID_RETURN_VALUE:up}}=Te(),{destroyer:Dn}=Vr(),vE=xt(),wp=Si(),BE=zo(),{createDeferredPromise:lp}=Se(),dp=bc(),hp=globalThis.Blob||gE.Blob,TE=typeof hp<"u"?function(e){return e instanceof hp}:function(e){return!1},kE=globalThis.AbortController||Tn().AbortController,{FunctionPrototypeCall:pp}=ce(),lr=class extends vE{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};mp.exports=function t(e,r){if(AE(e))return e;if(op(e))return Nn({readable:e});if(sp(e))return Nn({writable:e});if(_E(e))return Nn({writable:!1,readable:!1});if(ap(e))return Nn({readable:wp.fromWeb(e)});if(cp(e))return Nn({writable:BE.fromWeb(e)});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=PE(e);if(ip(i))return dp(lr,i,{objectMode:!0,write:o,final:s,destroy:a});let c=i?.then;if(typeof c=="function"){let f,u=pp(c,i,l=>{if(l!=null)throw new up("nully","body",l)},l=>{Dn(f,l)});return f=new lr({objectMode:!0,readable:!1,write:o,final(l){s(async()=>{try{await u,Cc.nextTick(l,null)}catch(p){Cc.nextTick(l,p)}})},destroy:a})}throw new up("Iterable, AsyncIterable or AsyncFunction",r,i)}if(TE(e))return t(e.arrayBuffer());if(ip(e))return dp(lr,e,{objectMode:!0,writable:!1});if(ap(e?.readable)&&cp(e?.writable))return lr.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?op(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?sp(e?.writable)?e?.writable:t(e.writable):void 0;return Nn({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return pp(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{Dn(i,o)}),i=new lr({objectMode:!0,writable:!1,read(){}})}throw new SE(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function PE(t){let{promise:e,resolve:r}=lp(),n=new kE,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:c,cb:f}=await s;if(Cc.nextTick(f),c)return;if(i.aborted)throw new yp(void 0,{cause:i.reason});({promise:e,resolve:r}=lp()),yield a}}(),{signal:i}),write(s,a,c){let f=r;r=null,f({chunk:s,done:!1,cb:c})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function Nn(t){let e=t.readable&&typeof t.readable.read!="function"?wp.wrap(t.readable):t.readable,r=t.writable,n=!!xE(e),i=!!EE(r),o,s,a,c,f;function u(l){let p=c;c=null,p?p(l):l&&f.destroy(l)}return f=new lr({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(fp(r,l=>{i=!1,l&&Dn(e,l),u(l)}),f._write=function(l,p,h){r.write(l,p)?h():o=h},f._final=function(l){r.end(),s=l},r.on("drain",function(){if(o){let l=o;o=null,l()}}),r.on("finish",function(){if(s){let l=s;s=null,l()}})),n&&(fp(e,l=>{n=!1,l&&Dn(e,l),u(l)}),e.on("readable",function(){if(a){let l=a;a=null,l()}}),e.on("end",function(){f.push(null)}),f._read=function(){for(;;){let l=e.read();if(l===null){a=f._read;return}if(!f.push(l))return}}),f._destroy=function(l,p){!l&&c!==null&&(l=new yp),a=null,o=null,s=null,c===null?p(l):(c=p,Dn(r,l),Dn(e,l))},f}});var xt=M((LS,Ep)=>{"use strict";var{ObjectDefineProperties:IE,ObjectGetOwnPropertyDescriptor:Nt,ObjectKeys:RE,ObjectSetPrototypeOf:gp}=ce();Ep.exports=Qe;var Kc=Si(),He=zo();gp(Qe.prototype,Kc.prototype);gp(Qe,Kc);{let t=RE(He.prototype);for(let e=0;e<t.length;e++){let r=t[e];Qe.prototype[r]||(Qe.prototype[r]=He.prototype[r])}}function Qe(t){if(!(this instanceof Qe))return new Qe(t);Kc.call(this,t),He.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}IE(Qe.prototype,{writable:{__proto__:null,...Nt(He.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Nt(He.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Nt(He.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Nt(He.prototype,"writableBuffer")},writableLength:{__proto__:null,...Nt(He.prototype,"writableLength")},writableFinished:{__proto__:null,...Nt(He.prototype,"writableFinished")},writableCorked:{__proto__:null,...Nt(He.prototype,"writableCorked")},writableEnded:{__proto__:null,...Nt(He.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Nt(He.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var Lc;function xp(){return Lc===void 0&&(Lc={}),Lc}Qe.fromWeb=function(t,e){return xp().newStreamDuplexFromReadableWritablePair(t,e)};Qe.toWeb=function(t){return xp().newReadableWritablePairFromDuplex(t)};var Oc;Qe.from=function(t){return Oc||(Oc=bp()),Oc(t,"body")}});var Mc=M((OS,Ap)=>{"use strict";var{ObjectSetPrototypeOf:_p,Symbol:UE}=ce();Ap.exports=Dt;var{ERR_METHOD_NOT_IMPLEMENTED:CE}=Te().codes,Dc=xt(),{getHighWaterMark:LE}=Ei();_p(Dt.prototype,Dc.prototype);_p(Dt,Dc);var ki=UE("kCallback");function Dt(t){if(!(this instanceof Dt))return new Dt(t);let e=t?LE(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Dc.call(this,t),this._readableState.sync=!1,this[ki]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",OE)}function Nc(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function OE(){this._final!==Nc&&Nc.call(this)}Dt.prototype._final=Nc;Dt.prototype._transform=function(t,e,r){throw new CE("_transform()")};Dt.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,o=n.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),i.ended||o===n.length||n.length<n.highWaterMark?r():this[ki]=r})};Dt.prototype._read=function(){if(this[ki]){let t=this[ki];this[ki]=null,t()}}});var jc=M((KS,vp)=>{"use strict";var{ObjectSetPrototypeOf:Sp}=ce();vp.exports=Mn;var qc=Mc();Sp(Mn.prototype,qc.prototype);Sp(Mn,qc);function Mn(t){if(!(this instanceof Mn))return new Mn(t);qc.call(this,t)}Mn.prototype._transform=function(t,e,r){r(null,t)}});var Qo=M((NS,Ip)=>{var Pi=cr(),{ArrayIsArray:KE,Promise:NE,SymbolAsyncIterator:DE,SymbolDispose:ME}=ce(),Xo=Kt(),{once:qE}=Se(),jE=Vr(),Bp=xt(),{aggregateTwoErrors:FE,codes:{ERR_INVALID_ARG_TYPE:Yc,ERR_INVALID_RETURN_VALUE:Fc,ERR_MISSING_ARGS:$E,ERR_STREAM_DESTROYED:VE,ERR_STREAM_PREMATURE_CLOSE:HE},AbortError:GE}=Te(),{validateFunction:WE,validateAbortSignal:JE}=Pn(),{isIterable:Jr,isReadable:$c,isReadableNodeStream:Zo,isNodeStream:Tp,isTransformStream:qn,isWebStream:zE,isReadableStream:Vc,isReadableFinished:YE}=mt(),ZE=globalThis.AbortController||Tn().AbortController,Hc,Gc,Wc;function kp(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=Xo(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,jE.destroyer(t,o||new VE("pipe")))},cleanup:i}}function XE(t){return WE(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Jc(t){if(Jr(t))return t;if(Zo(t))return QE(t);throw new Yc("val",["Readable","Iterable","AsyncIterable"],t)}async function*QE(t){Gc||(Gc=Si()),yield*Gc.prototype[DE].call(t)}async function Yo(t,e,r,{end:n}){let i,o=null,s=f=>{if(f&&(i=f),o){let u=o;o=null,u()}},a=()=>new NE((f,u)=>{i?u(i):o=()=>{i?u(i):f()}});e.on("drain",s);let c=Xo(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let f of t)e.write(f)||await a();n&&(e.end(),await a()),r()}catch(f){r(i!==f?FE(i,f):f)}finally{c(),e.off("drain",s)}}async function zc(t,e,r,{end:n}){qn(e)&&(e=e.writable);let i=e.getWriter();try{for await(let o of t)await i.ready,i.write(o).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(o){try{await i.abort(o),r(o)}catch(s){r(s)}}}function e1(...t){return Pp(t,qE(XE(t)))}function Pp(t,e,r){if(t.length===1&&KE(t[0])&&(t=t[0]),t.length<2)throw new $E("streams");let n=new ZE,i=n.signal,o=r?.signal,s=[];JE(o,"options.signal");function a(){y(new GE)}Wc=Wc||Se().addAbortListener;let c;o&&(c=Wc(o,a));let f,u,l=[],p=0;function h(g){y(g,--p===0)}function y(g,_){var E;if(g&&(!f||f.code==="ERR_STREAM_PREMATURE_CLOSE")&&(f=g),!(!f&&!_)){for(;l.length;)l.shift()(f);(E=c)===null||E===void 0||E[ME](),n.abort(),_&&(f||s.forEach(B=>B()),Pi.nextTick(e,f,u))}}let d;for(let g=0;g<t.length;g++){let _=t[g],E=g<t.length-1,B=g>0,T=E||r?.end!==!1,k=g===t.length-1;if(Tp(_)){let R=function(C){C&&C.name!=="AbortError"&&C.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(C)};var A=R;if(T){let{destroy:C,cleanup:L}=kp(_,E,B);l.push(C),$c(_)&&k&&s.push(L)}_.on("error",R),$c(_)&&k&&s.push(()=>{_.removeListener("error",R)})}if(g===0)if(typeof _=="function"){if(d=_({signal:i}),!Jr(d))throw new Fc("Iterable, AsyncIterable or Stream","source",d)}else Jr(_)||Zo(_)||qn(_)?d=_:d=Bp.from(_);else if(typeof _=="function"){if(qn(d)){var w;d=Jc((w=d)===null||w===void 0?void 0:w.readable)}else d=Jc(d);if(d=_(d,{signal:i}),E){if(!Jr(d,!0))throw new Fc("AsyncIterable",`transform[${g-1}]`,d)}else{var m;Hc||(Hc=jc());let R=new Hc({objectMode:!0}),C=(m=d)===null||m===void 0?void 0:m.then;if(typeof C=="function")p++,C.call(d,K=>{u=K,K!=null&&R.write(K),T&&R.end(),Pi.nextTick(h)},K=>{R.destroy(K),Pi.nextTick(h,K)});else if(Jr(d,!0))p++,Yo(d,R,h,{end:T});else if(Vc(d)||qn(d)){let K=d.readable||d;p++,Yo(K,R,h,{end:T})}else throw new Fc("AsyncIterable or Promise","destination",d);d=R;let{destroy:L,cleanup:j}=kp(d,!1,!0);l.push(L),k&&s.push(j)}}else if(Tp(_)){if(Zo(d)){p+=2;let R=t1(d,_,h,{end:T});$c(_)&&k&&s.push(R)}else if(qn(d)||Vc(d)){let R=d.readable||d;p++,Yo(R,_,h,{end:T})}else if(Jr(d))p++,Yo(d,_,h,{end:T});else throw new Yc("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],d);d=_}else if(zE(_)){if(Zo(d))p++,zc(Jc(d),_,h,{end:T});else if(Vc(d)||Jr(d))p++,zc(d,_,h,{end:T});else if(qn(d))p++,zc(d.readable,_,h,{end:T});else throw new Yc("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],d);d=_}else d=Bp.from(_)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&Pi.nextTick(a),d}function t1(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new HE)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;YE(t)?Pi.nextTick(s):t.once("end",s)}else r();return Xo(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),Xo(e,{readable:!1,writable:!0},r)}Ip.exports={pipelineImpl:Pp,pipeline:e1}});var Xc=M((DS,Kp)=>{"use strict";var{pipeline:r1}=Qo(),es=xt(),{destroyer:n1}=Vr(),{isNodeStream:ts,isReadable:Rp,isWritable:Up,isWebStream:Zc,isTransformStream:zr,isWritableStream:Cp,isReadableStream:Lp}=mt(),{AbortError:i1,codes:{ERR_INVALID_ARG_VALUE:Op,ERR_MISSING_ARGS:o1}}=Te(),s1=Kt();Kp.exports=function(...e){if(e.length===0)throw new o1("streams");if(e.length===1)return es.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=es.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=es.from(e[h])}for(let h=0;h<e.length;++h)if(!(!ts(e[h])&&!Zc(e[h]))){if(h<e.length-1&&!(Rp(e[h])||Lp(e[h])||zr(e[h])))throw new Op(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Up(e[h])||Cp(e[h])||zr(e[h])))throw new Op(`streams[${h}]`,r[h],"must be writable")}let n,i,o,s,a;function c(h){let y=s;s=null,y?y(h):h?a.destroy(h):!p&&!l&&a.destroy()}let f=e[0],u=r1(e,c),l=!!(Up(f)||Cp(f)||zr(f)),p=!!(Rp(u)||Lp(u)||zr(u));if(a=new es({writableObjectMode:!!(f!=null&&f.writableObjectMode),readableObjectMode:!!(u!=null&&u.readableObjectMode),writable:l,readable:p}),l){if(ts(f))a._write=function(y,d,w){f.write(y,d)?w():n=w},a._final=function(y){f.end(),i=y},f.on("drain",function(){if(n){let y=n;n=null,y()}});else if(Zc(f)){let d=(zr(f)?f.writable:f).getWriter();a._write=async function(w,m,A){try{await d.ready,d.write(w).catch(()=>{}),A()}catch(g){A(g)}},a._final=async function(w){try{await d.ready,d.close().catch(()=>{}),i=w}catch(m){w(m)}}}let h=zr(u)?u.readable:u;s1(h,()=>{if(i){let y=i;i=null,y()}})}if(p){if(ts(u))u.on("readable",function(){if(o){let h=o;o=null,h()}}),u.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=u.read();if(h===null){o=a._read;return}if(!a.push(h))return}};else if(Zc(u)){let y=(zr(u)?u.readable:u).getReader();a._read=async function(){for(;;)try{let{value:d,done:w}=await y.read();if(!a.push(d))return;if(w){a.push(null);return}}catch{return}}}}return a._destroy=function(h,y){!h&&s!==null&&(h=new i1),o=null,n=null,i=null,s===null?y(h):(s=y,ts(u)&&n1(u,h))},a}});var Gp=M((MS,tf)=>{"use strict";var a1=globalThis.AbortController||Tn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:c1,ERR_INVALID_ARG_TYPE:Ii,ERR_MISSING_ARGS:f1,ERR_OUT_OF_RANGE:u1},AbortError:Et}=Te(),{validateAbortSignal:Yr,validateInteger:Np,validateObject:Zr}=Pn(),l1=ce().Symbol("kWeak"),d1=ce().Symbol("kResistStopPropagation"),{finished:h1}=Kt(),p1=Xc(),{addAbortSignalNoValidate:y1}=xi(),{isWritable:w1,isNodeStream:m1}=mt(),{deprecate:b1}=Se(),{ArrayPrototypePush:g1,Boolean:x1,MathFloor:Dp,Number:E1,NumberIsNaN:_1,Promise:Mp,PromiseReject:qp,PromiseResolve:A1,PromisePrototypeThen:jp,Symbol:$p}=ce(),rs=$p("kEmpty"),Fp=$p("kEof");function S1(t,e){if(e!=null&&Zr(e,"options"),e?.signal!=null&&Yr(e.signal,"options.signal"),m1(t)&&!w1(t))throw new c1("stream",t,"must be writable");let r=p1(this,t);return e!=null&&e.signal&&y1(e.signal,r),r}function ns(t,e){if(typeof t!="function")throw new Ii("fn",["Function","AsyncFunction"],t);e!=null&&Zr(e,"options"),e?.signal!=null&&Yr(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Dp(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Dp(e.highWaterMark)),Np(r,"options.concurrency",1),Np(n,"options.highWaterMark",0),n+=r,(async function*(){let o=Se().AbortSignalAny([e?.signal].filter(x1)),s=this,a=[],c={signal:o},f,u,l=!1,p=0;function h(){l=!0,y()}function y(){p-=1,d()}function d(){u&&!l&&p<r&&a.length<n&&(u(),u=null)}async function w(){try{for await(let m of s){if(l)return;if(o.aborted)throw new Et;try{if(m=t(m,c),m===rs)continue;m=A1(m)}catch(A){m=qp(A)}p+=1,jp(m,y,h),a.push(m),f&&(f(),f=null),!l&&(a.length>=n||p>=r)&&await new Mp(A=>{u=A})}a.push(Fp)}catch(m){let A=qp(m);jp(A,y,h),a.push(A)}finally{l=!0,f&&(f(),f=null)}}w();try{for(;;){for(;a.length>0;){let m=await a[0];if(m===Fp)return;if(o.aborted)throw new Et;m!==rs&&(yield m),a.shift(),d()}await new Mp(m=>{f=m})}}finally{l=!0,u&&(u(),u=null)}}).call(this)}function v1(t=void 0){return t!=null&&Zr(t,"options"),t?.signal!=null&&Yr(t.signal,"options.signal"),(async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Et({cause:t.signal.reason});yield[r++,i]}}).call(this)}async function Vp(t,e=void 0){for await(let r of ef.call(this,t,e))return!0;return!1}async function B1(t,e=void 0){if(typeof t!="function")throw new Ii("fn",["Function","AsyncFunction"],t);return!await Vp.call(this,async(...r)=>!await t(...r),e)}async function T1(t,e){for await(let r of ef.call(this,t,e))return r}async function k1(t,e){if(typeof t!="function")throw new Ii("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),rs}for await(let n of ns.call(this,r,e));}function ef(t,e){if(typeof t!="function")throw new Ii("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:rs}return ns.call(this,r,e)}var Qc=class extends f1{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function P1(t,e,r){var n;if(typeof t!="function")throw new Ii("reducer",["Function","AsyncFunction"],t);r!=null&&Zr(r,"options"),r?.signal!=null&&Yr(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let f=new Et(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await h1(this.destroy(f)),f}let o=new a1,s=o.signal;if(r!=null&&r.signal){let f={once:!0,[l1]:this,[d1]:!0};r.signal.addEventListener("abort",()=>o.abort(),f)}let a=!1;try{for await(let f of this){var c;if(a=!0,r!=null&&(c=r.signal)!==null&&c!==void 0&&c.aborted)throw new Et;i?e=await t(e,f,{signal:s}):(e=f,i=!0)}if(!a&&!i)throw new Qc}finally{o.abort()}return e}async function I1(t){t!=null&&Zr(t,"options"),t?.signal!=null&&Yr(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Et(void 0,{cause:t.signal.reason});g1(e,n)}return e}function R1(t,e){let r=ns.call(this,t,e);return(async function*(){for await(let i of r)yield*i}).call(this)}function Hp(t){if(t=E1(t),_1(t))return 0;if(t<0)throw new u1("number",">= 0",t);return t}function U1(t,e=void 0){return e!=null&&Zr(e,"options"),e?.signal!=null&&Yr(e.signal,"options.signal"),t=Hp(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Et;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Et;t--<=0&&(yield o)}}).call(this)}function C1(t,e=void 0){return e!=null&&Zr(e,"options"),e?.signal!=null&&Yr(e.signal,"options.signal"),t=Hp(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Et;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Et;if(t-- >0&&(yield o),t<=0)return}}).call(this)}tf.exports.streamReturningOperators={asIndexedPairs:b1(v1,"readable.asIndexedPairs will be removed in a future version."),drop:U1,filter:ef,flatMap:R1,map:ns,take:C1,compose:S1};tf.exports.promiseReturningOperators={every:B1,forEach:k1,reduce:P1,toArray:I1,some:Vp,find:T1}});var rf=M((qS,Wp)=>{"use strict";var{ArrayPrototypePop:L1,Promise:O1}=ce(),{isIterable:K1,isNodeStream:N1,isWebStream:D1}=mt(),{pipelineImpl:M1}=Qo(),{finished:q1}=Kt();nf();function j1(...t){return new O1((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!N1(o)&&!K1(o)&&!D1(o)){let s=L1(t);n=s.signal,i=s.end}M1(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}Wp.exports={finished:q1,pipeline:j1}});var nf=M((jS,ry)=>{var{Buffer:F1}=je(),{ObjectDefineProperty:Mt,ObjectKeys:Yp,ReflectApply:Zp}=ce(),{promisify:{custom:Xp}}=Se(),{streamReturningOperators:Jp,promiseReturningOperators:zp}=Gp(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Qp}}=Te(),$1=Xc(),{setDefaultHighWaterMark:V1,getDefaultHighWaterMark:H1}=Ei(),{pipeline:ey}=Qo(),{destroyer:G1}=Vr(),ty=Kt(),of=rf(),Ri=mt(),ie=ry.exports=Ko().Stream;ie.isDestroyed=Ri.isDestroyed;ie.isDisturbed=Ri.isDisturbed;ie.isErrored=Ri.isErrored;ie.isReadable=Ri.isReadable;ie.isWritable=Ri.isWritable;ie.Readable=Si();for(let t of Yp(Jp)){let r=function(...n){if(new.target)throw Qp();return ie.Readable.from(Zp(e,this,n))};sf=r;let e=Jp[t];Mt(r,"name",{__proto__:null,value:e.name}),Mt(r,"length",{__proto__:null,value:e.length}),Mt(ie.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var sf;for(let t of Yp(zp)){let r=function(...i){if(new.target)throw Qp();return Zp(e,this,i)};sf=r;let e=zp[t];Mt(r,"name",{__proto__:null,value:e.name}),Mt(r,"length",{__proto__:null,value:e.length}),Mt(ie.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var sf;ie.Writable=zo();ie.Duplex=xt();ie.Transform=Mc();ie.PassThrough=jc();ie.pipeline=ey;var{addAbortSignal:W1}=xi();ie.addAbortSignal=W1;ie.finished=ty;ie.destroy=G1;ie.compose=$1;ie.setDefaultHighWaterMark=V1;ie.getDefaultHighWaterMark=H1;Mt(ie,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return of}});Mt(ey,Xp,{__proto__:null,enumerable:!0,get(){return of.pipeline}});Mt(ty,Xp,{__proto__:null,enumerable:!0,get(){return of.finished}});ie.Stream=ie;ie._isUint8Array=function(e){return e instanceof Uint8Array};ie._uint8ArrayToBuffer=function(e){return F1.from(e.buffer,e.byteOffset,e.byteLength)}});var af=M((FS,le)=>{"use strict";var pe=nf(),J1=rf(),z1=pe.Readable.destroy;le.exports=pe.Readable;le.exports._uint8ArrayToBuffer=pe._uint8ArrayToBuffer;le.exports._isUint8Array=pe._isUint8Array;le.exports.isDisturbed=pe.isDisturbed;le.exports.isErrored=pe.isErrored;le.exports.isReadable=pe.isReadable;le.exports.Readable=pe.Readable;le.exports.Writable=pe.Writable;le.exports.Duplex=pe.Duplex;le.exports.Transform=pe.Transform;le.exports.PassThrough=pe.PassThrough;le.exports.addAbortSignal=pe.addAbortSignal;le.exports.finished=pe.finished;le.exports.destroy=pe.destroy;le.exports.destroy=z1;le.exports.pipeline=pe.pipeline;le.exports.compose=pe.compose;Object.defineProperty(pe,"promises",{configurable:!0,enumerable:!0,get(){return J1}});le.exports.Stream=pe.Stream;le.exports.default=le.exports});var C_={};Is(C_,{AES_GCM_TAG_LENGTHS:()=>$i,AesCtr:()=>sn,AesCtrAlgorithm:()=>Nf,AesGcm:()=>an,AesGcmAlgorithm:()=>Vf,ConcatKdf:()=>Hf,CryptoAlgorithm:()=>Ne,CryptoUtils:()=>Kf,EcdsaAlgorithm:()=>Hn,Ed25519:()=>Yt,EdDsaAlgorithm:()=>qi,KEY_URI_PREFIX_JWK:()=>gs,LocalKeyManager:()=>Of,P256:()=>zt,POLY1305_TAG_LENGTH:()=>U_,Pbkdf2:()=>Gf,Secp256k1:()=>Jt,Secp256r1:()=>zt,Sha256:()=>Xr,Sha2Algorithm:()=>Ui,X25519:()=>Wf,XChaCha20:()=>Xf,XChaCha20Poly1305:()=>Qf,canonicalize:()=>Tf,computeJwkThumbprint:()=>G,isEcPrivateJwk:()=>it,isEcPublicJwk:()=>rn,isOctPrivateJwk:()=>Wt,isOkpPrivateJwk:()=>ot,isOkpPublicJwk:()=>nn,isPrivateJwk:()=>kf,isPublicJwk:()=>O2});var w0=Hi(uu(),1);var N_=new Uint8Array(0);function lu(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function cn(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function b0(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,c=t.charAt(0),f=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var d=0,w=0,m=0,A=y.length;m!==A&&y[m]===0;)m++,d++;for(var g=(A-m)*u+1>>>0,_=new Uint8Array(g);m!==A;){for(var E=y[m],B=0,T=g-1;(E!==0||B<w)&&T!==-1;T--,B++)E+=256*_[T]>>>0,_[T]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");w=B,m++}for(var k=g-w;k!==g&&_[k]===0;)k++;for(var R=c.repeat(d);k<g;++k)R+=t.charAt(_[k]);return R}function p(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var d=0;if(y[d]!==" "){for(var w=0,m=0;y[d]===c;)w++,d++;for(var A=(y.length-d)*f+1>>>0,g=new Uint8Array(A);y[d];){var _=r[y.charCodeAt(d)];if(_===255)return;for(var E=0,B=A-1;(_!==0||E<m)&&B!==-1;B--,E++)_+=a*g[B]>>>0,g[B]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");m=E,d++}if(y[d]!==" "){for(var T=A-m;T!==A&&g[T]===0;)T++;for(var k=new Uint8Array(w+(A-T)),R=w;T!==A;)k[R++]=g[T++];return k}}}function h(y){var d=p(y);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:p,decode:h}}var g0=b0,x0=g0,du=x0;var Cs=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ls=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hu(this,e)}},Os=class{decoders;constructor(e){this.decoders=e}or(e){return hu(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function hu(t,e){return new Os({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Ks=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Cs(e,r,n),this.decoder=new Ls(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function pu({name:t,prefix:e,encode:r,decode:n}){return new Ks(t,e,r,n)}function Ns({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=du(r,t);return pu({prefix:e,name:t,encode:n,decode:o=>cn(i(o))})}function E0(t,e,r,n){let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,c=0,f=0;for(let u=0;u<o;++u){let l=i[t[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|l,a+=r,a>=8&&(a-=8,s[f++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s}function _0(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function Be({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return pu({prefix:e,name:t,encode(i){return _0(i,n,r)},decode(i){return E0(i,n,r,t)}})}var Wn=Be({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),$_=Be({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),V_=Be({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),H_=Be({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),G_=Be({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),W_=Be({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),J_=Be({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),z_=Be({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ds=Be({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Pe=Ns({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),X_=Ns({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var tA=Be({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),rA=Be({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),at=Be({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nA=Be({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function yu(t){return t.byteOffset!==0||t.byteLength!==t.buffer.byteLength}function wu(t){return typeof t!="object"||t===null?!1:typeof t[Symbol.asyncIterator]=="function"}function Jn(t){let r=Object.prototype.toString.call(t).match(/\s([a-zA-Z0-9]+)/),[n,i]=r;return i}var zn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{f(n.next(u))}catch(l){s(l)}}function c(u){try{f(n.throw(u))}catch(l){s(l)}}function f(u){u.done?o(u.value):i(u.value).then(a,c)}f((n=n.apply(t,e||[])).next())})},mu=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(f){o({value:f,done:a})},s)}},Wi=new TextEncoder,xr=new TextDecoder,q=class t{constructor(e,r){this.data=e,this.format=r}static arrayBuffer(e){return new t(e,"ArrayBuffer")}static asyncIterable(e){if(!wu(e))throw new TypeError("Input must be of type AsyncIterable.");return new t(e,"AsyncIterable")}static base32Z(e){return new t(e,"Base32Z")}static base58Btc(e){return new t(e,"Base58Btc")}static base64Url(e){return new t(e,"Base64Url")}static bufferSource(e){return new t(e,"BufferSource")}static hex(e){if(typeof e!="string")throw new TypeError("Hex input must be a string.");if(e.length%2!==0)throw new TypeError("Hex input must have an even number of characters.");return new t(e,"Hex")}static multibase(e){return new t(e,"Multibase")}static object(e){return new t(e,"Object")}static string(e){return new t(e,"String")}static uint8Array(e){return new t(e,"Uint8Array")}toArrayBuffer(){switch(this.format){case"Base58Btc":return Pe.baseDecode(this.data).buffer;case"Base64Url":return at.baseDecode(this.data).buffer;case"BufferSource":{if(Jn(this.data)==="ArrayBuffer")return this.data;if(ArrayBuffer.isView(this.data))return yu(this.data)?this.data.buffer.slice(this.data.byteOffset,this.data.byteOffset+this.data.byteLength):this.data.buffer;throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":return this.toUint8Array().buffer;case"String":return this.toUint8Array().buffer;case"Uint8Array":return this.data.buffer;default:throw new TypeError(`Conversion from ${this.format} to ArrayBuffer is not supported.`)}}toArrayBufferAsync(){return zn(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":return yield(yield this.toBlobAsync()).arrayBuffer();default:throw new TypeError(`Asynchronous conversion from ${this.format} to ArrayBuffer is not supported.`)}})}toBase32Z(){switch(this.format){case"Uint8Array":return Ds.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Z is not supported.`)}}toBase58Btc(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return Pe.baseEncode(e)}case"Multibase":return this.data.substring(1);case"Uint8Array":return Pe.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base58Btc is not supported.`)}}toBase64Url(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return at.baseEncode(e)}case"BufferSource":{let e=this.toUint8Array();return at.baseEncode(e)}case"Object":{let e=JSON.stringify(this.data),r=Wi.encode(e);return at.baseEncode(r)}case"String":{let e=Wi.encode(this.data);return at.baseEncode(e)}case"Uint8Array":return at.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Url is not supported.`)}}toBlobAsync(){return zn(this,void 0,void 0,function*(){var e,r,n,i;switch(this.format){case"AsyncIterable":{let c=[];try{for(var o=!0,s=mu(this.data),a;a=yield s.next(),e=a.done,!e;o=!0){i=a.value,o=!1;let u=i;c.push(u)}}catch(u){r={error:u}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return new Blob(c)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Blob is not supported.`)}})}toHex(){let e=Array.from({length:256},(r,n)=>n.toString(16).padStart(2,"0"));switch(this.format){case"ArrayBuffer":{let r=this.toUint8Array();return t.uint8Array(r).toHex()}case"Base64Url":{let r=this.toUint8Array();return t.uint8Array(r).toHex()}case"Uint8Array":{let r="";for(let n=0;n<this.data.length;n++)r+=e[this.data[n]];return r}default:throw new TypeError(`Conversion from ${this.format} to Hex is not supported.`)}}toMultibase(){switch(this.format){case"Base58Btc":return`z${this.data}`;default:throw new TypeError(`Conversion from ${this.format} to Multibase is not supported.`)}}toObject(){switch(this.format){case"Base64Url":{let e=at.baseDecode(this.data),r=xr.decode(e);return JSON.parse(r)}case"String":return JSON.parse(this.data);case"Uint8Array":{let e=xr.decode(this.data);return JSON.parse(e)}default:throw new TypeError(`Conversion from ${this.format} to Object is not supported.`)}}toObjectAsync(){return zn(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let e=yield this.toStringAsync();return JSON.parse(e)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Object is not supported.`)}})}toString(){switch(this.format){case"ArrayBuffer":return xr.decode(this.data);case"Base64Url":{let e=at.baseDecode(this.data);return xr.decode(e)}case"Object":return JSON.stringify(this.data);case"Uint8Array":return xr.decode(this.data);default:throw new TypeError(`Conversion from ${this.format} to String is not supported.`)}}toStringAsync(){return zn(this,void 0,void 0,function*(){var e,r,n,i;switch(this.format){case"AsyncIterable":{let c="";try{for(var o=!0,s=mu(this.data),a;a=yield s.next(),e=a.done,!e;o=!0){i=a.value,o=!1;let f=i;typeof f=="string"?c+=f:c+=xr.decode(f,{stream:!0})}}catch(f){r={error:f}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return c+=xr.decode(void 0,{stream:!1}),c}default:throw new TypeError(`Asynchronous conversion from ${this.format} to String is not supported.`)}})}toUint8Array(){switch(this.format){case"ArrayBuffer":return new Uint8Array(this.data);case"Base32Z":return Ds.baseDecode(this.data);case"Base58Btc":return Pe.baseDecode(this.data);case"Base64Url":return at.baseDecode(this.data);case"BufferSource":{let e=Jn(this.data);if(e==="Uint8Array")return this.data;if(e==="ArrayBuffer")return new Uint8Array(this.data);if(ArrayBuffer.isView(this.data))return new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength);throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":{let e=new Uint8Array(this.data.length/2);for(let r=0;r<this.data.length;r+=2){let n=parseInt(this.data.substring(r,r+2),16);if(isNaN(n))throw new TypeError("Input is not a valid hexadecimal string.");e[r/2]=n}return e}case"Object":{let e=JSON.stringify(this.data);return Wi.encode(e)}case"String":return Wi.encode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Uint8Array is not supported.`)}}toUint8ArrayAsync(){return zn(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let e=yield this.toArrayBufferAsync();return new Uint8Array(e)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Uint8Array is not supported.`)}})}};var Yn;(function(t){t.Debug="debug",t.Silent="silent"})(Yn||(Yn={}));var Ms=class{constructor(){this.logLevel=Yn.Silent}setLogLevel(e){this.logLevel=e}log(e){this.info(e)}info(e){this.logLevel!==Yn.Silent&&console.info(e)}error(e){this.logLevel!==Yn.Silent&&console.error(e)}},A0=new Ms;typeof window<"u"&&(window.web5logger=A0);var vt={};Is(vt,{decode:()=>fn,encodeTo:()=>Er,encodingLength:()=>_r});var S0=xu,bu=128,v0=127,B0=~v0,T0=Math.pow(2,31);function xu(t,e,r){e=e||[],r=r||0;for(var n=r;t>=T0;)e[r++]=t&255|bu,t/=128;for(;t&B0;)e[r++]=t&255|bu,t>>>=7;return e[r]=t|0,xu.bytes=r-n+1,e}var k0=qs,P0=128,gu=127;function qs(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw qs.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&gu)<<i:(s&gu)*Math.pow(2,i),i+=7}while(s>=P0);return qs.bytes=o-n,r}var I0=Math.pow(2,7),R0=Math.pow(2,14),U0=Math.pow(2,21),C0=Math.pow(2,28),L0=Math.pow(2,35),O0=Math.pow(2,42),K0=Math.pow(2,49),N0=Math.pow(2,56),D0=Math.pow(2,63),M0=function(t){return t<I0?1:t<R0?2:t<U0?3:t<C0?4:t<L0?5:t<O0?6:t<K0?7:t<N0?8:t<D0?9:10},q0={encode:S0,decode:k0,encodingLength:M0},j0=q0,Zn=j0;function fn(t,e=0){return[Zn.decode(t,e),Zn.decode.bytes]}function Er(t,e,r=0){return Zn.encode(t,e,r),e}function _r(t){return Zn.encodingLength(t)}function js(t,e){let r=e.byteLength,n=_r(t),i=n+_r(r),o=new Uint8Array(i+r);return Er(t,o,0),Er(r,o,n),o.set(e,i),new un(t,r,e,o)}function Eu(t){let e=cn(t),[r,n]=fn(e),[i,o]=fn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new un(r,i,s,e)}function _u(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&lu(t.bytes,r.bytes)}}var un=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};function Au(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return $0(r,$s(t),e??Pe.encoder);default:return V0(r,$s(t),e??Wn.encoder)}}var Su=new WeakMap;function $s(t){let e=Su.get(t);if(e==null){let r=new Map;return Su.set(t,r),r}return e}var Vs=class t{code;version;multihash;bytes;"/";constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==Xn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==H0)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=js(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&_u(e.multihash,n.multihash)}toString(e){return Au(this,e)}toJSON(){return{"/":Au(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new t(n,i,o,s??vu(n,i,o.bytes))}else if(r[G0]===!0){let{version:n,multihash:i,code:o}=r,s=Eu(i);return t.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==Xn)throw new Error(`Version 0 CID must use dag-pb (code: ${Xn}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=vu(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Xn,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=cn(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new un(r.multihashCode,r.digestSize,o,i);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,p]=fn(e.subarray(r));return r+=p,l},i=n(),o=Xn;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),c=n(),f=r+c,u=f-s;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:u,size:f}}static parse(e,r){let[n,i]=F0(e,r),o=t.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return $s(o).set(n,e),o}};function F0(t,e){switch(t[0]){case"Q":{let r=e??Pe;return[Pe.prefix,r.decode(`${Pe.prefix}${t}`)]}case Pe.prefix:{let r=e??Pe;return[Pe.prefix,r.decode(t)]}case Wn.prefix:{let r=e??Wn;return[Wn.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function $0(t,e,r){let{prefix:n}=r;if(n!==Pe.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i}function V0(t,e,r){let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i}var Xn=112,H0=18;function vu(t,e,r){let n=_r(t),i=n+_r(e),o=new Uint8Array(i+r.byteLength);return Er(t,o,0),Er(e,o,n),o.set(r,i),o}var G0=Symbol.for("@ipld/js-cid/CID");var ct=class t{static addPrefix(e){var r;let{code:n,data:i,name:o}=e;if(!(o?!n:n))throw new Error("Either 'name' or 'code' must be defined, but not both.");if(n=t.codeToName.has(n)?n:t.nameToCode.get(o),n===void 0)throw new Error(`Unsupported multicodec: ${(r=e.name)!==null&&r!==void 0?r:e.code}`);let s=vt.encodingLength(n),a=new Uint8Array(s+i.byteLength);return a.set(i,s),vt.encodeTo(n,a),a}static getCodeFromData(e){let{prefixedData:r}=e,[n,i]=vt.decode(r);return n}static getCodeFromName(e){let{name:r}=e,n=t.nameToCode.get(r);if(n===void 0)throw new Error(`Unsupported multicodec: ${r}`);return n}static getNameFromCode(e){let{code:r}=e,n=t.codeToName.get(r);if(n===void 0)throw new Error(`Unsupported multicodec: ${r}`);return n}static registerCodec(e){t.codeToName.set(e.code,e.name),t.nameToCode.set(e.name,e.code)}static removePrefix(e){let{prefixedData:r}=e,[n,i]=vt.decode(r),o=t.codeToName.get(n);if(o===void 0)throw new Error(`Unsupported multicodec: ${n}`);return{code:n,data:r.slice(i),name:o}}};ct.codeToName=new Map;ct.nameToCode=new Map;ct.registerCodec({code:237,name:"ed25519-pub"});ct.registerCodec({code:4864,name:"ed25519-priv"});ct.registerCodec({code:236,name:"x25519-pub"});ct.registerCodec({code:4866,name:"x25519-priv"});ct.registerCodec({code:231,name:"secp256k1-pub"});ct.registerCodec({code:4865,name:"secp256k1-priv"});function Hs(t){Object.keys(t).forEach(e=>{t[e]===void 0?delete t[e]:typeof t[e]=="object"&&Hs(t[e])})}var Rm=Hi(id(),1),Mr=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{f(n.next(u))}catch(l){s(l)}}function c(u){try{f(n.throw(u))}catch(l){s(l)}}function f(u){u.done?o(u.value):i(u.value).then(a,c)}f((n=n.apply(t,e||[])).next())})};var vo=class{constructor(){this.store=new Map}clear(){return Mr(this,void 0,void 0,function*(){this.store.clear()})}close(){return Mr(this,void 0,void 0,function*(){})}delete(e){return Mr(this,void 0,void 0,function*(){return this.store.delete(e)})}get(e){return Mr(this,void 0,void 0,function*(){return this.store.get(e)})}has(e){return Mr(this,void 0,void 0,function*(){return this.store.has(e)})}list(){return Mr(this,void 0,void 0,function*(){return Array.from(this.store.values())})}set(e,r){return Mr(this,void 0,void 0,function*(){this.store.set(e,r)})}};var Y1=Hi(af(),1);var Z1=Hi(af(),1);function X1(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function is(t,...e){if(!X1(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function cf(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ny(t,e){is(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var qt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var ss=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),et=(t,e)=>t<<32-e|t>>>e;var av=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Q1(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function ff(t){return typeof t=="string"&&(t=Q1(t)),is(t),t}function uf(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];is(i),e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var os=class{clone(){return this._cloneInto()}},cv={}.toString;function iy(t){let e=n=>t().update(ff(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function oy(t=32){if(qt&&typeof qt.getRandomValues=="function")return qt.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function e2(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,f=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+f,a,n)}var sy=(t,e,r)=>t&e^~t&r,ay=(t,e,r)=>t&e^t&r^e&r,as=class extends os{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ss(this.buffer)}update(e){cf(this);let{view:r,buffer:n,blockLen:i}=this;e=ff(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let c=ss(e);for(;i<=o-s;s+=i)this.process(c,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){cf(this),ny(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;e2(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=ss(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let f=c/4,u=this.get();if(f>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<f;l++)a.setUint32(4*l,u[l],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};var t2=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),hr=new Uint32Array(64),lf=class extends as{constructor(){super(64,32,8,!1),this.A=dr[0]|0,this.B=dr[1]|0,this.C=dr[2]|0,this.D=dr[3]|0,this.E=dr[4]|0,this.F=dr[5]|0,this.G=dr[6]|0,this.H=dr[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:c}=this;return[e,r,n,i,o,s,a,c]}set(e,r,n,i,o,s,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=c|0}process(e,r){for(let l=0;l<16;l++,r+=4)hr[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=hr[l-15],h=hr[l-2],y=et(p,7)^et(p,18)^p>>>3,d=et(h,17)^et(h,19)^h>>>10;hr[l]=d+hr[l-7]+y+hr[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:c,G:f,H:u}=this;for(let l=0;l<64;l++){let p=et(a,6)^et(a,11)^et(a,25),h=u+p+sy(a,c,f)+t2[l]+hr[l]|0,d=(et(n,2)^et(n,13)^et(n,22))+ay(n,i,o)|0;u=f,f=c,c=a,a=s+h|0,s=o,o=i,i=n,n=h+d|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,f=f+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,c,f,u)}roundClean(){hr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var _t=iy(()=>new lf);var Xr=class{static async digest({data:e}){return _t(e)}};var Ne=class{};var Ui=class extends Ne{async digest({algorithm:e,data:r}){switch(e){case"SHA-256":return await Xr.digest({data:r})}}};function cy(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function r2(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function df(t,...e){if(!r2(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function fy(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");cy(t.outputLen),cy(t.blockLen)}function jn(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function uy(t,e){df(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var cs=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function ly(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var fs=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),tt=(t,e)=>t<<32-e|t>>>e,n2=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!n2)throw new Error("Non little-endian hardware is not supported");function hf(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Ci(t){if(typeof t=="string"&&(t=hf(t)),!ly(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function us(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!ly(i))throw new Error("Uint8Array expected");e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var Fn=class{clone(){return this._cloneInto()}},vv={}.toString;function ls(t){let e=n=>t().update(Ci(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Li(t=32){if(cs&&typeof cs.getRandomValues=="function")return cs.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function i2(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,f=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+f,a,n)}var $n=class extends Fn{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=fs(this.buffer)}update(e){jn(this);let{view:r,buffer:n,blockLen:i}=this;e=Ci(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let c=fs(e);for(;i<=o-s;s+=i)this.process(c,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){jn(this),uy(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;i2(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=fs(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let f=c/4,u=this.get();if(f>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<f;l++)a.setUint32(4*l,u[l],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};var o2=(t,e,r)=>t&e^~t&r,s2=(t,e,r)=>t&e^t&r^e&r,a2=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),pr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),yr=new Uint32Array(64),pf=class extends $n{constructor(){super(64,32,8,!1),this.A=pr[0]|0,this.B=pr[1]|0,this.C=pr[2]|0,this.D=pr[3]|0,this.E=pr[4]|0,this.F=pr[5]|0,this.G=pr[6]|0,this.H=pr[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:c}=this;return[e,r,n,i,o,s,a,c]}set(e,r,n,i,o,s,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=c|0}process(e,r){for(let l=0;l<16;l++,r+=4)yr[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=yr[l-15],h=yr[l-2],y=tt(p,7)^tt(p,18)^p>>>3,d=tt(h,17)^tt(h,19)^h>>>10;yr[l]=d+yr[l-7]+y+yr[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:c,G:f,H:u}=this;for(let l=0;l<64;l++){let p=tt(a,6)^tt(a,11)^tt(a,25),h=u+p+o2(a,c,f)+a2[l]+yr[l]|0,d=(tt(n,2)^tt(n,13)^tt(n,22))+s2(n,i,o)|0;u=f,f=c,c=a,a=s+h|0,s=o,o=i,i=n,n=h+d|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,f=f+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,c,f,u)}roundClean(){yr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ds=ls(()=>new pf);var ps={};Is(ps,{bitGet:()=>p2,bitLen:()=>h2,bitMask:()=>Oi,bitSet:()=>y2,bytesToHex:()=>Ft,bytesToNumberBE:()=>$t,bytesToNumberLE:()=>nt,concatBytes:()=>Ht,createHmacDrbg:()=>mf,ensureBytes:()=>oe,equalBytes:()=>l2,hexToBytes:()=>Qr,hexToNumber:()=>wf,isBytes:()=>rt,numberToBytesBE:()=>Ue,numberToBytesLE:()=>Vt,numberToHexUnpadded:()=>yy,numberToVarBytesBE:()=>u2,utf8ToBytes:()=>d2,validateObject:()=>Ge});var py=BigInt(0),hs=BigInt(1),c2=BigInt(2);function rt(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var f2=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Ft(t){if(!rt(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=f2[t[r]];return e}function yy(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function wf(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}var jt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function dy(t){if(t>=jt._0&&t<=jt._9)return t-jt._0;if(t>=jt._A&&t<=jt._F)return t-(jt._A-10);if(t>=jt._a&&t<=jt._f)return t-(jt._a-10)}function Qr(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=dy(t.charCodeAt(o)),a=dy(t.charCodeAt(o+1));if(s===void 0||a===void 0){let c=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+o)}n[i]=s*16+a}return n}function $t(t){return wf(Ft(t))}function nt(t){if(!rt(t))throw new Error("Uint8Array expected");return wf(Ft(Uint8Array.from(t).reverse()))}function Ue(t,e){return Qr(t.toString(16).padStart(e*2,"0"))}function Vt(t,e){return Ue(t,e).reverse()}function u2(t){return Qr(yy(t))}function oe(t,e,r){let n;if(typeof e=="string")try{n=Qr(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(rt(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function Ht(...t){let e=0;for(let i=0;i<t.length;i++){let o=t[i];if(!rt(o))throw new Error("Uint8Array expected");e+=o.length}let r=new Uint8Array(e),n=0;for(let i=0;i<t.length;i++){let o=t[i];r.set(o,n),n+=o.length}return r}function l2(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function d2(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function h2(t){let e;for(e=0;t>py;t>>=hs,e+=1);return e}function p2(t,e){return t>>BigInt(e)&hs}var y2=(t,e,r)=>t|(r?hs:py)<<BigInt(e),Oi=t=>(c2<<BigInt(t-1))-hs,yf=t=>new Uint8Array(t),hy=t=>Uint8Array.from(t);function mf(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=yf(t),i=yf(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),c=(l=yf())=>{i=a(hy([0]),l),n=a(),l.length!==0&&(i=a(hy([1]),l),n=a())},f=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,p=[];for(;l<e;){n=a();let h=n.slice();p.push(h),l+=n.length}return Ht(...p)};return(l,p)=>{s(),c(l);let h;for(;!(h=p(f()));)c();return s(),h}}var w2={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||rt(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Ge(t,e,r={}){let n=(i,o,s)=>{let a=w2[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let c=t[i];if(!(s&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}var ye=BigInt(0),ae=BigInt(1),en=BigInt(2),m2=BigInt(3),bf=BigInt(4),wy=BigInt(5),my=BigInt(8),b2=BigInt(9),g2=BigInt(16);function ee(t,e){let r=t%e;return r>=ye?r:e+r}function gf(t,e,r){if(r<=ye||e<ye)throw new Error("Expected power/modulo > 0");if(r===ae)return ye;let n=ae;for(;e>ye;)e&ae&&(n=n*t%r),t=t*t%r,e>>=ae;return n}function se(t,e,r){let n=t;for(;e-- >ye;)n*=n,n%=r;return n}function ys(t,e){if(t===ye||e<=ye)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ee(t,e),n=e,i=ye,o=ae,s=ae,a=ye;for(;r!==ye;){let f=n/r,u=n%r,l=i-s*f,p=o-a*f;n=r,r=u,i=s,o=a,s=l,a=p}if(n!==ae)throw new Error("invert: does not exist");return ee(i,e)}function x2(t){let e=(t-ae)/en,r,n,i;for(r=t-ae,n=0;r%en===ye;r/=en,n++);for(i=en;i<t&&gf(i,e,t)!==t-ae;i++);if(n===1){let s=(t+ae)/bf;return function(c,f){let u=c.pow(f,s);if(!c.eql(c.sqr(u),f))throw new Error("Cannot find square root");return u}}let o=(r+ae)/en;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let f=n,u=a.pow(a.mul(a.ONE,i),r),l=a.pow(c,o),p=a.pow(c,r);for(;!a.eql(p,a.ONE);){if(a.eql(p,a.ZERO))return a.ZERO;let h=1;for(let d=a.sqr(p);h<f&&!a.eql(d,a.ONE);h++)d=a.sqr(d);let y=a.pow(u,ae<<BigInt(f-h-1));u=a.sqr(y),l=a.mul(l,y),p=a.mul(p,u),f=h}return l}}function E2(t){if(t%bf===m2){let e=(t+ae)/bf;return function(n,i){let o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%my===wy){let e=(t-wy)/my;return function(n,i){let o=n.mul(i,en),s=n.pow(o,e),a=n.mul(i,s),c=n.mul(n.mul(a,en),s),f=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(f),i))throw new Error("Cannot find square root");return f}}return t%g2,x2(t)}var by=(t,e)=>(ee(t,e)&ae)===ae,_2=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function xf(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=_2.reduce((n,i)=>(n[i]="function",n),e);return Ge(t,r)}function A2(t,e,r){if(r<ye)throw new Error("Expected power > 0");if(r===ye)return t.ONE;if(r===ae)return e;let n=t.ONE,i=e;for(;r>ye;)r&ae&&(n=t.mul(n,i)),i=t.sqr(i),r>>=ae;return n}function S2(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}function Ef(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Vn(t,e,r=!1,n={}){if(t<=ye)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=Ef(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=E2(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:Oi(i),ZERO:ye,ONE:ae,create:c=>ee(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return ye<=c&&c<t},is0:c=>c===ye,isOdd:c=>(c&ae)===ae,neg:c=>ee(-c,t),eql:(c,f)=>c===f,sqr:c=>ee(c*c,t),add:(c,f)=>ee(c+f,t),sub:(c,f)=>ee(c-f,t),mul:(c,f)=>ee(c*f,t),pow:(c,f)=>A2(a,c,f),div:(c,f)=>ee(c*ys(f,t),t),sqrN:c=>c*c,addN:(c,f)=>c+f,subN:(c,f)=>c-f,mulN:(c,f)=>c*f,inv:c=>ys(c,t),sqrt:n.sqrt||(c=>s(a,c)),invertBatch:c=>S2(a,c),cmov:(c,f,u)=>u?f:c,toBytes:c=>r?Vt(c,o):Ue(c,o),fromBytes:c=>{if(c.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);return r?nt(c):$t(c)}});return Object.freeze(a)}function gy(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}function xy(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function _f(t){let e=xy(t);return e+Math.ceil(e/2)}function Ey(t,e,r=!1){let n=t.length,i=xy(e),o=_f(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?$t(t):nt(t),a=ee(s,e-ae)+ae;return r?Vt(a,i):Ue(a,i)}var B2=BigInt(0),Af=BigInt(1);function ws(t,e){let r=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:r,unsafeLadder(i,o){let s=t.ZERO,a=i;for(;o>B2;)o&Af&&(s=s.add(a)),a=a.double(),o>>=Af;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),c=[],f=i,u=f;for(let l=0;l<s;l++){u=f,c.push(u);for(let p=1;p<a;p++)u=u.add(f),c.push(u);f=u.double()}return c},wNAF(i,o,s){let{windows:a,windowSize:c}=n(i),f=t.ZERO,u=t.BASE,l=BigInt(2**i-1),p=2**i,h=BigInt(i);for(let y=0;y<a;y++){let d=y*c,w=Number(s&l);s>>=h,w>c&&(w-=p,s+=Af);let m=d,A=d+Math.abs(w)-1,g=y%2!==0,_=w<0;w===0?u=u.add(r(g,o[m])):f=f.add(r(_,o[A]))}return{p:f,f:u}},wNAFCached(i,o,s,a){let c=i._WINDOW_SIZE||1,f=o.get(i);return f||(f=this.precomputeWindow(i,c),c!==1&&o.set(i,a(f))),this.wNAF(c,f,s)}}}function Ki(t){return xf(t.Fp),Ge(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ef(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function T2(t){let e=Ki(t);Ge(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:k2,hexToBytes:P2}=ps,tn={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=tn;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:k2(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=tn,r=typeof t=="string"?P2(t):t;if(!rt(r))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=tn._parseInt(r.subarray(2)),{d:s,l:a}=tn._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=f=>Number.parseInt(f[0],16)&8?"00"+f:f,r=f=>{let u=f.toString(16);return u.length&1?`0${u}`:u},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),c=r(s);return`30${r(s+o+4)}02${c}${i}02${a}${n}`}},Gt=BigInt(0),We=BigInt(1),qv=BigInt(2),_y=BigInt(3),jv=BigInt(4);function I2(t){let e=T2(t),{Fp:r}=e,n=e.toBytes||((y,d,w)=>{let m=d.toAffine();return Ht(Uint8Array.from([4]),r.toBytes(m.x),r.toBytes(m.y))}),i=e.fromBytes||(y=>{let d=y.subarray(1),w=r.fromBytes(d.subarray(0,r.BYTES)),m=r.fromBytes(d.subarray(r.BYTES,2*r.BYTES));return{x:w,y:m}});function o(y){let{a:d,b:w}=e,m=r.sqr(y),A=r.mul(m,y);return r.add(r.add(A,r.mul(y,d)),w)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(y){return typeof y=="bigint"&&Gt<y&&y<e.n}function a(y){if(!s(y))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(y){let{allowedPrivateKeyLengths:d,nByteLength:w,wrapPrivateKey:m,n:A}=e;if(d&&typeof y!="bigint"){if(rt(y)&&(y=Ft(y)),typeof y!="string"||!d.includes(y.length))throw new Error("Invalid key");y=y.padStart(w*2,"0")}let g;try{g=typeof y=="bigint"?y:$t(oe("private key",y,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof y}`)}return m&&(g=ee(g,A)),a(g),g}let f=new Map;function u(y){if(!(y instanceof l))throw new Error("ProjectivePoint expected")}class l{constructor(d,w,m){if(this.px=d,this.py=w,this.pz=m,d==null||!r.isValid(d))throw new Error("x required");if(w==null||!r.isValid(w))throw new Error("y required");if(m==null||!r.isValid(m))throw new Error("z required")}static fromAffine(d){let{x:w,y:m}=d||{};if(!d||!r.isValid(w)||!r.isValid(m))throw new Error("invalid affine point");if(d instanceof l)throw new Error("projective point not allowed");let A=g=>r.eql(g,r.ZERO);return A(w)&&A(m)?l.ZERO:new l(w,m,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(d){let w=r.invertBatch(d.map(m=>m.pz));return d.map((m,A)=>m.toAffine(w[A])).map(l.fromAffine)}static fromHex(d){let w=l.fromAffine(i(oe("pointHex",d)));return w.assertValidity(),w}static fromPrivateKey(d){return l.BASE.multiply(c(d))}_setWindowSize(d){this._WINDOW_SIZE=d,f.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:d,y:w}=this.toAffine();if(!r.isValid(d)||!r.isValid(w))throw new Error("bad point: x or y not FE");let m=r.sqr(w),A=o(d);if(!r.eql(m,A))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:d}=this.toAffine();if(r.isOdd)return!r.isOdd(d);throw new Error("Field doesn't support isOdd")}equals(d){u(d);let{px:w,py:m,pz:A}=this,{px:g,py:_,pz:E}=d,B=r.eql(r.mul(w,E),r.mul(g,A)),T=r.eql(r.mul(m,E),r.mul(_,A));return B&&T}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:d,b:w}=e,m=r.mul(w,_y),{px:A,py:g,pz:_}=this,E=r.ZERO,B=r.ZERO,T=r.ZERO,k=r.mul(A,A),R=r.mul(g,g),C=r.mul(_,_),L=r.mul(A,g);return L=r.add(L,L),T=r.mul(A,_),T=r.add(T,T),E=r.mul(d,T),B=r.mul(m,C),B=r.add(E,B),E=r.sub(R,B),B=r.add(R,B),B=r.mul(E,B),E=r.mul(L,E),T=r.mul(m,T),C=r.mul(d,C),L=r.sub(k,C),L=r.mul(d,L),L=r.add(L,T),T=r.add(k,k),k=r.add(T,k),k=r.add(k,C),k=r.mul(k,L),B=r.add(B,k),C=r.mul(g,_),C=r.add(C,C),k=r.mul(C,L),E=r.sub(E,k),T=r.mul(C,R),T=r.add(T,T),T=r.add(T,T),new l(E,B,T)}add(d){u(d);let{px:w,py:m,pz:A}=this,{px:g,py:_,pz:E}=d,B=r.ZERO,T=r.ZERO,k=r.ZERO,R=e.a,C=r.mul(e.b,_y),L=r.mul(w,g),j=r.mul(m,_),K=r.mul(A,E),Y=r.add(w,m),S=r.add(g,_);Y=r.mul(Y,S),S=r.add(L,j),Y=r.sub(Y,S),S=r.add(w,A);let I=r.add(g,E);return S=r.mul(S,I),I=r.add(L,K),S=r.sub(S,I),I=r.add(m,A),B=r.add(_,E),I=r.mul(I,B),B=r.add(j,K),I=r.sub(I,B),k=r.mul(R,S),B=r.mul(C,K),k=r.add(B,k),B=r.sub(j,k),k=r.add(j,k),T=r.mul(B,k),j=r.add(L,L),j=r.add(j,L),K=r.mul(R,K),S=r.mul(C,S),j=r.add(j,K),K=r.sub(L,K),K=r.mul(R,K),S=r.add(S,K),L=r.mul(j,S),T=r.add(T,L),L=r.mul(I,S),B=r.mul(Y,B),B=r.sub(B,L),L=r.mul(Y,j),k=r.mul(I,k),k=r.add(k,L),new l(B,T,k)}subtract(d){return this.add(d.negate())}is0(){return this.equals(l.ZERO)}wNAF(d){return h.wNAFCached(this,f,d,w=>{let m=r.invertBatch(w.map(A=>A.pz));return w.map((A,g)=>A.toAffine(m[g])).map(l.fromAffine)})}multiplyUnsafe(d){let w=l.ZERO;if(d===Gt)return w;if(a(d),d===We)return this;let{endo:m}=e;if(!m)return h.unsafeLadder(this,d);let{k1neg:A,k1:g,k2neg:_,k2:E}=m.splitScalar(d),B=w,T=w,k=this;for(;g>Gt||E>Gt;)g&We&&(B=B.add(k)),E&We&&(T=T.add(k)),k=k.double(),g>>=We,E>>=We;return A&&(B=B.negate()),_&&(T=T.negate()),T=new l(r.mul(T.px,m.beta),T.py,T.pz),B.add(T)}multiply(d){a(d);let w=d,m,A,{endo:g}=e;if(g){let{k1neg:_,k1:E,k2neg:B,k2:T}=g.splitScalar(w),{p:k,f:R}=this.wNAF(E),{p:C,f:L}=this.wNAF(T);k=h.constTimeNegate(_,k),C=h.constTimeNegate(B,C),C=new l(r.mul(C.px,g.beta),C.py,C.pz),m=k.add(C),A=R.add(L)}else{let{p:_,f:E}=this.wNAF(w);m=_,A=E}return l.normalizeZ([m,A])[0]}multiplyAndAddUnsafe(d,w,m){let A=l.BASE,g=(E,B)=>B===Gt||B===We||!E.equals(A)?E.multiplyUnsafe(B):E.multiply(B),_=g(this,w).add(g(d,m));return _.is0()?void 0:_}toAffine(d){let{px:w,py:m,pz:A}=this,g=this.is0();d==null&&(d=g?r.ONE:r.inv(A));let _=r.mul(w,d),E=r.mul(m,d),B=r.mul(A,d);if(g)return{x:r.ZERO,y:r.ZERO};if(!r.eql(B,r.ONE))throw new Error("invZ was invalid");return{x:_,y:E}}isTorsionFree(){let{h:d,isTorsionFree:w}=e;if(d===We)return!0;if(w)return w(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:d,clearCofactor:w}=e;return d===We?this:w?w(l,this):this.multiplyUnsafe(e.h)}toRawBytes(d=!0){return this.assertValidity(),n(l,this,d)}toHex(d=!0){return Ft(this.toRawBytes(d))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let p=e.nBitLength,h=ws(l,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:s}}function R2(t){let e=Ki(t);return Ge(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Ay(t){let e=R2(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(S){return Gt<S&&S<r.ORDER}function a(S){return ee(S,n)}function c(S){return ys(S,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:p}=I2({...e,toBytes(S,I,N){let v=I.toAffine(),b=r.toBytes(v.x),P=Ht;return N?P(Uint8Array.from([I.hasEvenY()?2:3]),b):P(Uint8Array.from([4]),b,r.toBytes(v.y))},fromBytes(S){let I=S.length,N=S[0],v=S.subarray(1);if(I===i&&(N===2||N===3)){let b=$t(v);if(!s(b))throw new Error("Point is not on curve");let P=l(b),U=r.sqrt(P),O=(U&We)===We;return(N&1)===1!==O&&(U=r.neg(U)),{x:b,y:U}}else if(I===o&&N===4){let b=r.fromBytes(v.subarray(0,r.BYTES)),P=r.fromBytes(v.subarray(r.BYTES,2*r.BYTES));return{x:b,y:P}}else throw new Error(`Point of length ${I} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),h=S=>Ft(Ue(S,e.nByteLength));function y(S){let I=n>>We;return S>I}function d(S){return y(S)?a(-S):S}let w=(S,I,N)=>$t(S.slice(I,N));class m{constructor(I,N,v){this.r=I,this.s=N,this.recovery=v,this.assertValidity()}static fromCompact(I){let N=e.nByteLength;return I=oe("compactSignature",I,N*2),new m(w(I,0,N),w(I,N,2*N))}static fromDER(I){let{r:N,s:v}=tn.toSig(oe("DER",I));return new m(N,v)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(I){return new m(this.r,this.s,I)}recoverPublicKey(I){let{r:N,s:v,recovery:b}=this,P=T(oe("msgHash",I));if(b==null||![0,1,2,3].includes(b))throw new Error("recovery id invalid");let U=b===2||b===3?N+e.n:N;if(U>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let O=b&1?"03":"02",F=f.fromHex(O+h(U)),$=c(U),Z=a(-P*$),V=a(v*$),H=f.BASE.multiplyAndAddUnsafe(F,Z,V);if(!H)throw new Error("point at infinify");return H.assertValidity(),H}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Qr(this.toDERHex())}toDERHex(){return tn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Qr(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}let A={isValidPrivateKey(S){try{return u(S),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let S=_f(e.n);return Ey(e.randomBytes(S),e.n)},precompute(S=8,I=f.BASE){return I._setWindowSize(S),I.multiply(BigInt(3)),I}};function g(S,I=!0){return f.fromPrivateKey(S).toRawBytes(I)}function _(S){let I=rt(S),N=typeof S=="string",v=(I||N)&&S.length;return I?v===i||v===o:N?v===2*i||v===2*o:S instanceof f}function E(S,I,N=!0){if(_(S))throw new Error("first arg must be private key");if(!_(I))throw new Error("second arg must be public key");return f.fromHex(I).multiply(u(S)).toRawBytes(N)}let B=e.bits2int||function(S){let I=$t(S),N=S.length*8-e.nBitLength;return N>0?I>>BigInt(N):I},T=e.bits2int_modN||function(S){return a(B(S))},k=Oi(e.nBitLength);function R(S){if(typeof S!="bigint")throw new Error("bigint expected");if(!(Gt<=S&&S<k))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Ue(S,e.nByteLength)}function C(S,I,N=L){if(["recovered","canonical"].some(te=>te in N))throw new Error("sign() legacy options not supported");let{hash:v,randomBytes:b}=e,{lowS:P,prehash:U,extraEntropy:O}=N;P==null&&(P=!0),S=oe("msgHash",S),U&&(S=oe("prehashed msgHash",v(S)));let F=T(S),$=u(I),Z=[R($),R(F)];if(O!=null){let te=O===!0?b(r.BYTES):O;Z.push(oe("extraEntropy",te))}let V=Ht(...Z),H=F;function ne(te){let be=B(te);if(!p(be))return;let ge=c(be),de=f.BASE.multiply(be).toAffine(),_e=a(de.x);if(_e===Gt)return;let St=a(ge*a(H+_e*$));if(St===Gt)return;let gr=(de.x===_e?0:2)|Number(de.y&We),Gn=St;return P&&y(St)&&(Gn=d(St),gr^=1),new m(_e,Gn,gr)}return{seed:V,k2sig:ne}}let L={lowS:e.lowS,prehash:!1},j={lowS:e.lowS,prehash:!1};function K(S,I,N=L){let{seed:v,k2sig:b}=C(S,I,N),P=e;return mf(P.hash.outputLen,P.nByteLength,P.hmac)(v,b)}f.BASE._setWindowSize(8);function Y(S,I,N,v=j){let b=S;if(I=oe("msgHash",I),N=oe("publicKey",N),"strict"in v)throw new Error("options.strict was renamed to lowS");let{lowS:P,prehash:U}=v,O,F;try{if(typeof b=="string"||rt(b))try{O=m.fromDER(b)}catch(de){if(!(de instanceof tn.Err))throw de;O=m.fromCompact(b)}else if(typeof b=="object"&&typeof b.r=="bigint"&&typeof b.s=="bigint"){let{r:de,s:_e}=b;O=new m(de,_e)}else throw new Error("PARSE");F=f.fromHex(N)}catch(de){if(de.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(P&&O.hasHighS())return!1;U&&(I=e.hash(I));let{r:$,s:Z}=O,V=T(I),H=c(Z),ne=a(V*H),te=a($*H),be=f.BASE.multiplyAndAddUnsafe(F,ne,te)?.toAffine();return be?a(be.x)===$:!1}return{CURVE:e,getPublicKey:g,getSharedSecret:E,sign:K,verify:Y,ProjectivePoint:f,Signature:m,utils:A}}var ms=class extends Fn{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,fy(e);let n=Ci(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return jn(this),this.iHash.update(e),this}digestInto(e){jn(this),df(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Sf=(t,e,r)=>new ms(t,e).update(r).digest();Sf.create=(t,e)=>new ms(t,e);function U2(t){return{hash:t,hmac:(e,...r)=>Sf(t,e,us(...r)),randomBytes:Li}}function bs(t,e){let r=n=>Ay({...t,...U2(n)});return Object.freeze({...r(e),create:r})}var By=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Sy=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),C2=BigInt(1),vf=BigInt(2),vy=(t,e)=>(t+e/vf)/e;function L2(t){let e=By,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),f=t*t*t%e,u=f*f*t%e,l=se(u,r,e)*u%e,p=se(l,r,e)*u%e,h=se(p,vf,e)*f%e,y=se(h,i,e)*h%e,d=se(y,o,e)*y%e,w=se(d,a,e)*d%e,m=se(w,c,e)*w%e,A=se(m,a,e)*d%e,g=se(A,r,e)*u%e,_=se(g,s,e)*y%e,E=se(_,n,e)*f%e,B=se(E,vf,e);if(!Bf.eql(Bf.sqr(B),t))throw new Error("Cannot find square root");return B}var Bf=Vn(By,void 0,void 0,{sqrt:L2}),Ce=bs({a:BigInt(0),b:BigInt(7),Fp:Bf,n:Sy,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=Sy,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-C2*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=vy(o*t,e),c=vy(-n*t,e),f=ee(t-a*r-c*i,e),u=ee(-a*n-c*o,e),l=f>s,p=u>s;if(l&&(f=e-f),p&&(u=e-u),f>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:f,k2neg:p,k2:u}}}},ds),Qv=BigInt(0);var e8=Ce.ProjectivePoint;function Tf(t){let e=n=>{if(n!==null&&typeof n=="object"&&!Array.isArray(n)){let i=Object.keys(n).sort(),o={};for(let s of i)o[s]=e(n[s]);return o}return n},r=e(t);return JSON.stringify(r)}var gs="urn:jwk:";async function G({jwk:t}){let e=t.kty,r;if(e==="EC")r={crv:t.crv,kty:t.kty,x:t.x,y:t.y};else if(e==="oct")r={k:t.k,kty:t.kty};else if(e==="OKP")r={crv:t.crv,kty:t.kty,x:t.x};else if(e==="RSA")r={e:t.e,kty:t.kty,n:t.n};else throw new Error(`Unsupported key type: ${e}`);Hs(r);let n=Tf(r),i=q.string(n).toUint8Array(),o=await Xr.digest({data:i});return q.uint8Array(o).toBase64Url()}function it(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t&&"d"in t)||t.kty!=="EC"||typeof t.d!="string"||typeof t.x!="string")}function rn(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t)||"d"in t||t.kty!=="EC"||typeof t.x!="string")}function Wt(t){return!(!t||typeof t!="object"||!("kty"in t&&"k"in t)||t.kty!=="oct"||typeof t.k!="string")}function ot(t){return!(!t||typeof t!="object"||!("kty"in t&&"crv"in t&&"x"in t&&"d"in t)||t.kty!=="OKP"||typeof t.d!="string"||typeof t.x!="string")}function nn(t){return!(!t||typeof t!="object"||"d"in t||!("kty"in t&&"crv"in t&&"x"in t)||t.kty!=="OKP"||typeof t.x!="string")}function kf(t){if(!t||typeof t!="object")return!1;switch(t.kty){case"EC":case"OKP":case"RSA":return"d"in t;case"oct":return"k"in t;default:return!1}}function O2(t){if(!t||typeof t!="object")return!1;switch(t.kty){case"EC":case"OKP":return"x"in t&&!("d"in t);case"RSA":return"n"in t&&"e"in t&&!("d"in t);default:return!1}}var Jt=class t{static async adjustSignatureToLowS({signature:e}){let r=Ce.Signature.fromCompact(e);return r.hasHighS()?r.normalizeS().toCompactRawBytes():e}static async bytesToPrivateKey({privateKeyBytes:e}){let r=await t.getCurvePoint({keyBytes:e}),n={kty:"EC",crv:"secp256k1",d:q.uint8Array(e).toBase64Url(),x:q.uint8Array(r.x).toBase64Url(),y:q.uint8Array(r.y).toBase64Url()};return n.kid=await G({jwk:n}),n}static async bytesToPublicKey({publicKeyBytes:e}){let r=await t.getCurvePoint({keyBytes:e}),n={kty:"EC",crv:"secp256k1",x:q.uint8Array(r.x).toBase64Url(),y:q.uint8Array(r.y).toBase64Url()};return n.kid=await G({jwk:n}),n}static async compressPublicKey({publicKeyBytes:e}){return Ce.ProjectivePoint.fromHex(e).toRawBytes(!0)}static async computePublicKey({key:e}){let r=await t.privateKeyToBytes({privateKey:e}),n=await t.getCurvePoint({keyBytes:r}),i={kty:"EC",crv:"secp256k1",x:q.uint8Array(n.x).toBase64Url(),y:q.uint8Array(n.y).toBase64Url()};return i.kid=await G({jwk:i}),i}static async convertDerToCompactSignature({derSignature:e}){return Ce.Signature.fromDER(e).toCompactRawBytes()}static async decompressPublicKey({publicKeyBytes:e}){return Ce.ProjectivePoint.fromHex(e).toRawBytes(!1)}static async generateKey(){let e=Ce.utils.randomPrivateKey(),r=await t.bytesToPrivateKey({privateKeyBytes:e});return r.kid=await G({jwk:r}),r}static async getPublicKey({key:e}){if(!(it(e)&&e.crv==="secp256k1"))throw new Error("Secp256k1: The provided key is not a secp256k1 private JWK.");let{d:r,...n}=e;return n.kid??=await G({jwk:n}),n}static async privateKeyToBytes({privateKey:e}){if(!it(e))throw new Error("Secp256k1: The provided key is not a valid EC private key.");return q.base64Url(e.d).toUint8Array()}static async publicKeyToBytes({publicKey:e}){if(!(rn(e)&&e.y))throw new Error("Secp256k1: The provided key is not a valid EC public key.");let r=new Uint8Array([4]),n=q.base64Url(e.x).toUint8Array(),i=q.base64Url(e.y).toUint8Array();return new Uint8Array([...r,...n,...i])}static async sharedSecret({privateKeyA:e,publicKeyB:r}){if("x"in e&&"x"in r&&e.x===r.x)throw new Error("Secp256k1: ECDH shared secret cannot be computed from a single key pair's public and private keys.");let n=await t.privateKeyToBytes({privateKey:e}),i=await t.publicKeyToBytes({publicKey:r});return Ce.getSharedSecret(n,i,!0).slice(1)}static async sign({data:e,key:r}){let n=await t.privateKeyToBytes({privateKey:r}),i=_t(e);return Ce.sign(i,n).toCompactRawBytes()}static async validatePrivateKey({privateKeyBytes:e}){return Ce.utils.isValidPrivateKey(e)}static async validatePublicKey({publicKeyBytes:e}){try{Ce.ProjectivePoint.fromHex(e).assertValidity()}catch{return!1}return!0}static async verify({key:e,signature:r,data:n}){let i=await t.publicKeyToBytes({publicKey:e}),o=_t(n);return Ce.verify(r,o,i,{lowS:!1})}static async getCurvePoint({keyBytes:e}){e.byteLength===32&&(e=Ce.getPublicKey(e));let r=Ce.ProjectivePoint.fromHex(e),n=Ue(r.x,32),i=Ue(r.y,32);return{x:n,y:i}}};var Ty=Vn(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),K2=Ty.create(BigInt("-3")),N2=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),D2=bs({a:K2,b:N2,Fp:Ty,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},ds),De=D2;var zt=class t{static async adjustSignatureToLowS({signature:e}){let r=De.Signature.fromCompact(e);return r.hasHighS()?r.normalizeS().toCompactRawBytes():e}static async bytesToPrivateKey({privateKeyBytes:e}){let r=await t.getCurvePoint({keyBytes:e}),n={kty:"EC",crv:"P-256",d:q.uint8Array(e).toBase64Url(),x:q.uint8Array(r.x).toBase64Url(),y:q.uint8Array(r.y).toBase64Url()};return n.kid=await G({jwk:n}),n}static async bytesToPublicKey({publicKeyBytes:e}){let r=await t.getCurvePoint({keyBytes:e}),n={kty:"EC",crv:"P-256",x:q.uint8Array(r.x).toBase64Url(),y:q.uint8Array(r.y).toBase64Url()};return n.kid=await G({jwk:n}),n}static async compressPublicKey({publicKeyBytes:e}){return De.ProjectivePoint.fromHex(e).toRawBytes(!0)}static async computePublicKey({key:e}){let r=await t.privateKeyToBytes({privateKey:e}),n=await t.getCurvePoint({keyBytes:r}),i={kty:"EC",crv:"P-256",x:q.uint8Array(n.x).toBase64Url(),y:q.uint8Array(n.y).toBase64Url()};return i.kid=await G({jwk:i}),i}static async convertDerToCompactSignature({derSignature:e}){return De.Signature.fromDER(e).toCompactRawBytes()}static async decompressPublicKey({publicKeyBytes:e}){return De.ProjectivePoint.fromHex(e).toRawBytes(!1)}static async generateKey(){let e=De.utils.randomPrivateKey(),r=await t.bytesToPrivateKey({privateKeyBytes:e});return r.kid=await G({jwk:r}),r}static async getPublicKey({key:e}){if(!(it(e)&&e.crv==="P-256"))throw new Error("Secp256r1: The provided key is not a 'P-256' private JWK.");let{d:r,...n}=e;return n.kid??=await G({jwk:n}),n}static async privateKeyToBytes({privateKey:e}){if(!it(e))throw new Error("Secp256r1: The provided key is not a valid EC private key.");return q.base64Url(e.d).toUint8Array()}static async publicKeyToBytes({publicKey:e}){if(!(rn(e)&&e.y))throw new Error("Secp256r1: The provided key is not a valid EC public key.");let r=new Uint8Array([4]),n=q.base64Url(e.x).toUint8Array(),i=q.base64Url(e.y).toUint8Array();return new Uint8Array([...r,...n,...i])}static async sharedSecret({privateKeyA:e,publicKeyB:r}){if("x"in e&&"x"in r&&e.x===r.x)throw new Error("Secp256r1: ECDH shared secret cannot be computed from a single key pair's public and private keys.");let n=await t.privateKeyToBytes({privateKey:e}),i=await t.publicKeyToBytes({publicKey:r});return De.getSharedSecret(n,i,!0).slice(1)}static async sign({data:e,key:r}){let n=await t.privateKeyToBytes({privateKey:r}),i=_t(e);return De.sign(i,n).toCompactRawBytes()}static async validatePrivateKey({privateKeyBytes:e}){return De.utils.isValidPrivateKey(e)}static async validatePublicKey({publicKeyBytes:e}){try{De.ProjectivePoint.fromHex(e).assertValidity()}catch{return!1}return!0}static async verify({key:e,signature:r,data:n}){let i=await t.publicKeyToBytes({publicKey:e}),o=_t(n);return De.verify(r,o,i,{lowS:!1})}static async getCurvePoint({keyBytes:e}){e.byteLength===32&&(e=De.getPublicKey(e));let r=De.ProjectivePoint.fromHex(e),n=Ue(r.x,32),i=Ue(r.y,32);return{x:n,y:i}}};var Hn=class extends Ne{async computePublicKey({key:e}){if(!it(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":{let r=await Jt.computePublicKey({key:e});return r.alg="ES256K",r}case"P-256":{let r=await zt.computePublicKey({key:e});return r.alg="ES256",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}}async generateKey({algorithm:e}){switch(e){case"ES256K":case"secp256k1":{let r=await Jt.generateKey();return r.alg="ES256K",r}case"ES256":case"secp256r1":{let r=await zt.generateKey();return r.alg="ES256",r}}}async getPublicKey({key:e}){if(!it(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":{let r=await Jt.getPublicKey({key:e});return r.alg="ES256K",r}case"P-256":{let r=await zt.getPublicKey({key:e});return r.alg="ES256",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}}async sign({key:e,data:r}){if(!it(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) private key.");switch(e.crv){case"secp256k1":return await Jt.sign({key:e,data:r});case"P-256":return await zt.sign({key:e,data:r});default:throw new Error(`Unsupported curve: ${e.crv}`)}}async verify({key:e,signature:r,data:n}){if(!rn(e))throw new TypeError("Invalid key provided. Must be an elliptic curve (EC) public key.");switch(e.crv){case"secp256k1":return await Jt.verify({key:e,signature:r,data:n});case"P-256":return await zt.verify({key:e,signature:r,data:n});default:throw new Error(`Unsupported curve: ${e.crv}`)}}};var xs=BigInt(4294967295),Pf=BigInt(32);function ky(t,e=!1){return e?{h:Number(t&xs),l:Number(t>>Pf&xs)}:{h:Number(t>>Pf&xs)|0,l:Number(t&xs)|0}}function M2(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:o,l:s}=ky(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var q2=(t,e)=>BigInt(t>>>0)<<Pf|BigInt(e>>>0),j2=(t,e,r)=>t>>>r,F2=(t,e,r)=>t<<32-r|e>>>r,$2=(t,e,r)=>t>>>r|e<<32-r,V2=(t,e,r)=>t<<32-r|e>>>r,H2=(t,e,r)=>t<<64-r|e>>>r-32,G2=(t,e,r)=>t>>>r-32|e<<64-r,W2=(t,e)=>e,J2=(t,e)=>t,z2=(t,e,r)=>t<<r|e>>>32-r,Y2=(t,e,r)=>e<<r|t>>>32-r,Z2=(t,e,r)=>e<<r-32|t>>>64-r,X2=(t,e,r)=>t<<r-32|e>>>64-r;function Q2(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var e_=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),t_=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,r_=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),n_=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,i_=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),o_=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var s_={fromBig:ky,split:M2,toBig:q2,shrSH:j2,shrSL:F2,rotrSH:$2,rotrSL:V2,rotrBH:H2,rotrBL:G2,rotr32H:W2,rotr32L:J2,rotlSH:z2,rotlSL:Y2,rotlBH:Z2,rotlBL:X2,add:Q2,add3L:e_,add3H:t_,add4L:r_,add4H:n_,add5H:o_,add5L:i_},W=s_;var[a_,c_]=W.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),wr=new Uint32Array(80),mr=new Uint32Array(80),If=class extends $n{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:c,Eh:f,El:u,Fh:l,Fl:p,Gh:h,Gl:y,Hh:d,Hl:w}=this;return[e,r,n,i,o,s,a,c,f,u,l,p,h,y,d,w]}set(e,r,n,i,o,s,a,c,f,u,l,p,h,y,d,w){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=c|0,this.Eh=f|0,this.El=u|0,this.Fh=l|0,this.Fl=p|0,this.Gh=h|0,this.Gl=y|0,this.Hh=d|0,this.Hl=w|0}process(e,r){for(let g=0;g<16;g++,r+=4)wr[g]=e.getUint32(r),mr[g]=e.getUint32(r+=4);for(let g=16;g<80;g++){let _=wr[g-15]|0,E=mr[g-15]|0,B=W.rotrSH(_,E,1)^W.rotrSH(_,E,8)^W.shrSH(_,E,7),T=W.rotrSL(_,E,1)^W.rotrSL(_,E,8)^W.shrSL(_,E,7),k=wr[g-2]|0,R=mr[g-2]|0,C=W.rotrSH(k,R,19)^W.rotrBH(k,R,61)^W.shrSH(k,R,6),L=W.rotrSL(k,R,19)^W.rotrBL(k,R,61)^W.shrSL(k,R,6),j=W.add4L(T,L,mr[g-7],mr[g-16]),K=W.add4H(j,B,C,wr[g-7],wr[g-16]);wr[g]=K|0,mr[g]=j|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:c,Dh:f,Dl:u,Eh:l,El:p,Fh:h,Fl:y,Gh:d,Gl:w,Hh:m,Hl:A}=this;for(let g=0;g<80;g++){let _=W.rotrSH(l,p,14)^W.rotrSH(l,p,18)^W.rotrBH(l,p,41),E=W.rotrSL(l,p,14)^W.rotrSL(l,p,18)^W.rotrBL(l,p,41),B=l&h^~l&d,T=p&y^~p&w,k=W.add5L(A,E,T,c_[g],mr[g]),R=W.add5H(k,m,_,B,a_[g],wr[g]),C=k|0,L=W.rotrSH(n,i,28)^W.rotrBH(n,i,34)^W.rotrBH(n,i,39),j=W.rotrSL(n,i,28)^W.rotrBL(n,i,34)^W.rotrBL(n,i,39),K=n&o^n&a^o&a,Y=i&s^i&c^s&c;m=d|0,A=w|0,d=h|0,w=y|0,h=l|0,y=p|0,{h:l,l:p}=W.add(f|0,u|0,R|0,C|0),f=a|0,u=c|0,a=o|0,c=s|0,o=n|0,s=i|0;let S=W.add3L(C,j,Y);n=W.add3H(S,R,L,K),i=S|0}({h:n,l:i}=W.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=W.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:c}=W.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:f,l:u}=W.add(this.Dh|0,this.Dl|0,f|0,u|0),{h:l,l:p}=W.add(this.Eh|0,this.El|0,l|0,p|0),{h,l:y}=W.add(this.Fh|0,this.Fl|0,h|0,y|0),{h:d,l:w}=W.add(this.Gh|0,this.Gl|0,d|0,w|0),{h:m,l:A}=W.add(this.Hh|0,this.Hl|0,m|0,A|0),this.set(n,i,o,s,a,c,f,u,l,p,h,y,d,w,m,A)}roundClean(){wr.fill(0),mr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Rf=ls(()=>new If);var st=BigInt(0),Me=BigInt(1),Es=BigInt(2),f_=BigInt(8),u_={zip215:!0};function l_(t){let e=Ki(t);return Ge(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function _s(t){let e=l_(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=e,f=Es<<BigInt(a*8)-Me,u=r.create,l=e.uvRatio||((v,b)=>{try{return{isValid:!0,value:r.sqrt(v*r.inv(b))}}catch{return{isValid:!1,value:st}}}),p=e.adjustScalarBytes||(v=>v),h=e.domain||((v,b,P)=>{if(b.length||P)throw new Error("Contexts/pre-hash are not supported");return v}),y=v=>typeof v=="bigint"&&st<v,d=(v,b)=>y(v)&&y(b)&&v<b,w=v=>v===st||d(v,f);function m(v,b){if(d(v,b))return v;throw new Error(`Expected valid scalar < ${b}, got ${typeof v} ${v}`)}function A(v){return v===st?v:m(v,n)}let g=new Map;function _(v){if(!(v instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(b,P,U,O){if(this.ex=b,this.ey=P,this.ez=U,this.et=O,!w(b))throw new Error("x required");if(!w(P))throw new Error("y required");if(!w(U))throw new Error("z required");if(!w(O))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(b){if(b instanceof E)throw new Error("extended point not allowed");let{x:P,y:U}=b||{};if(!w(P)||!w(U))throw new Error("invalid affine point");return new E(P,U,Me,u(P*U))}static normalizeZ(b){let P=r.invertBatch(b.map(U=>U.ez));return b.map((U,O)=>U.toAffine(P[O])).map(E.fromAffine)}_setWindowSize(b){this._WINDOW_SIZE=b,g.delete(this)}assertValidity(){let{a:b,d:P}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:U,ey:O,ez:F,et:$}=this,Z=u(U*U),V=u(O*O),H=u(F*F),ne=u(H*H),te=u(Z*b),be=u(H*u(te+V)),ge=u(ne+u(P*u(Z*V)));if(be!==ge)throw new Error("bad point: equation left != right (1)");let de=u(U*O),_e=u(F*$);if(de!==_e)throw new Error("bad point: equation left != right (2)")}equals(b){_(b);let{ex:P,ey:U,ez:O}=this,{ex:F,ey:$,ez:Z}=b,V=u(P*Z),H=u(F*O),ne=u(U*Z),te=u($*O);return V===H&&ne===te}is0(){return this.equals(E.ZERO)}negate(){return new E(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:b}=e,{ex:P,ey:U,ez:O}=this,F=u(P*P),$=u(U*U),Z=u(Es*u(O*O)),V=u(b*F),H=P+U,ne=u(u(H*H)-F-$),te=V+$,be=te-Z,ge=V-$,de=u(ne*be),_e=u(te*ge),St=u(ne*ge),gr=u(be*te);return new E(de,_e,gr,St)}add(b){_(b);let{a:P,d:U}=e,{ex:O,ey:F,ez:$,et:Z}=this,{ex:V,ey:H,ez:ne,et:te}=b;if(P===BigInt(-1)){let tu=u((F-O)*(H+V)),ru=u((F+O)*(H-V)),Ps=u(ru-tu);if(Ps===st)return this.double();let nu=u($*Es*te),iu=u(Z*Es*ne),ou=iu+nu,su=ru+tu,au=iu-nu,i0=u(ou*Ps),o0=u(su*au),s0=u(ou*au),a0=u(Ps*su);return new E(i0,o0,a0,s0)}let be=u(O*V),ge=u(F*H),de=u(Z*U*te),_e=u($*ne),St=u((O+F)*(V+H)-be-ge),gr=_e-de,Gn=_e+de,eu=u(ge-P*be),e0=u(St*gr),t0=u(Gn*eu),r0=u(St*eu),n0=u(gr*Gn);return new E(e0,t0,n0,r0)}subtract(b){return this.add(b.negate())}wNAF(b){return k.wNAFCached(this,g,b,E.normalizeZ)}multiply(b){let{p:P,f:U}=this.wNAF(m(b,n));return E.normalizeZ([P,U])[0]}multiplyUnsafe(b){let P=A(b);return P===st?T:this.equals(T)||P===Me?this:this.equals(B)?this.wNAF(P).p:k.unsafeLadder(this,P)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return k.unsafeLadder(this,n).is0()}toAffine(b){let{ex:P,ey:U,ez:O}=this,F=this.is0();b==null&&(b=F?f_:r.inv(O));let $=u(P*b),Z=u(U*b),V=u(O*b);if(F)return{x:st,y:Me};if(V!==Me)throw new Error("invZ was invalid");return{x:$,y:Z}}clearCofactor(){let{h:b}=e;return b===Me?this:this.multiplyUnsafe(b)}static fromHex(b,P=!1){let{d:U,a:O}=e,F=r.BYTES;b=oe("pointHex",b,F);let $=b.slice(),Z=b[F-1];$[F-1]=Z&-129;let V=nt($);V===st||(P?m(V,f):m(V,r.ORDER));let H=u(V*V),ne=u(H-Me),te=u(U*H-O),{isValid:be,value:ge}=l(ne,te);if(!be)throw new Error("Point.fromHex: invalid y coordinate");let de=(ge&Me)===Me,_e=(Z&128)!==0;if(!P&&ge===st&&_e)throw new Error("Point.fromHex: x=0 and x_0=1");return _e!==de&&(ge=u(-ge)),E.fromAffine({x:ge,y:V})}static fromPrivateKey(b){return L(b).point}toRawBytes(){let{x:b,y:P}=this.toAffine(),U=Vt(P,r.BYTES);return U[U.length-1]|=b&Me?128:0,U}toHex(){return Ft(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Me,u(e.Gx*e.Gy)),E.ZERO=new E(st,Me,Me,st);let{BASE:B,ZERO:T}=E,k=ws(E,a*8);function R(v){return ee(v,n)}function C(v){return R(nt(v))}function L(v){let b=a;v=oe("private key",v,b);let P=oe("hashed private key",o(v),2*b),U=p(P.slice(0,b)),O=P.slice(b,2*b),F=C(U),$=B.multiply(F),Z=$.toRawBytes();return{head:U,prefix:O,scalar:F,point:$,pointBytes:Z}}function j(v){return L(v).pointBytes}function K(v=new Uint8Array,...b){let P=Ht(...b);return C(o(h(P,oe("context",v),!!i)))}function Y(v,b,P={}){v=oe("message",v),i&&(v=i(v));let{prefix:U,scalar:O,pointBytes:F}=L(b),$=K(P.context,U,v),Z=B.multiply($).toRawBytes(),V=K(P.context,Z,F,v),H=R($+V*O);A(H);let ne=Ht(Z,Vt(H,r.BYTES));return oe("result",ne,a*2)}let S=u_;function I(v,b,P,U=S){let{context:O,zip215:F}=U,$=r.BYTES;v=oe("signature",v,2*$),b=oe("message",b),i&&(b=i(b));let Z=nt(v.slice($,2*$)),V,H,ne;try{V=E.fromHex(P,F),H=E.fromHex(v.slice(0,$),F),ne=B.multiplyUnsafe(Z)}catch{return!1}if(!F&&V.isSmallOrder())return!1;let te=K(O,H.toRawBytes(),V.toRawBytes(),b);return H.add(V.multiplyUnsafe(te)).subtract(ne).clearCofactor().equals(E.ZERO)}return B._setWindowSize(8),{CURVE:e,getPublicKey:j,sign:Y,verify:I,ExtendedPoint:E,utils:{getExtendedPublicKey:L,randomPrivateKey:()=>s(r.BYTES),precompute(v=8,b=E.BASE){return b._setWindowSize(v),b.multiply(BigInt(3)),b}}}}var Ni=BigInt(0),Uf=BigInt(1);function d_(t){return Ge(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function Py(t){let e=d_(t),{P:r}=e,n=g=>ee(g,r),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,a=e.adjustScalarBytes||(g=>g),c=e.powPminus2||(g=>gf(g,r-BigInt(2),r));function f(g,_,E){let B=n(g*(_-E));return _=n(_-B),E=n(E+B),[_,E]}function u(g){if(typeof g=="bigint"&&Ni<=g&&g<r)return g;throw new Error("Expected valid scalar 0 < scalar < CURVE.P")}let l=(e.a-BigInt(2))/BigInt(4);function p(g,_){let E=u(g),B=u(_),T=E,k=Uf,R=Ni,C=E,L=Uf,j=Ni,K;for(let S=BigInt(i-1);S>=Ni;S--){let I=B>>S&Uf;j^=I,K=f(j,k,C),k=K[0],C=K[1],K=f(j,R,L),R=K[0],L=K[1],j=I;let N=k+R,v=n(N*N),b=k-R,P=n(b*b),U=v-P,O=C+L,F=C-L,$=n(F*N),Z=n(O*b),V=$+Z,H=$-Z;C=n(V*V),L=n(T*n(H*H)),k=n(v*P),R=n(U*(v+n(l*U)))}K=f(j,k,C),k=K[0],C=K[1],K=f(j,R,L),R=K[0],L=K[1];let Y=c(R);return n(k*Y)}function h(g){return Vt(n(g),o)}function y(g){let _=oe("u coordinate",g,o);return s===32&&(_[31]&=127),nt(_)}function d(g){let _=oe("scalar",g),E=_.length;if(E!==o&&E!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${E}`);return nt(a(_))}function w(g,_){let E=y(_),B=d(g),T=p(E,B);if(T===Ni)throw new Error("Invalid private or public key received");return h(T)}let m=h(e.Gu);function A(g){return w(g,m)}return{scalarMult:w,scalarMultBase:A,getSharedSecret:(g,_)=>w(g,_),getPublicKey:g=>A(g),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:m}}var Di=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Iy=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),H8=BigInt(0),h_=BigInt(1),Cf=BigInt(2),p_=BigInt(5),Ry=BigInt(10),y_=BigInt(20),w_=BigInt(40),Uy=BigInt(80);function Cy(t){let e=Di,n=t*t%e*t%e,i=se(n,Cf,e)*n%e,o=se(i,h_,e)*t%e,s=se(o,p_,e)*o%e,a=se(s,Ry,e)*s%e,c=se(a,y_,e)*a%e,f=se(c,w_,e)*c%e,u=se(f,Uy,e)*f%e,l=se(u,Uy,e)*f%e,p=se(l,Ry,e)*s%e;return{pow_p_5_8:se(p,Cf,e)*t%e,b2:n}}function Ly(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function m_(t,e){let r=Di,n=ee(e*e*e,r),i=ee(n*n*e,r),o=Cy(t*i).pow_p_5_8,s=ee(t*n*o,r),a=ee(e*s*s,r),c=s,f=ee(s*Iy,r),u=a===t,l=a===ee(-t,r),p=a===ee(-t*Iy,r);return u&&(s=c),(l||p)&&(s=f),by(s,r)&&(s=ee(-s,r)),{isValid:u||l,value:s}}var Je=Vn(Di,void 0,!0),Mi={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Je,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Rf,randomBytes:Li,adjustScalarBytes:Ly,uvRatio:m_},br=_s(Mi);function Oy(t,e,r){if(e.length>255)throw new Error("Context is too big");return us(hf("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var G8=_s({...Mi,domain:Oy}),W8=_s({...Mi,domain:Oy,prehash:Rf}),on=Py({P:Di,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{let e=Di,{pow_p_5_8:r,b2:n}=Cy(t);return ee(se(r,BigInt(3),e)*n,e)},adjustScalarBytes:Ly,randomBytes:Li});function Ky(t){let{y:e}=br.ExtendedPoint.fromHex(t),r=BigInt(1);return Je.toBytes(Je.create((r+e)*Je.inv(r-e)))}function Ny(t){let e=Mi.hash(t.subarray(0,32));return Mi.adjustScalarBytes(e).subarray(0,32)}var b_=(Je.ORDER+BigInt(3))/BigInt(8),J8=Je.pow(Cf,b_),z8=Je.sqrt(Je.neg(Je.ONE)),Y8=(Je.ORDER-BigInt(5))/BigInt(8),Z8=BigInt(486662);var X8=gy(Je,Je.neg(BigInt(486664)));var Q8=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),eB=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),tB=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),rB=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var nB=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Yt=class t{static async bytesToPrivateKey({privateKeyBytes:e}){let r=br.getPublicKey(e),n={crv:"Ed25519",d:q.uint8Array(e).toBase64Url(),kty:"OKP",x:q.uint8Array(r).toBase64Url()};return n.kid=await G({jwk:n}),n}static async bytesToPublicKey({publicKeyBytes:e}){let r={kty:"OKP",crv:"Ed25519",x:q.uint8Array(e).toBase64Url()};return r.kid=await G({jwk:r}),r}static async computePublicKey({key:e}){let r=await t.privateKeyToBytes({privateKey:e}),n=br.getPublicKey(r),i={kty:"OKP",crv:"Ed25519",x:q.uint8Array(n).toBase64Url()};return i.kid=await G({jwk:i}),i}static async convertPrivateKeyToX25519({privateKey:e}){let r=await t.privateKeyToBytes({privateKey:e}),n=Ny(r),i=on.getPublicKey(n),o={kty:"OKP",crv:"X25519",d:q.uint8Array(n).toBase64Url(),x:q.uint8Array(i).toBase64Url()};return o.kid=await G({jwk:o}),o}static async convertPublicKeyToX25519({publicKey:e}){let r=await t.publicKeyToBytes({publicKey:e});if(!await t.validatePublicKey({publicKeyBytes:r}))throw new Error("Ed25519: Invalid public key.");let i=Ky(r),o={kty:"OKP",crv:"X25519",x:q.uint8Array(i).toBase64Url()};return o.kid=await G({jwk:o}),o}static async generateKey(){let e=br.utils.randomPrivateKey(),r=await t.bytesToPrivateKey({privateKeyBytes:e});return r.kid=await G({jwk:r}),r}static async getPublicKey({key:e}){if(!(ot(e)&&e.crv==="Ed25519"))throw new Error("Ed25519: The provided key is not an Ed25519 private JWK.");let{d:r,...n}=e;return n.kid??=await G({jwk:n}),n}static async privateKeyToBytes({privateKey:e}){if(!ot(e))throw new Error("Ed25519: The provided key is not a valid OKP private key.");return q.base64Url(e.d).toUint8Array()}static async publicKeyToBytes({publicKey:e}){if(!nn(e))throw new Error("Ed25519: The provided key is not a valid OKP public key.");return q.base64Url(e.x).toUint8Array()}static async sign({key:e,data:r}){let n=await t.privateKeyToBytes({privateKey:e});return br.sign(r,n)}static async validatePublicKey({publicKeyBytes:e}){try{br.ExtendedPoint.fromHex(e).assertValidity()}catch{return!1}return!0}static async verify({key:e,signature:r,data:n}){let i=await t.publicKeyToBytes({publicKey:e});return br.verify(r,n,i)}};var qi=class extends Ne{async computePublicKey({key:e}){if(!ot(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":{let r=await Yt.computePublicKey({key:e});return r.alg="EdDSA",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}}async generateKey({algorithm:e}){switch(e){case"Ed25519":{let r=await Yt.generateKey();return r.alg="EdDSA",r}}}async getPublicKey({key:e}){if(!ot(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":{let r=await Yt.getPublicKey({key:e});return r.alg="EdDSA",r}default:throw new Error(`Unsupported curve: ${e.crv}`)}}async sign({key:e,data:r}){if(!ot(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) private key.");switch(e.crv){case"Ed25519":return await Yt.sign({key:e,data:r});default:throw new Error(`Unsupported curve: ${e.crv}`)}}async verify({key:e,signature:r,data:n}){if(!nn(e))throw new TypeError("Invalid key provided. Must be an octet key pair (OKP) public key.");switch(e.crv){case"Ed25519":return await Yt.verify({key:e,signature:r,data:n});default:throw new Error(`Unsupported curve: ${e.crv}`)}}};var Lf={Ed25519:{implementation:qi,names:["Ed25519"]},secp256k1:{implementation:Hn,names:["ES256K","secp256k1"]},secp256r1:{implementation:Hn,names:["ES256","secp256r1"]},"SHA-256":{implementation:Ui,names:["SHA-256"]}},Of=class{constructor(e){this._algorithmInstances=new Map;this._keyStore=e?.keyStore??new vo}async digest({algorithm:e,data:r}){return await this.getAlgorithm({algorithm:e}).digest({algorithm:e,data:r})}async exportKey({keyUri:e}){return await this.getPrivateKey({keyUri:e})}async generateKey({algorithm:e}){let n=await this.getAlgorithm({algorithm:e}).generateKey({algorithm:e});if(n?.kid===void 0)throw new Error("Generated key is missing a required property: kid");let i=`${gs}${n.kid}`;return await this._keyStore.set(i,n),i}async getKeyUri({key:e}){let r=await G({jwk:e});return`${gs}${r}`}async getPublicKey({keyUri:e}){let r=await this.getPrivateKey({keyUri:e}),n=this.getAlgorithmName({key:r});return await this.getAlgorithm({algorithm:n}).getPublicKey({key:r})}async importKey({key:e}){if(!kf(e))throw new TypeError("Invalid key provided. Must be a private key in JWK format.");let r=structuredClone(e);r.kid??=await G({jwk:r});let n=await this.getKeyUri({key:r});return await this._keyStore.set(n,r),n}async sign({keyUri:e,data:r}){let n=await this.getPrivateKey({keyUri:e}),i=this.getAlgorithmName({key:n});return this.getAlgorithm({algorithm:i}).sign({data:r,key:n})}async verify({key:e,signature:r,data:n}){let i=this.getAlgorithmName({key:e});return this.getAlgorithm({algorithm:i}).verify({key:e,signature:r,data:n})}getAlgorithm({algorithm:e}){let r=Lf[e]?.implementation;if(!r)throw new Error(`Algorithm not supported: ${e}`);return this._algorithmInstances.has(r)||this._algorithmInstances.set(r,new r),this._algorithmInstances.get(r)}getAlgorithmName({key:e}){let r=e.alg,n=e.crv;for(let i in Lf){let o=Lf[i];if(r&&o.names.includes(r))return i;if(n&&o.names.includes(n))return i}throw new Error(`Unable to determine algorithm based on provided input: alg=${r}, crv=${n}`)}async getPrivateKey({keyUri:e}){let r=await this._keyStore.get(e);if(!r)throw new Error(`Key not found: ${e}`);return r}};var Kf=class t{static getJoseSignatureAlgorithmFromPublicKey(e){let r={Ed25519:"EdDSA","P-256":"ES256","P-384":"ES384","P-521":"ES512",secp256k1:"ES256K"};if(e.alg&&Object.values(r).includes(e.alg))return e.alg;if(e.crv&&Object.keys(r).includes(e.crv))return r[e.crv];throw new Error(`Unable to determine algorithm based on provided input: alg=${e.alg}, crv=${e.crv}. Supported 'alg' values: ${Object.values(r).join(", ")}. Supported 'crv' values: ${Object.keys(r).join(", ")}.`)}static randomBytes(e){return oy(e)}static randomUuid(){return qt.randomUUID()}static randomPin({length:e}){if(3>e||e>10)throw new Error("randomPin() can securely generate a PIN between 3 to 10 digits.");let r=Math.pow(10,e)-1,n;if(e<=6){let i=Math.pow(10,e);do{let o=t.randomBytes(Math.ceil(e/2));n=new DataView(o.buffer).getUint16(0,!1)%i}while(n>r)}else{let i=Math.pow(10,10);do{let o=t.randomBytes(4);n=new DataView(o.buffer).getUint32(0,!1)%i}while(n>r)}return n.toString().padStart(e,"0")}};var As=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function ke(){if(As&&typeof As.subtle=="object"&&As.subtle!=null)return As.subtle;throw new Error("crypto.subtle must be defined")}var ji=128,Dy=[128,192,256],Ss=ji,sn=class{static async bytesToPrivateKey({privateKeyBytes:e}){let r={k:q.uint8Array(e).toBase64Url(),kty:"oct"};return r.kid=await G({jwk:r}),r}static async decrypt({key:e,data:r,counter:n,length:i}){if(n.byteLength!==ji/8)throw new TypeError(`The counter must be ${ji} bits in length`);if(i===0||i>Ss)throw new TypeError(`The 'length' property must be in the range 1 to ${Ss}`);let o=ke(),s=await o.importKey("jwk",e,{name:"AES-CTR"},!0,["decrypt"]),a=await o.decrypt({name:"AES-CTR",counter:n,length:i},s,r);return new Uint8Array(a)}static async encrypt({key:e,data:r,counter:n,length:i}){if(n.byteLength!==ji/8)throw new TypeError(`The counter must be ${ji} bits in length`);if(i===0||i>Ss)throw new TypeError(`The 'length' property must be in the range 1 to ${Ss}`);let o=ke(),s=await o.importKey("jwk",e,{name:"AES-CTR"},!0,["encrypt","decrypt"]),a=await o.encrypt({name:"AES-CTR",counter:n,length:i},s,r);return new Uint8Array(a)}static async generateKey({length:e}){if(!Dy.includes(e))throw new RangeError(`The key length is invalid: Must be ${Dy.join(", ")} bits`);let r=ke(),n=await r.generateKey({name:"AES-CTR",length:e},!0,["encrypt"]),{ext:i,key_ops:o,...s}=await r.exportKey("jwk",n);return s.kid=await G({jwk:s}),s}static async privateKeyToBytes({privateKey:e}){if(!Wt(e))throw new Error("AesCtr: The provided key is not a valid oct private key.");return q.base64Url(e.k).toUint8Array()}};var Nf=class extends Ne{async decrypt(e){return sn.decrypt(e)}async encrypt(e){return sn.encrypt(e)}async generateKey({algorithm:e}){let r={A128CTR:128,A192CTR:192,A256CTR:256}[e],n=await sn.generateKey({length:r});return n.alg=e,n}};function Fi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function Df(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function Mf(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function we(t,...e){if(!Mf(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function qf(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function My(t,e){we(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var Zt=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),qy=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),g_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!g_)throw new Error("Non little-endian hardware is not supported");function x_(t){if(typeof t!="string")throw new Error(`string expected, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function vs(t){if(typeof t=="string")t=x_(t);else if(Mf(t))t=t.slice();else throw new Error(`Uint8Array expected, got ${typeof t}`);return t}function jy(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}function Fy(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}var jf=(t,e)=>(Object.assign(e,t),e);function Ff(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,f=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+f,a,n)}var $y={async encrypt(t,e,r,n){let i=ke(),o=await i.importKey("raw",t,e,!0,["encrypt"]),s=await i.encrypt(r,o,n);return new Uint8Array(s)},async decrypt(t,e,r,n){let i=ke(),o=await i.importKey("raw",t,e,!0,["decrypt"]),s=await i.decrypt(r,o,n);return new Uint8Array(s)}},At={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function E_(t,e,r){if(t===At.CBC)return{name:At.CBC,iv:e};if(t===At.CTR)return{name:At.CTR,counter:e,length:64};if(t===At.GCM)return r?{name:At.GCM,iv:e,additionalData:r}:{name:At.GCM,iv:e};throw new Error("unknown aes block mode")}function $f(t){return(e,r,n)=>{we(e),we(r);let i={name:t,length:e.length*8},o=E_(t,r,n);return{encrypt(s){return we(s),$y.encrypt(e,i,o,s)},decrypt(s){return we(s),$y.decrypt(e,i,o,s)}}}}var NB=$f(At.CBC),DB=$f(At.CTR),MB=$f(At.GCM);var Bs=96,Vy=[128,192,256],$i=[96,104,112,120,128],an=class{static async bytesToPrivateKey({privateKeyBytes:e}){let r={k:q.uint8Array(e).toBase64Url(),kty:"oct"};return r.kid=await G({jwk:r}),r}static async decrypt({key:e,data:r,iv:n,additionalData:i,tagLength:o}){if(n.byteLength!==Bs/8)throw new TypeError(`The initialization vector must be ${Bs} bits in length`);if(o&&!$i.includes(o))throw new RangeError(`The tag length is invalid: Must be ${$i.join(", ")} bits`);let s=ke(),a=await s.importKey("jwk",e,{name:"AES-GCM"},!0,["decrypt"]),c={name:"AES-GCM",iv:n,...o&&{tagLength:o},...i&&{additionalData:i}},f=await s.decrypt(c,a,r);return new Uint8Array(f)}static async encrypt({data:e,iv:r,key:n,additionalData:i,tagLength:o}){if(r.byteLength!==Bs/8)throw new TypeError(`The initialization vector must be ${Bs} bits in length`);if(o&&!$i.includes(o))throw new RangeError(`The tag length is invalid: Must be ${$i.join(", ")} bits`);let s=ke(),a=await s.importKey("jwk",n,{name:"AES-GCM"},!0,["encrypt"]),c={name:"AES-GCM",iv:r,...o&&{tagLength:o},...i&&{additionalData:i}},f=await s.encrypt(c,a,e);return new Uint8Array(f)}static async generateKey({length:e}){if(!Vy.includes(e))throw new RangeError(`The key length is invalid: Must be ${Vy.join(", ")} bits`);let r=ke(),n=await r.generateKey({name:"AES-GCM",length:e},!0,["encrypt"]),{ext:i,key_ops:o,...s}=await r.exportKey("jwk",n);return s.kid=await G({jwk:s}),s}static async privateKeyToBytes({privateKey:e}){if(!Wt(e))throw new Error("AesGcm: The provided key is not a valid oct private key.");return q.base64Url(e.k).toUint8Array()}};var Vf=class extends Ne{async decrypt(e){return an.decrypt(e)}async encrypt(e){return an.encrypt(e)}async generateKey({algorithm:e}){let r={A128GCM:128,A192GCM:192,A256GCM:256}[e],n=await an.generateKey({length:r});return n.alg=e,n}};var Hf=class t{static async deriveKey({keyDataLen:e,fixedInfo:r,sharedSecret:n}){let o=Math.ceil(e/256);if(o!==1)throw new Error(`Concat KDF with ${o} rounds not supported.`);let s=new Uint8Array(4);new DataView(s.buffer).setUint32(0,o);let a=t.computeFixedInfo(r);return _t(uf(s,n,a)).slice(0,e/8)}static computeFixedInfo(e){let r=t.toDataLenData({data:e.algorithmId}),n=t.toDataLenData({data:e.partyUInfo}),i=t.toDataLenData({data:e.partyVInfo}),o=t.toDataLenData({data:e.suppPubInfo,variableLength:!1}),s=t.toDataLenData({data:e.suppPrivInfo});return uf(r,n,i,o,s)}static toDataLenData({data:e,variableLength:r=!0}){let n,i=Jn(e);if(i==="Undefined")return new Uint8Array(0);if(r){let o=i==="Uint8Array"?e:new q(e,i).toUint8Array(),s=o.length;n=new Uint8Array(4+s),new DataView(n.buffer).setUint32(0,s),n.set(o,4)}else{if(typeof e!="number")throw TypeError("Fixed length input must be a number.");n=new Uint8Array(4),new DataView(n.buffer).setUint32(0,e)}return n}};var Gf=class{static async deriveKey({hash:e,password:r,salt:n,iterations:i,length:o}){let s=await qt.subtle.importKey("raw",r,{name:"PBKDF2"},!1,["deriveBits"]),a=await qt.subtle.deriveBits({name:"PBKDF2",hash:e,salt:n,iterations:i},s,o);return new Uint8Array(a)}};var Wf=class t{static async bytesToPrivateKey({privateKeyBytes:e}){let r=on.getPublicKey(e),n={kty:"OKP",crv:"X25519",d:q.uint8Array(e).toBase64Url(),x:q.uint8Array(r).toBase64Url()};return n.kid=await G({jwk:n}),n}static async bytesToPublicKey({publicKeyBytes:e}){let r={kty:"OKP",crv:"X25519",x:q.uint8Array(e).toBase64Url()};return r.kid=await G({jwk:r}),r}static async computePublicKey({key:e}){let r=await t.privateKeyToBytes({privateKey:e}),n=on.getPublicKey(r),i={kty:"OKP",crv:"X25519",x:q.uint8Array(n).toBase64Url()};return i.kid=await G({jwk:i}),i}static async generateKey(){let e=on.utils.randomPrivateKey(),r=await t.bytesToPrivateKey({privateKeyBytes:e});return r.kid=await G({jwk:r}),r}static async getPublicKey({key:e}){if(!(ot(e)&&e.crv==="X25519"))throw new Error("X25519: The provided key is not an X25519 private JWK.");let{d:r,...n}=e;return n.kid??=await G({jwk:n}),n}static async privateKeyToBytes({privateKey:e}){if(!ot(e))throw new Error("X25519: The provided key is not a valid OKP private key.");return q.base64Url(e.d).toUint8Array()}static async publicKeyToBytes({publicKey:e}){if(!nn(e))throw new Error("X25519: The provided key is not a valid OKP public key.");return q.base64Url(e.x).toUint8Array()}static async sharedSecret({privateKeyA:e,publicKeyB:r}){if("x"in e&&"x"in r&&e.x===r.x)throw new Error("X25519: ECDH shared secret cannot be computed from a single key pair's public and private keys.");let n=await t.privateKeyToBytes({privateKey:e}),i=await t.publicKeyToBytes({publicKey:r});return on.getSharedSecret(n,i)}};var Ee=(t,e)=>t[e++]&255|(t[e++]&255)<<8,Jf=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=vs(e),we(e,32);let r=Ee(e,0),n=Ee(e,2),i=Ee(e,4),o=Ee(e,6),s=Ee(e,8),a=Ee(e,10),c=Ee(e,12),f=Ee(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|f<<8)&8191,this.r[9]=f>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Ee(e,16+2*u)}process(e,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],c=s[1],f=s[2],u=s[3],l=s[4],p=s[5],h=s[6],y=s[7],d=s[8],w=s[9],m=Ee(e,r+0),A=Ee(e,r+2),g=Ee(e,r+4),_=Ee(e,r+6),E=Ee(e,r+8),B=Ee(e,r+10),T=Ee(e,r+12),k=Ee(e,r+14),R=o[0]+(m&8191),C=o[1]+((m>>>13|A<<3)&8191),L=o[2]+((A>>>10|g<<6)&8191),j=o[3]+((g>>>7|_<<9)&8191),K=o[4]+((_>>>4|E<<12)&8191),Y=o[5]+(E>>>1&8191),S=o[6]+((E>>>14|B<<2)&8191),I=o[7]+((B>>>11|T<<5)&8191),N=o[8]+((T>>>8|k<<8)&8191),v=o[9]+(k>>>5|i),b=0,P=b+R*a+C*(5*w)+L*(5*d)+j*(5*y)+K*(5*h);b=P>>>13,P&=8191,P+=Y*(5*p)+S*(5*l)+I*(5*u)+N*(5*f)+v*(5*c),b+=P>>>13,P&=8191;let U=b+R*c+C*a+L*(5*w)+j*(5*d)+K*(5*y);b=U>>>13,U&=8191,U+=Y*(5*h)+S*(5*p)+I*(5*l)+N*(5*u)+v*(5*f),b+=U>>>13,U&=8191;let O=b+R*f+C*c+L*a+j*(5*w)+K*(5*d);b=O>>>13,O&=8191,O+=Y*(5*y)+S*(5*h)+I*(5*p)+N*(5*l)+v*(5*u),b+=O>>>13,O&=8191;let F=b+R*u+C*f+L*c+j*a+K*(5*w);b=F>>>13,F&=8191,F+=Y*(5*d)+S*(5*y)+I*(5*h)+N*(5*p)+v*(5*l),b+=F>>>13,F&=8191;let $=b+R*l+C*u+L*f+j*c+K*a;b=$>>>13,$&=8191,$+=Y*(5*w)+S*(5*d)+I*(5*y)+N*(5*h)+v*(5*p),b+=$>>>13,$&=8191;let Z=b+R*p+C*l+L*u+j*f+K*c;b=Z>>>13,Z&=8191,Z+=Y*a+S*(5*w)+I*(5*d)+N*(5*y)+v*(5*h),b+=Z>>>13,Z&=8191;let V=b+R*h+C*p+L*l+j*u+K*f;b=V>>>13,V&=8191,V+=Y*c+S*a+I*(5*w)+N*(5*d)+v*(5*y),b+=V>>>13,V&=8191;let H=b+R*y+C*h+L*p+j*l+K*u;b=H>>>13,H&=8191,H+=Y*f+S*c+I*a+N*(5*w)+v*(5*d),b+=H>>>13,H&=8191;let ne=b+R*d+C*y+L*h+j*p+K*l;b=ne>>>13,ne&=8191,ne+=Y*u+S*f+I*c+N*a+v*(5*w),b+=ne>>>13,ne&=8191;let te=b+R*w+C*d+L*y+j*h+K*p;b=te>>>13,te&=8191,te+=Y*l+S*u+I*f+N*c+v*a,b+=te>>>13,te&=8191,b=(b<<2)+b|0,b=b+P|0,P=b&8191,b=b>>>13,U+=b,o[0]=P,o[1]=U,o[2]=O,o[3]=F,o[4]=$,o[5]=Z,o[6]=V,o[7]=H,o[8]=ne,o[9]=te}finalize(){let{h:e,pad:r}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=8192;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)e[a]=e[a]&o|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+r[0];e[0]=s&65535;for(let a=1;a<8;a++)s=(e[a]+r[a]|0)+(s>>>16)|0,e[a]=s&65535}update(e){qf(this);let{buffer:r,blockLen:n}=this;e=vs(e);let i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){for(;n<=i-o;o+=n)this.process(e,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(r,0,!1),this.pos=0)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){qf(this),My(e,this),this.finished=!0;let{buffer:r,h:n}=this,{pos:i}=this;if(i){for(r[i++]=1;i<16;i++)r[i]=0;this.process(r,0,!0)}this.finalize();let o=0;for(let s=0;s<8;s++)e[o++]=n[s]>>>0,e[o++]=n[s]>>>8;return e}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}};function __(t){let e=(n,i)=>t(i).update(vs(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}var Hy=__(t=>new Jf(t));var Wy=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),A_=Wy("expand 16-byte k"),S_=Wy("expand 32-byte k"),v_=Zt(A_),Jy=Zt(S_),lT=Jy.slice();function D(t,e){return t<<e|t>>>32-e}function zf(t){return t.byteOffset%4===0}var Ts=64,B_=16,zy=2**32-1,Gy=new Uint32Array;function T_(t,e,r,n,i,o,s,a){let c=i.length,f=new Uint8Array(Ts),u=Zt(f),l=zf(i)&&zf(o),p=l?Zt(i):Gy,h=l?Zt(o):Gy;for(let y=0;y<c;s++){if(t(e,r,n,u,s,a),s>=zy)throw new Error("arx: counter overflow");let d=Math.min(Ts,c-y);if(l&&d===Ts){let w=y/4;if(y%4!==0)throw new Error("arx: invalid block position");for(let m=0,A;m<B_;m++)A=w+m,h[A]=p[A]^u[m];y+=Ts;continue}for(let w=0,m;w<d;w++)m=y+w,o[m]=i[m]^f[w];y+=d}}function Yf(t,e){let{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:o,rounds:s}=jy({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return Fi(i),Fi(s),Df(o),Df(r),(a,c,f,u,l=0)=>{we(a),we(c),we(f);let p=f.length;if(u||(u=new Uint8Array(p)),we(u),Fi(l),l<0||l>=zy)throw new Error("arx: counter overflow");if(u.length<p)throw new Error(`arx: output (${u.length}) is shorter than data (${p})`);let h=[],y=a.length,d,w;if(y===32)d=a.slice(),h.push(d),w=Jy;else if(y===16&&r)d=new Uint8Array(32),d.set(a),d.set(a,16),w=v_,h.push(d);else throw new Error(`arx: invalid 32-byte key, got length=${y}`);zf(c)||(c=c.slice(),h.push(c));let m=Zt(d);if(n){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(w,m,Zt(c.subarray(0,16)),m),c=c.subarray(16)}let A=16-i;if(A!==c.length)throw new Error(`arx: nonce must be ${A} or 16 bytes`);if(A!==12){let _=new Uint8Array(12);_.set(c,o?0:12-c.length),c=_,h.push(c)}let g=Zt(c);for(T_(t,w,m,g,f,u,l,s);h.length>0;)h.pop().fill(0);return u}}function Xy(t,e,r,n,i,o=20){let s=t[0],a=t[1],c=t[2],f=t[3],u=e[0],l=e[1],p=e[2],h=e[3],y=e[4],d=e[5],w=e[6],m=e[7],A=i,g=r[0],_=r[1],E=r[2],B=s,T=a,k=c,R=f,C=u,L=l,j=p,K=h,Y=y,S=d,I=w,N=m,v=A,b=g,P=_,U=E;for(let F=0;F<o;F+=2)B=B+C|0,v=D(v^B,16),Y=Y+v|0,C=D(C^Y,12),B=B+C|0,v=D(v^B,8),Y=Y+v|0,C=D(C^Y,7),T=T+L|0,b=D(b^T,16),S=S+b|0,L=D(L^S,12),T=T+L|0,b=D(b^T,8),S=S+b|0,L=D(L^S,7),k=k+j|0,P=D(P^k,16),I=I+P|0,j=D(j^I,12),k=k+j|0,P=D(P^k,8),I=I+P|0,j=D(j^I,7),R=R+K|0,U=D(U^R,16),N=N+U|0,K=D(K^N,12),R=R+K|0,U=D(U^R,8),N=N+U|0,K=D(K^N,7),B=B+L|0,U=D(U^B,16),I=I+U|0,L=D(L^I,12),B=B+L|0,U=D(U^B,8),I=I+U|0,L=D(L^I,7),T=T+j|0,v=D(v^T,16),N=N+v|0,j=D(j^N,12),T=T+j|0,v=D(v^T,8),N=N+v|0,j=D(j^N,7),k=k+K|0,b=D(b^k,16),Y=Y+b|0,K=D(K^Y,12),k=k+K|0,b=D(b^k,8),Y=Y+b|0,K=D(K^Y,7),R=R+C|0,P=D(P^R,16),S=S+P|0,C=D(C^S,12),R=R+C|0,P=D(P^R,8),S=S+P|0,C=D(C^S,7);let O=0;n[O++]=s+B|0,n[O++]=a+T|0,n[O++]=c+k|0,n[O++]=f+R|0,n[O++]=u+C|0,n[O++]=l+L|0,n[O++]=p+j|0,n[O++]=h+K|0,n[O++]=y+Y|0,n[O++]=d+S|0,n[O++]=w+I|0,n[O++]=m+N|0,n[O++]=A+v|0,n[O++]=g+b|0,n[O++]=_+P|0,n[O++]=E+U|0}function k_(t,e,r,n){let i=t[0],o=t[1],s=t[2],a=t[3],c=e[0],f=e[1],u=e[2],l=e[3],p=e[4],h=e[5],y=e[6],d=e[7],w=r[0],m=r[1],A=r[2],g=r[3];for(let E=0;E<20;E+=2)i=i+c|0,w=D(w^i,16),p=p+w|0,c=D(c^p,12),i=i+c|0,w=D(w^i,8),p=p+w|0,c=D(c^p,7),o=o+f|0,m=D(m^o,16),h=h+m|0,f=D(f^h,12),o=o+f|0,m=D(m^o,8),h=h+m|0,f=D(f^h,7),s=s+u|0,A=D(A^s,16),y=y+A|0,u=D(u^y,12),s=s+u|0,A=D(A^s,8),y=y+A|0,u=D(u^y,7),a=a+l|0,g=D(g^a,16),d=d+g|0,l=D(l^d,12),a=a+l|0,g=D(g^a,8),d=d+g|0,l=D(l^d,7),i=i+f|0,g=D(g^i,16),y=y+g|0,f=D(f^y,12),i=i+f|0,g=D(g^i,8),y=y+g|0,f=D(f^y,7),o=o+u|0,w=D(w^o,16),d=d+w|0,u=D(u^d,12),o=o+u|0,w=D(w^o,8),d=d+w|0,u=D(u^d,7),s=s+l|0,m=D(m^s,16),p=p+m|0,l=D(l^p,12),s=s+l|0,m=D(m^s,8),p=p+m|0,l=D(l^p,7),a=a+c|0,A=D(A^a,16),h=h+A|0,c=D(c^h,12),a=a+c|0,A=D(A^a,8),h=h+A|0,c=D(c^h,7);let _=0;n[_++]=i,n[_++]=o,n[_++]=s,n[_++]=a,n[_++]=w,n[_++]=m,n[_++]=A,n[_++]=g}var P_=Yf(Xy,{counterRight:!1,counterLength:4,allowShortKeys:!1}),ks=Yf(Xy,{counterRight:!1,counterLength:8,extendNonceFn:k_,allowShortKeys:!1});var I_=new Uint8Array(16),Yy=(t,e)=>{t.update(e);let r=e.length%16;r&&t.update(I_.subarray(r))},R_=new Uint8Array(32);function Zy(t,e,r,n,i){let o=t(e,r,R_),s=Hy.create(o);i&&Yy(s,i),Yy(s,n);let a=new Uint8Array(16),c=qy(a);Ff(c,0,BigInt(i?i.length:0),!0),Ff(c,8,BigInt(n.length),!0),s.update(a);let f=s.digest();return o.fill(0),f}var Qy=t=>(e,r,n)=>(we(e,32),we(r),{encrypt:(o,s)=>{let a=o.length,c=a+16;s?we(s,c):s=new Uint8Array(c),t(e,r,o,s,1);let f=Zy(t,e,r,s.subarray(0,-16),n);return s.set(f,a),s},decrypt:(o,s)=>{let a=o.length,c=a-16;if(a<16)throw new Error("encrypted data must be at least 16 bytes");s?we(s,c):s=new Uint8Array(c);let f=o.subarray(0,-16),u=o.subarray(-16),l=Zy(t,e,r,f,n);if(!Fy(u,l))throw new Error("invalid tag");return t(e,r,f,s,1),s}}),mT=jf({blockSize:64,nonceLength:12,tagLength:16},Qy(P_)),Zf=jf({blockSize:64,nonceLength:24,tagLength:16},Qy(ks));var Xf=class t{static async bytesToPrivateKey({privateKeyBytes:e}){let r={k:q.uint8Array(e).toBase64Url(),kty:"oct"};return r.kid=await G({jwk:r}),r}static async decrypt({data:e,key:r,nonce:n}){let i=await t.privateKeyToBytes({privateKey:r});return ks(i,n,e)}static async encrypt({data:e,key:r,nonce:n}){let i=await t.privateKeyToBytes({privateKey:r});return ks(i,n,e)}static async generateKey(){let e=ke(),r=await e.generateKey({name:"AES-CTR",length:256},!0,["encrypt"]),{alg:n,ext:i,key_ops:o,...s}=await e.exportKey("jwk",r);return s.kid=await G({jwk:s}),s}static async privateKeyToBytes({privateKey:e}){if(!Wt(e))throw new Error("XChaCha20: The provided key is not a valid oct private key.");return q.base64Url(e.k).toUint8Array()}};var U_=16,Qf=class t{static async bytesToPrivateKey({privateKeyBytes:e}){let r={k:q.uint8Array(e).toBase64Url(),kty:"oct"};return r.kid=await G({jwk:r}),r}static async decrypt({data:e,key:r,nonce:n,additionalData:i}){let o=await t.privateKeyToBytes({privateKey:r});return Zf(o,n,i).decrypt(e)}static async encrypt({data:e,key:r,nonce:n,additionalData:i}){let o=await t.privateKeyToBytes({privateKey:r});return Zf(o,n,i).encrypt(e)}static async generateKey(){let e=ke(),r=await e.generateKey({name:"AES-CTR",length:256},!0,["encrypt"]),{alg:n,ext:i,key_ops:o,...s}=await e.exportKey("jwk",r);return s.kid=await G({jwk:s}),s}static async privateKeyToBytes({privateKey:e}){if(!Wt(e))throw new Error("XChaCha20Poly1305: The provided key is not a valid oct private key.");return q.base64Url(e.k).toUint8Array()}};return h0(C_);})();
3
- /*! Bundled license information:
4
-
5
- ieee754/index.js:
6
- (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
7
-
8
- buffer/index.js:
9
- (*!
10
- * The buffer module from node.js, for the browser.
11
- *
12
- * @author Feross Aboukhadijeh <https://feross.org>
13
- * @license MIT
14
- *)
15
-
16
- queue-microtask/index.js:
17
- (*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
18
-
19
- run-parallel-limit/index.js:
20
- (*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
21
-
22
- safe-buffer/index.js:
23
- (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
24
-
25
- @noble/hashes/esm/utils.js:
26
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
27
-
28
- @noble/hashes/esm/utils.js:
29
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
30
-
31
- @noble/curves/esm/abstract/utils.js:
32
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
33
-
34
- @noble/curves/esm/abstract/modular.js:
35
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
36
-
37
- @noble/curves/esm/abstract/curve.js:
38
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
39
-
40
- @noble/curves/esm/abstract/weierstrass.js:
41
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
42
-
43
- @noble/curves/esm/_shortw_utils.js:
44
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
45
-
46
- @noble/curves/esm/secp256k1.js:
47
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
48
-
49
- @noble/curves/esm/p256.js:
50
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
51
-
52
- @noble/curves/esm/abstract/edwards.js:
53
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
54
-
55
- @noble/curves/esm/abstract/montgomery.js:
56
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
57
-
58
- @noble/curves/esm/ed25519.js:
59
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
60
-
61
- @noble/ciphers/esm/utils.js:
62
- (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
63
- */
64
- //# sourceMappingURL=browser.js.map