@snowmonster_defi/widget 1.0.1

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 (326) hide show
  1. package/README.md +85 -0
  2. package/dist/Arc-VDBY7LNS-DBrTWC6L.mjs +4 -0
  3. package/dist/Arc-VDBY7LNS-m3oU4SFX.js +1 -0
  4. package/dist/Brave-BRAKJXDS-B9q28yrX.js +1 -0
  5. package/dist/Brave-BRAKJXDS-CfOthErl.mjs +4 -0
  6. package/dist/Browser-76IHF3Y2-BR3yRO0Q.js +1 -0
  7. package/dist/Browser-76IHF3Y2-D5mI5yDv.mjs +4 -0
  8. package/dist/Chrome-65Q5P54Y-9eqcWmOm.js +1 -0
  9. package/dist/Chrome-65Q5P54Y-DrF9hxVd.mjs +4 -0
  10. package/dist/Edge-XSPUTORV-B8kHPG9e.js +1 -0
  11. package/dist/Edge-XSPUTORV-BPc8HSNM.mjs +4 -0
  12. package/dist/Firefox-AAHGJQIP--XXnd95e.mjs +4 -0
  13. package/dist/Firefox-AAHGJQIP-BtlH2zVc.js +1 -0
  14. package/dist/Linux-OO4TNCLJ-BzSRqE5q.js +1 -0
  15. package/dist/Linux-OO4TNCLJ-DjZl5oHj.mjs +4 -0
  16. package/dist/Macos-MW4AE7LN-34pmNxSL.js +1 -0
  17. package/dist/Macos-MW4AE7LN-DDrYwsGC.mjs +4 -0
  18. package/dist/Opera-KQZLSACL-BY-yTZwm.js +1 -0
  19. package/dist/Opera-KQZLSACL-DhwRnyeO.mjs +4 -0
  20. package/dist/Safari-ZPL37GXR-BAHe1sxY.js +1 -0
  21. package/dist/Safari-ZPL37GXR-BJMyZNGk.mjs +4 -0
  22. package/dist/Windows-PPTHQER6-8DxONxME.mjs +4 -0
  23. package/dist/Windows-PPTHQER6-BtXwY24K.js +1 -0
  24. package/dist/add-BMx827fr.js +15 -0
  25. package/dist/add-C1-3Nxd0.mjs +19 -0
  26. package/dist/all-wallets-Bw2RRXQf.js +6 -0
  27. package/dist/all-wallets-CeboYmll.mjs +10 -0
  28. package/dist/apechain-SX5YFU6N-B6iVN2eI.mjs +4 -0
  29. package/dist/apechain-SX5YFU6N-BP98RVDs.js +1 -0
  30. package/dist/app-store-C-SLhk-c.mjs +21 -0
  31. package/dist/app-store-DWCVxk5n.js +17 -0
  32. package/dist/apple-C0-QMsmX.mjs +22 -0
  33. package/dist/apple-C6JNxC7s.js +18 -0
  34. package/dist/ar_AR-44JUQ6EW-DSQ9qcs_.js +1487 -0
  35. package/dist/ar_AR-44JUQ6EW-DZr8TU0E.mjs +1490 -0
  36. package/dist/arbitrum-WURIBY6W-BS2MH6mu.js +1 -0
  37. package/dist/arbitrum-WURIBY6W-C9umEuPP.mjs +4 -0
  38. package/dist/arrow-bottom-BQlfsLH7.js +8 -0
  39. package/dist/arrow-bottom-DBsoY1j4.mjs +12 -0
  40. package/dist/arrow-bottom-circle-0d4DMC8k.mjs +15 -0
  41. package/dist/arrow-bottom-circle-BWbOWcMy.js +11 -0
  42. package/dist/arrow-left-Buye_G_C.mjs +12 -0
  43. package/dist/arrow-left-CYea8lr5.js +8 -0
  44. package/dist/arrow-right-Bz07l-7m.js +8 -0
  45. package/dist/arrow-right-NcpIvTiP.mjs +12 -0
  46. package/dist/arrow-top-BHtmjrGh.mjs +12 -0
  47. package/dist/arrow-top-CE8kNyrN.js +8 -0
  48. package/dist/assets-Q6ZU7ZJ5-DrI2eCWt.mjs +4 -0
  49. package/dist/assets-Q6ZU7ZJ5-Dy7quYMC.js +1 -0
  50. package/dist/avalanche-KOMJD3XY-BzTQlT3D.mjs +4 -0
  51. package/dist/avalanche-KOMJD3XY-Df8RTmnR.js +1 -0
  52. package/dist/bank-54nZmUNU.js +14 -0
  53. package/dist/bank-foInih1V.mjs +18 -0
  54. package/dist/base-OAXLRA4F-iT9zH1Kj.js +1 -0
  55. package/dist/base-OAXLRA4F-zGysVgz6.mjs +4 -0
  56. package/dist/basic-BoWB3br8.mjs +5718 -0
  57. package/dist/basic-DgjjeOAX.js +2128 -0
  58. package/dist/berachain-NJECWIVC-BMZnNAq4.js +1 -0
  59. package/dist/berachain-NJECWIVC-CRQ0XjnA.mjs +4 -0
  60. package/dist/blast-V555OVXZ-Bbwv3H8h.js +1 -0
  61. package/dist/blast-V555OVXZ-DfAGOAm0.mjs +4 -0
  62. package/dist/browser-BC7vNobG.mjs +18 -0
  63. package/dist/browser-b-nGXlqN.js +14 -0
  64. package/dist/bsc-N647EYR2-B1LUNwWi.js +1 -0
  65. package/dist/bsc-N647EYR2-BZ1b_4BN.mjs +4 -0
  66. package/dist/card--XvDDn3y.mjs +18 -0
  67. package/dist/card-BkMuyW1R.js +14 -0
  68. package/dist/ccip-B3WUowc8.js +1 -0
  69. package/dist/ccip-DKFQjR9A.mjs +149 -0
  70. package/dist/celo-GEP4TUHG-DGNZBO1F.js +1 -0
  71. package/dist/celo-GEP4TUHG-DjaxM9On.mjs +4 -0
  72. package/dist/checkmark-BbGho5Io.mjs +15 -0
  73. package/dist/checkmark-DXb72YHc.js +11 -0
  74. package/dist/checkmark-bold-B1F7R5EK.mjs +12 -0
  75. package/dist/checkmark-bold-DdBV1Lmi.js +8 -0
  76. package/dist/chevron-bottom-CQZ-Wq5W.js +8 -0
  77. package/dist/chevron-bottom-XyYYwAR8.mjs +12 -0
  78. package/dist/chevron-left-8n-It-m1.js +8 -0
  79. package/dist/chevron-left-DuAvtNd0.mjs +12 -0
  80. package/dist/chevron-right-D59N_heq.js +8 -0
  81. package/dist/chevron-right-W5vVm_KB.mjs +12 -0
  82. package/dist/chevron-top-CEOzd8Ij.js +8 -0
  83. package/dist/chevron-top-DFkm04W3.mjs +12 -0
  84. package/dist/chrome-store-BrkLwaGp.js +61 -0
  85. package/dist/chrome-store-CP2NiEXz.mjs +65 -0
  86. package/dist/clock-B5JaCeFx.mjs +12 -0
  87. package/dist/clock-LQXXXzZd.js +8 -0
  88. package/dist/close-CvPH2PaL.js +8 -0
  89. package/dist/close-w5A4PucI.mjs +12 -0
  90. package/dist/coinPlaceholder-DFh7VbZT.js +8 -0
  91. package/dist/coinPlaceholder-haEbTDpA.mjs +12 -0
  92. package/dist/compass-CvRkiQHa.mjs +12 -0
  93. package/dist/compass-Df_6O9--.js +8 -0
  94. package/dist/components/DexRouterWidget.d.ts +7 -0
  95. package/dist/components/Web3Provider.d.ts +6 -0
  96. package/dist/connect-UA7M4XW6-BCDqQn-T.js +1 -0
  97. package/dist/connect-UA7M4XW6-of1DMMin.mjs +4 -0
  98. package/dist/copy-CyrCMq2Q.mjs +19 -0
  99. package/dist/copy-D0w04l-Q.js +15 -0
  100. package/dist/core-BdUBRviB.js +907 -0
  101. package/dist/core-auWK_7Ox.mjs +16251 -0
  102. package/dist/create-FASO7PVG-BFLB5t7x.mjs +4 -0
  103. package/dist/create-FASO7PVG-DaZC1z5H.js +1 -0
  104. package/dist/cronos-HJPAQTAE-CWSImNSf.mjs +4 -0
  105. package/dist/cronos-HJPAQTAE-CYNBJWpC.js +1 -0
  106. package/dist/cursor-D5uRbW9D.mjs +7 -0
  107. package/dist/cursor-DFMotZ-L.js +3 -0
  108. package/dist/cursor-transparent-BanA5rDD.mjs +16 -0
  109. package/dist/cursor-transparent-Cs4NrQu6.js +12 -0
  110. package/dist/de_DE-PYAO5YD6-DRiWndek.mjs +1490 -0
  111. package/dist/de_DE-PYAO5YD6-Dd1WvOtn.js +1487 -0
  112. package/dist/degen-FQQ4XGHB-B0iCWKkK.js +1 -0
  113. package/dist/degen-FQQ4XGHB-DXAeLlGy.mjs +4 -0
  114. package/dist/desktop-6Q-_rh47.mjs +13 -0
  115. package/dist/desktop-CheS5Az_.js +9 -0
  116. package/dist/disconnect-CRF11ye0.mjs +12 -0
  117. package/dist/disconnect-DltoX_gP.js +8 -0
  118. package/dist/discord-B6nj8oD_.mjs +21 -0
  119. package/dist/discord-CqY7Pilo.js +17 -0
  120. package/dist/en_US-Y4ZOVFV4-Dn3zitY_.js +1 -0
  121. package/dist/en_US-Y4ZOVFV4-hyEPVcDM.mjs +4 -0
  122. package/dist/es_419-HRGOJ6VT-B7E9BfQ6.js +1487 -0
  123. package/dist/es_419-HRGOJ6VT-Bb7kiWEN.mjs +1490 -0
  124. package/dist/ethereum-RGGVA4PY-D0PFo6qh.js +1 -0
  125. package/dist/ethereum-RGGVA4PY-DxPcn0KS.mjs +4 -0
  126. package/dist/etherscan-CLcbtjKR.mjs +10 -0
  127. package/dist/etherscan-DxjvKQo9.js +6 -0
  128. package/dist/exclamation-triangle-CxJuBpFB.mjs +8 -0
  129. package/dist/exclamation-triangle-D9vGQKFQ.js +4 -0
  130. package/dist/extension-CSqCxcZG.js +8 -0
  131. package/dist/extension-t0E2b7ef.mjs +12 -0
  132. package/dist/external-link-B-Lcyi6R.mjs +12 -0
  133. package/dist/external-link-BoArXGTq.js +8 -0
  134. package/dist/facebook-Cnfem7th.mjs +30 -0
  135. package/dist/facebook-DOkj8R5F.js +26 -0
  136. package/dist/farcaster-BlN1w-oR.mjs +16 -0
  137. package/dist/farcaster-DKhgfKln.js +12 -0
  138. package/dist/filters-DY5tpPJB.mjs +12 -0
  139. package/dist/filters-w4oLgYuJ.js +8 -0
  140. package/dist/flow-5FQJFCTK-CVfZv3to.mjs +4 -0
  141. package/dist/flow-5FQJFCTK-zNre9dGJ.js +1 -0
  142. package/dist/fr_FR-IGGVC6RM-DaW0iy2_.js +1487 -0
  143. package/dist/fr_FR-IGGVC6RM-Kc8NKbgI.mjs +1490 -0
  144. package/dist/github-BnOjmw_1.mjs +22 -0
  145. package/dist/github-Bq8YXj-l.js +18 -0
  146. package/dist/gnosis-37ZC4RBL-DpsuNYS1.js +1 -0
  147. package/dist/gnosis-37ZC4RBL-xYLDpnHh.mjs +4 -0
  148. package/dist/google-BjbAYNIf.js +18 -0
  149. package/dist/google-ySq_VIsy.mjs +22 -0
  150. package/dist/gravity-J5YQHTYH-B97TrN9J.mjs +4 -0
  151. package/dist/gravity-J5YQHTYH-CnR8N36w.js +1 -0
  152. package/dist/hardhat-TX56IT5N-2KZA3GeI.mjs +4 -0
  153. package/dist/hardhat-TX56IT5N-Mh0k0VUo.js +1 -0
  154. package/dist/help-circle-D_pee-dG.mjs +16 -0
  155. package/dist/help-circle-MVmAyaVF.js +12 -0
  156. package/dist/hi_IN-XSKAA3MF-C9xFkabi.js +1487 -0
  157. package/dist/hi_IN-XSKAA3MF-DvyeO32P.mjs +1490 -0
  158. package/dist/hyperevm-VKPAA4SA-BrvLj9LS.js +1 -0
  159. package/dist/hyperevm-VKPAA4SA-C95vekJe.mjs +4 -0
  160. package/dist/id-ByfWOnEX.js +12 -0
  161. package/dist/id-CuusF9Qd.mjs +16 -0
  162. package/dist/id_ID-KUOB4UAL-B3IV2Afs.js +1487 -0
  163. package/dist/id_ID-KUOB4UAL-CvWLNQ5n.mjs +1490 -0
  164. package/dist/image-BlN-YE3X.js +4 -0
  165. package/dist/image-Cs26jwi7.mjs +8 -0
  166. package/dist/index-BKj9Y5tv.js +1750 -0
  167. package/dist/index-BUG5Ve0i.mjs +1037 -0
  168. package/dist/index-C8nreL9m.mjs +29619 -0
  169. package/dist/index-STIsWesT.js +394 -0
  170. package/dist/index.cjs.js +1 -0
  171. package/dist/index.d.ts +4 -0
  172. package/dist/index.es-APae9KBk.js +25 -0
  173. package/dist/index.es-e80IGd_J.mjs +11883 -0
  174. package/dist/index.es.js +9 -0
  175. package/dist/info-Cb2Tnwp9.mjs +7 -0
  176. package/dist/info-D7vY5t3I.js +3 -0
  177. package/dist/info-circle-CIVy5nVm.js +12 -0
  178. package/dist/info-circle-sI2i5HOv.mjs +16 -0
  179. package/dist/injectedWallet-AWJSZPMG-BDdjxTfh.js +1 -0
  180. package/dist/injectedWallet-AWJSZPMG-BZ4xMT5c.mjs +4 -0
  181. package/dist/ink-FZMYZWHG-BuNtRfvY.js +1 -0
  182. package/dist/ink-FZMYZWHG-DlcClk5L.mjs +4 -0
  183. package/dist/ja_JP-4WRQ63RX-BSsyVYkC.mjs +1490 -0
  184. package/dist/ja_JP-4WRQ63RX-DPg57Jtp.js +1487 -0
  185. package/dist/kaia-65D2U3PU-C3iOW87N.js +1 -0
  186. package/dist/kaia-65D2U3PU-DJdIsERb.mjs +4 -0
  187. package/dist/ko_KR-I2K7AIEP-BMvlvp6c.mjs +1490 -0
  188. package/dist/ko_KR-I2K7AIEP-DTiN0Tki.js +1487 -0
  189. package/dist/lightbulb-5NUvCVy3.js +3 -0
  190. package/dist/lightbulb-BYmcwWUA.mjs +7 -0
  191. package/dist/linea-QRMVQ5DY-C2d1pHrg.js +1 -0
  192. package/dist/linea-QRMVQ5DY-CrycDmSa.mjs +4 -0
  193. package/dist/login-UP3DZBGS-BT9d537y.mjs +4 -0
  194. package/dist/login-UP3DZBGS-C-c6uz2H.js +1 -0
  195. package/dist/mail-CT9BLct_.mjs +12 -0
  196. package/dist/mail-DAYPcxbx.js +8 -0
  197. package/dist/manta-SI27YFEJ-CBE6iXtC.js +1 -0
  198. package/dist/manta-SI27YFEJ-CFctqJ5B.mjs +4 -0
  199. package/dist/mantle-CKIUT334-CPiUOpgj.js +1 -0
  200. package/dist/mantle-CKIUT334-DZTIMdrF.mjs +4 -0
  201. package/dist/metaMaskWallet-SITXT2FV-CaDFha8m.mjs +4 -0
  202. package/dist/metaMaskWallet-SITXT2FV-CubKW4M9.js +1 -0
  203. package/dist/metamask-sdk-5m3nvPtB.js +542 -0
  204. package/dist/metamask-sdk-CPh1Wi1b.mjs +14970 -0
  205. package/dist/mobile-DNsm674z.js +9 -0
  206. package/dist/mobile-DRfo1ZAq.mjs +13 -0
  207. package/dist/monad-4KWC6TSS-Bme_0Zcf.mjs +4 -0
  208. package/dist/monad-4KWC6TSS-BnWBHM2V.js +1 -0
  209. package/dist/more-DFKbhNg4.js +11 -0
  210. package/dist/more-DvtnI5Dv.mjs +15 -0
  211. package/dist/ms_MY-6VZW6Q3Z-C_wmMLsb.mjs +1490 -0
  212. package/dist/ms_MY-6VZW6Q3Z-GeT8A_9b.js +1487 -0
  213. package/dist/network-placeholder-BPGY0Pea.js +14 -0
  214. package/dist/network-placeholder-DOmySIjI.mjs +18 -0
  215. package/dist/nftPlaceholder-CRB7uOjv.mjs +12 -0
  216. package/dist/nftPlaceholder-Dp6Tl1yi.js +8 -0
  217. package/dist/off-BVEy2I2N.js +8 -0
  218. package/dist/off-LjovEQOy.mjs +12 -0
  219. package/dist/optimism-HAF2GUT7-BT_Mx-dr.js +1 -0
  220. package/dist/optimism-HAF2GUT7-CDkFpVXG.mjs +4 -0
  221. package/dist/play-store-BwddU0Wq.mjs +36 -0
  222. package/dist/play-store-DlHvVfW-.js +32 -0
  223. package/dist/plus-C-X64_gj.mjs +17 -0
  224. package/dist/plus-ZMKluBd6.js +13 -0
  225. package/dist/polygon-WW6ZI7PM-DGanIpKH.js +1 -0
  226. package/dist/polygon-WW6ZI7PM-DMiAjxYW.mjs +4 -0
  227. package/dist/pt_BR-N3XOZ4SV-BeWb5NJg.mjs +1490 -0
  228. package/dist/pt_BR-N3XOZ4SV-E_1oHsgd.js +1487 -0
  229. package/dist/qr-code-Dhu5TPha.js +6 -0
  230. package/dist/qr-code-bLEKEk0B.mjs +10 -0
  231. package/dist/rainbowWallet-O26YNBMX-CB4dd0t7.mjs +4 -0
  232. package/dist/rainbowWallet-O26YNBMX-CqPvjISh.js +1 -0
  233. package/dist/recycle-horizontal-9JHHDd4h.js +9 -0
  234. package/dist/recycle-horizontal-CS_0PZGV.mjs +13 -0
  235. package/dist/refresh-C_qXNL0S.mjs +12 -0
  236. package/dist/refresh-DkMlARk7.js +8 -0
  237. package/dist/refresh-S4T5V5GX-BZCZ2pAn.js +1 -0
  238. package/dist/refresh-S4T5V5GX-CoT4SMY4.mjs +4 -0
  239. package/dist/reown-logo-CBPzCyQW.mjs +16 -0
  240. package/dist/reown-logo-UwMrTrcX.js +12 -0
  241. package/dist/ronin-EMCPYXZT-BVeW22BA.js +1 -0
  242. package/dist/ronin-EMCPYXZT-CMqZm7Bj.mjs +4 -0
  243. package/dist/ru_RU-IITAPRET-DRURjjb_.mjs +1490 -0
  244. package/dist/ru_RU-IITAPRET-DWVtNBKa.js +1487 -0
  245. package/dist/sanko-RHQYXGM5-BdRCo3KT.mjs +4 -0
  246. package/dist/sanko-RHQYXGM5-t_EneLtZ.js +1 -0
  247. package/dist/scan-4UYSQ56Q-Bt1XXdi3.mjs +4 -0
  248. package/dist/scan-4UYSQ56Q-DqVlbE3J.js +1 -0
  249. package/dist/scroll-5OBGQVOV-C_cEm-kG.mjs +4 -0
  250. package/dist/scroll-5OBGQVOV-DYo31pKm.js +1 -0
  251. package/dist/search-B4itLiVW.js +8 -0
  252. package/dist/search-CQuKFVAx.mjs +12 -0
  253. package/dist/secp256k1-BB5DYugF.mjs +1479 -0
  254. package/dist/secp256k1-BiRGPPqo.js +1 -0
  255. package/dist/secp256k1-CI29X52U.js +1 -0
  256. package/dist/secp256k1-Cf9t2cTM.mjs +1479 -0
  257. package/dist/send-porC6mPB.js +15 -0
  258. package/dist/send-qTi-ybzM.mjs +19 -0
  259. package/dist/sign-A7IJEUT5-BI5zSXW6.js +1 -0
  260. package/dist/sign-A7IJEUT5-BQQmgNRT.mjs +4 -0
  261. package/dist/style.css +1 -0
  262. package/dist/superposition-HG6MMR2Y-CUrWVrH0.js +1 -0
  263. package/dist/superposition-HG6MMR2Y-DHda4Hsd.mjs +4 -0
  264. package/dist/swapHorizontal-C3MNcVMo.mjs +12 -0
  265. package/dist/swapHorizontal-HantsmRd.js +8 -0
  266. package/dist/swapHorizontalBold-C_GQta-j.mjs +12 -0
  267. package/dist/swapHorizontalBold-XlXD6Scp.js +8 -0
  268. package/dist/swapHorizontalMedium-Bo6Sszm7.mjs +20 -0
  269. package/dist/swapHorizontalMedium-ChYk0TiL.js +16 -0
  270. package/dist/swapHorizontalRoundedBold-B5EvZSwz.mjs +12 -0
  271. package/dist/swapHorizontalRoundedBold-Dx_Co5wk.js +8 -0
  272. package/dist/swapVertical-cHQwpGr0.mjs +12 -0
  273. package/dist/swapVertical-fmzZLSPI.js +8 -0
  274. package/dist/telegram-BdrptLN3.mjs +20 -0
  275. package/dist/telegram-Dv7wEgKb.js +16 -0
  276. package/dist/th_TH-3ZQCKCQE-Da2m2LPy.js +1487 -0
  277. package/dist/th_TH-3ZQCKCQE-nFsMfjJa.mjs +1490 -0
  278. package/dist/three-dots-CPXRPIKy.js +5 -0
  279. package/dist/three-dots-DEs9ZhDC.mjs +9 -0
  280. package/dist/tr_TR-QUPUGMUF-DF0OeGUb.mjs +1490 -0
  281. package/dist/tr_TR-QUPUGMUF-s63Tz8WP.js +1487 -0
  282. package/dist/twitch-Ck5pSyDI.js +18 -0
  283. package/dist/twitch-IQhZ8m1X.mjs +22 -0
  284. package/dist/twitterIcon-DO8XDAwC.js +6 -0
  285. package/dist/twitterIcon-DsS9CDA5.mjs +10 -0
  286. package/dist/types/index.d.ts +51 -0
  287. package/dist/uk_UA-SSN6SV5E-Bb4huhf1.mjs +1490 -0
  288. package/dist/uk_UA-SSN6SV5E-IfMgDbzS.js +1487 -0
  289. package/dist/unichain-C5BWO2ZY-CgjeJfD4.mjs +4 -0
  290. package/dist/unichain-C5BWO2ZY-DrmDCV2p.js +1 -0
  291. package/dist/utils/constants.d.ts +6 -0
  292. package/dist/verify-CgTgRejE.js +8 -0
  293. package/dist/verify-DOD4hBvs.mjs +12 -0
  294. package/dist/verify-filled-BhxgjhKC.js +8 -0
  295. package/dist/verify-filled-QPe9Hi2W.mjs +12 -0
  296. package/dist/vi_VN-7BUVRNYY-Ba1mpr-F.js +1487 -0
  297. package/dist/vi_VN-7BUVRNYY-PCI3QRx7.mjs +1490 -0
  298. package/dist/w3m-modal-C3JE1VNb.mjs +1471 -0
  299. package/dist/w3m-modal-DLEWxfrc.js +642 -0
  300. package/dist/wallet-ByF6bf_R.mjs +12 -0
  301. package/dist/wallet-DU_BeJ1K.js +8 -0
  302. package/dist/wallet-placeholder-C3VkDDkp.js +14 -0
  303. package/dist/wallet-placeholder-DBpXjyqE.mjs +18 -0
  304. package/dist/walletConnectWallet-YHWKVTDY-DU_S15em.mjs +4 -0
  305. package/dist/walletConnectWallet-YHWKVTDY-k9TO_fWs.js +1 -0
  306. package/dist/walletconnect-B2bmSYc7.mjs +36 -0
  307. package/dist/walletconnect-DC4CEinm.js +30 -0
  308. package/dist/warning-circle-BBKO7OkV.js +12 -0
  309. package/dist/warning-circle-CYTT9cYz.mjs +16 -0
  310. package/dist/x-DG2aE2ub.mjs +16 -0
  311. package/dist/x-PLo7_AhG.js +12 -0
  312. package/dist/xdc-KJ3TDBYO-DjnCHm47.js +1 -0
  313. package/dist/xdc-KJ3TDBYO-Ie58M8Vn.mjs +4 -0
  314. package/dist/zetachain-TLDS5IPW-BRdUItmm.js +1 -0
  315. package/dist/zetachain-TLDS5IPW-CCJ72zNa.mjs +4 -0
  316. package/dist/zh_CN-HJBN674C-Bo2gNwt5.mjs +1490 -0
  317. package/dist/zh_CN-HJBN674C-Vu7Wn9i6.js +1487 -0
  318. package/dist/zh_HK-JW3WLRKE-BY2ft2ew.mjs +1490 -0
  319. package/dist/zh_HK-JW3WLRKE-COIwuLIC.js +1487 -0
  320. package/dist/zh_TW-VNNRNXY7-CyIPkoVZ.mjs +1490 -0
  321. package/dist/zh_TW-VNNRNXY7-DKIN8H5Y.js +1487 -0
  322. package/dist/zksync-DH7HK5U4-08fCIujK.mjs +4 -0
  323. package/dist/zksync-DH7HK5U4-DVKzLGnB.js +1 -0
  324. package/dist/zora-FYL5H3IO-BSEkA2hF.js +1 -0
  325. package/dist/zora-FYL5H3IO-BoL7oY8W.mjs +4 -0
  326. package/package.json +66 -0
@@ -0,0 +1,542 @@
1
+ "use strict";var Xf=Object.defineProperty;var Qf=(t,e,n)=>e in t?Xf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Bt=(t,e,n)=>Qf(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Tn=require("./index-BKj9Y5tv.js");var Es={exports:{}};(function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Tn.commonjsGlobal<"u"&&Tn.commonjsGlobal,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(c){var s=typeof o<"u"&&o||typeof self<"u"&&self||typeof Tn.commonjsGlobal<"u"&&Tn.commonjsGlobal||{},a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(C){return C&&DataView.prototype.isPrototypeOf(C)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(C){return C&&u.indexOf(Object.prototype.toString.call(C))>-1};function h(C){if(typeof C!="string"&&(C=String(C)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(C)||C==="")throw new TypeError('Invalid character in header field name: "'+C+'"');return C.toLowerCase()}function f(C){return typeof C!="string"&&(C=String(C)),C}function g(C){var O={next:function(){var D=C.shift();return{done:D===void 0,value:D}}};return a.iterable&&(O[Symbol.iterator]=function(){return O}),O}function m(C){this.map={},C instanceof m?C.forEach(function(O,D){this.append(D,O)},this):Array.isArray(C)?C.forEach(function(O){if(O.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+O.length);this.append(O[0],O[1])},this):C&&Object.getOwnPropertyNames(C).forEach(function(O){this.append(O,C[O])},this)}m.prototype.append=function(C,O){C=h(C),O=f(O);var D=this.map[C];this.map[C]=D?D+", "+O:O},m.prototype.delete=function(C){delete this.map[h(C)]},m.prototype.get=function(C){return C=h(C),this.has(C)?this.map[C]:null},m.prototype.has=function(C){return this.map.hasOwnProperty(h(C))},m.prototype.set=function(C,O){this.map[h(C)]=f(O)},m.prototype.forEach=function(C,O){for(var D in this.map)this.map.hasOwnProperty(D)&&C.call(O,this.map[D],D,this)},m.prototype.keys=function(){var C=[];return this.forEach(function(O,D){C.push(D)}),g(C)},m.prototype.values=function(){var C=[];return this.forEach(function(O){C.push(O)}),g(C)},m.prototype.entries=function(){var C=[];return this.forEach(function(O,D){C.push([D,O])}),g(C)},a.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function w(C){if(!C._noBody){if(C.bodyUsed)return Promise.reject(new TypeError("Already read"));C.bodyUsed=!0}}function p(C){return new Promise(function(O,D){C.onload=function(){O(C.result)},C.onerror=function(){D(C.error)}})}function S(C){var O=new FileReader,D=p(O);return O.readAsArrayBuffer(C),D}function _(C){var O=new FileReader,D=p(O),y=/charset=([A-Za-z0-9_-]+)/.exec(C.type),E=y?y[1]:"utf-8";return O.readAsText(C,E),D}function P(C){for(var O=new Uint8Array(C),D=new Array(O.length),y=0;y<O.length;y++)D[y]=String.fromCharCode(O[y]);return D.join("")}function I(C){if(C.slice)return C.slice(0);var O=new Uint8Array(C.byteLength);return O.set(new Uint8Array(C)),O.buffer}function K(){return this.bodyUsed=!1,this._initBody=function(C){this.bodyUsed=this.bodyUsed,this._bodyInit=C,C?typeof C=="string"?this._bodyText=C:a.blob&&Blob.prototype.isPrototypeOf(C)?this._bodyBlob=C:a.formData&&FormData.prototype.isPrototypeOf(C)?this._bodyFormData=C:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(C)?this._bodyText=C.toString():a.arrayBuffer&&a.blob&&l(C)?(this._bodyArrayBuffer=I(C.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(C)||d(C))?this._bodyArrayBuffer=I(C):this._bodyText=C=Object.prototype.toString.call(C):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof C=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(C)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var C=w(this);if(C)return C;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var C=w(this);return C||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(a.blob)return this.blob().then(S);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var C=w(this);if(C)return C;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(P(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(j)}),this.json=function(){return this.text().then(JSON.parse)},this}var q=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(C){var O=C.toUpperCase();return q.indexOf(O)>-1?O:C}function U(C,O){if(!(this instanceof U))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');O=O||{};var D=O.body;if(C instanceof U){if(C.bodyUsed)throw new TypeError("Already read");this.url=C.url,this.credentials=C.credentials,O.headers||(this.headers=new m(C.headers)),this.method=C.method,this.mode=C.mode,this.signal=C.signal,!D&&C._bodyInit!=null&&(D=C._bodyInit,C.bodyUsed=!0)}else this.url=String(C);if(this.credentials=O.credentials||this.credentials||"same-origin",(O.headers||!this.headers)&&(this.headers=new m(O.headers)),this.method=F(O.method||this.method||"GET"),this.mode=O.mode||this.mode||null,this.signal=O.signal||this.signal||function(){if("AbortController"in s){var k=new AbortController;return k.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(D),(this.method==="GET"||this.method==="HEAD")&&(O.cache==="no-store"||O.cache==="no-cache")){var y=/([?&])_=[^&]*/;if(y.test(this.url))this.url=this.url.replace(y,"$1_="+new Date().getTime());else{var E=/\?/;this.url+=(E.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function j(C){var O=new FormData;return C.trim().split("&").forEach(function(D){if(D){var y=D.split("="),E=y.shift().replace(/\+/g," "),k=y.join("=").replace(/\+/g," ");O.append(decodeURIComponent(E),decodeURIComponent(k))}}),O}function G(C){var O=new m,D=C.replace(/\r?\n[\t ]+/g," ");return D.split("\r").map(function(y){return y.indexOf(`
2
+ `)===0?y.substr(1,y.length):y}).forEach(function(y){var E=y.split(":"),k=E.shift().trim();if(k){var x=E.join(":").trim();try{O.append(k,x)}catch(b){console.warn("Response "+b.message)}}}),O}K.call(U.prototype);function $(C,O){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(O||(O={}),this.type="default",this.status=O.status===void 0?200:O.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=O.statusText===void 0?"":""+O.statusText,this.headers=new m(O.headers),this.url=O.url||"",this._initBody(C)}K.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},$.error=function(){var C=new $(null,{status:200,statusText:""});return C.ok=!1,C.status=0,C.type="error",C};var N=[301,302,303,307,308];$.redirect=function(C,O){if(N.indexOf(O)===-1)throw new RangeError("Invalid status code");return new $(null,{status:O,headers:{location:C}})},c.DOMException=s.DOMException;try{new c.DOMException}catch{c.DOMException=function(O,D){this.message=O,this.name=D;var y=Error(O);this.stack=y.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function R(C,O){return new Promise(function(D,y){var E=new U(C,O);if(E.signal&&E.signal.aborted)return y(new c.DOMException("Aborted","AbortError"));var k=new XMLHttpRequest;function x(){k.abort()}k.onload=function(){var A={statusText:k.statusText,headers:G(k.getAllResponseHeaders()||"")};E.url.indexOf("file://")===0&&(k.status<200||k.status>599)?A.status=200:A.status=k.status,A.url="responseURL"in k?k.responseURL:A.headers.get("X-Request-URL");var T="response"in k?k.response:k.responseText;setTimeout(function(){D(new $(T,A))},0)},k.onerror=function(){setTimeout(function(){y(new TypeError("Network request failed"))},0)},k.ontimeout=function(){setTimeout(function(){y(new TypeError("Network request timed out"))},0)},k.onabort=function(){setTimeout(function(){y(new c.DOMException("Aborted","AbortError"))},0)};function b(A){try{return A===""&&s.location.href?s.location.href:A}catch{return A}}if(k.open(E.method,b(E.url),!0),E.credentials==="include"?k.withCredentials=!0:E.credentials==="omit"&&(k.withCredentials=!1),"responseType"in k&&(a.blob?k.responseType="blob":a.arrayBuffer&&(k.responseType="arraybuffer")),O&&typeof O.headers=="object"&&!(O.headers instanceof m||s.Headers&&O.headers instanceof s.Headers)){var v=[];Object.getOwnPropertyNames(O.headers).forEach(function(A){v.push(h(A)),k.setRequestHeader(A,f(O.headers[A]))}),E.headers.forEach(function(A,T){v.indexOf(T)===-1&&k.setRequestHeader(T,A)})}else E.headers.forEach(function(A,T){k.setRequestHeader(T,A)});E.signal&&(E.signal.addEventListener("abort",x),k.onreadystatechange=function(){k.readyState===4&&E.signal.removeEventListener("abort",x)}),k.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return R.polyfill=!0,s.fetch||(s.fetch=R,s.Headers=m,s.Request=U,s.Response=$),c.Headers=m,c.Request=U,c.Response=$,c.fetch=R,c})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(Es,Es.exports);var ep=Es.exports;const Au=Tn.getDefaultExportFromCjs(ep);var _s={exports:{}},Po,oc;function tp(){if(oc)return Po;oc=1;var t=1e3,e=t*60,n=e*60,r=n*24,i=r*7,o=r*365.25;Po=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return c(u);if(h==="number"&&isFinite(u))return d.long?a(u):s(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function c(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var h=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*i;case"days":case"day":case"d":return h*r;case"hours":case"hour":case"hrs":case"hr":case"h":return h*n;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function s(u){var d=Math.abs(u);return d>=r?Math.round(u/r)+"d":d>=n?Math.round(u/n)+"h":d>=e?Math.round(u/e)+"m":d>=t?Math.round(u/t)+"s":u+"ms"}function a(u){var d=Math.abs(u);return d>=r?l(u,d,r,"day"):d>=n?l(u,d,n,"hour"):d>=e?l(u,d,e,"minute"):d>=t?l(u,d,t,"second"):u+" ms"}function l(u,d,h,f){var g=d>=h*1.5;return Math.round(u/h)+" "+f+(g?"s":"")}return Po}function np(t){n.debug=n,n.default=n,n.coerce=a,n.disable=o,n.enable=i,n.enabled=c,n.humanize=tp(),n.destroy=l,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let d=0;for(let h=0;h<u.length;h++)d=(d<<5)-d+u.charCodeAt(h),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=e;function n(u){let d,h=null,f,g;function m(...w){if(!m.enabled)return;const p=m,S=Number(new Date),_=S-(d||S);p.diff=_,p.prev=d,p.curr=S,d=S,w[0]=n.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let P=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(K,q)=>{if(K==="%%")return"%";P++;const F=n.formatters[q];if(typeof F=="function"){const U=w[P];K=F.call(p,U),w.splice(P,1),P--}return K}),n.formatArgs.call(p,w),(p.log||n.log).apply(p,w)}return m.namespace=u,m.useColors=n.useColors(),m.color=n.selectColor(u),m.extend=r,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(f!==n.namespaces&&(f=n.namespaces,g=n.enabled(u)),g),set:w=>{h=w}}),typeof n.init=="function"&&n.init(m),m}function r(u,d){const h=n(this.namespace+(typeof d>"u"?":":d)+u);return h.log=this.log,h}function i(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let d;const h=(typeof u=="string"?u:"").split(/[\s,]+/),f=h.length;for(d=0;d<f;d++)h[d]&&(u=h[d].replace(/\*/g,".*?"),u[0]==="-"?n.skips.push(new RegExp("^"+u.slice(1)+"$")):n.names.push(new RegExp("^"+u+"$")))}function o(){const u=[...n.names.map(s),...n.skips.map(s).map(d=>"-"+d)].join(",");return n.enable(""),u}function c(u){if(u[u.length-1]==="*")return!0;let d,h;for(d=0,h=n.skips.length;d<h;d++)if(n.skips[d].test(u))return!1;for(d=0,h=n.names.length;d<h;d++)if(n.names[d].test(u))return!0;return!1}function s(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function a(u){return u instanceof Error?u.stack||u.message:u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var rp=np;(function(t,e){e.formatArgs=r,e.save=i,e.load=o,e.useColors=n,e.storage=c(),e.destroy=(()=>{let a=!1;return()=>{a||(a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;a.splice(1,0,l,"color: inherit");let u=0,d=0;a[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(u++,h==="%c"&&(d=u))}),a.splice(d,0,l)}e.log=console.debug||console.log||(()=>{});function i(a){try{a?e.storage.setItem("debug",a):e.storage.removeItem("debug")}catch{}}function o(){let a;try{a=e.storage.getItem("debug")}catch{}return!a&&typeof process<"u"&&"env"in process&&(a=process.env.DEBUG),a}function c(){try{return localStorage}catch{}}t.exports=rp(e);const{formatters:s}=t.exports;s.j=function(a){try{return JSON.stringify(a)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(_s,_s.exports);var ip=_s.exports;const Ve=Tn.getDefaultExportFromCjs(ip);var da=Object.defineProperty,op=Object.getOwnPropertyDescriptor,sp=Object.getOwnPropertyNames,ap=Object.prototype.hasOwnProperty,cp=(t,e)=>{for(var n in e)da(t,n,{get:e[n],enumerable:!0})},lp=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sp(e))!ap.call(t,i)&&i!==n&&da(t,i,{get:()=>e[i],enumerable:!(r=op(e,i))||r.enumerable});return t},up=t=>lp(da({},"__esModule",{value:!0}),t),ku={};cp(ku,{createFinalURL:()=>Ou,createPathBasedClient:()=>gp,createQuerySerializer:()=>Ss,default:()=>xu,defaultBodySerializer:()=>Pu,defaultPathSerializer:()=>Ru,mergeHeaders:()=>Cs,randomID:()=>Tu,removeTrailingSlash:()=>As,serializeArrayParam:()=>fa,serializeObjectParam:()=>ha,serializePrimitiveParam:()=>zr,wrapAsPathBasedClient:()=>Mu});var dp=up(ku),hp=/\{[^{}]+\}/g,fp=()=>{var t,e;return typeof process=="object"&&Number.parseInt((e=(t=process==null?void 0:process.versions)==null?void 0:t.node)==null?void 0:e.substring(0,2))>=18&&process.versions.undici};function Tu(){return Math.random().toString(36).slice(2,11)}function xu(t){let{baseUrl:e="",Request:n=globalThis.Request,fetch:r=globalThis.fetch,querySerializer:i,bodySerializer:o,headers:c,requestInitExt:s=void 0,...a}={...t};s=fp()?s:void 0,e=As(e);const l=[];async function u(d,h){const{baseUrl:f,fetch:g=r,Request:m=n,headers:w,params:p={},parseAs:S="json",querySerializer:_,bodySerializer:P=o??Pu,body:I,...K}=h||{};let q=e;f&&(q=As(f)??e);let F=typeof i=="function"?i:Ss(i);_&&(F=typeof _=="function"?_:Ss({...typeof i=="object"?i:{},..._}));const U=I===void 0?void 0:P(I,Cs(c,w,p.header)),j=Cs(U===void 0||U instanceof FormData?{}:{"Content-Type":"application/json"},c,w,p.header),G={redirect:"follow",...a,...K,body:U,headers:j};let $,N,R=new n(Ou(d,{baseUrl:q,params:p,querySerializer:F}),G),C;for(const D in K)D in R||(R[D]=K[D]);if(l.length){$=Tu(),N=Object.freeze({baseUrl:q,fetch:g,parseAs:S,querySerializer:F,bodySerializer:P});for(const D of l)if(D&&typeof D=="object"&&typeof D.onRequest=="function"){const y=await D.onRequest({request:R,schemaPath:d,params:p,options:N,id:$});if(y)if(y instanceof n)R=y;else if(y instanceof Response){C=y;break}else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!C){try{C=await g(R,s)}catch(D){let y=D;if(l.length)for(let E=l.length-1;E>=0;E--){const k=l[E];if(k&&typeof k=="object"&&typeof k.onError=="function"){const x=await k.onError({request:R,error:y,schemaPath:d,params:p,options:N,id:$});if(x){if(x instanceof Response){y=void 0,C=x;break}if(x instanceof Error){y=x;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(y)throw y}if(l.length)for(let D=l.length-1;D>=0;D--){const y=l[D];if(y&&typeof y=="object"&&typeof y.onResponse=="function"){const E=await y.onResponse({request:R,response:C,schemaPath:d,params:p,options:N,id:$});if(E){if(!(E instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");C=E}}}}if(C.status===204||R.method==="HEAD"||C.headers.get("Content-Length")==="0")return C.ok?{data:void 0,response:C}:{error:void 0,response:C};if(C.ok)return S==="stream"?{data:C.body,response:C}:{data:await C[S](),response:C};let O=await C.text();try{O=JSON.parse(O)}catch{}return{error:O,response:C}}return{request(d,h,f){return u(h,{...f,method:d.toUpperCase()})},GET(d,h){return u(d,{...h,method:"GET"})},PUT(d,h){return u(d,{...h,method:"PUT"})},POST(d,h){return u(d,{...h,method:"POST"})},DELETE(d,h){return u(d,{...h,method:"DELETE"})},OPTIONS(d,h){return u(d,{...h,method:"OPTIONS"})},HEAD(d,h){return u(d,{...h,method:"HEAD"})},PATCH(d,h){return u(d,{...h,method:"PATCH"})},TRACE(d,h){return u(d,{...h,method:"TRACE"})},use(...d){for(const h of d)if(h){if(typeof h!="object"||!("onRequest"in h||"onResponse"in h||"onError"in h))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");l.push(h)}},eject(...d){for(const h of d){const f=l.indexOf(h);f!==-1&&l.splice(f,1)}}}}var pp=class{constructor(t,e){Bt(this,"GET",t=>this.client.GET(this.url,t));Bt(this,"PUT",t=>this.client.PUT(this.url,t));Bt(this,"POST",t=>this.client.POST(this.url,t));Bt(this,"DELETE",t=>this.client.DELETE(this.url,t));Bt(this,"OPTIONS",t=>this.client.OPTIONS(this.url,t));Bt(this,"HEAD",t=>this.client.HEAD(this.url,t));Bt(this,"PATCH",t=>this.client.PATCH(this.url,t));Bt(this,"TRACE",t=>this.client.TRACE(this.url,t));this.client=t,this.url=e}},mp=class{constructor(){this.client=null}get(t,e){const n=new pp(t,e);return this.client[e]=n,n}};function Mu(t){const e=new mp,n=new Proxy(t,e);function r(){}r.prototype=n;const i=new r;return e.client=i,i}function gp(t){return Mu(xu(t))}function zr(t,e,n){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${(n==null?void 0:n.allowReserved)===!0?e:encodeURIComponent(e)}`}function ha(t,e,n){if(!e||typeof e!="object")return"";const r=[],i={simple:",",label:".",matrix:";"}[n.style]||"&";if(n.style!=="deepObject"&&n.explode===!1){for(const s in e)r.push(s,n.allowReserved===!0?e[s]:encodeURIComponent(e[s]));const c=r.join(",");switch(n.style){case"form":return`${t}=${c}`;case"label":return`.${c}`;case"matrix":return`;${t}=${c}`;default:return c}}for(const c in e){const s=n.style==="deepObject"?`${t}[${c}]`:c;r.push(zr(s,e[c],n))}const o=r.join(i);return n.style==="label"||n.style==="matrix"?`${i}${o}`:o}function fa(t,e,n){if(!Array.isArray(e))return"";if(n.explode===!1){const o={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[n.style]||",",c=(n.allowReserved===!0?e:e.map(s=>encodeURIComponent(s))).join(o);switch(n.style){case"simple":return c;case"label":return`.${c}`;case"matrix":return`;${t}=${c}`;default:return`${t}=${c}`}}const r={simple:",",label:".",matrix:";"}[n.style]||"&",i=[];for(const o of e)n.style==="simple"||n.style==="label"?i.push(n.allowReserved===!0?o:encodeURIComponent(o)):i.push(zr(t,o,n));return n.style==="label"||n.style==="matrix"?`${r}${i.join(r)}`:i.join(r)}function Ss(t){return function(n){const r=[];if(n&&typeof n=="object")for(const i in n){const o=n[i];if(o!=null){if(Array.isArray(o)){if(o.length===0)continue;r.push(fa(i,o,{style:"form",explode:!0,...t==null?void 0:t.array,allowReserved:(t==null?void 0:t.allowReserved)||!1}));continue}if(typeof o=="object"){r.push(ha(i,o,{style:"deepObject",explode:!0,...t==null?void 0:t.object,allowReserved:(t==null?void 0:t.allowReserved)||!1}));continue}r.push(zr(i,o,t))}}return r.join("&")}}function Ru(t,e){let n=t;for(const r of t.match(hp)??[]){let i=r.substring(1,r.length-1),o=!1,c="simple";if(i.endsWith("*")&&(o=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(c="label",i=i.substring(1)):i.startsWith(";")&&(c="matrix",i=i.substring(1)),!e||e[i]===void 0||e[i]===null)continue;const s=e[i];if(Array.isArray(s)){n=n.replace(r,fa(i,s,{style:c,explode:o}));continue}if(typeof s=="object"){n=n.replace(r,ha(i,s,{style:c,explode:o}));continue}if(c==="matrix"){n=n.replace(r,`;${zr(i,s)}`);continue}n=n.replace(r,c==="label"?`.${encodeURIComponent(s)}`:encodeURIComponent(s))}return n}function Pu(t,e){return t instanceof FormData?t:e&&(e.get instanceof Function?e.get("Content-Type")??e.get("content-type"):e["Content-Type"]??e["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(t).toString():JSON.stringify(t)}function Ou(t,e){var i;let n=`${e.baseUrl}${t}`;(i=e.params)!=null&&i.path&&(n=Ru(n,e.params.path));let r=e.querySerializer(e.params.query??{});return r.startsWith("?")&&(r=r.substring(1)),r&&(n+=`?${r}`),n}function Cs(...t){const e=new Headers;for(const n of t){if(!n||typeof n!="object")continue;const r=n instanceof Headers?n.entries():Object.entries(n);for(const[i,o]of r)if(o===null)e.delete(i);else if(Array.isArray(o))for(const c of o)e.append(i,c);else o!==void 0&&e.set(i,o)}return e}function As(t){return t.endsWith("/")?t.substring(0,t.length-1):t}var yp=Object.create,mo=Object.defineProperty,vp=Object.getOwnPropertyDescriptor,bp=Object.getOwnPropertyNames,wp=Object.getPrototypeOf,Ep=Object.prototype.hasOwnProperty,_p=(t,e)=>{for(var n in e)mo(t,n,{get:e[n],enumerable:!0})},Iu=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bp(e))!Ep.call(t,i)&&i!==n&&mo(t,i,{get:()=>e[i],enumerable:!(r=vp(e,i))||r.enumerable});return t},Sp=(t,e,n)=>(n=t!=null?yp(wp(t)):{},Iu(!t||!t.__esModule?mo(n,"default",{value:t,enumerable:!0}):n,t)),Cp=t=>Iu(mo({},"__esModule",{value:!0}),t),Lu={};_p(Lu,{analytics:()=>Op});var Te=Cp(Lu),Ap=Sp(dp),kp=class{constructor(t){this.batch=[],this.maxTimeoutMs=3e4,this.timeoutId=null,this.isSending=!1,this.batchSize=t.batchSize,this.baseTimeoutMs=t.baseTimeoutMs,this.currentTimeoutMs=t.baseTimeoutMs,this.sendFn=t.sendFn}enqueue(t){this.batch.push(t),this.schedule()}schedule(){this.batch.length>0&&!this.timeoutId&&(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.flush()},this.currentTimeoutMs))}async flush(){if(this.isSending||this.batch.length===0)return;this.isSending=!0;const t=[...this.batch.slice(0,this.batchSize)];this.batch=this.batch.slice(this.batchSize);try{await this.sendFn(t),this.currentTimeoutMs=this.baseTimeoutMs}catch(e){console.error("Sender: Failed to send batch",e),this.batch=[...t,...this.batch],this.currentTimeoutMs=Math.min(this.currentTimeoutMs*2,this.maxTimeoutMs)}finally{this.isSending=!1,this.schedule()}}},Tp=kp,xp=class{constructor(t){this.enabled=!1,this.properties={};const e=(0,Ap.default)({baseUrl:t}),n=async r=>{const i=await e.POST("/v1/events",{body:r});if(i.response.status!==200)throw new Error(i.error)};this.sender=new Tp({batchSize:100,baseTimeoutMs:200,sendFn:n})}enable(){this.enabled=!0}setGlobalProperty(t,e){this.properties[t]=e}track(t,e){if(!this.enabled)return;const n={name:t,...this.properties,...e};this.sender.enqueue(n)}},Mp=xp,ks,sc;typeof process<"u"&&process.env&&(ks=(sc=process.env.METAMASK_ANALYTICS_ENDPOINT)!=null?sc:process.env.NEXT_PUBLIC_METAMASK_ANALYTICS_ENDPOINT);var Rp=ks??"https://mm-sdk-analytics.api.cx.metamask.io/",Pp=new Mp(Rp),Op=Pp,Nu={exports:{}};/*!
3
+ * EventEmitter2
4
+ * https://github.com/hij1nx/EventEmitter2
5
+ *
6
+ * Copyright (c) 2013 hij1nx
7
+ * Licensed under the MIT license.
8
+ */(function(t,e){(function(n){var r=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(E){return Object.prototype.toString.call(E)==="[object Array]"},o=10,c=typeof process=="object"&&typeof process.nextTick=="function",s=typeof Symbol=="function",a=typeof Reflect=="object",l=typeof setImmediate=="function",u=l?setImmediate:setTimeout,d=s?a&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(y){var E=Object.getOwnPropertyNames(y);return E.push.apply(E,Object.getOwnPropertySymbols(y)),E}:Object.keys;function h(){this._events={},this._conf&&f.call(this,this._conf)}function f(y){y&&(this._conf=y,y.delimiter&&(this.delimiter=y.delimiter),y.maxListeners!==n&&(this._maxListeners=y.maxListeners),y.wildcard&&(this.wildcard=y.wildcard),y.newListener&&(this._newListener=y.newListener),y.removeListener&&(this._removeListener=y.removeListener),y.verboseMemoryLeak&&(this.verboseMemoryLeak=y.verboseMemoryLeak),y.ignoreErrors&&(this.ignoreErrors=y.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function g(y,E){var k="(node) warning: possible EventEmitter memory leak detected. "+y+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(k+=" Event name: "+E+"."),typeof process<"u"&&process.emitWarning){var x=new Error(k);x.name="MaxListenersExceededWarning",x.emitter=this,x.count=y,process.emitWarning(x)}else console.error(k),console.trace&&console.trace()}var m=function(y,E,k){var x=arguments.length;switch(x){case 0:return[];case 1:return[y];case 2:return[y,E];case 3:return[y,E,k];default:for(var b=new Array(x);x--;)b[x]=arguments[x];return b}};function w(y,E){for(var k={},x,b=y.length,v=0,A=0;A<b;A++)x=y[A],k[x]=A<v?E[A]:n;return k}function p(y,E,k){this._emitter=y,this._target=E,this._listeners={},this._listenersCount=0;var x,b;if((k.on||k.off)&&(x=k.on,b=k.off),E.addEventListener?(x=E.addEventListener,b=E.removeEventListener):E.addListener?(x=E.addListener,b=E.removeListener):E.on&&(x=E.on,b=E.off),!x&&!b)throw Error("target does not implement any known event API");if(typeof x!="function")throw TypeError("on method must be a function");if(typeof b!="function")throw TypeError("off method must be a function");this._on=x,this._off=b;var v=y._observers;v?v.push(this):y._observers=[this]}Object.assign(p.prototype,{subscribe:function(y,E,k){var x=this,b=this._target,v=this._emitter,A=this._listeners,T=function(){var M=m.apply(null,arguments),L={data:M,name:E,original:y};if(k){var B=k.call(b,L);B!==!1&&v.emit.apply(v,[L.name].concat(M));return}v.emit.apply(v,[E].concat(M))};if(A[y])throw Error("Event '"+y+"' is already listening");this._listenersCount++,v._newListener&&v._removeListener&&!x._onNewListener?(this._onNewListener=function(M){M===E&&A[y]===null&&(A[y]=T,x._on.call(b,y,T))},v.on("newListener",this._onNewListener),this._onRemoveListener=function(M){M===E&&!v.hasListeners(M)&&A[y]&&(A[y]=null,x._off.call(b,y,T))},A[y]=null,v.on("removeListener",this._onRemoveListener)):(A[y]=T,x._on.call(b,y,T))},unsubscribe:function(y){var E=this,k=this._listeners,x=this._emitter,b,v,A=this._off,T=this._target,M;if(y&&typeof y!="string")throw TypeError("event must be a string");function L(){E._onNewListener&&(x.off("newListener",E._onNewListener),x.off("removeListener",E._onRemoveListener),E._onNewListener=null,E._onRemoveListener=null);var B=F.call(x,E);x._observers.splice(B,1)}if(y){if(b=k[y],!b)return;A.call(T,y,b),delete k[y],--this._listenersCount||L()}else{for(v=d(k),M=v.length;M-- >0;)y=v[M],A.call(T,y,k[y]);this._listeners={},this._listenersCount=0,L()}}});function S(y,E,k,x){var b=Object.assign({},E);if(!y)return b;if(typeof y!="object")throw TypeError("options must be an object");var v=Object.keys(y),A=v.length,T,M,L;function B(z){throw Error('Invalid "'+T+'" option value'+(z?". Reason: "+z:""))}for(var H=0;H<A;H++){if(T=v[H],!r.call(E,T))throw Error('Unknown "'+T+'" option');M=y[T],M!==n&&(L=k[T],b[T]=L?L(M,B):M)}return b}function _(y,E){return(typeof y!="function"||!y.hasOwnProperty("prototype"))&&E("value must be a constructor"),y}function P(y){var E="value must be type of "+y.join("|"),k=y.length,x=y[0],b=y[1];return k===1?function(v,A){if(typeof v===x)return v;A(E)}:k===2?function(v,A){var T=typeof v;if(T===x||T===b)return v;A(E)}:function(v,A){for(var T=typeof v,M=k;M-- >0;)if(T===y[M])return v;A(E)}}var I=P(["function"]),K=P(["object","function"]);function q(y,E,k){var x,b,v=0,A,T=new y(function(M,L,B){k=S(k,{timeout:0,overload:!1},{timeout:function(Q,te){return Q*=1,(typeof Q!="number"||Q<0||!Number.isFinite(Q))&&te("timeout must be a positive number"),Q}}),x=!k.overload&&typeof y.prototype.cancel=="function"&&typeof B=="function";function H(){b&&(b=null),v&&(clearTimeout(v),v=0)}var z=function(Q){H(),M(Q)},J=function(Q){H(),L(Q)};x?E(z,J,B):(b=[function(Q){J(Q||Error("canceled"))}],E(z,J,function(Q){if(A)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof Q!="function")throw TypeError("onCancel callback must be a function");b.push(Q)}),A=!0),k.timeout>0&&(v=setTimeout(function(){var Q=Error("timeout");Q.code="ETIMEDOUT",v=0,T.cancel(Q),L(Q)},k.timeout))});return x||(T.cancel=function(M){if(b){for(var L=b.length,B=1;B<L;B++)b[B](M);b[0](M),b=null}}),T}function F(y){var E=this._observers;if(!E)return-1;for(var k=E.length,x=0;x<k;x++)if(E[x]._target===y)return x;return-1}function U(y,E,k,x,b){if(!k)return null;if(x===0){var v=typeof E;if(v==="string"){var A,T,M=0,L=0,B=this.delimiter,H=B.length;if((T=E.indexOf(B))!==-1){A=new Array(5);do A[M++]=E.slice(L,T),L=T+H;while((T=E.indexOf(B,L))!==-1);A[M++]=E.slice(L),E=A,b=M}else E=[E],b=1}else v==="object"?b=E.length:(E=[E],b=1)}var z=null,J,Q,te,oe,ce,ne=E[x],re=E[x+1],ae,se;if(x===b)k._listeners&&(typeof k._listeners=="function"?(y&&y.push(k._listeners),z=[k]):(y&&y.push.apply(y,k._listeners),z=[k]));else if(ne==="*"){for(ae=d(k),T=ae.length;T-- >0;)J=ae[T],J!=="_listeners"&&(se=U(y,E,k[J],x+1,b),se&&(z?z.push.apply(z,se):z=se));return z}else if(ne==="**"){for(ce=x+1===b||x+2===b&&re==="*",ce&&k._listeners&&(z=U(y,E,k,b,b)),ae=d(k),T=ae.length;T-- >0;)J=ae[T],J!=="_listeners"&&(J==="*"||J==="**"?(k[J]._listeners&&!ce&&(se=U(y,E,k[J],b,b),se&&(z?z.push.apply(z,se):z=se)),se=U(y,E,k[J],x,b)):J===re?se=U(y,E,k[J],x+2,b):se=U(y,E,k[J],x,b),se&&(z?z.push.apply(z,se):z=se));return z}else k[ne]&&(z=U(y,E,k[ne],x+1,b));if(Q=k["*"],Q&&U(y,E,Q,x+1,b),te=k["**"],te)if(x<b)for(te._listeners&&U(y,E,te,b,b),ae=d(te),T=ae.length;T-- >0;)J=ae[T],J!=="_listeners"&&(J===re?U(y,E,te[J],x+2,b):J===ne?U(y,E,te[J],x+1,b):(oe={},oe[J]=te[J],U(y,E,{"**":oe},x+1,b)));else te._listeners?U(y,E,te,b,b):te["*"]&&te["*"]._listeners&&U(y,E,te["*"],b,b);return z}function j(y,E,k){var x=0,b=0,v,A=this.delimiter,T=A.length,M;if(typeof y=="string")if((v=y.indexOf(A))!==-1){M=new Array(5);do M[x++]=y.slice(b,v),b=v+T;while((v=y.indexOf(A,b))!==-1);M[x++]=y.slice(b)}else M=[y],x=1;else M=y,x=y.length;if(x>1){for(v=0;v+1<x;v++)if(M[v]==="**"&&M[v+1]==="**")return}var L=this.listenerTree,B;for(v=0;v<x;v++)if(B=M[v],L=L[B]||(L[B]={}),v===x-1)return L._listeners?(typeof L._listeners=="function"&&(L._listeners=[L._listeners]),k?L._listeners.unshift(E):L._listeners.push(E),!L._listeners.warned&&this._maxListeners>0&&L._listeners.length>this._maxListeners&&(L._listeners.warned=!0,g.call(this,L._listeners.length,B))):L._listeners=E,!0;return!0}function G(y,E,k,x){for(var b=d(y),v=b.length,A,T,M,L=y._listeners,B;v-- >0;)T=b[v],A=y[T],T==="_listeners"?M=k:M=k?k.concat(T):[T],B=x||typeof T=="symbol",L&&E.push(B?M:M.join(this.delimiter)),typeof A=="object"&&G.call(this,A,E,M,B);return E}function $(y){for(var E=d(y),k=E.length,x,b,v;k-- >0;)b=E[k],x=y[b],x&&(v=!0,b!=="_listeners"&&!$(x)&&delete y[b]);return v}function N(y,E,k){this.emitter=y,this.event=E,this.listener=k}N.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function R(y,E,k){if(k===!0)b=!0;else if(k===!1)x=!0;else{if(!k||typeof k!="object")throw TypeError("options should be an object or true");var x=k.async,b=k.promisify,v=k.nextTick,A=k.objectify}if(x||v||b){var T=E,M=E._origin||E;if(v&&!c)throw Error("process.nextTick is not supported");b===n&&(b=E.constructor.name==="AsyncFunction"),E=function(){var L=arguments,B=this,H=this.event;return b?v?Promise.resolve():new Promise(function(z){u(z)}).then(function(){return B.event=H,T.apply(B,L)}):(v?process.nextTick:u)(function(){B.event=H,T.apply(B,L)})},E._async=!0,E._origin=M}return[E,A?new N(this,y,E):this]}function C(y){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,y)}C.EventEmitter2=C,C.prototype.listenTo=function(y,E,k){if(typeof y!="object")throw TypeError("target musts be an object");var x=this;k=S(k,{on:n,off:n,reducers:n},{on:I,off:I,reducers:K});function b(v){if(typeof v!="object")throw TypeError("events must be an object");var A=k.reducers,T=F.call(x,y),M;T===-1?M=new p(x,y,k):M=x._observers[T];for(var L=d(v),B=L.length,H,z=typeof A=="function",J=0;J<B;J++)H=L[J],M.subscribe(H,v[H]||H,z?A:A&&A[H])}return i(E)?b(w(E)):b(typeof E=="string"?w(E.split(/\s+/)):E),this},C.prototype.stopListeningTo=function(y,E){var k=this._observers;if(!k)return!1;var x=k.length,b,v=!1;if(y&&typeof y!="object")throw TypeError("target should be an object");for(;x-- >0;)b=k[x],(!y||b._target===y)&&(b.unsubscribe(E),v=!0);return v},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(y){y!==n&&(this._maxListeners=y,this._conf||(this._conf={}),this._conf.maxListeners=y)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(y,E,k){return this._once(y,E,!1,k)},C.prototype.prependOnceListener=function(y,E,k){return this._once(y,E,!0,k)},C.prototype._once=function(y,E,k,x){return this._many(y,1,E,k,x)},C.prototype.many=function(y,E,k,x){return this._many(y,E,k,!1,x)},C.prototype.prependMany=function(y,E,k,x){return this._many(y,E,k,!0,x)},C.prototype._many=function(y,E,k,x,b){var v=this;if(typeof k!="function")throw new Error("many only accepts instances of Function");function A(){return--E===0&&v.off(y,A),k.apply(this,arguments)}return A._origin=k,this._on(y,A,x,b)},C.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var y=arguments[0],E,k=this.wildcard,x,b,v,A,T;if(y==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(k&&(E=y,y!=="newListener"&&y!=="removeListener"&&typeof y=="object")){if(b=y.length,s){for(v=0;v<b;v++)if(typeof y[v]=="symbol"){T=!0;break}}T||(y=y.join(this.delimiter))}var M=arguments.length,L;if(this._all&&this._all.length)for(L=this._all.slice(),v=0,b=L.length;v<b;v++)switch(this.event=y,M){case 1:L[v].call(this,y);break;case 2:L[v].call(this,y,arguments[1]);break;case 3:L[v].call(this,y,arguments[1],arguments[2]);break;default:L[v].apply(this,arguments)}if(k)L=[],U.call(this,L,E,this.listenerTree,0,b);else if(L=this._events[y],typeof L=="function"){switch(this.event=y,M){case 1:L.call(this);break;case 2:L.call(this,arguments[1]);break;case 3:L.call(this,arguments[1],arguments[2]);break;default:for(x=new Array(M-1),A=1;A<M;A++)x[A-1]=arguments[A];L.apply(this,x)}return!0}else L&&(L=L.slice());if(L&&L.length){if(M>3)for(x=new Array(M-1),A=1;A<M;A++)x[A-1]=arguments[A];for(v=0,b=L.length;v<b;v++)switch(this.event=y,M){case 1:L[v].call(this);break;case 2:L[v].call(this,arguments[1]);break;case 3:L[v].call(this,arguments[1],arguments[2]);break;default:L[v].apply(this,x)}return!0}else if(!this.ignoreErrors&&!this._all&&y==="error")throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},C.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var y=arguments[0],E=this.wildcard,k,x,b,v,A,T;if(y==="newListener"&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(E&&(k=y,y!=="newListener"&&y!=="removeListener"&&typeof y=="object")){if(v=y.length,s){for(A=0;A<v;A++)if(typeof y[A]=="symbol"){x=!0;break}}x||(y=y.join(this.delimiter))}var M=[],L=arguments.length,B;if(this._all)for(A=0,v=this._all.length;A<v;A++)switch(this.event=y,L){case 1:M.push(this._all[A].call(this,y));break;case 2:M.push(this._all[A].call(this,y,arguments[1]));break;case 3:M.push(this._all[A].call(this,y,arguments[1],arguments[2]));break;default:M.push(this._all[A].apply(this,arguments))}if(E?(B=[],U.call(this,B,k,this.listenerTree,0)):B=this._events[y],typeof B=="function")switch(this.event=y,L){case 1:M.push(B.call(this));break;case 2:M.push(B.call(this,arguments[1]));break;case 3:M.push(B.call(this,arguments[1],arguments[2]));break;default:for(b=new Array(L-1),T=1;T<L;T++)b[T-1]=arguments[T];M.push(B.apply(this,b))}else if(B&&B.length){if(B=B.slice(),L>3)for(b=new Array(L-1),T=1;T<L;T++)b[T-1]=arguments[T];for(A=0,v=B.length;A<v;A++)switch(this.event=y,L){case 1:M.push(B[A].call(this));break;case 2:M.push(B[A].call(this,arguments[1]));break;case 3:M.push(B[A].call(this,arguments[1],arguments[2]));break;default:M.push(B[A].apply(this,b))}}else if(!this.ignoreErrors&&!this._all&&y==="error")return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(M)},C.prototype.on=function(y,E,k){return this._on(y,E,!1,k)},C.prototype.prependListener=function(y,E,k){return this._on(y,E,!0,k)},C.prototype.onAny=function(y){return this._onAny(y,!1)},C.prototype.prependAny=function(y){return this._onAny(y,!0)},C.prototype.addListener=C.prototype.on,C.prototype._onAny=function(y,E){if(typeof y!="function")throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),E?this._all.unshift(y):this._all.push(y),this},C.prototype._on=function(y,E,k,x){if(typeof y=="function")return this._onAny(y,E),this;if(typeof E!="function")throw new Error("on only accepts instances of Function");this._events||h.call(this);var b=this,v;return x!==n&&(v=R.call(this,y,E,x),E=v[0],b=v[1]),this._newListener&&this.emit("newListener",y,E),this.wildcard?(j.call(this,y,E,k),b):(this._events[y]?(typeof this._events[y]=="function"&&(this._events[y]=[this._events[y]]),k?this._events[y].unshift(E):this._events[y].push(E),!this._events[y].warned&&this._maxListeners>0&&this._events[y].length>this._maxListeners&&(this._events[y].warned=!0,g.call(this,this._events[y].length,y))):this._events[y]=E,b)},C.prototype.off=function(y,E){if(typeof E!="function")throw new Error("removeListener only takes instances of Function");var k,x=[];if(this.wildcard){var b=typeof y=="string"?y.split(this.delimiter):y.slice();if(x=U.call(this,null,b,this.listenerTree,0),!x)return this}else{if(!this._events[y])return this;k=this._events[y],x.push({_listeners:k})}for(var v=0;v<x.length;v++){var A=x[v];if(k=A._listeners,i(k)){for(var T=-1,M=0,L=k.length;M<L;M++)if(k[M]===E||k[M].listener&&k[M].listener===E||k[M]._origin&&k[M]._origin===E){T=M;break}if(T<0)continue;return this.wildcard?A._listeners.splice(T,1):this._events[y].splice(T,1),k.length===0&&(this.wildcard?delete A._listeners:delete this._events[y]),this._removeListener&&this.emit("removeListener",y,E),this}else(k===E||k.listener&&k.listener===E||k._origin&&k._origin===E)&&(this.wildcard?delete A._listeners:delete this._events[y],this._removeListener&&this.emit("removeListener",y,E))}return this.listenerTree&&$(this.listenerTree),this},C.prototype.offAny=function(y){var E=0,k=0,x;if(y&&this._all&&this._all.length>0){for(x=this._all,E=0,k=x.length;E<k;E++)if(y===x[E])return x.splice(E,1),this._removeListener&&this.emit("removeListenerAny",y),this}else{if(x=this._all,this._removeListener)for(E=0,k=x.length;E<k;E++)this.emit("removeListenerAny",x[E]);this._all=[]}return this},C.prototype.removeListener=C.prototype.off,C.prototype.removeAllListeners=function(y){if(y===n)return!this._events||h.call(this),this;if(this.wildcard){var E=U.call(this,null,y,this.listenerTree,0),k,x;if(!E)return this;for(x=0;x<E.length;x++)k=E[x],k._listeners=null;this.listenerTree&&$(this.listenerTree)}else this._events&&(this._events[y]=null);return this},C.prototype.listeners=function(y){var E=this._events,k,x,b,v,A;if(y===n){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!E)return[];for(k=d(E),v=k.length,b=[];v-- >0;)x=E[k[v]],typeof x=="function"?b.push(x):b.push.apply(b,x);return b}else{if(this.wildcard){if(A=this.listenerTree,!A)return[];var T=[],M=typeof y=="string"?y.split(this.delimiter):y.slice();return U.call(this,T,M,A,0),T}return E?(x=E[y],x?typeof x=="function"?[x]:x:[]):[]}},C.prototype.eventNames=function(y){var E=this._events;return this.wildcard?G.call(this,this.listenerTree,[],null,y):E?d(E):[]},C.prototype.listenerCount=function(y){return this.listeners(y).length},C.prototype.hasListeners=function(y){if(this.wildcard){var E=[],k=typeof y=="string"?y.split(this.delimiter):y.slice();return U.call(this,E,k,this.listenerTree,0),E.length>0}var x=this._events,b=this._all;return!!(b&&b.length||x&&(y===n?d(x).length:x[y]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(y,E){var k=this,x=typeof E;return x==="number"?E={timeout:E}:x==="function"&&(E={filter:E}),E=S(E,{timeout:0,filter:n,handleError:!1,Promise,overload:!1},{filter:I,Promise:_}),q(E.Promise,function(b,v,A){function T(){var M=E.filter;if(!(M&&!M.apply(k,arguments)))if(k.off(y,T),E.handleError){var L=arguments[0];L?v(L):b(m.apply(null,arguments).slice(1))}else b(m.apply(null,arguments))}A(function(){k.off(y,T)}),k._on(y,T,!1)},{timeout:E.timeout,overload:E.overload})};function O(y,E,k){k=S(k,{Promise,timeout:0,overload:!1},{Promise:_});var x=k.Promise;return q(x,function(b,v,A){var T;if(typeof y.addEventListener=="function"){T=function(){b(m.apply(null,arguments))},A(function(){y.removeEventListener(E,T)}),y.addEventListener(E,T,{once:!0});return}var M=function(){L&&y.removeListener("error",L),b(m.apply(null,arguments))},L;E!=="error"&&(L=function(B){y.removeListener(E,M),v(B)},y.once("error",L)),A(function(){L&&y.removeListener("error",L),y.removeListener(E,M)}),y.once(E,M)},{timeout:k.timeout,overload:k.overload})}var D=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return D._maxListeners},set:function(y){if(typeof y!="number"||y<0||Number.isNaN(y))throw TypeError("n must be a non-negative number");D._maxListeners=y},enumerable:!0},once:{value:O,writable:!0,configurable:!0}}),Object.defineProperties(D,{_maxListeners:{value:o,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=C})()})(Nu);var go=Nu.exports;const Ip=Tn.getDefaultExportFromCjs(go);var Zr,Lp=new Uint8Array(16);function Np(){if(!Zr&&(Zr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Zr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Zr(Lp)}const Dp=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ts(t){return typeof t=="string"&&Dp.test(t)}var De=[];for(var Oo=0;Oo<256;++Oo)De.push((Oo+256).toString(16).substr(1));function Bp(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(De[t[e+0]]+De[t[e+1]]+De[t[e+2]]+De[t[e+3]]+"-"+De[t[e+4]]+De[t[e+5]]+"-"+De[t[e+6]]+De[t[e+7]]+"-"+De[t[e+8]]+De[t[e+9]]+"-"+De[t[e+10]]+De[t[e+11]]+De[t[e+12]]+De[t[e+13]]+De[t[e+14]]+De[t[e+15]]).toLowerCase();if(!Ts(n))throw TypeError("Stringified UUID is invalid");return n}function hn(t,e,n){t=t||{};var r=t.random||(t.rng||Np)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Bp(r)}const Nt=Object.create(null);Nt.open="0";Nt.close="1";Nt.ping="2";Nt.pong="3";Nt.message="4";Nt.upgrade="5";Nt.noop="6";const Ei=Object.create(null);Object.keys(Nt).forEach(t=>{Ei[Nt[t]]=t});const xs={type:"error",data:"parser error"},Du=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Bu=typeof ArrayBuffer=="function",$u=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,pa=({type:t,data:e},n,r)=>Du&&e instanceof Blob?n?r(e):ac(e,r):Bu&&(e instanceof ArrayBuffer||$u(e))?n?r(e):ac(new Blob([e]),r):r(Nt[t]+(e||"")),ac=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function cc(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Io;function $p(t,e){if(Du&&t.data instanceof Blob)return t.data.arrayBuffer().then(cc).then(e);if(Bu&&(t.data instanceof ArrayBuffer||$u(t.data)))return e(cc(t.data));pa(t,!1,n=>{Io||(Io=new TextEncoder),e(Io.encode(n))})}const lc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<lc.length;t++)gr[lc.charCodeAt(t)]=t;const Kp=t=>{let e=t.length*.75,n=t.length,r,i=0,o,c,s,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const l=new ArrayBuffer(e),u=new Uint8Array(l);for(r=0;r<n;r+=4)o=gr[t.charCodeAt(r)],c=gr[t.charCodeAt(r+1)],s=gr[t.charCodeAt(r+2)],a=gr[t.charCodeAt(r+3)],u[i++]=o<<2|c>>4,u[i++]=(c&15)<<4|s>>2,u[i++]=(s&3)<<6|a&63;return l},jp=typeof ArrayBuffer=="function",ma=(t,e)=>{if(typeof t!="string")return{type:"message",data:Ku(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Up(t.substring(1),e)}:Ei[n]?t.length>1?{type:Ei[n],data:t.substring(1)}:{type:Ei[n]}:xs},Up=(t,e)=>{if(jp){const n=Kp(t);return Ku(n,e)}else return{base64:!0,data:t}},Ku=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},ju="",Hp=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,c)=>{pa(o,!1,s=>{r[c]=s,++i===n&&e(r.join(ju))})})},Fp=(t,e)=>{const n=t.split(ju),r=[];for(let i=0;i<n.length;i++){const o=ma(n[i],e);if(r.push(o),o.type==="error")break}return r};function zp(){return new TransformStream({transform(t,e){$p(t,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let Lo;function Jr(t){return t.reduce((e,n)=>e+n.length,0)}function Xr(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;i<e;i++)n[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function qp(t,e){Lo||(Lo=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(c,s){for(n.push(c);;){if(r===0){if(Jr(n)<1)break;const a=Xr(n,1);o=(a[0]&128)===128,i=a[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Jr(n)<2)break;const a=Xr(n,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),r=3}else if(r===2){if(Jr(n)<8)break;const a=Xr(n,8),l=new DataView(a.buffer,a.byteOffset,a.length),u=l.getUint32(0);if(u>Math.pow(2,21)-1){s.enqueue(xs);break}i=u*Math.pow(2,32)+l.getUint32(4),r=3}else{if(Jr(n)<i)break;const a=Xr(n,i);s.enqueue(ma(o?a:Lo.decode(a),e)),r=0}if(i===0||i>t){s.enqueue(xs);break}}}})}const Uu=4;function Me(t){if(t)return Vp(t)}function Vp(t){for(var e in Me.prototype)t[e]=Me.prototype[e];return t}Me.prototype.on=Me.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Me.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Me.prototype.off=Me.prototype.removeListener=Me.prototype.removeAllListeners=Me.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Me.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this};Me.prototype.emitReserved=Me.prototype.emit;Me.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Me.prototype.hasListeners=function(t){return!!this.listeners(t).length};const yo=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),pt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Wp="arraybuffer";function Hu(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const Gp=pt.setTimeout,Yp=pt.clearTimeout;function vo(t,e){e.useNativeTimers?(t.setTimeoutFn=Gp.bind(pt),t.clearTimeoutFn=Yp.bind(pt)):(t.setTimeoutFn=pt.setTimeout.bind(pt),t.clearTimeoutFn=pt.clearTimeout.bind(pt))}const Zp=1.33;function Jp(t){return typeof t=="string"?Xp(t):Math.ceil((t.byteLength||t.size)*Zp)}function Xp(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function Fu(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Qp(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function e0(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class t0 extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class ga extends Me{constructor(e){super(),this.writable=!1,vo(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new t0(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=ma(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=Qp(e);return n.length?"?"+n:""}}class n0 extends ga{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Fp(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Hp(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Fu()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let zu=!1;try{zu=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const r0=zu;function i0(){}class o0 extends n0{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class It extends Me{constructor(e,n,r){super(),this.createRequest=e,vo(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=Hu(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=It.requestsCount++,It.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=i0,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete It.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}It.requestsCount=0;It.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",uc);else if(typeof addEventListener=="function"){const t="onpagehide"in pt?"pagehide":"unload";addEventListener(t,uc,!1)}}function uc(){for(let t in It.requests)It.requests.hasOwnProperty(t)&&It.requests[t].abort()}const s0=function(){const t=qu({xdomain:!1});return t&&t.responseType!==null}();class a0 extends o0{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=s0&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new It(qu,this.uri(),e)}}function qu(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||r0))return new XMLHttpRequest}catch{}if(!e)try{return new pt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Vu=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class c0 extends ga{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=Vu?{}:Hu(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;pa(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&yo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Fu()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const No=pt.WebSocket||pt.MozWebSocket;class l0 extends c0{createSocket(e,n,r){return Vu?new No(e,n,r):n?new No(e,n):new No(e)}doWrite(e,n){this.ws.send(n)}}class u0 extends ga{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=qp(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=zp();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:a})=>{s||(this.onPacket(a),o())}).catch(s=>{})};o();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;this._writer.write(r).then(()=>{i&&yo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const d0={websocket:l0,webtransport:u0,polling:a0},h0=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,f0=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ms(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=h0.exec(t||""),o={},c=14;for(;c--;)o[f0[c]]=i[c]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=p0(o,o.path),o.queryKey=m0(o,o.query),o}function p0(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function m0(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const Rs=typeof addEventListener=="function"&&typeof removeEventListener=="function",_i=[];Rs&&addEventListener("offline",()=>{_i.forEach(t=>t())},!1);class yn extends Me{constructor(e,n){if(super(),this.binaryType=Wp,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=Ms(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Ms(n.host).host);vo(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=e0(this.opts.query)),Rs&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},_i.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=Uu,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&yn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",yn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=Jp(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,yo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:e,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(yn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Rs&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=_i.indexOf(this._offlineEventListener);r!==-1&&_i.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}yn.protocol=Uu;class g0 extends yn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;yn.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;yn.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,u(),n.close(),n=null)}const c=d=>{const h=new Error("probe error: "+d);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function s(){c("transport closed")}function a(){c("socket closed")}function l(d){n&&d.name!==n.name&&o()}const u=()=>{n.removeListener("open",i),n.removeListener("error",c),n.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};n.once("open",i),n.once("error",c),n.once("close",s),this.once("close",a),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let y0=class extends g0{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>d0[i]).filter(i=>!!i)),super(e,r)}};function v0(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Ms(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+e,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const b0=typeof ArrayBuffer=="function",w0=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Wu=Object.prototype.toString,E0=typeof Blob=="function"||typeof Blob<"u"&&Wu.call(Blob)==="[object BlobConstructor]",_0=typeof File=="function"||typeof File<"u"&&Wu.call(File)==="[object FileConstructor]";function ya(t){return b0&&(t instanceof ArrayBuffer||w0(t))||E0&&t instanceof Blob||_0&&t instanceof File}function Si(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Si(t[n]))return!0;return!1}if(ya(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Si(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Si(t[n]))return!0;return!1}function S0(t){const e=[],n=t.data,r=t;return r.data=Ps(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Ps(t,e){if(!t)return t;if(ya(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Ps(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Ps(t[r],e));return n}return t}function C0(t,e){return t.data=Os(t.data,e),delete t.attachments,t}function Os(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Os(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Os(t[n],e));return t}const A0=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ge;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(ge||(ge={}));class k0{constructor(e){this.replacer=e}encode(e){return(e.type===ge.EVENT||e.type===ge.ACK)&&Si(e)?this.encodeAsBinary({type:e.type===ge.EVENT?ge.BINARY_EVENT:ge.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===ge.BINARY_EVENT||e.type===ge.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=S0(e),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}class va extends Me{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===ge.BINARY_EVENT;r||n.type===ge.BINARY_ACK?(n.type=r?ge.EVENT:ge.ACK,this.reconstructor=new T0(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(ya(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(ge[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ge.BINARY_EVENT||r.type===ge.BINARY_ACK){const o=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const c=e.substring(o,n);if(c!=Number(c)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(c)}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(o,n)}else r.nsp="/";const i=e.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const c=e.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===e.length)break}r.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(va.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case ge.CONNECT:return dc(n);case ge.DISCONNECT:return n===void 0;case ge.CONNECT_ERROR:return typeof n=="string"||dc(n);case ge.EVENT:case ge.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&A0.indexOf(n[0])===-1);case ge.ACK:case ge.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class T0{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=C0(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function dc(t){return Object.prototype.toString.call(t)==="[object Object]"}const x0=Object.freeze(Object.defineProperty({__proto__:null,Decoder:va,Encoder:k0,get PacketType(){return ge}},Symbol.toStringTag,{value:"Module"}));function vt(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const M0=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Gu extends Me{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[vt(e,"open",this.onopen.bind(this)),vt(e,"packet",this.onpacket.bind(this)),vt(e,"error",this.onerror.bind(this)),vt(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,i,o;if(M0.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:ge.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,d=n.pop();this._registerAckCallback(u,d),c.id=u}const s=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s<this.sendBuffer.length;s++)this.sendBuffer[s].id===e&&this.sendBuffer.splice(s,1);n.call(this,new Error("operation has timed out"))},i),c=(...s)=>{this.io.clearTimeoutFn(o),n.apply(this,s)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(c,s)=>c?i(c):r(s);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>(this._queue[0],i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ge.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ge.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ge.EVENT:case ge.BINARY_EVENT:this.onevent(e);break;case ge.ACK:case ge.BINARY_ACK:this.onack(e);break;case ge.DISCONNECT:this.ondisconnect();break;case ge.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:ge.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ge.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function sr(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}sr.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};sr.prototype.reset=function(){this.attempts=0};sr.prototype.setMin=function(t){this.ms=t};sr.prototype.setMax=function(t){this.max=t};sr.prototype.setJitter=function(t){this.jitter=t};class Is extends Me{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,vo(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new sr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||x0;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new y0(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=vt(n,"open",function(){r.onopen(),e&&e()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),e?e(s):this.maybeReconnectOnOpen()},c=vt(n,"error",o);if(this._timeout!==!1){const s=this._timeout,a=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(vt(e,"ping",this.onping.bind(this)),vt(e,"data",this.ondata.bind(this)),vt(e,"error",this.onerror.bind(this)),vt(e,"close",this.onclose.bind(this)),vt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){yo(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Gu(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ur={};function Ci(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=v0(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,c=ur[i]&&o in ur[i].nsps,s=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let a;return s?a=new Is(r,e):(ur[i]||(ur[i]=new Is(r,e)),a=ur[i]),n.query&&!e.query&&(e.query=n.queryKey),a.socket(n.path,e)}Object.assign(Ci,{Manager:Is,Socket:Gu,io:Ci,connect:Ci});function Z(t,e,n,r){return new(n||(n=Promise))(function(i,o){function c(l){try{a(r.next(l))}catch(u){o(u)}}function s(l){try{a(r.throw(l))}catch(u){o(u)}}function a(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n(function(d){d(u)})).then(c,s)}a((r=r.apply(t,e||[])).next())})}var Ge=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},kt=[],dt=[],R0=typeof Uint8Array<"u"?Uint8Array:Array,ba=!1;function Yu(){ba=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)kt[e]=t[e],dt[t.charCodeAt(e)]=e;dt[45]=62,dt[95]=63}function P0(t,e,n){for(var r,i,o=[],c=e;c<n;c+=3)r=(t[c]<<16)+(t[c+1]<<8)+t[c+2],o.push(kt[(i=r)>>18&63]+kt[i>>12&63]+kt[i>>6&63]+kt[63&i]);return o.join("")}function hc(t){var e;ba||Yu();for(var n=t.length,r=n%3,i="",o=[],c=16383,s=0,a=n-r;s<a;s+=c)o.push(P0(t,s,s+c>a?a:s+c));return r===1?(e=t[n-1],i+=kt[e>>2],i+=kt[e<<4&63],i+="=="):r===2&&(e=(t[n-2]<<8)+t[n-1],i+=kt[e>>10],i+=kt[e>>4&63],i+=kt[e<<2&63],i+="="),o.push(i),o.join("")}function Qr(t,e,n,r,i){var o,c,s=8*i-r-1,a=(1<<s)-1,l=a>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=t[e+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+t[e+d],d+=h,u-=8);for(c=o&(1<<-u)-1,o>>=-u,u+=r;u>0;c=256*c+t[e+d],d+=h,u-=8);if(o===0)o=1-l;else{if(o===a)return c?NaN:1/0*(f?-1:1);c+=Math.pow(2,r),o-=l}return(f?-1:1)*c*Math.pow(2,o-r)}function Zu(t,e,n,r,i,o){var c,s,a,l=8*o-i-1,u=(1<<l)-1,d=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,g=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,c=u):(c=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-c))<1&&(c--,a*=2),(e+=c+d>=1?h/a:h*Math.pow(2,1-d))*a>=2&&(c++,a/=2),c+d>=u?(s=0,c=u):c+d>=1?(s=(e*a-1)*Math.pow(2,i),c+=d):(s=e*Math.pow(2,d-1)*Math.pow(2,i),c=0));i>=8;t[n+f]=255&s,f+=g,s/=256,i-=8);for(c=c<<i|s,l+=i;l>0;t[n+f]=255&c,f+=g,c/=256,l-=8);t[n+f-g]|=128*m}var O0={}.toString,Ju=Array.isArray||function(t){return O0.call(t)=="[object Array]"};X.TYPED_ARRAY_SUPPORT=Ge.TYPED_ARRAY_SUPPORT===void 0||Ge.TYPED_ARRAY_SUPPORT;var I0=Hi();function Hi(){return X.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function zt(t,e){if(Hi()<e)throw new RangeError("Invalid typed array length");return X.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=X.prototype:(t===null&&(t=new X(e)),t.length=e),t}function X(t,e,n){if(!(X.TYPED_ARRAY_SUPPORT||this instanceof X))return new X(t,e,n);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ls(this,t)}return Xu(this,t,e,n)}function Xu(t,e,n,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?function(i,o,c,s){if(o.byteLength,c<0||o.byteLength<c)throw new RangeError("'offset' is out of bounds");if(o.byteLength<c+(s||0))throw new RangeError("'length' is out of bounds");return o=c===void 0&&s===void 0?new Uint8Array(o):s===void 0?new Uint8Array(o,c):new Uint8Array(o,c,s),X.TYPED_ARRAY_SUPPORT?(i=o).__proto__=X.prototype:i=Do(i,o),i}(t,e,n,r):typeof e=="string"?function(i,o,c){if(typeof c=="string"&&c!==""||(c="utf8"),!X.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');var s=0|ed(o,c);i=zt(i,s);var a=i.write(o,c);return a!==s&&(i=i.slice(0,a)),i}(t,e,n):function(i,o){if(Tt(o)){var c=0|wa(o.length);return(i=zt(i,c)).length===0||o.copy(i,0,0,c),i}if(o){if(typeof ArrayBuffer<"u"&&o.buffer instanceof ArrayBuffer||"length"in o)return typeof o.length!="number"||(s=o.length)!=s?zt(i,0):Do(i,o);if(o.type==="Buffer"&&Ju(o.data))return Do(i,o.data)}var s;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function Qu(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ls(t,e){if(Qu(e),t=zt(t,e<0?0:0|wa(e)),!X.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function Do(t,e){var n=e.length<0?0:0|wa(e.length);t=zt(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function wa(t){if(t>=Hi())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Hi().toString(16)+" bytes");return 0|t}function Tt(t){return!(t==null||!t._isBuffer)}function ed(t,e){if(Tt(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var n=t.length;if(n===0)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Fi(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return id(t).length;default:if(r)return Fi(t).length;e=(""+e).toLowerCase(),r=!0}}function L0(t,e,n){var r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return F0(this,e,n);case"utf8":case"utf-8":return nd(this,e,n);case"ascii":return U0(this,e,n);case"latin1":case"binary":return H0(this,e,n);case"base64":return j0(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z0(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Sn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function fc(t,e,n,r,i){if(t.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if(typeof e=="string"&&(e=X.from(e,r)),Tt(e))return e.length===0?-1:pc(t,e,n,r,i);if(typeof e=="number")return e&=255,X.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):pc(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function pc(t,e,n,r,i){var o,c=1,s=t.length,a=e.length;if(r!==void 0&&((r=String(r).toLowerCase())==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;c=2,s/=2,a/=2,n/=2}function l(f,g){return c===1?f[g]:f.readUInt16BE(g*c)}if(i){var u=-1;for(o=n;o<s;o++)if(l(t,o)===l(e,u===-1?0:o-u)){if(u===-1&&(u=o),o-u+1===a)return u*c}else u!==-1&&(o-=o-u),u=-1}else for(n+a>s&&(n=s-a),o=n;o>=0;o--){for(var d=!0,h=0;h<a;h++)if(l(t,o+h)!==l(e,h)){d=!1;break}if(d)return o}return-1}function N0(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var c=0;c<r;++c){var s=parseInt(e.substr(2*c,2),16);if(isNaN(s))return c;t[n+c]=s}return c}function D0(t,e,n,r){return bo(Fi(e,t.length-n),t,n,r)}function td(t,e,n,r){return bo(function(i){for(var o=[],c=0;c<i.length;++c)o.push(255&i.charCodeAt(c));return o}(e),t,n,r)}function B0(t,e,n,r){return td(t,e,n,r)}function $0(t,e,n,r){return bo(id(e),t,n,r)}function K0(t,e,n,r){return bo(function(i,o){for(var c,s,a,l=[],u=0;u<i.length&&!((o-=2)<0);++u)s=(c=i.charCodeAt(u))>>8,a=c%256,l.push(a),l.push(s);return l}(e,t.length-n),t,n,r)}function j0(t,e,n){return e===0&&n===t.length?hc(t):hc(t.slice(e,n))}function nd(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,c,s,a,l=t[i],u=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:(192&(o=t[i+1]))==128&&(a=(31&l)<<6|63&o)>127&&(u=a);break;case 3:o=t[i+1],c=t[i+2],(192&o)==128&&(192&c)==128&&(a=(15&l)<<12|(63&o)<<6|63&c)>2047&&(a<55296||a>57343)&&(u=a);break;case 4:o=t[i+1],c=t[i+2],s=t[i+3],(192&o)==128&&(192&c)==128&&(192&s)==128&&(a=(15&l)<<18|(63&o)<<12|(63&c)<<6|63&s)>65535&&a<1114112&&(u=a)}u===null?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return function(h){var f=h.length;if(f<=mc)return String.fromCharCode.apply(String,h);for(var g="",m=0;m<f;)g+=String.fromCharCode.apply(String,h.slice(m,m+=mc));return g}(r)}X.poolSize=8192,X._augment=function(t){return t.__proto__=X.prototype,t},X.from=function(t,e,n){return Xu(null,t,e,n)},X.TYPED_ARRAY_SUPPORT&&(X.prototype.__proto__=Uint8Array.prototype,X.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&X[Symbol.species]),X.alloc=function(t,e,n){return function(r,i,o,c){return Qu(i),i<=0?zt(r,i):o!==void 0?typeof c=="string"?zt(r,i).fill(o,c):zt(r,i).fill(o):zt(r,i)}(null,t,e,n)},X.allocUnsafe=function(t){return Ls(null,t)},X.allocUnsafeSlow=function(t){return Ls(null,t)},X.isBuffer=od,X.compare=function(t,e){if(!Tt(t)||!Tt(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},X.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},X.concat=function(t,e){if(!Ju(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return X.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=X.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!Tt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},X.byteLength=ed,X.prototype._isBuffer=!0,X.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Sn(this,e,e+1);return this},X.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Sn(this,e,e+3),Sn(this,e+1,e+2);return this},X.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Sn(this,e,e+7),Sn(this,e+1,e+6),Sn(this,e+2,e+5),Sn(this,e+3,e+4);return this},X.prototype.toString=function(){var t=0|this.length;return t===0?"":arguments.length===0?nd(this,0,t):L0.apply(this,arguments)},X.prototype.equals=function(t){if(!Tt(t))throw new TypeError("Argument must be a Buffer");return this===t||X.compare(this,t)===0},X.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},X.prototype.compare=function(t,e,n,r,i){if(!Tt(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),c=(n>>>=0)-(e>>>=0),s=Math.min(o,c),a=this.slice(r,i),l=t.slice(e,n),u=0;u<s;++u)if(a[u]!==l[u]){o=a[u],c=l[u];break}return o<c?-1:c<o?1:0},X.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},X.prototype.indexOf=function(t,e,n){return fc(this,t,e,n,!0)},X.prototype.lastIndexOf=function(t,e,n){return fc(this,t,e,n,!1)},X.prototype.write=function(t,e,n,r){if(e===void 0)r="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,r===void 0&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((n===void 0||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return N0(this,t,e,n);case"utf8":case"utf-8":return D0(this,t,e,n);case"ascii":return td(this,t,e,n);case"latin1":case"binary":return B0(this,t,e,n);case"base64":return $0(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K0(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},X.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var mc=4096;function U0(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function H0(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function F0(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=V0(t[o]);return i}function z0(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Pe(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function Ye(t,e,n,r,i,o){if(!Tt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function ei(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function ti(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function rd(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function gc(t,e,n,r,i){return i||rd(t,0,n,4),Zu(t,e,n,r,23,4),n+4}function yc(t,e,n,r,i){return i||rd(t,0,n,8),Zu(t,e,n,r,52,8),n+8}X.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=e===void 0?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),X.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=X.prototype;else{var i=e-t;n=new X(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},X.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||Pe(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},X.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||Pe(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},X.prototype.readUInt8=function(t,e){return e||Pe(t,1,this.length),this[t]},X.prototype.readUInt16LE=function(t,e){return e||Pe(t,2,this.length),this[t]|this[t+1]<<8},X.prototype.readUInt16BE=function(t,e){return e||Pe(t,2,this.length),this[t]<<8|this[t+1]},X.prototype.readUInt32LE=function(t,e){return e||Pe(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},X.prototype.readUInt32BE=function(t,e){return e||Pe(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},X.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||Pe(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},X.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||Pe(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},X.prototype.readInt8=function(t,e){return e||Pe(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},X.prototype.readInt16LE=function(t,e){e||Pe(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},X.prototype.readInt16BE=function(t,e){e||Pe(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},X.prototype.readInt32LE=function(t,e){return e||Pe(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},X.prototype.readInt32BE=function(t,e){return e||Pe(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},X.prototype.readFloatLE=function(t,e){return e||Pe(t,4,this.length),Qr(this,t,!0,23,4)},X.prototype.readFloatBE=function(t,e){return e||Pe(t,4,this.length),Qr(this,t,!1,23,4)},X.prototype.readDoubleLE=function(t,e){return e||Pe(t,8,this.length),Qr(this,t,!0,52,8)},X.prototype.readDoubleBE=function(t,e){return e||Pe(t,8,this.length),Qr(this,t,!1,52,8)},X.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Ye(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},X.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Ye(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},X.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,1,255,0),X.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},X.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,2,65535,0),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):ei(this,t,e,!0),e+2},X.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,2,65535,0),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):ei(this,t,e,!1),e+2},X.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,4,4294967295,0),X.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):ti(this,t,e,!0),e+4},X.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,4,4294967295,0),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ti(this,t,e,!1),e+4},X.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Ye(this,t,e,n,i-1,-i)}var o=0,c=1,s=0;for(this[e]=255&t;++o<n&&(c*=256);)t<0&&s===0&&this[e+o-1]!==0&&(s=1),this[e+o]=(t/c>>0)-s&255;return e+n},X.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Ye(this,t,e,n,i-1,-i)}var o=n-1,c=1,s=0;for(this[e+o]=255&t;--o>=0&&(c*=256);)t<0&&s===0&&this[e+o+1]!==0&&(s=1),this[e+o]=(t/c>>0)-s&255;return e+n},X.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,1,127,-128),X.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},X.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,2,32767,-32768),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):ei(this,t,e,!0),e+2},X.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,2,32767,-32768),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):ei(this,t,e,!1),e+2},X.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,4,2147483647,-2147483648),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ti(this,t,e,!0),e+4},X.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Ye(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ti(this,t,e,!1),e+4},X.prototype.writeFloatLE=function(t,e,n){return gc(this,t,e,!0,n)},X.prototype.writeFloatBE=function(t,e,n){return gc(this,t,e,!1,n)},X.prototype.writeDoubleLE=function(t,e,n){return yc(this,t,e,!0,n)},X.prototype.writeDoubleBE=function(t,e,n){return yc(this,t,e,!1,n)},X.prototype.copy=function(t,e,n,r){if(n||(n=0),r||r===0||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!X.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},X.prototype.fill=function(t,e,n,r){if(typeof t=="string"){if(typeof e=="string"?(r=e,e=0,n=this.length):typeof n=="string"&&(r=n,n=this.length),t.length===1){var i=t.charCodeAt(0);i<256&&(t=i)}if(r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!X.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else typeof t=="number"&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=n===void 0?this.length:n>>>0,t||(t=0),typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{var c=Tt(t)?t:Fi(new X(t,r).toString()),s=c.length;for(o=0;o<n-e;++o)this[o+e]=c[o%s]}return this};var q0=/[^+\/0-9A-Za-z-_]/g;function V0(t){return t<16?"0"+t.toString(16):t.toString(16)}function Fi(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],c=0;c<r;++c){if((n=t.charCodeAt(c))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(c+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function id(t){return function(e){var n,r,i,o,c,s;ba||Yu();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");c=e[a-2]==="="?2:e[a-1]==="="?1:0,s=new R0(3*a/4-c),i=c>0?a-4:a;var l=0;for(n=0,r=0;n<i;n+=4,r+=3)o=dt[e.charCodeAt(n)]<<18|dt[e.charCodeAt(n+1)]<<12|dt[e.charCodeAt(n+2)]<<6|dt[e.charCodeAt(n+3)],s[l++]=o>>16&255,s[l++]=o>>8&255,s[l++]=255&o;return c===2?(o=dt[e.charCodeAt(n)]<<2|dt[e.charCodeAt(n+1)]>>4,s[l++]=255&o):c===1&&(o=dt[e.charCodeAt(n)]<<10|dt[e.charCodeAt(n+1)]<<4|dt[e.charCodeAt(n+2)]>>2,s[l++]=o>>8&255,s[l++]=255&o),s}(function(e){if((e=function(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}(e).replace(q0,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(t))}function bo(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function od(t){return t!=null&&(!!t._isBuffer||vc(t)||function(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&vc(e.slice(0,0))}(t))}function vc(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var W0=Object.freeze({__proto__:null,Buffer:X,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),X.alloc(+t)},isBuffer:od,kMaxLength:I0}),mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function qr(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Fn={},ot={},Ue={};function zi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function sd(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function ad(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Ea(t,...e){if(!ad(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function cd(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");zi(t.outputLen),zi(t.blockLen)}function ld(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ud(t,e){Ea(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.isBytes=ad,Ue.number=zi,Ue.bool=sd,Ue.bytes=Ea,Ue.hash=cd,Ue.exists=ld,Ue.output=ud;const G0={number:zi,bool:sd,bytes:Ea,hash:cd,exists:ld,output:ud};Ue.default=G0,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.wrapCipher=t.Hash=t.nextTick=t.isLE=t.createView=t.u32=t.u16=t.u8=void 0,t.bytesToHex=r,t.hexToBytes=c,t.hexToNumber=s,t.bytesToNumberBE=function(d){return s(r(d))},t.numberToBytesBE=function(d,h){return c(d.toString(16).padStart(2*h,"0"))},t.asyncLoop=async function(d,h,f){let g=Date.now();for(let m=0;m<d;m++){f(m);const w=Date.now()-g;w>=0&&w<h||(await(0,t.nextTick)(),g+=w)}},t.utf8ToBytes=a,t.bytesToUtf8=function(d){return new TextDecoder().decode(d)},t.toBytes=function(d){if(typeof d=="string")d=a(d);else{if(!(0,e.isBytes)(d))throw new Error("Uint8Array expected, got "+typeof d);d=u(d)}return d},t.concatBytes=function(...d){let h=0;for(let g=0;g<d.length;g++){const m=d[g];(0,e.bytes)(m),h+=m.length}const f=new Uint8Array(h);for(let g=0,m=0;g<d.length;g++){const w=d[g];f.set(w,m),m+=w.length}return f},t.checkOpts=function(d,h){if(h==null||typeof h!="object")throw new Error("options must be defined");return Object.assign(d,h)},t.equalBytes=function(d,h){if(d.length!==h.length)return!1;let f=0;for(let g=0;g<d.length;g++)f|=d[g]^h[g];return f===0},t.setBigUint64=l,t.u64Lengths=function(d,h){const f=new Uint8Array(16),g=(0,t.createView)(f);return l(g,0,BigInt(h?h.length:0),!0),l(g,8,BigInt(d.length),!0),f},t.isAligned32=function(d){return d.byteOffset%4==0},t.copyBytes=u,t.clean=function(...d){for(let h=0;h<d.length;h++)d[h].fill(0)};const e=Ue;if(t.u8=d=>new Uint8Array(d.buffer,d.byteOffset,d.byteLength),t.u16=d=>new Uint16Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/2)),t.u32=d=>new Uint32Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/4)),t.createView=d=>new DataView(d.buffer,d.byteOffset,d.byteLength),t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!t.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},(d,h)=>h.toString(16).padStart(2,"0"));function r(d){(0,e.bytes)(d);let h="";for(let f=0;f<d.length;f++)h+=n[d[f]];return h}const i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(d){return d>=i._0&&d<=i._9?d-i._0:d>=i._A&&d<=i._F?d-(i._A-10):d>=i._a&&d<=i._f?d-(i._a-10):void 0}function c(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);const h=d.length,f=h/2;if(h%2)throw new Error("padded hex string expected, got unpadded hex of length "+h);const g=new Uint8Array(f);for(let m=0,w=0;m<f;m++,w+=2){const p=o(d.charCodeAt(w)),S=o(d.charCodeAt(w+1));if(p===void 0||S===void 0){const _=d[w]+d[w+1];throw new Error('hex string expected, got non-hex character "'+_+'" at index '+w)}g[m]=16*p+S}return g}function s(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);return BigInt(d===""?"0":`0x${d}`)}function a(d){if(typeof d!="string")throw new Error("string expected, got "+typeof d);return new Uint8Array(new TextEncoder().encode(d))}t.nextTick=async()=>{},t.Hash=class{};function l(d,h,f,g){if(typeof d.setBigUint64=="function")return d.setBigUint64(h,f,g);const m=BigInt(32),w=BigInt(4294967295),p=Number(f>>m&w),S=Number(f&w),_=g?4:0,P=g?0:4;d.setUint32(h+_,p,g),d.setUint32(h+P,S,g)}function u(d){return Uint8Array.from(d)}t.wrapCipher=(d,h)=>(Object.assign(h,d),h)}(ot);var Mr={},Oe={};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.AEAD_TAG_LENGTH=Oe.XCHACHA20_NONCE_LENGTH=Oe.CURVE25519_PUBLIC_KEY_SIZE=Oe.ETH_PUBLIC_KEY_SIZE=Oe.UNCOMPRESSED_PUBLIC_KEY_SIZE=Oe.COMPRESSED_PUBLIC_KEY_SIZE=Oe.SECRET_KEY_LENGTH=void 0,Oe.SECRET_KEY_LENGTH=32,Oe.COMPRESSED_PUBLIC_KEY_SIZE=33,Oe.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,Oe.ETH_PUBLIC_KEY_SIZE=64,Oe.CURVE25519_PUBLIC_KEY_SIZE=32,Oe.XCHACHA20_NONCE_LENGTH=24,Oe.AEAD_TAG_LENGTH=16,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ephemeralKeySize=t.symmetricNonceLength=t.symmetricAlgorithm=t.isHkdfKeyCompressed=t.isEphemeralKeyCompressed=t.ellipticCurve=t.ECIES_CONFIG=void 0;var e=Oe,n=function(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16};t.ECIES_CONFIG=new n,t.ellipticCurve=function(){return t.ECIES_CONFIG.ellipticCurve},t.isEphemeralKeyCompressed=function(){return t.ECIES_CONFIG.isEphemeralKeyCompressed},t.isHkdfKeyCompressed=function(){return t.ECIES_CONFIG.isHkdfKeyCompressed},t.symmetricAlgorithm=function(){return t.ECIES_CONFIG.symmetricAlgorithm},t.symmetricNonceLength=function(){return t.ECIES_CONFIG.symmetricNonceLength},t.ephemeralKeySize=function(){var r={secp256k1:t.ECIES_CONFIG.isEphemeralKeyCompressed?e.COMPRESSED_PUBLIC_KEY_SIZE:e.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:e.CURVE25519_PUBLIC_KEY_SIZE,ed25519:e.CURVE25519_PUBLIC_KEY_SIZE};if(t.ECIES_CONFIG.ellipticCurve in r)return r[t.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")}}(Mr);var Bo={},qi={},Eo={},dd={},_a={},ni={};Object.defineProperty(ni,"__esModule",{value:!0}),ni.crypto=void 0,ni.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.gcm=t.ctr=t.cbc=t.utils=void 0,t.randomBytes=i,t.getWebcryptoSubtle=o,t.managedNonce=function(a){return(0,n.number)(a.nonceLength),(l,...u)=>({encrypt(d,...h){const{nonceLength:f}=a,g=i(f),m=a(l,g,...u).encrypt(d,...h),w=(0,r.concatBytes)(g,m);return m.fill(0),w},decrypt(d,...h){const{nonceLength:f}=a,g=d.subarray(0,f),m=d.subarray(f);return a(l,g,...u).decrypt(m,...h)}})};const e=ni,n=Ue,r=ot;function i(a=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(a));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(a);throw new Error("crypto.getRandomValues must be defined")}function o(){if(e.crypto&&typeof e.crypto.subtle=="object"&&e.crypto.subtle!=null)return e.crypto.subtle;throw new Error("crypto.subtle must be defined")}t.utils={async encrypt(a,l,u,d){const h=o(),f=await h.importKey("raw",a,l,!0,["encrypt"]),g=await h.encrypt(u,f,d);return new Uint8Array(g)},async decrypt(a,l,u,d){const h=o(),f=await h.importKey("raw",a,l,!0,["decrypt"]),g=await h.decrypt(u,f,d);return new Uint8Array(g)}};const c={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function s(a){return(l,u,d)=>{(0,n.bytes)(l),(0,n.bytes)(u);const h={name:a,length:8*l.length},f=function(g,m,w){if(g===c.CBC)return{name:c.CBC,iv:m};if(g===c.CTR)return{name:c.CTR,counter:m,length:64};if(g===c.GCM)return w?{name:c.GCM,iv:m,additionalData:w}:{name:c.GCM,iv:m};throw new Error("unknown aes block mode")}(a,u,d);return{encrypt:g=>((0,n.bytes)(g),t.utils.encrypt(l,h,f,g)),decrypt:g=>((0,n.bytes)(g),t.utils.decrypt(l,h,f,g))}}}t.cbc=s(c.CBC),t.ctr=s(c.CTR),t.gcm=s(c.GCM)}(_a);var hd={},Ie={},qt={},rt={};function Vi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function fd(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function pd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Sa(t,...e){if(!pd(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function md(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Vi(t.outputLen),Vi(t.blockLen)}function gd(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function yd(t,e){Sa(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(rt,"__esModule",{value:!0}),rt.isBytes=pd,rt.number=Vi,rt.bool=fd,rt.bytes=Sa,rt.hash=md,rt.exists=gd,rt.output=yd;const Y0={number:Vi,bool:fd,bytes:Sa,hash:md,exists:gd,output:yd};rt.default=Y0;var Zt={},ri={};Object.defineProperty(ri,"__esModule",{value:!0}),ri.crypto=void 0,ri.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.nextTick=t.byteSwapIfBE=t.byteSwap=t.isLE=t.rotl=t.rotr=t.createView=t.u32=t.u8=void 0,t.isBytes=function(l){return l instanceof Uint8Array||l!=null&&typeof l=="object"&&l.constructor.name==="Uint8Array"},t.byteSwap32=function(l){for(let u=0;u<l.length;u++)l[u]=(0,t.byteSwap)(l[u])},t.bytesToHex=function(l){(0,n.bytes)(l);let u="";for(let d=0;d<l.length;d++)u+=r[l[d]];return u},t.hexToBytes=function(l){if(typeof l!="string")throw new Error("hex string expected, got "+typeof l);const u=l.length,d=u/2;if(u%2)throw new Error("padded hex string expected, got unpadded hex of length "+u);const h=new Uint8Array(d);for(let f=0,g=0;f<d;f++,g+=2){const m=o(l.charCodeAt(g)),w=o(l.charCodeAt(g+1));if(m===void 0||w===void 0){const p=l[g]+l[g+1];throw new Error('hex string expected, got non-hex character "'+p+'" at index '+g)}h[f]=16*m+w}return h},t.asyncLoop=async function(l,u,d){let h=Date.now();for(let f=0;f<l;f++){d(f);const g=Date.now()-h;g>=0&&g<u||(await(0,t.nextTick)(),h+=g)}},t.utf8ToBytes=c,t.toBytes=s,t.concatBytes=function(...l){let u=0;for(let h=0;h<l.length;h++){const f=l[h];(0,n.bytes)(f),u+=f.length}const d=new Uint8Array(u);for(let h=0,f=0;h<l.length;h++){const g=l[h];d.set(g,f),f+=g.length}return d},t.checkOpts=function(l,u){if(u!==void 0&&a.call(u)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(l,u)},t.wrapConstructor=function(l){const u=h=>l().update(s(h)).digest(),d=l();return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=()=>l(),u},t.wrapConstructorWithOpts=function(l){const u=(h,f)=>l(f).update(s(h)).digest(),d=l({});return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=h=>l(h),u},t.wrapXOFConstructorWithOpts=function(l){const u=(h,f)=>l(f).update(s(h)).digest(),d=l({});return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=h=>l(h),u},t.randomBytes=function(l=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(l));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(l);throw new Error("crypto.getRandomValues must be defined")};const e=ri,n=rt;t.u8=l=>new Uint8Array(l.buffer,l.byteOffset,l.byteLength),t.u32=l=>new Uint32Array(l.buffer,l.byteOffset,Math.floor(l.byteLength/4)),t.createView=l=>new DataView(l.buffer,l.byteOffset,l.byteLength),t.rotr=(l,u)=>l<<32-u|l>>>u,t.rotl=(l,u)=>l<<u|l>>>32-u>>>0,t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,t.byteSwap=l=>l<<24&4278190080|l<<8&16711680|l>>>8&65280|l>>>24&255,t.byteSwapIfBE=t.isLE?l=>l:l=>(0,t.byteSwap)(l);const r=Array.from({length:256},(l,u)=>u.toString(16).padStart(2,"0")),i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(l){return l>=i._0&&l<=i._9?l-i._0:l>=i._A&&l<=i._F?l-(i._A-10):l>=i._a&&l<=i._f?l-(i._a-10):void 0}function c(l){if(typeof l!="string")throw new Error("utf8ToBytes expected string, got "+typeof l);return new Uint8Array(new TextEncoder().encode(l))}function s(l){return typeof l=="string"&&(l=c(l)),(0,n.bytes)(l),l}t.nextTick=async()=>{},t.Hash=class{clone(){return this._cloneInto()}};const a={}.toString}(Zt),Object.defineProperty(qt,"__esModule",{value:!0}),qt.HashMD=qt.Maj=qt.Chi=void 0;const $o=rt,dr=Zt;qt.Chi=(t,e,n)=>t&e^~t&n;qt.Maj=(t,e,n)=>t&e^t&n^e&n;qt.HashMD=class extends dr.Hash{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,dr.createView)(this.buffer)}update(t){(0,$o.exists)(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=(0,dr.toBytes)(t)).length;for(let o=0;o<i;){const c=Math.min(r-this.pos,i-o);if(c!==r)n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(e,0),this.pos=0);else{const s=(0,dr.createView)(t);for(;r<=i-o;o+=r)this.process(s,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,$o.exists)(this),(0,$o.output)(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)e[u]=0;(function(u,d,h,f){if(typeof u.setBigUint64=="function")return u.setBigUint64(d,h,f);const g=BigInt(32),m=BigInt(4294967295),w=Number(h>>g&m),p=Number(h&m),S=f?4:0,_=f?0:4;u.setUint32(d+S,w,f),u.setUint32(d+_,p,f)})(n,r-8,BigInt(8*this.length),i),this.process(n,0);const c=(0,dr.createView)(t),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=s/4,l=this.get();if(a>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<a;u++)c.setUint32(4*u,l[u],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:o,pos:c}=this;return t.length=r,t.pos=c,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}};var de={};Object.defineProperty(de,"__esModule",{value:!0}),de.add5L=de.add5H=de.add4H=de.add4L=de.add3H=de.add3L=de.rotlBL=de.rotlBH=de.rotlSL=de.rotlSH=de.rotr32L=de.rotr32H=de.rotrBL=de.rotrBH=de.rotrSL=de.rotrSH=de.shrSL=de.shrSH=de.toBig=void 0,de.fromBig=Ca,de.split=vd,de.add=Od;const ii=BigInt(2**32-1),Ns=BigInt(32);function Ca(t,e=!1){return e?{h:Number(t&ii),l:Number(t>>Ns&ii)}:{h:0|Number(t>>Ns&ii),l:0|Number(t&ii)}}function vd(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:c}=Ca(t[i],e);[n[i],r[i]]=[o,c]}return[n,r]}const bd=(t,e)=>BigInt(t>>>0)<<Ns|BigInt(e>>>0);de.toBig=bd;const wd=(t,e,n)=>t>>>n;de.shrSH=wd;const Ed=(t,e,n)=>t<<32-n|e>>>n;de.shrSL=Ed;const _d=(t,e,n)=>t>>>n|e<<32-n;de.rotrSH=_d;const Sd=(t,e,n)=>t<<32-n|e>>>n;de.rotrSL=Sd;const Cd=(t,e,n)=>t<<64-n|e>>>n-32;de.rotrBH=Cd;const Ad=(t,e,n)=>t>>>n-32|e<<64-n;de.rotrBL=Ad;const kd=(t,e)=>e;de.rotr32H=kd;const Td=(t,e)=>t;de.rotr32L=Td;const xd=(t,e,n)=>t<<n|e>>>32-n;de.rotlSH=xd;const Md=(t,e,n)=>e<<n|t>>>32-n;de.rotlSL=Md;const Rd=(t,e,n)=>e<<n-32|t>>>64-n;de.rotlBH=Rd;const Pd=(t,e,n)=>t<<n-32|e>>>64-n;function Od(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}}de.rotlBL=Pd;const Id=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0);de.add3L=Id;const Ld=(t,e,n,r)=>e+n+r+(t/2**32|0)|0;de.add3H=Ld;const Nd=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0);de.add4L=Nd;const Dd=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0;de.add4H=Dd;const Bd=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0);de.add5L=Bd;const $d=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0;de.add5H=$d;const Z0={fromBig:Ca,split:vd,toBig:bd,shrSH:wd,shrSL:Ed,rotrSH:_d,rotrSL:Sd,rotrBH:Cd,rotrBL:Ad,rotr32H:kd,rotr32L:Td,rotlSH:xd,rotlSL:Md,rotlBH:Rd,rotlBL:Pd,add:Od,add3L:Id,add3H:Ld,add4L:Nd,add4H:Dd,add5H:$d,add5L:Bd};de.default=Z0,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.sha384=Ie.sha512_256=Ie.sha512_224=Ie.sha512=Ie.SHA384=Ie.SHA512_256=Ie.SHA512_224=Ie.SHA512=void 0;const J0=qt,he=de,oi=Zt,[X0,Q0]=he.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Jt=new Uint32Array(80),Xt=new Uint32Array(80);class Vr extends J0.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:i,Ch:o,Cl:c,Dh:s,Dl:a,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:g,Hh:m,Hl:w}=this;return[e,n,r,i,o,c,s,a,l,u,d,h,f,g,m,w]}set(e,n,r,i,o,c,s,a,l,u,d,h,f,g,m,w){this.Ah=0|e,this.Al=0|n,this.Bh=0|r,this.Bl=0|i,this.Ch=0|o,this.Cl=0|c,this.Dh=0|s,this.Dl=0|a,this.Eh=0|l,this.El=0|u,this.Fh=0|d,this.Fl=0|h,this.Gh=0|f,this.Gl=0|g,this.Hh=0|m,this.Hl=0|w}process(e,n){for(let _=0;_<16;_++,n+=4)Jt[_]=e.getUint32(n),Xt[_]=e.getUint32(n+=4);for(let _=16;_<80;_++){const P=0|Jt[_-15],I=0|Xt[_-15],K=he.default.rotrSH(P,I,1)^he.default.rotrSH(P,I,8)^he.default.shrSH(P,I,7),q=he.default.rotrSL(P,I,1)^he.default.rotrSL(P,I,8)^he.default.shrSL(P,I,7),F=0|Jt[_-2],U=0|Xt[_-2],j=he.default.rotrSH(F,U,19)^he.default.rotrBH(F,U,61)^he.default.shrSH(F,U,6),G=he.default.rotrSL(F,U,19)^he.default.rotrBL(F,U,61)^he.default.shrSL(F,U,6),$=he.default.add4L(q,G,Xt[_-7],Xt[_-16]),N=he.default.add4H($,K,j,Jt[_-7],Jt[_-16]);Jt[_]=0|N,Xt[_]=0|$}let{Ah:r,Al:i,Bh:o,Bl:c,Ch:s,Cl:a,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:g,Gh:m,Gl:w,Hh:p,Hl:S}=this;for(let _=0;_<80;_++){const P=he.default.rotrSH(d,h,14)^he.default.rotrSH(d,h,18)^he.default.rotrBH(d,h,41),I=he.default.rotrSL(d,h,14)^he.default.rotrSL(d,h,18)^he.default.rotrBL(d,h,41),K=d&f^~d&m,q=h&g^~h&w,F=he.default.add5L(S,I,q,Q0[_],Xt[_]),U=he.default.add5H(F,p,P,K,X0[_],Jt[_]),j=0|F,G=he.default.rotrSH(r,i,28)^he.default.rotrBH(r,i,34)^he.default.rotrBH(r,i,39),$=he.default.rotrSL(r,i,28)^he.default.rotrBL(r,i,34)^he.default.rotrBL(r,i,39),N=r&o^r&s^o&s,R=i&c^i&a^c&a;p=0|m,S=0|w,m=0|f,w=0|g,f=0|d,g=0|h,{h:d,l:h}=he.default.add(0|l,0|u,0|U,0|j),l=0|s,u=0|a,s=0|o,a=0|c,o=0|r,c=0|i;const C=he.default.add3L(j,$,R);r=he.default.add3H(C,U,G,N),i=0|C}({h:r,l:i}=he.default.add(0|this.Ah,0|this.Al,0|r,0|i)),{h:o,l:c}=he.default.add(0|this.Bh,0|this.Bl,0|o,0|c),{h:s,l:a}=he.default.add(0|this.Ch,0|this.Cl,0|s,0|a),{h:l,l:u}=he.default.add(0|this.Dh,0|this.Dl,0|l,0|u),{h:d,l:h}=he.default.add(0|this.Eh,0|this.El,0|d,0|h),{h:f,l:g}=he.default.add(0|this.Fh,0|this.Fl,0|f,0|g),{h:m,l:w}=he.default.add(0|this.Gh,0|this.Gl,0|m,0|w),{h:p,l:S}=he.default.add(0|this.Hh,0|this.Hl,0|p,0|S),this.set(r,i,o,c,s,a,l,u,d,h,f,g,m,w,p,S)}roundClean(){Jt.fill(0),Xt.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}Ie.SHA512=Vr;class Kd extends Vr{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}Ie.SHA512_224=Kd;class jd extends Vr{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}Ie.SHA512_256=jd;class bc extends Vr{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}Ie.SHA384=bc,Ie.sha512=(0,oi.wrapConstructor)(()=>new Vr),Ie.sha512_224=(0,oi.wrapConstructor)(()=>new Kd),Ie.sha512_256=(0,oi.wrapConstructor)(()=>new jd),Ie.sha384=(0,oi.wrapConstructor)(()=>new bc);var Ds={},qn={},Se={},fe={};Object.defineProperty(fe,"__esModule",{value:!0}),fe.notImplemented=fe.bitMask=void 0,fe.isBytes=Wi,fe.abytes=Gi,fe.abool=function(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)},fe.bytesToHex=Ko,fe.numberToHexUnpadded=wc,fe.hexToNumber=jo,fe.hexToBytes=ki,fe.bytesToNumberBE=function(t){return jo(Ko(t))},fe.bytesToNumberLE=function(t){return Gi(t),jo(Ko(Uint8Array.from(t).reverse()))},fe.numberToBytesBE=_c,fe.numberToBytesLE=function(t,e){return _c(t,e).reverse()},fe.numberToVarBytesBE=function(t){return ki(wc(t))},fe.ensureBytes=function(t,e,n){let r;if(typeof e=="string")try{r=ki(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else{if(!Wi(e))throw new Error(`${t} must be hex string or Uint8Array`);r=Uint8Array.from(e)}const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(`${t} expected ${n} bytes, got ${i}`);return r},fe.concatBytes=Sc,fe.equalBytes=function(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return n===0},fe.utf8ToBytes=function(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))},fe.inRange=Cc,fe.aInRange=function(t,e,n,r){if(!Cc(e,n,r))throw new Error(`expected valid ${t}: ${n} <= n < ${r}, got ${typeof e} ${e}`)},fe.bitLen=function(t){let e;for(e=0;t>Bs;t>>=Ai,e+=1);return e},fe.bitGet=function(t,e){return t>>BigInt(e)&Ai},fe.bitSet=function(t,e,n){return t|(n?Ai:Bs)<<BigInt(e)},fe.createHmacDrbg=function(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Ho(t),i=Ho(t),o=0;const c=()=>{r.fill(1),i.fill(0),o=0},s=(...u)=>n(i,r,...u),a=(u=Ho())=>{i=s(Ac([0]),u),r=s(),u.length!==0&&(i=s(Ac([1]),u),r=s())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const d=[];for(;u<e;){r=s();const h=r.slice();d.push(h),u+=r.length}return Sc(...d)};return(u,d)=>{let h;for(c(),a(u);!(h=d(l()));)a();return c(),h}},fe.validateObject=function(t,e,n={}){const r=(i,o,c)=>{const s=nm[o];if(typeof s!="function")throw new Error(`Invalid validator "${o}", expected function`);const a=t[i];if(!(c&&a===void 0||s(a,t)))throw new Error(`Invalid param ${String(i)}=${a} (${typeof a}), expected ${o}`)};for(const[i,o]of Object.entries(e))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return t},fe.memoized=function(t){const e=new WeakMap;return(n,...r)=>{const i=e.get(n);if(i!==void 0)return i;const o=t(n,...r);return e.set(n,o),o}};const Bs=BigInt(0),Ai=BigInt(1),em=BigInt(2);function Wi(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Gi(t){if(!Wi(t))throw new Error("Uint8Array expected")}const tm=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Ko(t){Gi(t);let e="";for(let n=0;n<t.length;n++)e+=tm[t[n]];return e}function wc(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function jo(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}const $t={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Ec(t){return t>=$t._0&&t<=$t._9?t-$t._0:t>=$t._A&&t<=$t._F?t-($t._A-10):t>=$t._a&&t<=$t._f?t-($t._a-10):void 0}function ki(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const c=Ec(t.charCodeAt(o)),s=Ec(t.charCodeAt(o+1));if(c===void 0||s===void 0){const a=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+o)}r[i]=16*c+s}return r}function _c(t,e){return ki(t.toString(16).padStart(2*e,"0"))}function Sc(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];Gi(i),e+=i.length}const n=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const o=t[r];n.set(o,i),i+=o.length}return n}const Uo=t=>typeof t=="bigint"&&Bs<=t;function Cc(t,e,n){return Uo(t)&&Uo(e)&&Uo(n)&&e<=t&&t<n}fe.bitMask=t=>(em<<BigInt(t-1))-Ai;const Ho=t=>new Uint8Array(t),Ac=t=>Uint8Array.from(t),nm={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||Wi(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};fe.notImplemented=()=>{throw new Error("not implemented")},Object.defineProperty(Se,"__esModule",{value:!0}),Se.isNegativeLE=void 0,Se.mod=tt,Se.pow=Ud,Se.pow2=function(t,e,n){let r=t;for(;e-- >Le;)r*=r,r%=n;return r},Se.invert=si,Se.tonelliShanks=Hd,Se.FpSqrt=xc,Se.validateField=function(t){const e=im.reduce((n,r)=>(n[r]="function",n),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,Qe.validateObject)(t,e)},Se.FpPow=Mc,Se.FpInvertBatch=Rc,Se.FpDiv=function(t,e,n){return t.mul(e,typeof n=="bigint"?si(n,t.ORDER):t.inv(n))},Se.FpLegendre=Pc,Se.FpIsSquare=function(t){const e=Pc(t.ORDER);return n=>{const r=e(t,n);return t.eql(r,t.ZERO)||t.eql(r,t.ONE)}},Se.nLength=Fo,Se.Field=function(t,e,n=!1,r={}){if(t<=Le)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=Fo(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=xc(t),s=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:(0,Qe.bitMask)(i),ZERO:Le,ONE:Ce,create:a=>tt(a,t),isValid:a=>{if(typeof a!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof a);return Le<=a&&a<t},is0:a=>a===Le,isOdd:a=>(a&Ce)===Ce,neg:a=>tt(-a,t),eql:(a,l)=>a===l,sqr:a=>tt(a*a,t),add:(a,l)=>tt(a+l,t),sub:(a,l)=>tt(a-l,t),mul:(a,l)=>tt(a*l,t),pow:(a,l)=>Mc(s,a,l),div:(a,l)=>tt(a*si(l,t),t),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>si(a,t),sqrt:r.sqrt||(a=>c(s,a)),invertBatch:a=>Rc(s,a),cmov:(a,l,u)=>u?l:a,toBytes:a=>n?(0,Qe.numberToBytesLE)(a,o):(0,Qe.numberToBytesBE)(a,o),fromBytes:a=>{if(a.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${a.length}`);return n?(0,Qe.bytesToNumberLE)(a):(0,Qe.bytesToNumberBE)(a)}});return Object.freeze(s)},Se.FpSqrtOdd=function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);return t.isOdd(n)?n:t.neg(n)},Se.FpSqrtEven=function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);return t.isOdd(n)?t.neg(n):n},Se.hashToPrivateScalar=function(t,e,n=!1){t=(0,Qe.ensureBytes)("privateHash",t);const r=t.length,i=Fo(e).nByteLength+8;if(i<24||r<i||r>1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${r}`);const o=n?(0,Qe.bytesToNumberLE)(t):(0,Qe.bytesToNumberBE)(t);return tt(o,e-Ce)+Ce},Se.getFieldBytesLength=Ks,Se.getMinHashLength=Oc,Se.mapHashToField=function(t,e,n=!1){const r=t.length,i=Ks(e),o=Oc(e);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const c=tt(n?(0,Qe.bytesToNumberBE)(t):(0,Qe.bytesToNumberLE)(t),e-Ce)+Ce;return n?(0,Qe.numberToBytesLE)(c,i):(0,Qe.numberToBytesBE)(c,i)};const Qe=fe,Le=BigInt(0),Ce=BigInt(1),fn=BigInt(2),rm=BigInt(3),$s=BigInt(4),kc=BigInt(5),Tc=BigInt(8);function tt(t,e){const n=t%e;return n>=Le?n:e+n}function Ud(t,e,n){if(n<=Le||e<Le)throw new Error("Expected power/modulo > 0");if(n===Ce)return Le;let r=Ce;for(;e>Le;)e&Ce&&(r=r*t%n),t=t*t%n,e>>=Ce;return r}function si(t,e){if(t===Le||e<=Le)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=tt(t,e),r=e,i=Le,o=Ce;for(;n!==Le;){const c=r%n,s=i-o*(r/n);r=n,n=c,i=o,o=s}if(r!==Ce)throw new Error("invert: does not exist");return tt(i,e)}function Hd(t){const e=(t-Ce)/fn;let n,r,i;for(n=t-Ce,r=0;n%fn===Le;n/=fn,r++);for(i=fn;i<t&&Ud(i,e,t)!==t-Ce;i++);if(r===1){const c=(t+Ce)/$s;return function(s,a){const l=s.pow(a,c);if(!s.eql(s.sqr(l),a))throw new Error("Cannot find square root");return l}}const o=(n+Ce)/fn;return function(c,s){if(c.pow(s,e)===c.neg(c.ONE))throw new Error("Cannot find square root");let a=r,l=c.pow(c.mul(c.ONE,i),n),u=c.pow(s,o),d=c.pow(s,n);for(;!c.eql(d,c.ONE);){if(c.eql(d,c.ZERO))return c.ZERO;let h=1;for(let g=c.sqr(d);h<a&&!c.eql(g,c.ONE);h++)g=c.sqr(g);const f=c.pow(l,Ce<<BigInt(a-h-1));l=c.sqr(f),u=c.mul(u,f),d=c.mul(d,l),a=h}return u}}function xc(t){if(t%$s===rm){const e=(t+Ce)/$s;return function(n,r){const i=n.pow(r,e);if(!n.eql(n.sqr(i),r))throw new Error("Cannot find square root");return i}}if(t%Tc===kc){const e=(t-kc)/Tc;return function(n,r){const i=n.mul(r,fn),o=n.pow(i,e),c=n.mul(r,o),s=n.mul(n.mul(c,fn),o),a=n.mul(c,n.sub(s,n.ONE));if(!n.eql(n.sqr(a),r))throw new Error("Cannot find square root");return a}}return Hd(t)}BigInt(9),BigInt(16);Se.isNegativeLE=(t,e)=>(tt(t,e)&Ce)===Ce;const im=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Mc(t,e,n){if(n<Le)throw new Error("Expected power > 0");if(n===Le)return t.ONE;if(n===Ce)return e;let r=t.ONE,i=e;for(;n>Le;)n&Ce&&(r=t.mul(r,i)),i=t.sqr(i),n>>=Ce;return r}function Rc(t,e){const n=new Array(e.length),r=e.reduce((o,c,s)=>t.is0(c)?o:(n[s]=o,t.mul(o,c)),t.ONE),i=t.inv(r);return e.reduceRight((o,c,s)=>t.is0(c)?o:(n[s]=t.mul(o,n[s]),t.mul(o,c)),i),n}function Pc(t){const e=(t-Ce)/fn;return(n,r)=>n.pow(r,e)}function Fo(t,e){const n=e!==void 0?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Ks(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Oc(t){const e=Ks(t);return e+Math.ceil(e/2)}Object.defineProperty(qn,"__esModule",{value:!0}),qn.wNAF=function(t,e){const n=(o,c)=>{const s=c.negate();return o?s:c},r=o=>{if(!Number.isSafeInteger(o)||o<=0||o>e)throw new Error(`Wrong window size=${o}, should be [1..${e}]`)},i=o=>(r(o),{windows:Math.ceil(e/o)+1,windowSize:2**(o-1)});return{constTimeNegate:n,unsafeLadder(o,c){let s=t.ZERO,a=o;for(;c>om;)c&zo&&(s=s.add(a)),a=a.double(),c>>=zo;return s},precomputeWindow(o,c){const{windows:s,windowSize:a}=i(c),l=[];let u=o,d=u;for(let h=0;h<s;h++){d=u,l.push(d);for(let f=1;f<a;f++)d=d.add(u),l.push(d);u=d.double()}return l},wNAF(o,c,s){const{windows:a,windowSize:l}=i(o);let u=t.ZERO,d=t.BASE;const h=BigInt(2**o-1),f=2**o,g=BigInt(o);for(let m=0;m<a;m++){const w=m*l;let p=Number(s&h);s>>=g,p>l&&(p-=f,s+=zo);const S=w,_=w+Math.abs(p)-1,P=m%2!=0,I=p<0;p===0?d=d.add(n(P,c[S])):u=u.add(n(I,c[_]))}return{p:u,f:d}},wNAFCached(o,c,s){const a=Nc.get(o)||1;let l=qo.get(o);return l||(l=this.precomputeWindow(o,a),a!==1&&qo.set(o,s(l))),this.wNAF(a,l,c)},setWindowSize(o,c){r(c),Nc.set(o,c),qo.delete(o)}}},qn.pippenger=function(t,e,n,r){if(!Array.isArray(n)||!Array.isArray(r)||r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");r.forEach((u,d)=>{if(!e.isValid(u))throw new Error(`wrong scalar at index ${d}`)}),n.forEach((u,d)=>{if(!(u instanceof t))throw new Error(`wrong point at index ${d}`)});const i=(0,Lc.bitLen)(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,c=(1<<o)-1,s=new Array(c+1).fill(t.ZERO),a=Math.floor((e.BITS-1)/o)*o;let l=t.ZERO;for(let u=a;u>=0;u-=o){s.fill(t.ZERO);for(let h=0;h<r.length;h++){const f=r[h],g=Number(f>>BigInt(u)&BigInt(c));s[g]=s[g].add(n[h])}let d=t.ZERO;for(let h=s.length-1,f=t.ZERO;h>0;h--)f=f.add(s[h]),d=d.add(f);if(l=l.add(d),u!==0)for(let h=0;h<o;h++)l=l.double()}return l},qn.validateBasic=function(t){return(0,Ic.validateField)(t.Fp),(0,Lc.validateObject)(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,Ic.nLength)(t.n,t.nBitLength),...t,p:t.Fp.ORDER})};const Ic=Se,Lc=fe,om=BigInt(0),zo=BigInt(1),qo=new WeakMap,Nc=new WeakMap;Object.defineProperty(Ds,"__esModule",{value:!0}),Ds.twistedEdwards=function(t){const e=function(N){const R=(0,Vo.validateBasic)(N);return Ze.validateObject(N,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...R})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:c,nByteLength:s,h:a}=e,l=ai<<BigInt(8*s)-Je,u=n.create,d=(0,Dc.Field)(e.n,e.nBitLength),h=e.uvRatio||((N,R)=>{try{return{isValid:!0,value:n.sqrt(N*n.inv(R))}}catch{return{isValid:!1,value:gt}}}),f=e.adjustScalarBytes||(N=>N),g=e.domain||((N,R,C)=>{if((0,et.abool)("phflag",C),R.length||C)throw new Error("Contexts/pre-hash are not supported");return N});function m(N,R){Ze.aInRange("coordinate "+N,R,gt,l)}function w(N){if(!(N instanceof _))throw new Error("ExtendedPoint expected")}const p=(0,et.memoized)((N,R)=>{const{ex:C,ey:O,ez:D}=N,y=N.is0();R==null&&(R=y?sm:n.inv(D));const E=u(C*R),k=u(O*R),x=u(D*R);if(y)return{x:gt,y:Je};if(x!==Je)throw new Error("invZ was invalid");return{x:E,y:k}}),S=(0,et.memoized)(N=>{const{a:R,d:C}=e;if(N.is0())throw new Error("bad point: ZERO");const{ex:O,ey:D,ez:y,et:E}=N,k=u(O*O),x=u(D*D),b=u(y*y),v=u(b*b),A=u(k*R);if(u(b*u(A+x))!==u(v+u(C*u(k*x))))throw new Error("bad point: equation left != right (1)");if(u(O*D)!==u(y*E))throw new Error("bad point: equation left != right (2)");return!0});class _{constructor(R,C,O,D){this.ex=R,this.ey=C,this.ez=O,this.et=D,m("x",R),m("y",C),m("z",O),m("t",D),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(R){if(R instanceof _)throw new Error("extended point not allowed");const{x:C,y:O}=R||{};return m("x",C),m("y",O),new _(C,O,Je,u(C*O))}static normalizeZ(R){const C=n.invertBatch(R.map(O=>O.ez));return R.map((O,D)=>O.toAffine(C[D])).map(_.fromAffine)}static msm(R,C){return(0,Vo.pippenger)(_,d,R,C)}_setWindowSize(R){K.setWindowSize(this,R)}assertValidity(){S(this)}equals(R){w(R);const{ex:C,ey:O,ez:D}=this,{ex:y,ey:E,ez:k}=R,x=u(C*k),b=u(y*D),v=u(O*k),A=u(E*D);return x===b&&v===A}is0(){return this.equals(_.ZERO)}negate(){return new _(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:R}=e,{ex:C,ey:O,ez:D}=this,y=u(C*C),E=u(O*O),k=u(ai*u(D*D)),x=u(R*y),b=C+O,v=u(u(b*b)-y-E),A=x+E,T=A-k,M=x-E,L=u(v*T),B=u(A*M),H=u(v*M),z=u(T*A);return new _(L,B,z,H)}add(R){w(R);const{a:C,d:O}=e,{ex:D,ey:y,ez:E,et:k}=this,{ex:x,ey:b,ez:v,et:A}=R;if(C===BigInt(-1)){const re=u((y-D)*(b+x)),ae=u((y+D)*(b-x)),se=u(ae-re);if(se===gt)return this.double();const me=u(E*ai*A),we=u(k*ai*v),ue=we+me,pe=ae+re,ye=we-me,Re=u(ue*se),st=u(pe*ye),xo=u(ue*ye),Mo=u(se*pe);return new _(Re,st,Mo,xo)}const T=u(D*x),M=u(y*b),L=u(k*O*A),B=u(E*v),H=u((D+y)*(x+b)-T-M),z=B-L,J=B+L,Q=u(M-C*T),te=u(H*z),oe=u(J*Q),ce=u(H*Q),ne=u(z*J);return new _(te,oe,ne,ce)}subtract(R){return this.add(R.negate())}wNAF(R){return K.wNAFCached(this,R,_.normalizeZ)}multiply(R){const C=R;Ze.aInRange("scalar",C,Je,r);const{p:O,f:D}=this.wNAF(C);return _.normalizeZ([O,D])[0]}multiplyUnsafe(R){const C=R;return Ze.aInRange("scalar",C,gt,r),C===gt?I:this.equals(I)||C===Je?this:this.equals(P)?this.wNAF(C).p:K.unsafeLadder(this,C)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return K.unsafeLadder(this,r).is0()}toAffine(R){return p(this,R)}clearCofactor(){const{h:R}=e;return R===Je?this:this.multiplyUnsafe(R)}static fromHex(R,C=!1){const{d:O,a:D}=e,y=n.BYTES;R=(0,et.ensureBytes)("pointHex",R,y),(0,et.abool)("zip215",C);const E=R.slice(),k=R[y-1];E[y-1]=-129&k;const x=Ze.bytesToNumberLE(E),b=C?l:n.ORDER;Ze.aInRange("pointHex.y",x,gt,b);const v=u(x*x),A=u(v-Je),T=u(O*v-D);let{isValid:M,value:L}=h(A,T);if(!M)throw new Error("Point.fromHex: invalid y coordinate");const B=(L&Je)===Je,H=(128&k)!=0;if(!C&&L===gt&&H)throw new Error("Point.fromHex: x=0 and x_0=1");return H!==B&&(L=u(-L)),_.fromAffine({x:L,y:x})}static fromPrivateKey(R){return U(R).point}toRawBytes(){const{x:R,y:C}=this.toAffine(),O=Ze.numberToBytesLE(C,n.BYTES);return O[O.length-1]|=R&Je?128:0,O}toHex(){return Ze.bytesToHex(this.toRawBytes())}}_.BASE=new _(e.Gx,e.Gy,Je,u(e.Gx*e.Gy)),_.ZERO=new _(gt,Je,Je,gt);const{BASE:P,ZERO:I}=_,K=(0,Vo.wNAF)(_,8*s);function q(N){return(0,Dc.mod)(N,r)}function F(N){return q(Ze.bytesToNumberLE(N))}function U(N){const R=s;N=(0,et.ensureBytes)("private key",N,R);const C=(0,et.ensureBytes)("hashed private key",o(N),2*R),O=f(C.slice(0,R)),D=C.slice(R,2*R),y=F(O),E=P.multiply(y),k=E.toRawBytes();return{head:O,prefix:D,scalar:y,point:E,pointBytes:k}}function j(N=new Uint8Array,...R){const C=Ze.concatBytes(...R);return F(o(g(C,(0,et.ensureBytes)("context",N),!!i)))}const G=am;return P._setWindowSize(8),{CURVE:e,getPublicKey:function(N){return U(N).pointBytes},sign:function(N,R,C={}){N=(0,et.ensureBytes)("message",N),i&&(N=i(N));const{prefix:O,scalar:D,pointBytes:y}=U(R),E=j(C.context,O,N),k=P.multiply(E).toRawBytes(),x=q(E+j(C.context,k,y,N)*D);Ze.aInRange("signature.s",x,gt,r);const b=Ze.concatBytes(k,Ze.numberToBytesLE(x,n.BYTES));return(0,et.ensureBytes)("result",b,2*s)},verify:function(N,R,C,O=G){const{context:D,zip215:y}=O,E=n.BYTES;N=(0,et.ensureBytes)("signature",N,2*E),R=(0,et.ensureBytes)("message",R),y!==void 0&&(0,et.abool)("zip215",y),i&&(R=i(R));const k=Ze.bytesToNumberLE(N.slice(E,2*E));let x,b,v;try{x=_.fromHex(C,y),b=_.fromHex(N.slice(0,E),y),v=P.multiplyUnsafe(k)}catch{return!1}if(!y&&x.isSmallOrder())return!1;const A=j(D,b.toRawBytes(),x.toRawBytes(),R);return b.add(x.multiplyUnsafe(A)).subtract(v).clearCofactor().equals(_.ZERO)},ExtendedPoint:_,utils:{getExtendedPublicKey:U,randomPrivateKey:()=>c(n.BYTES),precompute:(N=8,R=_.BASE)=>(R._setWindowSize(N),R.multiply(BigInt(3)),R)}}};const Vo=qn,Dc=Se,Ze=fe,et=fe,gt=BigInt(0),Je=BigInt(1),ai=BigInt(2),sm=BigInt(8),am={zip215:!0};var an={};Object.defineProperty(an,"__esModule",{value:!0}),an.expand_message_xmd=Fd,an.expand_message_xof=zd,an.hash_to_field=Wo,an.isogenyMap=function(t,e){const n=e.map(r=>Array.from(r).reverse());return(r,i)=>{const[o,c,s,a]=n.map(l=>l.reduce((u,d)=>t.add(t.mul(u,r),d)));return r=t.div(o,c),i=t.mul(i,t.div(s,a)),{x:r,y:i}}},an.createHasher=function(t,e,n){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=Wo(r,2,{...n,DST:n.DST,...i}),c=t.fromAffine(e(o[0])),s=t.fromAffine(e(o[1])),a=c.add(s).clearCofactor();return a.assertValidity(),a},encodeToCurve(r,i){const o=Wo(r,1,{...n,DST:n.encodeDST,...i}),c=t.fromAffine(e(o[0])).clearCofactor();return c.assertValidity(),c},mapToCurve(r){if(!Array.isArray(r))throw new Error("mapToCurve: expected array of bigints");for(const o of r)if(typeof o!="bigint")throw new Error(`mapToCurve: expected array of bigints, got ${o} in array`);const i=t.fromAffine(e(r)).clearCofactor();return i.assertValidity(),i}}};const cm=Se,je=fe,lm=je.bytesToNumberBE;function cn(t,e){if(Rr(t),Rr(e),t<0||t>=1<<8*e)throw new Error(`bad I2OSP call: value=${t} length=${e}`);const n=Array.from({length:e}).fill(0);for(let r=e-1;r>=0;r--)n[r]=255&t,t>>>=8;return new Uint8Array(n)}function um(t,e){const n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[r]^e[r];return n}function Rr(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function Fd(t,e,n,r){(0,je.abytes)(t),(0,je.abytes)(e),Rr(n),e.length>255&&(e=r((0,je.concatBytes)((0,je.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));const{outputLen:i,blockLen:o}=r,c=Math.ceil(n/i);if(n>65535||c>255)throw new Error("expand_message_xmd: invalid lenInBytes");const s=(0,je.concatBytes)(e,cn(e.length,1)),a=cn(0,o),l=cn(n,2),u=new Array(c),d=r((0,je.concatBytes)(a,t,l,cn(0,1),s));u[0]=r((0,je.concatBytes)(d,cn(1,1),s));for(let h=1;h<=c;h++){const f=[um(d,u[h-1]),cn(h+1,1),s];u[h]=r((0,je.concatBytes)(...f))}return(0,je.concatBytes)(...u).slice(0,n)}function zd(t,e,n,r,i){if((0,je.abytes)(t),(0,je.abytes)(e),Rr(n),e.length>255){const o=Math.ceil(2*r/8);e=i.create({dkLen:o}).update((0,je.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(e).digest()}if(n>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:n}).update(t).update(cn(n,2)).update(e).update(cn(e.length,1)).digest()}function Wo(t,e,n){(0,je.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:r,k:i,m:o,hash:c,expand:s,DST:a}=n;(0,je.abytes)(t),Rr(e);const l=typeof a=="string"?(0,je.utf8ToBytes)(a):a,u=r.toString(2).length,d=Math.ceil((u+i)/8),h=e*o*d;let f;if(s==="xmd")f=Fd(t,l,h,c);else if(s==="xof")f=zd(t,l,h,i,c);else{if(s!=="_internal_pass")throw new Error('expand must be "xmd" or "xof"');f=t}const g=new Array(e);for(let m=0;m<e;m++){const w=new Array(o);for(let p=0;p<o;p++){const S=d*(p+m*o),_=f.subarray(S,S+d);w[p]=(0,cm.mod)(lm(_),r)}g[m]=w}return g}var js={};Object.defineProperty(js,"__esModule",{value:!0}),js.montgomery=function(t){const e=function(m){return(0,Qt.validateObject)(m,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...m})}(t),{P:n}=e,r=m=>(0,Bc.mod)(m,n),i=e.montgomeryBits,o=Math.ceil(i/8),c=e.nByteLength,s=e.adjustScalarBytes||(m=>m),a=e.powPminus2||(m=>(0,Bc.pow)(m,n-BigInt(2),n));function l(m,w,p){const S=r(m*(w-p));return[w=r(w-S),p=r(p+S)]}const u=(e.a-BigInt(2))/BigInt(4);function d(m){return(0,Qt.numberToBytesLE)(r(m),o)}function h(m,w){const p=function(P){const I=(0,Qt.ensureBytes)("u coordinate",P,o);return c===32&&(I[31]&=127),(0,Qt.bytesToNumberLE)(I)}(w),S=function(P){const I=(0,Qt.ensureBytes)("scalar",P),K=I.length;if(K!==o&&K!==c)throw new Error(`Expected ${o} or ${c} bytes, got ${K}`);return(0,Qt.bytesToNumberLE)(s(I))}(m),_=function(P,I){(0,Qt.aInRange)("u",P,Kn,n),(0,Qt.aInRange)("scalar",I,Kn,n);const K=I,q=P;let F,U=Go,j=Kn,G=P,$=Go,N=Kn;for(let C=BigInt(i-1);C>=Kn;C--){const O=K>>C&Go;N^=O,F=l(N,U,G),U=F[0],G=F[1],F=l(N,j,$),j=F[0],$=F[1],N=O;const D=U+j,y=r(D*D),E=U-j,k=r(E*E),x=y-k,b=G+$,v=r((G-$)*D),A=r(b*E),T=v+A,M=v-A;G=r(T*T),$=r(q*r(M*M)),U=r(y*k),j=r(x*(y+r(u*x)))}F=l(N,U,G),U=F[0],G=F[1],F=l(N,j,$),j=F[0],$=F[1];const R=a(j);return r(U*R)}(p,S);if(_===Kn)throw new Error("Invalid private or public key received");return d(_)}const f=d(e.Gu);function g(m){return h(m,f)}return{scalarMult:h,scalarMultBase:g,getSharedSecret:(m,w)=>h(m,w),getPublicKey:m=>g(m),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:f}};const Bc=Se,Qt=fe,Kn=BigInt(0),Go=BigInt(1);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hash_to_ristretto255=t.hashToRistretto255=t.RistrettoPoint=t.encodeToCurve=t.hashToCurve=t.edwardsToMontgomery=t.x25519=t.ed25519ph=t.ed25519ctx=t.ed25519=t.ED25519_TORSION_SUBGROUP=void 0,t.edwardsToMontgomeryPub=K,t.edwardsToMontgomeryPriv=function(A){const T=P.hash(A.subarray(0,32));return P.adjustScalarBytes(T).subarray(0,32)};const e=Ie,n=Zt,r=Ds,i=an,o=Se,c=js,s=fe,a=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),u=BigInt(0),d=BigInt(1),h=BigInt(2),f=BigInt(3),g=BigInt(5),m=BigInt(8);function w(A){const T=BigInt(10),M=BigInt(20),L=BigInt(40),B=BigInt(80),H=a,z=A*A%H*A%H,J=(0,o.pow2)(z,h,H)*z%H,Q=(0,o.pow2)(J,d,H)*A%H,te=(0,o.pow2)(Q,g,H)*Q%H,oe=(0,o.pow2)(te,T,H)*te%H,ce=(0,o.pow2)(oe,M,H)*oe%H,ne=(0,o.pow2)(ce,L,H)*ce%H,re=(0,o.pow2)(ne,B,H)*ne%H,ae=(0,o.pow2)(re,B,H)*ne%H,se=(0,o.pow2)(ae,T,H)*te%H;return{pow_p_5_8:(0,o.pow2)(se,h,H)*A%H,b2:z}}function p(A){return A[0]&=248,A[31]&=127,A[31]|=64,A}function S(A,T){const M=a,L=(0,o.mod)(T*T*T,M),B=w(A*(0,o.mod)(L*L*T,M)).pow_p_5_8;let H=(0,o.mod)(A*L*B,M);const z=(0,o.mod)(T*H*H,M),J=H,Q=(0,o.mod)(H*l,M),te=z===A,oe=z===(0,o.mod)(-A,M),ce=z===(0,o.mod)(-A*l,M);return te&&(H=J),(oe||ce)&&(H=Q),(0,o.isNegativeLE)(H,M)&&(H=(0,o.mod)(-H,M)),{isValid:te||oe,value:H}}t.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const _=(0,o.Field)(a,void 0,!0),P={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:_,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:m,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:e.sha512,randomBytes:n.randomBytes,adjustScalarBytes:p,uvRatio:S};function I(A,T,M){if(T.length>255)throw new Error("Context is too big");return(0,n.concatBytes)((0,n.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([M?1:0,T.length]),T,A)}function K(A){const{y:T}=t.ed25519.ExtendedPoint.fromHex(A),M=BigInt(1);return _.toBytes(_.create((M+T)*_.inv(M-T)))}t.ed25519=(0,r.twistedEdwards)(P),t.ed25519ctx=(0,r.twistedEdwards)({...P,domain:I}),t.ed25519ph=(0,r.twistedEdwards)(Object.assign({},P,{domain:I,prehash:e.sha512})),t.x25519=(0,c.montgomery)({P:a,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:A=>{const T=a,{pow_p_5_8:M,b2:L}=w(A);return(0,o.mod)((0,o.pow2)(M,f,T)*L,T)},adjustScalarBytes:p,randomBytes:n.randomBytes}),t.edwardsToMontgomery=K;const q=(_.ORDER+f)/m,F=_.pow(h,q),U=_.sqrt(_.neg(_.ONE)),j=(0,o.FpSqrtEven)(_,_.neg(BigInt(486664)));function G(A){const{xMn:T,xMd:M,yMn:L,yMd:B}=function(ne){const re=(_.ORDER-g)/m,ae=BigInt(486662);let se=_.sqr(ne);se=_.mul(se,h);let me=_.add(se,_.ONE),we=_.neg(ae),ue=_.sqr(me),pe=_.mul(ue,me),ye=_.mul(se,ae);ye=_.mul(ye,we),ye=_.add(ye,ue),ye=_.mul(ye,we);let Re=_.sqr(pe);ue=_.sqr(Re),Re=_.mul(Re,pe),Re=_.mul(Re,ye),ue=_.mul(ue,Re);let st=_.pow(ue,re);st=_.mul(st,Re);let xo=_.mul(st,U);ue=_.sqr(st),ue=_.mul(ue,pe);let Mo=_.eql(ue,ye),ic=_.cmov(xo,st,Mo),qf=_.mul(we,se),cr=_.mul(st,ne);cr=_.mul(cr,F);let Vf=_.mul(cr,U),Wf=_.mul(ye,se);ue=_.sqr(cr),ue=_.mul(ue,pe);let Gf=_.eql(ue,Wf),Yf=_.cmov(Vf,cr,Gf);ue=_.sqr(ic),ue=_.mul(ue,pe);let Ro=_.eql(ue,ye),Zf=_.cmov(qf,we,Ro),lr=_.cmov(Yf,ic,Ro),Jf=_.isOdd(lr);return lr=_.cmov(lr,_.neg(lr),Ro!==Jf),{xMn:Zf,xMd:me,yMn:lr,yMd:d}}(A);let H=_.mul(T,B);H=_.mul(H,j);let z=_.mul(M,L),J=_.sub(T,M),Q=_.add(T,M),te=_.mul(z,Q),oe=_.eql(te,_.ZERO);H=_.cmov(H,_.ZERO,oe),z=_.cmov(z,_.ONE,oe),J=_.cmov(J,_.ONE,oe),Q=_.cmov(Q,_.ONE,oe);const ce=_.invertBatch([z,Q]);return{x:_.mul(H,ce[0]),y:_.mul(J,ce[1])}}const $=(0,i.createHasher)(t.ed25519.ExtendedPoint,A=>G(A[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:_.ORDER,m:1,k:128,expand:"xmd",hash:e.sha512});function N(A){if(!(A instanceof v))throw new Error("RistrettoPoint expected")}t.hashToCurve=$.hashToCurve,t.encodeToCurve=$.encodeToCurve;const R=l,C=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),O=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),D=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),y=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),E=A=>S(d,A),k=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),x=A=>t.ed25519.CURVE.Fp.create((0,s.bytesToNumberLE)(A)&k);function b(A){const{d:T}=t.ed25519.CURVE,M=t.ed25519.CURVE.Fp.ORDER,L=t.ed25519.CURVE.Fp.create,B=L(R*A*A),H=L((B+d)*D);let z=BigInt(-1);const J=L((z-T*B)*L(B+T));let{isValid:Q,value:te}=S(H,J),oe=L(te*A);(0,o.isNegativeLE)(oe,M)||(oe=L(-oe)),Q||(te=oe),Q||(z=B);const ce=L(z*(B-d)*y-J),ne=te*te,re=L((te+te)*J),ae=L(ce*C),se=L(d-ne),me=L(d+ne);return new t.ed25519.ExtendedPoint(L(re*me),L(se*ae),L(ae*me),L(re*se))}class v{constructor(T){this.ep=T}static fromAffine(T){return new v(t.ed25519.ExtendedPoint.fromAffine(T))}static hashToCurve(T){T=(0,s.ensureBytes)("ristrettoHash",T,64);const M=b(x(T.slice(0,32))),L=b(x(T.slice(32,64)));return new v(M.add(L))}static fromHex(T){T=(0,s.ensureBytes)("ristrettoHex",T,32);const{a:M,d:L}=t.ed25519.CURVE,B=t.ed25519.CURVE.Fp.ORDER,H=t.ed25519.CURVE.Fp.create,z="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",J=x(T);if(!(0,s.equalBytes)((0,s.numberToBytesLE)(J,32),T)||(0,o.isNegativeLE)(J,B))throw new Error(z);const Q=H(J*J),te=H(d+M*Q),oe=H(d-M*Q),ce=H(te*te),ne=H(oe*oe),re=H(M*L*ce-ne),{isValid:ae,value:se}=E(H(re*ne)),me=H(se*oe),we=H(se*me*re);let ue=H((J+J)*me);(0,o.isNegativeLE)(ue,B)&&(ue=H(-ue));const pe=H(te*we),ye=H(ue*pe);if(!ae||(0,o.isNegativeLE)(ye,B)||pe===u)throw new Error(z);return new v(new t.ed25519.ExtendedPoint(ue,pe,d,ye))}toRawBytes(){let{ex:T,ey:M,ez:L,et:B}=this.ep;const H=t.ed25519.CURVE.Fp.ORDER,z=t.ed25519.CURVE.Fp.create,J=z(z(L+M)*z(L-M)),Q=z(T*M),te=z(Q*Q),{value:oe}=E(z(J*te)),ce=z(oe*J),ne=z(oe*Q),re=z(ce*ne*B);let ae;if((0,o.isNegativeLE)(B*re,H)){let me=z(M*R),we=z(T*R);T=me,M=we,ae=z(ce*O)}else ae=ne;(0,o.isNegativeLE)(T*re,H)&&(M=z(-M));let se=z((L-M)*ae);return(0,o.isNegativeLE)(se,H)&&(se=z(-se)),(0,s.numberToBytesLE)(se,32)}toHex(){return(0,s.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(T){N(T);const{ex:M,ey:L}=this.ep,{ex:B,ey:H}=T.ep,z=t.ed25519.CURVE.Fp.create,J=z(M*H)===z(L*B),Q=z(L*H)===z(M*B);return J||Q}add(T){return N(T),new v(this.ep.add(T.ep))}subtract(T){return N(T),new v(this.ep.subtract(T.ep))}multiply(T){return new v(this.ep.multiply(T))}multiplyUnsafe(T){return new v(this.ep.multiplyUnsafe(T))}double(){return new v(this.ep.double())}negate(){return new v(this.ep.negate())}}t.RistrettoPoint=(v.BASE||(v.BASE=new v(t.ed25519.ExtendedPoint.BASE)),v.ZERO||(v.ZERO=new v(t.ed25519.ExtendedPoint.ZERO)),v),t.hashToRistretto255=(A,T)=>{const M=T.DST,L=typeof M=="string"?(0,n.utf8ToBytes)(M):M,B=(0,i.expand_message_xmd)(A,L,64,e.sha512);return v.hashToCurve(B)},t.hash_to_ristretto255=t.hashToRistretto255})(hd);var qd={},Vt={};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.sha224=Vt.sha256=Vt.SHA256=void 0;const Yo=qt,lt=Zt,dm=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),en=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),tn=new Uint32Array(64);class Aa extends Yo.HashMD{constructor(){super(64,32,8,!1),this.A=0|en[0],this.B=0|en[1],this.C=0|en[2],this.D=0|en[3],this.E=0|en[4],this.F=0|en[5],this.G=0|en[6],this.H=0|en[7]}get(){const{A:e,B:n,C:r,D:i,E:o,F:c,G:s,H:a}=this;return[e,n,r,i,o,c,s,a]}set(e,n,r,i,o,c,s,a){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|i,this.E=0|o,this.F=0|c,this.G=0|s,this.H=0|a}process(e,n){for(let d=0;d<16;d++,n+=4)tn[d]=e.getUint32(n,!1);for(let d=16;d<64;d++){const h=tn[d-15],f=tn[d-2],g=(0,lt.rotr)(h,7)^(0,lt.rotr)(h,18)^h>>>3,m=(0,lt.rotr)(f,17)^(0,lt.rotr)(f,19)^f>>>10;tn[d]=m+tn[d-7]+g+tn[d-16]|0}let{A:r,B:i,C:o,D:c,E:s,F:a,G:l,H:u}=this;for(let d=0;d<64;d++){const h=u+((0,lt.rotr)(s,6)^(0,lt.rotr)(s,11)^(0,lt.rotr)(s,25))+(0,Yo.Chi)(s,a,l)+dm[d]+tn[d]|0,f=((0,lt.rotr)(r,2)^(0,lt.rotr)(r,13)^(0,lt.rotr)(r,22))+(0,Yo.Maj)(r,i,o)|0;u=l,l=a,a=s,s=c+h|0,c=o,o=i,i=r,r=h+f|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,c=c+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,i,o,c,s,a,l,u)}roundClean(){tn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Vt.SHA256=Aa;class hm extends Aa{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}Vt.sha256=(0,lt.wrapConstructor)(()=>new Aa),Vt.sha224=(0,lt.wrapConstructor)(()=>new hm);var Ti={},ka={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const e=rt,n=Zt;class r extends n.Hash{constructor(o,c){super(),this.finished=!1,this.destroyed=!1,(0,e.hash)(o);const s=(0,n.toBytes)(c);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,l=new Uint8Array(a);l.set(s.length>a?o.create().update(s).digest():s);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=o.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),l.fill(0)}update(o){return(0,e.exists)(this),this.iHash.update(o),this}digestInto(o){(0,e.exists)(this),(0,e.bytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:c,iHash:s,finished:a,destroyed:l,blockLen:u,outputLen:d}=this;return o.finished=a,o.destroyed=l,o.blockLen=u,o.outputLen=d,o.oHash=c._cloneInto(o.oHash),o.iHash=s._cloneInto(o.iHash),o}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=r,t.hmac=(i,o,c)=>new r(i,o).update(c).digest(),t.hmac.create=(i,o)=>new r(i,o)})(ka);var Ta={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DER=void 0,t.weierstrassPoints=f,t.weierstrass=function(m){const w=function(A){const T=(0,e.validateBasic)(A);return r.validateObject(T,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...T})}(m),{Fp:p,n:S}=w,_=p.BYTES+1,P=2*p.BYTES+1;function I(A){return n.mod(A,S)}function K(A){return n.invert(A,S)}const{ProjectivePoint:q,normPrivateKeyToScalar:F,weierstrassEquation:U,isWithinCurveOrder:j}=f({...w,toBytes(A,T,M){const L=T.toAffine(),B=p.toBytes(L.x),H=r.concatBytes;return(0,i.abool)("isCompressed",M),M?H(Uint8Array.from([T.hasEvenY()?2:3]),B):H(Uint8Array.from([4]),B,p.toBytes(L.y))},fromBytes(A){const T=A.length,M=A[0],L=A.subarray(1);if(T!==_||M!==2&&M!==3){if(T===P&&M===4)return{x:p.fromBytes(L.subarray(0,p.BYTES)),y:p.fromBytes(L.subarray(p.BYTES,2*p.BYTES))};throw new Error(`Point of length ${T} was invalid. Expected ${_} compressed bytes or ${P} uncompressed bytes`)}{const B=r.bytesToNumberBE(L);if(!r.inRange(B,l,p.ORDER))throw new Error("Point is not on curve");const H=U(B);let z;try{z=p.sqrt(H)}catch(J){const Q=J instanceof Error?": "+J.message:"";throw new Error("Point is not on curve"+Q)}return(1&M)==1!=((z&l)===l)&&(z=p.neg(z)),{x:B,y:z}}}}),G=A=>r.bytesToHex(r.numberToBytesBE(A,w.nByteLength));function $(A){return A>S>>l}const N=(A,T,M)=>r.bytesToNumberBE(A.slice(T,M));class R{constructor(T,M,L){this.r=T,this.s=M,this.recovery=L,this.assertValidity()}static fromCompact(T){const M=w.nByteLength;return T=(0,i.ensureBytes)("compactSignature",T,2*M),new R(N(T,0,M),N(T,M,2*M))}static fromDER(T){const{r:M,s:L}=t.DER.toSig((0,i.ensureBytes)("DER",T));return new R(M,L)}assertValidity(){r.aInRange("r",this.r,l,S),r.aInRange("s",this.s,l,S)}addRecoveryBit(T){return new R(this.r,this.s,T)}recoverPublicKey(T){const{r:M,s:L,recovery:B}=this,H=y((0,i.ensureBytes)("msgHash",T));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const z=B===2||B===3?M+w.n:M;if(z>=p.ORDER)throw new Error("recovery id 2 or 3 invalid");const J=1&B?"03":"02",Q=q.fromHex(J+G(z)),te=K(z),oe=I(-H*te),ce=I(L*te),ne=q.BASE.multiplyAndAddUnsafe(Q,oe,ce);if(!ne)throw new Error("point at infinify");return ne.assertValidity(),ne}hasHighS(){return $(this.s)}normalizeS(){return this.hasHighS()?new R(this.r,I(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return t.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return G(this.r)+G(this.s)}}const C={isValidPrivateKey(A){try{return F(A),!0}catch{return!1}},normPrivateKeyToScalar:F,randomPrivateKey:()=>{const A=n.getMinHashLength(w.n);return n.mapHashToField(w.randomBytes(A),w.n)},precompute:(A=8,T=q.BASE)=>(T._setWindowSize(A),T.multiply(BigInt(3)),T)};function O(A){const T=r.isBytes(A),M=typeof A=="string",L=(T||M)&&A.length;return T?L===_||L===P:M?L===2*_||L===2*P:A instanceof q}const D=w.bits2int||function(A){const T=r.bytesToNumberBE(A),M=8*A.length-w.nBitLength;return M>0?T>>BigInt(M):T},y=w.bits2int_modN||function(A){return I(D(A))},E=r.bitMask(w.nBitLength);function k(A){return r.aInRange(`num < 2^${w.nBitLength}`,A,a,E),r.numberToBytesBE(A,w.nByteLength)}function x(A,T,M=b){if(["recovered","canonical"].some(re=>re in M))throw new Error("sign() legacy options not supported");const{hash:L,randomBytes:B}=w;let{lowS:H,prehash:z,extraEntropy:J}=M;H==null&&(H=!0),A=(0,i.ensureBytes)("msgHash",A),o(M),z&&(A=(0,i.ensureBytes)("prehashed msgHash",L(A)));const Q=y(A),te=F(T),oe=[k(te),k(Q)];if(J!=null&&J!==!1){const re=J===!0?B(p.BYTES):J;oe.push((0,i.ensureBytes)("extraEntropy",re))}const ce=r.concatBytes(...oe),ne=Q;return{seed:ce,k2sig:function(re){const ae=D(re);if(!j(ae))return;const se=K(ae),me=q.BASE.multiply(ae).toAffine(),we=I(me.x);if(we===a)return;const ue=I(se*I(ne+we*te));if(ue===a)return;let pe=(me.x===we?0:2)|Number(me.y&l),ye=ue;return H&&$(ue)&&(ye=function(Re){return $(Re)?I(-Re):Re}(ue),pe^=1),new R(we,ye,pe)}}}const b={lowS:w.lowS,prehash:!1},v={lowS:w.lowS,prehash:!1};return q.BASE._setWindowSize(8),{CURVE:w,getPublicKey:function(A,T=!0){return q.fromPrivateKey(A).toRawBytes(T)},getSharedSecret:function(A,T,M=!0){if(O(A))throw new Error("first arg must be private key");if(!O(T))throw new Error("second arg must be public key");return q.fromHex(T).multiply(F(A)).toRawBytes(M)},sign:function(A,T,M=b){const{seed:L,k2sig:B}=x(A,T,M),H=w;return r.createHmacDrbg(H.hash.outputLen,H.nByteLength,H.hmac)(L,B)},verify:function(A,T,M,L=v){var we;const B=A;if(T=(0,i.ensureBytes)("msgHash",T),M=(0,i.ensureBytes)("publicKey",M),"strict"in L)throw new Error("options.strict was renamed to lowS");o(L);const{lowS:H,prehash:z}=L;let J,Q;try{if(typeof B=="string"||r.isBytes(B))try{J=R.fromDER(B)}catch(ue){if(!(ue instanceof t.DER.Err))throw ue;J=R.fromCompact(B)}else{if(typeof B!="object"||typeof B.r!="bigint"||typeof B.s!="bigint")throw new Error("PARSE");{const{r:ue,s:pe}=B;J=new R(ue,pe)}}Q=q.fromHex(M)}catch(ue){if(ue.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(H&&J.hasHighS())return!1;z&&(T=w.hash(T));const{r:te,s:oe}=J,ce=y(T),ne=K(oe),re=I(ce*ne),ae=I(te*ne),se=(we=q.BASE.multiplyAndAddUnsafe(Q,re,ae))==null?void 0:we.toAffine();return se?I(se.x)===te:!1},ProjectivePoint:q,Signature:R,utils:C}},t.SWUFpSqrtRatio=g,t.mapToCurveSimpleSWU=function(m,w){if(n.validateField(m),!m.isValid(w.A)||!m.isValid(w.B)||!m.isValid(w.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const p=g(m,w.Z);if(!m.isOdd)throw new Error("Fp.isOdd is not implemented!");return S=>{let _,P,I,K,q,F,U,j;_=m.sqr(S),_=m.mul(_,w.Z),P=m.sqr(_),P=m.add(P,_),I=m.add(P,m.ONE),I=m.mul(I,w.B),K=m.cmov(w.Z,m.neg(P),!m.eql(P,m.ZERO)),K=m.mul(K,w.A),P=m.sqr(I),F=m.sqr(K),q=m.mul(F,w.A),P=m.add(P,q),P=m.mul(P,I),F=m.mul(F,K),q=m.mul(F,w.B),P=m.add(P,q),U=m.mul(_,I);const{isValid:G,value:$}=p(P,F);j=m.mul(_,S),j=m.mul(j,$),U=m.cmov(U,I,G),j=m.cmov(j,$,G);const N=m.isOdd(S)===m.isOdd(j);return j=m.cmov(m.neg(j),j,N),U=m.div(U,K),{x:U,y:j}}};const e=qn,n=Se,r=fe,i=fe;function o(m){m.lowS!==void 0&&(0,i.abool)("lowS",m.lowS),m.prehash!==void 0&&(0,i.abool)("prehash",m.prehash)}const{bytesToNumberBE:c,hexToBytes:s}=r;t.DER={Err:class extends Error{constructor(m=""){super(m)}},_tlv:{encode:(m,w)=>{const{Err:p}=t.DER;if(m<0||m>256)throw new p("tlv.encode: wrong tag");if(1&w.length)throw new p("tlv.encode: unpadded data");const S=w.length/2,_=r.numberToHexUnpadded(S);if(_.length/2&128)throw new p("tlv.encode: long form length too big");const P=S>127?r.numberToHexUnpadded(_.length/2|128):"";return`${r.numberToHexUnpadded(m)}${P}${_}${w}`},decode(m,w){const{Err:p}=t.DER;let S=0;if(m<0||m>256)throw new p("tlv.encode: wrong tag");if(w.length<2||w[S++]!==m)throw new p("tlv.decode: wrong tlv");const _=w[S++];let P=0;if(128&_){const K=127&_;if(!K)throw new p("tlv.decode(long): indefinite length not supported");if(K>4)throw new p("tlv.decode(long): byte length is too big");const q=w.subarray(S,S+K);if(q.length!==K)throw new p("tlv.decode: length bytes not complete");if(q[0]===0)throw new p("tlv.decode(long): zero leftmost byte");for(const F of q)P=P<<8|F;if(S+=K,P<128)throw new p("tlv.decode(long): not minimal encoding")}else P=_;const I=w.subarray(S,S+P);if(I.length!==P)throw new p("tlv.decode: wrong value length");return{v:I,l:w.subarray(S+P)}}},_int:{encode(m){const{Err:w}=t.DER;if(m<a)throw new w("integer: negative integers are not allowed");let p=r.numberToHexUnpadded(m);if(8&Number.parseInt(p[0],16)&&(p="00"+p),1&p.length)throw new w("unexpected assertion");return p},decode(m){const{Err:w}=t.DER;if(128&m[0])throw new w("Invalid signature integer: negative");if(m[0]===0&&!(128&m[1]))throw new w("Invalid signature integer: unnecessary leading zero");return c(m)}},toSig(m){const{Err:w,_int:p,_tlv:S}=t.DER,_=typeof m=="string"?s(m):m;r.abytes(_);const{v:P,l:I}=S.decode(48,_);if(I.length)throw new w("Invalid signature: left bytes after parsing");const{v:K,l:q}=S.decode(2,P),{v:F,l:U}=S.decode(2,q);if(U.length)throw new w("Invalid signature: left bytes after parsing");return{r:p.decode(K),s:p.decode(F)}},hexFromSig(m){const{_tlv:w,_int:p}=t.DER,S=`${w.encode(2,p.encode(m.r))}${w.encode(2,p.encode(m.s))}`;return w.encode(48,S)}};const a=BigInt(0),l=BigInt(1),u=BigInt(2),d=BigInt(3),h=BigInt(4);function f(m){const w=function(N){const R=(0,e.validateBasic)(N);r.validateObject(R,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:C,Fp:O,a:D}=R;if(C){if(!O.eql(D,O.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof C!="object"||typeof C.beta!="bigint"||typeof C.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...R})}(m),{Fp:p}=w,S=n.Field(w.n,w.nBitLength),_=w.toBytes||((N,R,C)=>{const O=R.toAffine();return r.concatBytes(Uint8Array.from([4]),p.toBytes(O.x),p.toBytes(O.y))}),P=w.fromBytes||(N=>{const R=N.subarray(1);return{x:p.fromBytes(R.subarray(0,p.BYTES)),y:p.fromBytes(R.subarray(p.BYTES,2*p.BYTES))}});function I(N){const{a:R,b:C}=w,O=p.sqr(N),D=p.mul(O,N);return p.add(p.add(D,p.mul(N,R)),C)}if(!p.eql(p.sqr(w.Gy),I(w.Gx)))throw new Error("bad generator point: equation left != right");function K(N){const{allowedPrivateKeyLengths:R,nByteLength:C,wrapPrivateKey:O,n:D}=w;if(R&&typeof N!="bigint"){if(r.isBytes(N)&&(N=r.bytesToHex(N)),typeof N!="string"||!R.includes(N.length))throw new Error("Invalid key");N=N.padStart(2*C,"0")}let y;try{y=typeof N=="bigint"?N:r.bytesToNumberBE((0,i.ensureBytes)("private key",N,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof N}`)}return O&&(y=n.mod(y,D)),r.aInRange("private key",y,l,D),y}function q(N){if(!(N instanceof j))throw new Error("ProjectivePoint expected")}const F=(0,i.memoized)((N,R)=>{const{px:C,py:O,pz:D}=N;if(p.eql(D,p.ONE))return{x:C,y:O};const y=N.is0();R==null&&(R=y?p.ONE:p.inv(D));const E=p.mul(C,R),k=p.mul(O,R),x=p.mul(D,R);if(y)return{x:p.ZERO,y:p.ZERO};if(!p.eql(x,p.ONE))throw new Error("invZ was invalid");return{x:E,y:k}}),U=(0,i.memoized)(N=>{if(N.is0()){if(w.allowInfinityPoint&&!p.is0(N.py))return;throw new Error("bad point: ZERO")}const{x:R,y:C}=N.toAffine();if(!p.isValid(R)||!p.isValid(C))throw new Error("bad point: x or y not FE");const O=p.sqr(C),D=I(R);if(!p.eql(O,D))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class j{constructor(R,C,O){if(this.px=R,this.py=C,this.pz=O,R==null||!p.isValid(R))throw new Error("x required");if(C==null||!p.isValid(C))throw new Error("y required");if(O==null||!p.isValid(O))throw new Error("z required");Object.freeze(this)}static fromAffine(R){const{x:C,y:O}=R||{};if(!R||!p.isValid(C)||!p.isValid(O))throw new Error("invalid affine point");if(R instanceof j)throw new Error("projective point not allowed");const D=y=>p.eql(y,p.ZERO);return D(C)&&D(O)?j.ZERO:new j(C,O,p.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(R){const C=p.invertBatch(R.map(O=>O.pz));return R.map((O,D)=>O.toAffine(C[D])).map(j.fromAffine)}static fromHex(R){const C=j.fromAffine(P((0,i.ensureBytes)("pointHex",R)));return C.assertValidity(),C}static fromPrivateKey(R){return j.BASE.multiply(K(R))}static msm(R,C){return(0,e.pippenger)(j,S,R,C)}_setWindowSize(R){$.setWindowSize(this,R)}assertValidity(){U(this)}hasEvenY(){const{y:R}=this.toAffine();if(p.isOdd)return!p.isOdd(R);throw new Error("Field doesn't support isOdd")}equals(R){q(R);const{px:C,py:O,pz:D}=this,{px:y,py:E,pz:k}=R,x=p.eql(p.mul(C,k),p.mul(y,D)),b=p.eql(p.mul(O,k),p.mul(E,D));return x&&b}negate(){return new j(this.px,p.neg(this.py),this.pz)}double(){const{a:R,b:C}=w,O=p.mul(C,d),{px:D,py:y,pz:E}=this;let k=p.ZERO,x=p.ZERO,b=p.ZERO,v=p.mul(D,D),A=p.mul(y,y),T=p.mul(E,E),M=p.mul(D,y);return M=p.add(M,M),b=p.mul(D,E),b=p.add(b,b),k=p.mul(R,b),x=p.mul(O,T),x=p.add(k,x),k=p.sub(A,x),x=p.add(A,x),x=p.mul(k,x),k=p.mul(M,k),b=p.mul(O,b),T=p.mul(R,T),M=p.sub(v,T),M=p.mul(R,M),M=p.add(M,b),b=p.add(v,v),v=p.add(b,v),v=p.add(v,T),v=p.mul(v,M),x=p.add(x,v),T=p.mul(y,E),T=p.add(T,T),v=p.mul(T,M),k=p.sub(k,v),b=p.mul(T,A),b=p.add(b,b),b=p.add(b,b),new j(k,x,b)}add(R){q(R);const{px:C,py:O,pz:D}=this,{px:y,py:E,pz:k}=R;let x=p.ZERO,b=p.ZERO,v=p.ZERO;const A=w.a,T=p.mul(w.b,d);let M=p.mul(C,y),L=p.mul(O,E),B=p.mul(D,k),H=p.add(C,O),z=p.add(y,E);H=p.mul(H,z),z=p.add(M,L),H=p.sub(H,z),z=p.add(C,D);let J=p.add(y,k);return z=p.mul(z,J),J=p.add(M,B),z=p.sub(z,J),J=p.add(O,D),x=p.add(E,k),J=p.mul(J,x),x=p.add(L,B),J=p.sub(J,x),v=p.mul(A,z),x=p.mul(T,B),v=p.add(x,v),x=p.sub(L,v),v=p.add(L,v),b=p.mul(x,v),L=p.add(M,M),L=p.add(L,M),B=p.mul(A,B),z=p.mul(T,z),L=p.add(L,B),B=p.sub(M,B),B=p.mul(A,B),z=p.add(z,B),M=p.mul(L,z),b=p.add(b,M),M=p.mul(J,z),x=p.mul(H,x),x=p.sub(x,M),M=p.mul(H,L),v=p.mul(J,v),v=p.add(v,M),new j(x,b,v)}subtract(R){return this.add(R.negate())}is0(){return this.equals(j.ZERO)}wNAF(R){return $.wNAFCached(this,R,j.normalizeZ)}multiplyUnsafe(R){r.aInRange("scalar",R,a,w.n);const C=j.ZERO;if(R===a)return C;if(R===l)return this;const{endo:O}=w;if(!O)return $.unsafeLadder(this,R);let{k1neg:D,k1:y,k2neg:E,k2:k}=O.splitScalar(R),x=C,b=C,v=this;for(;y>a||k>a;)y&l&&(x=x.add(v)),k&l&&(b=b.add(v)),v=v.double(),y>>=l,k>>=l;return D&&(x=x.negate()),E&&(b=b.negate()),b=new j(p.mul(b.px,O.beta),b.py,b.pz),x.add(b)}multiply(R){const{endo:C,n:O}=w;let D,y;if(r.aInRange("scalar",R,l,O),C){const{k1neg:E,k1:k,k2neg:x,k2:b}=C.splitScalar(R);let{p:v,f:A}=this.wNAF(k),{p:T,f:M}=this.wNAF(b);v=$.constTimeNegate(E,v),T=$.constTimeNegate(x,T),T=new j(p.mul(T.px,C.beta),T.py,T.pz),D=v.add(T),y=A.add(M)}else{const{p:E,f:k}=this.wNAF(R);D=E,y=k}return j.normalizeZ([D,y])[0]}multiplyAndAddUnsafe(R,C,O){const D=j.BASE,y=(k,x)=>x!==a&&x!==l&&k.equals(D)?k.multiply(x):k.multiplyUnsafe(x),E=y(this,C).add(y(R,O));return E.is0()?void 0:E}toAffine(R){return F(this,R)}isTorsionFree(){const{h:R,isTorsionFree:C}=w;if(R===l)return!0;if(C)return C(j,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:R,clearCofactor:C}=w;return R===l?this:C?C(j,this):this.multiplyUnsafe(w.h)}toRawBytes(R=!0){return(0,i.abool)("isCompressed",R),this.assertValidity(),_(j,this,R)}toHex(R=!0){return(0,i.abool)("isCompressed",R),r.bytesToHex(this.toRawBytes(R))}}j.BASE=new j(w.Gx,w.Gy,p.ONE),j.ZERO=new j(p.ZERO,p.ONE,p.ZERO);const G=w.nBitLength,$=(0,e.wNAF)(j,w.endo?Math.ceil(G/2):G);return{CURVE:w,ProjectivePoint:j,normPrivateKeyToScalar:K,weierstrassEquation:I,isWithinCurveOrder:function(N){return r.inRange(N,l,w.n)}}}function g(m,w){const p=m.ORDER;let S=a;for(let N=p-l;N%u===a;N/=u)S+=l;const _=S,P=u<<_-l-l,I=P*u,K=(p-l)/I,q=(K-l)/u,F=I-l,U=P,j=m.pow(w,K),G=m.pow(w,(K+l)/u);let $=(N,R)=>{let C=j,O=m.pow(R,F),D=m.sqr(O);D=m.mul(D,R);let y=m.mul(N,D);y=m.pow(y,q),y=m.mul(y,O),O=m.mul(y,R),D=m.mul(y,N);let E=m.mul(D,O);y=m.pow(E,U);let k=m.eql(y,m.ONE);O=m.mul(D,G),y=m.mul(E,C),D=m.cmov(O,D,k),E=m.cmov(y,E,k);for(let x=_;x>l;x--){let b=x-u;b=u<<b-l;let v=m.pow(E,b);const A=m.eql(v,m.ONE);O=m.mul(D,C),C=m.mul(C,C),v=m.mul(E,C),D=m.cmov(O,D,A),E=m.cmov(v,E,A)}return{isValid:k,value:D}};if(m.ORDER%h===d){const N=(m.ORDER-d)/h,R=m.sqrt(m.neg(w));$=(C,O)=>{let D=m.sqr(O);const y=m.mul(C,O);D=m.mul(D,y);let E=m.pow(D,N);E=m.mul(E,y);const k=m.mul(E,R),x=m.mul(m.sqr(E),O),b=m.eql(x,C);return{isValid:b,value:m.cmov(k,E,b)}}}return $}})(Ta),Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.getHash=Kc,Ti.createCurve=function(t,e){const n=r=>(0,pm.weierstrass)({...t,...Kc(r)});return Object.freeze({...n(e),create:n})};const fm=ka,$c=Zt,pm=Ta;function Kc(t){return{hash:t,hmac:(e,...n)=>(0,fm.hmac)(t,e,(0,$c.concatBytes)(...n)),randomBytes:$c.randomBytes}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.encodeToCurve=t.hashToCurve=t.schnorr=t.secp256k1=void 0;const e=Vt,n=Zt,r=Ti,i=an,o=Se,c=fe,s=Ta,a=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),u=BigInt(1),d=BigInt(2),h=(y,E)=>(y+E/d)/E;function f(y){const E=a,k=BigInt(3),x=BigInt(6),b=BigInt(11),v=BigInt(22),A=BigInt(23),T=BigInt(44),M=BigInt(88),L=y*y*y%E,B=L*L*y%E,H=(0,o.pow2)(B,k,E)*B%E,z=(0,o.pow2)(H,k,E)*B%E,J=(0,o.pow2)(z,d,E)*L%E,Q=(0,o.pow2)(J,b,E)*J%E,te=(0,o.pow2)(Q,v,E)*Q%E,oe=(0,o.pow2)(te,T,E)*te%E,ce=(0,o.pow2)(oe,M,E)*oe%E,ne=(0,o.pow2)(ce,T,E)*te%E,re=(0,o.pow2)(ne,k,E)*B%E,ae=(0,o.pow2)(re,A,E)*Q%E,se=(0,o.pow2)(ae,x,E)*L%E,me=(0,o.pow2)(se,d,E);if(!g.eql(g.sqr(me),y))throw new Error("Cannot find square root");return me}const g=(0,o.Field)(a,void 0,void 0,{sqrt:f});t.secp256k1=(0,r.createCurve)({a:BigInt(0),b:BigInt(7),Fp:g,n:l,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:y=>{const E=l,k=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),x=-u*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),b=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),v=k,A=BigInt("0x100000000000000000000000000000000"),T=h(v*y,E),M=h(-x*y,E);let L=(0,o.mod)(y-T*k-M*b,E),B=(0,o.mod)(-T*x-M*v,E);const H=L>A,z=B>A;if(H&&(L=E-L),z&&(B=E-B),L>A||B>A)throw new Error("splitScalar: Endomorphism failed, k="+y);return{k1neg:H,k1:L,k2neg:z,k2:B}}}},e.sha256);const m=BigInt(0),w={};function p(y,...E){let k=w[y];if(k===void 0){const x=(0,e.sha256)(Uint8Array.from(y,b=>b.charCodeAt(0)));k=(0,c.concatBytes)(x,x),w[y]=k}return(0,e.sha256)((0,c.concatBytes)(k,...E))}const S=y=>y.toRawBytes(!0).slice(1),_=y=>(0,c.numberToBytesBE)(y,32),P=y=>(0,o.mod)(y,a),I=y=>(0,o.mod)(y,l),K=t.secp256k1.ProjectivePoint,q=(y,E,k)=>K.BASE.multiplyAndAddUnsafe(y,E,k);function F(y){let E=t.secp256k1.utils.normPrivateKeyToScalar(y),k=K.fromPrivateKey(E);return{scalar:k.hasEvenY()?E:I(-E),bytes:S(k)}}function U(y){(0,c.aInRange)("x",y,u,a);const E=P(y*y);let k=f(P(E*y+BigInt(7)));k%d!==m&&(k=P(-k));const x=new K(y,k,u);return x.assertValidity(),x}const j=c.bytesToNumberBE;function G(...y){return I(j(p("BIP0340/challenge",...y)))}function $(y){return F(y).bytes}function N(y,E,k=(0,n.randomBytes)(32)){const x=(0,c.ensureBytes)("message",y),{bytes:b,scalar:v}=F(E),A=(0,c.ensureBytes)("auxRand",k,32),T=_(v^j(p("BIP0340/aux",A))),M=p("BIP0340/nonce",T,b,x),L=I(j(M));if(L===m)throw new Error("sign failed: k is zero");const{bytes:B,scalar:H}=F(L),z=G(B,b,x),J=new Uint8Array(64);if(J.set(B,0),J.set(_(I(H+z*v)),32),!R(J,x,b))throw new Error("sign: Invalid signature produced");return J}function R(y,E,k){const x=(0,c.ensureBytes)("signature",y,64),b=(0,c.ensureBytes)("message",E),v=(0,c.ensureBytes)("publicKey",k,32);try{const A=U(j(v)),T=j(x.subarray(0,32));if(!(0,c.inRange)(T,u,a))return!1;const M=j(x.subarray(32,64));if(!(0,c.inRange)(M,u,l))return!1;const L=G(_(T),S(A),b),B=q(A,M,I(-L));return!(!B||!B.hasEvenY()||B.toAffine().x!==T)}catch{return!1}}t.schnorr={getPublicKey:$,sign:N,verify:R,utils:{randomPrivateKey:t.secp256k1.utils.randomPrivateKey,lift_x:U,pointToBytes:S,numberToBytesBE:c.numberToBytesBE,bytesToNumberBE:c.bytesToNumberBE,taggedHash:p,mod:o.mod}};const C=(0,i.isogenyMap)(g,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(y=>y.map(E=>BigInt(E)))),O=(0,s.mapToCurveSimpleSWU)(g,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:g.create(BigInt("-11"))}),D=(0,i.createHasher)(t.secp256k1.ProjectivePoint,y=>{const{x:E,y:k}=O(g.create(y[0]));return C(E,k)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:g.ORDER,m:1,k:128,expand:"xmd",hash:e.sha256});t.hashToCurve=D.hashToCurve,t.encodeToCurve=D.encodeToCurve})(qd);var Us={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHex=t.remove0x=void 0;var e=ot;t.remove0x=function(n){return n.startsWith("0x")||n.startsWith("0X")?n.slice(2):n},t.decodeHex=function(n){return(0,e.hexToBytes)((0,t.remove0x)(n))}})(Us),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hexToPublicKey=t.convertPublicKeyFormat=t.getSharedPoint=t.getPublicKey=t.isValidPrivateKey=t.getValidSecret=void 0;var e=_a,n=hd,r=qd,i=Mr,o=Oe,c=Us;t.getValidSecret=function(){var u;do u=(0,e.randomBytes)(o.SECRET_KEY_LENGTH);while(!(0,t.isValidPrivateKey)(u));return u},t.isValidPrivateKey=function(u){return s((0,i.ellipticCurve)(),function(d){return d.utils.isValidPrivateKey(u)},function(){return!0},function(){return!0})},t.getPublicKey=function(u){return s((0,i.ellipticCurve)(),function(d){return d.getPublicKey(u)},function(d){return d.getPublicKey(u)},function(d){return d.getPublicKey(u)})},t.getSharedPoint=function(u,d,h){return s((0,i.ellipticCurve)(),function(f){return f.getSharedSecret(u,d,h)},function(f){return f.getSharedSecret(u,d)},function(f){return l(f,u,d)})},t.convertPublicKeyFormat=function(u,d){return s((0,i.ellipticCurve)(),function(h){return h.getSharedSecret(BigInt(1),u,d)},function(){return u},function(){return u})};function s(u,d,h,f){if(u==="secp256k1")return d(r.secp256k1);if(u==="x25519")return h(n.x25519);if(u==="ed25519")return f(n.ed25519);throw new Error("Not implemented")}t.hexToPublicKey=function(u){var d=(0,c.decodeHex)(u);return s((0,i.ellipticCurve)(),function(){return a(d)},function(){return d},function(){return d})};var a=function(u){if(u.length===o.ETH_PUBLIC_KEY_SIZE){var d=new Uint8Array(1+u.length);return d.set([4]),d.set(u,1),d}return u},l=function(u,d,h){var f=u.utils.getExtendedPublicKey(d).scalar;return u.ExtendedPoint.fromHex(h).multiply(f).toRawBytes()}}(dd);var Vd={},Vn={};Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.hkdf=void 0,Vn.extract=Gd,Vn.expand=Yd;const Hs=rt,jc=Zt,Wd=ka;function Gd(t,e,n){return(0,Hs.hash)(t),n===void 0&&(n=new Uint8Array(t.outputLen)),(0,Wd.hmac)(t,(0,jc.toBytes)(n),(0,jc.toBytes)(e))}const Zo=new Uint8Array([0]),Uc=new Uint8Array;function Yd(t,e,n,r=32){if((0,Hs.hash)(t),(0,Hs.number)(r),r>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/t.outputLen);n===void 0&&(n=Uc);const o=new Uint8Array(i*t.outputLen),c=Wd.hmac.create(t,e),s=c._cloneInto(),a=new Uint8Array(c.outputLen);for(let l=0;l<i;l++)Zo[0]=l+1,s.update(l===0?Uc:a).update(n).update(Zo).digestInto(a),o.set(a,t.outputLen*l),c._cloneInto(s);return c.destroy(),s.destroy(),a.fill(0),Zo.fill(0),o.slice(0,r)}Vn.hkdf=(t,e,n,r,i)=>Yd(t,Gd(t,e,n),r,i),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getSharedKey=t.deriveKey=void 0;var e=ot,n=Vn,r=Vt;t.deriveKey=function(i,o,c){return(0,n.hkdf)(r.sha256,i,o,c,32)},t.getSharedKey=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return(0,t.deriveKey)(e.concatBytes.apply(void 0,i))}}(Vd);var Hc={},Xn={},Ae={},xn={};Object.defineProperty(xn,"__esModule",{value:!0}),xn.polyval=xn.ghash=void 0,xn._toGHASHKey=Zd;const Mn=Ue,ze=ot,jt=16,xa=new Uint8Array(16),xt=(0,ze.u32)(xa),ht=t=>(t>>>0&255)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255|0;function Zd(t){t.reverse();const e=1&t[15];let n=0;for(let r=0;r<t.length;r++){const i=t[r];t[r]=i>>>1|n,n=(1&i)<<7}return t[0]^=225&-e,t}class Jd{constructor(e,n){this.blockLen=jt,this.outputLen=jt,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=(0,ze.toBytes)(e),(0,Mn.bytes)(e,16);const r=(0,ze.createView)(e);let i=r.getUint32(0,!1),o=r.getUint32(4,!1),c=r.getUint32(8,!1),s=r.getUint32(12,!1);const a=[];for(let p=0;p<128;p++)a.push({s0:ht(i),s1:ht(o),s2:ht(c),s3:ht(s)}),{s0:i,s1:o,s2:c,s3:s}={s3:(d=c)<<31|(h=s)>>>1,s2:(u=o)<<31|d>>>1,s1:(l=i)<<31|u>>>1,s0:l>>>1^225<<24&-(1&h)};var l,u,d,h;const f=(p=>p>65536?8:p>1024?4:2)(n||1024);if(![1,2,4,8].includes(f))throw new Error(`ghash: wrong window size=${f}, should be 2, 4 or 8`);this.W=f;const g=128/f,m=this.windowSize=2**f,w=[];for(let p=0;p<g;p++)for(let S=0;S<m;S++){let _=0,P=0,I=0,K=0;for(let q=0;q<f;q++){if(!(S>>>f-q-1&1))continue;const{s0:F,s1:U,s2:j,s3:G}=a[f*p+q];_^=F,P^=U,I^=j,K^=G}w.push({s0:_,s1:P,s2:I,s3:K})}this.t=w}_updateBlock(e,n,r,i){e^=this.s0,n^=this.s1,r^=this.s2,i^=this.s3;const{W:o,t:c,windowSize:s}=this;let a=0,l=0,u=0,d=0;const h=(1<<o)-1;let f=0;for(const g of[e,n,r,i])for(let m=0;m<4;m++){const w=g>>>8*m&255;for(let p=8/o-1;p>=0;p--){const S=w>>>o*p&h,{s0:_,s1:P,s2:I,s3:K}=c[f*s+S];a^=_,l^=P,u^=I,d^=K,f+=1}}this.s0=a,this.s1=l,this.s2=u,this.s3=d}update(e){e=(0,ze.toBytes)(e),(0,Mn.exists)(this);const n=(0,ze.u32)(e),r=Math.floor(e.length/jt),i=e.length%jt;for(let o=0;o<r;o++)this._updateBlock(n[4*o+0],n[4*o+1],n[4*o+2],n[4*o+3]);return i&&(xa.set(e.subarray(r*jt)),this._updateBlock(xt[0],xt[1],xt[2],xt[3]),(0,ze.clean)(xt)),this}destroy(){const{t:e}=this;for(const n of e)n.s0=0,n.s1=0,n.s2=0,n.s3=0}digestInto(e){(0,Mn.exists)(this),(0,Mn.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,c=(0,ze.u32)(e);return c[0]=n,c[1]=r,c[2]=i,c[3]=o,e}digest(){const e=new Uint8Array(jt);return this.digestInto(e),this.destroy(),e}}class mm extends Jd{constructor(e,n){e=(0,ze.toBytes)(e);const r=Zd((0,ze.copyBytes)(e));super(r,n),(0,ze.clean)(r)}update(e){e=(0,ze.toBytes)(e),(0,Mn.exists)(this);const n=(0,ze.u32)(e),r=e.length%jt,i=Math.floor(e.length/jt);for(let o=0;o<i;o++)this._updateBlock(ht(n[4*o+3]),ht(n[4*o+2]),ht(n[4*o+1]),ht(n[4*o+0]));return r&&(xa.set(e.subarray(i*jt)),this._updateBlock(ht(xt[3]),ht(xt[2]),ht(xt[1]),ht(xt[0])),(0,ze.clean)(xt)),this}digestInto(e){(0,Mn.exists)(this),(0,Mn.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,c=(0,ze.u32)(e);return c[0]=n,c[1]=r,c[2]=i,c[3]=o,e.reverse()}}function Fc(t){const e=(r,i)=>t(i,r.length).update((0,ze.toBytes)(r)).digest(),n=t(new Uint8Array(16),0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=(r,i)=>t(r,i),e}xn.ghash=Fc((t,e)=>new Jd(t,e)),xn.polyval=Fc((t,e)=>new mm(t,e)),Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.unsafe=Ae.aeskwp=Ae.aeskw=Ae.siv=Ae.gcm=Ae.cfb=Ae.cbc=Ae.ecb=Ae.ctr=void 0,Ae.expandKeyLE=wt,Ae.expandKeyDecLE=Pr;const ve=Ue,Fs=xn,ee=ot,Xe=16,ci=new Uint8Array(Xe),gm=283;function Ma(t){return t<<1^gm&-(t>>7)}function Wn(t,e){let n=0;for(;e>0;e>>=1)n^=t&-(1&e),t=Ma(t);return n}const zs=(()=>{const t=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=Ma(r))t[n]=r;const e=new Uint8Array(256);e[0]=99;for(let n=0;n<255;n++){let r=t[255-n];r|=r<<8,e[t[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return(0,ee.clean)(t),e})(),ym=zs.map((t,e)=>zs.indexOf(e)),vm=t=>t<<24|t>>>8,Jo=t=>t<<8|t>>>24,Yi=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function Xd(t,e){if(t.length!==256)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((l,u)=>e(t[u])),r=n.map(Jo),i=r.map(Jo),o=i.map(Jo),c=new Uint32Array(65536),s=new Uint32Array(65536),a=new Uint16Array(65536);for(let l=0;l<256;l++)for(let u=0;u<256;u++){const d=256*l+u;c[d]=n[l]^r[u],s[d]=i[l]^o[u],a[d]=t[l]<<8|t[u]}return{sbox:t,sbox2:a,T0:n,T1:r,T2:i,T3:o,T01:c,T23:s}}const Ra=Xd(zs,t=>Wn(t,3)<<24|t<<16|t<<8|Wn(t,2)),Qd=Xd(ym,t=>Wn(t,11)<<24|Wn(t,13)<<16|Wn(t,9)<<8|Wn(t,14)),bm=(()=>{const t=new Uint8Array(16);for(let e=0,n=1;e<16;e++,n=Ma(n))t[e]=n;return t})();function wt(t){(0,ve.bytes)(t);const e=t.length;if(![16,24,32].includes(e))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${e}`);const{sbox2:n}=Ra,r=[];(0,ee.isAligned32)(t)||r.push(t=(0,ee.copyBytes)(t));const i=(0,ee.u32)(t),o=i.length,c=a=>Rt(n,a,a,a,a),s=new Uint32Array(e+28);s.set(i);for(let a=o;a<s.length;a++){let l=s[a-1];a%o==0?l=c(vm(l))^bm[a/o-1]:o>6&&a%o==4&&(l=c(l)),s[a]=s[a-o]^l}return(0,ee.clean)(...r),s}function Pr(t){const e=wt(t),n=e.slice(),r=e.length,{sbox2:i}=Ra,{T0:o,T1:c,T2:s,T3:a}=Qd;for(let l=0;l<r;l+=4)for(let u=0;u<4;u++)n[l+u]=e[r-l-4+u];(0,ee.clean)(e);for(let l=4;l<r-4;l++){const u=n[l],d=Rt(i,u,u,u,u);n[l]=o[255&d]^c[d>>>8&255]^s[d>>>16&255]^a[d>>>24]}return n}function mn(t,e,n,r,i,o){return t[n<<8&65280|r>>>8&255]^e[i>>>8&65280|o>>>24&255]}function Rt(t,e,n,r,i){return t[255&e|65280&n]|t[r>>>16&255|i>>>16&65280]<<16}function qe(t,e,n,r,i){const{sbox2:o,T01:c,T23:s}=Ra;let a=0;e^=t[a++],n^=t[a++],r^=t[a++],i^=t[a++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[a++]^mn(c,s,e,n,r,i),h=t[a++]^mn(c,s,n,r,i,e),f=t[a++]^mn(c,s,r,i,e,n),g=t[a++]^mn(c,s,i,e,n,r);e=d,n=h,r=f,i=g}return{s0:t[a++]^Rt(o,e,n,r,i),s1:t[a++]^Rt(o,n,r,i,e),s2:t[a++]^Rt(o,r,i,e,n),s3:t[a++]^Rt(o,i,e,n,r)}}function Or(t,e,n,r,i){const{sbox2:o,T01:c,T23:s}=Qd;let a=0;e^=t[a++],n^=t[a++],r^=t[a++],i^=t[a++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[a++]^mn(c,s,e,i,r,n),h=t[a++]^mn(c,s,n,e,i,r),f=t[a++]^mn(c,s,r,n,e,i),g=t[a++]^mn(c,s,i,r,n,e);e=d,n=h,r=f,i=g}return{s0:t[a++]^Rt(o,e,i,r,n),s1:t[a++]^Rt(o,n,e,i,r),s2:t[a++]^Rt(o,r,n,e,i),s3:t[a++]^Rt(o,i,r,n,e)}}function Qn(t,e){if(e===void 0)return new Uint8Array(t);if((0,ve.bytes)(e),e.length<t)throw new Error(`aes: wrong destination length, expected at least ${t}, got: ${e.length}`);if(!(0,ee.isAligned32)(e))throw new Error("unaligned dst");return e}function eh(t,e,n,r){(0,ve.bytes)(e,Xe),(0,ve.bytes)(n);const i=n.length;r=Qn(i,r);const o=e,c=(0,ee.u32)(o);let{s0:s,s1:a,s2:l,s3:u}=qe(t,c[0],c[1],c[2],c[3]);const d=(0,ee.u32)(n),h=(0,ee.u32)(r);for(let g=0;g+4<=d.length;g+=4){h[g+0]=d[g+0]^s,h[g+1]=d[g+1]^a,h[g+2]=d[g+2]^l,h[g+3]=d[g+3]^u;let m=1;for(let w=o.length-1;w>=0;w--)m=m+(255&o[w])|0,o[w]=255&m,m>>>=8;({s0:s,s1:a,s2:l,s3:u}=qe(t,c[0],c[1],c[2],c[3]))}const f=Xe*Math.floor(d.length/4);if(f<i){const g=new Uint32Array([s,a,l,u]),m=(0,ee.u8)(g);for(let w=f,p=0;w<i;w++,p++)r[w]=n[w]^m[p];(0,ee.clean)(g)}return r}function Gn(t,e,n,r,i){(0,ve.bytes)(n,Xe),(0,ve.bytes)(r),i=Qn(r.length,i);const o=n,c=(0,ee.u32)(o),s=(0,ee.createView)(o),a=(0,ee.u32)(r),l=(0,ee.u32)(i),u=e?0:12,d=r.length;let h=s.getUint32(u,e),{s0:f,s1:g,s2:m,s3:w}=qe(t,c[0],c[1],c[2],c[3]);for(let S=0;S+4<=a.length;S+=4)l[S+0]=a[S+0]^f,l[S+1]=a[S+1]^g,l[S+2]=a[S+2]^m,l[S+3]=a[S+3]^w,h=h+1>>>0,s.setUint32(u,h,e),{s0:f,s1:g,s2:m,s3:w}=qe(t,c[0],c[1],c[2],c[3]);const p=Xe*Math.floor(a.length/4);if(p<d){const S=new Uint32Array([f,g,m,w]),_=(0,ee.u8)(S);for(let P=p,I=0;P<d;P++,I++)i[P]=r[P]^_[I];(0,ee.clean)(S)}return i}function zc(t){if((0,ve.bytes)(t),t.length%Xe!=0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function qc(t,e,n){(0,ve.bytes)(t);let r=t.length;const i=r%Xe;if(!e&&i!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,ee.isAligned32)(t)||(t=(0,ee.copyBytes)(t));const o=(0,ee.u32)(t);if(e){let s=Xe-i;s||(s=Xe),r+=s}const c=Qn(r,n);return{b:o,o:(0,ee.u32)(c),out:c}}function Vc(t,e){if(!e)return t;const n=t.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=t[n-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const i=t.subarray(0,-r);for(let o=0;o<r;o++)if(t[n-o-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function Wc(t){const e=new Uint8Array(16),n=(0,ee.u32)(e);e.set(t);const r=Xe-t.length;for(let i=Xe-r;i<Xe;i++)e[i]=r;return n}function th(t,e,n,r,i){const o=i==null?0:i.length,c=t.create(n,r.length+o);i&&c.update(i),c.update(r);const s=new Uint8Array(16),a=(0,ee.createView)(s);i&&(0,ee.setBigUint64)(a,0,BigInt(8*o),e),(0,ee.setBigUint64)(a,8,BigInt(8*r.length),e),c.update(s);const l=c.digest();return(0,ee.clean)(s),l}Ae.ctr=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e){function n(r,i){if((0,ve.bytes)(r),i!==void 0&&((0,ve.bytes)(i),!(0,ee.isAligned32)(i)))throw new Error("unaligned destination");const o=wt(t),c=(0,ee.copyBytes)(e),s=[o,c];(0,ee.isAligned32)(r)||s.push(r=(0,ee.copyBytes)(r));const a=eh(o,c,r,i);return(0,ee.clean)(...s),a}return(0,ve.bytes)(t),(0,ve.bytes)(e,Xe),{encrypt:(r,i)=>n(r,i),decrypt:(r,i)=>n(r,i)}}),Ae.ecb=(0,ee.wrapCipher)({blockSize:16},function(t,e={}){(0,ve.bytes)(t);const n=!e.disablePadding;return{encrypt(r,i){const{b:o,o:c,out:s}=qc(r,n,i),a=wt(t);let l=0;for(;l+4<=o.length;){const{s0:u,s1:d,s2:h,s3:f}=qe(a,o[l+0],o[l+1],o[l+2],o[l+3]);c[l++]=u,c[l++]=d,c[l++]=h,c[l++]=f}if(n){const u=Wc(r.subarray(4*l)),{s0:d,s1:h,s2:f,s3:g}=qe(a,u[0],u[1],u[2],u[3]);c[l++]=d,c[l++]=h,c[l++]=f,c[l++]=g}return(0,ee.clean)(a),s},decrypt(r,i){zc(r);const o=Pr(t),c=Qn(r.length,i),s=[o];(0,ee.isAligned32)(r)||s.push(r=(0,ee.copyBytes)(r));const a=(0,ee.u32)(r),l=(0,ee.u32)(c);for(let u=0;u+4<=a.length;){const{s0:d,s1:h,s2:f,s3:g}=Or(o,a[u+0],a[u+1],a[u+2],a[u+3]);l[u++]=d,l[u++]=h,l[u++]=f,l[u++]=g}return(0,ee.clean)(...s),Vc(c,n)}}}),Ae.cbc=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e,n={}){(0,ve.bytes)(t),(0,ve.bytes)(e,16);const r=!n.disablePadding;return{encrypt(i,o){const c=wt(t),{b:s,o:a,out:l}=qc(i,r,o);let u=e;const d=[c];(0,ee.isAligned32)(u)||d.push(u=(0,ee.copyBytes)(u));const h=(0,ee.u32)(u);let f=h[0],g=h[1],m=h[2],w=h[3],p=0;for(;p+4<=s.length;)f^=s[p+0],g^=s[p+1],m^=s[p+2],w^=s[p+3],{s0:f,s1:g,s2:m,s3:w}=qe(c,f,g,m,w),a[p++]=f,a[p++]=g,a[p++]=m,a[p++]=w;if(r){const S=Wc(i.subarray(4*p));f^=S[0],g^=S[1],m^=S[2],w^=S[3],{s0:f,s1:g,s2:m,s3:w}=qe(c,f,g,m,w),a[p++]=f,a[p++]=g,a[p++]=m,a[p++]=w}return(0,ee.clean)(...d),l},decrypt(i,o){zc(i);const c=Pr(t);let s=e;const a=[c];(0,ee.isAligned32)(s)||a.push(s=(0,ee.copyBytes)(s));const l=(0,ee.u32)(s),u=Qn(i.length,o);(0,ee.isAligned32)(i)||a.push(i=(0,ee.copyBytes)(i));const d=(0,ee.u32)(i),h=(0,ee.u32)(u);let f=l[0],g=l[1],m=l[2],w=l[3];for(let p=0;p+4<=d.length;){const S=f,_=g,P=m,I=w;f=d[p+0],g=d[p+1],m=d[p+2],w=d[p+3];const{s0:K,s1:q,s2:F,s3:U}=Or(c,f,g,m,w);h[p++]=K^S,h[p++]=q^_,h[p++]=F^P,h[p++]=U^I}return(0,ee.clean)(...a),Vc(u,r)}}}),Ae.cfb=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e){function n(r,i,o){(0,ve.bytes)(r);const c=r.length;o=Qn(c,o);const s=wt(t);let a=e;const l=[s];(0,ee.isAligned32)(a)||l.push(a=(0,ee.copyBytes)(a)),(0,ee.isAligned32)(r)||l.push(r=(0,ee.copyBytes)(r));const u=(0,ee.u32)(r),d=(0,ee.u32)(o),h=i?d:u,f=(0,ee.u32)(a);let g=f[0],m=f[1],w=f[2],p=f[3];for(let _=0;_+4<=u.length;){const{s0:P,s1:I,s2:K,s3:q}=qe(s,g,m,w,p);d[_+0]=u[_+0]^P,d[_+1]=u[_+1]^I,d[_+2]=u[_+2]^K,d[_+3]=u[_+3]^q,g=h[_++],m=h[_++],w=h[_++],p=h[_++]}const S=Xe*Math.floor(u.length/4);if(S<c){({s0:g,s1:m,s2:w,s3:p}=qe(s,g,m,w,p));const _=(0,ee.u8)(new Uint32Array([g,m,w,p]));for(let P=S,I=0;P<c;P++,I++)o[P]=r[P]^_[I];(0,ee.clean)(_)}return(0,ee.clean)(...l),o}return(0,ve.bytes)(t),(0,ve.bytes)(e,16),{encrypt:(r,i)=>n(r,!0,i),decrypt:(r,i)=>n(r,!1,i)}}),Ae.gcm=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(t,e,n){if((0,ve.bytes)(t),(0,ve.bytes)(e),n!==void 0&&(0,ve.bytes)(n),e.length<8)throw new Error("aes/gcm: invalid nonce length");const r=16;function i(c,s,a){const l=th(Fs.ghash,!1,c,a,n);for(let u=0;u<s.length;u++)l[u]^=s[u];return l}function o(){const c=wt(t),s=ci.slice(),a=ci.slice();if(Gn(c,!1,a,a,s),e.length===12)a.set(e);else{const l=ci.slice(),u=(0,ee.createView)(l);(0,ee.setBigUint64)(u,8,BigInt(8*e.length),!1);const d=Fs.ghash.create(s).update(e).update(l);d.digestInto(a),d.destroy()}return{xk:c,authKey:s,counter:a,tagMask:Gn(c,!1,a,ci)}}return{encrypt(c){(0,ve.bytes)(c);const{xk:s,authKey:a,counter:l,tagMask:u}=o(),d=new Uint8Array(c.length+r),h=[s,a,l,u];(0,ee.isAligned32)(c)||h.push(c=(0,ee.copyBytes)(c)),Gn(s,!1,l,c,d);const f=i(a,u,d.subarray(0,d.length-r));return h.push(f),d.set(f,c.length),(0,ee.clean)(...h),d},decrypt(c){if((0,ve.bytes)(c),c.length<r)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:s,authKey:a,counter:l,tagMask:u}=o(),d=[s,a,u,l];(0,ee.isAligned32)(c)||d.push(c=(0,ee.copyBytes)(c));const h=c.subarray(0,-16),f=c.subarray(-16),g=i(a,u,h);if(d.push(g),!(0,ee.equalBytes)(g,f))throw new Error("aes/gcm: invalid ghash tag");const m=Gn(s,!1,l,h);return(0,ee.clean)(...d),m}}});const li=(t,e,n)=>r=>{if(!Number.isSafeInteger(r)||e>r||r>n)throw new Error(`${t}: invalid value=${r}, must be [${e}..${n}]`)};function nh(t){return t!=null&&typeof t=="object"&&(t instanceof Uint32Array||t.constructor.name==="Uint32Array")}function rh(t,e){if((0,ve.bytes)(e,16),!nh(t))throw new Error("_encryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:c}=qe(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=c,e}function ih(t,e){if((0,ve.bytes)(e,16),!nh(t))throw new Error("_decryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:c}=Or(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=c,e}Ae.siv=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(t,e,n){const r=li("AAD",0,68719476736),i=li("plaintext",0,2**36),o=li("nonce",12,12),c=li("ciphertext",16,2**36+16);function s(){const u=wt(t),d=new Uint8Array(t.length),h=new Uint8Array(16),f=[u,d];let g=e;(0,ee.isAligned32)(g)||f.push(g=(0,ee.copyBytes)(g));const m=(0,ee.u32)(g);let w=0,p=m[0],S=m[1],_=m[2],P=0;for(const K of[h,d].map(ee.u32)){const q=(0,ee.u32)(K);for(let F=0;F<q.length;F+=2){const{s0:U,s1:j}=qe(u,w,p,S,_);q[F+0]=U,q[F+1]=j,w=++P}}const I={authKey:h,encKey:wt(d)};return(0,ee.clean)(...f),I}function a(u,d,h){const f=th(Fs.polyval,!0,d,h,n);for(let _=0;_<12;_++)f[_]^=e[_];f[15]&=127;const g=(0,ee.u32)(f);let m=g[0],w=g[1],p=g[2],S=g[3];return{s0:m,s1:w,s2:p,s3:S}=qe(u,m,w,p,S),g[0]=m,g[1]=w,g[2]=p,g[3]=S,f}function l(u,d,h){let f=(0,ee.copyBytes)(d);f[15]|=128;const g=Gn(u,!0,f,h);return(0,ee.clean)(f),g}return(0,ve.bytes)(t,16,24,32),(0,ve.bytes)(e),o(e.length),n!==void 0&&((0,ve.bytes)(n),r(n.length)),{encrypt(u){(0,ve.bytes)(u),i(u.length);const{encKey:d,authKey:h}=s(),f=a(d,h,u),g=[d,h,f];(0,ee.isAligned32)(u)||g.push(u=(0,ee.copyBytes)(u));const m=new Uint8Array(u.length+16);return m.set(f,u.length),m.set(l(d,f,u)),(0,ee.clean)(...g),m},decrypt(u){(0,ve.bytes)(u),c(u.length);const d=u.subarray(-16),{encKey:h,authKey:f}=s(),g=[h,f];(0,ee.isAligned32)(u)||g.push(u=(0,ee.copyBytes)(u));const m=l(h,d,u.subarray(0,-16)),w=a(h,f,m);if(g.push(w),!(0,ee.equalBytes)(d,w))throw(0,ee.clean)(...g),new Error("invalid polyval tag");return(0,ee.clean)(...g),m}}});const Zi={encrypt(t,e){if(e.length>=2**32)throw new Error("plaintext should be less than 4gb");const n=wt(t);if(e.length===16)rh(n,e);else{const r=(0,ee.u32)(e);let i=r[0],o=r[1];for(let c=0,s=1;c<6;c++)for(let a=2;a<r.length;a+=2,s++){const{s0:l,s1:u,s2:d,s3:h}=qe(n,i,o,r[a],r[a+1]);i=l,o=u^Yi(s),r[a]=d,r[a+1]=h}r[0]=i,r[1]=o}n.fill(0)},decrypt(t,e){if(e.length-8>=2**32)throw new Error("ciphertext should be less than 4gb");const n=Pr(t),r=e.length/8-1;if(r===1)ih(n,e);else{const i=(0,ee.u32)(e);let o=i[0],c=i[1];for(let s=0,a=6*r;s<6;s++)for(let l=2*r;l>=1;l-=2,a--){c^=Yi(a);const{s0:u,s1:d,s2:h,s3:f}=Or(n,o,c,i[l],i[l+1]);o=u,c=d,i[l]=h,i[l+1]=f}i[0]=o,i[1]=c}n.fill(0)}},Gc=new Uint8Array(8).fill(166);Ae.aeskw=(0,ee.wrapCipher)({blockSize:8},t=>({encrypt(e){if((0,ve.bytes)(e),!e.length||e.length%8!=0)throw new Error("invalid plaintext length");if(e.length===8)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const n=(0,ee.concatBytes)(Gc,e);return Zi.encrypt(t,n),n},decrypt(e){if((0,ve.bytes)(e),e.length%8!=0||e.length<24)throw new Error("invalid ciphertext length");const n=(0,ee.copyBytes)(e);if(Zi.decrypt(t,n),!(0,ee.equalBytes)(n.subarray(0,8),Gc))throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}}));const Yc=2790873510;Ae.aeskwp=(0,ee.wrapCipher)({blockSize:8},t=>({encrypt(e){if((0,ve.bytes)(e),!e.length)throw new Error("invalid plaintext length");const n=8*Math.ceil(e.length/8),r=new Uint8Array(8+n);r.set(e,8);const i=(0,ee.u32)(r);return i[0]=Yc,i[1]=Yi(e.length),Zi.encrypt(t,r),r},decrypt(e){if((0,ve.bytes)(e),e.length<16)throw new Error("invalid ciphertext length");const n=(0,ee.copyBytes)(e),r=(0,ee.u32)(n);Zi.decrypt(t,n);const i=Yi(r[1])>>>0,o=8*Math.ceil(i/8);if(r[0]!==Yc||n.length-8!==o)throw new Error("integrity check failed");for(let c=i;c<o;c++)if(n[8+c]!==0)throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}})),Ae.unsafe={expandKeyLE:wt,expandKeyDecLE:Pr,encrypt:qe,decrypt:Or,encryptBlock:rh,decryptBlock:ih,ctrCounter:eh,ctr32:Gn},Object.defineProperty(Xn,"__esModule",{value:!0}),Xn.aes256cbc=Xn.aes256gcm=void 0;var oh=Ae;Xn.aes256gcm=function(t,e,n){return(0,oh.gcm)(t,e,n)};Xn.aes256cbc=function(t,e,n){return(0,oh.cbc)(t,e)};var Ji={},sh={},Yn={};Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.sigma=void 0,Yn.rotl=function(t,e){return t<<e|t>>>32-e},Yn.createCipher=function(t,e){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:c}=(0,ut.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return(0,Kt.number)(i),(0,Kt.number)(c),(0,Kt.bool)(o),(0,Kt.bool)(n),(s,a,l,u,d=0)=>{(0,Kt.bytes)(s),(0,Kt.bytes)(a),(0,Kt.bytes)(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),(0,Kt.bytes)(u),(0,Kt.number)(d),d<0||d>=Zc)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let g,m,w=s.length;if(w===32)f.push(g=(0,ut.copyBytes)(s)),m=ch;else{if(w!==16||!n)throw new Error(`arx: invalid 32-byte key, got length=${w}`);g=new Uint8Array(32),g.set(s),g.set(s,16),m=_m,f.push(g)}Xo(a)||f.push(a=(0,ut.copyBytes)(a));const p=(0,ut.u32)(g);if(r){if(a.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,p,(0,ut.u32)(a.subarray(0,16)),p),a=a.subarray(16)}const S=16-i;if(S!==a.length)throw new Error(`arx: nonce must be ${S} or 16 bytes`);if(S!==12){const P=new Uint8Array(12);P.set(a,o?0:12-a.length),a=P,f.push(a)}const _=(0,ut.u32)(a);return function(P,I,K,q,F,U,j,G){const $=F.length,N=new Uint8Array(ui),R=(0,ut.u32)(N),C=Xo(F)&&Xo(U),O=C?(0,ut.u32)(F):Jc,D=C?(0,ut.u32)(U):Jc;for(let y=0;y<$;j++){if(P(I,K,q,R,j,G),j>=Zc)throw new Error("arx: counter overflow");const E=Math.min(ui,$-y);if(C&&E===ui){const k=y/4;if(y%4!=0)throw new Error("arx: invalid block position");for(let x,b=0;b<Sm;b++)x=k+b,D[x]=O[x]^R[b];y+=ui}else{for(let k,x=0;x<E;x++)k=y+x,U[k]=F[k]^N[x];y+=E}}}(t,m,p,_,l,u,d,c),(0,ut.clean)(...f),u}};const Kt=Ue,ut=ot,ah=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),wm=ah("expand 16-byte k"),Em=ah("expand 32-byte k"),_m=(0,ut.u32)(wm),ch=(0,ut.u32)(Em);function Xo(t){return t.byteOffset%4==0}Yn.sigma=ch.slice();const ui=64,Sm=16,Zc=2**32-1,Jc=new Uint32Array;var Er={};Object.defineProperty(Er,"__esModule",{value:!0}),Er.poly1305=void 0,Er.wrapConstructorWithKey=lh;const di=Ue,yr=ot,Ne=(t,e)=>255&t[e++]|(255&t[e++])<<8;class Cm{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=(0,yr.toBytes)(e),(0,di.bytes)(e,32);const n=Ne(e,0),r=Ne(e,2),i=Ne(e,4),o=Ne(e,6),c=Ne(e,8),s=Ne(e,10),a=Ne(e,12),l=Ne(e,14);this.r[0]=8191&n,this.r[1]=8191&(n>>>13|r<<3),this.r[2]=7939&(r>>>10|i<<6),this.r[3]=8191&(i>>>7|o<<9),this.r[4]=255&(o>>>4|c<<12),this.r[5]=c>>>1&8190,this.r[6]=8191&(c>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Ne(e,16+2*u)}process(e,n,r=!1){const i=r?0:2048,{h:o,r:c}=this,s=c[0],a=c[1],l=c[2],u=c[3],d=c[4],h=c[5],f=c[6],g=c[7],m=c[8],w=c[9],p=Ne(e,n+0),S=Ne(e,n+2),_=Ne(e,n+4),P=Ne(e,n+6),I=Ne(e,n+8),K=Ne(e,n+10),q=Ne(e,n+12),F=Ne(e,n+14);let U=o[0]+(8191&p),j=o[1]+(8191&(p>>>13|S<<3)),G=o[2]+(8191&(S>>>10|_<<6)),$=o[3]+(8191&(_>>>7|P<<9)),N=o[4]+(8191&(P>>>4|I<<12)),R=o[5]+(I>>>1&8191),C=o[6]+(8191&(I>>>14|K<<2)),O=o[7]+(8191&(K>>>11|q<<5)),D=o[8]+(8191&(q>>>8|F<<8)),y=o[9]+(F>>>5|i),E=0,k=E+U*s+j*(5*w)+G*(5*m)+$*(5*g)+N*(5*f);E=k>>>13,k&=8191,k+=R*(5*h)+C*(5*d)+O*(5*u)+D*(5*l)+y*(5*a),E+=k>>>13,k&=8191;let x=E+U*a+j*s+G*(5*w)+$*(5*m)+N*(5*g);E=x>>>13,x&=8191,x+=R*(5*f)+C*(5*h)+O*(5*d)+D*(5*u)+y*(5*l),E+=x>>>13,x&=8191;let b=E+U*l+j*a+G*s+$*(5*w)+N*(5*m);E=b>>>13,b&=8191,b+=R*(5*g)+C*(5*f)+O*(5*h)+D*(5*d)+y*(5*u),E+=b>>>13,b&=8191;let v=E+U*u+j*l+G*a+$*s+N*(5*w);E=v>>>13,v&=8191,v+=R*(5*m)+C*(5*g)+O*(5*f)+D*(5*h)+y*(5*d),E+=v>>>13,v&=8191;let A=E+U*d+j*u+G*l+$*a+N*s;E=A>>>13,A&=8191,A+=R*(5*w)+C*(5*m)+O*(5*g)+D*(5*f)+y*(5*h),E+=A>>>13,A&=8191;let T=E+U*h+j*d+G*u+$*l+N*a;E=T>>>13,T&=8191,T+=R*s+C*(5*w)+O*(5*m)+D*(5*g)+y*(5*f),E+=T>>>13,T&=8191;let M=E+U*f+j*h+G*d+$*u+N*l;E=M>>>13,M&=8191,M+=R*a+C*s+O*(5*w)+D*(5*m)+y*(5*g),E+=M>>>13,M&=8191;let L=E+U*g+j*f+G*h+$*d+N*u;E=L>>>13,L&=8191,L+=R*l+C*a+O*s+D*(5*w)+y*(5*m),E+=L>>>13,L&=8191;let B=E+U*m+j*g+G*f+$*h+N*d;E=B>>>13,B&=8191,B+=R*u+C*l+O*a+D*s+y*(5*w),E+=B>>>13,B&=8191;let H=E+U*w+j*m+G*g+$*f+N*h;E=H>>>13,H&=8191,H+=R*d+C*u+O*l+D*a+y*s,E+=H>>>13,H&=8191,E=(E<<2)+E|0,E=E+k|0,k=8191&E,E>>>=13,x+=E,o[0]=k,o[1]=x,o[2]=b,o[3]=v,o[4]=A,o[5]=T,o[6]=M,o[7]=L,o[8]=B,o[9]=H}finalize(){const{h:e,pad:n}=this,r=new Uint16Array(10);let i=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=i,i=e[s]>>>13,e[s]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let s=1;s<10;s++)r[s]=e[s]+i,i=r[s]>>>13,r[s]&=8191;r[9]-=8192;let o=(1^i)-1;for(let s=0;s<10;s++)r[s]&=o;o=~o;for(let s=0;s<10;s++)e[s]=e[s]&o|r[s];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let c=e[0]+n[0];e[0]=65535&c;for(let s=1;s<8;s++)c=(e[s]+n[s]|0)+(c>>>16)|0,e[s]=65535&c;(0,yr.clean)(r)}update(e){(0,di.exists)(this);const{buffer:n,blockLen:r}=this,i=(e=(0,yr.toBytes)(e)).length;for(let o=0;o<i;){const c=Math.min(r-this.pos,i-o);if(c!==r)n.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(n,0,!1),this.pos=0);else for(;r<=i-o;o+=r)this.process(e,o)}return this}destroy(){(0,yr.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,di.exists)(this),(0,di.output)(e,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:i}=this;if(i){for(n[i++]=1;i<16;i++)n[i]=0;this.process(n,0,!0)}this.finalize();let o=0;for(let c=0;c<8;c++)e[o++]=r[c]>>>0,e[o++]=r[c]>>>8;return e}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}}function lh(t){const e=(r,i)=>t(i).update((0,yr.toBytes)(r)).digest(),n=t(new Uint8Array(32));return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>t(r),e}Er.poly1305=lh(t=>new Cm(t)),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.xchacha20poly1305=t.chacha20poly1305=t._poly1305_aead=t.chacha12=t.chacha8=t.xchacha20=t.chacha20=t.chacha20orig=void 0,t.hchacha=c;const e=Yn,n=Ue,r=Er,i=ot;function o(d,h,f,g,m,w=20){let p=d[0],S=d[1],_=d[2],P=d[3],I=h[0],K=h[1],q=h[2],F=h[3],U=h[4],j=h[5],G=h[6],$=h[7],N=m,R=f[0],C=f[1],O=f[2],D=p,y=S,E=_,k=P,x=I,b=K,v=q,A=F,T=U,M=j,L=G,B=$,H=N,z=R,J=C,Q=O;for(let oe=0;oe<w;oe+=2)D=D+x|0,H=(0,e.rotl)(H^D,16),T=T+H|0,x=(0,e.rotl)(x^T,12),D=D+x|0,H=(0,e.rotl)(H^D,8),T=T+H|0,x=(0,e.rotl)(x^T,7),y=y+b|0,z=(0,e.rotl)(z^y,16),M=M+z|0,b=(0,e.rotl)(b^M,12),y=y+b|0,z=(0,e.rotl)(z^y,8),M=M+z|0,b=(0,e.rotl)(b^M,7),E=E+v|0,J=(0,e.rotl)(J^E,16),L=L+J|0,v=(0,e.rotl)(v^L,12),E=E+v|0,J=(0,e.rotl)(J^E,8),L=L+J|0,v=(0,e.rotl)(v^L,7),k=k+A|0,Q=(0,e.rotl)(Q^k,16),B=B+Q|0,A=(0,e.rotl)(A^B,12),k=k+A|0,Q=(0,e.rotl)(Q^k,8),B=B+Q|0,A=(0,e.rotl)(A^B,7),D=D+b|0,Q=(0,e.rotl)(Q^D,16),L=L+Q|0,b=(0,e.rotl)(b^L,12),D=D+b|0,Q=(0,e.rotl)(Q^D,8),L=L+Q|0,b=(0,e.rotl)(b^L,7),y=y+v|0,H=(0,e.rotl)(H^y,16),B=B+H|0,v=(0,e.rotl)(v^B,12),y=y+v|0,H=(0,e.rotl)(H^y,8),B=B+H|0,v=(0,e.rotl)(v^B,7),E=E+A|0,z=(0,e.rotl)(z^E,16),T=T+z|0,A=(0,e.rotl)(A^T,12),E=E+A|0,z=(0,e.rotl)(z^E,8),T=T+z|0,A=(0,e.rotl)(A^T,7),k=k+x|0,J=(0,e.rotl)(J^k,16),M=M+J|0,x=(0,e.rotl)(x^M,12),k=k+x|0,J=(0,e.rotl)(J^k,8),M=M+J|0,x=(0,e.rotl)(x^M,7);let te=0;g[te++]=p+D|0,g[te++]=S+y|0,g[te++]=_+E|0,g[te++]=P+k|0,g[te++]=I+x|0,g[te++]=K+b|0,g[te++]=q+v|0,g[te++]=F+A|0,g[te++]=U+T|0,g[te++]=j+M|0,g[te++]=G+L|0,g[te++]=$+B|0,g[te++]=N+H|0,g[te++]=R+z|0,g[te++]=C+J|0,g[te++]=O+Q|0}function c(d,h,f,g){let m=d[0],w=d[1],p=d[2],S=d[3],_=h[0],P=h[1],I=h[2],K=h[3],q=h[4],F=h[5],U=h[6],j=h[7],G=f[0],$=f[1],N=f[2],R=f[3];for(let O=0;O<20;O+=2)m=m+_|0,G=(0,e.rotl)(G^m,16),q=q+G|0,_=(0,e.rotl)(_^q,12),m=m+_|0,G=(0,e.rotl)(G^m,8),q=q+G|0,_=(0,e.rotl)(_^q,7),w=w+P|0,$=(0,e.rotl)($^w,16),F=F+$|0,P=(0,e.rotl)(P^F,12),w=w+P|0,$=(0,e.rotl)($^w,8),F=F+$|0,P=(0,e.rotl)(P^F,7),p=p+I|0,N=(0,e.rotl)(N^p,16),U=U+N|0,I=(0,e.rotl)(I^U,12),p=p+I|0,N=(0,e.rotl)(N^p,8),U=U+N|0,I=(0,e.rotl)(I^U,7),S=S+K|0,R=(0,e.rotl)(R^S,16),j=j+R|0,K=(0,e.rotl)(K^j,12),S=S+K|0,R=(0,e.rotl)(R^S,8),j=j+R|0,K=(0,e.rotl)(K^j,7),m=m+P|0,R=(0,e.rotl)(R^m,16),U=U+R|0,P=(0,e.rotl)(P^U,12),m=m+P|0,R=(0,e.rotl)(R^m,8),U=U+R|0,P=(0,e.rotl)(P^U,7),w=w+I|0,G=(0,e.rotl)(G^w,16),j=j+G|0,I=(0,e.rotl)(I^j,12),w=w+I|0,G=(0,e.rotl)(G^w,8),j=j+G|0,I=(0,e.rotl)(I^j,7),p=p+K|0,$=(0,e.rotl)($^p,16),q=q+$|0,K=(0,e.rotl)(K^q,12),p=p+K|0,$=(0,e.rotl)($^p,8),q=q+$|0,K=(0,e.rotl)(K^q,7),S=S+_|0,N=(0,e.rotl)(N^S,16),F=F+N|0,_=(0,e.rotl)(_^F,12),S=S+_|0,N=(0,e.rotl)(N^S,8),F=F+N|0,_=(0,e.rotl)(_^F,7);let C=0;g[C++]=m,g[C++]=w,g[C++]=p,g[C++]=S,g[C++]=G,g[C++]=$,g[C++]=N,g[C++]=R}t.chacha20orig=(0,e.createCipher)(o,{counterRight:!1,counterLength:8,allowShortKeys:!0}),t.chacha20=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,allowShortKeys:!1}),t.xchacha20=(0,e.createCipher)(o,{counterRight:!1,counterLength:8,extendNonceFn:c,allowShortKeys:!1}),t.chacha8=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,rounds:8}),t.chacha12=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,rounds:12});const s=new Uint8Array(16),a=(d,h)=>{d.update(h);const f=h.length%16;f&&d.update(s.subarray(f))},l=new Uint8Array(32);function u(d,h,f,g,m){const w=d(h,f,l),p=r.poly1305.create(w);m&&a(p,m),a(p,g);const S=new Uint8Array(16),_=(0,i.createView)(S);(0,i.setBigUint64)(_,0,BigInt(m?m.length:0),!0),(0,i.setBigUint64)(_,8,BigInt(g.length),!0),p.update(S);const P=p.digest();return(0,i.clean)(w,S),P}t._poly1305_aead=d=>(h,f,g)=>((0,n.bytes)(h,32),(0,n.bytes)(f),{encrypt(w,p){const S=w.length,_=S+16;p?(0,n.bytes)(p,_):p=new Uint8Array(_),d(h,f,w,p,1);const P=u(d,h,f,p.subarray(0,-16),g);return p.set(P,S),(0,i.clean)(P),p},decrypt(w,p){const S=w.length,_=S-16;if(S<16)throw new Error("encrypted data must be at least 16 bytes");p?(0,n.bytes)(p,_):p=new Uint8Array(_);const P=w.subarray(0,-16),I=w.subarray(-16),K=u(d,h,f,P,g);if(!(0,i.equalBytes)(I,K))throw new Error("invalid tag");return d(h,f,P,p,1),(0,i.clean)(K),p}}),t.chacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,t._poly1305_aead)(t.chacha20)),t.xchacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,t._poly1305_aead)(t.xchacha20))}(sh),Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.xchacha20=void 0;var jn,Xc,hr,Am=sh;Ji.xchacha20=function(t,e,n){return(0,Am.xchacha20poly1305)(t,e,n)},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.aesDecrypt=t.aesEncrypt=t.symDecrypt=t.symEncrypt=void 0;var e=ot,n=_a,r=Xn,i=Ji,o=Mr,c=Oe;t.symEncrypt=function(u,d,h){return s(a,u,d,h)};function s(u,d,h,f){var g=(0,o.symmetricAlgorithm)();if(g==="aes-256-gcm")return u(r.aes256gcm,d,h,(0,o.symmetricNonceLength)(),c.AEAD_TAG_LENGTH,f);if(g==="xchacha20")return u(i.xchacha20,d,h,c.XCHACHA20_NONCE_LENGTH,c.AEAD_TAG_LENGTH,f);if(g==="aes-256-cbc")return u(r.aes256cbc,d,h,16,0);throw new Error("Not implemented")}function a(u,d,h,f,g,m){var w=(0,n.randomBytes)(f),p=u(d,w,m).encrypt(h);if(g===0)return(0,e.concatBytes)(w,p);var S=p.length-g,_=p.subarray(0,S),P=p.subarray(S);return(0,e.concatBytes)(w,P,_)}function l(u,d,h,f,g,m){var w=h.subarray(0,f),p=u(d,Uint8Array.from(w),m),S=h.subarray(f);if(g===0)return p.decrypt(S);var _=S.subarray(0,g),P=S.subarray(g);return p.decrypt((0,e.concatBytes)(P,_))}t.symDecrypt=function(u,d,h){return s(l,u,d,h)},t.aesEncrypt=t.symEncrypt,t.aesDecrypt=t.symDecrypt}(Hc),jn=Eo,Xc=mt&&mt.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),hr=mt&&mt.__exportStar||function(t,e){for(var n in t)n==="default"||Object.prototype.hasOwnProperty.call(e,n)||Xc(e,t,n)},Object.defineProperty(jn,"__esModule",{value:!0}),hr(dd,jn),hr(Vd,jn),hr(Us,jn),hr(Hc,jn);var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.PublicKey=void 0;var Qc=ot,hi=Eo,km=function(){function t(e){this.data=(0,hi.convertPublicKeyFormat)(e,!0)}return t.fromHex=function(e){return new t((0,hi.hexToPublicKey)(e))},Object.defineProperty(t.prototype,"uncompressed",{get:function(){return X.from((0,hi.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"compressed",{get:function(){return X.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(e){return e===void 0&&(e=!0),(0,Qc.bytesToHex)(e?this.data:this.uncompressed)},t.prototype.decapsulate=function(e,n){n===void 0&&(n=!1);var r=n?this.data:this.uncompressed,i=e.multiply(this,n);return(0,hi.getSharedKey)(r,i)},t.prototype.equals=function(e){return(0,Qc.equalBytes)(this.data,e.data)},t}();Ir.PublicKey=km,Object.defineProperty(qi,"__esModule",{value:!0}),qi.PrivateKey=void 0;var el=ot,Un=Eo,Tm=Ir,xm=function(){function t(e){if(e===void 0)this.data=(0,Un.getValidSecret)();else{if(!(0,Un.isValidPrivateKey)(e))throw new Error("Invalid private key");this.data=e}this.publicKey=new Tm.PublicKey((0,Un.getPublicKey)(this.data))}return t.fromHex=function(e){return new t((0,Un.decodeHex)(e))},Object.defineProperty(t.prototype,"secret",{get:function(){return X.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(){return(0,el.bytesToHex)(this.data)},t.prototype.encapsulate=function(e,n){n===void 0&&(n=!1);var r=n?this.publicKey.compressed:this.publicKey.uncompressed,i=this.multiply(e,n);return(0,Un.getSharedKey)(r,i)},t.prototype.multiply=function(e,n){return n===void 0&&(n=!1),(0,Un.getSharedPoint)(this.data,e.compressed,n)},t.prototype.equals=function(e){return(0,el.equalBytes)(this.data,e.data)},t}();qi.PrivateKey=xm,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PublicKey=t.PrivateKey=void 0;var e=qi;Object.defineProperty(t,"PrivateKey",{enumerable:!0,get:function(){return e.PrivateKey}});var n=Ir;Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})}(Bo),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.PublicKey=t.PrivateKey=t.ECIES_CONFIG=void 0,t.encrypt=function(s,a){var l=new r.PrivateKey,u=s instanceof Uint8Array?new r.PublicKey(s):r.PublicKey.fromHex(s),d=l.encapsulate(u,(0,n.isHkdfKeyCompressed)()),h=(0,n.isEphemeralKeyCompressed)()?l.publicKey.compressed:l.publicKey.uncompressed,f=(0,i.symEncrypt)(d,a);return X.from((0,e.concatBytes)(h,f))},t.decrypt=function(s,a){var l=s instanceof Uint8Array?new r.PrivateKey(s):r.PrivateKey.fromHex(s),u=(0,n.ephemeralKeySize)(),d=new r.PublicKey(a.subarray(0,u)),h=a.subarray(u),f=d.decapsulate(l,(0,n.isHkdfKeyCompressed)());return X.from((0,i.symDecrypt)(f,h))};var e=ot,n=Mr,r=Bo,i=Eo,o=Mr;Object.defineProperty(t,"ECIES_CONFIG",{enumerable:!0,get:function(){return o.ECIES_CONFIG}});var c=Bo;Object.defineProperty(t,"PrivateKey",{enumerable:!0,get:function(){return c.PrivateKey}}),Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return c.PublicKey}}),t.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}}(Fn);const uh=Ve("KeyExchange:Layer"),dh=Ve("SocketService:Layer"),hh=Ve("Ecies:Layer"),fh=Ve("RemoteCommunication:Layer");uh.color="##95c44e",dh.color="#f638d7",hh.color="#465b9c",fh.color="#47a2be";const V={KeyExchange:uh,SocketService:dh,Ecies:hh,RemoteCommunication:fh};let fr,fi=[],Qo=[];const Yt=(t,e)=>Z(void 0,void 0,void 0,function*(){fr=e,Qo.push(t),function(n){return Z(this,void 0,void 0,function*(){if(!fr||!n)return;(function(){const c=Qo;Qo=fi,fi=c})();const r=fr.endsWith("/")?`${fr}evt`:`${fr}/evt`,i=Object.assign({},n);if(delete i.params,n.params)for(const[c,s]of Object.entries(n.params))i[c]=s;const o=JSON.stringify(i);V.RemoteCommunication(`[sendBufferedEvents] Sending ${fi.length} analytics events to ${r}`);try{const c=yield Au(r,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:o}),s=yield c.text();V.RemoteCommunication(`[sendBufferedEvents] Response: ${s}`),fi.length=0}catch{}})}(t).catch(()=>{})});class es{constructor(e){this.enabled=!0,e!=null&&e.debug&&Ve.enable("Ecies:Layer"),this.ecies=e!=null&&e.privateKey?Fn.PrivateKey.fromHex(e.privateKey):new Fn.PrivateKey,V.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),V.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),V.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new Fn.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,n){let r=e;if(this.enabled)try{V.Ecies("[ECIES: encrypt()] using otherPublicKey",n);const i=X.from(e),o=Fn.encrypt(n,i);r=X.from(o).toString("base64")}catch(i){throw V.Ecies("[ECIES: encrypt()] error encrypt:",i),V.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),V.Ecies("[ECIES: encrypt()] data: ",e),V.Ecies("[ECIES: encrypt()] otherkey: ",n),i}return r}decrypt(e){let n=e;if(this.enabled)try{V.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());const r=X.from(e.toString(),"base64");n=Fn.decrypt(this.ecies.toHex(),r).toString()}catch(r){throw V.Ecies("[ECIES: decrypt()] error decrypt",r),V.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),V.Ecies("[ECIES: decrypt()] encryptedData: ",e),r}return n}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){V.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var wn={version:"0.33.1"};const In="https://metamask-sdk.api.cx.metamask.io/",Mm=["websocket"],rr=6048e5,Rm=3e3,Ke={METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_WATCHASSET:"wallet_watchAsset",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},Pm=[Ke.METAMASK_CONNECTSIGN,Ke.METAMASK_CONNECTWITH,Ke.METAMASK_OPEN,Ke.METAMASK_BATCH,Ke.PERSONAL_SIGN,Ke.WALLET_REQUESTPERMISSIONS,Ke.WALLET_REVOKEPERMISSIONS,Ke.WALLET_WATCHASSET,Ke.ETH_SENDTRANSACTION,Ke.ETH_SIGNTYPEDDATA,Ke.ETH_SIGNTYPEDDATA_V3,Ke.ETH_SIGNTYPEDDATA_V4,Ke.ETH_SIGNTRANSACTION,Ke.ETH_SIGN,Ke.PERSONAL_EC_RECOVER];function Wr(t){return Pm.includes(t)}function ph(t){const{context:e}=t;V.RemoteCommunication(`[RemoteCommunication: clean()] context=${e}`),t.channelConfig=void 0,t.ready=!1,t.originatorConnectStarted=!1}exports.ConnectionStatus=void 0;exports.EventType=void 0;var Xi,_e;exports.MessageType=void 0;var xe,Hn;(Hn=exports.ConnectionStatus||(exports.ConnectionStatus={})).DISCONNECTED="disconnected",Hn.WAITING="waiting",Hn.TIMEOUT="timeout",Hn.LINKED="linked",Hn.PAUSED="paused",Hn.TERMINATED="terminated",function(t){t.KEY_INFO="key_info",t.SERVICE_STATUS="service_status",t.PROVIDER_UPDATE="provider_update",t.RPC_UPDATE="rpc_update",t.KEYS_EXCHANGED="keys_exchanged",t.JOIN_CHANNEL="join_channel",t.PUBLIC_KEY="public_key",t.CHANNEL_CREATED="channel_created",t.CLIENTS_CONNECTED="clients_connected",t.CLIENTS_DISCONNECTED="clients_disconnected",t.CLIENTS_WAITING="clients_waiting",t.CLIENTS_READY="clients_ready",t.REJECTED="rejected",t.WALLET_INIT="wallet_init",t.CHANNEL_PERSISTENCE="channel_persistence",t.CONFIG="config",t.MESSAGE_ACK="ack",t.SOCKET_DISCONNECTED="socket_disconnected",t.SOCKET_RECONNECT="socket_reconnect",t.OTP="otp",t.SDK_RPC_CALL="sdk_rpc_call",t.AUTHORIZED="authorized",t.CONNECTION_STATUS="connection_status",t.MESSAGE="message",t.TERMINATE="terminate"}(exports.EventType||(exports.EventType={})),(Xi||(Xi={})).KEY_EXCHANGE="key_exchange",function(t){t.KEY_HANDSHAKE_START="key_handshake_start",t.KEY_HANDSHAKE_CHECK="key_handshake_check",t.KEY_HANDSHAKE_SYN="key_handshake_SYN",t.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",t.KEY_HANDSHAKE_ACK="key_handshake_ACK",t.KEY_HANDSHAKE_WALLET="key_handshake_wallet",t.KEY_HANDSHAKE_NONE="none"}(_e||(_e={}));class Om extends go.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:n,context:r,ecies:i,logging:o}){super(),this.keysExchanged=!1,this.step=_e.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=r,this.communicationLayer=e,i!=null&&i.privateKey&&n&&(V.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${n} set keysExchanged to true!`,i),this.keysExchanged=!0),this.myECIES=new es(Object.assign(Object.assign({},i),{debug:o==null?void 0:o.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=(o==null?void 0:o.keyExchangeLayer)===!0,n&&this.setOtherPublicKey(n),this.communicationLayer.on(Xi.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){const{relayPersistence:n}=this.communicationLayer.remote.state;if(V.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${n}`,e),n)return void V.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");const{message:r}=e;this.keysExchanged&&V.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(exports.EventType.KEY_INFO,r.type),r.type===_e.KEY_HANDSHAKE_SYN?(this.checkStep([_e.KEY_HANDSHAKE_NONE,_e.KEY_HANDSHAKE_ACK]),V.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",r),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:_e.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch(i=>{V.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",i)}),this.setStep(_e.KEY_HANDSHAKE_ACK)):r.type===_e.KEY_HANDSHAKE_SYNACK?(this.checkStep([_e.KEY_HANDSHAKE_SYNACK,_e.KEY_HANDSHAKE_ACK,_e.KEY_HANDSHAKE_NONE]),V.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:_e.KEY_HANDSHAKE_ACK}).catch(i=>{V.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",i)}),this.keysExchanged=!0,this.setStep(_e.KEY_HANDSHAKE_ACK),this.emit(exports.EventType.KEYS_EXCHANGED)):r.type===_e.KEY_HANDSHAKE_ACK&&(V.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([_e.KEY_HANDSHAKE_ACK,_e.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(_e.KEY_HANDSHAKE_ACK),this.emit(exports.EventType.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new es(e)}clean(){V.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(_e.KEY_HANDSHAKE_NONE),this.emit(exports.EventType.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:n}){const{relayPersistence:r,protocolVersion:i}=this.communicationLayer.remote.state,o=i>=2;r?V.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(V.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${i} isOriginator=${e} step=${this.step} force=${n} relayPersistence=${r} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==_e.KEY_HANDSHAKE_NONE&&this.step!==_e.KEY_HANDSHAKE_SYNACK)||n?(V.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${n}) -- step=${this.step}`,this.step),this.clean(),this.setStep(_e.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:_e.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch(c=>{V.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",c)})):V.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&n!==!0?V.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):o?this.communicationLayer.sendMessage({type:_e.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch(c=>{V.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",c)}):(this.communicationLayer.sendMessage({type:_e.KEY_HANDSHAKE_START}).catch(c=>{V.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",c)}),this.clean()))}setStep(e){this.step=e,this.emit(exports.EventType.KEY_INFO,e)}checkStep(e){e.length>0&&e.indexOf(this.step.toString())}setRelayPersistence({localKey:e,otherKey:n}){this.otherPublicKey=n,this.myECIES=new es({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){V.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}(function(t){t.TERMINATE="terminate",t.ANSWER="answer",t.OFFER="offer",t.CANDIDATE="candidate",t.JSONRPC="jsonrpc",t.WALLET_INFO="wallet_info",t.WALLET_INIT="wallet_init",t.ORIGINATOR_INFO="originator_info",t.PAUSE="pause",t.OTP="otp",t.AUTHORIZED="authorized",t.PING="ping",t.READY="ready"})(exports.MessageType||(exports.MessageType={})),function(t){t.REQUEST="sdk_connect_request_started",t.REQUEST_MOBILE="sdk_connect_request_started_mobile",t.RECONNECT="sdk_reconnect_request_started",t.CONNECTED="sdk_connection_established",t.CONNECTED_MOBILE="sdk_connection_established_mobile",t.AUTHORIZED="sdk_connection_authorized",t.REJECTED="sdk_connection_rejected",t.TERMINATED="sdk_connection_terminated",t.DISCONNECTED="sdk_disconnected",t.SDK_USE_EXTENSION="sdk_use_extension",t.SDK_RPC_REQUEST="sdk_rpc_request",t.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",t.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",t.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",t.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"}(xe||(xe={}));const xi=(t,e,n)=>Z(void 0,void 0,void 0,function*(){var r,i,o,c,s,a;const{remote:l,state:u}=t,{channelId:d,isOriginator:h}=u;if(e==="error_terminated")return V.SocketService(`handleJoinChannelResults: Channel ${d} terminated`),void t.emit(exports.EventType.TERMINATE);if(!n)return void V.SocketService(`handleJoinChannelResults: No result for channel ${d}`);const{persistence:f,walletKey:g,rejected:m}=n;if(V.SocketService(`handleJoinChannelResults: Channel ${d} persistence=${f} walletKey=${g} rejected=${m}`),m)return V.SocketService(`handleJoinChannelResults: Channel ${d} rejected`),yield t.remote.disconnect({terminate:!0}),t.remote.emit(exports.EventType.REJECTED,{channelId:d}),void t.remote.emitServiceStatusEvent();if(g&&!(!((r=l.state.channelConfig)===null||r===void 0)&&r.otherKey)){t.getKeyExchange().setOtherPublicKey(g),(i=t.state.keyExchange)===null||i===void 0||i.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(exports.EventType.AUTHORIZED);const{communicationLayer:w,storageManager:p}=l.state,S=Object.assign(Object.assign({},l.state.channelConfig),{channelId:(o=l.state.channelId)!==null&&o!==void 0?o:"",validUntil:Date.now()+rr,localKey:w==null?void 0:w.getKeyInfo().ecies.private,otherKey:g});t.sendMessage({type:_e.KEY_HANDSHAKE_ACK}).catch(_=>{}),(c=t.state.socket)===null||c===void 0||c.emit(exports.MessageType.PING,{id:d,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield p==null?void 0:p.persistChannelConfig(S),l.emitServiceStatusEvent(),l.setConnectionStatus(exports.ConnectionStatus.LINKED)}f&&(t.emit(exports.EventType.CHANNEL_PERSISTENCE),(s=t.state.keyExchange)===null||s===void 0||s.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(exports.EventType.AUTHORIZED),Yt(Object.assign(Object.assign({id:d??"",event:h?xe.CONNECTED:xe.CONNECTED_MOBILE},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:wn.version,walletVersion:(a=t.remote.state.walletInfo)===null||a===void 0?void 0:a.version}),u.communicationServerUrl).catch(w=>{}))}),er=t=>new Promise(e=>{setTimeout(e,t)}),tl=(t,e,...n)=>Z(void 0,[t,e,...n],void 0,function*(r,i,o=200){let c;const s=Date.now();let a=!1;for(;!a;){if(a=Date.now()-s>3e5,c=i[r],c.elapsedTime!==void 0)return c;yield er(o)}throw new Error(`RPC ${r} timed out`)}),qs=t=>Z(void 0,void 0,void 0,function*(){const{state:e}=t,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:c}=e;if(c)return V.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",t),!1;if(!n)return V.SocketService("[SocketService: reconnectSocket()] socket is not defined",t),!1;if(!r)return!1;const{connected:s}=n;e.isReconnecting=!0,e.reconnectionAttempts=0,V.SocketService(`[SocketService: reconnectSocket()] connected=${s} trying to reconnect after socketio disconnection`,t);try{for(;3>e.reconnectionAttempts;){if(V.SocketService(`[SocketService: reconnectSocket()] Attempt ${e.reconnectionAttempts+1} of 3`,t),yield er(200),n.connected)return V.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(exports.MessageType.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_config",message:""}),!0;e.resumed=!0,n.connect(),t.emit(exports.EventType.SOCKET_RECONNECT);try{if(yield new Promise((a,l)=>{n.emit(exports.EventType.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},(u,d)=>Z(void 0,void 0,void 0,function*(){try{yield xi(t,u,d),a()}catch(h){l(h)}}))}),yield er(100),n.connected)return V.SocketService(`Reconnection successful on attempt ${e.reconnectionAttempts+1}`),!0}catch(a){V.SocketService(`Error during reconnection attempt ${e.reconnectionAttempts+1}:`,a)}e.reconnectionAttempts+=1,3>e.reconnectionAttempts&&(yield er(200))}return V.SocketService("Failed to reconnect after 3 attempts"),!1}finally{e.isReconnecting=!1,e.reconnectionAttempts=0}});function mh(t,e){return Z(this,void 0,void 0,function*(){var n;const r=(n=t.state.keyExchange)===null||n===void 0?void 0:n.encryptMessage(JSON.stringify(e)),i={id:t.state.channelId,context:t.state.context,clientType:t.state.isOriginator?"dapp":"wallet",message:r,plaintext:t.state.hasPlaintext?JSON.stringify(e):void 0};return V.SocketService(`[SocketService: encryptAndSendMessage()] context=${t.state.context}`,i),e.type===exports.MessageType.TERMINATE&&(t.state.manualDisconnect=!0),new Promise((o,c)=>{var s;(s=t.state.socket)===null||s===void 0||s.emit(exports.EventType.MESSAGE,i,(a,l)=>{var u;a&&(V.SocketService(`[SocketService: encryptAndSendMessage()] error=${a}`),c(a)),V.SocketService("[encryptAndSendMessage] response",l),o((u=l==null?void 0:l.success)!==null&&u!==void 0&&u)})})})}var Zn;(function(t){t.RPC_CHECK="rpcCheck",t.SKIPPED_RPC="skippedRpc"})(Zn||(Zn={}));const gh=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map(t=>t.toLowerCase()),Im=[{event:exports.EventType.CLIENTS_CONNECTED,handler:function(t,e){return n=>Z(this,void 0,void 0,function*(){var r,i,o,c,s,a,l,u,d,h,f;const g=(i=(r=t.remote.state.channelConfig)===null||r===void 0?void 0:r.relayPersistence)!==null&&i!==void 0&&i;if(V.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected-${e}' relayPersistence=${g} resumed=${t.state.resumed} clientsPaused=${t.state.clientsPaused} keysExchanged=${(o=t.state.keyExchange)===null||o===void 0?void 0:o.areKeysExchanged()} isOriginator=${t.state.isOriginator}`),t.emit(exports.EventType.CLIENTS_CONNECTED,{isOriginator:t.state.isOriginator,keysExchanged:(c=t.state.keyExchange)===null||c===void 0?void 0:c.areKeysExchanged(),context:t.state.context}),t.state.resumed)t.state.isOriginator||(V.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} 'clients_connected' / keysExchanged=${(s=t.state.keyExchange)===null||s===void 0?void 0:s.areKeysExchanged()} -- backward compatibility`),(a=t.state.keyExchange)===null||a===void 0||a.start({isOriginator:(l=t.state.isOriginator)!==null&&l!==void 0&&l})),t.state.resumed=!1;else if(t.state.clientsPaused)V.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!t.state.isOriginator){const m=!g;V.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(u=t.state.keyExchange)===null||u===void 0?void 0:u.areKeysExchanged()} -- force=${m} -- backward compatibility`),V.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(d=t.state.keyExchange)===null||d===void 0?void 0:d.areKeysExchanged()} -- force=${m} -- backward compatibility`),(h=t.state.keyExchange)===null||h===void 0||h.start({isOriginator:(f=t.state.isOriginator)!==null&&f!==void 0&&f,force:m})}t.state.clientsConnected=!0,t.state.clientsPaused=!1})}},{event:exports.EventType.CHANNEL_CREATED,handler:function(t,e){return n=>{V.SocketService(`[SocketService: handleChannelCreated()] context=${t.state.context} on 'channel_created-${e}'`,n),t.emit(exports.EventType.CHANNEL_CREATED,n)}}},{event:exports.EventType.CLIENTS_DISCONNECTED,handler:function(t,e){return()=>{var n;t.state.clientsConnected=!1,V.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}'`),t.remote.state.relayPersistence?V.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}' - relayPersistence enabled, skipping key exchange cleanup.`):(t.state.isOriginator&&!t.state.clientsPaused&&((n=t.state.keyExchange)===null||n===void 0||n.clean()),t.emit(exports.EventType.CLIENTS_DISCONNECTED,e))}}},{event:exports.EventType.CONFIG,handler:function(t,e){return n=>Z(this,void 0,void 0,function*(){var r,i,o;V.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${e}'`,n);const{persistence:c,walletKey:s}=n;t.state.isOriginator&&t.remote.state.channelConfig?(n.walletKey&&!t.remote.state.channelConfig.otherKey&&(V.SocketService(`Setting wallet key ${s}`),t.remote.state.channelConfig.otherKey=s,t.getKeyExchange().setOtherPublicKey(n.walletKey),(r=t.state.keyExchange)===null||r===void 0||r.setKeysExchanged(!0),yield t.remote.sendMessage({type:_e.KEY_HANDSHAKE_ACK}),yield t.remote.sendMessage({type:exports.MessageType.PING}),yield(i=t.remote.state.storageManager)===null||i===void 0?void 0:i.persistChannelConfig(t.remote.state.channelConfig)),c!==!0||t.remote.state.channelConfig.relayPersistence||(V.SocketService(`Setting relay persistence ${c}`),t.remote.state.channelConfig.relayPersistence=c,t.remote.state.relayPersistence=!0,t.remote.emit(exports.EventType.CHANNEL_PERSISTENCE),t.remote.state.authorized=!0,t.remote.state.ready=!0,t.remote.emit(exports.EventType.AUTHORIZED),yield(o=t.remote.state.storageManager)===null||o===void 0?void 0:o.persistChannelConfig(t.remote.state.channelConfig))):t.state.isOriginator||n.persistence&&(t.remote.state.relayPersistence=!0,t.remote.emit(exports.EventType.CHANNEL_PERSISTENCE))})}},{event:exports.EventType.MESSAGE,handler:function(t,e){return n=>{var r,i,o,c,s,a,l,u,d,h,f,g,m,w,p,S,_,P;const{ackId:I,message:K,error:q}=n,F=(r=t.remote.state.relayPersistence)!==null&&r!==void 0&&r;if(V.SocketService(`[SocketService handleMessage()] relayPersistence=${F} context=${t.state.context} on 'message' ${e} keysExchanged=${(i=t.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()}`,n),q)throw V.SocketService(`
9
+ [SocketService handleMessage()] context=${t.state.context}::on 'message' error=${q}`),new Error(q);const U=typeof K=="string";if(!U&&(K==null?void 0:K.type)===_e.KEY_HANDSHAKE_START)return F?void 0:(V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received HANDSHAKE_START isOriginator=${t.state.isOriginator}`,K),void((o=t.state.keyExchange)===null||o===void 0||o.start({isOriginator:(c=t.state.isOriginator)!==null&&c!==void 0&&c,force:!0})));if(!U&&(!((s=K==null?void 0:K.type)===null||s===void 0)&&s.startsWith("key_handshake")))return F?void 0:(V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' emit KEY_EXCHANGE`,K),void t.emit(Xi.KEY_EXCHANGE,{message:K,context:t.state.context}));if(U&&!(!((a=t.state.keyExchange)===null||a===void 0)&&a.areKeysExchanged())){let $=!1;try{V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' trying to decrypt message`),(l=t.state.keyExchange)===null||l===void 0||l.decryptMessage(K),$=!0}catch(N){V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' error`,N)}if(!$)return t.state.isOriginator?(d=t.state.keyExchange)===null||d===void 0||d.start({isOriginator:(h=t.state.isOriginator)!==null&&h!==void 0&&h}):t.sendMessage({type:_e.KEY_HANDSHAKE_START}).catch(N=>{}),void V.SocketService(`Message ignored because invalid key exchange status. step=${(f=t.state.keyExchange)===null||f===void 0?void 0:f.getKeyInfo().step}`,(g=t.state.keyExchange)===null||g===void 0?void 0:g.getKeyInfo(),K);V.SocketService("Invalid key exchange status detected --- updating it."),(u=t.state.keyExchange)===null||u===void 0||u.setKeysExchanged(!0)}else if(!U&&(K!=null&&K.type))return void t.emit(exports.EventType.MESSAGE,K);if(!U)return void t.emit(exports.EventType.MESSAGE,K);const j=(m=t.state.keyExchange)===null||m===void 0?void 0:m.decryptMessage(K),G=JSON.parse(j??"{}");if(I&&(I==null?void 0:I.length)>0&&(V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' ackid=${I} channelId=${e}`),(w=t.state.socket)===null||w===void 0||w.emit(exports.EventType.MESSAGE_ACK,{ackId:I,channelId:e,clientType:t.state.isOriginator?"dapp":"wallet"})),t.state.clientsPaused=(G==null?void 0:G.type)===exports.MessageType.PAUSE,t.state.isOriginator&&G.data){const $=G.data,N=t.state.rpcMethodTracker[$.id];if(N){const R=Date.now()-N.timestamp;V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received answer for id=${$.id} method=${N.method} responseTime=${R}`,G),t.remote.state.analytics&&gh.includes(N.method.toLowerCase())&&Yt(Object.assign(Object.assign({id:(p=t.remote.state.channelId)!==null&&p!==void 0?p:"",event:xe.SDK_RPC_REQUEST_DONE,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:wn.version},t.remote.state.originatorInfo),{walletVersion:(S=t.remote.state.walletInfo)===null||S===void 0?void 0:S.version,params:{method:N.method,from:"mobile"}}),t.remote.state.communicationServerUrl).catch(O=>{}),Wr(N.method)&&Te.analytics.track($.error?$.error.code===4001?"sdk_action_rejected":"sdk_action_failed":"sdk_action_succeeded",{action:N.method});const C=Object.assign(Object.assign({},N),{result:$.result,error:$.error?{code:(_=$.error)===null||_===void 0?void 0:_.code,message:(P=$.error)===null||P===void 0?void 0:P.message}:void 0,elapsedTime:R});t.state.rpcMethodTracker[$.id]=C,t.emit(exports.EventType.RPC_UPDATE,C)}}t.emit(exports.EventType.MESSAGE,{message:G})}}},{event:exports.EventType.REJECTED,handler:function(t,e){return n=>Z(this,void 0,void 0,function*(){var r;t.state.isOriginator&&!t.remote.state.ready?(V.SocketService(`[SocketService: handleChannelRejected()] context=${t.state.context} channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`,t.remote.state.originatorInfo),Yt(Object.assign(Object.assign({id:e,event:xe.REJECTED},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:wn.version,walletVersion:(r=t.remote.state.walletInfo)===null||r===void 0?void 0:r.version}),t.remote.state.communicationServerUrl).catch(i=>{}),Te.analytics.track("sdk_connection_rejected",{transport_type:"websocket"}),yield t.remote.disconnect({terminate:!0}),t.remote.emit(exports.EventType.REJECTED,{channelId:e}),t.remote.setConnectionStatus(exports.ConnectionStatus.DISCONNECTED)):V.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`)})}},{event:"clients_waiting_to_join",handler:function(t,e){return n=>{V.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${t.state.context} on 'clients_waiting_to_join-${e}'`,n),t.emit(exports.EventType.CLIENTS_WAITING,n)}}}],Lm=[{event:exports.EventType.KEY_INFO,handler:function(t){return e=>{V.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",e),t.emit(exports.EventType.KEY_INFO,e)}}},{event:exports.EventType.KEYS_EXCHANGED,handler:function(t){return()=>{var e,n,r;V.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${(e=t.state.keyExchange)===null||e===void 0?void 0:e.areKeysExchanged()}`);const{channelConfig:i}=t.remote.state;if(i){const c=t.getKeyExchange().getKeyInfo().ecies;i.localKey=c.private,i.otherKey=c.otherPubKey,t.remote.state.channelConfig=i,(n=t.remote.state.storageManager)===null||n===void 0||n.persistChannelConfig(i).catch(s=>{})}t.emit(exports.EventType.KEYS_EXCHANGED,{keysExchanged:(r=t.state.keyExchange)===null||r===void 0?void 0:r.areKeysExchanged(),isOriginator:t.state.isOriginator});const o={keyInfo:t.getKeyInfo()};t.emit(exports.EventType.SERVICE_STATUS,o)}}}];function nl(t,e){V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} setting socket listeners for channel ${e}...`);const{socket:n}=t.state,{keyExchange:r}=t.state;n&&t.state.isOriginator&&(t.state.debug&&(n==null||n.io.on("error",i=>{V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=error`,i)}),n==null||n.io.on("reconnect",i=>{V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect`,i),qs(t).catch(o=>{})}),n==null||n.io.on("reconnect_error",i=>{V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_error`,i)}),n==null||n.io.on("reconnect_failed",()=>{V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_failed`)})),n==null||n.on("disconnect",i=>(V.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${i}' begin recovery...`),function(o){return c=>{V.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${o.state.manualDisconnect}`,c),o.state.manualDisconnect||(o.emit(exports.EventType.SOCKET_DISCONNECTED),qs(o).catch(s=>{}))}}(t)(i)))),Im.forEach(({event:i,handler:o})=>{n==null||n.on(`${i}-${e}`,o(t,e))}),Lm.forEach(({event:i,handler:o})=>{r==null||r.on(i,o(t))}),t.state.setupChannelListeners=!0}class Nm extends go.EventEmitter2{constructor(e){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:"",focusListenerAdded:!1,removeFocusListener:void 0,isReconnecting:!1,reconnectionAttempts:0},this.options=e;const{reconnect:n,communicationLayerPreference:r,communicationServerUrl:i,context:o,remote:c,logging:s}=e;this.state.resumed=n,this.state.context=o,this.state.isOriginator=c.state.isOriginator,this.state.communicationLayerPreference=r,this.state.debug=(s==null?void 0:s.serviceLayer)===!0,this.remote=c,(s==null?void 0:s.serviceLayer)===!0&&Ve.enable("SocketService:Layer"),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==In&&(s==null?void 0:s.plaintext)===!0,V.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var e;const{otherPublicKey:n,ecies:r,logging:i}=this.options,o={autoConnect:!1,transports:Mm,withCredentials:!0},c=this.state.communicationServerUrl;V.SocketService(`[SocketService: initSocket()] Socket IO url: ${c}`),this.state.socket=Ci(c,o),function(a){if(typeof window<"u"&&typeof document<"u"&&(V.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,a),!a.state.focusListenerAdded)){const l=()=>{V.SocketService("Document has focus --- reconnecting socket"),qs(a).catch(u=>{})};window.addEventListener("focus",l),a.state.focusListenerAdded=!0,a.state.removeFocusListener=()=>{window.removeEventListener("focus",l),a.state.focusListenerAdded=!1}}}(this);const s={communicationLayer:this,otherPublicKey:n,sendPublicKey:!1,context:(e=this.state.context)!==null&&e!==void 0?e:"",ecies:r,logging:i};this.state.keyExchange=new Om(s)}resetKeys(){return V.SocketService("[SocketService: resetKeys()] Resetting keys."),void((e=this.state.keyExchange)===null||e===void 0||e.resetKeys());var e}createChannel(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){var n,r,i;if(V.SocketService(`[SocketService: createChannel()] context=${e.state.context}`),e.state.socket||e.initSocket(),(n=e.state.socket)===null||n===void 0?void 0:n.connected)throw new Error("socket already connected");(r=e.state.socket)===null||r===void 0||r.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;const o=hn();e.state.channelId=o,nl(e,o),yield new Promise((s,a)=>{var l;(l=e.state.socket)===null||l===void 0||l.emit(exports.EventType.JOIN_CHANNEL,{channelId:o,context:`${e.state.context}createChannel`,clientType:"dapp"},(u,d)=>Z(this,void 0,void 0,function*(){try{yield xi(e,u,d),s()}catch(h){a(h)}}))});const c=(i=e.state.keyExchange)===null||i===void 0?void 0:i.getKeyInfo();return{channelId:o,pubKey:(c==null?void 0:c.ecies.public)||"",privKey:(c==null?void 0:c.ecies.private)||""}})}(this)})}connectToChannel({channelId:e,withKeyExchange:n=!1,authorized:r}){return function(i){return Z(this,arguments,void 0,function*({options:o,instance:c}){const{channelId:s,authorized:a,withKeyExchange:l}=o,{state:u,remote:d}=c,{isOriginator:h=!1,socket:f,keyExchange:g}=u,{channelConfig:m}=d.state;if(f!=null&&f.connected)throw new Error("socket already connected");if(h&&(m!=null&&m.relayPersistence)){const{localKey:w,otherKey:p}=m;w&&p&&(g==null||g.setRelayPersistence({localKey:w,otherKey:p}))}return Object.assign(u,{manualDisconnect:!1,withKeyExchange:l,isOriginator:h,channelId:s}),f==null||f.connect(),nl(c,s),!h&&a&&(g==null||g.setKeysExchanged(!0),Object.assign(d.state,{ready:!0,authorized:!0})),new Promise(w=>{var p;const S=(p=g==null?void 0:g.getKeyInfo())===null||p===void 0?void 0:p.ecies.public;f==null||f.emit(exports.EventType.JOIN_CHANNEL,{channelId:s,context:`${u.context}_connectToChannel`,clientType:h?"dapp":"wallet",publicKey:a&&!h?S:void 0},(_,P)=>Z(this,void 0,void 0,function*(){yield xi(c,_,P),w()}))})})}({options:{channelId:e,withKeyExchange:n,authorized:r},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e,n;(n=(e=this).state.socket)===null||n===void 0||n.emit(exports.EventType.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:_e.KEY_HANDSHAKE_CHECK,pubkey:e.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return Z(this,void 0,void 0,function*(){return function(n,r){return Z(this,void 0,void 0,function*(){var i,o,c;if(!n.state.channelId)throw V.SocketService("handleSendMessage: no channelId - Create a channel first"),new Error("Create a channel first");if(V.SocketService(`[SocketService: handleSendMessage()] context=${n.state.context} areKeysExchanged=${(i=n.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()}`,r),(o=r==null?void 0:r.type)===null||o===void 0?void 0:o.startsWith("key_handshake"))return function(a,l){var u;V.SocketService(`[SocketService: handleKeyHandshake()] context=${a.state.context}`,l),(u=a.state.socket)===null||u===void 0||u.emit(exports.EventType.MESSAGE,{id:a.state.channelId,context:a.state.context,clientType:a.state.isOriginator?"dapp":"wallet",message:l})}(n,r),!0;(function(a,l){var u;if(!(!((u=a.state.keyExchange)===null||u===void 0)&&u.areKeysExchanged())&&!a.remote.state.relayPersistence)throw V.SocketService(`[SocketService: validateKeyExchange()] context=${a.state.context} ERROR keys not exchanged`,l),new Error("Keys not exchanged BBB")})(n,r),function(a,l){var u;const d=(u=l==null?void 0:l.method)!==null&&u!==void 0?u:"",h=l==null?void 0:l.id;a.state.isOriginator&&h&&(a.state.rpcMethodTracker[h]={id:h,timestamp:Date.now(),method:d},a.emit(exports.EventType.RPC_UPDATE,a.state.rpcMethodTracker[h]))}(n,r);const s=yield mh(n,r);return n.remote.state.analytics&&n.remote.state.isOriginator&&r.method&&gh.includes(r.method.toLowerCase())&&Yt({id:(c=n.remote.state.channelId)!==null&&c!==void 0?c:"",event:xe.SDK_RPC_REQUEST,params:{method:r.method,from:"mobile"}},n.remote.state.communicationServerUrl).catch(a=>{}),n.remote.state.isOriginator&&r.method&&Wr(r.method)&&Te.analytics.track("sdk_action_requested",{action:r.method}),function(a,l){return Z(this,void 0,void 0,function*(){var u;const d=l==null?void 0:l.id,h=(u=l==null?void 0:l.method)!==null&&u!==void 0?u:"";if(a.state.isOriginator&&d)try{const f=tl(d,a.state.rpcMethodTracker,200).then(w=>({type:Zn.RPC_CHECK,result:w})),g=Z(this,void 0,void 0,function*(){const w=yield(S=>Z(void 0,[S],void 0,function*({rpcId:_,instance:P}){for(;P.state.lastRpcId===_||P.state.lastRpcId===void 0;)yield er(200);return P.state.lastRpcId}))({instance:a,rpcId:d}),p=yield tl(w,a.state.rpcMethodTracker,200);return{type:Zn.SKIPPED_RPC,result:p}}),m=yield Promise.race([f,g]);if(m.type===Zn.RPC_CHECK){const w=m.result;V.SocketService(`[SocketService:handleRpcReplies()] id=${l.id} ${h} ( ${w.elapsedTime} ms)`,w.result)}else{if(m.type!==Zn.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${d}`);{const w=Object.assign(Object.assign({},a.state.rpcMethodTracker[d]),{error:new Error("SDK_CONNECTION_ISSUE")});a.emit(exports.EventType.RPC_UPDATE,w);const p={data:Object.assign(Object.assign({},w),{jsonrpc:"2.0"}),name:"metamask-provider"};a.emit(exports.EventType.MESSAGE,{message:p})}}}catch(f){throw f}})}(n,r).catch(a=>{}),s})}(this,e)})}ping(){return function(e){return Z(this,void 0,void 0,function*(){var n,r;V.SocketService(`[SocketService: ping()] context=${e.state.context} originator=${e.state.isOriginator} keysExchanged=${(n=e.state.keyExchange)===null||n===void 0?void 0:n.areKeysExchanged()}`),(r=e.state.socket)===null||r===void 0||r.emit(exports.MessageType.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(e){return Z(this,void 0,void 0,function*(){var n,r;V.SocketService(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,!((n=e.state.keyExchange)===null||n===void 0)&&n.areKeysExchanged()&&(yield e.sendMessage({type:exports.MessageType.PAUSE})),(r=e.state.socket)===null||r===void 0||r.disconnect()})}(this)}isConnected(){var e;return(e=this.state.socket)===null||e===void 0?void 0:e.connected}resume(){return function(e){return Z(this,void 0,void 0,function*(){const{state:n,remote:r}=e,{socket:i,channelId:o,context:c,keyExchange:s,isOriginator:a}=n,{isOriginator:l}=r.state;if(V.SocketService(`[SocketService: resume()] channelId=${o} context=${c} connected=${i==null?void 0:i.connected} manualDisconnect=${n.manualDisconnect} resumed=${n.resumed} keysExchanged=${s==null?void 0:s.areKeysExchanged()}`),!o)throw V.SocketService("[SocketService: resume()] channelId is not defined"),new Error("ChannelId is not defined");i!=null&&i.connected?(V.SocketService("[SocketService: resume()] already connected."),i.emit(exports.MessageType.PING,{id:o,clientType:l?"dapp":"wallet",context:"on_channel_config",message:""}),r.hasRelayPersistence()||s!=null&&s.areKeysExchanged()||(a?yield e.sendMessage({type:exports.MessageType.READY}):s==null||s.start({isOriginator:!1}))):(i==null||i.connect(),V.SocketService(`[SocketService: resume()] after connecting socket --> connected=${i==null?void 0:i.connected}`),i==null||i.emit(exports.EventType.JOIN_CHANNEL,{channelId:o,context:`${c}_resume`,clientType:l?"dapp":"wallet"},(u,d)=>Z(this,void 0,void 0,function*(){try{yield xi(e,u,d)}catch{}}))),n.manualDisconnect=!1,n.resumed=!0})}(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){return function(n,r){var i,o,c,s,a;V.SocketService(`[SocketService: disconnect()] context=${n.state.context}`,r),r!=null&&r.terminate&&((o=(i=n.state).removeFocusListener)===null||o===void 0||o.call(i),n.state.channelId=r.channelId,(c=n.state.socket)===null||c===void 0||c.removeAllListeners(),(s=n.state.keyExchange)===null||s===void 0||s.clean(),n.remote.state.ready=!1,n.state.socket=void 0,n.state.rpcMethodTracker={}),n.state.manualDisconnect=!0,(a=n.state.socket)===null||a===void 0||a.disconnect()}(this,e)}}exports.CommunicationLayerPreference=void 0;exports.PlatformType=void 0;var rl;function Dm(t){return()=>Z(this,void 0,void 0,function*(){var e,n,r;const{state:i}=t;if(i.authorized)return;yield Z(this,void 0,void 0,function*(){for(;!i.walletInfo;)yield er(500)});const o="7.3".localeCompare(((e=i.walletInfo)===null||e===void 0?void 0:e.version)||"");if(V.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${(n=i.walletInfo)===null||n===void 0?void 0:n.version} compareValue=${o}`),o!==1)return;const c=i.platformType===exports.PlatformType.MobileWeb||i.platformType===exports.PlatformType.ReactNative||i.platformType===exports.PlatformType.MetaMaskMobileWebview;V.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${c} channel=${i.channelId} walletVersion=${(r=i.walletInfo)===null||r===void 0?void 0:r.version}`),c&&(i.authorized=!0,t.emit(exports.EventType.AUTHORIZED))})}function Bm(t){return e=>{const{state:n}=t;V.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${e}`),t.emit(exports.EventType.CHANNEL_CREATED,e)}}function $m(t,e){return()=>{var n,r,i,o;const{state:c}=t;V.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${c.channelId} keysExchanged=${(r=(n=c.communicationLayer)===null||n===void 0?void 0:n.getKeyInfo())===null||r===void 0?void 0:r.keysExchanged}`),c.analytics&&Yt(Object.assign(Object.assign({id:(i=c.channelId)!==null&&i!==void 0?i:"",event:c.reconnection?xe.RECONNECT:c.isOriginator?xe.REQUEST:xe.REQUEST_MOBILE},c.originatorInfo),{commLayer:e,sdkVersion:c.sdkVersion,walletVersion:(o=c.walletInfo)===null||o===void 0?void 0:o.version,commLayerVersion:wn.version}),c.communicationServerUrl).catch(s=>{}),c.isOriginator&&!c.reconnection&&Te.analytics.track("sdk_connection_established",{transport_type:"websocket"}),c.clientsConnected=!0,c.originatorInfoSent=!1,t.emit(exports.EventType.CLIENTS_CONNECTED)}}function Km(t){return e=>{const{state:n}=t;V.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${n.context} on 'clients_disconnected' channelId=${e}`),n.relayPersistence||(n.clientsConnected=!1,n.ready=!1,n.authorized=!1),t.emit(exports.EventType.CLIENTS_DISCONNECTED,n.channelId),t.setConnectionStatus(exports.ConnectionStatus.DISCONNECTED)}}function jm(t){return e=>{var n;const{state:r}=t;if(V.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${e} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),t.setConnectionStatus(exports.ConnectionStatus.WAITING),t.emit(exports.EventType.CLIENTS_WAITING,e),r.originatorConnectStarted){V.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);const i=((n=r.autoConnectOptions)===null||n===void 0?void 0:n.timeout)||3e3,o=setTimeout(()=>{V.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${i}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||t.setConnectionStatus(exports.ConnectionStatus.TIMEOUT),clearTimeout(o)},i)}}}function Um(t,e){return n=>{var r,i,o,c,s,a,l,u;const{state:d}=t;if(V.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${d.context} on commLayer.'keys_exchanged' channel=${d.channelId}`,n),(i=(r=d.communicationLayer)===null||r===void 0?void 0:r.getKeyInfo())===null||i===void 0?void 0:i.keysExchanged){const h=Object.assign(Object.assign({},d.channelConfig),{channelId:(o=d.channelId)!==null&&o!==void 0?o:"",validUntil:((c=d.channelConfig)===null||c===void 0?void 0:c.validUntil)||rr,localKey:d.communicationLayer.getKeyInfo().ecies.private,otherKey:d.communicationLayer.getKeyInfo().ecies.otherPubKey});(s=d.storageManager)===null||s===void 0||s.persistChannelConfig(h).catch(f=>{}),t.setConnectionStatus(exports.ConnectionStatus.LINKED)}(function(h,f){var g,m,w,p,S,_,P,I;const{state:K}=h;V.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${K.channelId}`,f);const q=Object.assign(Object.assign({},K.channelConfig),{channelId:(g=K.channelId)!==null&&g!==void 0?g:"",validUntil:(w=(m=K.channelConfig)===null||m===void 0?void 0:m.validUntil)!==null&&w!==void 0?w:0,relayPersistence:K.relayPersistence,localKey:(S=(p=K.communicationLayer)===null||p===void 0?void 0:p.state.keyExchange)===null||S===void 0?void 0:S.getKeyInfo().ecies.private,otherKey:(P=(_=K.communicationLayer)===null||_===void 0?void 0:_.state.keyExchange)===null||P===void 0?void 0:P.getKeyInfo().ecies.otherPubKey,lastActive:f.getTime()});(I=K.storageManager)===null||I===void 0||I.persistChannelConfig(q)})(t,new Date),d.analytics&&d.channelId&&Yt(Object.assign(Object.assign({id:d.channelId,event:n.isOriginator?xe.CONNECTED:xe.CONNECTED_MOBILE},d.originatorInfo),{sdkVersion:d.sdkVersion,commLayer:e,commLayerVersion:wn.version,walletVersion:(a=d.walletInfo)===null||a===void 0?void 0:a.version}),d.communicationServerUrl).catch(h=>{}),d.isOriginator=n.isOriginator,n.isOriginator||((l=d.communicationLayer)===null||l===void 0||l.sendMessage({type:exports.MessageType.READY}),d.ready=!0,d.paused=!1),n.isOriginator&&!d.originatorInfoSent&&((u=d.communicationLayer)===null||u===void 0||u.sendMessage({type:exports.MessageType.ORIGINATOR_INFO,originatorInfo:d.originatorInfo,originator:d.originatorInfo}),d.originatorInfoSent=!0)}}function Hm(t){return e=>{let n=e;e.message&&(n=n.message),function(r,i){const{state:o}=i;if(V.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${o.context} on 'message' typeof=${typeof r}`,r),i.state.ready=!0,o.isOriginator||r.type!==exports.MessageType.ORIGINATOR_INFO)if(o.isOriginator&&r.type===exports.MessageType.WALLET_INFO)(function(c,s){const{state:a}=c;a.walletInfo=s.walletInfo,a.paused=!1})(i,r);else{if(o.isOriginator&&r.type===exports.MessageType.WALLET_INIT)(function(c,s){return Z(this,void 0,void 0,function*(){var a,l,u;const{state:d}=c;if(d.isOriginator){const h=s.data||{};if(typeof h=="object"&&"accounts"in h&&"chainId"in h&&"walletKey"in h)try{const{channelConfig:f}=c.state;if(V.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(f,null,2)),f){const g=h.accounts,m=h.chainId,w=h.walletKey;let p,S=!1;"deeplinkProtocol"in h&&(S=!!h.deeplinkProtocol,c.state.deeplinkProtocolAvailable=S),"walletVersion"in h&&(p=h.walletVersion),yield(a=c.state.storageManager)===null||a===void 0?void 0:a.persistChannelConfig(Object.assign(Object.assign({},f),{otherKey:w,walletVersion:p,deeplinkProtocolAvailable:S,relayPersistence:!0})),yield(l=c.state.storageManager)===null||l===void 0?void 0:l.persistAccounts(g),yield(u=c.state.storageManager)===null||u===void 0?void 0:u.persistChainId(m)}c.emit(exports.EventType.WALLET_INIT,{accounts:h.accounts,chainId:h.chainId})}catch{}}})})(i,r).catch(c=>{V.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${c}`)});else if(r.type===exports.MessageType.TERMINATE)(function(c){return Z(this,void 0,void 0,function*(){const{state:s}=c;s.isOriginator&&(yield yh({options:{terminate:!0,sendMessage:!1},instance:c}),c.emit(exports.EventType.TERMINATE))})})(i).catch(c=>{V.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${c}`)});else if(r.type===exports.MessageType.PAUSE)(function(c){const{state:s}=c;s.paused=!0,c.setConnectionStatus(exports.ConnectionStatus.PAUSED)})(i);else if(r.type===exports.MessageType.READY&&o.isOriginator)(function(c){const{state:s}=c;c.setConnectionStatus(exports.ConnectionStatus.LINKED);const a=s.paused;s.paused=!1,c.emit(exports.EventType.CLIENTS_READY,{isOriginator:s.isOriginator,walletInfo:s.walletInfo}),a&&(s.authorized=!0,c.emit(exports.EventType.AUTHORIZED))})(i);else{if(r.type===exports.MessageType.OTP&&o.isOriginator)return void function(c,s){var a;const{state:l}=c;c.emit(exports.EventType.OTP,s.otpAnswer),"6.6".localeCompare(((a=l.walletInfo)===null||a===void 0?void 0:a.version)||"")===1&&c.emit(exports.EventType.SDK_RPC_CALL,{method:Ke.ETH_REQUESTACCOUNTS,params:[]})}(i,r);r.type===exports.MessageType.AUTHORIZED&&o.isOriginator&&function(c){const{state:s}=c;s.authorized=!0,c.emit(exports.EventType.AUTHORIZED)}(i)}i.emit(exports.EventType.MESSAGE,r)}else(function(c,s){var a;const{state:l}=c;(a=l.communicationLayer)===null||a===void 0||a.sendMessage({type:exports.MessageType.WALLET_INFO,walletInfo:l.walletInfo}),l.originatorInfo=s.originatorInfo||s.originator,c.emit(exports.EventType.CLIENTS_READY,{isOriginator:l.isOriginator,originatorInfo:l.originatorInfo}),l.paused=!1})(i,r)}(n,t)}}function Fm(t){return()=>{const{state:e}=t;V.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),e.ready=!1,e.authorized=!1,ph(e),t.emitServiceStatusEvent({context:"socket_reconnect"})}}function zm(t){return()=>{const{state:e}=t;V.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1}}function qm(t){return()=>Z(this,void 0,void 0,function*(){var e,n,r,i,o,c,s;const{state:a}=t;V.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${a.context}`),t.state.ready=!0,t.state.clientsConnected=!0,t.state.authorized=!0,t.state.relayPersistence=!0,(e=t.state.communicationLayer)===null||e===void 0||e.getKeyExchange().setKeysExchanged(!0),t.emit(exports.EventType.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),t.emit(exports.EventType.AUTHORIZED),t.emit(exports.EventType.CLIENTS_READY),t.emit(exports.EventType.CHANNEL_PERSISTENCE);try{a.channelConfig=Object.assign(Object.assign({},a.channelConfig),{localKey:(n=a.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:(r=a.communicationLayer)===null||r===void 0?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:(i=a.channelId)!==null&&i!==void 0?i:"",validUntil:(c=(o=a.channelConfig)===null||o===void 0?void 0:o.validUntil)!==null&&c!==void 0?c:rr,relayPersistence:!0}),yield(s=a.storageManager)===null||s===void 0?void 0:s.persistChannelConfig(a.channelConfig)}catch{}})}function il({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,ecies:r,communicationServerUrl:i=In,instance:o}){var c,s,a,l,u,d,h,f,g,m,w;const{state:p}=o;if(V.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(p,null,2)),t!==exports.CommunicationLayerPreference.SOCKET)throw new Error("Invalid communication protocol");p.communicationLayer=new Nm({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,transports:p.transports,communicationServerUrl:i,context:p.context,ecies:r,logging:p.logging,remote:o});let S=typeof document<"u"&&document.URL||"",_=typeof document<"u"&&document.title||"";!((c=p.dappMetadata)===null||c===void 0)&&c.url&&(S=p.dappMetadata.url),!((s=p.dappMetadata)===null||s===void 0)&&s.name&&(_=p.dappMetadata.name);const P=(d=(l=(a=p.dappMetadata)===null||a===void 0?void 0:a.name)!==null&&l!==void 0?l:(u=p.dappMetadata)===null||u===void 0?void 0:u.url)!==null&&d!==void 0?d:"N/A",I=typeof window<"u"&&window.location!==void 0&&(h=window.location.hostname)!==null&&h!==void 0?h:P,K={url:S,title:_,source:(f=p.dappMetadata)===null||f===void 0?void 0:f.source,dappId:I,anonId:p.anonId,icon:((g=p.dappMetadata)===null||g===void 0?void 0:g.iconUrl)||((m=p.dappMetadata)===null||m===void 0?void 0:m.base64Icon),platform:p.platformType,apiVersion:wn.version,connector:(w=p.dappMetadata)===null||w===void 0?void 0:w.connector};p.originatorInfo=K;const q={[exports.EventType.AUTHORIZED]:Dm(o),[exports.EventType.MESSAGE]:Hm(o),[exports.EventType.CHANNEL_PERSISTENCE]:qm(o),[exports.EventType.CLIENTS_CONNECTED]:$m(o,t),[exports.EventType.KEYS_EXCHANGED]:Um(o,t),[exports.EventType.SOCKET_DISCONNECTED]:zm(o),[exports.EventType.SOCKET_RECONNECT]:Fm(o),[exports.EventType.CLIENTS_DISCONNECTED]:Km(o),[exports.EventType.KEY_INFO]:()=>{},[exports.EventType.CHANNEL_CREATED]:Bm(o),[exports.EventType.CLIENTS_WAITING]:jm(o),[exports.EventType.RPC_UPDATE]:F=>{o.emit(exports.EventType.RPC_UPDATE,F)}};for(const[F,U]of Object.entries(q))try{p.communicationLayer.on(F,U)}catch{}}function yh(t){return Z(this,arguments,void 0,function*({options:e,instance:n}){const{state:r}=n;return V.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${r.channelId}`,e),new Promise((i,o)=>{var c,s,a,l,u,d;e!=null&&e.terminate?(n.state.ready&&Yt({id:(c=n.state.channelId)!==null&&c!==void 0?c:"",event:xe.TERMINATED},n.state.communicationServerUrl).catch(h=>{}),r.ready=!1,r.paused=!1,(s=r.storageManager)===null||s===void 0||s.terminate((a=r.channelId)!==null&&a!==void 0?a:""),n.state.terminated=!0,e.sendMessage?!((l=r.communicationLayer)===null||l===void 0)&&l.getKeyInfo().keysExchanged&&n.state.communicationLayer&&mh(n.state.communicationLayer,{type:exports.MessageType.TERMINATE}).then(()=>{i(!0)}).catch(h=>{o(h)}):i(!0),r.authorized=!1,r.relayPersistence=!1,r.channelId=hn(),e.channelId=r.channelId,r.channelConfig=void 0,r.originatorConnectStarted=!1,(u=r.communicationLayer)===null||u===void 0||u.disconnect(e),n.setConnectionStatus(exports.ConnectionStatus.TERMINATED)):((d=r.communicationLayer)===null||d===void 0||d.disconnect(e),n.setConnectionStatus(exports.ConnectionStatus.DISCONNECTED),i(!0))})})}(exports.CommunicationLayerPreference||(exports.CommunicationLayerPreference={})).SOCKET="socket",function(t){t.NonBrowser="nodejs",t.MetaMaskMobileWebview="in-app-browser",t.DesktopWeb="web-desktop",t.MobileWeb="web-mobile",t.ReactNative="react-native"}(exports.PlatformType||(exports.PlatformType={}));class Vm extends go.EventEmitter2{constructor(e){super(),this.state={ready:!1,anonId:"",authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,deeplinkProtocolAvailable:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:In,context:"",persist:!1,clientsConnected:!1,sessionDuration:rr,originatorConnectStarted:!1,debug:!1,_connectionStatus:exports.ConnectionStatus.DISCONNECTED},this._options=e;const{anonId:n,platformType:r,communicationLayerPreference:i,otherPublicKey:o,reconnect:c,walletInfo:s,dappMetadata:a,protocolVersion:l,transports:u,context:d,relayPersistence:h,ecies:f,analytics:g=!1,storage:m,sdkVersion:w,communicationServerUrl:p=In,logging:S,autoConnect:_={timeout:Rm}}=e;this.state.anonId=n,this.state.otherPublicKey=o,this.state.dappMetadata=a,this.state.walletInfo=s,this.state.transports=u,this.state.platformType=r,this.state.analytics=g,this.state.protocolVersion=l??1,this.state.isOriginator=!o,this.state.relayPersistence=h,this.state.communicationServerUrl=p,this.state.context=d,this.state.terminated=!1,this.state.sdkVersion=w,this.setMaxListeners(50),this.setConnectionStatus(exports.ConnectionStatus.DISCONNECTED),m!=null&&m.duration&&(this.state.sessionDuration=rr),this.state.storageOptions=m,this.state.autoConnectOptions=_,this.state.debug=(S==null?void 0:S.remoteLayer)===!0,(S==null?void 0:S.remoteLayer)===!0&&Ve.enable("RemoteCommunication:Layer"),(S==null?void 0:S.serviceLayer)===!0&&Ve.enable("SocketService:Layer"),(S==null?void 0:S.eciesLayer)===!0&&Ve.enable("ECIES:Layer"),(S==null?void 0:S.keyExchangeLayer)===!0&&Ve.enable("KeyExchange:Layer"),this.state.logging=S,m!=null&&m.storageManager&&(this.state.storageManager=m.storageManager),V.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${l} relayPersistence=${h} isOriginator=${this.state.isOriginator} communicationLayerPreference=${i} otherPublicKey=${o} reconnect=${c}`),this.state.isOriginator||il({communicationLayerPreference:i,otherPublicKey:o,reconnect:c,ecies:f,communicationServerUrl:p,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return Z(this,void 0,void 0,function*(){var e;if(this.state.storageManager){const n=yield this.state.storageManager.getPersistedChannelConfig({});n&&(this.state.channelConfig=n,this.state.channelId=n.channelId,this.state.deeplinkProtocolAvailable=(e=n.deeplinkProtocolAvailable)!==null&&e!==void 0&&e,n.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(exports.ConnectionStatus.LINKED),yield this.connectToChannel({channelId:n.channelId})))}il({communicationLayerPreference:exports.CommunicationLayerPreference.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return Z(this,void 0,void 0,function*(){return yield function(e){return Z(this,void 0,void 0,function*(){var n;const{state:r}=e;if(!r.storageManager)return void V.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");const i=yield r.storageManager.getPersistedChannelConfig({});if(V.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${r.originatorConnectStarted} channelConfig`,i),(n=r.communicationLayer)===null||n===void 0?void 0:n.isConnected())return V.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),i;if(i){if(i.validUntil>Date.now())return r.channelConfig=i,r.originatorConnectStarted=!0,r.channelId=i==null?void 0:i.channelId,r.reconnection=!0,i;V.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}r.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){var n,r,i,o,c,s;if(!e.communicationLayer)throw new Error("communication layer not initialized");if(e.ready)throw new Error("Channel already connected");if(e.channelId&&(!((n=e.communicationLayer)===null||n===void 0)&&n.isConnected()))return e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),(r=e.storageManager)===null||r===void 0||r.persistChannelConfig(e.channelConfig),{channelId:e.channelId,privKey:(o=(i=e.communicationLayer)===null||i===void 0?void 0:i.getKeyInfo())===null||o===void 0?void 0:o.ecies.private,pubKey:(s=(c=e.communicationLayer)===null||c===void 0?void 0:c.getKeyInfo())===null||s===void 0?void 0:s.ecies.public};V.RemoteCommunication("[RemoteCommunication: generateChannelId()]");const a=yield e.communicationLayer.createChannel();V.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",a);const l=Object.assign(Object.assign({},e.channelConfig),{channelId:a.channelId,localKey:a.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=a.channelId,e.channelConfig=l,{channelId:e.channelId,pubKey:a.pubKey,privKey:a.privKey}})}(this.state)})}clean(){return ph(this.state)}connectToChannel({channelId:e,withKeyExchange:n,authorized:r}){return function(i){return Z(this,arguments,void 0,function*({channelId:o,withKeyExchange:c,authorized:s,state:a}){var l,u,d;if(!Ts(o))throw V.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} invalid channel channelId=${o}`),new Error(`Invalid channel ${o}`);if(V.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} channelId=${o} withKeyExchange=${c}`),(l=a.communicationLayer)===null||l===void 0?void 0:l.isConnected())return void V.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} already connected - interrupt connection.`);a.channelId=o,yield(u=a.communicationLayer)===null||u===void 0?void 0:u.connectToChannel({channelId:o,authorized:s,withKeyExchange:c});const h=Object.assign(Object.assign({},a.channelConfig),{channelId:o,validUntil:Date.now()+a.sessionDuration});a.channelConfig=h,(d=a.storageManager)===null||d===void 0||d.persistChannelConfig(h)})}({channelId:e,authorized:r,withKeyExchange:n,state:this.state})}sendMessage(e){return Z(this,void 0,void 0,function*(){const n=this.state.isOriginator&&e.method&&Wr(e.method);n&&Te.analytics.track("sdk_action_requested",{action:e.method});try{return yield function(r,i){return Z(this,void 0,void 0,function*(){var o,c;const{state:s}=r;V.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} paused=${s.paused} ready=${s.ready} relayPersistence=${s.relayPersistence} authorized=${s.authorized} socket=${(o=s.communicationLayer)===null||o===void 0?void 0:o.isConnected()} clientsConnected=${s.clientsConnected} status=${s._connectionStatus}`,i),s.relayPersistence||s.ready&&(!((c=s.communicationLayer)===null||c===void 0)&&c.isConnected())&&s.clientsConnected||(V.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} SKIP message waiting for MM mobile readiness.`),yield new Promise(a=>{r.once(exports.EventType.CLIENTS_READY,a)}),V.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} AFTER SKIP / READY -- sending pending message`));try{return yield function(l,u){return Z(this,void 0,void 0,function*(){return new Promise(d=>{var h;const{state:f}=l;V.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${f.context} ready=${f.ready} authorized=${f.authorized} method=${u.method}`),!f.isOriginator||f.authorized||f.relayPersistence?(h=f.communicationLayer)===null||h===void 0||h.sendMessage(u).then(g=>{d(g)}).catch(g=>{d(!1)}):l.once(exports.EventType.AUTHORIZED,()=>{var g;V.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${f.context} AFTER SKIP / AUTHORIZED -- sending pending message`),(g=f.communicationLayer)===null||g===void 0||g.sendMessage(u).then(m=>{d(m)}).catch(m=>{d(!1)})})})})}(r,i)}catch(a){throw a}})}(this,e)}catch(r){throw n&&Te.analytics.track("sdk_action_failed",{action:e.method}),r}})}testStorage(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){var n;const r=yield(n=e.storageManager)===null||n===void 0?void 0:n.getPersistedChannelConfig();V.RemoteCommunication("[RemoteCommunication: testStorage()] res",r)})}(this.state)})}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){return Z(this,void 0,void 0,function*(){var e;V.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.ping()})}testLogger(){V.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),V.SocketService(`testLogger() channel=${this.state.channelId}`),V.Ecies(`testLogger() channel=${this.state.channelId}`),V.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;V.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),(e=this.state.communicationLayer)===null||e===void 0||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit(exports.EventType.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(exports.EventType.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.getKeyInfo()}resetKeys(){var e;(e=this.state.communicationLayer)===null||e===void 0||e.resetKeys()}setOtherPublicKey(e){var n;const r=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange();if(!r)throw new Error("KeyExchange is not initialized.");r.getOtherPublicKey()!==e&&r.setOtherPublicKey(e)}pause(){return Z(this,void 0,void 0,function*(){var e;V.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.pause(),this.setConnectionStatus(exports.ConnectionStatus.PAUSED)})}getVersion(){return wn.version}hasRelayPersistence(){var e;return(e=this.state.relayPersistence)!==null&&e!==void 0&&e}resume(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){var n;const{state:r}=e;V.RemoteCommunication(`[RemoteCommunication: resume()] channel=${r.channelId}`),yield(n=r.communicationLayer)===null||n===void 0?void 0:n.resume(),e.setConnectionStatus(exports.ConnectionStatus.LINKED)})}(this)})}encrypt(e){var n,r,i;const o=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange(),c=o==null?void 0:o.getOtherPublicKey();if(!c)throw new Error("KeyExchange not completed");return(i=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||i===void 0?void 0:i.encrypt(e,c)}decrypt(e){var n,r,i;if(!(!((n=this.state.communicationLayer)===null||n===void 0)&&n.state.eciesInstance))throw new Error("ECIES instance is not initialized");return(i=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||i===void 0?void 0:i.decrypt(e)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.getRPCMethodTracker()}reject({channelId:e}){return function(n){return Z(this,arguments,void 0,function*({channelId:r,state:i}){var o,c,s;if(!Ts(r))throw V.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${i.context} invalid channel channelId=${r}`),new Error(`Invalid channel ${r}`);if(i.isOriginator)return void V.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} isOriginator=${i.isOriginator} channelId=${r}`);const{socket:a}=(c=(o=i.communicationLayer)===null||o===void 0?void 0:o.state)!==null&&c!==void 0?c:{};a!=null&&a.connected||(V.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket already connected`),a==null||a.connect()),Yt(Object.assign(Object.assign({id:r,event:xe.REJECTED},i.originatorInfo),{sdkVersion:i.sdkVersion,commLayerVersion:wn.version,walletVersion:(s=i.walletInfo)===null||s===void 0?void 0:s.version}),i.communicationServerUrl).catch(l=>{}),yield new Promise((l,u)=>{a==null||a.emit(exports.EventType.REJECTED,{channelId:r},(d,h)=>{V.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket=${a==null?void 0:a.id}`,{error:d,response:h}),d?u(d):l(h)})})})}({channelId:e,state:this.state})}disconnect(e){return Z(this,void 0,void 0,function*(){return yh({options:e,instance:this})})}}(function(t){t.RENEW="renew",t.LINK="link"})(rl||(rl={}));var Wm="ERC721",Gm="ERC1155",ke={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:t=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${t} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:t=>`'args.logger' must include required method '${t}'.`},info:{connected:t=>`MetaMask: Connected to chain with ID "${t}".`},warnings:{chainIdDeprecation:`MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead.
10
+ For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,networkVersionDeprecation:`MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead.
11
+ For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,selectedAddressDeprecation:`MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead.
12
+ For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,enableDeprecation:`MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.
13
+ For more information, see: https://eips.ethereum.org/EIPS/eip-1102`,sendDeprecation:`MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.
14
+ For more information, see: https://eips.ethereum.org/EIPS/eip-1193`,events:{close:`MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.
15
+ For more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect`,data:`MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.
16
+ For more information, see: https://eips.ethereum.org/EIPS/eip-1193#message`,networkChanged:`MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.
17
+ For more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged`,notification:`MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.
18
+ For more information, see: https://eips.ethereum.org/EIPS/eip-1193#message`},rpc:{ethDecryptDeprecation:`MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.
19
+ For more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686`,ethGetEncryptionPublicKeyDeprecation:`MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.
20
+ For more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686`,walletWatchAssetNFTExperimental:`MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future.
21
+ For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle`},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}};function Ym(t){const e={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{var o;e.ethDecryptDeprecation||n.method!=="eth_decrypt"?e.ethGetEncryptionPublicKeyDeprecation||n.method!=="eth_getEncryptionPublicKey"?!e.walletWatchAssetNFTExperimental&&n.method==="wallet_watchAsset"&&[Wm,Gm].includes(((o=n.params)==null?void 0:o.type)||"")&&(t.warn(ke.warnings.rpc.walletWatchAssetNFTExperimental),e.walletWatchAssetNFTExperimental=!0):(t.warn(ke.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),e.ethGetEncryptionPublicKeyDeprecation=!0):(t.warn(ke.warnings.rpc.ethDecryptDeprecation),e.ethDecryptDeprecation=!0),i()}}var vh=4294967295,ol=Math.floor(Math.random()*vh);function Zm(){return(t,e,n,r)=>{const i=t.id,o=ol=(ol+1)%vh;t.id=o,e.id=o,n(c=>{t.id=i,e.id=i,c()})}}var Pa=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},pn=(t,e,n)=>(Pa(t,e,"read from private field"),n?n.call(t):e.get(t)),bt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},pi=(t,e,n,r)=>(Pa(t,e,"write to private field"),e.set(t,n),n),Fe=(t,e,n)=>(Pa(t,e,"access private method"),n),ln={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},sl={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function al(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var Qi=(t,e)=>Object.hasOwnProperty.call(t,e);class Jm extends TypeError{constructor(e,n){let r;const{message:i,explanation:o,...c}=e,{path:s}=e,a=s.length===0?i:`At path: ${s.join(".")} -- ${i}`;super(o??a),o!=null&&(this.cause=a),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...n()])}}function Gt(t){return typeof t=="object"&&t!=null}function Dt(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Xm(t,e,n,r){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:o}=e,{type:c}=n,{refinement:s,message:a=`Expected a value of type \`${c}\`${s?` with refinement \`${s}\``:""}, but received: \`${Dt(r)}\``}=t;return{value:r,type:c,refinement:s,key:i[i.length-1],path:i,branch:o,...t,message:a}}function*cl(t,e,n,r){(function(i){return Gt(i)&&typeof i[Symbol.iterator]=="function"})(t)||(t=[t]);for(const i of t){const o=Xm(i,e,n,r);o&&(yield o)}}function*Oa(t,e,n={}){const{path:r=[],branch:i=[t],coerce:o=!1,mask:c=!1}=n,s={path:r,branch:i};if(o&&(t=e.coercer(t,s),c&&e.type!=="type"&&Gt(e.schema)&&Gt(t)&&!Array.isArray(t)))for(const l in t)e.schema[l]===void 0&&delete t[l];let a="valid";for(const l of e.validator(t,s))l.explanation=n.message,a="not_valid",yield[l,void 0];for(let[l,u,d]of e.entries(t,s)){const h=Oa(u,d,{path:l===void 0?r:[...r,l],branch:l===void 0?i:[...i,u],coerce:o,mask:c,message:n.message});for(const f of h)f[0]?(a=f[0].refinement!=null?"not_refined":"not_valid",yield[f[0],void 0]):o&&(u=f[1],l===void 0?t=u:t instanceof Map?t.set(l,u):t instanceof Set?t.add(u):Gt(t)&&(u!==void 0||l in t)&&(t[l]=u))}if(a!=="not_valid")for(const l of e.refiner(t,s))l.explanation=n.message,a="not_refined",yield[l,void 0];a==="valid"&&(yield[void 0,t])}class _t{constructor(e){const{type:n,schema:r,validator:i,refiner:o,coercer:c=a=>a,entries:s=function*(){}}=e;this.type=n,this.schema=r,this.entries=s,this.coercer=c,this.validator=i?(a,l)=>cl(i(a,l),l,this,a):()=>[],this.refiner=o?(a,l)=>cl(o(a,l),l,this,a):()=>[]}assert(e,n){return bh(e,this,n)}create(e,n){return wh(e,this,n)}is(e){return ar(e,this)}mask(e,n){return function(r,i,o){const c=Lr(r,i,{coerce:!0,mask:!0,message:o});if(c[0])throw c[0];return c[1]}(e,this,n)}validate(e,n={}){return Lr(e,this,n)}}function bh(t,e,n){const r=Lr(t,e,{message:n});if(r[0])throw r[0]}function wh(t,e,n){const r=Lr(t,e,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function ar(t,e){return!Lr(t,e)[0]}function Lr(t,e,n={}){const r=Oa(t,e,n),i=function(o){const{done:c,value:s}=o.next();return c?void 0:s}(r);return i[0]?[new Jm(i[0],function*(){for(const c of r)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function En(t,e){return new _t({type:t,schema:null,validator:e})}function ll(t){let e;return new _t({type:"lazy",schema:null,*entries(n,r){e??(e=t()),yield*e.entries(n,r)},validator:(n,r)=>(e??(e=t()),e.validator(n,r)),coercer:(n,r)=>(e??(e=t()),e.coercer(n,r)),refiner:(n,r)=>(e??(e=t()),e.refiner(n,r))})}function Eh(t){return new _t({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${Dt(e)}`})}function _h(t){const e=Dt(t),n=typeof t;return new _t({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?t:null,validator:r=>r===t||`Expected the literal \`${e}\`, but received: ${Dt(r)}`})}function Sh(){return En("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Dt(t)}`)}function Ch(t){const e=t?Object.keys(t):[],n=En("never",()=>!1);return new _t({type:"object",schema:t||null,*entries(r){if(t&&Gt(r)){const i=new Set(Object.keys(r));for(const o of e)i.delete(o),yield[o,r[o],t[o]];for(const o of i)yield[o,r[o],n]}},validator:r=>Gt(r)||`Expected an object, but received: ${Dt(r)}`,coercer:r=>Gt(r)?{...r}:r})}function ul(t){return new _t({...t,validator:(e,n)=>e===void 0||t.validator(e,n),refiner:(e,n)=>e===void 0||t.refiner(e,n)})}function Ah(t,e){return new _t({type:"record",schema:null,*entries(n){if(Gt(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:n=>Gt(n)||`Expected an object, but received: ${Dt(n)}`})}function _n(){return En("string",t=>typeof t=="string"||`Expected a string, but received: ${Dt(t)}`)}function _o(t){const e=t.map(n=>n.type).join(" | ");return new _t({type:"union",schema:null,coercer(n){for(const r of t){const[i,o]=r.validate(n,{coerce:!0});if(!i)return o}return n},validator(n,r){const i=[];for(const o of t){const[...c]=Oa(n,o,r),[s]=c;if(!s[0])return[];for(const[a]of c)a&&i.push(a)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Dt(n)}`,...i]}})}function Qm(t){return function(e){return function(n){return typeof n=="object"&&n!==null&&"message"in n}(e)&&typeof e.message=="string"?e.message:e==null?"":String(e)}(t).replace(/\.$/u,"")}function eg(t,e){var r,i;return n=t,typeof((i=(r=n==null?void 0:n.prototype)==null?void 0:r.constructor)==null?void 0:i.name)=="string"?new t({message:e}):t({message:e});var n}var tg=class extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}};function kh(){throw new Error("setTimeout has not been defined")}function Th(){throw new Error("clearTimeout has not been defined")}var nn=kh,rn=Th;function xh(t){if(nn===setTimeout)return setTimeout(t,0);if((nn===kh||!nn)&&setTimeout)return nn=setTimeout,setTimeout(t,0);try{return nn(t,0)}catch{try{return nn.call(null,t,0)}catch{return nn.call(this,t,0)}}}typeof Ge.setTimeout=="function"&&(nn=setTimeout),typeof Ge.clearTimeout=="function"&&(rn=clearTimeout);var Rn,Wt=[],tr=!1,Mi=-1;function ng(){tr&&Rn&&(tr=!1,Rn.length?Wt=Rn.concat(Wt):Mi=-1,Wt.length&&Mh())}function Mh(){if(!tr){var t=xh(ng);tr=!0;for(var e=Wt.length;e;){for(Rn=Wt,Wt=[];++Mi<e;)Rn&&Rn[Mi].run();Mi=-1,e=Wt.length}Rn=null,tr=!1,function(n){if(rn===clearTimeout)return clearTimeout(n);if((rn===Th||!rn)&&clearTimeout)return rn=clearTimeout,clearTimeout(n);try{return rn(n)}catch{try{return rn.call(null,n)}catch{return rn.call(this,n)}}}(t)}}function Rh(t,e){this.fun=t,this.array=e}Rh.prototype.run=function(){this.fun.apply(null,this.array)};function Nn(){}var rg=Nn,ig=Nn,og=Nn,sg=Nn,ag=Nn,cg=Nn,lg=Nn,zn=Ge.performance||{},ug=zn.now||zn.mozNow||zn.msNow||zn.oNow||zn.webkitNow||function(){return new Date().getTime()},dg=new Date,be={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Wt.push(new Rh(t,e)),Wt.length!==1||tr||xh(Mh)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:rg,addListener:ig,once:og,off:sg,removeListener:ag,removeAllListeners:cg,emit:lg,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*ug.call(zn),n=Math.floor(e),r=Math.floor(e%1*1e9);return t&&(n-=t[0],(r-=t[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-dg)/1e3}},Nr=t=>Ch(t);function dl({path:t,branch:e}){const n=t[t.length-1];return Qi(e[e.length-2],n)}function eo(t){return new _t({...t,type:`optional ${t.type}`,validator:(e,n)=>!dl(n)||t.validator(e,n),refiner:(e,n)=>!dl(n)||t.refiner(e,n)})}var mi,hl,fl,to=_o([_h(null),En("boolean",t=>typeof t=="boolean"),En("finite number",t=>ar(t,Sh())&&Number.isFinite(t)),_n(),Eh(ll(()=>to)),Ah(_n(),ll(()=>to))]),Dr=(mi=to,hl=En("any",()=>!0),fl=t=>(function(e,n,r="Assertion failed",i=tg){try{bh(e,n)}catch(o){throw eg(i,`${r}: ${Qm(o)}.`)}}(t,to),JSON.parse(JSON.stringify(t,(e,n)=>{if(e!=="__proto__"&&e!=="constructor")return n}))),new _t({...mi,coercer:(t,e)=>ar(t,hl)?mi.coercer(fl(t,e),e):mi.coercer(t,e)}));function Vs(t){try{return function(e){wh(e,Dr)}(t),!0}catch{return!1}}var _r=_h("2.0"),Ri=function(t){return new _t({...t,validator:(e,n)=>e===null||t.validator(e,n),refiner:(e,n)=>e===null||t.refiner(e,n)})}(_o([Sh(),_n()])),Ws=Nr({code:En("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${Dt(t)}`),message:_n(),data:eo(Dr),stack:eo(_n())}),Ph=_o([Ah(_n(),Dr),Eh(Dr)]),hg=Nr({id:Ri,jsonrpc:_r,method:_n(),params:eo(Ph)}),fg=Nr({jsonrpc:_r,method:_n(),params:eo(Ph)});function pl(t){return ar(t,hg)}function ml(t){return ar(t,Ws)}Ch({id:Ri,jsonrpc:_r,result:ul(En("unknown",()=>!0)),error:ul(Ws)}),_o([Nr({id:Ri,jsonrpc:_r,result:Dr}),Nr({id:Ri,jsonrpc:_r,error:Ws})]);var gl=ln.internal,pg="Unspecified error message. This is a bug, please report it.",mg={code:gl,message:Oh(gl)},gg="Unspecified server error.";function Oh(t,e=pg){if(function(n){return Number.isInteger(n)}(t)){const n=t.toString();if(Qi(sl,n))return sl[n].message;if(function(r){return r>=-32099&&r<=-32e3}(t))return gg}return e}function yl(t,{fallbackError:e=mg,shouldIncludeStack:n=!0}={}){if(!ml(e))throw new Error("Must provide fallback error with integer number code and string message.");const r=function(i,o){if(i&&typeof i=="object"&&"serialize"in i&&typeof i.serialize=="function")return i.serialize();if(ml(i))return i;const c=Ih(i);return{...o,data:{cause:c}}}(t,e);return n||delete r.stack,r}function Ih(t){return Array.isArray(t)?t.map(e=>Vs(e)?e:al(e)?vl(e):null):al(t)?vl(t):Vs(t)?t:null}function vl(t){return Object.getOwnPropertyNames(t).reduce((e,n)=>{const r=t[n];return Vs(r)&&(e[n]=r),e},{})}var Lh=vr;vr.default=vr,vr.stable=bl,vr.stableStringify=bl;var no="[...]",Nh="[Circular]",Ln=[],Pn=[];function Dh(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function vr(t,e,n,r){var i;r===void 0&&(r=Dh()),Gs(t,"",0,[],void 0,0,r);try{i=Pn.length===0?JSON.stringify(t,e,n):JSON.stringify(t,Bh(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Ln.length!==0;){var o=Ln.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function nr(t,e,n,r){var i=Object.getOwnPropertyDescriptor(r,n);i.get!==void 0?i.configurable?(Object.defineProperty(r,n,{value:t}),Ln.push([r,n,e,i])):Pn.push([e,n,t]):(r[n]=t,Ln.push([r,n,e]))}function Gs(t,e,n,r,i,o,c){var s;if(o+=1,typeof t=="object"&&t!==null){for(s=0;s<r.length;s++)if(r[s]===t)return void nr(Nh,t,e,i);if(c.depthLimit!==void 0&&o>c.depthLimit||c.edgesLimit!==void 0&&n+1>c.edgesLimit)return void nr(no,t,e,i);if(r.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Gs(t[s],s,s,r,t,o,c);else{var a=Object.keys(t);for(s=0;s<a.length;s++){var l=a[s];Gs(t[l],l,s,r,t,o,c)}}r.pop()}}function yg(t,e){return t<e?-1:t>e?1:0}function bl(t,e,n,r){r===void 0&&(r=Dh());var i,o=Ys(t,"",0,[],void 0,0,r)||t;try{i=Pn.length===0?JSON.stringify(o,e,n):JSON.stringify(o,Bh(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Ln.length!==0;){var c=Ln.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return i}function Ys(t,e,n,r,i,o,c){var s;if(o+=1,typeof t=="object"&&t!==null){for(s=0;s<r.length;s++)if(r[s]===t)return void nr(Nh,t,e,i);try{if(typeof t.toJSON=="function")return}catch{return}if(c.depthLimit!==void 0&&o>c.depthLimit||c.edgesLimit!==void 0&&n+1>c.edgesLimit)return void nr(no,t,e,i);if(r.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Ys(t[s],s,s,r,t,o,c);else{var a={},l=Object.keys(t).sort(yg);for(s=0;s<l.length;s++){var u=l[s];Ys(t[u],u,s,r,t,o,c),a[u]=t[u]}if(i===void 0)return a;Ln.push([i,e,t]),i[e]=a}r.pop()}}function Bh(t){return t=t!==void 0?t:function(e,n){return n},function(e,n){if(Pn.length>0)for(var r=0;r<Pn.length;r++){var i=Pn[r];if(i[1]===e&&i[0]===n){n=i[2],Pn.splice(r,1);break}}return t.call(this,e,n)}}var vg=wo(Lh),Ut=class extends Error{constructor(t,e,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!e||typeof e!="string")throw new Error('"message" must be a non-empty string.');super(e),this.code=t,n!==void 0&&(this.data=n)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data,function(e){if(typeof e!="object"||e===null)return!1;try{let n=e;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}catch{return!1}}(this.data)&&(t.data.cause=Ih(this.data.cause))),this.stack&&(t.stack=this.stack),t}toString(){return vg(this.serialize(),bg,2)}};function bg(t,e){if(e!=="[Circular]")return e}var Sr=t=>wg(ln.invalidRequest,t);function wg(t,e){const[n,r]=function(i){if(i){if(typeof i=="string")return[i];if(typeof i=="object"&&!Array.isArray(i)){const{message:o,data:c}=i;if(o&&typeof o!="string")throw new Error("Must specify string message.");return[o??void 0,c]}}return[]}(e);return new Ut(t,n??Oh(t),r)}var $h={};function on(){}function Ee(){Ee.init.call(this)}function Kh(t){return t._maxListeners===void 0?Ee.defaultMaxListeners:t._maxListeners}function wl(t,e,n,r){var i,o,c;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),c=o[e]):(o=t._events=new on,t._eventsCount=0),c){if(typeof c=="function"?c=o[e]=r?[n,c]:[c,n]:r?c.unshift(n):c.push(n),!c.warned&&(i=Kh(t))&&i>0&&c.length>i){c.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=c.length,function(a){typeof console.warn=="function"?console.warn(a):console.log(a)}(s)}}else c=o[e]=n,++t._eventsCount;return t}function El(t,e,n){var r=!1;function i(){t.removeListener(e,i),r||(r=!0,n.apply(t,arguments))}return i.listener=n,i}function _l(t){var e=this._events;if(e){var n=e[t];if(typeof n=="function")return 1;if(n)return n.length}return 0}function pr(t,e){for(var n=new Array(e);e--;)n[e]=t[e];return n}on.prototype=Object.create(null),Ee.EventEmitter=Ee,Ee.usingDomains=!1,Ee.prototype.domain=void 0,Ee.prototype._events=void 0,Ee.prototype._maxListeners=void 0,Ee.defaultMaxListeners=10,Ee.init=function(){this.domain=null,Ee.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new on,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ee.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},Ee.prototype.getMaxListeners=function(){return Kh(this)},Ee.prototype.emit=function(t){var e,n,r,i,o,c,s,a=t==="error";if(c=this._events)a=a&&c.error==null;else if(!a)return!1;if(s=this.domain,a){if(e=arguments[1],!s){if(e instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=s,e.domainThrown=!1,s.emit("error",e),!1}if(!(n=c[t]))return!1;var u=typeof n=="function";switch(r=arguments.length){case 1:(function(d,h,f){if(h)d.call(f);else for(var g=d.length,m=pr(d,g),w=0;w<g;++w)m[w].call(f)})(n,u,this);break;case 2:(function(d,h,f,g){if(h)d.call(f,g);else for(var m=d.length,w=pr(d,m),p=0;p<m;++p)w[p].call(f,g)})(n,u,this,arguments[1]);break;case 3:(function(d,h,f,g,m){if(h)d.call(f,g,m);else for(var w=d.length,p=pr(d,w),S=0;S<w;++S)p[S].call(f,g,m)})(n,u,this,arguments[1],arguments[2]);break;case 4:(function(d,h,f,g,m,w){if(h)d.call(f,g,m,w);else for(var p=d.length,S=pr(d,p),_=0;_<p;++_)S[_].call(f,g,m,w)})(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];(function(d,h,f,g){if(h)d.apply(f,g);else for(var m=d.length,w=pr(d,m),p=0;p<m;++p)w[p].apply(f,g)})(n,u,this,i)}return!0},Ee.prototype.addListener=function(t,e){return wl(this,t,e,!1)},Ee.prototype.on=Ee.prototype.addListener,Ee.prototype.prependListener=function(t,e){return wl(this,t,e,!0)},Ee.prototype.once=function(t,e){if(typeof e!="function")throw new TypeError('"listener" argument must be a function');return this.on(t,El(this,t,e)),this},Ee.prototype.prependOnceListener=function(t,e){if(typeof e!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(t,El(this,t,e)),this},Ee.prototype.removeListener=function(t,e){var n,r,i,o,c;if(typeof e!="function")throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[t]))return this;if(n===e||n.listener&&n.listener===e)--this._eventsCount==0?this._events=new on:(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(i=-1,o=n.length;o-- >0;)if(n[o]===e||n[o].listener&&n[o].listener===e){c=n[o].listener,i=o;break}if(i<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount==0)return this._events=new on,this;delete r[t]}else(function(s,a){for(var l=a,u=l+1,d=s.length;u<d;l+=1,u+=1)s[l]=s[u];s.pop()})(n,i);r.removeListener&&this.emit("removeListener",t,c||e)}return this},Ee.prototype.off=function(t,e){return this.removeListener(t,e)},Ee.prototype.removeAllListeners=function(t){var e,n;if(!(n=this._events))return this;if(!n.removeListener)return arguments.length===0?(this._events=new on,this._eventsCount=0):n[t]&&(--this._eventsCount==0?this._events=new on:delete n[t]),this;if(arguments.length===0){for(var r,i=Object.keys(n),o=0;o<i.length;++o)(r=i[o])!=="removeListener"&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new on,this._eventsCount=0,this}if(typeof(e=n[t])=="function")this.removeListener(t,e);else if(e)do this.removeListener(t,e[e.length-1]);while(e[0]);return this},Ee.prototype.listeners=function(t){var e,n,r=this._events;return n=r&&(e=r[t])?typeof e=="function"?[e.listener||e]:function(i){for(var o=new Array(i.length),c=0;c<o.length;++c)o[c]=i[c].listener||i[c];return o}(e):[],n},Ee.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):_l.call(t,e)},Ee.prototype.listenerCount=_l,Ee.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Ia=qr(Object.freeze({__proto__:null,EventEmitter:Ee,default:Ee}));Object.defineProperty($h,"__esModule",{value:!0});const Eg=Ia;function Sl(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout(()=>{throw r})}}let _g=class extends Eg.EventEmitter{emit(t,...e){let n=t==="error";const r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){let o;if(e.length>0&&([o]=e),o instanceof Error)throw o;const c=new Error("Unhandled error."+(o?` (${o.message})`:""));throw c.context=o,c}const i=r[t];if(i===void 0)return!1;if(typeof i=="function")Sl(i,this,e);else{const o=i.length,c=function(s){const a=s.length,l=new Array(a);for(let u=0;u<a;u+=1)l[u]=s[u];return l}(i);for(let s=0;s<o;s+=1)Sl(c[s],this,e)}return!0}};var ro,un,Jn,br,Pi,Oi,Zs,Ii,Js,ts,Cl,Li,Xs,ns,Al,Cr,io,rs,kl,jh=$h.default=_g,yt=class Ni extends jh{constructor({notificationHandler:e}={}){super(),bt(this,br),bt(this,Oi),bt(this,Ii),bt(this,ro,!1),bt(this,un,void 0),bt(this,Jn,void 0),pi(this,un,[]),pi(this,Jn,e)}destroy(){pn(this,un).forEach(e=>{"destroy"in e&&typeof e.destroy=="function"&&e.destroy()}),pi(this,un,[]),pi(this,ro,!0)}push(e){Fe(this,br,Pi).call(this),pn(this,un).push(e)}handle(e,n){if(Fe(this,br,Pi).call(this),n&&typeof n!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?n?Fe(this,Oi,Zs).call(this,e,n):Fe(this,Oi,Zs).call(this,e):n?Fe(this,Ii,Js).call(this,e,n):this._promiseHandle(e)}asMiddleware(){return Fe(this,br,Pi).call(this),async(e,n,r,i)=>{var o,c;try{const[s,a,l]=await Fe(o=Ni,Li,Xs).call(o,e,n,pn(this,un));return a?(await Fe(c=Ni,Cr,io).call(c,l),i(s)):r(async u=>{var d;try{await Fe(d=Ni,Cr,io).call(d,l)}catch(h){return u(h)}return u()})}catch(s){return i(s)}}}async _promiseHandle(e){return new Promise((n,r)=>{Fe(this,Ii,Js).call(this,e,(i,o)=>{i&&o===void 0?r(i):n(o)}).catch(r)})}};ro=new WeakMap,un=new WeakMap,Jn=new WeakMap,br=new WeakSet,Pi=function(){if(pn(this,ro))throw new Error("This engine is destroyed and can no longer be used.")},Oi=new WeakSet,Zs=async function(t,e){try{if(t.length===0){const r=[{id:null,jsonrpc:"2.0",error:new Ut(ln.invalidRequest,"Request batch must contain plain objects. Received an empty array")}];return e?e(null,r):r}const n=(await Promise.all(t.map(this._promiseHandle.bind(this)))).filter(r=>r!==void 0);return e?e(null,n):n}catch(n){if(e)return e(n);throw n}},Ii=new WeakSet,Js=async function(t,e){var n;if(!t||Array.isArray(t)||typeof t!="object"){const c=new Ut(ln.invalidRequest,"Requests must be plain objects. Received: "+typeof t,{request:t});return e(c,{id:null,jsonrpc:"2.0",error:c})}if(typeof t.method!="string"){const c=new Ut(ln.invalidRequest,"Must specify a string method. Received: "+typeof t.method,{request:t});return pn(this,Jn)&&!pl(t)?e(null):e(c,{id:t.id??null,jsonrpc:"2.0",error:c})}if(pn(this,Jn)&&ar(t,fg)&&!pl(t)){try{await pn(this,Jn).call(this,t)}catch(c){return e(c)}return e(null)}let r=null;const i={...t},o={id:i.id,jsonrpc:i.jsonrpc};try{await Fe(n=yt,ts,Cl).call(n,i,o,pn(this,un))}catch(c){r=c}return r&&(delete o.result,o.error||(o.error=yl(r))),e(r,o)},ts=new WeakSet,Cl=async function(t,e,n){var r,i,o;const[c,s,a]=await Fe(r=yt,Li,Xs).call(r,t,e,n);if(Fe(i=yt,rs,kl).call(i,t,e,s),await Fe(o=yt,Cr,io).call(o,a),c)throw c},Li=new WeakSet,Xs=async function(t,e,n){var r;const i=[];let o=null,c=!1;for(const s of n)if([o,c]=await Fe(r=yt,ns,Al).call(r,t,e,s,i),c)break;return[o,c,i.reverse()]},ns=new WeakSet,Al=async function(t,e,n,r){return new Promise(i=>{const o=s=>{const a=s||e.error;a&&(e.error=yl(a)),i([a,!0])},c=s=>{e.error?o(e.error):(s&&(typeof s!="function"&&o(new Ut(ln.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof s}" for request:
22
+ ${is(t)}`,{request:t})),r.push(s)),i([null,!1]))};try{n(t,e,c,o)}catch(s){o(s)}})},Cr=new WeakSet,io=async function(t){for(const e of t)await new Promise((n,r)=>{e(i=>i?r(i):n())})},rs=new WeakSet,kl=function(t,e,n){if(!Qi(e,"result")&&!Qi(e,"error"))throw new Ut(ln.internal,`JsonRpcEngine: Response has no error or result for request:
23
+ ${is(t)}`,{request:t});if(!n)throw new Ut(ln.internal,`JsonRpcEngine: Nothing ended request:
24
+ ${is(t)}`,{request:t})},bt(yt,ts),bt(yt,Li),bt(yt,ns),bt(yt,Cr),bt(yt,rs);var Sg=yt;function is(t){return JSON.stringify(t,null,2)}var Uh=Object.freeze(["eth_subscription"]),Cg=(t=console)=>[Zm(),Ag(t),Ym(t)];function Ag(t){return(e,n,r)=>{typeof e.method=="string"&&e.method||(n.error=Sr({message:"The request 'method' must be a non-empty string.",data:e})),r(i=>{const{error:o}=n;return o&&t.error(`MetaMask - RPC Error: ${o.message}`,o),i()})}}var Di=(t,e,n=!0)=>(r,i)=>{r||i.error?e(r||i.error):!n||Array.isArray(i)?t(i):t(i.result)},Hh=t=>!!t&&typeof t=="string"&&t.startsWith("0x"),Fh=()=>{};async function Tl(t,e){try{const n=await async function(){return{name:kg(window),icon:await Tg(window)}}();t.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:n},Fh)}catch(n){e.error({message:ke.errors.sendSiteMetadata(),originalError:n})}}function kg(t){const{document:e}=t,n=e.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=e.querySelector('head > meta[name="title"]');return r?r.content:e.title&&e.title.length>0?e.title:window.location.hostname}async function Tg(t){const{document:e}=t,n=e.querySelectorAll('head > link[rel~="icon"]');for(const r of Array.from(n))if(r&&await xg(r.href))return r.href;return null}async function xg(t){return new Promise((e,n)=>{try{const r=document.createElement("img");r.onload=()=>e(!0),r.onerror=()=>e(!1),r.src=t}catch(r){n(r)}})}var zh=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Mt=(t,e,n)=>(zh(t,e,"read from private field"),n?n.call(t):e.get(t)),Qs=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Ht=(t,e,n,r)=>(zh(t,e,"write to private field"),e.set(t,n),n);function xl(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout(()=>{throw r})}}class Mg extends Ee{emit(e,...n){let r=e==="error";const i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){let c;if(n.length>0&&([c]=n),c instanceof Error)throw c;const s=new Error("Unhandled error."+(c?` (${c.message})`:""));throw s.context=c,s}const o=i[e];if(o===void 0)return!1;if(typeof o=="function")xl(o,this,n);else{const c=o.length,s=function(a){const l=a.length,u=new Array(l);for(let d=0;d<l;d+=1)u[d]=a[d];return u}(o);for(let a=0;a<c;a+=1)xl(s[a],this,n)}return!0}}var sn,An,Rg=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if((r=e.length)!=n.length)return!1;for(i=r;i--!=0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if((r=(o=Object.keys(e)).length)!==Object.keys(n).length)return!1;for(i=r;i--!=0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!=0;){var c=o[i];if(!t(e[c],n[c]))return!1}return!0}return e!=e&&n!=n},Pg=wo(Rg),qh=class Vh extends Mg{constructor({logger:e=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),Qs(this,sn,void 0),Qs(this,An,void 0),this._log=e,this.setMaxListeners(n),this._state={...Vh._defaultState},Ht(this,An,null),Ht(this,sn,null),this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);const i=new Sg;r.forEach(o=>i.push(o)),this._rpcEngine=i}get chainId(){return Mt(this,sn)}get selectedAddress(){return Mt(this,An)}isConnected(){return this._state.isConnected}async request(e){if(!e||typeof e!="object"||Array.isArray(e))throw Sr({message:ke.errors.invalidRequestArgs(),data:e});const{method:n,params:r}=e;if(typeof n!="string"||n.length===0)throw Sr({message:ke.errors.invalidRequestMethod(),data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr({message:ke.errors.invalidRequestParams(),data:e});const i=r==null?{method:n}:{method:n,params:r};return new Promise((o,c)=>{this._rpcRequest(i,Di(o,c))})}_initializeState(e){if(this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:n,chainId:r,isUnlocked:i,networkVersion:o}=e;this._handleConnect(r),this._handleChainChanged({chainId:r,networkVersion:o}),this._handleUnlockStateChanged({accounts:n,isUnlocked:i}),this._handleAccountsChanged(n)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,n){let r=n;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),e.method!=="eth_accounts"&&e.method!=="eth_requestAccounts"||(r=(i,o)=>{this._handleAccountsChanged(o.result??[],e.method==="eth_accounts"),n(i,o)})),this._rpcEngine.handle(e,r)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(ke.info.connected(e)))}_handleDisconnect(e,n){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let r;this._state.isConnected=!1,e?(r=new Ut(1013,n??ke.errors.disconnected()),this._log.debug(r)):(r=new Ut(1011,n??ke.errors.permanentlyDisconnected()),this._log.error(r),Ht(this,sn,null),this._state.accounts=null,Ht(this,An,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}_handleChainChanged({chainId:e}={}){Hh(e)?(this._handleConnect(e),e!==Mt(this,sn)&&(Ht(this,sn,e),this._state.initialized&&this.emit("chainChanged",Mt(this,sn)))):this._log.error(ke.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,n=!1){let r=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),r=[]);for(const i of e)if(typeof i!="string"){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),r=[];break}if(!Pg(this._state.accounts,r)&&(n&&this._state.accounts!==null&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",r),this._state.accounts=r,Mt(this,An)!==r[0]&&Ht(this,An,r[0]||null),this._state.initialized)){const i=[...r];this.emit("accountsChanged",i)}}_handleUnlockStateChanged({accounts:e,isUnlocked:n}={}){typeof n=="boolean"?n!==this._state.isUnlocked&&(this._state.isUnlocked=n,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}};sn=new WeakMap,An=new WeakMap,qh._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var La,Og=qh,ea={exports:{}},Wh=Ia.EventEmitter,Na=qr(W0);La=typeof Object.create=="function"?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t};var Gh=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},Ig=/%[sdj%]/g;function So(t){if(!Br(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(Lt(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(t).replace(Ig,function(s){if(s==="%%")return"%";if(n>=i)return s;switch(s){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return s}}),c=r[n];n<i;c=r[++n])Gr(c)||!Dn(c)?o+=" "+c:o+=" "+Lt(c);return o}function Da(t,e){if(Pt(Ge.process))return function(){return Da(t,e).apply(this,arguments)};if(be.noDeprecation===!0)return t;var n=!1;return function(){if(!n){if(be.throwDeprecation)throw new Error(e);be.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}}var os,gi={};function Yh(t){return Pt(os)&&(os=be.env.NODE_DEBUG||""),t=t.toUpperCase(),!gi[t]&&(new RegExp("\\b"+t+"\\b","i").test(os)?gi[t]=function(){var e=So.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:gi[t]=function(){}),gi[t]}function Lt(t,e){var n={seen:[],stylize:Ng};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Co(e)?n.showHidden=e:e&&ja(n,e),Pt(n.showHidden)&&(n.showHidden=!1),Pt(n.depth)&&(n.depth=2),Pt(n.colors)&&(n.colors=!1),Pt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Lg),oo(n,t,n.depth)}function Lg(t,e){var n=Lt.styles[e];return n?"\x1B["+Lt.colors[n][0]+"m"+t+"\x1B["+Lt.colors[n][1]+"m":t}function Ng(t,e){return t}function oo(t,e,n){if(t.customInspect&&e&&Tr(e.inspect)&&e.inspect!==Lt&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Br(r)||(r=oo(t,r,n)),r}var i=function(h,f){if(Pt(f))return h.stylize("undefined","undefined");if(Br(f)){var g="'"+JSON.stringify(f).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return h.stylize(g,"string")}if($a(f))return h.stylize(""+f,"number");if(Co(f))return h.stylize(""+f,"boolean");if(Gr(f))return h.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),c=function(h){var f={};return h.forEach(function(g,m){f[g]=!0}),f}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),kr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ss(e);if(o.length===0){if(Tr(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Ar(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(so(e))return t.stylize(Date.prototype.toString.call(e),"date");if(kr(e))return ss(e)}var a,l="",u=!1,d=["{","}"];return Ba(e)&&(u=!0,d=["[","]"]),Tr(e)&&(l=" [Function"+(e.name?": "+e.name:"")+"]"),Ar(e)&&(l=" "+RegExp.prototype.toString.call(e)),so(e)&&(l=" "+Date.prototype.toUTCString.call(e)),kr(e)&&(l=" "+ss(e)),o.length!==0||u&&e.length!=0?n<0?Ar(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),a=u?function(h,f,g,m,w){for(var p=[],S=0,_=f.length;S<_;++S)tf(f,String(S))?p.push(as(h,f,g,m,String(S),!0)):p.push("");return w.forEach(function(P){P.match(/^\d+$/)||p.push(as(h,f,g,m,P,!0))}),p}(t,e,n,c,o):o.map(function(h){return as(t,e,n,c,h,u)}),t.seen.pop(),function(h,f,g){var m=h.reduce(function(w,p){return p.indexOf(`
25
+ `),w+p.replace(/\u001b\[\d\d?m/g,"").length+1},0);return m>60?g[0]+(f===""?"":f+`
26
+ `)+" "+h.join(`,
27
+ `)+" "+g[1]:g[0]+f+" "+h.join(", ")+" "+g[1]}(a,l,d)):d[0]+l+d[1]}function ss(t){return"["+Error.prototype.toString.call(t)+"]"}function as(t,e,n,r,i,o){var c,s,a;if((a=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=a.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):a.set&&(s=t.stylize("[Setter]","special")),tf(r,i)||(c="["+i+"]"),s||(t.seen.indexOf(a.value)<0?(s=Gr(n)?oo(t,a.value,null):oo(t,a.value,n-1)).indexOf(`
28
+ `)>-1&&(s=o?s.split(`
29
+ `).map(function(l){return" "+l}).join(`
30
+ `).substr(2):`
31
+ `+s.split(`
32
+ `).map(function(l){return" "+l}).join(`
33
+ `)):s=t.stylize("[Circular]","special")),Pt(c)){if(o&&i.match(/^\d+$/))return s;(c=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=t.stylize(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=t.stylize(c,"string"))}return c+": "+s}function Ba(t){return Array.isArray(t)}function Co(t){return typeof t=="boolean"}function Gr(t){return t===null}function Zh(t){return t==null}function $a(t){return typeof t=="number"}function Br(t){return typeof t=="string"}function Jh(t){return typeof t=="symbol"}function Pt(t){return t===void 0}function Ar(t){return Dn(t)&&Ka(t)==="[object RegExp]"}function Dn(t){return typeof t=="object"&&t!==null}function so(t){return Dn(t)&&Ka(t)==="[object Date]"}function kr(t){return Dn(t)&&(Ka(t)==="[object Error]"||t instanceof Error)}function Tr(t){return typeof t=="function"}function Xh(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0}function Qh(t){return X.isBuffer(t)}function Ka(t){return Object.prototype.toString.call(t)}function cs(t){return t<10?"0"+t.toString(10):t.toString(10)}Lt.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Lt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Dg=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ef(){var t,e;console.log("%s - %s",(t=new Date,e=[cs(t.getHours()),cs(t.getMinutes()),cs(t.getSeconds())].join(":"),[t.getDate(),Dg[t.getMonth()],e].join(" ")),So.apply(null,arguments))}function ja(t,e){if(!e||!Dn(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function tf(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var kn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Ua(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(kn&&t[kn]){var e;if(typeof(e=t[kn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,kn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,i=new Promise(function(s,a){n=s,r=a}),o=[],c=0;c<arguments.length;c++)o.push(arguments[c]);o.push(function(s,a){s?r(s):n(a)});try{t.apply(this,o)}catch(s){r(s)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),kn&&Object.defineProperty(e,kn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,Gh(t))}function Bg(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}function nf(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var i=n.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var o=this,c=function(){return i.apply(o,arguments)};t.apply(this,n).then(function(s){be.nextTick(c.bind(null,null,s))},function(s){be.nextTick(Bg.bind(null,s,c))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,Gh(t)),e}Ua.custom=kn;var ls,Ml,$g={inherits:La,_extend:ja,log:ef,isBuffer:Qh,isPrimitive:Xh,isFunction:Tr,isError:kr,isDate:so,isObject:Dn,isRegExp:Ar,isUndefined:Pt,isSymbol:Jh,isString:Br,isNumber:$a,isNullOrUndefined:Zh,isNull:Gr,isBoolean:Co,isArray:Ba,inspect:Lt,deprecate:Da,format:So,debuglog:Yh,promisify:Ua,callbackify:nf},rf=qr(Object.freeze({__proto__:null,_extend:ja,callbackify:nf,debuglog:Yh,default:$g,deprecate:Da,format:So,inherits:La,inspect:Lt,isArray:Ba,isBoolean:Co,isBuffer:Qh,isDate:so,isError:kr,isFunction:Tr,isNull:Gr,isNullOrUndefined:Zh,isNumber:$a,isObject:Dn,isPrimitive:Xh,isRegExp:Ar,isString:Br,isSymbol:Jh,isUndefined:Pt,log:ef,promisify:Ua}));function Kg(){if(Ml)return ls;function t(a,l){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);l&&(d=d.filter(function(h){return Object.getOwnPropertyDescriptor(a,h).enumerable})),u.push.apply(u,d)}return u}function e(a){for(var l=1;l<arguments.length;l++){var u=arguments[l]!=null?arguments[l]:{};l%2?t(Object(u),!0).forEach(function(d){n(a,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):t(Object(u)).forEach(function(d){Object.defineProperty(a,d,Object.getOwnPropertyDescriptor(u,d))})}return a}function n(a,l,u){return(l=i(l))in a?Object.defineProperty(a,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[l]=u,a}function r(a,l,u){return l&&function(d,h){for(var f=0;f<h.length;f++){var g=h[f];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(d,i(g.key),g)}}(a.prototype,l),Object.defineProperty(a,"prototype",{writable:!1}),a}function i(a){var l=function(u,d){if(typeof u!="object"||u===null)return u;var h=u[Symbol.toPrimitive];if(h!==void 0){var f=h.call(u,d);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)}(a,"string");return typeof l=="symbol"?l:String(l)}Ml=1;var o=Na.Buffer,c=rf.inspect,s=c&&c.custom||"inspect";return ls=function(){function a(){(function(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")})(this,a),this.head=null,this.tail=null,this.length=0}return r(a,[{key:"push",value:function(l){var u={data:l,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}},{key:"unshift",value:function(l){var u={data:l,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}},{key:"shift",value:function(){if(this.length!==0){var l=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,l}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(l){if(this.length===0)return"";for(var u=this.head,d=""+u.data;u=u.next;)d+=l+u.data;return d}},{key:"concat",value:function(l){if(this.length===0)return o.alloc(0);for(var u,d,h,f=o.allocUnsafe(l>>>0),g=this.head,m=0;g;)u=g.data,d=f,h=m,o.prototype.copy.call(u,d,h),m+=g.data.length,g=g.next;return f}},{key:"consume",value:function(l,u){var d;return l<this.head.data.length?(d=this.head.data.slice(0,l),this.head.data=this.head.data.slice(l)):d=l===this.head.data.length?this.shift():u?this._getString(l):this._getBuffer(l),d}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(l){var u=this.head,d=1,h=u.data;for(l-=h.length;u=u.next;){var f=u.data,g=l>f.length?f.length:l;if(g===f.length?h+=f:h+=f.slice(0,l),(l-=g)===0){g===f.length?(++d,u.next?this.head=u.next:this.head=this.tail=null):(this.head=u,u.data=f.slice(g));break}++d}return this.length-=d,h}},{key:"_getBuffer",value:function(l){var u=o.allocUnsafe(l),d=this.head,h=1;for(d.data.copy(u),l-=d.data.length;d=d.next;){var f=d.data,g=l>f.length?f.length:l;if(f.copy(u,u.length-l,0,g),(l-=g)===0){g===f.length?(++h,d.next?this.head=d.next:this.head=this.tail=null):(this.head=d,d.data=f.slice(g));break}++h}return this.length-=h,u}},{key:s,value:function(l,u){return c(this,e(e({},u),{},{depth:0,customInspect:!1}))}}]),a}(),ls}function Rl(t,e){ta(t,e),Bi(t)}function Bi(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function ta(t,e){t.emit("error",e)}var of={destroy:function(t,e){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,be.nextTick(ta,this,t)):be.nextTick(ta,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?n._writableState?n._writableState.errorEmitted?be.nextTick(Bi,n):(n._writableState.errorEmitted=!0,be.nextTick(Rl,n,o)):be.nextTick(Rl,n,o):e?(be.nextTick(Bi,n),e(o)):be.nextTick(Bi,n)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}},Bn={},sf={};function at(t,e,n){n||(n=Error);var r=function(i){var o,c;function s(a,l,u){return i.call(this,function(d,h,f){return typeof e=="string"?e:e(d,h,f)}(a,l,u))||this}return c=i,(o=s).prototype=Object.create(c.prototype),o.prototype.constructor=o,o.__proto__=c,s}(n);r.prototype.name=n.name,r.prototype.code=t,sf[t]=r}function Pl(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map(function(r){return String(r)}),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:n===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}at("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),at("ERR_INVALID_ARG_TYPE",function(t,e,n){var r,i,o;if(typeof e=="string"&&(i="not ",e.substr(0,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(s,a,l){return(l===void 0||l>s.length)&&(l=s.length),s.substring(l-a.length,l)===a}(t," argument"))o="The ".concat(t," ").concat(r," ").concat(Pl(e,"type"));else{var c=function(s,a,l){return typeof l!="number"&&(l=0),!(l+a.length>s.length)&&s.indexOf(a,l)!==-1}(t,".")?"property":"argument";o='The "'.concat(t,'" ').concat(c," ").concat(r," ").concat(Pl(e,"type"))}return o+=". Received type ".concat(typeof n)},TypeError),at("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),at("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),at("ERR_STREAM_PREMATURE_CLOSE","Premature close"),at("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),at("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),at("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),at("ERR_STREAM_WRITE_AFTER_END","write after end"),at("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),at("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),at("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Bn.codes=sf;var jg=Bn.codes.ERR_INVALID_OPT_VALUE,us,Ol,ds,Il,af={getHighWaterMark:function(t,e,n,r){var i=function(o,c,s){return o.highWaterMark!=null?o.highWaterMark:c?o[s]:null}(e,r,n);if(i!=null){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new jg(r?n:"highWaterMark",i);return Math.floor(i)}return t.objectMode?16:16384}},Ug=typeof Object.create=="function"?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},Yr=qr(Object.freeze({__proto__:null,default:Ug})),Hg=function(t,e){if(hs("noDeprecation"))return t;var n=!1;return function(){if(!n){if(hs("throwDeprecation"))throw new Error(e);hs("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}};function hs(t){try{if(!mt.localStorage)return!1}catch{return!1}var e=mt.localStorage[t];return e!=null&&String(e).toLowerCase()==="true"}function cf(){if(Ol)return us;function t($){var N=this;this.next=null,this.entry=null,this.finish=function(){(function(R,C,O){var D=R.entry;for(R.entry=null;D;){var y=D.callback;C.pendingcb--,y(O),D=D.next}C.corkedRequestsFree.next=R})(N,$)}}var e;Ol=1,us=I,I.WritableState=P;var n={deprecate:Hg},r=Wh,i=Na.Buffer,o=(mt!==void 0?mt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},c,s=of,a=af.getHighWaterMark,l=Bn.codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,h=l.ERR_MULTIPLE_CALLBACK,f=l.ERR_STREAM_CANNOT_PIPE,g=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,w=l.ERR_STREAM_WRITE_AFTER_END,p=l.ERR_UNKNOWN_ENCODING,S=s.errorOrDestroy;function _(){}function P($,N,R){e=e||ir(),$=$||{},typeof R!="boolean"&&(R=N instanceof e),this.objectMode=!!$.objectMode,R&&(this.objectMode=this.objectMode||!!$.writableObjectMode),this.highWaterMark=a(this,$,"writableHighWaterMark",R),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var C=$.decodeStrings===!1;this.decodeStrings=!C,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(O){(function(D,y){var E=D._writableState,k=E.sync,x=E.writecb;if(typeof x!="function")throw new h;if(function(v){v.writing=!1,v.writecb=null,v.length-=v.writelen,v.writelen=0}(E),y)(function(v,A,T,M,L){--A.pendingcb,T?(be.nextTick(L,M),be.nextTick(G,v,A),v._writableState.errorEmitted=!0,S(v,M)):(L(M),v._writableState.errorEmitted=!0,S(v,M),G(v,A))})(D,E,k,y,x);else{var b=U(E)||D.destroyed;b||E.corked||E.bufferProcessing||!E.bufferedRequest||F(D,E),k?be.nextTick(q,D,E,b,x):q(D,E,b,x)}})(N,O)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=$.emitClose!==!1,this.autoDestroy=!!$.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function I($){var N=this instanceof(e=e||ir());if(!N&&!c.call(I,this))return new I($);this._writableState=new P($,this,N),this.writable=!0,$&&(typeof $.write=="function"&&(this._write=$.write),typeof $.writev=="function"&&(this._writev=$.writev),typeof $.destroy=="function"&&(this._destroy=$.destroy),typeof $.final=="function"&&(this._final=$.final)),r.call(this)}function K($,N,R,C,O,D,y){N.writelen=C,N.writecb=y,N.writing=!0,N.sync=!0,N.destroyed?N.onwrite(new g("write")):R?$._writev(O,N.onwrite):$._write(O,D,N.onwrite),N.sync=!1}function q($,N,R,C){R||function(O,D){D.length===0&&D.needDrain&&(D.needDrain=!1,O.emit("drain"))}($,N),N.pendingcb--,C(),G($,N)}function F($,N){N.bufferProcessing=!0;var R=N.bufferedRequest;if($._writev&&R&&R.next){var C=N.bufferedRequestCount,O=new Array(C),D=N.corkedRequestsFree;D.entry=R;for(var y=0,E=!0;R;)O[y]=R,R.isBuf||(E=!1),R=R.next,y+=1;O.allBuffers=E,K($,N,!0,N.length,O,"",D.finish),N.pendingcb++,N.lastBufferedRequest=null,D.next?(N.corkedRequestsFree=D.next,D.next=null):N.corkedRequestsFree=new t(N),N.bufferedRequestCount=0}else{for(;R;){var k=R.chunk,x=R.encoding,b=R.callback;if(K($,N,!1,N.objectMode?1:k.length,k,x,b),R=R.next,N.bufferedRequestCount--,N.writing)break}R===null&&(N.lastBufferedRequest=null)}N.bufferedRequest=R,N.bufferProcessing=!1}function U($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function j($,N){$._final(function(R){N.pendingcb--,R&&S($,R),N.prefinished=!0,$.emit("prefinish"),G($,N)})}function G($,N){var R=U(N);if(R&&(function(O,D){D.prefinished||D.finalCalled||(typeof O._final!="function"||D.destroyed?(D.prefinished=!0,O.emit("prefinish")):(D.pendingcb++,D.finalCalled=!0,be.nextTick(j,O,D)))}($,N),N.pendingcb===0&&(N.finished=!0,$.emit("finish"),N.autoDestroy))){var C=$._readableState;(!C||C.autoDestroy&&C.endEmitted)&&$.destroy()}return R}return Yr(I,r),P.prototype.getBuffer=function(){for(var $=this.bufferedRequest,N=[];$;)N.push($),$=$.next;return N},function(){try{Object.defineProperty(P.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(I,Symbol.hasInstance,{value:function($){return!!c.call(this,$)||this===I&&$&&$._writableState instanceof P}})):c=function($){return $ instanceof this},I.prototype.pipe=function(){S(this,new f)},I.prototype.write=function($,N,R){var C,O=this._writableState,D=!1,y=!O.objectMode&&(C=$,i.isBuffer(C)||C instanceof o);return y&&!i.isBuffer($)&&($=function(E){return i.from(E)}($)),typeof N=="function"&&(R=N,N=null),y?N="buffer":N||(N=O.defaultEncoding),typeof R!="function"&&(R=_),O.ending?function(E,k){var x=new w;S(E,x),be.nextTick(k,x)}(this,R):(y||function(E,k,x,b){var v;return x===null?v=new m:typeof x=="string"||k.objectMode||(v=new u("chunk",["string","Buffer"],x)),!v||(S(E,v),be.nextTick(b,v),!1)}(this,O,$,R))&&(O.pendingcb++,D=function(E,k,x,b,v,A){if(!x){var T=function(H,z,J){return H.objectMode||H.decodeStrings===!1||typeof z!="string"||(z=i.from(z,J)),z}(k,b,v);b!==T&&(x=!0,v="buffer",b=T)}var M=k.objectMode?1:b.length;k.length+=M;var L=k.length<k.highWaterMark;if(L||(k.needDrain=!0),k.writing||k.corked){var B=k.lastBufferedRequest;k.lastBufferedRequest={chunk:b,encoding:v,isBuf:x,callback:A,next:null},B?B.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else K(E,k,!1,M,b,v,A);return L}(this,O,y,$,N,R)),D},I.prototype.cork=function(){this._writableState.corked++},I.prototype.uncork=function(){var $=this._writableState;$.corked&&($.corked--,$.writing||$.corked||$.bufferProcessing||!$.bufferedRequest||F(this,$))},I.prototype.setDefaultEncoding=function($){if(typeof $=="string"&&($=$.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf(($+"").toLowerCase())>-1))throw new p($);return this._writableState.defaultEncoding=$,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),I.prototype._write=function($,N,R){R(new d("_write()"))},I.prototype._writev=null,I.prototype.end=function($,N,R){var C=this._writableState;return typeof $=="function"?(R=$,$=null,N=null):typeof N=="function"&&(R=N,N=null),$!=null&&this.write($,N),C.corked&&(C.corked=1,this.uncork()),C.ending||function(O,D,y){D.ending=!0,G(O,D),y&&(D.finished?be.nextTick(y):O.once("finish",y)),D.ended=!0,O.writable=!1}(this,C,R),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function($){this._writableState&&(this._writableState.destroyed=$)}}),I.prototype.destroy=s.destroy,I.prototype._undestroy=s.undestroy,I.prototype._destroy=function($,N){N($)},us}function ir(){if(Il)return ds;Il=1;var t=Object.keys||function(l){var u=[];for(var d in l)u.push(d);return u};ds=c;var e=lf(),n=cf();Yr(c,e);for(var r=t(n.prototype),i=0;i<r.length;i++){var o=r[i];c.prototype[o]||(c.prototype[o]=n.prototype[o])}function c(l){if(!(this instanceof c))return new c(l);e.call(this,l),n.call(this,l),this.allowHalfOpen=!0,l&&(l.readable===!1&&(this.readable=!1),l.writable===!1&&(this.writable=!1),l.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||be.nextTick(a,this)}function a(l){l.end()}return Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(l){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=l,this._writableState.destroyed=l)}}),ds}var Fg=X.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function $i(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Fg(e))throw new Error("Unknown encoding: "+e)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=qg;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Vg;break;default:return void(this.write=zg)}this.charBuffer=new X(6),this.charReceived=0,this.charLength=0}function zg(t){return t.toString(this.encoding)}function qg(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function Vg(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}$i.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(t=t.slice(n,t.length),!((i=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,t.length===0)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,r),r-=this.charReceived);var i;if(r=(e+=t.toString(this.encoding,0,r)).length-1,(i=e.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,r)}return e},$i.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(e==1&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},$i.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e};var Ll=qr(Object.freeze({__proto__:null,StringDecoder:$i})),Nl=Bn.codes.ERR_STREAM_PREMATURE_CLOSE;function Wg(){}var fs,Dl,Bl,$l,ps,Kl,Ha=function t(e,n,r){if(typeof n=="function")return t(e,null,n);n||(n={}),r=function(g){var m=!1;return function(){if(!m){m=!0;for(var w=arguments.length,p=new Array(w),S=0;S<w;S++)p[S]=arguments[S];g.apply(this,p)}}}(r||Wg);var i=n.readable||n.readable!==!1&&e.readable,o=n.writable||n.writable!==!1&&e.writable,c=function(){e.writable||a()},s=e._writableState&&e._writableState.finished,a=function(){o=!1,s=!0,i||r.call(e)},l=e._readableState&&e._readableState.endEmitted,u=function(){i=!1,l=!0,o||r.call(e)},d=function(g){r.call(e,g)},h=function(){var g;return i&&!l?(e._readableState&&e._readableState.ended||(g=new Nl),r.call(e,g)):o&&!s?(e._writableState&&e._writableState.ended||(g=new Nl),r.call(e,g)):void 0},f=function(){e.req.on("finish",a)};return function(g){return g.setHeader&&typeof g.abort=="function"}(e)?(e.on("complete",a),e.on("abort",h),e.req?f():e.on("request",f)):o&&!e._writableState&&(e.on("end",c),e.on("close",c)),e.on("end",u),e.on("finish",a),n.error!==!1&&e.on("error",d),e.on("close",h),function(){e.removeListener("complete",a),e.removeListener("abort",h),e.removeListener("request",f),e.req&&e.req.removeListener("finish",a),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",a),e.removeListener("end",u),e.removeListener("error",d),e.removeListener("close",h)}};function Gg(){if(Dl)return fs;var t;function e(m,w,p){return(w=function(S){var _=function(P,I){if(typeof P!="object"||P===null)return P;var K=P[Symbol.toPrimitive];if(K!==void 0){var q=K.call(P,I);if(typeof q!="object")return q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(I==="string"?String:Number)(P)}(S,"string");return typeof _=="symbol"?_:String(_)}(w))in m?Object.defineProperty(m,w,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[w]=p,m}Dl=1;var n=Ha,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),c=Symbol("ended"),s=Symbol("lastPromise"),a=Symbol("handlePromise"),l=Symbol("stream");function u(m,w){return{value:m,done:w}}function d(m){var w=m[r];if(w!==null){var p=m[l].read();p!==null&&(m[s]=null,m[r]=null,m[i]=null,w(u(p,!1)))}}function h(m){be.nextTick(d,m)}var f=Object.getPrototypeOf(function(){}),g=Object.setPrototypeOf((e(t={get stream(){return this[l]},next:function(){var m=this,w=this[o];if(w!==null)return Promise.reject(w);if(this[c])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise(function(P,I){be.nextTick(function(){m[o]?I(m[o]):P(u(void 0,!0))})});var p,S=this[s];if(S)p=new Promise(function(P,I){return function(K,q){P.then(function(){I[c]?K(u(void 0,!0)):I[a](K,q)},q)}}(S,this));else{var _=this[l].read();if(_!==null)return Promise.resolve(u(_,!1));p=new Promise(this[a])}return this[s]=p,p}},Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var m=this;return new Promise(function(w,p){m[l].destroy(null,function(S){S?p(S):w(u(void 0,!0))})})}),t),f);return fs=function(m){var w,p=Object.create(g,(e(w={},l,{value:m,writable:!0}),e(w,r,{value:null,writable:!0}),e(w,i,{value:null,writable:!0}),e(w,o,{value:null,writable:!0}),e(w,c,{value:m._readableState.endEmitted,writable:!0}),e(w,a,{value:function(S,_){var P=p[l].read();P?(p[s]=null,p[r]=null,p[i]=null,S(u(P,!1))):(p[r]=S,p[i]=_)},writable:!0}),w));return p[s]=null,n(m,function(S){if(S&&S.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=p[i];return _!==null&&(p[s]=null,p[r]=null,p[i]=null,_(S)),void(p[o]=S)}var P=p[r];P!==null&&(p[s]=null,p[r]=null,p[i]=null,P(u(void 0,!0))),p[c]=!0}),m.on("readable",h.bind(null,p)),p},fs}function lf(){if(Kl)return ps;var t;Kl=1,ps=I,I.ReadableState=P,Ia.EventEmitter;var e=function(b,v){return b.listeners(v).length},n=Wh,r=Na.Buffer,i=(mt!==void 0?mt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},o,c=rf;o=c&&c.debuglog?c.debuglog("stream"):function(){};var s,a,l,u=Kg(),d=of,h=af.getHighWaterMark,f=Bn.codes,g=f.ERR_INVALID_ARG_TYPE,m=f.ERR_STREAM_PUSH_AFTER_EOF,w=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Yr(I,n);var S=d.errorOrDestroy,_=["error","close","destroy","pause","resume"];function P(b,v,A){t=t||ir(),b=b||{},typeof A!="boolean"&&(A=v instanceof t),this.objectMode=!!b.objectMode,A&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=h(this,b,"readableHighWaterMark",A),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(s||(s=Ll.StringDecoder),this.decoder=new s(b.encoding),this.encoding=b.encoding)}function I(b){if(t=t||ir(),!(this instanceof I))return new I(b);var v=this instanceof t;this._readableState=new P(b,this,v),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),n.call(this)}function K(b,v,A,T,M){o("readableAddChunk",v);var L,B=b._readableState;if(v===null)B.reading=!1,function(H,z){if(o("onEofChunk"),!z.ended){if(z.decoder){var J=z.decoder.end();J&&J.length&&(z.buffer.push(J),z.length+=z.objectMode?1:J.length)}z.ended=!0,z.sync?j(H):(z.needReadable=!1,z.emittedReadable||(z.emittedReadable=!0,G(H)))}}(b,B);else if(M||(L=function(H,z){var J;Q=z,r.isBuffer(Q)||Q instanceof i||typeof z=="string"||z===void 0||H.objectMode||(J=new g("chunk",["string","Buffer","Uint8Array"],z));var Q;return J}(B,v)),L)S(b,L);else if(B.objectMode||v&&v.length>0)if(typeof v=="string"||B.objectMode||Object.getPrototypeOf(v)===r.prototype||(v=function(H){return r.from(H)}(v)),T)B.endEmitted?S(b,new p):q(b,B,v,!0);else if(B.ended)S(b,new m);else{if(B.destroyed)return!1;B.reading=!1,B.decoder&&!A?(v=B.decoder.write(v),B.objectMode||v.length!==0?q(b,B,v,!1):$(b,B)):q(b,B,v,!1)}else T||(B.reading=!1,$(b,B));return!B.ended&&(B.length<B.highWaterMark||B.length===0)}function q(b,v,A,T){v.flowing&&v.length===0&&!v.sync?(v.awaitDrain=0,b.emit("data",A)):(v.length+=v.objectMode?1:A.length,T?v.buffer.unshift(A):v.buffer.push(A),v.needReadable&&j(b)),$(b,v)}Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(b){this._readableState&&(this._readableState.destroyed=b)}}),I.prototype.destroy=d.destroy,I.prototype._undestroy=d.undestroy,I.prototype._destroy=function(b,v){v(b)},I.prototype.push=function(b,v){var A,T=this._readableState;return T.objectMode?A=!0:typeof b=="string"&&((v=v||T.defaultEncoding)!==T.encoding&&(b=r.from(b,v),v=""),A=!0),K(this,b,v,!1,A)},I.prototype.unshift=function(b){return K(this,b,null,!0,!1)},I.prototype.isPaused=function(){return this._readableState.flowing===!1},I.prototype.setEncoding=function(b){s||(s=Ll.StringDecoder);var v=new s(b);this._readableState.decoder=v,this._readableState.encoding=this._readableState.decoder.encoding;for(var A=this._readableState.buffer.head,T="";A!==null;)T+=v.write(A.data),A=A.next;return this._readableState.buffer.clear(),T!==""&&this._readableState.buffer.push(T),this._readableState.length=T.length,this};var F=1073741824;function U(b,v){return b<=0||v.length===0&&v.ended?0:v.objectMode?1:b!=b?v.flowing&&v.length?v.buffer.head.data.length:v.length:(b>v.highWaterMark&&(v.highWaterMark=function(A){return A>=F?A=F:(A--,A|=A>>>1,A|=A>>>2,A|=A>>>4,A|=A>>>8,A|=A>>>16,A++),A}(b)),b<=v.length?b:v.ended?v.length:(v.needReadable=!0,0))}function j(b){var v=b._readableState;o("emitReadable",v.needReadable,v.emittedReadable),v.needReadable=!1,v.emittedReadable||(o("emitReadable",v.flowing),v.emittedReadable=!0,be.nextTick(G,b))}function G(b){var v=b._readableState;o("emitReadable_",v.destroyed,v.length,v.ended),v.destroyed||!v.length&&!v.ended||(b.emit("readable"),v.emittedReadable=!1),v.needReadable=!v.flowing&&!v.ended&&v.length<=v.highWaterMark,D(b)}function $(b,v){v.readingMore||(v.readingMore=!0,be.nextTick(N,b,v))}function N(b,v){for(;!v.reading&&!v.ended&&(v.length<v.highWaterMark||v.flowing&&v.length===0);){var A=v.length;if(o("maybeReadMore read 0"),b.read(0),A===v.length)break}v.readingMore=!1}function R(b){var v=b._readableState;v.readableListening=b.listenerCount("readable")>0,v.resumeScheduled&&!v.paused?v.flowing=!0:b.listenerCount("data")>0&&b.resume()}function C(b){o("readable nexttick read 0"),b.read(0)}function O(b,v){o("resume",v.reading),v.reading||b.read(0),v.resumeScheduled=!1,b.emit("resume"),D(b),v.flowing&&!v.reading&&b.read(0)}function D(b){var v=b._readableState;for(o("flow",v.flowing);v.flowing&&b.read()!==null;);}function y(b,v){return v.length===0?null:(v.objectMode?A=v.buffer.shift():!b||b>=v.length?(A=v.decoder?v.buffer.join(""):v.buffer.length===1?v.buffer.first():v.buffer.concat(v.length),v.buffer.clear()):A=v.buffer.consume(b,v.decoder),A);var A}function E(b){var v=b._readableState;o("endReadable",v.endEmitted),v.endEmitted||(v.ended=!0,be.nextTick(k,v,b))}function k(b,v){if(o("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,v.readable=!1,v.emit("end"),b.autoDestroy)){var A=v._writableState;(!A||A.autoDestroy&&A.finished)&&v.destroy()}}function x(b,v){for(var A=0,T=b.length;A<T;A++)if(b[A]===v)return A;return-1}return I.prototype.read=function(b){o("read",b),b=parseInt(b,10);var v=this._readableState,A=b;if(b!==0&&(v.emittedReadable=!1),b===0&&v.needReadable&&((v.highWaterMark!==0?v.length>=v.highWaterMark:v.length>0)||v.ended))return o("read: emitReadable",v.length,v.ended),v.length===0&&v.ended?E(this):j(this),null;if((b=U(b,v))===0&&v.ended)return v.length===0&&E(this),null;var T,M=v.needReadable;return o("need readable",M),(v.length===0||v.length-b<v.highWaterMark)&&o("length less than watermark",M=!0),v.ended||v.reading?o("reading or ended",M=!1):M&&(o("do read"),v.reading=!0,v.sync=!0,v.length===0&&(v.needReadable=!0),this._read(v.highWaterMark),v.sync=!1,v.reading||(b=U(A,v))),(T=b>0?y(b,v):null)===null?(v.needReadable=v.length<=v.highWaterMark,b=0):(v.length-=b,v.awaitDrain=0),v.length===0&&(v.ended||(v.needReadable=!0),A!==b&&v.ended&&E(this)),T!==null&&this.emit("data",T),T},I.prototype._read=function(b){S(this,new w("_read()"))},I.prototype.pipe=function(b,v){var A=this,T=this._readableState;switch(T.pipesCount){case 0:T.pipes=b;break;case 1:T.pipes=[T.pipes,b];break;default:T.pipes.push(b)}T.pipesCount+=1,o("pipe count=%d opts=%j",T.pipesCount,v);var M=(!v||v.end!==!1)&&b!==be.stdout&&b!==be.stderr?B:ce;function L(ne,re){o("onunpipe"),ne===A&&re&&re.hasUnpiped===!1&&(re.hasUnpiped=!0,o("cleanup"),b.removeListener("close",te),b.removeListener("finish",oe),b.removeListener("drain",H),b.removeListener("error",Q),b.removeListener("unpipe",L),A.removeListener("end",B),A.removeListener("end",ce),A.removeListener("data",J),z=!0,!T.awaitDrain||b._writableState&&!b._writableState.needDrain||H())}function B(){o("onend"),b.end()}T.endEmitted?be.nextTick(M):A.once("end",M),b.on("unpipe",L);var H=function(ne){return function(){var re=ne._readableState;o("pipeOnDrain",re.awaitDrain),re.awaitDrain&&re.awaitDrain--,re.awaitDrain===0&&e(ne,"data")&&(re.flowing=!0,D(ne))}}(A);b.on("drain",H);var z=!1;function J(ne){o("ondata");var re=b.write(ne);o("dest.write",re),re===!1&&((T.pipesCount===1&&T.pipes===b||T.pipesCount>1&&x(T.pipes,b)!==-1)&&!z&&(o("false write response, pause",T.awaitDrain),T.awaitDrain++),A.pause())}function Q(ne){o("onerror",ne),ce(),b.removeListener("error",Q),e(b,"error")===0&&S(b,ne)}function te(){b.removeListener("finish",oe),ce()}function oe(){o("onfinish"),b.removeListener("close",te),ce()}function ce(){o("unpipe"),A.unpipe(b)}return A.on("data",J),function(ne,re,ae){if(typeof ne.prependListener=="function")return ne.prependListener(re,ae);ne._events&&ne._events[re]?Array.isArray(ne._events[re])?ne._events[re].unshift(ae):ne._events[re]=[ae,ne._events[re]]:ne.on(re,ae)}(b,"error",Q),b.once("close",te),b.once("finish",oe),b.emit("pipe",A),T.flowing||(o("pipe resume"),A.resume()),b},I.prototype.unpipe=function(b){var v=this._readableState,A={hasUnpiped:!1};if(v.pipesCount===0)return this;if(v.pipesCount===1)return b&&b!==v.pipes||(b||(b=v.pipes),v.pipes=null,v.pipesCount=0,v.flowing=!1,b&&b.emit("unpipe",this,A)),this;if(!b){var T=v.pipes,M=v.pipesCount;v.pipes=null,v.pipesCount=0,v.flowing=!1;for(var L=0;L<M;L++)T[L].emit("unpipe",this,{hasUnpiped:!1});return this}var B=x(v.pipes,b);return B===-1||(v.pipes.splice(B,1),v.pipesCount-=1,v.pipesCount===1&&(v.pipes=v.pipes[0]),b.emit("unpipe",this,A)),this},I.prototype.on=function(b,v){var A=n.prototype.on.call(this,b,v),T=this._readableState;return b==="data"?(T.readableListening=this.listenerCount("readable")>0,T.flowing!==!1&&this.resume()):b==="readable"&&(T.endEmitted||T.readableListening||(T.readableListening=T.needReadable=!0,T.flowing=!1,T.emittedReadable=!1,o("on readable",T.length,T.reading),T.length?j(this):T.reading||be.nextTick(C,this))),A},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(b,v){var A=n.prototype.removeListener.call(this,b,v);return b==="readable"&&be.nextTick(R,this),A},I.prototype.removeAllListeners=function(b){var v=n.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||be.nextTick(R,this),v},I.prototype.resume=function(){var b=this._readableState;return b.flowing||(o("resume"),b.flowing=!b.readableListening,function(v,A){A.resumeScheduled||(A.resumeScheduled=!0,be.nextTick(O,v,A))}(this,b)),b.paused=!1,this},I.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(b){var v=this,A=this._readableState,T=!1;for(var M in b.on("end",function(){if(o("wrapped end"),A.decoder&&!A.ended){var B=A.decoder.end();B&&B.length&&v.push(B)}v.push(null)}),b.on("data",function(B){o("wrapped data"),A.decoder&&(B=A.decoder.write(B)),A.objectMode&&B==null||(A.objectMode||B&&B.length)&&(v.push(B)||(T=!0,b.pause()))}),b)this[M]===void 0&&typeof b[M]=="function"&&(this[M]=function(B){return function(){return b[B].apply(b,arguments)}}(M));for(var L=0;L<_.length;L++)b.on(_[L],this.emit.bind(this,_[L]));return this._read=function(B){o("wrapped _read",B),T&&(T=!1,b.resume())},this},typeof Symbol=="function"&&(I.prototype[Symbol.asyncIterator]=function(){return a===void 0&&(a=Gg()),a(this)}),Object.defineProperty(I.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(I.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(I.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(b){this._readableState&&(this._readableState.flowing=b)}}),I._fromList=y,Object.defineProperty(I.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(I.from=function(b,v){return l===void 0&&(l=$l?Bl:($l=1,Bl=function(){throw new Error("Readable.from is not available in the browser")})),l(I,b,v)}),ps}var uf=Ft,Ao=Bn.codes,Yg=Ao.ERR_METHOD_NOT_IMPLEMENTED,Zg=Ao.ERR_MULTIPLE_CALLBACK,Jg=Ao.ERR_TRANSFORM_ALREADY_TRANSFORMING,Xg=Ao.ERR_TRANSFORM_WITH_LENGTH_0,Ki=ir();function Qg(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new Zg);n.writechunk=null,n.writecb=null,e!=null&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Ft(t){if(!(this instanceof Ft))return new Ft(t);Ki.call(this,t),this._transformState={afterTransform:Qg.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",ey)}function ey(){var t=this;typeof this._flush!="function"||this._readableState.destroyed?jl(this,null,null):this._flush(function(e,n){jl(t,e,n)})}function jl(t,e,n){if(e)return t.emit("error",e);if(n!=null&&t.push(n),t._writableState.length)throw new Xg;if(t._transformState.transforming)throw new Jg;return t.push(null)}Yr(Ft,Ki),Ft.prototype.push=function(t,e){return this._transformState.needTransform=!1,Ki.prototype.push.call(this,t,e)},Ft.prototype._transform=function(t,e,n){n(new Yg("_transform()"))},Ft.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Ft.prototype._read=function(t){var e=this._transformState;e.writechunk===null||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},Ft.prototype._destroy=function(t,e){Ki.prototype._destroy.call(this,t,function(n){e(n)})};var ms,ty=$r,df=uf;function $r(t){if(!(this instanceof $r))return new $r(t);df.call(this,t)}Yr($r,df),$r.prototype._transform=function(t,e,n){n(null,t)};var hf=Bn.codes,ny=hf.ERR_MISSING_ARGS,ry=hf.ERR_STREAM_DESTROYED;function Ul(t){if(t)throw t}function Hl(t){t()}function iy(t,e){return t.pipe(e)}var oy=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=function(c){return c.length?typeof c[c.length-1]!="function"?Ul:c.pop():Ul}(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new ny("streams");var o=e.map(function(c,s){var a=s<e.length-1;return function(l,u,d,h){h=function(m){var w=!1;return function(){w||(w=!0,m.apply(void 0,arguments))}}(h);var f=!1;l.on("close",function(){f=!0}),ms===void 0&&(ms=Ha),ms(l,{readable:u,writable:d},function(m){if(m)return h(m);f=!0,h()});var g=!1;return function(m){if(!f&&!g)return g=!0,function(w){return w.setHeader&&typeof w.abort=="function"}(l)?l.abort():typeof l.destroy=="function"?l.destroy():void h(m||new ry("pipe"))}}(c,a,s>0,function(l){r||(r=l),l&&o.forEach(Hl),a||(o.forEach(Hl),i(r))})});return e.reduce(iy)};(function(t,e){(e=ea.exports=lf()).Stream=e,e.Readable=e,e.Writable=cf(),e.Duplex=ir(),e.Transform=uf,e.PassThrough=ty,e.finished=Ha,e.pipeline=oy})(0,ea.exports);var or=ea.exports;function sy(t={}){const e={},n=new or.Duplex({objectMode:!0,read:()=>{},write:function(o,c,s){let a=null;try{o.id?function(l){const{id:u}=l;if(u===null)return;const d=e[u];if(!d)return void console.warn(`StreamMiddleware - Unknown response id "${u}"`);delete e[u],Object.assign(d.res,l),setTimeout(d.end)}(o):function(l){t!=null&&t.retryOnMessage&&l.method===t.retryOnMessage&&Object.values(e).forEach(({req:u,retryCount:d=0})=>{if(!u.id)return;if(d>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${u.id}"`);const h=e[u.id];h&&(h.retryCount=d+1),i(u)}),r.emit("notification",l)}(o)}catch(l){a=l}s(a)}}),r=new jh;return{events:r,middleware:(o,c,s,a)=>{e[o.id]={req:o,res:c,next:s,end:a},i(o)},stream:n};function i(o){n.push(o)}}var ao={},na={exports:{}},ay=function t(e,n){if(e&&n)return t(e)(n);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(i){r[i]=e[i]}),r;function r(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];var c=e.apply(this,i),s=i[i.length-1];return typeof c=="function"&&c!==s&&Object.keys(s).forEach(function(a){c[a]=s[a]}),c}},Fl=ay;function yi(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function zl(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}na.exports=Fl(yi),na.exports.strict=Fl(zl),yi.proto=yi(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return yi(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return zl(this)},configurable:!0})});var cy=na.exports,co={};Object.defineProperty(co,"__esModule",{value:!0}),co.Substream=void 0;const ly=or;class uy extends ly.Duplex{constructor({parent:e,name:n}){super({objectMode:!0}),this._parent=e,this._name=n}_read(){}_write(e,n,r){this._parent.push({name:this._name,data:e}),r()}}co.Substream=uy;var dy=mt&&mt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ao,"__esModule",{value:!0}),ao.ObjectMultiplex=void 0;const gs=or,hy=dy(cy),fy=co,ql=Symbol("IGNORE_SUBSTREAM");let py=class extends gs.Duplex{constructor(t={}){super(Object.assign(Object.assign({},t),{objectMode:!0})),this._substreams={}}createStream(t){if(this.destroyed)throw new Error(`ObjectMultiplex - parent stream for name "${t}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw new Error(`ObjectMultiplex - parent stream for name "${t}" already ended`);if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);const e=new fy.Substream({parent:this,name:t});return this._substreams[t]=e,function(n,r){const i=(0,hy.default)(r);(0,gs.finished)(n,{readable:!1},i),(0,gs.finished)(n,{writable:!1},i)}(this,n=>e.destroy(n||void 0)),e}ignoreStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);this._substreams[t]=ql}_read(){}_write(t,e,n){const{name:r,data:i}=t;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${t}"`),n();const o=this._substreams[r];return o?(o!==ql&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}};ao.ObjectMultiplex=py;var my=wo(ao.ObjectMultiplex);const Ct=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Ct.writable=t=>Ct(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object",Ct.readable=t=>Ct(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object",Ct.duplex=t=>Ct.writable(t)&&Ct.readable(t),Ct.transform=t=>Ct.duplex(t)&&typeof t._transform=="function";var At,gy=Ct,yy=class extends Og{constructor(t,{jsonRpcStreamName:e,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!gy.duplex(t))throw new Error(ke.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new my;or.pipeline(t,o,t,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=sy({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),or.pipeline(this._jsonRpcConnection.stream,o.createStream(e),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",c=>{const{method:s,params:a}=c;s==="metamask_accountsChanged"?this._handleAccountsChanged(a):s==="metamask_unlockStateChanged"?this._handleUnlockStateChanged(a):s==="metamask_chainChanged"?this._handleChainChanged(a):Uh.includes(s)?this.emit("message",{type:s,data:a}):s==="METAMASK_STREAM_FAILURE"&&t.destroy(new Error(ke.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let t;try{t=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(t)}_handleStreamDisconnect(t,e){let n=`MetaMask: Lost connection to "${t}".`;e!=null&&e.stack&&(n+=`
34
+ ${e.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,e?e.message:void 0)}_handleChainChanged({chainId:t,networkVersion:e}={}){Hh(t)&&(n=>!!n&&typeof n=="string")(e)?e==="loading"?this._handleDisconnect(!0):super._handleChainChanged({chainId:t}):this._log.error(ke.errors.invalidNetworkParams(),{chainId:t,networkVersion:e})}},vy=class extends yy{constructor(t,{jsonRpcStreamName:e="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(t,{jsonRpcStreamName:e,logger:n,maxEventListeners:r,rpcMiddleware:Cg(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},Qs(this,At,void 0),this._initializeStateAsync(),Ht(this,At,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",o=>{const{method:c}=o;Uh.includes(c)&&(this.emit("data",o),this.emit("notification",o.params.result))}),i)if(document.readyState==="complete")Tl(this._rpcEngine,this._log);else{const o=()=>{Tl(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",o)};window.addEventListener("DOMContentLoaded",o)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(ke.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(ke.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),Mt(this,At)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(ke.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(t,e){this._rpcRequest(t,e)}addListener(t,e){return this._warnOfDeprecation(t),super.addListener(t,e)}on(t,e){return this._warnOfDeprecation(t),super.on(t,e)}once(t,e){return this._warnOfDeprecation(t),super.once(t,e)}prependListener(t,e){return this._warnOfDeprecation(t),super.prependListener(t,e)}prependOnceListener(t,e){return this._warnOfDeprecation(t),super.prependOnceListener(t,e)}_handleDisconnect(t,e){super._handleDisconnect(t,e),Mt(this,At)&&!t&&Ht(this,At,null)}_warnOfDeprecation(t){var e;((e=this._sentWarnings)==null?void 0:e.events[t])===!1&&(this._log.warn(ke.warnings.events[t]),this._sentWarnings.events[t]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(ke.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((t,e)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},Di(t,e))}catch(n){e(n)}})}send(t,e){return this._sentWarnings.send||(this._log.warn(ke.warnings.sendDeprecation),this._sentWarnings.send=!0),typeof t!="string"||e&&!Array.isArray(e)?t&&typeof t=="object"&&typeof e=="function"?this._rpcRequest(t,e):this._sendSync(t):new Promise((n,r)=>{try{this._rpcRequest({method:t,params:e},Di(n,r,!1))}catch(i){r(i)}})}_sendSync(t){let e;switch(t.method){case"eth_accounts":e=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":e=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(t,Fh),e=!0;break;case"net_version":e=Mt(this,At)??null;break;default:throw new Error(ke.errors.unsupportedSync(t.method))}return{id:t.id,jsonrpc:t.jsonrpc,result:e}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(t=>{this.on("_initialized",()=>t())}),this._state.isUnlocked),requestBatch:async t=>{if(!Array.isArray(t))throw Sr({message:"Batch requests must be made with an array of request objects.",data:t});return new Promise((e,n)=>{this._rpcRequest(t,Di(e,n))})}},{get:(t,e,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(ke.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(t,e,...n))})}_handleChainChanged({chainId:t,networkVersion:e}={}){super._handleChainChanged({chainId:t,networkVersion:e}),this._state.isConnected&&e!==Mt(this,At)&&(Ht(this,At,e),this._state.initialized&&this.emit("networkChanged",Mt(this,At)))}};At=new WeakMap;const W=Ve("MM_SDK");let Vl;W.color="#FFAC1C";var ff={},vn={};Object.defineProperty(vn,"__esModule",{value:!0}),vn.EthereumProviderError=vn.EthereumRpcError=void 0;const by=Lh;class pf extends Error{constructor(e,n,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=e,r!==void 0&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return by.default(this.serialize(),wy,2)}}vn.EthereumRpcError=pf;function wy(t,e){if(e!=="[Circular]")return e}vn.EthereumProviderError=class extends pf{constructor(t,e,n){if(!function(r){return Number.isInteger(r)&&r>=1e3&&r<=4999}(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,e,n)}};var Fa={},dn={};Object.defineProperty(dn,"__esModule",{value:!0}),dn.errorValues=dn.errorCodes=void 0,dn.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},dn.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=dn,n=vn,r=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",o={code:r,message:c(r)};function c(d,h=i){if(Number.isInteger(d)){const f=d.toString();if(u(e.errorValues,f))return e.errorValues[f].message;if(a(d))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return h}function s(d){if(!Number.isInteger(d))return!1;const h=d.toString();return!!e.errorValues[h]||!!a(d)}function a(d){return d>=-32099&&d<=-32e3}function l(d){return d&&typeof d=="object"&&!Array.isArray(d)?Object.assign({},d):d}function u(d,h){return Object.prototype.hasOwnProperty.call(d,h)}t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",t.getMessageFromCode=c,t.isValidCode=s,t.serializeError=function(d,{fallbackError:h=o,shouldIncludeStack:f=!1}={}){var g,m;if(!h||!Number.isInteger(h.code)||typeof h.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(d instanceof n.EthereumRpcError)return d.serialize();const w={};if(d&&typeof d=="object"&&!Array.isArray(d)&&u(d,"code")&&s(d.code)){const S=d;w.code=S.code,S.message&&typeof S.message=="string"?(w.message=S.message,u(S,"data")&&(w.data=S.data)):(w.message=c(w.code),w.data={originalError:l(d)})}else{w.code=h.code;const S=(g=d)===null||g===void 0?void 0:g.message;w.message=S&&typeof S=="string"?S:h.message,w.data={originalError:l(d)}}const p=(m=d)===null||m===void 0?void 0:m.stack;return f&&d&&p&&typeof p=="string"&&(w.stack=p),w}}(Fa);var lo={};Object.defineProperty(lo,"__esModule",{value:!0}),lo.ethErrors=void 0;const za=vn,mf=Fa,$e=dn;function ct(t,e){const[n,r]=gf(e);return new za.EthereumRpcError(t,n||mf.getMessageFromCode(t),r)}function mr(t,e){const[n,r]=gf(e);return new za.EthereumProviderError(t,n||mf.getMessageFromCode(t),r)}function gf(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:n}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,n]}}return[]}lo.ethErrors={rpc:{parse:t=>ct($e.errorCodes.rpc.parse,t),invalidRequest:t=>ct($e.errorCodes.rpc.invalidRequest,t),invalidParams:t=>ct($e.errorCodes.rpc.invalidParams,t),methodNotFound:t=>ct($e.errorCodes.rpc.methodNotFound,t),internal:t=>ct($e.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ct(e,t)},invalidInput:t=>ct($e.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>ct($e.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>ct($e.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>ct($e.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>ct($e.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>ct($e.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>mr($e.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>mr($e.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>mr($e.errorCodes.provider.unsupportedMethod,t),disconnected:t=>mr($e.errorCodes.provider.disconnected,t),chainDisconnected:t=>mr($e.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:n,data:r}=t;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new za.EthereumProviderError(e,n,r)}}},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=vn;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const n=Fa;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=lo;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=dn;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(ff);var yf={exports:{}};yf.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var c in r)n.d(o,c,(function(s){return r[s]}).bind(null,c));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=90)}({17:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=n(18),i=function(){function o(){}return o.getFirstMatch=function(c,s){var a=s.match(c);return a&&a.length>0&&a[1]||""},o.getSecondMatch=function(c,s){var a=s.match(c);return a&&a.length>1&&a[2]||""},o.matchAndReturnConst=function(c,s,a){if(c.test(s))return a},o.getWindowsVersionName=function(c){switch(c){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},o.getMacOSVersionName=function(c){var s=c.split(".").splice(0,2).map(function(a){return parseInt(a,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},o.getAndroidVersionName=function(c){var s=c.split(".").splice(0,2).map(function(a){return parseInt(a,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},o.getVersionPrecision=function(c){return c.split(".").length},o.compareVersions=function(c,s,a){a===void 0&&(a=!1);var l=o.getVersionPrecision(c),u=o.getVersionPrecision(s),d=Math.max(l,u),h=0,f=o.map([c,s],function(g){var m=d-o.getVersionPrecision(g),w=g+new Array(m+1).join(".0");return o.map(w.split("."),function(p){return new Array(20-p.length).join("0")+p}).reverse()});for(a&&(h=d-Math.min(l,u)),d-=1;d>=h;){if(f[0][d]>f[1][d])return 1;if(f[0][d]===f[1][d]){if(d===h)return 0;d-=1}else if(f[0][d]<f[1][d])return-1}},o.map=function(c,s){var a,l=[];if(Array.prototype.map)return Array.prototype.map.call(c,s);for(a=0;a<c.length;a+=1)l.push(s(c[a]));return l},o.find=function(c,s){var a,l;if(Array.prototype.find)return Array.prototype.find.call(c,s);for(a=0,l=c.length;a<l;a+=1){var u=c[a];if(s(u,a))return u}},o.assign=function(c){for(var s,a,l=c,u=arguments.length,d=new Array(u>1?u-1:0),h=1;h<u;h++)d[h-1]=arguments[h];if(Object.assign)return Object.assign.apply(Object,[c].concat(d));var f=function(){var g=d[s];typeof g=="object"&&g!==null&&Object.keys(g).forEach(function(m){l[m]=g[m]})};for(s=0,a=d.length;s<a;s+=1)f();return c},o.getBrowserAlias=function(c){return r.BROWSER_ALIASES_MAP[c]},o.getBrowserTypeByAlias=function(c){return r.BROWSER_MAP[c]||""},o}();e.default=i,t.exports=e.default},18:function(t,e,n){e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function c(a,l){for(var u=0;u<l.length;u++){var d=l[u];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}var s=function(){function a(){}var l,u,d;return a.getParser=function(h,f){if(f===void 0&&(f=!1),typeof h!="string")throw new Error("UserAgent should be a string");return new i.default(h,f)},a.parse=function(h){return new i.default(h).getResult()},l=a,d=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(u=null)&&c(l.prototype,u),d&&c(l,d),a}();e.default=s,t.exports=e.default},91:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=a(n(92)),i=a(n(93)),o=a(n(94)),c=a(n(95)),s=a(n(17));function a(u){return u&&u.__esModule?u:{default:u}}var l=function(){function u(h,f){if(f===void 0&&(f=!1),h==null||h==="")throw new Error("UserAgent parameter can't be empty");this._ua=h,this.parsedResult={},f!==!0&&this.parse()}var d=u.prototype;return d.getUA=function(){return this._ua},d.test=function(h){return h.test(this._ua)},d.parseBrowser=function(){var h=this;this.parsedResult.browser={};var f=s.default.find(r.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});throw new Error("Browser's test function is not valid")});return f&&(this.parsedResult.browser=f.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(h){return h?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var h=this;this.parsedResult.os={};var f=s.default.find(i.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});throw new Error("Browser's test function is not valid")});return f&&(this.parsedResult.os=f.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(h){var f=this.getOS().name;return h?String(f).toLowerCase()||"":f||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(h){h===void 0&&(h=!1);var f=this.getPlatform().type;return h?String(f).toLowerCase()||"":f||""},d.parsePlatform=function(){var h=this;this.parsedResult.platform={};var f=s.default.find(o.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});throw new Error("Browser's test function is not valid")});return f&&(this.parsedResult.platform=f.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(h){return h?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var h=this;this.parsedResult.engine={};var f=s.default.find(c.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});throw new Error("Browser's test function is not valid")});return f&&(this.parsedResult.engine=f.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(h){var f=this,g={},m=0,w={},p=0;if(Object.keys(h).forEach(function(U){var j=h[U];typeof j=="string"?(w[U]=j,p+=1):typeof j=="object"&&(g[U]=j,m+=1)}),m>0){var S=Object.keys(g),_=s.default.find(S,function(U){return f.isOS(U)});if(_){var P=this.satisfies(g[_]);if(P!==void 0)return P}var I=s.default.find(S,function(U){return f.isPlatform(U)});if(I){var K=this.satisfies(g[I]);if(K!==void 0)return K}}if(p>0){var q=Object.keys(w),F=s.default.find(q,function(U){return f.isBrowser(U,!0)});if(F!==void 0)return this.compareVersion(w[F])}},d.isBrowser=function(h,f){f===void 0&&(f=!1);var g=this.getBrowserName().toLowerCase(),m=h.toLowerCase(),w=s.default.getBrowserTypeByAlias(m);return f&&w&&(m=w.toLowerCase()),m===g},d.compareVersion=function(h){var f=[0],g=h,m=!1,w=this.getBrowserVersion();if(typeof w=="string")return h[0]===">"||h[0]==="<"?(g=h.substr(1),h[1]==="="?(m=!0,g=h.substr(2)):f=[],h[0]===">"?f.push(1):f.push(-1)):h[0]==="="?g=h.substr(1):h[0]==="~"&&(m=!0,g=h.substr(1)),f.indexOf(s.default.compareVersions(w,g,m))>-1},d.isOS=function(h){return this.getOSName(!0)===String(h).toLowerCase()},d.isPlatform=function(h){return this.getPlatformType(!0)===String(h).toLowerCase()},d.isEngine=function(h){return this.getEngineName(!0)===String(h).toLowerCase()},d.is=function(h,f){return f===void 0&&(f=!1),this.isBrowser(h,f)||this.isOS(h)||this.isPlatform(h)},d.some=function(h){var f=this;return h===void 0&&(h=[]),h.some(function(g){return f.is(g)})},u}();e.default=l,t.exports=e.default},92:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,c=[{test:[/googlebot/i],describe:function(s){var a={name:"Googlebot"},l=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/opera/i],describe:function(s){var a={name:"Opera"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/opr\/|opios/i],describe:function(s){var a={name:"Opera"},l=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/SamsungBrowser/i],describe:function(s){var a={name:"Samsung Internet for Android"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/Whale/i],describe:function(s){var a={name:"NAVER Whale Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/MZBrowser/i],describe:function(s){var a={name:"MZ Browser"},l=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/focus/i],describe:function(s){var a={name:"Focus"},l=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/swing/i],describe:function(s){var a={name:"Swing"},l=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/coast/i],describe:function(s){var a={name:"Opera Coast"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var a={name:"Opera Touch"},l=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/yabrowser/i],describe:function(s){var a={name:"Yandex Browser"},l=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/ucbrowser/i],describe:function(s){var a={name:"UC Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/Maxthon|mxios/i],describe:function(s){var a={name:"Maxthon"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/epiphany/i],describe:function(s){var a={name:"Epiphany"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/puffin/i],describe:function(s){var a={name:"Puffin"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/sleipnir/i],describe:function(s){var a={name:"Sleipnir"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/k-meleon/i],describe:function(s){var a={name:"K-Meleon"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/micromessenger/i],describe:function(s){var a={name:"WeChat"},l=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/qqbrowser/i],describe:function(s){var a={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/msie|trident/i],describe:function(s){var a={name:"Internet Explorer"},l=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/\sedg\//i],describe:function(s){var a={name:"Microsoft Edge"},l=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/edg([ea]|ios)/i],describe:function(s){var a={name:"Microsoft Edge"},l=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/vivaldi/i],describe:function(s){var a={name:"Vivaldi"},l=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/seamonkey/i],describe:function(s){var a={name:"SeaMonkey"},l=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/sailfish/i],describe:function(s){var a={name:"Sailfish"},l=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(a.version=l),a}},{test:[/silk/i],describe:function(s){var a={name:"Amazon Silk"},l=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/phantom/i],describe:function(s){var a={name:"PhantomJS"},l=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/slimerjs/i],describe:function(s){var a={name:"SlimerJS"},l=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var a={name:"BlackBerry"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var a={name:"WebOS Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/bada/i],describe:function(s){var a={name:"Bada"},l=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/tizen/i],describe:function(s){var a={name:"Tizen"},l=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/qupzilla/i],describe:function(s){var a={name:"QupZilla"},l=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var a={name:"Firefox"},l=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/electron/i],describe:function(s){var a={name:"Electron"},l=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/MiuiBrowser/i],describe:function(s){var a={name:"Miui"},l=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/chromium/i],describe:function(s){var a={name:"Chromium"},l=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/chrome|crios|crmo/i],describe:function(s){var a={name:"Chrome"},l=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/GSA/i],describe:function(s){var a={name:"Google Search"},l=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){var a=!s.test(/like android/i),l=s.test(/android/i);return a&&l},describe:function(s){var a={name:"Android Browser"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/playstation 4/i],describe:function(s){var a={name:"PlayStation 4"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/safari|applewebkit/i],describe:function(s){var a={name:"Safari"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/.*/i],describe:function(s){var a=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(a,s),version:i.default.getSecondMatch(a,s)}}}];e.default=c,t.exports=e.default},93:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:[/Roku\/DVP/],describe:function(s){var a=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:o.OS_MAP.Roku,version:a}}},{test:[/windows phone/i],describe:function(s){var a=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.WindowsPhone,version:a}}},{test:[/windows /i],describe:function(s){var a=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=i.default.getWindowsVersionName(a);return{name:o.OS_MAP.Windows,version:a,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var a={name:o.OS_MAP.iOS},l=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(a.version=l),a}},{test:[/macintosh/i],describe:function(s){var a=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=i.default.getMacOSVersionName(a),u={name:o.OS_MAP.MacOS,version:a};return l&&(u.versionName=l),u}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var a=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:a}}},{test:function(s){var a=!s.test(/like android/i),l=s.test(/android/i);return a&&l},describe:function(s){var a=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=i.default.getAndroidVersionName(a),u={name:o.OS_MAP.Android,version:a};return l&&(u.versionName=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var a=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:o.OS_MAP.WebOS};return a&&a.length&&(l.version=a),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var a=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||i.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:o.OS_MAP.BlackBerry,version:a}}},{test:[/bada/i],describe:function(s){var a=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.Bada,version:a}}},{test:[/tizen/i],describe:function(s){var a=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.Tizen,version:a}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var a=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.PlayStation4,version:a}}}];e.default=c,t.exports=e.default},94:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var a=i.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return a&&(l.model=a),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(s){var a=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return a&&!l},describe:function(s){var a=i.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:a}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var a=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&a>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];e.default=c,t.exports=e.default},95:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:o.ENGINE_MAP.Blink};var a=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:o.ENGINE_MAP.EdgeHTML,version:a}}},{test:[/trident/i],describe:function(s){var a={name:o.ENGINE_MAP.Trident},l=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){return s.test(/presto/i)},describe:function(s){var a={name:o.ENGINE_MAP.Presto},l=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){var a=s.test(/gecko/i),l=s.test(/like gecko/i);return a&&!l},describe:function(s){var a={name:o.ENGINE_MAP.Gecko},l=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var a={name:o.ENGINE_MAP.WebKit},l=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}}];e.default=c,t.exports=e.default}});var vf=wo(yf.exports);const We={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class Et{constructor({shouldSetOnWindow:e,connectionStream:n,shouldSendMetadata:r=!1,shouldShimWeb3:i,sdkInstance:o}){const c=new wf({connectionStream:n,shouldSendMetadata:r,shouldSetOnWindow:e,shouldShimWeb3:i,autoRequestAccounts:!1}),s=new Proxy(c,{deleteProperty:()=>!0});if(this.provider=s,this.sdkInstance=o,e&&typeof window<"u")try{a=c,window.ethereum=a,window.dispatchEvent(new Event("ethereum#initialized"))}catch(l){W("[Ethereum] Unable to set global provider - window.ethereum may be read-only",l)}var a;if(i&&typeof window<"u")try{(function(l,u=console){let d=!1,h=!1;if(!window.web3){const f="__isMetaMaskShim__";let g={currentProvider:l};Object.defineProperty(g,f,{value:!0,enumerable:!0,configurable:!1,writable:!1}),g=new Proxy(g,{get:(m,w,...p)=>(w!=="currentProvider"||d?w==="currentProvider"||w===f||h||(h=!0,u.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),l.request({method:"metamask_logWeb3ShimUsage"}).catch(S=>{u.debug("MetaMask: Failed to log web3 shim usage.",S)})):(d=!0,u.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(m,w,...p)),set:(...m)=>(u.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...m))}),Object.defineProperty(window,"web3",{value:g,enumerable:!1,configurable:!0,writable:!0})}})(this.provider)}catch(l){W("[Ethereum] Unable to shim web3 - window.web3 may be read-only",l)}this.provider.on("display_uri",l=>{this.sdkInstance.emit(We.DisplayURI,l)}),this.provider.on("_initialized",()=>{const l={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(We.Initialized,l),W("[Ethereum: constructor()] provider initialized",l)})}static init(e){var n;return W("[Ethereum: init()] Initializing Ethereum service"),this.instance=new Et(e),(n=this.instance)===null||n===void 0?void 0:n.provider}static destroy(){}static getInstance(){var e;if(!(!((e=this.instance)===null||e===void 0)&&e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(!((e=this.instance)===null||e===void 0)&&e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class Kr{constructor({useDeepLink:e,preferredOpenLink:n,debug:r=!1}){this.state={platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=n,this.state.debug=r}openDeeplink(e,n,r){return function(i,o,c,s){const{state:a}=i;W(`[PlatfformManager: openDeeplink()] universalLink --> ${o}`),W(`[PlatfformManager: openDeeplink()] deepLink --> ${c}`);try{if(a.preferredOpenLink)return void a.preferredOpenLink(a.useDeeplink?c:o,s);if(W(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${a.useDeeplink} link=${a.useDeeplink?c:o}`),a.useDeeplink)typeof window<"u"&&(window.location.href=c);else if(typeof document<"u"){const l=document.createElement("a");l.href=o,l.target="_self",l.rel="noreferrer noopener",l.click()}}catch(l){console.log("[PlatfformManager: openDeeplink()] can't open link",l)}}(this,e,n,r)}isReactNative(){var e;return this.isNotBrowser()&&typeof window<"u"&&(window==null?void 0:window.navigator)&&((e=window.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"}isMetaMaskInstalled(){return function(){const e=Et.getProvider()||(window==null?void 0:window.ethereum);return W(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${e==null?void 0:e.isMetaMask} isConnected=${e==null?void 0:e.isConnected()}`),(e==null?void 0:e.isMetaMask)&&(e==null?void 0:e.isConnected())}()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,n;const r=vf.parse(window.navigator.userAgent);return((e=r==null?void 0:r.platform)===null||e===void 0?void 0:e.type)==="mobile"||((n=r==null?void 0:r.platform)===null||n===void 0?void 0:n.type)==="tablet"}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return typeof window<"u"&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===exports.PlatformType.MobileWeb}static isNotBrowser(){var e;return typeof window>"u"||!(window!=null&&window.navigator)||Ge!==void 0&&((e=Ge==null?void 0:Ge.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"||(navigator==null?void 0:navigator.product)==="ReactNative"}isNotBrowser(){return Kr.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return Kr.isBrowser()}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(e){const{state:n}=e;return n.platformType?n.platformType:e.isReactNative()?exports.PlatformType.ReactNative:e.isNotBrowser()?exports.PlatformType.NonBrowser:e.isMetaMaskMobileWebView()?exports.PlatformType.MetaMaskMobileWebview:e.isMobile()?exports.PlatformType.MobileWeb:exports.PlatformType.DesktopWeb}(this)}}const bf=t=>Z(void 0,void 0,void 0,function*(){if(Kr.isBrowser()){const{StorageManagerWeb:n}=yield Promise.resolve().then(function(){return Gy});return new n(t)}const e={persistChannelConfig:()=>Z(void 0,void 0,void 0,function*(){}),getPersistedChannelConfig:()=>Z(void 0,void 0,void 0,function*(){}),persistAccounts:()=>Z(void 0,void 0,void 0,function*(){}),getCachedAccounts:()=>Z(void 0,void 0,void 0,function*(){return[]}),persistChainId:()=>Z(void 0,void 0,void 0,function*(){}),getCachedChainId:()=>Z(void 0,void 0,void 0,function*(){}),terminate:()=>Z(void 0,void 0,void 0,function*(){})};return Promise.resolve(e)});class wf extends vy{constructor({connectionStream:e,shouldSendMetadata:n,autoRequestAccounts:r=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:n}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},W(`[SDKProvider: constructor()] autoRequestAccounts=${r}`),this.state.autoRequestAccounts=r}forceInitializeState(){return Z(this,void 0,void 0,function*(){return W(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){W("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;const{accounts:n}=this._state;return n&&n.length!==0?((e=n[0])===null||e===void 0?void 0:e.toLowerCase())||"":(W("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleAccountsChanged(e,n){return this._handleAccountsChanged(e,n)}handleDisconnect({terminate:e=!1}){(function({terminate:n=!1,instance:r}){const{state:i}=r;W(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${n}`,r),n&&(r._state.accounts=null,r._state.isUnlocked=!1,r._state.isPermanentlyDisconnected=!0,r._state.initialized=!1),r._handleAccountsChanged([]),r._state.isConnected=!1,r.emit("disconnect",ff.ethErrors.provider.disconnected()),i.providerStateRequested=!1})({terminate:e,instance:this})}_initializeStateAsync(){return Z(this,void 0,void 0,function*(){return function(e){var n,r;return Z(this,void 0,void 0,function*(){e.state===void 0&&(e.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});const{state:i}=e;let o;if(i.providerStateRequested)W("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let c;i.providerStateRequested=!0;let s=null,a=!1,l=!1;const u=yield bf({enabled:!0});if(u){const d=yield u.getPersistedChannelConfig({});a=(n=d==null?void 0:d.relayPersistence)!==null&&n!==void 0&&n,c=yield u.getCachedChainId();const h=yield u.getCachedAccounts();h.length>0&&(s=h[0])}if(W(`[SDKProvider: initializeStateAsync()] relayPersistence=${a}`,{relayPersistence:a,cachedChainId:c,cachedSelectedAddress:s}),a)if(c&&s)o={accounts:[s],chainId:c,isUnlocked:!1},l=!0;else try{o=yield e.request({method:"metamask_getProviderState"})}catch(d){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",d),void(i.providerStateRequested=!1)}if(((r=o==null?void 0:o.accounts)===null||r===void 0?void 0:r.length)===0)if(e.getSelectedAddress())o.accounts=[e.getSelectedAddress()];else{W("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");const d=yield e.request({method:"eth_requestAccounts",params:[]});o.accounts=d}e._initializeState(o),i.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:o==null?void 0:o.chainId}))}})}(this)})}_initializeState(e){return W("[SDKProvider: _initializeState()]",e),function(n,r,i){return W("[SDKProvider: initializeState()] set state._initialized to false"),n._state.initialized=!1,r(i)}(this,super._initializeState.bind(this),e)}_handleChainChanged({chainId:e,networkVersion:n}={}){this.state.chainId=e,this.state.networkVersion=n,function({instance:r,chainId:i,networkVersion:o,superHandleChainChanged:c}){W(`[SDKProvider: handleChainChanged()] chainId=${i} networkVersion=${o}`);let s=o;o||(W("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),s="1"),i!==Vl&&(Te.analytics.track("sdk_used_chain",{caip_chain_id:`eip155:${parseInt(i??"0x1",16)}`}),Vl=i),r._state.isConnected=!0,r.emit("connect",{chainId:i}),c({chainId:i,networkVersion:s})}({instance:this,chainId:e,networkVersion:n,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var jr,$n={name:"@metamask/sdk",version:"0.33.1",description:"",homepage:"https://github.com/MetaMask/metamask-sdk#readme",bugs:{url:"https://github.com/MetaMask/metamask-sdk/issues"},repository:{type:"git",url:"https://github.com/MetaMask/metamask-sdk",directory:"packages/sdk"},main:"dist/node/cjs/metamask-sdk.js",module:"dist/browser/es/metamask-sdk.js",browser:"dist/browser/es/metamask-sdk.js",unpkg:"dist/browser/umd/metamask-sdk.js","react-native":"dist/react-native/es/metamask-sdk.js",types:"dist/types/src/index.d.ts",sideEffects:!1,files:["/dist"],scripts:{"build:types":"tsc --project tsconfig.build.json --emitDeclarationOnly --outDir dist/types",build:"yarn build:types && rollup -c --bundleConfigAsCjs","build:clean":"yarn clean && yarn build","build:post-tsc":"echo 'N/A'","build:pre-tsc":"echo 'N/A'",typecheck:"tsc --noEmit",clean:"rimraf ./dist",size:"node bundle-size && size-limit",lint:"yarn lint:eslint && yarn lint:misc --check","lint:changelog":"../../scripts/validate-changelog.sh @metamask/sdk","lint:eslint":"eslint . --cache --ext js,ts","lint:fix":"yarn lint:eslint --fix && yarn lint:misc --write","lint:misc":"prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",prepack:"../../scripts/prepack.sh","publish:preview":"yarn npm publish --tag preview",reset:"yarn clean && rimraf ./node_modules/",test:'jest --testPathIgnorePatterns "/e2e/"',"test:coverage":'jest --coverage --testPathIgnorePatterns "/e2e/"',"test:e2e":'jest --testPathPattern "/e2e/"',"test:ci":'jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js --testPathIgnorePatterns "/e2e/"',"test:dev":'jest -c ./jest.config.ts --detectOpenHandles --testPathIgnorePatterns "/e2e/"',watch:"rollup -c -w",dev:'concurrently "tsc --watch" "rollup -c -w --bundleConfigAsCjs"',"build:dev":"yarn build:types && NODE_ENV=dev rollup -c --bundleConfigAsCjs"},dependencies:{"@babel/runtime":"^7.26.0","@metamask/onboarding":"^1.0.1","@metamask/providers":"16.1.0","@metamask/sdk-analytics":"workspace:*","@metamask/sdk-communication-layer":"workspace:*","@metamask/sdk-install-modal-web":"workspace:*","@paulmillr/qr":"^0.2.1",bowser:"^2.9.0","cross-fetch":"^4.0.0",debug:"4.3.4",eciesjs:"^0.4.11","eth-rpc-errors":"^4.0.3",eventemitter2:"^6.4.9","obj-multiplex":"^1.0.0",pump:"^3.0.0","readable-stream":"^3.6.2","socket.io-client":"^4.5.1",tslib:"^2.6.0",util:"^0.12.4",uuid:"^8.3.2"},devDependencies:{"@jest/globals":"^29.3.1","@lavamoat/allow-scripts":"^2.3.1","@metamask/auto-changelog":"3.1.0","@metamask/eslint-config":"^6.0.0","@metamask/eslint-config-nodejs":"^6.0.0","@metamask/eslint-config-typescript":"^6.0.0","@react-native-async-storage/async-storage":"^1.19.6","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@rollup/plugin-replace":"^6.0.1","@rollup/plugin-terser":"^0.4.1","@size-limit/preset-big-lib":"^11.0.2","@types/dom-screen-wake-lock":"^1.0.2","@types/node":"^20.1.3","@types/pump":"^1.1.1","@types/qrcode-terminal":"^0.12.0","@types/uuid":"^10.0.0","@typescript-eslint/eslint-plugin":"^4.26.0","@typescript-eslint/parser":"^4.26.0","browserify-zlib":"^0.2.0",buffer:"^6.0.3",concurrently:"^9.1.2","crypto-browserify":"^3.12.0",eslint:"^7.30.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","eslint-plugin-jest":"^24.4.0","eslint-plugin-jsdoc":"^36.1.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^3.4.0","https-browserify":"^1.0.0",jest:"^29.3.1","jest-environment-jsdom":"^29.3.1",prettier:"^2.3.0",process:"^0.11.10",rimraf:"^4.4.0",rollup:"^4.26.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-jscc":"^2.0.0","rollup-plugin-natives":"^0.7.5","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-polyfill-node":"^0.13.0","rollup-plugin-sizes":"^1.0.6","rollup-plugin-typescript2":"^0.31.2","rollup-plugin-visualizer":"^5.12.0","size-limit":"^11.0.2","stream-browserify":"^3.0.0","stream-http":"^3.2.0","ts-jest":"^29.0.3","ts-node":"^10.9.1",typescript:"^4.3.2",url:"^0.11.0",webpack:"^5.0.0"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},lavamoat:{allowScripts:{"eciesjs>secp256k1":!1,"socket.io-client>engine.io-client>ws>bufferutil":!1,"socket.io-client>engine.io-client>ws>utf-8-validate":!1,"@metamask/sdk-communication-layer>bufferutil":!1,"@metamask/sdk-communication-layer>eciesjs>secp256k1":!1,"@metamask/sdk-communication-layer>utf-8-validate":!1}}};(function(t){t.INPAGE="metamask-inpage",t.CONTENT_SCRIPT="metamask-contentscript",t.PROVIDER="metamask-provider"})(jr||(jr={}));const Wl="direct",Ur="https://metamask.app.link/connect",Hr="metamask://connect",Gl={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},Ey=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,le={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_GETPERMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},Fr={[le.ETH_REQUESTACCOUNTS]:!0,[le.ETH_SENDTRANSACTION]:!0,[le.ETH_SIGNTRANSACTION]:!0,[le.ETH_SIGN]:!0,[le.PERSONAL_SIGN]:!0,[le.ETH_ACCOUNTS]:!1,[le.ETH_CHAINID]:!1,[le.PERSONAL_SIGN]:!0,[le.ETH_SIGNTYPEDDATA]:!0,[le.ETH_SIGNTYPEDDATA_V3]:!0,[le.ETH_SIGNTYPEDDATA_V4]:!0,[le.WALLET_REQUESTPERMISSIONS]:!0,[le.WALLET_GETPERMISSIONS]:!0,[le.WALLET_WATCHASSET]:!0,[le.WALLET_ADDETHEREUMCHAIN]:!0,[le.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[le.METAMASK_CONNECTSIGN]:!0,[le.METAMASK_CONNECTWITH]:!0,[le.PERSONAL_EC_RECOVER]:!0,[le.METAMASK_BATCH]:!0,[le.METAMASK_OPEN]:!0},_y=Object.keys(Fr).filter(t=>Fr[t]===!0).map(t=>t.toLowerCase()),Ef=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(t=>t.toLowerCase()),ys=".sdk-comm",uo="providerType",ra=".MMSDK_cached_address",ia=".MMSDK_cached_chainId",St={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"},Sy=1e6;exports.PROVIDER_UPDATE_TYPE=void 0;(function(t){t.TERMINATE="terminate",t.EXTENSION="extension",t.INITIALIZED="initialized"})(exports.PROVIDER_UPDATE_TYPE||(exports.PROVIDER_UPDATE_TYPE={}));const Cy=typeof window<"u"&&window.localStorage;function Ay({instance:t,msg:e}){return Z(this,void 0,void 0,function*(){if(t._initialized||(W("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield t.init()),W(`[MetaMaskSDK: connectAndSign()] activeProvider=${t.activeProvider}`),!t.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=/^0x([0-9A-Fa-f]{2})*$/u.test(e)?e:function(r){let i;if(X!==void 0)i=X.from(r,"utf8").toString("hex");else if(typeof TextEncoder<"u"){const o=new TextEncoder().encode(r);i=Array.from(o).map(c=>c.toString(16).padStart(2,"0")).join("")}else{if(typeof Ge!="object"||!("Buffer"in Ge))throw new Error("Unable to convert string to hex: No available method.");i=Ge.Buffer.from(r,"utf8").toString("hex")}return`0x${i}`}(e);return t.activeProvider.request({method:le.METAMASK_CONNECTWITH,params:[{method:le.PERSONAL_SIGN,params:[n]}]})})}function Yl(t){var e,n;return Z(this,void 0,void 0,function*(){W("[MetaMaskSDK: connectWithExtensionProvider()] ",t),t.sdkProvider=t.activeProvider,t.activeProvider=window.extension,window.ethereum=window.extension;try{const r=yield(e=window.extension)===null||e===void 0?void 0:e.request({method:"eth_requestAccounts"});W(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${r}`)}catch(r){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",r)}localStorage.setItem(uo,"extension"),t.extensionActive=!0,t.emit(We.ProviderUpdate,exports.PROVIDER_UPDATE_TYPE.EXTENSION),t.options.enableAnalytics&&((n=t.analytics)===null||n===void 0||n.send({event:xe.SDK_USE_EXTENSION}))})}function ho(t){let e;if(X!==void 0)e=X.from(t,"utf8").toString("base64");else if(typeof btoa=="function")e=btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/gu,(n,r)=>String.fromCharCode(parseInt(r,16))));else{if(typeof Ge!="object"||!("Buffer"in Ge))throw new Error("Unable to base64 encode: No available method.");e=Ge.Buffer.from(t,"utf8").toString("base64")}return e}function ky(t,e,n,r){var i,o,c,s,a,l,u,d,h,f,g,m,w,p,S,_,P,I,K,q;return Z(this,void 0,void 0,function*(){const F=(i=t.state.remote)===null||i===void 0?void 0:i.isReady(),U=(o=t.state.remote)===null||o===void 0?void 0:o.isConnected(),j=(c=t.state.remote)===null||c===void 0?void 0:c.isPaused(),G=Et.getProvider(),$=(s=t.state.remote)===null||s===void 0?void 0:s.getChannelId(),N=(a=t.state.remote)===null||a===void 0?void 0:a.isAuthorized(),{deeplinkProtocol:R}=t.state,{method:C,data:O,triggeredInstaller:D}=(x=>{var b,v,A,T;let M;X.isBuffer(x)?(M=x.toJSON(),M._isBuffer=!0):M=x;const L=(b=M==null?void 0:M.data)===null||b===void 0?void 0:b.method;let B=!1;return typeof((v=M==null?void 0:M.data)===null||v===void 0?void 0:v.params)=="object"&&((T=(A=M==null?void 0:M.data)===null||A===void 0?void 0:A.params)===null||T===void 0?void 0:T.__triggeredInstaller)===!0&&(B=!0,M.data.params=M.data.params.wrappedParams),{method:L,data:M,triggeredInstaller:B}})(e);if(W(`[RCPMS: write()] method='${C}' isRemoteReady=${F} channelId=${$} isSocketConnected=${U} isRemotePaused=${j} providerConnected=${G.isConnected()}`,e),!$)return C!==le.METAMASK_GETPROVIDERSTATE&&W(`[RCPMS: write()] ${C} --> channelId is undefined`),r(new Error("disconnected"));W(`[RCPMS: write()] remote.isPaused()=${(l=t.state.remote)===null||l===void 0?void 0:l.isPaused()} authorized=${N} ready=${F} socketConnected=${U}`,e);const y=(u=t.state.platformManager)===null||u===void 0?void 0:u.isSecure(),E=(h=(d=t.state.platformManager)===null||d===void 0?void 0:d.isMobileWeb())!==null&&h!==void 0&&h,k=(g=(f=t.state.remote)===null||f===void 0?void 0:f.hasDeeplinkProtocol())!==null&&g!==void 0&&g&&E&&N;try{if(!D){const v=JSON.stringify(O==null?void 0:O.data);if(v.length>Sy)return r(new Error(`Message size ${v.length} exceeds maximum allowed size of 1000000 bytes`));(m=t.state.remote)===null||m===void 0||m.sendMessage(O==null?void 0:O.data).then(()=>{W(`[RCPMS: _write()] ${C} sent successfully`)}).catch(A=>{W("[RCPMS: _write()] error sending message",A)})}if(!y)return W(`[RCPMS: _write()] unsecure platform for method ${C} -- return callback`),r();if(D)return W("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();const x=(S=(p=(w=t.state.remote)===null||w===void 0?void 0:w.getKeyInfo())===null||p===void 0?void 0:p.ecies.public)!==null&&S!==void 0?S:"";let b=encodeURI(`channelId=${$}&pubkey=${x}&comm=socket&t=d&v=2`);if(k){const v=JSON.stringify(O==null?void 0:O.data),A=(_=t.state.remote)===null||_===void 0?void 0:_.encrypt(v);if(!A)return W("[RCPMS: _write()] error encrypting message"),r(new Error("RemoteCommunicationPostMessageStream - disconnected"));b+=`&scheme=${R}&rpc=${ho(A)}`}if(!(!((P=t.state.platformManager)===null||P===void 0)&&P.isMetaMaskInstalled()))return W("[RCPMS: _write()] prevent deeplink until installation is completed."),r();Fr[C]?(W(`[RCPMS: _write()] redirect link for '${C}' socketConnected=${U} connect?${b}`),(I=t.state.platformManager)===null||I===void 0||I.openDeeplink(`${Ur}?${b}`,`${Hr}?${b}`,"_self")):!((K=t.state.remote)===null||K===void 0)&&K.isPaused()?(W(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${C}`),(q=t.state.platformManager)===null||q===void 0||q.openDeeplink(`${Ur}?redirect=true&${b}`,`${Hr}?redirect=true&${b}`,"_self")):W(`[RCPMS: _write()] method ${C} doesn't need redirect.`)}catch(x){return W("[RCPMS: _write()] error sending message",x),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}class Ty extends or.Duplex{constructor({name:e,remote:n,deeplinkProtocol:r,platformManager:i}){super({objectMode:!0}),this.state={_name:null,remote:null,deeplinkProtocol:!1,platformManager:null},this.state._name=e,this.state.remote=n,this.state.deeplinkProtocol=r,this.state.platformManager=i,this._onMessage=this._onMessage.bind(this),this.state.remote.on(exports.EventType.MESSAGE,this._onMessage)}_write(e,n,r){return Z(this,void 0,void 0,function*(){return ky(this,e,0,r)})}_read(){}_onMessage(e){return function(n,r){try{if(W("[RCPMS: onMessage()] message",r),!r||typeof r!="object"||typeof(r==null?void 0:r.data)!="object")return;if(!(r!=null&&r.name))return void W("[RCPMS: onMessage()] ignore message without name",r);if((r==null?void 0:r.name)!==jr.PROVIDER)return void W(`[RCPMS: onMessage()] ignore message with wrong name message=${r}`);if(X.isBuffer(r)){const i=X.from(r);n.push(i)}else n.push(r)}catch(i){W(`[RCPMS: onMessage()] ignore message error err=${i}`)}}(this,e)}start(){}}let Zl=1;const _f=t=>new Promise(e=>{setTimeout(()=>{e(!0)},t)}),xy=({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:e,injectProvider:n,shouldShimWeb3:r,platformManager:i,installer:o,sdk:c,remoteConnection:s,debug:a})=>Z(void 0,void 0,void 0,function*(){var l,u;const d=(({name:j,remoteConnection:G})=>{if(!G||!(G!=null&&G.getConnector()))throw new Error("Missing remote connection parameter");return new Ty({name:j,remote:G==null?void 0:G.getConnector(),deeplinkProtocol:G==null?void 0:G.state.deeplinkProtocol,platformManager:G==null?void 0:G.getPlatformManager()})})({name:jr.INPAGE,target:jr.CONTENT_SCRIPT,remoteConnection:s}),h=i.getPlatformType(),f=c.options.dappMetadata,g=`Sdk/Javascript SdkVersion/${$n.version} Platform/${h} dApp/${(l=f.url)!==null&&l!==void 0?l:f.name} dAppTitle/${f.name}`;let m=null,w=null;const p=(u=c.options.storage)===null||u===void 0?void 0:u.storageManager;if(p){try{const j=yield p.getCachedAccounts();j.length>0&&(m=j[0])}catch(j){console.error(`[initializeMobileProvider] failed to get cached addresses: ${j}`)}try{const j=yield p.getCachedChainId();j&&(w=j)}catch(j){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${j}`)}}W(`[initializeMobileProvider] cachedAccountAddress: ${m}, cachedChainId: ${w}`);const S=!(!n||h===exports.PlatformType.NonBrowser||h===exports.PlatformType.ReactNative),_=Et.init({shouldSetOnWindow:S,connectionStream:d,shouldShimWeb3:r,sdkInstance:c});let P=!1;const I=j=>{P=j},K=()=>P,q=(j,G,$,N)=>Z(void 0,void 0,void 0,function*(){var R,C,O,D,y,E,k,x,b;const v=Et.getProvider();if(P){v.emit("display_uri",(s==null?void 0:s.state.qrcodeLink)||""),s==null||s.showActiveModal();let Q=K();for(;Q;){const te=K(),oe=s==null?void 0:s.isAuthorized();Q=te&&!oe,W(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${te} authorized: ${oe}`),yield _f(1e3)}return W("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),$(...G)}const A=i.isMetaMaskInstalled(),T=s==null?void 0:s.isConnected();let M=null,L=null,B=null;if(M=(R=v.getSelectedAddress())!==null&&R!==void 0?R:m,B=v.getChainId()||w,M&&p&&M!==m&&p.persistAccounts([M]).catch(Q=>{console.error(`[initializeMobileProvider] failed to persist account: ${Q}`)}),B&&(w=B,p&&p.persistChainId(B).catch(Q=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${Q}`)})),W("[initializeMobileProvider: sendRequest()]",{selectedAddress:M,chainId:B}),N&&W(`[initializeMobileProvider: sendRequest()] method=${j} ongoing=${P} selectedAddress=${M} isInstalled=${A} checkInstallationOnAllCalls=${t} socketConnected=${T}`),M&&j.toLowerCase()===le.ETH_ACCOUNTS.toLowerCase())return[M];if(B&&j.toLowerCase()===le.ETH_CHAINID.toLowerCase())return B;const H=[le.ETH_REQUESTACCOUNTS,le.WALLET_REQUESTPERMISSIONS,le.METAMASK_CONNECTSIGN,le.METAMASK_CONNECTWITH],z=!Fr[j],J=(C=c.options.readonlyRPCMap)===null||C===void 0?void 0:C[B];if(J&&z)try{const Q=(O=G==null?void 0:G[0])===null||O===void 0?void 0:O.params,te=yield(({rpcEndpoint:oe,method:ce,sdkInfo:ne,params:re})=>Z(void 0,void 0,void 0,function*(){const ae=JSON.stringify({jsonrpc:"2.0",method:ce,params:re,id:(Zl+=1,Zl)}),se={Accept:"application/json","Content-Type":"application/json"};let me;oe.includes("infura")&&(se["Metamask-Sdk-Info"]=ne);try{me=yield Au(oe,{method:"POST",headers:se,body:ae})}catch(we){throw we instanceof Error?new Error(`Failed to fetch from RPC: ${we.message}`):new Error(`Failed to fetch from RPC: ${we}`)}if(!me.ok)throw new Error(`Server responded with a status of ${me.status}`);return(yield me.json()).result}))({rpcEndpoint:J,sdkInfo:g,method:j,params:Q||[]});return N&&W(`initializeProvider::ReadOnlyRPCResponse ${te}`),te}catch(Q){console.warn(`[initializeMobileProvider: sendRequest()] method=${j} readOnlyRPCRequest failed:`,Q)}if((!A||A&&!T)&&j!==le.METAMASK_GETPROVIDERSTATE){const Q=((D=G==null?void 0:G[0])===null||D===void 0?void 0:D.params)||[];if(H.indexOf(j)!==-1||t){I(!0);const te=j===le.METAMASK_CONNECTWITH,oe=`${Date.now()}`;try{yield o.start({wait:!1,connectWith:te?{method:j,id:oe,params:Q}:void 0}),yield new Promise((ce,ne)=>{s!=null&&s.isAuthorized()&&(W("[initializeMobileProvider: sendRequest()] already authorized"),ce(!0)),s==null||s.getConnector().once(exports.EventType.AUTHORIZED,()=>{ce(!0)}),c.once(exports.EventType.PROVIDER_UPDATE,re=>{W(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${re}`),re===exports.PROVIDER_UPDATE_TYPE.EXTENSION?ne(exports.EventType.PROVIDER_UPDATE):ne(new Error("Connection Terminated"))})})}catch(ce){if(exports.PROVIDER_UPDATE_TYPE.EXTENSION===ce){if(W(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${j} on the active provider`),j.toLowerCase()===le.METAMASK_CONNECTSIGN.toLowerCase()){const ne=yield(y=c.getProvider())===null||y===void 0?void 0:y.request({method:le.ETH_REQUESTACCOUNTS,params:[]});if(!ne.length)throw new Error("SDK state invalid -- undefined accounts");const re=yield(E=c.getProvider())===null||E===void 0?void 0:E.request({method:le.PERSONAL_SIGN,params:[Q[0],ne[0]]});return c.emit(We.ConnectWithResponse,re),re}if(j.toLowerCase()===le.METAMASK_CONNECTWITH.toLowerCase()){const[ne]=Q,re=yield(({method:ae,sdk:se,params:me})=>Z(void 0,void 0,void 0,function*(){var we,ue,pe,ye;if(!se.isExtensionActive())throw new Error("SDK state invalid -- extension is not active");W("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",ae,me);const Re=yield(we=se.getProvider())===null||we===void 0?void 0:we.request({method:le.ETH_REQUESTACCOUNTS,params:[]});if(!Re.length)throw new Error("SDK state invalid -- undefined accounts");if((ae==null?void 0:ae.toLowerCase())===le.PERSONAL_SIGN.toLowerCase()){const st={method:ae,params:[me[0],Re[0]]};return yield(ue=se.getProvider())===null||ue===void 0?void 0:ue.request(st)}if((ae==null?void 0:ae.toLowerCase())===le.ETH_SENDTRANSACTION.toLowerCase()){const st={method:ae,params:[Object.assign(Object.assign({},me[0]),{from:Re[0]})]};return yield(pe=se.getProvider())===null||pe===void 0?void 0:pe.request(st)}return Ef.includes(ae.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${ae} -- not handled by the extension -- call separately`),Re):yield(ye=se.getProvider())===null||ye===void 0?void 0:ye.request({method:ae,params:me})}))({method:ne.method,sdk:c,params:ne.params});return c.emit(We.ConnectWithResponse,re),re}return W(`[initializeMobileProvider: sendRequest()] sending '${j}' on active provider`,Q),yield(k=c.getProvider())===null||k===void 0?void 0:k.request({method:j,params:Q})}throw ce===exports.EventType.REJECTED?(s==null||s.closeModal(),(x=c.getProvider())===null||x===void 0||x.handleDisconnect({terminate:!1}),Object.assign(new Error("User rejected connection"),{code:4001})):(W(`[initializeMobileProvider: sendRequest()] failed to start installer: ${ce}`),ce)}finally{I(!1)}if(j===le.ETH_REQUESTACCOUNTS)return L=yield new Promise(ce=>{const ne=setInterval(()=>{const{accounts:re}=v.getState();re&&(clearInterval(ne),ce(re))},100)}),W(`[initializeMobileProvider: sendRequest()] selectedAddress: ${M} --- SKIP rpc call`),L;if(j===le.METAMASK_CONNECTWITH)try{let ce=0;const ne=5,re=({resolve:we,reject:ue})=>{ce+=1;const pe=s==null?void 0:s.getConnector().getRPCMethodTracker(),ye=pe==null?void 0:pe[oe];return W(`TRACKER: update method ${oe}`,ye),ye!=null&&ye.result?(W("[initializeMobileProvider: sendRequest()] found result",ye.result),c.emit(We.ConnectWithResponse,ye.result),void we(ye.result)):ye!=null&&ye.error?(W("[initializeMobileProvider: sendRequest()] found error",ye.error),void ue(ye.error)):ce>=ne?(W("[initializeMobileProvider: sendRequest()] max message count reached without result"),void ue(new Error("Max message count reached without result"))):void W("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")};let ae,se;const me=yield new Promise((we,ue)=>{const pe=s==null?void 0:s.getConnector().getRPCMethodTracker();W(`TRACKER: method ${oe}`,pe),pe!=null&&pe[oe].result?(W("[initializeMobileProvider: sendRequest()] found result",pe==null?void 0:pe[oe].result),we(pe==null?void 0:pe[oe].result)):pe!=null&&pe[oe].error&&(W("[initializeMobileProvider: sendRequest()] found error",pe==null?void 0:pe[oe].error),ue(pe==null?void 0:pe[oe].error)),se=()=>re({resolve:we,reject:ue}),ae=s==null?void 0:s.getConnector().on(exports.EventType.RPC_UPDATE,se)});return se&&(ae==null||ae.off(exports.EventType.RPC_UPDATE,se)),W("TRACKER: result",me),me}catch(ce){throw W("[initializeMobileProvider: sendRequest()] error:",ce),ce}return G[0]&&typeof G[0]=="object"&&(G[0].params={__triggeredInstaller:!0,wrappedParams:G[0].params}),$(...G)}if(i.isSecure()&&Fr[j])return $(...G);if(c.isExtensionActive())return W(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${j}' to it`,G,Q),yield(b=c.getProvider())===null||b===void 0?void 0:b.request({method:j,params:Q});throw W(`[initializeMobileProvider: sendRequest()] method=${j} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{const Q=yield $(...G);if(W(`[initializeMobileProvider: sendRequest()] method=${j} rpcResponse`,Q),j===le.WALLET_REQUESTPERMISSIONS){const te=Q.reduce((oe,ce)=>{var ne;if(ce.parentCapability==="eth_accounts"){const re=(ne=ce.caveats.find(ae=>ae.type==="restrictReturnedAccounts"))===null||ne===void 0?void 0:ne.value;re&&oe.push(...re)}return oe},[]);W("[initializeMobileProvider: sendRequest()] accountsToPersist:",te),te.length>0&&(v.handleAccountsChanged(te,!1),p==null||p.persistAccounts(te))}return Q}catch(Q){throw console.error("[initializeMobileProvider: sendRequest()] error:",Q),Q}}),{request:F}=_;_.request=(...j)=>Z(void 0,void 0,void 0,function*(){return q(j==null?void 0:j[0].method,j,F,a)});const{send:U}=_;return _.send=(...j)=>Z(void 0,void 0,void 0,function*(){return q(j==null?void 0:j[0],j,U,a)}),W("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),d.start(),_});function My(t){var e,n,r,i;return Z(this,void 0,void 0,function*(){const{options:o}=t,c={communicationLayerPreference:(e=o.communicationLayerPreference)!==null&&e!==void 0?e:exports.CommunicationLayerPreference.SOCKET,platformManager:t.platformManager,sdk:t,checkInstallationOnAllCalls:o.checkInstallationOnAllCalls,injectProvider:(n=o.injectProvider)===null||n===void 0||n,shouldShimWeb3:(r=o.shouldShimWeb3)===null||r===void 0||r,extensionOnly:(i=o.extensionOnly)===null||i===void 0||i,installer:t.installer,remoteConnection:t.remoteConnection,debug:t.debug},s=yield xy(c);t.activeProvider=s,function(a){var l,u,d,h;(u=(l=a.remoteConnection)===null||l===void 0?void 0:l.getConnector())===null||u===void 0||u.on(We.ConnectionStatus,f=>{a.emit(We.ConnectionStatus,f)}),(h=(d=a.remoteConnection)===null||d===void 0?void 0:d.getConnector())===null||h===void 0||h.on(We.ServiceStatus,f=>{a.emit(We.ServiceStatus,f)})}(t)})}const Ry="sdk";class Py{constructor({serverUrl:e,enabled:n,originatorInfo:r}){this.serverURL=In,this.serverURL=e,this.originatorInfo=r,this.enabled=n==null||n}send({event:e,params:n}){if(!this.enabled)return;const r=Object.assign(Object.assign({id:Ry,event:e,sdkVersion:$n.version},this.originatorInfo),{params:n});W(`[Analytics: send()] event: ${e}`,r),Yt(r,this.serverURL).catch(i=>{W(`[Analytics: send()] error: ${i}`)})}}const Oy=()=>{if(typeof document>"u")return;let t;const e=document.getElementsByTagName("link");for(let n=0;n<e.length;n++)e[n].getAttribute("rel")!=="icon"&&e[n].getAttribute("rel")!=="shortcut icon"||(t=e[n].getAttribute("href"));return t},Iy=163400;function Jl(t){var e,n,r;const{dappMetadata:i}=t,o=function({url:u,name:d}){var h;const f=u+d,g=ho(f);if(!localStorage)return"";let m=(h=localStorage.getItem(g))!==null&&h!==void 0?h:"";if(!m){m=hn();try{localStorage.setItem(g,m)}catch{return""}}return m}({url:(e=i==null?void 0:i.url)!==null&&e!==void 0?e:"no_url",name:(n=i==null?void 0:i.name)!==null&&n!==void 0?n:"no_name"}),c=(r=t.platformManager)===null||r===void 0?void 0:r.getPlatformType(),s=c===exports.PlatformType.DesktopWeb,a=c===exports.PlatformType.MetaMaskMobileWebview;let l="N/A";return s?l="extension":a&&(l="mobile"),{id:o,from:l}}const vi=(t,e,n)=>{if(Wr(t))if(n||e&&typeof e=="object"&&e!==null&&"error"in e){const r=n||(e==null?void 0:e.error);r&&r.code===4001?Te.analytics.track("sdk_action_rejected",{action:t}):Te.analytics.track("sdk_action_failed",{action:t})}else Te.analytics.track("sdk_action_succeeded",{action:t})},Sf=({provider:t,sdkInstance:e})=>{if("state"in t)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(t,{get:(n,r)=>r==="request"?function(i){var o,c;return Z(this,void 0,void 0,function*(){W("[wrapExtensionProvider()] Overwriting request method",i);const{method:s,params:a}=i,l=_y.includes(s.toLowerCase()),{id:u,from:d}=Jl(e);if(l&&((o=e.analytics)===null||o===void 0||o.send({event:xe.SDK_RPC_REQUEST,params:{method:s,from:d,id:u}})),Wr(s)&&Te.analytics.track("sdk_action_requested",{action:s}),s===le.METAMASK_BATCH&&Array.isArray(a))return(({target:g,args:m,trackEvent:w,sdkInstance:p})=>Z(void 0,void 0,void 0,function*(){var S,_;if(m.method!=="metamask_batch")throw new Error("Invalid usage");const P=[],I=(S=m==null?void 0:m.params)!==null&&S!==void 0?S:[];for(const F of I){const U=yield g==null?void 0:g.request({method:F.method,params:F.params});P.push(U)}const{id:K,from:q}=Jl(p);w&&((_=p.analytics)===null||_===void 0||_.send({event:xe.SDK_RPC_REQUEST_DONE,params:{method:m.method,from:q,id:K}}));for(const F of P)vi(m.method,F,null);return P}))({target:n,args:i,trackEvent:l,sdkInstance:e});if(s.toLowerCase()===le.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(a))return(({target:g,params:m})=>Z(void 0,void 0,void 0,function*(){let w,p=null;try{const S=yield g.request({method:le.ETH_REQUESTACCOUNTS,params:[]});if(!S.length)throw new Error("SDK state invalid -- undefined accounts");return w=yield g.request({method:le.PERSONAL_SIGN,params:[m[0],S[0]]}),w}catch(S){throw p=S,S}finally{vi(le.PERSONAL_SIGN,w,p)}}))({target:n,params:a});if(s.toLowerCase()===le.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(a))return(({target:g,params:m})=>Z(void 0,void 0,void 0,function*(){const[w]=m,p=w.method,S=w.params;let _,P=null;try{const I=yield g.request({method:le.ETH_REQUESTACCOUNTS,params:[]});if(!Array.isArray(I)||!I.length)throw new Error("SDK state invalid -- undefined accounts");return(p==null?void 0:p.toLowerCase())===le.PERSONAL_SIGN.toLowerCase()?(_=yield g.request({method:p,params:[S[0],I[0]]}),_):(p==null?void 0:p.toLowerCase())===le.ETH_SENDTRANSACTION.toLowerCase()?(_=yield g.request({method:p,params:[Object.assign(Object.assign({},S[0]),{from:I[0]})]}),_):Ef.includes(p.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${p} -- not handled by the extension -- call separately`),_=I,_):(_=yield g.request({method:p,params:S}),_)}catch(I){throw P=I,I}finally{vi(p,_,P)}}))({target:n,params:a});let h,f=null;try{return h=yield n.request(i),h}catch(g){throw f=g,g}finally{l&&((c=e.analytics)===null||c===void 0||c.send({event:xe.SDK_RPC_REQUEST_DONE,params:{method:s,from:d,id:u}})),vi(s,h,f)}})}:r==="getChainId"?function(){return t.chainId}:r==="getNetworkVersion"?function(){return t.networkVersion}:r==="getSelectedAddress"?function(){return t.selectedAddress}:r==="isConnected"?function(){return t._state.isConnected}:n[r]})};var fo;function Ly({mustBeMetaMask:t,sdkInstance:e}){return Z(this,void 0,void 0,function*(){if(typeof window>"u")throw new Error("window not available");try{const n=yield new Promise((r,i)=>{const o=setTimeout(()=>{i(new Error("eip6963RequestProvider timed out"))},500);window.addEventListener(fo.Announce,c=>{const s=c,{detail:{info:a,provider:l}={}}=s,{name:u,rdns:d,uuid:h}=a??{};Ey.test(h)&&u.startsWith(Gl.NAME)&&Gl.RDNS.includes(d)&&(clearTimeout(o),r(l))}),window.dispatchEvent(new Event(fo.Request))});return Sf({provider:n,sdkInstance:e})}catch{throw new Error("Provider not found")}})}(function(t){t.Announce="eip6963:announceProvider",t.Request="eip6963:requestProvider"})(fo||(fo={}));const Ny=t=>Z(void 0,void 0,void 0,function*(){const{options:e}=t,{infuraAPIKey:n}=e;if(!n)return;const r={"0x1":`https://mainnet.infura.io/v3/${n}`,"0x5":`https://goerli.infura.io/v3/${n}`,"0xaa36a7":`https://sepolia.infura.io/v3/${n}`,"0xe708":`https://linea-mainnet.infura.io/v3/${n}`,"0xe704":`https://linea-goerli.infura.io/v3/${n}`,"0x89":`https://polygon-mainnet.infura.io/v3/${n}`,"0x13881":`https://polygon-mumbai.infura.io/v3/${n}`,"0x45":`https://optimism-mainnet.infura.io/v3/${n}`,"0x1a4":`https://optimism-goerli.infura.io/v3/${n}`,"0xa4b1":`https://arbitrum-mainnet.infura.io/v3/${n}`,"0x66eed":`https://arbitrum-goerli.infura.io/v3/${n}`,"0x2a15c308d":`https://palm-mainnet.infura.io/v3/${n}`,"0x2a15c3083":`https://palm-testnet.infura.io/v3/${n}`,"0xa86a":`https://avalanche-mainnet.infura.io/v3/${n}`,"0xa869":`https://avalanche-fuji.infura.io/v3/${n}`,"0x4e454152":`https://aurora-mainnet.infura.io/v3/${n}`,"0x4e454153":`https://aurora-testnet.infura.io/v3/${n}`,"0x534e5f4d41494e":`https://starknet-mainnet.infura.io/v3/${n}`,"0x534e5f474f45524c49":`https://starknet-goerli.infura.io/v3/${n}`,"0x534e5f474f45524c4932":`https://starknet-goerli2.infura.io/v3/${n}`,"0xa4ec":`https://celo-mainnet.infura.io/v3/${n}`,"0xaef3":`https://celo-alfajores.infura.io/v3/${n}`};t.options.readonlyRPCMap?t.options.readonlyRPCMap=Object.assign(Object.assign({},t.options.readonlyRPCMap),r):t.options.readonlyRPCMap=r}),Dy=t=>Z(void 0,void 0,void 0,function*(){const{options:e}=t,{readonlyRPCMap:n}=e;if(n)try{W("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),t.setReadOnlyRPCCalls(!0)}catch{throw new Error("Invalid Infura Settings")}});function By(t,e,n,r){return new(n||(n=Promise))(function(i,o){function c(l){try{a(r.next(l))}catch(u){o(u)}}function s(l){try{a(r.throw(l))}catch(u){o(u)}}function a(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n(function(d){d(u)})).then(c,s)}a((r=r.apply(t,[])).next())})}function $y(t,e){var n,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(a){return function(l){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(i=c.trys,!((i=i.length>0&&i[i.length-1])||u[0]!==6&&u[0]!==2)){c=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(u[0]===6&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=e.call(t,c)}catch(d){u=[6,d],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([a,l])}}}var Xl="INSTALLED",Ql="NOT_INSTALLED",eu="REGISTERED",tu="REGISTERING",nu="RELOADING",ru={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},bi="REGISTRATION_IN_PROGRESS",iu="FORWARDER_ID",Ky=function(){function t(e){var n=e===void 0?{}:e,r=n.forwarderOrigin,i=r===void 0?"https://fwd.metamask.io":r,o=n.forwarderMode,c=o===void 0?t.FORWARDER_MODE.INJECT:o;this.forwarderOrigin=i,this.forwarderMode=c,this.state=t.isMetaMaskInstalled()?Xl:Ql;var s=t._detectBrowser();this.downloadUrl=s?ru[s]:ru.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),c===t.FORWARDER_MODE.INJECT&&sessionStorage.getItem(bi)==="true"&&t._injectForwarder(this.forwarderOrigin)}return t.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return e.data.type==="metamask:reload"?this._onMessageFromForwarder(e):void console.debug("Unknown message from '"+e.origin+"' with data "+JSON.stringify(e.data))},t.prototype._onMessageUnknownStateError=function(e){throw new Error("Unknown state: '"+e+"'")},t.prototype._onMessageFromForwarder=function(e){return By(this,0,void 0,function(){return $y(this,function(n){switch(n.label){case 0:switch(this.state){case nu:return[3,1];case Ql:return[3,2];case Xl:return[3,3];case tu:return[3,5];case eu:return[3,6]}return[3,7];case 1:return console.debug("Ignoring message while reloading"),[3,8];case 2:return console.debug("Reloading now to register with MetaMask"),this.state=nu,location.reload(),[3,8];case 3:return console.debug("Registering with MetaMask"),this.state=tu,[4,t._register()];case 4:return n.sent(),this.state=eu,e.source.postMessage({type:"metamask:registrationCompleted"},e.origin),this.stopOnboarding(),[3,8];case 5:return console.debug("Already registering - ignoring reload message"),[3,8];case 6:return console.debug("Already registered - ignoring reload message"),[3,8];case 7:this._onMessageUnknownStateError(this.state),n.label=8;case 8:return[2]}})})},t.prototype.startOnboarding=function(){sessionStorage.setItem(bi,"true"),this._openDownloadPage(),this._openForwarder()},t.prototype.stopOnboarding=function(){sessionStorage.getItem(bi)==="true"&&(this.forwarderMode===t.FORWARDER_MODE.INJECT&&(console.debug("Removing forwarder"),t._removeForwarder()),sessionStorage.setItem(bi,"false"))},t.prototype._openForwarder=function(){this.forwarderMode===t.FORWARDER_MODE.OPEN_TAB?window.open(this.forwarderOrigin,"_blank"):t._injectForwarder(this.forwarderOrigin)},t.prototype._openDownloadPage=function(){window.open(this.downloadUrl,"_blank")},t.isMetaMaskInstalled=function(){return!!(window.ethereum&&window.ethereum.isMetaMask)},t._register=function(){return window.ethereum.request({method:"wallet_registerOnboarding"})},t._injectForwarder=function(e){var n=document.body,r=document.createElement("iframe");r.setAttribute("height","0"),r.setAttribute("width","0"),r.setAttribute("style","display: none;"),r.setAttribute("src",e),r.setAttribute("id",iu),n.insertBefore(r,n.children[0])},t._removeForwarder=function(){var e;(e=document.getElementById(iu))===null||e===void 0||e.remove()},t._detectBrowser=function(){var e=vf.parse(window.navigator.userAgent);return e.browser.name==="Firefox"?"FIREFOX":["Chrome","Chromium"].includes(e.browser.name||"")?"CHROME":null},t.FORWARDER_MODE={INJECT:"INJECT",OPEN_TAB:"OPEN_TAB"},t}();function jy(t,{wait:e=!1}){return Z(this,void 0,void 0,function*(){return W(`[MetamaskInstaller: startInstaller()] wait=${e}`),e&&(yield _f(1e3)),yield t.checkInstallation()})}class Uy{constructor({remote:e,preferDesktop:n,platformManager:r,debug:i=!1}){this.state={isInstalling:!1,hasInstalled:!1,resendRequest:null,preferDesktop:!1,platformManager:null,remote:null,debug:!1,connectWith:void 0},this.state.remote=e,this.state.preferDesktop=n,this.state.platformManager=r,this.state.debug=i}startDesktopOnboarding(){return function(){return Z(this,void 0,void 0,function*(){W("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),new Ky().startOnboarding()})}()}redirectToProperInstall(){return Z(this,void 0,void 0,function*(){return function(e){var n,r;return Z(this,void 0,void 0,function*(){const{state:i}=e,o=(n=i.platformManager)===null||n===void 0?void 0:n.getPlatformType();if(W(`[MetamaskInstaller: redirectToProperInstall()] platform=${o}`),o===exports.PlatformType.MetaMaskMobileWebview)return!1;i.isInstalling=!0;try{yield(r=i.remote)===null||r===void 0?void 0:r.startConnection({connectWith:i.connectWith}),i.isInstalling=!1,i.hasInstalled=!0}catch(c){throw i.isInstalling=!1,c}return!0})}(this)})}checkInstallation(){return Z(this,void 0,void 0,function*(){return function(e){var n;return Z(this,void 0,void 0,function*(){const{state:r}=e,i=(n=r.platformManager)===null||n===void 0?void 0:n.isMetaMaskInstalled();return W(`[MetamaskInstaller: checkInstallation()] isInstalled=${i}`),!!i||(yield e.redirectToProperInstall())})}(this)})}start({wait:e=!1,connectWith:n}){return Z(this,void 0,void 0,function*(){this.state.connectWith=n,W(`[MetaMaskInstaller: start()] wait=${e}`,n),yield jy(this,{wait:e})})}}class Cf{constructor({debug:e,sdkVersion:n}){this.containers={install:void 0,pending:void 0,select:void 0},this.defined={install:!1,pending:!1,select:!1},this.debug=e!=null&&e,this.sdkVersion=n}loadComponent(e){return Z(this,void 0,void 0,function*(){if(!this.defined[e]){this.defined[e]=!0;try{const n=yield Promise.resolve().then(function(){return wv});console.log("loader",n),n.defineCustomElements()}catch(n){console.error(`Failed to load ${e} modal:`,n)}}})}renderInstallModal(e){var n;return Z(this,void 0,void 0,function*(){this.debug&&console.debug("ModalLoader: renderInstallModal",e),this.containers.install=e.parentElement,yield this.loadComponent("install");const r=document.createElement("mm-install-modal");r.link=e.link,r.preferDesktop=e.preferDesktop,r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.addEventListener("close",({detail:{shouldTerminate:i}})=>e.onClose(i)),r.addEventListener("startDesktopOnboarding",e.metaMaskInstaller.startDesktopOnboarding),r.addEventListener("trackAnalytics",i=>{var o;return(o=e.onAnalyticsEvent)===null||o===void 0?void 0:o.call(e,i.detail)}),e.parentElement.appendChild(r)})}renderSelectModal(e){var n;return Z(this,void 0,void 0,function*(){this.containers.select=e.parentElement,yield this.loadComponent("select");const r=document.createElement("mm-select-modal");r.link=e.link,r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.preferDesktop=e.preferDesktop,r.addEventListener("close",({detail:{shouldTerminate:i}})=>e.onClose(i)),r.addEventListener("connectWithExtension",e.connectWithExtension),e.parentElement.appendChild(r),setTimeout(()=>this.updateQRCode(e.link),100)})}renderPendingModal(e){var n;return Z(this,void 0,void 0,function*(){this.containers.pending=e.parentElement,yield this.loadComponent("pending");const r=document.createElement("mm-pending-modal");r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.displayOTP=e.displayOTP,r.addEventListener("close",e.onClose),r.addEventListener("updateOTPValue",({detail:{otpValue:i}})=>e.updateOTPValue(i)),e.onDisconnect&&r.addEventListener("disconnect",e.onDisconnect),e.parentElement.appendChild(r)})}updateOTPValue(e){const n=()=>{var r;const i=(r=this.containers.pending)===null||r===void 0?void 0:r.querySelector("mm-pending-modal");return!!i&&(i.otpCode=e,!0)};setTimeout(()=>{n()},800)}updateQRCode(e){var n,r;const i=(n=this.containers.install)===null||n===void 0?void 0:n.querySelector("mm-install-modal");if(i)i.link=e;else{const o=(r=this.containers.select)===null||r===void 0?void 0:r.querySelector("mm-select-modal");o&&(o.link=e)}}unmount(){Object.entries(this.containers).forEach(([e,n])=>{var r;(r=n==null?void 0:n.parentNode)===null||r===void 0||r.removeChild(n),this.containers[e]=void 0})}}const Hy=({link:t,debug:e,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:c})=>{let s=null,a=null;W("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),W(`[UI: InstallModal-web: sdkWebInstallModal()] link=${t}`),W(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --ios`),W(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --android`),W(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${t}"`);const l=u=>{var d;W("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",u,a),a!=null&&a.parentNode&&((d=a.parentNode)===null||d===void 0||d.removeChild(a)),a=null,s=null,u===!0&&(r==null||r())};return{mount:u=>{if(W("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",a),a)return a.style.display="block",void(s==null||s.updateQRCode(u));s=new Cf({debug:e,sdkVersion:$n.version}),a=document.createElement("div"),document.body.appendChild(a),window.extension?s.renderSelectModal({parentElement:a,connectWithExtension:()=>{l(),i==null||i()},onClose:l,link:t,preferDesktop:o!=null&&o}).catch(d=>{console.error(d)}):s.renderInstallModal({parentElement:a,preferDesktop:o!=null&&o,link:t,metaMaskInstaller:n,onClose:l,onAnalyticsEvent:c}).catch(d=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",d)})},unmount:l}},Fy=({onDisconnect:t,debug:e})=>{let n=null,r=null;const i=()=>{W("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),n!=null&&n.parentNode&&n.parentNode.removeChild(n),n=null,r=null},o=s=>{W("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",s),r&&r.updateOTPValue(s)},c=({displayOTP:s}={displayOTP:!0})=>{W("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new Cf({debug:e,sdkVersion:$n.version}),n=document.createElement("div"),document.body.appendChild(n),r.renderPendingModal({parentElement:n,onClose:i,onDisconnect:t,updateOTPValue:o,displayOTP:s}).catch(a=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",a)}))};return c(),{mount:c,unmount:i,updateOTPValue:o}};function Af(t,e){var n,r,i,o;t.connector||(W("[RemoteConnection: initializeConnector()] initialize connector"),t.connector=new Vm({anonId:e.anonId,platformType:e.platformManager.getPlatformType(),communicationLayerPreference:e.communicationLayerPreference,transports:e.transports,dappMetadata:Object.assign(Object.assign({},e.dappMetadata),{source:e._source}),analytics:e.enableAnalytics,communicationServerUrl:e.communicationServerUrl,sdkVersion:$n.version,context:"dapp",ecies:e.ecies,storage:e.storage,logging:e.logging}),e.timer&&(W("[RemoteConnection: initializeConnector()] reset background timer",e.timer),(r=(n=e.timer)===null||n===void 0?void 0:n.stopBackgroundTimer)===null||r===void 0||r.call(n),(o=(i=e.timer)===null||i===void 0?void 0:i.runBackgroundTimer)===null||o===void 0||o.call(i,()=>!1,1e4)))}function oa(t){t.listeners.forEach(({event:e,handler:n})=>{var r;(r=t.connector)===null||r===void 0||r.off(e,n)}),t.listeners=[]}function zy(t,e,n){return Z(this,void 0,void 0,function*(){const r=setTimeout(()=>{Te.analytics.track("sdk_connection_failed",{transport_type:"websocket"})},6e4);return new Promise((i,o)=>{if(!t.connector)return void o(new Error("No connector available"));W("[RemoteConnection: connectWithModalInstaller()]",{state:t,options:e,linkParams:n});const c=`${t.useDeeplink?Hr:Ur}?${n}`;(function(s,a,l){var u,d,h,f;s.installModal=(d=(u=a.modals).install)===null||d===void 0?void 0:d.call(u,{link:l,preferDesktop:s.preferDesktop,installer:a.getMetaMaskInstaller(),terminate:()=>{W("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),a.sdk.terminate().catch(g=>{console.warn("[MMSDK] failed to terminate connection",g)})},debug:s.developerMode,connectWithExtension:()=>{var g;return(g=a.connectWithExtensionProvider)===null||g===void 0||g.call(a),!1},onAnalyticsEvent:({event:g,params:m})=>{var w,p,S;const _=Object.assign(Object.assign({},m),{sdkVersion:a.sdk.getVersion(),dappId:(w=a.dappMetadata)===null||w===void 0?void 0:w.name,source:a._source,url:(p=a.dappMetadata)===null||p===void 0?void 0:p.url});(S=s.analytics)===null||S===void 0||S.send({event:g,params:_})}}),(f=(h=s.installModal)===null||h===void 0?void 0:h.mount)===null||f===void 0||f.call(h,l)})(t,e,c),e.sdk.once(exports.EventType.PROVIDER_UPDATE,s=>Z(this,void 0,void 0,function*(){if(W("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),s===exports.PROVIDER_UPDATE_TYPE.TERMINATE){const a={code:4001,message:"User rejected the request."};return clearTimeout(r),void o(a)}o(s)})),t.connector.once(exports.EventType.AUTHORIZED,()=>{clearTimeout(r),i()}),t.connector.once(exports.EventType.REJECTED,()=>{clearTimeout(r),o(exports.EventType.REJECTED)}),t.connector.once(exports.EventType.CLIENTS_READY,()=>Z(this,void 0,void 0,function*(){W("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),clearTimeout(r),i()}))})})}function kf(t,e){function n(r,i){var o;(o=t.connector)===null||o===void 0||o.on(r,i),t.listeners.push({event:r,handler:i})}t.connector&&(oa(t),n(exports.EventType.WALLET_INIT,({accounts:r,chainId:i})=>Z(this,void 0,void 0,function*(){W(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${r} chainId=${i}`);const o=Et.getProvider();o._setConnected();const c={accounts:r,chainId:i,isUnlocked:!1};o._initializeState(c),o.emit("chainChanged",i),o.emit("accountsChanged",r)})),n(exports.EventType.AUTHORIZED,()=>Z(this,void 0,void 0,function*(){var r,i,o,c;try{W("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",t.pendingModal,t.installModal);const s=Et.getProvider();s._setConnected(),(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(c=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||c===void 0||c.call(o,!1),t.otpAnswer=void 0,t.authorized=!0,W("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",s.getState()),yield s.forceInitializeState()}catch{}})),n(exports.EventType.TERMINATE,()=>{var r,i,o,c,s;(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(c=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||c===void 0||c.call(o,!0),t.pendingModal=void 0,t.installModal=void 0,t.otpAnswer=void 0,(s=t.connector)===null||s===void 0||s.disconnect({terminate:!0}),t.authorized=!1,Et.getProvider().handleDisconnect({terminate:!0}),oa(t),W("[RemoteConnection: setupListeners()] All listeners cleaned up")}))}function qy(t,e,{initialCheck:n,connectWith:r}={}){var i,o,c,s,a,l,u,d,h,f,g,m,w,p,S,_,P,I,K;return Z(this,void 0,void 0,function*(){try{if(Af(t,e),!t.connector)throw new Error("no connector defined");kf(t);const q=Et.getProvider();t.authorized=!1,q.emit("connecting");const F=yield(i=t.connector)===null||i===void 0?void 0:i.originatorSessionConnect();W(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,F);let U=(o=F==null?void 0:F.channelId)!==null&&o!==void 0?o:"",j=(s=(c=t.connector.getKeyInfo())===null||c===void 0?void 0:c.ecies.public)!==null&&s!==void 0?s:"",G=(l=(a=t.connector.getKeyInfo())===null||a===void 0?void 0:a.ecies.private)!==null&&l!==void 0?l:"";if(n&&!F)return Promise.resolve();if(!F&&!n){const T=yield t.connector.generateChannelIdConnect();U=(u=T.channelId)!==null&&u!==void 0?u:"",j=(d=T.pubKey)!==null&&d!==void 0?d:"",G=(h=T.privKey)!==null&&h!==void 0?h:"";const M=Date.now();(f=t.connector.state.storageManager)===null||f===void 0||f.persistChannelConfig({channelId:U,localKey:G,lastActive:M,validUntil:M+rr})}if(n&&(F!=null&&F.channelId))return!((g=t.connector)===null||g===void 0)&&g.isConnected()||(W(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,F),yield(m=t.connector)===null||m===void 0?void 0:m.connectToChannel({channelId:U})),Promise.resolve();F&&!(!((w=t.connector)===null||w===void 0)&&w.isConnected())&&(W("[RemoteConnection: startConnection()] reconnecting to channel",F),yield(p=t.connector)===null||p===void 0?void 0:p.connectToChannel({channelId:U}));const $=!((S=t.platformManager)===null||S===void 0)&&S.isSecure()?"":"&t=q",N=$n.version,{iconUrl:R,name:C,url:O,scheme:D}=e.dappMetadata||{},y=(_=t.platformManager)===null||_===void 0?void 0:_.getPlatformType();let E="N/A";typeof window<"u"&&window.location&&window.location.hostname?E=window.location.hostname:C!==void 0?E=C:O!==void 0&&(E=O);const k={url:O??"",title:C??"",icon:R,scheme:D??"",apiVersion:N,dappId:E||O||"N/A",anonId:e.anonId,platform:y??"",source:(P=e._source)!==null&&P!==void 0?P:""},x=ho(JSON.stringify(k));let b=`channelId=${U}&v=2&comm=${(I=t.communicationLayerPreference)!==null&&I!==void 0?I:""}&pubkey=${j}${$}&originatorInfo=${x}`;if(r){b+=`&rpc=${ho(JSON.stringify(r))}`;const T=t.connector.getRPCMethodTracker();T&&(T[`${r.id}`]=Object.assign(Object.assign({},r),{id:`${r.id}`,timestamp:Date.now()}))}const v=encodeURI(b),A=`${t.useDeeplink?Hr:Ur}?${b}`;if(t.qrcodeLink=A,t.developerMode&&W(`[RemoteConnection: startConnection()] qrcodeLink=${v}`),q.emit("display_uri",A),Te.analytics.track("sdk_connection_initiated",{transport_type:"websocket"}),(K=t.platformManager)===null||K===void 0?void 0:K.isSecure()){const T=setTimeout(()=>{Te.analytics.track("sdk_connection_failed",{transport_type:"websocket"})},6e4);return yield function(M,L){var B,H;return Z(this,void 0,void 0,function*(){const z=`${Ur}?${L}`,J=`${Hr}?${L}`;(H=(B=M.platformManager)===null||B===void 0?void 0:B.openDeeplink)===null||H===void 0||H.call(B,z,J,"_self")})}(t,v),new Promise((M,L)=>{var B,H,z;if(!((B=t.connector)===null||B===void 0)&&B.isAuthorized())return clearTimeout(T),void M();(H=t.connector)===null||H===void 0||H.once(exports.EventType.AUTHORIZED,()=>{clearTimeout(T),M()}),(z=t.connector)===null||z===void 0||z.once(exports.EventType.REJECTED,()=>{clearTimeout(T),L(exports.EventType.REJECTED)})})}return zy(t,e,v)}catch(q){throw console.error("[startConnection] error",q),q}})}class Vy{constructor(e){var n,r,i;this.state={connector:void 0,qrcodeLink:void 0,analytics:void 0,developerMode:!1,authorized:!1,reconnection:!1,preferDesktop:!1,deeplinkProtocol:!1,listeners:[],communicationLayerPreference:void 0,platformManager:void 0,pendingModal:void 0,installModal:void 0,otpAnswer:void 0},this.options=e;const o=((n=e.logging)===null||n===void 0?void 0:n.developerMode)===!0||((r=e.logging)===null||r===void 0?void 0:r.sdk)===!0;this.state.developerMode=o,this.state.analytics=e.analytics,this.state.preferDesktop=(i=e.preferDesktop)!==null&&i!==void 0&&i,this.state.useDeeplink=e.sdk.options.useDeeplink,this.state.communicationLayerPreference=e.communicationLayerPreference,this.state.platformManager=e.platformManager,e.modals.install||(e.modals.install=Hy),e.modals.otp||(e.modals.otp=Fy)}startConnection(e){return Z(this,void 0,void 0,function*(){return qy(this.state,this.options,e)})}initRemoteCommunication({sdkInstance:e}){var n,r,i;return Z(this,void 0,void 0,function*(){const o=yield(r=(n=e.options.storage)===null||n===void 0?void 0:n.storageManager)===null||r===void 0?void 0:r.getPersistedChannelConfig();if(!this.options.ecies){const c={privateKey:o==null?void 0:o.localKey};this.options.ecies=c}Af(this.state,this.options),yield(i=this.getConnector())===null||i===void 0?void 0:i.initFromDappStorage(),kf(this.state,this.options)})}showActiveModal(){return function(e){var n,r,i,o;e.authorized?W("[RemoteConnection: showActiveModal()] already authorized"):e.pendingModal?(r=(n=e.pendingModal).mount)===null||r===void 0||r.call(n):e.installModal&&((o=(i=e.installModal).mount)===null||o===void 0||o.call(i,e.qrcodeLink||""))}(this.state)}closeModal(){var e,n,r,i;(n=(e=this.state.pendingModal)===null||e===void 0?void 0:e.unmount)===null||n===void 0||n.call(e),(i=(r=this.state.installModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r,!1)}getUniversalLink(){if(!this.state.qrcodeLink)throw new Error("connection not started. run startConnection() first.");return this.state.qrcodeLink}getChannelConfig(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.getChannelConfig()}getKeyInfo(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.getKeyInfo()}getConnector(){if(!this.state.connector)throw new Error("invalid remote connector");return this.state.connector}getPlatformManager(){if(!this.state.platformManager)throw new Error("PlatformManager not available");return this.state.platformManager}isConnected(){var e;return((e=this.state.connector)===null||e===void 0?void 0:e.isReady())||!1}isAuthorized(){var e;return((e=this.state.connector)===null||e===void 0?void 0:e.isAuthorized())||!1}isPaused(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.isPaused()}disconnect(e){var n,r,i;W("[RemoteConnection: disconnect()]",e),e!=null&&e.terminate&&(Et.getProvider().handleDisconnect({terminate:!0}),(r=(n=this.state.pendingModal)===null||n===void 0?void 0:n.unmount)===null||r===void 0||r.call(n),this.state.otpAnswer=void 0),(i=this.state.connector)===null||i===void 0||i.disconnect(e),function(o){W("[RemoteConnection: cleanupConnector()] cleaning up connector"),o.connector&&(oa(o),o.connector.disconnect({terminate:!0}).catch(c=>{W("[RemoteConnection: cleanupConnector()] error disconnecting connector",c)}))}(this.state)}}function Wy(t){var e,n,r,i,o,c,s,a,l,u,d;return Z(this,void 0,void 0,function*(){const{options:h}=t;if(h.logging=(e=h.logging)!==null&&e!==void 0?e:{},h.communicationLayerPreference=(n=h.communicationLayerPreference)!==null&&n!==void 0?n:exports.CommunicationLayerPreference.SOCKET,h.enableDebug!==void 0&&(Ve.enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),h.enableAnalytics=(r=h.enableAnalytics)===null||r===void 0||r,h.injectProvider=(i=h.injectProvider)===null||i===void 0||i,h.shouldShimWeb3=(o=h.shouldShimWeb3)===null||o===void 0||o,h.extensionOnly=(c=h.extensionOnly)===null||c===void 0||c,h.useDeeplink=(s=h.useDeeplink)===null||s===void 0||s,h.storage=(a=h.storage)!==null&&a!==void 0?a:{enabled:!0},h.headless){Ve("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");const S=()=>{},_={install:()=>({mount:S,unmount:S})},P={installer:S};h.modals=_,h.ui=P}const f=((l=h.logging)===null||l===void 0?void 0:l.developerMode)===!0;t.debug=((u=h.logging)===null||u===void 0?void 0:u.sdk)||f,W("[MetaMaskSDK: performSDKInitialization()] options",t.options);const g=Object.assign({},h.logging);f&&(g.sdk=!0,g.eciesLayer=!0,g.keyExchangeLayer=!0,g.remoteLayer=!0,g.serviceLayer=!0,g.plaintext=!0),yield function(S){var _;return Z(this,void 0,void 0,function*(){const{options:P}=S;S.platformManager=new Kr({useDeepLink:(_=P.useDeeplink)!==null&&_!==void 0&&_,preferredOpenLink:P.openDeeplink,debug:S.debug})})}(t),yield function(S){var _,P,I,K,q;return Z(this,void 0,void 0,function*(){const{options:F}=S,U=(_=S.platformManager)===null||_===void 0?void 0:_.getPlatformType();S.analytics=new Py({serverUrl:(P=F.communicationServerUrl)!==null&&P!==void 0?P:In,enabled:F.enableAnalytics,originatorInfo:{url:(I=F.dappMetadata.url)!==null&&I!==void 0?I:"",title:(K=F.dappMetadata.name)!==null&&K!==void 0?K:"",dappId:S.getDappId(),platform:U??"",source:(q=F._source)!==null&&q!==void 0?q:"",anonId:""}})})}(t),yield function(S){var _,P,I;return Z(this,void 0,void 0,function*(){if(!S.options.enableAnalytics||!(!((_=S.platformManager)===null||_===void 0)&&_.isBrowser())&&!(!((P=S.platformManager)===null||P===void 0)&&P.isReactNative()))return;const K=S.getVersion(),q=S.getDappId(),F=yield S.getAnonId(),U=(I=S.platformManager)===null||I===void 0?void 0:I.getPlatformType(),j=S.options._source;Te.analytics.setGlobalProperty("sdk_version",K),Te.analytics.setGlobalProperty("dapp_id",q),Te.analytics.setGlobalProperty("anon_id",F),Te.analytics.setGlobalProperty("platform",U),Te.analytics.setGlobalProperty("integration_type",j),Te.analytics.enable(),Te.analytics.track("sdk_initialized",{})})}(t),yield function(S){var _;return Z(this,void 0,void 0,function*(){const{options:P}=S;((_=P.storage)===null||_===void 0?void 0:_.enabled)!==!0||P.storage.storageManager||(P.storage.storageManager=yield bf(P.storage))})}(t),yield function(S){return Z(this,void 0,void 0,function*(){const{options:_}=S,P=/^(http|https):\/\/[^\s]*$/;if(_.dappMetadata){_.dappMetadata.iconUrl&&!P.test(_.dappMetadata.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),_.dappMetadata.iconUrl=void 0),_.dappMetadata.base64Icon&&_.dappMetadata.base64Icon.length>Iy&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),_.dappMetadata.base64Icon=void 0),_.dappMetadata.url&&!P.test(_.dappMetadata.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");const I=Oy();if(I&&!_.dappMetadata.iconUrl&&!_.dappMetadata.base64Icon){const K=`${window.location.protocol}//${window.location.host}${I}`;_.dappMetadata.iconUrl=K}}S.dappMetadata=_.dappMetadata})}(t),yield Ny(t),yield Dy(t);const{metamaskBrowserExtension:m,preferExtension:w,shouldReturn:p}=yield function(S){var _,P,I,K;return Z(this,void 0,void 0,function*(){const{options:q}=S;let F,U=!1,j=!1;if(typeof window<"u"&&window.ethereum&&!(!((_=S.platformManager)===null||_===void 0)&&_.isMetaMaskMobileWebView())){U=localStorage.getItem(uo)==="extension";try{F=yield Ly({mustBeMetaMask:!0,sdkInstance:S}),window.extension=F,F.on(St.CHAIN_CHANGED,G=>{W(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${G}`),S.sdkProvider&&S.getMobileProvider().emit(St.CHAIN_CHANGED,G)}),F.on(St.ACCOUNTS_CHANGED,G=>Z(this,void 0,void 0,function*(){var $;W(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${G}`);const N=!!S.sdkProvider,R=!!S.extensionActive;if(N&&S.getMobileProvider().emit(St.ACCOUNTS_CHANGED,G),R&&(G==null?void 0:G.length)===0&&(yield($=S.getProvider())===null||$===void 0?void 0:$.request({method:le.WALLET_GETPERMISSIONS,params:[]})).length===0)try{yield S.terminate()}catch(C){W("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",C)}})),F.on(St.DISCONNECT,G=>{W(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${G}`),S.sdkProvider&&S.getMobileProvider().emit(St.DISCONNECT,G)}),F.on(St.CONNECT,G=>{W(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${G}`),S.sdkProvider&&S.getMobileProvider().emit(St.CONNECT,G)}),F.on(St.CONNECTED,G=>{W("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",G),S.sdkProvider&&S.getMobileProvider().emit(St.CONNECTED,G)})}catch{window.extension=void 0}}else!((P=S.platformManager)===null||P===void 0)&&P.isMetaMaskMobileWebView()&&((I=S.analytics)===null||I===void 0||I.send({event:xe.SDK_USE_INAPP_BROWSER}),S.activeProvider=Sf({provider:window.ethereum,sdkInstance:S}),S._initialized=!0,j=!0);return F&&q.extensionOnly&&(W("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),(K=S.analytics)===null||K===void 0||K.send({event:xe.SDK_USE_EXTENSION}),S.activeProvider=F,S.extensionActive=!0,S.extension=F,S._initialized=!0,j=!0),{preferExtension:U,shouldReturn:j,metamaskBrowserExtension:F}})}(t);if(p)W("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield function(S,_){var P,I,K,q,F;return Z(this,void 0,void 0,function*(){const{options:U}=S,j=Object.assign({},U.logging);S.remoteConnection=new Vy({anonId:yield S.getAnonId(),preferDesktop:(P=U.preferDesktop)!==null&&P!==void 0&&P,communicationLayerPreference:(I=U.communicationLayerPreference)!==null&&I!==void 0?I:exports.CommunicationLayerPreference.SOCKET,analytics:S.analytics,dappMetadata:U.dappMetadata,_source:U._source,enableAnalytics:(K=U.enableAnalytics)===null||K===void 0||K,timer:U.timer,sdk:S,platformManager:S.platformManager,transports:U.transports,communicationServerUrl:U.communicationServerUrl,storage:(q=U.storage)!==null&&q!==void 0?q:{enabled:!0},getMetaMaskInstaller:()=>{if(!S.installer)throw new Error("Invalid SDK status -- installer not initialized");return S.installer},logging:j,connectWithExtensionProvider:_===void 0?void 0:()=>Yl(S),modals:Object.assign(Object.assign({},U.modals),{onPendingModalDisconnect:S.terminate.bind(S)})}),yield S.remoteConnection.initRemoteCommunication({sdkInstance:S}),S.installer=new Uy({remote:S.remoteConnection,preferDesktop:(F=U.preferDesktop)!==null&&F!==void 0&&F,platformManager:S.platformManager,debug:S.debug})})}(t,m),yield My(t),yield function(S,_){var P,I;return Z(this,void 0,void 0,function*(){const{options:K}=S;_?(W("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),(P=S.analytics)===null||P===void 0||P.send({event:xe.SDK_EXTENSION_UTILIZED}),Yl(S).catch(q=>{console.warn("Can't connect with MetaMask extension...",q),localStorage.removeItem(uo)})):K.checkInstallationImmediately&&(!((I=S.platformManager)===null||I===void 0)&&I.isDesktopWeb()?(W("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),S.connect().catch(q=>{W(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${q}`)})):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),S._initialized=!0})}(t,w);try{yield(d=t.remoteConnection)===null||d===void 0?void 0:d.startConnection({initialCheck:!0})}catch(S){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",S)}t.emit(We.ProviderUpdate,exports.PROVIDER_UPDATE_TYPE.INITIALIZED)}})}class Tf extends Ip{constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:Wl,i18nOptions:{enabled:!1}}){var n,r,i;super(),this.extensionActive=!1,this._initialized=!1,this.sdkInitPromise=void 0,this.debug=!1,this.readonlyRPCCalls=!1,this.availableLanguages=["en"],this.ANON_ID_STORAGE_KEY="mm-sdk-anon-id",Ve.disable();const o=((n=e.logging)===null||n===void 0?void 0:n.developerMode)===!0;if((!((r=e.logging)===null||r===void 0)&&r.sdk||o)&&Ve.enable("MM_SDK"),W("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(!((i=e.dappMetadata)===null||i===void 0)&&i.url)){if(typeof window>"u"||typeof document>"u")throw new Error("You must provide dAppMetadata url");e.dappMetadata=Object.assign(Object.assign({},e.dappMetadata),{url:`${window.location.protocol}//${window.location.host}`})}this.options=e,this.options._source||(e._source=Wl),this.init().then(()=>{W("[MetaMaskSDK: constructor()]: initialized successfully."),typeof window<"u"&&(window.mmsdk=this)}).catch(c=>{console.error("[MetaMaskSDK: constructor()] error during initialization",c)})}init(){return Z(this,void 0,void 0,function*(){return function(e){var n;return Z(this,void 0,void 0,function*(){if(typeof window<"u"&&(!((n=window.mmsdk)===null||n===void 0)&&n.isInitialized()))return W("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return W("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return W("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=Wy(e),yield e.sdkInitPromise}catch(r){throw console.error(r),r}return e.sdkInitPromise})}(this)})}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return typeof window<"u"&&!!(!((e=window.ethereum)===null||e===void 0)&&e.isMetaMask)}connect(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){if(e._initialized||(W("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),W(`[MetaMaskSDK: connect()] isExtensionActive=${e.isExtensionActive()} activeProvider`,e.activeProvider),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=e.activeProvider.getSelectedAddress();return n?[n]:e.activeProvider.request({method:le.ETH_REQUESTACCOUNTS,params:[]})})}(this)})}connectAndSign({msg:e}){return Z(this,void 0,void 0,function*(){return Ay({instance:this,msg:e})})}connectWith(e){return Z(this,void 0,void 0,function*(){return function({instance:n,rpc:r}){return Z(this,void 0,void 0,function*(){if(n._initialized||(W("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield n.init()),W(`[MetaMaskSDK: connectWith()] method: ${r.method} rpc=${r}`),!n.activeProvider)throw new Error("SDK state invalid -- undefined provider");return n.activeProvider.request({method:le.METAMASK_CONNECTWITH,params:[r]})})}({instance:this,rpc:e})})}resume(){return function(e){var n,r,i;return Z(this,void 0,void 0,function*(){if(!(!((r=(n=e.remoteConnection)===null||n===void 0?void 0:n.getConnector())===null||r===void 0)&&r.isReady()))return W("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void((i=e.remoteConnection)===null||i===void 0||i.startConnection());W("[MetaMaskSDK: resume()] channel is ready")})}(this)}disconnect(){return console.warn("MetaMaskSDK.disconnect() is deprecated, use terminate()"),this.terminate()}isAuthorized(){var e;(e=this.remoteConnection)===null||e===void 0||e.isAuthorized()}terminate(){return function(e){var n,r,i;return Z(this,void 0,void 0,function*(){if(!(!((n=e.platformManager)===null||n===void 0)&&n.isMetaMaskMobileWebView())){if(Cy&&(window.localStorage.removeItem(uo),window.localStorage.removeItem(ia),window.localStorage.removeItem(ra)),e.extensionActive){try{yield(r=e.activeProvider)===null||r===void 0?void 0:r.request({method:le.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(o){W("[MetaMaskSDK: terminate()] error revoking permissions",o)}return e.options.extensionOnly?(e.emit(We.ProviderUpdate,exports.PROVIDER_UPDATE_TYPE.TERMINATE),void W("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(We.ProviderUpdate,exports.PROVIDER_UPDATE_TYPE.TERMINATE))}e.emit(We.ProviderUpdate,exports.PROVIDER_UPDATE_TYPE.TERMINATE),W(`[MetaMaskSDK: terminate()] remoteConnection=${e.remoteConnection}`),(i=e.remoteConnection)===null||i===void 0||i.disconnect({terminate:!0,sendMessage:!0})}})}(this)}isInitialized(){return this._initialized}setReadOnlyRPCCalls(e){this.readonlyRPCCalls=e}hasReadOnlyRPCCalls(){return this.readonlyRPCCalls}getProvider(){if(this.activeProvider)return this.activeProvider;console.warn("MetaMaskSDK: No active provider found")}getMobileProvider(){if(!this.sdkProvider)throw new Error("SDK state invalid -- undefined mobile provider");return this.sdkProvider}getUniversalLink(){var e;const n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getUniversalLink();if(!n)throw new Error("No Universal Link available, please call eth_requestAccounts first.");return n}getChannelId(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getChannelConfig())===null||n===void 0?void 0:n.channelId}getRPCHistory(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getRPCMethodTracker()}getVersion(){return $n.version}getDappId(){var e,n,r,i;return typeof window>"u"||window.location===void 0?(i=(n=(e=this.options.dappMetadata)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:(r=this.options.dappMetadata)===null||r===void 0?void 0:r.url)!==null&&i!==void 0?i:"N/A":window.location.hostname}getAnonId(){var e,n;return Z(this,void 0,void 0,function*(){if(this._anonId)return this._anonId;let r;return r=!((e=this.platformManager)===null||e===void 0)&&e.isBrowser()?this.getBrowserAnonId():!((n=this.platformManager)===null||n===void 0)&&n.isReactNative()?yield this.getReactNativeAnonId():hn(),this._anonId=r,r})}getBrowserAnonId(){const e=this.ANON_ID_STORAGE_KEY;try{const n=localStorage.getItem(e);if(n)return n;const r=hn();return localStorage.setItem(e,r),r}catch(n){return console.error("[MetaMaskSDK: getBrowserAnonId()] LocalStorage access error:",n),hn()}}getReactNativeAnonId(){return Z(this,void 0,void 0,function*(){const e=this.ANON_ID_STORAGE_KEY;try{const n=require("@react-native-async-storage/async-storage").default,r=yield n.getItem(e);if(r)return r;const i=hn();return yield n.setItem(e,i),i}catch(n){return console.error("[MetaMaskSDK: getReactNativeAnonId()] Error accessing AsyncStorage:",n),hn()}})}getWalletStatus(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getConnectionStatus()}_getChannelConfig(){var e;return(e=this.remoteConnection)===null||e===void 0?void 0:e.getChannelConfig()}_ping(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.ping()}_keyCheck(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.keyCheck()}_getServiceStatus(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getServiceStatus()}_getRemoteConnection(){return this.remoteConnection}_getDappMetadata(){return this.dappMetadata}_getKeyInfo(){var e;return(e=this.remoteConnection)===null||e===void 0?void 0:e.getKeyInfo()}_resetKeys(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.resetKeys()}_getConnection(){return this.remoteConnection}emit(e,n){return super.emit(e,n)}on(e,n){return super.on(e,n)}}var Gy=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:t}={enabled:!1}){this.enabled=!1,this.enabled=t}persistChannelConfig(t){return Z(this,void 0,void 0,function*(){const e=JSON.stringify(t);W(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,t),localStorage.setItem(ys,e)})}getPersistedChannelConfig(){return Z(this,void 0,void 0,function*(){let t;try{if(W(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),t=localStorage.getItem(ys),W("[StorageManagerWeb: getPersistedChannelConfig()]",t),!t)return;const e=JSON.parse(t);return W("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",e),e}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}})}persistAccounts(t){return Z(this,void 0,void 0,function*(){W(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,t);const e=JSON.stringify(t);localStorage.setItem(ra,e)})}getCachedAccounts(){return Z(this,void 0,void 0,function*(){try{const t=localStorage.getItem(ra);return t?JSON.parse(t):[]}catch(t){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",t),t}})}persistChainId(t){return Z(this,void 0,void 0,function*(){W(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,t),localStorage.setItem(ia,t)})}getCachedChainId(){return Z(this,void 0,void 0,function*(){try{const t=localStorage.getItem(ia);return t??void 0}catch(t){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",t),t}})}terminate(){return Z(this,void 0,void 0,function*(){W(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(ys)})}}});const Yy="hydrated",Zy=!1,Jy=!0;var Xy=Object.defineProperty,qa=new WeakMap,gn=t=>qa.get(t),Va=(t,e)=>qa.set(e.$lazyInstance$=t,e),ou=(t,e)=>e in t,On=(t,e)=>(0,console.error)(t,e),vs=new Map,ji=new Map,xf="slot-fb{display:contents}slot-fb[hidden]{display:none}",ko=typeof window<"u"?window:{},Ot=ko.document||{head:{}},Be={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,r)=>t.addEventListener(e,n,r),rel:(t,e,n,r)=>t.removeEventListener(e,n,r),ce:(t,e)=>new CustomEvent(t,e)},Mf=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),sa=!1,su=[],Rf=[],Qy=(t,e)=>n=>{t.push(n),sa||(sa=!0,4&Be.$flags$?Wa(aa):Be.raf(aa))},au=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(n){On(n)}t.length=0},aa=()=>{au(su),au(Rf),(sa=su.length>0)&&Be.raf(aa)},Wa=t=>(e=>Promise.resolve(e))().then(t),ev=Qy(Rf),cu={},Ga=t=>(t=typeof t)=="object"||t==="function";function Pf(t){var e,n,r;return(r=(n=(e=t.head)==null?void 0:e.querySelector('meta[name="csp-nonce"]'))==null?void 0:n.getAttribute("content"))!=null?r:void 0}((t,e)=>{for(var n in e)Xy(t,n,{get:e[n],enumerable:!0})})({},{err:()=>Of,map:()=>tv,ok:()=>ca,unwrap:()=>nv,unwrapErr:()=>rv});var ca=t=>({isOk:!0,isErr:!1,value:t}),Of=t=>({isOk:!1,isErr:!0,value:t});function tv(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then(r=>ca(r)):ca(n)}if(t.isErr){const n=t.value;return Of(n)}throw"should never get here"}var Ya,nv=t=>{if(t.isOk)return t.value;throw t.value},rv=t=>{if(t.isErr)return t.value;throw t.value},Y=(t,e,...n)=>{let r=null,i=!1,o=!1;const c=[],s=l=>{for(let u=0;u<l.length;u++)r=l[u],Array.isArray(r)?s(r):r!=null&&typeof r!="boolean"&&((i=typeof t!="function"&&!Ga(r))&&(r=String(r)),i&&o?c[c.length-1].$text$+=r:c.push(i?po(null,r):r),o=i)};if(s(n),e){const l=e.className||e.class;l&&(e.class=typeof l!="object"?l:Object.keys(l).filter(u=>l[u]).join(" "))}if(typeof t=="function")return t(e===null?{}:e,c,ov);const a=po(t,null);return a.$attrs$=e,c.length>0&&(a.$children$=c),a},po=(t,e)=>({$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null,$attrs$:null}),iv={},ov={forEach:(t,e)=>t.map(lu).forEach(e),map:(t,e)=>t.map(lu).map(e).map(sv)},lu=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),sv=t=>{if(typeof t.vtag=="function"){const n={...t.vattrs};return t.vkey&&(n.key=t.vkey),t.vname&&(n.name=t.vname),Y(t.vtag,n,...t.vchildren||[])}const e=po(t.vtag,t.vtext);return e.$attrs$=t.vattrs,e.$children$=t.vchildren,e.$key$=t.vkey,e.$name$=t.vname,e},To=t=>gn(t).$hostElement$,bn=(t,e,n)=>{const r=To(t);return{emit:i=>If(r,e,{bubbles:!0,composed:!0,cancelable:!0,detail:i})}},If=(t,e,n)=>{const r=Be.ce(e,n);return t.dispatchEvent(r),r},uu=new WeakMap,av=t=>{const e=t.$cmpMeta$,n=t.$hostElement$,r=e.$flags$;e.$tagName$;const i=((o,c,s)=>{var a;const l=Lf(c),u=ji.get(l);if(o=o.nodeType===11?o:Ot,u)if(typeof u=="string"){o=o.head||o;let d,h=uu.get(o);if(h||uu.set(o,h=new Set),!h.has(l)){{d=Ot.createElement("style"),d.innerHTML=u;const f=(a=Be.$nonce$)!=null?a:Pf(Ot);if(f!=null&&d.setAttribute("nonce",f),!(1&c.$flags$))if(o.nodeName==="HEAD"){const g=o.querySelectorAll("link[rel=preconnect]"),m=g.length>0?g[g.length-1].nextSibling:o.querySelector("style");o.insertBefore(d,m)}else if("host"in o)if(Mf){const g=new CSSStyleSheet;g.replaceSync(u),o.adoptedStyleSheets=[g,...o.adoptedStyleSheets]}else{const g=o.querySelector("style");g?g.innerHTML=u+g.innerHTML:o.prepend(d)}else o.append(d);1&c.$flags$&&o.nodeName!=="HEAD"&&o.insertBefore(d,null)}4&c.$flags$&&(d.innerHTML+=xf),h&&h.add(l)}}else o.adoptedStyleSheets.includes(u)||(o.adoptedStyleSheets=[...o.adoptedStyleSheets,u]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&r&&2&r&&(n["s-sc"]=i,n.classList.add(i+"-h"))},Lf=(t,e)=>"sc-"+t.$tagName$,du=(t,e,n,r,i,o)=>{if(n!==r){let c=ou(t,e),s=e.toLowerCase();if(e==="class"){const a=t.classList,l=hu(n),u=hu(r);a.remove(...l.filter(d=>d&&!u.includes(d))),a.add(...u.filter(d=>d&&!l.includes(d)))}else if(e==="style"){for(const a in n)r&&r[a]!=null||(a.includes("-")?t.style.removeProperty(a):t.style[a]="");for(const a in r)n&&r[a]===n[a]||(a.includes("-")?t.style.setProperty(a,r[a]):t.style[a]=r[a])}else if(c||e[0]!=="o"||e[1]!=="n"){const a=Ga(r);if((c||a&&r!==null)&&!i)try{if(t.tagName.includes("-"))t[e]=r;else{const l=r??"";e==="list"?c=!1:n!=null&&t[e]==l||(typeof t.__lookupSetter__(e)=="function"?t[e]=l:t.setAttribute(e,l))}}catch{}r==null||r===!1?r===!1&&t.getAttribute(e)!==""||t.removeAttribute(e):(!c||4&o||i)&&!a&&(r=r===!0?"":r,t.setAttribute(e,r))}else if(e=e[2]==="-"?e.slice(3):ou(ko,s)?s.slice(2):s[2]+e.slice(3),n||r){const a=e.endsWith(Nf);e=e.replace(lv,""),n&&Be.rel(t,e,n,a),r&&Be.ael(t,e,r,a)}}},cv=/\s/,hu=t=>t?t.split(cv):[],Nf="Capture",lv=new RegExp(Nf+"$"),Df=(t,e,n)=>{const r=e.$elm$.nodeType===11&&e.$elm$.host?e.$elm$.host:e.$elm$,i=t&&t.$attrs$||cu,o=e.$attrs$||cu;for(const c of fu(Object.keys(i)))c in o||du(r,c,i[c],void 0,n,e.$flags$);for(const c of fu(Object.keys(o)))du(r,c,i[c],o[c],n,e.$flags$)};function fu(t){return t.includes("ref")?[...t.filter(e=>e!=="ref"),"ref"]:t}var ft=!1,Za=(t,e,n,r)=>{const i=e.$children$[n];let o,c,s=0;if(i.$text$!==null)o=i.$elm$=Ot.createTextNode(i.$text$);else{if(ft||(ft=i.$tag$==="svg"),o=i.$elm$=Ot.createElementNS(ft?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.$tag$),ft&&i.$tag$==="foreignObject"&&(ft=!1),Df(null,i,ft),o.getRootNode().querySelector("body"),i.$children$)for(s=0;s<i.$children$.length;++s)c=Za(t,i,s),c&&o.appendChild(c);i.$tag$==="svg"?ft=!1:o.tagName==="foreignObject"&&(ft=!0)}return o["s-hn"]=Ya,o},pu=(t,e,n,r,i,o)=>{let c,s=t;for(s.shadowRoot&&s.tagName===Ya&&(s=s.shadowRoot);i<=o;++i)r[i]&&(c=Za(null,n,i),c&&(r[i].$elm$=c,Ui(s,c,e)))},mu=(t,e,n)=>{for(let r=e;r<=n;++r){const i=t[r];if(i){const o=i.$elm$;o&&o.remove()}}},wi=(t,e,n=!1)=>t.$tag$===e.$tag$,wr=(t,e,n=!1)=>{const r=e.$elm$=t.$elm$,i=t.$children$,o=e.$children$,c=e.$tag$,s=e.$text$;s===null?(Df(t,e,ft=c==="svg"||c!=="foreignObject"&&ft),i!==null&&o!==null?((a,l,u,d,h=!1)=>{let f,g=0,m=0,w=l.length-1,p=l[0],S=l[w],_=d.length-1,P=d[0],I=d[_];for(;g<=w&&m<=_;)p==null?p=l[++g]:S==null?S=l[--w]:P==null?P=d[++m]:I==null?I=d[--_]:wi(p,P,h)?(wr(p,P,h),p=l[++g],P=d[++m]):wi(S,I,h)?(wr(S,I,h),S=l[--w],I=d[--_]):wi(p,I,h)?(wr(p,I,h),Ui(a,p.$elm$,S.$elm$.nextSibling),p=l[++g],I=d[--_]):wi(S,P,h)?(wr(S,P,h),Ui(a,S.$elm$,p.$elm$),S=l[--w],P=d[++m]):(f=Za(l&&l[m],u,m),P=d[++m],f&&Ui(p.$elm$.parentNode,f,p.$elm$));g>w?pu(a,d[_+1]==null?null:d[_+1].$elm$,u,d,m,_):m>_&&mu(l,g,w)})(r,i,e,o,n):o!==null?(t.$text$!==null&&(r.textContent=""),pu(r,null,e,o,0,o.length-1)):!n&&Jy&&i!==null&&mu(i,0,i.length-1),ft&&c==="svg"&&(ft=!1)):t.$text$!==s&&(r.data=s)},Ui=(t,e,n)=>t==null?void 0:t.insertBefore(e,n),uv=(t,e,n=!1)=>{const r=t.$hostElement$,i=t.$cmpMeta$,o=t.$vnode$||po(null,null),c=(s=e)&&s.$tag$===iv?e:Y(null,null,e);var s;if(Ya=r.tagName,n&&c.$attrs$)for(const a of Object.keys(c.$attrs$))r.hasAttribute(a)&&!["key","ref","style","class"].includes(a)&&(c.$attrs$[a]=r[a]);c.$tag$=null,c.$flags$|=4,t.$vnode$=c,c.$elm$=o.$elm$=r.shadowRoot||r,r["s-sc"],1&i.$flags$,wr(o,c,n)},Bf=(t,e)=>{e&&!t.$onRenderResolve$&&e["s-p"]&&e["s-p"].push(new Promise(n=>t.$onRenderResolve$=n))},Ja=(t,e)=>(t.$flags$|=16,4&t.$flags$?void(t.$flags$|=512):(Bf(t,t.$ancestorComponent$),ev(()=>dv(t,e)))),dv=(t,e)=>{const n=t.$hostElement$;t.$cmpMeta$.$tagName$;const r=t.$lazyInstance$;if(!r)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return hv(void 0,()=>pv(t,r,e))},hv=(t,e)=>fv(t)?t.then(e).catch(n=>{console.error(n),e()}):e(),fv=t=>t instanceof Promise||t&&t.then&&typeof t.then=="function",pv=async(t,e,n)=>{var r;const i=t.$hostElement$;t.$cmpMeta$.$tagName$;const o=i["s-rc"];n&&av(t),t.$cmpMeta$.$tagName$,mv(t,e,i,n),o&&(o.map(c=>c()),i["s-rc"]=void 0);{const c=(r=i["s-p"])!=null?r:[],s=()=>gv(t);c.length===0?s():(Promise.all(c).then(s),t.$flags$|=4,c.length=0)}},mv=(t,e,n,r)=>{try{e=e.render(),t.$flags$&=-17,t.$flags$|=2,uv(t,e,r)}catch(i){On(i,t.$hostElement$)}return null},gv=t=>{t.$cmpMeta$.$tagName$;const e=t.$hostElement$,n=()=>{},r=t.$lazyInstance$,i=t.$ancestorComponent$;64&t.$flags$?n():(t.$flags$|=64,Kf(e),Xa(r,"componentDidLoad"),t.$onReadyResolve$(e),i||$f()),t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),512&t.$flags$&&Wa(()=>Ja(t,!1)),t.$flags$&=-517},$f=t=>{Kf(Ot.documentElement),Wa(()=>If(ko,"appload",{detail:{namespace:"sdk-install-modal-web"}}))},Xa=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(r){On(r)}},Kf=t=>{var e;return t.classList.add((e=Yy)!=null?e:"hydrated")},yv=(t,e,n,r)=>{const i=gn(t);if(!i)throw new Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const o=i.$hostElement$,c=i.$instanceValues$.get(e),s=i.$flags$,a=i.$lazyInstance$;var l,u;l=n,u=r.$members$[e][0],n=l==null||Ga(l)?l:4&u?l!=="false"&&(l===""||!!l):1&u?String(l):l;const d=Number.isNaN(c)&&Number.isNaN(n);if((!(8&s)||c===void 0)&&n!==c&&!d&&(i.$instanceValues$.set(e,n),a)){if(r.$watchers$&&128&s){const h=r.$watchers$[e];h&&h.map(f=>{try{a[f](n,c,e)}catch(g){On(g,o)}})}(18&s)==2&&Ja(i,!1)}},jf=(t,e,n)=>{var r,i;const o=t.prototype;if(e.$members$||e.$watchers$||t.watchers){t.watchers&&!e.$watchers$&&(e.$watchers$=t.watchers);const c=Object.entries((r=e.$members$)!=null?r:{});if(c.map(([s,[a]])=>{(31&a||2&n&&32&a)&&Object.defineProperty(o,s,{get(){return l=s,gn(this).$instanceValues$.get(l);var l},set(l){yv(this,s,l,e)},configurable:!0,enumerable:!0})}),1&n){const s=new Map;o.attributeChangedCallback=function(a,l,u){Be.jmp(()=>{var d;const h=s.get(a);if(this.hasOwnProperty(h))u=this[h],delete this[h];else{if(o.hasOwnProperty(h)&&typeof this[h]=="number"&&this[h]==u)return;if(h==null){const f=gn(this),g=f==null?void 0:f.$flags$;if(g&&!(8&g)&&128&g&&u!==l){const m=f.$lazyInstance$,w=(d=e.$watchers$)==null?void 0:d[a];w==null||w.forEach(p=>{m[p]!=null&&m[p].call(m,u,l,a)})}return}}this[h]=(u!==null||typeof this[h]!="boolean")&&u})},t.observedAttributes=Array.from(new Set([...Object.keys((i=e.$watchers$)!=null?i:{}),...c.filter(([a,l])=>15&l[0]).map(([a,l])=>{const u=l[1]||a;return s.set(u,a),u})]))}}return t},vv=async(t,e,n,r)=>{let i;if(!(32&e.$flags$)){if(e.$flags$|=32,n.$lazyBundleId$){const s=((a,l,u)=>{const d=a.$tagName$.replace(/-/g,"_"),h=a.$lazyBundleId$;if(!h)return;const f=vs.get(h);if(f)return f[d];{const g=m=>(vs.set(h,m),m[d]);if(h==="mm-install-modal_3")return Promise.resolve().then(function(){return Iv}).then(g,On)}return import(`./${h}.entry.js`).then(g=>(vs.set(h,g),g[d]),On)})(n);if(s&&"then"in s?i=await s:i=s,!i)throw new Error(`Constructor for "${n.$tagName$}#${e.$modeName$}" was not found`);i.isProxied||(n.$watchers$=i.watchers,jf(i,n,2),i.isProxied=!0),n.$tagName$,e.$flags$|=8;try{new i(e)}catch(a){On(a)}e.$flags$&=-9,e.$flags$|=128,la(e.$lazyInstance$)}else{i=t.constructor;const s=t.localName;customElements.whenDefined(s).then(()=>e.$flags$|=128)}if(i&&i.style){let s;typeof i.style=="string"&&(s=i.style);const a=Lf(n);ji.has(a)||(n.$tagName$,((l,u,d)=>{let h=ji.get(l);Mf&&d?(h=h||new CSSStyleSheet,typeof h=="string"?h=u:h.replaceSync(u)):h=u,ji.set(l,h)})(a,s,!!(1&n.$flags$)))}}const o=e.$ancestorComponent$,c=()=>Ja(e,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()},la=t=>{Xa(t,"connectedCallback")},gu=t=>{Xa(t,"disconnectedCallback")},bv=(t,e={})=>{var n;const r=[],i=e.exclude||[],o=ko.customElements,c=Ot.head,s=c.querySelector("meta[charset]"),a=Ot.createElement("style"),l=[];let u,d=!0;Object.assign(Be,e),Be.$resourcesUrl$=new URL(e.resourcesUrl||"./",Ot.baseURI).href;let h=!1;if(t.map(f=>{f[1].map(g=>{var m;const w={$flags$:g[0],$tagName$:g[1],$members$:g[2],$listeners$:g[3]};4&w.$flags$&&(h=!0),w.$members$=g[2],w.$watchers$=(m=g[4])!=null?m:{};const p=w.$tagName$,S=class extends HTMLElement{constructor(_){if(super(_),this.hasRegisteredEventListeners=!1,((P,I)=>{const K={$flags$:0,$hostElement$:P,$cmpMeta$:I,$instanceValues$:new Map};K.$onReadyPromise$=new Promise(q=>K.$onReadyResolve$=q),P["s-p"]=[],P["s-rc"]=[],qa.set(P,K)})(_=this,w),1&w.$flags$)if(_.shadowRoot){if(_.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${w.$tagName$}! Mode is set to ${_.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else _.attachShadow({mode:"open"})}connectedCallback(){gn(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),u&&(clearTimeout(u),u=null),d?l.push(this):Be.jmp(()=>(_=>{if(!(1&Be.$flags$)){const P=gn(_),I=P.$cmpMeta$;if(I.$tagName$,1&P.$flags$)P!=null&&P.$lazyInstance$?la(P.$lazyInstance$):P!=null&&P.$onReadyPromise$&&P.$onReadyPromise$.then(()=>la(P.$lazyInstance$));else{P.$flags$|=1;{let K=_;for(;K=K.parentNode||K.host;)if(K["s-p"]){Bf(P,P.$ancestorComponent$=K);break}}I.$members$&&Object.entries(I.$members$).map(([K,[q]])=>{if(31&q&&_.hasOwnProperty(K)){const F=_[K];delete _[K],_[K]=F}}),vv(_,P,I)}}})(this))}disconnectedCallback(){Be.jmp(()=>(async _=>{if(!(1&Be.$flags$)){const P=gn(_);P!=null&&P.$lazyInstance$?gu(P.$lazyInstance$):P!=null&&P.$onReadyPromise$&&P.$onReadyPromise$.then(()=>gu(P.$lazyInstance$))}})(this))}componentOnReady(){return gn(this).$onReadyPromise$}};w.$lazyBundleId$=f[0],i.includes(p)||o.get(p)||(r.push(p),o.define(p,jf(S,w,1)))})}),r.length>0&&(h&&(a.textContent+=xf),a.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",a.innerHTML.length)){a.setAttribute("data-styles","");const f=(n=Be.$nonce$)!=null?n:Pf(Ot);f!=null&&a.setAttribute("nonce",f),c.insertBefore(a,s?s.nextSibling:c.firstChild)}d=!1,l.length?l.map(f=>f.connectedCallback()):Be.jmp(()=>u=setTimeout($f,30))};(function(){if(typeof window<"u"&&window.Reflect!==void 0&&window.customElements!==void 0){var t=HTMLElement;window.HTMLElement=function(){return Reflect.construct(t,[],this.constructor)},HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)}})();var wv=Object.freeze({__proto__:null,defineCustomElements:async(t,e)=>{if(typeof window<"u")return await void 0,bv([["mm-install-modal_3",[[1,"mm-install-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}],[1,"mm-pending-modal",{displayOTP:[4,"display-o-t-p"],sdkVersion:[1,"sdk-version"],otpCode:[1,"otp-code"],translationsLoaded:[32]}],[1,"mm-select-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}]]]],e)},setNonce:t=>Be.$nonce$=t});const Ev={fontFamily:"Roboto, sans-serif"},Qa=({className:t},e)=>Y("div",{style:Ev,class:t},e),bs=({Icon:t,text:e})=>Y("div",{class:"flexContainer",style:{padding:"6",flexDirection:"row"}},Y("div",{class:"flexItem1"},Y(t,null)),Y("div",{class:"flexItem11"},Y("span",{style:{lineHeight:"2",color:"black"}},e))),_v=()=>Y("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M20.0002 7.9702V10.0302C20.0002 10.5802 19.5602 11.0302 19.0002 11.0502H17.0402C15.9602 11.0502 14.9702 10.2602 14.8802 9.1802C14.8202 8.5502 15.0602 7.9602 15.4802 7.5502C15.8502 7.1702 16.3602 6.9502 16.9202 6.9502H19.0002C19.5602 6.9702 20.0002 7.4202 20.0002 7.9702Z",fill:"#037DD6"}),Y("path",{d:"M18.47 12.55H17.04C15.14 12.55 13.54 11.12 13.38 9.3C13.29 8.26 13.67 7.22 14.43 6.48C15.07 5.82 15.96 5.45 16.92 5.45H18.47C18.76 5.45 19 5.21 18.97 4.92C18.75 2.49 17.14 0.83 14.75 0.55C14.51 0.51 14.26 0.5 14 0.5H5C4.72 0.5 4.45 0.52 4.19 0.56C1.64 0.88 0 2.78 0 5.5V12.5C0 15.26 2.24 17.5 5 17.5H14C16.8 17.5 18.73 15.75 18.97 13.08C19 12.79 18.76 12.55 18.47 12.55ZM11 6.75H5C4.59 6.75 4.25 6.41 4.25 6C4.25 5.59 4.59 5.25 5 5.25H11C11.41 5.25 11.75 5.59 11.75 6C11.75 6.41 11.41 6.75 11 6.75Z",fill:"#037DD6"})),Sv=()=>Y("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M14.44 0.0999756C12.63 0.0999756 11.01 0.979976 10 2.32998C8.99 0.979976 7.37 0.0999756 5.56 0.0999756C2.49 0.0999756 0 2.59998 0 5.68998C0 6.87998 0.19 7.97998 0.52 8.99998C2.1 14 6.97 16.99 9.38 17.81C9.72 17.93 10.28 17.93 10.62 17.81C13.03 16.99 17.9 14 19.48 8.99998C19.81 7.97998 20 6.87998 20 5.68998C20 2.59998 17.51 0.0999756 14.44 0.0999756Z",fill:"#037DD6"})),Cv=()=>Y("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M16.28 7.53V6.28C16.28 3.58 15.63 0 10 0C4.37 0 3.72 3.58 3.72 6.28V7.53C0.92 7.88 0 9.3 0 12.79V14.65C0 18.75 1.25 20 5.35 20H14.65C18.75 20 20 18.75 20 14.65V12.79C20 9.3 19.08 7.88 16.28 7.53ZM10 16.74C8.33 16.74 6.98 15.38 6.98 13.72C6.98 12.05 8.34 10.7 10 10.7C11.66 10.7 13.02 12.06 13.02 13.72C13.02 15.39 11.67 16.74 10 16.74ZM5.35 7.44C5.27 7.44 5.2 7.44 5.12 7.44V6.28C5.12 3.35 5.95 1.4 10 1.4C14.05 1.4 14.88 3.35 14.88 6.28V7.45C14.8 7.45 14.73 7.45 14.65 7.45H5.35V7.44Z",fill:"#037DD6"})),Av=()=>Y("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M16.4405 8.8999C20.0405 9.2099 21.5105 11.0599 21.5105 15.1099V15.2399C21.5105 19.7099 19.7205 21.4999 15.2505 21.4999H8.74047C4.27047 21.4999 2.48047 19.7099 2.48047 15.2399V15.1099C2.48047 11.0899 3.93047 9.2399 7.47047 8.9099",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),Y("path",{d:"M12 2V14.88",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),Y("path",{d:"M15.3504 12.6499L12.0004 15.9999L8.65039 12.6499",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}));function ec({version:t}){return Y("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",t?`v${t}`:"unknown")}const tc=()=>Y("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("rect",{width:"16",height:"16",fill:"white"}),Y("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.40554 2.40554C2.94627 1.86482 3.82296 1.86482 4.36369 2.40554L8 6.04186L11.6363 2.40554C12.177 1.86482 13.0537 1.86482 13.5945 2.40554C14.1352 2.94627 14.1352 3.82296 13.5945 4.36369L9.95814 8L13.5945 11.6363C14.1352 12.177 14.1352 13.0537 13.5945 13.5945C13.0537 14.1352 12.177 14.1352 11.6363 13.5945L8 9.95814L4.36369 13.5945C3.82296 14.1352 2.94627 14.1352 2.40554 13.5945C1.86482 13.0537 1.86482 12.177 2.40554 11.6363L6.04186 8L2.40554 4.36369C1.86482 3.82296 1.86482 2.94627 2.40554 2.40554Z",fill:"#BBC0C5"})),nc=()=>Y("svg",{width:"120",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 127 63"},Y("path",{fill:"currentColor",d:"M71.554 48.607v13.81h-7.072v-9.568l-8.059.945c-1.77.205-2.548.79-2.548 1.864 0 1.575 1.478 2.239 4.648 2.239 1.932 0 4.073-.29 5.963-.79l-3.66 5.225c-1.479.332-2.92.496-4.44.496-6.414 0-10.074-2.57-10.074-7.132 0-4.023 2.877-6.136 9.416-6.884l8.638-1.012c-.467-2.532-2.362-3.633-6.13-3.633-3.537 0-7.443.912-10.937 2.613l1.111-6.18c3.248-1.369 6.95-2.074 10.69-2.074 8.226 0 12.461 3.444 12.461 10.075l-.008.005ZM7.938 31.315.208 62.416h7.73l3.836-15.628 6.65 8.039h8.06l6.65-8.039 3.836 15.628h7.73l-7.73-31.105-14.518 17.388L7.934 31.311l.004.004ZM36.97.21 22.452 17.598 7.938.21.208 31.315h7.73l3.836-15.628 6.65 8.039h8.06l6.65-8.039 3.836 15.628h7.73L36.97.21Zm53.17 48.107-6.25-.912c-1.562-.247-2.178-.747-2.178-1.617 0-1.41 1.52-2.032 4.647-2.032 3.62 0 6.868.747 10.283 2.364l-.862-6.094c-2.757-.995-5.922-1.491-9.212-1.491-7.688 0-11.886 2.696-11.886 7.547 0 3.776 2.303 5.889 7.196 6.636l6.335.954c1.603.248 2.261.87 2.261 1.865 0 1.41-1.478 2.074-4.481 2.074-3.948 0-8.225-.953-11.72-2.654l.7 6.094c3.003 1.122 6.91 1.785 10.57 1.785 7.896 0 12.007-2.78 12.007-7.715 0-3.94-2.303-6.057-7.4-6.8l-.01-.004ZM100.3 34.09v28.325h7.071V34.091H100.3Zm15.334 15.595 9.833-10.744h-8.8l-9.296 11.114 9.912 12.356h8.925l-10.574-12.73v.004Zm-16.321-25.09c0 4.56 3.66 7.13 10.074 7.13 1.52 0 2.961-.167 4.44-.495l3.66-5.225c-1.89.496-4.031.79-5.963.79-3.166 0-4.648-.664-4.648-2.239 0-1.079.783-1.659 2.549-1.864l8.058-.945v9.567h7.072v-13.81c0-6.635-4.236-10.075-12.461-10.075-3.744 0-7.442.705-10.691 2.075l-1.112 6.178c3.495-1.701 7.401-2.613 10.937-2.613 3.769 0 5.664 1.1 6.13 3.633l-8.637 1.013c-6.539.747-9.417 2.86-9.417 6.883l.009-.004Zm-19.779-1.492c0 5.725 3.29 8.627 9.787 8.627 2.59 0 4.732-.416 6.785-1.37l.903-6.261c-1.974 1.2-3.99 1.822-6.005 1.822-3.044 0-4.402-1.243-4.402-4.023v-8.295h10.732V7.84H86.601V2.948l-13.448 7.174v3.482h6.372V23.1l.008.004Zm-6.95-2.612v1.411H53.47c.862 2.873 3.423 4.187 7.97 4.187 3.62 0 6.993-.747 9.992-2.196l-.862 6.056c-2.757 1.16-6.251 1.785-9.829 1.785-9.5 0-14.68-4.23-14.68-12.066 0-7.838 5.264-12.235 13.406-12.235s13.119 4.771 13.119 13.062l-.005-.004ZM53.378 17.09h12.086c-.637-2.751-2.732-4.188-6.08-4.188-3.349 0-5.335 1.399-6.006 4.188Z"}));function Cn(t,e){return t.toString(2).padStart(e,"0")}function yu(t,e){const n=t%e;return n>=0?n:e+n}function it(t,e){return new Array(t).fill(e)}function vu(...t){let e=0;for(const r of t)e=Math.max(e,r.length);const n=[];for(let r=0;r<e;r++)for(const i of t)r>=i.length||n.push(i[r]);return new Uint8Array(n)}function bu(t,e,n){if(n<0||n+e.length>t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[n+r])return!1;return!0}function wu(t){return{has:e=>t.includes(e),decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=t.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${t}`);return r})},encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(n=>{if(function(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}(n),n<0||n>=t.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${t.length})`);return t[n]})}}}class nt{static size(e,n){if(typeof e=="number"&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw new Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw new Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return n!==void 0&&(e={width:Math.min(e.width,n.width),height:Math.min(e.height,n.height)}),e}static fromString(e){const n=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split(`
35
+ `),r=n.length,i=new Array(r);let o;for(const c of n){const s=c.split("").map(a=>{if(a==="X")return!0;if(a===" ")return!1;if(a!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${a}`)});if(o&&s.length!==o)throw new Error(`Bitmap.fromString different row sizes: width=${o} cur=${s.length}`);o=s.length,i.push(s)}return o||(o=0),new nt({height:r,width:o},i)}constructor(e,n){const{height:r,width:i}=nt.size(e);this.data=n||Array.from({length:r},()=>it(i,void 0)),this.height=r,this.width=i}point(e){return this.data[e.y][e.x]}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};const{x:n,y:r}=this.xy(e);return{height:this.height-r,width:this.width-n}}xy(e){if(typeof e=="number"&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw new Error(`Bitmap: wrong x=${e.x}`);if(!Number.isSafeInteger(e.y))throw new Error(`Bitmap: wrong y=${e.y}`);return e.x=yu(e.x,this.width),e.y=yu(e.y,this.height),e}rect(e,n,r){const{x:i,y:o}=this.xy(e),{height:c,width:s}=nt.size(n,this.size({x:i,y:o}));for(let a=0;a<c;a++)for(let l=0;l<s;l++)this.data[o+a][i+l]=typeof r=="function"?r({x:l,y:a},this.data[o+a][i+l]):r;return this}rectRead(e,n,r){return this.rect(e,n,(i,o)=>(r(i,o),o))}hLine(e,n,r){return this.rect(e,{width:n,height:1},r)}vLine(e,n,r){return this.rect(e,{width:1,height:n},r)}border(e=2,n){const r=this.height+2*e,i=this.width+2*e,o=it(e,n),c=Array.from({length:e},()=>it(i,n));return new nt({height:r,width:i},[...c,...this.data.map(s=>[...o,...s,...o]),...c])}embed(e,n){return this.rect(e,n.size(),({x:r,y:i})=>n.data[i][r])}rectSlice(e,n=this.size()){const r=new nt(nt.size(n,this.size(this.xy(e))));return this.rect(e,n,({x:i,y:o},c)=>r.data[o][i]=c),r}inverse(){const{height:e,width:n}=this;return new nt({height:n,width:e}).rect({x:0,y:0},1/0,({x:r,y:i})=>this.data[r][i])}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw new Error(`Wrong scale factor: ${e}`);const{height:n,width:r}=this;return new nt({height:e*n,width:e*r}).rect({x:0,y:0},1/0,({x:i,y:o})=>this.data[Math.floor(o/e)][Math.floor(i/e)])}clone(){return new nt(this.size()).rect({x:0,y:0},this.size(),({x:e,y:n})=>this.data[n][e])}assertDrawn(){this.rectRead(0,1/0,(e,n)=>{if(typeof n!="boolean")throw new Error("Invalid color type="+typeof n)})}toString(){return this.data.map(e=>e.map(n=>n===void 0?"?":n?"X":" ").join("")).join(`
36
+ `)}toASCII(){const{height:e,width:n,data:r}=this;let i="";for(let o=0;o<e;o+=2){for(let c=0;c<n;c++){const s=r[o][c],a=o+1>=e||r[o+1][c];s||a?!s&&a?i+="▀":s&&!a?i+="▄":s&&a&&(i+=" "):i+="█"}i+=`
37
+ `}return i}toTerm(){const e="\x1B[0m",n=`\x1B[1;47m ${e}`,r=`\x1B[40m ${e}`;return this.data.map(i=>i.map(o=>o?r:n).join("")).join(`
38
+ `)}toSVG(){let e=`<svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 ${this.width} ${this.height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;return this.rectRead(0,1/0,({x:n,y:r},i)=>{i&&(e+=`<rect x="${n}" y="${r}" width="1" height="1" />`)}),e+="</svg>",e}toGIF(){const e=s=>[255&s,s>>>8&255],n=[...e(this.width),...e(this.height)],r=[];this.rectRead(0,1/0,(s,a)=>r.push(+(a===!0)));const i=126,o=[71,73,70,56,55,97,...n,246,0,0,255,255,255,...it(381,0),44,0,0,0,0,...n,0,7],c=Math.floor(r.length/i);for(let s=0;s<c;s++)o.push(127,128,...r.slice(i*s,i*(s+1)).map(a=>+a));return o.push(r.length%i+1,128,...r.slice(c*i).map(s=>+s)),o.push(1,129,0,59),new Uint8Array(o)}toImage(e=!1){const{height:n,width:r}=this.size(),i=new Uint8Array(n*r*(e?3:4));let o=0;for(let c=0;c<n;c++)for(let s=0;s<r;s++){const a=this.data[c][s]?0:255;i[o++]=a,i[o++]=a,i[o++]=a,e||(i[o++]=255)}return{height:n,width:r,data:i}}}const Eu=["low","medium","quartile","high"],_u=["numeric","alphanumeric","byte","kanji","eci"],kv=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],Tv={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},xv={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},He={size:{encode:t=>21+4*(t-1),decode:t=>(t-17)/4},sizeType:t=>Math.floor((t+7)/17),alignmentPatterns(t){if(t===1)return[];const e=He.size.encode(t)-6-1,n=e-6,r=Math.ceil(n/28);let i=Math.floor(n/r);i%2?i+=1:n%r*2>=r&&(i+=2);const o=[6];for(let c=1;c<r;c++)o.push(e-(r-c)*i);return o.push(e),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(t,e){const n=He.ECCode[t]<<3|e;let r=n;for(let i=0;i<10;i++)r=r<<1^1335*(r>>9);return(n<<10|r)^He.formatMask},versionBits(t){let e=t;for(let n=0;n<12;n++)e=e<<1^7973*(e>>11);return t<<12|e},alphabet:{numeric:wu("0123456789"),alphanumerc:wu("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(t,e)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]})[e][He.sizeType(t)],modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(t,e){const n=kv[t-1],r=Tv[e][t-1],i=xv[e][t-1],o=Math.floor(n/i)-r,c=i-n%i;return{words:r,numBlocks:i,shortBlocks:c,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-c}}},ua=[(t,e)=>(t+e)%2==0,(t,e)=>e%2==0,(t,e)=>t%3==0,(t,e)=>(t+e)%3==0,(t,e)=>(Math.floor(e/2)+Math.floor(t/3))%2==0,(t,e)=>t*e%2+t*e%3==0,(t,e)=>(t*e%2+t*e%3)%2==0,(t,e)=>((t+e)%2+t*e%3)%2==0],ie={tables:(t=>{const e=it(256,0),n=it(256,0);for(let r=0,i=1;r<256;r++)e[r]=i,n[i]=r,i<<=1,256&i&&(i^=285);return{exp:e,log:n}})(),exp:t=>ie.tables.exp[t],log(t){if(t===0)throw new Error(`GF.log: wrong arg=${t}`);return ie.tables.log[t]%255},mul:(t,e)=>t===0||e===0?0:ie.tables.exp[(ie.tables.log[t]+ie.tables.log[e])%255],add:(t,e)=>t^e,pow:(t,e)=>ie.tables.exp[ie.tables.log[t]*e%255],inv(t){if(t===0)throw new Error(`GF.inverse: wrong arg=${t}`);return ie.tables.exp[255-ie.tables.log[t]]},polynomial(t){if(t.length==0)throw new Error("GF.polymomial: wrong length");if(t[0]!==0)return t;let e=0;for(;e<t.length-1&&t[e]==0;e++);return t.slice(e)},monomial(t,e){if(t<0)throw new Error(`GF.monomial: wrong degree=${t}`);if(e==0)return[0];let n=it(t+1,0);return n[0]=e,ie.polynomial(n)},degree:t=>t.length-1,coefficient:(t,e)=>t[ie.degree(t)-e],mulPoly(t,e){if(t[0]===0||e[0]===0)return[0];const n=it(t.length+e.length-1,0);for(let r=0;r<t.length;r++)for(let i=0;i<e.length;i++)n[r+i]=ie.add(n[r+i],ie.mul(t[r],e[i]));return ie.polynomial(n)},mulPolyScalar(t,e){if(e==0)return[0];if(e==1)return t;const n=it(t.length,0);for(let r=0;r<t.length;r++)n[r]=ie.mul(t[r],e);return ie.polynomial(n)},mulPolyMonomial(t,e,n){if(e<0)throw new Error("GF.mulPolyMonomial: wrong degree");if(n==0)return[0];const r=it(t.length+e,0);for(let i=0;i<t.length;i++)r[i]=ie.mul(t[i],n);return ie.polynomial(r)},addPoly(t,e){if(t[0]===0)return e;if(e[0]===0)return t;let n=t,r=e;n.length>r.length&&([n,r]=[r,n]);let i=it(r.length,0),o=r.length-n.length,c=r.slice(0,o);for(let s=0;s<c.length;s++)i[s]=c[s];for(let s=o;s<r.length;s++)i[s]=ie.add(n[s-o],r[s]);return ie.polynomial(i)},remainderPoly(t,e){const n=Array.from(t);for(let r=0;r<t.length-e.length+1;r++){const i=n[r];if(i!==0)for(let o=1;o<e.length;o++)e[o]!==0&&(n[r+o]=ie.add(n[r+o],ie.mul(e[o],i)))}return n.slice(t.length-e.length+1,n.length)},divisorPoly(t){let e=[1];for(let n=0;n<t;n++)e=ie.mulPoly(e,[1,ie.pow(2,n)]);return e},evalPoly(t,e){if(e==0)return ie.coefficient(t,0);let n=t[0];for(let r=1;r<t.length;r++)n=ie.add(ie.mul(e,n),t[r]);return n},euclidian(t,e,n){ie.degree(t)<ie.degree(e)&&([t,e]=[e,t]);let r=t,i=e,o=[0],c=[1];for(;2*ie.degree(i)>=n;){let l=r,u=o;if(r=i,o=c,r[0]===0)throw new Error("rLast[0] === 0");i=l;let d=[0];const h=ie.inv(r[0]);for(;ie.degree(i)>=ie.degree(r)&&i[0]!==0;){const f=ie.degree(i)-ie.degree(r),g=ie.mul(i[0],h);d=ie.addPoly(d,ie.monomial(f,g)),i=ie.addPoly(i,ie.mulPolyMonomial(r,f,g))}if(d=ie.mulPoly(d,o),c=ie.addPoly(d,u),ie.degree(i)>=ie.degree(r))throw new Error(`Division failed r: ${i}, rLast: ${r}`)}const s=ie.coefficient(c,0);if(s==0)throw new Error("sigmaTilde(0) was zero");const a=ie.inv(s);return[ie.mulPolyScalar(c,a),ie.mulPolyScalar(i,a)]}};function Mv(t,e){const{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:c}=He.capacity(t,e),s=(a=n,{encode(l){const u=ie.divisorPoly(a),d=Array.from(l);return d.push(...u.slice(0,-1).fill(0)),Uint8Array.from(ie.remainderPoly(d,u))},decode(l){const u=l.slice(),d=ie.polynomial(Array.from(l));let h=it(a,0),f=!1;for(let _=0;_<a;_++){const P=ie.evalPoly(d,ie.exp(_));h[h.length-1-_]=P,P!==0&&(f=!0)}if(!f)return u;h=ie.polynomial(h);const g=ie.monomial(a,1),[m,w]=ie.euclidian(g,h,a),p=it(ie.degree(m),0);let S=0;for(let _=1;_<256&&S<p.length;_++)ie.evalPoly(m,_)===0&&(p[S++]=ie.inv(_));if(S!==p.length)throw new Error("RS.decode: wrong errors number");for(let _=0;_<p.length;_++){const P=u.length-1-ie.log(p[_]);if(P<0)throw new Error("RS.decode: wrong error location");const I=ie.inv(p[_]);let K=1;for(let q=0;q<p.length;q++)_!==q&&(K=ie.mul(K,ie.add(1,ie.mul(p[q],I))));u[P]=ie.add(u[P],ie.mul(ie.evalPoly(w,I),ie.inv(K)))}return u}});var a;return{encode(l){const u=[],d=[];for(let m=0;m<i;m++){const w=o+(m<r?0:1);u.push(l.subarray(0,w)),d.push(s.encode(l.subarray(0,w))),l=l.subarray(w)}const h=vu(...u),f=vu(...d),g=new Uint8Array(h.length+f.length);return g.set(h),g.set(f,h.length),g},decode(l){if(l.length!==c)throw new Error(`interleave.decode: len(data)=${l.length}, total=${c}`);const u=[];for(let f=0;f<i;f++){const g=f<r;u.push(new Uint8Array(n+o+(g?0:1)))}let d=0;for(let f=0;f<o;f++)for(let g=0;g<i;g++)u[g][f]=l[d++];for(let f=r;f<i;f++)u[f][o]=l[d++];for(let f=o;f<o+n;f++)for(let g=0;g<i;g++){const m=g<r;u[g][f+(m?0:1)]=l[d++]}const h=[];for(const f of u)h.push(...Array.from(s.decode(f)).slice(0,-n));return Uint8Array.from(h)}}}function Su(t,e,n,r){let i="",o=n.length;if(r==="numeric"){const d=He.alphabet.numeric.decode(n.split("")),h=d.length;for(let f=0;f<h-2;f+=3)i+=Cn(100*d[f]+10*d[f+1]+d[f+2],10);h%3==1?i+=Cn(d[h-1],4):h%3==2&&(i+=Cn(10*d[h-2]+d[h-1],7))}else if(r==="alphanumeric"){const d=He.alphabet.alphanumerc.decode(n.split("")),h=d.length;for(let f=0;f<h-1;f+=2)i+=Cn(45*d[f]+d[f+1],11);h%2==1&&(i+=Cn(d[h-1],6))}else{if(r!=="byte")throw new Error("encode: unsupported type");{const d=function(h){if(typeof h!="string")throw new Error("utf8ToBytes expected string, got "+typeof h);return new Uint8Array(new TextEncoder().encode(h))}(n);o=d.length,i=Array.from(d).map(h=>Cn(h,8)).join("")}}const{capacity:c}=He.capacity(t,e),s=Cn(o,He.lengthBits(t,r));let a=He.modeBits[r]+s+i;if(a.length>c)throw new Error("Capacity overflow");a+="0".repeat(Math.min(4,Math.max(0,c-a.length))),a.length%8&&(a+="0".repeat(8-a.length%8));const l="1110110000010001";for(let d=0;a.length!==c;d++)a+=l[d%16];const u=Uint8Array.from(a.match(/(.{8})/g).map(d=>+`0b${d}`));return Mv(t,e).encode(u)}function Cu(t,e,n,r,i=!1){const o=function(a,l,u,d=!1){const h=He.size.encode(a);let f=new nt(h+2);const g=new nt(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);f=f.embed(0,g).embed({x:-g.width,y:0},g).embed({x:0,y:-g.height},g),f=f.rectSlice(1,h);const m=new nt(1).rect(0,1,!0).border(1,!1).border(1,!0),w=He.alignmentPatterns(a);for(const p of w)for(const S of w)f.data[p][S]===void 0&&f.embed({x:S-2,y:p-2},m);f=f.hLine({x:0,y:6},1/0,({x:p},S)=>S===void 0?p%2==0:S).vLine({x:6,y:0},1/0,({y:p},S)=>S===void 0?p%2==0:S);{const p=He.formatBits(l,u),S=_=>!d&&(p>>_&1)==1;for(let _=0;_<6;_++)f.data[_][8]=S(_);for(let _=6;_<8;_++)f.data[_+1][8]=S(_);for(let _=8;_<15;_++)f.data[h-15+_][8]=S(_);for(let _=0;_<8;_++)f.data[8][h-_-1]=S(_);for(let _=8;_<9;_++)f.data[8][15-_-1+1]=S(_);for(let _=9;_<15;_++)f.data[8][15-_-1]=S(_);f.data[h-8][8]=!d}if(a>=7){const p=He.versionBits(a);for(let S=0;S<18;S+=1){const _=!d&&(p>>S&1)==1,P=Math.floor(S/3),I=S%3+h-8-3;f.data[P][I]=_,f.data[I][P]=_}}return f}(t,e,r,i);let c=0;const s=8*n.length;if(function(a,l,u){const d=a.height,h=ua[l];let f=-1,g=d-1;for(let m=d-1;m>0;m-=2){for(m==6&&(m=5);;g+=f){for(let w=0;w<2;w+=1){const p=m-w;a.data[g][p]===void 0&&u(p,g,h(p,g))}if(g+f<0||g+f>=d)break}f=-f}}(o,r,(a,l,u)=>{let d=!1;c<s&&(d=(n[c>>>3]>>(7-c&7)&1)!=0,c++),o.data[l][a]=d!==u}),c!==s)throw new Error("QR: bytes left after draw");return o}function Rv(t){const e=t.inverse(),n=f=>{let g=0;for(let m,w=0,p=1;w<f.length;w++)m===f[w]&&(p++,w!==f.length-1)||(p>=5&&(g+=p-5+3),m=f[w],p=1);return g};let r=0;t.data.forEach(f=>r+=n(f)),e.data.forEach(f=>r+=n(f));let i=0,o=t.data;const c=t.width-1,s=t.height-1;for(let f=0;f<c;f++)for(let g=0;g<s;g++){const m=f+1,w=g+1;o[f][g]===o[m][g]&&o[m][g]===o[f][w]&&o[m][g]===o[m][w]&&(i+=3)}const a=f=>{const g=[!0,!1,!0,!0,!0,!1,!0],m=[!1,!1,!1,!1],w=[...g,...m],p=[...m,...g];let S=0;for(let _=0;_<f.length;_++)bu(f,w,_)&&(S+=40),bu(f,p,_)&&(S+=40);return S};let l=0;for(const f of t.data)l+=a(f);for(const f of e.data)l+=a(f);let u=0;t.rectRead(0,1/0,(f,g)=>u+=g?1:0);const d=u/(t.height*t.width)*100,h=10*Math.floor(Math.abs(d-50)/5);return r+i+l+h}function Uf(t,e="raw",n={}){const r=n.ecc!==void 0?n.ecc:"medium";(function(u){if(!Eu.includes(u))throw new Error(`Invalid error correction mode=${u}. Expected: ${Eu}`)})(r);const i=n.encoding!==void 0?n.encoding:function(u){let d="numeric";for(let h of u)if(!He.alphabet.numeric.has(h)&&(d="alphanumeric",!He.alphabet.alphanumerc.has(h)))return"byte";return d}(t);(function(u){if(!_u.includes(u))throw new Error(`Encoding: invalid mode=${u}. Expected: ${_u}`);if(u==="kanji"||u==="eci")throw new Error(`Encoding: ${u} is not supported (yet?).`)})(i),n.mask!==void 0&&function(u){if(![0,1,2,3,4,5,6,7].includes(u)||!ua[u])throw new Error(`Invalid mask=${u}. Expected number [0..7]`)}(n.mask);let o,c=n.version,s=new Error("Unknown error");if(c!==void 0)(function(u){if(!Number.isSafeInteger(u)||u<1||u>40)throw new Error(`Invalid version=${u}. Expected number [1..40]`)})(c),o=Su(c,r,t,i);else for(let u=1;u<=40;u++)try{o=Su(u,r,t,i),c=u;break}catch(d){s=d}if(!c||!o)throw s;let a=function(u,d,h,f){if(f===void 0){const g=function(){let m,w=1/0;return{add(p,S){p>=w||(m=S,w=p)},get:()=>m,score:()=>w}}();for(let m=0;m<ua.length;m++)g.add(Rv(Cu(u,d,h,m,!0)),m);f=g.get()}if(f===void 0)throw new Error("Cannot find mask");return Cu(u,d,h,f)}(c,r,o,n.mask);a.assertDrawn();const l=n.border===void 0?2:n.border;if(!Number.isSafeInteger(l))throw new Error("Wrong border type="+typeof l);if(a=a.border(l,!1),n.scale!==void 0&&(a=a.scale(n.scale)),e==="raw")return a.data;if(e==="ascii")return a.toASCII();if(e==="svg")return a.toSVG();if(e==="gif")return a.toGIF();if(e==="term")return a.toTerm();throw new Error(`Unknown output: ${e}`)}const ws={DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",SCAN_TO_CONNECT:"Scan to connect and sign with",CONNECT_WITH_EXTENSION:"Connect With MetaMask Extension",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION:"Install MetaMask Extension"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}};class rc{constructor(e){var n;this.translations=ws,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=(n=e==null?void 0:e.baseUrl)!==null&&n!==void 0?n:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some(n=>n.toLowerCase().startsWith("en")))return"en";const e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){const n=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(n)}async loadTranslations(e){const n=e.split("-")[0];if(n!=="en"&&this.supportedLocales.includes(n))try{const r=`${this.baseUrl}/${n}.json`,i=await fetch(r);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);this.translations=await i.json()}catch(r){console.warn(`❌ Failed to load ${n} translations, falling back to English:`,r),this.translations=ws}else this.translations=ws}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,n){const r=e.split(".");let i=n;for(const o of r){if(typeof i!="object")return"";i=i[o]}return typeof i=="string"?i:""}}var xr;(function(t){t.SDK_MODAL_VIEWED="sdk_modal_viewed",t.SDK_MODAL_BUTTON_CLICKED="sdk_modal_button_clicked",t.SDK_MODAL_TOGGLE_CHANGED="sdk_modal_toggle_changed"})(xr||(xr={}));const Hf=class{constructor(t){Va(this,t),this.close=bn(this,"close"),this.startDesktopOnboarding=bn(this,"startDesktopOnboarding"),this.trackAnalytics=bn(this,"trackAnalytics"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.onClose=this.onClose.bind(this),this.onStartDesktopOnboardingHandler=this.onStartDesktopOnboardingHandler.bind(this),this.setTab=this.setTab.bind(this),this.render=this.render.bind(this),this.setTab(this.preferDesktop?1:2),this.i18nInstance=new rc}componentDidLoad(){this.trackAnalytics.emit({event:xr.SDK_MODAL_VIEWED,params:{extensionInstalled:!1,tab:this.tab===1?"desktop":"mobile"}})}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}updatePreferDesktop(t){t?this.setTab(1):this.setTab(2)}onClose(t=!1){this.close.emit({shouldTerminate:t})}onStartDesktopOnboardingHandler(){this.trackAnalytics.emit({event:xr.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(t,e=!1){e&&this.trackAnalytics.emit({event:xr.SDK_MODAL_TOGGLE_CHANGED,params:{toggle:this.tab===1?"desktop_to_mobile":"mobile_to_desktop"}}),this.tab=t,this.isDefaultTab=!1}render(){if(!this.translationsLoaded)return null;const t=r=>this.i18nInstance.t(r),e=this.isDefaultTab?this.preferDesktop?1:2:this.tab,n=Uf(this.link,"svg",{ecc:"medium",scale:2});return Y(Qa,{className:"install-model"},Y("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),Y("div",{class:"modal"},Y("div",{class:"closeButtonContainer"},Y("div",{class:"right"},Y("span",{class:"closeButton",onClick:()=>this.onClose(!0)},Y(tc,null)))),Y("div",{class:"logoContainer"},Y(nc,null)),Y("div",null,Y("div",{class:"tabcontainer"},Y("div",{class:"flexContainer"},Y("div",{onClick:()=>this.setTab(1,!0),class:"tab flexItem "+(e===1?"tabactive":"")},t("DESKTOP")),Y("div",{onClick:()=>this.setTab(2,!0),class:"tab flexItem "+(e===2?"tabactive":"")},t("MOBILE")))),Y("div",{style:{display:e===1?"none":"block"}},Y("div",{class:"flexContainer"},Y("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},n&&Y("div",{id:"sdk-mm-qrcode",class:"center",innerHTML:n}),Y("div",{class:"connectMobileText"},t("SCAN_TO_CONNECT")," ",Y("br",null),Y("span",{class:"blue"},Y("b",null,t("META_MASK_MOBILE_APP"))))))),Y("div",{style:{display:e===2?"none":"block"}},Y("div",{class:"item"},Y(bs,{Icon:Sv,text:t("INSTALL_MODAL.TRUSTED_BY_USERS")})),Y("div",{class:"item"},Y(bs,{Icon:_v,text:t("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),Y("div",{class:"item"},Y(bs,{Icon:Cv,text:t("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),Y("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},Y(Av,null),Y("span",{class:"installExtensionText"},t("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),Y(ec,{version:this.sdkVersion})))}get el(){return To(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Hf.style=`.flexContainer {
39
+ display: flex;
40
+ justify-content: center;
41
+ align-items: center;
42
+ flex-direction: row;
43
+ }
44
+
45
+ .flexItem {
46
+ flex: 1;
47
+ justify-content: center;
48
+ align-items: center;
49
+ }
50
+
51
+ .flexItem11 {
52
+ flex: 11;
53
+ justify-content: center;
54
+ align-items: center;
55
+ }
56
+
57
+ .flexItem1 {
58
+ flex: 1;
59
+ justify-content: center;
60
+ align-items: center;
61
+ }
62
+
63
+ .tab {
64
+ padding: 8px;
65
+ cursor: pointer;
66
+ background-color: #F2F4F6;
67
+ font-size: 12px;
68
+ text-align: center;
69
+ color: #24292E;
70
+ }
71
+
72
+ .tabcontainer {
73
+ padding: 4px;
74
+ background-color: #F2F4F6;
75
+ border-radius: 8px;
76
+ margin-bottom: 30px;
77
+ margin-top: 30px;
78
+ }
79
+
80
+ .tabactive {
81
+ background-color: white;
82
+ -webkit-transition: background-color 300ms linear;
83
+ -ms-transition: background-color 300ms linear;
84
+ transition: background-color 300ms linear;
85
+ border-radius: 8px;
86
+ }
87
+
88
+ .item {
89
+ font-size: 12px;
90
+ margin-bottom: 16px;
91
+ border-radius: 8px;
92
+ padding: 10px;
93
+ border: 2px #F2F4F6 solid;
94
+ color: #24292E;
95
+ }
96
+
97
+ .extensionLabel {
98
+ font-style: normal;
99
+ font-weight: bold;
100
+ font-size: 14px;
101
+ text-align: cetner;
102
+ color: #24272A;
103
+ }
104
+
105
+ .notice {
106
+ font-size: 12px;
107
+ margin-left: 10px;
108
+ margin-right: 10px;
109
+ color: grey;
110
+ }
111
+
112
+ .button {
113
+ margin-top: 41.5px;
114
+ margin-bottom: 20px;
115
+ width: 100%;
116
+ display: flex;
117
+ flex-direction: row;
118
+ justify-content: center;
119
+ align-items: center;
120
+ padding: 12px 20px;
121
+ background: #037DD6;
122
+ border-radius: 32px;
123
+ color: white;
124
+ border: 0;
125
+ font-size: 14px;
126
+ cursor: pointer;
127
+ }
128
+
129
+ .backdrop {
130
+ visibility: visible;
131
+ position: fixed;
132
+ top: 0;
133
+ left: 0;
134
+ right: 0;
135
+ bottom: 0;
136
+ width: 100%;
137
+ z-index: 99998;
138
+ background: rgba(0, 0, 0, 0.87);
139
+ opacity: 0.3;
140
+ }
141
+
142
+ .modal {
143
+ visibility: visible;
144
+ position: fixed;
145
+ left: 50%;
146
+ transform: translate(-50%, -50%);
147
+ z-index: 99999;
148
+ background: white;
149
+ padding: 20px;
150
+ border-radius: 8px;
151
+ top: 50%;
152
+ max-width: 100%;
153
+ width: 460px;
154
+ min-width: 300px;
155
+ box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
156
+ -webkit-font-smoothing: antialiased;
157
+ }
158
+
159
+ .closeButton {
160
+ color: #BBC0C5;
161
+ cursor: pointer;
162
+ }
163
+
164
+ .logoContainer {
165
+ margin-left: 24px;
166
+ margin-right: 24px;
167
+ margin-top: 24px;
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: center;
171
+ }
172
+
173
+ .connectMobileText {
174
+ font-size: 14px;
175
+ color: black;
176
+ margin-top: 28px;
177
+ margin-bottom: 28px;
178
+ line-height: 2;
179
+ }
180
+
181
+ .blue {
182
+ color: #037DD6;
183
+ font-weight: 700;
184
+ }
185
+
186
+ .installExtensionText {
187
+ margin-left: 10px;
188
+ }
189
+
190
+ .center {
191
+ display: flex;
192
+ justify-content: center;
193
+ align-items: center;
194
+ }
195
+
196
+ .right {
197
+ display: flex;
198
+ align-items: center;
199
+ justify-content: right;
200
+ }
201
+
202
+ #sdk-mm-qrcode {
203
+ svg {
204
+ width: 50%;
205
+ }
206
+ }`;const Ff=class{constructor(t){Va(this,t),this.close=bn(this,"close"),this.disconnect=bn(this,"disconnect"),this.updateOTPValue=bn(this,"updateOTPValue"),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new rc}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(t){this.updateOTPValue.emit({otpValue:t})}disconnectedCallback(){this.onClose()}render(){var t;if(!this.translationsLoaded)return null;const e=(t=this.displayOTP)===null||t===void 0||t,n=this.sdkVersion,r=i=>this.i18nInstance.t(i);return Y(Qa,{className:"pending-modal"},Y("div",{class:"backdrop",onClick:()=>this.onClose()}),Y("div",{class:"modal"},Y("div",{class:"closeButtonContainer"},Y("div",{class:"right"},Y("span",{class:"closeButton",onClick:()=>this.onClose()},Y(tc,null)))),Y("div",{class:"logoContainer"},Y(nc,null)),Y("div",null,Y("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},Y("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},r(e?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),Y("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),e&&Y("div",{class:"notice"},"* ",r("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),Y("div",{style:{marginTop:"20px"}},Y("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},r("PENDING_MODAL.DISCONNECT")))),Y(ec,{version:n})))}get el(){return To(this)}};Ff.style=`.flexContainer {
207
+ display: flex;
208
+ justify-content: center;
209
+ align-items: center;
210
+ flex-direction: row;
211
+ }
212
+
213
+ .flexItem {
214
+ flex: 1;
215
+ justify-content: center;
216
+ align-items: center;
217
+ }
218
+
219
+ .flexItem11 {
220
+ flex: 11;
221
+ justify-content: center;
222
+ align-items: center;
223
+ }
224
+
225
+ .flexItem1 {
226
+ flex: 1;
227
+ justify-content: center;
228
+ align-items: center;
229
+ }
230
+
231
+ .tab {
232
+ padding: 8px;
233
+ cursor: pointer;
234
+ background-color: #F2F4F6;
235
+ font-size: 12px;
236
+ text-align: center;
237
+ color: #24292E;
238
+ }
239
+
240
+ .tabcontainer {
241
+ padding: 4px;
242
+ background-color: #F2F4F6;
243
+ border-radius: 8px;
244
+ margin-bottom: 30px;
245
+ margin-top: 30px;
246
+ }
247
+
248
+ .tabactive {
249
+ background-color: white;
250
+ -webkit-transition: background-color 300ms linear;
251
+ -ms-transition: background-color 300ms linear;
252
+ transition: background-color 300ms linear;
253
+ border-radius: 8px;
254
+ }
255
+
256
+ .item {
257
+ font-size: 12px;
258
+ margin-bottom: 16px;
259
+ border-radius: 8px;
260
+ padding: 10px;
261
+ border: 2px #F2F4F6 solid;
262
+ color: #24292E;
263
+ }
264
+
265
+ .extensionLabel {
266
+ font-style: normal;
267
+ font-weight: bold;
268
+ font-size: 14px;
269
+ text-align: cetner;
270
+ color: #24272A;
271
+ }
272
+
273
+ .notice {
274
+ font-size: 12px;
275
+ margin-left: 10px;
276
+ margin-right: 10px;
277
+ color: grey;
278
+ }
279
+
280
+ .button {
281
+ margin-top: 41.5px;
282
+ margin-bottom: 20px;
283
+ width: 100%;
284
+ display: flex;
285
+ flex-direction: row;
286
+ justify-content: center;
287
+ align-items: center;
288
+ padding: 12px 20px;
289
+ background: #037DD6;
290
+ border-radius: 32px;
291
+ color: white;
292
+ border: 0;
293
+ font-size: 14px;
294
+ cursor: pointer;
295
+ }
296
+
297
+ .backdrop {
298
+ visibility: visible;
299
+ position: fixed;
300
+ top: 0;
301
+ left: 0;
302
+ right: 0;
303
+ bottom: 0;
304
+ width: 100%;
305
+ z-index: 99998;
306
+ background: rgba(0, 0, 0, 0.87);
307
+ opacity: 0.3;
308
+ }
309
+
310
+ .modal {
311
+ visibility: visible;
312
+ position: fixed;
313
+ left: 50%;
314
+ transform: translate(-50%, -50%);
315
+ z-index: 99999;
316
+ background: white;
317
+ padding: 20px;
318
+ border-radius: 8px;
319
+ top: 50%;
320
+ max-width: 100%;
321
+ width: 460px;
322
+ min-width: 300px;
323
+ box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
324
+ -webkit-font-smoothing: antialiased;
325
+ }
326
+
327
+ .closeButton {
328
+ color: #BBC0C5;
329
+ cursor: pointer;
330
+ }
331
+
332
+ .logoContainer {
333
+ margin-left: 24px;
334
+ margin-right: 24px;
335
+ margin-top: 24px;
336
+ display: flex;
337
+ align-items: center;
338
+ justify-content: center;
339
+ }
340
+
341
+ .connectMobileText {
342
+ font-size: 14px;
343
+ color: black;
344
+ margin-top: 28px;
345
+ margin-bottom: 28px;
346
+ line-height: 2;
347
+ }
348
+
349
+ .blue {
350
+ color: #037DD6;
351
+ font-weight: 700;
352
+ }
353
+
354
+ .installExtensionText {
355
+ margin-left: 10px;
356
+ }
357
+
358
+ .center {
359
+ display: flex;
360
+ justify-content: center;
361
+ align-items: center;
362
+ }
363
+
364
+ .right {
365
+ display: flex;
366
+ align-items: center;
367
+ justify-content: right;
368
+ }
369
+
370
+ #sdk-mm-qrcode {
371
+ svg {
372
+ width: 50%;
373
+ }
374
+ }`;const Pv=()=>Y("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M14.1364 14.9851C13.5909 14.9851 13.2273 14.5851 13.2273 13.9851C13.2273 13.3851 13.5909 12.9851 14.1364 12.9851C16.6818 12.9851 18.6818 10.7851 18.6818 7.98508C18.6818 5.18508 16.6818 2.98508 14.1364 2.98508C11.5909 2.98508 9.59091 5.18508 9.59091 7.98508C9.59091 8.58508 9.22727 8.98508 8.68182 8.98508C8.13636 8.98508 7.77273 8.58508 7.77273 7.98508C7.77273 4.08508 10.5909 0.985077 14.1364 0.985077C17.6818 0.985077 20.5 4.08508 20.5 7.98508C20.5 11.8851 17.6818 14.9851 14.1364 14.9851ZM6.68182 14.7851C3.22727 14.7851 0.5 11.6851 0.5 7.98508C0.5 4.28508 3.22727 1.18508 6.68182 1.18508C7.22727 1.18508 7.59091 1.58508 7.59091 2.18508C7.59091 2.78508 7.22727 3.18508 6.68182 3.18508C4.22727 3.18508 2.31818 5.38508 2.31818 7.98508C2.31818 10.5851 4.22727 12.7851 6.68182 12.7851C9.13636 12.7851 11.0455 10.6851 11.0455 7.98508C11.0455 7.38508 11.4091 6.98508 11.9545 6.98508C12.5 6.98508 12.8636 7.38508 12.8636 7.98508C12.7727 11.6851 10.0455 14.7851 6.68182 14.7851Z",fill:"white"})),Ov=()=>Y("svg",{width:"400",height:"300",viewBox:"0 0 400 300",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("rect",{width:"400",height:"300",fill:"white"}),Y("path",{d:"M300.116 242.46L250.485 227.681L213.057 250.055L186.944 250.045L149.493 227.681L99.8843 242.46L84.7939 191.518L99.8843 134.979L84.7939 87.1777L99.8843 27.9336L177.402 74.2466H222.598L300.116 27.9336L315.206 87.1777L300.116 134.979L315.206 191.518L300.116 242.46Z",fill:"#FF5C16"}),Y("path",{d:"M99.8955 27.9336L177.414 74.2792L174.331 106.085L99.8955 27.9336Z",fill:"#FF5C16"}),Y("path",{d:"M149.505 191.539L183.612 217.521L149.505 227.681V191.539Z",fill:"#FF5C16"}),Y("path",{d:"M180.886 148.585L174.33 106.107L132.369 134.991L132.348 134.98V135.001L132.477 164.732L149.493 148.585H149.504H180.886Z",fill:"#FF5C16"}),Y("path",{d:"M300.116 27.9336L222.598 74.2792L225.67 106.085L300.116 27.9336Z",fill:"#FF5C16"}),Y("path",{d:"M250.508 191.539L216.4 217.521L250.508 227.681V191.539Z",fill:"#FF5C16"}),Y("path",{d:"M267.652 135.001H267.663H267.652V134.98L267.641 134.991L225.68 106.107L219.125 148.585H250.507L267.533 164.732L267.652 135.001Z",fill:"#FF5C16"}),Y("path",{d:"M149.493 227.681L99.8843 242.46L84.7939 191.54H149.493V227.681Z",fill:"#E34807"}),Y("path",{d:"M180.875 148.574L190.351 209.98L177.219 175.838L132.456 164.732L149.483 148.574H180.864H180.875Z",fill:"#E34807"}),Y("path",{d:"M250.507 227.681L300.116 242.46L315.206 191.54H250.507V227.681Z",fill:"#E34807"}),Y("path",{d:"M219.126 148.574L209.649 209.98L222.782 175.838L267.545 164.732L250.507 148.574H219.126Z",fill:"#E34807"}),Y("path",{d:"M84.7939 191.517L99.8843 134.979H132.337L132.456 164.721L177.219 175.826L190.351 209.969L183.601 217.488L149.493 191.506H84.7939V191.517Z",fill:"#FF8D5D"}),Y("path",{d:"M315.206 191.517L300.116 134.979H267.664L267.545 164.721L222.782 175.826L209.649 209.969L216.4 217.488L250.507 191.506H315.206V191.517Z",fill:"#FF8D5D"}),Y("path",{d:"M222.598 74.2466H200H177.402L174.33 106.053L190.351 209.936H209.649L225.681 106.053L222.598 74.2466Z",fill:"#FF8D5D"}),Y("path",{d:"M99.8843 27.9336L84.7939 87.1777L99.8843 134.979H132.337L174.319 106.085L99.8843 27.9336Z",fill:"#661800"}),Y("path",{d:"M171.496 160.906H156.795L148.79 168.752L177.229 175.804L171.496 160.896V160.906Z",fill:"#661800"}),Y("path",{d:"M300.116 27.9336L315.206 87.1777L300.116 134.979H267.663L225.681 106.085L300.116 27.9336Z",fill:"#661800"}),Y("path",{d:"M228.525 160.906H243.248L251.253 168.763L222.781 175.826L228.525 160.896V160.906Z",fill:"#661800"}),Y("path",{d:"M213.046 229.789L216.399 217.51L209.649 209.991H190.34L183.59 217.51L186.943 229.789",fill:"#661800"}),Y("path",{d:"M213.047 229.789V250.066H186.944V229.789H213.047Z",fill:"#C0C4CD"}),Y("path",{d:"M149.504 227.66L186.965 250.056V229.779L183.611 217.5L149.504 227.66Z",fill:"#E7EBF6"}),Y("path",{d:"M250.506 227.66L213.045 250.056V229.779L216.398 217.5L250.506 227.66Z",fill:"#E7EBF6"})),zf=class{constructor(t){Va(this,t),this.close=bn(this,"close"),this.connectWithExtension=bn(this,"connectWithExtension"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.i18nInstance=new rc,this.setTab(this.preferDesktop?1:2)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(t=!1){this.close.emit({shouldTerminate:t})}connectWithExtensionHandler(){this.connectWithExtension.emit()}setTab(t){this.tab=t,this.isDefaultTab=!1}disconnectedCallback(){this.onClose()}updatePreferDesktop(t){t?this.setTab(1):this.setTab(2)}render(){if(!this.translationsLoaded)return null;const t=i=>this.i18nInstance.t(i),e=this.sdkVersion,n=this.isDefaultTab?this.preferDesktop?1:2:this.tab,r=Uf(this.link,"svg",{ecc:"medium",scale:2});return Y(Qa,{className:"select-modal"},Y("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),Y("div",{class:"modal"},Y("div",{class:"closeButtonContainer"},Y("div",{class:"right"},Y("span",{class:"closeButton",onClick:()=>this.onClose(!0)},Y(tc,null)))),Y("div",{class:"logoContainer"},Y(nc,null)),Y("div",null,Y("div",{class:"tabcontainer"},Y("div",{class:"flexContainer"},Y("div",{onClick:()=>this.setTab(1),class:"tab flexItem "+(n===1?"tabactive":"")},t("DESKTOP")),Y("div",{onClick:()=>this.setTab(2),class:"tab flexItem "+(n===2?"tabactive":"")},t("MOBILE")))),Y("div",{style:{display:n===1?"none":"block"}},Y("div",{class:"flexContainer"},Y("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},Y("div",{class:"center",id:"sdk-mm-qrcode",innerHTML:r}),Y("div",{class:"connectMobileText"},t("SCAN_TO_CONNECT"),Y("br",null),Y("span",{class:"blue"},Y("b",null,t("META_MASK_MOBILE_APP"))))))),Y("div",{style:{display:n===2?"none":"block"}},Y("div",{style:{display:"flex",justifyContent:"center",height:"300",marginTop:"-20"}},Y(Ov,null)),Y("div",{class:"extensionLabel"},t("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),Y("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},Y(Pv,null),Y("span",{class:"installExtensionText"},t("CONNECT_WITH_EXTENSION"))))),Y(ec,{version:e})))}get el(){return To(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};zf.style=`.flexContainer {
375
+ display: flex;
376
+ justify-content: center;
377
+ align-items: center;
378
+ flex-direction: row;
379
+ }
380
+
381
+ .flexItem {
382
+ flex: 1;
383
+ justify-content: center;
384
+ align-items: center;
385
+ }
386
+
387
+ .flexItem11 {
388
+ flex: 11;
389
+ justify-content: center;
390
+ align-items: center;
391
+ }
392
+
393
+ .flexItem1 {
394
+ flex: 1;
395
+ justify-content: center;
396
+ align-items: center;
397
+ }
398
+
399
+ .tab {
400
+ padding: 8px;
401
+ cursor: pointer;
402
+ background-color: #F2F4F6;
403
+ font-size: 12px;
404
+ text-align: center;
405
+ color: #24292E;
406
+ }
407
+
408
+ .tabcontainer {
409
+ padding: 4px;
410
+ background-color: #F2F4F6;
411
+ border-radius: 8px;
412
+ margin-bottom: 30px;
413
+ margin-top: 30px;
414
+ }
415
+
416
+ .tabactive {
417
+ background-color: white;
418
+ -webkit-transition: background-color 300ms linear;
419
+ -ms-transition: background-color 300ms linear;
420
+ transition: background-color 300ms linear;
421
+ border-radius: 8px;
422
+ }
423
+
424
+ .item {
425
+ font-size: 12px;
426
+ margin-bottom: 16px;
427
+ border-radius: 8px;
428
+ padding: 10px;
429
+ border: 2px #F2F4F6 solid;
430
+ color: #24292E;
431
+ }
432
+
433
+ .extensionLabel {
434
+ font-style: normal;
435
+ font-weight: bold;
436
+ font-size: 14px;
437
+ text-align: cetner;
438
+ color: #24272A;
439
+ }
440
+
441
+ .notice {
442
+ font-size: 12px;
443
+ margin-left: 10px;
444
+ margin-right: 10px;
445
+ color: grey;
446
+ }
447
+
448
+ .button {
449
+ margin-top: 41.5px;
450
+ margin-bottom: 20px;
451
+ width: 100%;
452
+ display: flex;
453
+ flex-direction: row;
454
+ justify-content: center;
455
+ align-items: center;
456
+ padding: 12px 20px;
457
+ background: #037DD6;
458
+ border-radius: 32px;
459
+ color: white;
460
+ border: 0;
461
+ font-size: 14px;
462
+ cursor: pointer;
463
+ }
464
+
465
+ .backdrop {
466
+ visibility: visible;
467
+ position: fixed;
468
+ top: 0;
469
+ left: 0;
470
+ right: 0;
471
+ bottom: 0;
472
+ width: 100%;
473
+ z-index: 99998;
474
+ background: rgba(0, 0, 0, 0.87);
475
+ opacity: 0.3;
476
+ }
477
+
478
+ .modal {
479
+ visibility: visible;
480
+ position: fixed;
481
+ left: 50%;
482
+ transform: translate(-50%, -50%);
483
+ z-index: 99999;
484
+ background: white;
485
+ padding: 20px;
486
+ border-radius: 8px;
487
+ top: 50%;
488
+ max-width: 100%;
489
+ width: 460px;
490
+ min-width: 300px;
491
+ box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
492
+ -webkit-font-smoothing: antialiased;
493
+ }
494
+
495
+ .closeButton {
496
+ color: #BBC0C5;
497
+ cursor: pointer;
498
+ }
499
+
500
+ .logoContainer {
501
+ margin-left: 24px;
502
+ margin-right: 24px;
503
+ margin-top: 24px;
504
+ display: flex;
505
+ align-items: center;
506
+ justify-content: center;
507
+ }
508
+
509
+ .connectMobileText {
510
+ font-size: 14px;
511
+ color: black;
512
+ margin-top: 28px;
513
+ margin-bottom: 28px;
514
+ line-height: 2;
515
+ }
516
+
517
+ .blue {
518
+ color: #037DD6;
519
+ font-weight: 700;
520
+ }
521
+
522
+ .installExtensionText {
523
+ margin-left: 10px;
524
+ }
525
+
526
+ .center {
527
+ display: flex;
528
+ justify-content: center;
529
+ align-items: center;
530
+ }
531
+
532
+ .right {
533
+ display: flex;
534
+ align-items: center;
535
+ justify-content: right;
536
+ }
537
+
538
+ #sdk-mm-qrcode {
539
+ svg {
540
+ width: 50%;
541
+ }
542
+ }`;var Iv=Object.freeze({__proto__:null,mm_install_modal:Hf,mm_pending_modal:Ff,mm_select_modal:zf});exports.DEFAULT_SERVER_URL=In;exports.MetaMaskSDK=Tf;exports.MetaMaskSDKEvent=We;exports.SDKProvider=wf;exports.default=Tf;