@fangorn-network/westmarch 2026.10.20-dev → 2026.10.22-dev

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 (586) hide show
  1. package/README.md +4 -2
  2. package/docs/app-to-agent.md +48 -46
  3. package/package.json +6 -5
  4. package/site/dist/assets/AccountNotFoundScreen-C4njXc69-DyVH4CEz.js +1 -0
  5. package/site/dist/assets/AddFundsSelectionScreen-RAoCn7ej-Dz1--SS9.js +31 -0
  6. package/site/dist/assets/Address-H8kD1d9O-BdFZmRwI.js +17 -0
  7. package/site/dist/assets/AffirmativeConsentScreen-BG0MJxku-CxaCAisL.js +6 -0
  8. package/site/dist/assets/AllowlistRejectionScreen-Cae6e1Od-JGk7vndN.js +1 -0
  9. package/site/dist/assets/ApiController-CTLbMCcH.js +5 -0
  10. package/site/dist/assets/ArrowsRightLeftIcon-B8g9adpz.js +1 -0
  11. package/site/dist/assets/AuthenticateWithWalletScreen-CU6hIcFT-CXD9_OP8.js +1 -0
  12. package/site/dist/assets/AwaitingEvmToSolBridgingScreen-D0e_sZMS-BtJCglvU.js +1 -0
  13. package/site/dist/assets/AwaitingExternalEthereumTransferScreen-ur5HL4R7-BgC2TsqH.js +1 -0
  14. package/site/dist/assets/AwaitingPasswordlessCodeScreen-DRHz76mM-B9OzLeEO.js +103 -0
  15. package/site/dist/assets/AwaitingSolToEvmBridgingScreen-CdLRrGD2-C7r5snUL.js +1 -0
  16. package/site/dist/assets/BridgeNetworkSelectionView-CFGjB2nO-BTV0NRio.js +68 -0
  17. package/site/dist/assets/CaptchaScreen-DbpvkIGx-7rSZIuM-.js +1 -0
  18. package/site/dist/assets/CheckCircleIcon-B1l17ioc.js +1 -0
  19. package/site/dist/assets/CheckCircleIcon-BGSI8nKf.js +1 -0
  20. package/site/dist/assets/Checkbox-D1EDeo41-BUfq0w99.js +52 -0
  21. package/site/dist/assets/ChevronDownIcon-B6uJvPHu.js +1 -0
  22. package/site/dist/assets/Chip-CZKIKt9K-r9Nk__0-.js +26 -0
  23. package/site/dist/assets/CoinbaseOnrampStatusScreen-BbyCJDXL-DWWNHxmR.js +16 -0
  24. package/site/dist/assets/ConnectEmailForm-B-VRE0MN-CRQwS0Xu.js +3 -0
  25. package/site/dist/assets/ConnectLedgerScreen-DWHABGot-CZcCt31O.js +10 -0
  26. package/site/dist/assets/ConnectOnlyLandingScreen-CZYx9Bmp-C5IOf-SQ.js +1 -0
  27. package/site/dist/assets/ConnectOnlyStatusScreen-DCRzjxHx-cwg74F3A.js +1 -0
  28. package/site/dist/assets/ConnectOrCreateScreen-CUUYUO07-D28oeK6b.js +1 -0
  29. package/site/dist/assets/ConnectPhoneForm-Dek5xn4C-EEdkKeTp.js +95 -0
  30. package/site/dist/assets/ConnectWalletView-DqI-PTvX-C2mEzukj.js +74 -0
  31. package/site/dist/assets/ConnectionStatusScreen-fUfROm9m-CH_7r8iV.js +7 -0
  32. package/site/dist/assets/ConnectionStatusScreen-fUfROm9m-Z33kis0B.js +1 -0
  33. package/site/dist/assets/ConnectorUtil-DH4NePk5.js +21 -0
  34. package/site/dist/assets/ConstantsUtil-DmLsRHAl.js +198 -0
  35. package/site/dist/assets/CopyToClipboard-i_OQSBJr-_G88JCVR.js +39 -0
  36. package/site/dist/assets/CopyableText-CQapvaMr-CGGfc_zM.js +28 -0
  37. package/site/dist/assets/CrossAppAuthScreen-CLw7ymZq-C9Okoc0V.js +1 -0
  38. package/site/dist/assets/CustomLandingScreenView-Cm_MBSyX-D2l6hdSl.js +22 -0
  39. package/site/dist/assets/DelegatedActionsConsentScreen-DYF2U4y5-Dda3KKqS.js +1 -0
  40. package/site/dist/assets/DelegatedActionsRevokeScreen-bPp6Uwyh-DG8kJPt1.js +1 -0
  41. package/site/dist/assets/DepositAddressAddressStepView-4vdkb55L-CcOUfn6f.js +187 -0
  42. package/site/dist/assets/DepositAddressScreen-DBLRs7aI-DeituDNh.js +8 -0
  43. package/site/dist/assets/DepositAddressV3Screen-CDqIEMQw-FDg6K14-.js +1 -0
  44. package/site/dist/assets/{EmailInputForm-Cqo1mda8-CZD4r5LM.js → EmailInputForm-Cqo1mda8-BmbxvPHC.js} +11 -11
  45. package/site/dist/assets/EmbeddedWalletConnectingScreen-D4T7DUzs-B05CQ9rx.js +1 -0
  46. package/site/dist/assets/EmbeddedWalletCreatedScreen-D7WhW5ve-Cxd1b9XH.js +1 -0
  47. package/site/dist/assets/EmbeddedWalletKeyExportScreen-CqV4NYQ3-CrJy0ViX.js +23 -0
  48. package/site/dist/assets/EmbeddedWalletOnAccountCreateScreen-BoKb3Q2S-Bakaa3zu.js +1 -0
  49. package/site/dist/assets/EmbeddedWalletPasswordUpdateScreen-D3rMlqS7-j78vKrcj.js +1 -0
  50. package/site/dist/assets/EmbeddedWalletPasswordUpdateSplashScreen-BPFkWJeE-D3dr7W9_.js +1 -0
  51. package/site/dist/assets/EnrollTotp-Dibew4dp-BXbYV8nI.js +66 -0
  52. package/site/dist/assets/EnvelopeIcon-DjPofnRI.js +1 -0
  53. package/site/dist/assets/ErrorBanner-BcpGRt0h-BhH6_V-9.js +21 -0
  54. package/site/dist/assets/{ErrorMessage-D8VaAP5m-oSruKN8L.js → ErrorMessage-D8VaAP5m-Bs7uX2a9.js} +2 -2
  55. package/site/dist/assets/ErrorScreen-DipdTWzE-BgPRgnOb.js +4 -0
  56. package/site/dist/assets/ErrorScreen-DipdTWzE-CvxXC6pz.js +1 -0
  57. package/site/dist/assets/ExclamationCircleIcon-BE-WGrut.js +1 -0
  58. package/site/dist/assets/ExclamationTriangleIcon-Ca1Xlc_f.js +1 -0
  59. package/site/dist/assets/FarcasterConnectStatusScreen-51tjUxqq-De2JvZdV.js +75 -0
  60. package/site/dist/assets/FarcasterSignerStatusScreen-6x-Uh95G-bLp3hXoO.js +28 -0
  61. package/site/dist/assets/FiatOnrampScreen-BAhYeiTI-Jr6D6JiZ.js +491 -0
  62. package/site/dist/assets/FingerPrintIcon-DOCbS93y.js +1 -0
  63. package/site/dist/assets/FundSolWalletWithExternalSolanaWallet-WtLwYaOl-A_G5kfa1.js +1 -0
  64. package/site/dist/assets/FundWalletMethodHeader-BWNkokCT-LPv35wkD.js +1 -0
  65. package/site/dist/assets/FundWithBankDepositScreen-DajkHxBD-0hfGrfvf.js +58 -0
  66. package/site/dist/assets/FundingEditAmountScreen-CpvpiO4M-Dz0s_NWR.js +1 -0
  67. package/site/dist/assets/FundingMethodSelectionScreen-Db7vhRlE-ZGm-3-Io.js +1 -0
  68. package/site/dist/assets/GlobeAltIcon-BBRl2MMn.js +1 -0
  69. package/site/dist/assets/GooglePay-B53WnudL-BGiVpB8y.js +1 -0
  70. package/site/dist/assets/HCaptchaWrapper-CUi9LJsp-CHdfIeD_.js +4 -0
  71. package/site/dist/assets/InAppBrowserLoginNotPossible-BMR9br1T-Cgoiow3m.js +1 -0
  72. package/site/dist/assets/InfoBanner-Cb3p1z12-_YqQmRiu.js +22 -0
  73. package/site/dist/assets/InjectedWalletIcon-DLcYOGDj-tuIrKQHH.js +1 -0
  74. package/site/dist/assets/InstallWalletScreen-DTA8dwLv-BMU_wa61.js +1 -0
  75. package/site/dist/assets/{JsonTree-BHzNC-ic-pAEq1bl9.js → JsonTree-BHzNC-ic-DcVr0YF0.js} +3 -3
  76. package/site/dist/assets/{LabelXs-oqZNqbm_-D09YjVR4.js → LabelXs-oqZNqbm_-CNprGVQM.js} +2 -2
  77. package/site/dist/assets/LandingScreen-CGWUoSUG-fH6rsQen.js +1 -0
  78. package/site/dist/assets/{Layouts-BMRfo5hw-D2u1-w8g.js → Layouts-BMRfo5hw-e-sepi6F.js} +16 -16
  79. package/site/dist/assets/Link-BdDilT2T-BdwlRJch.js +40 -0
  80. package/site/dist/assets/LinkConflictScreen-C3ZEPsgl-BXKN2Qm5.js +77 -0
  81. package/site/dist/assets/LinkEmailScreen-dKo9frwc-Cyn7Q8p1.js +1 -0
  82. package/site/dist/assets/LinkPasskeyScreen-zbrl_AI_-CWiqnwLM.js +117 -0
  83. package/site/dist/assets/LinkPasskeyScreen-zbrl_AI_-YmDevJzf.js +1 -0
  84. package/site/dist/assets/LinkPhoneScreen-oIUpfj0w-h7shW-Ay.js +1 -0
  85. package/site/dist/assets/Loader-UAZqxsnw-DJEVblm1.js +62 -0
  86. package/site/dist/assets/{LoadingSkeleton-BMsgO5PV-BRMh4Fv4.js → LoadingSkeleton-BMsgO5PV-D2atjsP5.js} +6 -6
  87. package/site/dist/assets/LockClosedIcon-9EFzWK1C.js +1 -0
  88. package/site/dist/assets/LoginFailedScreen-CN0dJV6U-By3Si77a.js +1 -0
  89. package/site/dist/assets/ManualTransferScreen-CHqcuqbs-BAHPY8rs.js +1 -0
  90. package/site/dist/assets/MfaAuthEnrollmentFlowScreen-Dj7gPTRC-CLjffFG1.js +1 -0
  91. package/site/dist/assets/MfaAuthVerifyFlowScreen-DbFpyWMy-BmQg1Y61.js +1 -0
  92. package/site/dist/assets/MfaEnrollmentFlowScreen-DhLnGgnr-DmBtTtlw.js +1 -0
  93. package/site/dist/assets/MfaVerifyFlowScreen-C_XPjMRP-4a683Bmf.js +1 -0
  94. package/site/dist/assets/ModalFooter-BCuEK_nz-C_71qsaz.js +403 -0
  95. package/site/dist/assets/MoonpayStatusScreen-CzTUtokc-DEHHcEf8.js +16 -0
  96. package/site/dist/assets/OAuthStatusScreen-ufbOa-da-BjAb_WsY.js +1 -0
  97. package/site/dist/assets/OpenLink-CUpJ1mOr-BLWFsPOW.js +39 -0
  98. package/site/dist/assets/PasskeySelectSignupOrLogin-xh2ScC_l-2PJTJxX-.js +1 -0
  99. package/site/dist/assets/PasskeyStatusScreen-Bla8MaOk-DCEg761l.js +6 -0
  100. package/site/dist/assets/PasswordRecoveryScreen-awGXZkQk-8nVjNc8k.js +20 -0
  101. package/site/dist/assets/{PhArrowCircleDown-BtlNV0TZ.js → PhArrowCircleDown-D97G-BOA.js} +5 -5
  102. package/site/dist/assets/PhArrowClockwise-DVgyFuez.js +14 -0
  103. package/site/dist/assets/PhArrowDown-87b1BizM.js +14 -0
  104. package/site/dist/assets/PhArrowLeft-Da0MfnbK.js +14 -0
  105. package/site/dist/assets/PhArrowRight-AdrIL4DW.js +14 -0
  106. package/site/dist/assets/{PhArrowSquareOut-DnQ7n_B4.js → PhArrowSquareOut-Bk2CMG3I.js} +5 -5
  107. package/site/dist/assets/PhArrowUp-4sgyKPGx.js +14 -0
  108. package/site/dist/assets/PhArrowUpRight-BNghD2zq.js +14 -0
  109. package/site/dist/assets/{PhArrowsClockwise-Brtx2Re-.js → PhArrowsClockwise-BXRn1GEl.js} +5 -5
  110. package/site/dist/assets/{PhArrowsDownUp-PZosTqZG.js → PhArrowsDownUp-DM09Jo_3.js} +5 -5
  111. package/site/dist/assets/PhArrowsLeftRight-MuKBLUoF.js +14 -0
  112. package/site/dist/assets/{PhBank-hhPAIPVb.js → PhBank-fHbgCqqZ.js} +5 -5
  113. package/site/dist/assets/PhBrowser-2-9m-AkM.js +14 -0
  114. package/site/dist/assets/PhCaretDown-BDNabFuL.js +14 -0
  115. package/site/dist/assets/PhCaretLeft-CI460R-A.js +14 -0
  116. package/site/dist/assets/PhCaretRight-D7ZS3Ls8.js +14 -0
  117. package/site/dist/assets/PhCaretUp-C-iIfyvO.js +14 -0
  118. package/site/dist/assets/PhCheck-DxQXn57r.js +14 -0
  119. package/site/dist/assets/{PhCircleHalf-Bk9C4DvT.js → PhCircleHalf-MJZeRBGF.js} +5 -5
  120. package/site/dist/assets/PhClock-x3MS3Mwi.js +14 -0
  121. package/site/dist/assets/{PhCompass-Df1ugFO-.js → PhCompass-hYn3HhGN.js} +5 -5
  122. package/site/dist/assets/PhCopy-CWNYcABI.js +14 -0
  123. package/site/dist/assets/{PhCreditCard-CZpdid2n.js → PhCreditCard-Fy4pzwtt.js} +5 -5
  124. package/site/dist/assets/{PhCurrencyDollar-B6IKKjue.js → PhCurrencyDollar-BgiaenCi.js} +5 -5
  125. package/site/dist/assets/{PhDesktop-BuCDXYJj.js → PhDesktop-CxrzCSv5.js} +5 -5
  126. package/site/dist/assets/PhDeviceMobile-CsyA5Goi.js +14 -0
  127. package/site/dist/assets/PhDotsThree-D-k1BiYg.js +14 -0
  128. package/site/dist/assets/PhEnvelope-D8kzeNox.js +14 -0
  129. package/site/dist/assets/PhFunnelSimple-CfQs5DAW.js +14 -0
  130. package/site/dist/assets/{PhGlobe-q1mqj65V.js → PhGlobe-DvmSc9_A.js} +5 -5
  131. package/site/dist/assets/{PhIdentificationCard-BeLXJpfZ.js → PhIdentificationCard-CfkZm-5K.js} +5 -5
  132. package/site/dist/assets/{PhImage-BYrKfN9k.js → PhImage-Cf0J2ZfJ.js} +5 -5
  133. package/site/dist/assets/{PhInfo-X33f06Ej.js → PhInfo-Bwi51-2X.js} +5 -5
  134. package/site/dist/assets/{PhLightbulb-DMZJsowR.js → PhLightbulb-C4FZV7Es.js} +5 -5
  135. package/site/dist/assets/PhMagnifyingGlass-C9u8jSCJ.js +14 -0
  136. package/site/dist/assets/{PhPaperPlaneRight-Dvo-nXr9.js → PhPaperPlaneRight-zxQVvPLX.js} +5 -5
  137. package/site/dist/assets/PhPlus-C4UoW-2n.js +14 -0
  138. package/site/dist/assets/{PhPower-D8-AcNM6.js → PhPower-CFyWDmgD.js} +5 -5
  139. package/site/dist/assets/{PhPuzzlePiece-C-7mYqGO.js → PhPuzzlePiece-BjoNVfST.js} +5 -5
  140. package/site/dist/assets/{PhQrCode-uIXlI5ER.js → PhQrCode-CP3tFauY.js} +5 -5
  141. package/site/dist/assets/{PhQuestion-rUoqC2sC.js → PhQuestion-wOWJBd3G.js} +5 -5
  142. package/site/dist/assets/{PhQuestionMark-W55Txvvb.js → PhQuestionMark-CV0k9C0Y.js} +5 -5
  143. package/site/dist/assets/{PhSealCheck-BeVLq9PH.js → PhSealCheck-vIKzREuN.js} +5 -5
  144. package/site/dist/assets/{PhSignOut-Cq2PivQ6.js → PhSignOut-CxELV-i0.js} +5 -5
  145. package/site/dist/assets/{PhSpinner-CZMtAFdX.js → PhSpinner-CGDmbzUd.js} +5 -5
  146. package/site/dist/assets/{PhTrash-BamrmMsN.js → PhTrash-C9PD0SAt.js} +5 -5
  147. package/site/dist/assets/{PhUser-A2fxqIV0.js → PhUser-0sWNXQeZ.js} +5 -5
  148. package/site/dist/assets/{PhVault-B8m1usHw.js → PhVault-6JTskUcC.js} +5 -5
  149. package/site/dist/assets/{PhWarning-CpkID9oi.js → PhWarning-CoKs3gz6.js} +5 -5
  150. package/site/dist/assets/PhWarningCircle-BXHw1fCt.js +14 -0
  151. package/site/dist/assets/PhX-DX0SFIqC.js +14 -0
  152. package/site/dist/assets/PhoneIcon-CZ47md80.js +1 -0
  153. package/site/dist/assets/PinInput-DbZ0b1i1-BrTXu3Km.js +247 -0
  154. package/site/dist/assets/PrivyPluginContext-DA-yS5vO-CY60yubk.js +1 -0
  155. package/site/dist/assets/QrCode-DbnZwlkH-CcMrWV5D.js +22 -0
  156. package/site/dist/assets/RecoveryOAuthStatusScreen-CsgtTI2x-DgeDnHOK.js +1 -0
  157. package/site/dist/assets/RecoveryPasswordCreateScreen-Be-qJ-LU-CvJJwLhK.js +1 -0
  158. package/site/dist/assets/RecoverySelectionScreen-D1iGtpmi-CADtGtSV.js +7 -0
  159. package/site/dist/assets/SIWXUtil-Cpiv91-M.js +1 -0
  160. package/site/dist/assets/{Screen-D30meWsY-DDum2qlY.js → Screen-D30meWsY-vEusJ7KX.js} +22 -22
  161. package/site/dist/assets/{ScreenHeader-CHmc4-Lu-BqrAEXbV.js → ScreenHeader-CHmc4-Lu-BvGTLg53.js} +4 -4
  162. package/site/dist/assets/ScreenLayout-OwaQQcxH-cfOTmyl0.js +1 -0
  163. package/site/dist/assets/{SelectSourceAsset-CWFog6gm-8iXuqbAs.js → SelectSourceAsset-CWFog6gm-DxYklZYs.js} +18 -18
  164. package/site/dist/assets/SetAutomaticRecoveryScreen-BO_OEqAZ-oeqeo05x.js +14 -0
  165. package/site/dist/assets/SetWalletPasswordForm-DwCTVtAh-BxFee9UA.js +11 -0
  166. package/site/dist/assets/ShieldCheckIcon-eFjsosCA.js +1 -0
  167. package/site/dist/assets/SignRequestScreen-BHKv32KR-z8ixfIma.js +26 -0
  168. package/site/dist/assets/SolanaWalletConnector-C7Lqk-Wz-Bc_lvdiF.js +1 -0
  169. package/site/dist/assets/{StackedContainer-B2vaEl56-C-ojzCoQ.js → StackedContainer-B2vaEl56-Do5dXB8-.js} +2 -2
  170. package/site/dist/assets/StandardSignAndSendTransactionScreen-CfhIXVtd-DudetZAc.js +20 -0
  171. package/site/dist/assets/{Subtitle-CV-2yKE4-o-1FQLlX.js → Subtitle-CV-2yKE4-DV0o1av3.js} +2 -2
  172. package/site/dist/assets/TelegramAuthScreen-UL9zLfO8-Bo3sONvf.js +1 -0
  173. package/site/dist/assets/{Title-BnzYV3Is-RX1f0RV-.js → Title-BnzYV3Is-C3qOPnO_.js} +2 -2
  174. package/site/dist/assets/TodoList-DnyULl18-BvxvubbF.js +36 -0
  175. package/site/dist/assets/TransactionDetails-e9nesl30-WWflkOIi.js +109 -0
  176. package/site/dist/assets/TransactionErrorView-BDBNqA_f-CotYKcgf.js +178 -0
  177. package/site/dist/assets/TransferFromWalletScreen-Qvn1Yuno-sVFlWqa8.js +31 -0
  178. package/site/dist/assets/TransferOrBridgeLoadingScreen-Dl1I_iIz-CV2-mY19.js +6 -0
  179. package/site/dist/assets/TurnstileWrapper-B7sNddys-oPbuMTQt.js +1 -0
  180. package/site/dist/assets/UpdateEmailScreen-DVOhPV0H-D_mjSpAy.js +1 -0
  181. package/site/dist/assets/UpdatePhoneScreen-CXRswTNZ-6RLG0ahv.js +1 -0
  182. package/site/dist/assets/UserLimitReachedScreen-5we2DHn8-CaVN0bti.js +1 -0
  183. package/site/dist/assets/{Value-DTgR824E-DZpvBCWi.js → Value-DTgR824E-Bp6WGZZm.js} +7 -7
  184. package/site/dist/assets/WalletCards-DH1rqayz-D3cOTb9x.js +1 -0
  185. package/site/dist/assets/WalletIcon-DOIZhb2l.js +1 -0
  186. package/site/dist/assets/WalletInfoCard-sq_2wgFg-bOqfl5MA.js +29 -0
  187. package/site/dist/assets/WalletInterstitialScreen-Sh7LfsAh-DWaVkMCA.js +1 -0
  188. package/site/dist/assets/WalletLink-DK5LB5Ha-DjUZvqs-.js +20 -0
  189. package/site/dist/assets/WalletOverflowButton-bfCnp-9T-B6P7DQXA.js +1 -0
  190. package/site/dist/assets/WarningBanner-ZZqCEtZK-Bc2YKZb7.js +21 -0
  191. package/site/dist/assets/__vite-browser-external-NciY4Vu1.js +1 -0
  192. package/site/dist/assets/_esm-BZP3cXTv.js +1 -0
  193. package/site/dist/assets/_esm-ZmzBJpEs.js +6 -0
  194. package/site/dist/assets/accounts-D4AXF17G.js +1 -0
  195. package/site/dist/assets/accounts-IkdFx9nq.js +1 -0
  196. package/site/dist/assets/analytics-mkkvFRju-BRBcadka.js +1 -0
  197. package/site/dist/assets/baseSepolia-Bn1j1Ysw.js +1 -0
  198. package/site/dist/assets/basic-Cz1YiCSk.js +1575 -0
  199. package/site/dist/assets/capitalizeFirstLetter-DmLYqXsO-DtOXx-2n.js +1 -0
  200. package/site/dist/assets/ccip-B1J3oTZx.js +7 -0
  201. package/site/dist/assets/ccip-Bd7261zy.js +1 -0
  202. package/site/dist/assets/ccip-D6EHKpjI.js +1 -0
  203. package/site/dist/assets/chain-scefkYIH.js +5 -0
  204. package/site/dist/assets/check-DHnllI8N.js +1 -0
  205. package/site/dist/assets/chevron-down-1y-r4bGO.js +1 -0
  206. package/site/dist/assets/circle-alert-OwxamXUX.js +1 -0
  207. package/site/dist/assets/circle-check-big-3sZGVC10.js +1 -0
  208. package/site/dist/assets/circle-x-DQjNUV9J.js +1 -0
  209. package/site/dist/assets/client-B-BpRtwY.js +1 -0
  210. package/site/dist/assets/client-BfIR1FvH.js +9 -0
  211. package/site/dist/assets/coinbase-DCPC2L_R-YEuIn3jh.js +3 -0
  212. package/site/dist/assets/copy-DMOX_yn7.js +1 -0
  213. package/site/dist/assets/core-GIEmxmAa.js +12 -0
  214. package/site/dist/assets/createLucideIcon-BsERoFTA.js +1 -0
  215. package/site/dist/assets/defineChain-B-SQDLTG.js +1 -0
  216. package/site/dist/assets/dijkstra-CY95afk4.js +1 -0
  217. package/site/dist/assets/dist-CoS6E-3x.js +1 -0
  218. package/site/dist/assets/dist-Cp6IXeJd.js +1 -0
  219. package/site/dist/assets/dist-CrNxmdZj.js +1 -0
  220. package/site/dist/assets/dist-DYGtf4F0.js +16 -0
  221. package/site/dist/assets/embed.worker-Cnl4VGr3.js +1 -0
  222. package/site/dist/assets/errors-BQ3N-RVt-CZPAWCgC.js +1 -0
  223. package/site/dist/assets/esm-C3DslVJx.js +1 -0
  224. package/site/dist/assets/esm-Ci1ogKuK.js +1 -0
  225. package/site/dist/assets/esm-Co94ENUV.js +37 -0
  226. package/site/dist/assets/esm-bb8SANZh.js +1 -0
  227. package/site/dist/assets/esm-n2lWo7kz.js +1 -0
  228. package/site/dist/assets/ethers-zTjbodk5-Cs648CnD.js +1 -0
  229. package/site/dist/assets/eventemitter3-Dzc_0Uq2.js +1 -0
  230. package/site/dist/assets/external-link-BBPG3rG7.js +1 -0
  231. package/site/dist/assets/farcaster-DPlSjvF5-CzBCmgyL.js +1 -0
  232. package/site/dist/assets/features-CuiHbgEJ.js +2 -0
  233. package/site/dist/assets/fingerprint-pattern-CjLtyIxB.js +1 -0
  234. package/site/dist/assets/floating-ui.react-DmaCfayr.js +1 -0
  235. package/site/dist/assets/floating-ui.react-dom-CaoMF8mP.js +1 -0
  236. package/site/dist/assets/formatErc20TokenAmount-BuPk9xcy-BVqOKQif.js +1 -0
  237. package/site/dist/assets/formatter-CVbp4SlJ.js +1 -0
  238. package/site/dist/assets/get-entropy-details-for-user-dHRH5Gpi-BNiOFXbK.js +1 -0
  239. package/site/dist/assets/getChainName-DjpPdUSc-DUyKDrnp.js +1 -0
  240. package/site/dist/assets/getErc20Balance-jXNpFf0N-q4bV8kQq.js +1 -0
  241. package/site/dist/assets/getErc20TokenInfo-BNTrzLMP-DcnTFrXN.js +1 -0
  242. package/site/dist/assets/getFormattedUsdFromLamports-De3U9GlO-Gx4_wxON.js +1 -0
  243. package/site/dist/assets/getUsdcMintAddress-BVgm9GRo-r2UnDeEy.js +1 -0
  244. package/site/dist/assets/guards-BIW-GiMJ-D3tWTQAR.js +1 -0
  245. package/site/dist/assets/hooks.module-BYZGfwDl.js +1 -0
  246. package/site/dist/assets/hourglass-D_GfQdJr.js +1 -0
  247. package/site/dist/assets/id-UqEwL2BI-CTlvRMA5.js +1 -0
  248. package/site/dist/assets/index-BdEw5wyl-kLbhqLbv.js +1 -0
  249. package/site/dist/assets/index-C2h3EneX.js +8 -0
  250. package/site/dist/assets/{index-CWARkn2w-D6ikWJWj.js → index-CWARkn2w-DxuckIFn.js} +7 -7
  251. package/site/dist/assets/index-DvMddJcd-CNBb4VUn.js +12 -0
  252. package/site/dist/assets/index-YiCw0Y_x-Czl0tWfF.js +436 -0
  253. package/site/dist/assets/index.browser-B-i-Lj3J.js +1 -0
  254. package/site/dist/assets/index.browser-BMmUcykv.js +1 -0
  255. package/site/dist/assets/index.es-Crd0TyUS.js +2 -0
  256. package/site/dist/assets/index.es-DQbup1WG.js +3 -0
  257. package/site/dist/assets/isPaymentRequestAvailable-Bq1cemEn-Cjf3l05I.js +1 -0
  258. package/site/dist/assets/jsx-runtime-CndCZlyt.js +1 -0
  259. package/site/dist/assets/landmark-BZPqMFEf.js +1 -0
  260. package/site/dist/assets/lib-DGtzi2DK.js +1 -0
  261. package/site/dist/assets/localBatchGatewayRequest-B71J8sQ9.js +29 -0
  262. package/site/dist/assets/lock-DyN_c-ud.js +1 -0
  263. package/site/dist/assets/logger-CsXm3oIv-B0UYpNFI.js +1 -0
  264. package/site/dist/assets/mail-V_mcPb64.js +1 -0
  265. package/site/dist/assets/modal-context-CwmSeFcv-DPWNJrfK.js +1 -0
  266. package/site/dist/assets/native-BKj27wfc.js +1 -0
  267. package/site/dist/assets/ofetch.CWycOUEr-Duby3iHT.js +1 -0
  268. package/site/dist/assets/parseAbi-Csg-8t59.js +2 -0
  269. package/site/dist/assets/parseAbiParameters-BWbIMYe4.js +1 -0
  270. package/site/dist/assets/parseEther-CHS0GNkM.js +1 -0
  271. package/site/dist/assets/pkce-DXF0yKjP-7_VY-d83.js +1 -0
  272. package/site/dist/assets/preload-helper-CRzLMJPS.js +1 -0
  273. package/site/dist/assets/privy-context-81KmsBw2-DiR6-Yq8.js +2 -0
  274. package/site/dist/assets/property-DuZ9DLP4.js +3 -0
  275. package/site/dist/assets/react-BfYA1q0G.js +1 -0
  276. package/site/dist/assets/react-CK2HRI1t.js +1 -0
  277. package/site/dist/assets/react-DxGeY8B8.js +1 -0
  278. package/site/dist/assets/react-auth-sHnipzbS.js +1 -0
  279. package/site/dist/assets/react-dom-BI2Koe4o.js +1 -0
  280. package/site/dist/assets/reservoir-x-nGuZkT-BguVFH3D.js +1 -0
  281. package/site/dist/assets/roles-BDPDWrwo.js +1 -0
  282. package/site/dist/assets/roles-DKPW79Ca.js +1 -0
  283. package/site/dist/assets/rolldown-runtime-Bjp52BOI.js +1 -0
  284. package/site/dist/assets/safe-url-D7SRPu33-CkMedGro.js +1 -0
  285. package/site/dist/assets/secp256k1-BeYL8aZl.js +1 -0
  286. package/site/dist/assets/secp256k1-Bh4MSkhz.js +1 -0
  287. package/site/dist/assets/secp256k1-Ci4cqHl0.js +1 -0
  288. package/site/dist/assets/secp256k1-DsxXqbXv.js +1 -0
  289. package/site/dist/assets/secp256k1-N9RUmafO.js +1 -0
  290. package/site/dist/assets/serializeAuthorizationList-DGMik9Wx.js +1 -0
  291. package/site/dist/assets/serializeSignature-CWKpxoab.js +2 -0
  292. package/site/dist/assets/sha2-C6s7zZmb.js +1 -0
  293. package/site/dist/assets/{shared-DRZUmnL5-MWD-C-pp.js → shared-DRZUmnL5-BewE5wK8.js} +33 -33
  294. package/site/dist/assets/{shared-FM0rljBt-c4eSjzGj.js → shared-FM0rljBt-CxLACri_.js} +6 -6
  295. package/site/dist/assets/shouldProceedtoEmbeddedWalletCreationFlow-B3vyavrh-BkAKsRNi.js +1 -0
  296. package/site/dist/assets/simulateTransaction-CfuOrae4-PjA_tGjX.js +1 -0
  297. package/site/dist/assets/smartphone-3p8nFSTE.js +1 -0
  298. package/site/dist/assets/src-BBjkfi-Q.js +1 -0
  299. package/site/dist/assets/storage-Ufl800Ne-1qCR2JMO.js +8 -0
  300. package/site/dist/assets/stringify-DqUj9VzO.js +20 -0
  301. package/site/dist/assets/stripe.esm-DEi2D291.js +2 -0
  302. package/site/dist/assets/styles-BsotlekN-Aq27nZGc.js +9 -0
  303. package/site/dist/assets/{styles-Cm9H63WO-Cv1TbqYi.js → styles-Cm9H63WO-p_ic_dxE.js} +17 -17
  304. package/site/dist/assets/{styles-DVyDvTdj-CI4xZNHp.js → styles-DVyDvTdj-CjsWqAld.js} +8 -8
  305. package/site/dist/assets/{styles-hslXy6xG-DeVcFoDD.js → styles-hslXy6xG-D5QHIrJU.js} +23 -23
  306. package/site/dist/assets/telegram-B-JqnkqZ-Dqkm4rDn.js +1 -0
  307. package/site/dist/assets/to-ui-error-DWe-qwS3-Bi1HUQI9.js +4 -0
  308. package/site/dist/assets/toViemAccount-B5iDGq1b-CdFZwv07.js +2 -0
  309. package/site/dist/assets/transaction-BNTP-bFm-M5tJx8vY.js +1 -0
  310. package/site/dist/assets/transfer-6YztDh-t-BVQkTvG-.js +1 -0
  311. package/site/dist/assets/transformers.web-BTyOEJ0C.js +40 -0
  312. package/site/dist/assets/transformers.web-CUZUFjAK.js +49 -0
  313. package/site/dist/assets/triangle-alert-BG3Qw-Hq.js +1 -0
  314. package/site/dist/assets/twitch-5IOe4sIQ-CaXHFlAu.js +1 -0
  315. package/site/dist/assets/types-4CuOD23i.js +1 -0
  316. package/site/dist/assets/use-headless-crypto-deposit-Yn-QRLB3-CQqeyhGY.js +1 -0
  317. package/site/dist/assets/use-unlink-wallet-BKK4_5Ur-C0xQN_Lp.js +1 -0
  318. package/site/dist/assets/useActiveWallet-B-yZYGc6-BkK6rFBm.js +123 -0
  319. package/site/dist/assets/useGetSolPrice-x7gfUIHJ-CLVXqv6I.js +1 -0
  320. package/site/dist/assets/useGetTokenPrice-CaoUkb79-DAXXs3rs.js +1 -0
  321. package/site/dist/assets/useI18n-C-5n_noF-CGpkgIVy.js +1 -0
  322. package/site/dist/assets/useWalletBalance-CZnP5f_f-Cfd64m4n.js +1 -0
  323. package/site/dist/assets/useWallets-X1ndvJ_U-CAYqg7Za.js +1 -0
  324. package/site/dist/assets/utils-BkR7EQjg.js +1 -0
  325. package/site/dist/assets/utils-DJhBNOZA.js +1 -0
  326. package/site/dist/assets/utils-DdckVfQr.js +1 -0
  327. package/site/dist/assets/w3m-modal-B4H_uiPH.js +1174 -0
  328. package/site/dist/assets/wallet-BNI12IYk.js +1 -0
  329. package/site/dist/assets/wallet-CITSaPlB.js +2 -0
  330. package/site/dist/assets/wallet-connect-BvJtUsDt-CVlSNIXP.js +1 -0
  331. package/site/dist/assets/walletconnect-registry-xxG8XLCb-BpzpBq5s.js +1 -0
  332. package/site/dist/assets/walletconnect-v2-3frQFwbg-CzZ6oybX.js +12 -0
  333. package/site/dist/assets/{index-CztIxJB6.js → wui-ux-by-reown-XyHdtV1O.js} +296 -296
  334. package/site/dist/assets/x-gjDrY2rk.js +1 -0
  335. package/site/dist/index.html +5 -117
  336. package/site/worker.js +6 -30
  337. package/src/agent/mcp.js +47 -15
  338. package/src/agent/view-tools.js +3 -11
  339. package/src/agent/x402.js +3 -42
  340. package/src/discover/apps.js +37 -2
  341. package/src/discover/explore.js +19 -13
  342. package/src/publish/init.js +74 -0
  343. package/src/publish/ship.js +36 -79
  344. package/src/publish/view-cli.js +6 -3
  345. package/src/publish/view.js +27 -43
  346. package/template/.github/workflows/ship.yml +33 -0
  347. package/template/README.md +38 -0
  348. package/template/app.json +27 -0
  349. package/template/ci/ship.sh +21 -0
  350. package/template/eval/goals.md +7 -0
  351. package/template/eval/golden.jsonl +0 -0
  352. package/template/gitignore +3 -0
  353. package/template/package.json +8 -0
  354. package/site/dist/assets/AccountNotFoundScreen-C4njXc69-RUyAWRzV.js +0 -1
  355. package/site/dist/assets/AddFundsSelectionScreen-RAoCn7ej-ZV-LlYBe.js +0 -31
  356. package/site/dist/assets/Address-H8kD1d9O-CGQnt7Pu.js +0 -17
  357. package/site/dist/assets/AffirmativeConsentScreen-BG0MJxku-CKn2JLwq.js +0 -6
  358. package/site/dist/assets/AllowlistRejectionScreen-Cae6e1Od-9oIP9fma.js +0 -1
  359. package/site/dist/assets/ArrowsRightLeftIcon-BEhBD_6N.js +0 -1
  360. package/site/dist/assets/AuthenticateWithWalletScreen-CU6hIcFT-D1wLlSJs.js +0 -1
  361. package/site/dist/assets/AwaitingEvmToSolBridgingScreen-D0e_sZMS-CSBbHTyz.js +0 -1
  362. package/site/dist/assets/AwaitingExternalEthereumTransferScreen-ur5HL4R7-BsRq-xBt.js +0 -1
  363. package/site/dist/assets/AwaitingPasswordlessCodeScreen-DRHz76mM-BPdhsKvN.js +0 -103
  364. package/site/dist/assets/AwaitingSolToEvmBridgingScreen-CdLRrGD2-CEGNdrkr.js +0 -1
  365. package/site/dist/assets/BridgeNetworkSelectionView-CFGjB2nO-Da9P7eSx.js +0 -68
  366. package/site/dist/assets/CaptchaScreen-DbpvkIGx-BecgMnD_.js +0 -1
  367. package/site/dist/assets/CheckCircleIcon-DBiWFjO6.js +0 -1
  368. package/site/dist/assets/CheckCircleIcon-DzG2ROJZ.js +0 -1
  369. package/site/dist/assets/Checkbox-D1EDeo41-DMHcj9o_.js +0 -52
  370. package/site/dist/assets/ChevronDownIcon-2Os56gUt.js +0 -1
  371. package/site/dist/assets/Chip-CZKIKt9K-BWzs9fj5.js +0 -26
  372. package/site/dist/assets/CoinbaseOnrampStatusScreen-BbyCJDXL-CFvcSiDs.js +0 -16
  373. package/site/dist/assets/ConnectEmailForm-B-VRE0MN-BozkCg8q.js +0 -3
  374. package/site/dist/assets/ConnectLedgerScreen-DWHABGot-DaCnbBzh.js +0 -10
  375. package/site/dist/assets/ConnectOnlyLandingScreen-CZYx9Bmp-DUkCLkxD.js +0 -1
  376. package/site/dist/assets/ConnectOnlyStatusScreen-DCRzjxHx-Dv_5nMkZ.js +0 -1
  377. package/site/dist/assets/ConnectOrCreateScreen-CUUYUO07-DSGEeB3Y.js +0 -1
  378. package/site/dist/assets/ConnectPhoneForm-Dek5xn4C-C-s4s_Lq.js +0 -95
  379. package/site/dist/assets/ConnectWalletView-DqI-PTvX-BKX7fdYr.js +0 -74
  380. package/site/dist/assets/ConnectionStatusScreen-fUfROm9m-DSoAuMFZ.js +0 -7
  381. package/site/dist/assets/CopyToClipboard-i_OQSBJr-CZTXyfV0.js +0 -39
  382. package/site/dist/assets/CopyableText-CQapvaMr-DHO818I0.js +0 -28
  383. package/site/dist/assets/CrossAppAuthScreen-CLw7ymZq-DW4nRGfz.js +0 -1
  384. package/site/dist/assets/CustomLandingScreenView-Cm_MBSyX-DH8Nnb4Y.js +0 -22
  385. package/site/dist/assets/DelegatedActionsConsentScreen-DYF2U4y5-gfUS_uV5.js +0 -1
  386. package/site/dist/assets/DelegatedActionsRevokeScreen-bPp6Uwyh-DZj9HTHc.js +0 -1
  387. package/site/dist/assets/DepositAddressAddressStepView-4vdkb55L-eHYsDK9W.js +0 -187
  388. package/site/dist/assets/DepositAddressScreen-DBLRs7aI-DK_XVgVk.js +0 -8
  389. package/site/dist/assets/DepositAddressV3Screen-CDqIEMQw-6gRZzhLe.js +0 -1
  390. package/site/dist/assets/EmbeddedWalletConnectingScreen-D4T7DUzs-BZu2ae0k.js +0 -1
  391. package/site/dist/assets/EmbeddedWalletCreatedScreen-D7WhW5ve-86pviemJ.js +0 -1
  392. package/site/dist/assets/EmbeddedWalletKeyExportScreen-CqV4NYQ3-vDcvT53Y.js +0 -23
  393. package/site/dist/assets/EmbeddedWalletOnAccountCreateScreen-BoKb3Q2S-rNJAtSJc.js +0 -1
  394. package/site/dist/assets/EmbeddedWalletPasswordUpdateScreen-D3rMlqS7-I8Q95280.js +0 -1
  395. package/site/dist/assets/EmbeddedWalletPasswordUpdateSplashScreen-BPFkWJeE-Coi7OxoI.js +0 -1
  396. package/site/dist/assets/EnrollTotp-Dibew4dp-DC7FrDgo.js +0 -66
  397. package/site/dist/assets/EnvelopeIcon-DY6ERnW7.js +0 -1
  398. package/site/dist/assets/ErrorBanner-BcpGRt0h-BvESwN99.js +0 -21
  399. package/site/dist/assets/ErrorScreen-DipdTWzE-DnKGxH1Z.js +0 -4
  400. package/site/dist/assets/ExclamationCircleIcon-BZhlqH0r.js +0 -1
  401. package/site/dist/assets/ExclamationTriangleIcon-CkAOJIYV.js +0 -1
  402. package/site/dist/assets/FarcasterConnectStatusScreen-51tjUxqq-4pi7jooW.js +0 -75
  403. package/site/dist/assets/FarcasterSignerStatusScreen-6x-Uh95G-z2XCMaLL.js +0 -28
  404. package/site/dist/assets/FiatOnrampScreen-BAhYeiTI-CBVA9v1-.js +0 -491
  405. package/site/dist/assets/FingerPrintIcon-ra2dqmJO.js +0 -1
  406. package/site/dist/assets/FundSolWalletWithExternalSolanaWallet-WtLwYaOl-DwAwc6Ny.js +0 -1
  407. package/site/dist/assets/FundWalletMethodHeader-BWNkokCT-CZszQsZf.js +0 -1
  408. package/site/dist/assets/FundWithBankDepositScreen-DajkHxBD-DfX6nvFQ.js +0 -58
  409. package/site/dist/assets/FundingEditAmountScreen-CpvpiO4M-CDS_sk_t.js +0 -1
  410. package/site/dist/assets/FundingMethodSelectionScreen-Db7vhRlE-CPfNQemT.js +0 -1
  411. package/site/dist/assets/GlobeAltIcon-SEUEIe_E.js +0 -1
  412. package/site/dist/assets/GooglePay-B53WnudL-aap7zwag.js +0 -1
  413. package/site/dist/assets/HCaptchaWrapper-CUi9LJsp-DgSjCjQI.js +0 -4
  414. package/site/dist/assets/InAppBrowserLoginNotPossible-BMR9br1T-DO4wICml.js +0 -1
  415. package/site/dist/assets/InfoBanner-Cb3p1z12-CDWt2ADo.js +0 -22
  416. package/site/dist/assets/InjectedWalletIcon-DLcYOGDj-Ba19XoBr.js +0 -1
  417. package/site/dist/assets/InstallWalletScreen-DTA8dwLv-DGpewEch.js +0 -1
  418. package/site/dist/assets/LandingScreen-CGWUoSUG-CUOCWUXd.js +0 -1
  419. package/site/dist/assets/Link-BdDilT2T-BYiP1zvW.js +0 -40
  420. package/site/dist/assets/LinkConflictScreen-C3ZEPsgl-Tb6cAepT.js +0 -77
  421. package/site/dist/assets/LinkEmailScreen-dKo9frwc-pq0NF2JO.js +0 -1
  422. package/site/dist/assets/LinkPasskeyScreen-zbrl_AI_-D9MOmDqg.js +0 -117
  423. package/site/dist/assets/LinkPhoneScreen-oIUpfj0w-B80UJqAZ.js +0 -1
  424. package/site/dist/assets/LockClosedIcon-BqkoEL9J.js +0 -1
  425. package/site/dist/assets/LoginFailedScreen-CN0dJV6U-DlnOM-Kh.js +0 -1
  426. package/site/dist/assets/ManualTransferScreen-CHqcuqbs-DSShupq9.js +0 -1
  427. package/site/dist/assets/MfaAuthEnrollmentFlowScreen-Dj7gPTRC-DUPV_SLA.js +0 -1
  428. package/site/dist/assets/MfaAuthVerifyFlowScreen-DbFpyWMy-D96GpzXX.js +0 -1
  429. package/site/dist/assets/MfaEnrollmentFlowScreen-DhLnGgnr-CYQDa4ND.js +0 -1
  430. package/site/dist/assets/MfaVerifyFlowScreen-C_XPjMRP-CJtSAXGN.js +0 -1
  431. package/site/dist/assets/ModalFooter-BCuEK_nz-D2I8KWtk.js +0 -403
  432. package/site/dist/assets/MoonpayStatusScreen-CzTUtokc-Bx5aHy-z.js +0 -16
  433. package/site/dist/assets/OAuthStatusScreen-ufbOa-da-CS6988X2.js +0 -1
  434. package/site/dist/assets/OpenLink-CUpJ1mOr-EZWVSX2r.js +0 -39
  435. package/site/dist/assets/PasskeySelectSignupOrLogin-xh2ScC_l-BY4eK5Jh.js +0 -1
  436. package/site/dist/assets/PasskeyStatusScreen-Bla8MaOk-LXys76u9.js +0 -6
  437. package/site/dist/assets/PasswordRecoveryScreen-awGXZkQk-RczvLvmo.js +0 -20
  438. package/site/dist/assets/PhArrowClockwise-mOiWYLMV.js +0 -14
  439. package/site/dist/assets/PhArrowDown-CkoOD89h.js +0 -14
  440. package/site/dist/assets/PhArrowLeft-C0jlxVhM.js +0 -14
  441. package/site/dist/assets/PhArrowRight-BI-V03Xf.js +0 -14
  442. package/site/dist/assets/PhArrowUp-izKvURUW.js +0 -14
  443. package/site/dist/assets/PhArrowUpRight-Bn-JhHsY.js +0 -14
  444. package/site/dist/assets/PhArrowsLeftRight-CYsRQ2qh.js +0 -14
  445. package/site/dist/assets/PhBrowser-BjzAmrHO.js +0 -14
  446. package/site/dist/assets/PhCaretDown-ddSjwcwm.js +0 -14
  447. package/site/dist/assets/PhCaretLeft-B7YLoNEF.js +0 -14
  448. package/site/dist/assets/PhCaretRight-BY8D5MIg.js +0 -14
  449. package/site/dist/assets/PhCaretUp-BG10nSut.js +0 -14
  450. package/site/dist/assets/PhCheck-DrKd7pBC.js +0 -14
  451. package/site/dist/assets/PhClock-Sj17weCB.js +0 -14
  452. package/site/dist/assets/PhCopy-rgttky8E.js +0 -14
  453. package/site/dist/assets/PhDeviceMobile-CnybhXY-.js +0 -14
  454. package/site/dist/assets/PhDotsThree-CSAEcba1.js +0 -14
  455. package/site/dist/assets/PhEnvelope-SmaNeXoQ.js +0 -14
  456. package/site/dist/assets/PhFunnelSimple-DKx35ITq.js +0 -14
  457. package/site/dist/assets/PhMagnifyingGlass-B6D0sWFL.js +0 -14
  458. package/site/dist/assets/PhPlus-CBvZvLax.js +0 -14
  459. package/site/dist/assets/PhWarningCircle-Cm58gXb9.js +0 -14
  460. package/site/dist/assets/PhX-C3b4cCEy.js +0 -14
  461. package/site/dist/assets/PhoneIcon-CzbssTb8.js +0 -1
  462. package/site/dist/assets/PinInput-DbZ0b1i1-1DtLWL81.js +0 -247
  463. package/site/dist/assets/QrCode-DbnZwlkH-ChwcUk_h.js +0 -22
  464. package/site/dist/assets/RecoveryOAuthStatusScreen-CsgtTI2x-C79jd345.js +0 -1
  465. package/site/dist/assets/RecoveryPasswordCreateScreen-Be-qJ-LU-C9c0x-yq.js +0 -1
  466. package/site/dist/assets/RecoverySelectionScreen-D1iGtpmi-PNqHb6CI.js +0 -7
  467. package/site/dist/assets/ScreenLayout-OwaQQcxH-B4Z8FjFp.js +0 -1
  468. package/site/dist/assets/SetAutomaticRecoveryScreen-BO_OEqAZ-CUpQZ9wq.js +0 -14
  469. package/site/dist/assets/SetWalletPasswordForm-DwCTVtAh-ZzvPLj2s.js +0 -15
  470. package/site/dist/assets/ShieldCheckIcon-Bjwe_-PV.js +0 -1
  471. package/site/dist/assets/SignRequestScreen-BHKv32KR-0qGeNipB.js +0 -26
  472. package/site/dist/assets/StandardSignAndSendTransactionScreen-CfhIXVtd-C3lgJb68.js +0 -20
  473. package/site/dist/assets/TelegramAuthScreen-UL9zLfO8-l35_C2DG.js +0 -1
  474. package/site/dist/assets/TodoList-DnyULl18-JxWWU9KA.js +0 -36
  475. package/site/dist/assets/TransactionDetails-e9nesl30-C91nJPM9.js +0 -109
  476. package/site/dist/assets/TransactionErrorView-BDBNqA_f-Cpm-4xzm.js +0 -178
  477. package/site/dist/assets/TransferFromWalletScreen-Qvn1Yuno-BWCH7-Si.js +0 -31
  478. package/site/dist/assets/TransferOrBridgeLoadingScreen-Dl1I_iIz-BWMeJabk.js +0 -6
  479. package/site/dist/assets/TurnstileWrapper-B7sNddys-Dgr80Gih.js +0 -1
  480. package/site/dist/assets/UpdateEmailScreen-DVOhPV0H-Clk4zk-8.js +0 -1
  481. package/site/dist/assets/UpdatePhoneScreen-CXRswTNZ-BgRsoR3B.js +0 -1
  482. package/site/dist/assets/UserLimitReachedScreen-5we2DHn8-D-SU-vAz.js +0 -1
  483. package/site/dist/assets/WalletCards-DH1rqayz-UuZ4i_Ze.js +0 -1
  484. package/site/dist/assets/WalletIcon-B1i03Vqc.js +0 -1
  485. package/site/dist/assets/WalletInfoCard-sq_2wgFg-TXTxmb8L.js +0 -29
  486. package/site/dist/assets/WalletInterstitialScreen-Sh7LfsAh-CbrFb0ON.js +0 -1
  487. package/site/dist/assets/WalletLink-DK5LB5Ha-BYQZV7UV.js +0 -20
  488. package/site/dist/assets/WalletOverflowButton-bfCnp-9T-CNgSPnTS.js +0 -1
  489. package/site/dist/assets/WarningBanner-ZZqCEtZK-DNZUUOph.js +0 -21
  490. package/site/dist/assets/__vite-browser-external-BIHI7g3E.js +0 -1
  491. package/site/dist/assets/analytics-mkkvFRju-DOXuftJB.js +0 -1
  492. package/site/dist/assets/basic-C9wn6QoQ.js +0 -1575
  493. package/site/dist/assets/bytes-CjWw8TJh.js +0 -1
  494. package/site/dist/assets/capitalizeFirstLetter-DmLYqXsO-tV1Idewc.js +0 -1
  495. package/site/dist/assets/ccip-BhHEqVIW.js +0 -1
  496. package/site/dist/assets/check-C_DTyjLS.js +0 -1
  497. package/site/dist/assets/chevron-down-iklXXH-z.js +0 -1
  498. package/site/dist/assets/circle-alert-KEOUF48T.js +0 -1
  499. package/site/dist/assets/circle-check-big-BJ_ADwB4.js +0 -1
  500. package/site/dist/assets/circle-x-BSfWmhYk.js +0 -1
  501. package/site/dist/assets/client-BnDcP42J.js +0 -9
  502. package/site/dist/assets/client-DH86IrJA.js +0 -125
  503. package/site/dist/assets/coinbase-DCPC2L_R-2ivYfoMv.js +0 -3
  504. package/site/dist/assets/copy-sK00DOfH.js +0 -1
  505. package/site/dist/assets/core-CRE213RM.js +0 -211
  506. package/site/dist/assets/createLucideIcon-D9OK_uxG.js +0 -1
  507. package/site/dist/assets/custom-V1wex-Di.js +0 -1
  508. package/site/dist/assets/dijkstra-COg3n3zL.js +0 -1
  509. package/site/dist/assets/embed.worker-BRIYO7m8.js +0 -1
  510. package/site/dist/assets/encodePacked-DyXYq3Cc.js +0 -1
  511. package/site/dist/assets/ethers-zTjbodk5-DSYOi6tU.js +0 -1
  512. package/site/dist/assets/external-link-Cdp8NBio.js +0 -1
  513. package/site/dist/assets/fallback-DiFue5Zm.js +0 -1
  514. package/site/dist/assets/farcaster-DPlSjvF5-DP2DLoHZ.js +0 -1
  515. package/site/dist/assets/features-B6BTj_BL.js +0 -5
  516. package/site/dist/assets/fingerprint-pattern-gFJTz5e4.js +0 -1
  517. package/site/dist/assets/floating-ui.react-D9ndYqYK.js +0 -1
  518. package/site/dist/assets/floating-ui.react-dom-CNbOgOFt.js +0 -1
  519. package/site/dist/assets/formatErc20TokenAmount-BuPk9xcy-CkAr4Oc0.js +0 -1
  520. package/site/dist/assets/getChainName-DjpPdUSc-c2urPd0g.js +0 -1
  521. package/site/dist/assets/getErc20Balance-jXNpFf0N-mFQ9Iqk-.js +0 -1
  522. package/site/dist/assets/getErc20TokenInfo-BNTrzLMP-Dx5he_uG.js +0 -1
  523. package/site/dist/assets/getFormattedUsdFromLamports-De3U9GlO-C446pzMl.js +0 -1
  524. package/site/dist/assets/getTransactionCount-80UHlwAV.js +0 -1
  525. package/site/dist/assets/getUsdcMintAddress-BVgm9GRo-FDalV59C.js +0 -1
  526. package/site/dist/assets/hashTypedData-Beq57Ogb.js +0 -22
  527. package/site/dist/assets/hooks.module-ClpaQ1Tg.js +0 -1
  528. package/site/dist/assets/hourglass-CB7z_I9H.js +0 -1
  529. package/site/dist/assets/http-BocEfKYb.js +0 -19
  530. package/site/dist/assets/index-0knDOgU9.js +0 -1
  531. package/site/dist/assets/index-9jNeS_nC.js +0 -1
  532. package/site/dist/assets/index-B--T-Fmt.js +0 -16
  533. package/site/dist/assets/index-BDkarAkX.js +0 -2
  534. package/site/dist/assets/index-BMfMy017.js +0 -679
  535. package/site/dist/assets/index-BOd8jv8-.js +0 -1
  536. package/site/dist/assets/index-BdEw5wyl-2VGMzHIs.js +0 -1
  537. package/site/dist/assets/index-C8ThRelw.js +0 -9
  538. package/site/dist/assets/index-D4LdLFDC.js +0 -1
  539. package/site/dist/assets/index-D6T-s6sR.js +0 -1
  540. package/site/dist/assets/index-D7396TWe.js +0 -1
  541. package/site/dist/assets/index-DdxtHe81.js +0 -2
  542. package/site/dist/assets/index-DvMddJcd-D7AEQrzj.js +0 -12
  543. package/site/dist/assets/index-nibyPLVP.js +0 -1
  544. package/site/dist/assets/index.browser-B6Bt5URJ.js +0 -1
  545. package/site/dist/assets/isPaymentRequestAvailable-Bq1cemEn-D7xtzRqA.js +0 -1
  546. package/site/dist/assets/landmark-CMLKifhk.js +0 -1
  547. package/site/dist/assets/lock-BkyjNE8h.js +0 -1
  548. package/site/dist/assets/mail-B6-Tq9Ld.js +0 -1
  549. package/site/dist/assets/native-CJ5et6AR.js +0 -1
  550. package/site/dist/assets/nonceManager-zkW7cM66.js +0 -1
  551. package/site/dist/assets/parseEther-C7aOvuze.js +0 -1
  552. package/site/dist/assets/parseSignature-BIjcuWdB.js +0 -1
  553. package/site/dist/assets/preload-helper-PPVm8Dsz.js +0 -1
  554. package/site/dist/assets/privateKeyToAccount-CRvvpHWf.js +0 -1
  555. package/site/dist/assets/property-CnFDNXw5.js +0 -3
  556. package/site/dist/assets/react-auth_false-DedQs79w.js +0 -1
  557. package/site/dist/assets/reservoir-x-nGuZkT-DFxAFt2v.js +0 -1
  558. package/site/dist/assets/roles-DV_6FRBZ.js +0 -1
  559. package/site/dist/assets/safe-url-D7SRPu33-A8zMgOTd.js +0 -1
  560. package/site/dist/assets/serializeErc6492Signature-CeJeL3h6.js +0 -1
  561. package/site/dist/assets/serializeTransaction-L-_Ej-jW.js +0 -8
  562. package/site/dist/assets/shouldProceedtoEmbeddedWalletCreationFlow-B3vyavrh-CF2QteTJ.js +0 -1
  563. package/site/dist/assets/simulateTransaction-CfuOrae4-BHUMPf6Q.js +0 -1
  564. package/site/dist/assets/smartphone-DAN5rY0T.js +0 -1
  565. package/site/dist/assets/stripe.esm-Dv8C3q95.js +0 -2
  566. package/site/dist/assets/styles-BsotlekN-Cjuu2SDV.js +0 -9
  567. package/site/dist/assets/telegram-B-JqnkqZ-DTjJLkIF.js +0 -1
  568. package/site/dist/assets/to-ui-error-DWe-qwS3-Dx3yzcV0.js +0 -4
  569. package/site/dist/assets/toAccount-Bq6rbpbI.js +0 -1
  570. package/site/dist/assets/transaction-BNTP-bFm-CrebgH-D.js +0 -1
  571. package/site/dist/assets/transactionReceipt-BwJl-gjg.js +0 -1
  572. package/site/dist/assets/transfer-6YztDh-t-DU6hH7CZ.js +0 -1
  573. package/site/dist/assets/transformers.web-BEKVh7pD.js +0 -40
  574. package/site/dist/assets/transformers.web-aWa49tv1.js +0 -40
  575. package/site/dist/assets/triangle-alert-ndoiBs4y.js +0 -1
  576. package/site/dist/assets/twitch-5IOe4sIQ-BXviIywg.js +0 -1
  577. package/site/dist/assets/useGetSolPrice-x7gfUIHJ-C7axYJ--.js +0 -1
  578. package/site/dist/assets/useGetTokenPrice-CaoUkb79-CR4CrguU.js +0 -1
  579. package/site/dist/assets/useI18n-C-5n_noF-C_t8QqBJ.js +0 -1
  580. package/site/dist/assets/useWalletBalance-CZnP5f_f-BnSHLVI_.js +0 -1
  581. package/site/dist/assets/w3m-modal-Bz5KWTQ-.js +0 -1174
  582. package/site/dist/assets/wallet-DTM31trz.js +0 -2
  583. package/site/dist/assets/wallet-UESEqPei.js +0 -1
  584. package/site/dist/assets/wallet-connect-BvJtUsDt-CnvUnFbz.js +0 -1
  585. package/site/dist/assets/walletconnect-v2-3frQFwbg-CzQk99gS.js +0 -15
  586. package/site/dist/assets/x-B2_XdOVQ.js +0 -1
@@ -1,125 +0,0 @@
1
- import{k as ie,t as la}from"./serializeTransaction-L-_Ej-jW.js";import{e as Yc}from"./encodePacked-DyXYq3Cc.js";import{p as Xc}from"./privateKeyToAccount-CRvvpHWf.js";import{G as Ii}from"./hashTypedData-Beq57Ogb.js";import{p as Jc}from"./parseSignature-BIjcuWdB.js";import"./toAccount-Bq6rbpbI.js";var Te={},Rn={},Ji;function Zc(){if(Ji)return Rn;Ji=1,Rn.byteLength=r,Rn.toByteArray=g,Rn.fromByteArray=F;for(var i=[],t=[],n=typeof Uint8Array<"u"?Uint8Array:Array,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=e.length;o<s;++o)i[o]=e[o],t[e.charCodeAt(o)]=o;t[45]=62,t[95]=63;function u(I){var k=I.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var z=I.indexOf("=");z===-1&&(z=k);var S=z===k?0:4-z%4;return[z,S]}function r(I){var k=u(I),z=k[0],S=k[1];return(z+S)*3/4-S}function b(I,k,z){return(k+z)*3/4-z}function g(I){var k,z=u(I),S=z[0],G=z[1],U=new n(b(I,S,G)),rt=0,H=G>0?S-4:S,lt;for(lt=0;lt<H;lt+=4)k=t[I.charCodeAt(lt)]<<18|t[I.charCodeAt(lt+1)]<<12|t[I.charCodeAt(lt+2)]<<6|t[I.charCodeAt(lt+3)],U[rt++]=k>>16&255,U[rt++]=k>>8&255,U[rt++]=k&255;return G===2&&(k=t[I.charCodeAt(lt)]<<2|t[I.charCodeAt(lt+1)]>>4,U[rt++]=k&255),G===1&&(k=t[I.charCodeAt(lt)]<<10|t[I.charCodeAt(lt+1)]<<4|t[I.charCodeAt(lt+2)]>>2,U[rt++]=k>>8&255,U[rt++]=k&255),U}function l(I){return i[I>>18&63]+i[I>>12&63]+i[I>>6&63]+i[I&63]}function x(I,k,z){for(var S,G=[],U=k;U<z;U+=3)S=(I[U]<<16&16711680)+(I[U+1]<<8&65280)+(I[U+2]&255),G.push(l(S));return G.join("")}function F(I){for(var k,z=I.length,S=z%3,G=[],U=16383,rt=0,H=z-S;rt<H;rt+=U)G.push(x(I,rt,rt+U>H?H:rt+U));return S===1?(k=I[z-1],G.push(i[k>>2]+i[k<<4&63]+"==")):S===2&&(k=(I[z-2]<<8)+I[z-1],G.push(i[k>>10]+i[k>>4&63]+i[k<<2&63]+"=")),G.join("")}return Rn}var fe={};var Zi;function Wc(){return Zi||(Zi=1,fe.read=function(i,t,n,e,o){var s,u,r=o*8-e-1,b=(1<<r)-1,g=b>>1,l=-7,x=n?o-1:0,F=n?-1:1,I=i[t+x];for(x+=F,s=I&(1<<-l)-1,I>>=-l,l+=r;l>0;s=s*256+i[t+x],x+=F,l-=8);for(u=s&(1<<-l)-1,s>>=-l,l+=e;l>0;u=u*256+i[t+x],x+=F,l-=8);if(s===0)s=1-g;else{if(s===b)return u?NaN:(I?-1:1)*(1/0);u=u+Math.pow(2,e),s=s-g}return(I?-1:1)*u*Math.pow(2,s-e)},fe.write=function(i,t,n,e,o,s){var u,r,b,g=s*8-o-1,l=(1<<g)-1,x=l>>1,F=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=e?0:s-1,k=e?1:-1,z=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(r=isNaN(t)?1:0,u=l):(u=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-u))<1&&(u--,b*=2),u+x>=1?t+=F/b:t+=F*Math.pow(2,1-x),t*b>=2&&(u++,b/=2),u+x>=l?(r=0,u=l):u+x>=1?(r=(t*b-1)*Math.pow(2,o),u=u+x):(r=t*Math.pow(2,x-1)*Math.pow(2,o),u=0));o>=8;i[n+I]=r&255,I+=k,r/=256,o-=8);for(u=u<<o|r,g+=o;g>0;i[n+I]=u&255,I+=k,u/=256,g-=8);i[n+I-k]|=z*128}),fe}var Wi;function $c(){return Wi||(Wi=1,(function(i){const t=Zc(),n=Wc(),e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=r,i.SlowBuffer=U,i.INSPECT_MAX_BYTES=50;const o=2147483647;i.kMaxLength=o,r.TYPED_ARRAY_SUPPORT=s(),!r.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const B=new Uint8Array(1),p={foo:function(){return 42}};return Object.setPrototypeOf(p,Uint8Array.prototype),Object.setPrototypeOf(B,p),B.foo()===42}catch{return!1}}Object.defineProperty(r.prototype,"parent",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.buffer}}),Object.defineProperty(r.prototype,"offset",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.byteOffset}});function u(B){if(B>o)throw new RangeError('The value "'+B+'" is invalid for option "size"');const p=new Uint8Array(B);return Object.setPrototypeOf(p,r.prototype),p}function r(B,p,y){if(typeof B=="number"){if(typeof p=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return x(B)}return b(B,p,y)}r.poolSize=8192;function b(B,p,y){if(typeof B=="string")return F(B,p);if(ArrayBuffer.isView(B))return k(B);if(B==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(It(B,ArrayBuffer)||B&&It(B.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(It(B,SharedArrayBuffer)||B&&It(B.buffer,SharedArrayBuffer)))return z(B,p,y);if(typeof B=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const M=B.valueOf&&B.valueOf();if(M!=null&&M!==B)return r.from(M,p,y);const D=S(B);if(D)return D;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]=="function")return r.from(B[Symbol.toPrimitive]("string"),p,y);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}r.from=function(B,p,y){return b(B,p,y)},Object.setPrototypeOf(r.prototype,Uint8Array.prototype),Object.setPrototypeOf(r,Uint8Array);function g(B){if(typeof B!="number")throw new TypeError('"size" argument must be of type number');if(B<0)throw new RangeError('The value "'+B+'" is invalid for option "size"')}function l(B,p,y){return g(B),B<=0?u(B):p!==void 0?typeof y=="string"?u(B).fill(p,y):u(B).fill(p):u(B)}r.alloc=function(B,p,y){return l(B,p,y)};function x(B){return g(B),u(B<0?0:G(B)|0)}r.allocUnsafe=function(B){return x(B)},r.allocUnsafeSlow=function(B){return x(B)};function F(B,p){if((typeof p!="string"||p==="")&&(p="utf8"),!r.isEncoding(p))throw new TypeError("Unknown encoding: "+p);const y=rt(B,p)|0;let M=u(y);const D=M.write(B,p);return D!==y&&(M=M.slice(0,D)),M}function I(B){const p=B.length<0?0:G(B.length)|0,y=u(p);for(let M=0;M<p;M+=1)y[M]=B[M]&255;return y}function k(B){if(It(B,Uint8Array)){const p=new Uint8Array(B);return z(p.buffer,p.byteOffset,p.byteLength)}return I(B)}function z(B,p,y){if(p<0||B.byteLength<p)throw new RangeError('"offset" is outside of buffer bounds');if(B.byteLength<p+(y||0))throw new RangeError('"length" is outside of buffer bounds');let M;return p===void 0&&y===void 0?M=new Uint8Array(B):y===void 0?M=new Uint8Array(B,p):M=new Uint8Array(B,p,y),Object.setPrototypeOf(M,r.prototype),M}function S(B){if(r.isBuffer(B)){const p=G(B.length)|0,y=u(p);return y.length===0||B.copy(y,0,0,p),y}if(B.length!==void 0)return typeof B.length!="number"||vt(B.length)?u(0):I(B);if(B.type==="Buffer"&&Array.isArray(B.data))return I(B.data)}function G(B){if(B>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return B|0}function U(B){return+B!=B&&(B=0),r.alloc(+B)}r.isBuffer=function(p){return p!=null&&p._isBuffer===!0&&p!==r.prototype},r.compare=function(p,y){if(It(p,Uint8Array)&&(p=r.from(p,p.offset,p.byteLength)),It(y,Uint8Array)&&(y=r.from(y,y.offset,y.byteLength)),!r.isBuffer(p)||!r.isBuffer(y))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(p===y)return 0;let M=p.length,D=y.length;for(let j=0,P=Math.min(M,D);j<P;++j)if(p[j]!==y[j]){M=p[j],D=y[j];break}return M<D?-1:D<M?1:0},r.isEncoding=function(p){switch(String(p).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}},r.concat=function(p,y){if(!Array.isArray(p))throw new TypeError('"list" argument must be an Array of Buffers');if(p.length===0)return r.alloc(0);let M;if(y===void 0)for(y=0,M=0;M<p.length;++M)y+=p[M].length;const D=r.allocUnsafe(y);let j=0;for(M=0;M<p.length;++M){let P=p[M];if(It(P,Uint8Array))j+P.length>D.length?(r.isBuffer(P)||(P=r.from(P)),P.copy(D,j)):Uint8Array.prototype.set.call(D,P,j);else if(r.isBuffer(P))P.copy(D,j);else throw new TypeError('"list" argument must be an Array of Buffers');j+=P.length}return D};function rt(B,p){if(r.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||It(B,ArrayBuffer))return B.byteLength;if(typeof B!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);const y=B.length,M=arguments.length>2&&arguments[2]===!0;if(!M&&y===0)return 0;let D=!1;for(;;)switch(p){case"ascii":case"latin1":case"binary":return y;case"utf8":case"utf-8":return pt(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y*2;case"hex":return y>>>1;case"base64":return At(B).length;default:if(D)return M?-1:pt(B).length;p=(""+p).toLowerCase(),D=!0}}r.byteLength=rt;function H(B,p,y){let M=!1;if((p===void 0||p<0)&&(p=0),p>this.length||((y===void 0||y>this.length)&&(y=this.length),y<=0)||(y>>>=0,p>>>=0,y<=p))return"";for(B||(B="utf8");;)switch(B){case"hex":return gt(this,p,y);case"utf8":case"utf-8":return T(this,p,y);case"ascii":return ct(this,p,y);case"latin1":case"binary":return J(this,p,y);case"base64":return C(this,p,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return et(this,p,y);default:if(M)throw new TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),M=!0}}r.prototype._isBuffer=!0;function lt(B,p,y){const M=B[p];B[p]=B[y],B[y]=M}r.prototype.swap16=function(){const p=this.length;if(p%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let y=0;y<p;y+=2)lt(this,y,y+1);return this},r.prototype.swap32=function(){const p=this.length;if(p%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let y=0;y<p;y+=4)lt(this,y,y+3),lt(this,y+1,y+2);return this},r.prototype.swap64=function(){const p=this.length;if(p%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let y=0;y<p;y+=8)lt(this,y,y+7),lt(this,y+1,y+6),lt(this,y+2,y+5),lt(this,y+3,y+4);return this},r.prototype.toString=function(){const p=this.length;return p===0?"":arguments.length===0?T(this,0,p):H.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(p){if(!r.isBuffer(p))throw new TypeError("Argument must be a Buffer");return this===p?!0:r.compare(this,p)===0},r.prototype.inspect=function(){let p="";const y=i.INSPECT_MAX_BYTES;return p=this.toString("hex",0,y).replace(/(.{2})/g,"$1 ").trim(),this.length>y&&(p+=" ... "),"<Buffer "+p+">"},e&&(r.prototype[e]=r.prototype.inspect),r.prototype.compare=function(p,y,M,D,j){if(It(p,Uint8Array)&&(p=r.from(p,p.offset,p.byteLength)),!r.isBuffer(p))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof p);if(y===void 0&&(y=0),M===void 0&&(M=p?p.length:0),D===void 0&&(D=0),j===void 0&&(j=this.length),y<0||M>p.length||D<0||j>this.length)throw new RangeError("out of range index");if(D>=j&&y>=M)return 0;if(D>=j)return-1;if(y>=M)return 1;if(y>>>=0,M>>>=0,D>>>=0,j>>>=0,this===p)return 0;let P=j-D,d=M-y;const f=Math.min(P,d),q=this.slice(D,j),N=p.slice(y,M);for(let v=0;v<f;++v)if(q[v]!==N[v]){P=q[v],d=N[v];break}return P<d?-1:d<P?1:0};function O(B,p,y,M,D){if(B.length===0)return-1;if(typeof y=="string"?(M=y,y=0):y>2147483647?y=2147483647:y<-2147483648&&(y=-2147483648),y=+y,vt(y)&&(y=D?0:B.length-1),y<0&&(y=B.length+y),y>=B.length){if(D)return-1;y=B.length-1}else if(y<0)if(D)y=0;else return-1;if(typeof p=="string"&&(p=r.from(p,M)),r.isBuffer(p))return p.length===0?-1:h(B,p,y,M,D);if(typeof p=="number")return p=p&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(B,p,y):Uint8Array.prototype.lastIndexOf.call(B,p,y):h(B,[p],y,M,D);throw new TypeError("val must be string, number or Buffer")}function h(B,p,y,M,D){let j=1,P=B.length,d=p.length;if(M!==void 0&&(M=String(M).toLowerCase(),M==="ucs2"||M==="ucs-2"||M==="utf16le"||M==="utf-16le")){if(B.length<2||p.length<2)return-1;j=2,P/=2,d/=2,y/=2}function f(N,v){return j===1?N[v]:N.readUInt16BE(v*j)}let q;if(D){let N=-1;for(q=y;q<P;q++)if(f(B,q)===f(p,N===-1?0:q-N)){if(N===-1&&(N=q),q-N+1===d)return N*j}else N!==-1&&(q-=q-N),N=-1}else for(y+d>P&&(y=P-d),q=y;q>=0;q--){let N=!0;for(let v=0;v<d;v++)if(f(B,q+v)!==f(p,v)){N=!1;break}if(N)return q}return-1}r.prototype.includes=function(p,y,M){return this.indexOf(p,y,M)!==-1},r.prototype.indexOf=function(p,y,M){return O(this,p,y,M,!0)},r.prototype.lastIndexOf=function(p,y,M){return O(this,p,y,M,!1)};function A(B,p,y,M){y=Number(y)||0;const D=B.length-y;M?(M=Number(M),M>D&&(M=D)):M=D;const j=p.length;M>j/2&&(M=j/2);let P;for(P=0;P<M;++P){const d=parseInt(p.substr(P*2,2),16);if(vt(d))return P;B[y+P]=d}return P}function Z(B,p,y,M){return _t(pt(p,B.length-y),B,y,M)}function tt(B,p,y,M){return _t(wt(p),B,y,M)}function at(B,p,y,M){return _t(At(p),B,y,M)}function R(B,p,y,M){return _t(Qt(p,B.length-y),B,y,M)}r.prototype.write=function(p,y,M,D){if(y===void 0)D="utf8",M=this.length,y=0;else if(M===void 0&&typeof y=="string")D=y,M=this.length,y=0;else if(isFinite(y))y=y>>>0,isFinite(M)?(M=M>>>0,D===void 0&&(D="utf8")):(D=M,M=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const j=this.length-y;if((M===void 0||M>j)&&(M=j),p.length>0&&(M<0||y<0)||y>this.length)throw new RangeError("Attempt to write outside buffer bounds");D||(D="utf8");let P=!1;for(;;)switch(D){case"hex":return A(this,p,y,M);case"utf8":case"utf-8":return Z(this,p,y,M);case"ascii":case"latin1":case"binary":return tt(this,p,y,M);case"base64":return at(this,p,y,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,p,y,M);default:if(P)throw new TypeError("Unknown encoding: "+D);D=(""+D).toLowerCase(),P=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(B,p,y){return p===0&&y===B.length?t.fromByteArray(B):t.fromByteArray(B.slice(p,y))}function T(B,p,y){y=Math.min(B.length,y);const M=[];let D=p;for(;D<y;){const j=B[D];let P=null,d=j>239?4:j>223?3:j>191?2:1;if(D+d<=y){let f,q,N,v;switch(d){case 1:j<128&&(P=j);break;case 2:f=B[D+1],(f&192)===128&&(v=(j&31)<<6|f&63,v>127&&(P=v));break;case 3:f=B[D+1],q=B[D+2],(f&192)===128&&(q&192)===128&&(v=(j&15)<<12|(f&63)<<6|q&63,v>2047&&(v<55296||v>57343)&&(P=v));break;case 4:f=B[D+1],q=B[D+2],N=B[D+3],(f&192)===128&&(q&192)===128&&(N&192)===128&&(v=(j&15)<<18|(f&63)<<12|(q&63)<<6|N&63,v>65535&&v<1114112&&(P=v))}}P===null?(P=65533,d=1):P>65535&&(P-=65536,M.push(P>>>10&1023|55296),P=56320|P&1023),M.push(P),D+=d}return ut(M)}const V=4096;function ut(B){const p=B.length;if(p<=V)return String.fromCharCode.apply(String,B);let y="",M=0;for(;M<p;)y+=String.fromCharCode.apply(String,B.slice(M,M+=V));return y}function ct(B,p,y){let M="";y=Math.min(B.length,y);for(let D=p;D<y;++D)M+=String.fromCharCode(B[D]&127);return M}function J(B,p,y){let M="";y=Math.min(B.length,y);for(let D=p;D<y;++D)M+=String.fromCharCode(B[D]);return M}function gt(B,p,y){const M=B.length;(!p||p<0)&&(p=0),(!y||y<0||y>M)&&(y=M);let D="";for(let j=p;j<y;++j)D+=zt[B[j]];return D}function et(B,p,y){const M=B.slice(p,y);let D="";for(let j=0;j<M.length-1;j+=2)D+=String.fromCharCode(M[j]+M[j+1]*256);return D}r.prototype.slice=function(p,y){const M=this.length;p=~~p,y=y===void 0?M:~~y,p<0?(p+=M,p<0&&(p=0)):p>M&&(p=M),y<0?(y+=M,y<0&&(y=0)):y>M&&(y=M),y<p&&(y=p);const D=this.subarray(p,y);return Object.setPrototypeOf(D,r.prototype),D};function st(B,p,y){if(B%1!==0||B<0)throw new RangeError("offset is not uint");if(B+p>y)throw new RangeError("Trying to access beyond buffer length")}r.prototype.readUintLE=r.prototype.readUIntLE=function(p,y,M){p=p>>>0,y=y>>>0,M||st(p,y,this.length);let D=this[p],j=1,P=0;for(;++P<y&&(j*=256);)D+=this[p+P]*j;return D},r.prototype.readUintBE=r.prototype.readUIntBE=function(p,y,M){p=p>>>0,y=y>>>0,M||st(p,y,this.length);let D=this[p+--y],j=1;for(;y>0&&(j*=256);)D+=this[p+--y]*j;return D},r.prototype.readUint8=r.prototype.readUInt8=function(p,y){return p=p>>>0,y||st(p,1,this.length),this[p]},r.prototype.readUint16LE=r.prototype.readUInt16LE=function(p,y){return p=p>>>0,y||st(p,2,this.length),this[p]|this[p+1]<<8},r.prototype.readUint16BE=r.prototype.readUInt16BE=function(p,y){return p=p>>>0,y||st(p,2,this.length),this[p]<<8|this[p+1]},r.prototype.readUint32LE=r.prototype.readUInt32LE=function(p,y){return p=p>>>0,y||st(p,4,this.length),(this[p]|this[p+1]<<8|this[p+2]<<16)+this[p+3]*16777216},r.prototype.readUint32BE=r.prototype.readUInt32BE=function(p,y){return p=p>>>0,y||st(p,4,this.length),this[p]*16777216+(this[p+1]<<16|this[p+2]<<8|this[p+3])},r.prototype.readBigUInt64LE=Gt(function(p){p=p>>>0,nt(p,"offset");const y=this[p],M=this[p+7];(y===void 0||M===void 0)&&X(p,this.length-8);const D=y+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24,j=this[++p]+this[++p]*2**8+this[++p]*2**16+M*2**24;return BigInt(D)+(BigInt(j)<<BigInt(32))}),r.prototype.readBigUInt64BE=Gt(function(p){p=p>>>0,nt(p,"offset");const y=this[p],M=this[p+7];(y===void 0||M===void 0)&&X(p,this.length-8);const D=y*2**24+this[++p]*2**16+this[++p]*2**8+this[++p],j=this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+M;return(BigInt(D)<<BigInt(32))+BigInt(j)}),r.prototype.readIntLE=function(p,y,M){p=p>>>0,y=y>>>0,M||st(p,y,this.length);let D=this[p],j=1,P=0;for(;++P<y&&(j*=256);)D+=this[p+P]*j;return j*=128,D>=j&&(D-=Math.pow(2,8*y)),D},r.prototype.readIntBE=function(p,y,M){p=p>>>0,y=y>>>0,M||st(p,y,this.length);let D=y,j=1,P=this[p+--D];for(;D>0&&(j*=256);)P+=this[p+--D]*j;return j*=128,P>=j&&(P-=Math.pow(2,8*y)),P},r.prototype.readInt8=function(p,y){return p=p>>>0,y||st(p,1,this.length),this[p]&128?(255-this[p]+1)*-1:this[p]},r.prototype.readInt16LE=function(p,y){p=p>>>0,y||st(p,2,this.length);const M=this[p]|this[p+1]<<8;return M&32768?M|4294901760:M},r.prototype.readInt16BE=function(p,y){p=p>>>0,y||st(p,2,this.length);const M=this[p+1]|this[p]<<8;return M&32768?M|4294901760:M},r.prototype.readInt32LE=function(p,y){return p=p>>>0,y||st(p,4,this.length),this[p]|this[p+1]<<8|this[p+2]<<16|this[p+3]<<24},r.prototype.readInt32BE=function(p,y){return p=p>>>0,y||st(p,4,this.length),this[p]<<24|this[p+1]<<16|this[p+2]<<8|this[p+3]},r.prototype.readBigInt64LE=Gt(function(p){p=p>>>0,nt(p,"offset");const y=this[p],M=this[p+7];(y===void 0||M===void 0)&&X(p,this.length-8);const D=this[p+4]+this[p+5]*2**8+this[p+6]*2**16+(M<<24);return(BigInt(D)<<BigInt(32))+BigInt(y+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24)}),r.prototype.readBigInt64BE=Gt(function(p){p=p>>>0,nt(p,"offset");const y=this[p],M=this[p+7];(y===void 0||M===void 0)&&X(p,this.length-8);const D=(y<<24)+this[++p]*2**16+this[++p]*2**8+this[++p];return(BigInt(D)<<BigInt(32))+BigInt(this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+M)}),r.prototype.readFloatLE=function(p,y){return p=p>>>0,y||st(p,4,this.length),n.read(this,p,!0,23,4)},r.prototype.readFloatBE=function(p,y){return p=p>>>0,y||st(p,4,this.length),n.read(this,p,!1,23,4)},r.prototype.readDoubleLE=function(p,y){return p=p>>>0,y||st(p,8,this.length),n.read(this,p,!0,52,8)},r.prototype.readDoubleBE=function(p,y){return p=p>>>0,y||st(p,8,this.length),n.read(this,p,!1,52,8)};function Lt(B,p,y,M,D,j){if(!r.isBuffer(B))throw new TypeError('"buffer" argument must be a Buffer instance');if(p>D||p<j)throw new RangeError('"value" argument is out of bounds');if(y+M>B.length)throw new RangeError("Index out of range")}r.prototype.writeUintLE=r.prototype.writeUIntLE=function(p,y,M,D){if(p=+p,y=y>>>0,M=M>>>0,!D){const d=Math.pow(2,8*M)-1;Lt(this,p,y,M,d,0)}let j=1,P=0;for(this[y]=p&255;++P<M&&(j*=256);)this[y+P]=p/j&255;return y+M},r.prototype.writeUintBE=r.prototype.writeUIntBE=function(p,y,M,D){if(p=+p,y=y>>>0,M=M>>>0,!D){const d=Math.pow(2,8*M)-1;Lt(this,p,y,M,d,0)}let j=M-1,P=1;for(this[y+j]=p&255;--j>=0&&(P*=256);)this[y+j]=p/P&255;return y+M},r.prototype.writeUint8=r.prototype.writeUInt8=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,1,255,0),this[y]=p&255,y+1},r.prototype.writeUint16LE=r.prototype.writeUInt16LE=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,2,65535,0),this[y]=p&255,this[y+1]=p>>>8,y+2},r.prototype.writeUint16BE=r.prototype.writeUInt16BE=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,2,65535,0),this[y]=p>>>8,this[y+1]=p&255,y+2},r.prototype.writeUint32LE=r.prototype.writeUInt32LE=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,4,4294967295,0),this[y+3]=p>>>24,this[y+2]=p>>>16,this[y+1]=p>>>8,this[y]=p&255,y+4},r.prototype.writeUint32BE=r.prototype.writeUInt32BE=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,4,4294967295,0),this[y]=p>>>24,this[y+1]=p>>>16,this[y+2]=p>>>8,this[y+3]=p&255,y+4};function Ut(B,p,y,M,D){Q(p,M,D,B,y,7);let j=Number(p&BigInt(4294967295));B[y++]=j,j=j>>8,B[y++]=j,j=j>>8,B[y++]=j,j=j>>8,B[y++]=j;let P=Number(p>>BigInt(32)&BigInt(4294967295));return B[y++]=P,P=P>>8,B[y++]=P,P=P>>8,B[y++]=P,P=P>>8,B[y++]=P,y}function mt(B,p,y,M,D){Q(p,M,D,B,y,7);let j=Number(p&BigInt(4294967295));B[y+7]=j,j=j>>8,B[y+6]=j,j=j>>8,B[y+5]=j,j=j>>8,B[y+4]=j;let P=Number(p>>BigInt(32)&BigInt(4294967295));return B[y+3]=P,P=P>>8,B[y+2]=P,P=P>>8,B[y+1]=P,P=P>>8,B[y]=P,y+8}r.prototype.writeBigUInt64LE=Gt(function(p,y=0){return Ut(this,p,y,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeBigUInt64BE=Gt(function(p,y=0){return mt(this,p,y,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeIntLE=function(p,y,M,D){if(p=+p,y=y>>>0,!D){const f=Math.pow(2,8*M-1);Lt(this,p,y,M,f-1,-f)}let j=0,P=1,d=0;for(this[y]=p&255;++j<M&&(P*=256);)p<0&&d===0&&this[y+j-1]!==0&&(d=1),this[y+j]=(p/P>>0)-d&255;return y+M},r.prototype.writeIntBE=function(p,y,M,D){if(p=+p,y=y>>>0,!D){const f=Math.pow(2,8*M-1);Lt(this,p,y,M,f-1,-f)}let j=M-1,P=1,d=0;for(this[y+j]=p&255;--j>=0&&(P*=256);)p<0&&d===0&&this[y+j+1]!==0&&(d=1),this[y+j]=(p/P>>0)-d&255;return y+M},r.prototype.writeInt8=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,1,127,-128),p<0&&(p=255+p+1),this[y]=p&255,y+1},r.prototype.writeInt16LE=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,2,32767,-32768),this[y]=p&255,this[y+1]=p>>>8,y+2},r.prototype.writeInt16BE=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,2,32767,-32768),this[y]=p>>>8,this[y+1]=p&255,y+2},r.prototype.writeInt32LE=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,4,2147483647,-2147483648),this[y]=p&255,this[y+1]=p>>>8,this[y+2]=p>>>16,this[y+3]=p>>>24,y+4},r.prototype.writeInt32BE=function(p,y,M){return p=+p,y=y>>>0,M||Lt(this,p,y,4,2147483647,-2147483648),p<0&&(p=4294967295+p+1),this[y]=p>>>24,this[y+1]=p>>>16,this[y+2]=p>>>8,this[y+3]=p&255,y+4},r.prototype.writeBigInt64LE=Gt(function(p,y=0){return Ut(this,p,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),r.prototype.writeBigInt64BE=Gt(function(p,y=0){return mt(this,p,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function L(B,p,y,M,D,j){if(y+M>B.length)throw new RangeError("Index out of range");if(y<0)throw new RangeError("Index out of range")}function a(B,p,y,M,D){return p=+p,y=y>>>0,D||L(B,p,y,4),n.write(B,p,y,M,23,4),y+4}r.prototype.writeFloatLE=function(p,y,M){return a(this,p,y,!0,M)},r.prototype.writeFloatBE=function(p,y,M){return a(this,p,y,!1,M)};function w(B,p,y,M,D){return p=+p,y=y>>>0,D||L(B,p,y,8),n.write(B,p,y,M,52,8),y+8}r.prototype.writeDoubleLE=function(p,y,M){return w(this,p,y,!0,M)},r.prototype.writeDoubleBE=function(p,y,M){return w(this,p,y,!1,M)},r.prototype.copy=function(p,y,M,D){if(!r.isBuffer(p))throw new TypeError("argument should be a Buffer");if(M||(M=0),!D&&D!==0&&(D=this.length),y>=p.length&&(y=p.length),y||(y=0),D>0&&D<M&&(D=M),D===M||p.length===0||this.length===0)return 0;if(y<0)throw new RangeError("targetStart out of bounds");if(M<0||M>=this.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("sourceEnd out of bounds");D>this.length&&(D=this.length),p.length-y<D-M&&(D=p.length-y+M);const j=D-M;return this===p&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(y,M,D):Uint8Array.prototype.set.call(p,this.subarray(M,D),y),j},r.prototype.fill=function(p,y,M,D){if(typeof p=="string"){if(typeof y=="string"?(D=y,y=0,M=this.length):typeof M=="string"&&(D=M,M=this.length),D!==void 0&&typeof D!="string")throw new TypeError("encoding must be a string");if(typeof D=="string"&&!r.isEncoding(D))throw new TypeError("Unknown encoding: "+D);if(p.length===1){const P=p.charCodeAt(0);(D==="utf8"&&P<128||D==="latin1")&&(p=P)}}else typeof p=="number"?p=p&255:typeof p=="boolean"&&(p=Number(p));if(y<0||this.length<y||this.length<M)throw new RangeError("Out of range index");if(M<=y)return this;y=y>>>0,M=M===void 0?this.length:M>>>0,p||(p=0);let j;if(typeof p=="number")for(j=y;j<M;++j)this[j]=p;else{const P=r.isBuffer(p)?p:r.from(p,D),d=P.length;if(d===0)throw new TypeError('The value "'+p+'" is invalid for argument "value"');for(j=0;j<M-y;++j)this[j+y]=P[j%d]}return this};const c={};function E(B,p,y){c[B]=class extends y{constructor(){super(),Object.defineProperty(this,"message",{value:p.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(D){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:D,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}E("ERR_BUFFER_OUT_OF_BOUNDS",function(B){return B?`${B} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),E("ERR_INVALID_ARG_TYPE",function(B,p){return`The "${B}" argument must be of type number. Received type ${typeof p}`},TypeError),E("ERR_OUT_OF_RANGE",function(B,p,y){let M=`The value of "${B}" is out of range.`,D=y;return Number.isInteger(y)&&Math.abs(y)>2**32?D=m(String(y)):typeof y=="bigint"&&(D=String(y),(y>BigInt(2)**BigInt(32)||y<-(BigInt(2)**BigInt(32)))&&(D=m(D)),D+="n"),M+=` It must be ${p}. Received ${D}`,M},RangeError);function m(B){let p="",y=B.length;const M=B[0]==="-"?1:0;for(;y>=M+4;y-=3)p=`_${B.slice(y-3,y)}${p}`;return`${B.slice(0,y)}${p}`}function _(B,p,y){nt(p,"offset"),(B[p]===void 0||B[p+y]===void 0)&&X(p,B.length-(y+1))}function Q(B,p,y,M,D,j){if(B>y||B<p){const P=typeof p=="bigint"?"n":"";let d;throw p===0||p===BigInt(0)?d=`>= 0${P} and < 2${P} ** ${(j+1)*8}${P}`:d=`>= -(2${P} ** ${(j+1)*8-1}${P}) and < 2 ** ${(j+1)*8-1}${P}`,new c.ERR_OUT_OF_RANGE("value",d,B)}_(M,D,j)}function nt(B,p){if(typeof B!="number")throw new c.ERR_INVALID_ARG_TYPE(p,"number",B)}function X(B,p,y){throw Math.floor(B)!==B?(nt(B,y),new c.ERR_OUT_OF_RANGE("offset","an integer",B)):p<0?new c.ERR_BUFFER_OUT_OF_BOUNDS:new c.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${p}`,B)}const ft=/[^+/0-9A-Za-z-_]/g;function Bt(B){if(B=B.split("=")[0],B=B.trim().replace(ft,""),B.length<2)return"";for(;B.length%4!==0;)B=B+"=";return B}function pt(B,p){p=p||1/0;let y;const M=B.length;let D=null;const j=[];for(let P=0;P<M;++P){if(y=B.charCodeAt(P),y>55295&&y<57344){if(!D){if(y>56319){(p-=3)>-1&&j.push(239,191,189);continue}else if(P+1===M){(p-=3)>-1&&j.push(239,191,189);continue}D=y;continue}if(y<56320){(p-=3)>-1&&j.push(239,191,189),D=y;continue}y=(D-55296<<10|y-56320)+65536}else D&&(p-=3)>-1&&j.push(239,191,189);if(D=null,y<128){if((p-=1)<0)break;j.push(y)}else if(y<2048){if((p-=2)<0)break;j.push(y>>6|192,y&63|128)}else if(y<65536){if((p-=3)<0)break;j.push(y>>12|224,y>>6&63|128,y&63|128)}else if(y<1114112){if((p-=4)<0)break;j.push(y>>18|240,y>>12&63|128,y>>6&63|128,y&63|128)}else throw new Error("Invalid code point")}return j}function wt(B){const p=[];for(let y=0;y<B.length;++y)p.push(B.charCodeAt(y)&255);return p}function Qt(B,p){let y,M,D;const j=[];for(let P=0;P<B.length&&!((p-=2)<0);++P)y=B.charCodeAt(P),M=y>>8,D=y%256,j.push(D),j.push(M);return j}function At(B){return t.toByteArray(Bt(B))}function _t(B,p,y,M){let D;for(D=0;D<M&&!(D+y>=p.length||D>=B.length);++D)p[D+y]=B[D];return D}function It(B,p){return B instanceof p||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===p.name}function vt(B){return B!==B}const zt=(function(){const B="0123456789abcdef",p=new Array(256);for(let y=0;y<16;++y){const M=y*16;for(let D=0;D<16;++D)p[M+D]=B[y]+B[D]}return p})();function Gt(B){return typeof BigInt>"u"?Kt:B}function Kt(){throw new Error("BigInt not supported")}})(Te)),Te}var Nt=$c();const ts=["number","string","function","Array","Uint8Array","Buffer","object","bigint","stringified-bigint","hexadecimal","bignumber","bignumberish"];function da(i){return typeof i=="number"}function bi(i){return typeof i=="string"}function ns(i){return typeof i=="function"}function ua(i){return typeof i=="object"}function es(i){return ua(i)&&Array.isArray(i)}function fa(i){return i instanceof Uint8Array}function ga(i){return Nt.Buffer.isBuffer(i)}function Ue(i){return typeof i=="bigint"}function Ci(i){if(!bi(i))return!1;try{return BigInt(i),!0}catch{return!1}}function ha(i,t=!0){return bi(i)?t?/^(0x|0X)[0-9a-fA-F]+$/.test(i):/^[0-9a-fA-F]+$/.test(i):!1}function is(i){return Ue(i)||Ci(i)}function os(i){return da(i)||Ue(i)||Ci(i)||ha(i)||ga(i)||fa(i)}function as(i,t){switch(t){case"number":return da(i);case"string":return bi(i);case"function":return ns(i);case"Array":return es(i);case"Uint8Array":return fa(i);case"Buffer":return ga(i);case"object":return ua(i);case"bigint":return Ue(i);case"stringified-bigint":return Ci(i);case"hexadecimal":return ha(i);case"bignumber":return is(i);case"bignumberish":return os(i);default:return!1}}function cs(i){return ts.includes(i)}function ss(i,t){if(!Ue(i))throw new TypeError(`Parameter '${t}' is not a bigint, received type: ${typeof i}`)}function rs(i,t,n){for(const e of n)if(!cs(e))throw new Error(`Type '${e}' is not supported`);for(const e of n)if(as(i,e))return;throw new TypeError(`Parameter '${t}' is none of the following types: ${n.join(", ")}`)}function ls(i){ss(i,"value");let t=i.toString(16);return t.length%2!==0&&(t=`0${t}`),t}function ds(i){return rs(i,"value",["Buffer","Uint8Array"]),BigInt(`0x${Nt.Buffer.from(i).reverse().toString("hex")}`)}function us(i,t){const n=ls(i),e=Math.ceil(n.length/2);if(t<e)throw Error(`Size ${t} is too small, need at least ${e} bytes`);const o=Nt.Buffer.alloc(t,0);return Nt.Buffer.from(n,"hex").reverse().copy(o,0),o}function _a(i){return!i}function fs(i){return(i&BigInt(1))===BigInt(1)}function pa(i,t){return i>>t}function gs(i){const t=[];let n=i;for(;n;)n&BigInt(1)?t.push(1):t.push(0),n>>=BigInt(1);return t}let hs=class{constructor(t){this.one=1n,this.zero=0n,this._order=t,this._half=t>>this.one,this._negone=this._order-this.one}e(t){return t%=this._order,t<0?t+this._order:t}mul(t,n){return t*n%this._order}sub(t,n){return t>=n?t-n:this._order-n+t}add(t,n){const e=t+n;return e>=this._order?e-this._order:e}inv(t){if(t===this.zero)throw new Error("Zero has no inverse");let n=this.zero,e=this._order,o=this.one,s=t%this._order;for(;s;){const u=e/s;[n,o]=[o,n-u*o],[e,s]=[s,e-u*s]}return n<this.zero&&(n+=this._order),n}div(t,n){return this.mul(t,this.inv(n))}eq(t,n){return t===n}square(t){return t*t%this._order}lt(t,n){const e=t>this._half?t-this._order:t,o=n>this._half?n-this._order:n;return e<o}geq(t,n){const e=t>this._half?t-this._order:t,o=n>this._half?n-this._order:n;return e>=o}neg(t){return t&&this._order-t}isZero(t){return t===this.zero}pow(t,n){if(_a(n))return this.one;n<0n&&(t=this.inv(t),n=-n);const e=gs(n);if(e.length===0)return this.one;let o=t;for(let s=e.length-2;s>=0;s-=1)o=this.square(o),e[s]&&(o=this.mul(o,t));return o}};const _s=BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"),Tt=new hs(_s),me=[Tt.e(BigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553")),Tt.e(BigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203"))],ni=Tt.e(BigInt("168700")),La=Tt.e(BigInt("168696")),ps=BigInt("21888242871839275222246405745257275088614511777268538073601725287587578984328"),mi=pa(ps,BigInt(3));function ei(i,t){const n=Tt.mul(i[0],t[1]),e=Tt.mul(i[1],t[0]),o=Tt.mul(Tt.sub(i[1],Tt.mul(ni,i[0])),Tt.add(t[0],t[1])),s=Tt.mul(n,e),u=Tt.mul(La,s),r=Tt.div(Tt.add(n,e),Tt.add(Tt.one,u)),b=Tt.div(Tt.add(o,Tt.sub(Tt.mul(ni,n),e)),Tt.sub(Tt.one,u));return[r,b]}function $n(i,t){let n=[Tt.e(BigInt(0)),Tt.e(BigInt(1))],e=t,o=i;for(;!_a(e);)fs(e)&&(n=ei(n,o)),o=ei(o,o),e=pa(e,BigInt(1));return n}function ii(i){const t=BigInt(i[0]),n=BigInt(i[1]),e=Tt.square(t),o=Tt.square(n);return Tt.eq(Tt.add(Tt.mul(ni,e),o),Tt.add(Tt.one,Tt.mul(Tt.mul(e,o),La)))}function Ls(i){const t=us(i[1],32);return Tt.lt(i[0],Tt.zero)&&(t[31]|=128),ds(t)}function As(i){if(i<=0)throw Error(`size ${i} is too small, need at least 1`);return crypto.getRandomValues(new Uint8Array(i))}var ys=Object.freeze({__proto__:null,getRandomValues:As});const Is=["number","string","function","Array","Uint8Array","Buffer","object","bigint","stringified-bigint","hexadecimal","bignumber","bignumberish"];function Aa(i){return typeof i=="number"}function wi(i){return typeof i=="string"}function bs(i){return typeof i=="function"}function Bi(i){return typeof i=="object"}function ya(i){return Bi(i)&&Array.isArray(i)}function Ei(i){return i instanceof Uint8Array}function xi(i){return Nt.Buffer.isBuffer(i)}function Oe(i){return typeof i=="bigint"}function Fi(i){if(!wi(i))return!1;try{return BigInt(i),!0}catch{return!1}}function Ia(i,t=!0){return wi(i)?t?/^(0x|0X)[0-9a-fA-F]+$/.test(i):/^[0-9a-fA-F]+$/.test(i):!1}function we(i){return Oe(i)||Fi(i)}function Si(i){return Aa(i)||Oe(i)||Fi(i)||Ia(i)||xi(i)||Ei(i)}function Cs(i,t){switch(t){case"number":return Aa(i);case"string":return wi(i);case"function":return bs(i);case"Array":return ya(i);case"Uint8Array":return Ei(i);case"Buffer":return xi(i);case"object":return Bi(i);case"bigint":return Oe(i);case"stringified-bigint":return Fi(i);case"hexadecimal":return Ia(i);case"bignumber":return we(i);case"bignumberish":return Si(i);default:return!1}}function ms(i){return Is.includes(i)}function ws(i,t){if(!Oe(i))throw new TypeError(`Parameter '${t}' is not a bigint, received type: ${typeof i}`)}function Bs(i,t){if(!Si(i))throw new TypeError(`Parameter '${t}' is not a bignumber-ish`)}function Me(i,t,n){for(const e of n)if(!ms(e))throw new Error(`Type '${e}' is not supported`);for(const e of n)if(Cs(i,e))return;throw new TypeError(`Parameter '${t}' is none of the following types: ${n.join(", ")}`)}function Es(i){ws(i,"value");let t=i.toString(16);return t.length%2!==0&&(t=`0${t}`),t}function xs(i){return Me(i,"value",["Buffer","Uint8Array"]),BigInt(`0x${Nt.Buffer.from(i).toString("hex")}`)}function oi(i){return Me(i,"value",["Buffer","Uint8Array"]),BigInt(`0x${Nt.Buffer.from(i).reverse().toString("hex")}`)}function ba(i){return xs(i)}function Fs(i,t){const n=Es(i),e=Math.ceil(n.length/2);if(t<e)throw Error(`Size ${t} is too small, need at least ${e} bytes`);const o=Nt.Buffer.alloc(t,0);return Nt.Buffer.from(n,"hex").reverse().copy(o,0),o}function Ss(i){return Bs(i,"value"),xi(i)||Ei(i)?ba(i):BigInt(i)}function Us(i){return!i}function Ca(i,t){return i>>t}function Os(i,t){return i*t}function Ms(i){const t=[];let n=i;for(;n;)n&BigInt(1)?t.push(1):t.push(0),n>>=BigInt(1);return t}class Ps{constructor(t){this.one=1n,this.zero=0n,this._order=t,this._half=t>>this.one,this._negone=this._order-this.one}e(t){return t%=this._order,t<0?t+this._order:t}mul(t,n){return t*n%this._order}sub(t,n){return t>=n?t-n:this._order-n+t}add(t,n){const e=t+n;return e>=this._order?e-this._order:e}inv(t){if(t===this.zero)throw new Error("Zero has no inverse");let n=this.zero,e=this._order,o=this.one,s=t%this._order;for(;s;){const u=e/s;[n,o]=[o,n-u*o],[e,s]=[s,e-u*s]}return n<this.zero&&(n+=this._order),n}div(t,n){return this.mul(t,this.inv(n))}eq(t,n){return t===n}square(t){return t*t%this._order}lt(t,n){const e=t>this._half?t-this._order:t,o=n>this._half?n-this._order:n;return e<o}geq(t,n){const e=t>this._half?t-this._order:t,o=n>this._half?n-this._order:n;return e>=o}neg(t){return t&&this._order-t}isZero(t){return t===this.zero}pow(t,n){if(Us(n))return this.one;n<0n&&(t=this.inv(t),n=-n);const e=Ms(n);if(e.length===0)return this.one;let o=t;for(let s=e.length-2;s>=0;s-=1)o=this.square(o),e[s]&&(o=this.mul(o,t));return o}}var ge={},ke,$i;function ma(){if($i)return ke;$i=1;const i=BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"),t=8,n=[56,57,56,60,60,63,64,63,60,66,60,65,70,60,64,68],e=u=>{let r=u*u;return u*r*r%i};function o(u,r){const b=[];for(let g=0;g<u.length;g++){let l=0n;for(let x=0;x<u.length;x++)l=l+r[g][x]*u[x];b.push(l%i)}return b}function s(u,r,b=1){const g=u.map(S=>BigInt(S));if(g.length<=0)throw new Error("poseidon-lite: Not enough inputs");if(g.length>n.length)throw new Error("poseidon-lite: Too many inputs");const l=g.length+1,x=t,F=n[l-2],{C:I,M:k}=r;if(k.length!==l)throw new Error(`poseidon-lite: Incorrect M length, expected ${l} got ${k.length}`);let z=[0n,...g];for(let S=0;S<x+F;S++){for(let G=0;G<z.length;G++)z[G]=z[G]+I[S*l+G],(S<x/2||S>=x/2+F||G===0)&&(z[G]=e(z[G]));z=o(z,k)}if(typeof b!="number")throw new Error(`poseidon-lite: expected nOuts to be number got ${typeof b}`);if(b===1)return z[0];if(b<=z.length)return z.slice(0,b);throw new Error(`poseidon-lite: Invalid number of outputs requested ${b}, max ${z.length}`)}return ke=s,ke}var he={},to;function wa(){if(to)return he;to=1,Object.defineProperty(he,"__esModule",{value:!0}),he.default=i;function i(t){if(Array.isArray(t))return t.map(i);if(typeof t=="object"){const o={};for(const[s,u]of Object.entries(t))o[s]=i(u);return o}const e=[...Uint8Array.from(atob(t),o=>o.charCodeAt(0))].map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)}return he}var Gn={},no;function Qs(){if(no)return Gn;no=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.default=void 0;var i={C:["FEhhRZjgD5jnrn3qRfvYO9loZT74OQzeLoa3Bq1AxlE=","CreykTiOXJ5DwNwfWR+4Ps22UCLhtwr0O4p7QMHf98M=","K3y7IXiW9SyajAiOZUryHoTN51SjzvWxXE1UZmEtat8=","K8aw3b4dcBtlcEKL3Byhvw2ln/O7u5X8K8ccDG5nplw=","EjpVoxmAOE89ILLOy8RO1gw4wR99IOknHvq5qQXu/Tw=","A3UBzIydyBkwmnafTfCY5YiwGFi8jrfieeKIO+n7jFM=","HCEW5H4DqGuxFpWwpf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R5iw=","F9X7bCyzcBDj41irLVdTdocO0zGGuOrkmtO0fjQKjX8=","F13Kx22KgSYTm1g644hTKQJG5D54P6aQPsgAfxeMACM=","DE/Qj+3l0iGtt6v1SYmMkeW+foW/H9KmEb8YLMLnFlU=","J3k0uQnnLTo0dbsex2arejitWbEoMD/FAC8Cplvf5yk=","Dog0mZjf5wPxsYRST5w5TWAEzKz5y5UolujP2wsHi2g=","HxsgeLYLD84Hgk4qK8jK6O5nNRSwBwqLRXEMx4y7mUI=","LrFVlWbFNt28MW9kgtUfo0BVdldwD1uKhG6BKg7TNNE=","HE29wzXPZ2Q1Ugi0ydJD00VB1iPGad7Cw7oGa76vZ3M=","I3SmstpvjKuOXP6NgF3Tot/KHot+ul3IV0Ah/RJB47Q=","Gd00JTPMxgOplzjj+1pWm5TvcbPkn5D7h09hYXMwcvQ=","IX1m22x/s+/6UIgAWH0us8bQPYOFEy8vzOfzXycFzM8=","CBX7hZH+AQOM06OziyNvnvynfGGNO/xsKn+okpbH5k8=","K7lDtAwr1FamwXhTscqI6w/zb1l0sv+aX1CT6b9joW8=","EaUVP85llRPufLmXSubLpYHjtM0UVwxXCf7D2NP8guk=","G3K/0HY12FAbLv+HhaJJW650x2U8+Q5tXJ8URCaDbfQ=","FJAsBwDuyJeuF4uoyvhQ15Px2HUSvqDs6jnPax/uIz0=","CcE4xuCmFqSf+Q1DprBD87dFt4hlhW3EwaReL9hMs/Q=","BbWKPc5XsoGicdaYlQUtiHRYpxV4PoMX4CSmGjXsELw=","K+jSlSXAz91eazEl473jv1WOVfvoZ/AkRXqWdlR00Dc=","Bh1y948bqdxrTX93hCJdaoG9/Bta1sJDafnAVgUj2a0=","C/GK78rP+r30ES7drcphRXOLSAOzYUW7lRbbUBoGkuk=","LnPdEF+osuyTHYzfKexnnjqYAakwcafV6jBlklXwO8Y=","D4RA72Z8mugTN7pdjJJ6U0fecpaGCyEcrR7L+101mO8=","AE0wOy3qYnsnMb6D+TrDTn0U0XihOABVjKc5Y5XrEY8=","I0VBrXIECnDaKZajUmkjDJRpnu8xOk1IBQgAjLw9N8E=","DRI/HnLSa5K92P1z0UKGwxKtTCOstGsuCMFXEEQJ4XQ=","L7Ngd28N551wmO56pBI8Be5rBai+Rgp3TzoEjhOFRbs=","A2hcB5Q04WcnbFfTzHlwO339xBwVbqHot/mbaValUyY=","Jgrw4P/8yXcsFjGxeTRFZrR6qto2geuQNMb3XDcFwcc=","KGK0E3T4m2lSdLM7dz8lVJFuK/+f9nJUX8L0lWP2J2c=","AqmRL+FwMQInGJ6h5pHQNi8Ys4tACw7/GSyllRPrqNU=","COUTreaUoNisHz6/GpZEDTLHE9UFjhIk4HA0jCgfSm8=","FApKQx4u55QA7XRll42EdzITxigmT/gPIax6a2c9Cas=","KWr00BnLXffZWbKdVJw/BxICtOuotT3F7pee0UM3eSc=","AYMuKEp/TIFhSIK2k5/A8YVXO9ICPj5QV2VHC7gSs0k=","GoTVame/3T2WWr3NMpqnjU/pNDRJby0QOGH9GdZtcmA=","BAy4KEd3OSfSrv3AdIkDep0fdjHsp1yfsN2gy5294UM=","AQ3PCEzCnLfK7PJqpjO85O0rAZ8oh87nsaePidP6vi8=","B+3CKgkR6iFEJe9UK3dtsjsP5YF4ENQMcsqYqr2a+oM=","LupKsIrsd18hSEeeo2+7lpNtpYuki9HS06zUgXOqq+c=","HkDA6CV/5KYQBc3PrRSM9/R9G1z936oIJzhpVRgkXxk=","I6J4CVg70epR9DbeVEPhCPadRM31HcHwPiGUi0mAuHY=","LkZSsETb/kDmO2sjL81fPzmr+9IFHuaK3HVAgNSSUKk=","Eeer227Lr8Ln2M3v6ce5xQR160dds8LK9/fWf0hXdfI=","GZ1SNQzDDoxzgh+AIJbw5UehNVGye/a4mTlvY6xc+Oc=","D1ddbuZ8vs2YNFYk4DKjfIWafL7zCz/dyUnNCXhIQQE=","HEtvmiritBjmJlrLqclrBhhNBwKOX7eE80da53cv8Fc=","Lctc+Ilt458ijhV8DFWT9GJvubwiUgY4PbIDYKvwySU=","E0CrufThExhr3CbL30vMpQtTGhB/hjylRFdePPhw+OE=","I2jmkrcnh8uIcOqIjnFOAG9Z0rRGDPt0xIqMxzsdGls=","H6ua3ZuqSk9W8jFld1xvLZIqdjKpT5Y3S33IUnVvVLY=","DH97gjANPGzj+JV7oeSt1UxMAV4g2XZdIgVxwWq4aA8=","FdY+hr6s2Txgg2iOXZyPPGlHkp+fH5mrV4pMOpIu/wM=","C+hDrl+bB+UlcheK99ro7QXTaxLAYHhikpNV6nQCPZ4=","EzJ0nFI2lMtpNeCWOgfoGwWWfOHZUMC3MQWOySp6DJo=","JUOUCIEOB0wL3UWYuYFf7okruVylECns8Am/+lubloI=","BX6NGd2ZmpGNopsJQLODup/RXbCw9kmW3/Z/61X5p0I=","HgFON+mxF887SHDZmfK1XTU00Ka+mOnjV/pD8B5wop0=","Gk7STm4DrrzWvbEAUz3JZll6/hXIUbS4Y/boiQhMZHk=","JTQgAHCD8aqGOtR2CQXBA57UERyfBT8ncQRS+DzjapA=","InahRBlxcJr/5tKpkyAAHsRexyFVxXXd7srA4ydZqwY=","KJV90SGOp5n9NBHrGTJYU633rorhKB91MwL+fTHfp7A=","L9klcmq3lMiL11eWqj5/HmaS8pFM+AImfd8B43kCoAg=","HPilycdqhLFHyCONklPNVbR8DEPYKWbEY2ooZ0cF/Zo=","A3PLvDBuG6uecHc2hxXmIwtLLi5KHbnGdLjDWaQekQg=","BgKD0v5/I9/1E9kRCz3GJEi8SPUxzgweq1kgvyMpCkA=","DatGXW2RB0DzPvbMDq3HG/gRm9/Vo1J9yLv636pAJjw=","DLp7y8giSyqOSroXl3IwpobNZCHcDKU0bzRGtiQ5xMM=","HkNl2weQycT0RbBlPEZv8h25bDi0B2uovWi8tN6mkR0=","G7LbohmamrO8hu9fnef2xcoT1g6rQs7WjemPxkOACo0=","CtPBhwxtbvQO661SEjzRopE9nWLoC/usroEuCCAh+co=","AbCYyR57DLtcNFiAd8Dd+VMA3fYUk1YwwM46JickUwg=","Gf1cDq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oBa3e8=","Jv0xRxgow2rjbCe3SAVLDAxP5SObMBaZ43Ze6+zBiUY=","B3XZlswsRFbzA6LB+QB2R+Eakh2f6j97kmFDuZ0voL4=","AW+5M3cIymOM39qRvQ2uprlyJO97IGJnKt3RvRi7iQA=","LDkvvn0/3kL8pPlHi7Q5MxJYJVNW8YSvb3bxGQVBF9c=","GHoqO/eaafo+UInvnx/Vb9tHxV7s53qiKKo94bSGvLE=","AnGoY6KAoyZB/6M1ELLt0njJhjA1lTLz5Qaydf1dIM4=","FVdFnJx0yUqgDlr2mh4xEvtpU3zol+wMcYlY2WUW8qs=","Ko4myo1kfZpjiFFuqdz/iQg9U55YFowqUMba4w8QnyE=","Ict1IZTPQ/O1GULrAEDrqd4rz7HCo/rpeSS3EPJoMs0=","LCba+Za+JHrNbdSsrWDTi1pHHmMiGI0CwTfny0hDd+w=","AkAXbuDnmC7r6Spo0+OjjCaCGswPXQWM+ME3vKLSbxs=","JjbglzyGXBvZdN142qqNCoTNr2vhrUfs8qDRjxFzGPI=","GehPTyWnmUlgQWYdxdl1toH24GdEzuibe+XZ/eF0SsA=","Dr+JBko68kfKHzb281cBiOJx4LMmxPsmZk6J4UVMoRA=","Jcfpe0db4A6LVZo4xFI2T0ycUx/suKxpj3/XPOIucew=","BETJnlkjU+WuyqMCrdkBwU2MVScKFgr+1EKe9VmK108=","E424iHgwVl8mk9Dg8C5OeeFEln8LpTsDUZq6dktcmUo=","JNQPRiEU/p7gKq/PdLT8ok4a42XcdcO1K7E8u7LyHt0=","IeZdbY7kN2C8pA5zC130xM86inMtsUj0spUbTGHWjow=","JI3XlmnsCdvwNQoV1sdcapvarO/KFNUTAJePE9GrbRw=","K4I4wVSPnL4p/TXPkee0jw69p+Y57faf6NWrp5JNU2I=","JDn9I5JX84GBx7489RPxv3I166lPa4lCqUy93s9vYvc=","IAlYI1KBphuixL4KoygqGMdLbSYvXefC4z0rs+iT3+w=","Dh7KXfiO5fYM+n4f5b77txn62CEfqbLQL8wjMZDB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WNVcpwqhnCrTCxwQASBsqyQN0Dgxas=","L5kTII4J49bp5vumOE/QdquJ8mYpduPjDghwuzDrVPI=","KzOAPZCIlwbnFPcgtWKNJvtgtUWh8+nOSaaukSsCQIY=","JsyrwQ6wQyfLXMPd4quzbwlwhsl+c4wTPJ9XB350iwk=","GxauDXxUQIy3X9kx8kZ1HysMPcINeegqJTG3bCK01d8=","EdC7RhvYryhE9J8PhAyU75UYslETRHQtH1Q4/j1BWuQ=","IzAxhHtHa+rQEY09szjokTPsQg1nPlBK1kclnfZVVx4=","H4TpeJW+5DjrPJLcmxhGya0pwWQ4ewautu0YQe2MTco=","J39/m1QvDCu19FvtBU8JYkU2AQw8+UUtInMZMyf4AdY=","HvyckGnlBouqwT0uZkVkG30n6A/CMHcWFTXERoLuV6k=","DW7Ed3YeLvusTxSzvz1SV6meZMPyX+EE+vmIsg/l/0Q=","Dg59fFUBmZt9Fhc7WbfK4fIDvvIa6/ACUYgUOcz5MBM=","IXvvL08SxtzJHCBYojORy3feU8puRNzcbqPTb+oybqY=","BXgMiK3wFTG1D4F+P+RER9KbNaqKOJxx6M8SJqzvaLo=","GHM4h6ays7TJDY5JkBluI0ReR9fqWTnr+4mj7j1ntL0=","ILrOY6z8rgscnyvuJLjp2oW6WX03sJBXIMTxXbIxsHo=","Fm6llTdaZ4asUn7p7O1z7Wv1UIdqvK86yStCyAiwDY8=","MEJiqe/0BArPQ+Mi1vUmdq4vhT7C56gNsAxIjPkXx04=","ImuscFAWbl9tt4zQsS028wW26MmgVRFK13Ceb1ckW2s=","JrL1OcVzgp9qypG6qVRQW8XD604d8dY4WCcX+98jiMw=","BqD79M1S6Tul5MbEr2XbAu6WKX+K0gDy8c/yUudptVE=","LLnCQRLTU0Gs6siDYPtSiSTli27KwyG5+ynmqjNo/yM=","IOiKTWB1Jt0H/gijVSpEZpEp64f8wLE6rI/or9kwFSE=","FURkmivXPjunLzlt+R3WVAHdj69R3jJfuu251TatlPw=","GYAHdFeZVxLETafhdxMljj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HZRq3clLBA/VgATZpfjNGSZUDHqGEs7BxYy2DCs6U=","GInPqCCfSVLfkCLbncWDtXF6BpbaQc7mSTfQzWMh5pM=","I2Bk1xy2xkyEdHrCX8+NiBUC5fA7/4dWG4WhFrHzmso=","L/ehdP/Owphi4E9dvcc+vzZhVwAzV2KQwMH2zYztJ64=","GeckoddCyrEDRV8AQO33RaJpanEITJPjInFUUN1Nb1s=","A+7TiStvDmxdoQWcXzeTmFg1qig1AKgSmQSpTIfxYb8=","COK4Jzv6MMGshQMG2R5Gip6NBQkq7ky8gMaHJIRjujA=","B63Mp22DN3KIOaG2rDs+1Cr7h9cq+Y9S9Bby7FiyjOw=","Fx7zeJa64rECCgpYOb1ReEzhG7QjfVSMFxFp0y+hm0A=","IP/fy4b00AUGTtvClpGMMy0y++/xcp3lBWomq7w6Nfo=","COzXpvFzXu2GuqCU5gj0iPONuzmPz+1LmUODoMqORkc=","HD9dhuWSH96YkBifHYxhh1QohgDmkovBgqxNXkyfDMs=","KcYRhO2dRg8zdVihr2Oap+PAl15AFO2OvK1KJdUeq/M=","De/UWyiVhygiituy29rval6bGmSQKnNPQCuM77irO1Y=","CnTqItigkzYGBhAXmsHYL/+pSS33be7U6mDgEzsIEag=","A6N78S2vFADSl6xKwTuiTBfcJi2xbIUj3u5ODM3ppoA=","Ef4XkNWrv1k1/yIxjk9//mmWatovkTa1T4MOrLCmU2g=","AYFlhC9AY3XyNGaGkVr7FL8f4FZMiFjuO94Kuj3l9o8=","Jh2yXnz/Wp+3LydrH5JgtmcwD7fTYbUP1cDotplbBfk=","KjrDMUsrZueW++Nt93jF5GlyMgzEPsgHBIgmtnBLp8Q=","I8qkuA7PqZ6dP+orvB2782nRv8iTfQPQdAYcMP2M12s=","J9smAIXiJImN8UXyP2NfIGbY5OEk5YHoxiYZKbHf4Qc=","J09sX9NKeE1rkV7wXUJO5sC6u/Np55qxOLgWe1YY7H8=","LDop4TqE0moJEckona8apM9YQKraBwHVfiPfx5babaE=","HqIQ8gA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F2rrj8z+9A8rYbRi8WUx5pJfsuYlO21VPE=","D5cRYmJ3I/P+rayyiwwQTLj3TeUIdS+o18DbKvE96O4="],["JL5RAJVDYgbdCr0LDLuVyIOrMEqlJZixppMG7JgaaI0=","IRYQ4q1KN3Qm+t9waLDBpsKZoWTBwaYD6u2USHDQubk=","FaZ9mBBBsfbwnz+evv2GTnedOvCBV3hqwHdQXlDsefw=","BJMn+nnSjBKiyCQGlH938Gd1sCh0aLMTaHdwHb58lZg=","IwlA3MUjJlj/nClpej/UFtFw6MmY8aqF3qDELXn5Uao=","GxIcBJzRFZ4okAfgydqZlcxLq0wm+4iOw5cqii5laWQ="]]};return Gn.default=i,Gn}var eo;function vs(){if(eo)return ge;eo=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.poseidon5=s;var i=e(ma()),t=e(wa()),n=e(Qs());function e(u){return u&&u.__esModule?u:{default:u}}const o=(0,t.default)(n.default);function s(u,r){return(0,i.default)(u,o,r)}return ge}var Ba=vs();const qs=Nt.Buffer.from([1]),Ts=Nt.Buffer.from([129]),An=[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],[11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4],[7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8],[9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13],[2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9],[12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11],[13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10],[6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5],[10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],[11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4],[7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8],[9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13],[2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]],Mn=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731,3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113],De=Nt.Buffer.from([128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function _e(i,t,n,e){let o=i[t*2]^i[n*2],s=i[t*2+1]^i[n*2+1];e>=32&&(s^=o,o^=s,s^=o,e-=32),e===0?(i[t*2]=o>>>0,i[t*2+1]=s>>>0):(i[t*2]=(o>>>e|s<<32-e)>>>0,i[t*2+1]=(s>>>e|o<<32-e)>>>0)}function yn(i,t,n,e,o,s,u,r){let b;b=i[e*2+1]+((t[An[n][r]*2+1]^Mn[An[n][r+1]*2+1])>>>0)+i[o*2+1],i[e*2]=i[e*2]+((t[An[n][r]*2]^Mn[An[n][r+1]*2])>>>0)+i[o*2]+~~(b/4294967296)>>>0,i[e*2+1]=b>>>0,_e(i,u,e,32),b=i[s*2+1]+i[u*2+1],i[s*2]=i[s*2]+i[u*2]+~~(b/4294967296)>>>0,i[s*2+1]=b>>>0,_e(i,o,s,25),b=i[e*2+1]+((t[An[n][r+1]*2+1]^Mn[An[n][r]*2+1])>>>0)+i[o*2+1],i[e*2]=i[e*2]+((t[An[n][r+1]*2]^Mn[An[n][r]*2])>>>0)+i[o*2]+~~(b/4294967296)>>>0,i[e*2+1]=b>>>0,_e(i,u,e,16),b=i[s*2+1]+i[u*2+1],i[s*2]=i[s*2]+i[u*2]+~~(b/4294967296)>>>0,i[s*2+1]=b>>>0,_e(i,o,s,11)}function io(i){for(let t=0;t<i.length&&!(i[t]<4294967296);t+=1)i[t]-=4294967296,i[t+1]+=1}class ks{constructor(){this._h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this._s=[0,0,0,0,0,0,0,0],this._block=Nt.Buffer.alloc(128),this._blockOffset=0,this._length=[0,0,0,0],this._nullt=!1,this._zo=qs,this._oo=Ts}_compress(){const t=new Array(32),n=new Array(32);let e;for(e=0;e<32;e+=1)n[e]=this._block.readUInt32BE(e*4);for(e=0;e<16;e+=1)t[e]=this._h[e]>>>0;for(e=16;e<24;e+=1)t[e]=(this._s[e-16]^Mn[e-16])>>>0;for(e=24;e<32;e+=1)t[e]=Mn[e-16];for(this._nullt||(t[24]=(t[24]^this._length[1])>>>0,t[25]=(t[25]^this._length[0])>>>0,t[26]=(t[26]^this._length[1])>>>0,t[27]=(t[27]^this._length[0])>>>0,t[28]=(t[28]^this._length[3])>>>0,t[29]=(t[29]^this._length[2])>>>0,t[30]=(t[30]^this._length[3])>>>0,t[31]=(t[31]^this._length[2])>>>0),e=0;e<16;e+=1)yn(t,n,e,0,4,8,12,0),yn(t,n,e,1,5,9,13,2),yn(t,n,e,2,6,10,14,4),yn(t,n,e,3,7,11,15,6),yn(t,n,e,0,5,10,15,8),yn(t,n,e,1,6,11,12,10),yn(t,n,e,2,7,8,13,12),yn(t,n,e,3,4,9,14,14);for(e=0;e<16;e+=1)this._h[e%8*2]=(this._h[e%8*2]^t[e*2])>>>0,this._h[e%8*2+1]=(this._h[e%8*2+1]^t[e*2+1])>>>0;for(e=0;e<8;e+=1)this._h[e*2]=(this._h[e*2]^this._s[e%4*2])>>>0,this._h[e*2+1]=(this._h[e*2+1]^this._s[e%4*2+1])>>>0}_padding(){const t=this._length.slice();t[0]+=this._blockOffset*8,io(t);const n=Nt.Buffer.alloc(16);for(let e=0;e<4;e+=1)n.writeUInt32BE(t[3-e],e*4);this._blockOffset===111?(this._length[0]-=8,this.update(this._oo)):(this._blockOffset<111?(this._blockOffset===0&&(this._nullt=!0),this._length[0]-=(111-this._blockOffset)*8,this.update(De.subarray(0,111-this._blockOffset))):(this._length[0]-=(128-this._blockOffset)*8,this.update(De.subarray(0,128-this._blockOffset)),this._length[0]-=888,this.update(De.subarray(1,112)),this._nullt=!0),this.update(this._zo),this._length[0]-=8),this._length[0]-=128,this.update(n)}digest(){this._padding();const t=Nt.Buffer.alloc(64);for(let n=0;n<16;n+=1)t.writeUInt32BE(this._h[n],n*4);return t}update(t){const n=this._block;let e=0;for(;this._blockOffset+t.length-e>=n.length;){for(let o=this._blockOffset;o<n.length;)n[o++]=t[e++];this._length[0]+=n.length*8,io(this._length),this._compress(),this._blockOffset=0}for(;e<t.length;)n[this._blockOffset++]=t[e++];return this}}function Ea(i){return i[0]&=248,i[31]&=127,i[31]|=64,i}function Ui(i){return ya(i)&&i.length===2&&we(i[0])&&we(i[1])}function Ds(i){return Bi(i)&&Object.prototype.hasOwnProperty.call(i,"R8")&&Object.prototype.hasOwnProperty.call(i,"S")&&Ui(i.R8)&&we(i.S)}function xa(i){return Me(i,"privateKey",["Buffer","Uint8Array","string"]),Nt.Buffer.from(i)}function Fa(i){return Me(i,"message",["bignumberish","string"]),Si(i)?Ss(i):ba(Nt.Buffer.from(i))}function ai(i){const t=new ks;return t.update(Nt.Buffer.from(i)),t.digest()}function Sa(i){i=xa(i);let t=ai(i);return t=t.slice(0,32),t=Ea(t),Ca(oi(t),BigInt(3))%mi}function zs(i){const t=Sa(i);return $n(me,t)}function Ua(i,t){i=xa(i),t=Fa(t);const n=ai(i),e=Ea(n.slice(0,32)),o=oi(e),s=$n(me,Ca(o,BigInt(3))),u=Fs(t,32),r=ai(Nt.Buffer.concat([n.slice(32,64),u])),b=new Ps(mi),g=b.e(oi(r)),l=$n(me,g),x=Ba.poseidon5([l[0],l[1],s[0],s[1],t]),F=b.add(g,b.mul(x,o));return{R8:l,S:F}}function Oa(i,t,n){if(!Ui(n)||!Ds(t)||!ii(t.R8)||!ii(n)||BigInt(t.S)>=mi)return!1;i=Fa(i);const e={R8:[BigInt(t.R8[0]),BigInt(t.R8[1])],S:BigInt(t.S)},o=[BigInt(n[0]),BigInt(n[1])],s=Ba.poseidon5([t.R8[0],t.R8[1],n[0],n[1],i]),u=$n(me,BigInt(t.S));let r=$n(o,Os(s,BigInt(8)));return r=ei(e.R8,r),Tt.eq(u[0],r[0])&&Tt.eq(u[1],r[1])}function Rs(i){if(!Ui(i)||!ii(i))throw new Error("Invalid public key");const t=[BigInt(i[0]),BigInt(i[1])];return Ls(t)}class Gs{constructor(t=ys.getRandomValues(32)){this.privateKey=t,this.secretScalar=Sa(t),this.publicKey=zs(t),this.packedPublicKey=Rs(this.publicKey)}signMessage(t){return Ua(this.privateKey,t)}verifySignature(t,n){return Oa(t,n,this.publicKey)}}const Ns=["number","boolean","string","function","Array","Uint8Array","Buffer","object","bigint","stringified-bigint","hexadecimal","bignumber","bignumberish"];function Ks(i){return typeof i<"u"}function Oi(i){return typeof i=="number"}function Hs(i){return typeof i=="boolean"}function oe(i){return typeof i=="string"}function Vs(i){return typeof i=="function"}function Mi(i){return typeof i=="object"}function js(i){return Mi(i)&&Array.isArray(i)}function Ma(i){return i instanceof Uint8Array}function Pa(i){return Nt.Buffer.isBuffer(i)}function Pi(i){return typeof i=="bigint"}function Qi(i){if(!oe(i))return!1;try{return BigInt(i),!0}catch{return!1}}function Qa(i,t=!0){return oe(i)?t?/^(0x|0X)[0-9a-fA-F]+$/.test(i):/^[0-9a-fA-F]+$/.test(i):!1}function Ys(i){return Pi(i)||Qi(i)}function Xs(i){return Oi(i)||Pi(i)||Qi(i)||Qa(i)||Pa(i)||Ma(i)}function Js(i,t){switch(t){case"number":return Oi(i);case"boolean":return Hs(i);case"string":return oe(i);case"function":return Vs(i);case"Array":return js(i);case"Uint8Array":return Ma(i);case"Buffer":return Pa(i);case"object":return Mi(i);case"bigint":return Pi(i);case"stringified-bigint":return Qi(i);case"hexadecimal":return Qa(i);case"bignumber":return Ys(i);case"bignumberish":return Xs(i);default:return!1}}function Zs(i){return Ns.includes(i)}function pe(i,t){if(!Ks(i))throw new TypeError(`Parameter '${t}' is not defined`)}function Ws(i,t){if(!Oi(i))throw new TypeError(`Parameter '${t}' is not a number, received type: ${typeof i}`)}function va(i,t){if(!oe(i))throw new TypeError(`Parameter '${t}' is not a string, received type: ${typeof i}`)}function ze(i,t){if(!Mi(i))throw new TypeError(`Parameter '${t}' is not an object, received type: ${typeof i}`)}function ci(i,t,n){for(const e of n)if(!Zs(e))throw new Error(`Type '${e}' is not supported`);for(const e of n)if(Js(i,e))return;throw new TypeError(`Parameter '${t}' is none of the following types: ${n.join(", ")}`)}function $s(i){return ci(i,"value",["Buffer","Uint8Array"]),Nt.Buffer.from(i).toString("base64")}function tr(i){return va(i,"value"),Nt.Buffer.from(i,"base64")}function nr(i){return va(i,"value"),Nt.Buffer.from(i,"utf8").toString("base64")}var Le={},Nn={},oo;function er(){if(oo)return Nn;oo=1,Object.defineProperty(Nn,"__esModule",{value:!0}),Nn.default=void 0;var i={C:["DumlkrqalRjQWYbWVvQMIRTEmTwRuymTjSHUcwTNjm4=","APFEUjXyFIxZhlhxafwbzYh7CNTQCGjfVpb/9AlW6GQ=","CN/zSH6KyZ4fKaBY0PqAuTDHKHMLerNs6HnziQ7Pc/U=","Lye+aQ/a7kbDzij3UysTyFbDU0LIS9puIJZjEPrcAdA=","KyrhrPaLe40kFr6/PU9iNLdj/gS4BD7ki4MnvryhbPI=","AxnQYgcr737MperAb5fU1VlSwXWrawPq5ktEx9vxHPo=","KIE9yuuuqoKKN234evSmO8i3vyetScYpjvezh78oUm0=","JydnOyzLyQPxgb844cHUDSAzhlIAw1K8FQkord35y3g=","I07E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G5SFJVle4CckRxvNGC6VIfa3u2jx6Tvk/rsNPL4=","Ci9TdouOv2qGkTsOV8BOARykCGSKR0OofXetvwycNRI=","ACSBVhQv0Dc6R5+R/yOelg9Zn/fpS+abfyopAwXhGY0=","Fx1WILh7+xMoz4wCqz8MmjlxlqpqVCwjUOtRKisrzak=","FwpPVVNvfclwCHx8ENb612DJUhct1U3ZnRBF5Ow0qAg=","KaujP3mf5mwu8xNK6gQzbsw344wc0hG6SC7KF+Lb+uE=","HpvBeaT911j90bsZRQiNR+cNEUoD9qDotbplA2nmSXM=","HdJpeZtmD61Y9/SJLfsLWv6q2GmpxLRPnJ4cQ72vjwk=","Is28i3ARetFAEYHQLhVFnnzNQm/oacfJXR3Syw8krzg=","DvBC5FR3HFM6n1elXFA/zv0xUPUu2Up81bqTucfazv0=","EWCeBq1sj+Lyh/MDYDfohRMY6LCKA1mgOzBP/KYugoQ=","EWbZ5VRhbbqedT7qQnwXt/7NWMB23+QnCLCPW3g6qa8=","LeUpiUMahZWTQTAmNUQT2xd/v0zSrAtW+FWoiDV+5GY=","MAbrT/x6hYGabaSS86isHfUa7lsXuOiddL8Bz19x6a0=","KvQfu2G6ioD9z2//nj9vQimT/o8KRjn5YjRMgiUUUIY=","EZ5oTeR2FV/lprQajryF24cYqyeInoXngbIUus5IJ8M=","GDW3huLokl4Yi+pZrjY1N7USSMI4KPBHz/eEuXs/2AA=","KCAaNMWU36NNeUmWxkM6INFSusKnkFySbEDihasy7rY=","CD79eifRdRCU6A/vr3iwAIZMgutXEYdySnYfiMIsxOc=","C2+Io1dxmVJhWOYc7qJ76BHBbfd3TdhRngeVZPYf0Ts=","Dsho5tFeUdlkT2bh1kcalFiVEcoA0p4QFDkObuQlT1s=","KvM+P4ZncScawMmz7S4RQuzT50uTnNQNANk3q4TJhZE=","C1ICEfkEtefQm12WHGrOdzRWjFR91oWLNkzl5HlR8Xg=","Cy1yLQkZoarY21jxAGKpLqDFasQnDoIsyiKGIBiKHUA=","H3kNTX+M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w2x2Q3nbyizI/dFBXD3e1ilAvN4L13E=","LiQZ+ewC7DlMmHHIMpY9wbiddDyMe5ZAKbIxFoex/iM=","EBBx8AMjebaXMVh2aQ8FPRSNThCfX7BlyKrMVaD4m/o="],["FDAh7GhqPzMNX55lRjgGXObNeeKMWzdTMmJE7mWhsac=","F2zAKWla0CWCpw7/CKb9mdBX4S5Y59e2sWzfq8juKRE=","GaP8ClZwK/QXun/uOAJZP6ZERwMHBD93cyec1x0l1eA="]]};return Nn.default=i,Nn}var ao;function ir(){if(ao)return Le;ao=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.poseidon2=s;var i=e(ma()),t=e(wa()),n=e(er());function e(u){return u&&u.__esModule?u:{default:u}}const o=(0,t.default)(n.default);function s(u,r){return(0,i.default)(u,o,r)}return Le}var Be=ir();class vi{constructor(t){const n=new Gs(t);this._privateKey=n.privateKey,this._secretScalar=n.secretScalar,this._publicKey=n.publicKey,this._commitment=Be.poseidon2(this._publicKey)}get privateKey(){return this._privateKey}get secretScalar(){return this._secretScalar}get publicKey(){return this._publicKey}get commitment(){return this._commitment}export(){return oe(this._privateKey)?nr(this._privateKey):$s(this.privateKey)}static import(t){return new vi(tr(t))}signMessage(t){return Ua(this.privateKey,t)}static verifySignature(t,n,e){return Oa(t,n,e)}static generateCommitment(t){return Be.poseidon2(t)}}function or(i){return typeof i<"u"}function ar(i){return typeof i=="number"}function cr(i){return typeof i=="string"}function sr(i){return typeof i=="function"}function rr(i){return typeof i=="object"}function lr(i){return rr(i)&&Array.isArray(i)}function jt(i,t){if(!or(i))throw new TypeError(`Parameter '${t}' is not defined`)}function Ae(i,t){if(!ar(i))throw new TypeError(`Parameter '${t}' is not a number, received type: ${typeof i}`)}function dr(i,t){if(!cr(i))throw new TypeError(`Parameter '${t}' is not a string, received type: ${typeof i}`)}function Re(i,t){if(!sr(i))throw new TypeError(`Parameter '${t}' is not a function, received type: ${typeof i}`)}function Kn(i,t){if(!lr(i))throw new TypeError(`Parameter '${t}' is not an Array instance`)}class te{constructor(t,n=[]){jt(t,"hash"),Re(t,"hash"),Kn(n,"leaves"),this._nodes=[[]],this._hash=t,n.length>0&&this.insertMany(n)}get root(){return this._nodes[this.depth][0]}get depth(){return this._nodes.length-1}get leaves(){return this._nodes[0].slice()}get size(){return this._nodes[0].length}indexOf(t){return jt(t,"leaf"),this._nodes[0].indexOf(t)}has(t){return jt(t,"leaf"),this._nodes[0].includes(t)}insert(t){jt(t,"leaf"),this.depth<Math.ceil(Math.log2(this.size+1))&&this._nodes.push([]);let n=t,e=this.size;for(let o=0;o<this.depth;o+=1){if(this._nodes[o][e]=n,e&1){const s=this._nodes[o][e-1];n=this._hash(s,n)}e>>=1}this._nodes[this.depth]=[n]}insertMany(t){if(jt(t,"leaves"),Kn(t,"leaves"),t.length===0)throw new Error("There are no leaves to add");let n=this.size>>1;this._nodes[0]=this._nodes[0].concat(t);const e=Math.ceil(Math.log2(this.size))-this.depth;for(let o=0;o<e;o+=1)this._nodes.push([]);for(let o=0;o<this.depth;o+=1){const s=Math.ceil(this._nodes[o].length/2);for(let u=n;u<s;u+=1){const r=this._nodes[o][u*2+1],b=this._nodes[o][u*2],g=r!==void 0?this._hash(b,r):b;this._nodes[o+1][u]=g}n>>=1}}update(t,n){jt(t,"index"),jt(n,"newLeaf"),Ae(t,"index");let e=n;for(let o=0;o<this.depth;o+=1){if(this._nodes[o][t]=e,t&1){const s=this._nodes[o][t-1];e=this._hash(s,e)}else{const s=this._nodes[o][t+1];s!==void 0&&(e=this._hash(e,s))}t>>=1}this._nodes[this.depth]=[e]}updateMany(t,n){if(jt(n,"leaves"),jt(t,"indices"),Kn(n,"leaves"),Kn(t,"indices"),n.length!==t.length)throw new Error("There is no correspondence between indices and leaves");let e=new Set;for(let o=0;o<t.length;o+=1){if(Ae(t[o],`index ${o}`),t[o]<0||t[o]>=this.size)throw new Error(`Index ${o} is out of range`);if(e.has(t[o]))throw new Error(`Leaf ${t[o]} is repeated`);e.add(t[o])}e.clear();for(let o=0;o<t.length;o+=1)this._nodes[0][t[o]]=n[o],e.add(t[o]>>1);for(let o=1;o<=this.depth;o+=1){const s=[];for(const u of e){const r=this._nodes[o-1][2*u],b=this._nodes[o-1][2*u+1];this._nodes[o][u]=b!==void 0?this._hash(r,b):r,s.push(u>>1)}e=new Set(s)}}generateProof(t){if(jt(t,"index"),Ae(t,"index"),t<0||t>=this.size)throw new Error(`The leaf at index '${t}' does not exist in this tree`);const n=this.leaves[t],e=[],o=[];for(let s=0;s<this.depth;s+=1){const u=t&1,r=u?t-1:t+1,b=this._nodes[s][r];b!==void 0&&(o.push(u),e.push(b)),t>>=1}return{root:this.root,leaf:n,index:o.length===0?0:Number.parseInt(o.reverse().join(""),2),siblings:e}}verifyProof(t){return te.verifyProof(t,this._hash)}static verifyProof(t,n){jt(t,"proof");const{root:e,leaf:o,siblings:s,index:u}=t;jt(t.root,"proof.root"),jt(t.leaf,"proof.leaf"),jt(t.siblings,"proof.siblings"),jt(t.index,"proof.index"),Kn(t.siblings,"proof.siblings"),Ae(t.index,"proof.index");let r=o;for(let b=0;b<s.length;b+=1)u>>b&1?r=n(s[b],r):r=n(r,s[b]);return e===r}export(){return JSON.stringify(this._nodes,(t,n)=>typeof n=="bigint"?n.toString():n)}static import(t,n,e){jt(t,"hash"),jt(n,"nodes"),Re(t,"hash"),dr(n,"nodes"),e&&(jt(e,"map"),Re(e,"map"));const o=new te(t);return o._nodes=JSON.parse(n,(s,u)=>typeof u=="string"?e?e(u):BigInt(u):u),o}}class qi{constructor(t=[]){this.leanIMT=new te((n,e)=>Be.poseidon2([n,e]),t.map(BigInt))}get root(){return this.leanIMT.root?this.leanIMT.root:0n}get depth(){return this.leanIMT.depth}get size(){return this.leanIMT.size}get members(){return this.leanIMT.leaves}indexOf(t){return this.leanIMT.indexOf(BigInt(t))}addMember(t){if(t===0n||t==="0")throw new Error("Failed to add member: value cannot be 0");this.leanIMT.insert(BigInt(t))}addMembers(t){for(const n of t)if(n===0n||n==="0")throw new Error("Failed to add member: value cannot be 0");this.leanIMT.insertMany(t.map(BigInt))}updateMember(t,n){if(this.members[t]===0n)throw new Error("Failed to update member: it has been removed");this.leanIMT.update(t,BigInt(n))}removeMember(t){if(this.members[t]===0n)throw new Error("Failed to remove member: it has already been removed");this.leanIMT.update(t,0n)}generateMerkleProof(t){return this.leanIMT.generateProof(t)}export(){return this.leanIMT.export()}static import(t){const n=new qi;return n.leanIMT=te.import((e,o)=>Be.poseidon2([e,o]),t),n}}function ur(i){return[i.pi_a[0],i.pi_a[1],i.pi_b[0][1],i.pi_b[0][0],i.pi_b[1][1],i.pi_b[1][0],i.pi_c[0],i.pi_c[1]]}const co=1,so=32;var Ee;(function(i){i.POSEIDON="poseidon",i.SEMAPHORE="semaphore",i.SEMAPHORE_IDENTITY="semaphore-identity"})(Ee||(Ee={}));const fr=Object.values(Ee).sort(),gr="https://snark-artifacts.pse.dev",hr=(i,t)=>`${gr}/${i}/${t}/${i}`;async function _r(i,t={}){if(!fr.includes(i))throw new Error(`Project '${i}' is not supported`);t.version??="latest";const n=hr(i,t.version),e=t.parameters?`-${t.parameters.join("-")}`:"";return{wasm:`${n}${e}.wasm`,zkey:`${n}${e}.zkey`}}const pr=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function Pe(i,t){if(!t||t==10)return BigInt(i);if(t==16)return i.slice(0,2)=="0x"?BigInt(i):BigInt("0x"+i)}const Ht=Pe;function Lr(i,t){let n=BigInt(0);t=BigInt(t);for(let e=0;e<i.length;e++)n=n*t+BigInt(i[e]);return n}function ae(i){const t=i.toString(16);return(t.length-1)*4+pr[parseInt(t[0],16)]}function qa(i){return BigInt(i)<BigInt(0)}function Ta(i){return!i}function xe(i,t){return BigInt(i)<<BigInt(t)}function qn(i,t){return BigInt(i)>>BigInt(t)}const Ar=xe,yr=qn;function Ti(i){return(BigInt(i)&BigInt(1))==BigInt(1)}function Ir(i){let t=BigInt(i);const n=[];for(;t;){if(t&BigInt(1)){const e=2-Number(t%BigInt(4));n.push(e),t=t-BigInt(e)}else n.push(0);t=t>>BigInt(1)}return n}function ka(i){let t=BigInt(i);const n=[];for(;t;)t&BigInt(1)?n.push(1):n.push(0),t=t>>BigInt(1);return n}function Da(i){if(i>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(i)}function br(i,t){const n=[];let e=BigInt(i);for(t=BigInt(t);e;)n.unshift(Number(e%t)),e=e/t;return n}function ki(i,t){return BigInt(i)+BigInt(t)}function un(i,t){return BigInt(i)-BigInt(t)}function za(i){return-BigInt(i)}function Ra(i,t){return BigInt(i)*BigInt(t)}function Cr(i){return BigInt(i)*BigInt(i)}function ce(i,t){return BigInt(i)**BigInt(t)}function mr(i,t){return BigInt(i)**BigInt(t)}function wr(i){return BigInt(i)>=0?BigInt(i):-BigInt(i)}function Tn(i,t){return BigInt(i)/BigInt(t)}function cn(i,t){return BigInt(i)%BigInt(t)}function Bn(i,t){return BigInt(i)==BigInt(t)}function Br(i,t){return BigInt(i)!=BigInt(t)}function Er(i,t){return BigInt(i)<BigInt(t)}function si(i,t){return BigInt(i)>BigInt(t)}function xr(i,t){return BigInt(i)<=BigInt(t)}function Ga(i,t){return BigInt(i)>=BigInt(t)}function Di(i,t){return BigInt(i)&BigInt(t)}function Fr(i,t){return BigInt(i)|BigInt(t)}function Sr(i,t){return BigInt(i)^BigInt(t)}function Ur(i,t){return BigInt(i)&&BigInt(t)}function Or(i,t){return BigInt(i)||BigInt(t)}function Mr(i){return!BigInt(i)}function ne(i,t,n,e){const o="0000000"+n.toString(16),s=new Uint32Array(i.buffer,i.byteOffset+t,e/4),u=((o.length-7)*4-1>>5)+1;for(let r=0;r<u;r++)s[r]=parseInt(o.substring(o.length-8*r-8,o.length-8*r),16);for(let r=u;r<s.length;r++)s[r]=0;for(let r=s.length*4;r<e;r++)i[r]=Da(Di(qn(n,r*8),255))}function Na(i,t,n,e){const o="0000000"+n.toString(16),s=new DataView(i.buffer,i.byteOffset+t,e),u=((o.length-7)*4-1>>5)+1;for(let r=0;r<u;r++)s.setUint32(e-r*4-4,parseInt(o.substring(o.length-8*r-8,o.length-8*r),16),!1);for(let r=0;r<e/4-u;r++)s[r]=0}function ee(i,t,n){n=n||i.byteLength,t=t||0;const e=new Uint32Array(i.buffer,i.byteOffset+t,n/4),o=new Array(n/4);return e.forEach((s,u)=>o[o.length-u-1]=s.toString(16).padStart(8,"0")),Pe(o.join(""),16)}function Ka(i,t,n){n=n||i.byteLength,t=t||0;const e=new DataView(i.buffer,i.byteOffset+t,n),o=new Array(n/4);for(let s=0;s<n/4;s++)o[s]=e.getUint32(s*4,!1).toString(16).padStart(8,"0");return Pe(o.join(""),16)}function Ha(i,t){return i.toString(t)}function kn(i){const t=new Uint8Array(Math.floor((ae(i)-1)/8)+1);return ne(t,0,i,t.byteLength),t}const Va=Ht(0),En=Ht(1);var Pr=Object.freeze({__proto__:null,abs:wr,add:ki,band:Di,bitLength:ae,bits:ka,bor:Fr,bxor:Sr,div:Tn,e:Ht,eq:Bn,exp:mr,fromArray:Lr,fromRprBE:Ka,fromRprLE:ee,fromString:Pe,geq:Ga,gt:si,isNegative:qa,isOdd:Ti,isZero:Ta,land:Ur,leq:xr,lnot:Mr,lor:Or,lt:Er,mod:cn,mul:Ra,naf:Ir,neg:za,neq:Br,one:En,pow:ce,shiftLeft:xe,shiftRight:qn,shl:Ar,shr:yr,square:Cr,sub:un,toArray:br,toLEBuff:kn,toNumber:Da,toRprBE:Na,toRprLE:ne,toString:Ha,zero:Va});function ro(i,t,n){if(Ta(n))return i.one;const e=ka(n);if(e.length==0)return i.one;let o=t;for(let s=e.length-2;s>=0;s--)o=i.square(o),e[s]&&(o=i.mul(o,t));return o}function Qr(i){if(i.m%2==1)if(Bn(cn(i.p,4),1))if(Bn(cn(i.p,8),1))if(Bn(cn(i.p,16),1))vr(i);else if(Bn(cn(i.p,16),9))qr(i);else throw new Error("Field withot sqrt");else if(Bn(cn(i.p,8),5))Tr(i);else throw new Error("Field withot sqrt");else Bn(cn(i.p,4),3)&&kr(i);else{const t=cn(ce(i.p,i.m/2),4);t==1?Dr(i):t==3?zr(i):Rr(i)}}function vr(i){for(i.sqrt_q=ce(i.p,i.m),i.sqrt_s=0,i.sqrt_t=un(i.sqrt_q,1);!Ti(i.sqrt_t);)i.sqrt_s=i.sqrt_s+1,i.sqrt_t=Tn(i.sqrt_t,2);let t=i.one;for(;i.eq(t,i.one);){const n=i.random();i.sqrt_z=i.pow(n,i.sqrt_t),t=i.pow(i.sqrt_z,2**(i.sqrt_s-1))}i.sqrt_tm1d2=Tn(un(i.sqrt_t,1),2),i.sqrt=function(n){const e=this;if(e.isZero(n))return e.zero;let o=e.pow(n,e.sqrt_tm1d2);const s=e.pow(e.mul(e.square(o),n),2**(e.sqrt_s-1));if(e.eq(s,e.negone))return null;let u=e.sqrt_s,r=e.mul(n,o),b=e.mul(r,o),g=e.sqrt_z;for(;!e.eq(b,e.one);){let l=e.square(b),x=1;for(;!e.eq(l,e.one);)l=e.square(l),x++;o=g;for(let F=0;F<u-x-1;F++)o=e.square(o);g=e.square(o),b=e.mul(b,g),r=e.mul(r,o),u=x}return e.geq(r,e.zero)?r:e.neg(r)}}function qr(i){i.sqrt=function(){throw new Error("Sqrt alg 4 not implemented")}}function Tr(i){i.sqrt=function(){throw new Error("Sqrt alg 3 not implemented")}}function kr(i){i.sqrt_q=ce(i.p,i.m),i.sqrt_e1=Tn(un(i.sqrt_q,3),4),i.sqrt=function(t){if(this.isZero(t))return this.zero;const n=this.pow(t,this.sqrt_e1),e=this.mul(this.square(n),t);if(this.eq(e,this.negone))return null;const o=this.mul(n,t);return i.geq(o,i.zero)?o:i.neg(o)}}function Dr(i){i.sqrt=function(){throw new Error("Sqrt alg 10 not implemented")}}function zr(i){i.sqrt_q=ce(i.p,i.m/2),i.sqrt_e34=Tn(un(i.sqrt_q,3),4),i.sqrt_e12=Tn(un(i.sqrt_q,1),2),i.frobenius=function(t,n){return t%2==1?i.conjugate(n):n},i.sqrt=function(t){const n=this,e=n.pow(t,n.sqrt_e34),o=n.mul(n.square(e),t),s=n.mul(n.frobenius(1,o),o);if(n.eq(s,n.negone))return null;const u=n.mul(e,t);let r;if(n.eq(o,n.negone))r=n.mul(u,[n.F.zero,n.F.one]);else{const b=n.pow(n.add(n.one,o),n.sqrt_e12);r=n.mul(b,u)}return n.geq(r,n.zero)?r:n.neg(r)}}function Rr(i){i.sqrt=function(){throw new Error("Sqrt alg 8 not implemented")}}function In(i,t,n,e,o){i[t]=i[t]+i[n]>>>0,i[o]=(i[o]^i[t])>>>0,i[o]=(i[o]<<16|i[o]>>>16&65535)>>>0,i[e]=i[e]+i[o]>>>0,i[n]=(i[n]^i[e])>>>0,i[n]=(i[n]<<12|i[n]>>>20&4095)>>>0,i[t]=i[t]+i[n]>>>0,i[o]=(i[o]^i[t])>>>0,i[o]=(i[o]<<8|i[o]>>>24&255)>>>0,i[e]=i[e]+i[o]>>>0,i[n]=(i[n]^i[e])>>>0,i[n]=(i[n]<<7|i[n]>>>25&127)>>>0}function Gr(i){In(i,0,4,8,12),In(i,1,5,9,13),In(i,2,6,10,14),In(i,3,7,11,15),In(i,0,5,10,15),In(i,1,6,11,12),In(i,2,7,8,13),In(i,3,4,9,14)}class Nr{constructor(t){t=t||[0,0,0,0,0,0,0,0],this.state=[1634760805,857760878,2036477234,1797285236,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],0,0,0,0],this.idx=16,this.buff=new Array(16)}nextU32(){return this.idx==16&&this.update(),this.buff[this.idx++]}nextU64(){return ki(Ra(this.nextU32(),4294967296),this.nextU32())}nextBool(){return(this.nextU32()&1)==1}update(){for(let t=0;t<16;t++)this.buff[t]=this.state[t];for(let t=0;t<10;t++)Gr(this.buff);for(let t=0;t<16;t++)this.buff[t]=this.buff[t]+this.state[t]>>>0;this.idx=0,this.state[12]=this.state[12]+1>>>0,this.state[12]==0&&(this.state[13]=this.state[13]+1>>>0,this.state[13]==0&&(this.state[14]=this.state[14]+1>>>0,this.state[14]==0&&(this.state[15]=this.state[15]+1>>>0)))}}function ja(i){let t=new Uint8Array(i);if(typeof globalThis.crypto<"u")globalThis.crypto.getRandomValues(t);else for(let n=0;n<i;n++)t[n]=Math.random()*4294967296>>>0;return t}function Kr(){const i=ja(32),t=new Uint32Array(i.buffer),n=[];for(let e=0;e<8;e++)n.push(t[e]);return n}let ye=null;function zi(){return ye||(ye=new Nr(Kr()),ye)}class Hr{constructor(t,n,e){this.F=n,this.G=t,this.opMulGF=e;let o=n.sqrt_t||n.t,s=n.sqrt_s||n.s,u=n.one;for(;n.eq(n.pow(u,n.half),n.one);)u=n.add(u,n.one);this.w=new Array(s+1),this.wi=new Array(s+1),this.w[s]=this.F.pow(u,o),this.wi[s]=this.F.inv(this.w[s]);let r=s-1;for(;r>=0;)this.w[r]=this.F.square(this.w[r+1]),this.wi[r]=this.F.square(this.wi[r+1]),r--;this.roots=[],this._setRoots(Math.min(s,15))}_setRoots(t){for(let n=t;n>=0&&!this.roots[n];n--){let e=this.F.one;const o=1<<n,s=new Array(o);for(let u=0;u<o;u++)s[u]=e,e=this.F.mul(e,this.w[n]);this.roots[n]=s}}fft(t){if(t.length<=1)return t;const n=lo(t.length-1)+1;this._setRoots(n);const e=1<<n;if(t.length!=e)throw new Error("Size must be multiple of 2");return Fe(this,t,n,0,1)}ifft(t){if(t.length<=1)return t;const n=lo(t.length-1)+1;this._setRoots(n);const e=1<<n;if(t.length!=e)throw new Error("Size must be multiple of 2");const o=Fe(this,t,n,0,1),s=this.F.inv(this.F.mulScalar(this.F.one,e)),u=new Array(e);for(let r=0;r<e;r++)u[r]=this.opMulGF(o[(e-r)%e],s);return u}}function lo(i){return((i&4294901760)!==0?(i&=4294901760,16):0)|((i&4278255360)!==0?(i&=4278255360,8):0)|((i&4042322160)!==0?(i&=4042322160,4):0)|((i&3435973836)!==0?(i&=3435973836,2):0)|(i&2863311530)!==0}function Fe(i,t,n,e,o){const s=1<<n;if(s==1)return[t[e]];if(s==2)return[i.G.add(t[e],t[e+o]),i.G.sub(t[e],t[e+o])];const u=s>>1,r=Fe(i,t,n-1,e,o*2),b=Fe(i,t,n-1,e+o,o*2),g=new Array(s);for(let l=0;l<u;l++)g[l]=i.G.add(r[l],i.opMulGF(b[l],i.roots[n][l])),g[l+u]=i.G.sub(r[l],i.opMulGF(b[l],i.roots[n][l]));return g}class Vr{constructor(t){this.type="F1",this.one=BigInt(1),this.zero=BigInt(0),this.p=BigInt(t),this.m=1,this.negone=this.p-this.one,this.two=BigInt(2),this.half=this.p>>this.one,this.bitLength=ae(this.p),this.mask=(this.one<<BigInt(this.bitLength))-this.one,this.n64=Math.floor((this.bitLength-1)/64)+1,this.n32=this.n64*2,this.n8=this.n64*8,this.R=this.e(this.one<<BigInt(this.n64*64)),this.Ri=this.inv(this.R);const n=this.negone>>this.one;this.nqr=this.two;let e=this.pow(this.nqr,n);for(;!this.eq(e,this.negone);)this.nqr=this.nqr+this.one,e=this.pow(this.nqr,n);for(this.s=0,this.t=this.negone;(this.t&this.one)==this.zero;)this.s=this.s+1,this.t=this.t>>this.one;this.nqr_to_t=this.pow(this.nqr,this.t),Qr(this),this.FFT=new Hr(this,this,this.mul.bind(this)),this.fft=this.FFT.fft.bind(this.FFT),this.ifft=this.FFT.ifft.bind(this.FFT),this.w=this.FFT.w,this.wi=this.FFT.wi,this.shift=this.square(this.nqr),this.k=this.exp(this.nqr,2**this.s)}e(t,n){let e;if(n?n==16&&(e=BigInt("0x"+t)):e=BigInt(t),e<0){let o=-e;return o>=this.p&&(o=o%this.p),this.p-o}else return e>=this.p?e%this.p:e}add(t,n){const e=t+n;return e>=this.p?e-this.p:e}sub(t,n){return t>=n?t-n:this.p-n+t}neg(t){return t&&this.p-t}mul(t,n){return t*n%this.p}mulScalar(t,n){return t*this.e(n)%this.p}square(t){return t*t%this.p}eq(t,n){return t==n}neq(t,n){return t!=n}lt(t,n){const e=t>this.half?t-this.p:t,o=n>this.half?n-this.p:n;return e<o}gt(t,n){const e=t>this.half?t-this.p:t,o=n>this.half?n-this.p:n;return e>o}leq(t,n){const e=t>this.half?t-this.p:t,o=n>this.half?n-this.p:n;return e<=o}geq(t,n){const e=t>this.half?t-this.p:t,o=n>this.half?n-this.p:n;return e>=o}div(t,n){return this.mul(t,this.inv(n))}idiv(t,n){if(!n)throw new Error("Division by zero");return t/n}inv(t){if(!t)throw new Error("Division by zero");let n=this.zero,e=this.p,o=this.one,s=t%this.p;for(;s;){let u=e/s;[n,o]=[o,n-u*o],[e,s]=[s,e-u*s]}return n<this.zero&&(n+=this.p),n}mod(t,n){return t%n}pow(t,n){return ro(this,t,n)}exp(t,n){return ro(this,t,n)}band(t,n){const e=t&n&this.mask;return e>=this.p?e-this.p:e}bor(t,n){const e=(t|n)&this.mask;return e>=this.p?e-this.p:e}bxor(t,n){const e=(t^n)&this.mask;return e>=this.p?e-this.p:e}bnot(t){const n=t^this.mask;return n>=this.p?n-this.p:n}shl(t,n){if(Number(n)<this.bitLength){const e=t<<n&this.mask;return e>=this.p?e-this.p:e}else{const e=this.p-n;return Number(e)<this.bitLength?t>>e:this.zero}}shr(t,n){if(Number(n)<this.bitLength)return t>>n;{const e=this.p-n;if(Number(e)<this.bitLength){const o=t<<e&this.mask;return o>=this.p?o-this.p:o}else return 0}}land(t,n){return t&&n?this.one:this.zero}lor(t,n){return t||n?this.one:this.zero}lnot(t){return t?this.zero:this.one}sqrt_old(t){if(t==this.zero)return this.zero;if(this.pow(t,this.negone>>this.one)!=this.one)return null;let e=this.s,o=this.nqr_to_t,s=this.pow(t,this.t),u=this.pow(t,this.add(this.t,this.one)>>this.one);for(;s!=this.one;){let r=this.square(s),b=1;for(;r!=this.one;)b++,r=this.square(r);let g=o;for(let l=0;l<e-b-1;l++)g=this.square(g);e=b,o=this.square(g),s=this.mul(s,o),u=this.mul(u,g)}return u>this.p>>this.one&&(u=this.neg(u)),u}normalize(t,n){if(t=BigInt(t,n),t<0){let e=-t;return e>=this.p&&(e=e%this.p),this.p-e}else return t>=this.p?t%this.p:t}random(){const t=this.bitLength*2/8;let n=this.zero;for(let e=0;e<t;e++)n=(n<<BigInt(8))+BigInt(ja(1)[0]);return n%this.p}toString(t,n){n=n||10;let e;return t>this.half&&n==10?e="-"+(this.p-t).toString(n):e=t.toString(n),e}isZero(t){return t==this.zero}fromRng(t){let n;do{n=this.zero;for(let e=0;e<this.n64;e++)n+=t.nextU64()<<BigInt(64*e);n&=this.mask}while(n>=this.p);return n=n*this.Ri%this.p,n}fft(t){return this.FFT.fft(t)}ifft(t){return this.FFT.ifft(t)}toRprLE(t,n,e){ne(t,n,e,this.n64*8)}toRprBE(t,n,e){Na(t,n,e,this.n64*8)}toRprBEM(t,n,e){return this.toRprBE(t,n,this.mul(this.R,e))}toRprLEM(t,n,e){return this.toRprLE(t,n,this.mul(this.R,e))}fromRprLE(t,n){return ee(t,n,this.n8)}fromRprBE(t,n){return Ka(t,n,this.n8)}fromRprLEM(t,n){return this.mul(this.fromRprLE(t,n),this.Ri)}fromRprBEM(t,n){return this.mul(this.fromRprBE(t,n),this.Ri)}toObject(t){return t}}var Cn={};Cn.bigInt2BytesLE=function(t,n){const e=Array(n);let o=BigInt(t);for(let s=0;s<n;s++)e[s]=Number(o&0xFFn),o=o>>8n;return e};Cn.bigInt2U32LE=function(t,n){const e=Array(n);let o=BigInt(t);for(let s=0;s<n;s++)e[s]=Number(o&0xFFFFFFFFn),o=o>>32n;return e};Cn.isOcamNum=function(i){return!(!Array.isArray(i)||i.length!=3||typeof i[0]!="number"||typeof i[1]!="number"||!Array.isArray(i[2]))};var jr=function(t,n,e){const o=e||"int";if(t.modules[o])return o;t.modules[o]={};const s=n*2,u=n*8;function r(){const O=t.addFunction(o+"_copy");O.addParam("px","i32"),O.addParam("pr","i32");const h=O.getCodeBuilder();for(let A=0;A<n;A++)O.addCode(h.i64_store(h.getLocal("pr"),A*8,h.i64_load(h.getLocal("px"),A*8)))}function b(){const O=t.addFunction(o+"_zero");O.addParam("pr","i32");const h=O.getCodeBuilder();for(let A=0;A<n;A++)O.addCode(h.i64_store(h.getLocal("pr"),A*8,h.i64_const(0)))}function g(){const O=t.addFunction(o+"_one");O.addParam("pr","i32");const h=O.getCodeBuilder();O.addCode(h.i64_store(h.getLocal("pr"),0,h.i64_const(1)));for(let A=1;A<n;A++)O.addCode(h.i64_store(h.getLocal("pr"),A*8,h.i64_const(0)))}function l(){const O=t.addFunction(o+"_isZero");O.addParam("px","i32"),O.setReturnType("i32");const h=O.getCodeBuilder();function A(Z){return Z==0?h.ret(h.i64_eqz(h.i64_load(h.getLocal("px")))):h.if(h.i64_eqz(h.i64_load(h.getLocal("px"),Z*8)),A(Z-1),h.ret(h.i32_const(0)))}O.addCode(A(n-1)),O.addCode(h.ret(h.i32_const(0)))}function x(){const O=t.addFunction(o+"_eq");O.addParam("px","i32"),O.addParam("py","i32"),O.setReturnType("i32");const h=O.getCodeBuilder();function A(Z){return Z==0?h.ret(h.i64_eq(h.i64_load(h.getLocal("px")),h.i64_load(h.getLocal("py")))):h.if(h.i64_eq(h.i64_load(h.getLocal("px"),Z*8),h.i64_load(h.getLocal("py"),Z*8)),A(Z-1),h.ret(h.i32_const(0)))}O.addCode(A(n-1)),O.addCode(h.ret(h.i32_const(0)))}function F(){const O=t.addFunction(o+"_gte");O.addParam("px","i32"),O.addParam("py","i32"),O.setReturnType("i32");const h=O.getCodeBuilder();function A(Z){return Z==0?h.ret(h.i64_ge_u(h.i64_load(h.getLocal("px")),h.i64_load(h.getLocal("py")))):h.if(h.i64_lt_u(h.i64_load(h.getLocal("px"),Z*8),h.i64_load(h.getLocal("py"),Z*8)),h.ret(h.i32_const(0)),h.if(h.i64_gt_u(h.i64_load(h.getLocal("px"),Z*8),h.i64_load(h.getLocal("py"),Z*8)),h.ret(h.i32_const(1)),A(Z-1)))}O.addCode(A(n-1)),O.addCode(h.ret(h.i32_const(0)))}function I(){const O=t.addFunction(o+"_add");O.addParam("x","i32"),O.addParam("y","i32"),O.addParam("r","i32"),O.setReturnType("i32"),O.addLocal("c","i64");const h=O.getCodeBuilder();O.addCode(h.setLocal("c",h.i64_add(h.i64_load32_u(h.getLocal("x")),h.i64_load32_u(h.getLocal("y"))))),O.addCode(h.i64_store32(h.getLocal("r"),h.getLocal("c")));for(let A=1;A<s;A++)O.addCode(h.setLocal("c",h.i64_add(h.i64_add(h.i64_load32_u(h.getLocal("x"),4*A),h.i64_load32_u(h.getLocal("y"),4*A)),h.i64_shr_u(h.getLocal("c"),h.i64_const(32))))),O.addCode(h.i64_store32(h.getLocal("r"),A*4,h.getLocal("c")));O.addCode(h.i32_wrap_i64(h.i64_shr_u(h.getLocal("c"),h.i64_const(32))))}function k(){const O=t.addFunction(o+"_sub");O.addParam("x","i32"),O.addParam("y","i32"),O.addParam("r","i32"),O.setReturnType("i32"),O.addLocal("c","i64");const h=O.getCodeBuilder();O.addCode(h.setLocal("c",h.i64_sub(h.i64_load32_u(h.getLocal("x")),h.i64_load32_u(h.getLocal("y"))))),O.addCode(h.i64_store32(h.getLocal("r"),h.i64_and(h.getLocal("c"),h.i64_const("0xFFFFFFFF"))));for(let A=1;A<s;A++)O.addCode(h.setLocal("c",h.i64_add(h.i64_sub(h.i64_load32_u(h.getLocal("x"),4*A),h.i64_load32_u(h.getLocal("y"),4*A)),h.i64_shr_s(h.getLocal("c"),h.i64_const(32))))),O.addCode(h.i64_store32(h.getLocal("r"),A*4,h.i64_and(h.getLocal("c"),h.i64_const("0xFFFFFFFF"))));O.addCode(h.i32_wrap_i64(h.i64_shr_s(h.getLocal("c"),h.i64_const(32))))}function z(){const O=t.addFunction(o+"_mul");O.addParam("x","i32"),O.addParam("y","i32"),O.addParam("r","i32"),O.addLocal("c0","i64"),O.addLocal("c1","i64");for(let C=0;C<s;C++)O.addLocal("x"+C,"i64"),O.addLocal("y"+C,"i64");const h=O.getCodeBuilder(),A=[],Z=[];function tt(C,T){let V,ut;return A[C]?V=h.getLocal("x"+C):(V=h.teeLocal("x"+C,h.i64_load32_u(h.getLocal("x"),C*4)),A[C]=!0),Z[T]?ut=h.getLocal("y"+T):(ut=h.teeLocal("y"+T,h.i64_load32_u(h.getLocal("y"),T*4)),Z[T]=!0),h.i64_mul(V,ut)}let at="c0",R="c1";for(let C=0;C<s*2-1;C++){for(let T=Math.max(0,C-s+1);T<=C&&T<s;T++){const V=C-T;O.addCode(h.setLocal(at,h.i64_add(h.i64_and(h.getLocal(at),h.i64_const(4294967295)),tt(T,V)))),O.addCode(h.setLocal(R,h.i64_add(h.getLocal(R),h.i64_shr_u(h.getLocal(at),h.i64_const(32)))))}O.addCode(h.i64_store32(h.getLocal("r"),C*4,h.getLocal(at))),[at,R]=[R,at],O.addCode(h.setLocal(R,h.i64_shr_u(h.getLocal(at),h.i64_const(32))))}O.addCode(h.i64_store32(h.getLocal("r"),s*4*2-4,h.getLocal(at)))}function S(){const O=t.addFunction(o+"_square");O.addParam("x","i32"),O.addParam("r","i32"),O.addLocal("c0","i64"),O.addLocal("c1","i64"),O.addLocal("c0_old","i64"),O.addLocal("c1_old","i64");for(let T=0;T<s;T++)O.addLocal("x"+T,"i64");const h=O.getCodeBuilder(),A=[];function Z(T,V){let ut,ct;return A[T]?ut=h.getLocal("x"+T):(ut=h.teeLocal("x"+T,h.i64_load32_u(h.getLocal("x"),T*4)),A[T]=!0),A[V]?ct=h.getLocal("x"+V):(ct=h.teeLocal("x"+V,h.i64_load32_u(h.getLocal("x"),V*4)),A[V]=!0),h.i64_mul(ut,ct)}let tt="c0",at="c1",R="c0_old",C="c1_old";for(let T=0;T<s*2-1;T++){O.addCode(h.setLocal(tt,h.i64_const(0)),h.setLocal(at,h.i64_const(0)));for(let V=Math.max(0,T-s+1);V<T+1>>1&&V<s;V++){const ut=T-V;O.addCode(h.setLocal(tt,h.i64_add(h.i64_and(h.getLocal(tt),h.i64_const(4294967295)),Z(V,ut)))),O.addCode(h.setLocal(at,h.i64_add(h.getLocal(at),h.i64_shr_u(h.getLocal(tt),h.i64_const(32)))))}O.addCode(h.setLocal(tt,h.i64_shl(h.i64_and(h.getLocal(tt),h.i64_const(4294967295)),h.i64_const(1)))),O.addCode(h.setLocal(at,h.i64_add(h.i64_shl(h.getLocal(at),h.i64_const(1)),h.i64_shr_u(h.getLocal(tt),h.i64_const(32))))),T%2==0&&(O.addCode(h.setLocal(tt,h.i64_add(h.i64_and(h.getLocal(tt),h.i64_const(4294967295)),Z(T>>1,T>>1)))),O.addCode(h.setLocal(at,h.i64_add(h.getLocal(at),h.i64_shr_u(h.getLocal(tt),h.i64_const(32)))))),T>0&&(O.addCode(h.setLocal(tt,h.i64_add(h.i64_and(h.getLocal(tt),h.i64_const(4294967295)),h.i64_and(h.getLocal(R),h.i64_const(4294967295))))),O.addCode(h.setLocal(at,h.i64_add(h.i64_add(h.getLocal(at),h.i64_shr_u(h.getLocal(tt),h.i64_const(32))),h.getLocal(C))))),O.addCode(h.i64_store32(h.getLocal("r"),T*4,h.getLocal(tt))),O.addCode(h.setLocal(R,h.getLocal(at)),h.setLocal(C,h.i64_shr_u(h.getLocal(R),h.i64_const(32))))}O.addCode(h.i64_store32(h.getLocal("r"),s*4*2-4,h.getLocal(R)))}function G(){const O=t.addFunction(o+"_squareOld");O.addParam("x","i32"),O.addParam("r","i32");const h=O.getCodeBuilder();O.addCode(h.call(o+"_mul",h.getLocal("x"),h.getLocal("x"),h.getLocal("r")))}function U(){const O=t.addFunction(o+"__mul1");O.addParam("px","i32"),O.addParam("y","i64"),O.addParam("pr","i32"),O.addLocal("c","i64");const h=O.getCodeBuilder();O.addCode(h.setLocal("c",h.i64_mul(h.i64_load32_u(h.getLocal("px"),0,0),h.getLocal("y")))),O.addCode(h.i64_store32(h.getLocal("pr"),0,0,h.getLocal("c")));for(let A=1;A<s;A++)O.addCode(h.setLocal("c",h.i64_add(h.i64_mul(h.i64_load32_u(h.getLocal("px"),4*A,0),h.getLocal("y")),h.i64_shr_u(h.getLocal("c"),h.i64_const(32))))),O.addCode(h.i64_store32(h.getLocal("pr"),A*4,0,h.getLocal("c")))}function rt(){const O=t.addFunction(o+"__add1");O.addParam("x","i32"),O.addParam("y","i64"),O.addLocal("c","i64"),O.addLocal("px","i32");const h=O.getCodeBuilder();O.addCode(h.setLocal("px",h.getLocal("x"))),O.addCode(h.setLocal("c",h.i64_add(h.i64_load32_u(h.getLocal("px"),0,0),h.getLocal("y")))),O.addCode(h.i64_store32(h.getLocal("px"),0,0,h.getLocal("c"))),O.addCode(h.setLocal("c",h.i64_shr_u(h.getLocal("c"),h.i64_const(32)))),O.addCode(h.block(h.loop(h.br_if(1,h.i64_eqz(h.getLocal("c"))),h.setLocal("px",h.i32_add(h.getLocal("px"),h.i32_const(4))),h.setLocal("c",h.i64_add(h.i64_load32_u(h.getLocal("px"),0,0),h.getLocal("c"))),h.i64_store32(h.getLocal("px"),0,0,h.getLocal("c")),h.setLocal("c",h.i64_shr_u(h.getLocal("c"),h.i64_const(32))),h.br(0))))}function H(){U(),rt();const O=t.addFunction(o+"_div");O.addParam("x","i32"),O.addParam("y","i32"),O.addParam("c","i32"),O.addParam("r","i32"),O.addLocal("rr","i32"),O.addLocal("cc","i32"),O.addLocal("eX","i32"),O.addLocal("eY","i32"),O.addLocal("sy","i64"),O.addLocal("sx","i64"),O.addLocal("ec","i32");const h=O.getCodeBuilder(),A=h.i32_const(t.alloc(u)),Z=h.i32_const(t.alloc(u)),tt=h.i32_const(t.alloc(u)),at=h.getLocal("cc"),R=h.getLocal("rr"),C=t.alloc(u*2),T=h.i32_const(C),V=h.i32_const(C+u);O.addCode(h.if(h.getLocal("c"),h.setLocal("cc",h.getLocal("c")),h.setLocal("cc",Z))),O.addCode(h.if(h.getLocal("r"),h.setLocal("rr",h.getLocal("r")),h.setLocal("rr",tt))),O.addCode(h.call(o+"_copy",h.getLocal("x"),R)),O.addCode(h.call(o+"_copy",h.getLocal("y"),A)),O.addCode(h.call(o+"_zero",at)),O.addCode(h.call(o+"_zero",T)),O.addCode(h.setLocal("eX",h.i32_const(u-1))),O.addCode(h.setLocal("eY",h.i32_const(u-1))),O.addCode(h.block(h.loop(h.br_if(1,h.i32_or(h.i32_load8_u(h.i32_add(A,h.getLocal("eY")),0,0),h.i32_eq(h.getLocal("eY"),h.i32_const(3)))),h.setLocal("eY",h.i32_sub(h.getLocal("eY"),h.i32_const(1))),h.br(0)))),O.addCode(h.setLocal("sy",h.i64_add(h.i64_load32_u(h.i32_sub(h.i32_add(A,h.getLocal("eY")),h.i32_const(3)),0,0),h.i64_const(1)))),O.addCode(h.if(h.i64_eq(h.getLocal("sy"),h.i64_const(1)),h.drop(h.i64_div_u(h.i64_const(0),h.i64_const(0))))),O.addCode(h.block(h.loop(h.block(h.loop(h.br_if(1,h.i32_or(h.i32_load8_u(h.i32_add(R,h.getLocal("eX")),0,0),h.i32_eq(h.getLocal("eX"),h.i32_const(7)))),h.setLocal("eX",h.i32_sub(h.getLocal("eX"),h.i32_const(1))),h.br(0))),h.setLocal("sx",h.i64_load(h.i32_sub(h.i32_add(R,h.getLocal("eX")),h.i32_const(7)),0,0)),h.setLocal("sx",h.i64_div_u(h.getLocal("sx"),h.getLocal("sy"))),h.setLocal("ec",h.i32_sub(h.i32_sub(h.getLocal("eX"),h.getLocal("eY")),h.i32_const(4))),h.block(h.loop(h.br_if(1,h.i32_and(h.i64_eqz(h.i64_and(h.getLocal("sx"),h.i64_const("0xFFFFFFFF00000000"))),h.i32_ge_s(h.getLocal("ec"),h.i32_const(0)))),h.setLocal("sx",h.i64_shr_u(h.getLocal("sx"),h.i64_const(8))),h.setLocal("ec",h.i32_add(h.getLocal("ec"),h.i32_const(1))),h.br(0))),h.if(h.i64_eqz(h.getLocal("sx")),[...h.br_if(2,h.i32_eqz(h.call(o+"_gte",R,A))),...h.setLocal("sx",h.i64_const(1)),...h.setLocal("ec",h.i32_const(0))]),h.call(o+"__mul1",A,h.getLocal("sx"),V),h.drop(h.call(o+"_sub",R,h.i32_sub(V,h.getLocal("ec")),R)),h.call(o+"__add1",h.i32_add(at,h.getLocal("ec")),h.getLocal("sx")),h.br(0))))}function lt(){const O=t.addFunction(o+"_inverseMod");O.addParam("px","i32"),O.addParam("pm","i32"),O.addParam("pr","i32"),O.addLocal("t","i32"),O.addLocal("newt","i32"),O.addLocal("r","i32"),O.addLocal("qq","i32"),O.addLocal("qr","i32"),O.addLocal("newr","i32"),O.addLocal("swp","i32"),O.addLocal("x","i32"),O.addLocal("signt","i32"),O.addLocal("signnewt","i32"),O.addLocal("signx","i32");const h=O.getCodeBuilder(),A=h.i32_const(t.alloc(u)),Z=h.i32_const(t.alloc(u)),tt=h.i32_const(t.alloc(u)),at=h.i32_const(t.alloc(u)),R=h.i32_const(t.alloc(u)),C=h.i32_const(t.alloc(u)),T=h.i32_const(t.alloc(u*2)),V=h.i32_const(t.alloc(u));O.addCode(h.setLocal("t",A),h.call(o+"_zero",A),h.setLocal("signt",h.i32_const(0))),O.addCode(h.setLocal("r",Z),h.call(o+"_copy",h.getLocal("pm"),Z)),O.addCode(h.setLocal("newt",tt),h.call(o+"_one",tt),h.setLocal("signnewt",h.i32_const(0))),O.addCode(h.setLocal("newr",at),h.call(o+"_copy",h.getLocal("px"),at)),O.addCode(h.setLocal("qq",R)),O.addCode(h.setLocal("qr",C)),O.addCode(h.setLocal("x",V)),O.addCode(h.block(h.loop(h.br_if(1,h.call(o+"_isZero",h.getLocal("newr"))),h.call(o+"_div",h.getLocal("r"),h.getLocal("newr"),h.getLocal("qq"),h.getLocal("qr")),h.call(o+"_mul",h.getLocal("qq"),h.getLocal("newt"),T),h.if(h.getLocal("signt"),h.if(h.getLocal("signnewt"),h.if(h.call(o+"_gte",T,h.getLocal("t")),[...h.drop(h.call(o+"_sub",T,h.getLocal("t"),h.getLocal("x"))),...h.setLocal("signx",h.i32_const(0))],[...h.drop(h.call(o+"_sub",h.getLocal("t"),T,h.getLocal("x"))),...h.setLocal("signx",h.i32_const(1))]),[...h.drop(h.call(o+"_add",T,h.getLocal("t"),h.getLocal("x"))),...h.setLocal("signx",h.i32_const(1))]),h.if(h.getLocal("signnewt"),[...h.drop(h.call(o+"_add",T,h.getLocal("t"),h.getLocal("x"))),...h.setLocal("signx",h.i32_const(0))],h.if(h.call(o+"_gte",h.getLocal("t"),T),[...h.drop(h.call(o+"_sub",h.getLocal("t"),T,h.getLocal("x"))),...h.setLocal("signx",h.i32_const(0))],[...h.drop(h.call(o+"_sub",T,h.getLocal("t"),h.getLocal("x"))),...h.setLocal("signx",h.i32_const(1))]))),h.setLocal("swp",h.getLocal("t")),h.setLocal("t",h.getLocal("newt")),h.setLocal("newt",h.getLocal("x")),h.setLocal("x",h.getLocal("swp")),h.setLocal("signt",h.getLocal("signnewt")),h.setLocal("signnewt",h.getLocal("signx")),h.setLocal("swp",h.getLocal("r")),h.setLocal("r",h.getLocal("newr")),h.setLocal("newr",h.getLocal("qr")),h.setLocal("qr",h.getLocal("swp")),h.br(0)))),O.addCode(h.if(h.getLocal("signt"),h.drop(h.call(o+"_sub",h.getLocal("pm"),h.getLocal("t"),h.getLocal("pr"))),h.call(o+"_copy",h.getLocal("t"),h.getLocal("pr"))))}return r(),b(),l(),g(),x(),F(),I(),k(),z(),S(),G(),H(),lt(),t.exportFunction(o+"_copy"),t.exportFunction(o+"_zero"),t.exportFunction(o+"_one"),t.exportFunction(o+"_isZero"),t.exportFunction(o+"_eq"),t.exportFunction(o+"_gte"),t.exportFunction(o+"_add"),t.exportFunction(o+"_sub"),t.exportFunction(o+"_mul"),t.exportFunction(o+"_square"),t.exportFunction(o+"_squareOld"),t.exportFunction(o+"_div"),t.exportFunction(o+"_inverseMod"),o},Ri=function(t,n,e,o,s,u,r){const b=t.addFunction(n);b.addParam("base","i32"),b.addParam("scalar","i32"),b.addParam("scalarLength","i32"),b.addParam("r","i32"),b.addLocal("i","i32"),b.addLocal("b","i32");const g=b.getCodeBuilder(),l=g.i32_const(t.alloc(e));b.addCode(g.if(g.i32_eqz(g.getLocal("scalarLength")),[...g.call(r,g.getLocal("r")),...g.ret([])])),b.addCode(g.call(u,g.getLocal("base"),l)),b.addCode(g.call(r,g.getLocal("r"))),b.addCode(g.setLocal("i",g.getLocal("scalarLength"))),b.addCode(g.block(g.loop(g.setLocal("i",g.i32_sub(g.getLocal("i"),g.i32_const(1))),g.setLocal("b",g.i32_load8_u(g.i32_add(g.getLocal("scalar"),g.getLocal("i")))),...x(),g.br_if(1,g.i32_eqz(g.getLocal("i"))),g.br(0))));function x(){const F=[];for(let I=0;I<8;I++)F.push(...g.call(s,g.getLocal("r"),g.getLocal("r")),...g.if(g.i32_ge_u(g.getLocal("b"),g.i32_const(128>>I)),[...g.setLocal("b",g.i32_sub(g.getLocal("b"),g.i32_const(128>>I))),...g.call(o,g.getLocal("r"),l,g.getLocal("r"))]));return F}},Gi=Yr;function Yr(i,t){const n=i.modules[t].n64*8,e=i.addFunction(t+"_batchInverse");e.addParam("pIn","i32"),e.addParam("inStep","i32"),e.addParam("n","i32"),e.addParam("pOut","i32"),e.addParam("outStep","i32"),e.addLocal("itAux","i32"),e.addLocal("itIn","i32"),e.addLocal("itOut","i32"),e.addLocal("i","i32");const o=e.getCodeBuilder(),s=o.i32_const(i.alloc(n));e.addCode(o.setLocal("itAux",o.i32_load(o.i32_const(0))),o.i32_store(o.i32_const(0),o.i32_add(o.getLocal("itAux"),o.i32_mul(o.i32_add(o.getLocal("n"),o.i32_const(1)),o.i32_const(n))))),e.addCode(o.call(t+"_one",o.getLocal("itAux")),o.setLocal("itIn",o.getLocal("pIn")),o.setLocal("itAux",o.i32_add(o.getLocal("itAux"),o.i32_const(n))),o.setLocal("i",o.i32_const(0)),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("i"),o.getLocal("n"))),o.if(o.call(t+"_isZero",o.getLocal("itIn")),o.call(t+"_copy",o.i32_sub(o.getLocal("itAux"),o.i32_const(n)),o.getLocal("itAux")),o.call(t+"_mul",o.getLocal("itIn"),o.i32_sub(o.getLocal("itAux"),o.i32_const(n)),o.getLocal("itAux"))),o.setLocal("itIn",o.i32_add(o.getLocal("itIn"),o.getLocal("inStep"))),o.setLocal("itAux",o.i32_add(o.getLocal("itAux"),o.i32_const(n))),o.setLocal("i",o.i32_add(o.getLocal("i"),o.i32_const(1))),o.br(0))),o.setLocal("itIn",o.i32_sub(o.getLocal("itIn"),o.getLocal("inStep"))),o.setLocal("itAux",o.i32_sub(o.getLocal("itAux"),o.i32_const(n))),o.setLocal("itOut",o.i32_add(o.getLocal("pOut"),o.i32_mul(o.i32_sub(o.getLocal("n"),o.i32_const(1)),o.getLocal("outStep")))),o.call(t+"_inverse",o.getLocal("itAux"),o.getLocal("itAux")),o.block(o.loop(o.br_if(1,o.i32_eqz(o.getLocal("i"))),o.if(o.call(t+"_isZero",o.getLocal("itIn")),[...o.call(t+"_copy",o.getLocal("itAux"),o.i32_sub(o.getLocal("itAux"),o.i32_const(n))),...o.call(t+"_zero",o.getLocal("itOut"))],[...o.call(t+"_copy",o.i32_sub(o.getLocal("itAux"),o.i32_const(n)),s),...o.call(t+"_mul",o.getLocal("itAux"),o.getLocal("itIn"),o.i32_sub(o.getLocal("itAux"),o.i32_const(n))),...o.call(t+"_mul",o.getLocal("itAux"),s,o.getLocal("itOut"))]),o.setLocal("itIn",o.i32_sub(o.getLocal("itIn"),o.getLocal("inStep"))),o.setLocal("itOut",o.i32_sub(o.getLocal("itOut"),o.getLocal("outStep"))),o.setLocal("itAux",o.i32_sub(o.getLocal("itAux"),o.i32_const(n))),o.setLocal("i",o.i32_sub(o.getLocal("i"),o.i32_const(1))),o.br(0)))),e.addCode(o.i32_store(o.i32_const(0),o.getLocal("itAux")))}var Ya=Xr;function Xr(i,t,n,e,o,s){typeof s>"u"&&(e<o?s=!0:s=!1);const u=i.addFunction(t);u.addParam("pIn","i32"),u.addParam("n","i32"),u.addParam("pOut","i32"),u.addLocal("i","i32"),u.addLocal("itIn","i32"),u.addLocal("itOut","i32");const r=u.getCodeBuilder();s?u.addCode(r.setLocal("itIn",r.i32_add(r.getLocal("pIn"),r.i32_mul(r.i32_sub(r.getLocal("n"),r.i32_const(1)),r.i32_const(e)))),r.setLocal("itOut",r.i32_add(r.getLocal("pOut"),r.i32_mul(r.i32_sub(r.getLocal("n"),r.i32_const(1)),r.i32_const(o)))),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("n"))),r.call(n,r.getLocal("itIn"),r.getLocal("itOut")),r.setLocal("itIn",r.i32_sub(r.getLocal("itIn"),r.i32_const(e))),r.setLocal("itOut",r.i32_sub(r.getLocal("itOut"),r.i32_const(o))),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0)))):u.addCode(r.setLocal("itIn",r.getLocal("pIn")),r.setLocal("itOut",r.getLocal("pOut")),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("n"))),r.call(n,r.getLocal("itIn"),r.getLocal("itOut")),r.setLocal("itIn",r.i32_add(r.getLocal("itIn"),r.i32_const(e))),r.setLocal("itOut",r.i32_add(r.getLocal("itOut"),r.i32_const(o))),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0))))}var Jr=Zr;function Zr(i,t,n,e,o,s){typeof s>"u"&&(e<o?s=!0:s=!1);const u=i.addFunction(t);u.addParam("pIn1","i32"),u.addParam("pIn2","i32"),u.addParam("n","i32"),u.addParam("pOut","i32"),u.addLocal("i","i32"),u.addLocal("itIn1","i32"),u.addLocal("itIn2","i32"),u.addLocal("itOut","i32");const r=u.getCodeBuilder();s?u.addCode(r.setLocal("itIn1",r.i32_add(r.getLocal("pIn1"),r.i32_mul(r.i32_sub(r.getLocal("n"),r.i32_const(1)),r.i32_const(e)))),r.setLocal("itIn2",r.i32_add(r.getLocal("pIn2"),r.i32_mul(r.i32_sub(r.getLocal("n"),r.i32_const(1)),r.i32_const(e)))),r.setLocal("itOut",r.i32_add(r.getLocal("pOut"),r.i32_mul(r.i32_sub(r.getLocal("n"),r.i32_const(1)),r.i32_const(o)))),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("n"))),r.call(n,r.getLocal("itIn1"),r.getLocal("itIn2"),r.getLocal("itOut")),r.setLocal("itIn1",r.i32_sub(r.getLocal("itIn1"),r.i32_const(e))),r.setLocal("itIn2",r.i32_sub(r.getLocal("itIn2"),r.i32_const(e))),r.setLocal("itOut",r.i32_sub(r.getLocal("itOut"),r.i32_const(o))),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0)))):u.addCode(r.setLocal("itIn1",r.getLocal("pIn1")),r.setLocal("itIn2",r.getLocal("pIn2")),r.setLocal("itOut",r.getLocal("pOut")),r.setLocal("i",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal("i"),r.getLocal("n"))),r.call(n,r.getLocal("itIn1"),r.getLocal("itIn2"),r.getLocal("itOut")),r.setLocal("itIn1",r.i32_add(r.getLocal("itIn1"),r.i32_const(e))),r.setLocal("itIn2",r.i32_add(r.getLocal("itIn2"),r.i32_const(e))),r.setLocal("itOut",r.i32_add(r.getLocal("itOut"),r.i32_const(o))),r.setLocal("i",r.i32_add(r.getLocal("i"),r.i32_const(1))),r.br(0))))}var Wt={};function Xa(i,t){return i===t?0:i>t?1:-1}function Ni(i){return i*i}function Ja(i){return i%2n!==0n}function Ki(i){return i%2n===0n}function Qe(i){return i<0n}function Wr(i){return i>0n}function Za(i){return Qe(i)?i.toString(2).length-1:i.toString(2).length}function se(i){return i<0n?-i:i}function Dn(i){return se(i)===1n}function Wa(i,t){for(var n=0n,e=1n,o=t,s=se(i),u,r,b;s!==0n;)u=o/s,r=n,b=o,n=e,o=s,e=r-u*e,s=b-u*s;if(!Dn(o))throw new Error(i.toString()+" and "+t.toString()+" are not co-prime");return Xa(n,0n)===-1&&(n=n+t),Qe(i)?-n:n}function $a(i,t,n){if(n===0n)throw new Error("Cannot take modPow with modulus 0");var e=1n,o=i%n;for(Qe(t)&&(t=t*-1n,o=Wa(o,n));Wr(t);){if(o===0n)return 0n;Ja(t)&&(e=e*o%n),t=t/2n,o=Ni(o)%n}return e}function $r(i,t){return i=i>=0n?i:-i,t=t>=0n?t:-t,i===t?0:i>t?1:-1}function uo(i,t){return t===0n?!1:Dn(t)?!0:$r(t,2n)===0?Ki(i):i%t===0n}function tl(i){var t=se(i);if(Dn(t))return!1;if(t===2n||t===3n||t===5n)return!0;if(Ki(t)||uo(t,3n)||uo(t,5n))return!1;if(t<49n)return!0}function nl(i){return i-1n}function fo(i,t){for(var n=nl(i),e=n,o=0,s,u,r;Ki(e);)e=e/2n,o++;t:for(u=0;u<t.length;u++)if(!(i<t[u])&&(r=$a(BigInt(t[u]),e,i),!(Dn(r)||r===n))){for(s=o-1;s!=0;s--){if(r=Ni(r)%i,Dn(r))return!1;if(r===n)continue t}return!1}return!0}function el(i){var t=tl(i);if(t!==void 0)return t;var n=se(i),e=Za(n);if(e<=64)return fo(n,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var o=Math.log(2)*Number(e),s=Math.ceil(o),u=[],r=0;r<s;r++)u.push(BigInt(r+2));return fo(n,u)}Wt.bitLength=Za;Wt.isOdd=Ja;Wt.isNegative=Qe;Wt.abs=se;Wt.isUnit=Dn;Wt.compare=Xa;Wt.modInv=Wa;Wt.modPow=$a;Wt.isPrime=el;Wt.square=Ni;const il=jr,rn=Cn,ol=Ri,al=Gi,Ge=Ya,Ne=Jr,{bitLength:cl,modInv:Ke,modPow:go,isPrime:ho,isOdd:sl,square:rl}=Wt;var Hi=function(t,n,e,o){const s=BigInt(n),u=Math.floor((cl(s-1n)-1)/64)+1,r=u*2,b=u*8,g=e||"f1m";if(t.modules[g])return g;const l=il(t,u,o),x=t.alloc(b,rn.bigInt2BytesLE(s,b)),F=t.alloc(rn.bigInt2BytesLE(rl(1n<<BigInt(u*64))%s,b)),I=t.alloc(rn.bigInt2BytesLE((1n<<BigInt(u*64))%s,b)),k=t.alloc(rn.bigInt2BytesLE(0n,b)),z=s-1n,S=z>>1n,G=t.alloc(b,rn.bigInt2BytesLE(S,b)),U=S+1n,rt=t.alloc(b,rn.bigInt2BytesLE(U,b));t.modules[g]={pq:x,pR2:F,n64:u,q:s,pOne:I,pZero:k,pePlusOne:rt};function H(){const m=t.addFunction(g+"_one");m.addParam("pr","i32");const _=m.getCodeBuilder();m.addCode(_.call(l+"_copy",_.i32_const(I),_.getLocal("pr")))}function lt(){const m=t.addFunction(g+"_add");m.addParam("x","i32"),m.addParam("y","i32"),m.addParam("r","i32");const _=m.getCodeBuilder();m.addCode(_.if(_.call(l+"_add",_.getLocal("x"),_.getLocal("y"),_.getLocal("r")),_.drop(_.call(l+"_sub",_.getLocal("r"),_.i32_const(x),_.getLocal("r"))),_.if(_.call(l+"_gte",_.getLocal("r"),_.i32_const(x)),_.drop(_.call(l+"_sub",_.getLocal("r"),_.i32_const(x),_.getLocal("r"))))))}function O(){const m=t.addFunction(g+"_sub");m.addParam("x","i32"),m.addParam("y","i32"),m.addParam("r","i32");const _=m.getCodeBuilder();m.addCode(_.if(_.call(l+"_sub",_.getLocal("x"),_.getLocal("y"),_.getLocal("r")),_.drop(_.call(l+"_add",_.getLocal("r"),_.i32_const(x),_.getLocal("r")))))}function h(){const m=t.addFunction(g+"_neg");m.addParam("x","i32"),m.addParam("r","i32");const _=m.getCodeBuilder();m.addCode(_.call(g+"_sub",_.i32_const(k),_.getLocal("x"),_.getLocal("r")))}function A(){const m=t.addFunction(g+"_isNegative");m.addParam("x","i32"),m.setReturnType("i32");const _=m.getCodeBuilder(),Q=_.i32_const(t.alloc(b));m.addCode(_.call(g+"_fromMontgomery",_.getLocal("x"),Q),_.call(l+"_gte",Q,_.i32_const(rt)))}function Z(){const m=t.addFunction(g+"_sign");m.addParam("x","i32"),m.setReturnType("i32");const _=m.getCodeBuilder(),Q=_.i32_const(t.alloc(b));m.addCode(_.if(_.call(l+"_isZero",_.getLocal("x")),_.ret(_.i32_const(0))),_.call(g+"_fromMontgomery",_.getLocal("x"),Q),_.if(_.call(l+"_gte",Q,_.i32_const(rt)),_.ret(_.i32_const(-1))),_.ret(_.i32_const(1)))}function tt(){const m=t.alloc(r*r*8),_=t.addFunction(g+"_mReduct");_.addParam("t","i32"),_.addParam("r","i32"),_.addLocal("np32","i64"),_.addLocal("c","i64"),_.addLocal("m","i64");const Q=_.getCodeBuilder(),nt=Number(0x100000000n-Ke(s,0x100000000n));_.addCode(Q.setLocal("np32",Q.i64_const(nt)));for(let X=0;X<r;X++){_.addCode(Q.setLocal("c",Q.i64_const(0))),_.addCode(Q.setLocal("m",Q.i64_and(Q.i64_mul(Q.i64_load32_u(Q.getLocal("t"),X*4),Q.getLocal("np32")),Q.i64_const("0xFFFFFFFF"))));for(let ft=0;ft<r;ft++)_.addCode(Q.setLocal("c",Q.i64_add(Q.i64_add(Q.i64_load32_u(Q.getLocal("t"),(X+ft)*4),Q.i64_shr_u(Q.getLocal("c"),Q.i64_const(32))),Q.i64_mul(Q.i64_load32_u(Q.i32_const(x),ft*4),Q.getLocal("m"))))),_.addCode(Q.i64_store32(Q.getLocal("t"),(X+ft)*4,Q.getLocal("c")));_.addCode(Q.i64_store32(Q.i32_const(m),X*4,Q.i64_shr_u(Q.getLocal("c"),Q.i64_const(32))))}_.addCode(Q.call(g+"_add",Q.i32_const(m),Q.i32_add(Q.getLocal("t"),Q.i32_const(r*4)),Q.getLocal("r")))}function at(){const m=t.addFunction(g+"_mul");m.addParam("x","i32"),m.addParam("y","i32"),m.addParam("r","i32"),m.addLocal("c0","i64"),m.addLocal("c1","i64"),m.addLocal("np32","i64");for(let At=0;At<r;At++)m.addLocal("x"+At,"i64"),m.addLocal("y"+At,"i64"),m.addLocal("m"+At,"i64"),m.addLocal("q"+At,"i64");const _=m.getCodeBuilder(),Q=Number(0x100000000n-Ke(s,0x100000000n));m.addCode(_.setLocal("np32",_.i64_const(Q)));const nt=[],X=[],ft=[];function Bt(At,_t){let It,vt;return nt[At]?It=_.getLocal("x"+At):(It=_.teeLocal("x"+At,_.i64_load32_u(_.getLocal("x"),At*4)),nt[At]=!0),X[_t]?vt=_.getLocal("y"+_t):(vt=_.teeLocal("y"+_t,_.i64_load32_u(_.getLocal("y"),_t*4)),X[_t]=!0),_.i64_mul(It,vt)}function pt(At,_t){let It,vt;return ft[At]?It=_.getLocal("q"+At):(It=_.teeLocal("q"+At,_.i64_load32_u(_.i32_const(0),x+At*4)),ft[At]=!0),vt=_.getLocal("m"+_t),_.i64_mul(It,vt)}let wt="c0",Qt="c1";for(let At=0;At<r*2-1;At++){for(let _t=Math.max(0,At-r+1);_t<=At&&_t<r;_t++){const It=At-_t;m.addCode(_.setLocal(wt,_.i64_add(_.i64_and(_.getLocal(wt),_.i64_const(4294967295)),Bt(_t,It)))),m.addCode(_.setLocal(Qt,_.i64_add(_.getLocal(Qt),_.i64_shr_u(_.getLocal(wt),_.i64_const(32)))))}for(let _t=Math.max(1,At-r+1);_t<=At&&_t<r;_t++){const It=At-_t;m.addCode(_.setLocal(wt,_.i64_add(_.i64_and(_.getLocal(wt),_.i64_const(4294967295)),pt(_t,It)))),m.addCode(_.setLocal(Qt,_.i64_add(_.getLocal(Qt),_.i64_shr_u(_.getLocal(wt),_.i64_const(32)))))}At<r&&(m.addCode(_.setLocal("m"+At,_.i64_and(_.i64_mul(_.i64_and(_.getLocal(wt),_.i64_const(4294967295)),_.getLocal("np32")),_.i64_const("0xFFFFFFFF")))),m.addCode(_.setLocal(wt,_.i64_add(_.i64_and(_.getLocal(wt),_.i64_const(4294967295)),pt(0,At)))),m.addCode(_.setLocal(Qt,_.i64_add(_.getLocal(Qt),_.i64_shr_u(_.getLocal(wt),_.i64_const(32)))))),At>=r&&m.addCode(_.i64_store32(_.getLocal("r"),(At-r)*4,_.getLocal(wt))),[wt,Qt]=[Qt,wt],m.addCode(_.setLocal(Qt,_.i64_shr_u(_.getLocal(wt),_.i64_const(32))))}m.addCode(_.i64_store32(_.getLocal("r"),r*4-4,_.getLocal(wt))),m.addCode(_.if(_.i32_wrap_i64(_.getLocal(Qt)),_.drop(_.call(l+"_sub",_.getLocal("r"),_.i32_const(x),_.getLocal("r"))),_.if(_.call(l+"_gte",_.getLocal("r"),_.i32_const(x)),_.drop(_.call(l+"_sub",_.getLocal("r"),_.i32_const(x),_.getLocal("r"))))))}function R(){const m=t.addFunction(g+"_square");m.addParam("x","i32"),m.addParam("r","i32"),m.addLocal("c0","i64"),m.addLocal("c1","i64"),m.addLocal("c0_old","i64"),m.addLocal("c1_old","i64"),m.addLocal("np32","i64");for(let _t=0;_t<r;_t++)m.addLocal("x"+_t,"i64"),m.addLocal("m"+_t,"i64"),m.addLocal("q"+_t,"i64");const _=m.getCodeBuilder(),Q=Number(0x100000000n-Ke(s,0x100000000n));m.addCode(_.setLocal("np32",_.i64_const(Q)));const nt=[],X=[];function ft(_t,It){let vt,zt;return nt[_t]?vt=_.getLocal("x"+_t):(vt=_.teeLocal("x"+_t,_.i64_load32_u(_.getLocal("x"),_t*4)),nt[_t]=!0),nt[It]?zt=_.getLocal("x"+It):(zt=_.teeLocal("x"+It,_.i64_load32_u(_.getLocal("x"),It*4)),nt[It]=!0),_.i64_mul(vt,zt)}function Bt(_t,It){let vt,zt;return X[_t]?vt=_.getLocal("q"+_t):(vt=_.teeLocal("q"+_t,_.i64_load32_u(_.i32_const(0),x+_t*4)),X[_t]=!0),zt=_.getLocal("m"+It),_.i64_mul(vt,zt)}let pt="c0",wt="c1",Qt="c0_old",At="c1_old";for(let _t=0;_t<r*2-1;_t++){m.addCode(_.setLocal(pt,_.i64_const(0)),_.setLocal(wt,_.i64_const(0)));for(let It=Math.max(0,_t-r+1);It<_t+1>>1&&It<r;It++){const vt=_t-It;m.addCode(_.setLocal(pt,_.i64_add(_.i64_and(_.getLocal(pt),_.i64_const(4294967295)),ft(It,vt)))),m.addCode(_.setLocal(wt,_.i64_add(_.getLocal(wt),_.i64_shr_u(_.getLocal(pt),_.i64_const(32)))))}m.addCode(_.setLocal(pt,_.i64_shl(_.i64_and(_.getLocal(pt),_.i64_const(4294967295)),_.i64_const(1)))),m.addCode(_.setLocal(wt,_.i64_add(_.i64_shl(_.getLocal(wt),_.i64_const(1)),_.i64_shr_u(_.getLocal(pt),_.i64_const(32))))),_t%2==0&&(m.addCode(_.setLocal(pt,_.i64_add(_.i64_and(_.getLocal(pt),_.i64_const(4294967295)),ft(_t>>1,_t>>1)))),m.addCode(_.setLocal(wt,_.i64_add(_.getLocal(wt),_.i64_shr_u(_.getLocal(pt),_.i64_const(32)))))),_t>0&&(m.addCode(_.setLocal(pt,_.i64_add(_.i64_and(_.getLocal(pt),_.i64_const(4294967295)),_.i64_and(_.getLocal(Qt),_.i64_const(4294967295))))),m.addCode(_.setLocal(wt,_.i64_add(_.i64_add(_.getLocal(wt),_.i64_shr_u(_.getLocal(pt),_.i64_const(32))),_.getLocal(At)))));for(let It=Math.max(1,_t-r+1);It<=_t&&It<r;It++){const vt=_t-It;m.addCode(_.setLocal(pt,_.i64_add(_.i64_and(_.getLocal(pt),_.i64_const(4294967295)),Bt(It,vt)))),m.addCode(_.setLocal(wt,_.i64_add(_.getLocal(wt),_.i64_shr_u(_.getLocal(pt),_.i64_const(32)))))}_t<r&&(m.addCode(_.setLocal("m"+_t,_.i64_and(_.i64_mul(_.i64_and(_.getLocal(pt),_.i64_const(4294967295)),_.getLocal("np32")),_.i64_const("0xFFFFFFFF")))),m.addCode(_.setLocal(pt,_.i64_add(_.i64_and(_.getLocal(pt),_.i64_const(4294967295)),Bt(0,_t)))),m.addCode(_.setLocal(wt,_.i64_add(_.getLocal(wt),_.i64_shr_u(_.getLocal(pt),_.i64_const(32)))))),_t>=r&&m.addCode(_.i64_store32(_.getLocal("r"),(_t-r)*4,_.getLocal(pt))),m.addCode(_.setLocal(Qt,_.getLocal(wt)),_.setLocal(At,_.i64_shr_u(_.getLocal(Qt),_.i64_const(32))))}m.addCode(_.i64_store32(_.getLocal("r"),r*4-4,_.getLocal(Qt))),m.addCode(_.if(_.i32_wrap_i64(_.getLocal(At)),_.drop(_.call(l+"_sub",_.getLocal("r"),_.i32_const(x),_.getLocal("r"))),_.if(_.call(l+"_gte",_.getLocal("r"),_.i32_const(x)),_.drop(_.call(l+"_sub",_.getLocal("r"),_.i32_const(x),_.getLocal("r"))))))}function C(){const m=t.addFunction(g+"_squareOld");m.addParam("x","i32"),m.addParam("r","i32");const _=m.getCodeBuilder();m.addCode(_.call(g+"_mul",_.getLocal("x"),_.getLocal("x"),_.getLocal("r")))}function T(){const m=t.addFunction(g+"_toMontgomery");m.addParam("x","i32"),m.addParam("r","i32");const _=m.getCodeBuilder();m.addCode(_.call(g+"_mul",_.getLocal("x"),_.i32_const(F),_.getLocal("r")))}function V(){const m=t.alloc(b*2),_=t.addFunction(g+"_fromMontgomery");_.addParam("x","i32"),_.addParam("r","i32");const Q=_.getCodeBuilder();_.addCode(Q.call(l+"_copy",Q.getLocal("x"),Q.i32_const(m))),_.addCode(Q.call(l+"_zero",Q.i32_const(m+b))),_.addCode(Q.call(g+"_mReduct",Q.i32_const(m),Q.getLocal("r")))}function ut(){const m=t.addFunction(g+"_inverse");m.addParam("x","i32"),m.addParam("r","i32");const _=m.getCodeBuilder();m.addCode(_.call(g+"_fromMontgomery",_.getLocal("x"),_.getLocal("r"))),m.addCode(_.call(l+"_inverseMod",_.getLocal("r"),_.i32_const(x),_.getLocal("r"))),m.addCode(_.call(g+"_toMontgomery",_.getLocal("r"),_.getLocal("r")))}let ct=2n;if(ho(s))for(;go(ct,S,s)!==z;)ct=ct+1n;let J=0,gt=z;for(;!sl(gt)&&gt!==0n;)J++,gt=gt>>1n;const et=t.alloc(b,rn.bigInt2BytesLE(gt,b)),st=go(ct,gt,s),Lt=t.alloc(rn.bigInt2BytesLE((st<<BigInt(u*64))%s,b)),Ut=gt+1n>>1n,mt=t.alloc(b,rn.bigInt2BytesLE(Ut,b));function L(){const m=t.addFunction(g+"_sqrt");m.addParam("n","i32"),m.addParam("r","i32"),m.addLocal("m","i32"),m.addLocal("i","i32"),m.addLocal("j","i32");const _=m.getCodeBuilder(),Q=_.i32_const(I),nt=_.i32_const(t.alloc(b)),X=_.i32_const(t.alloc(b)),ft=_.i32_const(t.alloc(b)),Bt=_.i32_const(t.alloc(b)),pt=_.i32_const(t.alloc(b));m.addCode(_.if(_.call(g+"_isZero",_.getLocal("n")),_.ret(_.call(g+"_zero",_.getLocal("r")))),_.setLocal("m",_.i32_const(J)),_.call(g+"_copy",_.i32_const(Lt),nt),_.call(g+"_exp",_.getLocal("n"),_.i32_const(et),_.i32_const(b),X),_.call(g+"_exp",_.getLocal("n"),_.i32_const(mt),_.i32_const(b),ft),_.block(_.loop(_.br_if(1,_.call(g+"_eq",X,Q)),_.call(g+"_square",X,Bt),_.setLocal("i",_.i32_const(1)),_.block(_.loop(_.br_if(1,_.call(g+"_eq",Bt,Q)),_.call(g+"_square",Bt,Bt),_.setLocal("i",_.i32_add(_.getLocal("i"),_.i32_const(1))),_.br(0))),_.call(g+"_copy",nt,pt),_.setLocal("j",_.i32_sub(_.i32_sub(_.getLocal("m"),_.getLocal("i")),_.i32_const(1))),_.block(_.loop(_.br_if(1,_.i32_eqz(_.getLocal("j"))),_.call(g+"_square",pt,pt),_.setLocal("j",_.i32_sub(_.getLocal("j"),_.i32_const(1))),_.br(0))),_.setLocal("m",_.getLocal("i")),_.call(g+"_square",pt,nt),_.call(g+"_mul",X,nt,X),_.call(g+"_mul",ft,pt,ft),_.br(0))),_.if(_.call(g+"_isNegative",ft),_.call(g+"_neg",ft,_.getLocal("r")),_.call(g+"_copy",ft,_.getLocal("r"))))}function a(){const m=t.addFunction(g+"_isSquare");m.addParam("n","i32"),m.setReturnType("i32");const _=m.getCodeBuilder(),Q=_.i32_const(I),nt=_.i32_const(t.alloc(b));m.addCode(_.if(_.call(g+"_isZero",_.getLocal("n")),_.ret(_.i32_const(1))),_.call(g+"_exp",_.getLocal("n"),_.i32_const(G),_.i32_const(b),nt),_.call(g+"_eq",nt,Q))}function w(){const m=t.addFunction(g+"_load");m.addParam("scalar","i32"),m.addParam("scalarLen","i32"),m.addParam("r","i32"),m.addLocal("p","i32"),m.addLocal("l","i32"),m.addLocal("i","i32"),m.addLocal("j","i32");const _=m.getCodeBuilder(),Q=_.i32_const(t.alloc(b)),nt=t.alloc(b),X=_.i32_const(nt);m.addCode(_.call(l+"_zero",_.getLocal("r")),_.setLocal("i",_.i32_const(b)),_.setLocal("p",_.getLocal("scalar")),_.block(_.loop(_.br_if(1,_.i32_gt_u(_.getLocal("i"),_.getLocal("scalarLen"))),_.if(_.i32_eq(_.getLocal("i"),_.i32_const(b)),_.call(g+"_one",Q),_.call(g+"_mul",Q,_.i32_const(F),Q)),_.call(g+"_mul",_.getLocal("p"),Q,X),_.call(g+"_add",_.getLocal("r"),X,_.getLocal("r")),_.setLocal("p",_.i32_add(_.getLocal("p"),_.i32_const(b))),_.setLocal("i",_.i32_add(_.getLocal("i"),_.i32_const(b))),_.br(0))),_.setLocal("l",_.i32_rem_u(_.getLocal("scalarLen"),_.i32_const(b))),_.if(_.i32_eqz(_.getLocal("l")),_.ret([])),_.call(l+"_zero",X),_.setLocal("j",_.i32_const(0)),_.block(_.loop(_.br_if(1,_.i32_eq(_.getLocal("j"),_.getLocal("l"))),_.i32_store8(_.getLocal("j"),nt,_.i32_load8_u(_.getLocal("p"))),_.setLocal("p",_.i32_add(_.getLocal("p"),_.i32_const(1))),_.setLocal("j",_.i32_add(_.getLocal("j"),_.i32_const(1))),_.br(0))),_.if(_.i32_eq(_.getLocal("i"),_.i32_const(b)),_.call(g+"_one",Q),_.call(g+"_mul",Q,_.i32_const(F),Q)),_.call(g+"_mul",X,Q,X),_.call(g+"_add",_.getLocal("r"),X,_.getLocal("r")))}function c(){const m=t.addFunction(g+"_timesScalar");m.addParam("x","i32"),m.addParam("scalar","i32"),m.addParam("scalarLen","i32"),m.addParam("r","i32");const _=m.getCodeBuilder(),Q=_.i32_const(t.alloc(b));m.addCode(_.call(g+"_load",_.getLocal("scalar"),_.getLocal("scalarLen"),Q),_.call(g+"_toMontgomery",Q,Q),_.call(g+"_mul",_.getLocal("x"),Q,_.getLocal("r")))}function E(){const m=t.addFunction(g+"_isOne");m.addParam("x","i32"),m.setReturnType("i32");const _=m.getCodeBuilder();m.addCode(_.ret(_.call(l+"_eq",_.getLocal("x"),_.i32_const(I))))}return t.exportFunction(l+"_copy",g+"_copy"),t.exportFunction(l+"_zero",g+"_zero"),t.exportFunction(l+"_isZero",g+"_isZero"),t.exportFunction(l+"_eq",g+"_eq"),E(),lt(),O(),h(),tt(),at(),R(),C(),T(),V(),A(),Z(),ut(),H(),w(),c(),al(t,g),Ge(t,g+"_batchToMontgomery",g+"_toMontgomery",b,b),Ge(t,g+"_batchFromMontgomery",g+"_fromMontgomery",b,b),Ge(t,g+"_batchNeg",g+"_neg",b,b),Ne(t,g+"_batchAdd",g+"_add",b,b),Ne(t,g+"_batchSub",g+"_sub",b,b),Ne(t,g+"_batchMul",g+"_mul",b,b),t.exportFunction(g+"_add"),t.exportFunction(g+"_sub"),t.exportFunction(g+"_neg"),t.exportFunction(g+"_isNegative"),t.exportFunction(g+"_isOne"),t.exportFunction(g+"_sign"),t.exportFunction(g+"_mReduct"),t.exportFunction(g+"_mul"),t.exportFunction(g+"_square"),t.exportFunction(g+"_squareOld"),t.exportFunction(g+"_fromMontgomery"),t.exportFunction(g+"_toMontgomery"),t.exportFunction(g+"_inverse"),t.exportFunction(g+"_one"),t.exportFunction(g+"_load"),t.exportFunction(g+"_timesScalar"),ol(t,g+"_exp",b,g+"_mul",g+"_square",l+"_copy",g+"_one"),t.exportFunction(g+"_exp"),t.exportFunction(g+"_batchInverse"),ho(s)&&(L(),a(),t.exportFunction(g+"_sqrt"),t.exportFunction(g+"_isSquare")),t.exportFunction(g+"_batchToMontgomery"),t.exportFunction(g+"_batchFromMontgomery"),g};const ll=Hi,{bitLength:dl}=Wt;var tc=function(t,n,e,o,s){const u=BigInt(n),r=Math.floor((dl(u-1n)-1)/64)+1,b=r*8,g=e||"f1";if(t.modules[g])return g;t.modules[g]={n64:r};const l=s||"int",x=ll(t,u,o,l),F=t.modules[x].pR2,I=t.modules[x].pq,k=t.modules[x].pePlusOne;function z(){const rt=t.alloc(b),H=t.addFunction(g+"_mul");H.addParam("x","i32"),H.addParam("y","i32"),H.addParam("r","i32");const lt=H.getCodeBuilder();H.addCode(lt.call(x+"_mul",lt.getLocal("x"),lt.getLocal("y"),lt.i32_const(rt))),H.addCode(lt.call(x+"_mul",lt.i32_const(rt),lt.i32_const(F),lt.getLocal("r")))}function S(){const rt=t.addFunction(g+"_square");rt.addParam("x","i32"),rt.addParam("r","i32");const H=rt.getCodeBuilder();rt.addCode(H.call(g+"_mul",H.getLocal("x"),H.getLocal("x"),H.getLocal("r")))}function G(){const rt=t.addFunction(g+"_inverse");rt.addParam("x","i32"),rt.addParam("r","i32");const H=rt.getCodeBuilder();rt.addCode(H.call(l+"_inverseMod",H.getLocal("x"),H.i32_const(I),H.getLocal("r")))}function U(){const rt=t.addFunction(g+"_isNegative");rt.addParam("x","i32"),rt.setReturnType("i32");const H=rt.getCodeBuilder();rt.addCode(H.call(l+"_gte",H.getLocal("x"),H.i32_const(k)))}return z(),S(),G(),U(),t.exportFunction(x+"_add",g+"_add"),t.exportFunction(x+"_sub",g+"_sub"),t.exportFunction(x+"_neg",g+"_neg"),t.exportFunction(g+"_mul"),t.exportFunction(g+"_square"),t.exportFunction(g+"_inverse"),t.exportFunction(g+"_isNegative"),t.exportFunction(x+"_copy",g+"_copy"),t.exportFunction(x+"_zero",g+"_zero"),t.exportFunction(x+"_one",g+"_one"),t.exportFunction(x+"_isZero",g+"_isZero"),t.exportFunction(x+"_eq",g+"_eq"),g};const ul=Ri,fl=Gi,He=Cn;var nc=function(t,n,e,o){if(t.modules[e])return e;const s=t.modules[o].n64*8,u=t.modules[o].q;t.modules[e]={n64:t.modules[o].n64*2};function r(){const R=t.addFunction(e+"_add");R.addParam("x","i32"),R.addParam("y","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("y"),ct=C.i32_add(C.getLocal("y"),C.i32_const(s)),J=C.getLocal("r"),gt=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_add",T,ut,J),C.call(o+"_add",V,ct,gt))}function b(){const R=t.addFunction(e+"_timesScalar");R.addParam("x","i32"),R.addParam("scalar","i32"),R.addParam("scalarLen","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("r"),ct=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_timesScalar",T,C.getLocal("scalar"),C.getLocal("scalarLen"),ut),C.call(o+"_timesScalar",V,C.getLocal("scalar"),C.getLocal("scalarLen"),ct))}function g(){const R=t.addFunction(e+"_sub");R.addParam("x","i32"),R.addParam("y","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("y"),ct=C.i32_add(C.getLocal("y"),C.i32_const(s)),J=C.getLocal("r"),gt=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_sub",T,ut,J),C.call(o+"_sub",V,ct,gt))}function l(){const R=t.addFunction(e+"_neg");R.addParam("x","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("r"),ct=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_neg",T,ut),C.call(o+"_neg",V,ct))}function x(){const R=t.addFunction(e+"_conjugate");R.addParam("x","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("r"),ct=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_copy",T,ut),C.call(o+"_neg",V,ct))}function F(){const R=t.addFunction(e+"_isNegative");R.addParam("x","i32"),R.setReturnType("i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s));R.addCode(C.if(C.call(o+"_isZero",V),C.ret(C.call(o+"_isNegative",T))),C.ret(C.call(o+"_isNegative",V)))}function I(){const R=t.addFunction(e+"_mul");R.addParam("x","i32"),R.addParam("y","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("y"),ct=C.i32_add(C.getLocal("y"),C.i32_const(s)),J=C.getLocal("r"),gt=C.i32_add(C.getLocal("r"),C.i32_const(s)),et=C.i32_const(t.alloc(s)),st=C.i32_const(t.alloc(s)),Lt=C.i32_const(t.alloc(s)),Ut=C.i32_const(t.alloc(s));R.addCode(C.call(o+"_mul",T,ut,et),C.call(o+"_mul",V,ct,st),C.call(o+"_add",T,V,Lt),C.call(o+"_add",ut,ct,Ut),C.call(o+"_mul",Lt,Ut,Lt),C.call(n,st,J),C.call(o+"_add",et,J,J),C.call(o+"_add",et,st,gt),C.call(o+"_sub",Lt,gt,gt))}function k(){const R=t.addFunction(e+"_mul1");R.addParam("x","i32"),R.addParam("y","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("y"),ct=C.getLocal("r"),J=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_mul",T,ut,ct),C.call(o+"_mul",V,ut,J))}function z(){const R=t.addFunction(e+"_square");R.addParam("x","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("r"),ct=C.i32_add(C.getLocal("r"),C.i32_const(s)),J=C.i32_const(t.alloc(s)),gt=C.i32_const(t.alloc(s)),et=C.i32_const(t.alloc(s)),st=C.i32_const(t.alloc(s));R.addCode(C.call(o+"_mul",T,V,J),C.call(o+"_add",T,V,gt),C.call(n,V,et),C.call(o+"_add",T,et,et),C.call(n,J,st),C.call(o+"_add",st,J,st),C.call(o+"_mul",gt,et,ut),C.call(o+"_sub",ut,st,ut),C.call(o+"_add",J,J,ct))}function S(){const R=t.addFunction(e+"_toMontgomery");R.addParam("x","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("r"),ct=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_toMontgomery",T,ut),C.call(o+"_toMontgomery",V,ct))}function G(){const R=t.addFunction(e+"_fromMontgomery");R.addParam("x","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("r"),ct=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_fromMontgomery",T,ut),C.call(o+"_fromMontgomery",V,ct))}function U(){const R=t.addFunction(e+"_copy");R.addParam("x","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("r"),ct=C.i32_add(C.getLocal("r"),C.i32_const(s));R.addCode(C.call(o+"_copy",T,ut),C.call(o+"_copy",V,ct))}function rt(){const R=t.addFunction(e+"_zero");R.addParam("x","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s));R.addCode(C.call(o+"_zero",T),C.call(o+"_zero",V))}function H(){const R=t.addFunction(e+"_one");R.addParam("x","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s));R.addCode(C.call(o+"_one",T),C.call(o+"_zero",V))}function lt(){const R=t.addFunction(e+"_eq");R.addParam("x","i32"),R.addParam("y","i32"),R.setReturnType("i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("y"),ct=C.i32_add(C.getLocal("y"),C.i32_const(s));R.addCode(C.i32_and(C.call(o+"_eq",T,ut),C.call(o+"_eq",V,ct)))}function O(){const R=t.addFunction(e+"_isZero");R.addParam("x","i32"),R.setReturnType("i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s));R.addCode(C.i32_and(C.call(o+"_isZero",T),C.call(o+"_isZero",V)))}function h(){const R=t.addFunction(e+"_inverse");R.addParam("x","i32"),R.addParam("r","i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s)),ut=C.getLocal("r"),ct=C.i32_add(C.getLocal("r"),C.i32_const(s)),J=C.i32_const(t.alloc(s)),gt=C.i32_const(t.alloc(s)),et=C.i32_const(t.alloc(s)),st=C.i32_const(t.alloc(s));R.addCode(C.call(o+"_square",T,J),C.call(o+"_square",V,gt),C.call(n,gt,et),C.call(o+"_sub",J,et,et),C.call(o+"_inverse",et,st),C.call(o+"_mul",T,st,ut),C.call(o+"_mul",V,st,ct),C.call(o+"_neg",ct,ct))}function A(){const R=t.addFunction(e+"_sign");R.addParam("x","i32"),R.addLocal("s","i32"),R.setReturnType("i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s));R.addCode(C.setLocal("s",C.call(o+"_sign",V)),C.if(C.getLocal("s"),C.ret(C.getLocal("s"))),C.ret(C.call(o+"_sign",T)))}function Z(){const R=t.addFunction(e+"_isOne");R.addParam("x","i32"),R.setReturnType("i32");const C=R.getCodeBuilder(),T=C.getLocal("x"),V=C.i32_add(C.getLocal("x"),C.i32_const(s));R.addCode(C.ret(C.i32_and(C.call(o+"_isOne",T),C.call(o+"_isZero",V))))}function tt(){const R=t.addFunction(e+"_sqrt");R.addParam("a","i32"),R.addParam("pr","i32");const C=R.getCodeBuilder(),T=C.i32_const(t.alloc(He.bigInt2BytesLE((BigInt(u||0)-3n)/4n,s))),V=C.i32_const(t.alloc(He.bigInt2BytesLE((BigInt(u||0)-1n)/2n,s))),ut=C.getLocal("a"),ct=C.i32_const(t.alloc(s*2)),J=C.i32_const(t.alloc(s*2)),gt=C.i32_const(t.alloc(s*2)),et=t.alloc(s*2),st=C.i32_const(et),Lt=C.i32_const(et),Ut=C.i32_const(et+s),mt=C.i32_const(t.alloc(s*2)),L=C.i32_const(t.alloc(s*2));R.addCode(C.call(e+"_one",st),C.call(e+"_neg",st,st),C.call(e+"_exp",ut,T,C.i32_const(s),ct),C.call(e+"_square",ct,J),C.call(e+"_mul",ut,J,J),C.call(e+"_conjugate",J,gt),C.call(e+"_mul",gt,J,gt),C.if(C.call(e+"_eq",gt,st),C.unreachable()),C.call(e+"_mul",ct,ut,mt),C.if(C.call(e+"_eq",J,st),[...C.call(o+"_zero",Lt),...C.call(o+"_one",Ut),...C.call(e+"_mul",st,mt,C.getLocal("pr"))],[...C.call(e+"_one",L),...C.call(e+"_add",L,J,L),...C.call(e+"_exp",L,V,C.i32_const(s),L),...C.call(e+"_mul",L,mt,C.getLocal("pr"))]))}function at(){const R=t.addFunction(e+"_isSquare");R.addParam("a","i32"),R.setReturnType("i32");const C=R.getCodeBuilder(),T=C.i32_const(t.alloc(He.bigInt2BytesLE((BigInt(u||0)-3n)/4n,s))),V=C.getLocal("a"),ut=C.i32_const(t.alloc(s*2)),ct=C.i32_const(t.alloc(s*2)),J=C.i32_const(t.alloc(s*2)),gt=t.alloc(s*2),et=C.i32_const(gt);R.addCode(C.call(e+"_one",et),C.call(e+"_neg",et,et),C.call(e+"_exp",V,T,C.i32_const(s),ut),C.call(e+"_square",ut,ct),C.call(e+"_mul",V,ct,ct),C.call(e+"_conjugate",ct,J),C.call(e+"_mul",J,ct,J),C.if(C.call(e+"_eq",J,et),C.ret(C.i32_const(0))),C.ret(C.i32_const(1)))}return O(),Z(),rt(),H(),U(),I(),k(),z(),r(),g(),l(),x(),S(),G(),lt(),h(),b(),A(),F(),t.exportFunction(e+"_isZero"),t.exportFunction(e+"_isOne"),t.exportFunction(e+"_zero"),t.exportFunction(e+"_one"),t.exportFunction(e+"_copy"),t.exportFunction(e+"_mul"),t.exportFunction(e+"_mul1"),t.exportFunction(e+"_square"),t.exportFunction(e+"_add"),t.exportFunction(e+"_sub"),t.exportFunction(e+"_neg"),t.exportFunction(e+"_sign"),t.exportFunction(e+"_conjugate"),t.exportFunction(e+"_fromMontgomery"),t.exportFunction(e+"_toMontgomery"),t.exportFunction(e+"_eq"),t.exportFunction(e+"_inverse"),fl(t,e),ul(t,e+"_exp",s*2,e+"_mul",e+"_square",e+"_copy",e+"_one"),tt(),at(),t.exportFunction(e+"_exp"),t.exportFunction(e+"_timesScalar"),t.exportFunction(e+"_batchInverse"),t.exportFunction(e+"_sqrt"),t.exportFunction(e+"_isSquare"),t.exportFunction(e+"_isNegative"),e};const gl=Ri,hl=Gi;var ec=function(t,n,e,o){if(t.modules[e])return e;const s=t.modules[o].n64*8;t.modules[e]={n64:t.modules[o].n64*3};function u(){const h=t.addFunction(e+"_add");h.addParam("x","i32"),h.addParam("y","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("y"),C=A.i32_add(A.getLocal("y"),A.i32_const(s)),T=A.i32_add(A.getLocal("y"),A.i32_const(2*s)),V=A.getLocal("r"),ut=A.i32_add(A.getLocal("r"),A.i32_const(s)),ct=A.i32_add(A.getLocal("r"),A.i32_const(2*s));h.addCode(A.call(o+"_add",Z,R,V),A.call(o+"_add",tt,C,ut),A.call(o+"_add",at,T,ct))}function r(){const h=t.addFunction(e+"_timesScalar");h.addParam("x","i32"),h.addParam("scalar","i32"),h.addParam("scalarLen","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("r"),C=A.i32_add(A.getLocal("r"),A.i32_const(s)),T=A.i32_add(A.getLocal("r"),A.i32_const(2*s));h.addCode(A.call(o+"_timesScalar",Z,A.getLocal("scalar"),A.getLocal("scalarLen"),R),A.call(o+"_timesScalar",tt,A.getLocal("scalar"),A.getLocal("scalarLen"),C),A.call(o+"_timesScalar",at,A.getLocal("scalar"),A.getLocal("scalarLen"),T))}function b(){const h=t.addFunction(e+"_sub");h.addParam("x","i32"),h.addParam("y","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("y"),C=A.i32_add(A.getLocal("y"),A.i32_const(s)),T=A.i32_add(A.getLocal("y"),A.i32_const(2*s)),V=A.getLocal("r"),ut=A.i32_add(A.getLocal("r"),A.i32_const(s)),ct=A.i32_add(A.getLocal("r"),A.i32_const(2*s));h.addCode(A.call(o+"_sub",Z,R,V),A.call(o+"_sub",tt,C,ut),A.call(o+"_sub",at,T,ct))}function g(){const h=t.addFunction(e+"_neg");h.addParam("x","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("r"),C=A.i32_add(A.getLocal("r"),A.i32_const(s)),T=A.i32_add(A.getLocal("r"),A.i32_const(2*s));h.addCode(A.call(o+"_neg",Z,R),A.call(o+"_neg",tt,C),A.call(o+"_neg",at,T))}function l(){const h=t.addFunction(e+"_isNegative");h.addParam("x","i32"),h.setReturnType("i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s));h.addCode(A.if(A.call(o+"_isZero",at),A.if(A.call(o+"_isZero",tt),A.ret(A.call(o+"_isNegative",Z)),A.ret(A.call(o+"_isNegative",tt)))),A.ret(A.call(o+"_isNegative",at)))}function x(){const h=t.addFunction(e+"_mul");h.addParam("x","i32"),h.addParam("y","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("y"),C=A.i32_add(A.getLocal("y"),A.i32_const(s)),T=A.i32_add(A.getLocal("y"),A.i32_const(2*s)),V=A.getLocal("r"),ut=A.i32_add(A.getLocal("r"),A.i32_const(s)),ct=A.i32_add(A.getLocal("r"),A.i32_const(2*s)),J=A.i32_const(t.alloc(s)),gt=A.i32_const(t.alloc(s)),et=A.i32_const(t.alloc(s)),st=A.i32_const(t.alloc(s)),Lt=A.i32_const(t.alloc(s)),Ut=A.i32_const(t.alloc(s)),mt=A.i32_const(t.alloc(s)),L=A.i32_const(t.alloc(s)),a=A.i32_const(t.alloc(s)),w=A.i32_const(t.alloc(s)),c=A.i32_const(t.alloc(s)),E=A.i32_const(t.alloc(s)),m=A.i32_const(t.alloc(s));h.addCode(A.call(o+"_mul",Z,R,J),A.call(o+"_mul",tt,C,gt),A.call(o+"_mul",at,T,et),A.call(o+"_add",Z,tt,st),A.call(o+"_add",R,C,Lt),A.call(o+"_add",Z,at,Ut),A.call(o+"_add",R,T,mt),A.call(o+"_add",tt,at,L),A.call(o+"_add",C,T,a),A.call(o+"_add",J,gt,w),A.call(o+"_add",J,et,c),A.call(o+"_add",gt,et,E),A.call(o+"_mul",L,a,V),A.call(o+"_sub",V,E,V),A.call(n,V,V),A.call(o+"_add",J,V,V),A.call(o+"_mul",st,Lt,ut),A.call(o+"_sub",ut,w,ut),A.call(n,et,m),A.call(o+"_add",ut,m,ut),A.call(o+"_mul",Ut,mt,ct),A.call(o+"_sub",ct,c,ct),A.call(o+"_add",ct,gt,ct))}function F(){const h=t.addFunction(e+"_square");h.addParam("x","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("r"),C=A.i32_add(A.getLocal("r"),A.i32_const(s)),T=A.i32_add(A.getLocal("r"),A.i32_const(2*s)),V=A.i32_const(t.alloc(s)),ut=A.i32_const(t.alloc(s)),ct=A.i32_const(t.alloc(s)),J=A.i32_const(t.alloc(s)),gt=A.i32_const(t.alloc(s)),et=A.i32_const(t.alloc(s)),st=A.i32_const(t.alloc(s));h.addCode(A.call(o+"_square",Z,V),A.call(o+"_mul",Z,tt,ut),A.call(o+"_add",ut,ut,ct),A.call(o+"_sub",Z,tt,J),A.call(o+"_add",J,at,J),A.call(o+"_square",J,J),A.call(o+"_mul",tt,at,gt),A.call(o+"_add",gt,gt,et),A.call(o+"_square",at,st),A.call(n,et,R),A.call(o+"_add",V,R,R),A.call(n,st,C),A.call(o+"_add",ct,C,C),A.call(o+"_add",V,st,T),A.call(o+"_sub",et,T,T),A.call(o+"_add",J,T,T),A.call(o+"_add",ct,T,T))}function I(){const h=t.addFunction(e+"_toMontgomery");h.addParam("x","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("r"),C=A.i32_add(A.getLocal("r"),A.i32_const(s)),T=A.i32_add(A.getLocal("r"),A.i32_const(2*s));h.addCode(A.call(o+"_toMontgomery",Z,R),A.call(o+"_toMontgomery",tt,C),A.call(o+"_toMontgomery",at,T))}function k(){const h=t.addFunction(e+"_fromMontgomery");h.addParam("x","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("r"),C=A.i32_add(A.getLocal("r"),A.i32_const(s)),T=A.i32_add(A.getLocal("r"),A.i32_const(2*s));h.addCode(A.call(o+"_fromMontgomery",Z,R),A.call(o+"_fromMontgomery",tt,C),A.call(o+"_fromMontgomery",at,T))}function z(){const h=t.addFunction(e+"_copy");h.addParam("x","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("r"),C=A.i32_add(A.getLocal("r"),A.i32_const(s)),T=A.i32_add(A.getLocal("r"),A.i32_const(2*s));h.addCode(A.call(o+"_copy",Z,R),A.call(o+"_copy",tt,C),A.call(o+"_copy",at,T))}function S(){const h=t.addFunction(e+"_zero");h.addParam("x","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s));h.addCode(A.call(o+"_zero",Z),A.call(o+"_zero",tt),A.call(o+"_zero",at))}function G(){const h=t.addFunction(e+"_one");h.addParam("x","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s));h.addCode(A.call(o+"_one",Z),A.call(o+"_zero",tt),A.call(o+"_zero",at))}function U(){const h=t.addFunction(e+"_eq");h.addParam("x","i32"),h.addParam("y","i32"),h.setReturnType("i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("y"),C=A.i32_add(A.getLocal("y"),A.i32_const(s)),T=A.i32_add(A.getLocal("y"),A.i32_const(2*s));h.addCode(A.i32_and(A.i32_and(A.call(o+"_eq",Z,R),A.call(o+"_eq",tt,C)),A.call(o+"_eq",at,T)))}function rt(){const h=t.addFunction(e+"_isZero");h.addParam("x","i32"),h.setReturnType("i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s));h.addCode(A.i32_and(A.i32_and(A.call(o+"_isZero",Z),A.call(o+"_isZero",tt)),A.call(o+"_isZero",at)))}function H(){const h=t.addFunction(e+"_inverse");h.addParam("x","i32"),h.addParam("r","i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s)),R=A.getLocal("r"),C=A.i32_add(A.getLocal("r"),A.i32_const(s)),T=A.i32_add(A.getLocal("r"),A.i32_const(2*s)),V=A.i32_const(t.alloc(s)),ut=A.i32_const(t.alloc(s)),ct=A.i32_const(t.alloc(s)),J=A.i32_const(t.alloc(s)),gt=A.i32_const(t.alloc(s)),et=A.i32_const(t.alloc(s)),st=A.i32_const(t.alloc(s)),Lt=A.i32_const(t.alloc(s)),Ut=A.i32_const(t.alloc(s)),mt=A.i32_const(t.alloc(s)),L=A.i32_const(t.alloc(s));h.addCode(A.call(o+"_square",Z,V),A.call(o+"_square",tt,ut),A.call(o+"_square",at,ct),A.call(o+"_mul",Z,tt,J),A.call(o+"_mul",Z,at,gt),A.call(o+"_mul",tt,at,et),A.call(n,et,st),A.call(o+"_sub",V,st,st),A.call(n,ct,Lt),A.call(o+"_sub",Lt,J,Lt),A.call(o+"_sub",ut,gt,Ut),A.call(o+"_mul",at,Lt,mt),A.call(o+"_mul",tt,Ut,L),A.call(o+"_add",mt,L,mt),A.call(n,mt,mt),A.call(o+"_mul",Z,st,L),A.call(o+"_add",L,mt,mt),A.call(o+"_inverse",mt,mt),A.call(o+"_mul",mt,st,R),A.call(o+"_mul",mt,Lt,C),A.call(o+"_mul",mt,Ut,T))}function lt(){const h=t.addFunction(e+"_sign");h.addParam("x","i32"),h.addLocal("s","i32"),h.setReturnType("i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(2*s));h.addCode(A.setLocal("s",A.call(o+"_sign",at)),A.if(A.getLocal("s"),A.ret(A.getLocal("s"))),A.setLocal("s",A.call(o+"_sign",tt)),A.if(A.getLocal("s"),A.ret(A.getLocal("s"))),A.ret(A.call(o+"_sign",Z)))}function O(){const h=t.addFunction(e+"_isOne");h.addParam("x","i32"),h.setReturnType("i32");const A=h.getCodeBuilder(),Z=A.getLocal("x"),tt=A.i32_add(A.getLocal("x"),A.i32_const(s)),at=A.i32_add(A.getLocal("x"),A.i32_const(s*2));h.addCode(A.ret(A.i32_and(A.i32_and(A.call(o+"_isOne",Z),A.call(o+"_isZero",tt)),A.call(o+"_isZero",at))))}return rt(),O(),S(),G(),z(),x(),F(),u(),b(),g(),lt(),I(),k(),U(),H(),r(),l(),t.exportFunction(e+"_isZero"),t.exportFunction(e+"_isOne"),t.exportFunction(e+"_zero"),t.exportFunction(e+"_one"),t.exportFunction(e+"_copy"),t.exportFunction(e+"_mul"),t.exportFunction(e+"_square"),t.exportFunction(e+"_add"),t.exportFunction(e+"_sub"),t.exportFunction(e+"_neg"),t.exportFunction(e+"_sign"),t.exportFunction(e+"_fromMontgomery"),t.exportFunction(e+"_toMontgomery"),t.exportFunction(e+"_eq"),t.exportFunction(e+"_inverse"),hl(t,e),gl(t,e+"_exp",s*3,e+"_mul",e+"_square",e+"_copy",e+"_one"),t.exportFunction(e+"_exp"),t.exportFunction(e+"_timesScalar"),t.exportFunction(e+"_batchInverse"),t.exportFunction(e+"_isNegative"),e},_l=function(t,n,e,o,s,u,r,b){const g=t.addFunction(n);g.addParam("base","i32"),g.addParam("scalar","i32"),g.addParam("scalarLength","i32"),g.addParam("r","i32"),g.addLocal("old0","i32"),g.addLocal("nbits","i32"),g.addLocal("i","i32"),g.addLocal("last","i32"),g.addLocal("cur","i32"),g.addLocal("carry","i32"),g.addLocal("p","i32");const l=g.getCodeBuilder(),x=l.i32_const(t.alloc(e));function F(k){return l.i32_and(l.i32_shr_u(l.i32_load(l.i32_add(l.getLocal("scalar"),l.i32_and(l.i32_shr_u(k,l.i32_const(3)),l.i32_const(4294967292)))),l.i32_and(k,l.i32_const(31))),l.i32_const(1))}function I(k){return[...l.i32_store8(l.getLocal("p"),l.i32_const(k)),...l.setLocal("p",l.i32_add(l.getLocal("p"),l.i32_const(1)))]}g.addCode(l.if(l.i32_eqz(l.getLocal("scalarLength")),[...l.call(b,l.getLocal("r")),...l.ret([])]),l.setLocal("nbits",l.i32_shl(l.getLocal("scalarLength"),l.i32_const(3))),l.setLocal("old0",l.i32_load(l.i32_const(0))),l.setLocal("p",l.getLocal("old0")),l.i32_store(l.i32_const(0),l.i32_and(l.i32_add(l.i32_add(l.getLocal("old0"),l.i32_const(32)),l.getLocal("nbits")),l.i32_const(4294967288))),l.setLocal("i",l.i32_const(1)),l.setLocal("last",F(l.i32_const(0))),l.setLocal("carry",l.i32_const(0)),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("i"),l.getLocal("nbits"))),l.setLocal("cur",F(l.getLocal("i"))),l.if(l.getLocal("last"),l.if(l.getLocal("cur"),l.if(l.getLocal("carry"),[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(1)),...I(1)],[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(1)),...I(255)]),l.if(l.getLocal("carry"),[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(1)),...I(255)],[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(0)),...I(1)])),l.if(l.getLocal("cur"),l.if(l.getLocal("carry"),[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(1)),...I(0)],[...l.setLocal("last",l.i32_const(1)),...l.setLocal("carry",l.i32_const(0)),...I(0)]),l.if(l.getLocal("carry"),[...l.setLocal("last",l.i32_const(1)),...l.setLocal("carry",l.i32_const(0)),...I(0)],[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(0)),...I(0)]))),l.setLocal("i",l.i32_add(l.getLocal("i"),l.i32_const(1))),l.br(0))),l.if(l.getLocal("last"),l.if(l.getLocal("carry"),[...I(255),...I(0),...I(1)],[...I(1)]),l.if(l.getLocal("carry"),[...I(0),...I(1)])),l.setLocal("p",l.i32_sub(l.getLocal("p"),l.i32_const(1))),l.call(r,l.getLocal("base"),x),l.call(b,l.getLocal("r")),l.block(l.loop(l.call(s,l.getLocal("r"),l.getLocal("r")),l.setLocal("cur",l.i32_load8_u(l.getLocal("p"))),l.if(l.getLocal("cur"),l.if(l.i32_eq(l.getLocal("cur"),l.i32_const(1)),l.call(o,l.getLocal("r"),x,l.getLocal("r")),l.call(u,l.getLocal("r"),x,l.getLocal("r")))),l.br_if(1,l.i32_eq(l.getLocal("old0"),l.getLocal("p"))),l.setLocal("p",l.i32_sub(l.getLocal("p"),l.i32_const(1))),l.br(0))),l.i32_store(l.i32_const(0),l.getLocal("old0")))},pl=function(t,n,e,o,s){const r=t.modules[n].n64*8;function b(){const F=t.addFunction(e+"_getChunk");F.addParam("pScalar","i32"),F.addParam("scalarSize","i32"),F.addParam("startBit","i32"),F.addParam("chunkSize","i32"),F.addLocal("bitsToEnd","i32"),F.addLocal("mask","i32"),F.setReturnType("i32");const I=F.getCodeBuilder();F.addCode(I.setLocal("bitsToEnd",I.i32_sub(I.i32_mul(I.getLocal("scalarSize"),I.i32_const(8)),I.getLocal("startBit"))),I.if(I.i32_gt_s(I.getLocal("chunkSize"),I.getLocal("bitsToEnd")),I.setLocal("mask",I.i32_sub(I.i32_shl(I.i32_const(1),I.getLocal("bitsToEnd")),I.i32_const(1))),I.setLocal("mask",I.i32_sub(I.i32_shl(I.i32_const(1),I.getLocal("chunkSize")),I.i32_const(1)))),I.i32_and(I.i32_shr_u(I.i32_load(I.i32_add(I.getLocal("pScalar"),I.i32_shr_u(I.getLocal("startBit"),I.i32_const(3))),0,0),I.i32_and(I.getLocal("startBit"),I.i32_const(7))),I.getLocal("mask")))}function g(){const F=t.addFunction(e+"_chunk");F.addParam("pBases","i32"),F.addParam("pScalars","i32"),F.addParam("scalarSize","i32"),F.addParam("n","i32"),F.addParam("startBit","i32"),F.addParam("chunkSize","i32"),F.addParam("pr","i32"),F.addLocal("nChunks","i32"),F.addLocal("itScalar","i32"),F.addLocal("endScalar","i32"),F.addLocal("itBase","i32"),F.addLocal("i","i32"),F.addLocal("j","i32"),F.addLocal("nTable","i32"),F.addLocal("pTable","i32"),F.addLocal("idx","i32"),F.addLocal("pIdxTable","i32");const I=F.getCodeBuilder();F.addCode(I.if(I.i32_eqz(I.getLocal("n")),[...I.call(n+"_zero",I.getLocal("pr")),...I.ret([])]),I.setLocal("nTable",I.i32_shl(I.i32_const(1),I.getLocal("chunkSize"))),I.setLocal("pTable",I.i32_load(I.i32_const(0))),I.i32_store(I.i32_const(0),I.i32_add(I.getLocal("pTable"),I.i32_mul(I.getLocal("nTable"),I.i32_const(r)))),I.setLocal("j",I.i32_const(0)),I.block(I.loop(I.br_if(1,I.i32_eq(I.getLocal("j"),I.getLocal("nTable"))),I.call(n+"_zero",I.i32_add(I.getLocal("pTable"),I.i32_mul(I.getLocal("j"),I.i32_const(r)))),I.setLocal("j",I.i32_add(I.getLocal("j"),I.i32_const(1))),I.br(0))),I.setLocal("itBase",I.getLocal("pBases")),I.setLocal("itScalar",I.getLocal("pScalars")),I.setLocal("endScalar",I.i32_add(I.getLocal("pScalars"),I.i32_mul(I.getLocal("n"),I.getLocal("scalarSize")))),I.block(I.loop(I.br_if(1,I.i32_eq(I.getLocal("itScalar"),I.getLocal("endScalar"))),I.setLocal("idx",I.call(e+"_getChunk",I.getLocal("itScalar"),I.getLocal("scalarSize"),I.getLocal("startBit"),I.getLocal("chunkSize"))),I.if(I.getLocal("idx"),[...I.setLocal("pIdxTable",I.i32_add(I.getLocal("pTable"),I.i32_mul(I.i32_sub(I.getLocal("idx"),I.i32_const(1)),I.i32_const(r)))),...I.call(o,I.getLocal("pIdxTable"),I.getLocal("itBase"),I.getLocal("pIdxTable"))]),I.setLocal("itScalar",I.i32_add(I.getLocal("itScalar"),I.getLocal("scalarSize"))),I.setLocal("itBase",I.i32_add(I.getLocal("itBase"),I.i32_const(s))),I.br(0))),I.call(e+"_reduceTable",I.getLocal("pTable"),I.getLocal("chunkSize")),I.call(n+"_copy",I.getLocal("pTable"),I.getLocal("pr")),I.i32_store(I.i32_const(0),I.getLocal("pTable")))}function l(){const F=t.addFunction(e);F.addParam("pBases","i32"),F.addParam("pScalars","i32"),F.addParam("scalarSize","i32"),F.addParam("n","i32"),F.addParam("pr","i32"),F.addLocal("chunkSize","i32"),F.addLocal("nChunks","i32"),F.addLocal("itScalar","i32"),F.addLocal("endScalar","i32"),F.addLocal("itBase","i32"),F.addLocal("itBit","i32"),F.addLocal("i","i32"),F.addLocal("j","i32"),F.addLocal("nTable","i32"),F.addLocal("pTable","i32"),F.addLocal("idx","i32"),F.addLocal("pIdxTable","i32");const I=F.getCodeBuilder(),k=I.i32_const(t.alloc(r)),z=t.alloc([17,17,17,17,17,17,17,17,17,17,16,16,15,14,13,13,12,11,10,9,8,7,7,6,5,4,3,2,1,1,1,1]);F.addCode(I.call(n+"_zero",I.getLocal("pr")),I.if(I.i32_eqz(I.getLocal("n")),I.ret([])),I.setLocal("chunkSize",I.i32_load8_u(I.i32_clz(I.getLocal("n")),z)),I.setLocal("nChunks",I.i32_add(I.i32_div_u(I.i32_sub(I.i32_shl(I.getLocal("scalarSize"),I.i32_const(3)),I.i32_const(1)),I.getLocal("chunkSize")),I.i32_const(1))),I.setLocal("itBit",I.i32_mul(I.i32_sub(I.getLocal("nChunks"),I.i32_const(1)),I.getLocal("chunkSize"))),I.block(I.loop(I.br_if(1,I.i32_lt_s(I.getLocal("itBit"),I.i32_const(0))),I.if(I.i32_eqz(I.call(n+"_isZero",I.getLocal("pr"))),[...I.setLocal("j",I.i32_const(0)),...I.block(I.loop(I.br_if(1,I.i32_eq(I.getLocal("j"),I.getLocal("chunkSize"))),I.call(n+"_double",I.getLocal("pr"),I.getLocal("pr")),I.setLocal("j",I.i32_add(I.getLocal("j"),I.i32_const(1))),I.br(0)))]),I.call(e+"_chunk",I.getLocal("pBases"),I.getLocal("pScalars"),I.getLocal("scalarSize"),I.getLocal("n"),I.getLocal("itBit"),I.getLocal("chunkSize"),k),I.call(n+"_add",I.getLocal("pr"),k,I.getLocal("pr")),I.setLocal("itBit",I.i32_sub(I.getLocal("itBit"),I.getLocal("chunkSize"))),I.br(0))))}function x(){const F=t.addFunction(e+"_reduceTable");F.addParam("pTable","i32"),F.addParam("p","i32"),F.addLocal("half","i32"),F.addLocal("it1","i32"),F.addLocal("it2","i32"),F.addLocal("pAcc","i32");const I=F.getCodeBuilder();F.addCode(I.if(I.i32_eq(I.getLocal("p"),I.i32_const(1)),I.ret([])),I.setLocal("half",I.i32_shl(I.i32_const(1),I.i32_sub(I.getLocal("p"),I.i32_const(1)))),I.setLocal("it1",I.getLocal("pTable")),I.setLocal("it2",I.i32_add(I.getLocal("pTable"),I.i32_mul(I.getLocal("half"),I.i32_const(r)))),I.setLocal("pAcc",I.i32_sub(I.getLocal("it2"),I.i32_const(r))),I.block(I.loop(I.br_if(1,I.i32_eq(I.getLocal("it1"),I.getLocal("pAcc"))),I.call(n+"_add",I.getLocal("it1"),I.getLocal("it2"),I.getLocal("it1")),I.call(n+"_add",I.getLocal("pAcc"),I.getLocal("it2"),I.getLocal("pAcc")),I.setLocal("it1",I.i32_add(I.getLocal("it1"),I.i32_const(r))),I.setLocal("it2",I.i32_add(I.getLocal("it2"),I.i32_const(r))),I.br(0))),I.call(e+"_reduceTable",I.getLocal("pTable"),I.i32_sub(I.getLocal("p"),I.i32_const(1))),I.setLocal("p",I.i32_sub(I.getLocal("p"),I.i32_const(1))),I.block(I.loop(I.br_if(1,I.i32_eqz(I.getLocal("p"))),I.call(n+"_double",I.getLocal("pAcc"),I.getLocal("pAcc")),I.setLocal("p",I.i32_sub(I.getLocal("p"),I.i32_const(1))),I.br(0))),I.call(n+"_add",I.getLocal("pTable"),I.getLocal("pAcc"),I.getLocal("pTable")))}b(),x(),g(),l(),t.exportFunction(e),t.exportFunction(e+"_chunk")};const _o=_l,Hn=Ya,po=pl;var ic=function(t,n,e,o){const s=t.modules[e].n64,u=s*8;if(t.modules[n])return n;t.modules[n]={n64:s*3};function r(){const L=t.addFunction(n+"_isZero");L.addParam("p1","i32"),L.setReturnType("i32");const a=L.getCodeBuilder();L.addCode(a.call(e+"_isZero",a.i32_add(a.getLocal("p1"),a.i32_const(u*2))))}function b(){const L=t.addFunction(n+"_isZeroAffine");L.addParam("p1","i32"),L.setReturnType("i32");const a=L.getCodeBuilder();L.addCode(a.i32_and(a.call(e+"_isZero",a.getLocal("p1")),a.call(e+"_isZero",a.i32_add(a.getLocal("p1"),a.i32_const(u)))))}function g(){const L=t.addFunction(n+"_copy");L.addParam("ps","i32"),L.addParam("pd","i32");const a=L.getCodeBuilder();for(let w=0;w<s*3;w++)L.addCode(a.i64_store(a.getLocal("pd"),w*8,a.i64_load(a.getLocal("ps"),w*8)))}function l(){const L=t.addFunction(n+"_copyAffine");L.addParam("ps","i32"),L.addParam("pd","i32");const a=L.getCodeBuilder();for(let w=0;w<s*2;w++)L.addCode(a.i64_store(a.getLocal("pd"),w*8,a.i64_load(a.getLocal("ps"),w*8)))}function x(){const L=t.addFunction(n+"_zero");L.addParam("pr","i32");const a=L.getCodeBuilder();L.addCode(a.call(e+"_zero",a.getLocal("pr"))),L.addCode(a.call(e+"_one",a.i32_add(a.getLocal("pr"),a.i32_const(u)))),L.addCode(a.call(e+"_zero",a.i32_add(a.getLocal("pr"),a.i32_const(u*2))))}function F(){const L=t.addFunction(n+"_zeroAffine");L.addParam("pr","i32");const a=L.getCodeBuilder();L.addCode(a.call(e+"_zero",a.getLocal("pr"))),L.addCode(a.call(e+"_zero",a.i32_add(a.getLocal("pr"),a.i32_const(u))))}function I(){const L=t.addFunction(n+"_eq");L.addParam("p1","i32"),L.addParam("p2","i32"),L.setReturnType("i32"),L.addLocal("z1","i32"),L.addLocal("z2","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u));L.addCode(a.setLocal("z1",a.i32_add(a.getLocal("p1"),a.i32_const(u*2))));const E=a.getLocal("z1"),m=a.getLocal("p2"),_=a.i32_add(a.getLocal("p2"),a.i32_const(u));L.addCode(a.setLocal("z2",a.i32_add(a.getLocal("p2"),a.i32_const(u*2))));const Q=a.getLocal("z2"),nt=a.i32_const(t.alloc(u)),X=a.i32_const(t.alloc(u)),ft=a.i32_const(t.alloc(u)),Bt=a.i32_const(t.alloc(u)),pt=a.i32_const(t.alloc(u)),wt=a.i32_const(t.alloc(u)),Qt=a.i32_const(t.alloc(u)),At=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZero",a.getLocal("p1")),a.ret(a.call(n+"_isZero",a.getLocal("p2")))),a.if(a.call(n+"_isZero",a.getLocal("p2")),a.ret(a.i32_const(0))),a.if(a.call(e+"_isOne",E),a.ret(a.call(n+"_eqMixed",a.getLocal("p2"),a.getLocal("p1")))),a.if(a.call(e+"_isOne",Q),a.ret(a.call(n+"_eqMixed",a.getLocal("p1"),a.getLocal("p2")))),a.call(e+"_square",E,nt),a.call(e+"_square",Q,X),a.call(e+"_mul",w,X,ft),a.call(e+"_mul",m,nt,Bt),a.call(e+"_mul",E,nt,pt),a.call(e+"_mul",Q,X,wt),a.call(e+"_mul",c,wt,Qt),a.call(e+"_mul",_,pt,At),a.if(a.call(e+"_eq",ft,Bt),a.if(a.call(e+"_eq",Qt,At),a.ret(a.i32_const(1)))),a.ret(a.i32_const(0)))}function k(){const L=t.addFunction(n+"_eqMixed");L.addParam("p1","i32"),L.addParam("p2","i32"),L.setReturnType("i32"),L.addLocal("z1","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u));L.addCode(a.setLocal("z1",a.i32_add(a.getLocal("p1"),a.i32_const(u*2))));const E=a.getLocal("z1"),m=a.getLocal("p2"),_=a.i32_add(a.getLocal("p2"),a.i32_const(u)),Q=a.i32_const(t.alloc(u)),nt=a.i32_const(t.alloc(u)),X=a.i32_const(t.alloc(u)),ft=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZero",a.getLocal("p1")),a.ret(a.call(n+"_isZeroAffine",a.getLocal("p2")))),a.if(a.call(n+"_isZeroAffine",a.getLocal("p2")),a.ret(a.i32_const(0))),a.if(a.call(e+"_isOne",E),a.ret(a.call(n+"_eqAffine",a.getLocal("p1"),a.getLocal("p2")))),a.call(e+"_square",E,Q),a.call(e+"_mul",m,Q,nt),a.call(e+"_mul",E,Q,X),a.call(e+"_mul",_,X,ft),a.if(a.call(e+"_eq",w,nt),a.if(a.call(e+"_eq",c,ft),a.ret(a.i32_const(1)))),a.ret(a.i32_const(0)))}function z(){const L=t.addFunction(n+"_double");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u)),E=a.i32_add(a.getLocal("p1"),a.i32_const(u*2)),m=a.getLocal("pr"),_=a.i32_add(a.getLocal("pr"),a.i32_const(u)),Q=a.i32_add(a.getLocal("pr"),a.i32_const(u*2)),nt=a.i32_const(t.alloc(u)),X=a.i32_const(t.alloc(u)),ft=a.i32_const(t.alloc(u)),Bt=a.i32_const(t.alloc(u)),pt=a.i32_const(t.alloc(u)),wt=a.i32_const(t.alloc(u)),Qt=a.i32_const(t.alloc(u)),At=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZero",a.getLocal("p1")),[...a.call(n+"_copy",a.getLocal("p1"),a.getLocal("pr")),...a.ret([])]),a.if(a.call(e+"_isOne",E),[...a.ret(a.call(n+"_doubleAffine",a.getLocal("p1"),a.getLocal("pr"))),...a.ret([])]),a.call(e+"_square",w,nt),a.call(e+"_square",c,X),a.call(e+"_square",X,ft),a.call(e+"_add",w,X,Bt),a.call(e+"_square",Bt,Bt),a.call(e+"_sub",Bt,nt,Bt),a.call(e+"_sub",Bt,ft,Bt),a.call(e+"_add",Bt,Bt,Bt),a.call(e+"_add",nt,nt,pt),a.call(e+"_add",pt,nt,pt),a.call(e+"_square",pt,wt),a.call(e+"_mul",c,E,Qt),a.call(e+"_add",Bt,Bt,m),a.call(e+"_sub",wt,m,m),a.call(e+"_add",ft,ft,At),a.call(e+"_add",At,At,At),a.call(e+"_add",At,At,At),a.call(e+"_sub",Bt,m,_),a.call(e+"_mul",_,pt,_),a.call(e+"_sub",_,At,_),a.call(e+"_add",Qt,Qt,Q))}function S(){const L=t.addFunction(n+"_doubleAffine");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u)),E=a.getLocal("pr"),m=a.i32_add(a.getLocal("pr"),a.i32_const(u)),_=a.i32_add(a.getLocal("pr"),a.i32_const(u*2)),Q=a.i32_const(t.alloc(u)),nt=a.i32_const(t.alloc(u)),X=a.i32_const(t.alloc(u)),ft=a.i32_const(t.alloc(u)),Bt=a.i32_const(t.alloc(u)),pt=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZeroAffine",a.getLocal("p1")),[...a.call(n+"_toJacobian",a.getLocal("p1"),a.getLocal("pr")),...a.ret([])]),a.call(e+"_square",w,Q),a.call(e+"_square",c,nt),a.call(e+"_square",nt,X),a.call(e+"_add",w,nt,ft),a.call(e+"_square",ft,ft),a.call(e+"_sub",ft,Q,ft),a.call(e+"_sub",ft,X,ft),a.call(e+"_add",ft,ft,ft),a.call(e+"_add",Q,Q,Bt),a.call(e+"_add",Bt,Q,Bt),a.call(e+"_add",c,c,_),a.call(e+"_square",Bt,E),a.call(e+"_sub",E,ft,E),a.call(e+"_sub",E,ft,E),a.call(e+"_add",X,X,pt),a.call(e+"_add",pt,pt,pt),a.call(e+"_add",pt,pt,pt),a.call(e+"_sub",ft,E,m),a.call(e+"_mul",m,Bt,m),a.call(e+"_sub",m,pt,m))}function G(){const L=t.addFunction(n+"_eqAffine");L.addParam("p1","i32"),L.addParam("p2","i32"),L.setReturnType("i32"),L.addLocal("z1","i32");const a=L.getCodeBuilder();L.addCode(a.ret(a.i32_and(a.call(e+"_eq",a.getLocal("p1"),a.getLocal("p2")),a.call(e+"_eq",a.i32_add(a.getLocal("p1"),a.i32_const(u)),a.i32_add(a.getLocal("p2"),a.i32_const(u))))))}function U(){const L=t.addFunction(n+"_toMontgomery");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder();L.addCode(a.call(e+"_toMontgomery",a.getLocal("p1"),a.getLocal("pr")));for(let w=1;w<3;w++)L.addCode(a.call(e+"_toMontgomery",a.i32_add(a.getLocal("p1"),a.i32_const(w*u)),a.i32_add(a.getLocal("pr"),a.i32_const(w*u))))}function rt(){const L=t.addFunction(n+"_toMontgomeryAffine");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder();L.addCode(a.call(e+"_toMontgomery",a.getLocal("p1"),a.getLocal("pr")));for(let w=1;w<2;w++)L.addCode(a.call(e+"_toMontgomery",a.i32_add(a.getLocal("p1"),a.i32_const(w*u)),a.i32_add(a.getLocal("pr"),a.i32_const(w*u))))}function H(){const L=t.addFunction(n+"_fromMontgomery");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder();L.addCode(a.call(e+"_fromMontgomery",a.getLocal("p1"),a.getLocal("pr")));for(let w=1;w<3;w++)L.addCode(a.call(e+"_fromMontgomery",a.i32_add(a.getLocal("p1"),a.i32_const(w*u)),a.i32_add(a.getLocal("pr"),a.i32_const(w*u))))}function lt(){const L=t.addFunction(n+"_fromMontgomeryAffine");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder();L.addCode(a.call(e+"_fromMontgomery",a.getLocal("p1"),a.getLocal("pr")));for(let w=1;w<2;w++)L.addCode(a.call(e+"_fromMontgomery",a.i32_add(a.getLocal("p1"),a.i32_const(w*u)),a.i32_add(a.getLocal("pr"),a.i32_const(w*u))))}function O(){const L=t.addFunction(n+"_add");L.addParam("p1","i32"),L.addParam("p2","i32"),L.addParam("pr","i32"),L.addLocal("z1","i32"),L.addLocal("z2","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u));L.addCode(a.setLocal("z1",a.i32_add(a.getLocal("p1"),a.i32_const(u*2))));const E=a.getLocal("z1"),m=a.getLocal("p2"),_=a.i32_add(a.getLocal("p2"),a.i32_const(u));L.addCode(a.setLocal("z2",a.i32_add(a.getLocal("p2"),a.i32_const(u*2))));const Q=a.getLocal("z2"),nt=a.getLocal("pr"),X=a.i32_add(a.getLocal("pr"),a.i32_const(u)),ft=a.i32_add(a.getLocal("pr"),a.i32_const(u*2)),Bt=a.i32_const(t.alloc(u)),pt=a.i32_const(t.alloc(u)),wt=a.i32_const(t.alloc(u)),Qt=a.i32_const(t.alloc(u)),At=a.i32_const(t.alloc(u)),_t=a.i32_const(t.alloc(u)),It=a.i32_const(t.alloc(u)),vt=a.i32_const(t.alloc(u)),zt=a.i32_const(t.alloc(u)),Gt=a.i32_const(t.alloc(u)),Kt=a.i32_const(t.alloc(u)),B=a.i32_const(t.alloc(u)),p=a.i32_const(t.alloc(u)),y=a.i32_const(t.alloc(u)),M=a.i32_const(t.alloc(u)),D=a.i32_const(t.alloc(u)),j=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZero",a.getLocal("p1")),[...a.call(n+"_copy",a.getLocal("p2"),a.getLocal("pr")),...a.ret([])]),a.if(a.call(n+"_isZero",a.getLocal("p2")),[...a.call(n+"_copy",a.getLocal("p1"),a.getLocal("pr")),...a.ret([])]),a.if(a.call(e+"_isOne",E),[...a.call(n+"_addMixed",m,w,nt),...a.ret([])]),a.if(a.call(e+"_isOne",Q),[...a.call(n+"_addMixed",w,m,nt),...a.ret([])]),a.call(e+"_square",E,Bt),a.call(e+"_square",Q,pt),a.call(e+"_mul",w,pt,wt),a.call(e+"_mul",m,Bt,Qt),a.call(e+"_mul",E,Bt,At),a.call(e+"_mul",Q,pt,_t),a.call(e+"_mul",c,_t,It),a.call(e+"_mul",_,At,vt),a.if(a.call(e+"_eq",wt,Qt),a.if(a.call(e+"_eq",It,vt),[...a.call(n+"_double",a.getLocal("p1"),a.getLocal("pr")),...a.ret([])])),a.call(e+"_sub",Qt,wt,zt),a.call(e+"_sub",vt,It,Gt),a.call(e+"_add",zt,zt,Kt),a.call(e+"_square",Kt,Kt),a.call(e+"_mul",zt,Kt,B),a.call(e+"_add",Gt,Gt,p),a.call(e+"_mul",wt,Kt,M),a.call(e+"_square",p,y),a.call(e+"_add",M,M,D),a.call(e+"_sub",y,B,nt),a.call(e+"_sub",nt,D,nt),a.call(e+"_mul",It,B,j),a.call(e+"_add",j,j,j),a.call(e+"_sub",M,nt,X),a.call(e+"_mul",X,p,X),a.call(e+"_sub",X,j,X),a.call(e+"_add",E,Q,ft),a.call(e+"_square",ft,ft),a.call(e+"_sub",ft,Bt,ft),a.call(e+"_sub",ft,pt,ft),a.call(e+"_mul",ft,zt,ft))}function h(){const L=t.addFunction(n+"_addMixed");L.addParam("p1","i32"),L.addParam("p2","i32"),L.addParam("pr","i32"),L.addLocal("z1","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u));L.addCode(a.setLocal("z1",a.i32_add(a.getLocal("p1"),a.i32_const(u*2))));const E=a.getLocal("z1"),m=a.getLocal("p2"),_=a.i32_add(a.getLocal("p2"),a.i32_const(u)),Q=a.getLocal("pr"),nt=a.i32_add(a.getLocal("pr"),a.i32_const(u)),X=a.i32_add(a.getLocal("pr"),a.i32_const(u*2)),ft=a.i32_const(t.alloc(u)),Bt=a.i32_const(t.alloc(u)),pt=a.i32_const(t.alloc(u)),wt=a.i32_const(t.alloc(u)),Qt=a.i32_const(t.alloc(u)),At=a.i32_const(t.alloc(u)),_t=a.i32_const(t.alloc(u)),It=a.i32_const(t.alloc(u)),vt=a.i32_const(t.alloc(u)),zt=a.i32_const(t.alloc(u)),Gt=a.i32_const(t.alloc(u)),Kt=a.i32_const(t.alloc(u)),B=a.i32_const(t.alloc(u)),p=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZero",a.getLocal("p1")),[...a.call(n+"_copyAffine",a.getLocal("p2"),a.getLocal("pr")),...a.call(e+"_one",a.i32_add(a.getLocal("pr"),a.i32_const(u*2))),...a.ret([])]),a.if(a.call(n+"_isZeroAffine",a.getLocal("p2")),[...a.call(n+"_copy",a.getLocal("p1"),a.getLocal("pr")),...a.ret([])]),a.if(a.call(e+"_isOne",E),[...a.call(n+"_addAffine",w,m,Q),...a.ret([])]),a.call(e+"_square",E,ft),a.call(e+"_mul",m,ft,Bt),a.call(e+"_mul",E,ft,pt),a.call(e+"_mul",_,pt,wt),a.if(a.call(e+"_eq",w,Bt),a.if(a.call(e+"_eq",c,wt),[...a.call(n+"_doubleAffine",a.getLocal("p2"),a.getLocal("pr")),...a.ret([])])),a.call(e+"_sub",Bt,w,Qt),a.call(e+"_sub",wt,c,_t),a.call(e+"_square",Qt,At),a.call(e+"_add",At,At,It),a.call(e+"_add",It,It,It),a.call(e+"_mul",Qt,It,vt),a.call(e+"_add",_t,_t,zt),a.call(e+"_mul",w,It,Kt),a.call(e+"_square",zt,Gt),a.call(e+"_add",Kt,Kt,B),a.call(e+"_sub",Gt,vt,Q),a.call(e+"_sub",Q,B,Q),a.call(e+"_mul",c,vt,p),a.call(e+"_add",p,p,p),a.call(e+"_sub",Kt,Q,nt),a.call(e+"_mul",nt,zt,nt),a.call(e+"_sub",nt,p,nt),a.call(e+"_add",E,Qt,X),a.call(e+"_square",X,X),a.call(e+"_sub",X,ft,X),a.call(e+"_sub",X,At,X))}function A(){const L=t.addFunction(n+"_addAffine");L.addParam("p1","i32"),L.addParam("p2","i32"),L.addParam("pr","i32"),L.addLocal("z1","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u));L.addCode(a.setLocal("z1",a.i32_add(a.getLocal("p1"),a.i32_const(u*2))));const E=a.getLocal("p2"),m=a.i32_add(a.getLocal("p2"),a.i32_const(u)),_=a.getLocal("pr"),Q=a.i32_add(a.getLocal("pr"),a.i32_const(u)),nt=a.i32_add(a.getLocal("pr"),a.i32_const(u*2)),X=a.i32_const(t.alloc(u)),ft=a.i32_const(t.alloc(u)),Bt=a.i32_const(t.alloc(u)),pt=a.i32_const(t.alloc(u)),wt=a.i32_const(t.alloc(u)),Qt=a.i32_const(t.alloc(u)),At=a.i32_const(t.alloc(u)),_t=a.i32_const(t.alloc(u)),It=a.i32_const(t.alloc(u)),vt=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZeroAffine",a.getLocal("p1")),[...a.call(n+"_copyAffine",a.getLocal("p2"),a.getLocal("pr")),...a.call(e+"_one",a.i32_add(a.getLocal("pr"),a.i32_const(u*2))),...a.ret([])]),a.if(a.call(n+"_isZeroAffine",a.getLocal("p2")),[...a.call(n+"_copyAffine",a.getLocal("p1"),a.getLocal("pr")),...a.call(e+"_one",a.i32_add(a.getLocal("pr"),a.i32_const(u*2))),...a.ret([])]),a.if(a.call(e+"_eq",w,E),a.if(a.call(e+"_eq",c,m),[...a.call(n+"_doubleAffine",a.getLocal("p2"),a.getLocal("pr")),...a.ret([])])),a.call(e+"_sub",E,w,X),a.call(e+"_sub",m,c,Bt),a.call(e+"_square",X,ft),a.call(e+"_add",ft,ft,pt),a.call(e+"_add",pt,pt,pt),a.call(e+"_mul",X,pt,wt),a.call(e+"_add",Bt,Bt,Qt),a.call(e+"_mul",w,pt,_t),a.call(e+"_square",Qt,At),a.call(e+"_add",_t,_t,It),a.call(e+"_sub",At,wt,_),a.call(e+"_sub",_,It,_),a.call(e+"_mul",c,wt,vt),a.call(e+"_add",vt,vt,vt),a.call(e+"_sub",_t,_,Q),a.call(e+"_mul",Q,Qt,Q),a.call(e+"_sub",Q,vt,Q),a.call(e+"_add",X,X,nt))}function Z(){const L=t.addFunction(n+"_neg");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u)),E=a.i32_add(a.getLocal("p1"),a.i32_const(u*2)),m=a.getLocal("pr"),_=a.i32_add(a.getLocal("pr"),a.i32_const(u)),Q=a.i32_add(a.getLocal("pr"),a.i32_const(u*2));L.addCode(a.call(e+"_copy",w,m),a.call(e+"_neg",c,_),a.call(e+"_copy",E,Q))}function tt(){const L=t.addFunction(n+"_negAffine");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u)),E=a.getLocal("pr"),m=a.i32_add(a.getLocal("pr"),a.i32_const(u));L.addCode(a.call(e+"_copy",w,E),a.call(e+"_neg",c,m))}function at(){const L=t.addFunction(n+"_sub");L.addParam("p1","i32"),L.addParam("p2","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.i32_const(t.alloc(u*3));L.addCode(a.call(n+"_neg",a.getLocal("p2"),w),a.call(n+"_add",a.getLocal("p1"),w,a.getLocal("pr")))}function R(){const L=t.addFunction(n+"_subMixed");L.addParam("p1","i32"),L.addParam("p2","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.i32_const(t.alloc(u*3));L.addCode(a.call(n+"_negAffine",a.getLocal("p2"),w),a.call(n+"_addMixed",a.getLocal("p1"),w,a.getLocal("pr")))}function C(){const L=t.addFunction(n+"_subAffine");L.addParam("p1","i32"),L.addParam("p2","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.i32_const(t.alloc(u*3));L.addCode(a.call(n+"_negAffine",a.getLocal("p2"),w),a.call(n+"_addAffine",a.getLocal("p1"),w,a.getLocal("pr")))}function T(){const L=t.addFunction(n+"_normalize");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u)),E=a.i32_add(a.getLocal("p1"),a.i32_const(u*2)),m=a.getLocal("pr"),_=a.i32_add(a.getLocal("pr"),a.i32_const(u)),Q=a.i32_add(a.getLocal("pr"),a.i32_const(u*2)),nt=a.i32_const(t.alloc(u)),X=a.i32_const(t.alloc(u)),ft=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZero",a.getLocal("p1")),a.call(n+"_zero",a.getLocal("pr")),[...a.call(e+"_inverse",E,nt),...a.call(e+"_square",nt,X),...a.call(e+"_mul",nt,X,ft),...a.call(e+"_mul",w,X,m),...a.call(e+"_mul",c,ft,_),...a.call(e+"_one",Q)]))}function V(){const L=t.addFunction(n+"_toAffine");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u)),E=a.i32_add(a.getLocal("p1"),a.i32_const(u*2)),m=a.getLocal("pr"),_=a.i32_add(a.getLocal("pr"),a.i32_const(u)),Q=a.i32_const(t.alloc(u)),nt=a.i32_const(t.alloc(u)),X=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZero",a.getLocal("p1")),[...a.call(e+"_zero",m),...a.call(e+"_zero",_)],[...a.call(e+"_inverse",E,Q),...a.call(e+"_square",Q,nt),...a.call(e+"_mul",Q,nt,X),...a.call(e+"_mul",w,nt,m),...a.call(e+"_mul",c,X,_)]))}function ut(){const L=t.addFunction(n+"_toJacobian");L.addParam("p1","i32"),L.addParam("pr","i32");const a=L.getCodeBuilder(),w=a.getLocal("p1"),c=a.i32_add(a.getLocal("p1"),a.i32_const(u)),E=a.getLocal("pr"),m=a.i32_add(a.getLocal("pr"),a.i32_const(u)),_=a.i32_add(a.getLocal("pr"),a.i32_const(u*2));L.addCode(a.if(a.call(n+"_isZeroAffine",a.getLocal("p1")),a.call(n+"_zero",a.getLocal("pr")),[...a.call(e+"_one",_),...a.call(e+"_copy",c,m),...a.call(e+"_copy",w,E)]))}function ct(){const L=t.addFunction(n+"_batchToAffine");L.addParam("pIn","i32"),L.addParam("n","i32"),L.addParam("pOut","i32"),L.addLocal("pAux","i32"),L.addLocal("itIn","i32"),L.addLocal("itAux","i32"),L.addLocal("itOut","i32"),L.addLocal("i","i32");const a=L.getCodeBuilder(),w=a.i32_const(t.alloc(u));L.addCode(a.setLocal("pAux",a.i32_load(a.i32_const(0))),a.i32_store(a.i32_const(0),a.i32_add(a.getLocal("pAux"),a.i32_mul(a.getLocal("n"),a.i32_const(u)))),a.call(e+"_batchInverse",a.i32_add(a.getLocal("pIn"),a.i32_const(u*2)),a.i32_const(u*3),a.getLocal("n"),a.getLocal("pAux"),a.i32_const(u)),a.setLocal("itIn",a.getLocal("pIn")),a.setLocal("itAux",a.getLocal("pAux")),a.setLocal("itOut",a.getLocal("pOut")),a.setLocal("i",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal("i"),a.getLocal("n"))),a.if(a.call(e+"_isZero",a.getLocal("itAux")),[...a.call(e+"_zero",a.getLocal("itOut")),...a.call(e+"_zero",a.i32_add(a.getLocal("itOut"),a.i32_const(u)))],[...a.call(e+"_mul",a.getLocal("itAux"),a.i32_add(a.getLocal("itIn"),a.i32_const(u)),w),...a.call(e+"_square",a.getLocal("itAux"),a.getLocal("itAux")),...a.call(e+"_mul",a.getLocal("itAux"),a.getLocal("itIn"),a.getLocal("itOut")),...a.call(e+"_mul",a.getLocal("itAux"),w,a.i32_add(a.getLocal("itOut"),a.i32_const(u)))]),a.setLocal("itIn",a.i32_add(a.getLocal("itIn"),a.i32_const(u*3))),a.setLocal("itOut",a.i32_add(a.getLocal("itOut"),a.i32_const(u*2))),a.setLocal("itAux",a.i32_add(a.getLocal("itAux"),a.i32_const(u))),a.setLocal("i",a.i32_add(a.getLocal("i"),a.i32_const(1))),a.br(0))),a.i32_store(a.i32_const(0),a.getLocal("pAux")))}function J(){const L=t.addFunction(n+"__reverseBytes");L.addParam("pIn","i32"),L.addParam("n","i32"),L.addParam("pOut","i32"),L.addLocal("itOut","i32"),L.addLocal("itIn","i32");const a=L.getCodeBuilder();L.addCode(a.setLocal("itOut",a.i32_sub(a.i32_add(a.getLocal("pOut"),a.getLocal("n")),a.i32_const(1))),a.setLocal("itIn",a.getLocal("pIn")),a.block(a.loop(a.br_if(1,a.i32_lt_s(a.getLocal("itOut"),a.getLocal("pOut"))),a.i32_store8(a.getLocal("itOut"),a.i32_load8_u(a.getLocal("itIn"))),a.setLocal("itOut",a.i32_sub(a.getLocal("itOut"),a.i32_const(1))),a.setLocal("itIn",a.i32_add(a.getLocal("itIn"),a.i32_const(1))),a.br(0))))}function gt(){const L=t.addFunction(n+"_LEMtoC");L.addParam("pIn","i32"),L.addParam("pOut","i32");const a=L.getCodeBuilder(),w=a.i32_const(t.alloc(u));L.addCode(a.if(a.call(n+"_isZeroAffine",a.getLocal("pIn")),[...a.call(e+"_zero",a.getLocal("pOut")),...a.i32_store8(a.getLocal("pOut"),a.i32_const(64)),...a.ret([])]),a.call(e+"_fromMontgomery",a.getLocal("pIn"),w),a.call(n+"__reverseBytes",w,a.i32_const(u),a.getLocal("pOut")),a.if(a.i32_eq(a.call(e+"_sign",a.i32_add(a.getLocal("pIn"),a.i32_const(u))),a.i32_const(-1)),a.i32_store8(a.getLocal("pOut"),a.i32_or(a.i32_load8_u(a.getLocal("pOut")),a.i32_const(128)))))}function et(){const L=t.addFunction(n+"_LEMtoU");L.addParam("pIn","i32"),L.addParam("pOut","i32");const a=L.getCodeBuilder(),w=t.alloc(u*2),c=a.i32_const(w),E=a.i32_const(w),m=a.i32_const(w+u);L.addCode(a.if(a.call(n+"_isZeroAffine",a.getLocal("pIn")),[...a.call(n+"_zeroAffine",a.getLocal("pOut")),...a.ret([])]),a.call(n+"_fromMontgomeryAffine",a.getLocal("pIn"),c),a.call(n+"__reverseBytes",E,a.i32_const(u),a.getLocal("pOut")),a.call(n+"__reverseBytes",m,a.i32_const(u),a.i32_add(a.getLocal("pOut"),a.i32_const(u))))}function st(){const L=t.addFunction(n+"_UtoLEM");L.addParam("pIn","i32"),L.addParam("pOut","i32");const a=L.getCodeBuilder(),w=t.alloc(u*2),c=a.i32_const(w),E=a.i32_const(w),m=a.i32_const(w+u);L.addCode(a.if(a.i32_and(a.i32_load8_u(a.getLocal("pIn")),a.i32_const(64)),[...a.call(n+"_zeroAffine",a.getLocal("pOut")),...a.ret([])]),a.call(n+"__reverseBytes",a.getLocal("pIn"),a.i32_const(u),E),a.call(n+"__reverseBytes",a.i32_add(a.getLocal("pIn"),a.i32_const(u)),a.i32_const(u),m),a.call(n+"_toMontgomeryAffine",c,a.getLocal("pOut")))}function Lt(){const L=t.addFunction(n+"_CtoLEM");L.addParam("pIn","i32"),L.addParam("pOut","i32"),L.addLocal("firstByte","i32"),L.addLocal("greatest","i32");const a=L.getCodeBuilder(),w=t.alloc(u*2),c=a.i32_const(w),E=a.i32_const(w+u);L.addCode(a.setLocal("firstByte",a.i32_load8_u(a.getLocal("pIn"))),a.if(a.i32_and(a.getLocal("firstByte"),a.i32_const(64)),[...a.call(n+"_zeroAffine",a.getLocal("pOut")),...a.ret([])]),a.setLocal("greatest",a.i32_and(a.getLocal("firstByte"),a.i32_const(128))),a.call(e+"_copy",a.getLocal("pIn"),E),a.i32_store8(E,a.i32_and(a.getLocal("firstByte"),a.i32_const(63))),a.call(n+"__reverseBytes",E,a.i32_const(u),c),a.call(e+"_toMontgomery",c,a.getLocal("pOut")),a.call(e+"_square",a.getLocal("pOut"),E),a.call(e+"_mul",a.getLocal("pOut"),E,E),a.call(e+"_add",E,a.i32_const(o),E),a.call(e+"_sqrt",E,E),a.call(e+"_neg",E,c),a.if(a.i32_eq(a.call(e+"_sign",E),a.i32_const(-1)),a.if(a.getLocal("greatest"),a.call(e+"_copy",E,a.i32_add(a.getLocal("pOut"),a.i32_const(u))),a.call(e+"_neg",E,a.i32_add(a.getLocal("pOut"),a.i32_const(u)))),a.if(a.getLocal("greatest"),a.call(e+"_neg",E,a.i32_add(a.getLocal("pOut"),a.i32_const(u))),a.call(e+"_copy",E,a.i32_add(a.getLocal("pOut"),a.i32_const(u))))))}function Ut(){const L=t.addFunction(n+"_inCurveAffine");L.addParam("pIn","i32"),L.setReturnType("i32");const a=L.getCodeBuilder(),w=a.getLocal("pIn"),c=a.i32_add(a.getLocal("pIn"),a.i32_const(u)),E=a.i32_const(t.alloc(u)),m=a.i32_const(t.alloc(u));L.addCode(a.call(e+"_square",c,E),a.call(e+"_square",w,m),a.call(e+"_mul",w,m,m),a.call(e+"_add",m,a.i32_const(o),m),a.ret(a.call(e+"_eq",E,m)))}function mt(){const L=t.addFunction(n+"_inCurve");L.addParam("pIn","i32"),L.setReturnType("i32");const a=L.getCodeBuilder(),w=a.i32_const(t.alloc(u*2));L.addCode(a.call(n+"_toAffine",a.getLocal("pIn"),w),a.ret(a.call(n+"_inCurveAffine",w)))}return b(),r(),F(),x(),l(),g(),ut(),G(),k(),I(),S(),z(),A(),h(),O(),tt(),Z(),C(),R(),at(),lt(),H(),rt(),U(),V(),Ut(),mt(),ct(),T(),J(),et(),gt(),st(),Lt(),Hn(t,n+"_batchLEMtoU",n+"_LEMtoU",u*2,u*2),Hn(t,n+"_batchLEMtoC",n+"_LEMtoC",u*2,u),Hn(t,n+"_batchUtoLEM",n+"_UtoLEM",u*2,u*2),Hn(t,n+"_batchCtoLEM",n+"_CtoLEM",u,u*2,!0),Hn(t,n+"_batchToJacobian",n+"_toJacobian",u*2,u*3,!0),po(t,n,n+"_multiexp",n+"_add",u*3),po(t,n,n+"_multiexpAffine",n+"_addMixed",u*2),_o(t,n+"_timesScalar",u*3,n+"_add",n+"_double",n+"_sub",n+"_copy",n+"_zero"),_o(t,n+"_timesScalarAffine",u*2,n+"_addMixed",n+"_double",n+"_subMixed",n+"_copyAffine",n+"_zero"),t.exportFunction(n+"_isZero"),t.exportFunction(n+"_isZeroAffine"),t.exportFunction(n+"_eq"),t.exportFunction(n+"_eqMixed"),t.exportFunction(n+"_eqAffine"),t.exportFunction(n+"_copy"),t.exportFunction(n+"_copyAffine"),t.exportFunction(n+"_zero"),t.exportFunction(n+"_zeroAffine"),t.exportFunction(n+"_double"),t.exportFunction(n+"_doubleAffine"),t.exportFunction(n+"_add"),t.exportFunction(n+"_addMixed"),t.exportFunction(n+"_addAffine"),t.exportFunction(n+"_neg"),t.exportFunction(n+"_negAffine"),t.exportFunction(n+"_sub"),t.exportFunction(n+"_subMixed"),t.exportFunction(n+"_subAffine"),t.exportFunction(n+"_fromMontgomery"),t.exportFunction(n+"_fromMontgomeryAffine"),t.exportFunction(n+"_toMontgomery"),t.exportFunction(n+"_toMontgomeryAffine"),t.exportFunction(n+"_timesScalar"),t.exportFunction(n+"_timesScalarAffine"),t.exportFunction(n+"_normalize"),t.exportFunction(n+"_LEMtoU"),t.exportFunction(n+"_LEMtoC"),t.exportFunction(n+"_UtoLEM"),t.exportFunction(n+"_CtoLEM"),t.exportFunction(n+"_batchLEMtoU"),t.exportFunction(n+"_batchLEMtoC"),t.exportFunction(n+"_batchUtoLEM"),t.exportFunction(n+"_batchCtoLEM"),t.exportFunction(n+"_toAffine"),t.exportFunction(n+"_toJacobian"),t.exportFunction(n+"_batchToAffine"),t.exportFunction(n+"_batchToJacobian"),t.exportFunction(n+"_inCurve"),t.exportFunction(n+"_inCurveAffine"),n};const{isOdd:Ll,modInv:Lo,modPow:Vn}=Wt,Ie=Cn;var oc=function(t,n,e,o,s){const r=t.modules[o].n64*8,g=t.modules[e].n64*8,l=t.modules[o].q;let x=l-1n,F=0;for(;!Ll(x);)F++,x=x>>1n;let I=2n;for(;Vn(I,l>>1n,l)===1n;)I=I+1n;const k=new Array(F+1);k[F]=Vn(I,x,l);let z=F-1;for(;z>=0;)k[z]=Vn(k[z+1],2n,l),z--;const S=[],G=(1n<<BigInt(r*8))%l;for(let w=0;w<k.length;w++){const c=k[w]*G%l;S.push(...Ie.bigInt2BytesLE(c,r))}const U=t.alloc(S),rt=new Array(F+1);rt[0]=1n;for(let w=1;w<=F;w++)rt[w]=rt[w-1]*2n;const H=[];for(let w=0;w<=F;w++){const c=Lo(rt[w],l)*G%l;H.push(...Ie.bigInt2BytesLE(c,r))}const lt=t.alloc(H),O=Vn(I,2n,l),h=[],A=[];for(let w=0;w<=F;w++){const c=Vn(O,2n**BigInt(w),l),E=Lo(l+1n-c,l);h.push(...Ie.bigInt2BytesLE(c*G%l,r)),A.push(...Ie.bigInt2BytesLE(E*G%l,r))}const Z=t.alloc(h),tt=t.alloc(A);function at(w){let c=0;for(let E=0;E<8;E++)w&1<<E&&(c=c|128>>E);return c}const R=Array(256);for(let w=0;w<256;w++)R[w]=at(w);const C=t.alloc(R);function T(){const w=t.addFunction(n+"__log2");w.addParam("n","i32"),w.setReturnType("i32"),w.addLocal("bits","i32"),w.addLocal("aux","i32");const c=w.getCodeBuilder();w.addCode(c.setLocal("aux",c.i32_shr_u(c.getLocal("n"),c.i32_const(1)))),w.addCode(c.setLocal("bits",c.i32_const(0))),w.addCode(c.block(c.loop(c.br_if(1,c.i32_eqz(c.getLocal("aux"))),c.setLocal("aux",c.i32_shr_u(c.getLocal("aux"),c.i32_const(1))),c.setLocal("bits",c.i32_add(c.getLocal("bits"),c.i32_const(1))),c.br(0)))),w.addCode(c.if(c.i32_ne(c.getLocal("n"),c.i32_shl(c.i32_const(1),c.getLocal("bits"))),c.unreachable())),w.addCode(c.if(c.i32_gt_u(c.getLocal("bits"),c.i32_const(F)),c.unreachable())),w.addCode(c.getLocal("bits"))}function V(){const w=t.addFunction(n+"_fft");w.addParam("px","i32"),w.addParam("n","i32"),w.addLocal("bits","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(r));w.addCode(c.setLocal("bits",c.call(n+"__log2",c.getLocal("n"))),c.call(o+"_one",E),c.call(n+"_rawfft",c.getLocal("px"),c.getLocal("bits"),c.i32_const(0),E))}function ut(){const w=t.addFunction(n+"_ifft");w.addParam("px","i32"),w.addParam("n","i32"),w.addLocal("bits","i32"),w.addLocal("pInv2","i32");const c=w.getCodeBuilder();w.addCode(c.setLocal("bits",c.call(n+"__log2",c.getLocal("n"))),c.setLocal("pInv2",c.i32_add(c.i32_const(lt),c.i32_mul(c.getLocal("bits"),c.i32_const(r)))),c.call(n+"_rawfft",c.getLocal("px"),c.getLocal("bits"),c.i32_const(1),c.getLocal("pInv2")))}function ct(){const w=t.addFunction(n+"_rawfft");w.addParam("px","i32"),w.addParam("bits","i32"),w.addParam("reverse","i32"),w.addParam("mulFactor","i32"),w.addLocal("s","i32"),w.addLocal("k","i32"),w.addLocal("j","i32"),w.addLocal("m","i32"),w.addLocal("mdiv2","i32"),w.addLocal("n","i32"),w.addLocal("pwm","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(r)),m=c.i32_const(t.alloc(g)),_=c.i32_const(t.alloc(g));w.addCode(c.call(n+"__reversePermutation",c.getLocal("px"),c.getLocal("bits")),c.setLocal("n",c.i32_shl(c.i32_const(1),c.getLocal("bits"))),c.setLocal("s",c.i32_const(1)),c.block(c.loop(c.br_if(1,c.i32_gt_u(c.getLocal("s"),c.getLocal("bits"))),c.setLocal("m",c.i32_shl(c.i32_const(1),c.getLocal("s"))),c.setLocal("pwm",c.i32_add(c.i32_const(U),c.i32_mul(c.getLocal("s"),c.i32_const(r)))),c.setLocal("k",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal("k"),c.getLocal("n"))),c.call(o+"_one",E),c.setLocal("mdiv2",c.i32_shr_u(c.getLocal("m"),c.i32_const(1))),c.setLocal("j",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal("j"),c.getLocal("mdiv2"))),c.setLocal("idx1",c.i32_add(c.getLocal("px"),c.i32_mul(c.i32_add(c.getLocal("k"),c.getLocal("j")),c.i32_const(g)))),c.setLocal("idx2",c.i32_add(c.getLocal("idx1"),c.i32_mul(c.getLocal("mdiv2"),c.i32_const(g)))),c.call(s,c.getLocal("idx2"),E,m),c.call(e+"_copy",c.getLocal("idx1"),_),c.call(e+"_add",_,m,c.getLocal("idx1")),c.call(e+"_sub",_,m,c.getLocal("idx2")),c.call(o+"_mul",E,c.getLocal("pwm"),E),c.setLocal("j",c.i32_add(c.getLocal("j"),c.i32_const(1))),c.br(0))),c.setLocal("k",c.i32_add(c.getLocal("k"),c.getLocal("m"))),c.br(0))),c.setLocal("s",c.i32_add(c.getLocal("s"),c.i32_const(1))),c.br(0))),c.call(n+"__fftFinal",c.getLocal("px"),c.getLocal("bits"),c.getLocal("reverse"),c.getLocal("mulFactor")))}function J(){const w=t.addFunction(n+"__fftFinal");w.addParam("px","i32"),w.addParam("bits","i32"),w.addParam("reverse","i32"),w.addParam("mulFactor","i32"),w.addLocal("n","i32"),w.addLocal("ndiv2","i32"),w.addLocal("pInv2","i32"),w.addLocal("i","i32"),w.addLocal("mask","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(g));w.addCode(c.if(c.i32_and(c.i32_eqz(c.getLocal("reverse")),c.call(o+"_isOne",c.getLocal("mulFactor"))),c.ret([])),c.setLocal("n",c.i32_shl(c.i32_const(1),c.getLocal("bits"))),c.setLocal("mask",c.i32_sub(c.getLocal("n"),c.i32_const(1))),c.setLocal("i",c.i32_const(1)),c.setLocal("ndiv2",c.i32_shr_u(c.getLocal("n"),c.i32_const(1))),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal("i"),c.getLocal("ndiv2"))),c.setLocal("idx1",c.i32_add(c.getLocal("px"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.setLocal("idx2",c.i32_add(c.getLocal("px"),c.i32_mul(c.i32_sub(c.getLocal("n"),c.getLocal("i")),c.i32_const(g)))),c.if(c.getLocal("reverse"),c.if(c.call(o+"_isOne",c.getLocal("mulFactor")),[...c.call(e+"_copy",c.getLocal("idx1"),E),...c.call(e+"_copy",c.getLocal("idx2"),c.getLocal("idx1")),...c.call(e+"_copy",E,c.getLocal("idx2"))],[...c.call(e+"_copy",c.getLocal("idx1"),E),...c.call(s,c.getLocal("idx2"),c.getLocal("mulFactor"),c.getLocal("idx1")),...c.call(s,E,c.getLocal("mulFactor"),c.getLocal("idx2"))]),c.if(c.call(o+"_isOne",c.getLocal("mulFactor")),[],[...c.call(s,c.getLocal("idx1"),c.getLocal("mulFactor"),c.getLocal("idx1")),...c.call(s,c.getLocal("idx2"),c.getLocal("mulFactor"),c.getLocal("idx2"))])),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))),c.if(c.call(o+"_isOne",c.getLocal("mulFactor")),[],[...c.call(s,c.getLocal("px"),c.getLocal("mulFactor"),c.getLocal("px")),...c.setLocal("idx2",c.i32_add(c.getLocal("px"),c.i32_mul(c.getLocal("ndiv2"),c.i32_const(g)))),...c.call(s,c.getLocal("idx2"),c.getLocal("mulFactor"),c.getLocal("idx2"))]))}function gt(){const w=t.addFunction(n+"__reversePermutation");w.addParam("px","i32"),w.addParam("bits","i32"),w.addLocal("n","i32"),w.addLocal("i","i32"),w.addLocal("ri","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(g));w.addCode(c.setLocal("n",c.i32_shl(c.i32_const(1),c.getLocal("bits"))),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("px"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.setLocal("ri",c.call(n+"__rev",c.getLocal("i"),c.getLocal("bits"))),c.setLocal("idx2",c.i32_add(c.getLocal("px"),c.i32_mul(c.getLocal("ri"),c.i32_const(g)))),c.if(c.i32_lt_u(c.getLocal("i"),c.getLocal("ri")),[...c.call(e+"_copy",c.getLocal("idx1"),E),...c.call(e+"_copy",c.getLocal("idx2"),c.getLocal("idx1")),...c.call(e+"_copy",E,c.getLocal("idx2"))]),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}function et(){const w=t.addFunction(n+"__rev");w.addParam("x","i32"),w.addParam("bits","i32"),w.setReturnType("i32");const c=w.getCodeBuilder();w.addCode(c.i32_rotl(c.i32_add(c.i32_add(c.i32_shl(c.i32_load8_u(c.i32_and(c.getLocal("x"),c.i32_const(255)),C,0),c.i32_const(24)),c.i32_shl(c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal("x"),c.i32_const(8)),c.i32_const(255)),C,0),c.i32_const(16))),c.i32_add(c.i32_shl(c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal("x"),c.i32_const(16)),c.i32_const(255)),C,0),c.i32_const(8)),c.i32_load8_u(c.i32_and(c.i32_shr_u(c.getLocal("x"),c.i32_const(24)),c.i32_const(255)),C,0))),c.getLocal("bits")))}function st(){const w=t.addFunction(n+"_fftJoin");w.addParam("pBuff1","i32"),w.addParam("pBuff2","i32"),w.addParam("n","i32"),w.addParam("first","i32"),w.addParam("inc","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32"),w.addLocal("i","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(r)),m=c.i32_const(t.alloc(g)),_=c.i32_const(t.alloc(g));w.addCode(c.call(o+"_copy",c.getLocal("first"),E),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff1"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff2"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.call(s,c.getLocal("idx2"),E,m),c.call(e+"_copy",c.getLocal("idx1"),_),c.call(e+"_add",_,m,c.getLocal("idx1")),c.call(e+"_sub",_,m,c.getLocal("idx2")),c.call(o+"_mul",E,c.getLocal("inc"),E),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}function Lt(){const w=t.addFunction(n+"_fftJoinExt");w.addParam("pBuff1","i32"),w.addParam("pBuff2","i32"),w.addParam("n","i32"),w.addParam("first","i32"),w.addParam("inc","i32"),w.addParam("totalBits","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32"),w.addLocal("i","i32"),w.addLocal("pShiftToM","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(r)),m=c.i32_const(t.alloc(g));w.addCode(c.setLocal("pShiftToM",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal("totalBits"),c.i32_const(r)))),c.call(o+"_copy",c.getLocal("first"),E),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff1"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff2"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.call(e+"_add",c.getLocal("idx1"),c.getLocal("idx2"),m),c.call(s,c.getLocal("idx2"),c.getLocal("pShiftToM"),c.getLocal("idx2")),c.call(e+"_add",c.getLocal("idx1"),c.getLocal("idx2"),c.getLocal("idx2")),c.call(s,c.getLocal("idx2"),E,c.getLocal("idx2")),c.call(e+"_copy",m,c.getLocal("idx1")),c.call(o+"_mul",E,c.getLocal("inc"),E),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}function Ut(){const w=t.addFunction(n+"_fftJoinExtInv");w.addParam("pBuff1","i32"),w.addParam("pBuff2","i32"),w.addParam("n","i32"),w.addParam("first","i32"),w.addParam("inc","i32"),w.addParam("totalBits","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32"),w.addLocal("i","i32"),w.addLocal("pShiftToM","i32"),w.addLocal("pSConst","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(r)),m=c.i32_const(t.alloc(g));w.addCode(c.setLocal("pShiftToM",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal("totalBits"),c.i32_const(r)))),c.setLocal("pSConst",c.i32_add(c.i32_const(tt),c.i32_mul(c.getLocal("totalBits"),c.i32_const(r)))),c.call(o+"_copy",c.getLocal("first"),E),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff1"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff2"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.call(s,c.getLocal("idx2"),E,m),c.call(e+"_sub",c.getLocal("idx1"),m,c.getLocal("idx2")),c.call(s,c.getLocal("idx2"),c.getLocal("pSConst"),c.getLocal("idx2")),c.call(s,c.getLocal("idx1"),c.getLocal("pShiftToM"),c.getLocal("idx1")),c.call(e+"_sub",m,c.getLocal("idx1"),c.getLocal("idx1")),c.call(s,c.getLocal("idx1"),c.getLocal("pSConst"),c.getLocal("idx1")),c.call(o+"_mul",E,c.getLocal("inc"),E),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}function mt(){const w=t.addFunction(n+"_prepareLagrangeEvaluation");w.addParam("pBuff1","i32"),w.addParam("pBuff2","i32"),w.addParam("n","i32"),w.addParam("first","i32"),w.addParam("inc","i32"),w.addParam("totalBits","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32"),w.addLocal("i","i32"),w.addLocal("pShiftToM","i32"),w.addLocal("pSConst","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(r)),m=c.i32_const(t.alloc(g));w.addCode(c.setLocal("pShiftToM",c.i32_add(c.i32_const(Z),c.i32_mul(c.getLocal("totalBits"),c.i32_const(r)))),c.setLocal("pSConst",c.i32_add(c.i32_const(tt),c.i32_mul(c.getLocal("totalBits"),c.i32_const(r)))),c.call(o+"_copy",c.getLocal("first"),E),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff1"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff2"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.call(s,c.getLocal("idx1"),c.getLocal("pShiftToM"),m),c.call(e+"_sub",c.getLocal("idx2"),m,m),c.call(e+"_sub",c.getLocal("idx1"),c.getLocal("idx2"),c.getLocal("idx2")),c.call(s,m,c.getLocal("pSConst"),c.getLocal("idx1")),c.call(s,c.getLocal("idx2"),E,c.getLocal("idx2")),c.call(o+"_mul",E,c.getLocal("inc"),E),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}function L(){const w=t.addFunction(n+"_fftMix");w.addParam("pBuff","i32"),w.addParam("n","i32"),w.addParam("exp","i32"),w.addLocal("nGroups","i32"),w.addLocal("nPerGroup","i32"),w.addLocal("nPerGroupDiv2","i32"),w.addLocal("pairOffset","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32"),w.addLocal("i","i32"),w.addLocal("j","i32"),w.addLocal("pwm","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(r)),m=c.i32_const(t.alloc(g)),_=c.i32_const(t.alloc(g));w.addCode(c.setLocal("nPerGroup",c.i32_shl(c.i32_const(1),c.getLocal("exp"))),c.setLocal("nPerGroupDiv2",c.i32_shr_u(c.getLocal("nPerGroup"),c.i32_const(1))),c.setLocal("nGroups",c.i32_shr_u(c.getLocal("n"),c.getLocal("exp"))),c.setLocal("pairOffset",c.i32_mul(c.getLocal("nPerGroupDiv2"),c.i32_const(g))),c.setLocal("pwm",c.i32_add(c.i32_const(U),c.i32_mul(c.getLocal("exp"),c.i32_const(r)))),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("nGroups"))),c.call(o+"_one",E),c.setLocal("j",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("j"),c.getLocal("nPerGroupDiv2"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff"),c.i32_mul(c.i32_add(c.i32_mul(c.getLocal("i"),c.getLocal("nPerGroup")),c.getLocal("j")),c.i32_const(g)))),c.setLocal("idx2",c.i32_add(c.getLocal("idx1"),c.getLocal("pairOffset"))),c.call(s,c.getLocal("idx2"),E,m),c.call(e+"_copy",c.getLocal("idx1"),_),c.call(e+"_add",_,m,c.getLocal("idx1")),c.call(e+"_sub",_,m,c.getLocal("idx2")),c.call(o+"_mul",E,c.getLocal("pwm"),E),c.setLocal("j",c.i32_add(c.getLocal("j"),c.i32_const(1))),c.br(0))),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}function a(){const w=t.addFunction(n+"_fftFinal");w.addParam("pBuff","i32"),w.addParam("n","i32"),w.addParam("factor","i32"),w.addLocal("idx1","i32"),w.addLocal("idx2","i32"),w.addLocal("i","i32"),w.addLocal("ndiv2","i32");const c=w.getCodeBuilder(),E=c.i32_const(t.alloc(g));w.addCode(c.setLocal("ndiv2",c.i32_shr_u(c.getLocal("n"),c.i32_const(1))),c.if(c.i32_and(c.getLocal("n"),c.i32_const(1)),c.call(s,c.i32_add(c.getLocal("pBuff"),c.i32_mul(c.getLocal("ndiv2"),c.i32_const(g))),c.getLocal("factor"),c.i32_add(c.getLocal("pBuff"),c.i32_mul(c.getLocal("ndiv2"),c.i32_const(g))))),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal("i"),c.getLocal("ndiv2"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff"),c.i32_mul(c.getLocal("i"),c.i32_const(g)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff"),c.i32_mul(c.i32_sub(c.i32_sub(c.getLocal("n"),c.i32_const(1)),c.getLocal("i")),c.i32_const(g)))),c.call(s,c.getLocal("idx2"),c.getLocal("factor"),E),c.call(s,c.getLocal("idx1"),c.getLocal("factor"),c.getLocal("idx2")),c.call(e+"_copy",E,c.getLocal("idx1")),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}et(),gt(),J(),ct(),T(),V(),ut(),st(),Lt(),Ut(),L(),a(),mt(),t.exportFunction(n+"_fft"),t.exportFunction(n+"_ifft"),t.exportFunction(n+"_rawfft"),t.exportFunction(n+"_fftJoin"),t.exportFunction(n+"_fftJoinExt"),t.exportFunction(n+"_fftJoinExtInv"),t.exportFunction(n+"_fftMix"),t.exportFunction(n+"_fftFinal"),t.exportFunction(n+"_prepareLagrangeEvaluation")},ac=function(t,n,e){const s=t.modules[e].n64*8;function u(){const b=t.addFunction(n+"_zero");b.addParam("px","i32"),b.addParam("n","i32"),b.addLocal("lastp","i32"),b.addLocal("p","i32");const g=b.getCodeBuilder();b.addCode(g.setLocal("p",g.getLocal("px")),g.setLocal("lastp",g.i32_add(g.getLocal("px"),g.i32_mul(g.getLocal("n"),g.i32_const(s)))),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal("p"),g.getLocal("lastp"))),g.call(e+"_zero",g.getLocal("p")),g.setLocal("p",g.i32_add(g.getLocal("p"),g.i32_const(s))),g.br(0))))}function r(){const b=t.addFunction(n+"_constructLC");b.addParam("ppolynomials","i32"),b.addParam("psignals","i32"),b.addParam("nSignals","i32"),b.addParam("pres","i32"),b.addLocal("i","i32"),b.addLocal("j","i32"),b.addLocal("pp","i32"),b.addLocal("ps","i32"),b.addLocal("pd","i32"),b.addLocal("ncoefs","i32");const g=b.getCodeBuilder(),l=g.i32_const(t.alloc(s));b.addCode(g.setLocal("i",g.i32_const(0)),g.setLocal("pp",g.getLocal("ppolynomials")),g.setLocal("ps",g.getLocal("psignals")),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal("i"),g.getLocal("nSignals"))),g.setLocal("ncoefs",g.i32_load(g.getLocal("pp"))),g.setLocal("pp",g.i32_add(g.getLocal("pp"),g.i32_const(4))),g.setLocal("j",g.i32_const(0)),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal("j"),g.getLocal("ncoefs"))),g.setLocal("pd",g.i32_add(g.getLocal("pres"),g.i32_mul(g.i32_load(g.getLocal("pp")),g.i32_const(s)))),g.setLocal("pp",g.i32_add(g.getLocal("pp"),g.i32_const(4))),g.call(e+"_mul",g.getLocal("ps"),g.getLocal("pp"),l),g.call(e+"_add",l,g.getLocal("pd"),g.getLocal("pd")),g.setLocal("pp",g.i32_add(g.getLocal("pp"),g.i32_const(s))),g.setLocal("j",g.i32_add(g.getLocal("j"),g.i32_const(1))),g.br(0))),g.setLocal("ps",g.i32_add(g.getLocal("ps"),g.i32_const(s))),g.setLocal("i",g.i32_add(g.getLocal("i"),g.i32_const(1))),g.br(0))))}return u(),r(),t.exportFunction(n+"_zero"),t.exportFunction(n+"_constructLC"),n},cc=function(t,n,e){const s=t.modules[e].n64*8;function u(){const g=t.addFunction(n+"_buildABC");g.addParam("pCoefs","i32"),g.addParam("nCoefs","i32"),g.addParam("pWitness","i32"),g.addParam("pA","i32"),g.addParam("pB","i32"),g.addParam("pC","i32"),g.addParam("offsetOut","i32"),g.addParam("nOut","i32"),g.addParam("offsetWitness","i32"),g.addParam("nWitness","i32"),g.addLocal("it","i32"),g.addLocal("ita","i32"),g.addLocal("itb","i32"),g.addLocal("last","i32"),g.addLocal("m","i32"),g.addLocal("c","i32"),g.addLocal("s","i32"),g.addLocal("pOut","i32");const l=g.getCodeBuilder(),x=l.i32_const(t.alloc(s));g.addCode(l.setLocal("ita",l.getLocal("pA")),l.setLocal("itb",l.getLocal("pB")),l.setLocal("last",l.i32_add(l.getLocal("pA"),l.i32_mul(l.getLocal("nOut"),l.i32_const(s)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("ita"),l.getLocal("last"))),l.call(e+"_zero",l.getLocal("ita")),l.call(e+"_zero",l.getLocal("itb")),l.setLocal("ita",l.i32_add(l.getLocal("ita"),l.i32_const(s))),l.setLocal("itb",l.i32_add(l.getLocal("itb"),l.i32_const(s))),l.br(0))),l.setLocal("it",l.getLocal("pCoefs")),l.setLocal("last",l.i32_add(l.getLocal("pCoefs"),l.i32_mul(l.getLocal("nCoefs"),l.i32_const(s+12)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("it"),l.getLocal("last"))),l.setLocal("s",l.i32_load(l.getLocal("it"),8)),l.if(l.i32_or(l.i32_lt_u(l.getLocal("s"),l.getLocal("offsetWitness")),l.i32_ge_u(l.getLocal("s"),l.i32_add(l.getLocal("offsetWitness"),l.getLocal("nWitness")))),[...l.setLocal("it",l.i32_add(l.getLocal("it"),l.i32_const(s+12))),...l.br(1)]),l.setLocal("m",l.i32_load(l.getLocal("it"))),l.if(l.i32_eq(l.getLocal("m"),l.i32_const(0)),l.setLocal("pOut",l.getLocal("pA")),l.if(l.i32_eq(l.getLocal("m"),l.i32_const(1)),l.setLocal("pOut",l.getLocal("pB")),[...l.setLocal("it",l.i32_add(l.getLocal("it"),l.i32_const(s+12))),...l.br(1)])),l.setLocal("c",l.i32_load(l.getLocal("it"),4)),l.if(l.i32_or(l.i32_lt_u(l.getLocal("c"),l.getLocal("offsetOut")),l.i32_ge_u(l.getLocal("c"),l.i32_add(l.getLocal("offsetOut"),l.getLocal("nOut")))),[...l.setLocal("it",l.i32_add(l.getLocal("it"),l.i32_const(s+12))),...l.br(1)]),l.setLocal("pOut",l.i32_add(l.getLocal("pOut"),l.i32_mul(l.i32_sub(l.getLocal("c"),l.getLocal("offsetOut")),l.i32_const(s)))),l.call(e+"_mul",l.i32_add(l.getLocal("pWitness"),l.i32_mul(l.i32_sub(l.getLocal("s"),l.getLocal("offsetWitness")),l.i32_const(s))),l.i32_add(l.getLocal("it"),l.i32_const(12)),x),l.call(e+"_add",l.getLocal("pOut"),x,l.getLocal("pOut")),l.setLocal("it",l.i32_add(l.getLocal("it"),l.i32_const(s+12))),l.br(0))),l.setLocal("ita",l.getLocal("pA")),l.setLocal("itb",l.getLocal("pB")),l.setLocal("it",l.getLocal("pC")),l.setLocal("last",l.i32_add(l.getLocal("pA"),l.i32_mul(l.getLocal("nOut"),l.i32_const(s)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("ita"),l.getLocal("last"))),l.call(e+"_mul",l.getLocal("ita"),l.getLocal("itb"),l.getLocal("it")),l.setLocal("ita",l.i32_add(l.getLocal("ita"),l.i32_const(s))),l.setLocal("itb",l.i32_add(l.getLocal("itb"),l.i32_const(s))),l.setLocal("it",l.i32_add(l.getLocal("it"),l.i32_const(s))),l.br(0))))}function r(){const g=t.addFunction(n+"_joinABC");g.addParam("pA","i32"),g.addParam("pB","i32"),g.addParam("pC","i32"),g.addParam("n","i32"),g.addParam("pP","i32"),g.addLocal("ita","i32"),g.addLocal("itb","i32"),g.addLocal("itc","i32"),g.addLocal("itp","i32"),g.addLocal("last","i32");const l=g.getCodeBuilder(),x=l.i32_const(t.alloc(s));g.addCode(l.setLocal("ita",l.getLocal("pA")),l.setLocal("itb",l.getLocal("pB")),l.setLocal("itc",l.getLocal("pC")),l.setLocal("itp",l.getLocal("pP")),l.setLocal("last",l.i32_add(l.getLocal("pA"),l.i32_mul(l.getLocal("n"),l.i32_const(s)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("ita"),l.getLocal("last"))),l.call(e+"_mul",l.getLocal("ita"),l.getLocal("itb"),x),l.call(e+"_sub",x,l.getLocal("itc"),l.getLocal("itp")),l.setLocal("ita",l.i32_add(l.getLocal("ita"),l.i32_const(s))),l.setLocal("itb",l.i32_add(l.getLocal("itb"),l.i32_const(s))),l.setLocal("itc",l.i32_add(l.getLocal("itc"),l.i32_const(s))),l.setLocal("itp",l.i32_add(l.getLocal("itp"),l.i32_const(s))),l.br(0))))}function b(){const g=t.addFunction(n+"_batchAdd");g.addParam("pa","i32"),g.addParam("pb","i32"),g.addParam("n","i32"),g.addParam("pr","i32"),g.addLocal("ita","i32"),g.addLocal("itb","i32"),g.addLocal("itr","i32"),g.addLocal("last","i32");const l=g.getCodeBuilder();g.addCode(l.setLocal("ita",l.getLocal("pa")),l.setLocal("itb",l.getLocal("pb")),l.setLocal("itr",l.getLocal("pr")),l.setLocal("last",l.i32_add(l.getLocal("pa"),l.i32_mul(l.getLocal("n"),l.i32_const(s)))),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("ita"),l.getLocal("last"))),l.call(e+"_add",l.getLocal("ita"),l.getLocal("itb"),l.getLocal("itr")),l.setLocal("ita",l.i32_add(l.getLocal("ita"),l.i32_const(s))),l.setLocal("itb",l.i32_add(l.getLocal("itb"),l.i32_const(s))),l.setLocal("itr",l.i32_add(l.getLocal("itr"),l.i32_const(s))),l.br(0))))}return u(),r(),b(),t.exportFunction(n+"_buildABC"),t.exportFunction(n+"_joinABC"),t.exportFunction(n+"_batchAdd"),n},sc=function(t,n,e,o,s,u,r,b){const g=t.addFunction(n);g.addParam("pIn","i32"),g.addParam("n","i32"),g.addParam("pFirst","i32"),g.addParam("pInc","i32"),g.addParam("pOut","i32"),g.addLocal("pOldFree","i32"),g.addLocal("i","i32"),g.addLocal("pFrom","i32"),g.addLocal("pTo","i32");const l=g.getCodeBuilder(),x=l.i32_const(t.alloc(r));g.addCode(l.setLocal("pFrom",l.getLocal("pIn")),l.setLocal("pTo",l.getLocal("pOut"))),g.addCode(l.call(o+"_copy",l.getLocal("pFirst"),x)),g.addCode(l.setLocal("i",l.i32_const(0)),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("i"),l.getLocal("n"))),l.call(b,l.getLocal("pFrom"),x,l.getLocal("pTo")),l.setLocal("pFrom",l.i32_add(l.getLocal("pFrom"),l.i32_const(s))),l.setLocal("pTo",l.i32_add(l.getLocal("pTo"),l.i32_const(u))),l.call(o+"_mul",x,l.getLocal("pInc"),x),l.setLocal("i",l.i32_add(l.getLocal("i"),l.i32_const(1))),l.br(0)))),t.exportFunction(n)};const Pt=Cn,Al=Hi,yl=tc,Ao=nc,Il=ec,yo=ic,Ve=oc,bl=ac,Cl=cc,jn=sc,{bitLength:ml,modInv:wl,isOdd:Io,isNegative:Bl}=Wt;var El=function(t,n){const e=n||"bn128";if(t.modules[e])return e;const o=21888242871839275222246405745257275088696311157297823662689037894645226208583n,s=21888242871839275222246405745257275088548364400416034343698204186575808495617n,u=Math.floor((ml(o-1n)-1)/64)+1,r=u*8,b=r,g=r,l=g*2,x=g*12,F=t.alloc(Pt.bigInt2BytesLE(s,b)),I=Al(t,o,"f1m");yl(t,s,"fr","frm");const k=t.alloc(Pt.bigInt2BytesLE(H(3n),g)),z=yo(t,"g1m","f1m",k);Ve(t,"frm","frm","frm","frm_mul"),bl(t,"pol","frm"),Cl(t,"qap","frm");const S=Ao(t,"f1m_neg","f2m","f1m"),G=t.alloc([...Pt.bigInt2BytesLE(H(19485874751759354771024239261021720505790618469301721065564631296452457478373n),g),...Pt.bigInt2BytesLE(H(266929791119991161246907387137283842545076965332900288569378510910307636690n),g)]),U=yo(t,"g2m","f2m",G);function rt(P,d){const f=t.addFunction(P);f.addParam("pG","i32"),f.addParam("pFr","i32"),f.addParam("pr","i32");const q=f.getCodeBuilder(),N=q.i32_const(t.alloc(r));f.addCode(q.call("frm_fromMontgomery",q.getLocal("pFr"),N),q.call(d,q.getLocal("pG"),N,q.i32_const(r),q.getLocal("pr"))),t.exportFunction(P)}rt("g1m_timesFr","g1m_timesScalar"),Ve(t,"g1m","g1m","frm","g1m_timesFr"),rt("g2m_timesFr","g2m_timesScalar"),Ve(t,"g2m","g2m","frm","g2m_timesFr"),rt("g1m_timesFrAffine","g1m_timesScalarAffine"),rt("g2m_timesFrAffine","g2m_timesScalarAffine"),jn(t,"frm_batchApplyKey","fmr","frm",r,r,r,"frm_mul"),jn(t,"g1m_batchApplyKey","g1m","frm",r*3,r*3,r,"g1m_timesFr"),jn(t,"g1m_batchApplyKeyMixed","g1m","frm",r*2,r*3,r,"g1m_timesFrAffine"),jn(t,"g2m_batchApplyKey","g2m","frm",r*2*3,r*3*2,r,"g2m_timesFr"),jn(t,"g2m_batchApplyKeyMixed","g2m","frm",r*2*2,r*3*2,r,"g2m_timesFrAffine");function H(P){return BigInt(P)*(1n<<BigInt(g*8))%o}const lt=[1n,2n,1n],O=t.alloc([...Pt.bigInt2BytesLE(H(lt[0]),g),...Pt.bigInt2BytesLE(H(lt[1]),g),...Pt.bigInt2BytesLE(H(lt[2]),g)]),h=[0n,1n,0n],A=t.alloc([...Pt.bigInt2BytesLE(H(h[0]),g),...Pt.bigInt2BytesLE(H(h[1]),g),...Pt.bigInt2BytesLE(H(h[2]),g)]),Z=[[10857046999023057135944570762232829481370756359578518086990519993285655852781n,11559732032986387107991004021392285783925812861821192530917403151452391805634n],[8495653923123431417604973247489272438418190587263600148770280649306958101930n,4082367875863433681332203403145435568316851327593401208105741076214120093531n],[1n,0n]],tt=t.alloc([...Pt.bigInt2BytesLE(H(Z[0][0]),g),...Pt.bigInt2BytesLE(H(Z[0][1]),g),...Pt.bigInt2BytesLE(H(Z[1][0]),g),...Pt.bigInt2BytesLE(H(Z[1][1]),g),...Pt.bigInt2BytesLE(H(Z[2][0]),g),...Pt.bigInt2BytesLE(H(Z[2][1]),g)]),at=[[0n,0n],[1n,0n],[0n,0n]],R=t.alloc([...Pt.bigInt2BytesLE(H(at[0][0]),g),...Pt.bigInt2BytesLE(H(at[0][1]),g),...Pt.bigInt2BytesLE(H(at[1][0]),g),...Pt.bigInt2BytesLE(H(at[1][1]),g),...Pt.bigInt2BytesLE(H(at[2][0]),g),...Pt.bigInt2BytesLE(H(at[2][1]),g)]),C=t.alloc([...Pt.bigInt2BytesLE(H(1),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g),...Pt.bigInt2BytesLE(H(0),g)]),T=t.alloc([...Pt.bigInt2BytesLE(H(9),g),...Pt.bigInt2BytesLE(H(1),g)]),V=t.alloc([...Pt.bigInt2BytesLE(H(wl(2n,o)),g),...Pt.bigInt2BytesLE(0n,g)]),ut=T,ct=t.alloc([...Pt.bigInt2BytesLE(H(19485874751759354771024239261021720505790618469301721065564631296452457478373n),g),...Pt.bigInt2BytesLE(H(266929791119991161246907387137283842545076965332900288569378510910307636690n),g)]);function J(){const P=t.addFunction(e+"_mulNR6");P.addParam("x","i32"),P.addParam("pr","i32");const d=P.getCodeBuilder();P.addCode(d.call(S+"_mul",d.i32_const(T),d.getLocal("x"),d.getLocal("pr")))}J();const gt=Il(t,e+"_mulNR6","f6m","f2m");function et(){const P=t.addFunction(e+"_mulNR12");P.addParam("x","i32"),P.addParam("pr","i32");const d=P.getCodeBuilder();P.addCode(d.call(S+"_mul",d.i32_const(T),d.i32_add(d.getLocal("x"),d.i32_const(r*4)),d.getLocal("pr")),d.call(S+"_copy",d.getLocal("x"),d.i32_add(d.getLocal("pr"),d.i32_const(r*2))),d.call(S+"_copy",d.i32_add(d.getLocal("x"),d.i32_const(r*2)),d.i32_add(d.getLocal("pr"),d.i32_const(r*4))))}et();const st=Ao(t,e+"_mulNR12","ftm",gt),Ut=nt(29793968203157093288n),mt=t.alloc(Ut),L=3*l,a=Ut.length-1,c=Ut.reduce((P,d)=>P+(d!=0?1:0),0)+a+1,E=6*r,m=3*r*2+c*L;t.modules[e]={n64:u,pG1gen:O,pG1zero:A,pG1b:k,pG2gen:tt,pG2zero:R,pG2b:G,pq:t.modules.f1m.pq,pr:F,pOneT:C,prePSize:E,preQSize:m,r:s.toString(),q:o.toString()};const _=4965661367192848881n;function Q(P){let d=P;const f=[];for(;d>0n;){if(Io(d)){const q=2-Number(d%4n);f.push(q),d=d-BigInt(q)}else f.push(0);d=d>>1n}return f}function nt(P){let d=P;const f=[];for(;d>0n;)Io(d)?f.push(1):f.push(0),d=d>>1n;return f}function X(){const P=t.addFunction(e+"_prepareG1");P.addParam("pP","i32"),P.addParam("ppreP","i32");const d=P.getCodeBuilder();P.addCode(d.call(z+"_normalize",d.getLocal("pP"),d.getLocal("ppreP")))}function ft(){const P=t.addFunction(e+"_prepAddStep");P.addParam("pQ","i32"),P.addParam("pR","i32"),P.addParam("pCoef","i32");const d=P.getCodeBuilder(),f=d.getLocal("pQ"),q=d.i32_add(d.getLocal("pQ"),d.i32_const(l)),N=d.getLocal("pR"),v=d.i32_add(d.getLocal("pR"),d.i32_const(l)),Y=d.i32_add(d.getLocal("pR"),d.i32_const(2*l)),K=d.getLocal("pCoef"),$=d.i32_add(d.getLocal("pCoef"),d.i32_const(l)),it=d.i32_add(d.getLocal("pCoef"),d.i32_const(2*l)),ot=$,W=d.i32_const(t.alloc(l)),dt=d.i32_const(t.alloc(l)),bt=d.i32_const(t.alloc(l)),yt=d.i32_const(t.alloc(l)),ht=d.i32_const(t.alloc(l)),Et=d.i32_const(t.alloc(l)),Ft=d.i32_const(t.alloc(l));P.addCode(d.call(S+"_mul",f,Y,ot),d.call(S+"_sub",N,ot,ot),d.call(S+"_mul",q,Y,W),d.call(S+"_sub",v,W,W),d.call(S+"_square",ot,dt),d.call(S+"_square",W,bt),d.call(S+"_mul",ot,dt,yt),d.call(S+"_mul",N,dt,ht),d.call(S+"_add",ht,ht,Ft),d.call(S+"_mul",Y,bt,Et),d.call(S+"_add",yt,Et,Et),d.call(S+"_sub",Et,Ft,Et),d.call(S+"_mul",ot,Et,N),d.call(S+"_mul",yt,v,v),d.call(S+"_sub",ht,Et,Ft),d.call(S+"_mul",W,Ft,Ft),d.call(S+"_sub",Ft,v,v),d.call(S+"_mul",Y,yt,Y),d.call(S+"_mul",ot,q,Ft),d.call(S+"_mul",W,f,K),d.call(S+"_sub",K,Ft,K),d.call(S+"_mul",K,d.i32_const(ut),K),d.call(S+"_neg",W,it))}function Bt(){const P=t.addFunction(e+"_prepDblStep");P.addParam("pR","i32"),P.addParam("pCoef","i32");const d=P.getCodeBuilder(),f=d.getLocal("pR"),q=d.i32_add(d.getLocal("pR"),d.i32_const(l)),N=d.i32_add(d.getLocal("pR"),d.i32_const(2*l)),v=d.getLocal("pCoef"),Y=d.i32_add(d.getLocal("pCoef"),d.i32_const(l)),K=d.i32_add(d.getLocal("pCoef"),d.i32_const(2*l)),$=d.i32_const(t.alloc(l)),it=d.i32_const(t.alloc(l)),ot=d.i32_const(t.alloc(l)),W=d.i32_const(t.alloc(l)),dt=d.i32_const(t.alloc(l)),bt=d.i32_const(t.alloc(l)),yt=d.i32_const(t.alloc(l)),ht=d.i32_const(t.alloc(l)),Et=d.i32_const(t.alloc(l)),Ft=d.i32_const(t.alloc(l)),qt=d.i32_const(t.alloc(l)),xt=d.i32_const(t.alloc(l));P.addCode(d.call(S+"_mul",q,d.i32_const(V),$),d.call(S+"_mul",f,$,$),d.call(S+"_square",q,it),d.call(S+"_square",N,ot),d.call(S+"_add",ot,ot,W),d.call(S+"_add",W,ot,W),d.call(S+"_mul",d.i32_const(ct),W,dt),d.call(S+"_add",dt,dt,bt),d.call(S+"_add",dt,bt,bt),d.call(S+"_add",it,bt,yt),d.call(S+"_mul",yt,d.i32_const(V),yt),d.call(S+"_add",it,ot,xt),d.call(S+"_add",q,N,ht),d.call(S+"_square",ht,ht),d.call(S+"_sub",ht,xt,ht),d.call(S+"_sub",dt,it,Et),d.call(S+"_square",f,Ft),d.call(S+"_square",dt,qt),d.call(S+"_sub",it,bt,xt),d.call(S+"_mul",$,xt,f),d.call(S+"_add",qt,qt,xt),d.call(S+"_add",qt,xt,xt),d.call(S+"_square",yt,q),d.call(S+"_sub",q,xt,q),d.call(S+"_mul",it,ht,N),d.call(S+"_mul",d.i32_const(ut),Et,v),d.call(S+"_neg",ht,Y),d.call(S+"_add",Ft,Ft,K),d.call(S+"_add",Ft,K,K))}function pt(){const P=t.addFunction(e+"_mulByQ");P.addParam("p1","i32"),P.addParam("pr","i32");const d=P.getCodeBuilder(),f=d.getLocal("p1"),q=d.i32_add(d.getLocal("p1"),d.i32_const(l)),N=d.i32_add(d.getLocal("p1"),d.i32_const(l*2)),v=d.getLocal("pr"),Y=d.i32_add(d.getLocal("pr"),d.i32_const(l)),K=d.i32_add(d.getLocal("pr"),d.i32_const(l*2)),$=d.i32_const(t.alloc([...Pt.bigInt2BytesLE(H("21575463638280843010398324269430826099269044274347216827212613867836435027261"),g),...Pt.bigInt2BytesLE(H("10307601595873709700152284273816112264069230130616436755625194854815875713954"),g)])),it=d.i32_const(t.alloc([...Pt.bigInt2BytesLE(H("2821565182194536844548159561693502659359617185244120367078079554186484126554"),g),...Pt.bigInt2BytesLE(H("3505843767911556378687030309984248845540243509899259641013678093033130930403"),g)]));P.addCode(d.call(S+"_conjugate",f,v),d.call(S+"_mul",$,v,v),d.call(S+"_conjugate",q,Y),d.call(S+"_mul",it,Y,Y),d.call(S+"_conjugate",N,K))}function wt(){pt();const P=t.addFunction(e+"_prepareG2");P.addParam("pQ","i32"),P.addParam("ppreQ","i32"),P.addLocal("pCoef","i32"),P.addLocal("i","i32");const d=P.getCodeBuilder(),f=d.getLocal("pQ"),q=t.alloc(l*3),N=d.i32_const(q),v=d.i32_const(q),Y=d.i32_const(q+l),K=d.i32_const(q+2*l),$=d.i32_add(d.getLocal("ppreQ"),d.i32_const(0)),it=d.i32_add(d.getLocal("ppreQ"),d.i32_const(l)),ot=t.alloc(l*3),W=d.i32_const(ot),dt=t.alloc(l*3),bt=d.i32_const(dt),yt=d.i32_const(dt+l);P.addCode(d.call(U+"_normalize",f,$),d.call(S+"_copy",$,v),d.call(S+"_copy",it,Y),d.call(S+"_one",K)),P.addCode(d.setLocal("pCoef",d.i32_add(d.getLocal("ppreQ"),d.i32_const(l*3))),d.setLocal("i",d.i32_const(Ut.length-2)),d.block(d.loop(d.call(e+"_prepDblStep",N,d.getLocal("pCoef")),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(L))),d.if(d.i32_load8_s(d.getLocal("i"),mt),[...d.call(e+"_prepAddStep",$,N,d.getLocal("pCoef")),...d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(L)))]),d.br_if(1,d.i32_eqz(d.getLocal("i"))),d.setLocal("i",d.i32_sub(d.getLocal("i"),d.i32_const(1))),d.br(0)))),P.addCode(d.call(e+"_mulByQ",$,W),d.call(e+"_mulByQ",W,bt)),P.addCode(d.call(S+"_neg",yt,yt),d.call(e+"_prepAddStep",W,N,d.getLocal("pCoef")),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(L))),d.call(e+"_prepAddStep",bt,N,d.getLocal("pCoef")),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(L))))}function Qt(){const P=t.addFunction(e+"__mulBy024Old");P.addParam("pEll0","i32"),P.addParam("pEllVW","i32"),P.addParam("pEllVV","i32"),P.addParam("pR","i32");const d=P.getCodeBuilder(),f=d.getLocal("pEll0"),q=d.getLocal("pEllVV"),N=d.getLocal("pEllVW"),v=d.getLocal("pR"),Y=t.alloc(x),K=d.i32_const(Y),$=d.i32_const(Y),it=d.i32_const(Y+l),ot=d.i32_const(Y+l*2),W=d.i32_const(Y+l*3),dt=d.i32_const(Y+l*4),bt=d.i32_const(Y+l*5);P.addCode(d.call(S+"_copy",f,$),d.call(S+"_zero",it),d.call(S+"_copy",q,ot),d.call(S+"_zero",W),d.call(S+"_copy",N,dt),d.call(S+"_zero",bt),d.call(st+"_mul",K,v,v))}function At(){const P=t.addFunction(e+"__mulBy024");P.addParam("pEll0","i32"),P.addParam("pEllVW","i32"),P.addParam("pEllVV","i32"),P.addParam("pR","i32");const d=P.getCodeBuilder(),f=d.getLocal("pEll0"),q=d.getLocal("pEllVV"),N=d.getLocal("pEllVW"),v=d.getLocal("pR"),Y=d.i32_add(d.getLocal("pR"),d.i32_const(2*r)),K=d.i32_add(d.getLocal("pR"),d.i32_const(4*r)),$=d.i32_add(d.getLocal("pR"),d.i32_const(6*r)),it=d.i32_add(d.getLocal("pR"),d.i32_const(8*r)),ot=d.i32_add(d.getLocal("pR"),d.i32_const(10*r)),W=d.i32_const(t.alloc(l)),dt=d.i32_const(t.alloc(l)),bt=d.i32_const(t.alloc(l)),yt=d.i32_const(t.alloc(l)),ht=d.i32_const(t.alloc(l)),Et=d.i32_const(t.alloc(l)),Ft=d.i32_const(t.alloc(l)),qt=d.i32_const(t.alloc(l)),xt=d.i32_const(t.alloc(l)),St=d.i32_const(t.alloc(l)),Ct=d.i32_const(t.alloc(l));P.addCode(d.call(S+"_mul",v,f,Ft),d.call(S+"_mul",K,q,qt),d.call(S+"_mul",it,N,xt),d.call(S+"_add",v,it,bt),d.call(S+"_add",v,K,dt),d.call(S+"_add",Y,$,yt),d.call(S+"_add",yt,ot,yt),d.call(S+"_mul",Y,q,St),d.call(S+"_add",St,xt,ht),d.call(S+"_mul",d.i32_const(T),ht,Et),d.call(S+"_add",Et,Ft,v),d.call(S+"_mul",ot,N,ht),d.call(S+"_add",St,ht,St),d.call(S+"_add",ht,qt,ht),d.call(S+"_mul",d.i32_const(T),ht,Et),d.call(S+"_mul",Y,f,ht),d.call(S+"_add",St,ht,St),d.call(S+"_add",Et,ht,Y),d.call(S+"_add",f,q,W),d.call(S+"_mul",dt,W,ht),d.call(S+"_add",Ft,qt,Ct),d.call(S+"_sub",ht,Ct,ht),d.call(S+"_mul",$,N,Et),d.call(S+"_add",St,Et,St),d.call(S+"_add",K,it,W),d.call(S+"_add",ht,Et,K),d.call(S+"_add",q,N,dt),d.call(S+"_mul",dt,W,ht),d.call(S+"_add",qt,xt,Ct),d.call(S+"_sub",ht,Ct,ht),d.call(S+"_mul",d.i32_const(T),ht,Et),d.call(S+"_mul",$,f,ht),d.call(S+"_add",St,ht,St),d.call(S+"_add",Et,ht,$),d.call(S+"_mul",ot,q,ht),d.call(S+"_add",St,ht,St),d.call(S+"_mul",d.i32_const(T),ht,Et),d.call(S+"_add",f,N,W),d.call(S+"_mul",bt,W,ht),d.call(S+"_add",Ft,xt,Ct),d.call(S+"_sub",ht,Ct,ht),d.call(S+"_add",Et,ht,it),d.call(S+"_add",f,q,W),d.call(S+"_add",W,N,W),d.call(S+"_mul",yt,W,ht),d.call(S+"_sub",ht,St,ot))}function _t(){const P=t.addFunction(e+"_millerLoop");P.addParam("ppreP","i32"),P.addParam("ppreQ","i32"),P.addParam("r","i32"),P.addLocal("pCoef","i32"),P.addLocal("i","i32");const d=P.getCodeBuilder(),f=d.getLocal("ppreP"),q=d.i32_add(d.getLocal("ppreP"),d.i32_const(g)),N=d.getLocal("pCoef"),v=d.i32_add(d.getLocal("pCoef"),d.i32_const(l)),Y=d.i32_add(d.getLocal("pCoef"),d.i32_const(2*l)),K=t.alloc(l),$=d.i32_const(K),it=t.alloc(l),ot=d.i32_const(it),W=d.getLocal("r");P.addCode(d.call(st+"_one",W),d.setLocal("pCoef",d.i32_add(d.getLocal("ppreQ"),d.i32_const(l*3))),d.setLocal("i",d.i32_const(Ut.length-2)),d.block(d.loop(d.call(st+"_square",W,W),d.call(S+"_mul1",v,q,$),d.call(S+"_mul1",Y,f,ot),d.call(e+"__mulBy024",N,$,ot,W),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(L))),d.if(d.i32_load8_s(d.getLocal("i"),mt),[...d.call(S+"_mul1",v,q,$),...d.call(S+"_mul1",Y,f,ot),...d.call(e+"__mulBy024",N,$,ot,W),...d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(L)))]),d.br_if(1,d.i32_eqz(d.getLocal("i"))),d.setLocal("i",d.i32_sub(d.getLocal("i"),d.i32_const(1))),d.br(0)))),P.addCode(d.call(S+"_mul1",v,q,$),d.call(S+"_mul1",Y,f,ot),d.call(e+"__mulBy024",N,$,ot,W),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(L))),d.call(S+"_mul1",v,q,$),d.call(S+"_mul1",Y,f,ot),d.call(e+"__mulBy024",N,$,ot,W),d.setLocal("pCoef",d.i32_add(d.getLocal("pCoef"),d.i32_const(L))))}function It(P){const d=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[8376118865763821496583973867626364092589906065868298776909617916018768340080n,16469823323077808223889137241176536799009286646108169935659301613961712198316n],[21888242871839275220042445260109153167277707414472061641714758635765020556617n,0n],[11697423496358154304825782922584725312912383441159505038794027105778954184319n,303847389135065887422783454877609941456349188919719272345083954437860409601n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3321304630594332808241809054958361220322477375291206261884409189760185844239n,5722266937896532885780051958958348231143373700109372999374820235121374419868n],[21888242871839275222246405745257275088696311157297823662689037894645226208582n,0n],[13512124006075453725662431877630910996106405091429524885779419978626457868503n,5418419548761466998357268504080738289687024511189653727029736280683514010267n],[2203960485148121921418603742825762020974279258880205651966n,0n],[10190819375481120917420622822672549775783927716138318623895010788866272024264n,21584395482704209334823622290379665147239961968378104390343953940207365798982n],[2203960485148121921418603742825762020974279258880205651967n,0n],[18566938241244942414004596690298913868373833782006617400804628704885040364344n,16165975933942742336466353786298926857552937457188450663314217659523851788715n]]],f=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[21575463638280843010398324269430826099269044274347216827212613867836435027261n,10307601595873709700152284273816112264069230130616436755625194854815875713954n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3772000881919853776433695186713858239009073593817195771773381919316419345261n,2236595495967245188281701248203181795121068902605861227855261137820944008926n],[2203960485148121921418603742825762020974279258880205651966n,0n],[18429021223477853657660792034369865839114504446431234726392080002137598044644n,9344045779998320333812420223237981029506012124075525679208581902008406485703n]],[[1n,0n],[2581911344467009335267311115468803099551665605076196740867805258568234346338n,19937756971775647987995932169929341994314640652964949448313374472400716661030n],[2203960485148121921418603742825762020974279258880205651966n,0n],[5324479202449903542726783395506214481928257762400643279780343368557297135718n,16208900380737693084919495127334387981393726419856888799917914180988844123039n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[13981852324922362344252311234282257507216387789820983642040889267519694726527n,7629828391165209371577384193250820201684255241773809077146787135900891633097n]]],q=t.addFunction(e+"__frobeniusMap"+P);q.addParam("x","i32"),q.addParam("r","i32");const N=q.getCodeBuilder();for(let Y=0;Y<6;Y++){const K=Y==0?N.getLocal("x"):N.i32_add(N.getLocal("x"),N.i32_const(Y*l)),$=K,it=N.i32_add(N.getLocal("x"),N.i32_const(Y*l+g)),ot=Y==0?N.getLocal("r"):N.i32_add(N.getLocal("r"),N.i32_const(Y*l)),W=ot,dt=N.i32_add(N.getLocal("r"),N.i32_const(Y*l+g)),bt=v(d[Math.floor(Y/3)][P%12],f[Y%3][P%6]),yt=t.alloc([...Pt.bigInt2BytesLE(H(bt[0]),32),...Pt.bigInt2BytesLE(H(bt[1]),32)]);P%2==1?q.addCode(N.call(I+"_copy",$,W),N.call(I+"_neg",it,dt),N.call(S+"_mul",ot,N.i32_const(yt),ot)):q.addCode(N.call(S+"_mul",K,N.i32_const(yt),ot))}function v(Y,K){const $=BigInt(Y[0]),it=BigInt(Y[1]),ot=BigInt(K[0]),W=BigInt(K[1]),dt=[($*ot-it*W)%o,($*W+it*ot)%o];return Bl(dt[0])&&(dt[0]=dt[0]+o),dt}}function vt(){const P=t.addFunction(e+"__finalExponentiationFirstChunk");P.addParam("x","i32"),P.addParam("r","i32");const d=P.getCodeBuilder(),f=d.getLocal("x"),q=f,N=d.i32_add(f,d.i32_const(r*6)),v=d.getLocal("r"),Y=t.alloc(x),K=d.i32_const(Y),$=K,it=d.i32_const(Y+r*6),ot=d.i32_const(t.alloc(x)),W=d.i32_const(t.alloc(x)),dt=d.i32_const(t.alloc(x));P.addCode(d.call(gt+"_copy",q,$),d.call(gt+"_neg",N,it),d.call(st+"_inverse",f,ot),d.call(st+"_mul",K,ot,W),d.call(e+"__frobeniusMap2",W,dt),d.call(st+"_mul",W,dt,v))}function zt(){const P=t.addFunction(e+"__cyclotomicSquare");P.addParam("x","i32"),P.addParam("r","i32");const d=P.getCodeBuilder(),f=d.getLocal("x"),q=d.i32_add(d.getLocal("x"),d.i32_const(l)),N=d.i32_add(d.getLocal("x"),d.i32_const(2*l)),v=d.i32_add(d.getLocal("x"),d.i32_const(3*l)),Y=d.i32_add(d.getLocal("x"),d.i32_const(4*l)),K=d.i32_add(d.getLocal("x"),d.i32_const(5*l)),$=d.getLocal("r"),it=d.i32_add(d.getLocal("r"),d.i32_const(l)),ot=d.i32_add(d.getLocal("r"),d.i32_const(2*l)),W=d.i32_add(d.getLocal("r"),d.i32_const(3*l)),dt=d.i32_add(d.getLocal("r"),d.i32_const(4*l)),bt=d.i32_add(d.getLocal("r"),d.i32_const(5*l)),yt=d.i32_const(t.alloc(l)),ht=d.i32_const(t.alloc(l)),Et=d.i32_const(t.alloc(l)),Ft=d.i32_const(t.alloc(l)),qt=d.i32_const(t.alloc(l)),xt=d.i32_const(t.alloc(l)),St=d.i32_const(t.alloc(l)),Ct=d.i32_const(t.alloc(l));P.addCode(d.call(S+"_mul",f,Y,St),d.call(S+"_mul",Y,d.i32_const(T),yt),d.call(S+"_add",f,yt,yt),d.call(S+"_add",f,Y,Ct),d.call(S+"_mul",Ct,yt,yt),d.call(S+"_mul",d.i32_const(T),St,Ct),d.call(S+"_add",St,Ct,Ct),d.call(S+"_sub",yt,Ct,yt),d.call(S+"_add",St,St,ht),d.call(S+"_mul",v,N,St),d.call(S+"_mul",N,d.i32_const(T),Et),d.call(S+"_add",v,Et,Et),d.call(S+"_add",v,N,Ct),d.call(S+"_mul",Ct,Et,Et),d.call(S+"_mul",d.i32_const(T),St,Ct),d.call(S+"_add",St,Ct,Ct),d.call(S+"_sub",Et,Ct,Et),d.call(S+"_add",St,St,Ft),d.call(S+"_mul",q,K,St),d.call(S+"_mul",K,d.i32_const(T),qt),d.call(S+"_add",q,qt,qt),d.call(S+"_add",q,K,Ct),d.call(S+"_mul",Ct,qt,qt),d.call(S+"_mul",d.i32_const(T),St,Ct),d.call(S+"_add",St,Ct,Ct),d.call(S+"_sub",qt,Ct,qt),d.call(S+"_add",St,St,xt),d.call(S+"_sub",yt,f,$),d.call(S+"_add",$,$,$),d.call(S+"_add",yt,$,$),d.call(S+"_add",ht,Y,dt),d.call(S+"_add",dt,dt,dt),d.call(S+"_add",ht,dt,dt),d.call(S+"_mul",xt,d.i32_const(ut),Ct),d.call(S+"_add",Ct,v,W),d.call(S+"_add",W,W,W),d.call(S+"_add",Ct,W,W),d.call(S+"_sub",qt,N,ot),d.call(S+"_add",ot,ot,ot),d.call(S+"_add",qt,ot,ot),d.call(S+"_sub",Et,q,it),d.call(S+"_add",it,it,it),d.call(S+"_add",Et,it,it),d.call(S+"_add",Ft,K,bt),d.call(S+"_add",bt,bt,bt),d.call(S+"_add",Ft,bt,bt))}function Gt(P,d){const f=Q(P).map(it=>it==-1?255:it),q=t.alloc(f),N=t.addFunction(e+"__cyclotomicExp_"+d);N.addParam("x","i32"),N.addParam("r","i32"),N.addLocal("bit","i32"),N.addLocal("i","i32");const v=N.getCodeBuilder(),Y=v.getLocal("x"),K=v.getLocal("r"),$=v.i32_const(t.alloc(x));N.addCode(v.call(st+"_conjugate",Y,$),v.call(st+"_one",K),v.if(v.teeLocal("bit",v.i32_load8_s(v.i32_const(f.length-1),q)),v.if(v.i32_eq(v.getLocal("bit"),v.i32_const(1)),v.call(st+"_mul",K,Y,K),v.call(st+"_mul",K,$,K))),v.setLocal("i",v.i32_const(f.length-2)),v.block(v.loop(v.call(e+"__cyclotomicSquare",K,K),v.if(v.teeLocal("bit",v.i32_load8_s(v.getLocal("i"),q)),v.if(v.i32_eq(v.getLocal("bit"),v.i32_const(1)),v.call(st+"_mul",K,Y,K),v.call(st+"_mul",K,$,K))),v.br_if(1,v.i32_eqz(v.getLocal("i"))),v.setLocal("i",v.i32_sub(v.getLocal("i"),v.i32_const(1))),v.br(0))))}function Kt(){zt(),Gt(_,"w0");const P=t.addFunction(e+"__finalExponentiationLastChunk");P.addParam("x","i32"),P.addParam("r","i32");const d=P.getCodeBuilder(),f=d.getLocal("x"),q=d.getLocal("r"),N=d.i32_const(t.alloc(x)),v=d.i32_const(t.alloc(x)),Y=d.i32_const(t.alloc(x)),K=d.i32_const(t.alloc(x)),$=d.i32_const(t.alloc(x)),it=d.i32_const(t.alloc(x)),ot=d.i32_const(t.alloc(x)),W=d.i32_const(t.alloc(x)),dt=d.i32_const(t.alloc(x)),bt=d.i32_const(t.alloc(x)),yt=d.i32_const(t.alloc(x)),ht=d.i32_const(t.alloc(x)),Et=d.i32_const(t.alloc(x)),Ft=d.i32_const(t.alloc(x)),qt=d.i32_const(t.alloc(x)),xt=d.i32_const(t.alloc(x)),St=d.i32_const(t.alloc(x)),Ct=d.i32_const(t.alloc(x)),kt=d.i32_const(t.alloc(x)),Xt=d.i32_const(t.alloc(x)),tn=d.i32_const(t.alloc(x));P.addCode(d.call(e+"__cyclotomicExp_w0",f,N),d.call(st+"_conjugate",N,N),d.call(e+"__cyclotomicSquare",N,v),d.call(e+"__cyclotomicSquare",v,Y),d.call(st+"_mul",Y,v,K),d.call(e+"__cyclotomicExp_w0",K,$),d.call(st+"_conjugate",$,$),d.call(e+"__cyclotomicSquare",$,it),d.call(e+"__cyclotomicExp_w0",it,ot),d.call(st+"_conjugate",ot,ot),d.call(st+"_conjugate",K,W),d.call(st+"_conjugate",ot,dt),d.call(st+"_mul",dt,$,bt),d.call(st+"_mul",bt,W,yt),d.call(st+"_mul",yt,v,ht),d.call(st+"_mul",yt,$,Et),d.call(st+"_mul",Et,f,Ft),d.call(e+"__frobeniusMap1",ht,qt),d.call(st+"_mul",qt,Ft,xt),d.call(e+"__frobeniusMap2",yt,St),d.call(st+"_mul",St,xt,Ct),d.call(st+"_conjugate",f,kt),d.call(st+"_mul",kt,ht,Xt),d.call(e+"__frobeniusMap3",Xt,tn),d.call(st+"_mul",tn,Ct,q))}function B(){vt(),Kt();const P=t.addFunction(e+"_finalExponentiation");P.addParam("x","i32"),P.addParam("r","i32");const d=P.getCodeBuilder(),f=d.getLocal("x"),q=d.getLocal("r"),N=d.i32_const(t.alloc(x));P.addCode(d.call(e+"__finalExponentiationFirstChunk",f,N),d.call(e+"__finalExponentiationLastChunk",N,q))}function p(){const P=t.addFunction(e+"_finalExponentiationOld");P.addParam("x","i32"),P.addParam("r","i32");const f=t.alloc(Pt.bigInt2BytesLE(552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n,352)),q=P.getCodeBuilder();P.addCode(q.call(st+"_exp",q.getLocal("x"),q.i32_const(f),q.i32_const(352),q.getLocal("r")))}const y=t.alloc(E),M=t.alloc(m);function D(P){const d=t.addFunction(e+"_pairingEq"+P);for(let v=0;v<P;v++)d.addParam("p_"+v,"i32"),d.addParam("q_"+v,"i32");d.addParam("c","i32"),d.setReturnType("i32");const f=d.getCodeBuilder(),q=f.i32_const(t.alloc(x)),N=f.i32_const(t.alloc(x));d.addCode(f.call(st+"_one",q));for(let v=0;v<P;v++)d.addCode(f.call(e+"_prepareG1",f.getLocal("p_"+v),f.i32_const(y))),d.addCode(f.call(e+"_prepareG2",f.getLocal("q_"+v),f.i32_const(M))),d.addCode(f.call(e+"_millerLoop",f.i32_const(y),f.i32_const(M),N)),d.addCode(f.call(st+"_mul",q,N,q));d.addCode(f.call(e+"_finalExponentiation",q,q)),d.addCode(f.call(st+"_eq",q,f.getLocal("c")))}function j(){const P=t.addFunction(e+"_pairing");P.addParam("p","i32"),P.addParam("q","i32"),P.addParam("r","i32");const d=P.getCodeBuilder(),f=d.i32_const(t.alloc(x));P.addCode(d.call(e+"_prepareG1",d.getLocal("p"),d.i32_const(y))),P.addCode(d.call(e+"_prepareG2",d.getLocal("q"),d.i32_const(M))),P.addCode(d.call(e+"_millerLoop",d.i32_const(y),d.i32_const(M),f)),P.addCode(d.call(e+"_finalExponentiation",f,d.getLocal("r")))}ft(),Bt(),X(),wt(),At(),Qt(),_t();for(let P=0;P<10;P++)It(P),t.exportFunction(e+"__frobeniusMap"+P);p(),B();for(let P=1;P<=5;P++)D(P),t.exportFunction(e+"_pairingEq"+P);j(),t.exportFunction(e+"_pairing"),t.exportFunction(e+"_prepareG1"),t.exportFunction(e+"_prepareG2"),t.exportFunction(e+"_millerLoop"),t.exportFunction(e+"_finalExponentiation"),t.exportFunction(e+"_finalExponentiationOld"),t.exportFunction(e+"__mulBy024"),t.exportFunction(e+"__mulBy024Old"),t.exportFunction(e+"__cyclotomicSquare"),t.exportFunction(e+"__cyclotomicExp_w0")};const Ot=Cn,xl=Hi,Fl=tc,bo=nc,Sl=ec,Co=ic,je=oc,Ul=ac,Ol=cc,Yn=sc,{bitLength:mo,isOdd:wo,isNegative:Ml}=Wt;var Pl=function(t,n){const e=n||"bls12381";if(t.modules[e])return e;const o=0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn,s=0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n,u=Math.floor((mo(o-1n)-1)/64)+1,r=u*8,b=r,g=b*2,l=b*12,x=Math.floor((mo(s-1n)-1)/64)+1,F=x*8,I=F,k=t.alloc(Ot.bigInt2BytesLE(s,I)),z=xl(t,o,"f1m","intq");Fl(t,s,"fr","frm","intr");const S=t.alloc(Ot.bigInt2BytesLE(O(4n),b)),G=Co(t,"g1m","f1m",S);je(t,"frm","frm","frm","frm_mul"),Ul(t,"pol","frm"),Ol(t,"qap","frm");const U=bo(t,"f1m_neg","f2m","f1m"),rt=t.alloc([...Ot.bigInt2BytesLE(O(4n),b),...Ot.bigInt2BytesLE(O(4n),b)]),H=Co(t,"g2m","f2m",rt);function lt(d,f){const q=t.addFunction(d);q.addParam("pG","i32"),q.addParam("pFr","i32"),q.addParam("pr","i32");const N=q.getCodeBuilder(),v=N.i32_const(t.alloc(F));q.addCode(N.call("frm_fromMontgomery",N.getLocal("pFr"),v),N.call(f,N.getLocal("pG"),v,N.i32_const(F),N.getLocal("pr"))),t.exportFunction(d)}lt("g1m_timesFr","g1m_timesScalar"),je(t,"g1m","g1m","frm","g1m_timesFr"),lt("g2m_timesFr","g2m_timesScalar"),je(t,"g2m","g2m","frm","g2m_timesFr"),lt("g1m_timesFrAffine","g1m_timesScalarAffine"),lt("g2m_timesFrAffine","g2m_timesScalarAffine"),Yn(t,"frm_batchApplyKey","fmr","frm",F,F,F,"frm_mul"),Yn(t,"g1m_batchApplyKey","g1m","frm",r*3,r*3,F,"g1m_timesFr"),Yn(t,"g1m_batchApplyKeyMixed","g1m","frm",r*2,r*3,F,"g1m_timesFrAffine"),Yn(t,"g2m_batchApplyKey","g2m","frm",r*2*3,r*3*2,F,"g2m_timesFr"),Yn(t,"g2m_batchApplyKeyMixed","g2m","frm",r*2*2,r*3*2,F,"g2m_timesFrAffine");function O(d){return BigInt(d)*(1n<<BigInt(b*8))%o}const h=[3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507n,1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569n,1n],A=t.alloc([...Ot.bigInt2BytesLE(O(h[0]),b),...Ot.bigInt2BytesLE(O(h[1]),b),...Ot.bigInt2BytesLE(O(h[2]),b)]),Z=[0n,1n,0n],tt=t.alloc([...Ot.bigInt2BytesLE(O(Z[0]),b),...Ot.bigInt2BytesLE(O(Z[1]),b),...Ot.bigInt2BytesLE(O(Z[2]),b)]),at=[[352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160n,3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758n],[1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905n,927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582n],[1n,0n]],R=t.alloc([...Ot.bigInt2BytesLE(O(at[0][0]),b),...Ot.bigInt2BytesLE(O(at[0][1]),b),...Ot.bigInt2BytesLE(O(at[1][0]),b),...Ot.bigInt2BytesLE(O(at[1][1]),b),...Ot.bigInt2BytesLE(O(at[2][0]),b),...Ot.bigInt2BytesLE(O(at[2][1]),b)]),C=[[0n,0n],[1n,0n],[0n,0n]],T=t.alloc([...Ot.bigInt2BytesLE(O(C[0][0]),b),...Ot.bigInt2BytesLE(O(C[0][1]),b),...Ot.bigInt2BytesLE(O(C[1][0]),b),...Ot.bigInt2BytesLE(O(C[1][1]),b),...Ot.bigInt2BytesLE(O(C[2][0]),b),...Ot.bigInt2BytesLE(O(C[2][1]),b)]),V=t.alloc([...Ot.bigInt2BytesLE(O(1n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b),...Ot.bigInt2BytesLE(O(0n),b)]),ut=t.alloc([...Ot.bigInt2BytesLE(O(1n),b),...Ot.bigInt2BytesLE(O(1n),b)]);function ct(){const d=t.addFunction(U+"_mulNR");d.addParam("x","i32"),d.addParam("pr","i32");const f=d.getCodeBuilder(),q=f.i32_const(t.alloc(b)),N=f.getLocal("x"),v=f.i32_add(f.getLocal("x"),f.i32_const(b)),Y=f.getLocal("pr"),K=f.i32_add(f.getLocal("pr"),f.i32_const(b));d.addCode(f.call(z+"_copy",N,q),f.call(z+"_sub",N,v,Y),f.call(z+"_add",q,v,K))}ct();const J=Sl(t,U+"_mulNR","f6m","f2m");function gt(){const d=t.addFunction(J+"_mulNR");d.addParam("x","i32"),d.addParam("pr","i32");const f=d.getCodeBuilder(),q=f.i32_const(t.alloc(b*2));d.addCode(f.call(U+"_copy",f.getLocal("x"),q),f.call(U+"_mulNR",f.i32_add(f.getLocal("x"),f.i32_const(r*4)),f.getLocal("pr")),f.call(U+"_copy",f.i32_add(f.getLocal("x"),f.i32_const(r*2)),f.i32_add(f.getLocal("pr"),f.i32_const(r*4))),f.call(U+"_copy",q,f.i32_add(f.getLocal("pr"),f.i32_const(r*2))))}gt();const et=bo(t,J+"_mulNR","ftm",J),Lt=nt(0xd201000000010000n),Ut=t.alloc(Lt),mt=3*g,L=Lt.length-1,w=Lt.reduce((d,f)=>d+(f!=0?1:0),0)+L+1,c=6*r,E=3*r*2+w*mt,m=!0,_=15132376222941642752n;t.modules[e]={n64q:u,n64r:x,n8q:r,n8r:F,pG1gen:A,pG1zero:tt,pG1b:S,pG2gen:R,pG2zero:T,pG2b:rt,pq:t.modules.f1m.pq,pr:k,pOneT:V,r:s,q:o,prePSize:c,preQSize:E};function Q(d){let f=d;const q=[];for(;f>0n;){if(wo(f)){const N=2-Number(f%4n);q.push(N),f=f-BigInt(N)}else q.push(0);f=f>>1n}return q}function nt(d){let f=d;const q=[];for(;f>0n;)wo(f)?q.push(1):q.push(0),f=f>>1n;return q}function X(){const d=t.addFunction(e+"_prepareG1");d.addParam("pP","i32"),d.addParam("ppreP","i32");const f=d.getCodeBuilder();d.addCode(f.call(G+"_normalize",f.getLocal("pP"),f.getLocal("ppreP")))}function ft(){const d=t.addFunction(e+"_prepDblStep");d.addParam("R","i32"),d.addParam("r","i32");const f=d.getCodeBuilder(),q=f.getLocal("R"),N=f.i32_add(f.getLocal("R"),f.i32_const(2*r)),v=f.i32_add(f.getLocal("R"),f.i32_const(4*r)),Y=f.getLocal("r"),K=f.i32_add(f.getLocal("r"),f.i32_const(2*r)),$=f.i32_add(f.getLocal("r"),f.i32_const(4*r)),it=f.i32_const(t.alloc(g)),ot=f.i32_const(t.alloc(g)),W=f.i32_const(t.alloc(g)),dt=f.i32_const(t.alloc(g)),bt=f.i32_const(t.alloc(g));d.addCode(f.call(U+"_square",q,Y),f.call(U+"_square",N,ot),f.call(U+"_square",ot,W),f.call(U+"_add",ot,q,K),f.call(U+"_square",K,K),f.call(U+"_sub",K,Y,K),f.call(U+"_sub",K,W,K),f.call(U+"_add",K,K,K),f.call(U+"_add",Y,Y,dt),f.call(U+"_add",dt,Y,dt),f.call(U+"_add",q,dt,$),f.call(U+"_square",dt,bt),f.call(U+"_square",v,it),f.call(U+"_sub",bt,K,q),f.call(U+"_sub",q,K,q),f.call(U+"_add",v,N,v),f.call(U+"_square",v,v),f.call(U+"_sub",v,ot,v),f.call(U+"_sub",v,it,v),f.call(U+"_sub",K,q,N),f.call(U+"_mul",N,dt,N),f.call(U+"_add",W,W,W),f.call(U+"_add",W,W,W),f.call(U+"_add",W,W,W),f.call(U+"_sub",N,W,N),f.call(U+"_mul",dt,it,K),f.call(U+"_add",K,K,K),f.call(U+"_neg",K,K),f.call(U+"_square",$,$),f.call(U+"_sub",$,Y,$),f.call(U+"_sub",$,bt,$),f.call(U+"_add",ot,ot,ot),f.call(U+"_add",ot,ot,ot),f.call(U+"_sub",$,ot,$),f.call(U+"_mul",v,it,Y),f.call(U+"_add",Y,Y,Y))}function Bt(){const d=t.addFunction(e+"_prepAddStep");d.addParam("R","i32"),d.addParam("Q","i32"),d.addParam("r","i32");const f=d.getCodeBuilder(),q=f.getLocal("R"),N=f.i32_add(f.getLocal("R"),f.i32_const(2*r)),v=f.i32_add(f.getLocal("R"),f.i32_const(4*r)),Y=f.getLocal("Q"),K=f.i32_add(f.getLocal("Q"),f.i32_const(2*r)),$=f.getLocal("r"),it=f.i32_add(f.getLocal("r"),f.i32_const(2*r)),ot=f.i32_add(f.getLocal("r"),f.i32_const(4*r)),W=f.i32_const(t.alloc(g)),dt=f.i32_const(t.alloc(g)),bt=f.i32_const(t.alloc(g)),yt=f.i32_const(t.alloc(g)),ht=f.i32_const(t.alloc(g)),Et=f.i32_const(t.alloc(g)),Ft=f.i32_const(t.alloc(g)),qt=f.i32_const(t.alloc(g)),xt=f.i32_const(t.alloc(g)),St=f.i32_const(t.alloc(g)),Ct=f.i32_const(t.alloc(g));d.addCode(f.call(U+"_square",v,W),f.call(U+"_square",K,dt),f.call(U+"_mul",W,Y,yt),f.call(U+"_add",K,v,it),f.call(U+"_square",it,it),f.call(U+"_sub",it,dt,it),f.call(U+"_sub",it,W,it),f.call(U+"_mul",it,W,it),f.call(U+"_sub",yt,q,ht),f.call(U+"_square",ht,Et),f.call(U+"_add",Et,Et,Ft),f.call(U+"_add",Ft,Ft,Ft),f.call(U+"_mul",Ft,ht,qt),f.call(U+"_sub",it,N,xt),f.call(U+"_sub",xt,N,xt),f.call(U+"_mul",xt,Y,ot),f.call(U+"_mul",Ft,q,St),f.call(U+"_square",xt,q),f.call(U+"_sub",q,qt,q),f.call(U+"_sub",q,St,q),f.call(U+"_sub",q,St,q),f.call(U+"_add",v,ht,v),f.call(U+"_square",v,v),f.call(U+"_sub",v,W,v),f.call(U+"_sub",v,Et,v),f.call(U+"_add",K,v,$),f.call(U+"_sub",St,q,Ct),f.call(U+"_mul",Ct,xt,Ct),f.call(U+"_mul",N,qt,yt),f.call(U+"_add",yt,yt,yt),f.call(U+"_sub",Ct,yt,N),f.call(U+"_square",$,$),f.call(U+"_sub",$,dt,$),f.call(U+"_square",v,bt),f.call(U+"_sub",$,bt,$),f.call(U+"_add",ot,ot,ot),f.call(U+"_sub",ot,$,ot),f.call(U+"_add",v,v,$),f.call(U+"_neg",xt,xt),f.call(U+"_add",xt,xt,it))}function pt(){const d=t.addFunction(e+"_prepareG2");d.addParam("pQ","i32"),d.addParam("ppreQ","i32"),d.addLocal("pCoef","i32"),d.addLocal("i","i32");const f=d.getCodeBuilder(),q=f.getLocal("pQ"),N=t.alloc(g*3),v=f.i32_const(N),Y=f.getLocal("ppreQ");d.addCode(f.call(H+"_normalize",q,Y),f.if(f.call(H+"_isZero",Y),f.ret([])),f.call(H+"_copy",Y,v),f.setLocal("pCoef",f.i32_add(f.getLocal("ppreQ"),f.i32_const(g*3)))),d.addCode(f.setLocal("i",f.i32_const(Lt.length-2)),f.block(f.loop(f.call(e+"_prepDblStep",v,f.getLocal("pCoef")),f.setLocal("pCoef",f.i32_add(f.getLocal("pCoef"),f.i32_const(mt))),f.if(f.i32_load8_s(f.getLocal("i"),Ut),[...f.call(e+"_prepAddStep",v,Y,f.getLocal("pCoef")),...f.setLocal("pCoef",f.i32_add(f.getLocal("pCoef"),f.i32_const(mt)))]),f.br_if(1,f.i32_eqz(f.getLocal("i"))),f.setLocal("i",f.i32_sub(f.getLocal("i"),f.i32_const(1))),f.br(0))))}function wt(){const d=t.addFunction(J+"_mul1");d.addParam("pA","i32"),d.addParam("pC1","i32"),d.addParam("pR","i32");const f=d.getCodeBuilder(),q=f.getLocal("pA"),N=f.i32_add(f.getLocal("pA"),f.i32_const(b*2)),v=f.i32_add(f.getLocal("pA"),f.i32_const(b*4)),Y=f.getLocal("pC1"),K=f.getLocal("pR"),$=f.i32_add(f.getLocal("pR"),f.i32_const(b*2)),it=f.i32_add(f.getLocal("pR"),f.i32_const(b*4)),ot=f.i32_const(t.alloc(b*2)),W=f.i32_const(t.alloc(b*2));d.addCode(f.call(U+"_add",q,N,ot),f.call(U+"_add",N,v,W),f.call(U+"_mul",N,Y,it),f.call(U+"_mul",W,Y,K),f.call(U+"_sub",K,it,K),f.call(U+"_mulNR",K,K),f.call(U+"_mul",ot,Y,$),f.call(U+"_sub",$,it,$))}wt();function Qt(){const d=t.addFunction(J+"_mul01");d.addParam("pA","i32"),d.addParam("pC0","i32"),d.addParam("pC1","i32"),d.addParam("pR","i32");const f=d.getCodeBuilder(),q=f.getLocal("pA"),N=f.i32_add(f.getLocal("pA"),f.i32_const(b*2)),v=f.i32_add(f.getLocal("pA"),f.i32_const(b*4)),Y=f.getLocal("pC0"),K=f.getLocal("pC1"),$=f.getLocal("pR"),it=f.i32_add(f.getLocal("pR"),f.i32_const(b*2)),ot=f.i32_add(f.getLocal("pR"),f.i32_const(b*4)),W=f.i32_const(t.alloc(b*2)),dt=f.i32_const(t.alloc(b*2)),bt=f.i32_const(t.alloc(b*2)),yt=f.i32_const(t.alloc(b*2));d.addCode(f.call(U+"_mul",q,Y,W),f.call(U+"_mul",N,K,dt),f.call(U+"_add",q,N,bt),f.call(U+"_add",q,v,yt),f.call(U+"_add",N,v,$),f.call(U+"_mul",$,K,$),f.call(U+"_sub",$,dt,$),f.call(U+"_mulNR",$,$),f.call(U+"_add",$,W,$),f.call(U+"_add",Y,K,it),f.call(U+"_mul",it,bt,it),f.call(U+"_sub",it,W,it),f.call(U+"_sub",it,dt,it),f.call(U+"_mul",yt,Y,ot),f.call(U+"_sub",ot,W,ot),f.call(U+"_add",ot,dt,ot))}Qt();function At(){const d=t.addFunction(et+"_mul014");d.addParam("pA","i32"),d.addParam("pC0","i32"),d.addParam("pC1","i32"),d.addParam("pC4","i32"),d.addParam("pR","i32");const f=d.getCodeBuilder(),q=f.getLocal("pA"),N=f.i32_add(f.getLocal("pA"),f.i32_const(b*6)),v=f.getLocal("pC0"),Y=f.getLocal("pC1"),K=f.getLocal("pC4"),$=f.i32_const(t.alloc(b*6)),it=f.i32_const(t.alloc(b*6)),ot=f.i32_const(t.alloc(b*2)),W=f.getLocal("pR"),dt=f.i32_add(f.getLocal("pR"),f.i32_const(b*6));d.addCode(f.call(J+"_mul01",q,v,Y,$),f.call(J+"_mul1",N,K,it),f.call(U+"_add",Y,K,ot),f.call(J+"_add",N,q,dt),f.call(J+"_mul01",dt,v,ot,dt),f.call(J+"_sub",dt,$,dt),f.call(J+"_sub",dt,it,dt),f.call(J+"_copy",it,W),f.call(J+"_mulNR",W,W),f.call(J+"_add",W,$,W))}At();function _t(){const d=t.addFunction(e+"_ell");d.addParam("pP","i32"),d.addParam("pCoefs","i32"),d.addParam("pF","i32");const f=d.getCodeBuilder(),q=f.getLocal("pP"),N=f.i32_add(f.getLocal("pP"),f.i32_const(r)),v=f.getLocal("pF"),Y=f.getLocal("pCoefs"),K=f.i32_add(f.getLocal("pCoefs"),f.i32_const(b)),$=f.i32_add(f.getLocal("pCoefs"),f.i32_const(b*2)),it=f.i32_add(f.getLocal("pCoefs"),f.i32_const(b*3)),ot=f.i32_add(f.getLocal("pCoefs"),f.i32_const(b*4)),W=t.alloc(b*2),dt=f.i32_const(W),bt=f.i32_const(W),yt=f.i32_const(W+b),ht=t.alloc(b*2),Et=f.i32_const(ht),Ft=f.i32_const(ht),qt=f.i32_const(ht+b);d.addCode(f.call(z+"_mul",Y,N,bt),f.call(z+"_mul",K,N,yt),f.call(z+"_mul",$,q,Ft),f.call(z+"_mul",it,q,qt),f.call(et+"_mul014",v,ot,Et,dt,v))}_t();function It(){const d=t.addFunction(e+"_millerLoop");d.addParam("ppreP","i32"),d.addParam("ppreQ","i32"),d.addParam("r","i32"),d.addLocal("pCoef","i32"),d.addLocal("i","i32");const f=d.getCodeBuilder(),q=f.getLocal("ppreP"),N=f.getLocal("pCoef"),v=f.getLocal("r");d.addCode(f.call(et+"_one",v),f.if(f.call(G+"_isZero",q),f.ret([])),f.if(f.call(G+"_isZero",f.getLocal("ppreQ")),f.ret([])),f.setLocal("pCoef",f.i32_add(f.getLocal("ppreQ"),f.i32_const(g*3))),f.setLocal("i",f.i32_const(Lt.length-2)),f.block(f.loop(f.call(e+"_ell",q,N,v),f.setLocal("pCoef",f.i32_add(f.getLocal("pCoef"),f.i32_const(mt))),f.if(f.i32_load8_s(f.getLocal("i"),Ut),[...f.call(e+"_ell",q,N,v),...f.setLocal("pCoef",f.i32_add(f.getLocal("pCoef"),f.i32_const(mt)))]),f.call(et+"_square",v,v),f.br_if(1,f.i32_eq(f.getLocal("i"),f.i32_const(1))),f.setLocal("i",f.i32_sub(f.getLocal("i"),f.i32_const(1))),f.br(0))),f.call(e+"_ell",q,N,v)),d.addCode(f.call(et+"_conjugate",v,v))}function vt(d){const f=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n,151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n],[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n,877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n,3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n,3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n]]],q=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[0n,4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[0n,1n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[0n,793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n]],[[1n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n]]],N=t.addFunction(et+"_frobeniusMap"+d);N.addParam("x","i32"),N.addParam("r","i32");const v=N.getCodeBuilder();for(let K=0;K<6;K++){const $=K==0?v.getLocal("x"):v.i32_add(v.getLocal("x"),v.i32_const(K*g)),it=$,ot=v.i32_add(v.getLocal("x"),v.i32_const(K*g+b)),W=K==0?v.getLocal("r"):v.i32_add(v.getLocal("r"),v.i32_const(K*g)),dt=W,bt=v.i32_add(v.getLocal("r"),v.i32_const(K*g+b)),yt=Y(f[Math.floor(K/3)][d%12],q[K%3][d%6]),ht=t.alloc([...Ot.bigInt2BytesLE(O(yt[0]),r),...Ot.bigInt2BytesLE(O(yt[1]),r)]);d%2==1?N.addCode(v.call(z+"_copy",it,dt),v.call(z+"_neg",ot,bt),v.call(U+"_mul",W,v.i32_const(ht),W)):N.addCode(v.call(U+"_mul",$,v.i32_const(ht),W))}function Y(K,$){const it=K[0],ot=K[1],W=$[0],dt=$[1],bt=[(it*W-ot*dt)%o,(it*dt+ot*W)%o];return Ml(bt[0])&&(bt[0]=bt[0]+o),bt}}function zt(){const d=t.addFunction(e+"__cyclotomicSquare");d.addParam("x","i32"),d.addParam("r","i32");const f=d.getCodeBuilder(),q=f.getLocal("x"),N=f.i32_add(f.getLocal("x"),f.i32_const(g)),v=f.i32_add(f.getLocal("x"),f.i32_const(2*g)),Y=f.i32_add(f.getLocal("x"),f.i32_const(3*g)),K=f.i32_add(f.getLocal("x"),f.i32_const(4*g)),$=f.i32_add(f.getLocal("x"),f.i32_const(5*g)),it=f.getLocal("r"),ot=f.i32_add(f.getLocal("r"),f.i32_const(g)),W=f.i32_add(f.getLocal("r"),f.i32_const(2*g)),dt=f.i32_add(f.getLocal("r"),f.i32_const(3*g)),bt=f.i32_add(f.getLocal("r"),f.i32_const(4*g)),yt=f.i32_add(f.getLocal("r"),f.i32_const(5*g)),ht=f.i32_const(t.alloc(g)),Et=f.i32_const(t.alloc(g)),Ft=f.i32_const(t.alloc(g)),qt=f.i32_const(t.alloc(g)),xt=f.i32_const(t.alloc(g)),St=f.i32_const(t.alloc(g)),Ct=f.i32_const(t.alloc(g)),kt=f.i32_const(t.alloc(g));d.addCode(f.call(U+"_mul",q,K,Ct),f.call(U+"_mulNR",K,ht),f.call(U+"_add",q,ht,ht),f.call(U+"_add",q,K,kt),f.call(U+"_mul",kt,ht,ht),f.call(U+"_mulNR",Ct,kt),f.call(U+"_add",Ct,kt,kt),f.call(U+"_sub",ht,kt,ht),f.call(U+"_add",Ct,Ct,Et),f.call(U+"_mul",Y,v,Ct),f.call(U+"_mulNR",v,Ft),f.call(U+"_add",Y,Ft,Ft),f.call(U+"_add",Y,v,kt),f.call(U+"_mul",kt,Ft,Ft),f.call(U+"_mulNR",Ct,kt),f.call(U+"_add",Ct,kt,kt),f.call(U+"_sub",Ft,kt,Ft),f.call(U+"_add",Ct,Ct,qt),f.call(U+"_mul",N,$,Ct),f.call(U+"_mulNR",$,xt),f.call(U+"_add",N,xt,xt),f.call(U+"_add",N,$,kt),f.call(U+"_mul",kt,xt,xt),f.call(U+"_mulNR",Ct,kt),f.call(U+"_add",Ct,kt,kt),f.call(U+"_sub",xt,kt,xt),f.call(U+"_add",Ct,Ct,St),f.call(U+"_sub",ht,q,it),f.call(U+"_add",it,it,it),f.call(U+"_add",ht,it,it),f.call(U+"_add",Et,K,bt),f.call(U+"_add",bt,bt,bt),f.call(U+"_add",Et,bt,bt),f.call(U+"_mul",St,f.i32_const(ut),kt),f.call(U+"_add",kt,Y,dt),f.call(U+"_add",dt,dt,dt),f.call(U+"_add",kt,dt,dt),f.call(U+"_sub",xt,v,W),f.call(U+"_add",W,W,W),f.call(U+"_add",xt,W,W),f.call(U+"_sub",Ft,N,ot),f.call(U+"_add",ot,ot,ot),f.call(U+"_add",Ft,ot,ot),f.call(U+"_add",qt,$,yt),f.call(U+"_add",yt,yt,yt),f.call(U+"_add",qt,yt,yt))}function Gt(d,f,q){const N=Q(d).map(W=>W==-1?255:W),v=t.alloc(N),Y=t.addFunction(e+"__cyclotomicExp_"+q);Y.addParam("x","i32"),Y.addParam("r","i32"),Y.addLocal("bit","i32"),Y.addLocal("i","i32");const K=Y.getCodeBuilder(),$=K.getLocal("x"),it=K.getLocal("r"),ot=K.i32_const(t.alloc(l));Y.addCode(K.call(et+"_conjugate",$,ot),K.call(et+"_one",it),K.if(K.teeLocal("bit",K.i32_load8_s(K.i32_const(N.length-1),v)),K.if(K.i32_eq(K.getLocal("bit"),K.i32_const(1)),K.call(et+"_mul",it,$,it),K.call(et+"_mul",it,ot,it))),K.setLocal("i",K.i32_const(N.length-2)),K.block(K.loop(K.call(e+"__cyclotomicSquare",it,it),K.if(K.teeLocal("bit",K.i32_load8_s(K.getLocal("i"),v)),K.if(K.i32_eq(K.getLocal("bit"),K.i32_const(1)),K.call(et+"_mul",it,$,it),K.call(et+"_mul",it,ot,it))),K.br_if(1,K.i32_eqz(K.getLocal("i"))),K.setLocal("i",K.i32_sub(K.getLocal("i"),K.i32_const(1))),K.br(0)))),Y.addCode(K.call(et+"_conjugate",it,it))}function Kt(){zt(),Gt(_,m,"w0");const d=t.addFunction(e+"_finalExponentiation");d.addParam("x","i32"),d.addParam("r","i32");const f=d.getCodeBuilder(),q=f.getLocal("x"),N=f.getLocal("r"),v=f.i32_const(t.alloc(l)),Y=f.i32_const(t.alloc(l)),K=f.i32_const(t.alloc(l)),$=f.i32_const(t.alloc(l)),it=f.i32_const(t.alloc(l)),ot=f.i32_const(t.alloc(l)),W=f.i32_const(t.alloc(l));d.addCode(f.call(et+"_frobeniusMap6",q,v),f.call(et+"_inverse",q,Y),f.call(et+"_mul",v,Y,K),f.call(et+"_copy",K,Y),f.call(et+"_frobeniusMap2",K,K),f.call(et+"_mul",K,Y,K),f.call(e+"__cyclotomicSquare",K,Y),f.call(et+"_conjugate",Y,Y),f.call(e+"__cyclotomicExp_w0",K,$),f.call(e+"__cyclotomicSquare",$,it),f.call(et+"_mul",Y,$,ot),f.call(e+"__cyclotomicExp_w0",ot,Y),f.call(e+"__cyclotomicExp_w0",Y,v),f.call(e+"__cyclotomicExp_w0",v,W),f.call(et+"_mul",W,it,W),f.call(e+"__cyclotomicExp_w0",W,it),f.call(et+"_conjugate",ot,ot),f.call(et+"_mul",it,ot,it),f.call(et+"_mul",it,K,it),f.call(et+"_conjugate",K,ot),f.call(et+"_mul",Y,K,Y),f.call(et+"_frobeniusMap3",Y,Y),f.call(et+"_mul",W,ot,W),f.call(et+"_frobeniusMap1",W,W),f.call(et+"_mul",$,v,$),f.call(et+"_frobeniusMap2",$,$),f.call(et+"_mul",$,Y,$),f.call(et+"_mul",$,W,$),f.call(et+"_mul",$,it,N))}function B(){const d=t.addFunction(e+"_finalExponentiationOld");d.addParam("x","i32"),d.addParam("r","i32");const q=t.alloc(Ot.bigInt2BytesLE(322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560n,544)),N=d.getCodeBuilder();d.addCode(N.call(et+"_exp",N.getLocal("x"),N.i32_const(q),N.i32_const(544),N.getLocal("r")))}const p=t.alloc(c),y=t.alloc(E);function M(d){const f=t.addFunction(e+"_pairingEq"+d);for(let Y=0;Y<d;Y++)f.addParam("p_"+Y,"i32"),f.addParam("q_"+Y,"i32");f.addParam("c","i32"),f.setReturnType("i32");const q=f.getCodeBuilder(),N=q.i32_const(t.alloc(l)),v=q.i32_const(t.alloc(l));f.addCode(q.call(et+"_one",N));for(let Y=0;Y<d;Y++)f.addCode(q.call(e+"_prepareG1",q.getLocal("p_"+Y),q.i32_const(p))),f.addCode(q.call(e+"_prepareG2",q.getLocal("q_"+Y),q.i32_const(y))),f.addCode(q.if(q.i32_eqz(q.call(G+"_inGroupAffine",q.i32_const(p))),q.ret(q.i32_const(0))),q.if(q.i32_eqz(q.call(H+"_inGroupAffine",q.i32_const(y))),q.ret(q.i32_const(0)))),f.addCode(q.call(e+"_millerLoop",q.i32_const(p),q.i32_const(y),v)),f.addCode(q.call(et+"_mul",N,v,N));f.addCode(q.call(e+"_finalExponentiation",N,N)),f.addCode(q.call(et+"_eq",N,q.getLocal("c")))}function D(){const d=t.addFunction(e+"_pairing");d.addParam("p","i32"),d.addParam("q","i32"),d.addParam("r","i32");const f=d.getCodeBuilder(),q=f.i32_const(t.alloc(l));d.addCode(f.call(e+"_prepareG1",f.getLocal("p"),f.i32_const(p))),d.addCode(f.call(e+"_prepareG2",f.getLocal("q"),f.i32_const(y))),d.addCode(f.call(e+"_millerLoop",f.i32_const(p),f.i32_const(y),q)),d.addCode(f.call(e+"_finalExponentiation",q,f.getLocal("r")))}function j(){const d=t.addFunction(H+"_inGroupAffine");d.addParam("p","i32"),d.setReturnType("i32");const f=d.getCodeBuilder(),q=[2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279894n,2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279893n],N=4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,v=[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],Y=f.i32_const(t.alloc([...Ot.bigInt2BytesLE(O(q[0]),r),...Ot.bigInt2BytesLE(O(q[1]),r)])),K=f.i32_const(t.alloc(Ot.bigInt2BytesLE(O(N),r))),$=f.i32_const(t.alloc([...Ot.bigInt2BytesLE(O(v[0]),r),...Ot.bigInt2BytesLE(O(v[1]),r)])),it=f.i32_const(t.alloc(Ot.bigInt2BytesLE(_,8))),ot=f.getLocal("p"),W=f.i32_add(f.getLocal("p"),f.i32_const(g)),dt=f.i32_const(t.alloc(b)),bt=f.i32_const(t.alloc(g)),yt=f.i32_const(t.alloc(g)),ht=t.alloc(g*2),Et=f.i32_const(ht),Ft=f.i32_const(ht),qt=f.i32_const(ht),xt=f.i32_const(ht+b),St=f.i32_const(ht+g),Ct=f.i32_const(ht+g),kt=f.i32_const(ht+g+b),Xt=t.alloc(g*3),tn=f.i32_const(Xt),Sn=f.i32_const(Xt),hn=f.i32_const(Xt),_n=f.i32_const(Xt+b),Un=f.i32_const(Xt+g),pn=f.i32_const(Xt+g),Ln=f.i32_const(Xt+g+b),On=f.i32_const(Xt+g*2);d.addCode(f.if(f.call(H+"_isZeroAffine",f.getLocal("p")),f.ret(f.i32_const(1))),f.if(f.i32_eqz(f.call(H+"_inCurveAffine",f.getLocal("p"))),f.ret(f.i32_const(0))),f.call(U+"_mul",ot,Y,bt),f.call(U+"_mul",W,Y,yt),f.call(U+"_mul1",bt,K,Ft),f.call(U+"_neg",yt,St),f.call(U+"_neg",bt,Sn),f.call(U+"_mul",yt,$,Un),f.call(z+"_sub",qt,xt,dt),f.call(z+"_add",qt,xt,xt),f.call(z+"_copy",dt,qt),f.call(z+"_sub",Ct,kt,dt),f.call(z+"_add",Ct,kt,kt),f.call(z+"_copy",dt,Ct),f.call(z+"_add",hn,_n,dt),f.call(z+"_sub",hn,_n,_n),f.call(z+"_copy",dt,hn),f.call(z+"_sub",Ln,pn,dt),f.call(z+"_add",pn,Ln,Ln),f.call(z+"_copy",dt,pn),f.call(U+"_one",On),f.call(H+"_timesScalar",tn,it,f.i32_const(8),tn),f.call(H+"_addMixed",tn,Et,tn),f.ret(f.call(H+"_eqMixed",tn,f.getLocal("p"))));const sn=t.addFunction(H+"_inGroup");sn.addParam("pIn","i32"),sn.setReturnType("i32");const an=sn.getCodeBuilder(),mn=an.i32_const(t.alloc(g*2));sn.addCode(an.call(H+"_toAffine",an.getLocal("pIn"),mn),an.ret(an.call(H+"_inGroupAffine",mn)))}function P(){const d=t.addFunction(G+"_inGroupAffine");d.addParam("p","i32"),d.setReturnType("i32");const f=d.getCodeBuilder(),q=4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,N=793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,v=(_*_-1n)/3n,Y=f.i32_const(t.alloc(Ot.bigInt2BytesLE(O(q),r))),K=f.i32_const(t.alloc(Ot.bigInt2BytesLE(O(N),r))),$=f.i32_const(t.alloc(Ot.bigInt2BytesLE(v,16))),it=f.getLocal("p"),ot=f.i32_add(f.getLocal("p"),f.i32_const(b)),W=t.alloc(b*3),dt=f.i32_const(W),bt=f.i32_const(W),yt=f.i32_const(W+b),ht=t.alloc(b*2),Et=f.i32_const(ht),Ft=f.i32_const(ht),qt=f.i32_const(ht+b);d.addCode(f.if(f.call(G+"_isZeroAffine",f.getLocal("p")),f.ret(f.i32_const(1))),f.if(f.i32_eqz(f.call(G+"_inCurveAffine",f.getLocal("p"))),f.ret(f.i32_const(0))),f.call(z+"_mul",it,Y,bt),f.call(z+"_copy",ot,yt),f.call(z+"_mul",it,K,Ft),f.call(z+"_copy",ot,qt),f.call(G+"_doubleAffine",dt,dt),f.call(G+"_subMixed",dt,f.getLocal("p"),dt),f.call(G+"_subMixed",dt,Et,dt),f.call(G+"_timesScalar",dt,$,f.i32_const(16),dt),f.ret(f.call(G+"_eqMixed",dt,Et)));const xt=t.addFunction(G+"_inGroup");xt.addParam("pIn","i32"),xt.setReturnType("i32");const St=xt.getCodeBuilder(),Ct=St.i32_const(t.alloc(b*2));xt.addCode(St.call(G+"_toAffine",St.getLocal("pIn"),Ct),St.ret(St.call(G+"_inGroupAffine",Ct)))}for(let d=0;d<10;d++)vt(d),t.exportFunction(et+"_frobeniusMap"+d);P(),j(),Bt(),ft(),X(),pt(),It(),B(),Kt();for(let d=1;d<=5;d++)M(d),t.exportFunction(e+"_pairingEq"+d);D(),t.exportFunction(e+"_pairing"),t.exportFunction(e+"_prepareG1"),t.exportFunction(e+"_prepareG2"),t.exportFunction(e+"_millerLoop"),t.exportFunction(e+"_finalExponentiation"),t.exportFunction(e+"_finalExponentiationOld"),t.exportFunction(e+"__cyclotomicSquare"),t.exportFunction(e+"__cyclotomicExp_w0"),t.exportFunction(J+"_mul1"),t.exportFunction(J+"_mul01"),t.exportFunction(et+"_mul014"),t.exportFunction(G+"_inGroupAffine"),t.exportFunction(G+"_inGroup"),t.exportFunction(H+"_inGroupAffine"),t.exportFunction(H+"_inGroup")},Ql=El,vl=Pl;function ri(i){if(typeof i=="bigint"||i.eq!==void 0)return i.toString(10);if(i instanceof Uint8Array)return ee(i,0);if(Array.isArray(i))return i.map(ri);if(typeof i=="object"){const t={};return Object.keys(i).forEach(e=>{t[e]=ri(i[e])}),t}else return i}function li(i){if(typeof i=="string"&&/^[0-9]+$/.test(i))return BigInt(i);if(typeof i=="string"&&/^0x[0-9a-fA-F]+$/.test(i))return BigInt(i);if(Array.isArray(i))return i.map(li);if(typeof i=="object"){if(i===null)return null;const t={};return Object.keys(i).forEach(e=>{t[e]=li(i[e])}),t}else return i}function ql(i){let t=BigInt(0),n=i.length,e=0;const o=new DataView(i.buffer,i.byteOffset,i.byteLength);for(;n>0;)n>=4?(n-=4,t+=BigInt(o.getUint32(n))<<BigInt(e*8),e+=4):n>=2?(n-=2,t+=BigInt(o.getUint16(n))<<BigInt(e*8),e+=2):(n-=1,t+=BigInt(o.getUint8(n))<<BigInt(e*8),e+=1);return t}function Tl(i,t){let n=i;const e=new Uint8Array(t),o=new DataView(e.buffer);let s=t;for(;s>0;)s-4>=0?(s-=4,o.setUint32(s,Number(n&BigInt(4294967295))),n=n>>BigInt(32)):s-2>=0?(s-=2,o.setUint16(s,Number(n&BigInt(65535))),n=n>>BigInt(16)):(s-=1,o.setUint8(s,Number(n&BigInt(255))),n=n>>BigInt(8));if(n)throw new Error("Number does not fit in this length");return e}function kl(i){let t=BigInt(0),n=0;const e=new DataView(i.buffer,i.byteOffset,i.byteLength);for(;n<i.length;)n+4<=i.length?(t+=BigInt(e.getUint32(n,!0))<<BigInt(n*8),n+=4):n+2<=i.length?(t+=BigInt(e.getUint16(n,!0))<<BigInt(n*8),n+=2):(t+=BigInt(e.getUint8(n,!0))<<BigInt(n*8),n+=1);return t}function rc(i,t){let n=i;typeof t>"u"&&(t=Math.floor((ae(i)-1)/8)+1,t==0&&(t=1));const e=new Uint8Array(t),o=new DataView(e.buffer);let s=0;for(;s<t;)s+4<=t?(o.setUint32(s,Number(n&BigInt(4294967295)),!0),s+=4,n=n>>BigInt(32)):s+2<=t?(o.setUint16(s,Number(n&BigInt(65535)),!0),s+=2,n=n>>BigInt(16)):(o.setUint8(s,Number(n&BigInt(255)),!0),s+=1,n=n>>BigInt(8));if(n)throw new Error("Number does not fit in this length");return e}function di(i,t){if(typeof t=="bigint"||t.eq!==void 0)return t.toString(10);if(t instanceof Uint8Array)return i.toString(i.e(t));if(Array.isArray(t))return t.map(di.bind(this,i));if(typeof t=="object"){const n={};return Object.keys(t).forEach(o=>{n[o]=di(i,t[o])}),n}else return t}function ui(i,t){if(typeof t=="string"&&/^[0-9]+$/.test(t))return i.e(t);if(typeof t=="string"&&/^0x[0-9a-fA-F]+$/.test(t))return i.e(t);if(Array.isArray(t))return t.map(ui.bind(this,i));if(typeof t=="object"){if(t===null)return null;const n={};return Object.keys(t).forEach(o=>{n[o]=ui(i,t[o])}),n}else return t}const Zn=[];for(let i=0;i<256;i++)Zn[i]=Dl(i,8);function Dl(i,t){let n=0,e=i;for(let o=0;o<t;o++)n<<=1,n=n|e&1,e>>=1;return n}function lc(i,t){return(Zn[i>>>24]|Zn[i>>>16&255]<<8|Zn[i>>>8&255]<<16|Zn[i&255]<<24)>>>32-t}function $t(i){return((i&4294901760)!==0?(i&=4294901760,16):0)|((i&4278255360)!==0?(i&=4278255360,8):0)|((i&4042322160)!==0?(i&=4042322160,4):0)|((i&3435973836)!==0?(i&=3435973836,2):0)|(i&2863311530)!==0}function dc(i,t){const n=i.byteLength/t,e=$t(n);if(n!=1<<e)throw new Error("Invalid number of pointers");for(let o=0;o<n;o++){const s=lc(o,e);if(o>s){const u=i.slice(o*t,(o+1)*t);i.set(i.slice(s*t,(s+1)*t),o*t),i.set(u,s*t)}}}function Vi(i,t){const n=new Uint8Array(t*i.length);for(let e=0;e<i.length;e++)n.set(i[e],e*t);return n}function Se(i,t){const n=i.byteLength/t,e=new Array(n);for(let o=0;o<n;o++)e[o]=i.slice(o*t,o*t+t);return e}var zl=Object.freeze({__proto__:null,array2buffer:Vi,beBuff2int:ql,beInt2Buff:Tl,bitReverse:lc,buffReverseBits:dc,buffer2array:Se,leBuff2int:kl,leInt2Buff:rc,log2:$t,stringifyBigInts:ri,stringifyFElements:di,unstringifyBigInts:li,unstringifyFElements:ui});const Yt=1<<30;class Dt{constructor(t){this.buffers=[],this.byteLength=t;for(let n=0;n<t;n+=Yt){const e=Math.min(t-n,Yt);this.buffers.push(new Uint8Array(e))}}slice(t,n){n===void 0&&(n=this.byteLength),t===void 0&&(t=0);const e=n-t,o=Math.floor(t/Yt),s=Math.floor((t+e-1)/Yt);if(o==s||e==0)return this.buffers[o].slice(t%Yt,t%Yt+e);let u,r=o,b=t%Yt,g=e;for(;g>0;){const l=b+g>Yt?Yt-b:g,x=new Uint8Array(this.buffers[r].buffer,this.buffers[r].byteOffset+b,l);if(l==e)return x.slice();u||(e<=Yt?u=new Uint8Array(e):u=new Dt(e)),u.set(x,e-g),g=g-l,r++,b=0}return u}set(t,n){n===void 0&&(n=0);const e=t.byteLength;if(e==0)return;const o=Math.floor(n/Yt),s=Math.floor((n+e-1)/Yt);if(o==s)return t instanceof Dt&&t.buffers.length==1?this.buffers[o].set(t.buffers[0],n%Yt):this.buffers[o].set(t,n%Yt);let u=o,r=n%Yt,b=e;for(;b>0;){const g=r+b>Yt?Yt-r:b,l=t.slice(e-b,e-b+g);new Uint8Array(this.buffers[u].buffer,this.buffers[u].byteOffset+r,g).set(l),b=b-g,u++,r=0}}}function bn(i,t,n,e){return async function(s){const u=Math.floor(s.byteLength/n);if(u*n!==s.byteLength)throw new Error("Invalid buffer size");const r=Math.floor(u/i.concurrency),b=[];for(let F=0;F<i.concurrency;F++){let I;if(F<i.concurrency-1?I=r:I=u-F*r,I==0)continue;const z=[{cmd:"ALLOCSET",var:0,buff:s.slice(F*r*n,F*r*n+I*n)},{cmd:"ALLOC",var:1,len:e*I},{cmd:"CALL",fnName:t,params:[{var:0},{val:I},{var:1}]},{cmd:"GET",out:0,var:1,len:e*I}];b.push(i.queueAction(z))}const g=await Promise.all(b);let l;s instanceof Dt?l=new Dt(u*e):l=new Uint8Array(u*e);let x=0;for(let F=0;F<g.length;F++)l.set(g[F][0],x),x+=g[F][0].byteLength;return l}}class Bo{constructor(t,n,e,o){if(this.tm=t,this.prefix=n,this.p=o,this.n8=e,this.type="F1",this.m=1,this.half=qn(o,En),this.bitLength=ae(o),this.mask=un(xe(En,this.bitLength),En),this.pOp1=t.alloc(e),this.pOp2=t.alloc(e),this.pOp3=t.alloc(e),this.tm.instance.exports[n+"_zero"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,this.n8),this.tm.instance.exports[n+"_one"](this.pOp1),this.one=this.tm.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.n64=Math.floor(e/8),this.n32=Math.floor(e/4),this.n64*8!=this.n8)throw new Error("n8 must be a multiple of 8");this.half=qn(this.p,En),this.nqr=this.two;let s=this.exp(this.nqr,this.half);for(;!this.eq(s,this.negone);)this.nqr=this.add(this.nqr,this.one),s=this.exp(this.nqr,this.half);this.shift=this.mul(this.nqr,this.nqr),this.shiftInv=this.inv(this.shift),this.s=0;let u=un(this.p,En);for(;!Ti(u);)this.s=this.s+1,u=qn(u,En);this.w=[],this.w[this.s]=this.exp(this.nqr,u);for(let r=this.s-1;r>=0;r--)this.w[r]=this.square(this.w[r+1]);if(!this.eq(this.w[0],this.one))throw new Error("Error calculating roots of unity");this.batchToMontgomery=bn(t,n+"_batchToMontgomery",this.n8,this.n8),this.batchFromMontgomery=bn(t,n+"_batchFromMontgomery",this.n8,this.n8)}op2(t,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,n){return this.tm.setBuff(this.pOp1,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,n){return this.op2("_add",t,n)}eq(t,n){return this.op2Bool("_eq",t,n)}isZero(t){return this.op1Bool("_isZero",t)}sub(t,n){return this.op2("_sub",t,n)}neg(t){return this.op1("_neg",t)}inv(t){return this.op1("_inverse",t)}toMontgomery(t){return this.op1("_toMontgomery",t)}fromMontgomery(t){return this.op1("_fromMontgomery",t)}mul(t,n){return this.op2("_mul",t,n)}div(t,n){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(t){return this.op1("_square",t)}isSquare(t){return this.op1Bool("_isSquare",t)}sqrt(t){return this.op1("_sqrt",t)}exp(t,n){return n instanceof Uint8Array||(n=kn(Ht(n))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,n.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}isNegative(t){return this.op1Bool("_isNegative",t)}e(t,n){if(t instanceof Uint8Array)return t;let e=Ht(t,n);qa(e)?(e=za(e),si(e,this.p)&&(e=cn(e,this.p)),e=un(this.p,e)):si(e,this.p)&&(e=cn(e,this.p));const o=rc(e,this.n8);return this.toMontgomery(o)}toString(t,n){const e=this.fromMontgomery(t),o=ee(e,0);return Ha(o,n)}fromRng(t){let n;const e=new Uint8Array(this.n8);do{n=Va;for(let o=0;o<this.n64;o++)n=ki(n,xe(t.nextU64(),64*o));n=Di(n,this.mask)}while(Ga(n,this.p));return ne(e,0,n,this.n8),e}random(){return this.fromRng(zi())}toObject(t){const n=this.fromMontgomery(t);return ee(n,0)}fromObject(t){const n=new Uint8Array(this.n8);return ne(n,0,t,this.n8),this.toMontgomery(n)}toRprLE(t,n,e){t.set(this.fromMontgomery(e),n)}toRprBE(t,n,e){const o=this.fromMontgomery(e);for(let s=0;s<this.n8/2;s++){const u=o[s];o[s]=o[this.n8-1-s],o[this.n8-1-s]=u}t.set(o,n)}fromRprLE(t,n){n=n||0;const e=t.slice(n,n+this.n8);return this.toMontgomery(e)}async batchInverse(t){let n=!1;const e=this.n8,o=this.n8;Array.isArray(t)?(t=Vi(t,e),n=!0):t=t.slice(0,t.byteLength);const s=Math.floor(t.byteLength/e);if(s*e!==t.byteLength)throw new Error("Invalid buffer size");const u=Math.floor(s/this.tm.concurrency),r=[];for(let x=0;x<this.tm.concurrency;x++){let F;if(x<this.tm.concurrency-1?F=u:F=s-x*u,F==0)continue;const k=[{cmd:"ALLOCSET",var:0,buff:t.slice(x*u*e,x*u*e+F*e)},{cmd:"ALLOC",var:1,len:o*F},{cmd:"CALL",fnName:this.prefix+"_batchInverse",params:[{var:0},{val:e},{val:F},{var:1},{val:o}]},{cmd:"GET",out:0,var:1,len:o*F}];r.push(this.tm.queueAction(k))}const b=await Promise.all(r);let g;t instanceof Dt?g=new Dt(s*o):g=new Uint8Array(s*o);let l=0;for(let x=0;x<b.length;x++)g.set(b[x][0],l),l+=b[x][0].byteLength;return n?Se(g,o):g}}class Eo{constructor(t,n,e){this.tm=t,this.prefix=n,this.F=e,this.type="F2",this.m=e.m*2,this.n8=this.F.n8*2,this.n32=this.F.n32*2,this.n64=this.F.n64*2,this.pOp1=t.alloc(e.n8*2),this.pOp2=t.alloc(e.n8*2),this.pOp3=t.alloc(e.n8*2),this.tm.instance.exports[n+"_zero"](this.pOp1),this.zero=t.getBuff(this.pOp1,this.n8),this.tm.instance.exports[n+"_one"](this.pOp1),this.one=t.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(t,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,n){return this.tm.setBuff(this.pOp1,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,n){return this.op2("_add",t,n)}eq(t,n){return this.op2Bool("_eq",t,n)}isZero(t){return this.op1Bool("_isZero",t)}sub(t,n){return this.op2("_sub",t,n)}neg(t){return this.op1("_neg",t)}inv(t){return this.op1("_inverse",t)}isNegative(t){return this.op1Bool("_isNegative",t)}toMontgomery(t){return this.op1("_toMontgomery",t)}fromMontgomery(t){return this.op1("_fromMontgomery",t)}mul(t,n){return this.op2("_mul",t,n)}mul1(t,n){return this.op2("_mul1",t,n)}div(t,n){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(t){return this.op1("_square",t)}isSquare(t){return this.op1Bool("_isSquare",t)}sqrt(t){return this.op1("_sqrt",t)}exp(t,n){return n instanceof Uint8Array||(n=kn(Ht(n))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,n.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}e(t,n){if(t instanceof Uint8Array)return t;if(Array.isArray(t)&&t.length==2){const e=this.F.e(t[0],n),o=this.F.e(t[1],n),s=new Uint8Array(this.F.n8*2);return s.set(e),s.set(o,this.F.n8*2),s}else throw new Error("invalid F2")}toString(t,n){const e=this.F.toString(t.slice(0,this.F.n8),n),o=this.F.toString(t.slice(this.F.n8),n);return`[${e}, ${o}]`}fromRng(t){const n=this.F.fromRng(t),e=this.F.fromRng(t),o=new Uint8Array(this.F.n8*2);return o.set(n),o.set(e,this.F.n8),o}random(){return this.fromRng(zi())}toObject(t){const n=this.F.toObject(t.slice(0,this.F.n8)),e=this.F.toObject(t.slice(this.F.n8,this.F.n8*2));return[n,e]}fromObject(t){const n=new Uint8Array(this.F.n8*2),e=this.F.fromObject(t[0]),o=this.F.fromObject(t[1]);return n.set(e),n.set(o,this.F.n8),n}c1(t){return t.slice(0,this.F.n8)}c2(t){return t.slice(this.F.n8)}}class Rl{constructor(t,n,e){this.tm=t,this.prefix=n,this.F=e,this.type="F3",this.m=e.m*3,this.n8=this.F.n8*3,this.n32=this.F.n32*3,this.n64=this.F.n64*3,this.pOp1=t.alloc(e.n8*3),this.pOp2=t.alloc(e.n8*3),this.pOp3=t.alloc(e.n8*3),this.tm.instance.exports[n+"_zero"](this.pOp1),this.zero=t.getBuff(this.pOp1,this.n8),this.tm.instance.exports[n+"_one"](this.pOp1),this.one=t.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(t,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,n){return this.tm.setBuff(this.pOp1,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}eq(t,n){return this.op2Bool("_eq",t,n)}isZero(t){return this.op1Bool("_isZero",t)}add(t,n){return this.op2("_add",t,n)}sub(t,n){return this.op2("_sub",t,n)}neg(t){return this.op1("_neg",t)}inv(t){return this.op1("_inverse",t)}isNegative(t){return this.op1Bool("_isNegative",t)}toMontgomery(t){return this.op1("_toMontgomery",t)}fromMontgomery(t){return this.op1("_fromMontgomery",t)}mul(t,n){return this.op2("_mul",t,n)}div(t,n){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(t){return this.op1("_square",t)}isSquare(t){return this.op1Bool("_isSquare",t)}sqrt(t){return this.op1("_sqrt",t)}exp(t,n){return n instanceof Uint8Array||(n=kn(Ht(n))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,n.byteLength,this.pOp3),this.getBuff(this.pOp3,this.n8)}e(t,n){if(t instanceof Uint8Array)return t;if(Array.isArray(t)&&t.length==3){const e=this.F.e(t[0],n),o=this.F.e(t[1],n),s=this.F.e(t[2],n),u=new Uint8Array(this.F.n8*3);return u.set(e),u.set(o,this.F.n8),u.set(s,this.F.n8*2),u}else throw new Error("invalid F3")}toString(t,n){const e=this.F.toString(t.slice(0,this.F.n8),n),o=this.F.toString(t.slice(this.F.n8,this.F.n8*2),n),s=this.F.toString(t.slice(this.F.n8*2),n);return`[${e}, ${o}, ${s}]`}fromRng(t){const n=this.F.fromRng(t),e=this.F.fromRng(t),o=this.F.fromRng(t),s=new Uint8Array(this.F.n8*3);return s.set(n),s.set(e,this.F.n8),s.set(o,this.F.n8*2),s}random(){return this.fromRng(zi())}toObject(t){const n=this.F.toObject(t.slice(0,this.F.n8)),e=this.F.toObject(t.slice(this.F.n8,this.F.n8*2)),o=this.F.toObject(t.slice(this.F.n8*2,this.F.n8*3));return[n,e,o]}fromObject(t){const n=new Uint8Array(this.F.n8*3),e=this.F.fromObject(t[0]),o=this.F.fromObject(t[1]),s=this.F.fromObject(t[2]);return n.set(e),n.set(o,this.F.n8),n.set(s,this.F.n8*2),n}c1(t){return t.slice(0,this.F.n8)}c2(t){return t.slice(this.F.n8,this.F.n8*2)}c3(t){return t.slice(this.F.n8*2)}}class xo{constructor(t,n,e,o,s,u){this.tm=t,this.prefix=n,this.F=e,this.pOp1=t.alloc(e.n8*3),this.pOp2=t.alloc(e.n8*3),this.pOp3=t.alloc(e.n8*3),this.tm.instance.exports[n+"_zero"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,e.n8*3),this.tm.instance.exports[n+"_zeroAffine"](this.pOp1),this.zeroAffine=this.tm.getBuff(this.pOp1,e.n8*2),this.one=this.tm.getBuff(o,e.n8*3),this.g=this.one,this.oneAffine=this.tm.getBuff(o,e.n8*2),this.gAffine=this.oneAffine,this.b=this.tm.getBuff(s,e.n8),u&&(this.cofactor=kn(u)),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.batchLEMtoC=bn(t,n+"_batchLEMtoC",e.n8*2,e.n8),this.batchLEMtoU=bn(t,n+"_batchLEMtoU",e.n8*2,e.n8*2),this.batchCtoLEM=bn(t,n+"_batchCtoLEM",e.n8,e.n8*2),this.batchUtoLEM=bn(t,n+"_batchUtoLEM",e.n8*2,e.n8*2),this.batchToJacobian=bn(t,n+"_batchToJacobian",e.n8*2,e.n8*3),this.batchToAffine=bn(t,n+"_batchToAffine",e.n8*3,e.n8*2)}op2(t,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}op2bool(t,n,e){return this.tm.setBuff(this.pOp1,n),this.tm.setBuff(this.pOp2,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3)}op1(t,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}op1Affine(t,n){return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*2)}op1Bool(t,n){return this.tm.setBuff(this.pOp1,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,n){if(t.byteLength==this.F.n8*3){if(n.byteLength==this.F.n8*3)return this.op2("_add",t,n);if(n.byteLength==this.F.n8*2)return this.op2("_addMixed",t,n);throw new Error("invalid point size")}else if(t.byteLength==this.F.n8*2){if(n.byteLength==this.F.n8*3)return this.op2("_addMixed",n,t);if(n.byteLength==this.F.n8*2)return this.op2("_addAffine",t,n);throw new Error("invalid point size")}else throw new Error("invalid point size")}sub(t,n){if(t.byteLength==this.F.n8*3){if(n.byteLength==this.F.n8*3)return this.op2("_sub",t,n);if(n.byteLength==this.F.n8*2)return this.op2("_subMixed",t,n);throw new Error("invalid point size")}else if(t.byteLength==this.F.n8*2){if(n.byteLength==this.F.n8*3)return this.op2("_subMixed",n,t);if(n.byteLength==this.F.n8*2)return this.op2("_subAffine",t,n);throw new Error("invalid point size")}else throw new Error("invalid point size")}neg(t){if(t.byteLength==this.F.n8*3)return this.op1("_neg",t);if(t.byteLength==this.F.n8*2)return this.op1Affine("_negAffine",t);throw new Error("invalid point size")}double(t){if(t.byteLength==this.F.n8*3)return this.op1("_double",t);if(t.byteLength==this.F.n8*2)return this.op1("_doubleAffine",t);throw new Error("invalid point size")}isZero(t){if(t.byteLength==this.F.n8*3)return this.op1Bool("_isZero",t);if(t.byteLength==this.F.n8*2)return this.op1Bool("_isZeroAffine",t);throw new Error("invalid point size")}timesScalar(t,n){n instanceof Uint8Array||(n=kn(Ht(n)));let e;if(t.byteLength==this.F.n8*3)e=this.prefix+"_timesScalar";else if(t.byteLength==this.F.n8*2)e=this.prefix+"_timesScalarAffine";else throw new Error("invalid point size");return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[e](this.pOp1,this.pOp2,n.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}timesFr(t,n){let e;if(t.byteLength==this.F.n8*3)e=this.prefix+"_timesFr";else if(t.byteLength==this.F.n8*2)e=this.prefix+"_timesFrAffine";else throw new Error("invalid point size");return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[e](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}eq(t,n){if(t.byteLength==this.F.n8*3){if(n.byteLength==this.F.n8*3)return this.op2bool("_eq",t,n);if(n.byteLength==this.F.n8*2)return this.op2bool("_eqMixed",t,n);throw new Error("invalid point size")}else if(t.byteLength==this.F.n8*2){if(n.byteLength==this.F.n8*3)return this.op2bool("_eqMixed",n,t);if(n.byteLength==this.F.n8*2)return this.op2bool("_eqAffine",t,n);throw new Error("invalid point size")}else throw new Error("invalid point size")}toAffine(t){if(t.byteLength==this.F.n8*3)return this.op1Affine("_toAffine",t);if(t.byteLength==this.F.n8*2)return t;throw new Error("invalid point size")}toJacobian(t){if(t.byteLength==this.F.n8*3)return t;if(t.byteLength==this.F.n8*2)return this.op1("_toJacobian",t);throw new Error("invalid point size")}toRprUncompressed(t,n,e){if(this.tm.setBuff(this.pOp1,e),e.byteLength==this.F.n8*3)this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);else if(e.byteLength!=this.F.n8*2)throw new Error("invalid point size");this.tm.instance.exports[this.prefix+"_LEMtoU"](this.pOp1,this.pOp1);const o=this.tm.getBuff(this.pOp1,this.F.n8*2);t.set(o,n)}fromRprUncompressed(t,n){const e=t.slice(n,n+this.F.n8*2);return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+"_UtoLEM"](this.pOp1,this.pOp1),this.tm.getBuff(this.pOp1,this.F.n8*2)}toRprCompressed(t,n,e){if(this.tm.setBuff(this.pOp1,e),e.byteLength==this.F.n8*3)this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);else if(e.byteLength!=this.F.n8*2)throw new Error("invalid point size");this.tm.instance.exports[this.prefix+"_LEMtoC"](this.pOp1,this.pOp1);const o=this.tm.getBuff(this.pOp1,this.F.n8);t.set(o,n)}fromRprCompressed(t,n){const e=t.slice(n,n+this.F.n8);return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+"_CtoLEM"](this.pOp1,this.pOp2),this.tm.getBuff(this.pOp2,this.F.n8*2)}toUncompressed(t){const n=new Uint8Array(this.F.n8*2);return this.toRprUncompressed(n,0,t),n}toRprLEM(t,n,e){if(e.byteLength==this.F.n8*2){t.set(e,n);return}else if(e.byteLength==this.F.n8*3){this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);const o=this.tm.getBuff(this.pOp1,this.F.n8*2);t.set(o,n)}else throw new Error("invalid point size")}fromRprLEM(t,n){return n=n||0,t.slice(n,n+this.F.n8*2)}toString(t,n){if(t.byteLength==this.F.n8*3){const e=this.F.toString(t.slice(0,this.F.n8),n),o=this.F.toString(t.slice(this.F.n8,this.F.n8*2),n),s=this.F.toString(t.slice(this.F.n8*2),n);return`[ ${e}, ${o}, ${s} ]`}else if(t.byteLength==this.F.n8*2){const e=this.F.toString(t.slice(0,this.F.n8),n),o=this.F.toString(t.slice(this.F.n8),n);return`[ ${e}, ${o} ]`}else throw new Error("invalid point size")}isValid(t){if(this.isZero(t))return!0;const n=this.F,e=this.toAffine(t),o=e.slice(0,this.F.n8),s=e.slice(this.F.n8,this.F.n8*2),u=n.add(n.mul(n.square(o),o),this.b),r=n.square(s);return n.eq(u,r)}fromRng(t){const n=this.F;let e=[],o,s;do e[0]=n.fromRng(t),o=t.nextBool(),s=n.add(n.mul(n.square(e[0]),e[0]),this.b);while(!n.isSquare(s));e[1]=n.sqrt(s);const u=n.isNegative(e[1]);o^u&&(e[1]=n.neg(e[1]));let r=new Uint8Array(this.F.n8*2);return r.set(e[0]),r.set(e[1],this.F.n8),this.cofactor&&(r=this.timesScalar(r,this.cofactor)),r}toObject(t){if(this.isZero(t))return[this.F.toObject(this.F.zero),this.F.toObject(this.F.one),this.F.toObject(this.F.zero)];const n=this.F.toObject(t.slice(0,this.F.n8)),e=this.F.toObject(t.slice(this.F.n8,this.F.n8*2));let o;return t.byteLength==this.F.n8*3?o=this.F.toObject(t.slice(this.F.n8*2,this.F.n8*3)):o=this.F.toObject(this.F.one),[n,e,o]}fromObject(t){const n=this.F.fromObject(t[0]),e=this.F.fromObject(t[1]);let o;if(t.length==3?o=this.F.fromObject(t[2]):o=this.F.one,this.F.isZero(o,this.F.one))return this.zeroAffine;if(this.F.eq(o,this.F.one)){const s=new Uint8Array(this.F.n8*2);return s.set(n),s.set(e,this.F.n8),s}else{const s=new Uint8Array(this.F.n8*3);return s.set(n),s.set(e,this.F.n8),s.set(o,this.F.n8*2),s}}e(t){return t instanceof Uint8Array?t:this.fromObject(t)}x(t){return this.toAffine(t).slice(0,this.F.n8)}y(t){return this.toAffine(t).slice(this.F.n8)}}function Gl(i){let n,e;async function o(l){const x=new Uint8Array(l.code),F=await WebAssembly.compile(x);e=new WebAssembly.Memory({initial:l.init,maximum:32767}),n=await WebAssembly.instantiate(F,{env:{memory:e}})}function s(l){const x=new Uint32Array(e.buffer,0,1);for(;x[0]&3;)x[0]++;const F=x[0];if(x[0]+=l,x[0]+l>e.buffer.byteLength){const I=e.buffer.byteLength/65536;let k=Math.floor((x[0]+l)/65536)+1;k>32767&&(k=32767),e.grow(k-I)}return F}function u(l){const x=s(l.byteLength);return b(x,l),x}function r(l,x){const F=new Uint8Array(e.buffer);return new Uint8Array(F.buffer,F.byteOffset+l,x)}function b(l,x){new Uint8Array(e.buffer).set(new Uint8Array(x),l)}function g(l){if(l[0].cmd=="INIT")return o(l[0]);const x={vars:[],out:[]},I=new Uint32Array(e.buffer,0,1)[0];for(let z=0;z<l.length;z++)switch(l[z].cmd){case"ALLOCSET":x.vars[l[z].var]=u(l[z].buff);break;case"ALLOC":x.vars[l[z].var]=s(l[z].len);break;case"SET":b(x.vars[l[z].var],l[z].buff);break;case"CALL":{const S=[];for(let G=0;G<l[z].params.length;G++){const U=l[z].params[G];typeof U.var<"u"?S.push(x.vars[U.var]+(U.offset||0)):typeof U.val<"u"&&S.push(U.val)}n.exports[l[z].fnName](...S);break}case"GET":x.out[l[z].out]=r(x.vars[l[z].var],l[z].len).slice();break;default:throw new Error("Invalid cmd")}const k=new Uint32Array(e.buffer,0,1);return k[0]=I,x.out}return g}const Ye=25;class Fo{constructor(){this.promise=new Promise((t,n)=>{this.reject=n,this.resolve=t})}}function Nl(i){return new Promise(t=>setTimeout(t,i))}let fi;const So=`(function thread(self) {
2
- const MAXMEM = 32767;
3
- let instance;
4
- let memory;
5
-
6
- if (self) {
7
- self.onmessage = function(e) {
8
- let data;
9
- if (e.data) {
10
- data = e.data;
11
- } else {
12
- data = e;
13
- }
14
-
15
- if (data[0].cmd == "INIT") {
16
- init(data[0]).then(function() {
17
- self.postMessage(data.result);
18
- });
19
- } else if (data[0].cmd == "TERMINATE") {
20
- self.close();
21
- } else {
22
- const res = runTask(data);
23
- self.postMessage(res);
24
- }
25
- };
26
- }
27
-
28
- async function init(data) {
29
- const code = new Uint8Array(data.code);
30
- const wasmModule = await WebAssembly.compile(code);
31
- memory = new WebAssembly.Memory({initial:data.init, maximum: MAXMEM});
32
-
33
- instance = await WebAssembly.instantiate(wasmModule, {
34
- env: {
35
- "memory": memory
36
- }
37
- });
38
- }
39
-
40
-
41
-
42
- function alloc(length) {
43
- const u32 = new Uint32Array(memory.buffer, 0, 1);
44
- while (u32[0] & 3) u32[0]++; // Return always aligned pointers
45
- const res = u32[0];
46
- u32[0] += length;
47
- if (u32[0] + length > memory.buffer.byteLength) {
48
- const currentPages = memory.buffer.byteLength / 0x10000;
49
- let requiredPages = Math.floor((u32[0] + length) / 0x10000)+1;
50
- if (requiredPages>MAXMEM) requiredPages=MAXMEM;
51
- memory.grow(requiredPages-currentPages);
52
- }
53
- return res;
54
- }
55
-
56
- function allocBuffer(buffer) {
57
- const p = alloc(buffer.byteLength);
58
- setBuffer(p, buffer);
59
- return p;
60
- }
61
-
62
- function getBuffer(pointer, length) {
63
- const u8 = new Uint8Array(memory.buffer);
64
- return new Uint8Array(u8.buffer, u8.byteOffset + pointer, length);
65
- }
66
-
67
- function setBuffer(pointer, buffer) {
68
- const u8 = new Uint8Array(memory.buffer);
69
- u8.set(new Uint8Array(buffer), pointer);
70
- }
71
-
72
- function runTask(task) {
73
- if (task[0].cmd == "INIT") {
74
- return init(task[0]);
75
- }
76
- const ctx = {
77
- vars: [],
78
- out: []
79
- };
80
- const u32a = new Uint32Array(memory.buffer, 0, 1);
81
- const oldAlloc = u32a[0];
82
- for (let i=0; i<task.length; i++) {
83
- switch (task[i].cmd) {
84
- case "ALLOCSET":
85
- ctx.vars[task[i].var] = allocBuffer(task[i].buff);
86
- break;
87
- case "ALLOC":
88
- ctx.vars[task[i].var] = alloc(task[i].len);
89
- break;
90
- case "SET":
91
- setBuffer(ctx.vars[task[i].var], task[i].buff);
92
- break;
93
- case "CALL": {
94
- const params = [];
95
- for (let j=0; j<task[i].params.length; j++) {
96
- const p = task[i].params[j];
97
- if (typeof p.var !== "undefined") {
98
- params.push(ctx.vars[p.var] + (p.offset || 0));
99
- } else if (typeof p.val != "undefined") {
100
- params.push(p.val);
101
- }
102
- }
103
- instance.exports[task[i].fnName](...params);
104
- break;
105
- }
106
- case "GET":
107
- ctx.out[task[i].out] = getBuffer(ctx.vars[task[i].var], task[i].len).slice();
108
- break;
109
- default:
110
- throw new Error("Invalid cmd");
111
- }
112
- }
113
- const u32b = new Uint32Array(memory.buffer, 0, 1);
114
- u32b[0] = oldAlloc;
115
- return ctx.out;
116
- }
117
-
118
-
119
- return runTask;
120
- })(self)`;if(globalThis?.Blob){const i=new TextEncoder().encode(So),t=new Blob([i],{type:"application/javascript"});fi=URL.createObjectURL(t)}else fi="data:application/javascript;base64,"+globalThis.btoa(So);async function Kl(i,t){const n=new Hl;n.memory=new WebAssembly.Memory({initial:Ye}),n.u8=new Uint8Array(n.memory.buffer),n.u32=new Uint32Array(n.memory.buffer);const e=await WebAssembly.compile(i.code);if(n.instance=await WebAssembly.instantiate(e,{env:{memory:n.memory}}),globalThis?.Worker||(t=!0),n.singleThread=t,n.initalPFree=n.u32[0],n.pq=i.pq,n.pr=i.pr,n.pG1gen=i.pG1gen,n.pG1zero=i.pG1zero,n.pG2gen=i.pG2gen,n.pG2zero=i.pG2zero,n.pOneT=i.pOneT,t)n.code=i.code,n.taskManager=Gl(),await n.taskManager([{cmd:"INIT",init:Ye,code:n.code.slice()}]),n.concurrency=1;else{n.workers=[],n.pendingDeferreds=[],n.working=[];let s=2;typeof navigator=="object"&&navigator.hardwareConcurrency&&(s=navigator.hardwareConcurrency),s==0&&(s=2),s>64&&(s=64),n.concurrency=s;for(let r=0;r<s;r++)n.workers[r]=new Worker(fi),n.workers[r].addEventListener("message",o(r)),n.working[r]=!1;const u=[];for(let r=0;r<n.workers.length;r++){const b=i.code.slice();u.push(n.postAction(r,[{cmd:"INIT",init:Ye,code:b}],[b.buffer]))}await Promise.all(u)}return n;function o(s){return function(u){let r;u&&u.data?r=u.data:r=u,n.working[s]=!1,n.pendingDeferreds[s].resolve(r),n.processWorks()}}}class Hl{constructor(){this.actionQueue=[],this.oldPFree=0}startSyncOp(){if(this.oldPFree!=0)throw new Error("Sync operation in progress");this.oldPFree=this.u32[0]}endSyncOp(){if(this.oldPFree==0)throw new Error("No sync operation in progress");this.u32[0]=this.oldPFree,this.oldPFree=0}postAction(t,n,e,o){if(this.working[t])throw new Error("Posting a job t a working worker");return this.working[t]=!0,this.pendingDeferreds[t]=o||new Fo,this.workers[t].postMessage(n,e),this.pendingDeferreds[t].promise}processWorks(){for(let t=0;t<this.workers.length&&this.actionQueue.length>0;t++)if(this.working[t]==!1){const n=this.actionQueue.shift();this.postAction(t,n.data,n.transfers,n.deferred)}}queueAction(t,n){const e=new Fo;if(this.singleThread){const o=this.taskManager(t);e.resolve(o)}else this.actionQueue.push({data:t,transfers:n,deferred:e}),this.processWorks();return e.promise}resetMemory(){this.u32[0]=this.initalPFree}allocBuff(t){const n=this.alloc(t.byteLength);return this.setBuff(n,t),n}getBuff(t,n){return this.u8.slice(t,t+n)}setBuff(t,n){this.u8.set(new Uint8Array(n),t)}alloc(t){for(;this.u32[0]&3;)this.u32[0]++;const n=this.u32[0];return this.u32[0]+=t,n}async terminate(){for(let t=0;t<this.workers.length;t++)this.workers[t].postMessage([{cmd:"TERMINATE"}]);await Nl(200)}}function Xe(i,t){const n=i[t],e=i.Fr,o=i.tm;i[t].batchApplyKey=async function(s,u,r,b,g){b=b||"affine",g=g||"affine";let l,x,F,I,k;if(t=="G1")b=="jacobian"?(F=n.F.n8*3,l="g1m_batchApplyKey"):(F=n.F.n8*2,l="g1m_batchApplyKeyMixed"),I=n.F.n8*3,g=="jacobian"?k=n.F.n8*3:(x="g1m_batchToAffine",k=n.F.n8*2);else if(t=="G2")b=="jacobian"?(F=n.F.n8*3,l="g2m_batchApplyKey"):(F=n.F.n8*2,l="g2m_batchApplyKeyMixed"),I=n.F.n8*3,g=="jacobian"?k=n.F.n8*3:(x="g2m_batchToAffine",k=n.F.n8*2);else if(t=="Fr")l="frm_batchApplyKey",F=n.n8,I=n.n8,k=n.n8;else throw new Error("Invalid group: "+t);const z=Math.floor(s.byteLength/F),S=Math.floor(z/o.concurrency),G=[];r=e.e(r);let U=e.e(u);for(let O=0;O<o.concurrency;O++){let h;if(O<o.concurrency-1?h=S:h=z-O*S,h==0)continue;const A=[];A.push({cmd:"ALLOCSET",var:0,buff:s.slice(O*S*F,O*S*F+h*F)}),A.push({cmd:"ALLOCSET",var:1,buff:U}),A.push({cmd:"ALLOCSET",var:2,buff:r}),A.push({cmd:"ALLOC",var:3,len:h*Math.max(I,k)}),A.push({cmd:"CALL",fnName:l,params:[{var:0},{val:h},{var:1},{var:2},{var:3}]}),x&&A.push({cmd:"CALL",fnName:x,params:[{var:3},{val:h},{var:3}]}),A.push({cmd:"GET",out:0,var:3,len:h*k}),G.push(o.queueAction(A)),U=e.mul(U,e.exp(r,h))}const rt=await Promise.all(G);let H;s instanceof Dt?H=new Dt(z*k):H=new Uint8Array(z*k);let lt=0;for(let O=0;O<rt.length;O++)H.set(rt[O][0],lt),lt+=rt[O][0].byteLength;return H}}function Vl(i){const t=i.tm;i.pairing=function(e,o){t.startSyncOp();const s=t.allocBuff(i.G1.toJacobian(e)),u=t.allocBuff(i.G2.toJacobian(o)),r=t.alloc(i.Gt.n8);t.instance.exports[i.name+"_pairing"](s,u,r);const b=t.getBuff(r,i.Gt.n8);return t.endSyncOp(),b},i.pairingEq=async function(){let e,o;arguments.length%2==1?(e=arguments[arguments.length-1],o=(arguments.length-1)/2):(e=i.Gt.one,o=arguments.length/2);const s=[];for(let l=0;l<o;l++){const x=[],F=i.G1.toJacobian(arguments[l*2]);x.push({cmd:"ALLOCSET",var:0,buff:F}),x.push({cmd:"ALLOC",var:1,len:i.prePSize});const I=i.G2.toJacobian(arguments[l*2+1]);x.push({cmd:"ALLOCSET",var:2,buff:I}),x.push({cmd:"ALLOC",var:3,len:i.preQSize}),x.push({cmd:"ALLOC",var:4,len:i.Gt.n8}),x.push({cmd:"CALL",fnName:i.name+"_prepareG1",params:[{var:0},{var:1}]}),x.push({cmd:"CALL",fnName:i.name+"_prepareG2",params:[{var:2},{var:3}]}),x.push({cmd:"CALL",fnName:i.name+"_millerLoop",params:[{var:1},{var:3},{var:4}]}),x.push({cmd:"GET",out:0,var:4,len:i.Gt.n8}),s.push(t.queueAction(x))}const u=await Promise.all(s);t.startSyncOp();const r=t.alloc(i.Gt.n8);t.instance.exports.ftm_one(r);for(let l=0;l<u.length;l++){const x=t.allocBuff(u[l][0]);t.instance.exports.ftm_mul(r,x,r)}t.instance.exports[i.name+"_finalExponentiation"](r,r);const b=t.allocBuff(e),g=!!t.instance.exports.ftm_eq(r,b);return t.endSyncOp(),g},i.prepareG1=function(n){this.tm.startSyncOp();const e=this.tm.allocBuff(n),o=this.tm.alloc(this.prePSize);this.tm.instance.exports[this.name+"_prepareG1"](e,o);const s=this.tm.getBuff(o,this.prePSize);return this.tm.endSyncOp(),s},i.prepareG2=function(n){this.tm.startSyncOp();const e=this.tm.allocBuff(n),o=this.tm.alloc(this.preQSize);this.tm.instance.exports[this.name+"_prepareG2"](e,o);const s=this.tm.getBuff(o,this.preQSize);return this.tm.endSyncOp(),s},i.millerLoop=function(n,e){this.tm.startSyncOp();const o=this.tm.allocBuff(n),s=this.tm.allocBuff(e),u=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+"_millerLoop"](o,s,u);const r=this.tm.getBuff(u,this.Gt.n8);return this.tm.endSyncOp(),r},i.finalExponentiation=function(n){this.tm.startSyncOp();const e=this.tm.allocBuff(n),o=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+"_finalExponentiation"](e,o);const s=this.tm.getBuff(o,this.Gt.n8);return this.tm.endSyncOp(),s}}const Uo=[1,1,1,1,2,3,4,5,6,7,7,8,9,10,11,12,13,13,14,15,16,16,17,17,17,17,17,17,17,17,17,17];function Oo(i,t){const n=i[t],e=n.tm;async function o(u,r,b,g,l){if(!(u instanceof Uint8Array))throw g&&g.error(`${l} _multiExpChunk buffBases is not Uint8Array`),new Error(`${l} _multiExpChunk buffBases is not Uint8Array`);if(!(r instanceof Uint8Array))throw g&&g.error(`${l} _multiExpChunk buffScalars is not Uint8Array`),new Error(`${l} _multiExpChunk buffScalars is not Uint8Array`);b=b||"affine";let x,F;if(t=="G1")b=="affine"?(F="g1m_multiexpAffine_chunk",x=n.F.n8*2):(F="g1m_multiexp_chunk",x=n.F.n8*3);else if(t=="G2")b=="affine"?(F="g2m_multiexpAffine_chunk",x=n.F.n8*2):(F="g2m_multiexp_chunk",x=n.F.n8*3);else throw new Error("Invalid group");const I=Math.floor(u.byteLength/x);if(I==0)return n.zero;const k=Math.floor(r.byteLength/I);if(k*I!=r.byteLength)throw new Error("Scalar size does not match");const z=Uo[$t(I)],S=Math.floor((k*8-1)/z)+1,G=[];for(let H=0;H<S;H++){const lt=[{cmd:"ALLOCSET",var:0,buff:u},{cmd:"ALLOCSET",var:1,buff:r},{cmd:"ALLOC",var:2,len:n.F.n8*3},{cmd:"CALL",fnName:F,params:[{var:0},{var:1},{val:k},{val:I},{val:H*z},{val:Math.min(k*8-H*z,z)},{var:2}]},{cmd:"GET",out:0,var:2,len:n.F.n8*3}];G.push(n.tm.queueAction(lt))}const U=await Promise.all(G);let rt=n.zero;for(let H=U.length-1;H>=0;H--){if(!n.isZero(rt))for(let lt=0;lt<z;lt++)rt=n.double(rt);rt=n.add(rt,U[H][0])}return rt}async function s(u,r,b,g,l){let I;if(t=="G1")b=="affine"?I=n.F.n8*2:I=n.F.n8*3;else if(t=="G2")b=="affine"?I=n.F.n8*2:I=n.F.n8*3;else throw new Error("Invalid group");const k=Math.floor(u.byteLength/I);if(k==0)return n.zero;const z=Math.floor(r.byteLength/k);if(z*k!=r.byteLength)throw new Error("Scalar size does not match");const S=Uo[$t(k)],G=Math.floor((z*8-1)/S)+1;let U;U=Math.floor(k/(e.concurrency/G)),U>4194304&&(U=4194304),U<1024&&(U=1024);const rt=[];for(let O=0;O<k;O+=U){g&&g.debug(`Multiexp start: ${l}: ${O}/${k}`);const h=Math.min(k-O,U),A=u.slice(O*I,(O+h)*I),Z=r.slice(O*z,(O+h)*z);rt.push(o(A,Z,b,g,l).then(tt=>(g&&g.debug(`Multiexp end: ${l}: ${O}/${k}`),tt)))}const H=await Promise.all(rt);let lt=n.zero;for(let O=H.length-1;O>=0;O--)lt=n.add(lt,H[O]);return lt}n.multiExp=async function(r,b,g,l){return await s(r,b,"jacobian",g,l)},n.multiExpAffine=async function(r,b,g,l){return await s(r,b,"affine",g,l)}}function Je(i,t){const n=i[t],e=i.Fr,o=n.tm;async function s(g,l,x,F,I,k){x=x||"affine",F=F||"affine";const z=14;let S,G,U,rt,H,lt,O,h;t=="G1"?(x=="affine"?(S=n.F.n8*2,rt="g1m_batchToJacobian"):S=n.F.n8*3,G=n.F.n8*3,l&&(h="g1m_fftFinal"),O="g1m_fftJoin",lt="g1m_fftMix",F=="affine"?(U=n.F.n8*2,H="g1m_batchToAffine"):U=n.F.n8*3):t=="G2"?(x=="affine"?(S=n.F.n8*2,rt="g2m_batchToJacobian"):S=n.F.n8*3,G=n.F.n8*3,l&&(h="g2m_fftFinal"),O="g2m_fftJoin",lt="g2m_fftMix",F=="affine"?(U=n.F.n8*2,H="g2m_batchToAffine"):U=n.F.n8*3):t=="Fr"&&(S=n.n8,G=n.n8,U=n.n8,l&&(h="frm_fftFinal"),lt="frm_fftMix",O="frm_fftJoin");let A=!1;Array.isArray(g)?(g=Vi(g,S),A=!0):g=g.slice(0,g.byteLength);const Z=g.byteLength/S,tt=$t(Z);if(1<<tt!=Z)throw new Error("fft must be multiple of 2");if(tt==e.s+1){let J;return l?J=await r(g,x,F,I,k):J=await u(g,x,F,I,k),A?Se(J,U):J}let at;l&&(at=e.inv(e.e(Z)));let R;dc(g,S);let C,T=Math.min(1<<z,Z),V=Z/T;for(;V<o.concurrency&&T>=16;)V*=2,T/=2;const ut=$t(T),ct=[];for(let J=0;J<V;J++){I&&I.debug(`${k}: fft ${tt} mix start: ${J}/${V}`);const gt=[];gt.push({cmd:"ALLOC",var:0,len:G*T});const et=g.slice(T*J*S,T*(J+1)*S);gt.push({cmd:"SET",var:0,buff:et}),rt&&gt.push({cmd:"CALL",fnName:rt,params:[{var:0},{val:T},{var:0}]});for(let st=1;st<=ut;st++)gt.push({cmd:"CALL",fnName:lt,params:[{var:0},{val:T},{val:st}]});ut==tt?(h&&(gt.push({cmd:"ALLOCSET",var:1,buff:at}),gt.push({cmd:"CALL",fnName:h,params:[{var:0},{val:T},{var:1}]})),H&&gt.push({cmd:"CALL",fnName:H,params:[{var:0},{val:T},{var:0}]}),gt.push({cmd:"GET",out:0,var:0,len:T*U})):gt.push({cmd:"GET",out:0,var:0,len:G*T}),ct.push(o.queueAction(gt).then(st=>(I&&I.debug(`${k}: fft ${tt} mix end: ${J}/${V}`),st)))}C=await Promise.all(ct);for(let J=0;J<V;J++)C[J]=C[J][0];for(let J=ut+1;J<=tt;J++){I&&I.debug(`${k}: fft ${tt} join: ${J}/${tt}`);const gt=1<<tt-J,et=V/gt,st=[];for(let Ut=0;Ut<gt;Ut++)for(let mt=0;mt<et/2;mt++){const L=e.exp(e.w[J],mt*T),a=e.w[J],w=Ut*et+mt,c=Ut*et+mt+et/2,E=[];E.push({cmd:"ALLOCSET",var:0,buff:C[w]}),E.push({cmd:"ALLOCSET",var:1,buff:C[c]}),E.push({cmd:"ALLOCSET",var:2,buff:L}),E.push({cmd:"ALLOCSET",var:3,buff:a}),E.push({cmd:"CALL",fnName:O,params:[{var:0},{var:1},{val:T},{var:2},{var:3}]}),J==tt?(h&&(E.push({cmd:"ALLOCSET",var:4,buff:at}),E.push({cmd:"CALL",fnName:h,params:[{var:0},{val:T},{var:4}]}),E.push({cmd:"CALL",fnName:h,params:[{var:1},{val:T},{var:4}]})),H&&(E.push({cmd:"CALL",fnName:H,params:[{var:0},{val:T},{var:0}]}),E.push({cmd:"CALL",fnName:H,params:[{var:1},{val:T},{var:1}]})),E.push({cmd:"GET",out:0,var:0,len:T*U}),E.push({cmd:"GET",out:1,var:1,len:T*U})):(E.push({cmd:"GET",out:0,var:0,len:T*G}),E.push({cmd:"GET",out:1,var:1,len:T*G})),st.push(o.queueAction(E).then(m=>(I&&I.debug(`${k}: fft ${tt} join ${J}/${tt} ${Ut+1}/${gt} ${mt}/${et/2}`),m)))}const Lt=await Promise.all(st);for(let Ut=0;Ut<gt;Ut++)for(let mt=0;mt<et/2;mt++){const L=Ut*et+mt,a=Ut*et+mt+et/2,w=Lt.shift();C[L]=w[0],C[a]=w[1]}}if(g instanceof Dt?R=new Dt(Z*U):R=new Uint8Array(Z*U),l){R.set(C[0].slice((T-1)*U));let J=U;for(let gt=V-1;gt>0;gt--)R.set(C[gt],J),J+=T*U,delete C[gt];R.set(C[0].slice(0,(T-1)*U),J),delete C[0]}else for(let J=0;J<V;J++)R.set(C[J],T*U*J),delete C[J];return A?Se(R,U):R}async function u(g,l,x,F,I){let k,z;k=g.slice(0,g.byteLength/2),z=g.slice(g.byteLength/2,g.byteLength);const S=[];[k,z]=await b(k,z,"fftJoinExt",e.one,e.shift,l,"jacobian",F,I),S.push(s(k,!1,"jacobian",x,F,I)),S.push(s(z,!1,"jacobian",x,F,I));const G=await Promise.all(S);let U;return G[0].byteLength>1<<28?U=new Dt(G[0].byteLength*2):U=new Uint8Array(G[0].byteLength*2),U.set(G[0]),U.set(G[1],G[0].byteLength),U}async function r(g,l,x,F,I){let k,z;k=g.slice(0,g.byteLength/2),z=g.slice(g.byteLength/2,g.byteLength);const S=[];S.push(s(k,!0,l,"jacobian",F,I)),S.push(s(z,!0,l,"jacobian",F,I)),[k,z]=await Promise.all(S);const G=await b(k,z,"fftJoinExtInv",e.one,e.shiftInv,"jacobian",x,F,I);let U;return G[0].byteLength>1<<28?U=new Dt(G[0].byteLength*2):U=new Uint8Array(G[0].byteLength*2),U.set(G[0]),U.set(G[1],G[0].byteLength),U}async function b(g,l,x,F,I,k,z,S,G){let H,lt,O,h,A,Z;if(t=="G1")k=="affine"?(A=n.F.n8*2,lt="g1m_batchToJacobian"):A=n.F.n8*3,Z=n.F.n8*3,H="g1m_"+x,z=="affine"?(O="g1m_batchToAffine",h=n.F.n8*2):h=n.F.n8*3;else if(t=="G2")k=="affine"?(A=n.F.n8*2,lt="g2m_batchToJacobian"):A=n.F.n8*3,H="g2m_"+x,Z=n.F.n8*3,z=="affine"?(O="g2m_batchToAffine",h=n.F.n8*2):h=n.F.n8*3;else if(t=="Fr")A=e.n8,h=e.n8,Z=e.n8,H="frm_"+x;else throw new Error("Invalid group");if(g.byteLength!=l.byteLength)throw new Error("Invalid buffer size");const tt=Math.floor(g.byteLength/A);if(tt!=1<<$t(tt))throw new Error("Invalid number of points");let at=Math.floor(tt/o.concurrency);at<16&&(at=16),at>65536&&(at=65536);const R=[];for(let ct=0;ct<tt;ct+=at){S&&S.debug(`${G}: fftJoinExt Start: ${ct}/${tt}`);const J=Math.min(tt-ct,at),gt=e.mul(F,e.exp(I,ct)),et=[],st=g.slice(ct*A,(ct+J)*A),Lt=l.slice(ct*A,(ct+J)*A);et.push({cmd:"ALLOC",var:0,len:Z*J}),et.push({cmd:"SET",var:0,buff:st}),et.push({cmd:"ALLOC",var:1,len:Z*J}),et.push({cmd:"SET",var:1,buff:Lt}),et.push({cmd:"ALLOCSET",var:2,buff:gt}),et.push({cmd:"ALLOCSET",var:3,buff:I}),lt&&(et.push({cmd:"CALL",fnName:lt,params:[{var:0},{val:J},{var:0}]}),et.push({cmd:"CALL",fnName:lt,params:[{var:1},{val:J},{var:1}]})),et.push({cmd:"CALL",fnName:H,params:[{var:0},{var:1},{val:J},{var:2},{var:3},{val:e.s}]}),O&&(et.push({cmd:"CALL",fnName:O,params:[{var:0},{val:J},{var:0}]}),et.push({cmd:"CALL",fnName:O,params:[{var:1},{val:J},{var:1}]})),et.push({cmd:"GET",out:0,var:0,len:J*h}),et.push({cmd:"GET",out:1,var:1,len:J*h}),R.push(o.queueAction(et).then(Ut=>(S&&S.debug(`${G}: fftJoinExt End: ${ct}/${tt}`),Ut)))}const C=await Promise.all(R);let T,V;tt*h>1<<28?(T=new Dt(tt*h),V=new Dt(tt*h)):(T=new Uint8Array(tt*h),V=new Uint8Array(tt*h));let ut=0;for(let ct=0;ct<C.length;ct++)T.set(C[ct][0],ut),V.set(C[ct][1],ut),ut+=C[ct][0].byteLength;return[T,V]}n.fft=async function(g,l,x,F,I){return await s(g,!1,l,x,F,I)},n.ifft=async function(g,l,x,F,I){return await s(g,!0,l,x,F,I)},n.lagrangeEvaluations=async function(g,l,x,F,I){l=l||"affine",x=x||"affine";let k;if(t=="G1")l=="affine"?k=n.F.n8*2:k=n.F.n8*3;else if(t=="G2")l=="affine"?k=n.F.n8*2:k=n.F.n8*3;else if(t=="Fr")k=e.n8;else throw new Error("Invalid group");const z=g.byteLength/k,S=$t(z);if(2**S*k!=g.byteLength)throw F&&F.error("lagrangeEvaluations iinvalid input size"),new Error("lagrangeEvaluations invalid Input size");if(S<=e.s)return await n.ifft(g,l,x,F,I);if(S>e.s+1)throw F&&F.error("lagrangeEvaluations input too big"),new Error("lagrangeEvaluations input too big");let G=g.slice(0,g.byteLength/2),U=g.slice(g.byteLength/2,g.byteLength);const rt=e.exp(e.shift,z/2),H=e.inv(e.sub(e.one,rt));[G,U]=await b(G,U,"prepareLagrangeEvaluation",H,e.shiftInv,l,"jacobian",F,I+" prep");const lt=[];lt.push(s(G,!0,"jacobian",x,F,I+" t0")),lt.push(s(U,!0,"jacobian",x,F,I+" t1")),[G,U]=await Promise.all(lt);let O;return G.byteLength>1<<28?O=new Dt(G.byteLength*2):O=new Uint8Array(G.byteLength*2),O.set(G),O.set(U,G.byteLength),O},n.fftMix=async function(l){const x=n.F.n8*3;let F,I;if(t=="G1")F="g1m_fftMix",I="g1m_fftJoin";else if(t=="G2")F="g2m_fftMix",I="g2m_fftJoin";else if(t=="Fr")F="frm_fftMix",I="frm_fftJoin";else throw new Error("Invalid group");const k=Math.floor(l.byteLength/x),z=$t(k);let S=1<<$t(o.concurrency);k<=S*2&&(S=1);const G=k/S,U=$t(G),rt=[];for(let A=0;A<S;A++){const Z=[],tt=l.slice(A*G*x,(A+1)*G*x);Z.push({cmd:"ALLOCSET",var:0,buff:tt});for(let at=1;at<=U;at++)Z.push({cmd:"CALL",fnName:F,params:[{var:0},{val:G},{val:at}]});Z.push({cmd:"GET",out:0,var:0,len:G*x}),rt.push(o.queueAction(Z))}const H=await Promise.all(rt),lt=[];for(let A=0;A<H.length;A++)lt[A]=H[A][0];for(let A=U+1;A<=z;A++){const Z=1<<z-A,tt=S/Z,at=[];for(let C=0;C<Z;C++)for(let T=0;T<tt/2;T++){const V=e.exp(e.w[A],T*G),ut=e.w[A],ct=C*tt+T,J=C*tt+T+tt/2,gt=[];gt.push({cmd:"ALLOCSET",var:0,buff:lt[ct]}),gt.push({cmd:"ALLOCSET",var:1,buff:lt[J]}),gt.push({cmd:"ALLOCSET",var:2,buff:V}),gt.push({cmd:"ALLOCSET",var:3,buff:ut}),gt.push({cmd:"CALL",fnName:I,params:[{var:0},{var:1},{val:G},{var:2},{var:3}]}),gt.push({cmd:"GET",out:0,var:0,len:G*x}),gt.push({cmd:"GET",out:1,var:1,len:G*x}),at.push(o.queueAction(gt))}const R=await Promise.all(at);for(let C=0;C<Z;C++)for(let T=0;T<tt/2;T++){const V=C*tt+T,ut=C*tt+T+tt/2,ct=R.shift();lt[V]=ct[0],lt[ut]=ct[1]}}let O;l instanceof Dt?O=new Dt(k*x):O=new Uint8Array(k*x);let h=0;for(let A=0;A<S;A++)O.set(lt[A],h),h+=lt[A].byteLength;return O},n.fftJoin=async function(l,x,F,I){const k=n.F.n8*3;let z;if(t=="G1")z="g1m_fftJoin";else if(t=="G2")z="g2m_fftJoin";else if(t=="Fr")z="frm_fftJoin";else throw new Error("Invalid group");if(l.byteLength!=x.byteLength)throw new Error("Invalid buffer size");const S=Math.floor(l.byteLength/k);if(S!=1<<$t(S))throw new Error("Invalid number of points");let G=1<<$t(o.concurrency);S<=G*2&&(G=1);const U=S/G,rt=[];for(let A=0;A<G;A++){const Z=[],tt=e.mul(F,e.exp(I,A*U)),at=l.slice(A*U*k,(A+1)*U*k),R=x.slice(A*U*k,(A+1)*U*k);Z.push({cmd:"ALLOCSET",var:0,buff:at}),Z.push({cmd:"ALLOCSET",var:1,buff:R}),Z.push({cmd:"ALLOCSET",var:2,buff:tt}),Z.push({cmd:"ALLOCSET",var:3,buff:I}),Z.push({cmd:"CALL",fnName:z,params:[{var:0},{var:1},{val:U},{var:2},{var:3}]}),Z.push({cmd:"GET",out:0,var:0,len:U*k}),Z.push({cmd:"GET",out:1,var:1,len:U*k}),rt.push(o.queueAction(Z))}const H=await Promise.all(rt);let lt,O;l instanceof Dt?(lt=new Dt(S*k),O=new Dt(S*k)):(lt=new Uint8Array(S*k),O=new Uint8Array(S*k));let h=0;for(let A=0;A<H.length;A++)lt.set(H[A][0],h),O.set(H[A][1],h),h+=H[A][0].byteLength;return[lt,O]},n.fftFinal=async function(l,x){const F=n.F.n8*3,I=n.F.n8*2;let k,z;if(t=="G1")k="g1m_fftFinal",z="g1m_batchToAffine";else if(t=="G2")k="g2m_fftFinal",z="g2m_batchToAffine";else throw new Error("Invalid group");const S=Math.floor(l.byteLength/F);if(S!=1<<$t(S))throw new Error("Invalid number of points");const G=Math.floor(S/o.concurrency),U=[];for(let O=0;O<o.concurrency;O++){let h;if(O<o.concurrency-1?h=G:h=S-O*G,h==0)continue;const A=[],Z=l.slice(O*G*F,(O*G+h)*F);A.push({cmd:"ALLOCSET",var:0,buff:Z}),A.push({cmd:"ALLOCSET",var:1,buff:x}),A.push({cmd:"CALL",fnName:k,params:[{var:0},{val:h},{var:1}]}),A.push({cmd:"CALL",fnName:z,params:[{var:0},{val:h},{var:0}]}),A.push({cmd:"GET",out:0,var:0,len:h*I}),U.push(o.queueAction(A))}const rt=await Promise.all(U);let H;l instanceof Dt?H=new Dt(S*I):H=new Uint8Array(S*I);let lt=0;for(let O=rt.length-1;O>=0;O--)H.set(rt[O][0],lt),lt+=rt[O][0].byteLength;return H}}async function uc(i){const t=await Kl(i.wasm,i.singleThread),n={};return n.q=Ht(i.wasm.q.toString()),n.r=Ht(i.wasm.r.toString()),n.name=i.name,n.tm=t,n.prePSize=i.wasm.prePSize,n.preQSize=i.wasm.preQSize,n.Fr=new Bo(t,"frm",i.n8r,i.r),n.F1=new Bo(t,"f1m",i.n8q,i.q),n.F2=new Eo(t,"f2m",n.F1),n.G1=new xo(t,"g1m",n.F1,i.wasm.pG1gen,i.wasm.pG1b,i.cofactorG1),n.G2=new xo(t,"g2m",n.F2,i.wasm.pG2gen,i.wasm.pG2b,i.cofactorG2),n.F6=new Rl(t,"f6m",n.F2),n.F12=new Eo(t,"ftm",n.F6),n.Gt=n.F12,Xe(n,"G1"),Xe(n,"G2"),Xe(n,"Fr"),Oo(n,"G1"),Oo(n,"G2"),Je(n,"G1"),Je(n,"G2"),Je(n,"Fr"),Vl(n),n.array2buffer=function(e,o){const s=new Uint8Array(o*e.length);for(let u=0;u<e.length;u++)s.set(e[u],u*o);return s},n.buffer2array=function(e,o){const s=e.byteLength/o,u=new Array(s);for(let r=0;r<s;r++)u[r]=e.slice(r*o,r*o+o);return u},n}function zn(i){return BigInt(i)}function fc(i){return i<0n}function jl(i){return i===0n}function Yl(i){return fc(i)?i.toString(2).length-1:i.toString(2).length}function Ze(i){const t=[],n=zn(i);return t.push(Number(n&0xFFn)),t.push(Number(n>>8n&0xFFn)),t.push(Number(n>>16n&0xFFn)),t.push(Number(n>>24n&0xFFn)),t}function Xl(i){for(var t=[],n=0;n<i.length;n++){var e=i.charCodeAt(n);e<128?t.push(e):e<2048?t.push(192|e>>6,128|e&63):e<55296||e>=57344?t.push(224|e>>12,128|e>>6&63,128|e&63):(n++,e=65536+((e&1023)<<10|i.charCodeAt(n)&1023),t.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|e&63))}return t}function Xn(i){const t=Xl(i);return[...Mt(t.length),...t]}function gc(i){const t=[];let n=zn(i);if(fc(n))throw new Error("Number cannot be negative");for(;!jl(n);)t.push(Number(n&0x7Fn)),n=n>>7n;t.length==0&&t.push(0);for(let e=0;e<t.length-1;e++)t[e]=t[e]|128;return t}function hc(i){let t,n;const e=Yl(i);i<0?(n=!0,t=(1n<<BigInt(e))+i):(n=!1,t=zn(i));const o=7-e%7,s=(1n<<BigInt(o))-1n<<BigInt(e),u=(1<<7-o)-1|128,r=gc(t+s);return n||(r[r.length-1]=r[r.length-1]&u),r}function gi(i){let t=zn(i);if(t>0xFFFFFFFFn)throw new Error("Number too big");if(t>0x7FFFFFFFn&&(t=t-0x100000000n),t<-2147483648n)throw new Error("Number too small");return hc(t)}function Jl(i){let t=zn(i);if(t>0xFFFFFFFFFFFFFFFFn)throw new Error("Number too big");if(t>0x7FFFFFFFFFFFFFFFn&&(t=t-0x10000000000000000n),t<-9223372036854775808n)throw new Error("Number too small");return hc(t)}function Mt(i){let t=zn(i);if(t>0xFFFFFFFFn)throw new Error("Number too big");return gc(t)}function Mo(i){return Array.from(i,function(t){return("0"+(t&255).toString(16)).slice(-2)}).join("")}class Zl{constructor(t){this.func=t,this.functionName=t.functionName,this.module=t.module}setLocal(t,n){const e=this.func.localIdxByName[t];if(e===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[...n,33,...Mt(e)]}teeLocal(t,n){const e=this.func.localIdxByName[t];if(e===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[...n,34,...Mt(e)]}getLocal(t){const n=this.func.localIdxByName[t];if(n===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[32,...Mt(n)]}i64_load8_s(t,n,e){const o=n||0,s=e===void 0?0:e;return[...t,48,s,...Mt(o)]}i64_load8_u(t,n,e){const o=n||0,s=e===void 0?0:e;return[...t,49,s,...Mt(o)]}i64_load16_s(t,n,e){const o=n||0,s=e===void 0?1:e;return[...t,50,s,...Mt(o)]}i64_load16_u(t,n,e){const o=n||0,s=e===void 0?1:e;return[...t,51,s,...Mt(o)]}i64_load32_s(t,n,e){const o=n||0,s=e===void 0?2:e;return[...t,52,s,...Mt(o)]}i64_load32_u(t,n,e){const o=n||0,s=e===void 0?2:e;return[...t,53,s,...Mt(o)]}i64_load(t,n,e){const o=n||0,s=e===void 0?3:e;return[...t,41,s,...Mt(o)]}i64_store(t,n,e,o){let s,u,r;return Array.isArray(n)?(s=0,u=3,r=n):Array.isArray(e)?(s=n,u=3,r=e):Array.isArray(o)&&(s=n,u=e,r=o),[...t,...r,55,u,...Mt(s)]}i64_store32(t,n,e,o){let s,u,r;return Array.isArray(n)?(s=0,u=2,r=n):Array.isArray(e)?(s=n,u=2,r=e):Array.isArray(o)&&(s=n,u=e,r=o),[...t,...r,62,u,...Mt(s)]}i64_store16(t,n,e,o){let s,u,r;return Array.isArray(n)?(s=0,u=1,r=n):Array.isArray(e)?(s=n,u=1,r=e):Array.isArray(o)&&(s=n,u=e,r=o),[...t,...r,61,u,...Mt(s)]}i64_store8(t,n,e,o){let s,u,r;return Array.isArray(n)?(s=0,u=0,r=n):Array.isArray(e)?(s=n,u=0,r=e):Array.isArray(o)&&(s=n,u=e,r=o),[...t,...r,60,u,...Mt(s)]}i32_load8_s(t,n,e){const o=n||0,s=e===void 0?0:e;return[...t,44,s,...Mt(o)]}i32_load8_u(t,n,e){const o=n||0,s=e===void 0?0:e;return[...t,45,s,...Mt(o)]}i32_load16_s(t,n,e){const o=n||0,s=e===void 0?1:e;return[...t,46,s,...Mt(o)]}i32_load16_u(t,n,e){const o=n||0,s=e===void 0?1:e;return[...t,47,s,...Mt(o)]}i32_load(t,n,e){const o=n||0,s=e===void 0?2:e;return[...t,40,s,...Mt(o)]}i32_store(t,n,e,o){let s,u,r;return Array.isArray(n)?(s=0,u=2,r=n):Array.isArray(e)?(s=n,u=2,r=e):Array.isArray(o)&&(s=n,u=e,r=o),[...t,...r,54,u,...Mt(s)]}i32_store16(t,n,e,o){let s,u,r;return Array.isArray(n)?(s=0,u=1,r=n):Array.isArray(e)?(s=n,u=1,r=e):Array.isArray(o)&&(s=n,u=e,r=o),[...t,...r,59,u,...Mt(s)]}i32_store8(t,n,e,o){let s,u,r;return Array.isArray(n)?(s=0,u=0,r=n):Array.isArray(e)?(s=n,u=0,r=e):Array.isArray(o)&&(s=n,u=e,r=o),[...t,...r,58,u,...Mt(s)]}call(t,...n){const e=this.module.functionIdxByName[t];if(e===void 0)throw new Error(`Function not defined: Function: ${t}`);return[...[].concat(...n),16,...Mt(e)]}call_indirect(t,...n){return[...[].concat(...n),...t,17,0,0]}if(t,n,e){return e?[...t,4,64,...n,5,...e,11]:[...t,4,64,...n,11]}block(t){return[2,64,...t,11]}loop(...t){return[3,64,...[].concat(...t),11]}br_if(t,n){return[...n,13,...Mt(t)]}br(t){return[12,...Mt(t)]}ret(t){return[...t,15]}drop(t){return[...t,26]}i64_const(t){return[66,...Jl(t)]}i32_const(t){return[65,...gi(t)]}i64_eqz(t){return[...t,80]}i64_eq(t,n){return[...t,...n,81]}i64_ne(t,n){return[...t,...n,82]}i64_lt_s(t,n){return[...t,...n,83]}i64_lt_u(t,n){return[...t,...n,84]}i64_gt_s(t,n){return[...t,...n,85]}i64_gt_u(t,n){return[...t,...n,86]}i64_le_s(t,n){return[...t,...n,87]}i64_le_u(t,n){return[...t,...n,88]}i64_ge_s(t,n){return[...t,...n,89]}i64_ge_u(t,n){return[...t,...n,90]}i64_add(t,n){return[...t,...n,124]}i64_sub(t,n){return[...t,...n,125]}i64_mul(t,n){return[...t,...n,126]}i64_div_s(t,n){return[...t,...n,127]}i64_div_u(t,n){return[...t,...n,128]}i64_rem_s(t,n){return[...t,...n,129]}i64_rem_u(t,n){return[...t,...n,130]}i64_and(t,n){return[...t,...n,131]}i64_or(t,n){return[...t,...n,132]}i64_xor(t,n){return[...t,...n,133]}i64_shl(t,n){return[...t,...n,134]}i64_shr_s(t,n){return[...t,...n,135]}i64_shr_u(t,n){return[...t,...n,136]}i64_extend_i32_s(t){return[...t,172]}i64_extend_i32_u(t){return[...t,173]}i64_clz(t){return[...t,121]}i64_ctz(t){return[...t,122]}i32_eqz(t){return[...t,69]}i32_eq(t,n){return[...t,...n,70]}i32_ne(t,n){return[...t,...n,71]}i32_lt_s(t,n){return[...t,...n,72]}i32_lt_u(t,n){return[...t,...n,73]}i32_gt_s(t,n){return[...t,...n,74]}i32_gt_u(t,n){return[...t,...n,75]}i32_le_s(t,n){return[...t,...n,76]}i32_le_u(t,n){return[...t,...n,77]}i32_ge_s(t,n){return[...t,...n,78]}i32_ge_u(t,n){return[...t,...n,79]}i32_add(t,n){return[...t,...n,106]}i32_sub(t,n){return[...t,...n,107]}i32_mul(t,n){return[...t,...n,108]}i32_div_s(t,n){return[...t,...n,109]}i32_div_u(t,n){return[...t,...n,110]}i32_rem_s(t,n){return[...t,...n,111]}i32_rem_u(t,n){return[...t,...n,112]}i32_and(t,n){return[...t,...n,113]}i32_or(t,n){return[...t,...n,114]}i32_xor(t,n){return[...t,...n,115]}i32_shl(t,n){return[...t,...n,116]}i32_shr_s(t,n){return[...t,...n,117]}i32_shr_u(t,n){return[...t,...n,118]}i32_rotl(t,n){return[...t,...n,119]}i32_rotr(t,n){return[...t,...n,120]}i32_wrap_i64(t){return[...t,167]}i32_clz(t){return[...t,103]}i32_ctz(t){return[...t,104]}unreachable(){return[0]}current_memory(){return[63,0]}comment(){return[]}}const We={i32:127,i64:126,f32:125,f64:124,anyfunc:112,func:96,emptyblock:64};class Po{constructor(t,n,e,o,s){if(e=="import")this.fnType="import",this.moduleName=o,this.fieldName=s;else if(e=="internal")this.fnType="internal";else throw new Error("Invalid function fnType: "+e);this.module=t,this.fnName=n,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(t,n){if(this.localIdxByName[t])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${t} `);const e=this.nextLocal++;this.localIdxByName[t]=e,this.params.push({type:n})}addLocal(t,n,e){const o=e||1;if(this.localIdxByName[t])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${t} `);const s=this.nextLocal++;this.localIdxByName[t]=s,this.locals.push({type:n,length:o})}setReturnType(t){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=t}getSignature(){const t=[...Mt(this.params.length),...this.params.map(e=>We[e.type])],n=this.returnType?[1,We[this.returnType]]:[0];return[96,...t,...n]}getBody(){const t=this.locals.map(e=>[...Mt(e.length),We[e.type]]),n=[...Mt(this.locals.length),...[].concat(...t),...this.code,11];return[...Mt(n.length),...n]}addCode(...t){this.code.push(...[].concat(...t))}getCodeBuilder(){return new Zl(this)}}class _c{constructor(){this.functions=[],this.functionIdxByName={},this.nImportFunctions=0,this.nInternalFunctions=0,this.memory={pagesSize:1,moduleName:"env",fieldName:"memory"},this.free=8,this.datas=[],this.modules={},this.exports=[],this.functionsTable=[]}build(){return this._setSignatures(),new Uint8Array([...Ze(1836278016),...Ze(1),...this._buildType(),...this._buildImport(),...this._buildFunctionDeclarations(),...this._buildFunctionsTable(),...this._buildExports(),...this._buildElements(),...this._buildCode(),...this._buildData()])}addFunction(t){if(typeof this.functionIdxByName[t]<"u")throw new Error(`Function already defined: ${t}`);const n=this.functions.length;return this.functionIdxByName[t]=n,this.functions.push(new Po(this,t,"internal")),this.nInternalFunctions++,this.functions[n]}addIimportFunction(t,n,e){if(typeof this.functionIdxByName[t]<"u")throw new Error(`Function already defined: ${t}`);if(this.functions.length>0&&this.functions[this.functions.length-1].type=="internal")throw new Error(`Import functions must be declared before internal: ${t}`);let o=e||t;const s=this.functions.length;return this.functionIdxByName[t]=s,this.functions.push(new Po(this,t,"import",n,o)),this.nImportFunctions++,this.functions[s]}setMemory(t,n,e){this.memory={pagesSize:t,moduleName:n||"env",fieldName:e||"memory"}}exportFunction(t,n){const e=n||t;if(typeof this.functionIdxByName[t]>"u")throw new Error(`Function not defined: ${t}`);const o=this.functionIdxByName[t];e!=t&&(this.functionIdxByName[e]=o),this.exports.push({exportName:e,idx:o})}addFunctionToTable(t){const n=this.functionIdxByName[t];this.functionsTable.push(n)}addData(t,n){this.datas.push({offset:t,bytes:n})}alloc(t,n){let e,o;(Array.isArray(t)||ArrayBuffer.isView(t))&&typeof n>"u"?(e=t.length,o=t):(e=t,o=n),e=(e-1>>3)+1<<3;const s=this.free;return this.free+=e,o&&this.addData(s,o),s}allocString(t){const e=new globalThis.TextEncoder().encode(t);return this.alloc([...e,0])}_setSignatures(){this.signatures=[];const t={};if(this.functionsTable.length>0){const n=this.functions[this.functionsTable[0]].getSignature(),e="s_"+Mo(n);t[e]=0,this.signatures.push(n)}for(let n=0;n<this.functions.length;n++){const e=this.functions[n].getSignature(),o="s_"+Mo(e);typeof t[o]>"u"&&(t[o]=this.signatures.length,this.signatures.push(e)),this.functions[n].signatureIdx=t[o]}}_buildSection(t,n){return[t,...Mt(n.length),...n]}_buildType(){return this._buildSection(1,[...Mt(this.signatures.length),...[].concat(...this.signatures)])}_buildImport(){const t=[];t.push([...Xn(this.memory.moduleName),...Xn(this.memory.fieldName),2,0,...Mt(this.memory.pagesSize)]);for(let n=0;n<this.nImportFunctions;n++)t.push([...Xn(this.functions[n].moduleName),...Xn(this.functions[n].fieldName),0,...Mt(this.functions[n].signatureIdx)]);return this._buildSection(2,Mt(t.length).concat(...t))}_buildFunctionDeclarations(){const t=[];for(let n=this.nImportFunctions;n<this.nImportFunctions+this.nInternalFunctions;n++)t.push(...Mt(this.functions[n].signatureIdx));return this._buildSection(3,[...Mt(t.length),...t])}_buildFunctionsTable(){return this.functionsTable.length==0?[]:this._buildSection(4,[...Mt(1),112,0,...Mt(this.functionsTable.length)])}_buildElements(){if(this.functionsTable.length==0)return[];const t=[];for(let n=0;n<this.functionsTable.length;n++)t.push(...Mt(this.functionsTable[n]));return this._buildSection(9,[...Mt(1),...Mt(0),65,...gi(0),11,...Mt(this.functionsTable.length),...t])}_buildExports(){const t=[];for(let n=0;n<this.exports.length;n++)t.push([...Xn(this.exports[n].exportName),0,...Mt(this.exports[n].idx)]);return this._buildSection(7,Mt(t.length).concat(...t))}_buildCode(){const t=[];for(let n=this.nImportFunctions;n<this.nImportFunctions+this.nInternalFunctions;n++)t.push(this.functions[n].getBody());return this._buildSection(10,Mt(t.length).concat(...t))}_buildData(){const t=[];t.push([0,65,0,11,4,...Ze(this.free)]);for(let n=0;n<this.datas.length;n++)t.push([0,65,...gi(this.datas[n].offset),11,...Mt(this.datas[n].bytes.length),...this.datas[n].bytes]);return this._buildSection(11,Mt(t.length).concat(...t))}}globalThis.curve_bn128=null;async function pc(i,t){if(!i&&globalThis.curve_bn128)return globalThis.curve_bn128;const n=new _c;n.setMemory(25),Ql(n);const e={};e.code=n.build(),e.pq=n.modules.f1m.pq,e.pr=n.modules.frm.pq,e.pG1gen=n.modules.bn128.pG1gen,e.pG1zero=n.modules.bn128.pG1zero,e.pG1b=n.modules.bn128.pG1b,e.pG2gen=n.modules.bn128.pG2gen,e.pG2zero=n.modules.bn128.pG2zero,e.pG2b=n.modules.bn128.pG2b,e.pOneT=n.modules.bn128.pOneT,e.prePSize=n.modules.bn128.prePSize,e.preQSize=n.modules.bn128.preQSize,e.n8q=32,e.n8r=32,e.q=n.modules.bn128.q,e.r=n.modules.bn128.r;const o={name:"bn128",wasm:e,q:Ht("21888242871839275222246405745257275088696311157297823662689037894645226208583"),r:Ht("21888242871839275222246405745257275088548364400416034343698204186575808495617"),n8q:32,n8r:32,cofactorG2:Ht("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d",16),singleThread:!!i},s=await uc(o);return s.terminate=async function(){o.singleThread||(globalThis.curve_bn128=null,await this.tm.terminate())},i||(globalThis.curve_bn128=s),s}globalThis.curve_bls12381=null;async function Lc(i,t){if(!i&&globalThis.curve_bls12381)return globalThis.curve_bls12381;const n=new _c;n.setMemory(25),vl(n);const e={};e.code=n.build(),e.pq=n.modules.f1m.pq,e.pr=n.modules.frm.pq,e.pG1gen=n.modules.bls12381.pG1gen,e.pG1zero=n.modules.bls12381.pG1zero,e.pG1b=n.modules.bls12381.pG1b,e.pG2gen=n.modules.bls12381.pG2gen,e.pG2zero=n.modules.bls12381.pG2zero,e.pG2b=n.modules.bls12381.pG2b,e.pOneT=n.modules.bls12381.pOneT,e.prePSize=n.modules.bls12381.prePSize,e.preQSize=n.modules.bls12381.preQSize,e.n8q=48,e.n8r=32,e.q=n.modules.bls12381.q,e.r=n.modules.bls12381.r;const o={name:"bls12381",wasm:e,q:Ht("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),r:Ht("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),n8q:48,n8r:32,cofactorG1:Ht("0x396c8c005555e1568c00aaab0000aaab",16),cofactorG2:Ht("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5",16),singleThread:!!i},s=await uc(o);return s.terminate=async function(){o.singleThread||(globalThis.curve_bls12381=null,await this.tm.terminate())},i||(globalThis.curve_bls12381=s),s}Ht("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16);Ht("21888242871839275222246405745257275088548364400416034343698204186575808495617");Ht("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16);Ht("21888242871839275222246405745257275088696311157297823662689037894645226208583");const Rt=Pr,Jt=zl;var Ac={};async function yc(i,t,n,e){if(n=n||4096*64,typeof t!="number"&&["w+","wx+","r","ax+","a+"].indexOf(t)<0)throw new Error("Invalid open option");const o=await Ac.promises.open(i,t),s=await o.stat();return new Wl(o,s,n,e,i)}class Wl{constructor(t,n,e,o,s){for(this.fileName=s,this.fd=t,this.pos=0,this.pageSize=o||256;this.pageSize<n.blksize;)this.pageSize*=2;this.totalSize=n.size,this.totalPages=Math.floor((n.size-1)/this.pageSize)+1,this.maxPagesLoaded=Math.floor(e/this.pageSize)+1,this.pages={},this.pendingLoads=[],this.writing=!1,this.reading=!1,this.avBuffs=[],this.history={}}_loadPage(t){const n=this,e=new Promise((o,s)=>{n.pendingLoads.push({page:t,resolve:o,reject:s})});return n.__statusPage("After Load request: ",t),e}__statusPage(t,n){const e=[],o=this;if(!o.logHistory)return;e.push("=="+t+" "+n);let s="";for(let u=0;u<o.pendingLoads.length;u++)o.pendingLoads[u].page==n&&(s=s+" "+u);if(s&&e.push("Pending loads:"+s),typeof o.pages[n]<"u"){const u=o.pages[n];e.push("Loaded"),e.push("pendingOps: "+u.pendingOps),u.loading&&e.push("loading: "+u.loading),u.writing&&e.push("writing"),u.dirty&&e.push("dirty")}e.push("=="),o.history[n]||(o.history[n]=[]),o.history[n].push(e)}__printHistory(t){const n=this;n.history[t]||console.log("Empty History ",t),console.log("History "+t);for(let e=0;e<n.history[t].length;e++)for(let o=0;o<n.history[t][e].length;o++)console.log("-> "+n.history[t][e][o])}_triggerLoad(){const t=this;if(t.reading||t.pendingLoads.length==0)return;const n=Object.keys(t.pages),e=[];for(let r=0;r<n.length;r++){const b=t.pages[parseInt(n[r])];b.dirty==!1&&b.pendingOps==0&&!b.writing&&!b.loading&&e.push(parseInt(n[r]))}let o=t.maxPagesLoaded-n.length;const s=[];for(;t.pendingLoads.length>0&&(typeof t.pages[t.pendingLoads[0].page]<"u"||o>0||e.length>0);){const r=t.pendingLoads.shift();if(typeof t.pages[r.page]<"u"){t.pages[r.page].pendingOps++;const b=e.indexOf(r.page);b>=0&&e.splice(b,1),t.pages[r.page].loading?t.pages[r.page].loading.push(r):r.resolve(),t.__statusPage("After Load (cached): ",r.page)}else{if(o)o--;else{const b=e.shift();t.__statusPage("Before Unload: ",b),t.avBuffs.unshift(t.pages[b]),delete t.pages[b],t.__statusPage("After Unload: ",b)}r.page>=t.totalPages?(t.pages[r.page]=u(),r.resolve(),t.__statusPage("After Load (new): ",r.page)):(t.reading=!0,t.pages[r.page]=u(),t.pages[r.page].loading=[r],s.push(t.fd.read(t.pages[r.page].buff,0,t.pageSize,r.page*t.pageSize).then(b=>{t.pages[r.page].size=b.bytesRead;const g=t.pages[r.page].loading;delete t.pages[r.page].loading;for(let l=0;l<g.length;l++)g[l].resolve();return t.__statusPage("After Load (loaded): ",r.page),b},b=>{r.reject(b)})),t.__statusPage("After Load (loading): ",r.page))}}Promise.all(s).then(()=>{t.reading=!1,t.pendingLoads.length>0&&setImmediate(t._triggerLoad.bind(t)),t._tryClose()});function u(){if(t.avBuffs.length>0){const r=t.avBuffs.shift();return r.dirty=!1,r.pendingOps=1,r.size=0,r}else return{dirty:!1,buff:new Uint8Array(t.pageSize),pendingOps:1,size:0}}}_triggerWrite(){const t=this;if(t.writing)return;const n=Object.keys(t.pages),e=[];for(let o=0;o<n.length;o++){const s=t.pages[parseInt(n[o])];s.dirty&&(s.dirty=!1,s.writing=!0,t.writing=!0,e.push(t.fd.write(s.buff,0,s.size,parseInt(n[o])*t.pageSize).then(()=>{s.writing=!1},u=>{console.log("ERROR Writing: "+u),t.error=u,t._tryClose()})))}t.writing&&Promise.all(e).then(()=>{t.writing=!1,setImmediate(t._triggerWrite.bind(t)),t._tryClose(),t.pendingLoads.length>0&&setImmediate(t._triggerLoad.bind(t))})}_getDirtyPage(){for(let t in this.pages)if(this.pages[t].dirty)return t;return-1}async write(t,n){if(t.byteLength==0)return;const e=this;if(typeof n>"u"&&(n=e.pos),e.pos=n+t.byteLength,e.totalSize<n+t.byteLength&&(e.totalSize=n+t.byteLength),e.pendingClose)throw new Error("Writing a closing file");const o=Math.floor(n/e.pageSize),s=Math.floor((n+t.byteLength-1)/e.pageSize),u=[];for(let l=o;l<=s;l++)u.push(e._loadPage(l));e._triggerLoad();let r=o,b=n%e.pageSize,g=t.byteLength;for(;g>0;){await u[r-o];const l=b+g>e.pageSize?e.pageSize-b:g,x=t.slice(t.byteLength-g,t.byteLength-g+l);new Uint8Array(e.pages[r].buff.buffer,b,l).set(x),e.pages[r].dirty=!0,e.pages[r].pendingOps--,e.pages[r].size=Math.max(b+l,e.pages[r].size),r>=e.totalPages&&(e.totalPages=r+1),g=g-l,r++,b=0,e.writing||setImmediate(e._triggerWrite.bind(e))}}async read(t,n){const e=this;let o=new Uint8Array(t);return await e.readToBuffer(o,0,t,n),o}async readToBuffer(t,n,e,o){if(e==0)return;const s=this;if(e>s.pageSize*s.maxPagesLoaded*.8){const F=Math.floor(e*1.1);this.maxPagesLoaded=Math.floor(F/s.pageSize)+1}if(typeof o>"u"&&(o=s.pos),s.pos=o+e,s.pendingClose)throw new Error("Reading a closing file");const u=Math.floor(o/s.pageSize),r=Math.floor((o+e-1)/s.pageSize),b=[];for(let F=u;F<=r;F++)b.push(s._loadPage(F));s._triggerLoad();let g=u,l=o%s.pageSize,x=o+e>s.totalSize?e-(o+e-s.totalSize):e;for(;x>0;){await b[g-u],s.__statusPage("After Await (read): ",g);const F=l+x>s.pageSize?s.pageSize-l:x,I=new Uint8Array(s.pages[g].buff.buffer,s.pages[g].buff.byteOffset+l,F);t.set(I,n+e-x),s.pages[g].pendingOps--,s.__statusPage("After Op done: ",g),x=x-F,g++,l=0,s.pendingLoads.length>0&&setImmediate(s._triggerLoad.bind(s))}this.pos=o+e}_tryClose(){const t=this;!t.pendingClose||(t.error&&t.pendingCloseReject(t.error),t._getDirtyPage()>=0||t.writing||t.reading||t.pendingLoads.length>0)||t.pendingClose()}close(){const t=this;if(t.pendingClose)throw new Error("Closing the file twice");return new Promise((n,e)=>{t.pendingClose=n,t.pendingCloseReject=e,t._tryClose()}).then(()=>{t.fd.close()},n=>{throw t.fd.close(),n})}async discard(){await this.close(),await Ac.promises.unlink(this.fileName)}async writeULE32(t,n){const e=this,o=new Uint8Array(4);new DataView(o.buffer).setUint32(0,t,!0),await e.write(o,n)}async writeUBE32(t,n){const e=this,o=new Uint8Array(4);new DataView(o.buffer).setUint32(0,t,!1),await e.write(o,n)}async writeULE64(t,n){const e=this,o=new Uint8Array(8),s=new DataView(o.buffer);s.setUint32(0,t&4294967295,!0),s.setUint32(4,Math.floor(t/4294967296),!0),await e.write(o,n)}async readULE32(t){const e=await this.read(4,t);return new Uint32Array(e.buffer)[0]}async readUBE32(t){const e=await this.read(4,t);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(t){const e=await this.read(8,t),o=new Uint32Array(e.buffer);return o[1]*4294967296+o[0]}async readString(t){const n=this;if(n.pendingClose)throw new Error("Reading a closing file");let e=typeof t>"u"?n.pos:t,o=Math.floor(e/n.pageSize),s=!1,u="";for(;!s;){let r=n._loadPage(o);n._triggerLoad(),await r,n.__statusPage("After Await (read): ",o);let b=e%n.pageSize;const g=new Uint8Array(n.pages[o].buff.buffer,n.pages[o].buff.byteOffset+b,n.pageSize-b);let l=g.findIndex(x=>x===0);s=l!==-1,s?(u+=new TextDecoder().decode(g.slice(0,l)),n.pos=o*this.pageSize+b+l+1):(u+=new TextDecoder().decode(g),n.pos=o*this.pageSize+b+g.length),n.pages[o].pendingOps--,n.__statusPage("After Op done: ",o),e=n.pos,o++,n.pendingLoads.length>0&&setImmediate(n._triggerLoad.bind(n))}return u}}function $l(i){const t=i.initialSize||1048576,n=new bc;return n.o=i,n.o.data=new Uint8Array(t),n.allocSize=t,n.totalSize=0,n.readOnly=!1,n.pos=0,n}function t2(i){const t=new bc;return t.o=i,t.allocSize=i.data.byteLength,t.totalSize=i.data.byteLength,t.readOnly=!0,t.pos=0,t}const hi=new Uint8Array(4),Qo=new DataView(hi.buffer),Ic=new Uint8Array(8),vo=new DataView(Ic.buffer);class bc{constructor(){this.pageSize=16384}_resizeIfNeeded(t){if(t>this.allocSize){const n=Math.max(this.allocSize+1048576,Math.floor(this.allocSize*1.1),t),e=new Uint8Array(n);e.set(this.o.data),this.o.data=e,this.allocSize=n}}async write(t,n){if(typeof n>"u"&&(n=this.pos),this.readOnly)throw new Error("Writing a read only file");this._resizeIfNeeded(n+t.byteLength),this.o.data.set(t.slice(),n),n+t.byteLength>this.totalSize&&(this.totalSize=n+t.byteLength),this.pos=n+t.byteLength}async readToBuffer(t,n,e,o){if(typeof o>"u"&&(o=this.pos),this.readOnly&&o+e>this.totalSize)throw new Error("Reading out of bounds");this._resizeIfNeeded(o+e);const u=new Uint8Array(this.o.data.buffer,this.o.data.byteOffset+o,e);t.set(u,n),this.pos=o+e}async read(t,n){const e=this,o=new Uint8Array(t);return await e.readToBuffer(o,0,t,n),o}close(){this.o.data.byteLength!=this.totalSize&&(this.o.data=this.o.data.slice(0,this.totalSize))}async discard(){}async writeULE32(t,n){const e=this;Qo.setUint32(0,t,!0),await e.write(hi,n)}async writeUBE32(t,n){const e=this;Qo.setUint32(0,t,!1),await e.write(hi,n)}async writeULE64(t,n){const e=this;vo.setUint32(0,t&4294967295,!0),vo.setUint32(4,Math.floor(t/4294967296),!0),await e.write(Ic,n)}async readULE32(t){const e=await this.read(4,t);return new Uint32Array(e.buffer)[0]}async readUBE32(t){const e=await this.read(4,t);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(t){const e=await this.read(8,t),o=new Uint32Array(e.buffer);return o[1]*4294967296+o[0]}async readString(t){const n=this;let e=typeof t>"u"?n.pos:t;if(e>this.totalSize){if(this.readOnly)throw new Error("Reading out of bounds");this._resizeIfNeeded(t)}const o=new Uint8Array(n.o.data.buffer,e,this.totalSize-e);let s=o.findIndex(b=>b===0),u=s!==-1,r="";return u?(r=new TextDecoder().decode(o.slice(0,s)),n.pos=e+s+1):n.pos=e,r}}const Vt=1<<22;function n2(i){const t=i.initialSize||0,n=new mc;n.o=i;const e=t?Math.floor((t-1)/Vt)+1:0;n.o.data=[];for(let o=0;o<e-1;o++)n.o.data.push(new Uint8Array(Vt));return e&&n.o.data.push(new Uint8Array(t-Vt*(e-1))),n.totalSize=0,n.readOnly=!1,n.pos=0,n}function e2(i){const t=new mc;return t.o=i,t.totalSize=(i.data.length-1)*Vt+i.data[i.data.length-1].byteLength,t.readOnly=!0,t.pos=0,t}const _i=new Uint8Array(4),qo=new DataView(_i.buffer),Cc=new Uint8Array(8),To=new DataView(Cc.buffer);class mc{constructor(){this.pageSize=16384}_resizeIfNeeded(t){if(t<=this.totalSize)return;if(this.readOnly)throw new Error("Reading out of file bounds");const n=Math.floor((t-1)/Vt)+1;for(let e=Math.max(this.o.data.length-1,0);e<n;e++){const o=e<n-1?Vt:t-(n-1)*Vt,s=new Uint8Array(o);e==this.o.data.length-1&&s.set(this.o.data[e]),this.o.data[e]=s}this.totalSize=t}async write(t,n){const e=this;if(typeof n>"u"&&(n=e.pos),this.readOnly)throw new Error("Writing a read only file");this._resizeIfNeeded(n+t.byteLength);let s=Math.floor(n/Vt),u=n%Vt,r=t.byteLength;for(;r>0;){const b=u+r>Vt?Vt-u:r,g=t.slice(t.byteLength-r,t.byteLength-r+b);new Uint8Array(e.o.data[s].buffer,u,b).set(g),r=r-b,s++,u=0}this.pos=n+t.byteLength}async readToBuffer(t,n,e,o){const s=this;if(typeof o>"u"&&(o=s.pos),this.readOnly&&o+e>this.totalSize)throw new Error("Reading out of bounds");this._resizeIfNeeded(o+e);let r=Math.floor(o/Vt),b=o%Vt,g=e;for(;g>0;){const l=b+g>Vt?Vt-b:g,x=new Uint8Array(s.o.data[r].buffer,b,l);t.set(x,n+e-g),g=g-l,r++,b=0}this.pos=o+e}async read(t,n){const e=this,o=new Uint8Array(t);return await e.readToBuffer(o,0,t,n),o}close(){}async discard(){}async writeULE32(t,n){const e=this;qo.setUint32(0,t,!0),await e.write(_i,n)}async writeUBE32(t,n){const e=this;qo.setUint32(0,t,!1),await e.write(_i,n)}async writeULE64(t,n){const e=this;To.setUint32(0,t&4294967295,!0),To.setUint32(4,Math.floor(t/4294967296),!0),await e.write(Cc,n)}async readULE32(t){const e=await this.read(4,t);return new Uint32Array(e.buffer)[0]}async readUBE32(t){const e=await this.read(4,t);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(t){const e=await this.read(8,t),o=new Uint32Array(e.buffer);return o[1]*4294967296+o[0]}async readString(t){const n=this,e=2048;let o=typeof t>"u"?n.pos:t;if(o>this.totalSize){if(this.readOnly)throw new Error("Reading out of bounds");this._resizeIfNeeded(t)}let s=!1,u="";for(;!s;){let r=Math.floor(o/Vt),b=o%Vt;if(n.o.data[r]===void 0)throw new Error("ERROR");let g=Math.min(e,n.o.data[r].length-b);const l=new Uint8Array(n.o.data[r].buffer,b,g);let x=l.findIndex(F=>F===0);s=x!==-1,s?(u+=new TextDecoder().decode(l.slice(0,x)),n.pos=r*Vt+b+x+1):(u+=new TextDecoder().decode(l),n.pos=r*Vt+b+l.length),o=n.pos}return u}}const i2=1024,o2=512,a2=2,c2=0,s2=65536,r2=8192;async function wc(i,t,n){if(typeof i=="string"&&(i={type:"file",fileName:i,cacheSize:s2,pageSize:r2}),i.type=="file")return await yc(i.fileName,i2|o2|a2,i.cacheSize,i.pageSize);if(i.type=="mem")return $l(i);if(i.type=="bigMem")return n2(i);throw new Error("Invalid FastFile type: "+i.type)}async function Bc(i,t,n){if(i instanceof Uint8Array&&(i={type:"mem",data:i}),typeof i=="string"&&(i={type:"mem",data:await fetch(i).then(function(o){return o.arrayBuffer()}).then(function(o){return new Uint8Array(o)})}),i.type=="file")return await yc(i.fileName,c2,i.cacheSize,i.pageSize);if(i.type=="mem")return await t2(i);if(i.type=="bigMem")return await e2(i);throw new Error("Invalid FastFile type: "+i.type)}async function ko(i,t,n,e,o){const s=await Bc(i),u=await s.read(4);let r="";for(let x=0;x<4;x++)r+=String.fromCharCode(u[x]);if(r!=t)throw new Error(i+": Invalid File format");if(await s.readULE32()>n)throw new Error("Version not supported");const g=await s.readULE32();let l=[];for(let x=0;x<g;x++){let F=await s.readULE32(),I=await s.readULE64();typeof l[F]>"u"&&(l[F]=[]),l[F].push({p:s.pos,size:I}),s.pos+=I}return{fd:s,sections:l}}async function l2(i,t,n,e,o,s){const u=await wc(i),r=new Uint8Array(4);for(let b=0;b<4;b++)r[b]=t.charCodeAt(b);return await u.write(r,0),await u.writeULE32(n),await u.writeULE32(e),u}async function Do(i,t){if(typeof i.writingSection<"u")throw new Error("Already writing a section");await i.writeULE32(t),i.writingSection={pSectionSize:i.pos},await i.writeULE64(0)}async function zo(i){if(typeof i.writingSection>"u")throw new Error("Not writing a section");const t=i.pos-i.writingSection.pSectionSize-8,n=i.pos;i.pos=i.writingSection.pSectionSize,await i.writeULE64(t),i.pos=n,delete i.writingSection}async function re(i,t,n){if(typeof i.readingSection<"u")throw new Error("Already reading a section");if(!t[n])throw new Error(i.fileName+": Missing section "+n);if(t[n].length>1)throw new Error(i.fileName+": Section Duplicated "+n);i.pos=t[n][0].p,i.readingSection=t[n][0]}async function le(i,t){if(typeof i.readingSection>"u")throw new Error("Not reading a section");if(i.pos-i.readingSection.p!=i.readingSection.size)throw new Error("Invalid section size reading");delete i.readingSection}async function d2(i,t,n,e){const o=new Uint8Array(n);Rt.toRprLE(o,0,t,n),await i.write(o,e)}async function Fn(i,t,n){const e=await i.read(t,n);return Rt.fromRprLE(e,0,t)}async function wn(i,t,n,e,o){if(e=typeof e>"u"?0:e,o=typeof o>"u"?t[n][0].size-e:o,e+o>t[n][0].size)throw new Error("Reading out of the range of the section");let s;return o<1<<30?s=new Uint8Array(o):s=new Dt(o),await i.readToBuffer(s,0,o,t[n][0].p+e),s}Rt.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16);Rt.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");const u2=Rt.e("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),f2=Rt.e("21888242871839275222246405745257275088696311157297823662689037894645226208583");async function ji(i,t){let n,e=t&&t.singleThread;if(Rt.eq(i,f2))n=await pc(e);else if(Rt.eq(i,u2))n=await Lc(e);else throw new Error(`Curve not supported: ${Rt.toString(i)}`);return n}async function g2(i,t){let n,e=t&&t.singleThread;const o=s(i);if(["BN128","BN254","ALTBN128"].indexOf(o)>=0)n=await pc(e);else if(["BLS12381"].indexOf(o)>=0)n=await Lc(e);else throw new Error(`Curve not supported: ${i}`);return n;function s(u){return u.toUpperCase().match(/[A-Za-z0-9]+/g).join("")}}var h2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},gn={exports:{}},_2=xc;class Ec extends Error{}Ec.prototype.name="AssertionError";function xc(i,t){if(!i){var n=new Ec(t);throw Error.captureStackTrace&&Error.captureStackTrace(n,xc),n}}var pi={exports:{}};function Fc(i){return i.length}function p2(i){const t=i.byteLength;let n="";for(let e=0;e<t;e++)n+=String.fromCharCode(i[e]);return n}function L2(i,t,n=0,e=Fc(t)){const o=Math.min(e,i.byteLength-n);for(let s=0;s<o;s++)i[n+s]=t.charCodeAt(s);return o}var A2={byteLength:Fc,toString:p2,write:L2};const Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xn=new Uint8Array(256);for(let i=0;i<Pn.length;i++)xn[Pn.charCodeAt(i)]=i;xn[45]=62;xn[95]=63;function Sc(i){let t=i.length;return i.charCodeAt(t-1)===61&&t--,t>1&&i.charCodeAt(t-1)===61&&t--,t*3>>>2}function y2(i){const t=i.byteLength;let n="";for(let e=0;e<t;e+=3)n+=Pn[i[e]>>2]+Pn[(i[e]&3)<<4|i[e+1]>>4]+Pn[(i[e+1]&15)<<2|i[e+2]>>6]+Pn[i[e+2]&63];return t%3===2?n=n.substring(0,n.length-1)+"=":t%3===1&&(n=n.substring(0,n.length-2)+"=="),n}function I2(i,t,n=0,e=Sc(t)){const o=Math.min(e,i.byteLength-n);for(let s=0,u=0;u<o;s+=4){const r=xn[t.charCodeAt(s)],b=xn[t.charCodeAt(s+1)],g=xn[t.charCodeAt(s+2)],l=xn[t.charCodeAt(s+3)];i[u++]=r<<2|b>>4,i[u++]=(b&15)<<4|g>>2,i[u++]=(g&3)<<6|l&63}return o}var b2={byteLength:Sc,toString:y2,write:I2};function Uc(i){return i.length>>>1}function C2(i){const t=i.byteLength;i=new DataView(i.buffer,i.byteOffset,t);let n="",e=0;for(let o=t-t%4;e<o;e+=4)n+=i.getUint32(e).toString(16).padStart(8,"0");for(;e<t;e++)n+=i.getUint8(e).toString(16).padStart(2,"0");return n}function m2(i,t,n=0,e=Uc(t)){const o=Math.min(e,i.byteLength-n);for(let s=0;s<o;s++){const u=Ro(t.charCodeAt(s*2)),r=Ro(t.charCodeAt(s*2+1));if(u===void 0||r===void 0)return i.subarray(0,s);i[n+s]=u<<4|r}return o}var w2={byteLength:Uc,toString:C2,write:m2};function Ro(i){if(i>=48&&i<=57)return i-48;if(i>=65&&i<=70)return i-65+10;if(i>=97&&i<=102)return i-97+10}function Li(i){let t=0;for(let n=0,e=i.length;n<e;n++){const o=i.charCodeAt(n);if(o>=55296&&o<=56319&&n+1<e){const s=i.charCodeAt(n+1);if(s>=56320&&s<=57343){t+=4,n++;continue}}o<=127?t+=1:o<=2047?t+=2:t+=3}return t}let Ai;if(typeof TextDecoder<"u"){const i=new TextDecoder;Ai=function(n){return i.decode(n)}}else Ai=function(t){const n=t.byteLength;let e="",o=0;for(;o<n;){let s=t[o];if(s<=127){e+=String.fromCharCode(s),o++;continue}let u=0,r=0;if(s<=223?(u=1,r=s&31):s<=239?(u=2,r=s&15):s<=244&&(u=3,r=s&7),n-o-u>0){let b=0;for(;b<u;)s=t[o+b+1],r=r<<6|s&63,b+=1}else r=65533,u=n-o;e+=String.fromCodePoint(r),o+=u+1}return e};let yi;if(typeof TextEncoder<"u"){const i=new TextEncoder;yi=function(n,e,o=0,s=Li(e)){const u=Math.min(s,n.byteLength-o);return i.encodeInto(e,n.subarray(o,o+u)),u}}else yi=function(t,n,e=0,o=Li(n)){const s=Math.min(o,t.byteLength-e);t=t.subarray(e,e+s);let u=0,r=0;for(;u<n.length;){const b=n.codePointAt(u);if(b<=127){t[r++]=b,u++;continue}let g=0,l=0;for(b<=2047?(g=6,l=192):b<=65535?(g=12,l=224):b<=2097151&&(g=18,l=240),t[r++]=l|b>>g,g-=6;g>=0;)t[r++]=128|b>>g&63,g-=6;u+=b>=65536?2:1}return s};var B2={byteLength:Li,toString:Ai,write:yi};function Oc(i){return i.length*2}function E2(i){const t=i.byteLength;let n="";for(let e=0;e<t-1;e+=2)n+=String.fromCharCode(i[e]+i[e+1]*256);return n}function x2(i,t,n=0,e=Oc(t)){const o=Math.min(e,i.byteLength-n);let s=o;for(let u=0;u<t.length&&!((s-=2)<0);++u){const r=t.charCodeAt(u),b=r>>8,g=r%256;i[n+u*2]=g,i[n+u*2+1]=b}return o}var F2={byteLength:Oc,toString:E2,write:x2};(function(i,t){const n=A2,e=b2,o=w2,s=B2,u=F2,r=new Uint8Array(Uint16Array.of(255).buffer)[0]===255;function b(c){switch(c){case"ascii":return n;case"base64":return e;case"hex":return o;case"utf8":case"utf-8":case void 0:return s;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u;default:throw new Error(`Unknown encoding: ${c}`)}}function g(c){return c instanceof Uint8Array}function l(c){try{return b(c),!0}catch{return!1}}function x(c,E,m){const _=new Uint8Array(c);return E!==void 0&&t.fill(_,E,0,_.byteLength,m),_}function F(c){return new Uint8Array(c)}function I(c){return new Uint8Array(c)}function k(c,E){return b(E).byteLength(c)}function z(c,E){if(c===E)return 0;const m=Math.min(c.byteLength,E.byteLength);c=new DataView(c.buffer,c.byteOffset,c.byteLength),E=new DataView(E.buffer,E.byteOffset,E.byteLength);let _=0;for(let Q=m-m%4;_<Q;_+=4){const nt=c.getUint32(_,r),X=E.getUint32(_,r);if(nt!==X)break}for(;_<m;_++){const Q=c.getUint8(_),nt=E.getUint8(_);if(Q<nt)return-1;if(Q>nt)return 1}return c.byteLength>E.byteLength?1:c.byteLength<E.byteLength?-1:0}function S(c,E){E===void 0&&(E=c.reduce((Q,nt)=>Q+nt.byteLength,0));const m=new Uint8Array(E);let _=0;for(const Q of c){if(_+Q.byteLength>m.byteLength){const nt=Q.subarray(0,m.byteLength-_);return m.set(nt,_),m}m.set(Q,_),_+=Q.byteLength}return m}function G(c,E,m=0,_=0,Q=c.byteLength){if(Q>0&&Q<_||Q===_||c.byteLength===0||E.byteLength===0)return 0;if(m<0)throw new RangeError("targetStart is out of range");if(_<0||_>=c.byteLength)throw new RangeError("sourceStart is out of range");if(Q<0)throw new RangeError("sourceEnd is out of range");m>=E.byteLength&&(m=E.byteLength),Q>c.byteLength&&(Q=c.byteLength),E.byteLength-m<Q-_&&(Q=E.length-m+_);const nt=Q-_;return c===E?E.copyWithin(m,_,Q):E.set(c.subarray(_,Q),m),nt}function U(c,E){if(c===E)return!0;if(c.byteLength!==E.byteLength)return!1;const m=c.byteLength;c=new DataView(c.buffer,c.byteOffset,c.byteLength),E=new DataView(E.buffer,E.byteOffset,E.byteLength);let _=0;for(let Q=m-m%4;_<Q;_+=4)if(c.getUint32(_,r)!==E.getUint32(_,r))return!1;for(;_<m;_++)if(c.getUint8(_)!==E.getUint8(_))return!1;return!0}function rt(c,E,m,_,Q){if(typeof E=="string"?typeof m=="string"?(Q=m,m=0,_=c.byteLength):typeof _=="string"&&(Q=_,_=c.byteLength):typeof E=="number"?E=E&255:typeof E=="boolean"&&(E=+E),m<0||c.byteLength<m||c.byteLength<_)throw new RangeError("Out of range index");if(m===void 0&&(m=0),_===void 0&&(_=c.byteLength),_<=m)return c;if(E||(E=0),typeof E=="number")for(let nt=m;nt<_;++nt)c[nt]=E;else{E=g(E)?E:H(E,Q);const nt=E.byteLength;for(let X=0;X<_-m;++X)c[X+m]=E[X%nt]}return c}function H(c,E,m){return typeof c=="string"?lt(c,E):Array.isArray(c)?O(c):ArrayBuffer.isView(c)?h(c):A(c,E,m)}function lt(c,E){const m=b(E),_=new Uint8Array(m.byteLength(c));return m.write(_,c,0,_.byteLength),_}function O(c){const E=new Uint8Array(c.length);return E.set(c),E}function h(c){const E=new Uint8Array(c.byteLength);return E.set(c),E}function A(c,E,m){return new Uint8Array(c,E,m)}function Z(c,E,m,_){return at(c,E,m,_)!==-1}function tt(c,E,m,_,Q){if(c.byteLength===0)return-1;if(typeof m=="string"?(_=m,m=0):m===void 0?m=Q?0:c.length-1:m<0&&(m+=c.byteLength),m>=c.byteLength){if(Q)return-1;m=c.byteLength-1}else if(m<0)if(Q)m=0;else return-1;if(typeof E=="string")E=H(E,_);else if(typeof E=="number")return E=E&255,Q?c.indexOf(E,m):c.lastIndexOf(E,m);if(E.byteLength===0)return-1;if(Q){let nt=-1;for(let X=m;X<c.byteLength;X++)if(c[X]===E[nt===-1?0:X-nt]){if(nt===-1&&(nt=X),X-nt+1===E.byteLength)return nt}else nt!==-1&&(X-=X-nt),nt=-1}else{m+E.byteLength>c.byteLength&&(m=c.byteLength-E.byteLength);for(let nt=m;nt>=0;nt--){let X=!0;for(let ft=0;ft<E.byteLength;ft++)if(c[nt+ft]!==E[ft]){X=!1;break}if(X)return nt}}return-1}function at(c,E,m,_){return tt(c,E,m,_,!0)}function R(c,E,m,_){return tt(c,E,m,_,!1)}function C(c,E,m){const _=c[E];c[E]=c[m],c[m]=_}function T(c){const E=c.byteLength;if(E%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let m=0;m<E;m+=2)C(c,m,m+1);return c}function V(c){const E=c.byteLength;if(E%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let m=0;m<E;m+=4)C(c,m,m+3),C(c,m+1,m+2);return c}function ut(c){const E=c.byteLength;if(E%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let m=0;m<E;m+=8)C(c,m,m+7),C(c,m+1,m+6),C(c,m+2,m+5),C(c,m+3,m+4);return c}function ct(c){return c}function J(c,E,m=0,_=c.byteLength){const Q=c.byteLength;return m>=Q||_<=m?"":(m<0&&(m=0),_>Q&&(_=Q),(m!==0||_<Q)&&(c=c.subarray(m,_)),b(E).toString(c))}function gt(c,E,m,_,Q){return m===void 0?Q="utf8":_===void 0&&typeof m=="string"?(Q=m,m=void 0):Q===void 0&&typeof _=="string"&&(Q=_,_=void 0),b(Q).write(c,E,m,_)}function et(c,E,m){return m===void 0&&(m=0),new DataView(c.buffer,c.byteOffset,c.byteLength).setFloat64(m,E,!0),m+8}function st(c,E,m){return m===void 0&&(m=0),new DataView(c.buffer,c.byteOffset,c.byteLength).setFloat32(m,E,!0),m+4}function Lt(c,E,m){return m===void 0&&(m=0),new DataView(c.buffer,c.byteOffset,c.byteLength).setUint32(m,E,!0),m+4}function Ut(c,E,m){return m===void 0&&(m=0),new DataView(c.buffer,c.byteOffset,c.byteLength).setInt32(m,E,!0),m+4}function mt(c,E){return E===void 0&&(E=0),new DataView(c.buffer,c.byteOffset,c.byteLength).getFloat64(E,!0)}function L(c,E){return E===void 0&&(E=0),new DataView(c.buffer,c.byteOffset,c.byteLength).getFloat32(E,!0)}function a(c,E){return E===void 0&&(E=0),new DataView(c.buffer,c.byteOffset,c.byteLength).getUint32(E,!0)}function w(c,E){return E===void 0&&(E=0),new DataView(c.buffer,c.byteOffset,c.byteLength).getInt32(E,!0)}i.exports=t={isBuffer:g,isEncoding:l,alloc:x,allocUnsafe:F,allocUnsafeSlow:I,byteLength:k,compare:z,concat:S,copy:G,equals:U,fill:rt,from:H,includes:Z,indexOf:at,lastIndexOf:R,swap16:T,swap32:V,swap64:ut,toBuffer:ct,toString:J,write:gt,writeDoubleLE:et,writeFloatLE:st,writeUInt32LE:Lt,writeInt32LE:Ut,readDoubleLE:mt,readFloatLE:L,readUInt32LE:a,readInt32LE:w}})(pi,pi.exports);var $e,Go;function S2(){if(Go)return $e;Go=1;var i=(s,u)=>function(){return u||(0,s[Object.keys(s)[0]])((u={exports:{}}).exports,u),u.exports},t=(()=>{for(var s=new Uint8Array(128),u=0;u<64;u++)s[u<26?u+65:u<52?u+71:u<62?u-4:u*4-205]=u;return r=>{for(var b=r.length,g=new Uint8Array((b-(r[b-1]=="=")-(r[b-2]=="="))*3/4|0),l=0,x=0;l<b;){var F=s[r.charCodeAt(l++)],I=s[r.charCodeAt(l++)],k=s[r.charCodeAt(l++)],z=s[r.charCodeAt(l++)];g[x++]=F<<2|I>>4,g[x++]=I<<4|k>>2,g[x++]=k<<6|z}return g}})(),n=i({"wasm-binary:./blake2b.wat"(s,u){u.exports=t("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMKvz8EwAIAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCAAQgA3AyAgAEIANwMoIABCADcDMCAAQgA3AzggAEIANwNAIABCADcDSCAAQgA3A1AgAEIANwNYIABCADcDYCAAQgA3A2ggAEIANwNwIABCADcDeCAAQoiS853/zPmE6gBBACkDAIU3A4ABIABCu86qptjQ67O7f0EIKQMAhTcDiAEgAEKr8NP0r+68tzxBECkDAIU3A5ABIABC8e30+KWn/aelf0EYK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fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgISAhKQMAIAEgCYWFNwMAICIgIikDACACIAqFhTcDACAjICMpAwAgAyALhYU3AwAgJCAkKQMAIAQgDIWFNwMAICUgJSkDACAFIA2FhTcDACAmICYpAwAgBiAOhYU3AwAgJyAnKQMAIAcgD4WFNwMAICggKCkDACAIIBCFhTcDAAs=")}}),e=n(),o=WebAssembly.compile(e);return $e=async s=>(await WebAssembly.instantiate(await o,s)).exports,$e}var nn=_2,U2=pi.exports,fn=null,No=typeof WebAssembly<"u"&&S2()().then(i=>{fn=i}),dn=64,Ce=[];gn.exports=Zt;var Ko=gn.exports.BYTES_MIN=16,Ho=gn.exports.BYTES_MAX=64;gn.exports.BYTES=32;var Vo=gn.exports.KEYBYTES_MIN=16,jo=gn.exports.KEYBYTES_MAX=64;gn.exports.KEYBYTES=32;var Yo=gn.exports.SALTBYTES=16,Xo=gn.exports.PERSONALBYTES=16;function Zt(i,t,n,e,o){if(!(this instanceof Zt))return new Zt(i,t,n,e,o);if(!fn)throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");i||(i=32),o!==!0&&(nn(i>=Ko,"digestLength must be at least "+Ko+", was given "+i),nn(i<=Ho,"digestLength must be at most "+Ho+", was given "+i),t!=null&&(nn(t instanceof Uint8Array,"key must be Uint8Array or Buffer"),nn(t.length>=Vo,"key must be at least "+Vo+", was given "+t.length),nn(t.length<=jo,"key must be at least "+jo+", was given "+t.length)),n!=null&&(nn(n instanceof Uint8Array,"salt must be Uint8Array or Buffer"),nn(n.length===Yo,"salt must be exactly "+Yo+", was given "+n.length)),e!=null&&(nn(e instanceof Uint8Array,"personal must be Uint8Array or Buffer"),nn(e.length===Xo,"personal must be exactly "+Xo+", was given "+e.length))),Ce.length||(Ce.push(dn),dn+=216),this.digestLength=i,this.finalized=!1,this.pointer=Ce.pop(),this._memory=new Uint8Array(fn.memory.buffer),this._memory.fill(0,0,64),this._memory[0]=this.digestLength,this._memory[1]=t?t.length:0,this._memory[2]=1,this._memory[3]=1,n&&this._memory.set(n,32),e&&this._memory.set(e,48),this.pointer+216>this._memory.length&&this._realloc(this.pointer+216),fn.blake2b_init(this.pointer,this.digestLength),t&&(this.update(t),this._memory.fill(0,dn,dn+t.length),this._memory[this.pointer+200]=128)}Zt.prototype._realloc=function(i){fn.memory.grow(Math.max(0,Math.ceil(Math.abs(i-this._memory.length)/65536))),this._memory=new Uint8Array(fn.memory.buffer)};Zt.prototype.update=function(i){return nn(this.finalized===!1,"Hash instance finalized"),nn(i instanceof Uint8Array,"input must be Uint8Array or Buffer"),dn+i.length>this._memory.length&&this._realloc(dn+i.length),this._memory.set(i,dn),fn.blake2b_update(this.pointer,dn,dn+i.length),this};Zt.prototype.digest=function(i){if(nn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Ce.push(this.pointer),fn.blake2b_final(this.pointer),!i||i==="binary")return this._memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(typeof i=="string")return U2.toString(this._memory,i,this.pointer+128,this.pointer+128+this.digestLength);nn(i instanceof Uint8Array&&i.length>=this.digestLength,"input must be Uint8Array or Buffer");for(var t=0;t<this.digestLength;t++)i[t]=this._memory[this.pointer+128+t];return i};Zt.prototype.final=Zt.prototype.digest;Zt.WASM=fn;Zt.SUPPORTED=typeof WebAssembly<"u";Zt.ready=function(i){return i||(i=O2),No?No.then(()=>i(),i):i(new Error("WebAssembly not supported"))};Zt.prototype.ready=Zt.ready;Zt.prototype.getPartialHash=function(){return this._memory.slice(this.pointer,this.pointer+216)};Zt.prototype.setPartialHash=function(i){this._memory.set(i,this.pointer)};function O2(){}function ve(i){return((i&4294901760)!==0?(i&=4294901760,16):0)|((i&4278255360)!==0?(i&=4278255360,8):0)|((i&4042322160)!==0?(i&=4042322160,4):0)|((i&3435973836)!==0?(i&=3435973836,2):0)|(i&2863311530)!==0}const M2=1,P2=2,Mc=10,Q2=2;async function en(i,t,n){const e=await i.read(t.G1.F.n8*2),o=t.G1.fromRprLEM(e,0);return n?t.G1.toObject(o):o}async function Wn(i,t,n){const e=await i.read(t.G2.F.n8*2),o=t.G2.fromRprLEM(e,0);return n?t.G2.toObject(o):o}async function v2(i,t,n,e){await re(i,t,1);const o=await i.readULE32();if(await le(i),o===M2)return await q2(i,t,n,e);if(o===P2)return await T2(i,t,n,e);if(o===Mc)return await k2(i,t,n,e);throw new Error("Protocol not supported: ")}async function q2(i,t,n,e){const o={};o.protocol="groth16",await re(i,t,2);const s=await i.readULE32();o.n8q=s,o.q=await Fn(i,s);const u=await i.readULE32();return o.n8r=u,o.r=await Fn(i,u),o.curve=await ji(o.q,e),o.nVars=await i.readULE32(),o.nPublic=await i.readULE32(),o.domainSize=await i.readULE32(),o.power=ve(o.domainSize),o.vk_alpha_1=await en(i,o.curve,n),o.vk_beta_1=await en(i,o.curve,n),o.vk_beta_2=await Wn(i,o.curve,n),o.vk_gamma_2=await Wn(i,o.curve,n),o.vk_delta_1=await en(i,o.curve,n),o.vk_delta_2=await Wn(i,o.curve,n),await le(i),o}async function T2(i,t,n,e){const o={};o.protocol="plonk",await re(i,t,2);const s=await i.readULE32();o.n8q=s,o.q=await Fn(i,s);const u=await i.readULE32();return o.n8r=u,o.r=await Fn(i,u),o.curve=await ji(o.q,e),o.nVars=await i.readULE32(),o.nPublic=await i.readULE32(),o.domainSize=await i.readULE32(),o.power=ve(o.domainSize),o.nAdditions=await i.readULE32(),o.nConstraints=await i.readULE32(),o.k1=await i.read(u),o.k2=await i.read(u),o.Qm=await en(i,o.curve,n),o.Ql=await en(i,o.curve,n),o.Qr=await en(i,o.curve,n),o.Qo=await en(i,o.curve,n),o.Qc=await en(i,o.curve,n),o.S1=await en(i,o.curve,n),o.S2=await en(i,o.curve,n),o.S3=await en(i,o.curve,n),o.X_2=await Wn(i,o.curve,n),await le(i),o}async function k2(i,t,n,e){const o={};o.protocol="fflonk",o.protocolId=Mc,await re(i,t,Q2);const s=await i.readULE32();o.n8q=s,o.q=await Fn(i,s),o.curve=await ji(o.q,e);const u=await i.readULE32();return o.n8r=u,o.r=await Fn(i,u),o.nVars=await i.readULE32(),o.nPublic=await i.readULE32(),o.domainSize=await i.readULE32(),o.power=ve(o.domainSize),o.nAdditions=await i.readULE32(),o.nConstraints=await i.readULE32(),o.k1=await i.read(u),o.k2=await i.read(u),o.w3=await i.read(u),o.w4=await i.read(u),o.w8=await i.read(u),o.wr=await i.read(u),o.X_2=await Wn(i,o.curve,n),o.C0=await en(i,o.curve,n),await le(i),o}async function D2(i,t,n){await Do(i,1);const e=(Math.floor((Rt.bitLength(n)-1)/64)+1)*8;if(await i.writeULE32(e),await d2(i,n,e),t.byteLength%e!=0)throw new Error("Invalid witness length");await i.writeULE32(t.byteLength/e),await zo(i),await Do(i,2),await i.write(t),await zo(i)}async function z2(i,t){await re(i,t,1);const n=await i.readULE32(),e=await Fn(i,n),o=await i.readULE32();return await le(i),{n8:n,q:e,nWitness:o}}const{stringifyBigInts:Jo}=Jt;async function Pc(i,t,n,e){const{fd:o,sections:s}=await ko(t,"wtns",2),u=await z2(o,s),{fd:r,sections:b}=await ko(i,"zkey",2),g=await v2(r,b,void 0,e);if(g.protocol!="groth16")throw new Error("zkey file is not groth16");if(!Rt.eq(g.r,u.q))throw new Error("Curve of the witness does not match the curve of the proving key");if(u.nWitness!=g.nVars)throw new Error(`Invalid witness length. Circuit: ${g.nVars}, witness: ${u.nWitness}`);const l=g.curve,x=l.Fr,F=l.G1,I=l.G2,k=ve(g.domainSize);n&&n.debug("Reading Wtns");const z=await wn(o,s,2);n&&n.debug("Reading Coeffs");const S=await wn(r,b,4);n&&n.debug("Building ABC");const[G,U,rt]=await R2(l,g,z,S,n),H=k==x.s?l.Fr.shift:l.Fr.w[k+1],lt=await x.ifft(G,"","",n,"IFFT_A"),O=await x.batchApplyKey(lt,x.e(1),H),h=await x.fft(O,"","",n,"FFT_A"),A=await x.ifft(U,"","",n,"IFFT_B"),Z=await x.batchApplyKey(A,x.e(1),H),tt=await x.fft(Z,"","",n,"FFT_B"),at=await x.ifft(rt,"","",n,"IFFT_C"),R=await x.batchApplyKey(at,x.e(1),H),C=await x.fft(R,"","",n,"FFT_C");n&&n.debug("Join ABC");const T=await G2(l,g,h,tt,C,n);let V={};n&&n.debug("Reading A Points");const ut=await wn(r,b,5);V.pi_a=await l.G1.multiExpAffine(ut,z,n,"multiexp A"),n&&n.debug("Reading B1 Points");const ct=await wn(r,b,6);let J=await l.G1.multiExpAffine(ct,z,n,"multiexp B1");n&&n.debug("Reading B2 Points");const gt=await wn(r,b,7);V.pi_b=await l.G2.multiExpAffine(gt,z,n,"multiexp B2"),n&&n.debug("Reading C Points");const et=await wn(r,b,8);V.pi_c=await l.G1.multiExpAffine(et,z.slice((g.nPublic+1)*l.Fr.n8),n,"multiexp C"),n&&n.debug("Reading H Points");const st=await wn(r,b,9),Lt=await l.G1.multiExpAffine(st,T,n,"multiexp H"),Ut=l.Fr.random(),mt=l.Fr.random();V.pi_a=F.add(V.pi_a,g.vk_alpha_1),V.pi_a=F.add(V.pi_a,F.timesFr(g.vk_delta_1,Ut)),V.pi_b=I.add(V.pi_b,g.vk_beta_2),V.pi_b=I.add(V.pi_b,I.timesFr(g.vk_delta_2,mt)),J=F.add(J,g.vk_beta_1),J=F.add(J,F.timesFr(g.vk_delta_1,mt)),V.pi_c=F.add(V.pi_c,Lt),V.pi_c=F.add(V.pi_c,F.timesFr(V.pi_a,mt)),V.pi_c=F.add(V.pi_c,F.timesFr(J,Ut)),V.pi_c=F.add(V.pi_c,F.timesFr(g.vk_delta_1,x.neg(x.mul(Ut,mt))));let L=[];for(let a=1;a<=g.nPublic;a++){const w=z.slice(a*x.n8,a*x.n8+x.n8);L.push(Rt.fromRprLE(w))}return V.pi_a=F.toObject(F.toAffine(V.pi_a)),V.pi_b=I.toObject(I.toAffine(V.pi_b)),V.pi_c=F.toObject(F.toAffine(V.pi_c)),V.protocol="groth16",V.curve=l.name,await r.close(),await o.close(),V=Jo(V),L=Jo(L),{proof:V,publicSignals:L}}async function R2(i,t,n,e,o){const s=i.Fr.n8,u=12+t.n8r,r=(e.byteLength-4)/u,b=new Dt(t.domainSize*s),g=new Dt(t.domainSize*s),l=new Dt(t.domainSize*s),x=[b,g];for(let F=0;F<r;F++){o&&F%1e6==0&&o.debug(`QAP AB: ${F}/${r}`);const I=e.slice(4+F*u,4+F*u+u),k=new DataView(I.buffer),z=k.getUint32(0,!0),S=k.getUint32(4,!0),G=k.getUint32(8,!0),U=I.slice(12,12+s);x[z].set(i.Fr.add(x[z].slice(S*s,S*s+s),i.Fr.mul(U,n.slice(G*s,G*s+s))),S*s)}for(let F=0;F<t.domainSize;F++)o&&F%1e6==0&&o.debug(`QAP C: ${F}/${t.domainSize}`),l.set(i.Fr.mul(b.slice(F*s,F*s+s),g.slice(F*s,F*s+s)),F*s);return[b,g,l]}async function G2(i,t,n,e,o,s){const r=i.Fr.n8,b=Math.floor(n.byteLength/i.Fr.n8),g=[];for(let I=0;I<b;I+=4194304){s&&s.debug(`JoinABC: ${I}/${b}`);const k=Math.min(b-I,4194304),z=[],S=n.slice(I*r,(I+k)*r),G=e.slice(I*r,(I+k)*r),U=o.slice(I*r,(I+k)*r);z.push({cmd:"ALLOCSET",var:0,buff:S}),z.push({cmd:"ALLOCSET",var:1,buff:G}),z.push({cmd:"ALLOCSET",var:2,buff:U}),z.push({cmd:"ALLOC",var:3,len:k*r}),z.push({cmd:"CALL",fnName:"qap_joinABC",params:[{var:0},{var:1},{var:2},{val:k},{var:3}]}),z.push({cmd:"CALL",fnName:"frm_batchFromMontgomery",params:[{var:3},{val:k},{var:3}]}),z.push({cmd:"GET",out:0,var:3,len:k*r}),g.push(i.tm.queueAction(z))}const l=await Promise.all(g);let x;n instanceof Dt?x=new Dt(n.byteLength):x=new Uint8Array(n.byteLength);let F=0;for(let I=0;I<l.length;I++)x.set(l[I][0],F),F+=l[I][0].byteLength;return x}function Qc(i){let t=[];return n(t,i),t;function n(e,o){if(Array.isArray(o))for(let s=0;s<o.length;s++)n(e,o[s]);else e.push(o)}}function N2(i,t){let n=BigInt(i)%t;return n<0&&(n+=t),n}function vc(i){const t=BigInt(2)**BigInt(64);let n=BigInt("0xCBF29CE484222325");for(let s=0;s<i.length;s++)n^=BigInt(i[s].charCodeAt(0)),n*=BigInt(1099511628211),n%=t;let e=n.toString(16),o=16-e.length;return e="0".repeat(o).concat(e),e}function K2(i,t){const n=[];let e=BigInt(i);const o=BigInt(4294967296);for(;e;)n.unshift(Number(e%o)),e=e/o;if(t){let s=t-n.length;for(;s>0;)n.unshift(0),s--}return n}async function H2(i,t){let n,e,o;t=t||{};let s=1,u=0,r=0,b=!1;if(i instanceof WebAssembly.Instance)n=i,b=!0;else{let F=32767;if(t.memorySize&&(F=parseInt(t.memorySize),F<0))throw new Error("Invalid memory size");let I=!1;for(;!I;)try{o=new WebAssembly.Memory({initial:F}),I=!0}catch(G){if(F<=1)throw G;console.warn("Could not allocate "+F*1024*64+" bytes. This may cause severe instability. Trying with "+F*1024*64/2+" bytes"),F=Math.floor(F/2)}const k=await WebAssembly.compile(i);let z="",S="";n=await WebAssembly.instantiate(k,{env:{memory:o},runtime:{printDebug:function(G){console.log("printDebug:",G)},exceptionHandler:function(G){let U;throw G===1?U="Signal not found. ":G===2?U="Too many signals set. ":G===3?U="Signal already set. ":G===4?U="Assert Failed. ":G===5?U="Not enough memory. ":G===6?U="Input signal array access exceeds the size. ":U="Unknown error. ",console.error("ERROR: ",G,z),new Error(U+z)},printErrorMessage:function(){z+=l()+`
121
- `},writeBufferMessage:function(){const G=l();G===`
122
- `?(console.log(S),S=""):(S!==""&&(S+=" "),S+=G)},showSharedRWMemory:function(){const G=n.exports.getFieldNumLen32(),U=new Uint32Array(G);for(let rt=0;rt<G;rt++)U[G-1-rt]=n.exports.readSharedRWMemory(rt);if(s>=2&&(u>=1||r>=7)){S!==""&&(S+=" ");const rt=Rt.fromArray(U,4294967296).toString();S+=rt}else console.log(Rt.fromArray(U,4294967296))},error:function(G,U,rt,H,lt,O){let h;throw G===7?h=x(U)+" "+e.getFr(H).toString()+" != "+e.getFr(lt).toString()+" "+x(O):G===9?h=x(U)+" "+e.getFr(H).toString()+" "+x(lt):G===5&&t.sym?h=x(U)+" "+t.sym.labelIdx2Name[lt]:h=x(U)+" "+rt+" "+H+" "+lt+" "+O,console.log("ERROR: ",G,h),new Error(h)},log:function(G){console.log(e.getFr(G).toString())},logGetSignal:function(G,U){t.logGetSignal&&t.logGetSignal(G,e.getFr(U))},logSetSignal:function(G,U){t.logSetSignal&&t.logSetSignal(G,e.getFr(U))},logStartComponent:function(G){t.logStartComponent&&t.logStartComponent(G)},logFinishComponent:function(G){t.logFinishComponent&&t.logFinishComponent(G)}}})}typeof n.exports.getVersion=="function"&&(s=n.exports.getVersion()),typeof n.exports.getMinorVersion=="function"&&(u=n.exports.getMinorVersion()),typeof n.exports.getPatchVersion=="function"&&(r=n.exports.getPatchVersion());const g=t&&(t.sanityCheck||t.logGetSignal||t.logSetSignal||t.logStartComponent||t.logFinishComponent);if(s===2)e=new j2(n,g);else if(s===1){if(b)throw new Error("Loading code from WebAssembly instance is not supported for circom version 1");e=new V2(o,n,g)}else throw new Error(`Unsupported circom version: ${s}`);return e;function l(){let F="",I=n.exports.getMessageChar();for(;I!==0;)F+=String.fromCharCode(I),I=n.exports.getMessageChar();return F}function x(F){const I=new Uint8Array(o.buffer),k=[];for(let z=0;I[F+z]>0;z++)k.push(I[F+z]);return String.fromCharCode.apply(null,k)}}class V2{constructor(t,n,e){this.memory=t,this.i32=new Uint32Array(t.buffer),this.instance=n,this.n32=(this.instance.exports.getFrLen()>>2)-2;const o=this.instance.exports.getPRawPrime(),s=new Array(this.n32);for(let u=0;u<this.n32;u++)s[this.n32-1-u]=this.i32[(o>>2)+u];this.prime=Rt.fromArray(s,4294967296),this.Fr=new Vr(this.prime),this.mask32=Rt.fromString("FFFFFFFF",16),this.NVars=this.instance.exports.getNVars(),this.n64=Math.floor((this.Fr.bitLength-1)/64)+1,this.R=this.Fr.e(Rt.shiftLeft(1,this.n64*64)),this.RInv=this.Fr.inv(this.R),this.sanityCheck=e}circom_version(){return 1}async _doCalculateWitness(t,n){this.instance.exports.init(this.sanityCheck||n?1:0);const e=this.allocInt(),o=this.allocFr();Object.keys(t).forEach(u=>{const r=vc(u),b=parseInt(r.slice(0,8),16),g=parseInt(r.slice(8,16),16);try{this.instance.exports.getSignalOffset32(e,0,b,g)}catch{throw new Error(`Signal ${u} is not an input of the circuit.`)}const l=this.getInt(e),x=Qc(t[u]);for(let F=0;F<x.length;F++)this.setFr(o,x[F]),this.instance.exports.setSignal(0,0,l+F,o)})}async calculateWitness(t,n){const e=this,o=e.i32[0],s=[];await e._doCalculateWitness(t,n);for(let u=0;u<e.NVars;u++){const r=e.instance.exports.getPWitness(u);s.push(e.getFr(r))}return e.i32[0]=o,s}async calculateBinWitness(t,n){const e=this,o=e.i32[0];await e._doCalculateWitness(t,n);const s=e.instance.exports.getWitnessBuffer();e.i32[0]=o;const u=e.memory.buffer.slice(s,s+e.NVars*e.n64*8);return new Uint8Array(u)}allocInt(){const t=this.i32[0];return this.i32[0]=t+8,t}allocFr(){const t=this.i32[0];return this.i32[0]=t+this.n32*4+8,t}getInt(t){return this.i32[t>>2]}setInt(t,n){this.i32[t>>2]=n}getFr(t){const n=this,e=t>>2;if(n.i32[e+1]&2147483648){const s=new Array(n.n32);for(let r=0;r<n.n32;r++)s[n.n32-1-r]=n.i32[e+2+r];const u=n.Fr.e(Rt.fromArray(s,4294967296));return n.i32[e+1]&1073741824?o(u):u}else return n.i32[e]&2147483648?n.Fr.e(n.i32[e]-4294967296):n.Fr.e(n.i32[e]);function o(s){return n.Fr.mul(n.RInv,s)}}setFr(t,n){const e=this;n=e.Fr.e(n);const o=e.Fr.neg(e.Fr.e("80000000",16)),s=e.Fr.e("7FFFFFFF",16);if(e.Fr.geq(n,o)&&e.Fr.leq(n,s)){let r;e.Fr.geq(n,e.Fr.zero)?r=Rt.toNumber(n):(r=Rt.toNumber(e.Fr.sub(n,o)),r=r-2147483648,r=4294967296+r),e.i32[t>>2]=r,e.i32[(t>>2)+1]=0;return}e.i32[t>>2]=0,e.i32[(t>>2)+1]=2147483648;const u=Rt.toArray(n,4294967296);for(let r=0;r<e.n32;r++){const b=u.length-1-r;b>=0?e.i32[(t>>2)+2+r]=u[b]:e.i32[(t>>2)+2+r]=0}}}class j2{constructor(t,n){this.instance=t,this.version=this.instance.exports.getVersion(),this.n32=this.instance.exports.getFieldNumLen32(),this.instance.exports.getRawPrime();const e=new Uint32Array(this.n32);for(let o=0;o<this.n32;o++)e[this.n32-1-o]=this.instance.exports.readSharedRWMemory(o);this.prime=Rt.fromArray(e,4294967296),this.witnessSize=this.instance.exports.getWitnessSize(),this.sanityCheck=n}circom_version(){return this.instance.exports.getVersion()}async _doCalculateWitness(t,n){this.instance.exports.init(this.sanityCheck||n?1:0);const e=Object.keys(t);let o=0;if(e.forEach(s=>{const u=vc(s),r=parseInt(u.slice(0,8),16),b=parseInt(u.slice(8,16),16),g=Qc(t[s]);if(typeof this.instance.exports.getInputSignalSize=="function"){let l=this.instance.exports.getInputSignalSize(r,b);if(l<0)throw new Error(`Signal ${s} not found
123
- `);if(g.length<l)throw new Error(`Not enough values for input signal ${s}
124
- `);if(g.length>l)throw new Error(`Too many values for input signal ${s}
125
- `)}for(let l=0;l<g.length;l++){const x=K2(N2(g[l],this.prime),this.n32);for(let F=0;F<this.n32;F++)this.instance.exports.writeSharedRWMemory(F,x[this.n32-1-F]);try{this.instance.exports.setInputSignal(r,b,l),o++}catch(F){throw new Error(F)}}}),o<this.instance.exports.getInputSize())throw new Error(`Not all inputs have been set. Only ${o} out of ${this.instance.exports.getInputSize()}`)}async calculateWitness(t,n){const e=[];await this._doCalculateWitness(t,n);for(let o=0;o<this.witnessSize;o++){this.instance.exports.getWitness(o);const s=new Uint32Array(this.n32);for(let u=0;u<this.n32;u++)s[this.n32-1-u]=this.instance.exports.readSharedRWMemory(u);e.push(Rt.fromArray(s,4294967296))}return e}async calculateWTNSBin(t,n){const e=new Uint32Array(this.witnessSize*this.n32+this.n32+11),o=new Uint8Array(e.buffer);await this._doCalculateWitness(t,n),o[0]=119,o[1]=116,o[2]=110,o[3]=115,e[1]=2,e[2]=2,e[3]=1;const s=this.n32*4,r=(8+s).toString(16);e[4]=parseInt(r.slice(0,8),16),e[5]=parseInt(r.slice(8,16),16),e[6]=s,this.instance.exports.getRawPrime();let b=7;for(let x=0;x<this.n32;x++)e[b+x]=this.instance.exports.readSharedRWMemory(x);b+=this.n32,e[b]=this.witnessSize,b++,e[b]=2,b++;const l=(s*this.witnessSize).toString(16);e[b]=parseInt(l.slice(0,8),16),e[b+1]=parseInt(l.slice(8,16),16),b+=2;for(let x=0;x<this.witnessSize;x++){this.instance.exports.getWitness(x);for(let F=0;F<this.n32;F++)e[b+F]=this.instance.exports.readSharedRWMemory(F);b+=this.n32}return o}}const{unstringifyBigInts:Y2}=Jt;async function X2(i,t,n,e){const o=Y2(i),s=await Bc(t),u=await s.read(s.totalSize);await s.close();const r=await H2(u,e);if(r.circom_version()===1){const b=await r.calculateBinWitness(o),g=await l2(n,"wtns",2,2);await D2(g,b,r.prime),await g.close()}else{const b=await wc(n),g=await r.calculateWTNSBin(o);await b.write(g),await b.close()}}const{unstringifyBigInts:J2}=Jt;async function Z2(i,t,n,e,o,s){const u=J2(i),r={type:"mem"};return await X2(u,t,r,o),await Pc(n,r,e,s)}const{unstringifyBigInts:ti}=Jt;async function W2(i,t,n,e){const o=ti(i),s=ti(n),u=ti(t),r=await g2(o.curve),b=r.G1.fromObject(o.IC[0]),g=new Uint8Array(r.G1.F.n8*2*u.length),l=new Uint8Array(r.Fr.n8*u.length);if(!td(r,u))return e&&e.error("Public inputs are not valid."),!1;for(let H=0;H<u.length;H++){const lt=r.G1.fromObject(o.IC[H+1]);g.set(lt,H*r.G1.F.n8*2),Rt.toRprLE(l,r.Fr.n8*H,u[H],r.Fr.n8)}let x=await r.G1.multiExpAffine(g,l);x=r.G1.add(x,b);const F=r.G1.fromObject(s.pi_a),I=r.G2.fromObject(s.pi_b),k=r.G1.fromObject(s.pi_c);if(!$2(r,{pi_a:F,pi_b:I,pi_c:k}))return e&&e.error("Proof commitments are not valid."),!1;const z=r.G2.fromObject(o.vk_gamma_2),S=r.G2.fromObject(o.vk_delta_2),G=r.G1.fromObject(o.vk_alpha_1),U=r.G2.fromObject(o.vk_beta_2);return await r.pairingEq(r.G1.neg(F),I,x,z,k,S,G,U)?(e&&e.info("OK!"),!0):(e&&e.error("Invalid proof"),!1)}function $2(i,t){const n=i.G1,e=i.G2;return n.isValid(t.pi_a)&&e.isValid(t.pi_b)&&n.isValid(t.pi_c)}function td(i,t){for(let n=0;n<t.length;n++)if(!Rt.lt(t[n],i.r))return!1;return!0}const{unstringifyBigInts:Zo}=Jt;function ln(i){let t=i.toString(16);for(;t.length<64;)t="0"+t;return t=`"0x${t}"`,t}async function nd(i,t){const n=Zo(i),e=Zo(t);let o="";for(let u=0;u<e.length;u++)o!=""&&(o=o+","),o=o+ln(e[u]);let s;return s=`[${ln(n.pi_a[0])}, ${ln(n.pi_a[1])}],[[${ln(n.pi_b[0][1])}, ${ln(n.pi_b[0][0])}],[${ln(n.pi_b[1][1])}, ${ln(n.pi_b[1][0])}]],[${ln(n.pi_c[0])}, ${ln(n.pi_c[1])}],[${o}]`,s}var ed=Object.freeze({__proto__:null,fullProve:Z2,prove:Pc,verify:W2,exportSolidityCallData:nd});Rt.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16);Rt.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");const{unstringifyBigInts:Xd}=Jt,{stringifyBigInts:Jd}=Jt,{unstringifyBigInts:Zd,stringifyBigInts:Wd}=Jt;var qc={exports:{}};(function(i){(function(){var t="input is invalid type",n="finalize already called",e=typeof window=="object",o=e?window:{};o.JS_SHA3_NO_WINDOW&&(e=!1);var s=!e&&typeof self=="object",u=!o.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;u?o=h2:s&&(o=self);var r=!o.JS_SHA3_NO_COMMON_JS&&!0&&i.exports,b=!o.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",g="0123456789abcdef".split(""),l=[31,7936,2031616,520093696],x=[4,1024,262144,67108864],F=[1,256,65536,16777216],I=[6,1536,393216,100663296],k=[0,8,16,24],z=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],G=[128,256],U=["hex","buffer","arrayBuffer","array","digest"],rt={128:168,256:136};(o.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(L){return Object.prototype.toString.call(L)==="[object Array]"}),b&&(o.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(L){return typeof L=="object"&&L.buffer&&L.buffer.constructor===ArrayBuffer});for(var H=function(L,a,w){return function(c){return new Lt(L,a,L).update(c)[w]()}},lt=function(L,a,w){return function(c,E){return new Lt(L,a,E).update(c)[w]()}},O=function(L,a,w){return function(c,E,m,_){return T["cshake"+L].update(c,E,m,_)[w]()}},h=function(L,a,w){return function(c,E,m,_){return T["kmac"+L].update(c,E,m,_)[w]()}},A=function(L,a,w,c){for(var E=0;E<U.length;++E){var m=U[E];L[m]=a(w,c,m)}return L},Z=function(L,a){var w=H(L,a,"hex");return w.create=function(){return new Lt(L,a,L)},w.update=function(c){return w.create().update(c)},A(w,H,L,a)},tt=function(L,a){var w=lt(L,a,"hex");return w.create=function(c){return new Lt(L,a,c)},w.update=function(c,E){return w.create(E).update(c)},A(w,lt,L,a)},at=function(L,a){var w=rt[L],c=O(L,a,"hex");return c.create=function(E,m,_){return!m&&!_?T["shake"+L].create(E):new Lt(L,a,E).bytepad([m,_],w)},c.update=function(E,m,_,Q){return c.create(m,_,Q).update(E)},A(c,O,L,a)},R=function(L,a){var w=rt[L],c=h(L,a,"hex");return c.create=function(E,m,_){return new Ut(L,a,m).bytepad(["KMAC",_],w).bytepad([E],w)},c.update=function(E,m,_,Q){return c.create(E,_,Q).update(m)},A(c,h,L,a)},C=[{name:"keccak",padding:F,bits:S,createMethod:Z},{name:"sha3",padding:I,bits:S,createMethod:Z},{name:"shake",padding:l,bits:G,createMethod:tt},{name:"cshake",padding:x,bits:G,createMethod:at},{name:"kmac",padding:x,bits:G,createMethod:R}],T={},V=[],ut=0;ut<C.length;++ut)for(var ct=C[ut],J=ct.bits,gt=0;gt<J.length;++gt){var et=ct.name+"_"+J[gt];if(V.push(et),T[et]=ct.createMethod(J[gt],ct.padding),ct.name!=="sha3"){var st=ct.name+J[gt];V.push(st),T[st]=T[et]}}function Lt(L,a,w){this.blocks=[],this.s=[],this.padding=a,this.outputBits=w,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(L<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=w>>5,this.extraBytes=(w&31)>>3;for(var c=0;c<50;++c)this.s[c]=0}Lt.prototype.update=function(L){if(this.finalized)throw new Error(n);var a,w=typeof L;if(w!=="string"){if(w==="object"){if(L===null)throw new Error(t);if(b&&L.constructor===ArrayBuffer)L=new Uint8Array(L);else if(!Array.isArray(L)&&(!b||!ArrayBuffer.isView(L)))throw new Error(t)}else throw new Error(t);a=!0}for(var c=this.blocks,E=this.byteCount,m=L.length,_=this.blockCount,Q=0,nt=this.s,X,ft;Q<m;){if(this.reset)for(this.reset=!1,c[0]=this.block,X=1;X<_+1;++X)c[X]=0;if(a)for(X=this.start;Q<m&&X<E;++Q)c[X>>2]|=L[Q]<<k[X++&3];else for(X=this.start;Q<m&&X<E;++Q)ft=L.charCodeAt(Q),ft<128?c[X>>2]|=ft<<k[X++&3]:ft<2048?(c[X>>2]|=(192|ft>>6)<<k[X++&3],c[X>>2]|=(128|ft&63)<<k[X++&3]):ft<55296||ft>=57344?(c[X>>2]|=(224|ft>>12)<<k[X++&3],c[X>>2]|=(128|ft>>6&63)<<k[X++&3],c[X>>2]|=(128|ft&63)<<k[X++&3]):(ft=65536+((ft&1023)<<10|L.charCodeAt(++Q)&1023),c[X>>2]|=(240|ft>>18)<<k[X++&3],c[X>>2]|=(128|ft>>12&63)<<k[X++&3],c[X>>2]|=(128|ft>>6&63)<<k[X++&3],c[X>>2]|=(128|ft&63)<<k[X++&3]);if(this.lastByteIndex=X,X>=E){for(this.start=X-E,this.block=c[_],X=0;X<_;++X)nt[X]^=c[X];mt(nt),this.reset=!0}else this.start=X}return this},Lt.prototype.encode=function(L,a){var w=L&255,c=1,E=[w];for(L=L>>8,w=L&255;w>0;)E.unshift(w),L=L>>8,w=L&255,++c;return a?E.push(c):E.unshift(c),this.update(E),E.length},Lt.prototype.encodeString=function(L){var a,w=typeof L;if(w!=="string"){if(w==="object"){if(L===null)throw new Error(t);if(b&&L.constructor===ArrayBuffer)L=new Uint8Array(L);else if(!Array.isArray(L)&&(!b||!ArrayBuffer.isView(L)))throw new Error(t)}else throw new Error(t);a=!0}var c=0,E=L.length;if(a)c=E;else for(var m=0;m<L.length;++m){var _=L.charCodeAt(m);_<128?c+=1:_<2048?c+=2:_<55296||_>=57344?c+=3:(_=65536+((_&1023)<<10|L.charCodeAt(++m)&1023),c+=4)}return c+=this.encode(c*8),this.update(L),c},Lt.prototype.bytepad=function(L,a){for(var w=this.encode(a),c=0;c<L.length;++c)w+=this.encodeString(L[c]);var E=a-w%a,m=[];return m.length=E,this.update(m),this},Lt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var L=this.blocks,a=this.lastByteIndex,w=this.blockCount,c=this.s;if(L[a>>2]|=this.padding[a&3],this.lastByteIndex===this.byteCount)for(L[0]=L[w],a=1;a<w+1;++a)L[a]=0;for(L[w-1]|=2147483648,a=0;a<w;++a)c[a]^=L[a];mt(c)}},Lt.prototype.toString=Lt.prototype.hex=function(){this.finalize();for(var L=this.blockCount,a=this.s,w=this.outputBlocks,c=this.extraBytes,E=0,m=0,_="",Q;m<w;){for(E=0;E<L&&m<w;++E,++m)Q=a[E],_+=g[Q>>4&15]+g[Q&15]+g[Q>>12&15]+g[Q>>8&15]+g[Q>>20&15]+g[Q>>16&15]+g[Q>>28&15]+g[Q>>24&15];m%L===0&&(mt(a),E=0)}return c&&(Q=a[E],_+=g[Q>>4&15]+g[Q&15],c>1&&(_+=g[Q>>12&15]+g[Q>>8&15]),c>2&&(_+=g[Q>>20&15]+g[Q>>16&15])),_},Lt.prototype.arrayBuffer=function(){this.finalize();var L=this.blockCount,a=this.s,w=this.outputBlocks,c=this.extraBytes,E=0,m=0,_=this.outputBits>>3,Q;c?Q=new ArrayBuffer(w+1<<2):Q=new ArrayBuffer(_);for(var nt=new Uint32Array(Q);m<w;){for(E=0;E<L&&m<w;++E,++m)nt[m]=a[E];m%L===0&&mt(a)}return c&&(nt[E]=a[E],Q=Q.slice(0,_)),Q},Lt.prototype.buffer=Lt.prototype.arrayBuffer,Lt.prototype.digest=Lt.prototype.array=function(){this.finalize();for(var L=this.blockCount,a=this.s,w=this.outputBlocks,c=this.extraBytes,E=0,m=0,_=[],Q,nt;m<w;){for(E=0;E<L&&m<w;++E,++m)Q=m<<2,nt=a[E],_[Q]=nt&255,_[Q+1]=nt>>8&255,_[Q+2]=nt>>16&255,_[Q+3]=nt>>24&255;m%L===0&&mt(a)}return c&&(Q=m<<2,nt=a[E],_[Q]=nt&255,c>1&&(_[Q+1]=nt>>8&255),c>2&&(_[Q+2]=nt>>16&255)),_};function Ut(L,a,w){Lt.call(this,L,a,w)}Ut.prototype=new Lt,Ut.prototype.finalize=function(){return this.encode(this.outputBits,!0),Lt.prototype.finalize.call(this)};var mt=function(L){var a,w,c,E,m,_,Q,nt,X,ft,Bt,pt,wt,Qt,At,_t,It,vt,zt,Gt,Kt,B,p,y,M,D,j,P,d,f,q,N,v,Y,K,$,it,ot,W,dt,bt,yt,ht,Et,Ft,qt,xt,St,Ct,kt,Xt,tn,Sn,hn,_n,Un,pn,Ln,On,sn,an,mn,ue;for(c=0;c<48;c+=2)E=L[0]^L[10]^L[20]^L[30]^L[40],m=L[1]^L[11]^L[21]^L[31]^L[41],_=L[2]^L[12]^L[22]^L[32]^L[42],Q=L[3]^L[13]^L[23]^L[33]^L[43],nt=L[4]^L[14]^L[24]^L[34]^L[44],X=L[5]^L[15]^L[25]^L[35]^L[45],ft=L[6]^L[16]^L[26]^L[36]^L[46],Bt=L[7]^L[17]^L[27]^L[37]^L[47],pt=L[8]^L[18]^L[28]^L[38]^L[48],wt=L[9]^L[19]^L[29]^L[39]^L[49],a=pt^(_<<1|Q>>>31),w=wt^(Q<<1|_>>>31),L[0]^=a,L[1]^=w,L[10]^=a,L[11]^=w,L[20]^=a,L[21]^=w,L[30]^=a,L[31]^=w,L[40]^=a,L[41]^=w,a=E^(nt<<1|X>>>31),w=m^(X<<1|nt>>>31),L[2]^=a,L[3]^=w,L[12]^=a,L[13]^=w,L[22]^=a,L[23]^=w,L[32]^=a,L[33]^=w,L[42]^=a,L[43]^=w,a=_^(ft<<1|Bt>>>31),w=Q^(Bt<<1|ft>>>31),L[4]^=a,L[5]^=w,L[14]^=a,L[15]^=w,L[24]^=a,L[25]^=w,L[34]^=a,L[35]^=w,L[44]^=a,L[45]^=w,a=nt^(pt<<1|wt>>>31),w=X^(wt<<1|pt>>>31),L[6]^=a,L[7]^=w,L[16]^=a,L[17]^=w,L[26]^=a,L[27]^=w,L[36]^=a,L[37]^=w,L[46]^=a,L[47]^=w,a=ft^(E<<1|m>>>31),w=Bt^(m<<1|E>>>31),L[8]^=a,L[9]^=w,L[18]^=a,L[19]^=w,L[28]^=a,L[29]^=w,L[38]^=a,L[39]^=w,L[48]^=a,L[49]^=w,Qt=L[0],At=L[1],qt=L[11]<<4|L[10]>>>28,xt=L[10]<<4|L[11]>>>28,P=L[20]<<3|L[21]>>>29,d=L[21]<<3|L[20]>>>29,sn=L[31]<<9|L[30]>>>23,an=L[30]<<9|L[31]>>>23,yt=L[40]<<18|L[41]>>>14,ht=L[41]<<18|L[40]>>>14,Y=L[2]<<1|L[3]>>>31,K=L[3]<<1|L[2]>>>31,_t=L[13]<<12|L[12]>>>20,It=L[12]<<12|L[13]>>>20,St=L[22]<<10|L[23]>>>22,Ct=L[23]<<10|L[22]>>>22,f=L[33]<<13|L[32]>>>19,q=L[32]<<13|L[33]>>>19,mn=L[42]<<2|L[43]>>>30,ue=L[43]<<2|L[42]>>>30,hn=L[5]<<30|L[4]>>>2,_n=L[4]<<30|L[5]>>>2,$=L[14]<<6|L[15]>>>26,it=L[15]<<6|L[14]>>>26,vt=L[25]<<11|L[24]>>>21,zt=L[24]<<11|L[25]>>>21,kt=L[34]<<15|L[35]>>>17,Xt=L[35]<<15|L[34]>>>17,N=L[45]<<29|L[44]>>>3,v=L[44]<<29|L[45]>>>3,y=L[6]<<28|L[7]>>>4,M=L[7]<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=tn^~Et&qt,L[39]=Sn^~Ft&xt,L[48]=mn^~hn&Un,L[49]=ue^~_n&pn,L[0]^=z[c],L[1]^=z[c+1]};if(r)i.exports=T;else for(ut=0;ut<V.length;++ut)o[V[ut]]=T[V[ut]]})()})(qc);var id=qc.exports;const{keccak256:$d}=id,{stringifyBigInts:tu}=Jt,{unstringifyBigInts:nu}=Jt,{unstringifyBigInts:eu}=Jt,{unstringifyBigInts:iu}=Jt,{stringifyBigInts:ou}=Jt,{unstringifyBigInts:au}=Jt,{unstringifyBigInts:cu}=Jt,{unstringifyBigInts:su}=Jt;function Wo(i){if(!Number.isSafeInteger(i)||i<0)throw new Error(`Wrong positive integer: ${i}`)}function Tc(i,...t){if(!(i instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(i.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${i.length}`)}function $o(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function od(i,t){Tc(i);const n=t.outputLen;if(i.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const ad=i=>i instanceof Uint8Array,cd=i=>new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)),sd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!sd)throw new Error("Non little-endian hardware is not supported");function rd(i){if(typeof i!="string")throw new Error(`utf8ToBytes expected string, got ${typeof i}`);return new Uint8Array(new TextEncoder().encode(i))}function kc(i){if(typeof i=="string"&&(i=rd(i)),!ad(i))throw new Error(`expected Uint8Array, got ${typeof i}`);return i}class ld{clone(){return this._cloneInto()}}function dd(i){const t=e=>i().update(kc(e)).digest(),n=i();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>i(),t}const be=BigInt(2**32-1),ta=BigInt(32);function ud(i,t=!1){return t?{h:Number(i&be),l:Number(i>>ta&be)}:{h:Number(i>>ta&be)|0,l:Number(i&be)|0}}function fd(i,t=!1){let n=new Uint32Array(i.length),e=new Uint32Array(i.length);for(let o=0;o<i.length;o++){const{h:s,l:u}=ud(i[o],t);[n[o],e[o]]=[s,u]}return[n,e]}const gd=(i,t,n)=>i<<n|t>>>32-n,hd=(i,t,n)=>t<<n|i>>>32-n,_d=(i,t,n)=>t<<n-32|i>>>64-n,pd=(i,t,n)=>i<<n-32|t>>>64-n,Ld="6.13.4";function na(i,t,n){for(let e in t){let o=t[e];Object.defineProperty(i,e,{enumerable:!0,value:o,writable:!1})}}function Qn(i){if(i==null)return"null";if(Array.isArray(i))return"[ "+i.map(Qn).join(", ")+" ]";if(i instanceof Uint8Array){const t="0123456789abcdef";let n="0x";for(let e=0;e<i.length;e++)n+=t[i[e]>>4],n+=t[i[e]&15];return n}if(typeof i=="object"&&typeof i.toJSON=="function")return Qn(i.toJSON());switch(typeof i){case"boolean":case"symbol":return i.toString();case"bigint":return BigInt(i).toString();case"number":return i.toString();case"string":return JSON.stringify(i);case"object":{const t=Object.keys(i);return t.sort(),"{ "+t.map(n=>`${Qn(n)}: ${Qn(i[n])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Ad(i,t,n){let e=i;{const s=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${Qn(n)}`);for(const u in n){if(u==="shortMessage")continue;const r=n[u];s.push(u+"="+Qn(r))}}s.push(`code=${t}`),s.push(`version=${Ld}`),s.length&&(i+=" ("+s.join(", ")+")")}let o;switch(t){case"INVALID_ARGUMENT":o=new TypeError(i);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":o=new RangeError(i);break;default:o=new Error(i)}return na(o,{code:t}),n&&Object.assign(o,n),o.shortMessage==null&&na(o,{shortMessage:e}),o}function qe(i,t,n,e){if(!i)throw Ad(t,n,e)}function on(i,t,n,e){qe(i,t,"INVALID_ARGUMENT",{argument:n,value:e})}["NFD","NFC","NFKD","NFKC"].reduce((i,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");i.push(t)}catch{}return i},[]);function yd(i,t,n){if(i instanceof Uint8Array)return i;if(typeof i=="string"&&i.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const e=new Uint8Array((i.length-2)/2);let o=2;for(let s=0;s<e.length;s++)e[s]=parseInt(i.substring(o,o+2),16),o+=2;return e}on(!1,"invalid BytesLike value",t||"value",i)}function Yi(i,t){return yd(i,t)}const ea="0123456789abcdef";function Dc(i){const t=Yi(i);let n="0x";for(let e=0;e<t.length;e++){const o=t[e];n+=ea[(o&240)>>4]+ea[o&15]}return n}function Id(i,t,n){const e=Yi(i);qe(t>=e.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(e),length:t,offset:t+1});const o=new Uint8Array(t);return o.fill(0),o.set(e,0),Dc(o)}function bd(i,t){return Id(i,t)}const Cd=BigInt(0);BigInt(1);const vn=9007199254740991;function zc(i,t){switch(typeof i){case"bigint":return i;case"number":return on(Number.isInteger(i),"underflow",t||"value",i),on(i>=-vn&&i<=vn,"overflow",t||"value",i),BigInt(i);case"string":try{if(i==="")throw new Error("empty string");return i[0]==="-"&&i[1]!=="-"?-BigInt(i.substring(1)):BigInt(i)}catch(n){on(!1,`invalid BigNumberish string: ${n.message}`,t||"value",i)}}on(!1,"invalid BigNumberish value",t||"value",i)}function md(i,t){const n=zc(i,t);return qe(n>=Cd,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:i}),n}const ia="0123456789abcdef";function oa(i){if(i instanceof Uint8Array){let t="0x0";for(const n of i)t+=ia[n>>4],t+=ia[n&15];return BigInt(t)}return zc(i)}function Rc(i,t){switch(typeof i){case"bigint":return on(i>=-vn&&i<=vn,"overflow",t,i),Number(i);case"number":return on(Number.isInteger(i),"underflow",t,i),on(i>=-vn&&i<=vn,"overflow",t,i),i;case"string":try{if(i==="")throw new Error("empty string");return Rc(BigInt(i),t)}catch(n){on(!1,`invalid numeric string: ${n.message}`,t,i)}}on(!1,"invalid numeric value",t,i)}function wd(i,t){let e=md(i,"value").toString(16);{const o=Rc(t,"width");for(qe(o*2>=e.length,`value exceeds width (${o} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:i});e.length<o*2;)e="0"+e}return"0x"+e}function Bd(i,t){on(typeof i=="string","invalid string value","str",i);let n=[];for(let e=0;e<i.length;e++){const o=i.charCodeAt(e);if(o<128)n.push(o);else if(o<2048)n.push(o>>6|192),n.push(o&63|128);else if((o&64512)==55296){e++;const s=i.charCodeAt(e);on(e<i.length&&(s&64512)===56320,"invalid surrogate pair","str",i);const u=65536+((o&1023)<<10)+(s&1023);n.push(u>>18|240),n.push(u>>12&63|128),n.push(u>>6&63|128),n.push(u&63|128)}else n.push(o>>12|224),n.push(o>>6&63|128),n.push(o&63|128)}return new Uint8Array(n)}const[Gc,Nc,Kc]=[[],[],[]],Ed=BigInt(0),Jn=BigInt(1),xd=BigInt(2),Fd=BigInt(7),Sd=BigInt(256),Ud=BigInt(113);for(let i=0,t=Jn,n=1,e=0;i<24;i++){[n,e]=[e,(2*n+3*e)%5],Gc.push(2*(5*e+n)),Nc.push((i+1)*(i+2)/2%64);let o=Ed;for(let s=0;s<7;s++)t=(t<<Jn^(t>>Fd)*Ud)%Sd,t&xd&&(o^=Jn<<(Jn<<BigInt(s))-Jn);Kc.push(o)}const[Od,Md]=fd(Kc,!0),aa=(i,t,n)=>n>32?_d(i,t,n):gd(i,t,n),ca=(i,t,n)=>n>32?pd(i,t,n):hd(i,t,n);function Pd(i,t=24){const n=new Uint32Array(10);for(let e=24-t;e<24;e++){for(let u=0;u<10;u++)n[u]=i[u]^i[u+10]^i[u+20]^i[u+30]^i[u+40];for(let u=0;u<10;u+=2){const r=(u+8)%10,b=(u+2)%10,g=n[b],l=n[b+1],x=aa(g,l,1)^n[r],F=ca(g,l,1)^n[r+1];for(let I=0;I<50;I+=10)i[u+I]^=x,i[u+I+1]^=F}let o=i[2],s=i[3];for(let u=0;u<24;u++){const r=Nc[u],b=aa(o,s,r),g=ca(o,s,r),l=Gc[u];o=i[l],s=i[l+1],i[l]=b,i[l+1]=g}for(let u=0;u<50;u+=10){for(let r=0;r<10;r++)n[r]=i[u+r];for(let r=0;r<10;r++)i[u+r]^=~n[(r+2)%10]&n[(r+4)%10]}i[0]^=Od[e],i[1]^=Md[e]}n.fill(0)}class Xi extends ld{constructor(t,n,e,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=e,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Wo(e),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=cd(this.state)}keccak(){Pd(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){$o(this);const{blockLen:n,state:e}=this;t=kc(t);const o=t.length;for(let s=0;s<o;){const u=Math.min(n-this.pos,o-s);for(let r=0;r<u;r++)e[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:e,blockLen:o}=this;t[e]^=n,(n&128)!==0&&e===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){$o(this,!1),Tc(t),this.finish();const n=this.state,{blockLen:e}=this;for(let o=0,s=t.length;o<s;){this.posOut>=e&&this.keccak();const u=Math.min(e-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+u),o),this.posOut+=u,o+=u}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Wo(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(od(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:e,outputLen:o,rounds:s,enableXOF:u}=this;return t||(t=new Xi(n,e,o,u,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=e,t.outputLen=o,t.enableXOF=u,t.destroyed=this.destroyed,t}}const Qd=(i,t,n)=>dd(()=>new Xi(t,i,n)),vd=Qd(1,136,256/8);let Hc=!1;const Vc=function(i){return vd(i)};let jc=Vc;function de(i){const t=Yi(i,"data");return Dc(jc(t))}de._=Vc;de.lock=function(){Hc=!0};de.register=function(i){if(Hc)throw new TypeError("keccak256 is locked");jc=i};Object.freeze(de);function qd(i){const t=Bd(i);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return bd(t,32)}function sa(i){return(BigInt(de(wd(i,32)))>>8n).toString()}function ra(i){try{return oa(i)}catch(t){if(typeof i=="string")return oa(qd(i));throw TypeError(t instanceof Error?t.message:t.toString())}}async function Td(i,t,n,e,o,s){pe(i,"identity"),pe(t,"groupOrMerkleProof"),pe(n,"message"),pe(e,"scope"),ze(i,"identity"),ze(t,"groupOrMerkleProof"),ci(n,"message",["string","bigint","number","Uint8Array"]),ci(e,"scope",["string","bigint","number","Uint8Array"]),o&&Ws(o,"merkleTreeDepth"),s&&ze(s,"snarkArtifacts"),n=ra(n),e=ra(e);let u;if("siblings"in t)u=t;else{const I=t.indexOf(i.commitment);u=t.generateMerkleProof(I)}const r=u.siblings.length;if(o!==void 0){if(o<co||o>so)throw new TypeError(`The tree depth must be a number between ${co} and ${so}`)}else o=r!==0?r:1;s??(s=await _r(Ee.SEMAPHORE,{parameters:[o],version:"4.13.0"}));const{wasm:b,zkey:g}=s,l=u.siblings;for(let I=0;I<o;I+=1)l[I]===void 0&&(l[I]=0n);const{proof:x,publicSignals:F}=await ed.fullProve({secret:i.secretScalar,merkleProofLength:r,merkleProofIndex:u.index,merkleProofSiblings:l,scope:sa(e),message:sa(n)},b,g);return{merkleTreeDepth:o,merkleTreeRoot:u.root.toString(),nullifier:F[1],message:n.toString(),scope:e.toString(),points:ur(x)}}const kd=(i,t,n,e)=>ie(Ii([{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[i,t,n,e])),Dd=(i,t)=>BigInt(ie(Ii([{type:"bytes32"},{type:"uint256"}],[i,t]))),ru=(i,t)=>BigInt(ie(Ii([{type:"bytes32"},{type:"address"}],[i,t]))),zd={name:"Joined",type:"event",inputs:[{name:"app_id",type:"bytes32",indexed:!0},{name:"epoch",type:"uint256",indexed:!0},{name:"commitment",type:"uint256",indexed:!1}]};async function lu(i){const t=await i.signMessage({message:"fangorn:identity:v1"});return new vi(ie(t))}function du(i,t){const n=ie(Yc(["string","bytes32","bytes32"],["fangorn:stealth:",la(i.secretScalar,{size:32}),t]));return{holder:Xc(n).address,key:n}}async function uu({wallet:i,identity:t,registry:n,appId:e,epoch:o,price:s,usdc:u,chainId:r,usdcName:b="USD Coin",usdcVersion:g="2",validForSeconds:l=3600}){const x=t.commitment,F=la(crypto.getRandomValues(new Uint8Array(32))),I=kd(e,o,x,F),k=0n,z=BigInt(Math.floor(Date.now()/1e3)+l),S=await i.signTypedData({domain:{name:b,version:g,chainId:r,verifyingContract:u},types:{ReceiveWithAuthorization:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"validAfter",type:"uint256"},{name:"validBefore",type:"uint256"},{name:"nonce",type:"bytes32"}]},primaryType:"ReceiveWithAuthorization",message:{from:i.address,to:n,value:s,validAfter:k,validBefore:z,nonce:I}}),G=Jc(S);return{appId:e,commitment:x.toString(),salt:F,payment:{from:i.address,value:s.toString(),validAfter:k.toString(),validBefore:z.toString(),nonce:I,v:Number(G.v??BigInt(27+(G.yParity??0))),r:G.r,s:G.s}}}async function fu({publicClient:i,registry:t,identity:n,appId:e,epoch:o,holder:s,fromBlock:u=0n}){const r=await i.getLogs({address:t,event:zd,args:{app_id:e,epoch:o},fromBlock:u}),b=new qi(r.map(l=>l.args.commitment));if(b.indexOf(n.commitment)<0)throw new Error("this identity has not joined that group: did the join land?");const g=await Td(n,b,BigInt(s),Dd(e,o));return{appId:e,epoch:o.toString(),holder:s,merkleTreeDepth:g.merkleTreeDepth.toString(),merkleTreeRoot:g.merkleTreeRoot.toString(),nullifier:g.nullifier.toString(),points:g.points.map(String)}}export{fu as buildClaim,du as holderFor,lu as identityFrom,Dd as membershipScope,ru as membershipTokenId,uu as signJoin};