@dcl/shop 1.10.2-32947525166.commit-3fff6df → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/_assets/{Activity-BtEVQjQA.js → Activity-C-iRRJes.js} +8 -8
  2. package/_assets/{AnimatedBackground-IkrIRL1K.js → AnimatedBackground-2IqhbI98.js} +2 -2
  3. package/_assets/{Assets-DvkscE7I.js → Assets-BQHoTVy5.js} +9 -9
  4. package/_assets/{Authorizations-BtzgbNu4.js → Authorizations-DSQN_BUe.js} +2 -2
  5. package/_assets/{Cart-Dykg2Yej.js → Cart-4FZ_RV6w.js} +2 -2
  6. package/_assets/{Collection-D09TrPa7.js → Collection-C9Oa84DP.js} +2 -2
  7. package/_assets/{CollectionCarousel-Dz6JQa7s.js → CollectionCarousel-LTlXX1yl.js} +3 -3
  8. package/_assets/{Confetti-D9nguoEQ.js → Confetti-BHqqmYb2.js} +4 -4
  9. package/_assets/{ConstantsUtil-Bu2OGff0.js → ConstantsUtil-DFqlrvtU.js} +2 -2
  10. package/_assets/{ContentClient-f4spWPdK.js → ContentClient-lL0cd1fK.js} +2 -2
  11. package/_assets/{Creator-Dm0O6yeM.js → Creator-DG7Zttkm.js} +2 -2
  12. package/_assets/{DeploymentBuilder-C-2B6p5d.js → DeploymentBuilder-auJsBwBc.js} +2 -2
  13. package/_assets/{EmotePlaybackBar-BBMWt3Nd.js → EmotePlaybackBar-CUy3CzlZ.js} +3 -3
  14. package/_assets/{ErrorNotice-DdujPcIo.js → ErrorNotice-BjLTkOLz.js} +2 -2
  15. package/_assets/{ExchangeController-DYTNZzp6.js → ExchangeController-em5jrB6C.js} +2 -2
  16. package/_assets/{Faq-C3L446f-.js → Faq-Cpsw7_4i.js} +2 -2
  17. package/_assets/{GetCredits-BHWulS_s.js → GetCredits-BTNAQtsn.js} +2 -2
  18. package/_assets/{Grow-Ds18j49m.js → Grow-DEVww-vf.js} +2 -2
  19. package/_assets/{HelpersUtil-D_NL_P-0.js → HelpersUtil-CNYq2ptq.js} +2 -2
  20. package/_assets/{ItemDetail-7kOHAz0J.js → ItemDetail-BJ_vUz1c.js} +2 -2
  21. package/_assets/{LoadMore-D8qDeRXU.js → LoadMore-CED3UI8v.js} +2 -2
  22. package/_assets/{ManaPricingBanner.styles-Dt6CIbk5.js → ManaPricingBanner.styles-BTTWbgOA.js} +2 -2
  23. package/_assets/{MyAssets-C3InNeq1.js → MyAssets-ExvadkK7.js} +2 -2
  24. package/_assets/{MyFavorites-Npqe8V7G.js → MyFavorites-BCpm40DL.js} +2 -2
  25. package/_assets/{NetworkUtil-DZ3oAWCy.js → NetworkUtil-_MPSq3Em.js} +2 -2
  26. package/_assets/{NotFound-BdlAZ0_k.js → NotFound-CmTXi9L3.js} +2 -2
  27. package/_assets/{NotificationsBell-Dj9JMzV2.js → NotificationsBell-D-6m4nDn.js} +2 -2
  28. package/_assets/{OutfitDetail-Kz1IbWuZ.js → OutfitDetail-7UO86DhJ.js} +2 -2
  29. package/_assets/{OutfitPreview-8dcvA95w.js → OutfitPreview-JNvUqt1m.js} +2 -2
  30. package/_assets/{OutfitStudio-Bua05_wP.js → OutfitStudio-DZHt3262.js} +2 -2
  31. package/_assets/{StoreSettings-DdjrIzwL.js → StoreSettings-FlBDdIHX.js} +3 -3
  32. package/_assets/{Success-ml7Z6uvY.js → Success-DrVW8DLr.js} +2 -2
  33. package/_assets/{SwapController-D0ZGb8jE.js → SwapController-DsQW0o_D.js} +2 -2
  34. package/_assets/{TradeService-B7MAJN_i.js → TradeService-DpLGt6zv.js} +2 -2
  35. package/_assets/{W3MFrameProviderSingleton-Cm_URG_Z.js → W3MFrameProviderSingleton-Doq6mTar.js} +4 -4
  36. package/_assets/{WebCryptoP256-juwBaL-I.js → WebCryptoP256-C54oY5uR.js} +2 -2
  37. package/_assets/{authorizations-iCNozW6w.js → authorizations-FX9A7NCF.js} +2 -2
  38. package/_assets/{basic-B2qyT6DX.js → basic-DzQ2oQpZ.js} +2 -2
  39. package/_assets/{biconomy-CjkHT4Sp.js → biconomy-D1Rmohrx.js} +2 -2
  40. package/_assets/{browseLayout.styles-DwS3IXc0.js → browseLayout.styles-DmXbjfpy.js} +2 -2
  41. package/_assets/{browser-Bhqn8eEy.js → browser-DDCBDKUs.js} +2 -2
  42. package/_assets/{browser-ponyfill-C3QJTrvF.js → browser-ponyfill-CFlZGY9p.js} +2 -2
  43. package/_assets/{builder-B6XCY6l2.js → builder-BUAFeauh.js} +2 -2
  44. package/_assets/{buy-BuEQSKKw.js → buy-BqmJYTA_.js} +2 -2
  45. package/_assets/{buy-gasless-a5LMIsjC.js → buy-gasless-r0-rX1Xz.js} +2 -2
  46. package/_assets/{categories-6vheNz_S.js → categories-DJ3CpW29.js} +2 -2
  47. package/_assets/{ccip-BSvD3xKG.js → ccip-CSFYjyzm.js} +2 -2
  48. package/_assets/{ccip-yZWGiwtk.js → ccip-DaOGcTi5.js} +2 -2
  49. package/_assets/{chains-WnQPMe2B.js → chains-Ca-lKFdh.js} +2 -2
  50. package/_assets/collectionPage.styles-Clp4tsb3.js +40 -0
  51. package/_assets/{common-DvLByPe6.js → common-D71QDZS6.js} +2 -2
  52. package/_assets/{controller-BHUJxVTn.js → controller-bhainDRr.js} +3 -3
  53. package/_assets/{core-DmhrtURy.js → core-W86KJVIY.js} +5 -5
  54. package/_assets/{createSvgIcon-6YmTulQL.js → createSvgIcon-42bsA22h.js} +2 -2
  55. package/_assets/{custom-N6ka0CP3.js → custom-NlyiR2bJ.js} +2 -2
  56. package/_assets/{data-capture-BuHtqEhX.js → data-capture-CkEuTxvB.js} +2 -2
  57. package/_assets/{dcl-schemas-CLUmlxzq.js → dcl-schemas-DvE7IWDY.js} +2 -2
  58. package/_assets/{decimals-CPONYvIL.js → decimals-BonQIQks.js} +2 -2
  59. package/_assets/{decimals-CzAhZKsk.js → decimals-_BVgpJXE.js} +2 -2
  60. package/_assets/{detectExtension-BqixUDGl.js → detectExtension-DfGWjbQS.js} +2 -2
  61. package/_assets/{disposePreview-BLUbNHQC.js → disposePreview-CJnRDEpI.js} +2 -2
  62. package/_assets/{email-CjDWrdP0.js → email-CqMQJOKz.js} +2 -2
  63. package/_assets/{embedded-wallet-XcVcc7hx.js → embedded-wallet-6hmBy_Gf.js} +2 -2
  64. package/_assets/{emotion-styled.browser.esm-KQkBvz99.js → emotion-styled.browser.esm-D5XTvD6_.js} +2 -2
  65. package/_assets/{engine-BvP73XBl.js → engine-C3fRGwPf.js} +2 -2
  66. package/_assets/{errors--mHJKOdI.js → errors-CpdVn533.js} +2 -2
  67. package/_assets/{estimate-l1-fee-BQAkfTeN.js → estimate-l1-fee-Dcdfy4V-.js} +2 -2
  68. package/_assets/{eth_estimateGas-CCp4EILg.js → eth_estimateGas-DesFBy-I.js} +2 -2
  69. package/_assets/{eth_getStorageAt-NvgDLAuk.js → eth_getStorageAt-BhKGiz8g.js} +2 -2
  70. package/_assets/{eth_getTransactionCount-B-qIZY5_.js → eth_getTransactionCount-RiEmS15Z.js} +2 -2
  71. package/_assets/{ethereum-nDSm9vps.js → ethereum-DZDk5IEF.js} +2 -2
  72. package/_assets/{ethers-C9Iy8r0X.js → ethers-owZvXzo9.js} +2 -2
  73. package/_assets/{events-D6b4C9sL.js → events-CEwCSw8b.js} +2 -2
  74. package/_assets/{execute-CfXZj3Ro.js → execute-ChVwLvIS.js} +3 -3
  75. package/_assets/{extractIPFS-BjFXihPz.js → extractIPFS-MYkeOpFd.js} +2 -2
  76. package/_assets/{features-CqYf_Gvf.js → features-Cqya9akR.js} +2 -2
  77. package/_assets/{fetchTokenMetadata-ByYxB_9b.js → fetchTokenMetadata-Dt_Ge3P_.js} +3 -3
  78. package/_assets/{field.styles-BNlIn-oB.js → field.styles-CeeeC6M6.js} +2 -2
  79. package/_assets/{fortmatic-DiGOvvaO.js → fortmatic-HaoGtnlW.js} +2 -2
  80. package/_assets/{get-bytecode-BePQJps4.js → get-bytecode-Ceomoa5A.js} +2 -2
  81. package/_assets/{get-ecosystem-wallet-info-BYwnK28c.js → get-ecosystem-wallet-info-H_KBMV7z.js} +2 -2
  82. package/_assets/{getBalance-BGeqscYW.js → getBalance-Cfh3tdBU.js} +3 -3
  83. package/_assets/{getInstalledModules-ClhZXB-X.js → getInstalledModules-Cs4m8xMh.js} +2 -2
  84. package/_assets/{getNFT-D7zjcfkw.js → getNFT-CZmGsek0.js} +2 -2
  85. package/_assets/{getNFT-CigxvNVN.js → getNFT-Ds5tBhuH.js} +3 -3
  86. package/_assets/{grid.styles-BpWMimNV.js → grid.styles-DNvkHrfB.js} +2 -2
  87. package/_assets/{hashTypedData-0IsE41Hs.js → hashTypedData-B46TYEGs.js} +2 -2
  88. package/_assets/{hashTypedData-DRSIA9uS.js → hashTypedData-Ck3JYcdR.js} +2 -2
  89. package/_assets/{in-app-CPsaFODl.js → in-app-DkAnD74t.js} +2 -2
  90. package/_assets/{in-app-wallet-calls-CU6OCgfY.js → in-app-wallet-calls-6zqnTKmU.js} +2 -2
  91. package/_assets/{index-BVoenAQb.js → index-01W2VDSm.js} +2 -2
  92. package/_assets/{index-BgBta_-V.js → index-3eVpa8Zs.js} +3 -3
  93. package/_assets/{index-oom5HekT.js → index-4IZGP5BI.js} +2 -2
  94. package/_assets/{index-BA4OfL1w.js → index-B4HWQoMQ.js} +2 -2
  95. package/_assets/{index-DPJ_Dv-6.js → index-B5QXa_jU.js} +2 -2
  96. package/_assets/{index-DNt7hHHr.js → index-B6482tHt.js} +2 -2
  97. package/_assets/{index-B9VasuEE.js → index-BA85S4-b.js} +2 -2
  98. package/_assets/{index-B6QN3jej.js → index-BEPvB9a4.js} +2 -2
  99. package/_assets/{index-CszNNscD.js → index-BGwtsOnp.js} +2 -2
  100. package/_assets/{index-BJpQZ4-U.js → index-BIwL8wYY.js} +3 -3
  101. package/_assets/{index-CquGyNx3.js → index-BLyS1Id_.js} +2 -2
  102. package/_assets/{index-BriEZS3d.js → index-BPcUuaEM.js} +2 -2
  103. package/_assets/{index-CbPG6lqd.js → index-BWCMDqq2.js} +2 -2
  104. package/_assets/{index-CaYeG5nD.js → index-BXMUYCCw.js} +2 -2
  105. package/_assets/{index-JMZ5GXFr.js → index-Baph5Fsk.js} +4 -4
  106. package/_assets/{index-CnXK43z2.js → index-BeOtFyfk.js} +4 -4
  107. package/_assets/{index-BiOTdBif.js → index-Bg3xAgln.js} +2 -2
  108. package/_assets/{index-DDZoG2cJ.js → index-BhQW2CzQ.js} +2 -2
  109. package/_assets/{index-DVnQ1dYh.js → index-BkQgAoIb.js} +2 -2
  110. package/_assets/{index-DN0B-b9w.js → index-Bo4xq_KT.js} +38 -38
  111. package/_assets/{index-CPT9NXY_.js → index-BrIq7-i_.js} +2 -2
  112. package/_assets/{index-CPVhPEus.js → index-BsRChzmD.js} +2 -2
  113. package/_assets/{index-B7dn7Wpp.js → index-BuX-PHvB.js} +2 -2
  114. package/_assets/{index-E0gShLWk.js → index-BwNtq0ty.js} +2 -2
  115. package/_assets/{index-B7qNoUjO.js → index-BxSg-i3Z.js} +2 -2
  116. package/_assets/{index-DjYpq0m2.js → index-BymVVTih.js} +2 -2
  117. package/_assets/{index-CuTLeipJ.js → index-C-lBesby.js} +3 -3
  118. package/_assets/{index-C61JOxOi.js → index-C2TEKrCX.js} +2 -2
  119. package/_assets/{index-DMZuQX5Z.js → index-C2brhh00.js} +2 -2
  120. package/_assets/{index-KCbHh191.js → index-C5FVqvWl.js} +2 -2
  121. package/_assets/{index-BBSGNrFt.js → index-C8KL-9aQ.js} +4 -4
  122. package/_assets/{index-DcEfK_6R.js → index-C8b_Mp8q.js} +2 -2
  123. package/_assets/{index-2g2rt955.js → index-CDQhnjTx.js} +2 -2
  124. package/_assets/{index-DW1kr9We.js → index-CEdEU2Sz.js} +2 -2
  125. package/_assets/{index-TzVkLch4.js → index-CM0lUMPb.js} +2 -2
  126. package/_assets/{index-D1mY66Y6.js → index-CPV3T5Nk.js} +2 -2
  127. package/_assets/{index-DHiguVqg.js → index-CbCpnm3M.js} +2 -2
  128. package/_assets/{index-BRefIP3Y.js → index-Cez_C6xC.js} +2 -2
  129. package/_assets/{index-BunDVVpi.js → index-CjNGDouF.js} +2 -2
  130. package/_assets/{index-q70Ygp1T.js → index-Csoi-PzU.js} +2 -2
  131. package/_assets/{index-DjZtSIJT.js → index-CvgadAKP.js} +2 -2
  132. package/_assets/{index-xsD5uLyo.js → index-CxWJWmtu.js} +2 -2
  133. package/_assets/{index-rRqQLcGi.js → index-D3K6TzDb.js} +2 -2
  134. package/_assets/{index-Cygm1etz.js → index-D6f-xTid.js} +2 -2
  135. package/_assets/{index-BUsrJ61f.js → index-DBBu_7y6.js} +2 -2
  136. package/_assets/{index-CeDhF33l.js → index-DCzudm6R.js} +2 -2
  137. package/_assets/{index-CzmCNEXu.js → index-DFuoNvPP.js} +2 -2
  138. package/_assets/{index-C_6cb0bY.js → index-DJ1qFjFz.js} +2 -2
  139. package/_assets/{index-BWlHHe4G.js → index-DJovNmup.js} +2 -2
  140. package/_assets/{index-B_2Y_zc2.js → index-DMDo5Dfi.js} +2 -2
  141. package/_assets/{index-C7CWpZ7h.js → index-DML3k0rv.js} +2 -2
  142. package/_assets/{index-IV4V-eiF.js → index-DNS0QrgR.js} +2 -2
  143. package/_assets/{index-DcG7nuHK.js → index-DNdSl4K9.js} +2 -2
  144. package/_assets/{index-DqmNsU3V.js → index-DOsSArLP.js} +2 -2
  145. package/_assets/{index-CiJZSR52.js → index-DS-I38Tc.js} +2 -2
  146. package/_assets/{index-Bz2OeIHf.js → index-DSSDadoY.js} +2 -2
  147. package/_assets/{index-CGTc-luO.js → index-DVftQW5q.js} +2 -2
  148. package/_assets/{index-DOSiX24O.js → index-DbNtir5j.js} +2 -2
  149. package/_assets/{index-CdzRs1b-.js → index-Dd2Jq54A.js} +2 -2
  150. package/_assets/{index-CYl9EZ1l.js → index-Df9jZPLX.js} +3 -3
  151. package/_assets/{index-B7iUyeUt.js → index-Rhe6B7O9.js} +2 -2
  152. package/_assets/{index-5hRGbsT6.js → index-VvaOIIkN.js} +2 -2
  153. package/_assets/{index-NF_GoMGX.js → index-gKpIsDfs.js} +2 -2
  154. package/_assets/{index-BN0gbiar.js → index-h96Dfz17.js} +2 -2
  155. package/_assets/{index-DrZ7e67r.js → index-lYPp_CsV.js} +2 -2
  156. package/_assets/{index-BKpRjuv3.js → index-mUHmvZEV.js} +2 -2
  157. package/_assets/{index-BM89P0tM.js → index-swOm_k9d.js} +2 -2
  158. package/_assets/{index.es-DmNzhBfU.js → index.es-BMZKN-3q.js} +2 -2
  159. package/_assets/{index.es-7TvS5Qh2.js → index.es-CG8pIgNp.js} +2 -2
  160. package/_assets/{index.es-Dd_ITeS6.js → index.es-DblaMqlJ.js} +2 -2
  161. package/_assets/{index.es-sDdxkcpY.js → index.es-QU0adH7w.js} +5 -5
  162. package/_assets/items-empty-BMZ75Lpv.js +2 -0
  163. package/_assets/{jump-B99flTYG.js → jump-CEV1qxuu.js} +2 -2
  164. package/_assets/{linkAccount-BK4E9pGS.js → linkAccount-CDnEj4n7.js} +2 -2
  165. package/_assets/{localBatchGatewayRequest-CD9qdDZu.js → localBatchGatewayRequest-BTYDfS5L.js} +2 -2
  166. package/_assets/{native-B_xZpXlS.js → native-vQacsgOz.js} +2 -2
  167. package/_assets/{networks-DdoPyzr9.js → networks-R6efXWNT.js} +2 -2
  168. package/_assets/{onramp-CSzaYxx7.js → onramp-MIzJ7Phu.js} +2 -2
  169. package/_assets/{openzeppelin-BaM2lzE6.js → openzeppelin-WZqVhiNR.js} +2 -2
  170. package/_assets/{ownerOf-BfgU8Yir.js → ownerOf-CUrOWK4W.js} +2 -2
  171. package/_assets/{parseNft-PWSwCsvW.js → parseNft-DNnWK2BZ.js} +3 -3
  172. package/_assets/{parseSignature-CqMdCDcO.js → parseSignature-BxQdCW5i.js} +2 -2
  173. package/_assets/{parseSignature-BO5eeDYg.js → parseSignature-ssuAz5tk.js} +4 -4
  174. package/_assets/{passkeys-CACjqd-H.js → passkeys-VOKftow9.js} +2 -2
  175. package/_assets/{pay-with-exchange-C4xcSOKH.js → pay-with-exchange-H5b_2iDR.js} +2 -2
  176. package/_assets/{prepare-contract-call-CL7yIz7F.js → prepare-contract-call-DMYCdn0g.js} +2 -2
  177. package/_assets/{qr-overlay-CxDuFBIO.js → qr-overlay-DlZQUuEN.js} +4 -4
  178. package/_assets/{react-DdXEvnSt.js → react-eHGl4EaY.js} +2 -2
  179. package/_assets/{receive-Bi97E5iX.js → receive-b4QzvIHG.js} +2 -2
  180. package/_assets/{resolveImplementation-DU78VhfE.js → resolveImplementation-DHfJOcqj.js} +2 -2
  181. package/_assets/{resume-buy-BuTzbRDw.js → resume-buy-OKb8MiCf.js} +2 -2
  182. package/_assets/{rpc-B0bLYj3y.js → rpc-DS-ctSv0.js} +2 -2
  183. package/_assets/{sales-empty-RQ131-Cj.js → sales-empty-CTLNLo98.js} +2 -2
  184. package/_assets/{search-empty-CMaQUOPN.js → search-empty-CfWjX9Z-.js} +2 -2
  185. package/_assets/{secp256k1-DZCMwq3_.js → secp256k1-8GzWOfIy.js} +2 -2
  186. package/_assets/{secp256k1-C2bpUlKp.js → secp256k1-DpFuX-Ol.js} +2 -2
  187. package/_assets/{secp256k1-C55vmJBM.js → secp256k1-DwYyjHky.js} +2 -2
  188. package/_assets/{send-DC8EEssh.js → send-COzoq6o1.js} +2 -2
  189. package/_assets/{send-batch-transaction-Di75_q5e.js → send-batch-transaction-BgnH7oNx.js} +2 -2
  190. package/_assets/{send-eip712-transaction-C6wD9VSl.js → send-eip712-transaction-CNt5Pfzs.js} +3 -3
  191. package/_assets/{send-gasless-transaction-Cg4w5bcd.js → send-gasless-transaction-UwIdWPPH.js} +3 -3
  192. package/_assets/{send-transaction-Bu06yAj8.js → send-transaction-BXllE_ec.js} +3 -3
  193. package/_assets/{sendMetaTransaction-CKbbr1d4.js → sendMetaTransaction-D1z-Wmsw.js} +2 -2
  194. package/_assets/{sendRawTransaction-azgWOYRw.js → sendRawTransaction-DXJcvhe0.js} +4 -4
  195. package/_assets/{sentry-CBtADnon.js → sentry-Bv3fzY7D.js} +3 -3
  196. package/_assets/{serializeTransaction-BBcJIPff.js → serializeTransaction-B5hMBD3v.js} +2 -2
  197. package/_assets/{session-proposal-Dqdz1uoL.js → session-proposal-C1LetR0O.js} +2 -2
  198. package/_assets/{session-request-DYe2S1ap.js → session-request-bNq-_KEQ.js} +3 -3
  199. package/_assets/{sha256-BmebHN1B.js → sha256-D6nBKqdK.js} +2 -2
  200. package/_assets/{signing-o11zMWds.js → signing-DWEjtXRX.js} +4 -4
  201. package/_assets/{skeleton.styles-YvcInZiQ.js → skeleton.styles-doHMnxGS.js} +2 -2
  202. package/_assets/{socials-Bqwr35jk.js → socials-F27dq_3-.js} +2 -2
  203. package/_assets/{styled-Bv9C-hhk.js → styled-P9L5SAVN.js} +2 -2
  204. package/_assets/{swaps-BJemJ3RQ.js → swaps-BJjH9K6-.js} +2 -2
  205. package/_assets/{thirdweb-Dys1d89O.js → thirdweb-sllJut3_.js} +4 -4
  206. package/_assets/{to-serializable-transaction-DAhX_zz6.js → to-serializable-transaction-DYHJF9B0.js} +3 -3
  207. package/_assets/{totalSupply-f0y3Xsn-.js → totalSupply-B1ExUCAh.js} +2 -2
  208. package/_assets/{transaction-DplS0dTf.js → transaction-BsO81ihM.js} +2 -2
  209. package/_assets/{transactionReceipt-B37TIvhI.js → transactionReceipt-WABT5B1W.js} +2 -2
  210. package/_assets/{transactions-CoSZVkVt.js → transactions-DFiEzKoy.js} +2 -2
  211. package/_assets/{useCreditPacks-hefn0ZD5.js → useCreditPacks-v3OL_Ll5.js} +2 -2
  212. package/_assets/{useInfiniteGrid-BgpINlDx.js → useInfiniteGrid-CueovPl3.js} +2 -2
  213. package/_assets/{useStore-C_7NQ9wl.js → useStore-B9TZQeZ1.js} +3 -3
  214. package/_assets/{useTheme-Bf8p94fs.js → useTheme-CH48hjjC.js} +2 -2
  215. package/_assets/{utils-cnMKR5rx.js → utils-BWMxYffs.js} +2 -2
  216. package/_assets/{verifyHash-DSs7CuzA.js → verifyHash-D4hTFZ7n.js} +2 -2
  217. package/_assets/{w3m-modal-BJXFFFi6.js → w3m-modal-C4xYPIy3.js} +2 -2
  218. package/_assets/{w3m-modal-DAP74p6c.js → w3m-modal-CLbpmAGV.js} +2 -2
  219. package/_assets/{wait-for-tx-receipt-B6DTuo_9.js → wait-for-tx-receipt-EKO_WpX3.js} +2 -2
  220. package/_assets/{wallets-CjFPtGr5.js → wallets-D0RL-9yA.js} +6 -6
  221. package/_assets/{web-connector-DSLaUAKj.js → web-connector-C-ABA0VC.js} +4 -4
  222. package/_assets/{writeContract-BZfaaQq4.js → writeContract-BBWBhvR4.js} +2 -2
  223. package/_assets/{zora-sepolia-CiyL4SYq.js → zora-sepolia-CGe2iXCC.js} +2 -2
  224. package/_assets/{zoraTestnet-BbAmNK9l.js → zoraTestnet-C-qLus12.js} +2 -2
  225. package/index.html +11 -11
  226. package/package.json +2 -2
  227. package/_assets/collectionPage.styles-6NhFxJwg.js +0 -40
  228. package/_assets/items-empty-BYwwtSaT.js +0 -2
@@ -1,6 +1,6 @@
1
- var H=Object.defineProperty;var V=(r,t,e)=>t in r?H(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var D=(r,t,e)=>V(r,typeof t!="symbol"?t+"":t,e);import{c as commonjsGlobal}from"./react-DdXEvnSt.js";import{c as commonjsRequire}from"./sentry-CBtADnon.js";import{r as requireCryptoBrowserify}from"./index-CiJZSR52.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new r.Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="ffb96adf-b02d-4b63-bf2b-28d0c1b4d02e",r._sentryDebugIdIdentifier="sentry-dbid-ffb96adf-b02d-4b63-bf2b-28d0c1b4d02e")}catch{}})();var dist={exports:{}};dist.exports;var hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,(function(module){var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJS=(r,t)=>function(){return t||(0,r[__getOwnPropNames(r)[0]])((t={exports:{}}).exports,t),t.exports},__export=(r,t)=>{for(var e in t)__defProp(r,e,{get:t[e],enumerable:!0})},__copyProps=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of __getOwnPropNames(t))!__hasOwnProp.call(r,i)&&i!==e&&__defProp(r,i,{get:()=>t[i],enumerable:!(n=__getOwnPropDesc(t,i))||n.enumerable});return r},__toESM=(r,t,e)=>(e=r!=null?__create(__getProtoOf(r)):{},__copyProps(__defProp(e,"default",{value:r,enumerable:!0}),r)),__toCommonJS=r=>__copyProps(__defProp({},"__esModule",{value:!0}),r),require_err_code=__commonJS({"node_modules/err-code/index.js"(r,t){function e(i,o){for(const a in o)Object.defineProperty(i,a,{value:o[a],enumerable:!0,configurable:!0});return i}function n(i,o,a){if(!i||typeof i=="string")throw new TypeError("Please pass an Error to err-code");a||(a={}),typeof o=="object"&&(a=o,o=""),o&&(a.code=o);try{return e(i,a)}catch{a.message=i.message,a.stack=i.stack;const u=function(){};return u.prototype=Object.create(Object.getPrototypeOf(i)),e(new u,a)}}t.exports=n}}),require_aspromise=__commonJS({"node_modules/@protobufjs/aspromise/index.js"(r,t){t.exports=e;function e(n,i){for(var o=new Array(arguments.length-1),a=0,s=2,u=!0;s<arguments.length;)o[a++]=arguments[s++];return new Promise(function(f,g){o[a]=function(y){if(u)if(u=!1,y)g(y);else{for(var l=new Array(arguments.length-1),c=0;c<l.length;)l[c++]=arguments[c];f.apply(null,l)}};try{n.apply(i||null,o)}catch(b){u&&(u=!1,g(b))}})}}}),require_base64=__commonJS({"node_modules/@protobufjs/base64/index.js"(r){var t=r;t.length=function(s){var u=s.length;if(!u)return 0;for(var h=0;--u%4>1&&s.charAt(u)==="=";)++h;return Math.ceil(s.length*3)/4-h};var e=new Array(64),n=new Array(123);for(i=0;i<64;)n[e[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;var i;t.encode=function(s,u,h){for(var f=null,g=[],b=0,y=0,l;u<h;){var c=s[u++];switch(y){case 0:g[b++]=e[c>>2],l=(c&3)<<4,y=1;break;case 1:g[b++]=e[l|c>>4],l=(c&15)<<2,y=2;break;case 2:g[b++]=e[l|c>>6],g[b++]=e[c&63],y=0;break}b>8191&&((f||(f=[])).push(String.fromCharCode.apply(String,g)),b=0)}return y&&(g[b++]=e[l],g[b++]=61,y===1&&(g[b++]=61)),f?(b&&f.push(String.fromCharCode.apply(String,g.slice(0,b))),f.join("")):String.fromCharCode.apply(String,g.slice(0,b))};var o="invalid encoding";t.decode=function(s,u,h){for(var f=h,g=0,b,y=0;y<s.length;){var l=s.charCodeAt(y++);if(l===61&&g>1)break;if((l=n[l])===void 0)throw Error(o);switch(g){case 0:b=l,g=1;break;case 1:u[h++]=b<<2|(l&48)>>4,b=l,g=2;break;case 2:u[h++]=(b&15)<<4|(l&60)>>2,b=l,g=3;break;case 3:u[h++]=(b&3)<<6|l,g=0;break}}if(g===1)throw Error(o);return h-f},t.test=function(s){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s)}}}),require_eventemitter=__commonJS({"node_modules/@protobufjs/eventemitter/index.js"(r,t){t.exports=e;function e(){this._listeners={}}e.prototype.on=function(i,o,a){return(this._listeners[i]||(this._listeners[i]=[])).push({fn:o,ctx:a||this}),this},e.prototype.off=function(i,o){if(i===void 0)this._listeners={};else if(o===void 0)this._listeners[i]=[];else for(var a=this._listeners[i],s=0;s<a.length;)a[s].fn===o?a.splice(s,1):++s;return this},e.prototype.emit=function(i){var o=this._listeners[i];if(o){for(var a=[],s=1;s<arguments.length;)a.push(arguments[s++]);for(s=0;s<o.length;)o[s].fn.apply(o[s++].ctx,a)}return this}}}),require_float=__commonJS({"node_modules/@protobufjs/float/index.js"(r,t){t.exports=e(e);function e(s){return typeof Float32Array<"u"?(function(){var u=new Float32Array([-0]),h=new Uint8Array(u.buffer),f=h[3]===128;function g(c,d,w){u[0]=c,d[w]=h[0],d[w+1]=h[1],d[w+2]=h[2],d[w+3]=h[3]}function b(c,d,w){u[0]=c,d[w]=h[3],d[w+1]=h[2],d[w+2]=h[1],d[w+3]=h[0]}s.writeFloatLE=f?g:b,s.writeFloatBE=f?b:g;function y(c,d){return h[0]=c[d],h[1]=c[d+1],h[2]=c[d+2],h[3]=c[d+3],u[0]}function l(c,d){return h[3]=c[d],h[2]=c[d+1],h[1]=c[d+2],h[0]=c[d+3],u[0]}s.readFloatLE=f?y:l,s.readFloatBE=f?l:y})():(function(){function u(f,g,b,y){var l=g<0?1:0;if(l&&(g=-g),g===0)f(1/g>0?0:2147483648,b,y);else if(isNaN(g))f(2143289344,b,y);else if(g>34028234663852886e22)f((l<<31|2139095040)>>>0,b,y);else if(g<11754943508222875e-54)f((l<<31|Math.round(g/1401298464324817e-60))>>>0,b,y);else{var c=Math.floor(Math.log(g)/Math.LN2),d=Math.round(g*Math.pow(2,-c)*8388608)&8388607;f((l<<31|c+127<<23|d)>>>0,b,y)}}s.writeFloatLE=u.bind(null,n),s.writeFloatBE=u.bind(null,i);function h(f,g,b){var y=f(g,b),l=(y>>31)*2+1,c=y>>>23&255,d=y&8388607;return c===255?d?NaN:l*(1/0):c===0?l*1401298464324817e-60*d:l*Math.pow(2,c-150)*(d+8388608)}s.readFloatLE=h.bind(null,o),s.readFloatBE=h.bind(null,a)})(),typeof Float64Array<"u"?(function(){var u=new Float64Array([-0]),h=new Uint8Array(u.buffer),f=h[7]===128;function g(c,d,w){u[0]=c,d[w]=h[0],d[w+1]=h[1],d[w+2]=h[2],d[w+3]=h[3],d[w+4]=h[4],d[w+5]=h[5],d[w+6]=h[6],d[w+7]=h[7]}function b(c,d,w){u[0]=c,d[w]=h[7],d[w+1]=h[6],d[w+2]=h[5],d[w+3]=h[4],d[w+4]=h[3],d[w+5]=h[2],d[w+6]=h[1],d[w+7]=h[0]}s.writeDoubleLE=f?g:b,s.writeDoubleBE=f?b:g;function y(c,d){return h[0]=c[d],h[1]=c[d+1],h[2]=c[d+2],h[3]=c[d+3],h[4]=c[d+4],h[5]=c[d+5],h[6]=c[d+6],h[7]=c[d+7],u[0]}function l(c,d){return h[7]=c[d],h[6]=c[d+1],h[5]=c[d+2],h[4]=c[d+3],h[3]=c[d+4],h[2]=c[d+5],h[1]=c[d+6],h[0]=c[d+7],u[0]}s.readDoubleLE=f?y:l,s.readDoubleBE=f?l:y})():(function(){function u(f,g,b,y,l,c){var d=y<0?1:0;if(d&&(y=-y),y===0)f(0,l,c+g),f(1/y>0?0:2147483648,l,c+b);else if(isNaN(y))f(0,l,c+g),f(2146959360,l,c+b);else if(y>17976931348623157e292)f(0,l,c+g),f((d<<31|2146435072)>>>0,l,c+b);else{var w;if(y<22250738585072014e-324)w=y/5e-324,f(w>>>0,l,c+g),f((d<<31|w/4294967296)>>>0,l,c+b);else{var v=Math.floor(Math.log(y)/Math.LN2);v===1024&&(v=1023),w=y*Math.pow(2,-v),f(w*4503599627370496>>>0,l,c+g),f((d<<31|v+1023<<20|w*1048576&1048575)>>>0,l,c+b)}}}s.writeDoubleLE=u.bind(null,n,0,4),s.writeDoubleBE=u.bind(null,i,4,0);function h(f,g,b,y,l){var c=f(y,l+g),d=f(y,l+b),w=(d>>31)*2+1,v=d>>>20&2047,p=4294967296*(d&1048575)+c;return v===2047?p?NaN:w*(1/0):v===0?w*5e-324*p:w*Math.pow(2,v-1075)*(p+4503599627370496)}s.readDoubleLE=h.bind(null,o,0,4),s.readDoubleBE=h.bind(null,a,4,0)})(),s}function n(s,u,h){u[h]=s&255,u[h+1]=s>>>8&255,u[h+2]=s>>>16&255,u[h+3]=s>>>24}function i(s,u,h){u[h]=s>>>24,u[h+1]=s>>>16&255,u[h+2]=s>>>8&255,u[h+3]=s&255}function o(s,u){return(s[u]|s[u+1]<<8|s[u+2]<<16|s[u+3]<<24)>>>0}function a(s,u){return(s[u]<<24|s[u+1]<<16|s[u+2]<<8|s[u+3])>>>0}}}),require_inquire=__commonJS({"node_modules/@protobufjs/inquire/index.js"(exports,module){module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}}}),require_utf8=__commonJS({"node_modules/@protobufjs/utf8/index.js"(r){var t=r;t.length=function(n){for(var i=0,o=0,a=0;a<n.length;++a)o=n.charCodeAt(a),o<128?i+=1:o<2048?i+=2:(o&64512)===55296&&(n.charCodeAt(a+1)&64512)===56320?(++a,i+=4):i+=3;return i},t.read=function(n,i,o){var a=o-i;if(a<1)return"";for(var s=null,u=[],h=0,f;i<o;)f=n[i++],f<128?u[h++]=f:f>191&&f<224?u[h++]=(f&31)<<6|n[i++]&63:f>239&&f<365?(f=((f&7)<<18|(n[i++]&63)<<12|(n[i++]&63)<<6|n[i++]&63)-65536,u[h++]=55296+(f>>10),u[h++]=56320+(f&1023)):u[h++]=(f&15)<<12|(n[i++]&63)<<6|n[i++]&63,h>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,u)),h=0);return s?(h&&s.push(String.fromCharCode.apply(String,u.slice(0,h))),s.join("")):String.fromCharCode.apply(String,u.slice(0,h))},t.write=function(n,i,o){for(var a=o,s,u,h=0;h<n.length;++h)s=n.charCodeAt(h),s<128?i[o++]=s:s<2048?(i[o++]=s>>6|192,i[o++]=s&63|128):(s&64512)===55296&&((u=n.charCodeAt(h+1))&64512)===56320?(s=65536+((s&1023)<<10)+(u&1023),++h,i[o++]=s>>18|240,i[o++]=s>>12&63|128,i[o++]=s>>6&63|128,i[o++]=s&63|128):(i[o++]=s>>12|224,i[o++]=s>>6&63|128,i[o++]=s&63|128);return o-a}}}),require_pool=__commonJS({"node_modules/@protobufjs/pool/index.js"(r,t){t.exports=e;function e(n,i,o){var a=o||8192,s=a>>>1,u=null,h=a;return function(g){if(g<1||g>s)return n(g);h+g>a&&(u=n(a),h=0);var b=i.call(u,h,h+=g);return h&7&&(h=(h|7)+1),b}}}}),require_longbits=__commonJS({"node_modules/protobufjs/src/util/longbits.js"(r,t){t.exports=n;var e=require_minimal();function n(s,u){this.lo=s>>>0,this.hi=u>>>0}var i=n.zero=new n(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(u){if(u===0)return i;var h=u<0;h&&(u=-u);var f=u>>>0,g=(u-f)/4294967296>>>0;return h&&(g=~g>>>0,f=~f>>>0,++f>4294967295&&(f=0,++g>4294967295&&(g=0))),new n(f,g)},n.from=function(u){if(typeof u=="number")return n.fromNumber(u);if(e.isString(u))if(e.Long)u=e.Long.fromString(u);else return n.fromNumber(parseInt(u,10));return u.low||u.high?new n(u.low>>>0,u.high>>>0):i},n.prototype.toNumber=function(u){if(!u&&this.hi>>>31){var h=~this.lo+1>>>0,f=~this.hi>>>0;return h||(f=f+1>>>0),-(h+f*4294967296)}return this.lo+this.hi*4294967296},n.prototype.toLong=function(u){return e.Long?new e.Long(this.lo|0,this.hi|0,!!u):{low:this.lo|0,high:this.hi|0,unsigned:!!u}};var a=String.prototype.charCodeAt;n.fromHash=function(u){return u===o?i:new n((a.call(u,0)|a.call(u,1)<<8|a.call(u,2)<<16|a.call(u,3)<<24)>>>0,(a.call(u,4)|a.call(u,5)<<8|a.call(u,6)<<16|a.call(u,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var u=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^u)>>>0,this.lo=(this.lo<<1^u)>>>0,this},n.prototype.zzDecode=function(){var u=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^u)>>>0,this.hi=(this.hi>>>1^u)>>>0,this},n.prototype.length=function(){var u=this.lo,h=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return f===0?h===0?u<16384?u<128?1:2:u<2097152?3:4:h<16384?h<128?5:6:h<2097152?7:8:f<128?9:10}}}),require_minimal=__commonJS({"node_modules/protobufjs/src/util/minimal.js"(r){var t=r;t.asPromise=require_aspromise(),t.base64=require_base64(),t.EventEmitter=require_eventemitter(),t.float=require_float(),t.inquire=require_inquire(),t.utf8=require_utf8(),t.pool=require_pool(),t.LongBits=require_longbits(),t.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||r,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(o){return typeof o=="number"&&isFinite(o)&&Math.floor(o)===o},t.isString=function(o){return typeof o=="string"||o instanceof String},t.isObject=function(o){return o&&typeof o=="object"},t.isset=t.isSet=function(o,a){var s=o[a];return s!=null&&o.hasOwnProperty(a)?typeof s!="object"||(Array.isArray(s)?s.length:Object.keys(s).length)>0:!1},t.Buffer=(function(){try{var i=t.inquire("buffer").Buffer;return i.prototype.utf8Write?i:null}catch{return null}})(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(o){return typeof o=="number"?t.Buffer?t._Buffer_allocUnsafe(o):new t.Array(o):t.Buffer?t._Buffer_from(o):typeof Uint8Array>"u"?o:new Uint8Array(o)},t.Array=typeof Uint8Array<"u"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(o){return o?t.LongBits.from(o).toHash():t.LongBits.zeroHash},t.longFromHash=function(o,a){var s=t.LongBits.fromHash(o);return t.Long?t.Long.fromBits(s.lo,s.hi,a):s.toNumber(!!a)};function e(i,o,a){for(var s=Object.keys(o),u=0;u<s.length;++u)(i[s[u]]===void 0||!a)&&(i[s[u]]=o[s[u]]);return i}t.merge=e,t.lcFirst=function(o){return o.charAt(0).toLowerCase()+o.substring(1)};function n(i){function o(a,s){if(!(this instanceof o))return new o(a,s);Object.defineProperty(this,"message",{get:function(){return a}}),Error.captureStackTrace?Error.captureStackTrace(this,o):Object.defineProperty(this,"stack",{value:new Error().stack||""}),s&&e(this,s)}return o.prototype=Object.create(Error.prototype,{constructor:{value:o,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return i},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),o}t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(o){for(var a={},s=0;s<o.length;++s)a[o[s]]=1;return function(){for(var u=Object.keys(this),h=u.length-1;h>-1;--h)if(a[u[h]]===1&&this[u[h]]!==void 0&&this[u[h]]!==null)return u[h]}},t.oneOfSetter=function(o){return function(a){for(var s=0;s<o.length;++s)o[s]!==a&&delete this[o[s]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var i=t.Buffer;if(!i){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=i.from!==Uint8Array.from&&i.from||function(a,s){return new i(a,s)},t._Buffer_allocUnsafe=i.allocUnsafe||function(a){return new i(a)}}}}),require_reader=__commonJS({"node_modules/protobufjs/src/reader.js"(r,t){t.exports=s;var e=require_minimal(),n,i=e.LongBits,o=e.utf8;function a(y,l){return RangeError("index out of range: "+y.pos+" + "+(l||1)+" > "+y.len)}function s(y){this.buf=y,this.pos=0,this.len=y.length}var u=typeof Uint8Array<"u"?function(l){if(l instanceof Uint8Array||Array.isArray(l))return new s(l);throw Error("illegal buffer")}:function(l){if(Array.isArray(l))return new s(l);throw Error("illegal buffer")},h=function(){return e.Buffer?function(c){return(s.create=function(w){return e.Buffer.isBuffer(w)?new n(w):u(w)})(c)}:u};s.create=h(),s.prototype._slice=e.Array.prototype.subarray||e.Array.prototype.slice,s.prototype.uint32=(function(){var l=4294967295;return function(){if(l=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(l=(l|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(l=(l|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(l=(l|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(l=(l|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return l;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return l}})(),s.prototype.int32=function(){return this.uint32()|0},s.prototype.sint32=function(){var l=this.uint32();return l>>>1^-(l&1)|0};function f(){var y=new i(0,0),l=0;if(this.len-this.pos>4){for(;l<4;++l)if(y.lo=(y.lo|(this.buf[this.pos]&127)<<l*7)>>>0,this.buf[this.pos++]<128)return y;if(y.lo=(y.lo|(this.buf[this.pos]&127)<<28)>>>0,y.hi=(y.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return y;l=0}else{for(;l<3;++l){if(this.pos>=this.len)throw a(this);if(y.lo=(y.lo|(this.buf[this.pos]&127)<<l*7)>>>0,this.buf[this.pos++]<128)return y}return y.lo=(y.lo|(this.buf[this.pos++]&127)<<l*7)>>>0,y}if(this.len-this.pos>4){for(;l<5;++l)if(y.hi=(y.hi|(this.buf[this.pos]&127)<<l*7+3)>>>0,this.buf[this.pos++]<128)return y}else for(;l<5;++l){if(this.pos>=this.len)throw a(this);if(y.hi=(y.hi|(this.buf[this.pos]&127)<<l*7+3)>>>0,this.buf[this.pos++]<128)return y}throw Error("invalid varint encoding")}s.prototype.bool=function(){return this.uint32()!==0};function g(y,l){return(y[l-4]|y[l-3]<<8|y[l-2]<<16|y[l-1]<<24)>>>0}s.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return g(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return g(this.buf,this.pos+=4)|0};function b(){if(this.pos+8>this.len)throw a(this,8);return new i(g(this.buf,this.pos+=4),g(this.buf,this.pos+=4))}s.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var l=e.float.readFloatLE(this.buf,this.pos);return this.pos+=4,l},s.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var l=e.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,l},s.prototype.bytes=function(){var l=this.uint32(),c=this.pos,d=this.pos+l;if(d>this.len)throw a(this,l);return this.pos+=l,Array.isArray(this.buf)?this.buf.slice(c,d):c===d?new this.buf.constructor(0):this._slice.call(this.buf,c,d)},s.prototype.string=function(){var l=this.bytes();return o.read(l,0,l.length)},s.prototype.skip=function(l){if(typeof l=="number"){if(this.pos+l>this.len)throw a(this,l);this.pos+=l}else do if(this.pos>=this.len)throw a(this);while(this.buf[this.pos++]&128);return this},s.prototype.skipType=function(y){switch(y){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(y=this.uint32()&7)!==4;)this.skipType(y);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+y+" at offset "+this.pos)}return this},s._configure=function(y){n=y,s.create=h(),n._configure();var l=e.Long?"toLong":"toNumber";e.merge(s.prototype,{int64:function(){return f.call(this)[l](!1)},uint64:function(){return f.call(this)[l](!0)},sint64:function(){return f.call(this).zzDecode()[l](!1)},fixed64:function(){return b.call(this)[l](!0)},sfixed64:function(){return b.call(this)[l](!1)}})}}}),require_reader_buffer=__commonJS({"node_modules/protobufjs/src/reader_buffer.js"(r,t){t.exports=i;var e=require_reader();(i.prototype=Object.create(e.prototype)).constructor=i;var n=require_minimal();function i(o){e.call(this,o)}i._configure=function(){n.Buffer&&(i.prototype._slice=n.Buffer.prototype.slice)},i.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+a,this.len))},i._configure()}}),require_writer=__commonJS({"node_modules/protobufjs/src/writer.js"(r,t){t.exports=f;var e=require_minimal(),n,i=e.LongBits,o=e.base64,a=e.utf8;function s(v,p,m){this.fn=v,this.len=p,this.next=void 0,this.val=m}function u(){}function h(v){this.head=v.head,this.tail=v.tail,this.len=v.len,this.next=v.states}function f(){this.len=0,this.head=new s(u,0,0),this.tail=this.head,this.states=null}var g=function(){return e.Buffer?function(){return(f.create=function(){return new n})()}:function(){return new f}};f.create=g(),f.alloc=function(p){return new e.Array(p)},e.Array!==Array&&(f.alloc=e.pool(f.alloc,e.Array.prototype.subarray)),f.prototype._push=function(p,m,_){return this.tail=this.tail.next=new s(p,m,_),this.len+=m,this};function b(v,p,m){p[m]=v&255}function y(v,p,m){for(;v>127;)p[m++]=v&127|128,v>>>=7;p[m]=v}function l(v,p){this.len=v,this.next=void 0,this.val=p}l.prototype=Object.create(s.prototype),l.prototype.fn=y,f.prototype.uint32=function(p){return this.len+=(this.tail=this.tail.next=new l((p=p>>>0)<128?1:p<16384?2:p<2097152?3:p<268435456?4:5,p)).len,this},f.prototype.int32=function(p){return p<0?this._push(c,10,i.fromNumber(p)):this.uint32(p)},f.prototype.sint32=function(p){return this.uint32((p<<1^p>>31)>>>0)};function c(v,p,m){for(;v.hi;)p[m++]=v.lo&127|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;v.lo>127;)p[m++]=v.lo&127|128,v.lo=v.lo>>>7;p[m++]=v.lo}f.prototype.uint64=function(p){var m=i.from(p);return this._push(c,m.length(),m)},f.prototype.int64=f.prototype.uint64,f.prototype.sint64=function(p){var m=i.from(p).zzEncode();return this._push(c,m.length(),m)},f.prototype.bool=function(p){return this._push(b,1,p?1:0)};function d(v,p,m){p[m]=v&255,p[m+1]=v>>>8&255,p[m+2]=v>>>16&255,p[m+3]=v>>>24}f.prototype.fixed32=function(p){return this._push(d,4,p>>>0)},f.prototype.sfixed32=f.prototype.fixed32,f.prototype.fixed64=function(p){var m=i.from(p);return this._push(d,4,m.lo)._push(d,4,m.hi)},f.prototype.sfixed64=f.prototype.fixed64,f.prototype.float=function(p){return this._push(e.float.writeFloatLE,4,p)},f.prototype.double=function(p){return this._push(e.float.writeDoubleLE,8,p)};var w=e.Array.prototype.set?function(p,m,_){m.set(p,_)}:function(p,m,_){for(var A=0;A<p.length;++A)m[_+A]=p[A]};f.prototype.bytes=function(p){var m=p.length>>>0;if(!m)return this._push(b,1,0);if(e.isString(p)){var _=f.alloc(m=o.length(p));o.decode(p,_,0),p=_}return this.uint32(m)._push(w,m,p)},f.prototype.string=function(p){var m=a.length(p);return m?this.uint32(m)._push(a.write,m,p):this._push(b,1,0)},f.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new s(u,0,0),this.len=0,this},f.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new s(u,0,0),this.len=0),this},f.prototype.ldelim=function(){var p=this.head,m=this.tail,_=this.len;return this.reset().uint32(_),_&&(this.tail.next=p.next,this.tail=m,this.len+=_),this},f.prototype.finish=function(){for(var p=this.head.next,m=this.constructor.alloc(this.len),_=0;p;)p.fn(p.val,m,_),_+=p.len,p=p.next;return m},f._configure=function(v){n=v,f.create=g(),n._configure()}}}),require_writer_buffer=__commonJS({"node_modules/protobufjs/src/writer_buffer.js"(r,t){t.exports=i;var e=require_writer();(i.prototype=Object.create(e.prototype)).constructor=i;var n=require_minimal();function i(){e.call(this)}i._configure=function(){i.alloc=n._Buffer_allocUnsafe,i.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&n.Buffer.prototype.set.name==="set"?function(s,u,h){u.set(s,h)}:function(s,u,h){if(s.copy)s.copy(u,h,0,s.length);else for(var f=0;f<s.length;)u[h++]=s[f++]}},i.prototype.bytes=function(s){n.isString(s)&&(s=n._Buffer_from(s,"base64"));var u=s.length>>>0;return this.uint32(u),u&&this._push(i.writeBytesBuffer,u,s),this};function o(a,s,u){a.length<40?n.utf8.write(a,s,u):s.utf8Write?s.utf8Write(a,u):s.write(a,u)}i.prototype.string=function(s){var u=n.Buffer.byteLength(s);return this.uint32(u),u&&this._push(o,u,s),this},i._configure()}}),require_murmurHash3js=__commonJS({"node_modules/murmurhash3js-revisited/lib/murmurHash3js.js"(r,t){(function(e,n){var i={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function o(c){if(!Array.isArray(c)&&!ArrayBuffer.isView(c))return!1;for(var d=0;d<c.length;d++)if(!Number.isInteger(c[d])||c[d]<0||c[d]>255)return!1;return!0}function a(c,d){return(c&65535)*d+(((c>>>16)*d&65535)<<16)}function s(c,d){return c<<d|c>>>32-d}function u(c){return c^=c>>>16,c=a(c,2246822507),c^=c>>>13,c=a(c,3266489909),c^=c>>>16,c}function h(c,d){c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var w=[0,0,0,0];return w[3]+=c[3]+d[3],w[2]+=w[3]>>>16,w[3]&=65535,w[2]+=c[2]+d[2],w[1]+=w[2]>>>16,w[2]&=65535,w[1]+=c[1]+d[1],w[0]+=w[1]>>>16,w[1]&=65535,w[0]+=c[0]+d[0],w[0]&=65535,[w[0]<<16|w[1],w[2]<<16|w[3]]}function f(c,d){c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var w=[0,0,0,0];return w[3]+=c[3]*d[3],w[2]+=w[3]>>>16,w[3]&=65535,w[2]+=c[2]*d[3],w[1]+=w[2]>>>16,w[2]&=65535,w[2]+=c[3]*d[2],w[1]+=w[2]>>>16,w[2]&=65535,w[1]+=c[1]*d[3],w[0]+=w[1]>>>16,w[1]&=65535,w[1]+=c[2]*d[2],w[0]+=w[1]>>>16,w[1]&=65535,w[1]+=c[3]*d[1],w[0]+=w[1]>>>16,w[1]&=65535,w[0]+=c[0]*d[3]+c[1]*d[2]+c[2]*d[1]+c[3]*d[0],w[0]&=65535,[w[0]<<16|w[1],w[2]<<16|w[3]]}function g(c,d){return d%=64,d===32?[c[1],c[0]]:d<32?[c[0]<<d|c[1]>>>32-d,c[1]<<d|c[0]>>>32-d]:(d-=32,[c[1]<<d|c[0]>>>32-d,c[0]<<d|c[1]>>>32-d])}function b(c,d){return d%=64,d===0?c:d<32?[c[0]<<d|c[1]>>>32-d,c[1]<<d]:[c[1]<<d-32,0]}function y(c,d){return[c[0]^d[0],c[1]^d[1]]}function l(c){return c=y(c,[0,c[0]>>>1]),c=f(c,[4283543511,3981806797]),c=y(c,[0,c[0]>>>1]),c=f(c,[3301882366,444984403]),c=y(c,[0,c[0]>>>1]),c}i.x86.hash32=function(c,d){if(i.inputValidation&&!o(c))return n;d=d||0;for(var w=c.length%4,v=c.length-w,p=d,m=0,_=3432918353,A=461845907,E=0;E<v;E=E+4)m=c[E]|c[E+1]<<8|c[E+2]<<16|c[E+3]<<24,m=a(m,_),m=s(m,15),m=a(m,A),p^=m,p=s(p,13),p=a(p,5)+3864292196;switch(m=0,w){case 3:m^=c[E+2]<<16;case 2:m^=c[E+1]<<8;case 1:m^=c[E],m=a(m,_),m=s(m,15),m=a(m,A),p^=m}return p^=c.length,p=u(p),p>>>0},i.x86.hash128=function(c,d){if(i.inputValidation&&!o(c))return n;d=d||0;for(var w=c.length%16,v=c.length-w,p=d,m=d,_=d,A=d,E=0,S=0,x=0,F=0,T=597399067,N=2869860233,U=951274213,z=2716044179,B=0;B<v;B=B+16)E=c[B]|c[B+1]<<8|c[B+2]<<16|c[B+3]<<24,S=c[B+4]|c[B+5]<<8|c[B+6]<<16|c[B+7]<<24,x=c[B+8]|c[B+9]<<8|c[B+10]<<16|c[B+11]<<24,F=c[B+12]|c[B+13]<<8|c[B+14]<<16|c[B+15]<<24,E=a(E,T),E=s(E,15),E=a(E,N),p^=E,p=s(p,19),p+=m,p=a(p,5)+1444728091,S=a(S,N),S=s(S,16),S=a(S,U),m^=S,m=s(m,17),m+=_,m=a(m,5)+197830471,x=a(x,U),x=s(x,17),x=a(x,z),_^=x,_=s(_,15),_+=A,_=a(_,5)+2530024501,F=a(F,z),F=s(F,18),F=a(F,T),A^=F,A=s(A,13),A+=p,A=a(A,5)+850148119;switch(E=0,S=0,x=0,F=0,w){case 15:F^=c[B+14]<<16;case 14:F^=c[B+13]<<8;case 13:F^=c[B+12],F=a(F,z),F=s(F,18),F=a(F,T),A^=F;case 12:x^=c[B+11]<<24;case 11:x^=c[B+10]<<16;case 10:x^=c[B+9]<<8;case 9:x^=c[B+8],x=a(x,U),x=s(x,17),x=a(x,z),_^=x;case 8:S^=c[B+7]<<24;case 7:S^=c[B+6]<<16;case 6:S^=c[B+5]<<8;case 5:S^=c[B+4],S=a(S,N),S=s(S,16),S=a(S,U),m^=S;case 4:E^=c[B+3]<<24;case 3:E^=c[B+2]<<16;case 2:E^=c[B+1]<<8;case 1:E^=c[B],E=a(E,T),E=s(E,15),E=a(E,N),p^=E}return p^=c.length,m^=c.length,_^=c.length,A^=c.length,p+=m,p+=_,p+=A,m+=p,_+=p,A+=p,p=u(p),m=u(m),_=u(_),A=u(A),p+=m,p+=_,p+=A,m+=p,_+=p,A+=p,("00000000"+(p>>>0).toString(16)).slice(-8)+("00000000"+(m>>>0).toString(16)).slice(-8)+("00000000"+(_>>>0).toString(16)).slice(-8)+("00000000"+(A>>>0).toString(16)).slice(-8)},i.x64.hash128=function(c,d){if(i.inputValidation&&!o(c))return n;d=d||0;for(var w=c.length%16,v=c.length-w,p=[0,d],m=[0,d],_=[0,0],A=[0,0],E=[2277735313,289559509],S=[1291169091,658871167],x=0;x<v;x=x+16)_=[c[x+4]|c[x+5]<<8|c[x+6]<<16|c[x+7]<<24,c[x]|c[x+1]<<8|c[x+2]<<16|c[x+3]<<24],A=[c[x+12]|c[x+13]<<8|c[x+14]<<16|c[x+15]<<24,c[x+8]|c[x+9]<<8|c[x+10]<<16|c[x+11]<<24],_=f(_,E),_=g(_,31),_=f(_,S),p=y(p,_),p=g(p,27),p=h(p,m),p=h(f(p,[0,5]),[0,1390208809]),A=f(A,S),A=g(A,33),A=f(A,E),m=y(m,A),m=g(m,31),m=h(m,p),m=h(f(m,[0,5]),[0,944331445]);switch(_=[0,0],A=[0,0],w){case 15:A=y(A,b([0,c[x+14]],48));case 14:A=y(A,b([0,c[x+13]],40));case 13:A=y(A,b([0,c[x+12]],32));case 12:A=y(A,b([0,c[x+11]],24));case 11:A=y(A,b([0,c[x+10]],16));case 10:A=y(A,b([0,c[x+9]],8));case 9:A=y(A,[0,c[x+8]]),A=f(A,S),A=g(A,33),A=f(A,E),m=y(m,A);case 8:_=y(_,b([0,c[x+7]],56));case 7:_=y(_,b([0,c[x+6]],48));case 6:_=y(_,b([0,c[x+5]],40));case 5:_=y(_,b([0,c[x+4]],32));case 4:_=y(_,b([0,c[x+3]],24));case 3:_=y(_,b([0,c[x+2]],16));case 2:_=y(_,b([0,c[x+1]],8));case 1:_=y(_,[0,c[x]]),_=f(_,E),_=g(_,31),_=f(_,S),p=y(p,_)}return p=y(p,[0,c.length]),m=y(m,[0,c.length]),p=h(p,m),m=h(m,p),p=l(p),m=l(m),p=h(p,m),m=h(m,p),("00000000"+(p[0]>>>0).toString(16)).slice(-8)+("00000000"+(p[1]>>>0).toString(16)).slice(-8)+("00000000"+(m[0]>>>0).toString(16)).slice(-8)+("00000000"+(m[1]>>>0).toString(16)).slice(-8)},typeof r<"u"?(typeof t<"u"&&t.exports&&(r=t.exports=i),r.murmurHash3=i):(i._murmurHash3=e.murmurHash3,i.noConflict=function(){return e.murmurHash3=i._murmurHash3,i._murmurHash3=n,i.noConflict=n,i},e.murmurHash3=i)})(r)}}),require_murmurhash3js_revisited=__commonJS({"node_modules/murmurhash3js-revisited/index.js"(r,t){t.exports=require_murmurHash3js()}}),require_sparse_array=__commonJS({"node_modules/sparse-array/index.js"(r,t){var e=7;t.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(u,h){let f=this._internalPositionFor(u,!1);if(h===void 0)f!==-1&&(this._unsetInternalPos(f),this._unsetBit(u),this._changedLength=!0,this._changedData=!0);else{let g=!1;f===-1?(f=this._data.length,this._setBit(u),this._changedData=!0):g=!0,this._setInternalPos(f,u,h,g),this._changedLength=!0}}unset(u){this.set(u,void 0)}get(u){this._sortData();const h=this._internalPositionFor(u,!0);if(h!==-1)return this._data[h][1]}push(u){return this.set(this.length,u),this.length}get length(){if(this._sortData(),this._changedLength){const u=this._data[this._data.length-1];this._length=u?u[0]+1:0,this._changedLength=!1}return this._length}forEach(u){let h=0;for(;h<this.length;)u(this.get(h),h,this),h++}map(u){let h=0,f=new Array(this.length);for(;h<this.length;)f[h]=u(this.get(h),h,this),h++;return f}reduce(u,h){let f=0,g=h;for(;f<this.length;){const b=this.get(f);g=u(g,b,f),f++}return g}find(u){let h=0,f,g;for(;h<this.length&&!f;)g=this.get(h),f=u(g),h++;return f?g:void 0}_internalPositionFor(u,h){const f=this._bytePosFor(u,h);if(f>=this._bitArrays.length)return-1;const g=this._bitArrays[f],b=u-f*e;if(!((g&1<<b)>0))return-1;const l=this._bitArrays.slice(0,f).reduce(n,0),c=~(4294967295<<b+1),d=i(g&c);return l+d-1}_bytePosFor(u,h){const f=Math.floor(u/e),g=f+1;for(;!h&&this._bitArrays.length<g;)this._bitArrays.push(0);return f}_setBit(u){const h=this._bytePosFor(u,!1);this._bitArrays[h]|=1<<u-h*e}_unsetBit(u){const h=this._bytePosFor(u,!1);this._bitArrays[h]&=~(1<<u-h*e)}_setInternalPos(u,h,f,g){const b=this._data,y=[h,f];if(g)this._sortData(),b[u]=y;else{if(b.length)if(b[b.length-1][0]>=h)b.push(y);else if(b[0][0]<=h)b.unshift(y);else{const l=Math.round(b.length/2);this._data=b.slice(0,l).concat(y).concat(b.slice(l))}else this._data.push(y);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(u){this._data.splice(u,1)}_sortData(){this._changedData&&this._data.sort(o),this._changedData=!1}bitField(){const u=[];let h=8,f=0,g=0,b;const y=this._bitArrays.slice();for(;y.length||f;){f===0&&(b=y.shift(),f=7);const c=Math.min(f,h),d=~(255<<c),w=b&d;g|=w<<8-h,b=b>>>c,f-=c,h-=c,(!h||!f&&!y.length)&&(u.push(g),g=0,h=8)}for(var l=u.length-1;l>0&&u[l]===0;l--)u.pop();return u}compactArray(){return this._sortData(),this._data.map(a)}};function n(s,u){return s+i(u)}function i(s){let u=s;return u=u-(u>>1&1431655765),u=(u&858993459)+(u>>2&858993459),(u+(u>>4)&252645135)*16843009>>24}function o(s,u){return s[0]-u[0]}function a(s){return s[1]}}}),src_exports2={};__export(src_exports2,{calculateMultipleHashesADR32:()=>calculateMultipleHashesADR32,calculateMultipleHashesADR32LegacyQmHash:()=>calculateMultipleHashesADR32LegacyQmHash,compareStrings:()=>compareStrings,hashV0:()=>hashV0,hashV1:()=>hashV1,keccak256Hash:()=>keccak256Hash,prepareADR32Data:()=>prepareADR32Data,sortKeys:()=>sortKeys}),module.exports=__toCommonJS(src_exports2);var import_crypto3=__toESM(requireCryptoBrowserify()),bytes_exports={};__export(bytes_exports,{coerce:()=>coerce,empty:()=>empty,equals:()=>equals,fromHex:()=>fromHex,fromString:()=>fromString,isBinary:()=>isBinary,toHex:()=>toHex,toString:()=>toString});var empty=new Uint8Array(0),toHex=r=>r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),""),fromHex=r=>{const t=r.match(/../g);return t?new Uint8Array(t.map(e=>parseInt(e,16))):empty},equals=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},coerce=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},isBinary=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),fromString=r=>new TextEncoder().encode(r),toString=r=>new TextDecoder().decode(r),encode_1=encode,MSB=128,MSBALL=-128,INT=Math.pow(2,31);function encode(r,t,e){t=t||[],e=e||0;for(var n=e;r>=INT;)t[e++]=r&255|MSB,r/=128;for(;r&MSBALL;)t[e++]=r&255|MSB,r>>>=7;return t[e]=r|0,encode.bytes=e-n+1,t}var decode=read,MSB$1=128,REST$1=127;function read(r,n){var e=0,n=n||0,i=0,o=n,a,s=r.length;do{if(o>=s)throw read.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&REST$1)<<i:(a&REST$1)*Math.pow(2,i),i+=7}while(a>=MSB$1);return read.bytes=o-n,e}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(r){return r<N1?1:r<N2?2:r<N3?3:r<N4?4:r<N5?5:r<N6?6:r<N7?7:r<N8?8:r<N9?9:10},varint={encode:encode_1,decode,encodingLength:length},_brrp_varint=varint,varint_default=_brrp_varint,decode2=(r,t=0)=>[varint_default.decode(r,t),varint_default.decode.bytes],encodeTo=(r,t,e=0)=>(varint_default.encode(r,t,e),t),encodingLength=r=>varint_default.encodingLength(r),create=(r,t)=>{const e=t.byteLength,n=encodingLength(r),i=n+encodingLength(e),o=new Uint8Array(i+e);return encodeTo(r,o,0),encodeTo(e,o,n),o.set(t,i),new Digest(r,e,t,o)},decode3=r=>{const t=coerce(r),[e,n]=decode2(t),[i,o]=decode2(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Digest(e,i,a,t)},equals2=(r,t)=>{if(r===t)return!0;{const e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&equals(r.bytes,e.bytes)}},Digest=class{constructor(r,t,e,n){this.code=r,this.size=t,this.digest=e,this.bytes=n}};function base(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var s=r.length,u=r.charAt(0),h=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var c=0,d=0,w=0,v=l.length;w!==v&&l[w]===0;)w++,c++;for(var p=(v-w)*f+1>>>0,m=new Uint8Array(p);w!==v;){for(var _=l[w],A=0,E=p-1;(_!==0||A<d)&&E!==-1;E--,A++)_+=256*m[E]>>>0,m[E]=_%s>>>0,_=_/s>>>0;if(_!==0)throw new Error("Non-zero carry");d=A,w++}for(var S=p-d;S!==p&&m[S]===0;)S++;for(var x=u.repeat(c);S<p;++S)x+=r.charAt(m[S]);return x}function b(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var c=0;if(l[c]!==" "){for(var d=0,w=0;l[c]===u;)d++,c++;for(var v=(l.length-c)*h+1>>>0,p=new Uint8Array(v);l[c];){var m=e[l.charCodeAt(c)];if(m===255)return;for(var _=0,A=v-1;(m!==0||_<w)&&A!==-1;A--,_++)m+=s*p[A]>>>0,p[A]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");w=_,c++}if(l[c]!==" "){for(var E=v-w;E!==v&&p[E]===0;)E++;for(var S=new Uint8Array(d+(v-E)),x=d;E!==v;)S[x++]=p[E++];return S}}}function y(l){var c=b(l);if(c)return c;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:b,decode:y}}var src=base,_brrp__multiformats_scope_baseX=src,base_x_default=_brrp__multiformats_scope_baseX,Encoder=class{constructor(r,t,e){this.name=r,this.prefix=t,this.baseEncode=e}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},Decoder=class{constructor(r,t,e){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=e}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return or(this,r)}},ComposedDecoder=class{constructor(r){this.decoders=r}or(r){return or(this,r)}decode(r){const t=r[0],e=this.decoders[t];if(e)return e.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or=(r,t)=>new ComposedDecoder({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Codec=class{constructor(r,t,e,n){this.name=r,this.prefix=t,this.baseEncode=e,this.baseDecode=n,this.encoder=new Encoder(r,t,e),this.decoder=new Decoder(r,t,n)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},from=({name:r,prefix:t,encode:e,decode:n})=>new Codec(r,t,e,n),baseX=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=base_x_default(e,t);return from({prefix:r,name:t,encode:n,decode:o=>coerce(i(o))})},decode4=(r,t,e,n)=>{const i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;const a=new Uint8Array(o*e/8|0);let s=0,u=0,h=0;for(let f=0;f<o;++f){const g=i[r[f]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<e|g,s+=e,s>=8&&(s-=8,a[h++]=255&u>>s)}if(s>=e||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode2=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let o="",a=0,s=0;for(let u=0;u<r.length;++u)for(s=s<<8|r[u],a+=8;a>e;)a-=e,o+=t[i&s>>a];if(a&&(o+=t[i&s<<e-a]),n)for(;o.length*e&7;)o+="=";return o},rfc4648=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>from({prefix:t,name:r,encode(i){return encode2(i,n,e)},decode(i){return decode4(i,n,e,r)}}),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"});baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5});rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var format=(r,t)=>{const{bytes:e,version:n}=r;switch(n){case 0:return toStringV0(e,baseCache(r),t||base58btc.encoder);default:return toStringV1(e,baseCache(r),t||base32.encoder)}},cache=new WeakMap,baseCache=r=>{const t=cache.get(r);if(t==null){const e=new Map;return cache.set(r,e),e}return t},CID=class C{constructor(t,e,n,i){this.code=e,this.version=t,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:{const{code:t,multihash:e}=this;if(t!==DAG_PB_CODE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==SHA_256_CODE)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return C.createV0(e)}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:{const{code:t,digest:e}=this.multihash,n=create(t,e);return C.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(t){return C.equals(this,t)}static equals(t,e){const n=e;return n&&t.code===n.code&&t.version===n.version&&equals2(t.multihash,n.multihash)}toString(t){return format(this,t)}toJSON(){return{"/":format(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;const e=t;if(e instanceof C)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){const{version:n,code:i,multihash:o,bytes:a}=e;return new C(n,i,o,a||encodeCID(n,i,o.bytes))}else if(e[cidSymbol]===!0){const{version:n,multihash:i,code:o}=e,a=decode3(i);return C.create(n,o,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==DAG_PB_CODE)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);return new C(t,e,n,n.bytes)}case 1:{const i=encodeCID(t,e,n.bytes);return new C(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return C.create(0,DAG_PB_CODE,t)}static createV1(t,e){return C.create(1,t,e)}static decode(t){const[e,n]=C.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){const e=C.inspectBytes(t),n=e.size-e.multihashSize,i=coerce(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");const o=i.subarray(e.multihashSize-e.digestSize),a=new Digest(e.multihashCode,e.digestSize,o,i);return[e.version===0?C.createV0(a):C.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0;const n=()=>{const[g,b]=decode2(t.subarray(e));return e+=b,g};let i=n(),o=DAG_PB_CODE;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);const a=e,s=n(),u=n(),h=e+u,f=h-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:h}}static parse(t,e){const[n,i]=parseCIDtoBytes(t,e),o=C.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(o).set(n,t),o}},parseCIDtoBytes=(r,t)=>{switch(r[0]){case"Q":{const e=t||base58btc;return[base58btc.prefix,e.decode(`${base58btc.prefix}${r}`)]}case base58btc.prefix:{const e=t||base58btc;return[base58btc.prefix,e.decode(r)]}case base32.prefix:{const e=t||base32;return[base32.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},toStringV0=(r,t,e)=>{const{prefix:n}=e;if(n!==base58btc.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);const i=t.get(n);if(i==null){const o=e.encode(r).slice(1);return t.set(n,o),o}else return i},toStringV1=(r,t,e)=>{const{prefix:n}=e,i=t.get(n);if(i==null){const o=e.encode(r);return t.set(n,o),o}else return i},DAG_PB_CODE=112,SHA_256_CODE=18,encodeCID=(r,t,e)=>{const n=encodingLength(r),i=n+encodingLength(t),o=new Uint8Array(i+e.byteLength);return encodeTo(r,o,0),encodeTo(t,o,n),o.set(e,i),o},cidSymbol=Symbol.for("@ipld/js-cid/CID");__toESM(require_err_code());function isAsyncIterable(r){return r[Symbol.asyncIterator]!=null}function batch(r,t=1){return t=Number(t),isAsyncIterable(r)?(async function*(){let e=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for await(const n of r)for(e.push(n);e.length>=t;)yield e.slice(0,t),e=e.slice(t);for(;e.length>0;)yield e.slice(0,t),e=e.slice(t)})():(function*(){let e=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for(const n of r)for(e.push(n);e.length>=t;)yield e.slice(0,t),e=e.slice(t);for(;e.length>0;)yield e.slice(0,t),e=e.slice(t)})()}var src_default=batch;async function*parallelBatch(r,t=1){for await(const e of src_default(r,t)){const n=e.map(async i=>i().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let i=0;i<n.length;i++){const o=await n[i];if(o.ok)yield o.value;else throw o.err}}}function asUint8Array(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function alloc(r=0){var t;return((t=globalThis.Buffer)==null?void 0:t.alloc)!=null?asUint8Array(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function allocUnsafe(r=0){var t;return((t=globalThis.Buffer)==null?void 0:t.allocUnsafe)!=null?asUint8Array(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function concat(r,t){t==null&&(t=r.reduce((i,o)=>i+o.length,0));const e=allocUnsafe(t);let n=0;for(const i of r)e.set(i,n),n+=i.length;return asUint8Array(e)}function equals3(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var symbol=Symbol.for("@achingbrain/uint8arraylist");function findBufAndOffset(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(const n of r){const i=e+n.byteLength;if(t<i)return{buf:n,index:t-e};e=i}throw new RangeError("index is out of bounds")}function isUint8ArrayList(r){return!!(r!=null&&r[symbol])}var Uint8ArrayList=class M{constructor(...t){Object.defineProperty(this,symbol,{value:!0}),this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(const n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(isUint8ArrayList(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(const n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(isUint8ArrayList(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){const e=findBufAndOffset(this.bufs,t);return e.buf[e.index]}set(t,e){const n=findBufAndOffset(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(isUint8ArrayList(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){const{bufs:n,length:i}=this._subList(t,e);return concat(n,i)}subarray(t,e){const{bufs:n,length:i}=this._subList(t,e);return n.length===1?n[0]:concat(n,i)}sublist(t,e){const{bufs:n,length:i}=this._subList(t,e),o=new M;return o.length=i,o.bufs=n,o}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:[...this.bufs],length:this.length};const n=[];let i=0;for(let o=0;o<this.bufs.length;o++){const a=this.bufs[o],s=i,u=s+a.byteLength;if(i=u,t>=u)continue;const h=t>=s&&t<u,f=e>s&&e<=u;if(h&&f){if(t===s&&e===u){n.push(a);break}const g=t-s;n.push(a.subarray(g,g+(e-t)));break}if(h){if(t===0){n.push(a);continue}n.push(a.subarray(t-s));continue}if(f){if(e===u){n.push(a);break}n.push(a.subarray(0,e-s));break}n.push(a)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!isUint8ArrayList(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;const i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");const o=256,a=new Int32Array(o);for(let g=0;g<o;g++)a[g]=-1;for(let g=0;g<i;g++)a[n[g]]=g;const s=a,u=this.byteLength-n.byteLength,h=n.byteLength-1;let f;for(let g=e;g<=u;g+=f){f=0;for(let b=h;b>=0;b--){const y=this.get(g+b);if(n[b]!==y){f=Math.max(1,b-s[y]);break}}if(f===0)return g}return-1}getInt8(t){const e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){const n=allocUnsafe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){const n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){const i=alloc(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,e,n),this.write(i,t)}getInt32(t,e){const n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){const i=alloc(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,e,n),this.write(i,t)}getBigInt64(t,e){const n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){const i=alloc(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,e,n),this.write(i,t)}getUint8(t){const e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){const n=allocUnsafe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){const n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){const i=alloc(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,e,n),this.write(i,t)}getUint32(t,e){const n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){const i=alloc(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,e,n),this.write(i,t)}getBigUint64(t,e){const n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){const i=alloc(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,e,n),this.write(i,t)}getFloat32(t,e){const n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){const i=alloc(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,e,n),this.write(i,t)}getFloat64(t,e){const n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){const i=alloc(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,e,n),this.write(i,t)}equals(t){if(t==null||!(t instanceof M)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!equals3(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){const n=new M;return n.bufs=t,e==null&&(e=t.reduce((i,o)=>i+o.byteLength,0)),n.length=e,n}},DEFAULT_CHUNK_SIZE=262144,fixedSize=(r={})=>{const t=r.chunkSize??DEFAULT_CHUNK_SIZE;return async function*(n){let i=new Uint8ArrayList,o=0,a=!1;for await(const s of n)for(i.append(s),o+=s.length;o>=t;)if(yield i.slice(0,t),a=!0,t===i.length)i=new Uint8ArrayList,o=0;else{const u=new Uint8ArrayList;u.append(i.sublist(t)),i=u,o-=t}(!a||o>0)&&(yield i.subarray(0,o))}},src_exports={};__export(src_exports,{code:()=>code,createLink:()=>createLink,createNode:()=>createNode,decode:()=>decode5,encode:()=>encode3,name:()=>name,prepare:()=>prepare,validate:()=>validate});var textDecoder=new TextDecoder;function decodeVarint(r,t){let e=0;for(let n=0;;n+=7){if(n>=64)throw new Error("protobuf: varint overflow");if(t>=r.length)throw new Error("protobuf: unexpected end of data");const i=r[t++];if(e+=n<28?(i&127)<<n:(i&127)*2**n,i<128)break}return[e,t]}function decodeBytes(r,t){let e;[e,t]=decodeVarint(r,t);const n=t+e;if(e<0||n<0)throw new Error("protobuf: invalid length");if(n>r.length)throw new Error("protobuf: unexpected end of data");return[r.subarray(t,n),n]}function decodeKey(r,t){let e;return[e,t]=decodeVarint(r,t),[e&7,e>>3,t]}function decodeLink(r){const t={},e=r.length;let n=0;for(;n<e;){let i,o;if([i,o,n]=decodeKey(r,n),o===1){if(t.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Hash`);if(t.Name!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[t.Hash,n]=decodeBytes(r,n)}else if(o===2){if(t.Name!==void 0)throw new Error("protobuf: (PBLink) duplicate Name section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Name`);if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let a;[a,n]=decodeBytes(r,n),t.Name=textDecoder.decode(a)}else if(o===3){if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(i!==0)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Tsize`);[t.Tsize,n]=decodeVarint(r,n)}else throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${o}`)}if(n>e)throw new Error("protobuf: (PBLink) unexpected end of data");return t}function decodeNode(r){const t=r.length;let e=0,n,i=!1,o;for(;e<t;){let s,u;if([s,u,e]=decodeKey(r,e),s!==2)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${s}`);if(u===1){if(o)throw new Error("protobuf: (PBNode) duplicate Data section");[o,e]=decodeBytes(r,e),n&&(i=!0)}else if(u===2){if(i)throw new Error("protobuf: (PBNode) duplicate Links section");n||(n=[]);let h;[h,e]=decodeBytes(r,e),n.push(decodeLink(h))}else throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${u}`)}if(e>t)throw new Error("protobuf: (PBNode) unexpected end of data");const a={};return o&&(a.Data=o),a.Links=n||[],a}var textEncoder=new TextEncoder,maxInt32=2**32,maxUInt32=2**31;function encodeLink(r,t){let e=t.length;if(typeof r.Tsize=="number"){if(r.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(r.Tsize))throw new Error("Tsize too large for encoding");e=encodeVarint(t,e,r.Tsize)-1,t[e]=24}if(typeof r.Name=="string"){const n=textEncoder.encode(r.Name);e-=n.length,t.set(n,e),e=encodeVarint(t,e,n.length)-1,t[e]=18}return r.Hash&&(e-=r.Hash.length,t.set(r.Hash,e),e=encodeVarint(t,e,r.Hash.length)-1,t[e]=10),t.length-e}function encodeNode(r){const t=sizeNode(r),e=new Uint8Array(t);let n=t;if(r.Data&&(n-=r.Data.length,e.set(r.Data,n),n=encodeVarint(e,n,r.Data.length)-1,e[n]=10),r.Links)for(let i=r.Links.length-1;i>=0;i--){const o=encodeLink(r.Links[i],e.subarray(0,n));n-=o,n=encodeVarint(e,n,o)-1,e[n]=18}return e}function sizeLink(r){let t=0;if(r.Hash){const e=r.Hash.length;t+=1+e+sov(e)}if(typeof r.Name=="string"){const e=textEncoder.encode(r.Name).length;t+=1+e+sov(e)}return typeof r.Tsize=="number"&&(t+=1+sov(r.Tsize)),t}function sizeNode(r){let t=0;if(r.Data){const e=r.Data.length;t+=1+e+sov(e)}if(r.Links)for(const e of r.Links){const n=sizeLink(e);t+=1+n+sov(n)}return t}function encodeVarint(r,t,e){t-=sov(e);const n=t;for(;e>=maxUInt32;)r[t++]=e&127|128,e/=128;for(;e>=128;)r[t++]=e&127|128,e>>>=7;return r[t]=e,n}function sov(r){return r%2===0&&r++,Math.floor((len64(r)+6)/7)}function len64(r){let t=0;return r>=maxInt32&&(r=Math.floor(r/maxInt32),t=32),r>=65536&&(r>>>=16,t+=16),r>=256&&(r>>>=8,t+=8),t+len8tab[r]}var len8tab=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8],pbNodeProperties=["Data","Links"],pbLinkProperties=["Hash","Name","Tsize"],textEncoder2=new TextEncoder;function linkComparator(r,t){if(r===t)return 0;const e=r.Name?textEncoder2.encode(r.Name):[],n=t.Name?textEncoder2.encode(t.Name):[];let i=e.length,o=n.length;for(let a=0,s=Math.min(i,o);a<s;++a)if(e[a]!==n[a]){i=e[a],o=n[a];break}return i<o?-1:o<i?1:0}function hasOnlyProperties(r,t){return!Object.keys(r).some(e=>!t.includes(e))}function asLink(r){if(typeof r.asCID=="object"){const e=CID.asCID(r);if(!e)throw new TypeError("Invalid DAG-PB form");return{Hash:e}}if(typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form");const t={};if(r.Hash){let e=CID.asCID(r.Hash);try{e||(typeof r.Hash=="string"?e=CID.parse(r.Hash):r.Hash instanceof Uint8Array&&(e=CID.decode(r.Hash)))}catch(n){throw new TypeError(`Invalid DAG-PB form: ${n.message}`)}e&&(t.Hash=e)}if(!t.Hash)throw new TypeError("Invalid DAG-PB form");return typeof r.Name=="string"&&(t.Name=r.Name),typeof r.Tsize=="number"&&(t.Tsize=r.Tsize),t}function prepare(r){if((r instanceof Uint8Array||typeof r=="string")&&(r={Data:r}),typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form");const t={};if(r.Data!==void 0)if(typeof r.Data=="string")t.Data=textEncoder2.encode(r.Data);else if(r.Data instanceof Uint8Array)t.Data=r.Data;else throw new TypeError("Invalid DAG-PB form");if(r.Links!==void 0)if(Array.isArray(r.Links))t.Links=r.Links.map(asLink),t.Links.sort(linkComparator);else throw new TypeError("Invalid DAG-PB form");else t.Links=[];return t}function validate(r){if(!r||typeof r!="object"||Array.isArray(r)||r instanceof Uint8Array||r["/"]&&r["/"]===r.bytes)throw new TypeError("Invalid DAG-PB form");if(!hasOnlyProperties(r,pbNodeProperties))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(r.Data!==void 0&&!(r.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be bytes)");if(!Array.isArray(r.Links))throw new TypeError("Invalid DAG-PB form (Links must be a list)");for(let t=0;t<r.Links.length;t++){const e=r.Links[t];if(!e||typeof e!="object"||Array.isArray(e)||e instanceof Uint8Array||e["/"]&&e["/"]===e.bytes)throw new TypeError("Invalid DAG-PB form (bad link)");if(!hasOnlyProperties(e,pbLinkProperties))throw new TypeError("Invalid DAG-PB form (extraneous properties on link)");if(e.Hash===void 0)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(e.Hash==null||!e.Hash["/"]||e.Hash["/"]!==e.Hash.bytes)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(e.Name!==void 0&&typeof e.Name!="string")throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(e.Tsize!==void 0){if(typeof e.Tsize!="number"||e.Tsize%1!==0)throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(e.Tsize<0)throw new TypeError("Invalid DAG-PB form (link Tsize cannot be negative)")}if(t>0&&linkComparator(e,r.Links[t-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function createNode(r,t=[]){return prepare({Data:r,Links:t})}function createLink(r,t,e){return asLink({Hash:e,Name:r,Tsize:t})}var name="dag-pb",code=112;function encode3(r){validate(r);const t={};return r.Links&&(t.Links=r.Links.map(e=>{const n={};return e.Hash&&(n.Hash=e.Hash.bytes),e.Name!==void 0&&(n.Name=e.Name),e.Tsize!==void 0&&(n.Tsize=e.Tsize),n})),r.Data&&(t.Data=r.Data),encodeNode(t)}function decode5(r){const t=decodeNode(r),e={};return t.Data&&(e.Data=t.Data),t.Links&&(e.Links=t.Links.map(n=>{const i={};try{i.Hash=CID.decode(n.Hash)}catch{}if(!i.Hash)throw new Error("Invalid Hash field found in link, expected CID");return n.Name!==void 0&&(i.Name=n.Name),n.Tsize!==void 0&&(i.Tsize=n.Tsize),i})),e}var import_err_code=__toESM(require_err_code()),import_reader=__toESM(require_reader()),import_reader_buffer=__toESM(require_reader_buffer()),import_minimal=__toESM(require_minimal()),import_writer=__toESM(require_writer()),import_writer_buffer=__toESM(require_writer_buffer());function configure(){import_minimal.default._configure(),import_reader.default._configure(import_reader_buffer.default),import_writer.default._configure(import_writer_buffer.default)}configure();var methods=["uint64","int64","sint64","fixed64","sfixed64"];function patchReader(r){for(const t of methods){if(r[t]==null)continue;const e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function reader(r){return patchReader(new import_reader.default(r))}function patchWriter(r){for(const t of methods){if(r[t]==null)continue;const e=r[t];r[t]=function(n){return e.call(this,n.toString())}}return r}function writer(){return patchWriter(import_writer.default.create())}function decodeMessage(r,t){const e=reader(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function encodeMessage(r,t){const e=writer();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var CODEC_TYPES;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function enumeration(r){function t(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}const e=function(o,a){const s=t(o);a.int32(s)},n=function(o){const a=o.int32();return t(a)};return createCodec("enum",CODEC_TYPES.VARINT,e,n)}function message(r,t){return createCodec("message",CODEC_TYPES.LENGTH_DELIMITED,r,t)}var Data;(function(r){(function(n){n.Raw="Raw",n.Directory="Directory",n.File="File",n.Metadata="Metadata",n.Symlink="Symlink",n.HAMTShard="HAMTShard"})(r.DataType||(r.DataType={}));let t;(function(n){n[n.Raw=0]="Raw",n[n.Directory=1]="Directory",n[n.File=2]="File",n[n.Metadata=3]="Metadata",n[n.Symlink=4]="Symlink",n[n.HAMTShard=5]="HAMTShard"})(t||(t={})),(function(n){n.codec=()=>enumeration(t)})(r.DataType||(r.DataType={}));let e;r.codec=()=>(e==null&&(e=message((n,i,o={})=>{if(o.lengthDelimited!==!1&&i.fork(),n.Type!=null&&(i.uint32(8),r.DataType.codec().encode(n.Type,i)),n.Data!=null&&(i.uint32(18),i.bytes(n.Data)),n.filesize!=null&&(i.uint32(24),i.uint64(n.filesize)),n.blocksizes!=null)for(const a of n.blocksizes)i.uint32(32),i.uint64(a);n.hashType!=null&&(i.uint32(40),i.uint64(n.hashType)),n.fanout!=null&&(i.uint32(48),i.uint64(n.fanout)),n.mode!=null&&(i.uint32(56),i.uint32(n.mode)),n.mtime!=null&&(i.uint32(66),UnixTime.codec().encode(n.mtime,i)),o.lengthDelimited!==!1&&i.ldelim()},(n,i)=>{const o={blocksizes:[]},a=i==null?n.len:n.pos+i;for(;n.pos<a;){const s=n.uint32();switch(s>>>3){case 1:o.Type=r.DataType.codec().decode(n);break;case 2:o.Data=n.bytes();break;case 3:o.filesize=n.uint64();break;case 4:o.blocksizes.push(n.uint64());break;case 5:o.hashType=n.uint64();break;case 6:o.fanout=n.uint64();break;case 7:o.mode=n.uint32();break;case 8:o.mtime=UnixTime.codec().decode(n,n.uint32());break;default:n.skipType(s&7);break}}return o})),e),r.encode=n=>encodeMessage(n,r.codec()),r.decode=n=>decodeMessage(n,r.codec())})(Data||(Data={}));var UnixTime;(function(r){let t;r.codec=()=>(t==null&&(t=message((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.Seconds!=null&&(n.uint32(8),n.int64(e.Seconds)),e.FractionalNanoseconds!=null&&(n.uint32(21),n.fixed32(e.FractionalNanoseconds)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{const i={},o=n==null?e.len:e.pos+n;for(;e.pos<o;){const a=e.uint32();switch(a>>>3){case 1:i.Seconds=e.int64();break;case 2:i.FractionalNanoseconds=e.fixed32();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>encodeMessage(e,r.codec()),r.decode=e=>decodeMessage(e,r.codec())})(UnixTime||(UnixTime={}));var Metadata;(function(r){let t;r.codec=()=>(t==null&&(t=message((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.MimeType!=null&&(n.uint32(10),n.string(e.MimeType)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{const i={},o=n==null?e.len:e.pos+n;for(;e.pos<o;){const a=e.uint32();switch(a>>>3){case 1:i.MimeType=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>encodeMessage(e,r.codec()),r.decode=e=>decodeMessage(e,r.codec())})(Metadata||(Metadata={}));var types={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},dirTypes=["directory","hamt-sharded-directory"],DEFAULT_FILE_MODE=parseInt("0644",8),DEFAULT_DIRECTORY_MODE=parseInt("0755",8),UnixFS=class P{constructor(t={type:"file"}){D(this,"type");D(this,"data");D(this,"blockSizes");D(this,"hashType");D(this,"fanout");D(this,"mtime");D(this,"_mode");D(this,"_originalMode");const{type:e,data:n,blockSizes:i,hashType:o,fanout:a,mtime:s,mode:u}=t;if(e!=null&&!Object.values(types).includes(e))throw(0,import_err_code.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e??"file",this.data=n,this.hashType=o,this.fanout=a,this.blockSizes=i??[],this._originalMode=0,this.mode=u,this.mtime=s}static unmarshal(t){const e=Data.decode(t),n=new P({type:types[e.Type!=null?e.Type.toString():"File"],data:e.Data,blockSizes:e.blocksizes,mode:e.mode,mtime:e.mtime!=null?{secs:e.mtime.Seconds??0n,nsecs:e.mtime.FractionalNanoseconds}:void 0});return n._originalMode=e.mode??0,n}set mode(t){t==null?this._mode=this.isDirectory()?DEFAULT_DIRECTORY_MODE:DEFAULT_FILE_MODE:this._mode=t&4095}get mode(){return this._mode}isDirectory(){return dirTypes.includes(this.type)}addBlockSize(t){this.blockSizes.push(t)}removeBlockSize(t){this.blockSizes.splice(t,1)}fileSize(){if(this.isDirectory())return 0n;let t=0n;return this.blockSizes.forEach(e=>{t+=e}),this.data!=null&&(t+=BigInt(this.data.length)),t}marshal(){let t;switch(this.type){case"raw":t=Data.DataType.Raw;break;case"directory":t=Data.DataType.Directory;break;case"file":t=Data.DataType.File;break;case"metadata":t=Data.DataType.Metadata;break;case"symlink":t=Data.DataType.Symlink;break;case"hamt-sharded-directory":t=Data.DataType.HAMTShard;break;default:throw(0,import_err_code.default)(new Error(`Type: ${t} is not valid`),"ERR_INVALID_TYPE")}let e=this.data;(this.data==null||this.data.length===0)&&(e=void 0);let n;this.mode!=null&&(n=this._originalMode&4294963200|(this.mode??0),n===DEFAULT_FILE_MODE&&!this.isDirectory()&&(n=void 0),n===DEFAULT_DIRECTORY_MODE&&this.isDirectory()&&(n=void 0));let i;return this.mtime!=null&&(i={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),Data.encode({Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:n,mtime:i})}},raw_exports={};__export(raw_exports,{code:()=>code2,decode:()=>decode6,encode:()=>encode4,name:()=>name2});var equals4=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},coerce2=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},name2="raw",code2=85,encode4=r=>coerce2(r),decode6=r=>coerce2(r),CustomProgressEvent=class extends Event{constructor(r,t){super(r),this.detail=t}},encode_12=encode5,MSB2=128,MSBALL2=-128,INT2=Math.pow(2,31);function encode5(r,t,e){t=t||[],e=e||0;for(var n=e;r>=INT2;)t[e++]=r&255|MSB2,r/=128;for(;r&MSBALL2;)t[e++]=r&255|MSB2,r>>>=7;return t[e]=r|0,encode5.bytes=e-n+1,t}var decode7=read2,MSB$12=128,REST$12=127;function read2(r,n){var e=0,n=n||0,i=0,o=n,a,s=r.length;do{if(o>=s)throw read2.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&REST$12)<<i:(a&REST$12)*Math.pow(2,i),i+=7}while(a>=MSB$12);return read2.bytes=o-n,e}var N12=Math.pow(2,7),N22=Math.pow(2,14),N32=Math.pow(2,21),N42=Math.pow(2,28),N52=Math.pow(2,35),N62=Math.pow(2,42),N72=Math.pow(2,49),N82=Math.pow(2,56),N92=Math.pow(2,63),length2=function(r){return r<N12?1:r<N22?2:r<N32?3:r<N42?4:r<N52?5:r<N62?6:r<N72?7:r<N82?8:r<N92?9:10},varint2={encode:encode_12,decode:decode7,encodingLength:length2},_brrp_varint2=varint2,varint_default2=_brrp_varint2,decode8=(r,t=0)=>[varint_default2.decode(r,t),varint_default2.decode.bytes],encodeTo2=(r,t,e=0)=>(varint_default2.encode(r,t,e),t),encodingLength2=r=>varint_default2.encodingLength(r),create2=(r,t)=>{const e=t.byteLength,n=encodingLength2(r),i=n+encodingLength2(e),o=new Uint8Array(i+e);return encodeTo2(r,o,0),encodeTo2(e,o,n),o.set(t,i),new Digest2(r,e,t,o)},decode9=r=>{const t=coerce2(r),[e,n]=decode8(t),[i,o]=decode8(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Digest2(e,i,a,t)},equals5=(r,t)=>{if(r===t)return!0;{const e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&equals4(r.bytes,e.bytes)}},Digest2=class{constructor(r,t,e,n){this.code=r,this.size=t,this.digest=e,this.bytes=n}};function base2(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var s=r.length,u=r.charAt(0),h=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var c=0,d=0,w=0,v=l.length;w!==v&&l[w]===0;)w++,c++;for(var p=(v-w)*f+1>>>0,m=new Uint8Array(p);w!==v;){for(var _=l[w],A=0,E=p-1;(_!==0||A<d)&&E!==-1;E--,A++)_+=256*m[E]>>>0,m[E]=_%s>>>0,_=_/s>>>0;if(_!==0)throw new Error("Non-zero carry");d=A,w++}for(var S=p-d;S!==p&&m[S]===0;)S++;for(var x=u.repeat(c);S<p;++S)x+=r.charAt(m[S]);return x}function b(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var c=0;if(l[c]!==" "){for(var d=0,w=0;l[c]===u;)d++,c++;for(var v=(l.length-c)*h+1>>>0,p=new Uint8Array(v);l[c];){var m=e[l.charCodeAt(c)];if(m===255)return;for(var _=0,A=v-1;(m!==0||_<w)&&A!==-1;A--,_++)m+=s*p[A]>>>0,p[A]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");w=_,c++}if(l[c]!==" "){for(var E=v-w;E!==v&&p[E]===0;)E++;for(var S=new Uint8Array(d+(v-E)),x=d;E!==v;)S[x++]=p[E++];return S}}}function y(l){var c=b(l);if(c)return c;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:b,decode:y}}var src2=base2,_brrp__multiformats_scope_baseX2=src2,base_x_default2=_brrp__multiformats_scope_baseX2,Encoder2=class{constructor(r,t,e){this.name=r,this.prefix=t,this.baseEncode=e}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},Decoder2=class{constructor(r,t,e){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=e}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return or2(this,r)}},ComposedDecoder2=class{constructor(r){this.decoders=r}or(r){return or2(this,r)}decode(r){const t=r[0],e=this.decoders[t];if(e)return e.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or2=(r,t)=>new ComposedDecoder2({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Codec2=class{constructor(r,t,e,n){this.name=r,this.prefix=t,this.baseEncode=e,this.baseDecode=n,this.encoder=new Encoder2(r,t,e),this.decoder=new Decoder2(r,t,n)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},from2=({name:r,prefix:t,encode:e,decode:n})=>new Codec2(r,t,e,n),baseX2=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=base_x_default2(e,t);return from2({prefix:r,name:t,encode:n,decode:o=>coerce2(i(o))})},decode10=(r,t,e,n)=>{const i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;const a=new Uint8Array(o*e/8|0);let s=0,u=0,h=0;for(let f=0;f<o;++f){const g=i[r[f]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<e|g,s+=e,s>=8&&(s-=8,a[h++]=255&u>>s)}if(s>=e||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode6=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let o="",a=0,s=0;for(let u=0;u<r.length;++u)for(s=s<<8|r[u],a+=8;a>e;)a-=e,o+=t[i&s>>a];if(a&&(o+=t[i&s<<e-a]),n)for(;o.length*e&7;)o+="=";return o},rfc46482=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>from2({prefix:t,name:r,encode(i){return encode6(i,n,e)},decode(i){return decode10(i,n,e,r)}}),base58btc2=baseX2({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"});baseX2({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var base322=rfc46482({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5});rfc46482({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rfc46482({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rfc46482({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rfc46482({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rfc46482({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rfc46482({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),rfc46482({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rfc46482({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var format2=(r,t)=>{const{bytes:e,version:n}=r;switch(n){case 0:return toStringV02(e,baseCache2(r),t||base58btc2.encoder);default:return toStringV12(e,baseCache2(r),t||base322.encoder)}},cache2=new WeakMap,baseCache2=r=>{const t=cache2.get(r);if(t==null){const e=new Map;return cache2.set(r,e),e}return t},CID2=class k{constructor(t,e,n,i){this.code=e,this.version=t,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:{const{code:t,multihash:e}=this;if(t!==DAG_PB_CODE2)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==SHA_256_CODE2)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return k.createV0(e)}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:{const{code:t,digest:e}=this.multihash,n=create2(t,e);return k.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(t){return k.equals(this,t)}static equals(t,e){const n=e;return n&&t.code===n.code&&t.version===n.version&&equals5(t.multihash,n.multihash)}toString(t){return format2(this,t)}toJSON(){return{"/":format2(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;const e=t;if(e instanceof k)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){const{version:n,code:i,multihash:o,bytes:a}=e;return new k(n,i,o,a||encodeCID2(n,i,o.bytes))}else if(e[cidSymbol2]===!0){const{version:n,multihash:i,code:o}=e,a=decode9(i);return k.create(n,o,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==DAG_PB_CODE2)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE2}) block encoding`);return new k(t,e,n,n.bytes)}case 1:{const i=encodeCID2(t,e,n.bytes);return new k(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return k.create(0,DAG_PB_CODE2,t)}static createV1(t,e){return k.create(1,t,e)}static decode(t){const[e,n]=k.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){const e=k.inspectBytes(t),n=e.size-e.multihashSize,i=coerce2(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");const o=i.subarray(e.multihashSize-e.digestSize),a=new Digest2(e.multihashCode,e.digestSize,o,i);return[e.version===0?k.createV0(a):k.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0;const n=()=>{const[g,b]=decode8(t.subarray(e));return e+=b,g};let i=n(),o=DAG_PB_CODE2;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);const a=e,s=n(),u=n(),h=e+u,f=h-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:h}}static parse(t,e){const[n,i]=parseCIDtoBytes2(t,e),o=k.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache2(o).set(n,t),o}},parseCIDtoBytes2=(r,t)=>{switch(r[0]){case"Q":{const e=t||base58btc2;return[base58btc2.prefix,e.decode(`${base58btc2.prefix}${r}`)]}case base58btc2.prefix:{const e=t||base58btc2;return[base58btc2.prefix,e.decode(r)]}case base322.prefix:{const e=t||base322;return[base322.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},toStringV02=(r,t,e)=>{const{prefix:n}=e;if(n!==base58btc2.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);const i=t.get(n);if(i==null){const o=e.encode(r).slice(1);return t.set(n,o),o}else return i},toStringV12=(r,t,e)=>{const{prefix:n}=e,i=t.get(n);if(i==null){const o=e.encode(r);return t.set(n,o),o}else return i},DAG_PB_CODE2=112,SHA_256_CODE2=18,encodeCID2=(r,t,e)=>{const n=encodingLength2(r),i=n+encodingLength2(t),o=new Uint8Array(i+e.byteLength);return encodeTo2(r,o,0),encodeTo2(t,o,n),o.set(e,i),o},cidSymbol2=Symbol.for("@ipld/js-cid/CID"),import_crypto=__toESM(requireCryptoBrowserify()),from3=({name:r,code:t,encode:e})=>new Hasher(r,t,e),Hasher=class{constructor(r,t,e){this.name=r,this.code=t,this.encode=e}digest(r){if(r instanceof Uint8Array){const t=this.encode(r);return t instanceof Uint8Array?create2(this.code,t):t.then(e=>create2(this.code,e))}else throw Error("Unknown type, must be binary type")}},sha256=from3({name:"sha2-256",code:18,encode:r=>coerce2(import_crypto.default.createHash("sha256").update(r).digest())}),persist=async(r,t,e)=>{e.codec==null&&(e.codec=src_exports);const n=await sha256.digest(r),i=CID2.create(e.cidVersion,e.codec.code,n);return await t.put(i,r,e),i};function defaultBufferImporter(r){return async function*(e,n){let i=0n;for await(let o of e.content)yield async()=>{var h;let a;const s={codec:src_exports,cidVersion:r.cidVersion,onProgress:r.onProgress};r.rawLeaves?(s.codec=raw_exports,s.cidVersion=1):(a=new UnixFS({type:r.leafType,data:o}),o=encode3({Data:a.marshal(),Links:[]}));const u=await persist(o,n,s);return i+=BigInt(o.byteLength),(h=r.onProgress)==null||h.call(r,new CustomProgressEvent("unixfs:importer:progress:file:write",{bytesWritten:i,cid:u,path:e.path})),{cid:u,unixfs:a,size:BigInt(o.length),block:o}}}}var import_err_code2=__toESM(require_err_code()),dirBuilder=async(r,t,e)=>{const n=new UnixFS({type:"directory",mtime:r.mtime,mode:r.mode}),i=encode3(prepare({Data:n.marshal()})),o=await persist(i,t,e),a=r.path;return{cid:o,path:a,unixfs:n,size:BigInt(i.length),originalPath:r.originalPath,block:i}};async function*buildFileBatch(r,t,e){let n=-1,i;for await(const o of parallelBatch(e.bufferImporter(r,t),e.blockWriteConcurrency)){if(n++,n===0){i={...o,single:!0};continue}else n===1&&i!=null&&(yield{...i,block:void 0,single:void 0},i=void 0);yield{...o,block:void 0}}i!=null&&(yield i)}function isSingleBlockImport(r){return r.single===!0}var reduce=(r,t,e)=>async function(i){var f,g;if(i.length===1&&isSingleBlockImport(i[0])&&e.reduceSingleLeafToSelf){const b=i[0];let y=b.block;return isSingleBlockImport(b)&&(r.mtime!==void 0||r.mode!==void 0)&&(b.unixfs=new UnixFS({type:"file",mtime:r.mtime,mode:r.mode,data:b.block}),y={Data:b.unixfs.marshal(),Links:[]},b.block=encode3(prepare(y)),b.cid=await persist(b.block,t,{...e,cidVersion:e.cidVersion}),b.size=BigInt(b.block.length)),(f=e.onProgress)==null||f.call(e,new CustomProgressEvent("unixfs:importer:progress:file:layout",{cid:b.cid,path:b.originalPath})),{cid:b.cid,path:r.path,unixfs:b.unixfs,size:b.size,originalPath:b.originalPath}}const o=new UnixFS({type:"file",mtime:r.mtime,mode:r.mode}),a=i.filter(b=>{var y,l;return b.cid.code===code2&&b.size>0||b.unixfs!=null&&b.unixfs.data==null&&b.unixfs.fileSize()>0n?!0:!!((l=(y=b.unixfs)==null?void 0:y.data)!=null&&l.length)}).map(b=>{var y;return b.cid.code===code2?(o.addBlockSize(b.size),{Name:"",Tsize:Number(b.size),Hash:b.cid}):(b.unixfs==null||b.unixfs.data==null?o.addBlockSize(((y=b.unixfs)==null?void 0:y.fileSize())??0n):o.addBlockSize(BigInt(b.unixfs.data.length)),{Name:"",Tsize:Number(b.size),Hash:b.cid})}),s={Data:o.marshal(),Links:a},u=encode3(prepare(s)),h=await persist(u,t,e);return(g=e.onProgress)==null||g.call(e,new CustomProgressEvent("unixfs:importer:progress:file:layout",{cid:h,path:r.originalPath})),{cid:h,path:r.path,unixfs:o,size:BigInt(u.length+s.Links.reduce((b,y)=>b+(y.Tsize??0),0)),originalPath:r.originalPath,block:u}},fileBuilder=async(r,t,e)=>e.layout(buildFileBatch(r,t,e),reduce(r,t,e));function isIterable(r){return Symbol.iterator in r}function isAsyncIterable2(r){return Symbol.asyncIterator in r}function contentAsAsyncIterable(r){try{if(r instanceof Uint8Array)return(async function*(){yield r})();if(isIterable(r))return(async function*(){yield*r})();if(isAsyncIterable2(r))return r}catch{throw(0,import_err_code2.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,import_err_code2.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}function defaultDagBuilder(r){return async function*(e,n){for await(const i of e){let o;if(i.path!=null&&(o=i.path,i.path=i.path.split("/").filter(a=>a!=null&&a!==".").join("/")),isFileCandidate(i)){const a={path:i.path,mtime:i.mtime,mode:i.mode,content:(async function*(){var u;let s=0n;for await(const h of r.chunker(r.chunkValidator(contentAsAsyncIterable(i.content)))){const f=BigInt(h.byteLength);s+=f,(u=r.onProgress)==null||u.call(r,new CustomProgressEvent("unixfs:importer:progress:file:read",{bytesRead:s,chunkSize:f,path:i.path})),yield h}})(),originalPath:o};yield async()=>fileBuilder(a,n,r)}else if(i.path!=null){const a={path:i.path,mtime:i.mtime,mode:i.mode,originalPath:o};yield async()=>dirBuilder(a,n,r)}else throw new Error("Import candidate must have content or path or both")}}}function isFileCandidate(r){return r.content!=null}var import_err_code3=__toESM(require_err_code()),identity_exports={};__export(identity_exports,{identity:()=>identity});function base3(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var s=r.length,u=r.charAt(0),h=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var c=0,d=0,w=0,v=l.length;w!==v&&l[w]===0;)w++,c++;for(var p=(v-w)*f+1>>>0,m=new Uint8Array(p);w!==v;){for(var _=l[w],A=0,E=p-1;(_!==0||A<d)&&E!==-1;E--,A++)_+=256*m[E]>>>0,m[E]=_%s>>>0,_=_/s>>>0;if(_!==0)throw new Error("Non-zero carry");d=A,w++}for(var S=p-d;S!==p&&m[S]===0;)S++;for(var x=u.repeat(c);S<p;++S)x+=r.charAt(m[S]);return x}function b(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var c=0;if(l[c]!==" "){for(var d=0,w=0;l[c]===u;)d++,c++;for(var v=(l.length-c)*h+1>>>0,p=new Uint8Array(v);l[c];){var m=e[l.charCodeAt(c)];if(m===255)return;for(var _=0,A=v-1;(m!==0||_<w)&&A!==-1;A--,_++)m+=s*p[A]>>>0,p[A]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");w=_,c++}if(l[c]!==" "){for(var E=v-w;E!==v&&p[E]===0;)E++;for(var S=new Uint8Array(d+(v-E)),x=d;E!==v;)S[x++]=p[E++];return S}}}function y(l){var c=b(l);if(c)return c;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:b,decode:y}}var src3=base3,_brrp__multiformats_scope_baseX3=src3,base_x_default3=_brrp__multiformats_scope_baseX3,coerce3=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},fromString2=r=>new TextEncoder().encode(r),toString2=r=>new TextDecoder().decode(r),Encoder3=class{constructor(r,t,e){this.name=r,this.prefix=t,this.baseEncode=e}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},Decoder3=class{constructor(r,t,e){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=e}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return or3(this,r)}},ComposedDecoder3=class{constructor(r){this.decoders=r}or(r){return or3(this,r)}decode(r){const t=r[0],e=this.decoders[t];if(e)return e.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or3=(r,t)=>new ComposedDecoder3({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Codec3=class{constructor(r,t,e,n){this.name=r,this.prefix=t,this.baseEncode=e,this.baseDecode=n,this.encoder=new Encoder3(r,t,e),this.decoder=new Decoder3(r,t,n)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},from4=({name:r,prefix:t,encode:e,decode:n})=>new Codec3(r,t,e,n),baseX3=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=base_x_default3(e,t);return from4({prefix:r,name:t,encode:n,decode:o=>coerce3(i(o))})},decode11=(r,t,e,n)=>{const i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;const a=new Uint8Array(o*e/8|0);let s=0,u=0,h=0;for(let f=0;f<o;++f){const g=i[r[f]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<e|g,s+=e,s>=8&&(s-=8,a[h++]=255&u>>s)}if(s>=e||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode7=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let o="",a=0,s=0;for(let u=0;u<r.length;++u)for(s=s<<8|r[u],a+=8;a>e;)a-=e,o+=t[i&s>>a];if(a&&(o+=t[i&s<<e-a]),n)for(;o.length*e&7;)o+="=";return o},rfc46483=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>from4({prefix:t,name:r,encode(i){return encode7(i,n,e)},decode(i){return decode11(i,n,e,r)}}),identity=from4({prefix:"\0",name:"identity",encode:r=>toString2(r),decode:r=>fromString2(r)}),base2_exports={};__export(base2_exports,{base2:()=>base22});var base22=rfc46483({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base8_exports={};__export(base8_exports,{base8:()=>base8});var base8=rfc46483({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base10_exports={};__export(base10_exports,{base10:()=>base10});var base10=baseX3({prefix:"9",name:"base10",alphabet:"0123456789"}),base16_exports={};__export(base16_exports,{base16:()=>base16,base16upper:()=>base16upper});var base16=rfc46483({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc46483({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base32_exports={};__export(base32_exports,{base32:()=>base323,base32hex:()=>base32hex3,base32hexpad:()=>base32hexpad3,base32hexpadupper:()=>base32hexpadupper3,base32hexupper:()=>base32hexupper3,base32pad:()=>base32pad3,base32padupper:()=>base32padupper3,base32upper:()=>base32upper3,base32z:()=>base32z3});var base323=rfc46483({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper3=rfc46483({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad3=rfc46483({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper3=rfc46483({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex3=rfc46483({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper3=rfc46483({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad3=rfc46483({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper3=rfc46483({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z3=rfc46483({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base36_exports={};__export(base36_exports,{base36:()=>base36,base36upper:()=>base36upper});var base36=baseX3({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX3({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base58_exports={};__export(base58_exports,{base58btc:()=>base58btc3,base58flickr:()=>base58flickr3});var base58btc3=baseX3({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr3=baseX3({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base64_exports={};__export(base64_exports,{base64:()=>base64,base64pad:()=>base64pad,base64url:()=>base64url,base64urlpad:()=>base64urlpad});var base64=rfc46483({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc46483({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc46483({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc46483({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base256emoji_exports={};__export(base256emoji_exports,{base256emoji:()=>base256emoji});var alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce((r,t,e)=>(r[e]=t,r),[]),alphabetCharsToBytes=alphabet.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function encode8(r){return r.reduce((t,e)=>(t+=alphabetBytesToChars[e],t),"")}function decode12(r){const t=[];for(const e of r){const n=alphabetCharsToBytes[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var base256emoji=from4({prefix:"🚀",name:"base256emoji",encode:encode8,decode:decode12}),sha2_exports={};__export(sha2_exports,{sha256:()=>sha2562,sha512:()=>sha5122});var import_crypto2=__toESM(requireCryptoBrowserify()),encode_13=encode9,MSB3=128,MSBALL3=-128,INT3=Math.pow(2,31);function encode9(r,t,e){t=t||[],e=e||0;for(var n=e;r>=INT3;)t[e++]=r&255|MSB3,r/=128;for(;r&MSBALL3;)t[e++]=r&255|MSB3,r>>>=7;return t[e]=r|0,encode9.bytes=e-n+1,t}var decode13=read3,MSB$13=128,REST$13=127;function read3(r,n){var e=0,n=n||0,i=0,o=n,a,s=r.length;do{if(o>=s)throw read3.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&REST$13)<<i:(a&REST$13)*Math.pow(2,i),i+=7}while(a>=MSB$13);return read3.bytes=o-n,e}var N13=Math.pow(2,7),N23=Math.pow(2,14),N33=Math.pow(2,21),N43=Math.pow(2,28),N53=Math.pow(2,35),N63=Math.pow(2,42),N73=Math.pow(2,49),N83=Math.pow(2,56),N93=Math.pow(2,63),length3=function(r){return r<N13?1:r<N23?2:r<N33?3:r<N43?4:r<N53?5:r<N63?6:r<N73?7:r<N83?8:r<N93?9:10},varint3={encode:encode_13,decode:decode13,encodingLength:length3},_brrp_varint3=varint3,varint_default3=_brrp_varint3,encodeTo3=(r,t,e=0)=>(varint_default3.encode(r,t,e),t),encodingLength3=r=>varint_default3.encodingLength(r),create3=(r,t)=>{const e=t.byteLength,n=encodingLength3(r),i=n+encodingLength3(e),o=new Uint8Array(i+e);return encodeTo3(r,o,0),encodeTo3(e,o,n),o.set(t,i),new Digest3(r,e,t,o)},Digest3=class{constructor(r,t,e,n){this.code=r,this.size=t,this.digest=e,this.bytes=n}},from5=({name:r,code:t,encode:e})=>new Hasher2(r,t,e),Hasher2=class{constructor(r,t,e){this.name=r,this.code=t,this.encode=e}digest(r){if(r instanceof Uint8Array){const t=this.encode(r);return t instanceof Uint8Array?create3(this.code,t):t.then(e=>create3(this.code,e))}else throw Error("Unknown type, must be binary type")}},sha2562=from5({name:"sha2-256",code:18,encode:r=>coerce3(import_crypto2.default.createHash("sha256").update(r).digest())}),sha5122=from5({name:"sha2-512",code:19,encode:r=>coerce3(import_crypto2.default.createHash("sha512").update(r).digest())}),identity_exports2={};__export(identity_exports2,{identity:()=>identity2});var code3=0,name3="identity",encode10=coerce3,digest=r=>create3(code3,encode10(r)),identity2={code:code3,name:name3,encode:encode10,digest};new TextEncoder,new TextDecoder;var bases={...identity_exports,...base2_exports,...base8_exports,...base10_exports,...base16_exports,...base32_exports,...base36_exports,...base58_exports,...base64_exports,...base256emoji_exports};({...sha2_exports,...identity_exports2});function createCodec2(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var string=createCodec2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ascii=createCodec2("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=allocUnsafe(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),BASES={utf8:string,"utf-8":string,hex:bases.base16,latin1:ascii,ascii,binary:ascii,...bases},bases_default=BASES;function fromString3(r,t="utf8"){const e=bases_default[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?asUint8Array(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var defaultChunkValidator=()=>async function*(t){for await(const e of t){if(e.length===void 0)throw(0,import_err_code3.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if(typeof e=="string"||e instanceof String)yield fromString3(e.toString());else if(Array.isArray(e))yield Uint8Array.from(e);else if(e instanceof Uint8Array)yield e;else throw(0,import_err_code3.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}},DEFAULT_MAX_CHILDREN_PER_NODE=174;function balanced(r){const t=DEFAULT_MAX_CHILDREN_PER_NODE;return async function e(n,i){const o=[];for await(const a of src_default(n,t))o.push(await i(a));return o.length>1?e(o,i):o[0]}}var Dir=class{constructor(r,t){D(this,"options");D(this,"root");D(this,"dir");D(this,"path");D(this,"dirty");D(this,"flat");D(this,"parent");D(this,"parentKey");D(this,"unixfs");D(this,"mode");D(this,"mtime");D(this,"cid");D(this,"size");D(this,"nodeSize");this.options=t??{},this.root=r.root,this.dir=r.dir,this.path=r.path,this.dirty=r.dirty,this.flat=r.flat,this.parent=r.parent,this.parentKey=r.parentKey,this.unixfs=r.unixfs,this.mode=r.mode,this.mtime=r.mtime}},CID_V0=CID2.parse("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"),CID_V1=CID2.parse("zdj7WbTaiJT1fgatdet9Ei9iDB5hdCxkbVyhyh8YTUnXMiwYi"),DirFlat=class extends Dir{constructor(t,e){super(t,e);D(this,"_children");this._children=new Map}async put(t,e){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,this._children.set(t,e)}async get(t){return Promise.resolve(this._children.get(t))}childCount(){return this._children.size}directChildrenCount(){return this.childCount()}onlyChild(){return this._children.values().next().value}async*eachChildSeries(){for(const[t,e]of this._children.entries())yield{key:t,child:e}}estimateNodeSize(){if(this.nodeSize!==void 0)return this.nodeSize;this.nodeSize=0;for(const[t,e]of this._children.entries())e.size!=null&&e.cid!=null&&(this.nodeSize+=t.length+(this.options.cidVersion===1?CID_V1.bytes.byteLength:CID_V0.bytes.byteLength));return this.nodeSize}async*flush(t){const e=[];for(const[u,h]of this._children.entries()){let f=h;if(h instanceof Dir)for await(const g of h.flush(t))f=g,yield g;f.size!=null&&f.cid!=null&&e.push({Name:u,Tsize:Number(f.size),Hash:f.cid})}const n=new UnixFS({type:"directory",mtime:this.mtime,mode:this.mode}),i={Data:n.marshal(),Links:e},o=encode3(prepare(i)),a=await persist(o,t,this.options),s=o.length+i.Links.reduce((u,h)=>u+(h.Tsize==null?0:h.Tsize),0);this.cid=a,this.size=s,yield{cid:a,unixfs:n,path:this.path,size:BigInt(s)}}},from6=({name:r,code:t,encode:e})=>new Hasher3(r,t,e),Hasher3=class{constructor(r,t,e){this.name=r,this.code=t,this.encode=e}digest(r){if(r instanceof Uint8Array){const t=this.encode(r);return t instanceof Uint8Array?create(this.code,t):t.then(e=>create(this.code,e))}else throw Error("Unknown type, must be binary type")}},import_murmurhash3js_revisited=__toESM(require_murmurhash3js_revisited()),murmur3128=from6({name:"murmur3-128",code:34,encode:r=>bytes_exports.fromHex(import_murmurhash3js_revisited.default.x64.hash128(r))}),import_sparse_array=__toESM(require_sparse_array()),Bucket=class I{constructor(t,e,n=0){this._options=t,this._popCount=0,this._parent=e,this._posAtParent=n,this._children=new import_sparse_array.default,this.key=null}async put(t,e){const n=await this._findNewBucketAndPos(t);await n.bucket._putAt(n,t,e)}async get(t){const e=await this._findChild(t);if(e!=null)return e.value}async del(t){const e=await this._findPlace(t),n=e.bucket._at(e.pos);n!=null&&n.key===t&&e.bucket._delAt(e.pos)}leafCount(){return this._children.compactArray().reduce((e,n)=>n instanceof I?e+n.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const t=this._children.compactArray();for(const e of t)e instanceof I?yield*e.eachLeafSeries():yield e}serialize(t,e){const n=[];return e(this._children.reduce((i,o,a)=>(o!=null&&(o instanceof I?i.push(o.serialize(t,e)):i.push(t(o,a))),i),n))}async asyncTransform(t,e){return await asyncTransformBucket(this,t,e)}toJSON(){return this.serialize(mapNode,reduceNodes)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(t){const e=await this._findPlace(t),n=e.bucket._at(e.pos);if(!(n instanceof I)&&n!=null&&n.key===t)return n}async _findPlace(t){const e=this._options.hash(typeof t=="string"?fromString3(t):t),n=await e.take(this._options.bits),i=this._children.get(n);return i instanceof I?await i._findPlace(e):{bucket:this,pos:n,hash:e,existingChild:i}}async _findNewBucketAndPos(t){const e=await this._findPlace(t);if(e.existingChild!=null&&e.existingChild.key!==t){const n=new I(this._options,e.bucket,e.pos);e.bucket._putObjectAt(e.pos,n);const i=await n._findPlace(e.existingChild.hash);return i.bucket._putAt(i,e.existingChild.key,e.existingChild.value),await n._findNewBucketAndPos(e.hash)}return e}_putAt(t,e,n){this._putObjectAt(t.pos,{key:e,value:n,hash:t.hash})}_putObjectAt(t,e){this._children.get(t)==null&&this._popCount++,this._children.set(t,e)}_delAt(t){if(t===-1)throw new Error("Invalid position");this._children.get(t)!=null&&this._popCount--,this._children.unset(t),this._level()}_level(){if(this._parent!=null&&this._popCount<=1)if(this._popCount===1){const t=this._children.find(exists);if(t!=null&&!(t instanceof I)){const e=t.hash;e.untake(this._options.bits);const n={pos:this._posAtParent,hash:e,bucket:this._parent};this._parent._putAt(n,t.key,t.value)}}else this._parent._delAt(this._posAtParent)}_at(t){return this._children.get(t)}};function exists(r){return!!r}function mapNode(r,t){return r.key}function reduceNodes(r){return r}async function asyncTransformBucket(r,t,e){const n=[];for(const i of r._children.compactArray())if(i instanceof Bucket)await asyncTransformBucket(i,t,e);else{const o=await t(i);n.push({bitField:r._children.bitField(),children:o})}return await e(n)}var START_MASKS=[255,254,252,248,240,224,192,128],STOP_MASKS=[1,3,7,15,31,63,127,255],ConsumableBuffer=class{constructor(r){this._value=r,this._currentBytePos=r.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+this._currentBytePos*8}totalBits(){return this._value.length*8}take(r){let t=r,e=0;for(;t>0&&this._haveBits();){const n=this._value[this._currentBytePos],i=this._currentBitPos+1,o=Math.min(i,t),a=byteBitsToInt(n,i-o,o);e=(e<<o)+a,t-=o,this._currentBitPos-=o,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return e}untake(r){for(this._currentBitPos+=r;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}};function byteBitsToInt(r,t,e){const n=maskFor(t,e);return(r&n)>>>t}function maskFor(r,t){return START_MASKS[r]&STOP_MASKS[Math.min(t+r-1,7)]}function wrapHash(r){function t(e){return e instanceof InfiniteHash?e:new InfiniteHash(e,r)}return t}var InfiniteHash=class{constructor(r,t){if(!(r instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=r,this._hashFn=t,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(r){let t=r;for(;this._availableBits<t;)await this._produceMoreBits();let e=0;for(;t>0;){const n=this._buffers[this._currentBufferIndex],i=Math.min(n.availableBits(),t),o=n.take(i);e=(e<<i)+o,t-=i,this._availableBits-=i,n.availableBits()===0&&this._currentBufferIndex++}return e}untake(r){let t=r;for(;t>0;){const e=this._buffers[this._currentBufferIndex],n=Math.min(e.totalBits()-e.availableBits(),t);e.untake(n),t-=n,this._availableBits+=n,this._currentBufferIndex>0&&e.totalBits()===e.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;const r=this._depth>0?concat([this._value,Uint8Array.from([this._depth])]):this._value,t=await this._hashFn(r),e=new ConsumableBuffer(t);this._buffers.push(e),this._availableBits+=e.availableBits()}};function createHAMT(r){if(r==null||r.hashFn==null)throw new Error("please define an options.hashFn");const t={bits:r.bits??8,hash:wrapHash(r.hashFn)};return new Bucket(t)}async function hamtHashFn(r){return(await murmur3128.encode(r)).slice(0,8).reverse()}var HAMT_HASH_CODE=BigInt(34),DirSharded=class extends Dir{constructor(t,e){super(t,e);D(this,"_bucket");this._bucket=createHAMT({hashFn:hamtHashFn,bits:8})}async put(t,e){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,await this._bucket.put(t,e)}async get(t){return this._bucket.get(t)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(const{key:t,value:e}of this._bucket.eachLeafSeries())yield{key:t,child:e}}estimateNodeSize(){return this.nodeSize!==void 0?this.nodeSize:(this.nodeSize=calculateSize(this._bucket,this,this.options),this.nodeSize)}async*flush(t){for await(const e of flush(this._bucket,t,this,this.options))yield{...e,path:this.path}}},dir_sharded_default=DirSharded;async function*flush(r,t,e,n){const i=r._children,o=[];let a=0n;for(let y=0;y<i.length;y++){const l=i.get(y);if(l==null)continue;const c=y.toString(16).toUpperCase().padStart(2,"0");if(l instanceof Bucket){let d;for await(const w of flush(l,t,null,n))d=w;if(d==null)throw new Error("Could not flush sharded directory, no subshard found");o.push({Name:c,Tsize:Number(d.size),Hash:d.cid}),a+=d.size}else if(isDir(l.value)){const d=l.value;let w;for await(const p of d.flush(t))w=p,yield w;if(w==null)throw new Error("Did not flush dir");const v=c+l.key;o.push({Name:v,Tsize:Number(w.size),Hash:w.cid}),a+=w.size}else{const d=l.value;if(d.cid==null)continue;const w=c+l.key,v=d.size;o.push({Name:w,Tsize:Number(v),Hash:d.cid}),a+=BigInt(v??0)}}const s=Uint8Array.from(i.bitField().reverse()),u=new UnixFS({type:"hamt-sharded-directory",data:s,fanout:BigInt(r.tableSize()),hashType:HAMT_HASH_CODE,mtime:e==null?void 0:e.mtime,mode:e==null?void 0:e.mode}),h={Data:u.marshal(),Links:o},f=encode3(prepare(h)),g=await persist(f,t,n),b=BigInt(f.byteLength)+a;yield{cid:g,unixfs:u,size:b}}function isDir(r){return typeof r.flush=="function"}function calculateSize(r,t,e){const n=r._children,i=[];for(let u=0;u<n.length;u++){const h=n.get(u);if(h==null)continue;const f=u.toString(16).toUpperCase().padStart(2,"0");if(h instanceof Bucket){const g=calculateSize(h,null,e);i.push({Name:f,Tsize:Number(g),Hash:e.cidVersion===0?CID_V0:CID_V1})}else if(typeof h.value.flush=="function"){const b=h.value.nodeSize();i.push({Name:f+h.key,Tsize:Number(b),Hash:e.cidVersion===0?CID_V0:CID_V1})}else{const g=h.value;if(g.cid==null)continue;const b=f+h.key,y=g.size;i.push({Name:b,Tsize:Number(y),Hash:g.cid})}}const o=Uint8Array.from(n.bitField().reverse()),a=new UnixFS({type:"hamt-sharded-directory",data:o,fanout:BigInt(r.tableSize()),hashType:HAMT_HASH_CODE,mtime:t==null?void 0:t.mtime,mode:t==null?void 0:t.mode});return encode3(prepare({Data:a.marshal(),Links:i})).length}async function flatToShard(r,t,e,n){let i=t;t instanceof DirFlat&&t.estimateNodeSize()>e&&(i=await convertToShard(t,n));const o=i.parent;if(o!=null){if(i!==t){if(r!=null&&(r.parent=i),i.parentKey==null)throw new Error("No parent key found");await o.put(i.parentKey,i)}return flatToShard(i,o,e,n)}return i}async function convertToShard(r,t){const e=new dir_sharded_default({root:r.root,dir:!0,parent:r.parent,parentKey:r.parentKey,path:r.path,dirty:r.dirty,flat:!1,mtime:r.mtime,mode:r.mode},t);for await(const{key:n,child:i}of r.eachChildSeries())await e.put(n,i);return e}var toPathComponents=(r="")=>(r.trim().match(/([^\\/]|\\\/)+/g)??[]).filter(Boolean);async function addToTree(r,t,e){var s,u;const n=toPathComponents(r.path??""),i=n.length-1;let o=t,a="";for(let h=0;h<n.length;h++){const f=n[h];a+=`${a!==""?"/":""}${f}`;const g=h===i;if(o.dirty=!0,o.cid=void 0,o.size=void 0,g)await o.put(f,r),t=await flatToShard(null,o,e.shardSplitThresholdBytes,e);else{let b=await o.get(f);(b==null||!(b instanceof Dir))&&(b=new DirFlat({root:!1,dir:!0,parent:o,parentKey:f,path:a,dirty:!0,flat:!0,mtime:(s=b==null?void 0:b.unixfs)==null?void 0:s.mtime,mode:(u=b==null?void 0:b.unixfs)==null?void 0:u.mode},e)),await o.put(f,b),o=b}}return t}async function*flushAndYield(r,t){var e;if(!(r instanceof Dir)){((e=r.unixfs)==null?void 0:e.isDirectory())===!0&&(yield r);return}yield*r.flush(t)}function defaultTreeBuilder(r){return async function*(e,n){let i=new DirFlat({root:!0,dir:!0,path:"",dirty:!0,flat:!0},r),o,a=!1;for await(const s of e){if(s==null)continue;const u=`${s.originalPath??""}`.split("/")[0];u!=null&&u!==""&&(o==null?(o=u,a=!0):o!==u&&(a=!1)),i=await addToTree(s,i,r),(s.unixfs==null||!s.unixfs.isDirectory())&&(yield s)}if(r.wrapWithDirectory||a&&i.childCount()>1)yield*flushAndYield(i,n);else for await(const s of i.eachChildSeries())s!=null&&(yield*flushAndYield(s.child,n))}}async function*importer(r,t,e={}){let n;Symbol.asyncIterator in r||Symbol.iterator in r?n=r:n=[r];const i=e.wrapWithDirectory??!1,o=e.shardSplitThresholdBytes??262144,a=e.cidVersion??1,s=e.rawLeaves??!0,u=e.leafType??"file",h=e.fileImportConcurrency??50,f=e.blockWriteConcurrency??10,g=e.reduceSingleLeafToSelf??!0,b=e.chunker??fixedSize(),y=e.chunkValidator??defaultChunkValidator(),l=e.dagBuilder??defaultDagBuilder({chunker:b,chunkValidator:y,wrapWithDirectory:i,layout:e.layout??balanced(),bufferImporter:e.bufferImporter??defaultBufferImporter({cidVersion:a,rawLeaves:s,leafType:u,onProgress:e.onProgress}),blockWriteConcurrency:f,reduceSingleLeafToSelf:g,cidVersion:a,onProgress:e.onProgress}),c=e.treeBuilder??defaultTreeBuilder({wrapWithDirectory:i,shardSplitThresholdBytes:o,cidVersion:a,onProgress:e.onProgress});for await(const d of c(parallelBatch(l(n,t),h),t))yield{cid:d.cid,path:d.path,unixfs:d.unixfs,size:d.size}}var errors_exports={};__export(errors_exports,{abortedError:()=>abortedError,closeFailedError:()=>closeFailedError,deleteFailedError:()=>deleteFailedError,getFailedError:()=>getFailedError,hasFailedError:()=>hasFailedError,notFoundError:()=>notFoundError,openFailedError:()=>openFailedError,putFailedError:()=>putFailedError});var import_err_code5=__toESM(require_err_code());function openFailedError(r){return r=r??new Error("Open failed"),(0,import_err_code5.default)(r,"ERR_OPEN_FAILED")}function closeFailedError(r){return r=r??new Error("Close failed"),(0,import_err_code5.default)(r,"ERR_CLOSE_FAILED")}function putFailedError(r){return r=r??new Error("Put failed"),(0,import_err_code5.default)(r,"ERR_PUT_FAILED")}function getFailedError(r){return r=r??new Error("Get failed"),(0,import_err_code5.default)(r,"ERR_GET_FAILED")}function deleteFailedError(r){return r=r??new Error("Delete failed"),(0,import_err_code5.default)(r,"ERR_DELETE_FAILED")}function hasFailedError(r){return r=r??new Error("Has failed"),(0,import_err_code5.default)(r,"ERR_HAS_FAILED")}function notFoundError(r){return r=r??new Error("Not Found"),(0,import_err_code5.default)(r,"ERR_NOT_FOUND")}function abortedError(r){return r=r??new Error("Aborted"),(0,import_err_code5.default)(r,"ERR_ABORTED")}var BaseBlockstore=class{has(r,t){return Promise.reject(new Error(".has is not implemented"))}put(r,t,e){return Promise.reject(new Error(".put is not implemented"))}async*putMany(r,t){for await(const{cid:e,block:n}of r)await this.put(e,n,t),yield e}get(r,t){return Promise.reject(new Error(".get is not implemented"))}async*getMany(r,t){for await(const e of r)yield{cid:e,block:await this.get(e,t)}}async delete(r,t){await Promise.reject(new Error(".delete is not implemented"))}async*deleteMany(r,t){for await(const e of r)await this.delete(e,t),yield e}async*getAll(r){throw new Error(".getAll is not implemented")}};function base4(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var s=r.length,u=r.charAt(0),h=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var c=0,d=0,w=0,v=l.length;w!==v&&l[w]===0;)w++,c++;for(var p=(v-w)*f+1>>>0,m=new Uint8Array(p);w!==v;){for(var _=l[w],A=0,E=p-1;(_!==0||A<d)&&E!==-1;E--,A++)_+=256*m[E]>>>0,m[E]=_%s>>>0,_=_/s>>>0;if(_!==0)throw new Error("Non-zero carry");d=A,w++}for(var S=p-d;S!==p&&m[S]===0;)S++;for(var x=u.repeat(c);S<p;++S)x+=r.charAt(m[S]);return x}function b(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var c=0;if(l[c]!==" "){for(var d=0,w=0;l[c]===u;)d++,c++;for(var v=(l.length-c)*h+1>>>0,p=new Uint8Array(v);l[c];){var m=e[l.charCodeAt(c)];if(m===255)return;for(var _=0,A=v-1;(m!==0||_<w)&&A!==-1;A--,_++)m+=s*p[A]>>>0,p[A]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");w=_,c++}if(l[c]!==" "){for(var E=v-w;E!==v&&p[E]===0;)E++;for(var S=new Uint8Array(d+(v-E)),x=d;E!==v;)S[x++]=p[E++];return S}}}function y(l){var c=b(l);if(c)return c;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:b,decode:y}}var src4=base4,_brrp__multiformats_scope_baseX4=src4,base_x_default4=_brrp__multiformats_scope_baseX4,equals8=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},coerce4=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},Encoder4=class{constructor(r,t,e){this.name=r,this.prefix=t,this.baseEncode=e}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},Decoder4=class{constructor(r,t,e){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=e}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return or4(this,r)}},ComposedDecoder4=class{constructor(r){this.decoders=r}or(r){return or4(this,r)}decode(r){const t=r[0],e=this.decoders[t];if(e)return e.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or4=(r,t)=>new ComposedDecoder4({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Codec4=class{constructor(r,t,e,n){this.name=r,this.prefix=t,this.baseEncode=e,this.baseDecode=n,this.encoder=new Encoder4(r,t,e),this.decoder=new Decoder4(r,t,n)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},from7=({name:r,prefix:t,encode:e,decode:n})=>new Codec4(r,t,e,n),baseX4=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=base_x_default4(e,t);return from7({prefix:r,name:t,encode:n,decode:o=>coerce4(i(o))})},decode16=(r,t,e,n)=>{const i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;const a=new Uint8Array(o*e/8|0);let s=0,u=0,h=0;for(let f=0;f<o;++f){const g=i[r[f]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<e|g,s+=e,s>=8&&(s-=8,a[h++]=255&u>>s)}if(s>=e||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode11=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let o="",a=0,s=0;for(let u=0;u<r.length;++u)for(s=s<<8|r[u],a+=8;a>e;)a-=e,o+=t[i&s>>a];if(a&&(o+=t[i&s<<e-a]),n)for(;o.length*e&7;)o+="=";return o},rfc46484=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>from7({prefix:t,name:r,encode(i){return encode11(i,n,e)},decode(i){return decode16(i,n,e,r)}}),base324=rfc46484({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5});rfc46484({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rfc46484({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rfc46484({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rfc46484({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rfc46484({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rfc46484({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),rfc46484({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rfc46484({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var encode_14=encode12,MSB4=128,MSBALL4=-128,INT4=Math.pow(2,31);function encode12(r,t,e){t=t||[],e=e||0;for(var n=e;r>=INT4;)t[e++]=r&255|MSB4,r/=128;for(;r&MSBALL4;)t[e++]=r&255|MSB4,r>>>=7;return t[e]=r|0,encode12.bytes=e-n+1,t}var decode17=read4,MSB$14=128,REST$14=127;function read4(r,n){var e=0,n=n||0,i=0,o=n,a,s=r.length;do{if(o>=s)throw read4.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&REST$14)<<i:(a&REST$14)*Math.pow(2,i),i+=7}while(a>=MSB$14);return read4.bytes=o-n,e}var N14=Math.pow(2,7),N24=Math.pow(2,14),N34=Math.pow(2,21),N44=Math.pow(2,28),N54=Math.pow(2,35),N64=Math.pow(2,42),N74=Math.pow(2,49),N84=Math.pow(2,56),N94=Math.pow(2,63),length4=function(r){return r<N14?1:r<N24?2:r<N34?3:r<N44?4:r<N54?5:r<N64?6:r<N74?7:r<N84?8:r<N94?9:10},varint4={encode:encode_14,decode:decode17,encodingLength:length4},_brrp_varint4=varint4,varint_default4=_brrp_varint4,decode18=(r,t=0)=>[varint_default4.decode(r,t),varint_default4.decode.bytes],encodeTo4=(r,t,e=0)=>(varint_default4.encode(r,t,e),t),encodingLength4=r=>varint_default4.encodingLength(r),create4=(r,t)=>{const e=t.byteLength,n=encodingLength4(r),i=n+encodingLength4(e),o=new Uint8Array(i+e);return encodeTo4(r,o,0),encodeTo4(e,o,n),o.set(t,i),new Digest4(r,e,t,o)},decode19=r=>{const t=coerce4(r),[e,n]=decode18(t),[i,o]=decode18(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Digest4(e,i,a,t)},equals9=(r,t)=>{if(r===t)return!0;{const e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&equals8(r.bytes,e.bytes)}},Digest4=class{constructor(r,t,e,n){this.code=r,this.size=t,this.digest=e,this.bytes=n}},base58btc4=baseX4({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"});baseX4({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var format4=(r,t)=>{const{bytes:e,version:n}=r;switch(n){case 0:return toStringV04(e,baseCache4(r),t||base58btc4.encoder);default:return toStringV14(e,baseCache4(r),t||base324.encoder)}},cache4=new WeakMap,baseCache4=r=>{const t=cache4.get(r);if(t==null){const e=new Map;return cache4.set(r,e),e}return t},CID4=class L{constructor(t,e,n,i){this.code=e,this.version=t,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:{const{code:t,multihash:e}=this;if(t!==DAG_PB_CODE4)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==SHA_256_CODE4)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return L.createV0(e)}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:{const{code:t,digest:e}=this.multihash,n=create4(t,e);return L.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(t){return L.equals(this,t)}static equals(t,e){const n=e;return n&&t.code===n.code&&t.version===n.version&&equals9(t.multihash,n.multihash)}toString(t){return format4(this,t)}toJSON(){return{"/":format4(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;const e=t;if(e instanceof L)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){const{version:n,code:i,multihash:o,bytes:a}=e;return new L(n,i,o,a||encodeCID4(n,i,o.bytes))}else if(e[cidSymbol4]===!0){const{version:n,multihash:i,code:o}=e,a=decode19(i);return L.create(n,o,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==DAG_PB_CODE4)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE4}) block encoding`);return new L(t,e,n,n.bytes)}case 1:{const i=encodeCID4(t,e,n.bytes);return new L(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return L.create(0,DAG_PB_CODE4,t)}static createV1(t,e){return L.create(1,t,e)}static decode(t){const[e,n]=L.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){const e=L.inspectBytes(t),n=e.size-e.multihashSize,i=coerce4(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");const o=i.subarray(e.multihashSize-e.digestSize),a=new Digest4(e.multihashCode,e.digestSize,o,i);return[e.version===0?L.createV0(a):L.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0;const n=()=>{const[g,b]=decode18(t.subarray(e));return e+=b,g};let i=n(),o=DAG_PB_CODE4;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);const a=e,s=n(),u=n(),h=e+u,f=h-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:h}}static parse(t,e){const[n,i]=parseCIDtoBytes4(t,e),o=L.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache4(o).set(n,t),o}},parseCIDtoBytes4=(r,t)=>{switch(r[0]){case"Q":{const e=t||base58btc4;return[base58btc4.prefix,e.decode(`${base58btc4.prefix}${r}`)]}case base58btc4.prefix:{const e=t||base58btc4;return[base58btc4.prefix,e.decode(r)]}case base324.prefix:{const e=t||base324;return[base324.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},toStringV04=(r,t,e)=>{const{prefix:n}=e;if(n!==base58btc4.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);const i=t.get(n);if(i==null){const o=e.encode(r).slice(1);return t.set(n,o),o}else return i},toStringV14=(r,t,e)=>{const{prefix:n}=e,i=t.get(n);if(i==null){const o=e.encode(r);return t.set(n,o),o}else return i},DAG_PB_CODE4=112,SHA_256_CODE4=18,encodeCID4=(r,t,e)=>{const n=encodingLength4(r),i=n+encodingLength4(t),o=new Uint8Array(i+e.byteLength);return encodeTo4(r,o,0),encodeTo4(t,o,n),o.set(e,i),o},cidSymbol4=Symbol.for("@ipld/js-cid/CID"),code4=85,MemoryBlockstore=class extends BaseBlockstore{constructor(){super();D(this,"data");this.data=new Map}put(t,e){return this.data.set(base324.encode(t.multihash.bytes),e),t}get(t){const e=this.data.get(base324.encode(t.multihash.bytes));if(e==null)throw notFoundError();return e}has(t){return this.data.has(base324.encode(t.multihash.bytes))}async delete(t){this.data.delete(base324.encode(t.multihash.bytes))}async*getAll(){for(const[t,e]of this.data.entries())yield{cid:CID4.createV1(code4,decode19(base324.decode(t))),block:e}}};({...errors_exports});async function hashV0(r){const t=import_crypto3.default.createHash("sha256");if(r instanceof Uint8Array)t.update(r);else if(Symbol.asyncIterator in r)for await(const e of r)t.update(e);else throw new Error("Invalid value provided to hashStreamV0. Expected AsyncGenerator<Uint8Array> | AsyncIterable<Uint8Array> | Uint8Array");return CID.createV0(create(18,t.digest())).toString()}async function hashV1(r){const t=new MemoryBlockstore;let e;async function*n(){yield r}if(r instanceof Uint8Array)for await(const{cid:i}of importer([{content:n()}],t,{cidVersion:1,rawLeaves:!0}))e=i;else if(Symbol.asyncIterator in r)for await(const{cid:i}of importer([{content:r}],t,{cidVersion:1,rawLeaves:!0}))e=i;else throw new Error("Invalid value provided to hashStreamV1. Expected AsyncGenerator<Uint8Array> | AsyncIterable<Uint8Array> | Uint8Array");return`${e}`}function sortKeys(r,t){return compareStrings(r.hash,t.hash)||compareStrings(r.file,t.file)||0}function compareStrings(r,t){if(r===t)return 0;for(let e=0;e<Math.max(r.length,t.length);e++){if(r.charAt(e)>t.charAt(e))return 1;if(r.charAt(e)<t.charAt(e))return-1}return r.length>t.length?1:-1}function prepareADR32Data(r,t){return new TextEncoder().encode(JSON.stringify({content:r.sort(sortKeys).map(e=>({key:e.file,hash:e.hash})),metadata:t}))}async function calculateMultipleHashesADR32(r,t){const e=prepareADR32Data(r,t);return{data:e,hash:await hashV1(e)}}async function calculateMultipleHashesADR32LegacyQmHash(r,t){const e=prepareADR32Data(r,t);return{data:e,hash:await hashV0(e)}}function number(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function bool(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}function bytes(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function hash(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(r.outputLen),number(r.blockLen)}function exists2(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function output(r,t){bytes(r);const e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var assert={number,bool,bytes,hash,exists:exists2,output},assert_default=assert,U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(r,t=!1){return t?{h:Number(r&U32_MASK64),l:Number(r>>_32n&U32_MASK64)}:{h:Number(r>>_32n&U32_MASK64)|0,l:Number(r&U32_MASK64)|0}}function split(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;i<r.length;i++){const{h:o,l:a}=fromBig(r[i],t);[e[i],n[i]]=[o,a]}return[e,n]}var toBig=(r,t)=>BigInt(r>>>0)<<_32n|BigInt(t>>>0),shrSH=(r,t,e)=>r>>>e,shrSL=(r,t,e)=>r<<32-e|t>>>e,rotrSH=(r,t,e)=>r>>>e|t<<32-e,rotrSL=(r,t,e)=>r<<32-e|t>>>e,rotrBH=(r,t,e)=>r<<64-e|t>>>e-32,rotrBL=(r,t,e)=>r>>>e-32|t<<64-e,rotr32H=(r,t)=>t,rotr32L=(r,t)=>r,rotlSH=(r,t,e)=>r<<e|t>>>32-e,rotlSL=(r,t,e)=>t<<e|r>>>32-e,rotlBH=(r,t,e)=>t<<e-32|r>>>64-e,rotlBL=(r,t,e)=>r<<e-32|t>>>64-e;function add(r,t,e,n){const i=(t>>>0)+(n>>>0);return{h:r+e+(i/2**32|0)|0,l:i|0}}var add3L=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),add3H=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,add4L=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),add4H=(r,t,e,n,i)=>t+e+n+i+(r/2**32|0)|0,add5L=(r,t,e,n,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),add5H=(r,t,e,n,i,o)=>t+e+n+i+o+(r/2**32|0)|0,u64={fromBig,split,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},u64_default=u64,u8a=r=>r instanceof Uint8Array,u32=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");var hexes=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function bytesToHex(r){if(!u8a(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=hexes[r[e]];return t}function utf8ToBytes(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function toBytes(r){if(typeof r=="string"&&(r=utf8ToBytes(r)),!u8a(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}var Hash=class{clone(){return this._cloneInto()}};function wrapConstructor(r){const t=n=>r().update(toBytes(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function wrapXOFConstructorWithOpts(r){const t=(n,i)=>r(i).update(toBytes(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}var[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]],_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let r=0,t=_1n,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],SHA3_PI.push(2*(5*n+e)),SHA3_ROTL.push((r+1)*(r+2)/2%64);let i=_0n;for(let o=0;o<7;o++)t=(t<<_1n^(t>>_7n)*_0x71n)%_256n,t&_2n&&(i^=_1n<<(_1n<<BigInt(o))-_1n);_SHA3_IOTA.push(i)}var[SHA3_IOTA_H,SHA3_IOTA_L]=u64_default.split(_SHA3_IOTA,!0),rotlH=(r,t,e)=>e>32?u64_default.rotlBH(r,t,e):u64_default.rotlSH(r,t,e),rotlL=(r,t,e)=>e>32?u64_default.rotlBL(r,t,e):u64_default.rotlSL(r,t,e);function keccakP(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let a=0;a<10;a++)e[a]=r[a]^r[a+10]^r[a+20]^r[a+30]^r[a+40];for(let a=0;a<10;a+=2){const s=(a+8)%10,u=(a+2)%10,h=e[u],f=e[u+1],g=rotlH(h,f,1)^e[s],b=rotlL(h,f,1)^e[s+1];for(let y=0;y<50;y+=10)r[a+y]^=g,r[a+y+1]^=b}let i=r[2],o=r[3];for(let a=0;a<24;a++){const s=SHA3_ROTL[a],u=rotlH(i,o,s),h=rotlL(i,o,s),f=SHA3_PI[a];i=r[f],o=r[f+1],r[f]=u,r[f+1]=h}for(let a=0;a<50;a+=10){for(let s=0;s<10;s++)e[s]=r[a+s];for(let s=0;s<10;s++)r[a+s]^=~e[(s+2)%10]&e[(s+4)%10]}r[0]^=SHA3_IOTA_H[n],r[1]^=SHA3_IOTA_L[n]}e.fill(0)}var Keccak=class O extends Hash{constructor(t,e,n,i=!1,o=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,assert_default.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){assert_default.exists(this);const{blockLen:e,state:n}=this;t=toBytes(t);const i=t.length;for(let o=0;o<i;){const a=Math.min(e-this.pos,i-o);for(let s=0;s<a;s++)n[this.pos++]^=t[o++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,(e&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){assert_default.exists(this,!1),assert_default.bytes(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,o=t.length;i<o;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,o-i);t.set(e.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return assert_default.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(assert_default.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new O(e,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}},gen=(r,t,e)=>wrapConstructor(()=>new Keccak(t,r,e));gen(6,144,224/8),gen(6,136,256/8),gen(6,104,384/8),gen(6,72,512/8),gen(1,144,224/8);var keccak_256=gen(1,136,256/8);gen(1,104,384/8),gen(1,72,512/8);var genShake=(r,t,e)=>wrapXOFConstructorWithOpts((n={})=>new Keccak(t,r,n.dkLen===void 0?e:n.dkLen,!0));genShake(31,168,128/8),genShake(31,136,256/8);function wrapHash2(r){return t=>(assert_default.bytes(t),r(t))}(()=>{const r=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,t=typeof commonjsRequire=="function"&&commonjsRequire.bind(module);return{node:t&&!r?t("crypto"):void 0,web:r}})();var keccak256=(()=>{const r=wrapHash2(keccak_256);return r.create=keccak_256.create,r})();function keccak256Hash(r,t){const e=JSON.stringify(pick(r,t)),n=new TextEncoder().encode(e),i=keccak256(n);return bytesToHex(i)}var pick=(r,t)=>Object.fromEntries(t.filter(e=>e in r).map(e=>[e,r[e]]));/*! Bundled license information:
1
+ var H=Object.defineProperty;var V=(r,t,e)=>t in r?H(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var D=(r,t,e)=>V(r,typeof t!="symbol"?t+"":t,e);import{c as commonjsGlobal}from"./react-eHGl4EaY.js";import{c as commonjsRequire}from"./sentry-Bv3fzY7D.js";import{r as requireCryptoBrowserify}from"./index-DS-I38Tc.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new r.Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="ffb96adf-b02d-4b63-bf2b-28d0c1b4d02e",r._sentryDebugIdIdentifier="sentry-dbid-ffb96adf-b02d-4b63-bf2b-28d0c1b4d02e")}catch{}})();var dist={exports:{}};dist.exports;var hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,(function(module){var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJS=(r,t)=>function(){return t||(0,r[__getOwnPropNames(r)[0]])((t={exports:{}}).exports,t),t.exports},__export=(r,t)=>{for(var e in t)__defProp(r,e,{get:t[e],enumerable:!0})},__copyProps=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of __getOwnPropNames(t))!__hasOwnProp.call(r,i)&&i!==e&&__defProp(r,i,{get:()=>t[i],enumerable:!(n=__getOwnPropDesc(t,i))||n.enumerable});return r},__toESM=(r,t,e)=>(e=r!=null?__create(__getProtoOf(r)):{},__copyProps(__defProp(e,"default",{value:r,enumerable:!0}),r)),__toCommonJS=r=>__copyProps(__defProp({},"__esModule",{value:!0}),r),require_err_code=__commonJS({"node_modules/err-code/index.js"(r,t){function e(i,o){for(const a in o)Object.defineProperty(i,a,{value:o[a],enumerable:!0,configurable:!0});return i}function n(i,o,a){if(!i||typeof i=="string")throw new TypeError("Please pass an Error to err-code");a||(a={}),typeof o=="object"&&(a=o,o=""),o&&(a.code=o);try{return e(i,a)}catch{a.message=i.message,a.stack=i.stack;const u=function(){};return u.prototype=Object.create(Object.getPrototypeOf(i)),e(new u,a)}}t.exports=n}}),require_aspromise=__commonJS({"node_modules/@protobufjs/aspromise/index.js"(r,t){t.exports=e;function e(n,i){for(var o=new Array(arguments.length-1),a=0,s=2,u=!0;s<arguments.length;)o[a++]=arguments[s++];return new Promise(function(f,g){o[a]=function(y){if(u)if(u=!1,y)g(y);else{for(var l=new Array(arguments.length-1),c=0;c<l.length;)l[c++]=arguments[c];f.apply(null,l)}};try{n.apply(i||null,o)}catch(b){u&&(u=!1,g(b))}})}}}),require_base64=__commonJS({"node_modules/@protobufjs/base64/index.js"(r){var t=r;t.length=function(s){var u=s.length;if(!u)return 0;for(var h=0;--u%4>1&&s.charAt(u)==="=";)++h;return Math.ceil(s.length*3)/4-h};var e=new Array(64),n=new Array(123);for(i=0;i<64;)n[e[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;var i;t.encode=function(s,u,h){for(var f=null,g=[],b=0,y=0,l;u<h;){var c=s[u++];switch(y){case 0:g[b++]=e[c>>2],l=(c&3)<<4,y=1;break;case 1:g[b++]=e[l|c>>4],l=(c&15)<<2,y=2;break;case 2:g[b++]=e[l|c>>6],g[b++]=e[c&63],y=0;break}b>8191&&((f||(f=[])).push(String.fromCharCode.apply(String,g)),b=0)}return y&&(g[b++]=e[l],g[b++]=61,y===1&&(g[b++]=61)),f?(b&&f.push(String.fromCharCode.apply(String,g.slice(0,b))),f.join("")):String.fromCharCode.apply(String,g.slice(0,b))};var o="invalid encoding";t.decode=function(s,u,h){for(var f=h,g=0,b,y=0;y<s.length;){var l=s.charCodeAt(y++);if(l===61&&g>1)break;if((l=n[l])===void 0)throw Error(o);switch(g){case 0:b=l,g=1;break;case 1:u[h++]=b<<2|(l&48)>>4,b=l,g=2;break;case 2:u[h++]=(b&15)<<4|(l&60)>>2,b=l,g=3;break;case 3:u[h++]=(b&3)<<6|l,g=0;break}}if(g===1)throw Error(o);return h-f},t.test=function(s){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s)}}}),require_eventemitter=__commonJS({"node_modules/@protobufjs/eventemitter/index.js"(r,t){t.exports=e;function e(){this._listeners={}}e.prototype.on=function(i,o,a){return(this._listeners[i]||(this._listeners[i]=[])).push({fn:o,ctx:a||this}),this},e.prototype.off=function(i,o){if(i===void 0)this._listeners={};else if(o===void 0)this._listeners[i]=[];else for(var a=this._listeners[i],s=0;s<a.length;)a[s].fn===o?a.splice(s,1):++s;return this},e.prototype.emit=function(i){var o=this._listeners[i];if(o){for(var a=[],s=1;s<arguments.length;)a.push(arguments[s++]);for(s=0;s<o.length;)o[s].fn.apply(o[s++].ctx,a)}return this}}}),require_float=__commonJS({"node_modules/@protobufjs/float/index.js"(r,t){t.exports=e(e);function e(s){return typeof Float32Array<"u"?(function(){var u=new Float32Array([-0]),h=new Uint8Array(u.buffer),f=h[3]===128;function g(c,d,w){u[0]=c,d[w]=h[0],d[w+1]=h[1],d[w+2]=h[2],d[w+3]=h[3]}function b(c,d,w){u[0]=c,d[w]=h[3],d[w+1]=h[2],d[w+2]=h[1],d[w+3]=h[0]}s.writeFloatLE=f?g:b,s.writeFloatBE=f?b:g;function y(c,d){return h[0]=c[d],h[1]=c[d+1],h[2]=c[d+2],h[3]=c[d+3],u[0]}function l(c,d){return h[3]=c[d],h[2]=c[d+1],h[1]=c[d+2],h[0]=c[d+3],u[0]}s.readFloatLE=f?y:l,s.readFloatBE=f?l:y})():(function(){function u(f,g,b,y){var l=g<0?1:0;if(l&&(g=-g),g===0)f(1/g>0?0:2147483648,b,y);else if(isNaN(g))f(2143289344,b,y);else if(g>34028234663852886e22)f((l<<31|2139095040)>>>0,b,y);else if(g<11754943508222875e-54)f((l<<31|Math.round(g/1401298464324817e-60))>>>0,b,y);else{var c=Math.floor(Math.log(g)/Math.LN2),d=Math.round(g*Math.pow(2,-c)*8388608)&8388607;f((l<<31|c+127<<23|d)>>>0,b,y)}}s.writeFloatLE=u.bind(null,n),s.writeFloatBE=u.bind(null,i);function h(f,g,b){var y=f(g,b),l=(y>>31)*2+1,c=y>>>23&255,d=y&8388607;return c===255?d?NaN:l*(1/0):c===0?l*1401298464324817e-60*d:l*Math.pow(2,c-150)*(d+8388608)}s.readFloatLE=h.bind(null,o),s.readFloatBE=h.bind(null,a)})(),typeof Float64Array<"u"?(function(){var u=new Float64Array([-0]),h=new Uint8Array(u.buffer),f=h[7]===128;function g(c,d,w){u[0]=c,d[w]=h[0],d[w+1]=h[1],d[w+2]=h[2],d[w+3]=h[3],d[w+4]=h[4],d[w+5]=h[5],d[w+6]=h[6],d[w+7]=h[7]}function b(c,d,w){u[0]=c,d[w]=h[7],d[w+1]=h[6],d[w+2]=h[5],d[w+3]=h[4],d[w+4]=h[3],d[w+5]=h[2],d[w+6]=h[1],d[w+7]=h[0]}s.writeDoubleLE=f?g:b,s.writeDoubleBE=f?b:g;function y(c,d){return h[0]=c[d],h[1]=c[d+1],h[2]=c[d+2],h[3]=c[d+3],h[4]=c[d+4],h[5]=c[d+5],h[6]=c[d+6],h[7]=c[d+7],u[0]}function l(c,d){return h[7]=c[d],h[6]=c[d+1],h[5]=c[d+2],h[4]=c[d+3],h[3]=c[d+4],h[2]=c[d+5],h[1]=c[d+6],h[0]=c[d+7],u[0]}s.readDoubleLE=f?y:l,s.readDoubleBE=f?l:y})():(function(){function u(f,g,b,y,l,c){var d=y<0?1:0;if(d&&(y=-y),y===0)f(0,l,c+g),f(1/y>0?0:2147483648,l,c+b);else if(isNaN(y))f(0,l,c+g),f(2146959360,l,c+b);else if(y>17976931348623157e292)f(0,l,c+g),f((d<<31|2146435072)>>>0,l,c+b);else{var w;if(y<22250738585072014e-324)w=y/5e-324,f(w>>>0,l,c+g),f((d<<31|w/4294967296)>>>0,l,c+b);else{var v=Math.floor(Math.log(y)/Math.LN2);v===1024&&(v=1023),w=y*Math.pow(2,-v),f(w*4503599627370496>>>0,l,c+g),f((d<<31|v+1023<<20|w*1048576&1048575)>>>0,l,c+b)}}}s.writeDoubleLE=u.bind(null,n,0,4),s.writeDoubleBE=u.bind(null,i,4,0);function h(f,g,b,y,l){var c=f(y,l+g),d=f(y,l+b),w=(d>>31)*2+1,v=d>>>20&2047,p=4294967296*(d&1048575)+c;return v===2047?p?NaN:w*(1/0):v===0?w*5e-324*p:w*Math.pow(2,v-1075)*(p+4503599627370496)}s.readDoubleLE=h.bind(null,o,0,4),s.readDoubleBE=h.bind(null,a,4,0)})(),s}function n(s,u,h){u[h]=s&255,u[h+1]=s>>>8&255,u[h+2]=s>>>16&255,u[h+3]=s>>>24}function i(s,u,h){u[h]=s>>>24,u[h+1]=s>>>16&255,u[h+2]=s>>>8&255,u[h+3]=s&255}function o(s,u){return(s[u]|s[u+1]<<8|s[u+2]<<16|s[u+3]<<24)>>>0}function a(s,u){return(s[u]<<24|s[u+1]<<16|s[u+2]<<8|s[u+3])>>>0}}}),require_inquire=__commonJS({"node_modules/@protobufjs/inquire/index.js"(exports,module){module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}}}),require_utf8=__commonJS({"node_modules/@protobufjs/utf8/index.js"(r){var t=r;t.length=function(n){for(var i=0,o=0,a=0;a<n.length;++a)o=n.charCodeAt(a),o<128?i+=1:o<2048?i+=2:(o&64512)===55296&&(n.charCodeAt(a+1)&64512)===56320?(++a,i+=4):i+=3;return i},t.read=function(n,i,o){var a=o-i;if(a<1)return"";for(var s=null,u=[],h=0,f;i<o;)f=n[i++],f<128?u[h++]=f:f>191&&f<224?u[h++]=(f&31)<<6|n[i++]&63:f>239&&f<365?(f=((f&7)<<18|(n[i++]&63)<<12|(n[i++]&63)<<6|n[i++]&63)-65536,u[h++]=55296+(f>>10),u[h++]=56320+(f&1023)):u[h++]=(f&15)<<12|(n[i++]&63)<<6|n[i++]&63,h>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,u)),h=0);return s?(h&&s.push(String.fromCharCode.apply(String,u.slice(0,h))),s.join("")):String.fromCharCode.apply(String,u.slice(0,h))},t.write=function(n,i,o){for(var a=o,s,u,h=0;h<n.length;++h)s=n.charCodeAt(h),s<128?i[o++]=s:s<2048?(i[o++]=s>>6|192,i[o++]=s&63|128):(s&64512)===55296&&((u=n.charCodeAt(h+1))&64512)===56320?(s=65536+((s&1023)<<10)+(u&1023),++h,i[o++]=s>>18|240,i[o++]=s>>12&63|128,i[o++]=s>>6&63|128,i[o++]=s&63|128):(i[o++]=s>>12|224,i[o++]=s>>6&63|128,i[o++]=s&63|128);return o-a}}}),require_pool=__commonJS({"node_modules/@protobufjs/pool/index.js"(r,t){t.exports=e;function e(n,i,o){var a=o||8192,s=a>>>1,u=null,h=a;return function(g){if(g<1||g>s)return n(g);h+g>a&&(u=n(a),h=0);var b=i.call(u,h,h+=g);return h&7&&(h=(h|7)+1),b}}}}),require_longbits=__commonJS({"node_modules/protobufjs/src/util/longbits.js"(r,t){t.exports=n;var e=require_minimal();function n(s,u){this.lo=s>>>0,this.hi=u>>>0}var i=n.zero=new n(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(u){if(u===0)return i;var h=u<0;h&&(u=-u);var f=u>>>0,g=(u-f)/4294967296>>>0;return h&&(g=~g>>>0,f=~f>>>0,++f>4294967295&&(f=0,++g>4294967295&&(g=0))),new n(f,g)},n.from=function(u){if(typeof u=="number")return n.fromNumber(u);if(e.isString(u))if(e.Long)u=e.Long.fromString(u);else return n.fromNumber(parseInt(u,10));return u.low||u.high?new n(u.low>>>0,u.high>>>0):i},n.prototype.toNumber=function(u){if(!u&&this.hi>>>31){var h=~this.lo+1>>>0,f=~this.hi>>>0;return h||(f=f+1>>>0),-(h+f*4294967296)}return this.lo+this.hi*4294967296},n.prototype.toLong=function(u){return e.Long?new e.Long(this.lo|0,this.hi|0,!!u):{low:this.lo|0,high:this.hi|0,unsigned:!!u}};var a=String.prototype.charCodeAt;n.fromHash=function(u){return u===o?i:new n((a.call(u,0)|a.call(u,1)<<8|a.call(u,2)<<16|a.call(u,3)<<24)>>>0,(a.call(u,4)|a.call(u,5)<<8|a.call(u,6)<<16|a.call(u,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var u=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^u)>>>0,this.lo=(this.lo<<1^u)>>>0,this},n.prototype.zzDecode=function(){var u=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^u)>>>0,this.hi=(this.hi>>>1^u)>>>0,this},n.prototype.length=function(){var u=this.lo,h=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return f===0?h===0?u<16384?u<128?1:2:u<2097152?3:4:h<16384?h<128?5:6:h<2097152?7:8:f<128?9:10}}}),require_minimal=__commonJS({"node_modules/protobufjs/src/util/minimal.js"(r){var t=r;t.asPromise=require_aspromise(),t.base64=require_base64(),t.EventEmitter=require_eventemitter(),t.float=require_float(),t.inquire=require_inquire(),t.utf8=require_utf8(),t.pool=require_pool(),t.LongBits=require_longbits(),t.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||r,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(o){return typeof o=="number"&&isFinite(o)&&Math.floor(o)===o},t.isString=function(o){return typeof o=="string"||o instanceof String},t.isObject=function(o){return o&&typeof o=="object"},t.isset=t.isSet=function(o,a){var s=o[a];return s!=null&&o.hasOwnProperty(a)?typeof s!="object"||(Array.isArray(s)?s.length:Object.keys(s).length)>0:!1},t.Buffer=(function(){try{var i=t.inquire("buffer").Buffer;return i.prototype.utf8Write?i:null}catch{return null}})(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(o){return typeof o=="number"?t.Buffer?t._Buffer_allocUnsafe(o):new t.Array(o):t.Buffer?t._Buffer_from(o):typeof Uint8Array>"u"?o:new Uint8Array(o)},t.Array=typeof Uint8Array<"u"?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(o){return o?t.LongBits.from(o).toHash():t.LongBits.zeroHash},t.longFromHash=function(o,a){var s=t.LongBits.fromHash(o);return t.Long?t.Long.fromBits(s.lo,s.hi,a):s.toNumber(!!a)};function e(i,o,a){for(var s=Object.keys(o),u=0;u<s.length;++u)(i[s[u]]===void 0||!a)&&(i[s[u]]=o[s[u]]);return i}t.merge=e,t.lcFirst=function(o){return o.charAt(0).toLowerCase()+o.substring(1)};function n(i){function o(a,s){if(!(this instanceof o))return new o(a,s);Object.defineProperty(this,"message",{get:function(){return a}}),Error.captureStackTrace?Error.captureStackTrace(this,o):Object.defineProperty(this,"stack",{value:new Error().stack||""}),s&&e(this,s)}return o.prototype=Object.create(Error.prototype,{constructor:{value:o,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return i},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),o}t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(o){for(var a={},s=0;s<o.length;++s)a[o[s]]=1;return function(){for(var u=Object.keys(this),h=u.length-1;h>-1;--h)if(a[u[h]]===1&&this[u[h]]!==void 0&&this[u[h]]!==null)return u[h]}},t.oneOfSetter=function(o){return function(a){for(var s=0;s<o.length;++s)o[s]!==a&&delete this[o[s]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var i=t.Buffer;if(!i){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=i.from!==Uint8Array.from&&i.from||function(a,s){return new i(a,s)},t._Buffer_allocUnsafe=i.allocUnsafe||function(a){return new i(a)}}}}),require_reader=__commonJS({"node_modules/protobufjs/src/reader.js"(r,t){t.exports=s;var e=require_minimal(),n,i=e.LongBits,o=e.utf8;function a(y,l){return RangeError("index out of range: "+y.pos+" + "+(l||1)+" > "+y.len)}function s(y){this.buf=y,this.pos=0,this.len=y.length}var u=typeof Uint8Array<"u"?function(l){if(l instanceof Uint8Array||Array.isArray(l))return new s(l);throw Error("illegal buffer")}:function(l){if(Array.isArray(l))return new s(l);throw Error("illegal buffer")},h=function(){return e.Buffer?function(c){return(s.create=function(w){return e.Buffer.isBuffer(w)?new n(w):u(w)})(c)}:u};s.create=h(),s.prototype._slice=e.Array.prototype.subarray||e.Array.prototype.slice,s.prototype.uint32=(function(){var l=4294967295;return function(){if(l=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(l=(l|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(l=(l|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(l=(l|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(l=(l|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return l;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return l}})(),s.prototype.int32=function(){return this.uint32()|0},s.prototype.sint32=function(){var l=this.uint32();return l>>>1^-(l&1)|0};function f(){var y=new i(0,0),l=0;if(this.len-this.pos>4){for(;l<4;++l)if(y.lo=(y.lo|(this.buf[this.pos]&127)<<l*7)>>>0,this.buf[this.pos++]<128)return y;if(y.lo=(y.lo|(this.buf[this.pos]&127)<<28)>>>0,y.hi=(y.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return y;l=0}else{for(;l<3;++l){if(this.pos>=this.len)throw a(this);if(y.lo=(y.lo|(this.buf[this.pos]&127)<<l*7)>>>0,this.buf[this.pos++]<128)return y}return y.lo=(y.lo|(this.buf[this.pos++]&127)<<l*7)>>>0,y}if(this.len-this.pos>4){for(;l<5;++l)if(y.hi=(y.hi|(this.buf[this.pos]&127)<<l*7+3)>>>0,this.buf[this.pos++]<128)return y}else for(;l<5;++l){if(this.pos>=this.len)throw a(this);if(y.hi=(y.hi|(this.buf[this.pos]&127)<<l*7+3)>>>0,this.buf[this.pos++]<128)return y}throw Error("invalid varint encoding")}s.prototype.bool=function(){return this.uint32()!==0};function g(y,l){return(y[l-4]|y[l-3]<<8|y[l-2]<<16|y[l-1]<<24)>>>0}s.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return g(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return g(this.buf,this.pos+=4)|0};function b(){if(this.pos+8>this.len)throw a(this,8);return new i(g(this.buf,this.pos+=4),g(this.buf,this.pos+=4))}s.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var l=e.float.readFloatLE(this.buf,this.pos);return this.pos+=4,l},s.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var l=e.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,l},s.prototype.bytes=function(){var l=this.uint32(),c=this.pos,d=this.pos+l;if(d>this.len)throw a(this,l);return this.pos+=l,Array.isArray(this.buf)?this.buf.slice(c,d):c===d?new this.buf.constructor(0):this._slice.call(this.buf,c,d)},s.prototype.string=function(){var l=this.bytes();return o.read(l,0,l.length)},s.prototype.skip=function(l){if(typeof l=="number"){if(this.pos+l>this.len)throw a(this,l);this.pos+=l}else do if(this.pos>=this.len)throw a(this);while(this.buf[this.pos++]&128);return this},s.prototype.skipType=function(y){switch(y){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(y=this.uint32()&7)!==4;)this.skipType(y);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+y+" at offset "+this.pos)}return this},s._configure=function(y){n=y,s.create=h(),n._configure();var l=e.Long?"toLong":"toNumber";e.merge(s.prototype,{int64:function(){return f.call(this)[l](!1)},uint64:function(){return f.call(this)[l](!0)},sint64:function(){return f.call(this).zzDecode()[l](!1)},fixed64:function(){return b.call(this)[l](!0)},sfixed64:function(){return b.call(this)[l](!1)}})}}}),require_reader_buffer=__commonJS({"node_modules/protobufjs/src/reader_buffer.js"(r,t){t.exports=i;var e=require_reader();(i.prototype=Object.create(e.prototype)).constructor=i;var n=require_minimal();function i(o){e.call(this,o)}i._configure=function(){n.Buffer&&(i.prototype._slice=n.Buffer.prototype.slice)},i.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+a,this.len))},i._configure()}}),require_writer=__commonJS({"node_modules/protobufjs/src/writer.js"(r,t){t.exports=f;var e=require_minimal(),n,i=e.LongBits,o=e.base64,a=e.utf8;function s(v,p,m){this.fn=v,this.len=p,this.next=void 0,this.val=m}function u(){}function h(v){this.head=v.head,this.tail=v.tail,this.len=v.len,this.next=v.states}function f(){this.len=0,this.head=new s(u,0,0),this.tail=this.head,this.states=null}var g=function(){return e.Buffer?function(){return(f.create=function(){return new n})()}:function(){return new f}};f.create=g(),f.alloc=function(p){return new e.Array(p)},e.Array!==Array&&(f.alloc=e.pool(f.alloc,e.Array.prototype.subarray)),f.prototype._push=function(p,m,_){return this.tail=this.tail.next=new s(p,m,_),this.len+=m,this};function b(v,p,m){p[m]=v&255}function y(v,p,m){for(;v>127;)p[m++]=v&127|128,v>>>=7;p[m]=v}function l(v,p){this.len=v,this.next=void 0,this.val=p}l.prototype=Object.create(s.prototype),l.prototype.fn=y,f.prototype.uint32=function(p){return this.len+=(this.tail=this.tail.next=new l((p=p>>>0)<128?1:p<16384?2:p<2097152?3:p<268435456?4:5,p)).len,this},f.prototype.int32=function(p){return p<0?this._push(c,10,i.fromNumber(p)):this.uint32(p)},f.prototype.sint32=function(p){return this.uint32((p<<1^p>>31)>>>0)};function c(v,p,m){for(;v.hi;)p[m++]=v.lo&127|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;v.lo>127;)p[m++]=v.lo&127|128,v.lo=v.lo>>>7;p[m++]=v.lo}f.prototype.uint64=function(p){var m=i.from(p);return this._push(c,m.length(),m)},f.prototype.int64=f.prototype.uint64,f.prototype.sint64=function(p){var m=i.from(p).zzEncode();return this._push(c,m.length(),m)},f.prototype.bool=function(p){return this._push(b,1,p?1:0)};function d(v,p,m){p[m]=v&255,p[m+1]=v>>>8&255,p[m+2]=v>>>16&255,p[m+3]=v>>>24}f.prototype.fixed32=function(p){return this._push(d,4,p>>>0)},f.prototype.sfixed32=f.prototype.fixed32,f.prototype.fixed64=function(p){var m=i.from(p);return this._push(d,4,m.lo)._push(d,4,m.hi)},f.prototype.sfixed64=f.prototype.fixed64,f.prototype.float=function(p){return this._push(e.float.writeFloatLE,4,p)},f.prototype.double=function(p){return this._push(e.float.writeDoubleLE,8,p)};var w=e.Array.prototype.set?function(p,m,_){m.set(p,_)}:function(p,m,_){for(var A=0;A<p.length;++A)m[_+A]=p[A]};f.prototype.bytes=function(p){var m=p.length>>>0;if(!m)return this._push(b,1,0);if(e.isString(p)){var _=f.alloc(m=o.length(p));o.decode(p,_,0),p=_}return this.uint32(m)._push(w,m,p)},f.prototype.string=function(p){var m=a.length(p);return m?this.uint32(m)._push(a.write,m,p):this._push(b,1,0)},f.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new s(u,0,0),this.len=0,this},f.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new s(u,0,0),this.len=0),this},f.prototype.ldelim=function(){var p=this.head,m=this.tail,_=this.len;return this.reset().uint32(_),_&&(this.tail.next=p.next,this.tail=m,this.len+=_),this},f.prototype.finish=function(){for(var p=this.head.next,m=this.constructor.alloc(this.len),_=0;p;)p.fn(p.val,m,_),_+=p.len,p=p.next;return m},f._configure=function(v){n=v,f.create=g(),n._configure()}}}),require_writer_buffer=__commonJS({"node_modules/protobufjs/src/writer_buffer.js"(r,t){t.exports=i;var e=require_writer();(i.prototype=Object.create(e.prototype)).constructor=i;var n=require_minimal();function i(){e.call(this)}i._configure=function(){i.alloc=n._Buffer_allocUnsafe,i.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&n.Buffer.prototype.set.name==="set"?function(s,u,h){u.set(s,h)}:function(s,u,h){if(s.copy)s.copy(u,h,0,s.length);else for(var f=0;f<s.length;)u[h++]=s[f++]}},i.prototype.bytes=function(s){n.isString(s)&&(s=n._Buffer_from(s,"base64"));var u=s.length>>>0;return this.uint32(u),u&&this._push(i.writeBytesBuffer,u,s),this};function o(a,s,u){a.length<40?n.utf8.write(a,s,u):s.utf8Write?s.utf8Write(a,u):s.write(a,u)}i.prototype.string=function(s){var u=n.Buffer.byteLength(s);return this.uint32(u),u&&this._push(o,u,s),this},i._configure()}}),require_murmurHash3js=__commonJS({"node_modules/murmurhash3js-revisited/lib/murmurHash3js.js"(r,t){(function(e,n){var i={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function o(c){if(!Array.isArray(c)&&!ArrayBuffer.isView(c))return!1;for(var d=0;d<c.length;d++)if(!Number.isInteger(c[d])||c[d]<0||c[d]>255)return!1;return!0}function a(c,d){return(c&65535)*d+(((c>>>16)*d&65535)<<16)}function s(c,d){return c<<d|c>>>32-d}function u(c){return c^=c>>>16,c=a(c,2246822507),c^=c>>>13,c=a(c,3266489909),c^=c>>>16,c}function h(c,d){c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var w=[0,0,0,0];return w[3]+=c[3]+d[3],w[2]+=w[3]>>>16,w[3]&=65535,w[2]+=c[2]+d[2],w[1]+=w[2]>>>16,w[2]&=65535,w[1]+=c[1]+d[1],w[0]+=w[1]>>>16,w[1]&=65535,w[0]+=c[0]+d[0],w[0]&=65535,[w[0]<<16|w[1],w[2]<<16|w[3]]}function f(c,d){c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var w=[0,0,0,0];return w[3]+=c[3]*d[3],w[2]+=w[3]>>>16,w[3]&=65535,w[2]+=c[2]*d[3],w[1]+=w[2]>>>16,w[2]&=65535,w[2]+=c[3]*d[2],w[1]+=w[2]>>>16,w[2]&=65535,w[1]+=c[1]*d[3],w[0]+=w[1]>>>16,w[1]&=65535,w[1]+=c[2]*d[2],w[0]+=w[1]>>>16,w[1]&=65535,w[1]+=c[3]*d[1],w[0]+=w[1]>>>16,w[1]&=65535,w[0]+=c[0]*d[3]+c[1]*d[2]+c[2]*d[1]+c[3]*d[0],w[0]&=65535,[w[0]<<16|w[1],w[2]<<16|w[3]]}function g(c,d){return d%=64,d===32?[c[1],c[0]]:d<32?[c[0]<<d|c[1]>>>32-d,c[1]<<d|c[0]>>>32-d]:(d-=32,[c[1]<<d|c[0]>>>32-d,c[0]<<d|c[1]>>>32-d])}function b(c,d){return d%=64,d===0?c:d<32?[c[0]<<d|c[1]>>>32-d,c[1]<<d]:[c[1]<<d-32,0]}function y(c,d){return[c[0]^d[0],c[1]^d[1]]}function l(c){return c=y(c,[0,c[0]>>>1]),c=f(c,[4283543511,3981806797]),c=y(c,[0,c[0]>>>1]),c=f(c,[3301882366,444984403]),c=y(c,[0,c[0]>>>1]),c}i.x86.hash32=function(c,d){if(i.inputValidation&&!o(c))return n;d=d||0;for(var w=c.length%4,v=c.length-w,p=d,m=0,_=3432918353,A=461845907,E=0;E<v;E=E+4)m=c[E]|c[E+1]<<8|c[E+2]<<16|c[E+3]<<24,m=a(m,_),m=s(m,15),m=a(m,A),p^=m,p=s(p,13),p=a(p,5)+3864292196;switch(m=0,w){case 3:m^=c[E+2]<<16;case 2:m^=c[E+1]<<8;case 1:m^=c[E],m=a(m,_),m=s(m,15),m=a(m,A),p^=m}return p^=c.length,p=u(p),p>>>0},i.x86.hash128=function(c,d){if(i.inputValidation&&!o(c))return n;d=d||0;for(var w=c.length%16,v=c.length-w,p=d,m=d,_=d,A=d,E=0,S=0,x=0,F=0,T=597399067,N=2869860233,U=951274213,z=2716044179,B=0;B<v;B=B+16)E=c[B]|c[B+1]<<8|c[B+2]<<16|c[B+3]<<24,S=c[B+4]|c[B+5]<<8|c[B+6]<<16|c[B+7]<<24,x=c[B+8]|c[B+9]<<8|c[B+10]<<16|c[B+11]<<24,F=c[B+12]|c[B+13]<<8|c[B+14]<<16|c[B+15]<<24,E=a(E,T),E=s(E,15),E=a(E,N),p^=E,p=s(p,19),p+=m,p=a(p,5)+1444728091,S=a(S,N),S=s(S,16),S=a(S,U),m^=S,m=s(m,17),m+=_,m=a(m,5)+197830471,x=a(x,U),x=s(x,17),x=a(x,z),_^=x,_=s(_,15),_+=A,_=a(_,5)+2530024501,F=a(F,z),F=s(F,18),F=a(F,T),A^=F,A=s(A,13),A+=p,A=a(A,5)+850148119;switch(E=0,S=0,x=0,F=0,w){case 15:F^=c[B+14]<<16;case 14:F^=c[B+13]<<8;case 13:F^=c[B+12],F=a(F,z),F=s(F,18),F=a(F,T),A^=F;case 12:x^=c[B+11]<<24;case 11:x^=c[B+10]<<16;case 10:x^=c[B+9]<<8;case 9:x^=c[B+8],x=a(x,U),x=s(x,17),x=a(x,z),_^=x;case 8:S^=c[B+7]<<24;case 7:S^=c[B+6]<<16;case 6:S^=c[B+5]<<8;case 5:S^=c[B+4],S=a(S,N),S=s(S,16),S=a(S,U),m^=S;case 4:E^=c[B+3]<<24;case 3:E^=c[B+2]<<16;case 2:E^=c[B+1]<<8;case 1:E^=c[B],E=a(E,T),E=s(E,15),E=a(E,N),p^=E}return p^=c.length,m^=c.length,_^=c.length,A^=c.length,p+=m,p+=_,p+=A,m+=p,_+=p,A+=p,p=u(p),m=u(m),_=u(_),A=u(A),p+=m,p+=_,p+=A,m+=p,_+=p,A+=p,("00000000"+(p>>>0).toString(16)).slice(-8)+("00000000"+(m>>>0).toString(16)).slice(-8)+("00000000"+(_>>>0).toString(16)).slice(-8)+("00000000"+(A>>>0).toString(16)).slice(-8)},i.x64.hash128=function(c,d){if(i.inputValidation&&!o(c))return n;d=d||0;for(var w=c.length%16,v=c.length-w,p=[0,d],m=[0,d],_=[0,0],A=[0,0],E=[2277735313,289559509],S=[1291169091,658871167],x=0;x<v;x=x+16)_=[c[x+4]|c[x+5]<<8|c[x+6]<<16|c[x+7]<<24,c[x]|c[x+1]<<8|c[x+2]<<16|c[x+3]<<24],A=[c[x+12]|c[x+13]<<8|c[x+14]<<16|c[x+15]<<24,c[x+8]|c[x+9]<<8|c[x+10]<<16|c[x+11]<<24],_=f(_,E),_=g(_,31),_=f(_,S),p=y(p,_),p=g(p,27),p=h(p,m),p=h(f(p,[0,5]),[0,1390208809]),A=f(A,S),A=g(A,33),A=f(A,E),m=y(m,A),m=g(m,31),m=h(m,p),m=h(f(m,[0,5]),[0,944331445]);switch(_=[0,0],A=[0,0],w){case 15:A=y(A,b([0,c[x+14]],48));case 14:A=y(A,b([0,c[x+13]],40));case 13:A=y(A,b([0,c[x+12]],32));case 12:A=y(A,b([0,c[x+11]],24));case 11:A=y(A,b([0,c[x+10]],16));case 10:A=y(A,b([0,c[x+9]],8));case 9:A=y(A,[0,c[x+8]]),A=f(A,S),A=g(A,33),A=f(A,E),m=y(m,A);case 8:_=y(_,b([0,c[x+7]],56));case 7:_=y(_,b([0,c[x+6]],48));case 6:_=y(_,b([0,c[x+5]],40));case 5:_=y(_,b([0,c[x+4]],32));case 4:_=y(_,b([0,c[x+3]],24));case 3:_=y(_,b([0,c[x+2]],16));case 2:_=y(_,b([0,c[x+1]],8));case 1:_=y(_,[0,c[x]]),_=f(_,E),_=g(_,31),_=f(_,S),p=y(p,_)}return p=y(p,[0,c.length]),m=y(m,[0,c.length]),p=h(p,m),m=h(m,p),p=l(p),m=l(m),p=h(p,m),m=h(m,p),("00000000"+(p[0]>>>0).toString(16)).slice(-8)+("00000000"+(p[1]>>>0).toString(16)).slice(-8)+("00000000"+(m[0]>>>0).toString(16)).slice(-8)+("00000000"+(m[1]>>>0).toString(16)).slice(-8)},typeof r<"u"?(typeof t<"u"&&t.exports&&(r=t.exports=i),r.murmurHash3=i):(i._murmurHash3=e.murmurHash3,i.noConflict=function(){return e.murmurHash3=i._murmurHash3,i._murmurHash3=n,i.noConflict=n,i},e.murmurHash3=i)})(r)}}),require_murmurhash3js_revisited=__commonJS({"node_modules/murmurhash3js-revisited/index.js"(r,t){t.exports=require_murmurHash3js()}}),require_sparse_array=__commonJS({"node_modules/sparse-array/index.js"(r,t){var e=7;t.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(u,h){let f=this._internalPositionFor(u,!1);if(h===void 0)f!==-1&&(this._unsetInternalPos(f),this._unsetBit(u),this._changedLength=!0,this._changedData=!0);else{let g=!1;f===-1?(f=this._data.length,this._setBit(u),this._changedData=!0):g=!0,this._setInternalPos(f,u,h,g),this._changedLength=!0}}unset(u){this.set(u,void 0)}get(u){this._sortData();const h=this._internalPositionFor(u,!0);if(h!==-1)return this._data[h][1]}push(u){return this.set(this.length,u),this.length}get length(){if(this._sortData(),this._changedLength){const u=this._data[this._data.length-1];this._length=u?u[0]+1:0,this._changedLength=!1}return this._length}forEach(u){let h=0;for(;h<this.length;)u(this.get(h),h,this),h++}map(u){let h=0,f=new Array(this.length);for(;h<this.length;)f[h]=u(this.get(h),h,this),h++;return f}reduce(u,h){let f=0,g=h;for(;f<this.length;){const b=this.get(f);g=u(g,b,f),f++}return g}find(u){let h=0,f,g;for(;h<this.length&&!f;)g=this.get(h),f=u(g),h++;return f?g:void 0}_internalPositionFor(u,h){const f=this._bytePosFor(u,h);if(f>=this._bitArrays.length)return-1;const g=this._bitArrays[f],b=u-f*e;if(!((g&1<<b)>0))return-1;const l=this._bitArrays.slice(0,f).reduce(n,0),c=~(4294967295<<b+1),d=i(g&c);return l+d-1}_bytePosFor(u,h){const f=Math.floor(u/e),g=f+1;for(;!h&&this._bitArrays.length<g;)this._bitArrays.push(0);return f}_setBit(u){const h=this._bytePosFor(u,!1);this._bitArrays[h]|=1<<u-h*e}_unsetBit(u){const h=this._bytePosFor(u,!1);this._bitArrays[h]&=~(1<<u-h*e)}_setInternalPos(u,h,f,g){const b=this._data,y=[h,f];if(g)this._sortData(),b[u]=y;else{if(b.length)if(b[b.length-1][0]>=h)b.push(y);else if(b[0][0]<=h)b.unshift(y);else{const l=Math.round(b.length/2);this._data=b.slice(0,l).concat(y).concat(b.slice(l))}else this._data.push(y);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(u){this._data.splice(u,1)}_sortData(){this._changedData&&this._data.sort(o),this._changedData=!1}bitField(){const u=[];let h=8,f=0,g=0,b;const y=this._bitArrays.slice();for(;y.length||f;){f===0&&(b=y.shift(),f=7);const c=Math.min(f,h),d=~(255<<c),w=b&d;g|=w<<8-h,b=b>>>c,f-=c,h-=c,(!h||!f&&!y.length)&&(u.push(g),g=0,h=8)}for(var l=u.length-1;l>0&&u[l]===0;l--)u.pop();return u}compactArray(){return this._sortData(),this._data.map(a)}};function n(s,u){return s+i(u)}function i(s){let u=s;return u=u-(u>>1&1431655765),u=(u&858993459)+(u>>2&858993459),(u+(u>>4)&252645135)*16843009>>24}function o(s,u){return s[0]-u[0]}function a(s){return s[1]}}}),src_exports2={};__export(src_exports2,{calculateMultipleHashesADR32:()=>calculateMultipleHashesADR32,calculateMultipleHashesADR32LegacyQmHash:()=>calculateMultipleHashesADR32LegacyQmHash,compareStrings:()=>compareStrings,hashV0:()=>hashV0,hashV1:()=>hashV1,keccak256Hash:()=>keccak256Hash,prepareADR32Data:()=>prepareADR32Data,sortKeys:()=>sortKeys}),module.exports=__toCommonJS(src_exports2);var import_crypto3=__toESM(requireCryptoBrowserify()),bytes_exports={};__export(bytes_exports,{coerce:()=>coerce,empty:()=>empty,equals:()=>equals,fromHex:()=>fromHex,fromString:()=>fromString,isBinary:()=>isBinary,toHex:()=>toHex,toString:()=>toString});var empty=new Uint8Array(0),toHex=r=>r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),""),fromHex=r=>{const t=r.match(/../g);return t?new Uint8Array(t.map(e=>parseInt(e,16))):empty},equals=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},coerce=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},isBinary=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),fromString=r=>new TextEncoder().encode(r),toString=r=>new TextDecoder().decode(r),encode_1=encode,MSB=128,MSBALL=-128,INT=Math.pow(2,31);function encode(r,t,e){t=t||[],e=e||0;for(var n=e;r>=INT;)t[e++]=r&255|MSB,r/=128;for(;r&MSBALL;)t[e++]=r&255|MSB,r>>>=7;return t[e]=r|0,encode.bytes=e-n+1,t}var decode=read,MSB$1=128,REST$1=127;function read(r,n){var e=0,n=n||0,i=0,o=n,a,s=r.length;do{if(o>=s)throw read.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&REST$1)<<i:(a&REST$1)*Math.pow(2,i),i+=7}while(a>=MSB$1);return read.bytes=o-n,e}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(r){return r<N1?1:r<N2?2:r<N3?3:r<N4?4:r<N5?5:r<N6?6:r<N7?7:r<N8?8:r<N9?9:10},varint={encode:encode_1,decode,encodingLength:length},_brrp_varint=varint,varint_default=_brrp_varint,decode2=(r,t=0)=>[varint_default.decode(r,t),varint_default.decode.bytes],encodeTo=(r,t,e=0)=>(varint_default.encode(r,t,e),t),encodingLength=r=>varint_default.encodingLength(r),create=(r,t)=>{const e=t.byteLength,n=encodingLength(r),i=n+encodingLength(e),o=new Uint8Array(i+e);return encodeTo(r,o,0),encodeTo(e,o,n),o.set(t,i),new Digest(r,e,t,o)},decode3=r=>{const t=coerce(r),[e,n]=decode2(t),[i,o]=decode2(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Digest(e,i,a,t)},equals2=(r,t)=>{if(r===t)return!0;{const e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&equals(r.bytes,e.bytes)}},Digest=class{constructor(r,t,e,n){this.code=r,this.size=t,this.digest=e,this.bytes=n}};function base(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var s=r.length,u=r.charAt(0),h=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var c=0,d=0,w=0,v=l.length;w!==v&&l[w]===0;)w++,c++;for(var p=(v-w)*f+1>>>0,m=new Uint8Array(p);w!==v;){for(var _=l[w],A=0,E=p-1;(_!==0||A<d)&&E!==-1;E--,A++)_+=256*m[E]>>>0,m[E]=_%s>>>0,_=_/s>>>0;if(_!==0)throw new Error("Non-zero carry");d=A,w++}for(var S=p-d;S!==p&&m[S]===0;)S++;for(var x=u.repeat(c);S<p;++S)x+=r.charAt(m[S]);return x}function b(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var c=0;if(l[c]!==" "){for(var d=0,w=0;l[c]===u;)d++,c++;for(var v=(l.length-c)*h+1>>>0,p=new Uint8Array(v);l[c];){var m=e[l.charCodeAt(c)];if(m===255)return;for(var _=0,A=v-1;(m!==0||_<w)&&A!==-1;A--,_++)m+=s*p[A]>>>0,p[A]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");w=_,c++}if(l[c]!==" "){for(var E=v-w;E!==v&&p[E]===0;)E++;for(var S=new Uint8Array(d+(v-E)),x=d;E!==v;)S[x++]=p[E++];return S}}}function y(l){var c=b(l);if(c)return c;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:b,decode:y}}var src=base,_brrp__multiformats_scope_baseX=src,base_x_default=_brrp__multiformats_scope_baseX,Encoder=class{constructor(r,t,e){this.name=r,this.prefix=t,this.baseEncode=e}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},Decoder=class{constructor(r,t,e){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=e}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return or(this,r)}},ComposedDecoder=class{constructor(r){this.decoders=r}or(r){return or(this,r)}decode(r){const t=r[0],e=this.decoders[t];if(e)return e.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or=(r,t)=>new ComposedDecoder({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Codec=class{constructor(r,t,e,n){this.name=r,this.prefix=t,this.baseEncode=e,this.baseDecode=n,this.encoder=new Encoder(r,t,e),this.decoder=new Decoder(r,t,n)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},from=({name:r,prefix:t,encode:e,decode:n})=>new Codec(r,t,e,n),baseX=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=base_x_default(e,t);return from({prefix:r,name:t,encode:n,decode:o=>coerce(i(o))})},decode4=(r,t,e,n)=>{const i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;const a=new Uint8Array(o*e/8|0);let s=0,u=0,h=0;for(let f=0;f<o;++f){const g=i[r[f]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<e|g,s+=e,s>=8&&(s-=8,a[h++]=255&u>>s)}if(s>=e||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode2=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let o="",a=0,s=0;for(let u=0;u<r.length;++u)for(s=s<<8|r[u],a+=8;a>e;)a-=e,o+=t[i&s>>a];if(a&&(o+=t[i&s<<e-a]),n)for(;o.length*e&7;)o+="=";return o},rfc4648=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>from({prefix:t,name:r,encode(i){return encode2(i,n,e)},decode(i){return decode4(i,n,e,r)}}),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"});baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5});rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var format=(r,t)=>{const{bytes:e,version:n}=r;switch(n){case 0:return toStringV0(e,baseCache(r),t||base58btc.encoder);default:return toStringV1(e,baseCache(r),t||base32.encoder)}},cache=new WeakMap,baseCache=r=>{const t=cache.get(r);if(t==null){const e=new Map;return cache.set(r,e),e}return t},CID=class C{constructor(t,e,n,i){this.code=e,this.version=t,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:{const{code:t,multihash:e}=this;if(t!==DAG_PB_CODE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==SHA_256_CODE)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return C.createV0(e)}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:{const{code:t,digest:e}=this.multihash,n=create(t,e);return C.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(t){return C.equals(this,t)}static equals(t,e){const n=e;return n&&t.code===n.code&&t.version===n.version&&equals2(t.multihash,n.multihash)}toString(t){return format(this,t)}toJSON(){return{"/":format(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;const e=t;if(e instanceof C)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){const{version:n,code:i,multihash:o,bytes:a}=e;return new C(n,i,o,a||encodeCID(n,i,o.bytes))}else if(e[cidSymbol]===!0){const{version:n,multihash:i,code:o}=e,a=decode3(i);return C.create(n,o,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==DAG_PB_CODE)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);return new C(t,e,n,n.bytes)}case 1:{const i=encodeCID(t,e,n.bytes);return new C(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return C.create(0,DAG_PB_CODE,t)}static createV1(t,e){return C.create(1,t,e)}static decode(t){const[e,n]=C.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){const e=C.inspectBytes(t),n=e.size-e.multihashSize,i=coerce(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");const o=i.subarray(e.multihashSize-e.digestSize),a=new Digest(e.multihashCode,e.digestSize,o,i);return[e.version===0?C.createV0(a):C.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0;const n=()=>{const[g,b]=decode2(t.subarray(e));return e+=b,g};let i=n(),o=DAG_PB_CODE;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);const a=e,s=n(),u=n(),h=e+u,f=h-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:h}}static parse(t,e){const[n,i]=parseCIDtoBytes(t,e),o=C.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(o).set(n,t),o}},parseCIDtoBytes=(r,t)=>{switch(r[0]){case"Q":{const e=t||base58btc;return[base58btc.prefix,e.decode(`${base58btc.prefix}${r}`)]}case base58btc.prefix:{const e=t||base58btc;return[base58btc.prefix,e.decode(r)]}case base32.prefix:{const e=t||base32;return[base32.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},toStringV0=(r,t,e)=>{const{prefix:n}=e;if(n!==base58btc.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);const i=t.get(n);if(i==null){const o=e.encode(r).slice(1);return t.set(n,o),o}else return i},toStringV1=(r,t,e)=>{const{prefix:n}=e,i=t.get(n);if(i==null){const o=e.encode(r);return t.set(n,o),o}else return i},DAG_PB_CODE=112,SHA_256_CODE=18,encodeCID=(r,t,e)=>{const n=encodingLength(r),i=n+encodingLength(t),o=new Uint8Array(i+e.byteLength);return encodeTo(r,o,0),encodeTo(t,o,n),o.set(e,i),o},cidSymbol=Symbol.for("@ipld/js-cid/CID");__toESM(require_err_code());function isAsyncIterable(r){return r[Symbol.asyncIterator]!=null}function batch(r,t=1){return t=Number(t),isAsyncIterable(r)?(async function*(){let e=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for await(const n of r)for(e.push(n);e.length>=t;)yield e.slice(0,t),e=e.slice(t);for(;e.length>0;)yield e.slice(0,t),e=e.slice(t)})():(function*(){let e=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for(const n of r)for(e.push(n);e.length>=t;)yield e.slice(0,t),e=e.slice(t);for(;e.length>0;)yield e.slice(0,t),e=e.slice(t)})()}var src_default=batch;async function*parallelBatch(r,t=1){for await(const e of src_default(r,t)){const n=e.map(async i=>i().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let i=0;i<n.length;i++){const o=await n[i];if(o.ok)yield o.value;else throw o.err}}}function asUint8Array(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function alloc(r=0){var t;return((t=globalThis.Buffer)==null?void 0:t.alloc)!=null?asUint8Array(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function allocUnsafe(r=0){var t;return((t=globalThis.Buffer)==null?void 0:t.allocUnsafe)!=null?asUint8Array(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function concat(r,t){t==null&&(t=r.reduce((i,o)=>i+o.length,0));const e=allocUnsafe(t);let n=0;for(const i of r)e.set(i,n),n+=i.length;return asUint8Array(e)}function equals3(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var symbol=Symbol.for("@achingbrain/uint8arraylist");function findBufAndOffset(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(const n of r){const i=e+n.byteLength;if(t<i)return{buf:n,index:t-e};e=i}throw new RangeError("index is out of bounds")}function isUint8ArrayList(r){return!!(r!=null&&r[symbol])}var Uint8ArrayList=class M{constructor(...t){Object.defineProperty(this,symbol,{value:!0}),this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(const n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(isUint8ArrayList(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(const n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(isUint8ArrayList(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){const e=findBufAndOffset(this.bufs,t);return e.buf[e.index]}set(t,e){const n=findBufAndOffset(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(isUint8ArrayList(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){const{bufs:n,length:i}=this._subList(t,e);return concat(n,i)}subarray(t,e){const{bufs:n,length:i}=this._subList(t,e);return n.length===1?n[0]:concat(n,i)}sublist(t,e){const{bufs:n,length:i}=this._subList(t,e),o=new M;return o.length=i,o.bufs=n,o}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:[...this.bufs],length:this.length};const n=[];let i=0;for(let o=0;o<this.bufs.length;o++){const a=this.bufs[o],s=i,u=s+a.byteLength;if(i=u,t>=u)continue;const h=t>=s&&t<u,f=e>s&&e<=u;if(h&&f){if(t===s&&e===u){n.push(a);break}const g=t-s;n.push(a.subarray(g,g+(e-t)));break}if(h){if(t===0){n.push(a);continue}n.push(a.subarray(t-s));continue}if(f){if(e===u){n.push(a);break}n.push(a.subarray(0,e-s));break}n.push(a)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!isUint8ArrayList(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;const i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");const o=256,a=new Int32Array(o);for(let g=0;g<o;g++)a[g]=-1;for(let g=0;g<i;g++)a[n[g]]=g;const s=a,u=this.byteLength-n.byteLength,h=n.byteLength-1;let f;for(let g=e;g<=u;g+=f){f=0;for(let b=h;b>=0;b--){const y=this.get(g+b);if(n[b]!==y){f=Math.max(1,b-s[y]);break}}if(f===0)return g}return-1}getInt8(t){const e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){const n=allocUnsafe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){const n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){const i=alloc(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,e,n),this.write(i,t)}getInt32(t,e){const n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){const i=alloc(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,e,n),this.write(i,t)}getBigInt64(t,e){const n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){const i=alloc(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,e,n),this.write(i,t)}getUint8(t){const e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){const n=allocUnsafe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){const n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){const i=alloc(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,e,n),this.write(i,t)}getUint32(t,e){const n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){const i=alloc(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,e,n),this.write(i,t)}getBigUint64(t,e){const n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){const i=alloc(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,e,n),this.write(i,t)}getFloat32(t,e){const n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){const i=alloc(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,e,n),this.write(i,t)}getFloat64(t,e){const n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){const i=alloc(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,e,n),this.write(i,t)}equals(t){if(t==null||!(t instanceof M)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!equals3(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){const n=new M;return n.bufs=t,e==null&&(e=t.reduce((i,o)=>i+o.byteLength,0)),n.length=e,n}},DEFAULT_CHUNK_SIZE=262144,fixedSize=(r={})=>{const t=r.chunkSize??DEFAULT_CHUNK_SIZE;return async function*(n){let i=new Uint8ArrayList,o=0,a=!1;for await(const s of n)for(i.append(s),o+=s.length;o>=t;)if(yield i.slice(0,t),a=!0,t===i.length)i=new Uint8ArrayList,o=0;else{const u=new Uint8ArrayList;u.append(i.sublist(t)),i=u,o-=t}(!a||o>0)&&(yield i.subarray(0,o))}},src_exports={};__export(src_exports,{code:()=>code,createLink:()=>createLink,createNode:()=>createNode,decode:()=>decode5,encode:()=>encode3,name:()=>name,prepare:()=>prepare,validate:()=>validate});var textDecoder=new TextDecoder;function decodeVarint(r,t){let e=0;for(let n=0;;n+=7){if(n>=64)throw new Error("protobuf: varint overflow");if(t>=r.length)throw new Error("protobuf: unexpected end of data");const i=r[t++];if(e+=n<28?(i&127)<<n:(i&127)*2**n,i<128)break}return[e,t]}function decodeBytes(r,t){let e;[e,t]=decodeVarint(r,t);const n=t+e;if(e<0||n<0)throw new Error("protobuf: invalid length");if(n>r.length)throw new Error("protobuf: unexpected end of data");return[r.subarray(t,n),n]}function decodeKey(r,t){let e;return[e,t]=decodeVarint(r,t),[e&7,e>>3,t]}function decodeLink(r){const t={},e=r.length;let n=0;for(;n<e;){let i,o;if([i,o,n]=decodeKey(r,n),o===1){if(t.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Hash`);if(t.Name!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[t.Hash,n]=decodeBytes(r,n)}else if(o===2){if(t.Name!==void 0)throw new Error("protobuf: (PBLink) duplicate Name section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Name`);if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let a;[a,n]=decodeBytes(r,n),t.Name=textDecoder.decode(a)}else if(o===3){if(t.Tsize!==void 0)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(i!==0)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Tsize`);[t.Tsize,n]=decodeVarint(r,n)}else throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${o}`)}if(n>e)throw new Error("protobuf: (PBLink) unexpected end of data");return t}function decodeNode(r){const t=r.length;let e=0,n,i=!1,o;for(;e<t;){let s,u;if([s,u,e]=decodeKey(r,e),s!==2)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${s}`);if(u===1){if(o)throw new Error("protobuf: (PBNode) duplicate Data section");[o,e]=decodeBytes(r,e),n&&(i=!0)}else if(u===2){if(i)throw new Error("protobuf: (PBNode) duplicate Links section");n||(n=[]);let h;[h,e]=decodeBytes(r,e),n.push(decodeLink(h))}else throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${u}`)}if(e>t)throw new Error("protobuf: (PBNode) unexpected end of data");const a={};return o&&(a.Data=o),a.Links=n||[],a}var textEncoder=new TextEncoder,maxInt32=2**32,maxUInt32=2**31;function encodeLink(r,t){let e=t.length;if(typeof r.Tsize=="number"){if(r.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(r.Tsize))throw new Error("Tsize too large for encoding");e=encodeVarint(t,e,r.Tsize)-1,t[e]=24}if(typeof r.Name=="string"){const n=textEncoder.encode(r.Name);e-=n.length,t.set(n,e),e=encodeVarint(t,e,n.length)-1,t[e]=18}return r.Hash&&(e-=r.Hash.length,t.set(r.Hash,e),e=encodeVarint(t,e,r.Hash.length)-1,t[e]=10),t.length-e}function encodeNode(r){const t=sizeNode(r),e=new Uint8Array(t);let n=t;if(r.Data&&(n-=r.Data.length,e.set(r.Data,n),n=encodeVarint(e,n,r.Data.length)-1,e[n]=10),r.Links)for(let i=r.Links.length-1;i>=0;i--){const o=encodeLink(r.Links[i],e.subarray(0,n));n-=o,n=encodeVarint(e,n,o)-1,e[n]=18}return e}function sizeLink(r){let t=0;if(r.Hash){const e=r.Hash.length;t+=1+e+sov(e)}if(typeof r.Name=="string"){const e=textEncoder.encode(r.Name).length;t+=1+e+sov(e)}return typeof r.Tsize=="number"&&(t+=1+sov(r.Tsize)),t}function sizeNode(r){let t=0;if(r.Data){const e=r.Data.length;t+=1+e+sov(e)}if(r.Links)for(const e of r.Links){const n=sizeLink(e);t+=1+n+sov(n)}return t}function encodeVarint(r,t,e){t-=sov(e);const n=t;for(;e>=maxUInt32;)r[t++]=e&127|128,e/=128;for(;e>=128;)r[t++]=e&127|128,e>>>=7;return r[t]=e,n}function sov(r){return r%2===0&&r++,Math.floor((len64(r)+6)/7)}function len64(r){let t=0;return r>=maxInt32&&(r=Math.floor(r/maxInt32),t=32),r>=65536&&(r>>>=16,t+=16),r>=256&&(r>>>=8,t+=8),t+len8tab[r]}var len8tab=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8],pbNodeProperties=["Data","Links"],pbLinkProperties=["Hash","Name","Tsize"],textEncoder2=new TextEncoder;function linkComparator(r,t){if(r===t)return 0;const e=r.Name?textEncoder2.encode(r.Name):[],n=t.Name?textEncoder2.encode(t.Name):[];let i=e.length,o=n.length;for(let a=0,s=Math.min(i,o);a<s;++a)if(e[a]!==n[a]){i=e[a],o=n[a];break}return i<o?-1:o<i?1:0}function hasOnlyProperties(r,t){return!Object.keys(r).some(e=>!t.includes(e))}function asLink(r){if(typeof r.asCID=="object"){const e=CID.asCID(r);if(!e)throw new TypeError("Invalid DAG-PB form");return{Hash:e}}if(typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form");const t={};if(r.Hash){let e=CID.asCID(r.Hash);try{e||(typeof r.Hash=="string"?e=CID.parse(r.Hash):r.Hash instanceof Uint8Array&&(e=CID.decode(r.Hash)))}catch(n){throw new TypeError(`Invalid DAG-PB form: ${n.message}`)}e&&(t.Hash=e)}if(!t.Hash)throw new TypeError("Invalid DAG-PB form");return typeof r.Name=="string"&&(t.Name=r.Name),typeof r.Tsize=="number"&&(t.Tsize=r.Tsize),t}function prepare(r){if((r instanceof Uint8Array||typeof r=="string")&&(r={Data:r}),typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form");const t={};if(r.Data!==void 0)if(typeof r.Data=="string")t.Data=textEncoder2.encode(r.Data);else if(r.Data instanceof Uint8Array)t.Data=r.Data;else throw new TypeError("Invalid DAG-PB form");if(r.Links!==void 0)if(Array.isArray(r.Links))t.Links=r.Links.map(asLink),t.Links.sort(linkComparator);else throw new TypeError("Invalid DAG-PB form");else t.Links=[];return t}function validate(r){if(!r||typeof r!="object"||Array.isArray(r)||r instanceof Uint8Array||r["/"]&&r["/"]===r.bytes)throw new TypeError("Invalid DAG-PB form");if(!hasOnlyProperties(r,pbNodeProperties))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(r.Data!==void 0&&!(r.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be bytes)");if(!Array.isArray(r.Links))throw new TypeError("Invalid DAG-PB form (Links must be a list)");for(let t=0;t<r.Links.length;t++){const e=r.Links[t];if(!e||typeof e!="object"||Array.isArray(e)||e instanceof Uint8Array||e["/"]&&e["/"]===e.bytes)throw new TypeError("Invalid DAG-PB form (bad link)");if(!hasOnlyProperties(e,pbLinkProperties))throw new TypeError("Invalid DAG-PB form (extraneous properties on link)");if(e.Hash===void 0)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(e.Hash==null||!e.Hash["/"]||e.Hash["/"]!==e.Hash.bytes)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(e.Name!==void 0&&typeof e.Name!="string")throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(e.Tsize!==void 0){if(typeof e.Tsize!="number"||e.Tsize%1!==0)throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(e.Tsize<0)throw new TypeError("Invalid DAG-PB form (link Tsize cannot be negative)")}if(t>0&&linkComparator(e,r.Links[t-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function createNode(r,t=[]){return prepare({Data:r,Links:t})}function createLink(r,t,e){return asLink({Hash:e,Name:r,Tsize:t})}var name="dag-pb",code=112;function encode3(r){validate(r);const t={};return r.Links&&(t.Links=r.Links.map(e=>{const n={};return e.Hash&&(n.Hash=e.Hash.bytes),e.Name!==void 0&&(n.Name=e.Name),e.Tsize!==void 0&&(n.Tsize=e.Tsize),n})),r.Data&&(t.Data=r.Data),encodeNode(t)}function decode5(r){const t=decodeNode(r),e={};return t.Data&&(e.Data=t.Data),t.Links&&(e.Links=t.Links.map(n=>{const i={};try{i.Hash=CID.decode(n.Hash)}catch{}if(!i.Hash)throw new Error("Invalid Hash field found in link, expected CID");return n.Name!==void 0&&(i.Name=n.Name),n.Tsize!==void 0&&(i.Tsize=n.Tsize),i})),e}var import_err_code=__toESM(require_err_code()),import_reader=__toESM(require_reader()),import_reader_buffer=__toESM(require_reader_buffer()),import_minimal=__toESM(require_minimal()),import_writer=__toESM(require_writer()),import_writer_buffer=__toESM(require_writer_buffer());function configure(){import_minimal.default._configure(),import_reader.default._configure(import_reader_buffer.default),import_writer.default._configure(import_writer_buffer.default)}configure();var methods=["uint64","int64","sint64","fixed64","sfixed64"];function patchReader(r){for(const t of methods){if(r[t]==null)continue;const e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function reader(r){return patchReader(new import_reader.default(r))}function patchWriter(r){for(const t of methods){if(r[t]==null)continue;const e=r[t];r[t]=function(n){return e.call(this,n.toString())}}return r}function writer(){return patchWriter(import_writer.default.create())}function decodeMessage(r,t){const e=reader(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function encodeMessage(r,t){const e=writer();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var CODEC_TYPES;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function enumeration(r){function t(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}const e=function(o,a){const s=t(o);a.int32(s)},n=function(o){const a=o.int32();return t(a)};return createCodec("enum",CODEC_TYPES.VARINT,e,n)}function message(r,t){return createCodec("message",CODEC_TYPES.LENGTH_DELIMITED,r,t)}var Data;(function(r){(function(n){n.Raw="Raw",n.Directory="Directory",n.File="File",n.Metadata="Metadata",n.Symlink="Symlink",n.HAMTShard="HAMTShard"})(r.DataType||(r.DataType={}));let t;(function(n){n[n.Raw=0]="Raw",n[n.Directory=1]="Directory",n[n.File=2]="File",n[n.Metadata=3]="Metadata",n[n.Symlink=4]="Symlink",n[n.HAMTShard=5]="HAMTShard"})(t||(t={})),(function(n){n.codec=()=>enumeration(t)})(r.DataType||(r.DataType={}));let e;r.codec=()=>(e==null&&(e=message((n,i,o={})=>{if(o.lengthDelimited!==!1&&i.fork(),n.Type!=null&&(i.uint32(8),r.DataType.codec().encode(n.Type,i)),n.Data!=null&&(i.uint32(18),i.bytes(n.Data)),n.filesize!=null&&(i.uint32(24),i.uint64(n.filesize)),n.blocksizes!=null)for(const a of n.blocksizes)i.uint32(32),i.uint64(a);n.hashType!=null&&(i.uint32(40),i.uint64(n.hashType)),n.fanout!=null&&(i.uint32(48),i.uint64(n.fanout)),n.mode!=null&&(i.uint32(56),i.uint32(n.mode)),n.mtime!=null&&(i.uint32(66),UnixTime.codec().encode(n.mtime,i)),o.lengthDelimited!==!1&&i.ldelim()},(n,i)=>{const o={blocksizes:[]},a=i==null?n.len:n.pos+i;for(;n.pos<a;){const s=n.uint32();switch(s>>>3){case 1:o.Type=r.DataType.codec().decode(n);break;case 2:o.Data=n.bytes();break;case 3:o.filesize=n.uint64();break;case 4:o.blocksizes.push(n.uint64());break;case 5:o.hashType=n.uint64();break;case 6:o.fanout=n.uint64();break;case 7:o.mode=n.uint32();break;case 8:o.mtime=UnixTime.codec().decode(n,n.uint32());break;default:n.skipType(s&7);break}}return o})),e),r.encode=n=>encodeMessage(n,r.codec()),r.decode=n=>decodeMessage(n,r.codec())})(Data||(Data={}));var UnixTime;(function(r){let t;r.codec=()=>(t==null&&(t=message((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.Seconds!=null&&(n.uint32(8),n.int64(e.Seconds)),e.FractionalNanoseconds!=null&&(n.uint32(21),n.fixed32(e.FractionalNanoseconds)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{const i={},o=n==null?e.len:e.pos+n;for(;e.pos<o;){const a=e.uint32();switch(a>>>3){case 1:i.Seconds=e.int64();break;case 2:i.FractionalNanoseconds=e.fixed32();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>encodeMessage(e,r.codec()),r.decode=e=>decodeMessage(e,r.codec())})(UnixTime||(UnixTime={}));var Metadata;(function(r){let t;r.codec=()=>(t==null&&(t=message((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.MimeType!=null&&(n.uint32(10),n.string(e.MimeType)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{const i={},o=n==null?e.len:e.pos+n;for(;e.pos<o;){const a=e.uint32();switch(a>>>3){case 1:i.MimeType=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>encodeMessage(e,r.codec()),r.decode=e=>decodeMessage(e,r.codec())})(Metadata||(Metadata={}));var types={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},dirTypes=["directory","hamt-sharded-directory"],DEFAULT_FILE_MODE=parseInt("0644",8),DEFAULT_DIRECTORY_MODE=parseInt("0755",8),UnixFS=class P{constructor(t={type:"file"}){D(this,"type");D(this,"data");D(this,"blockSizes");D(this,"hashType");D(this,"fanout");D(this,"mtime");D(this,"_mode");D(this,"_originalMode");const{type:e,data:n,blockSizes:i,hashType:o,fanout:a,mtime:s,mode:u}=t;if(e!=null&&!Object.values(types).includes(e))throw(0,import_err_code.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e??"file",this.data=n,this.hashType=o,this.fanout=a,this.blockSizes=i??[],this._originalMode=0,this.mode=u,this.mtime=s}static unmarshal(t){const e=Data.decode(t),n=new P({type:types[e.Type!=null?e.Type.toString():"File"],data:e.Data,blockSizes:e.blocksizes,mode:e.mode,mtime:e.mtime!=null?{secs:e.mtime.Seconds??0n,nsecs:e.mtime.FractionalNanoseconds}:void 0});return n._originalMode=e.mode??0,n}set mode(t){t==null?this._mode=this.isDirectory()?DEFAULT_DIRECTORY_MODE:DEFAULT_FILE_MODE:this._mode=t&4095}get mode(){return this._mode}isDirectory(){return dirTypes.includes(this.type)}addBlockSize(t){this.blockSizes.push(t)}removeBlockSize(t){this.blockSizes.splice(t,1)}fileSize(){if(this.isDirectory())return 0n;let t=0n;return this.blockSizes.forEach(e=>{t+=e}),this.data!=null&&(t+=BigInt(this.data.length)),t}marshal(){let t;switch(this.type){case"raw":t=Data.DataType.Raw;break;case"directory":t=Data.DataType.Directory;break;case"file":t=Data.DataType.File;break;case"metadata":t=Data.DataType.Metadata;break;case"symlink":t=Data.DataType.Symlink;break;case"hamt-sharded-directory":t=Data.DataType.HAMTShard;break;default:throw(0,import_err_code.default)(new Error(`Type: ${t} is not valid`),"ERR_INVALID_TYPE")}let e=this.data;(this.data==null||this.data.length===0)&&(e=void 0);let n;this.mode!=null&&(n=this._originalMode&4294963200|(this.mode??0),n===DEFAULT_FILE_MODE&&!this.isDirectory()&&(n=void 0),n===DEFAULT_DIRECTORY_MODE&&this.isDirectory()&&(n=void 0));let i;return this.mtime!=null&&(i={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),Data.encode({Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:n,mtime:i})}},raw_exports={};__export(raw_exports,{code:()=>code2,decode:()=>decode6,encode:()=>encode4,name:()=>name2});var equals4=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},coerce2=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},name2="raw",code2=85,encode4=r=>coerce2(r),decode6=r=>coerce2(r),CustomProgressEvent=class extends Event{constructor(r,t){super(r),this.detail=t}},encode_12=encode5,MSB2=128,MSBALL2=-128,INT2=Math.pow(2,31);function encode5(r,t,e){t=t||[],e=e||0;for(var n=e;r>=INT2;)t[e++]=r&255|MSB2,r/=128;for(;r&MSBALL2;)t[e++]=r&255|MSB2,r>>>=7;return t[e]=r|0,encode5.bytes=e-n+1,t}var decode7=read2,MSB$12=128,REST$12=127;function read2(r,n){var e=0,n=n||0,i=0,o=n,a,s=r.length;do{if(o>=s)throw read2.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&REST$12)<<i:(a&REST$12)*Math.pow(2,i),i+=7}while(a>=MSB$12);return read2.bytes=o-n,e}var N12=Math.pow(2,7),N22=Math.pow(2,14),N32=Math.pow(2,21),N42=Math.pow(2,28),N52=Math.pow(2,35),N62=Math.pow(2,42),N72=Math.pow(2,49),N82=Math.pow(2,56),N92=Math.pow(2,63),length2=function(r){return r<N12?1:r<N22?2:r<N32?3:r<N42?4:r<N52?5:r<N62?6:r<N72?7:r<N82?8:r<N92?9:10},varint2={encode:encode_12,decode:decode7,encodingLength:length2},_brrp_varint2=varint2,varint_default2=_brrp_varint2,decode8=(r,t=0)=>[varint_default2.decode(r,t),varint_default2.decode.bytes],encodeTo2=(r,t,e=0)=>(varint_default2.encode(r,t,e),t),encodingLength2=r=>varint_default2.encodingLength(r),create2=(r,t)=>{const e=t.byteLength,n=encodingLength2(r),i=n+encodingLength2(e),o=new Uint8Array(i+e);return encodeTo2(r,o,0),encodeTo2(e,o,n),o.set(t,i),new Digest2(r,e,t,o)},decode9=r=>{const t=coerce2(r),[e,n]=decode8(t),[i,o]=decode8(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Digest2(e,i,a,t)},equals5=(r,t)=>{if(r===t)return!0;{const e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&equals4(r.bytes,e.bytes)}},Digest2=class{constructor(r,t,e,n){this.code=r,this.size=t,this.digest=e,this.bytes=n}};function base2(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var s=r.length,u=r.charAt(0),h=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var c=0,d=0,w=0,v=l.length;w!==v&&l[w]===0;)w++,c++;for(var p=(v-w)*f+1>>>0,m=new Uint8Array(p);w!==v;){for(var _=l[w],A=0,E=p-1;(_!==0||A<d)&&E!==-1;E--,A++)_+=256*m[E]>>>0,m[E]=_%s>>>0,_=_/s>>>0;if(_!==0)throw new Error("Non-zero carry");d=A,w++}for(var S=p-d;S!==p&&m[S]===0;)S++;for(var x=u.repeat(c);S<p;++S)x+=r.charAt(m[S]);return x}function b(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var c=0;if(l[c]!==" "){for(var d=0,w=0;l[c]===u;)d++,c++;for(var v=(l.length-c)*h+1>>>0,p=new Uint8Array(v);l[c];){var m=e[l.charCodeAt(c)];if(m===255)return;for(var _=0,A=v-1;(m!==0||_<w)&&A!==-1;A--,_++)m+=s*p[A]>>>0,p[A]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");w=_,c++}if(l[c]!==" "){for(var E=v-w;E!==v&&p[E]===0;)E++;for(var S=new Uint8Array(d+(v-E)),x=d;E!==v;)S[x++]=p[E++];return S}}}function y(l){var c=b(l);if(c)return c;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:b,decode:y}}var src2=base2,_brrp__multiformats_scope_baseX2=src2,base_x_default2=_brrp__multiformats_scope_baseX2,Encoder2=class{constructor(r,t,e){this.name=r,this.prefix=t,this.baseEncode=e}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},Decoder2=class{constructor(r,t,e){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=e}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return or2(this,r)}},ComposedDecoder2=class{constructor(r){this.decoders=r}or(r){return or2(this,r)}decode(r){const t=r[0],e=this.decoders[t];if(e)return e.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or2=(r,t)=>new ComposedDecoder2({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Codec2=class{constructor(r,t,e,n){this.name=r,this.prefix=t,this.baseEncode=e,this.baseDecode=n,this.encoder=new Encoder2(r,t,e),this.decoder=new Decoder2(r,t,n)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},from2=({name:r,prefix:t,encode:e,decode:n})=>new Codec2(r,t,e,n),baseX2=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=base_x_default2(e,t);return from2({prefix:r,name:t,encode:n,decode:o=>coerce2(i(o))})},decode10=(r,t,e,n)=>{const i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;const a=new Uint8Array(o*e/8|0);let s=0,u=0,h=0;for(let f=0;f<o;++f){const g=i[r[f]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<e|g,s+=e,s>=8&&(s-=8,a[h++]=255&u>>s)}if(s>=e||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode6=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let o="",a=0,s=0;for(let u=0;u<r.length;++u)for(s=s<<8|r[u],a+=8;a>e;)a-=e,o+=t[i&s>>a];if(a&&(o+=t[i&s<<e-a]),n)for(;o.length*e&7;)o+="=";return o},rfc46482=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>from2({prefix:t,name:r,encode(i){return encode6(i,n,e)},decode(i){return decode10(i,n,e,r)}}),base58btc2=baseX2({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"});baseX2({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var base322=rfc46482({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5});rfc46482({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rfc46482({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rfc46482({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rfc46482({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rfc46482({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rfc46482({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),rfc46482({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rfc46482({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var format2=(r,t)=>{const{bytes:e,version:n}=r;switch(n){case 0:return toStringV02(e,baseCache2(r),t||base58btc2.encoder);default:return toStringV12(e,baseCache2(r),t||base322.encoder)}},cache2=new WeakMap,baseCache2=r=>{const t=cache2.get(r);if(t==null){const e=new Map;return cache2.set(r,e),e}return t},CID2=class k{constructor(t,e,n,i){this.code=e,this.version=t,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:{const{code:t,multihash:e}=this;if(t!==DAG_PB_CODE2)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==SHA_256_CODE2)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return k.createV0(e)}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:{const{code:t,digest:e}=this.multihash,n=create2(t,e);return k.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(t){return k.equals(this,t)}static equals(t,e){const n=e;return n&&t.code===n.code&&t.version===n.version&&equals5(t.multihash,n.multihash)}toString(t){return format2(this,t)}toJSON(){return{"/":format2(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;const e=t;if(e instanceof k)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){const{version:n,code:i,multihash:o,bytes:a}=e;return new k(n,i,o,a||encodeCID2(n,i,o.bytes))}else if(e[cidSymbol2]===!0){const{version:n,multihash:i,code:o}=e,a=decode9(i);return k.create(n,o,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==DAG_PB_CODE2)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE2}) block encoding`);return new k(t,e,n,n.bytes)}case 1:{const i=encodeCID2(t,e,n.bytes);return new k(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return k.create(0,DAG_PB_CODE2,t)}static createV1(t,e){return k.create(1,t,e)}static decode(t){const[e,n]=k.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){const e=k.inspectBytes(t),n=e.size-e.multihashSize,i=coerce2(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");const o=i.subarray(e.multihashSize-e.digestSize),a=new Digest2(e.multihashCode,e.digestSize,o,i);return[e.version===0?k.createV0(a):k.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0;const n=()=>{const[g,b]=decode8(t.subarray(e));return e+=b,g};let i=n(),o=DAG_PB_CODE2;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);const a=e,s=n(),u=n(),h=e+u,f=h-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:h}}static parse(t,e){const[n,i]=parseCIDtoBytes2(t,e),o=k.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache2(o).set(n,t),o}},parseCIDtoBytes2=(r,t)=>{switch(r[0]){case"Q":{const e=t||base58btc2;return[base58btc2.prefix,e.decode(`${base58btc2.prefix}${r}`)]}case base58btc2.prefix:{const e=t||base58btc2;return[base58btc2.prefix,e.decode(r)]}case base322.prefix:{const e=t||base322;return[base322.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},toStringV02=(r,t,e)=>{const{prefix:n}=e;if(n!==base58btc2.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);const i=t.get(n);if(i==null){const o=e.encode(r).slice(1);return t.set(n,o),o}else return i},toStringV12=(r,t,e)=>{const{prefix:n}=e,i=t.get(n);if(i==null){const o=e.encode(r);return t.set(n,o),o}else return i},DAG_PB_CODE2=112,SHA_256_CODE2=18,encodeCID2=(r,t,e)=>{const n=encodingLength2(r),i=n+encodingLength2(t),o=new Uint8Array(i+e.byteLength);return encodeTo2(r,o,0),encodeTo2(t,o,n),o.set(e,i),o},cidSymbol2=Symbol.for("@ipld/js-cid/CID"),import_crypto=__toESM(requireCryptoBrowserify()),from3=({name:r,code:t,encode:e})=>new Hasher(r,t,e),Hasher=class{constructor(r,t,e){this.name=r,this.code=t,this.encode=e}digest(r){if(r instanceof Uint8Array){const t=this.encode(r);return t instanceof Uint8Array?create2(this.code,t):t.then(e=>create2(this.code,e))}else throw Error("Unknown type, must be binary type")}},sha256=from3({name:"sha2-256",code:18,encode:r=>coerce2(import_crypto.default.createHash("sha256").update(r).digest())}),persist=async(r,t,e)=>{e.codec==null&&(e.codec=src_exports);const n=await sha256.digest(r),i=CID2.create(e.cidVersion,e.codec.code,n);return await t.put(i,r,e),i};function defaultBufferImporter(r){return async function*(e,n){let i=0n;for await(let o of e.content)yield async()=>{var h;let a;const s={codec:src_exports,cidVersion:r.cidVersion,onProgress:r.onProgress};r.rawLeaves?(s.codec=raw_exports,s.cidVersion=1):(a=new UnixFS({type:r.leafType,data:o}),o=encode3({Data:a.marshal(),Links:[]}));const u=await persist(o,n,s);return i+=BigInt(o.byteLength),(h=r.onProgress)==null||h.call(r,new CustomProgressEvent("unixfs:importer:progress:file:write",{bytesWritten:i,cid:u,path:e.path})),{cid:u,unixfs:a,size:BigInt(o.length),block:o}}}}var import_err_code2=__toESM(require_err_code()),dirBuilder=async(r,t,e)=>{const n=new UnixFS({type:"directory",mtime:r.mtime,mode:r.mode}),i=encode3(prepare({Data:n.marshal()})),o=await persist(i,t,e),a=r.path;return{cid:o,path:a,unixfs:n,size:BigInt(i.length),originalPath:r.originalPath,block:i}};async function*buildFileBatch(r,t,e){let n=-1,i;for await(const o of parallelBatch(e.bufferImporter(r,t),e.blockWriteConcurrency)){if(n++,n===0){i={...o,single:!0};continue}else n===1&&i!=null&&(yield{...i,block:void 0,single:void 0},i=void 0);yield{...o,block:void 0}}i!=null&&(yield i)}function isSingleBlockImport(r){return r.single===!0}var reduce=(r,t,e)=>async function(i){var f,g;if(i.length===1&&isSingleBlockImport(i[0])&&e.reduceSingleLeafToSelf){const b=i[0];let y=b.block;return isSingleBlockImport(b)&&(r.mtime!==void 0||r.mode!==void 0)&&(b.unixfs=new UnixFS({type:"file",mtime:r.mtime,mode:r.mode,data:b.block}),y={Data:b.unixfs.marshal(),Links:[]},b.block=encode3(prepare(y)),b.cid=await persist(b.block,t,{...e,cidVersion:e.cidVersion}),b.size=BigInt(b.block.length)),(f=e.onProgress)==null||f.call(e,new CustomProgressEvent("unixfs:importer:progress:file:layout",{cid:b.cid,path:b.originalPath})),{cid:b.cid,path:r.path,unixfs:b.unixfs,size:b.size,originalPath:b.originalPath}}const o=new UnixFS({type:"file",mtime:r.mtime,mode:r.mode}),a=i.filter(b=>{var y,l;return b.cid.code===code2&&b.size>0||b.unixfs!=null&&b.unixfs.data==null&&b.unixfs.fileSize()>0n?!0:!!((l=(y=b.unixfs)==null?void 0:y.data)!=null&&l.length)}).map(b=>{var y;return b.cid.code===code2?(o.addBlockSize(b.size),{Name:"",Tsize:Number(b.size),Hash:b.cid}):(b.unixfs==null||b.unixfs.data==null?o.addBlockSize(((y=b.unixfs)==null?void 0:y.fileSize())??0n):o.addBlockSize(BigInt(b.unixfs.data.length)),{Name:"",Tsize:Number(b.size),Hash:b.cid})}),s={Data:o.marshal(),Links:a},u=encode3(prepare(s)),h=await persist(u,t,e);return(g=e.onProgress)==null||g.call(e,new CustomProgressEvent("unixfs:importer:progress:file:layout",{cid:h,path:r.originalPath})),{cid:h,path:r.path,unixfs:o,size:BigInt(u.length+s.Links.reduce((b,y)=>b+(y.Tsize??0),0)),originalPath:r.originalPath,block:u}},fileBuilder=async(r,t,e)=>e.layout(buildFileBatch(r,t,e),reduce(r,t,e));function isIterable(r){return Symbol.iterator in r}function isAsyncIterable2(r){return Symbol.asyncIterator in r}function contentAsAsyncIterable(r){try{if(r instanceof Uint8Array)return(async function*(){yield r})();if(isIterable(r))return(async function*(){yield*r})();if(isAsyncIterable2(r))return r}catch{throw(0,import_err_code2.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,import_err_code2.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}function defaultDagBuilder(r){return async function*(e,n){for await(const i of e){let o;if(i.path!=null&&(o=i.path,i.path=i.path.split("/").filter(a=>a!=null&&a!==".").join("/")),isFileCandidate(i)){const a={path:i.path,mtime:i.mtime,mode:i.mode,content:(async function*(){var u;let s=0n;for await(const h of r.chunker(r.chunkValidator(contentAsAsyncIterable(i.content)))){const f=BigInt(h.byteLength);s+=f,(u=r.onProgress)==null||u.call(r,new CustomProgressEvent("unixfs:importer:progress:file:read",{bytesRead:s,chunkSize:f,path:i.path})),yield h}})(),originalPath:o};yield async()=>fileBuilder(a,n,r)}else if(i.path!=null){const a={path:i.path,mtime:i.mtime,mode:i.mode,originalPath:o};yield async()=>dirBuilder(a,n,r)}else throw new Error("Import candidate must have content or path or both")}}}function isFileCandidate(r){return r.content!=null}var import_err_code3=__toESM(require_err_code()),identity_exports={};__export(identity_exports,{identity:()=>identity});function base3(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var s=r.length,u=r.charAt(0),h=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var c=0,d=0,w=0,v=l.length;w!==v&&l[w]===0;)w++,c++;for(var p=(v-w)*f+1>>>0,m=new Uint8Array(p);w!==v;){for(var _=l[w],A=0,E=p-1;(_!==0||A<d)&&E!==-1;E--,A++)_+=256*m[E]>>>0,m[E]=_%s>>>0,_=_/s>>>0;if(_!==0)throw new Error("Non-zero carry");d=A,w++}for(var S=p-d;S!==p&&m[S]===0;)S++;for(var x=u.repeat(c);S<p;++S)x+=r.charAt(m[S]);return x}function b(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var c=0;if(l[c]!==" "){for(var d=0,w=0;l[c]===u;)d++,c++;for(var v=(l.length-c)*h+1>>>0,p=new Uint8Array(v);l[c];){var m=e[l.charCodeAt(c)];if(m===255)return;for(var _=0,A=v-1;(m!==0||_<w)&&A!==-1;A--,_++)m+=s*p[A]>>>0,p[A]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");w=_,c++}if(l[c]!==" "){for(var E=v-w;E!==v&&p[E]===0;)E++;for(var S=new Uint8Array(d+(v-E)),x=d;E!==v;)S[x++]=p[E++];return S}}}function y(l){var c=b(l);if(c)return c;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:b,decode:y}}var src3=base3,_brrp__multiformats_scope_baseX3=src3,base_x_default3=_brrp__multiformats_scope_baseX3,coerce3=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},fromString2=r=>new TextEncoder().encode(r),toString2=r=>new TextDecoder().decode(r),Encoder3=class{constructor(r,t,e){this.name=r,this.prefix=t,this.baseEncode=e}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},Decoder3=class{constructor(r,t,e){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=e}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return or3(this,r)}},ComposedDecoder3=class{constructor(r){this.decoders=r}or(r){return or3(this,r)}decode(r){const t=r[0],e=this.decoders[t];if(e)return e.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or3=(r,t)=>new ComposedDecoder3({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Codec3=class{constructor(r,t,e,n){this.name=r,this.prefix=t,this.baseEncode=e,this.baseDecode=n,this.encoder=new Encoder3(r,t,e),this.decoder=new Decoder3(r,t,n)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},from4=({name:r,prefix:t,encode:e,decode:n})=>new Codec3(r,t,e,n),baseX3=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=base_x_default3(e,t);return from4({prefix:r,name:t,encode:n,decode:o=>coerce3(i(o))})},decode11=(r,t,e,n)=>{const i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;const a=new Uint8Array(o*e/8|0);let s=0,u=0,h=0;for(let f=0;f<o;++f){const g=i[r[f]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<e|g,s+=e,s>=8&&(s-=8,a[h++]=255&u>>s)}if(s>=e||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode7=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let o="",a=0,s=0;for(let u=0;u<r.length;++u)for(s=s<<8|r[u],a+=8;a>e;)a-=e,o+=t[i&s>>a];if(a&&(o+=t[i&s<<e-a]),n)for(;o.length*e&7;)o+="=";return o},rfc46483=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>from4({prefix:t,name:r,encode(i){return encode7(i,n,e)},decode(i){return decode11(i,n,e,r)}}),identity=from4({prefix:"\0",name:"identity",encode:r=>toString2(r),decode:r=>fromString2(r)}),base2_exports={};__export(base2_exports,{base2:()=>base22});var base22=rfc46483({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base8_exports={};__export(base8_exports,{base8:()=>base8});var base8=rfc46483({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base10_exports={};__export(base10_exports,{base10:()=>base10});var base10=baseX3({prefix:"9",name:"base10",alphabet:"0123456789"}),base16_exports={};__export(base16_exports,{base16:()=>base16,base16upper:()=>base16upper});var base16=rfc46483({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc46483({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base32_exports={};__export(base32_exports,{base32:()=>base323,base32hex:()=>base32hex3,base32hexpad:()=>base32hexpad3,base32hexpadupper:()=>base32hexpadupper3,base32hexupper:()=>base32hexupper3,base32pad:()=>base32pad3,base32padupper:()=>base32padupper3,base32upper:()=>base32upper3,base32z:()=>base32z3});var base323=rfc46483({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper3=rfc46483({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad3=rfc46483({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper3=rfc46483({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex3=rfc46483({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper3=rfc46483({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad3=rfc46483({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper3=rfc46483({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z3=rfc46483({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base36_exports={};__export(base36_exports,{base36:()=>base36,base36upper:()=>base36upper});var base36=baseX3({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX3({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base58_exports={};__export(base58_exports,{base58btc:()=>base58btc3,base58flickr:()=>base58flickr3});var base58btc3=baseX3({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr3=baseX3({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base64_exports={};__export(base64_exports,{base64:()=>base64,base64pad:()=>base64pad,base64url:()=>base64url,base64urlpad:()=>base64urlpad});var base64=rfc46483({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc46483({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc46483({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc46483({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base256emoji_exports={};__export(base256emoji_exports,{base256emoji:()=>base256emoji});var alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce((r,t,e)=>(r[e]=t,r),[]),alphabetCharsToBytes=alphabet.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function encode8(r){return r.reduce((t,e)=>(t+=alphabetBytesToChars[e],t),"")}function decode12(r){const t=[];for(const e of r){const n=alphabetCharsToBytes[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var base256emoji=from4({prefix:"🚀",name:"base256emoji",encode:encode8,decode:decode12}),sha2_exports={};__export(sha2_exports,{sha256:()=>sha2562,sha512:()=>sha5122});var import_crypto2=__toESM(requireCryptoBrowserify()),encode_13=encode9,MSB3=128,MSBALL3=-128,INT3=Math.pow(2,31);function encode9(r,t,e){t=t||[],e=e||0;for(var n=e;r>=INT3;)t[e++]=r&255|MSB3,r/=128;for(;r&MSBALL3;)t[e++]=r&255|MSB3,r>>>=7;return t[e]=r|0,encode9.bytes=e-n+1,t}var decode13=read3,MSB$13=128,REST$13=127;function read3(r,n){var e=0,n=n||0,i=0,o=n,a,s=r.length;do{if(o>=s)throw read3.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&REST$13)<<i:(a&REST$13)*Math.pow(2,i),i+=7}while(a>=MSB$13);return read3.bytes=o-n,e}var N13=Math.pow(2,7),N23=Math.pow(2,14),N33=Math.pow(2,21),N43=Math.pow(2,28),N53=Math.pow(2,35),N63=Math.pow(2,42),N73=Math.pow(2,49),N83=Math.pow(2,56),N93=Math.pow(2,63),length3=function(r){return r<N13?1:r<N23?2:r<N33?3:r<N43?4:r<N53?5:r<N63?6:r<N73?7:r<N83?8:r<N93?9:10},varint3={encode:encode_13,decode:decode13,encodingLength:length3},_brrp_varint3=varint3,varint_default3=_brrp_varint3,encodeTo3=(r,t,e=0)=>(varint_default3.encode(r,t,e),t),encodingLength3=r=>varint_default3.encodingLength(r),create3=(r,t)=>{const e=t.byteLength,n=encodingLength3(r),i=n+encodingLength3(e),o=new Uint8Array(i+e);return encodeTo3(r,o,0),encodeTo3(e,o,n),o.set(t,i),new Digest3(r,e,t,o)},Digest3=class{constructor(r,t,e,n){this.code=r,this.size=t,this.digest=e,this.bytes=n}},from5=({name:r,code:t,encode:e})=>new Hasher2(r,t,e),Hasher2=class{constructor(r,t,e){this.name=r,this.code=t,this.encode=e}digest(r){if(r instanceof Uint8Array){const t=this.encode(r);return t instanceof Uint8Array?create3(this.code,t):t.then(e=>create3(this.code,e))}else throw Error("Unknown type, must be binary type")}},sha2562=from5({name:"sha2-256",code:18,encode:r=>coerce3(import_crypto2.default.createHash("sha256").update(r).digest())}),sha5122=from5({name:"sha2-512",code:19,encode:r=>coerce3(import_crypto2.default.createHash("sha512").update(r).digest())}),identity_exports2={};__export(identity_exports2,{identity:()=>identity2});var code3=0,name3="identity",encode10=coerce3,digest=r=>create3(code3,encode10(r)),identity2={code:code3,name:name3,encode:encode10,digest};new TextEncoder,new TextDecoder;var bases={...identity_exports,...base2_exports,...base8_exports,...base10_exports,...base16_exports,...base32_exports,...base36_exports,...base58_exports,...base64_exports,...base256emoji_exports};({...sha2_exports,...identity_exports2});function createCodec2(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var string=createCodec2("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ascii=createCodec2("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=allocUnsafe(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),BASES={utf8:string,"utf-8":string,hex:bases.base16,latin1:ascii,ascii,binary:ascii,...bases},bases_default=BASES;function fromString3(r,t="utf8"){const e=bases_default[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?asUint8Array(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var defaultChunkValidator=()=>async function*(t){for await(const e of t){if(e.length===void 0)throw(0,import_err_code3.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if(typeof e=="string"||e instanceof String)yield fromString3(e.toString());else if(Array.isArray(e))yield Uint8Array.from(e);else if(e instanceof Uint8Array)yield e;else throw(0,import_err_code3.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}},DEFAULT_MAX_CHILDREN_PER_NODE=174;function balanced(r){const t=DEFAULT_MAX_CHILDREN_PER_NODE;return async function e(n,i){const o=[];for await(const a of src_default(n,t))o.push(await i(a));return o.length>1?e(o,i):o[0]}}var Dir=class{constructor(r,t){D(this,"options");D(this,"root");D(this,"dir");D(this,"path");D(this,"dirty");D(this,"flat");D(this,"parent");D(this,"parentKey");D(this,"unixfs");D(this,"mode");D(this,"mtime");D(this,"cid");D(this,"size");D(this,"nodeSize");this.options=t??{},this.root=r.root,this.dir=r.dir,this.path=r.path,this.dirty=r.dirty,this.flat=r.flat,this.parent=r.parent,this.parentKey=r.parentKey,this.unixfs=r.unixfs,this.mode=r.mode,this.mtime=r.mtime}},CID_V0=CID2.parse("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"),CID_V1=CID2.parse("zdj7WbTaiJT1fgatdet9Ei9iDB5hdCxkbVyhyh8YTUnXMiwYi"),DirFlat=class extends Dir{constructor(t,e){super(t,e);D(this,"_children");this._children=new Map}async put(t,e){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,this._children.set(t,e)}async get(t){return Promise.resolve(this._children.get(t))}childCount(){return this._children.size}directChildrenCount(){return this.childCount()}onlyChild(){return this._children.values().next().value}async*eachChildSeries(){for(const[t,e]of this._children.entries())yield{key:t,child:e}}estimateNodeSize(){if(this.nodeSize!==void 0)return this.nodeSize;this.nodeSize=0;for(const[t,e]of this._children.entries())e.size!=null&&e.cid!=null&&(this.nodeSize+=t.length+(this.options.cidVersion===1?CID_V1.bytes.byteLength:CID_V0.bytes.byteLength));return this.nodeSize}async*flush(t){const e=[];for(const[u,h]of this._children.entries()){let f=h;if(h instanceof Dir)for await(const g of h.flush(t))f=g,yield g;f.size!=null&&f.cid!=null&&e.push({Name:u,Tsize:Number(f.size),Hash:f.cid})}const n=new UnixFS({type:"directory",mtime:this.mtime,mode:this.mode}),i={Data:n.marshal(),Links:e},o=encode3(prepare(i)),a=await persist(o,t,this.options),s=o.length+i.Links.reduce((u,h)=>u+(h.Tsize==null?0:h.Tsize),0);this.cid=a,this.size=s,yield{cid:a,unixfs:n,path:this.path,size:BigInt(s)}}},from6=({name:r,code:t,encode:e})=>new Hasher3(r,t,e),Hasher3=class{constructor(r,t,e){this.name=r,this.code=t,this.encode=e}digest(r){if(r instanceof Uint8Array){const t=this.encode(r);return t instanceof Uint8Array?create(this.code,t):t.then(e=>create(this.code,e))}else throw Error("Unknown type, must be binary type")}},import_murmurhash3js_revisited=__toESM(require_murmurhash3js_revisited()),murmur3128=from6({name:"murmur3-128",code:34,encode:r=>bytes_exports.fromHex(import_murmurhash3js_revisited.default.x64.hash128(r))}),import_sparse_array=__toESM(require_sparse_array()),Bucket=class I{constructor(t,e,n=0){this._options=t,this._popCount=0,this._parent=e,this._posAtParent=n,this._children=new import_sparse_array.default,this.key=null}async put(t,e){const n=await this._findNewBucketAndPos(t);await n.bucket._putAt(n,t,e)}async get(t){const e=await this._findChild(t);if(e!=null)return e.value}async del(t){const e=await this._findPlace(t),n=e.bucket._at(e.pos);n!=null&&n.key===t&&e.bucket._delAt(e.pos)}leafCount(){return this._children.compactArray().reduce((e,n)=>n instanceof I?e+n.leafCount():e+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){const t=this._children.compactArray();for(const e of t)e instanceof I?yield*e.eachLeafSeries():yield e}serialize(t,e){const n=[];return e(this._children.reduce((i,o,a)=>(o!=null&&(o instanceof I?i.push(o.serialize(t,e)):i.push(t(o,a))),i),n))}async asyncTransform(t,e){return await asyncTransformBucket(this,t,e)}toJSON(){return this.serialize(mapNode,reduceNodes)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(t){const e=await this._findPlace(t),n=e.bucket._at(e.pos);if(!(n instanceof I)&&n!=null&&n.key===t)return n}async _findPlace(t){const e=this._options.hash(typeof t=="string"?fromString3(t):t),n=await e.take(this._options.bits),i=this._children.get(n);return i instanceof I?await i._findPlace(e):{bucket:this,pos:n,hash:e,existingChild:i}}async _findNewBucketAndPos(t){const e=await this._findPlace(t);if(e.existingChild!=null&&e.existingChild.key!==t){const n=new I(this._options,e.bucket,e.pos);e.bucket._putObjectAt(e.pos,n);const i=await n._findPlace(e.existingChild.hash);return i.bucket._putAt(i,e.existingChild.key,e.existingChild.value),await n._findNewBucketAndPos(e.hash)}return e}_putAt(t,e,n){this._putObjectAt(t.pos,{key:e,value:n,hash:t.hash})}_putObjectAt(t,e){this._children.get(t)==null&&this._popCount++,this._children.set(t,e)}_delAt(t){if(t===-1)throw new Error("Invalid position");this._children.get(t)!=null&&this._popCount--,this._children.unset(t),this._level()}_level(){if(this._parent!=null&&this._popCount<=1)if(this._popCount===1){const t=this._children.find(exists);if(t!=null&&!(t instanceof I)){const e=t.hash;e.untake(this._options.bits);const n={pos:this._posAtParent,hash:e,bucket:this._parent};this._parent._putAt(n,t.key,t.value)}}else this._parent._delAt(this._posAtParent)}_at(t){return this._children.get(t)}};function exists(r){return!!r}function mapNode(r,t){return r.key}function reduceNodes(r){return r}async function asyncTransformBucket(r,t,e){const n=[];for(const i of r._children.compactArray())if(i instanceof Bucket)await asyncTransformBucket(i,t,e);else{const o=await t(i);n.push({bitField:r._children.bitField(),children:o})}return await e(n)}var START_MASKS=[255,254,252,248,240,224,192,128],STOP_MASKS=[1,3,7,15,31,63,127,255],ConsumableBuffer=class{constructor(r){this._value=r,this._currentBytePos=r.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+this._currentBytePos*8}totalBits(){return this._value.length*8}take(r){let t=r,e=0;for(;t>0&&this._haveBits();){const n=this._value[this._currentBytePos],i=this._currentBitPos+1,o=Math.min(i,t),a=byteBitsToInt(n,i-o,o);e=(e<<o)+a,t-=o,this._currentBitPos-=o,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return e}untake(r){for(this._currentBitPos+=r;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}};function byteBitsToInt(r,t,e){const n=maskFor(t,e);return(r&n)>>>t}function maskFor(r,t){return START_MASKS[r]&STOP_MASKS[Math.min(t+r-1,7)]}function wrapHash(r){function t(e){return e instanceof InfiniteHash?e:new InfiniteHash(e,r)}return t}var InfiniteHash=class{constructor(r,t){if(!(r instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=r,this._hashFn=t,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(r){let t=r;for(;this._availableBits<t;)await this._produceMoreBits();let e=0;for(;t>0;){const n=this._buffers[this._currentBufferIndex],i=Math.min(n.availableBits(),t),o=n.take(i);e=(e<<i)+o,t-=i,this._availableBits-=i,n.availableBits()===0&&this._currentBufferIndex++}return e}untake(r){let t=r;for(;t>0;){const e=this._buffers[this._currentBufferIndex],n=Math.min(e.totalBits()-e.availableBits(),t);e.untake(n),t-=n,this._availableBits+=n,this._currentBufferIndex>0&&e.totalBits()===e.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;const r=this._depth>0?concat([this._value,Uint8Array.from([this._depth])]):this._value,t=await this._hashFn(r),e=new ConsumableBuffer(t);this._buffers.push(e),this._availableBits+=e.availableBits()}};function createHAMT(r){if(r==null||r.hashFn==null)throw new Error("please define an options.hashFn");const t={bits:r.bits??8,hash:wrapHash(r.hashFn)};return new Bucket(t)}async function hamtHashFn(r){return(await murmur3128.encode(r)).slice(0,8).reverse()}var HAMT_HASH_CODE=BigInt(34),DirSharded=class extends Dir{constructor(t,e){super(t,e);D(this,"_bucket");this._bucket=createHAMT({hashFn:hamtHashFn,bits:8})}async put(t,e){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,await this._bucket.put(t,e)}async get(t){return this._bucket.get(t)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(const{key:t,value:e}of this._bucket.eachLeafSeries())yield{key:t,child:e}}estimateNodeSize(){return this.nodeSize!==void 0?this.nodeSize:(this.nodeSize=calculateSize(this._bucket,this,this.options),this.nodeSize)}async*flush(t){for await(const e of flush(this._bucket,t,this,this.options))yield{...e,path:this.path}}},dir_sharded_default=DirSharded;async function*flush(r,t,e,n){const i=r._children,o=[];let a=0n;for(let y=0;y<i.length;y++){const l=i.get(y);if(l==null)continue;const c=y.toString(16).toUpperCase().padStart(2,"0");if(l instanceof Bucket){let d;for await(const w of flush(l,t,null,n))d=w;if(d==null)throw new Error("Could not flush sharded directory, no subshard found");o.push({Name:c,Tsize:Number(d.size),Hash:d.cid}),a+=d.size}else if(isDir(l.value)){const d=l.value;let w;for await(const p of d.flush(t))w=p,yield w;if(w==null)throw new Error("Did not flush dir");const v=c+l.key;o.push({Name:v,Tsize:Number(w.size),Hash:w.cid}),a+=w.size}else{const d=l.value;if(d.cid==null)continue;const w=c+l.key,v=d.size;o.push({Name:w,Tsize:Number(v),Hash:d.cid}),a+=BigInt(v??0)}}const s=Uint8Array.from(i.bitField().reverse()),u=new UnixFS({type:"hamt-sharded-directory",data:s,fanout:BigInt(r.tableSize()),hashType:HAMT_HASH_CODE,mtime:e==null?void 0:e.mtime,mode:e==null?void 0:e.mode}),h={Data:u.marshal(),Links:o},f=encode3(prepare(h)),g=await persist(f,t,n),b=BigInt(f.byteLength)+a;yield{cid:g,unixfs:u,size:b}}function isDir(r){return typeof r.flush=="function"}function calculateSize(r,t,e){const n=r._children,i=[];for(let u=0;u<n.length;u++){const h=n.get(u);if(h==null)continue;const f=u.toString(16).toUpperCase().padStart(2,"0");if(h instanceof Bucket){const g=calculateSize(h,null,e);i.push({Name:f,Tsize:Number(g),Hash:e.cidVersion===0?CID_V0:CID_V1})}else if(typeof h.value.flush=="function"){const b=h.value.nodeSize();i.push({Name:f+h.key,Tsize:Number(b),Hash:e.cidVersion===0?CID_V0:CID_V1})}else{const g=h.value;if(g.cid==null)continue;const b=f+h.key,y=g.size;i.push({Name:b,Tsize:Number(y),Hash:g.cid})}}const o=Uint8Array.from(n.bitField().reverse()),a=new UnixFS({type:"hamt-sharded-directory",data:o,fanout:BigInt(r.tableSize()),hashType:HAMT_HASH_CODE,mtime:t==null?void 0:t.mtime,mode:t==null?void 0:t.mode});return encode3(prepare({Data:a.marshal(),Links:i})).length}async function flatToShard(r,t,e,n){let i=t;t instanceof DirFlat&&t.estimateNodeSize()>e&&(i=await convertToShard(t,n));const o=i.parent;if(o!=null){if(i!==t){if(r!=null&&(r.parent=i),i.parentKey==null)throw new Error("No parent key found");await o.put(i.parentKey,i)}return flatToShard(i,o,e,n)}return i}async function convertToShard(r,t){const e=new dir_sharded_default({root:r.root,dir:!0,parent:r.parent,parentKey:r.parentKey,path:r.path,dirty:r.dirty,flat:!1,mtime:r.mtime,mode:r.mode},t);for await(const{key:n,child:i}of r.eachChildSeries())await e.put(n,i);return e}var toPathComponents=(r="")=>(r.trim().match(/([^\\/]|\\\/)+/g)??[]).filter(Boolean);async function addToTree(r,t,e){var s,u;const n=toPathComponents(r.path??""),i=n.length-1;let o=t,a="";for(let h=0;h<n.length;h++){const f=n[h];a+=`${a!==""?"/":""}${f}`;const g=h===i;if(o.dirty=!0,o.cid=void 0,o.size=void 0,g)await o.put(f,r),t=await flatToShard(null,o,e.shardSplitThresholdBytes,e);else{let b=await o.get(f);(b==null||!(b instanceof Dir))&&(b=new DirFlat({root:!1,dir:!0,parent:o,parentKey:f,path:a,dirty:!0,flat:!0,mtime:(s=b==null?void 0:b.unixfs)==null?void 0:s.mtime,mode:(u=b==null?void 0:b.unixfs)==null?void 0:u.mode},e)),await o.put(f,b),o=b}}return t}async function*flushAndYield(r,t){var e;if(!(r instanceof Dir)){((e=r.unixfs)==null?void 0:e.isDirectory())===!0&&(yield r);return}yield*r.flush(t)}function defaultTreeBuilder(r){return async function*(e,n){let i=new DirFlat({root:!0,dir:!0,path:"",dirty:!0,flat:!0},r),o,a=!1;for await(const s of e){if(s==null)continue;const u=`${s.originalPath??""}`.split("/")[0];u!=null&&u!==""&&(o==null?(o=u,a=!0):o!==u&&(a=!1)),i=await addToTree(s,i,r),(s.unixfs==null||!s.unixfs.isDirectory())&&(yield s)}if(r.wrapWithDirectory||a&&i.childCount()>1)yield*flushAndYield(i,n);else for await(const s of i.eachChildSeries())s!=null&&(yield*flushAndYield(s.child,n))}}async function*importer(r,t,e={}){let n;Symbol.asyncIterator in r||Symbol.iterator in r?n=r:n=[r];const i=e.wrapWithDirectory??!1,o=e.shardSplitThresholdBytes??262144,a=e.cidVersion??1,s=e.rawLeaves??!0,u=e.leafType??"file",h=e.fileImportConcurrency??50,f=e.blockWriteConcurrency??10,g=e.reduceSingleLeafToSelf??!0,b=e.chunker??fixedSize(),y=e.chunkValidator??defaultChunkValidator(),l=e.dagBuilder??defaultDagBuilder({chunker:b,chunkValidator:y,wrapWithDirectory:i,layout:e.layout??balanced(),bufferImporter:e.bufferImporter??defaultBufferImporter({cidVersion:a,rawLeaves:s,leafType:u,onProgress:e.onProgress}),blockWriteConcurrency:f,reduceSingleLeafToSelf:g,cidVersion:a,onProgress:e.onProgress}),c=e.treeBuilder??defaultTreeBuilder({wrapWithDirectory:i,shardSplitThresholdBytes:o,cidVersion:a,onProgress:e.onProgress});for await(const d of c(parallelBatch(l(n,t),h),t))yield{cid:d.cid,path:d.path,unixfs:d.unixfs,size:d.size}}var errors_exports={};__export(errors_exports,{abortedError:()=>abortedError,closeFailedError:()=>closeFailedError,deleteFailedError:()=>deleteFailedError,getFailedError:()=>getFailedError,hasFailedError:()=>hasFailedError,notFoundError:()=>notFoundError,openFailedError:()=>openFailedError,putFailedError:()=>putFailedError});var import_err_code5=__toESM(require_err_code());function openFailedError(r){return r=r??new Error("Open failed"),(0,import_err_code5.default)(r,"ERR_OPEN_FAILED")}function closeFailedError(r){return r=r??new Error("Close failed"),(0,import_err_code5.default)(r,"ERR_CLOSE_FAILED")}function putFailedError(r){return r=r??new Error("Put failed"),(0,import_err_code5.default)(r,"ERR_PUT_FAILED")}function getFailedError(r){return r=r??new Error("Get failed"),(0,import_err_code5.default)(r,"ERR_GET_FAILED")}function deleteFailedError(r){return r=r??new Error("Delete failed"),(0,import_err_code5.default)(r,"ERR_DELETE_FAILED")}function hasFailedError(r){return r=r??new Error("Has failed"),(0,import_err_code5.default)(r,"ERR_HAS_FAILED")}function notFoundError(r){return r=r??new Error("Not Found"),(0,import_err_code5.default)(r,"ERR_NOT_FOUND")}function abortedError(r){return r=r??new Error("Aborted"),(0,import_err_code5.default)(r,"ERR_ABORTED")}var BaseBlockstore=class{has(r,t){return Promise.reject(new Error(".has is not implemented"))}put(r,t,e){return Promise.reject(new Error(".put is not implemented"))}async*putMany(r,t){for await(const{cid:e,block:n}of r)await this.put(e,n,t),yield e}get(r,t){return Promise.reject(new Error(".get is not implemented"))}async*getMany(r,t){for await(const e of r)yield{cid:e,block:await this.get(e,t)}}async delete(r,t){await Promise.reject(new Error(".delete is not implemented"))}async*deleteMany(r,t){for await(const e of r)await this.delete(e,t),yield e}async*getAll(r){throw new Error(".getAll is not implemented")}};function base4(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(e[a]!==255)throw new TypeError(o+" is ambiguous");e[a]=i}var s=r.length,u=r.charAt(0),h=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var c=0,d=0,w=0,v=l.length;w!==v&&l[w]===0;)w++,c++;for(var p=(v-w)*f+1>>>0,m=new Uint8Array(p);w!==v;){for(var _=l[w],A=0,E=p-1;(_!==0||A<d)&&E!==-1;E--,A++)_+=256*m[E]>>>0,m[E]=_%s>>>0,_=_/s>>>0;if(_!==0)throw new Error("Non-zero carry");d=A,w++}for(var S=p-d;S!==p&&m[S]===0;)S++;for(var x=u.repeat(c);S<p;++S)x+=r.charAt(m[S]);return x}function b(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var c=0;if(l[c]!==" "){for(var d=0,w=0;l[c]===u;)d++,c++;for(var v=(l.length-c)*h+1>>>0,p=new Uint8Array(v);l[c];){var m=e[l.charCodeAt(c)];if(m===255)return;for(var _=0,A=v-1;(m!==0||_<w)&&A!==-1;A--,_++)m+=s*p[A]>>>0,p[A]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");w=_,c++}if(l[c]!==" "){for(var E=v-w;E!==v&&p[E]===0;)E++;for(var S=new Uint8Array(d+(v-E)),x=d;E!==v;)S[x++]=p[E++];return S}}}function y(l){var c=b(l);if(c)return c;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:b,decode:y}}var src4=base4,_brrp__multiformats_scope_baseX4=src4,base_x_default4=_brrp__multiformats_scope_baseX4,equals8=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},coerce4=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},Encoder4=class{constructor(r,t,e){this.name=r,this.prefix=t,this.baseEncode=e}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},Decoder4=class{constructor(r,t,e){if(this.name=r,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=e}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return or4(this,r)}},ComposedDecoder4=class{constructor(r){this.decoders=r}or(r){return or4(this,r)}decode(r){const t=r[0],e=this.decoders[t];if(e)return e.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},or4=(r,t)=>new ComposedDecoder4({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Codec4=class{constructor(r,t,e,n){this.name=r,this.prefix=t,this.baseEncode=e,this.baseDecode=n,this.encoder=new Encoder4(r,t,e),this.decoder=new Decoder4(r,t,n)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},from7=({name:r,prefix:t,encode:e,decode:n})=>new Codec4(r,t,e,n),baseX4=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:i}=base_x_default4(e,t);return from7({prefix:r,name:t,encode:n,decode:o=>coerce4(i(o))})},decode16=(r,t,e,n)=>{const i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=r.length;for(;r[o-1]==="=";)--o;const a=new Uint8Array(o*e/8|0);let s=0,u=0,h=0;for(let f=0;f<o;++f){const g=i[r[f]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<e|g,s+=e,s>=8&&(s-=8,a[h++]=255&u>>s)}if(s>=e||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode11=(r,t,e)=>{const n=t[t.length-1]==="=",i=(1<<e)-1;let o="",a=0,s=0;for(let u=0;u<r.length;++u)for(s=s<<8|r[u],a+=8;a>e;)a-=e,o+=t[i&s>>a];if(a&&(o+=t[i&s<<e-a]),n)for(;o.length*e&7;)o+="=";return o},rfc46484=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>from7({prefix:t,name:r,encode(i){return encode11(i,n,e)},decode(i){return decode16(i,n,e,r)}}),base324=rfc46484({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5});rfc46484({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rfc46484({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rfc46484({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rfc46484({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rfc46484({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rfc46484({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),rfc46484({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rfc46484({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var encode_14=encode12,MSB4=128,MSBALL4=-128,INT4=Math.pow(2,31);function encode12(r,t,e){t=t||[],e=e||0;for(var n=e;r>=INT4;)t[e++]=r&255|MSB4,r/=128;for(;r&MSBALL4;)t[e++]=r&255|MSB4,r>>>=7;return t[e]=r|0,encode12.bytes=e-n+1,t}var decode17=read4,MSB$14=128,REST$14=127;function read4(r,n){var e=0,n=n||0,i=0,o=n,a,s=r.length;do{if(o>=s)throw read4.bytes=0,new RangeError("Could not decode varint");a=r[o++],e+=i<28?(a&REST$14)<<i:(a&REST$14)*Math.pow(2,i),i+=7}while(a>=MSB$14);return read4.bytes=o-n,e}var N14=Math.pow(2,7),N24=Math.pow(2,14),N34=Math.pow(2,21),N44=Math.pow(2,28),N54=Math.pow(2,35),N64=Math.pow(2,42),N74=Math.pow(2,49),N84=Math.pow(2,56),N94=Math.pow(2,63),length4=function(r){return r<N14?1:r<N24?2:r<N34?3:r<N44?4:r<N54?5:r<N64?6:r<N74?7:r<N84?8:r<N94?9:10},varint4={encode:encode_14,decode:decode17,encodingLength:length4},_brrp_varint4=varint4,varint_default4=_brrp_varint4,decode18=(r,t=0)=>[varint_default4.decode(r,t),varint_default4.decode.bytes],encodeTo4=(r,t,e=0)=>(varint_default4.encode(r,t,e),t),encodingLength4=r=>varint_default4.encodingLength(r),create4=(r,t)=>{const e=t.byteLength,n=encodingLength4(r),i=n+encodingLength4(e),o=new Uint8Array(i+e);return encodeTo4(r,o,0),encodeTo4(e,o,n),o.set(t,i),new Digest4(r,e,t,o)},decode19=r=>{const t=coerce4(r),[e,n]=decode18(t),[i,o]=decode18(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Digest4(e,i,a,t)},equals9=(r,t)=>{if(r===t)return!0;{const e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&equals8(r.bytes,e.bytes)}},Digest4=class{constructor(r,t,e,n){this.code=r,this.size=t,this.digest=e,this.bytes=n}},base58btc4=baseX4({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"});baseX4({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var format4=(r,t)=>{const{bytes:e,version:n}=r;switch(n){case 0:return toStringV04(e,baseCache4(r),t||base58btc4.encoder);default:return toStringV14(e,baseCache4(r),t||base324.encoder)}},cache4=new WeakMap,baseCache4=r=>{const t=cache4.get(r);if(t==null){const e=new Map;return cache4.set(r,e),e}return t},CID4=class L{constructor(t,e,n,i){this.code=e,this.version=t,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:{const{code:t,multihash:e}=this;if(t!==DAG_PB_CODE4)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==SHA_256_CODE4)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return L.createV0(e)}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:{const{code:t,digest:e}=this.multihash,n=create4(t,e);return L.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(t){return L.equals(this,t)}static equals(t,e){const n=e;return n&&t.code===n.code&&t.version===n.version&&equals9(t.multihash,n.multihash)}toString(t){return format4(this,t)}toJSON(){return{"/":format4(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;const e=t;if(e instanceof L)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){const{version:n,code:i,multihash:o,bytes:a}=e;return new L(n,i,o,a||encodeCID4(n,i,o.bytes))}else if(e[cidSymbol4]===!0){const{version:n,multihash:i,code:o}=e,a=decode19(i);return L.create(n,o,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==DAG_PB_CODE4)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE4}) block encoding`);return new L(t,e,n,n.bytes)}case 1:{const i=encodeCID4(t,e,n.bytes);return new L(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return L.create(0,DAG_PB_CODE4,t)}static createV1(t,e){return L.create(1,t,e)}static decode(t){const[e,n]=L.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){const e=L.inspectBytes(t),n=e.size-e.multihashSize,i=coerce4(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");const o=i.subarray(e.multihashSize-e.digestSize),a=new Digest4(e.multihashCode,e.digestSize,o,i);return[e.version===0?L.createV0(a):L.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0;const n=()=>{const[g,b]=decode18(t.subarray(e));return e+=b,g};let i=n(),o=DAG_PB_CODE4;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);const a=e,s=n(),u=n(),h=e+u,f=h-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:h}}static parse(t,e){const[n,i]=parseCIDtoBytes4(t,e),o=L.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache4(o).set(n,t),o}},parseCIDtoBytes4=(r,t)=>{switch(r[0]){case"Q":{const e=t||base58btc4;return[base58btc4.prefix,e.decode(`${base58btc4.prefix}${r}`)]}case base58btc4.prefix:{const e=t||base58btc4;return[base58btc4.prefix,e.decode(r)]}case base324.prefix:{const e=t||base324;return[base324.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},toStringV04=(r,t,e)=>{const{prefix:n}=e;if(n!==base58btc4.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);const i=t.get(n);if(i==null){const o=e.encode(r).slice(1);return t.set(n,o),o}else return i},toStringV14=(r,t,e)=>{const{prefix:n}=e,i=t.get(n);if(i==null){const o=e.encode(r);return t.set(n,o),o}else return i},DAG_PB_CODE4=112,SHA_256_CODE4=18,encodeCID4=(r,t,e)=>{const n=encodingLength4(r),i=n+encodingLength4(t),o=new Uint8Array(i+e.byteLength);return encodeTo4(r,o,0),encodeTo4(t,o,n),o.set(e,i),o},cidSymbol4=Symbol.for("@ipld/js-cid/CID"),code4=85,MemoryBlockstore=class extends BaseBlockstore{constructor(){super();D(this,"data");this.data=new Map}put(t,e){return this.data.set(base324.encode(t.multihash.bytes),e),t}get(t){const e=this.data.get(base324.encode(t.multihash.bytes));if(e==null)throw notFoundError();return e}has(t){return this.data.has(base324.encode(t.multihash.bytes))}async delete(t){this.data.delete(base324.encode(t.multihash.bytes))}async*getAll(){for(const[t,e]of this.data.entries())yield{cid:CID4.createV1(code4,decode19(base324.decode(t))),block:e}}};({...errors_exports});async function hashV0(r){const t=import_crypto3.default.createHash("sha256");if(r instanceof Uint8Array)t.update(r);else if(Symbol.asyncIterator in r)for await(const e of r)t.update(e);else throw new Error("Invalid value provided to hashStreamV0. Expected AsyncGenerator<Uint8Array> | AsyncIterable<Uint8Array> | Uint8Array");return CID.createV0(create(18,t.digest())).toString()}async function hashV1(r){const t=new MemoryBlockstore;let e;async function*n(){yield r}if(r instanceof Uint8Array)for await(const{cid:i}of importer([{content:n()}],t,{cidVersion:1,rawLeaves:!0}))e=i;else if(Symbol.asyncIterator in r)for await(const{cid:i}of importer([{content:r}],t,{cidVersion:1,rawLeaves:!0}))e=i;else throw new Error("Invalid value provided to hashStreamV1. Expected AsyncGenerator<Uint8Array> | AsyncIterable<Uint8Array> | Uint8Array");return`${e}`}function sortKeys(r,t){return compareStrings(r.hash,t.hash)||compareStrings(r.file,t.file)||0}function compareStrings(r,t){if(r===t)return 0;for(let e=0;e<Math.max(r.length,t.length);e++){if(r.charAt(e)>t.charAt(e))return 1;if(r.charAt(e)<t.charAt(e))return-1}return r.length>t.length?1:-1}function prepareADR32Data(r,t){return new TextEncoder().encode(JSON.stringify({content:r.sort(sortKeys).map(e=>({key:e.file,hash:e.hash})),metadata:t}))}async function calculateMultipleHashesADR32(r,t){const e=prepareADR32Data(r,t);return{data:e,hash:await hashV1(e)}}async function calculateMultipleHashesADR32LegacyQmHash(r,t){const e=prepareADR32Data(r,t);return{data:e,hash:await hashV0(e)}}function number(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function bool(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}function bytes(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function hash(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number(r.outputLen),number(r.blockLen)}function exists2(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function output(r,t){bytes(r);const e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var assert={number,bool,bytes,hash,exists:exists2,output},assert_default=assert,U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(r,t=!1){return t?{h:Number(r&U32_MASK64),l:Number(r>>_32n&U32_MASK64)}:{h:Number(r>>_32n&U32_MASK64)|0,l:Number(r&U32_MASK64)|0}}function split(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;i<r.length;i++){const{h:o,l:a}=fromBig(r[i],t);[e[i],n[i]]=[o,a]}return[e,n]}var toBig=(r,t)=>BigInt(r>>>0)<<_32n|BigInt(t>>>0),shrSH=(r,t,e)=>r>>>e,shrSL=(r,t,e)=>r<<32-e|t>>>e,rotrSH=(r,t,e)=>r>>>e|t<<32-e,rotrSL=(r,t,e)=>r<<32-e|t>>>e,rotrBH=(r,t,e)=>r<<64-e|t>>>e-32,rotrBL=(r,t,e)=>r>>>e-32|t<<64-e,rotr32H=(r,t)=>t,rotr32L=(r,t)=>r,rotlSH=(r,t,e)=>r<<e|t>>>32-e,rotlSL=(r,t,e)=>t<<e|r>>>32-e,rotlBH=(r,t,e)=>t<<e-32|r>>>64-e,rotlBL=(r,t,e)=>r<<e-32|t>>>64-e;function add(r,t,e,n){const i=(t>>>0)+(n>>>0);return{h:r+e+(i/2**32|0)|0,l:i|0}}var add3L=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),add3H=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,add4L=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),add4H=(r,t,e,n,i)=>t+e+n+i+(r/2**32|0)|0,add5L=(r,t,e,n,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),add5H=(r,t,e,n,i,o)=>t+e+n+i+o+(r/2**32|0)|0,u64={fromBig,split,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},u64_default=u64,u8a=r=>r instanceof Uint8Array,u32=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");var hexes=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function bytesToHex(r){if(!u8a(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=hexes[r[e]];return t}function utf8ToBytes(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function toBytes(r){if(typeof r=="string"&&(r=utf8ToBytes(r)),!u8a(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}var Hash=class{clone(){return this._cloneInto()}};function wrapConstructor(r){const t=n=>r().update(toBytes(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function wrapXOFConstructorWithOpts(r){const t=(n,i)=>r(i).update(toBytes(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}var[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]],_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let r=0,t=_1n,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],SHA3_PI.push(2*(5*n+e)),SHA3_ROTL.push((r+1)*(r+2)/2%64);let i=_0n;for(let o=0;o<7;o++)t=(t<<_1n^(t>>_7n)*_0x71n)%_256n,t&_2n&&(i^=_1n<<(_1n<<BigInt(o))-_1n);_SHA3_IOTA.push(i)}var[SHA3_IOTA_H,SHA3_IOTA_L]=u64_default.split(_SHA3_IOTA,!0),rotlH=(r,t,e)=>e>32?u64_default.rotlBH(r,t,e):u64_default.rotlSH(r,t,e),rotlL=(r,t,e)=>e>32?u64_default.rotlBL(r,t,e):u64_default.rotlSL(r,t,e);function keccakP(r,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let a=0;a<10;a++)e[a]=r[a]^r[a+10]^r[a+20]^r[a+30]^r[a+40];for(let a=0;a<10;a+=2){const s=(a+8)%10,u=(a+2)%10,h=e[u],f=e[u+1],g=rotlH(h,f,1)^e[s],b=rotlL(h,f,1)^e[s+1];for(let y=0;y<50;y+=10)r[a+y]^=g,r[a+y+1]^=b}let i=r[2],o=r[3];for(let a=0;a<24;a++){const s=SHA3_ROTL[a],u=rotlH(i,o,s),h=rotlL(i,o,s),f=SHA3_PI[a];i=r[f],o=r[f+1],r[f]=u,r[f+1]=h}for(let a=0;a<50;a+=10){for(let s=0;s<10;s++)e[s]=r[a+s];for(let s=0;s<10;s++)r[a+s]^=~e[(s+2)%10]&e[(s+4)%10]}r[0]^=SHA3_IOTA_H[n],r[1]^=SHA3_IOTA_L[n]}e.fill(0)}var Keccak=class O extends Hash{constructor(t,e,n,i=!1,o=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,assert_default.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){assert_default.exists(this);const{blockLen:e,state:n}=this;t=toBytes(t);const i=t.length;for(let o=0;o<i;){const a=Math.min(e-this.pos,i-o);for(let s=0;s<a;s++)n[this.pos++]^=t[o++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:i}=this;t[n]^=e,(e&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){assert_default.exists(this,!1),assert_default.bytes(t),this.finish();const e=this.state,{blockLen:n}=this;for(let i=0,o=t.length;i<o;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,o-i);t.set(e.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return assert_default.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(assert_default.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new O(e,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}},gen=(r,t,e)=>wrapConstructor(()=>new Keccak(t,r,e));gen(6,144,224/8),gen(6,136,256/8),gen(6,104,384/8),gen(6,72,512/8),gen(1,144,224/8);var keccak_256=gen(1,136,256/8);gen(1,104,384/8),gen(1,72,512/8);var genShake=(r,t,e)=>wrapXOFConstructorWithOpts((n={})=>new Keccak(t,r,n.dkLen===void 0?e:n.dkLen,!0));genShake(31,168,128/8),genShake(31,136,256/8);function wrapHash2(r){return t=>(assert_default.bytes(t),r(t))}(()=>{const r=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,t=typeof commonjsRequire=="function"&&commonjsRequire.bind(module);return{node:t&&!r?t("crypto"):void 0,web:r}})();var keccak256=(()=>{const r=wrapHash2(keccak_256);return r.create=keccak_256.create,r})();function keccak256Hash(r,t){const e=JSON.stringify(pick(r,t)),n=new TextEncoder().encode(e),i=keccak256(n);return bytesToHex(i)}var pick=(r,t)=>Object.fromEntries(t.filter(e=>e in r).map(e=>[e,r[e]]));/*! Bundled license information:
2
2
 
3
3
  @noble/hashes/esm/utils.js:
4
4
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
5
5
  */})(dist)),dist.exports}export{requireDist as r};
6
- //# sourceMappingURL=index-DjZtSIJT.js.map
6
+ //# sourceMappingURL=index-CvgadAKP.js.map